Index: trunk/kernel/units/stylesheets/stylesheets_event_handler.php =================================================================== diff -u -r1566 -r1654 --- trunk/kernel/units/stylesheets/stylesheets_event_handler.php (.../stylesheets_event_handler.php) (revision 1566) +++ trunk/kernel/units/stylesheets/stylesheets_event_handler.php (.../stylesheets_event_handler.php) (revision 1654) @@ -16,51 +16,13 @@ $ids = explode(',', $event->MasterEvent->getEventParam('ids') ); - if($ids) + if(!$ids) return false; + foreach($ids as $id) { - $this->Application->setUnitOption('selectors','AutoLoad',false); - $selector_item =& $this->Application->recallObject('selectors.item', 'selectors', Array('live_table'=>true) ); - $parent_field = $this->Application->getUnitOption($selector_item->Prefix,'ForeignKey'); - - $sql_template = 'SELECT '.$selector_item->IDField.' FROM '.$selector_item->TableName.' WHERE '.$parent_field.' = %s'; - - foreach($ids as $id) - { - $object->Load($id); - $selectors_ids = $this->Conn->GetCol( sprintf($sql_template,$id) ); - $ret = '/* This file is generated automatically. Don\'t edit it manually ! */'."\n\n"; - - foreach($selectors_ids as $selector_id) - { - $selector_item->Load($selector_id); - $ret .= $selector_item->CompileStyle()."\n"; - } - - $ret .= $object->GetDBField('AdvancedCSS'); - - $compile_ts = time(); - $css_path = DOC_ROOT.BASE_PATH.'/kernel/stylesheets/'; - - $css_file = $css_path.strtolower($object->GetDBField('Name')).'-'.$compile_ts.'.css'; - - $fp = fopen($css_file,'w'); - if($fp) - { - $prev_css = $css_path.strtolower($object->GetDBField('Name')).'-'.$object->GetDBField('LastCompiled').'.css'; - if( file_exists($prev_css) ) unlink($prev_css); - - fwrite($fp, $ret); - fclose($fp); - - $object->SetDBField('LastCompiled_date', $compile_ts); - $object->SetDBField('LastCompiled_time', $compile_ts); - $object->Update(); - } - } + $object->Load($id); + $object->Compile(); } } - - } ?> \ No newline at end of file