当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleTemplate::addJavaScriptCode方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Backend\Template\ModuleTemplate::addJavaScriptCode方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleTemplate::addJavaScriptCode方法的具体用法?PHP ModuleTemplate::addJavaScriptCode怎么用?PHP ModuleTemplate::addJavaScriptCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Backend\Template\ModuleTemplate的用法示例。


在下文中一共展示了ModuleTemplate::addJavaScriptCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 /**
  * Main
  *
  * @return void
  */
 public function main()
 {
     // Template markers
     $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $this->access = is_array($this->pageinfo);
     $lang = $this->getLanguageService();
     if ($this->id && $this->access) {
         $urlParameters = array('id' => $this->id, 'template' => 'all');
         $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         // JavaScript
         $this->moduleTemplate->addJavaScriptCode('TSTemplateInlineJS', '
             function uFormUrl(aname) {
                 document.forms[0].action = ' . GeneralUtility::quoteJSvalue($aHref . '#') . '+aname;
             }
             function brPoint(lnumber,t) {
                 window.location.href = ' . GeneralUtility::quoteJSvalue($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=') . '+(t?"setup":"const")+"&breakPointLN="+lnumber;
                 return false;
             }
             if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';
         ');
         $this->moduleTemplate->getPageRenderer()->addCssInlineBlock('TSTemplateInlineStyle', '
             TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
             TABLE#typo3-objectBrowser A { text-decoration: none; }
             TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
             .ts-typoscript { width: 100%; }
             .tsob-search-submit {margin-left: 3px; margin-right: 3px;}
             .tst-analyzer-options { margin:5px 0; }
         ');
         // Setting up the context sensitive menu:
         $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
         // Build the module content
         $this->content = '<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="multipart/form-data" id="TypoScriptTemplateModuleController" name="editForm" class="form">';
         $this->content .= $this->moduleTemplate->header($lang->getLL('moduleTitle'));
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
         $this->content .= '</form>';
     } else {
         // Template pages:
         $records = $this->getDatabaseConnection()->exec_SELECTgetRows('pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val', 'pages,sys_template', 'pages.uid=sys_template.pid' . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages') . BackendUtility::deleteClause('sys_template') . BackendUtility::versioningPlaceholderClause('sys_template'), 'pages.uid', 'pages.pid, pages.sorting');
         $pArray = array();
         foreach ($records as $record) {
             $this->setInPageArray($pArray, BackendUtility::BEgetRootLine($record['uid'], 'AND 1=1'), $record);
         }
         $table = '<div class="table-fit"><table class="table table-striped table-hover" id="ts-overview">' . '<thead>' . '<tr>' . '<th>' . $lang->getLL('pageName') . '</th>' . '<th>' . $lang->getLL('templates') . '</th>' . '<th>' . $lang->getLL('isRoot') . '</th>' . '<th>' . $lang->getLL('isExt') . '</th>' . '</tr>' . '</thead>' . '<tbody>' . implode('', $this->renderList($pArray)) . '</tbody>' . '</table></div>';
         $this->content = $this->moduleTemplate->header($lang->getLL('moduleTitle'));
         $this->content .= '<p class="lead">' . $lang->getLL('overview') . '</p>' . $table;
         // RENDER LIST of pages with templates, END
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:61,代码来源:TypoScriptTemplateModuleController.php

示例2: init

 /**
  * Initialization
  *
  * @return void
  */
 public function init()
 {
     $this->MCONF['name'] = $this->moduleName;
     $this->menuConfig();
     $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
     $this->moduleTemplate->setForm('<form action="" method="post" name="' . $this->formName . '">');
     $this->moduleTemplate->addJavaScriptCode('jumpToUrl', '
         function jumpToUrl(URL) {
             window.location.href = URL;
             return false;
         }
         ');
 }
开发者ID:Audibene-GMBH,项目名称:TYPO3.CMS,代码行数:18,代码来源:DatabaseIntegrityView.php

示例3: main

 /**
  * Creates the module's content. In this case it rather acts as a kind of #
  * dispatcher redirecting requests to specific tasks.
  *
  * @return void
  */
 public function main()
 {
     $this->getButtons();
     $this->generateMenu();
     $this->moduleTemplate->addJavaScriptCode('TaskCenterInlineJavascript', 'if (top.fsMod) { top.fsMod.recentIds["web"] = 0; }');
     // Render content depending on the mode
     $mode = (string) $this->MOD_SETTINGS['mode'];
     if ($mode === 'information') {
         $this->renderInformationContent();
     } else {
         $this->renderModuleContent();
     }
     // Renders the module page
     $this->moduleTemplate->setTitle($this->getLanguageService()->getLL('title'));
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:21,代码来源:TaskModuleController.php

示例4: main

 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     if ($this->pageinfo) {
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
     }
     $access = is_array($this->pageinfo);
     // We keep this here, in case somebody relies on the old doc being here
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     // Main
     if ($this->id && $access) {
         // JavaScript
         $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
         $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" id="PageFunctionsController" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
         $vContent = $this->moduleTemplate->getVersionSelector($this->id, true);
         if ($vContent) {
             $this->content .= '<div>' . $vContent . '</div>';
         }
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
         $this->content .= '</form>';
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html'));
         $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
         $this->content = $view->render();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:44,代码来源:PageFunctionsController.php

示例5: main

    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return void
     */
    public function main()
    {
        // We leave this here because of dependencies to submodules
        $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
        // The page will show only if there is a valid page and if this page
        // may be viewed by the user
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        if ($this->pageinfo) {
            $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
        }
        $access = is_array($this->pageinfo);
        if ($this->id && $access || $this->backendUser->user['admin'] && !$this->id) {
            if ($this->backendUser->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            // JavaScript
            $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
				function jumpToUrl(URL) {
					window.location.href = URL;
					return false;
				}
				');
            // Setting up the context sensitive menu:
            $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
            $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) . '" method="post" id="InfoModuleController" name="webinfoForm" class="form-inline form-inline-spaced">';
            $vContent = $this->moduleTemplate->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->moduleTemplate->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $this->getButtons();
            $this->generateMenu();
            $this->content .= '</form>';
        } else {
            // If no access or if ID == zero
            $this->content = $this->doc->header($this->languageService->getLL('title'));
        }
    }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:44,代码来源:InfoModuleController.php

示例6: main

 /**
  * Main function.
  * Creates some general objects and calls other functions for the main rendering of module content.
  *
  * @return void
  */
 public function main()
 {
     $lang = $this->getLanguageService();
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $access = is_array($this->pageinfo) ? 1 : 0;
     // Content
     $content = '';
     if ($this->id && $access) {
         // Initialize permission settings:
         $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo);
         $this->EDIT_CONTENT = $this->pageIsNotLockedForEditors();
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
         // override the default jumpToUrl
         $this->moduleTemplate->addJavaScriptCode('jumpToUrl', '
             function jumpToUrl(URL,formEl) {
                 if (document.editform && TBE_EDITOR.isFormChanged)  {   // Check if the function exists... (works in all browsers?)
                     if (!TBE_EDITOR.isFormChanged()) {
                         window.location.href = URL;
                     } else if (formEl) {
                         if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
                     }
                 } else {
                     window.location.href = URL;
                 }
             }
         ');
         $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', '
             if (top.fsMod) {
                 top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
                 top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . ';
             }
             ' . ($this->popView ? BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id)) : '') . '
             function deleteRecord(table,id,url) {   //
                 if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) {
                     window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . '&prErr=1&uPT=1";
                 }
                 return false;
             }
         ');
         // Find backend layout / columns
         $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this);
         if (!empty($backendLayout['__colPosList'])) {
             $this->colPosList = implode(',', $backendLayout['__colPosList']);
         }
         // Removing duplicates, if any
         $this->colPosList = array_unique(GeneralUtility::intExplode(',', $this->colPosList));
         // Accessible columns
         if (isset($this->modSharedTSconfig['properties']['colPos_list']) && trim($this->modSharedTSconfig['properties']['colPos_list']) !== '') {
             $this->activeColPosList = array_unique(GeneralUtility::intExplode(',', trim($this->modSharedTSconfig['properties']['colPos_list'])));
             // Match with the list which is present in the colPosList for the current page
             if (!empty($this->colPosList) && !empty($this->activeColPosList)) {
                 $this->activeColPosList = array_unique(array_intersect($this->activeColPosList, $this->colPosList));
             }
         } else {
             $this->activeColPosList = $this->colPosList;
         }
         $this->activeColPosList = implode(',', $this->activeColPosList);
         $this->colPosList = implode(',', $this->colPosList);
         $content .= $this->getHeaderFlashMessagesForCurrentPid();
         // Render the primary module content:
         if ($this->MOD_SETTINGS['function'] == 0) {
             // QuickEdit
             $content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db', ['prErr' => 1, 'uPT' => 1])) . '" method="post" enctype="multipart/form-data" name="editform" id="PageLayoutController" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
             $content .= $this->renderQuickEdit();
         } else {
             $content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName, array('id' => $this->id, 'imagemode' => $this->imagemode))) . '" id="PageLayoutController" method="post">';
             // Page title
             $content .= '<h1 class="t3js-title-inlineedit">' . htmlspecialchars($this->getLocalizedPageTitle()) . '</h1>';
             // All other listings
             $content .= $this->renderListContent();
         }
         $content .= '</form>';
         $content .= $this->searchContent;
         // Setting up the buttons for the docheader
         $this->makeButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : '');
         // Create LanguageMenu
         $this->makeLanguageMenu();
     } else {
         $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         $content .= '<h1>' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '</h1>';
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));
         $view->assignMultiple(array('title' => $lang->getLL('clickAPage_header'), 'message' => $lang->getLL('clickAPage_content'), 'state' => InfoboxViewHelper::STATE_INFO));
         $content .= $view->render();
     }
     // Set content
     $this->moduleTemplate->setContent($content);
 }
开发者ID:CDRO,项目名称:TYPO3.CMS,代码行数:95,代码来源:PageLayoutController.php

示例7: main

 /**
  * Main module function
  *
  * @throws \BadFunctionCallException
  * @throws \InvalidArgumentException
  * @return void
  */
 public function main()
 {
     $this->lang->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf');
     // Start document template object:
     // We keep this here, in case somebody relies on the old doc being here
     $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
     $this->doc->bodyTagId = 'imp-exp-mod';
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
     // Setting up the context sensitive menu:
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Impexp/ImportExport');
     $this->moduleTemplate->addJavaScriptCode('ImpexpInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
     $this->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('xMOD_tximpexp')) . '" method="post" enctype="multipart/form-data">' . '<input type="hidden" name="id" value="' . $this->id . '" />');
     // Input data grabbed:
     $inData = GeneralUtility::_GP('tx_impexp');
     $this->content .= $this->moduleTemplate->sectionHeader($this->lang->getLL('title_' . (string) $inData['action']));
     $this->content .= '<div style="padding-top: 5px;"></div>';
     $this->checkUpload();
     switch ((string) $inData['action']) {
         case 'export':
             $this->shortcutName = $this->lang->getLL('title_export');
             // Finally: If upload went well, set the new file as the thumbnail in the $inData array:
             if (!empty($this->uploadedFiles[0])) {
                 $inData['meta']['thumbnail'] = $this->uploadedFiles[0]->getCombinedIdentifier();
             }
             // Call export interface
             $this->exportData($inData);
             break;
         case 'import':
             $this->shortcutName = $this->lang->getLL('title_import');
             // Finally: If upload went well, set the new file as the import file:
             if (!empty($this->uploadedFiles[0])) {
                 // Only allowed extensions....
                 if (GeneralUtility::inList('t3d,xml', $this->uploadedFiles[0]->getExtension())) {
                     $inData['file'] = $this->uploadedFiles[0]->getCombinedIdentifier();
                 }
             }
             // Call import interface:
             $this->importData($inData);
             break;
     }
     // Setting up the buttons and markers for docheader
     $this->getButtons();
 }
开发者ID:Audibene-GMBH,项目名称:TYPO3.CMS,代码行数:52,代码来源:ImportExportController.php

示例8: main

 /**
  * Main module function
  *
  * @throws \BadFunctionCallException
  * @throws \InvalidArgumentException
  * @return void
  */
 public function main()
 {
     $this->lang->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf');
     // Start document template object:
     // We keep this here, in case somebody relies on the old doc being here
     $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
     $this->doc->bodyTagId = 'imp-exp-mod';
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     if (is_array($this->pageinfo)) {
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
     }
     // Setting up the context sensitive menu:
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Impexp/ImportExport');
     $this->moduleTemplate->addJavaScriptCode('ImpexpInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
     // Input data grabbed:
     $inData = GeneralUtility::_GP('tx_impexp');
     $this->standaloneView->assign('moduleUrl', BackendUtility::getModuleUrl('xMOD_tximpexp'));
     $this->standaloneView->assign('id', $this->id);
     $this->standaloneView->assign('inData', $inData);
     switch ((string) $inData['action']) {
         case 'export':
             $this->shortcutName = $this->lang->getLL('title_export');
             // Call export interface
             $this->exportData($inData);
             $this->standaloneView->setTemplate('Export.html');
             break;
         case 'import':
             $this->shortcutName = $this->lang->getLL('title_import');
             if (GeneralUtility::_POST('_upload')) {
                 $this->checkUpload();
             }
             // Finally: If upload went well, set the new file as the import file:
             if (!empty($this->uploadedFiles[0])) {
                 // Only allowed extensions....
                 $extension = $this->uploadedFiles[0]->getExtension();
                 if ($extension === 't3d' || $extension === 'xml') {
                     $inData['file'] = $this->uploadedFiles[0]->getCombinedIdentifier();
                 }
             }
             // Call import interface:
             $this->importData($inData);
             $this->standaloneView->setTemplate('Import.html');
             break;
     }
     // Setting up the buttons and markers for docheader
     $this->getButtons();
 }
开发者ID:burguin,项目名称:test01,代码行数:55,代码来源:ImportExportController.php


注:本文中的TYPO3\CMS\Backend\Template\ModuleTemplate::addJavaScriptCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。