Index: trunk/core/units/stylesheets/stylesheets_event_handler.php =================================================================== diff -u -r1566 -r1654 --- trunk/core/units/stylesheets/stylesheets_event_handler.php (.../stylesheets_event_handler.php) (revision 1566) +++ trunk/core/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 Index: trunk/core/kernel/application.php =================================================================== diff -u -r1647 -r1654 --- trunk/core/kernel/application.php (.../application.php) (revision 1647) +++ trunk/core/kernel/application.php (.../application.php) (revision 1654) @@ -782,6 +782,8 @@ { $session =& $this->recallObject('Session'); $sid = $session->NeedQueryString() && !(defined('MOD_REWRITE') && MOD_REWRITE) ? $this->GetSID() : ''; + if( getArrayValue($params,'admin') == 1 ) $sid = $this->GetSID(); + $ret = ''; if ($env_var) { $ret = ENV_VAR_NAME.'='; Index: trunk/admin/modules/addmodule.php =================================================================== diff -u -r1262 -r1654 --- trunk/admin/modules/addmodule.php (.../addmodule.php) (revision 1262) +++ trunk/admin/modules/addmodule.php (.../addmodule.php) (revision 1654) @@ -175,7 +175,7 @@ } if ($result) { - $data["Url"] = "$status"; + $data["Url"] = "$status"; } else { $show_errors = true; Index: trunk/core/units/stylesheets/stylesheets_config.php =================================================================== diff -u -r1566 -r1654 --- trunk/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1566) +++ trunk/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1654) @@ -2,7 +2,7 @@ $config = Array( 'Prefix' => 'css', - 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ItemClass' => Array('class'=>'StylesheetsItem','file'=>'stylesheets_item.php','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'StylesheetsEventHandler','file'=>'stylesheets_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), Index: trunk/core/units/stylesheets/stylesheets_item.php =================================================================== diff -u --- trunk/core/units/stylesheets/stylesheets_item.php (revision 0) +++ trunk/core/units/stylesheets/stylesheets_item.php (revision 1654) @@ -0,0 +1,45 @@ +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'; + + $selectors_ids = $this->Conn->GetCol( sprintf($sql_template, $this->GetID() ) ); + $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 .= $this->GetDBField('AdvancedCSS'); + + $compile_ts = time(); + $css_path = DOC_ROOT.BASE_PATH.'/kernel/stylesheets/'; + + $css_file = $css_path.strtolower($this->GetDBField('Name')).'-'.$compile_ts.'.css'; + + $fp = fopen($css_file,'w'); + if($fp) + { + $prev_css = $css_path.strtolower($this->GetDBField('Name')).'-'.$this->GetDBField('LastCompiled').'.css'; + if( file_exists($prev_css) ) unlink($prev_css); + + fwrite($fp, $ret); + fclose($fp); + + $this->SetDBField('LastCompiled_date', $compile_ts); + $this->SetDBField('LastCompiled_time', $compile_ts); + $this->Update(); + } + } + } + +?> \ No newline at end of file Index: trunk/kernel/units/stylesheets/stylesheets_config.php =================================================================== diff -u -r1566 -r1654 --- trunk/kernel/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1566) +++ trunk/kernel/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1654) @@ -2,7 +2,7 @@ $config = Array( 'Prefix' => 'css', - 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ItemClass' => Array('class'=>'StylesheetsItem','file'=>'stylesheets_item.php','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'StylesheetsEventHandler','file'=>'stylesheets_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), 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 Index: trunk/kernel/units/stylesheets/stylesheets_item.php =================================================================== diff -u --- trunk/kernel/units/stylesheets/stylesheets_item.php (revision 0) +++ trunk/kernel/units/stylesheets/stylesheets_item.php (revision 1654) @@ -0,0 +1,45 @@ +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'; + + $selectors_ids = $this->Conn->GetCol( sprintf($sql_template, $this->GetID() ) ); + $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 .= $this->GetDBField('AdvancedCSS'); + + $compile_ts = time(); + $css_path = DOC_ROOT.BASE_PATH.'/kernel/stylesheets/'; + + $css_file = $css_path.strtolower($this->GetDBField('Name')).'-'.$compile_ts.'.css'; + + $fp = fopen($css_file,'w'); + if($fp) + { + $prev_css = $css_path.strtolower($this->GetDBField('Name')).'-'.$this->GetDBField('LastCompiled').'.css'; + if( file_exists($prev_css) ) unlink($prev_css); + + fwrite($fp, $ret); + fclose($fp); + + $this->SetDBField('LastCompiled_date', $compile_ts); + $this->SetDBField('LastCompiled_time', $compile_ts); + $this->Update(); + } + } + } + +?> \ No newline at end of file