Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F925758
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 20, 8:15 PM
Size
2 KB
Mime Type
text/x-diff
Expires
Thu, May 22, 8:15 PM (1 d, 1 h)
Engine
blob
Format
Raw Data
Handle
629871
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.3.4/core/units/stylesheets/stylesheets_item.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.4/core/units/stylesheets/stylesheets_item.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.3.4/core/units/stylesheets/stylesheets_item.php (revision 3257)
@@ -0,0 +1,44 @@
+<?php
+
+ class StylesheetsItem extends kDBItem
+ {
+ function Compile()
+ {
+ $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';
+
+ $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 = FULL_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);
+
+ $sql = 'UPDATE '.$this->TableName.' SET LastCompiled = '.$compile_ts.' WHERE '.$this->IDField.' = '.$this->GetID();
+ $this->Conn->Query($sql);
+ }
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.3.4/core/units/stylesheets/stylesheets_item.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.3
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment