예제 #1
0
 /**
  * Main function, adding the item to input menuItems array
  *
  * @param ClickMenu $backRef References to parent clickmenu objects.
  * @param array $menuItems Array of existing menu items accumulated. New element added to this.
  * @param string $table Table name of the element
  * @param int $uid Record UID of the element
  * @return array Modified menuItems array
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
         // Returns directly, because the clicked item was not from the pages table
         if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
             return $menuItems;
         }
         // Adds the regular item
         $LL = $this->includeLL();
         // "Versioning" element added:
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon($this->iconFactory->getIcon('actions-version-open', Icon::SIZE_SMALL)->render()), $backRef->urlRefForCM($url), true);
         // Find position of "delete" element:
         $c = 0;
         foreach ($menuItems as $k => $value) {
             $c++;
             if ($k === 'delete') {
                 break;
             }
         }
         // .. subtract two (delete item + divider line)
         $c -= 2;
         // ... and insert the items just before the delete element.
         array_splice($menuItems, $c, 0, $localItems);
     }
     return $menuItems;
 }
예제 #2
0
 /**
  * Processing of clickmenu items
  *
  * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent
  * @param array $menuItems Menu items array to modify
  * @param string $table Table name
  * @param int $uid Uid of the record
  * @return array Menu item array, returned after modification
  * @todo Skinning for icons...
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = [];
     // Show import/export on second level menu OR root level.
     if ($backRef->cmLevel && GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
         $LL = $this->includeLL();
         $urlParameters = ['tx_impexp' => ['action' => 'export'], 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']];
         if ($table == 'pages') {
             $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
             $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
             $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
         } else {
             $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
             $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
         }
         $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
         $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('export', $LL)), $this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1);
         if ($table === 'pages') {
             $backendUser = $this->getBackendUser();
             $isEnabledForNonAdmin = $backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser');
             if ($backendUser->isAdmin() || !empty($isEnabledForNonAdmin['value'])) {
                 $urlParameters = ['id' => $uid, 'table' => $table, 'tx_impexp' => ['action' => 'import']];
                 $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
                 $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('import', $LL)), $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1);
             }
         }
     }
     return array_merge($menuItems, $localItems);
 }
 /**
  * Create click menu item
  *
  * @param string $title
  * @param string $shortTitle
  * @param string $icon
  * @param string $url
  * @param bool $addReturnUrl
  * @return string
  */
 protected function createLink($title, $shortTitle, $icon, $url, $addReturnUrl = TRUE)
 {
     if (strpos($url, 'alert') !== 0) {
         $url = $this->parentObject->urlRefForCM($url, $addReturnUrl ? 'returnUrl' : '');
     }
     return $this->parentObject->linkItem('<span title="' . htmlspecialchars($title) . '">' . $shortTitle . '</span>', $this->parentObject->excludeIcon($icon), $url);
 }
예제 #4
0
 /**
  * Main function, adding the item to input menuItems array
  *
  * @param ClickMenu $backRef References to parent clickmenu objects.
  * @param array $menuItems Array of existing menu items accumulated. New element added to this.
  * @param string $table Table name of the element
  * @param int $uid Record UID of the element
  * @return array Modified menuItems array
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
         // Returns directly, because the clicked item was not from the pages table
         if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
             return $menuItems;
         }
         // Adds the regular item
         $LL = $this->includeLL();
         // "Versioning" element added:
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon('<img src="' . $backRef->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'Resources/Public/Icons/module-version.png" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url), TRUE);
         // Find position of "delete" element:
         $c = 0;
         foreach ($menuItems as $k => $value) {
             $c++;
             if ($k === 'delete') {
                 break;
             }
         }
         // .. subtract two (delete item + divider line)
         $c -= 2;
         // ... and insert the items just before the delete element.
         array_splice($menuItems, $c, 0, $localItems);
     }
     return $menuItems;
 }
예제 #5
0
 /**
  * Main function
  *
  * @param ClickMenu reference parent object
  * @param array $menuItems
  * @param string $tableName
  * @param integer $uid
  *
  * @return array
  */
 public function main(ClickMenu $backRef, array $menuItems, $tableName, $uid)
 {
     if ('tx_crawler_configuration' !== $tableName) {
         return $menuItems;
     }
     $crawlerConfiguration = BackendUtility::getRecord($tableName, $uid, 'pid, name');
     if (!$crawlerConfiguration) {
         return $menuItems;
     }
     $additionalParameters = array();
     $additionalParameters[] = 'SET[function]=tx_crawler_modfunc1';
     $additionalParameters[] = 'SET[crawlaction]=start';
     $additionalParameters[] = 'configurationSelection[]=' . $crawlerConfiguration['name'];
     $additionalMenuItems = array();
     $additionalMenuItems[] = $backRef->linkItem(LocalizationUtility::translate('LLL:EXT:crawler/locallang_db.xml:contextMenu.label', 'crawler'), $backRef->excludeIcon($this->getContextMenuIcon()), 'top.goToModule(\'web_info\', 1, \'&' . implode('&', $additionalParameters) . '\'); return hideCM();');
     return array_merge($menuItems, $additionalMenuItems);
 }
예제 #6
0
 /**
  * Processing of clickmenu items
  *
  * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent
  * @param array $menuItems Menu items array to modify
  * @param string $table Table name
  * @param int $uid Uid of the record
  * @return array Menu item array, returned after modification
  * @todo Skinning for icons...
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     // Show import/export on second level menu OR root level.
     if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
         $LL = $this->includeLL();
         $urlParameters = array('tx_impexp' => array('action' => 'export'), 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']);
         if ($table == 'pages') {
             $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
             $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
             $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
         } else {
             $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
             $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
         }
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-export-t3d')), $backRef->urlRefForCM($url), 1);
         if ($table == 'pages') {
             $urlParameters = array('id' => $uid, 'table' => $table, 'tx_impexp' => array('action' => 'import'));
             $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
             $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1);
         }
     }
     return array_merge($menuItems, $localItems);
 }
 /**
  * Adding CM element for Delete
  *
  * @param	string	$table	Table name
  * @param	integer	$uid	UID for the current record.
  * @param	array	$elInfo	Label for including in the confirmation message, EXT:lang/locallang_core.php:mess.delete
  * @return	array		Item array, element in $menuItems
  * @internal
  */
 function DB_delete($table, $uid, $elInfo)
 {
     $loc = 'top.content.list_frame';
     if ($this->beUser->jsConfirmation(4)) {
         $conf = "confirm(" . GeneralUtility::quoteJSvalue(sprintf($this->LANG->sL('LLL:EXT:lang/locallang_core.php:mess.delete'), $elInfo[0]) . BackendUtility::referenceCount($table, $uid, ' (There are %s reference(s) to this record!)')) . ")";
     } else {
         $conf = '1==1';
     }
     $editOnClick = 'if(' . $loc . " && " . $conf . " ){" . $loc . ".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(" . $this->backRef->frameLocation($loc . '.document') . ")+'" . "&cmd[" . $table . '][' . $uid . '][DDdelete]=1&prErr=1&vC=' . $this->beUser->veriCode() . BackendUtility::getUrlToken('tceAction') . "';hideCM();}";
     return $this->backRef->linkItem($this->LANG->getLLL('delete', $this->LL), $this->backRef->excludeIcon(IconUtility::getSpriteIcon('actions-edit-delete')), $editOnClick . 'return false;');
 }
 /**
  * Main function
  *
  * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu reference parent object
  * @param array menutitems for manipultation
  * @param string table name
  * @param int uid
  * @return array manipulated menuitems
  */
 function main(\TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef, array $menuItems, $table, $uid)
 {
     if ($table != 'tx_crawler_configuration') {
         // early return without doing anything
         return $menuItems;
     }
     $localItems = array();
     $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $uid, 'pid, name, processing_instruction_filter', '', true);
     if (!empty($row)) {
         $url = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('info') . 'mod1/index.php';
         $url .= '?id=' . intval($row['pid']);
         $url .= '&SET[function]=tx_crawler_modfunc1';
         $url .= '&SET[crawlaction]=start';
         $url .= '&configurationSelection[]=' . $row['name'];
         foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $row['processing_instruction_filter']) as $processing_instruction) {
             $url .= '&procInstructions[]=' . $processing_instruction;
         }
         // $onClick = $backRef->urlRefForCM($url);
         $onClick = "top.nextLoadModuleUrl='" . $url . "';top.goToModule('web_info',1);";
         $localItems[] = $backRef->linkItem('Crawl', $backRef->excludeIcon('<img src="' . $backRef->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('crawler') . 'icon_tx_crawler_configuration.gif" border="0" align="top" alt="" />'), $onClick, 0);
     }
     return array_merge($menuItems, $localItems);
 }
예제 #9
0
 /**
  * Displays the 'Send to review/public' option
  *
  * @param string $table Table that is to be host of the sending
  * @param int $uid Uid of the item that is to be send
  *
  * @return string
  */
 public function DB_review($table, $uid)
 {
     $language = $this->getLanguageService();
     $url = ExtensionManagementUtility::extRelPath('version') . 'cm1/index.php?id=' . ($table == 'pages' ? $uid : $this->rec['pid']) . '&table=' . rawurlencode($table) . '&uid=' . $uid . '&sendToReview=1';
     return $this->clickMenu->linkItem($language->sL('LLL:EXT:version/locallang.xml:title_review', 1), $this->excludeIcon('<img src="' . $this->backPath . ExtensionManagementUtility::extRelPath('version') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $this->clickMenu->urlRefForCM($url), 1);
 }