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


PHP CMSMenu::add_link方法代码示例

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


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

示例1: testBasicMenuHandling

 public function testBasicMenuHandling()
 {
     // Clear existing menu
     CMSMenu::clear_menu();
     $menuItems = CMSMenu::get_menu_items();
     $this->assertTrue(empty($menuItems), 'Menu can be cleared');
     // Add a controller to the menu and check it is as expected
     CMSMenu::add_controller('CMSMenuTest_LeftAndMainController');
     $menuItems = CMSMenu::get_menu_items();
     $menuItem = $menuItems['CMSMenuTest_LeftAndMainController'];
     $this->assertType('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
     $this->assertEquals($menuItem->url, singleton('CMSMenuTest_LeftAndMainController')->Link(), 'Controller menu item has the correct link');
     $this->assertEquals($menuItem->controller, 'CMSMenuTest_LeftAndMainController', 'Controller menu item has the correct controller class');
     $this->assertEquals($menuItem->priority, singleton('CMSMenuTest_LeftAndMainController')->stat('menu_priority'), 'Controller menu item has the correct priority');
     CMSMenu::clear_menu();
     // Add a link to the menu
     CMSMenu::add_link('LinkCode', 'link title', 'http://www.example.com');
     $menuItems = CMSMenu::get_menu_items();
     $menuItem = $menuItems['LinkCode'];
     $this->assertType('CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem');
     $this->assertEquals($menuItem->title, 'link title', 'Link menu item has the correct title');
     $this->assertEquals($menuItem->url, 'http://www.example.com', 'Link menu item has the correct link');
     $this->assertNull($menuItem->controller, 'Link menu item has no controller class');
     $this->assertEquals($menuItem->priority, -1, 'Link menu item has the correct priority');
     CMSMenu::clear_menu();
 }
开发者ID:rixrix,项目名称:sapphire,代码行数:26,代码来源:CMSMenuTest.php

示例2: testLinkWithExternalAttributes

 public function testLinkWithExternalAttributes()
 {
     CMSMenu::clear_menu();
     CMSMenu::add_link('LinkCode', 'link title', 'http://www.example.com', -2, array('target' => '_blank'));
     $menuItems = CMSMenu::get_menu_items();
     $menuItem = $menuItems['LinkCode'];
     $this->assertEquals('target="_blank"', $menuItem->getAttributesHTML());
     CMSMenu::clear_menu();
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:9,代码来源:CMSMenuTest.php

示例3: init

 public function init()
 {
     parent::init();
     if (!Permission::check("VIEW_DEVTASKS")) {
         return;
     }
     $tasks = array('devbuild' => array('title' => 'Dev/Build', 'link' => 'dev/build', 'reset_time' => '5000', 'error_handler' => 'newtab', 'success_handler' => 'ignore'));
     $config_tasks = Config::inst()->get(__CLASS__, 'tasks');
     if (is_array($config_tasks)) {
         $tasks = array_merge($tasks, $config_tasks);
     }
     foreach ($tasks as $item => $values) {
         $attributes = array('class' => 'devbuild-trigger', 'data-title' => isset($values['title']) ? $values['title'] : $item, 'data-link' => isset($values['link']) ? $values['link'] : 'dev/build', 'data-reset-time' => isset($values['reset_time']) ? $values['reset_time'] : '5000', 'data-error-handler' => isset($values['error_handler']) ? $values['error_handler'] : 'newtab', 'data-success-handler' => isset($values['success_handler']) ? $values['success_handler'] : 'ignore');
         // priority controls the ordering of the link in the stack. The
         // lower the number, the lower in the list
         $priority = -90;
         CMSMenu::add_link($item, '', '#', $priority, $attributes);
     }
 }
开发者ID:gorriecoe,项目名称:silverstripe-fancy-devbuild,代码行数:19,代码来源:DevTasks.php

示例4: init

 /**
  * @uses LeftAndMainExtension->init()
  * @uses LeftAndMainExtension->accessedCMS()
  * @uses CMSMenu
  */
 function init()
 {
     parent::init();
     SSViewer::setOption('rewriteHashlinks', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::set_date_format($member->DateFormat);
     }
     if (!empty($member->TimeFormat)) {
         i18n::set_time_format($member->TimeFormat);
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), self::$help_link);
     // Allow customisation of the access check by a extension
     // Also all the canView() check to execute Controller::redirect()
     if (!$this->canView() && !$this->response->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 return $this->redirect($candidate->Link);
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "Please choose an authentication method and enter your credentials to access the CMS."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."));
         return Security::permissionFailure($this, $messageSet);
     }
     // Don't continue if there's already been a redirection request.
     if ($this->redirectedTo()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->request->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Set the members html editor config
     HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS());
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HtmlEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     if (!$htmlEditorConfig->getOption('content_css')) {
         $cssFiles = array();
         $cssFiles[] = FRAMEWORK_ADMIN_DIR . '/css/editor.css';
         // Use theme from the site config
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (SSViewer::current_theme()) {
             $theme = SSViewer::current_theme();
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles[] = THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles[] = project() . '/css/editor.css';
             }
         }
         // Remove files that don't exist
         foreach ($cssFiles as $k => $cssFile) {
             if (!file_exists(BASE_PATH . '/' . $cssFile)) {
                 unset($cssFiles[$k]);
             }
         }
         $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
     }
     // Using uncompressed files as they'll be processed by JSMin in the Requirements class.
     // Not as effective as other compressors or pre-compressed+finetuned files,
     // but overall the unified minification into a single file brings more performance benefits
     // than a couple of saved bytes (after gzip) in individual files.
     // We also re-compress already compressed files through JSMin as this causes weird runtime bugs.
     Requirements::combine_files('lib.js', array(THIRDPARTY_DIR . '/jquery/jquery.js', FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js', FRAMEWORK_ADMIN_DIR . '/javascript/lib.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', THIRDPARTY_DIR . '/jquery-form/jquery.form.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', FRAMEWORK_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js', FRAMEWORK_DIR . '/javascript/TreeDropdownField.js', FRAMEWORK_DIR . '/javascript/DateField.js', FRAMEWORK_DIR . '/javascript/HtmlEditorField.js', FRAMEWORK_DIR . '/javascript/TabSet.js', FRAMEWORK_DIR . '/javascript/i18n.js', FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js', FRAMEWORK_DIR . '/javascript/GridField.js'));
     if (Director::isDev()) {
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/leaktools.js');
     }
     HTMLEditorField::include_js();
     Requirements::combine_files('leftandmain.js', array_unique(array_merge(array(FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.AddForm.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js'), Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true), Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true))));
     // TODO Confuses jQuery.ondemand through document.write()
     if (Director::isDev()) {
         Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
     }
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css');
     Requirements::css(THIRDPARTY_DIR . '/jstree/themes/apple/style.css');
     Requirements::css(FRAMEWORK_DIR . '/css/TreeDropdownField.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css');
//.........这里部分代码省略.........
开发者ID:prostart,项目名称:cobblestonepath,代码行数:101,代码来源:LeftAndMain.php

示例5: init

 /**
  * @uses LeftAndMainDecorator->init()
  * @uses LeftAndMainDecorator->accessedCMS()
  * @uses CMSMenu
  */
 function init()
 {
     parent::init();
     SSViewer::setOption('rewriteHashlinks', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::set_date_format($member->DateFormat);
     }
     if (!empty($member->TimeFormat)) {
         i18n::set_time_format($member->TimeFormat);
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', PR_HIGH, 'Menu title'), self::$help_link);
     // set reading lang
     if (Object::has_extension('SiteTree', 'Translatable') && !$this->isAjax()) {
         Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
     }
     // Allow customisation of the access check by a decorator
     // Also all the canView() check to execute Director::redirect()
     if (!$this->canView() && !$this->response->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 return Director::redirect($candidate->Link);
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "Please choose an authentication method and enter your credentials to access the CMS."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."));
         return Security::permissionFailure($this, $messageSet);
     }
     // Don't continue if there's already been a redirection request.
     if (Director::redirected_to()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Set the members html editor config
     HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS());
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HtmlEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     if (!$htmlEditorConfig->getOption('content_css')) {
         $cssFiles = 'cms/css/editor.css';
         // Use theme from the site config
         if (($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (SSViewer::current_theme()) {
             $theme = SSViewer::current_theme();
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles .= ',' . THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles .= ',' . project() . '/css/editor.css';
             }
         }
         $htmlEditorConfig->setOption('content_css', $cssFiles);
     }
     Requirements::css(CMS_DIR . '/css/typography.css');
     Requirements::css(CMS_DIR . '/css/layout.css');
     Requirements::css(CMS_DIR . '/css/cms_left.css');
     Requirements::css(CMS_DIR . '/css/cms_right.css');
     Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
     if (isset($_REQUEST['debug_firebug'])) {
         // Firebug is a useful console for debugging javascript
         // Its available as a Firefox extension or a javascript library
         // for easy inclusion in other browsers (just append ?debug_firebug=1 to the URL)
         Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/firebug-lite/firebug.js');
     } else {
         // By default, we include fake-objects for all firebug calls
         // to avoid javascript errors when referencing console.log() etc in javascript code
         Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/firebug-lite/firebugx.js');
     }
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototypefix/intro.js');
     Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototypefix/outro.js');
     Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js');
     Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
     //import all of jquery ui
     Requirements::javascript(CMS_DIR . '/thirdparty/jquery-layout/jquery.layout.js');
     Requirements::javascript(CMS_DIR . '/thirdparty/jquery-layout/jquery.layout.state.js');
//.........这里部分代码省略.........
开发者ID:rodneyway,项目名称:silverstripe-cms,代码行数:101,代码来源:LeftAndMain.php

示例6: init

 function init()
 {
     CMSMenu::remove_menu_item('Help');
     CMSMenu::add_link('Help', "Help", "http://www.silverstripe.purplespider.com/" . Config::inst()->get($this->class, 'url'), -2, array("target" => "_blank"));
 }
开发者ID:helpfulrobot,项目名称:purplespider-mypswd-tweaks,代码行数:5,代码来源:CMSHelpLink.php

示例7: resetMenu

 /**
  * Clear menu to default state as per LeftAndMain::init()
  */
 protected function resetMenu()
 {
     CMSMenu::clear_menu();
     CMSMenu::populate_menu();
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), LeftAndMain::config()->help_link, -2, array('target' => '_blank'));
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:9,代码来源:LeftAndMainTest.php

示例8: init

 /**
  * @uses LeftAndMainExtension->init()
  * @uses LeftAndMainExtension->accessedCMS()
  * @uses CMSMenu
  */
 function init()
 {
     parent::init();
     SSViewer::setOption('rewriteHashlinks', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::set_date_format($member->DateFormat);
     }
     if (!empty($member->TimeFormat)) {
         i18n::set_time_format($member->TimeFormat);
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', PR_HIGH, 'Menu title'), self::$help_link);
     // Allow customisation of the access check by a extension
     // Also all the canView() check to execute Director::redirect()
     if (!$this->canView() && !$this->response->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 return Director::redirect($candidate->Link);
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "Please choose an authentication method and enter your credentials to access the CMS."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."));
         return Security::permissionFailure($this, $messageSet);
     }
     // Don't continue if there's already been a redirection request.
     if (Director::redirected_to()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Requirements
     Requirements::combine_files('lib.js', array(THIRDPARTY_DIR . '/prototype/prototype.js', THIRDPARTY_DIR . '/behaviour/behaviour.js', THIRDPARTY_DIR . '/jquery/jquery.js', SAPPHIRE_DIR . '/javascript/jquery_improvements.js', THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js', SAPPHIRE_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', SAPPHIRE_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js', SAPPHIRE_DIR . '/javascript/TreeDropdownField.js', SAPPHIRE_DIR . "/thirdparty/jquery-form/jquery.form.js", SAPPHIRE_DIR . '/javascript/DateField.js', SAPPHIRE_DIR . '/javascript/HtmlEditorField.js', SAPPHIRE_DIR . '/javascript/TabSet.js', SAPPHIRE_DIR . '/javascript/Validator.js', SAPPHIRE_DIR . '/javascript/i18n.js', SAPPHIRE_ADMIN_DIR . '/javascript/ssui.core.js'));
     Requirements::combine_files('leftandmain.js', array(SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Content.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.AddForm.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js'));
     Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
     Requirements::add_i18n_javascript(SAPPHIRE_ADMIN_DIR . '/javascript/lang');
     Requirements::combine_files('lib.css', array(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css', SAPPHIRE_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css', THIRDPARTY_DIR . '/jstree/themes/apple/style.css', SAPPHIRE_DIR . '/javascript/TreeDropdownField.css', SAPPHIRE_ADMIN_DIR . '/css/unjquery.css'));
     Requirements::css(SAPPHIRE_ADMIN_DIR . '/css/screen.css');
     // Set the members html editor config
     HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS());
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HtmlEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     if (!$htmlEditorConfig->getOption('content_css')) {
         $cssFiles = array();
         $cssFiles[] = 'sapphire/admin/css/editor.css';
         // Use theme from the site config
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (SSViewer::current_theme()) {
             $theme = SSViewer::current_theme();
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles[] = THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles[] = project() . '/css/editor.css';
             }
         }
         // Remove files that don't exist
         foreach ($cssFiles as $k => $cssFile) {
             if (!file_exists(BASE_PATH . '/' . $cssFile)) {
                 unset($cssFiles[$k]);
             }
         }
         $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
     }
     foreach (self::$extra_requirements['javascript'] as $file) {
         Requirements::javascript($file[0]);
     }
     foreach (self::$extra_requirements['css'] as $file) {
         Requirements::css($file[0], $file[1]);
     }
     foreach (self::$extra_requirements['themedcss'] as $file) {
         Requirements::themedCSS($file[0], $file[1]);
     }
     $dummy = null;
     $this->extend('init', $dummy);
     // The user's theme shouldn't affect the CMS, if, for example, they have replaced
     // TableListField.ss or Form.ss.
     SSViewer::set_theme(null);
//.........这里部分代码省略.........
开发者ID:rixrix,项目名称:sapphire,代码行数:101,代码来源:LeftAndMain.php

示例9: init

	/**
	 * @uses LeftAndMainDecorator->init()
	 * @uses LeftAndMainDecorator->accessedCMS()
	 * @uses CMSMenu
	 * @uses Director::set_site_mode()
	 */
	function init() {
		parent::init();

		Director::set_site_mode('cms');
		
		// set language
		$member = Member::currentUser();
		if(!empty($member->Locale)) {
			i18n::set_locale($member->Locale);
		}
		
		// can't be done in cms/_config.php as locale is not set yet
		CMSMenu::add_link(
			'Help', 
			_t('LeftAndMain.HELP', 'Help', PR_HIGH, 'Menu title'), 
			'http://userhelp.silverstripe.com'
		);
		
		// set reading lang
		if(Translatable::is_enabled() && !Director::is_ajax()) {
			Translatable::choose_site_lang(array_keys(Translatable::get_existing_content_languages('SiteTree')));
		}

		// Allow customisation of the access check by a decorator
		if(!$this->canView()) {
			// When access /admin/, we should try a redirect to another part of the admin rather than be locked out
			$menu = $this->MainMenu();
			foreach($menu as $candidate) {
				if(
					$candidate->Link && 
					$candidate->Link != $this->Link() 
					&& $candidate->MenuItem->controller 
					&& singleton($candidate->MenuItem->controller)->canView()
				) {
					return Director::redirect($candidate->Link);
				}
			}
			
			if(Member::currentUser()) {
				Session::set("BackURL", null);
			}
			
			// if no alternate menu items have matched, return a permission error
			$messageSet = array(
				'default' => _t('LeftAndMain.PERMDEFAULT',"Please choose an authentication method and enter your credentials to access the CMS."),
				'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY',"I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"),
				'logInAgain' => _t('LeftAndMain.PERMAGAIN',"You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."),
			);

			return Security::permissionFailure($this, $messageSet);
		}

		// Don't continue if there's already been a redirection request.
		if(Director::redirected_to()) return;

		// Audit logging hook
		if(empty($_REQUEST['executeForm']) && !Director::is_ajax()) $this->extend('accessedCMS');
		
		Requirements::css(CMS_DIR . '/css/typography.css');
		Requirements::css(CMS_DIR . '/css/layout.css');
		Requirements::css(CMS_DIR . '/css/cms_left.css');
		Requirements::css(CMS_DIR . '/css/cms_right.css');
		Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
		
		if(isset($_REQUEST['debug_firebug'])) {
			// Firebug is a useful console for debugging javascript
			// Its available as a Firefox extension or a javascript library
			// for easy inclusion in other browsers (just append ?debug_firebug=1 to the URL)
			Requirements::javascript(THIRDPARTY_DIR . '/firebug/firebug-lite-compressed.js');
		} else {
			// By default, we include fake-objects for all firebug calls
			// to avoid javascript errors when referencing console.log() etc in javascript code
			Requirements::javascript(THIRDPARTY_DIR . '/firebug/firebugx.js');
		}
		
		Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
		Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
		Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery_improvements.js');
		Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
		Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/livequery/jquery.livequery.js');
		Requirements::javascript(SAPPHIRE_DIR . '/javascript/core/jquery.ondemand.js');
		Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js');
		Requirements::javascript(THIRDPARTY_DIR . '/loader.js');
		Requirements::javascript(THIRDPARTY_DIR . '/hover.js');
		Requirements::javascript(THIRDPARTY_DIR . '/layout_helpers.js');
		Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
		
		Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js');
		Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/dragdrop.js');
		Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/controls.js');

		Requirements::css(THIRDPARTY_DIR . '/greybox/greybox.css');
		Requirements::javascript(THIRDPARTY_DIR . '/greybox/AmiJS.js');
		Requirements::javascript(THIRDPARTY_DIR . '/greybox/greybox.js');
//.........这里部分代码省略.........
开发者ID:neopba,项目名称:silverstripe-book,代码行数:101,代码来源:LeftAndMain.php

示例10: init

 /**
  * @uses LeftAndMainExtension->init()
  * @uses LeftAndMainExtension->accessedCMS()
  * @uses CMSMenu
  */
 public function init()
 {
     parent::init();
     Config::inst()->update('SSViewer', 'rewrite_hash_links', false);
     Config::inst()->update('ContentNegotiator', 'enabled', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::config()->date_format = $member->DateFormat;
     }
     if (!empty($member->TimeFormat)) {
         i18n::config()->time_format = $member->TimeFormat;
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), $this->config()->help_link, -2, array('target' => '_blank'));
     // Allow customisation of the access check by a extension
     // Also all the canView() check to execute Controller::redirect()
     if (!$this->canView() && !$this->getResponse()->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 return $this->redirect($candidate->Link);
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "You must be logged in to access the administration area; please enter your credentials below."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do" . " so below."), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and" . " password below."));
         return Security::permissionFailure($this, $messageSet);
     }
     // Don't continue if there's already been a redirection request.
     if ($this->redirectedTo()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->getRequest()->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Set the members html editor config
     if (Member::currentUser()) {
         HtmlEditorConfig::set_active_identifier(Member::currentUser()->getHtmlEditorConfigForCMS());
     }
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HtmlEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     if (!$htmlEditorConfig->getOption('content_css')) {
         $cssFiles = array();
         $cssFiles[] = FRAMEWORK_ADMIN_DIR . '/css/editor.css';
         // Use theme from the site config
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (Config::inst()->get('SSViewer', 'theme_enabled') && Config::inst()->get('SSViewer', 'theme')) {
             $theme = Config::inst()->get('SSViewer', 'theme');
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles[] = THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles[] = project() . '/css/editor.css';
             }
         }
         // Remove files that don't exist
         foreach ($cssFiles as $k => $cssFile) {
             if (!file_exists(BASE_PATH . '/' . $cssFile)) {
                 unset($cssFiles[$k]);
             }
         }
         $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
     }
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/bundle-lib.js', ['provides' => [THIRDPARTY_DIR . '/jquery/jquery.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', THIRDPARTY_DIR . '/jquery-form/jquery.form.js', THIRDPARTY_DIR . '/jquery-ondemand/jquery.ondemand.js', THIRDPARTY_DIR . '/jquery-changetracker/lib/jquery.changetracker.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', FRAMEWORK_DIR . '/javascript/dist/TreeDropdownField.js', FRAMEWORK_DIR . '/javascript/dist/DateField.js', FRAMEWORK_DIR . '/javascript/dist/HtmlEditorField.js', FRAMEWORK_DIR . '/javascript/dist/TabSet.js', FRAMEWORK_DIR . '/javascript/dist/GridField.js', FRAMEWORK_DIR . '/javascript/dist/i18n.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/sspath.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/ssui.core.js']]);
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/bundle-leftandmain.js', ['provides' => [FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Layout.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.ActionTabSet.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Panel.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Tree.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Content.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.EditForm.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Menu.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Preview.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.BatchActions.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.FieldHelp.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.FieldDescriptionToggle.js', FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.TreeDropdownField.js']]);
     Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', false, true);
     Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', false, true);
     if ($this->config()->session_keepalive_ping) {
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Ping.js');
     }
     if (Director::isDev()) {
         // TODO Confuses jQuery.ondemand through document.write()
         Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/leaktools.js');
     }
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css');
     Requirements::css(THIRDPARTY_DIR . '/jstree/themes/apple/style.css');
     Requirements::css(FRAMEWORK_DIR . '/css/TreeDropdownField.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css');
//.........这里部分代码省略.........
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:101,代码来源:LeftAndMain.php

示例11: init

 /**
  * @uses LeftAndMainExtension->init()
  * @uses LeftAndMainExtension->accessedCMS()
  * @uses CMSMenu
  */
 protected function init()
 {
     parent::init();
     Config::inst()->update('SSViewer', 'rewrite_hash_links', false);
     Config::inst()->update('ContentNegotiator', 'enabled', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::config()->date_format = $member->DateFormat;
     }
     if (!empty($member->TimeFormat)) {
         i18n::config()->time_format = $member->TimeFormat;
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), $this->config()->help_link, -2, array('target' => '_blank'));
     // Allow customisation of the access check by a extension
     // Also all the canView() check to execute Controller::redirect()
     if (!$this->canView() && !$this->getResponse()->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 $this->redirect($candidate->Link);
                 return;
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "You must be logged in to access the administration area; please enter your credentials below."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do" . " so below."), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and" . " password below."));
         Security::permissionFailure($this, $messageSet);
         return;
     }
     // Don't continue if there's already been a redirection request.
     if ($this->redirectedTo()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->getRequest()->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Set the members html editor config
     if (Member::currentUser()) {
         HTMLEditorConfig::set_active_identifier(Member::currentUser()->getHtmlEditorConfigForCMS());
     }
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HTMLEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     Requirements::customScript("\n\t\t\twindow.ss = window.ss || {};\n\t\t\twindow.ss.config = " . $this->getCombinedClientConfig() . ";\n\t\t");
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/bundle-lib.js', ['provides' => [THIRDPARTY_DIR . '/jquery/jquery.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', THIRDPARTY_DIR . '/jquery-form/jquery.form.js', THIRDPARTY_DIR . '/jquery-ondemand/jquery.ondemand.js', THIRDPARTY_DIR . '/jquery-changetracker/lib/jquery.changetracker.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', FRAMEWORK_DIR . '/client/dist/js/TreeDropdownField.js', FRAMEWORK_DIR . '/client/dist/js/DateField.js', FRAMEWORK_DIR . '/client/dist/js/HtmlEditorField.js', FRAMEWORK_DIR . '/client/dist/js/TabSet.js', FRAMEWORK_DIR . '/client/dist/js/GridField.js', FRAMEWORK_DIR . '/client/dist/js/i18n.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/sspath.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/ssui.core.js']]);
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/bundle-legacy.js', ['provides' => [FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Layout.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.ActionTabSet.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Panel.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Tree.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Content.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.EditForm.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Menu.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Preview.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.BatchActions.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.FieldHelp.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.FieldDescriptionToggle.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.TreeDropdownField.js', FRAMEWORK_ADMIN_DIR . '/client/dist/js/AddToCampaignForm.js']]);
     Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/client/lang', false, true);
     Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/client/lang', false, true);
     if ($this->config()->session_keepalive_ping) {
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/LeftAndMain.Ping.js');
     }
     if (Director::isDev()) {
         // TODO Confuses jQuery.ondemand through document.write()
         Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/leaktools.js');
     }
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/client/dist/js/bundle-framework.js');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::css(THIRDPARTY_DIR . '/jstree/themes/apple/style.css');
     Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/TreeDropdownField.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/client/dist/styles/bundle.css');
     Requirements::css(FRAMEWORK_DIR . '/client/dist/styles/GridField.css');
     // Custom requirements
     $extraJs = $this->stat('extra_requirements_javascript');
     if ($extraJs) {
         foreach ($extraJs as $file => $config) {
             if (is_numeric($file)) {
                 $file = $config;
             }
             Requirements::javascript($file);
         }
     }
     $extraCss = $this->stat('extra_requirements_css');
     if ($extraCss) {
         foreach ($extraCss as $file => $config) {
             if (is_numeric($file)) {
                 $file = $config;
                 $config = array();
             }
             Requirements::css($file, isset($config['media']) ? $config['media'] : null);
         }
     }
     $extraThemedCss = $this->stat('extra_requirements_themedCss');
     if ($extraThemedCss) {
//.........这里部分代码省略.........
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:101,代码来源:LeftAndMain.php


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