Exemple #1
0
 public function indexAction()
 {
     $version = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'versions.php')->get('orm');
     $res = Resource::getInstance();
     $dbConfigs = array();
     foreach ($this->_configMain->get('db_configs') as $k => $v) {
         $dbConfigs[] = array('id' => $k, 'title' => $this->_lang->get($v['title']));
     }
     //tooltips
     $lPath = $this->_configMain->get('lang_path') . $this->_configMain->get('language') . '/orm.php';
     Lang::addDictionaryLoader('orm_tooltips', $lPath, Config::File_Array);
     $this->_resource->addInlineJs('
       var canPublish =  ' . (int) $this->_user->canPublish($this->_module) . ';
       var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
       var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
       var useForeignKeys = ' . (int) $this->_configMain['foreign_keys'] . ';
       var canUseBackup = ' . (int) $this->_isLocalhost() . ';
       var dbConfigsList = ' . json_encode($dbConfigs) . ';
     ');
     $this->_resource->addRawJs('var ormTooltips = ' . Lang::lang('orm_tooltips')->getJson() . ';');
     $res->addJs('/js/app/system/SearchPanel.js', 0);
     $res->addJs('/js/app/system/ORM.js?v=' . $version, 2);
     $res->addJs('/js/app/system/EditWindow.js', 1);
     $res->addJs('/js/app/system/HistoryPanel.js', 1);
     $res->addJs('/js/app/system/ContentWindow.js', 1);
     $res->addJs('/js/app/system/RevisionPanel.js', 2);
     $res->addJs('/js/app/system/RelatedGridPanel.js', 2);
     $res->addJs('/js/lib/uml/raphael.js', 3);
     // $res->addJs('/js/lib/uml/raphael.2.1.min.js'  , 3);
     $res->addJs('/js/lib/uml/joint.js', 4);
     $res->addJs('/js/lib/uml/joint.dia.js', 5);
     $res->addJs('/js/lib/uml/joint.dia.uml.js', 6);
 }
Exemple #2
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();
 }
Exemple #3
0
 public function __construct()
 {
     $this->_page = Page::getInstance();
     $this->_resource = Resource::getInstance();
     $this->_lang = Lang::lang();
     $this->_db = static::$_defaultDb;
     $this->_configMain = Registry::get('main', 'config');
 }
Exemple #4
0
 /**
  * (non-PHPdoc)
  * @see Backend_Controller::indexAction()
  */
 public function indexAction()
 {
     $res = Resource::getInstance();
     $res->addJs('/js/app/system/crud/logs.js', true, 1);
     $actions = array(array('id' => 0, 'title' => $this->_lang->ALL));
     foreach (Model_Historylog::$actions as $k => $v) {
         $actions[] = array('id' => $k, 'title' => $v);
     }
     $res->addInlineJs('var logActions = ' . json_encode($actions) . ';');
 }
Exemple #5
0
 /**
  * (non-PHPdoc)
  * 
  * @see Backend_Controller::indexAction()
  */
 public function indexAction()
 {
     $res = Resource::getInstance();
     $res->addJs('/js/app/system/FilesystemWindow.js', 1);
     $res->addJs('/js/app/system/crud/fmodules.js', 1);
     $this->_resource->addInlineJs('
     	var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
     	var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
  ');
 }
Exemple #6
0
 public function indexAction()
 {
     $res = Resource::getInstance();
     $res->addJs('/js/lib/extjs4/ux/RowExpander.js', 1);
     $res->addJs('/js/app/system/crud/compiler.js', 2);
     $res->addJs('/js/app/system/SearchPanel.js', 3);
     $this->_resource->addInlineJs('
     	var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
     	var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
     ');
 }
Exemple #7
0
    /**
     * (non-PHPdoc)
     * @see Backend_Controller::indexAction()
     */
    public function indexAction()
    {
        $res = Resource::getInstance();
        $res->addJs('/js/app/system/ImportPanel.js', 0);
        $res->addJs('/js/app/system/crud/import.js', 1);
        $this->_resource->addInlineJs('
	        var importLang = ' . $this->_iLang->getJson() . ';
            var canPublish =  ' . (int) $this->_user->canPublish($this->_module) . ';
        	var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
        	var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
        ');
    }
Exemple #8
0
 /**
  * (non-PHPdoc)
  * 
  * @see Backend_Controller::indexAction()
  */
 public function indexAction()
 {
     $res = Resource::getInstance();
     $res->addJs('/js/lib/ext_ux/SearchField.js');
     $this->_resource->addJs('/js/lib/extjs4/ux/CheckColumn.js', 0);
     $this->_resource->addJs('/js/app/system/SearchPanel.js', 0);
     $res->addJs('/js/app/system/crud/acl.js', true, 1);
     $this->_resource->addInlineJs('
     	var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
     	var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
     ');
 }
Exemple #9
0
 /**
  * (non-PHPdoc)
  * @see Backend_Controller::indexAction()
  */
 public function indexAction()
 {
     $res = Resource::getInstance();
     $res->addJs('/js/app/system/FilesystemWindow.js', 1);
     $this->_resource->addJs('/js/lib/extjs4/ux/CheckColumn.js', 1);
     $this->_resource->addJs('/js/lib/ext_ux/CTemplate.js', 1);
     $this->_resource->addJs('/js/lib/ext_ux/ComponentColumn.js', 2);
     $res->addJs('/js/app/system/crud/modules.js', 2);
     $this->_resource->addInlineJs('
     	var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
     	var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
     ');
 }
Exemple #10
0
 public function indexAction()
 {
     parent::indexAction();
     $resource = Resource::getInstance();
     $resource->addJs('/js/app/system/BlocksPanel.js', 3);
     $fModules = Config::factory(Config::File_Array, $this->_configMain->get('frontend_modules'));
     $funcList = array(array('id' => '', 'title' => '---'));
     foreach ($fModules as $code => $config) {
         $funcList[] = array('id' => $code, 'title' => $config['title']);
     }
     $resource->addInlineJs('
     	var aFuncCodes = ' . json_encode($funcList) . ';
     ');
 }
Exemple #11
0
 /**
  * (non-PHPdoc)
  * @see Backend_Controller::indexAction()
  */
 public function indexAction()
 {
     $res = Resource::getInstance();
     $this->_resource->addInlineJs('
     	var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
     	var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
     ');
     $res->addJs('/js/app/system/SearchPanel.js', 0);
     $res->addJs('/js/app/system/crud/deploy/application.js', 1);
     $res->addJs('/js/app/system/crud/deploy/servers.js', 1);
     $res->addJs('/js/app/system/crud/deploy/monitor.js', 1);
     $res->addJs('/js/app/system/crud/deploy/history.js', 1);
     $res->addJs('/js/app/system/crud/deploy/db.js', 1);
     $res->addJs('/js/app/system/crud/deploy/files.js', 1);
     $res->addJs('/js/app/system/orm/dataGrid.js', 1);
     $res->addJs('/js/app/system/crud/deploy.js', 2);
 }
 public function actionEdit($type = false)
 {
     $cid = Request::getVar('cid', "");
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     setSysConfig("sidebar.display", 0);
     $this->addIconToolbar("Save", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'apply')), "apply");
     $this->addBarTitle("Permission <small>[Edit]</small>", "user");
     $this->addIconToolbar("Close", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'cancel')), "cancel");
     $this->pageTitle = "Edit resource";
     $model = Resource::getInstance();
     $item = $model->getItem($cid);
     $data['lists'] = $model->getListEdit($item);
     $data['item'] = $item;
     $this->render('edit', $data);
 }
 function actionGrant()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     global $user;
     $cid = Request::getVar('cid', 0);
     $obj_user = YiiUser::getInstance();
     $obj_user = $obj_user->getUser($cid);
     $this->addBarTitle("Grant user <small>[{$obj_user->username}]</small>", "user");
     $this->addIconToolbar("Save", Router::buildLink("permission", array('view' => 'users', 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("permission", array('view' => 'users', 'layout' => 'apply')), "apply");
     $this->addIconToolbar("Close", Router::buildLink("permission", array('view' => 'users', 'layout' => 'cancel')), "cancel");
     $this->pageTitle = "Edit grant";
     $model_resource = Resource::getInstance();
     $model = Users::getInstance();
     $items = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $lists = $model->getListGrant();
     $this->render('grant', array("items" => $items, "all_granted" => $all_granted, "lists" => $lists));
 }
Exemple #14
0
 public function indexAction()
 {
     $res = Resource::getInstance();
     $this->_resource->addInlineJs('
     	var canEdit = ' . (bool) $this->_user->canEdit($this->_module) . ';
     	var canDelete = ' . (bool) $this->_user->canDelete($this->_module) . ';
     ');
     $this->_resource->addCss('/js/lib/CodeMirror/lib/codemirror.css');
     $this->_resource->addJs('/js/lib/CodeMirror/lib/codemirror.js', 1);
     $this->_resource->addJs('/js/lib/CodeMirror/mode/mysql/mysql.js', 2);
     $this->_resource->addCss('/js/lib/CodeMirror/theme/eclipse.css');
     $this->_resource->addJs('/js/lib/CodeMirror/lib/util/formatting.js', 2);
     $this->_resource->addJs('/js/lib/CodeMirror/lib/util/searchcursor.js', 2);
     $this->_resource->addJs('/js/lib/CodeMirror/lib/util/match-highlighter.js', 2);
     $this->_resource->addJs('/js/lib/CodeMirror/lib/util/dialog.js', 2);
     $this->_resource->addJs('/js/lib/CodeMirror/lib/util/search.js', 2);
     $res->addJs('/js/app/system/FilesystemWindow.js', 1);
     $res->addJs('/js/app/system/SqlEditor.js', 1);
     $res->addJs('/js/app/system/report/filter.js', 1);
     $res->addJs('/js/app/system/report/config.js', 1);
     $res->addJs('/js/app/system/report/results.js', 1);
     $res->addJs('/js/app/system/report/record.js', 1);
     $res->addJs('/js/app/system/crud/reports.js', 2);
 }
Exemple #15
0
 public function __construct()
 {
     $this->_page = Page::getInstance();
     $this->_resource = Resource::getInstance();
     $this->_module = $this->getModule();
     $this->_lang = Lang::lang();
     $this->_db = static::$_defaultDb;
     $this->_configMain = Registry::get('main', 'config');
     $cacheManager = new Cache_Manager();
     $this->_configBackoffice = Config::factory(Config::File_Array, $this->_configMain->get('configs') . 'backend.php');
     $this->_cache = $cacheManager->get('data');
     if (Request::get('logout', 'boolean', false)) {
         User::getInstance()->logout();
         session_destroy();
         if (!Request::isAjax()) {
             Response::redirect(Request::url(array('index')));
         }
     }
     $this->checkAuth();
     if ($this->_configBackoffice->get('use_csrf_token')) {
         $csrf = new Security_Csrf();
         $this->_page->csrfToken = $csrf->createToken();
     }
 }
Exemple #16
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')));
 }
Exemple #17
0
 /**
  * Conpile object
  * @param string $id
  * @return array()
  */
 protected function _compileItem($id)
 {
     $object = $this->_project->getObject($id);
     if ($object->getClass() === 'Component_Field_System_Medialibhtml') {
         /**
          * @todo Уменьшить связанность
          */
         Resource::getInstance()->addJs('/js/lib/jquery.js', 1);
         Model::factory('Medialib')->includeScripts();
     }
     $code = array('defines' => '', 'layout' => '');
     $code = $this->_compileJs($id);
     $definesCode = $code['defines'];
     $layoutCode = $code['layout'];
     $layoutCode .= $this->getObjectLayoutCode($id);
     return array('layout' => $layoutCode, 'defines' => $definesCode);
 }
Exemple #18
0
    /**
     * Init layout from designer project
     * @property string $projectFile - designer project related path
     * @property Config_Abstract $designerConfig
     * @property array $replaceTemplates, optional
     * @todo cache the code
     */
    public static function runProject($projectFile, Config_Abstract $designerConfig, $replace = array(), $renderTo = false)
    {
        /**
         * @todo slow operation
         */
        if (!file_exists($projectFile)) {
            throw new Exception('Invalid project file' . $projectFile);
        }
        /**
         * @todo slow operation
         */
        $cachedKey = self::getProjectCacheKey($projectFile);
        $project = Designer_Factory::loadProject($designerConfig, $projectFile);
        $projectCfg = $project->getConfig();
        Ext_Code::setRunNamespace($projectCfg['runnamespace']);
        $projectData['includes'] = self::getProjectIncludes($cachedKey, $project, true, $replace);
        $names = $project->getRootPanels();
        $actionJs = $project->getActionsFile();
        $initCode = '
		    var applicationClassesNamespace = "' . $projectCfg['namespace'] . '";
			var applicationRunNamespace = "' . $projectCfg['runnamespace'] . '";
		';
        $initCode .= 'Ext.onReady(function(){';
        if (!empty($names)) {
            if ($renderTo) {
                $renderTo = str_replace('-', '_', $renderTo);
                $initCode .= '
				app.content = Ext.create("Ext.container.Container", {
					layout:"fit",
					renderTo:"' . $renderTo . '"
				});
      		   ';
            }
            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.content.add(' . Ext_Code::appendRunNamespace($name) . ');
				';
            }
            if ($renderTo) {
                $initCode .= '
			      	app.content.doComponentLayout();
				';
            }
        }
        $initCode .= '
		              app.application.fireEvent("projectLoaded");
	           });';
        $resource = Resource::getInstance();
        if ($projectData && isset($projectData['includes']) && !empty($projectData['includes'])) {
            foreach ($projectData['includes'] as $file) {
                if (File::getExt($file) == '.css') {
                    if (strpos($file, '?') === false) {
                        $file = $file . '?' . $cachedKey;
                    }
                    $resource->addCss($file, false);
                } else {
                    if (strpos($file, '?') === false) {
                        $file = $file . '?' . $cachedKey;
                    }
                    $resource->addJs($file, false, false);
                }
            }
        }
        $resource->addInlineJs($initCode);
    }
 public function actionEdit()
 {
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to add/edit group");
         $this->redirect(Router::buildLink("users", array('view' => 'group')));
     }
     setSysConfig("sidebar.display", 0);
     $this->addIconToolbar("Save", Router::buildLink("users", array("view" => "group", "layout" => "save")), "save");
     $this->addIconToolbar("Apply", Router::buildLink("users", array("view" => "group", "layout" => "apply")), "apply");
     $items = array();
     $cid = Request::getVar("cid", 0);
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     if ($cid == 0) {
         $this->addIconToolbar("Cancel", Router::buildLink("users", array("view" => "group", "layout" => "cancel")), "cancel");
         $this->addBarTitle("User group <small>[New]</small>", "user");
         $this->pageTitle = "New group";
     } else {
         $this->addIconToolbar("Close", Router::buildLink("users", array("view" => "group", "layout" => "cancel")), "cancel");
         $this->addBarTitle("User group <small>[Edit]</small>", "user");
         $this->pageTitle = "Edit group";
     }
     $model = new Group();
     $model_resource = Resource::getInstance();
     $item = $model->getItem();
     $lists = $model->getListEdit($item);
     $arr_resource = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $this->render('edit', array("item" => $item, "lists" => $lists, 'arr_resource' => $arr_resource, "all_granted" => $all_granted));
 }
Exemple #20
0
<?php

if (!defined('DVELUM')) {
    exit;
}
$page = $this->get('page');
$resource = Resource::getInstance();
$resource->addCss('/templates/public/main/css/reset.css', 0);
$resource->addCss('/templates/public/main/css/style.css', 100);
$wwwRoot = Request::wwwRoot();
?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo $page->html_title;
?>
</title>
	<?php 
/*<BASE href="<?php echo Request::baseUrl();?>">*/
$page = $this->get('page');
echo $page->getOgMeta();
if (isset($page->csrfToken) && !empty($page->csrfToken)) {
    echo '<meta name="csrf-token" content="' . $page->csrfToken . '"/>';
}
if (strlen($page->meta_description)) {
    echo '	<meta name="DESCRIPTION" content="' . $page->meta_description . '" />' . "\n";
}
if (strlen($page->meta_keywords)) {
    echo '	<meta name="KEYWORDS" content="' . $page->meta_keywords . '" />';
}
Exemple #21
0
		 <div class="block_wrap feature_wrap">
			 <div class="bottom elements">
				 <div class="layout-wrap sidebar-right">
					<div class="content-wrap">
						<div id="content" class="content">
						   <h3><?php 
echo $page->page_title;
?>
</h3>
						   <?php 
echo $page->text;
?>
						</div>
						<div class="sep"></div>
					</div>
					<div id="sidebar">
						<?php 
echo $this->get('blockManager')->getBlocksHtml('rightblocks');
?>
					</div>
				 </div>	
			 </div>
		 </div>
	</div><!--end:fullwidth-->
</div><!--end:container-->
<?php 
$template = new Template();
$template->set('page', Page::getInstance());
$template->set('resource', Resource::getInstance());
$template->set('bottomBlocks', $this->get('blockManager')->getBlocksHtml('bottomblocks'));
echo $template->render($this->path . '/footer.php');
Exemple #22
0
 /**
  * Include required JavaScript files defined in the configuration file
  */
 public function includeScripts()
 {
     $resource = Resource::getInstance();
     $media = Model::factory('Medialib');
     $media->includeScripts();
     $includesPath = $this->configMain->get('configs') . 'js_inc_backend.php';
     $cfg = Config::factory(Config::File_Array, $includesPath);
     $resource->addJs('/js/lib/jquery.js', 0, true, 'head');
     if ($this->configMain->get('development')) {
         $resource->addJs('/js/lib/extjs4/ext-all-debug.js', 0, true, 'head');
     } else {
         $resource->addJs('/js/lib/extjs4/ext-all.js', 0, true, 'head');
     }
     $resource->addJs('/js/lang/' . $this->configMain['language'] . '.js', 1, true, 'head');
     $resource->addJs('/js/lib/extjs4/locale/ext-lang-' . $this->configMain['language'] . '.js', 2, true, 'head');
     $resource->addJs('/js/app/system/common.js', 3, false, 'head');
     $resource->addJs('/js/lib/extjs4/ext-theme-gray.js', 2);
     $resource->addCss('/js/lib/extjs4/resources/css/ext-all-gray.css');
     $resource->addCss('/templates/system/default/css/style.css');
     if ($cfg->getCount()) {
         $js = $cfg->get('js');
         if (!empty($js)) {
             foreach ($js as $file => $config) {
                 $resource->addJs($file, $config['order'], $config['minified']);
             }
         }
         $css = $cfg->get('css');
         if (!empty($css)) {
             foreach ($css as $file => $config) {
                 $resource->addCss($file, $config['order']);
             }
         }
     }
 }
 function actionEdit()
 {
     global $user;
     setSysConfig("sidebar.display", 0);
     $model = new Users();
     $cid = Request::getVar("cid", 0);
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     $this->addIconToolbar("Save", Router::buildLink("users", array("view" => "user", 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("users", array("view" => "user", 'layout' => 'apply')), "apply");
     if ($cid == 0) {
         $this->addIconToolbar("Cancel", Router::buildLink("users", array("view" => "user", 'layout' => 'cancel')), "cancel");
         $this->addBarTitle("User <small>[New]</small>", "user");
         $this->pageTitle = "New User";
     } else {
         $this->addIconToolbar("Close", Router::buildLink("users", array("view" => "user", 'layout' => 'cancel')), "cancel");
         $this->addBarTitle("User <small>[Edit]</small>", "user");
         $this->pageTitle = "Edit User";
     }
     $model = new Users();
     $model_resource = Resource::getInstance();
     $item = $model->getItem($cid);
     if ($item->id != 0) {
         // account da duoc tao
         if (!($bool = $user->modifyChecking($item->id))) {
             // user leader nhom cha
             if ($item->status != -1) {
                 // user da duoc active thi khong duoc thay doi
                 YiiMessage::raseNotice("Your account not have permission to modify this account");
                 $this->redirect(Router::buildLink("cpanel"));
             }
         }
         // => user da active thi chi user do va superadmin moi thay doi thong tin
     } else {
         if ($user->leader == 0) {
             // neu khong phai leader thi khong duoc tao acc moi
             YiiMessage::raseNotice("Your account not have permission to make account");
             $this->redirect(Router::buildLink("cpanel"));
         }
     }
     $arr_resource = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $lists = $model->getListEdit($item);
     $this->render('edit', array("item" => $item, "lists" => $lists, 'arr_resource' => $arr_resource, "all_granted" => $all_granted));
 }
Exemple #24
0
 /**
  * Include required sources
  */
 public function includeScripts()
 {
     $version = Config::factory(Config::File_Array, Registry::get('main', 'config')->get('configs') . 'versions.php')->get('medialib');
     if (self::$_scriptsIncluded) {
         return;
     }
     $conf = $this->getConfig()->__toArray();
     $resource = Resource::getInstance();
     $resource->addCss('/js/lib/jquery.Jcrop.css');
     $editor = Registry::get('main', 'config')->get('html_editor');
     if ($editor === 'tinymce') {
         $resource->addJs('/js/lib/tiny_mce/tiny_mce.js', 0, true);
         $resource->addJs('/js/lib/ext_ux/Ext.ux.TinyMCE.js', 1, true);
         $resource->addJs('/js/app/system/medialib/HtmlPanel_tinymce.js', 3);
     } elseif ($editor === 'ckeditor') {
         $resource->addJs('/js/lib/ckeditor/ckeditor.js', 0, true);
         $resource->addJs('/js/lib/ext_ux/ckplugin.js', 1, true);
         $resource->addJs('/js/app/system/medialib/HtmlPanel_ckeditor.js', 3);
     }
     $resource->addJs('/js/lib/ext_ux/AjaxFileUpload.js', 1, false);
     $resource->addJs('/js/app/system/SearchPanel.js', 1);
     $resource->addJs('/js/app/system/ImageField.js', 1);
     $resource->addJs('/js/app/system/MedialinkField.js', 1);
     $resource->addJs('/js/app/system/Medialib.js?v=' . $version, 2);
     $resource->addJs('/js/lib/jquery.Jcrop.min.js', 2, true);
     $resource->addInlineJs('
   	app.maxFileSize = "' . ini_get('upload_max_filesize') . '";
   	app.mediaConfig = ' . json_encode($conf) . ';
   	app.imageSize = ' . json_encode($conf['image']['sizes']) . ';
   	app.medialibControllerName = "medialib";
 ');
     self::$_scriptsIncluded = true;
 }
Exemple #25
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'));
 }
Exemple #26
0
					 <div class="content-wrap">
						 <div id="content" class="content">
							<?php 
echo $page->text;
?>
							<div class="content-col-2">
							<?php 
echo $blockManager->getBlocksHtml('centerleft');
?>
							</div>
							<div class="content-col-2">
								<?php 
echo $blockManager->getBlocksHtml('centerright');
?>
							</div>
						 </div>		
						 <div class="sep"></div>			
					 </div>	
					 <div id="sidebar"><?php 
echo $blockManager->getBlocksHtml('rightblocks');
?>
</div>
				 </div>	
			 </div>
		 </div>
	</div><!--end:fullwidth-->
</div><!--end:container-->
<?php 
$template = new Template();
$template->setProperties(array('page' => $page, 'resource' => Resource::getInstance(), 'bottomBlocks' => $blockManager->getBlocksHtml('bottomblocks'), 'footerBlocks' => $blockManager->getBlocksHtml('footerblocks')));
echo $template->render($this->get('path') . '/footer.php');
Exemple #27
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'));
    }