Example #1
0
 /**
  * Show login form
  */
 protected function loginAction()
 {
     $template = new Template();
     $template->set('wwwRoot', $this->_configMain->get('wwwroot'));
     $template->resource = Resource::getInstance();
     Response::put($template->render('./templates/public/backoffice_login.php'));
     Application::close();
 }
Example #2
0
 /**
  * Show login form
  */
 protected function loginAction()
 {
     $template = new Template();
     $template->set('wwwRoot', $this->_configMain->get('wwwroot'));
     Response::put($template->render('./templates/system/' . $this->_configBackend->get('theme') . '/login.php'));
     Application::close();
 }
Example #3
0
 /**
  * Show Page.
  * Running this method initiates rendering of templates and sending of HTML
  * data.
  *
  * @param Page $page
  * @param Blockmanager $blockManager
  */
 public function showPage(Page $page, Blockmanager $blockManager)
 {
     header('Content-Type: text/html; charset=utf-8');
     $template = new Template();
     $template->disableCache();
     $template->setProperties(array('development' => $this->_appConfig->get('development'), 'page' => $page, 'path' => $page->getThemePath(), 'templatesRoot' => Application::getTemplatesPath(), 'blockManager' => $blockManager, 'resource' => Resource::getInstance(), 'pagesTree' => Model::factory('Page')->getTree()));
     Response::put($template->render($page->getTemplatePath('layout.php')));
 }
Example #4
0
 /**
  * Run backend application
  */
 protected function _runBackend()
 {
     if ($this->_cache) {
         Blockmanager::setDefaultCache($this->_cache);
     }
     /*
      * Prepare objects
      */
     Db_Object_Builder::useForeignKeys($this->_config->get('foreign_keys'));
     /*
      * Inject Externals exper ino Objects Manager
      */
     if ($this->_config->get('allow_externals')) {
         Db_Object_Manager::setExternalsExpert($this->_getExternalsExpert());
     }
     $cfgBackend = Config::factory(Config::File_Array, $this->_config->get('configs') . 'backend.php');
     Registry::set('backend', $cfgBackend, 'config');
     self::$_templates = $this->_config->get('templates') . 'system/' . $cfgBackend->get('theme') . '/';
     $page = Page::getInstance();
     $page->setTemplatesPath(self::$_templates);
     $user = User::getInstance();
     /*
      * Update "Users Online" statistics
      */
     if ($this->_config->get('usersOnline') && $user->isAuthorized()) {
         Model::factory('Online')->addOnline(session_id(), $user->id);
     }
     /*
      * Start routing
      */
     $router = new Backend_Router();
     $router->route();
     $controller = Request::getInstance()->getPart(1);
     /*
      * Define frontent JS variables
      */
     $res = Resource::getInstance();
     $res->addInlineJs('
         app.wwwRoot = "' . $this->_config->get('wwwroot') . '";
     	app.admin = "' . $this->_config->get('wwwroot') . $this->_config->get('adminPath') . '";
     	app.delimiter = "' . $this->_config->get('urlDelimiter') . '";
     	app.root = "' . $this->_config->get('wwwroot') . $this->_config->get('adminPath') . $this->_config->get('urlDelimiter') . $controller . $this->_config->get('urlDelimiter') . '";
     ');
     /*
      * Load template
      */
     $template = new Template();
     $template->disableCache();
     $template->setProperties(array('wwwRoot' => $this->_config->get('wwwroot'), 'page' => $page, 'urlPath' => $controller, 'resource' => $res, 'path' => self::$_templates, 'adminPath' => $this->_config->get('adminPath'), 'development' => $this->_config->get('development'), 'version' => Config::factory(Config::File_Array, $this->_config->get('configs') . 'versions.php')->get('core'), 'lang' => $this->_config->get('language'), 'modules' => Config::factory(Config::File_Array, $this->_config->get('backend_modules')), 'userModules' => $user->getAvailableModules(), 'useCSRFToken' => $cfgBackend->get('use_csrf_token')));
     Response::put($template->render(self::$_templates . 'layout.php'));
 }
Example #5
0
 public function devinfoAction()
 {
     $template = new Template();
     Response::put($template->render('./templates/system/default/devindex.php'));
 }
Example #6
0
    public function indexAction()
    {
        if (!$this->_session->keyExists('loaded') || !$this->_session->get('loaded')) {
            Response::put('');
            exit;
        }
        $designerConfig = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'designer.php');
        $res = Resource::getInstance();
        $res->addJs('/js/lib/jquery.js', 0);
        Model::factory('Medialib')->includeScripts();
        $res->addJs('/js/app/system/SearchPanel.js');
        $res->addJs('/js/app/system/HistoryPanel.js', 0);
        $res->addJs('/js/lib/ext_ux/RowExpander.js', 0);
        $res->addJs('/js/app/system/RevisionPanel.js', 1);
        $res->addJs('/js/app/system/EditWindow.js', 2);
        $res->addJs('/js/app/system/ContentWindow.js', 3);
        $res->addJs('/js/app/system/designer/viewframe/main.js', 4);
        $res->addJs('/js/app/system/designer/lang/' . $designerConfig['lang'] . '.js', 5);
        $project = $this->_getProject();
        $projectCfg = $project->getConfig();
        Ext_Code::setRunNamespace($projectCfg['runnamespace']);
        Ext_Code::setNamespace($projectCfg['namespace']);
        $grids = $project->getGrids();
        if (!empty($grids)) {
            foreach ($grids as $name => $object) {
                if ($object->isInstance()) {
                    continue;
                }
                $cols = $object->getColumns();
                if (!empty($cols)) {
                    foreach ($cols as $column) {
                        $column['data']->itemId = $column['id'];
                    }
                }
                $object->addListener('columnresize', '{
							 fn:function( ct, column, width,eOpts){
								app.application.onGridColumnResize("' . $name . '", ct, column, width, eOpts);
							 }
				}');
                $object->addListener('columnmove', '{
							fn:function(ct, column, fromIdx, toIdx, eOpts){
								app.application.onGridColumnMove("' . $name . '", ct, column, fromIdx, toIdx, eOpts);
							}
				}');
            }
        }
        $dManager = new Dictionary_Manager();
        $key = 'vf_' . md5($dManager->getDataHash() . serialize($project));
        $templates = $designerConfig->get('templates');
        $replaces = array(array('tpl' => $templates['wwwroot'], 'value' => $this->_configMain->get('wwwroot')), array('tpl' => $templates['adminpath'], 'value' => $this->_configMain->get('adminPath')), array('tpl' => $templates['urldelimiter'], 'value' => $this->_configMain->get('urlDelimiter')));
        $includes = Designer_Factory::getProjectIncludes($key, $project, true, $replaces);
        if (!empty($includes)) {
            foreach ($includes as $file) {
                if (File::getExt($file) == '.css') {
                    $res->addCss($file, false);
                } else {
                    $res->addJs($file, false, false);
                }
            }
        }
        $names = $project->getRootPanels();
        $basePaths = array();
        $parts = explode('/', $this->_configMain->get('wwwroot'));
        if (is_array($parts) && !empty($parts)) {
            foreach ($parts as $item) {
                if (!empty($item)) {
                    $basePaths[] = $item;
                }
            }
        }
        $basePaths[] = $this->_configMain['adminPath'];
        $basePaths[] = 'designer';
        $basePaths[] = 'sub';
        //' . $project->getCode($replaces) . '
        $initCode = '
		app.delimiter = "' . $this->_configMain['urlDelimiter'] . '";
		app.admin = "' . $this->_configMain->get('wwwroot') . $this->_configMain->get('adminPath') . '";
		app.wwwRoot = "' . $this->_configMain->get('wwwroot') . '";

		var applicationClassesNamespace = "' . $projectCfg['namespace'] . '";
		var applicationRunNamespace = "' . $projectCfg['runnamespace'] . '";
		var designerUrlPaths = ["' . implode('","', $basePaths) . '"];
		var canDelete = true;
		var canPublish = true;
		var canEdit = true;

		Ext.onReady(function(){
		    app.application.mainUrl = app.createUrl(designerUrlPaths);
            ';
        if (!empty($names)) {
            foreach ($names as $name) {
                if ($project->getObject($name)->isExtendedComponent()) {
                    if ($project->getObject($name)->getConfig()->defineOnly) {
                        continue;
                    }
                    $initCode .= Ext_Code::appendRunNamespace($name) . ' = Ext.create("' . Ext_Code::appendNamespace($name) . '",{});';
                }
                $initCode .= '
			        app.viewFrame.add(' . Ext_Code::appendRunNamespace($name) . ');
			    ';
            }
        }
        $initCode .= '
        	 app.application.fireEvent("projectLoaded");
	   });';
        $res->addInlineJs($initCode);
        $tpl = new Template();
        $tpl->lang = $this->_configMain['language'];
        $tpl->development = $this->_configMain['development'];
        $tpl->resource = $res;
        $tpl->useCSRFToken = Registry::get('backend', 'config')->get('use_csrf_token');
        Response::put($tpl->render(Application::getTemplatesPath() . 'designer/viewframe.php'));
    }