Index: branches/5.2.x/core/units/fck/fck_eh.php =================================================================== diff -u -N -r15012 -r15042 --- branches/5.2.x/core/units/fck/fck_eh.php (.../fck_eh.php) (revision 15012) +++ branches/5.2.x/core/units/fck/fck_eh.php (.../fck_eh.php) (revision 15042) @@ -1,6 +1,6 @@ Array ('self' => true), + ); + + $this->permMapping = array_merge($this->permMapping, $permissions); + } + + /** * Checks user permission to execute given $event * * @param kEvent $event @@ -25,7 +43,7 @@ */ public function CheckPermission(kEvent &$event) { - if ( $this->Application->isAdminUser ) { + if ( $this->Application->isAdminUser || $event->Name == 'OnGetsEditorStyles' ) { // this limits all event execution only to logged-in users in admin return true; } @@ -54,33 +72,35 @@ function OnLoadCmsTree(&$event) { $event->status = kEvent::erSTOP; - $this->CreateXmlHeader(); - $res = ''."\n" ; - $res.= ""."\n"; - $lang = $this->Application->GetVar('m_lang'); + $category_helper =& $this->Application->recallObject('CategoryHelper'); + /* @var $category_helper CategoryHelper */ - $st =& $this->Application->recallObject('st.-dummy'); - /* @var $st kDBItem */ + $pages = $category_helper->getStructureTreeAsOptions(); - $st_options = $this->Application->getUnitOption('st'.'.ParentId', 'Fields'); - $pages = $st_options['options']; - $page_ids = array_keys($pages); - $sql = 'SELECT NamedParentPath, CategoryId FROM ' . TABLE_PREFIX . 'Categories - WHERE CategoryId IN (' . implode(',', $page_ids) . ')'; - $tpls = $this->Application->Conn->GetCol($sql, 'CategoryId'); + WHERE CategoryId IN (' . implode(',', array_keys($pages)) . ')'; + $templates = $this->Conn->GetCol($sql, 'CategoryId'); - //$res = ''; + $templates[$this->Application->getBaseCategory()] .= '/Index'; // "Content" category will act as "Home Page" + + $res = '' . "\n"; + $res .= '' . "\n"; + foreach ($pages as $id => $title) { - $page_path = preg_replace('/^Content\//i', '', strtolower($tpls[$id]).'.html'); - $title = $title.' ('.$page_path.')'; - $real_url = $this->Application->HREF($tpls[$id], '_FRONT_END_', array('pass'=>'m'), 'index.php'); - $res .= ''."\n"; + $template = $templates[$id]; + $page_path = preg_replace('/^Content\//i', '', strtolower($template).'.html'); + + $title = $title . ' (' . $page_path . ')'; + $real_url = $this->Application->HREF($template, '_FRONT_END_', array('pass' => 'm'), 'index.php'); + + $res .= '' . "\n"; } $res.= ""; + + $this->CreateXmlHeader(); echo $res; } @@ -214,4 +234,20 @@ $fck_helper->UploadFile(); } + + /** + * Returns compressed CSS file + * + * @param kEvent $event + */ + function OnGetsEditorStyles(&$event) + { + $minify_helper =& $this->Application->recallObject('MinifyHelper'); + /* @var $minify_helper MinifyHelper */ + + $this->Application->InitParser(); + $styles_css = $minify_helper->CompressScriptTag( Array ('files' => 'inc/style.css') ); + + $event->redirect = 'external:' . $styles_css; + } } \ No newline at end of file