Пример #1
0
 public function __construct($bShouldLogin = true)
 {
     parent::__construct();
     SanityCheck::basicCheck();
     if ($bShouldLogin && (!Session::getSession()->isAuthenticated() || !Session::getSession()->getUser()->getIsBackendLoginEnabled())) {
         LinkUtil::redirect(LinkUtil::link(array(), 'AdminManager', array('preview' => self::getRequestedPath())));
     }
     $oResourceIncluder = ResourceIncluder::defaultIncluder();
     $oResourceIncluder->addCustomJs('window.FILE_PREFIX = "' . MAIN_DIR_FE_PHP . Manager::getPrefixForManager('FileManager') . '";');
     //Fix JSON requests when using Prototype in the frontend
     $oResourceIncluder->addReverseDependency('lib_prototype', false, 'preview/prototype_json_fix.js');
     //Add jQuery and jQuery UI
     $oResourceIncluder->addJavaScriptLibrary('jquery', AdminManager::JQUERY_VERSION, null, true, null, ResourceIncluder::PRIORITY_FIRST);
     $oResourceIncluder->addJavaScriptLibrary('jqueryui', AdminManager::JQUERY_UI_VERSION);
     //Add client widget handling code
     $oResourceIncluder->addResource('widget/widget.js');
     $oResourceIncluder->addResource('widget/widget_skeleton.js');
     //Provides some basic overrides for tooltip, notifyuser and stuff
     //Override some site styles in specific regions
     $oResourceIncluder->addResource('preview/preview-reset.css');
     $oResourceIncluder->addResource('preview/preview-default.css');
     $oResourceIncluder->addResource('admin/theme/jquery-ui-1.10.2.custom.min.css');
     //Add the css that handles styles for all widgets but namespace it so it applies only to specific areas of the page (editable areas, dialogs, the admin menu, etc.)
     $this->addNamespacedCss(array('widget', 'widget.css'));
     $oResourceIncluder->addResource('backend/additions.js', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oResourceIncluder->addResource('preview/additions.js', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oResourceIncluder->addResource('backend/additions.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oResourceIncluder->addResource('preview/additions.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     //preview-interface.css contains things like the edit buttons
     ResourceIncluder::defaultIncluder()->addResource('preview-interface.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     //Include the resources of widgets we know we’re gonna use.
     if ($bShouldLogin) {
         $oLoginWindowWidget = WidgetModule::getWidget('login_window');
         LoginWindowWidgetModule::includeResources();
     }
     $this->oAdminMenuWidget = WidgetModule::getWidget('admin_menu');
     AdminMenuWidgetModule::includeResources();
     $this->oPageTypeWidget = WidgetModule::getWidget('page_type');
     PageTypeWidgetModule::includeResources();
 }
Пример #2
0
 private function doAdmin($oTemplate)
 {
     $oAdminMenuWidget = new AdminMenuWidgetModule();
     AdminMenuWidgetModule::includeResources($this->oResourceIncluder);
     $oTemplate->replaceIdentifierMultiple('main_content', $this->oModule->mainContent());
     $mSidebarContent = $this->oModule->sidebarContent();
     if ($mSidebarContent === null) {
         $mSidebarContent = '';
     } else {
         if ($mSidebarContent === false) {
             $mSidebarContent = null;
         }
     }
     $oTemplate->replaceIdentifierMultiple('sidebar_content', $mSidebarContent);
     $oTemplate->replaceIdentifierMultiple('admin_menu', $oAdminMenuWidget->doWidget());
     foreach ($this->oModule->usedWidgets() as $mWidget) {
         if (!is_string($mWidget)) {
             $mWidget = get_class($mWidget);
         } else {
             $mWidget = WidgetModule::getClassNameByName($mWidget);
         }
         call_user_func(array($mWidget, 'includeResources'), $this->oResourceIncluder);
     }
     $this->oModule->includeCustomResources($this->oResourceIncluder);
 }