Fixed bug #12271: List module and Clickmenu should not enable to create inconsistant...
authorRupert Germann <rupi@gmx.li>
Tue, 20 Oct 2009 20:30:05 +0000 (20:30 +0000)
committerRupert Germann <rupi@gmx.li>
Tue, 20 Oct 2009 20:30:05 +0000 (20:30 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6197 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/alt_clickmenu.php
typo3/class.db_list_extra.inc

index c146625..b1081d7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
 
 2009-10-20  Rupert Germann  <rupi@gmx.li>
 
+       * Fixed bug #12271: List module and Clickmenu should not enable to create inconsistant record-relations (thanks to Tolleiv Nietsch)
        * Fixed bug #12269: List module renders wrong data in localization view when record-overlay was moved in WS (thanks to Tolleiv Nietsch)
        * Fixed bug #8817: Copying Content Elements does not copy Language Overlays (thanks to Tolleiv Nietsch)
        * Fixed bug #2314: When moving records the translation do not move with it (thanks to Tolleiv Nietsch)
index e6e67fa..814dd23 100644 (file)
@@ -267,6 +267,11 @@ class clickMenu {
                        $DBmount = TRUE;
                }
 
+               $l10nOverlay = false;
+               if ($table != 'pages_language_overlay' && array_key_exists('transOrigPointerField', $TCA[$table]['ctrl'])) {
+                       $l10nOverlay = intval($this->rec[$TCA[$table]['ctrl']['transOrigPointerField']]) != 0;
+               }
+
                        // If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
                if (is_array($this->rec) || $root)      {
 
@@ -297,9 +302,9 @@ class clickMenu {
                        $menuItems['spacer1']='spacer';
 
                                // Copy:
-                       if(!in_array('copy',$this->disabledItems) && !$root && !$DBmount)       $menuItems['copy']=$this->DB_copycut($table,$uid,'copy');
+                       if (!in_array('copy', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay)    $menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
                                // Cut:
-                       if(!in_array('cut',$this->disabledItems) && !$root && !$DBmount)        $menuItems['cut']=$this->DB_copycut($table,$uid,'cut');
+                       if (!in_array('cut', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay)     $menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
 
                                // Paste:
                        $elFromAllTables = count($this->clipObj->elFromTable(''));
index 065dc22..06cf1ed 100644 (file)
@@ -1340,17 +1340,18 @@ class localRecordList extends recordList {
                $cells=array();
 
                $cells['pasteAfter'] = $cells['pasteInto'] = $this->spaceIcon;
-
+                       //enables to hide the copy, cut and paste icons for localized records - doesn't make much sense to perform these options for them
+               $isL10nOverlay = $this->localizationView && $table != 'pages_language_overlay' && $row[$TCA[$table]['ctrl']['transOrigPointerField']] != 0;
                        // Return blank, if disabled:
                        // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
                if ($this->clipObj->current=='normal')  {       // For the "Normal" pad:
 
                                // Show copy/cut icons:
                        $isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
-                       $cells['copy']='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'">'.
+                       $cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_copy'.($isSel=='copy'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy',1).'" alt="" />'.
                                        '</a>';
-                       $cells['cut']='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'">'.
+                       $cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_cut'.($isSel=='cut'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut',1).'" alt="" />'.
                                        '</a>';
 
@@ -1373,13 +1374,13 @@ class localRecordList extends recordList {
                        }
 
                                // Adding the checkbox to the panel:
-                       $cells['select']='<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
+                       $cells['select'] = $isL10nOverlay ? $this->spaceIcon : '<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
                }
 
                        // Now, looking for selected elements from the current table:
                $elFromTable = $this->clipObj->elFromTable($table);
                if (count($elFromTable) && $TCA[$table]['ctrl']['sortby'])      {       // IF elements are found and they can be individually ordered, then add a "paste after" icon:
-                       $cells['pasteAfter']='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'">'.
+                       $cells['pasteAfter'] = $isL10nOverlay ? $this->spaceIcon : '<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteAfter',1).'" alt="" />'.
                                        '</a>';
                }