Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Tue, May 20, 10:23 PM

in-portal

Index: branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php (revision 1411)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php (revision 1412)
@@ -1,70 +1,72 @@
<?php
-
-$config = Array(
+ define('STYLE_BASE', 1);
+ define('STYLE_BLOCK', 2);
+
+ $config = Array(
'Prefix' => 'selectors',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'SelectorsEventHandler','file'=>'selectors_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'SelectorsTagProcessor','file'=>'selectors_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'Hooks' => Array(),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
'IDField' => 'SelectorId',
'TitleField' => 'Name',
'TableName' => TABLE_PREFIX.'StylesheetSelectors',
'ForeignKey' => 'StylesheetId',
'ParentTableKey' => 'StylesheetId',
'ParentPrefix' => 'css',
'AutoDelete' => true,
'AutoClone' => true,
'ListSQLs' => Array( ''=>'SELECT * FROM %s',
), // key - special, value - list select sql
'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
),
'ListSortings' => Array(
'' => Array(
'Sorting' => Array('Name' => 'asc'),
)
),
'Fields' => Array(
'SelectorId' => Array(),
'StylesheetId' => Array('type' => 'int','not_null' => '1','default' => '0'),
'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
'SelectorName' => Array('type' => 'string','not_null' => '1','default' => ''),
'SelectorData' => Array('not_null' => '1','default' => ''),
'Description' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'Type' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array( 1 => 'la_BaseSelectors', 2 => 'la_BlockSelectors'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'),
+ 'Type' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array( STYLE_BASE => 'la_BaseSelectors', STYLE_BLOCK => 'la_BlockSelectors'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'),
'ParentId' => Array('type' => 'int','not_null' => '1','default' => '0'),
),
'VirtualFields' => Array(),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_selector.gif'),
'Fields' => Array(
'Name' => Array( 'title'=>'la_col_Name', 'data_block' => 'grid_checkbox_td'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'grid_description_td' ),
),
),
'BlockStyles' => Array(
'Icons' => Array('default'=>'icon16_selector.gif'),
'Fields' => Array(
'Name' => Array( 'title'=>'la_col_Name', 'data_block' => 'grid_checkbox_td'),
'SelectorName' => Array( 'title'=>'la_col_SelectorName'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'grid_description_td' ),
),
),
),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.4
\ No newline at end of property
+1.1.2.5
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php (revision 1412)
@@ -0,0 +1,78 @@
+<?php
+
+ class StylesheetsEventHandler extends InpDBEventHandler
+ {
+
+ /**
+ * Compile stylesheet file based on theme definitions
+ *
+ * @param kEvent $event
+ */
+ function OnCompile(&$event)
+ {
+ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
+ $object =& $event->getObject();
+
+ $this->StoreSelectedIDs($event);
+
+ $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)
+ {
+ foreach($ids as $id)
+ {
+ $object->Load($id);
+
+ $selectors->linkToParent('');
+ $selectors->Query();
+ $selectors->GoFirst();
+
+ while( !$selectors->EOL() )
+ {
+ $selector_name = $selectors->GetDBField('Name');
+ $selector_data = $selectors->GetDBField('SelectorData');
+ $ret .= $this->prepareSelector($selector_name, $selector_data);
+ $selectors->GoNext();
+ }
+
+ $compile_ts = time();
+ $css_path = DOC_ROOT.BASE_PATH.'/themes/';
+
+ $css_file = $css_path.$compile_ts.'-'.strtolower($object->GetDBField('Name')).'.css';
+
+ $fp = fopen($css_file,'w');
+ if($fp)
+ {
+ $prev_css = $css_path.$object->GetDBField('LastCompiled').'-'.strtolower($object->GetDBField('Name')).'.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();
+ }
+ }
+ }
+ $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
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php (revision 1411)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php (revision 1412)
@@ -1,96 +1,97 @@
<?php
$config = Array(
'Prefix' => 'css',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
- 'EventHandlerClass' => Array('class'=>'InpDBEventHandler','file'=>'','build_event'=>'OnBuild'),
+ 'EventHandlerClass' => Array('class'=>'StylesheetsEventHandler','file'=>'stylesheets_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
'AutoLoad' => true,
'Hooks' => Array(),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
4 => 'mode',
),
'IDField' => 'StylesheetId',
'StatusField' => Array('Enabled'),
'TitleField' => 'Name',
'TitlePresets' => Array(
'default' => Array( 'new_status_labels' => Array('css'=>'!la_title_Adding_Stylesheet!'),
'edit_status_labels' => Array('css'=>'!la_title_Editing_Stylesheet!'),
'new_titlefield' => Array('css'=>'!la_title_New_Stylesheet!'),
),
'styles_list' => Array('prefixes' => Array('css_List'), 'format' => "!la_title_Stylesheets! (#css_recordcount#)"),
'stylesheets_edit' => Array('prefixes' => Array('css'), 'format' => "#css_status# '#css_titlefield#' - !la_title_General!"),
'base_styles' => Array('prefixes' => Array('css','selectors.base_List'), 'format' => "#css_status# '#css_titlefield#' - !la_title_BaseStyles! (#selectors.base_recordcount#)"),
'block_styles' => Array('prefixes' => Array('css','selectors.block_List'), 'format' => "#css_status# '#css_titlefield#' - !la_title_BlockStyles! (#selectors.block_recordcount#)"),
'base_style_edit' => Array( 'prefixes' => Array('css','selectors'),
'new_status_labels' => Array('selectors.base'=>'!la_title_Adding_BaseStyle!'),
'edit_status_labels' => Array('selectors.base'=>'!la_title_Editing_BaseStyle!'),
'new_titlefield' => Array('selectors.base'=>'!la_title_New_BaseStyle!'),
'format' => "#css_status# '#css_titlefield#' - #selectors_status# '#selectors_titlefield#'"),
'style_edit' => Array('prefixes' => Array('selectors'), 'format' => "!la_title_EditingStyle! '#selectors_titlefield#'"),
),
'TableName' => TABLE_PREFIX.'Stylesheets',
'SubItems' => Array('selectors'),
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array(0,1), 'type' => WHERE_FILTER),
),
'Filters' => Array(
0 => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ),
1 => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ),
)
),
'AutoDelete' => true,
'AutoClone' => true,
'ListSQLs' => Array( ''=>'SELECT * FROM %s',
), // key - special, value - list select sql
'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
),
'ListSortings' => Array(
'' => Array(
'Sorting' => Array('Name' => 'asc'),
)
),
'Fields' => Array(
'StylesheetId' => Array(),
'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
'Description' => Array('type' => 'string','not_null' => '1','default' => ''),
'AdvancedCSS' => Array('type' => 'string','not_null' => '1','default' => ''),
'LastCompiled' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => '0'),
'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array(0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1, 'not_null' => '1','default' => 0),
),
'VirtualFields' => Array(),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_custom.gif',0=>'icon16_style_disabled.gif',1=>'icon16_style.gif'),
'Fields' => Array(
'Name' => Array( 'title'=>'la_col_Name', 'data_block' => 'grid_checkbox_td'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'grid_description_td' ),
'Enabled' => Array( 'title'=>'la_col_Status' ),
+ 'LastCompiled' => Array('title' => 'la_col_LastCompiled'),
),
),
),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.4
\ No newline at end of property
+1.1.2.5
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_list.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_list.tpl (revision 1411)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_list.tpl (revision 1412)
@@ -1,68 +1,75 @@
<inp2:m_set nobody="yes"/>
<inp2:m_include t="incs/header"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
<inp2:m_ParseBlock name="section_header" icon="icon46_style" title="!la_title_Stylesheets!"/>
<inp2:m_ParseBlock name="blue_bar" prefix="css" title_preset="styles_list" module="in-commerce" icon="icon46_style"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
//do not rename - this function is used in default grid for double click!
function edit()
{
std_edit_item('css', 'in-commerce/stylesheets/stylesheets_edit');
}
var a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('new_style', '<inp2:m_phrase label="la_ToolTip_NewStylesheet"/>',
function() {
std_precreate_item('css', 'in-commerce/stylesheets/stylesheets_edit')
} ) );
a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit"/>', edit) );
a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete"/>',
function() {
std_delete_items('css')
} ) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('approve', '<inp2:m_phrase label="la_ToolTip_Approve"/>', function() {
submit_event('css','OnMassApprove');
}
) );
a_toolbar.AddButton( new ToolBarButton('decline', '<inp2:m_phrase label="la_ToolTip_Decline"/>', function() {
submit_event('css','OnMassDecline');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+ a_toolbar.AddButton( new ToolBarButton('compile', '<inp2:m_phrase label="la_ToolTip_Compile"/>', function() {
+ submit_event('css','OnCompile');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View"/>', function() {
show_viewmenu(a_toolbar,'view');
}
) );
a_toolbar.Render();
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_block name="grid_description_td" />
<td valign="top" class="text"><inp2:$PrefixSpecial_field field="$field" grid="$grid" no_special="no_special" cut_first="100"/></td>
<inp2:m_blockend />
<inp2:m_ParseBlock name="grid" PrefixSpecial="css" IdField="StylesheetId" grid="Default" header_block="grid_column_title" data_block="grid_data_td" has_filters="has_filters" search="on"/>
<script type="text/javascript">
- Grids['css'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline') );
+ Grids['css'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','compile') );
</script>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_list.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.2
\ No newline at end of property
+1.1.2.3
\ No newline at end of property

Event Timeline