Index: trunk/core/units/skins/skin_eh.php =================================================================== diff -u -N --- trunk/core/units/skins/skin_eh.php (revision 8397) +++ trunk/core/units/skins/skin_eh.php (revision 0) @@ -1,90 +0,0 @@ -Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { - return; - } - - $ids = $this->StoreSelectedIDs($event); - if ($ids) { - $id = array_shift($ids); - $this->setPrimary($id); - } - - $this->clearSelectedIDs($event); - } - - function setPrimary($id) - { - $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); - $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - - $sql = 'UPDATE '.$table_name.' - SET IsPrimary = 0'; - $this->Conn->Query($sql); - - - $sql = 'UPDATE '.$table_name.' - SET IsPrimary = 1 - WHERE '.$id_field.' = '.$id; - $this->Conn->Query($sql); - } - - - /** - * [HOOK] Compile stylesheet file based on theme definitions - * - * @param kEvent $event - */ - function OnCompileStylesheet(&$event) - { - $object =& $event->getObject( Array('skip_autoload' => true) ); - $object->SwitchToLive(); - - $ids = explode(',', $event->MasterEvent->getEventParam('ids') ); - - if(!$ids) return false; - foreach($ids as $id) - { - $object->Load($id); - $this->Compile($object); - } - } - - function Compile(&$object) - { - $ret = $object->GetDBField('CSS'); - $options = $object->GetDBField('Options'); - $options = unserialize($options); - $options['base_url'] = array('Value'=>rtrim($this->Application->BaseURL(), '/')); - foreach ($options as $key => $row) { - $ret = str_replace('@@'.$key.'@@', $row['Value'], $ret); - } - - $compile_ts = adodb_mktime(); - $css_path = WRITEABLE.'/user_files/'; - - $css_file = $css_path.'admin-'.strtolower($object->GetDBField('Name')).'-'.$compile_ts.'.css'; - - $fp = fopen($css_file,'w'); - if($fp) - { - $prev_css = $css_path.'admin-'.strtolower($object->GetDBField('Name')).'-'.$object->GetDBField('LastCompiled').'.css'; - if( file_exists($prev_css) ) unlink($prev_css); - - fwrite($fp, $ret); - fclose($fp); - - $sql = 'UPDATE '.$object->TableName.' SET LastCompiled = '.$compile_ts.' WHERE '.$object->IDField.' = '.$object->GetID(); - $this->Conn->Query($sql); - } - } -} \ No newline at end of file