Updating version number to 4.3-dev after release of 4.3.0RC1
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_clipboard.php
old mode 100755 (executable)
new mode 100644 (file)
index d2f5cc6..b82a1c0
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -338,18 +338,18 @@ class t3lib_clipboard {
                }
                                // Edit:
                if (!$this->fileMode && $elCount)       {
-                       $opt[]='<option value="'.htmlspecialchars("window.location.href='".$this->editUrl()."&returnUrl='+top.rawurlencode(window.location.href);").'">'.$this->clLabel('edit','rm').'</option>';
+                       $opt[]='<option value="' . htmlspecialchars("window.location.href='" . $this->editUrl() . "&returnUrl='+top.rawurlencode(window.location.href);") . '">' . $this->clLabel('edit', 'rm') . '</option>';
                }
                                // Delete:
                if ($elCount)   {
                        if($GLOBALS['BE_USER']->jsConfirmation(4))      {
                                $js = "
                        if(confirm(".$GLOBALS['LANG']->JScharCode(sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.deleteClip'),$elCount)).")){
-                               window.location.href='".$this->deleteUrl(0,$this->fileMode?1:0)."&redirect='+top.rawurlencode(window.location.href);
+                               window.location.href='" . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . "&redirect='+top.rawurlencode(window.location.href);
                        }
                                        ";
                        } else {
-                               $js = " window.location.href='".$this->deleteUrl(0,$this->fileMode?1:0)."&redirect='+top.rawurlencode(window.location.href); ";
+                               $js = " window.location.href='" . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . "&redirect='+top.rawurlencode(window.location.href); ";
                        }
                        $opt[]='<option value="'.htmlspecialchars($js).'">'.$this->clLabel('delete','rm').'</option>';
                }
@@ -466,6 +466,12 @@ class t3lib_clipboard {
                                                                        '<a href="'.htmlspecialchars($this->removeUrl($table,$uid)).'#clip_head"><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/close_12h.gif','width="11" height="12"').' border="0" title="'.$this->clLabel('removeItem').'" alt="" /></a>'.
                                                                        '</td>
                                                                </tr>';
+
+                                                       $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad);
+                                                       if ($localizationData) {
+                                                               $lines[] = $localizationData;
+                                                       }
+
                                                } else {
                                                        unset($this->clipData[$pad]['el'][$k]);
                                                        $this->changed=1;
@@ -486,6 +492,58 @@ class t3lib_clipboard {
                return $lines;
        }
 
+
+       /**
+        * Gets all localizations of the current record.
+        *
+        * @param       string          the table
+        * @param       array           the current record
+        * @return      string          HTML table rows
+        */
+       function getLocalizations($table, $parentRec, $bgColClass, $pad) {
+               $lines = array();
+               $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
+
+               if ($table != 'pages' && t3lib_BEfunc::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
+                       $where = array();
+                       $where[] = $tcaCtrl['transOrigPointerField'] . '=' . intval($parentRec['uid']);
+                       $where[] = $tcaCtrl['languageField'] . '!=0';
+
+                       if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
+                               $where[] = $tcaCtrl['delete'] . '=0';
+                       }
+
+                       if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
+                               $where[] = 't3ver_wsid=' . $parentRec['t3ver_wsid'];
+                       }
+
+                       $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', $table, implode(' AND ', $where));
+
+                       if (is_array($rows)) {
+                               $modeData = '';
+                               if ($pad == 'normal') {
+                                       $mode = ($this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut');
+                                       $modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
+                               }
+
+                               foreach ($rows as $rec) {
+                                       $lines[]='
+                                       <tr>
+                                               <td class="' . $bgColClass . '">' .
+                                                       t3lib_iconWorks::getIconImage($table, $rec, $this->backPath,' style="margin-left: 38px;"') . '</td>
+                                               <td class="' . $bgColClass . '" nowrap="nowrap" width="95%">&nbsp;' . htmlspecialchars(
+                                                               t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])) .
+                                                               $modeData . '&nbsp;</td>
+                                               <td class="' . $bgColClass . '" align="center" nowrap="nowrap">&nbsp;</td>
+                                       </tr>';
+                               }
+                       }
+               }
+               return implode('',$lines);
+       }
+
+
+
        /**
         * Wraps title of pad in bold-tags and maybe the number of elements if any.
         *
@@ -1021,4 +1079,5 @@ class t3lib_clipboard {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_clipboard.php'])        {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_clipboard.php']);
 }
+
 ?>