Index: alt_clickmenu.php =================================================================== RCS file: /cvsroot/typo3/TYPO3core/typo3/alt_clickmenu.php,v retrieving revision 1.34 diff -u -r1.34 alt_clickmenu.php --- alt_clickmenu.php 19 Dec 2005 20:29:26 -0000 1.34 +++ alt_clickmenu.php 18 Jan 2006 00:35:06 -0000 @@ -167,6 +167,15 @@ ini_set('display_errors',0); // XML has to be parsed, no parse errors allowed } + // Deal with Drag&Drop context menus + if (strcmp(t3lib_div::_GP('dragDrop'),'')) { + $this->iParts[0] = t3lib_div::_GP('dragDrop'); + $this->iParts[1] = t3lib_div::_GP('srcId'); + $this->iParts[2] = t3lib_div::_GP('dstId'); + $CMcontent = $this->printDragDropClickMenu($this->iParts[0],$this->iParts[1],$this->iParts[2]); + return $CMcontent; + } + // can be set differently as well $this->iParts[0] = t3lib_div::_GP('table'); $this->iParts[1] = t3lib_div::_GP('uid'); @@ -982,6 +991,117 @@ + /*************************************** + * + * DRAG'N DROP + * + ***************************************/ + + /** + * Make 1st level clickmenu: + * + * @param string The absolute path + * @param integer UID for the current record. + * @return string HTML content + */ + function printDragDropClickMenu($table,$srcId,$dstId) { + $menuItems=array(); + + // If the drag and drop menu should apply to PAGES use this set of menu items + if ($table == 'pages') { + // Move Into: + $menuItems['movePage_into']=$this->DRAGDROP_copymovepage($srcId,$dstId,'move','into'); + // Move After: + $menuItems['movePage_after']=$this->DRAGDROP_copymovepage($srcId,$dstId,'move','after'); + // Copy Into: + $menuItems['copyPage_into']=$this->DRAGDROP_copymovepage($srcId,$dstId,'copy','into'); + // Copy After: + $menuItems['copyPage_after']=$this->DRAGDROP_copymovepage($srcId,$dstId,'copy','after'); + } + + // If the drag and drop menu should apply to FOLDERS use this set of menu items + if ($table == 'folders') { + // Move Into: + $menuItems['moveFolder_into']=$this->DRAGDROP_copymovefolder($srcId,$dstId,'move'); + // Copy Into: + $menuItems['copyFolder_into']=$this->DRAGDROP_copymovefolder($srcId,$dstId,'copy'); + } + + // Adding external elements to the menuItems array + $menuItems = $this->processingByExtClassArray($menuItems,"dragDrop_".$table,$uid); // to extend this, you need to apply a Context Menu to a "virtual" table called "dragDrop_pages" or similar + + // Processing by external functions? + $menuItems = $this->externalProcessingOfDBMenuItems($menuItems); + + // Return the printed elements: + return $this->printItems($menuItems, + $root? + 'PH_backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']): + t3lib_iconWorks::getIconImage($table,$this->rec,$this->PH_backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,1) + ); + } + + + /** + * Processing the $menuItems array (for extension classes) (DRAG'N DROP) + * + * @param array $menuItems array for manipulation. + * @return array Processed $menuItems array + */ + function externalProcessingOfDragDropMenuItems($menuItems) { + return $menuItems; + } + + + /** + * Adding CM element for Copying/Moving a Page Into/After from a drag & drop action + * + * @param integer source UID code for the record to modify + * @param integer destination UID code for the record to modify + * @param string Action code: either "move" or "copy" + * @param string Parameter code: either "into" or "after" + * @return array Item array, element in $menuItems + * @internal + */ + function DRAGDROP_copymovepage($srcUid,$dstUid,$action,$into) { + $negativeSign = ($into == 'into') ? '' : '-'; + $editOnClick=''; + $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':''); + $editOnClick='if('.$loc.'){'.$loc.'.document.location=top.TS.PATH_typo3+"tce_db.php?redirect="+top.rawurlencode('.$this->frameLocation($loc.'.document').')+"'. + '&cmd[pages]['.$srcUid.']['.$action.']='.$negativeSign.$dstUid.'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode().'";hideCM();}'; + + return $this->linkItem( + $this->label($action.'Page_'.$into), + $this->excludeIcon('PH_backPath,'gfx/'.$action.'_page_'.$into.'.gif','width="11" height="12"').' alt="" />'), + $editOnClick.'return false;', + 0 + ); + } + + + /** + * Adding CM element for Copying/Moving a Folder Into from a drag & drop action + * + * @param string source path for the record to modify + * @param string destination path for the records to modify + * @param string Action code: either "move" or "copy" + * @return array Item array, element in $menuItems + * @internal + */ + function DRAGDROP_copymovefolder($srcPath,$dstPath,$action) { + $editOnClick=''; + $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':''); + $editOnClick='if('.$loc.'){'.$loc.'.document.location=top.TS.PATH_typo3+"tce_file.php?redirect="+top.rawurlencode('.$this->frameLocation($loc.'.document').')+"'. + '&file['.$action.'][0][data]='.$srcPath.'&file['.$action.'][0][target]='.$dstPath.'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode().'";hideCM();}'; + + return $this->linkItem( + $this->label($action.'Folder_into'), + $this->excludeIcon('PH_backPath,'gfx/'.$action.'_folder_into.gif','width="11" height="12"').' alt="" />'), + $editOnClick.'return false;', + 0 + ); + } + Index: alt_db_navframe.php =================================================================== RCS file: /cvsroot/typo3/TYPO3core/typo3/alt_db_navframe.php,v retrieving revision 1.22 diff -u -r1.22 alt_db_navframe.php --- alt_db_navframe.php 28 Dec 2005 00:49:11 -0000 1.22 +++ alt_db_navframe.php 18 Jan 2006 00:35:06 -0000 @@ -116,6 +116,11 @@ $thePageIcon=''.$thePageIcon.''; } + // Wrap icon in a drag/drop span. + $spanOnDrag = htmlspecialchars('return dragElement("'.$row['uid'].'")'); + $spanOnDrop = htmlspecialchars('return dropElement("'.$row['uid'].'")'); + $dragDropIcon = ''.$thePageIcon.''; + // Add Page ID: if ($this->ext_showPageId) { $pageIdStr = '['.$row['uid'].'] '; @@ -123,7 +128,7 @@ $pageIdStr = ''; } - return $thePageIcon.$lockIcon.$pageIdStr; + return $dragDropIcon.$lockIcon.$pageIdStr; } /** @@ -156,7 +161,13 @@ if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler']) { $CSM = ' oncontextmenu="'.htmlspecialchars($GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon('','pages',$row['uid'],0,'&bank='.$this->bank,'',TRUE)).'"'; } - return ''.$title.''; + $thePageTitle=''.$title.''; + + // Wrap title in a drag/drop span. + $spanOnDrag = htmlspecialchars('return dragElement("'.$row['uid'].'")'); + $spanOnDrop = htmlspecialchars('return dropElement("'.$row['uid'].'")'); + $dragDropTitle = ''.$thePageTitle.''; + return $dragDropTitle; } } @@ -286,6 +297,12 @@ $this->doc->bodyTagAdditions = $CMparts[1]; $this->doc->JScode.= $CMparts[0]; $this->doc->postCode.= $CMparts[2]; + + // Drag and Drop code is added: + $DDparts=$this->doc->getDragDropCode('pages'); + // ignore the $DDparts[1] for now + $this->doc->JScode.= $DDparts[0]; + $this->doc->postCode.= $DDparts[2]; } /** Index: alt_file_navframe.php =================================================================== RCS file: /cvsroot/typo3/TYPO3core/typo3/alt_file_navframe.php,v retrieving revision 1.14 diff -u -r1.14 alt_file_navframe.php --- alt_file_navframe.php 28 Dec 2005 00:49:11 -0000 1.14 +++ alt_file_navframe.php 18 Jan 2006 00:35:06 -0000 @@ -159,6 +159,12 @@ $this->doc->bodyTagAdditions = $CMparts[1]; $this->doc->JScode.=$CMparts[0]; $this->doc->postCode.= $CMparts[2]; + + // Drag and Drop code is added: + $DDparts=$this->doc->getDragDropCode('folders'); + // ignore the $DDparts[1] for now + $this->doc->JScode.= $DDparts[0]; + $this->doc->postCode.= $DDparts[2]; } /** Index: template.php =================================================================== RCS file: /cvsroot/typo3/TYPO3core/typo3/template.php,v retrieving revision 1.51 diff -u -r1.51 template.php --- template.php 26 Dec 2005 21:19:45 -0000 1.51 +++ template.php 18 Jan 2006 00:35:07 -0000 @@ -1444,6 +1444,81 @@ } /** + * Returns an array with parts (JavaScript, init-functions,
-layers) for use on pages which have the drag and drop functionality (usually pages and folder display trees) + * + * @param string indicator of which table the drag and drop function should work on (pages or folders) + * @return array If values are present: [0] = A '; + + if ($this->isCMlayers()) { + return array( + $content, + '', + '' + ); + } else { + return array($content,'',''); + } + } + + /** * Creates a tab menu from an array definition * * Returns a tab menu for a module Index: sysext/lang/locallang_core.xml =================================================================== RCS file: /cvsroot/typo3/TYPO3core/typo3/sysext/lang/locallang_core.xml,v retrieving revision 1.23 diff -u -r1.23 locallang_core.xml --- sysext/lang/locallang_core.xml 19 Dec 2005 15:11:42 -0000 1.23 +++ sysext/lang/locallang_core.xml 18 Jan 2006 00:35:08 -0000 @@ -180,6 +180,12 @@ + + + + + + EXT:csh_dk/lang/dk.locallang_core.xml EXT:csh_de/lang/de.locallang_core.xml