Index: mod1/class.tx_templavoila_mod1_clipboard.php =================================================================== --- mod1/class.tx_templavoila_mod1_clipboard.php (revision 27776) +++ mod1/class.tx_templavoila_mod1_clipboard.php (working copy) @@ -159,14 +159,14 @@ $setElement = '&CB[el]['.rawurlencode('tt_content|'.$elementRecord['uid']).']='.rawurlencode($this->pObj->apiObj->flexform_getStringFromPointer($elementPointer)); $setElementRef = '&CB[el]['.rawurlencode('tt_content|'.$elementRecord['uid']).']=1'; - $linkCopy = ''.$copyIcon.''; - $linkCut = ''.$cutIcon.''; - $linkRef = ''.$refIcon.''; + $linkCopy = ''.$copyIcon.''; + $linkCut = ''.$cutIcon.''; + $linkRef = ''.$refIcon.''; $output = - (t3lib_div::inList($listOfButtons, 'copy') ? $linkCopy : ''). - (t3lib_div::inList($listOfButtons, 'ref') ? $linkRef : ''). - (t3lib_div::inList($listOfButtons, 'cut') ? $linkCut : ''); + (t3lib_div::inList($listOfButtons, 'copy') && !in_array('copy', $this->pObj->blindIcons) ? $linkCopy : ''). + (t3lib_div::inList($listOfButtons, 'ref') && !in_array('ref', $this->pObj->blindIcons) ? $linkRef : ''). + (t3lib_div::inList($listOfButtons, 'cut') && !in_array('cut', $this->pObj->blindIcons) ? $linkCut : ''); return $output; } @@ -182,6 +182,10 @@ function element_getPasteButtons($destinationPointer) { global $LANG, $BE_USER; + if (in_array('paste', $this->pObj->blindIcons)) { + return ''; + } + $origDestinationPointer = $destinationPointer; if (!$destinationPointer = $this->pObj->apiObj->flexform_getValidPointer($destinationPointer)) return ''; if (!is_array ($this->t3libClipboardObj->clipData['normal']['el'])) return ''; @@ -227,10 +231,10 @@ // FCEs with sub elements have two different paste icons, normal elements only one: if ($pasteMode == 'copy' && $clipboardElementHasSubElements) { - $output = ''.$pasteAfterIcon.''; - $output .= ''.$pasteSubRefIcon.''; + $output = ''.$pasteAfterIcon.''; + $output .= ''.$pasteSubRefIcon.''; } else { - $output = ''.$pasteAfterIcon.''; + $output = ''.$pasteAfterIcon.''; } return $output; @@ -354,11 +358,11 @@ } if (count($infoData)) { - return 'Ref: '.count($infoData).''; + return 'Ref: '.count($infoData).''; } elseif (0===$BE_USER->workspace) { $this->deleteUids[] = $uid; $params = '&cmd[tt_content]['.$uid.'][delete]=1'; - return ''. + return ''. 'doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('renderreferencecount_delete',1).'" alt="" />'. ''; } else { Index: mod1/dragdrop-min.js =================================================================== --- mod1/dragdrop-min.js (revision 27776) +++ mod1/dragdrop-min.js (working copy) @@ -1 +1 @@ -var sortable_currentItem;function sortable_unhideRecord(it,command){jumpToUrl(command)}function sortable_hideRecord(it,command){if(!sortable_removeHidden){return jumpToUrl(command)}while(it.className!="sortableItem"){it=it.parentNode}new Ajax.Request(command);new Effect.Fade(it,{duration:0.5,afterFinish:sortable_hideRecordCallBack})}function sortable_hideRecordCallBack(obj){var el=obj.element;while(el.lastChild){el.removeChild(el.lastChild)}}function sortable_unlinkRecordCallBack(obj){var el=obj.element;var pn=el.parentNode;pn.removeChild(el);sortable_update(pn)}function sortable_unlinkRecord(pointer,id){new Ajax.Request("index.php?"+sortable_linkParameters+"&ajaxUnlinkRecord="+escape(pointer));new Effect.Fade(id,{duration:0.5,afterFinish:sortable_unlinkRecordCallBack})}function sortable_updateItemButtons(el,position,pID){var p=new Array();var p1=new Array();var href="";var i=0;var newPos=escape(pID+position);var childs=el.childElements();var buttons=childs[0].childElements()[0].childElements()[0].childElements()[1].childNodes;for(i=0;imodTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']); + $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED'); $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']); $this->altRoot = t3lib_div::_GP('altRoot'); $this->versionId = t3lib_div::_GP('versionId'); + // enable debug for development + if ($this->modTSconfig['properties']['debug']) { + $this->debug = TRUE; + } + + $this->blindIcons = isset($this->modTSconfig['properties']['blindIcons']) ? t3lib_div::trimExplode(',', $this->modTSconfig['properties']['blindIcons'], TRUE) : array(); + $this->addToRecentElements(); // Fill array allAvailableLanguages and currently selected language (from language selector or from outside) @@ -253,11 +265,11 @@ } // page/be_user TSconfig settings and blinding of menu-items - $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']); $this->MOD_MENU['view'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['view'],'menu.function'); - if (!isset($this->modTSconfig['properties']['sideBarEnable'])) $this->modTSconfig['properties']['sideBarEnable'] = 1; - $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED'); + if (!isset($this->modTSconfig['properties']['sideBarEnable'])) { + $this->modTSconfig['properties']['sideBarEnable'] = 1; + } // CLEANSE SETTINGS $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']); @@ -398,6 +410,24 @@ } if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).'; + + var browserPos = null; + + function setFormValueOpenBrowser(mode,params) { // + var url = "' . $BACK_PATH . 'browser.php?mode="+mode+"&bparams="+params; + + browserWin = window.open(url,"Typo3WinBrowser - TemplaVoila Element Selector","height=350,width="+(mode=="db"?650:600)+",status=0,menubar=0,resizable=1,scrollbars=1"); + browserWin.focus(); + } + function setFormValueFromBrowseWin(fName,value,label,exclusiveValues){ + if (value) { + var ret = value.split(\'_\'); + var rid = ret.pop(); + ret = ret.join(\'_\'); + browserPos.href = browserPos.rel.replace(\'' . rawurlencode('###') . '\', ret+\':\'+rid); + jumpToUrl(browserPos.href); + } + } ' ); @@ -407,7 +437,7 @@ //TODO: switch to $this->doc->JScodeLibArray for preventing double inclusion #$this->doc->JScode .= ''; $this->doc->JScode .= ''; - $this->doc->JScode .= ''; + $this->doc->JScode .= ''; // Set up JS for dynamic tab menu and side bar $this->doc->JScode .= $this->doc->getDynTabMenuJScode(); @@ -497,25 +527,25 @@ // Create sortables if (is_array($this->sortableContainers)) { - + $script = ''; if (t3lib_div::compat_version ('4.3')) { $items_json = json_encode ($this->sortableItems); } else { $items_json = t3lib_div::array2json ($this->sortableItems); } - $this->content .= ''; + $script .= '});'; + $this->content .= t3lib_div::wrapJS($script); } } @@ -738,22 +768,22 @@ if (!$this->translatorMode && $canEditContent) { // Create CE specific buttons: - $linkMakeLocal = !$elementBelongsToCurrentPage ? $this->link_makeLocal('doc->backPath,t3lib_extMgm::extRelPath('templavoila').'mod1/makelocalcopy.gif','').' title="'.$LANG->getLL('makeLocal').'" border="0" alt="" />', $parentPointer) : ''; + $linkMakeLocal = !$elementBelongsToCurrentPage && !in_array('makeLocal', $this->blindIcons) ? $this->link_makeLocal('doc->backPath,t3lib_extMgm::extRelPath('templavoila').'mod1/makelocalcopy.gif','').' title="'.$LANG->getLL('makeLocal').'" border="0" alt="" />', $parentPointer) : ''; if( $this->modTSconfig['properties']['enableDeleteIconForLocalElements'] < 2 || !$elementBelongsToCurrentPage || $this->global_tt_content_elementRegister[$contentTreeArr['el']['uid']] > 1 ) { - $linkUnlink = $this->link_unlink('doc->backPath, t3lib_extMgm::extRelPath('templavoila') . 'mod1/unlink.png','').' title="'.$LANG->getLL('unlinkRecord').'" border="0" alt="" />', $parentPointer, FALSE); + $linkUnlink = !in_array('unlink', $this->blindIcons) ? $this->link_unlink('doc->backPath, t3lib_extMgm::extRelPath('templavoila') . 'mod1/unlink.png','').' title="'.$LANG->getLL('unlinkRecord').'" border="0" alt="" />', $parentPointer, FALSE) : ''; } else { $linkUnlink = ''; } if ($GLOBALS['BE_USER']->recordEditAccessInternals('tt_content', $contentTreeArr['previewData']['fullRow'])) { - $linkEdit = ($elementBelongsToCurrentPage ? $this->link_edit('doc->backPath,'gfx/edit2.gif','').' title="'.$LANG->getLL('editrecord').'" border="0" alt="" />',$contentTreeArr['el']['table'],$contentTreeArr['el']['uid']) : ''); - $linkHide = $this->icon_hide($contentTreeArr['el']); + $linkEdit = ($elementBelongsToCurrentPage && !in_array('edit', $this->blindIcons) ? $this->link_edit('doc->backPath,'gfx/edit2.gif','').' title="'.$LANG->getLL('editrecord').'" border="0" alt="" />',$contentTreeArr['el']['table'],$contentTreeArr['el']['uid']) : ''); + $linkHide = !in_array('hide', $this->blindIcons) ? $this->icon_hide($contentTreeArr['el']) : ''; if( $this->modTSconfig['properties']['enableDeleteIconForLocalElements'] && $elementBelongsToCurrentPage ) { $hasForeignReferences = $this->hasElementForeignReferences($contentTreeArr['el'],$contentTreeArr['el']['pid']); - $linkDelete = $this->link_unlink('doc->backPath,'gfx/deletedok.gif','').' title="'.$LANG->getLL('deleteRecord').'" border="0" alt="" />', $parentPointer, TRUE, $hasForeignReferences); + $linkDelete = !in_array('delete', $this->blindIcons) ? $this->link_unlink('doc->backPath,'gfx/deletedok.gif','').' title="'.$LANG->getLL('deleteRecord').'" border="0" alt="" />', $parentPointer, TRUE, $hasForeignReferences) : ''; } else { $linkDelete = ''; } @@ -910,11 +940,20 @@ $canCreateNew = $GLOBALS['BE_USER']->isPSet($this->calcPerms, 'pages', 'new'); $canEditContent = $GLOBALS['BE_USER']->isPSet($this->calcPerms, 'pages', 'editcontent'); - if (!$this->translatorMode && $canCreateNew) { + if (!$this->translatorMode) { - // "New" and "Paste" icon: - $newIcon = 'doc->backPath,'gfx/new_el.gif','').' style="text-align: center; vertical-align: middle;" vspace="5" hspace="1" border="0" title="'.$LANG->getLL ('createnewrecord').'" alt="" />'; - $cellContent .= $this->link_new($newIcon, $subElementPointer); + // "New" icon: + if ($canCreateNew && !in_array('new', $this->blindIcons)) { + $newIcon = 'doc->backPath,'gfx/new_el.gif','').' style="text-align: center; vertical-align: middle;" vspace="5" hspace="1" border="0" title="'.$LANG->getLL ('createnewrecord').'" alt="" />'; + $cellContent .= $this->link_new($newIcon, $subElementPointer); + } + // "Browse Record" icon + if (!in_array('browse', $this->blindIcons)) { + $newIcon = 'doc->backPath,'gfx/insert3.gif','').' style="text-align: center; vertical-align: middle;" vspace="5" hspace="1" border="0" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.browse_db').'" alt="" />'; + $cellContent .= $this->link_browse($newIcon, $subElementPointer); + } + + // "Paste" icon $cellContent .= '' . $this->clipboardObj->element_getPasteButtons ($subElementPointer) . ''; } @@ -942,11 +981,19 @@ $cellContent .= $this->render_framework_allSheets($subElementArr, $languageKey, $subElementPointer, $elementContentTreeArr['ds_meta']); - if (!$this->translatorMode && $canCreateNew) { - // "New" and "Paste" icon: - $newIcon = 'doc->backPath,'gfx/new_el.gif','').' style="text-align: center; vertical-align: middle;" vspace="5" hspace="1" border="0" title="'.$LANG->getLL ('createnewrecord').'" alt="" />'; - $cellContent .= $this->link_new($newIcon, $subElementPointer); + if (!$this->translatorMode) { + // "New" icon: + if ($canCreateNew && !in_array('new', $this->blindIcons)) { + $newIcon = 'doc->backPath,'gfx/new_el.gif','').' style="text-align: center; vertical-align: middle;" vspace="5" hspace="1" border="0" title="'.$LANG->getLL ('createnewrecord').'" alt="" />'; + $cellContent .= $this->link_new($newIcon, $subElementPointer); + } + // "Browse Record" icon + if (!in_array('browse', $this->blindIcons)) { + $newIcon = 'doc->backPath,'gfx/insert3.gif','').' style="text-align: center; vertical-align: middle;" vspace="5" hspace="1" border="0" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.browse_db').'" alt="" />'; + $cellContent .= $this->link_browse($newIcon, $subElementPointer); + } + // "Paste" icon $cellContent .= '' . $this->clipboardObj->element_getPasteButtons ($subElementPointer) . ''; } @@ -1287,7 +1334,7 @@ $linkLabel = $LANG->getLL('createcopyfortranslation',1).' ('.htmlspecialchars($sLInfo['title']).')'; $localizeIcon = 'doc->backPath,'gfx/clip_copy.gif','width="12" height="12"').' class="bottom" title="'.$linkLabel.'" alt="" />'; - $l10nInfo = ''.$localizeIcon.''; + $l10nInfo = ''.$localizeIcon.''; $l10nInfo .= ' '.$linkLabel.''; $flagLink_begin = ''; $flagLink_end = ''; @@ -1734,7 +1781,7 @@ return ''.$label.''; } else { $onClick = t3lib_BEfunc::editOnClick('&edit['.$table.']['.$uid.']=edit', $this->doc->backPath); - return ''.$label.''; + return ''.$label.''; } } else { return $label; @@ -1798,9 +1845,9 @@ * can safely use '#' */ if ($hidden) - return '' . $label . ''; + return '' . $label . ''; else - return '' . $label . ''; + return '' . $label . ''; } } else { return $label; @@ -1808,7 +1855,31 @@ } return ''; } + /** + * Returns an HTML link for browse for record + * + * @param string $label: The label (or image) + * @param array $parentPointer: Flexform pointer defining the parent element of the new record + * @return string HTML anchor tag containing the label and the correct link + * @access protected + */ + function link_browse($label, $parentPointer) { + + $parameters = + $this->link_getParameters(). + '&pasteRecord=ref' . + '&source=' . rawurlencode('###'). + '&destination=' . rawurlencode($this->apiObj->flexform_getStringFromPointer($parentPointer)); + $onClick = + 'browserPos = this;' . + 'setFormValueOpenBrowser(\'db\',\'browser[communication]|||tt_content\');'. + 'return false;'; + + return '' . $label . ''; + } + + /** * Returns an HTML link for creating a new record * * @param string $label: The label (or image) @@ -1821,7 +1892,7 @@ $parameters = $this->link_getParameters(). '&parentRecord='.rawurlencode($this->apiObj->flexform_getStringFromPointer($parentPointer)); - return ''.$label.''; + return ''.$label.''; } /** @@ -1842,9 +1913,9 @@ if ($realDelete) { $LLlabel = $foreignReferences ? 'deleteRecordWithReferencesMsg' : 'deleteRecordMsg'; - return '' . $label . ''; + return '' . $label . ''; } else { - return '' . $label . ''; + return '' . $label . ''; } } @@ -1859,7 +1930,7 @@ function link_makeLocal($label, $makeLocalPointer) { global $LANG; - return ''.$label.''; + return ''.$label.''; } /**