Index: branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php =================================================================== diff -u -r1412 -r1421 --- branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php (.../stylesheets_event_handler.php) (revision 1412) +++ branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php (.../stylesheets_event_handler.php) (revision 1421) @@ -8,34 +8,30 @@ * * @param kEvent $event */ - function OnCompile(&$event) + function OnCompileStylesheet(&$event) { $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); $object =& $event->getObject(); - $this->StoreSelectedIDs($event); + $ids = explode(',', $this->Application->RecallVar($event->getPrefixSpecial().'_selected_ids') ); - $ids = $this->getSelectedIDs($event); - - $selectors =& $this->Application->recallObject('selectors','selectors_List',Array('skip_counting'=>true,'per_page'=>-1) ); - $ret = '/* This file is generated automatically. Don\'t edit it manually ! */'."\n\n"; if($ids) { + $selector_item =& $this->Application->recallObject('selectors.item', 'selectors'); + $parent_field = $this->Application->getUnitOption($selector_item->Prefix,'ForeignKey'); + + $sql = 'SELECT '.$selector_item->IDField.' FROM '.$selector_item->TableName.' WHERE '.$parent_field.' = '.$id; + $selectors_ids = $this->Conn->GetCol($sql); + foreach($ids as $id) { $object->Load($id); - $selectors->linkToParent(''); - $selectors->Query(); - $selectors->GoFirst(); - - while( !$selectors->EOL() ) + foreach($selectors_ids as $selector_id) { - $selector_name = $selectors->GetDBField('Name'); - $selector_data = $selectors->GetDBField('SelectorData'); - $ret .= $this->prepareSelector($selector_name, $selector_data); - $selectors->GoNext(); + $selector_item->Load($selector_id); + $ret .= $selector_item->CompileStyle()."\n"; } $compile_ts = time(); @@ -58,21 +54,9 @@ } } } - $this->clearSelectedIDs($event); } - function prepareSelector($selector_name, $selector_data) - { - if( IsSerialized($selector_data) ) $selector_data = unserialize($selector_data); - $ret = '.'.$selector_name." {\n"; - foreach($selector_data as $property_name => $property_value) - { - $ret .= "\t$property_name: $property_value;\n"; - } - - $ret .= "}\n\n"; - return $ret; - } + } ?> \ No newline at end of file