Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl
===================================================================
diff -u -r1406 -r1410
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl (.../stylesheets_edit_base.tpl) (revision 1406)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/stylesheets_edit_base.tpl (.../stylesheets_edit_base.tpl) (revision 1410)
@@ -40,11 +40,13 @@
//Relations related:
a_toolbar.AddButton( new ToolBarButton('new_base_style', '',
function() {
+ set_hidden_field('remove_specials[selectors.base]',1);
std_new_item('selectors.base', 'in-commerce/stylesheets/base_style_edit')
} ) );
function edit()
{
+ set_hidden_field('remove_specials[selectors.base]',1);
std_edit_temp_item('selectors.base', 'in-commerce/stylesheets/base_style_edit');
}
Index: branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_tag_processor.php
===================================================================
diff -u -r1407 -r1410
--- branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_tag_processor.php (.../selectors_tag_processor.php) (revision 1407)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_tag_processor.php (.../selectors_tag_processor.php) (revision 1410)
@@ -5,13 +5,20 @@
function PrintStyle($params)
{
- $style_data = parent::Field($params);
+ $object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params );
+ $style_data = $object->GetDBField( $params['field'] );
+ //$style_data = str_replace(array(">", "<",""", "&"), array(">","<", "\"", "&"), $style_data);
+
$ret = '';
if($style_data)
{
- $style_attribs = unserialize($style_data);
- $ret = implode('
',$style_attribs);
+ //$style_attribs = unserialize($style_data);
+ foreach($style_data as $property_name => $property_value)
+ {
+ $ret .= $property_name.': '.$property_value.';
';
+ }
+
}
return $ret;
}
@@ -29,12 +36,28 @@
{
$ret = parent::InputName($params);
$subfield = getArrayValue($params,'subfield');
- if($subfield)
+ if($subfield && $subfield != '$subfield')
{
$ret .= '['.$subfield.']';
}
return $ret;
}
+
+ function Field($params)
+ {
+ $subfield = getArrayValue($params,'subfield');
+ if($subfield && $subfield != '$subfield')
+ {
+ $params['no_special'] = 'no_special';
+ }
+ $ret = parent::Field($params);
+ if($subfield && $subfield != '$subfield')
+ {
+ return getArrayValue($ret,$subfield);
+ }
+ return $ret;
+ }
+
}
?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/colorselector.js
===================================================================
diff -u
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/colorselector.js (revision 0)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/colorselector.js (revision 1410)
@@ -0,0 +1,85 @@
+ // color Selector
+
+ var aColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF';
+
+ function kColorSelector($field)
+ {
+ this.Field = $field;
+
+ var $selector = document.getElementById('colorSelector_div');
+ this.updateColor = updateColor;
+ this.colorMouseOver = colorMouseOver;
+ this.colorMouseOut = colorMouseOut;
+ this.colorClick = colorClick;
+
+ if( !isset($selector) )
+ {
+ var $s_table = document.createElement('TABLE');
+ $s_table.id = 'colorSelector';
+ $selector.appendChild($s_table);
+
+ var $selector = document.createElement('DIV');
+ $selector.id = 'colorSelector_div';
+ $selector.className = 'table_color1';
+ $selector.style.width = '178px';
+ $selector.style.borderWidth = '1px';
+ $selector.style.borderColor = '#000000';
+ $selector.style.display = 'none';
+ $selector.style.position = 'absolute';
+ $selector.style.borderStyle = 'solid';
+ document.appendChild($selector);
+
+ var oTable = document.getElementById('colorSelector');
+ var iCounter = 0;
+ aColors = aColors.split(',');
+
+ while(iCounter < aColors.length)
+ {
+ var oRow = oTable.insertRow(-1);
+ for(var i = 0; i < 8 && iCounter < aColors.length; i++, iCounter++)
+ {
+ var $cell = document.createElement('TD');
+ $cell.innerHTML = '
';
+ $cell.onmouseover = this.colorMouseOver;
+ $cell.onmouseout = this.colorMouseOut;
+ $cell.onclick = this.colorClick;
+ $cell.setAttribute('ColorIndex', iCounter);
+ var oDiv=oRow.insertCell(-1).appendChild($cell);
+ };
+ }
+ }
+ }
+
+ function updateColor($event,$color_preview)
+ {
+ alert('e: '+$event+'; cp: '+$color_preview);
+ document.getElementById('color_'+$color_preview).style.backgroundColor = document.getElementById($color_preview).value;
+ }
+
+ function colorMouseOver($e)
+ {
+ if(!$e) $e = window.event;
+ //print_pre(this);
+ this.parentNode.style.backgroundColor = '#C8D3E2';
+ this.parentNode.style.borderColor = '#7196CC';
+
+ }
+
+ function colorMouseOut($e)
+ {
+ if(!$e) $e = window.event;
+ this.parentNode.style.backgroundColor = '#F6F6F6';
+ this.parentNode.style.borderColor = '#F6F6F6';
+ }
+
+ function colorClick($e)
+ {
+ if(!$e) $e = window.event;
+ var $color = aColors[ this.getAttribute('ColorIndex') ];
+
+ document.getElementById('color_'+$input_name).style.backgroundColor = $color;
+ document.getElementById($input_name).value = '#' + $color;
+ document.getElementById('colorSelector_div').style.display = 'none';
+
+ colorMouseOut($e);
+ }
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/style_editor.tpl
===================================================================
diff -u
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/style_editor.tpl (revision 0)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/style_editor.tpl (revision 1410)
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
">
+
+
+ "
+ id=""
+ value=""
+ tabindex=""
+ size=""
+ maxlength=""
+ class=""
+ onkeypress="$cs.updateColor(event,'color_')"
+ onblur="">
+ " style="display: inline; border: 1px solid #000000;" onclick="openColorSelector(event,'');">
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/base_style_edit.tpl
===================================================================
diff -u -r1407 -r1410
--- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/base_style_edit.tpl (.../base_style_edit.tpl) (revision 1407)
+++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/stylesheets/base_style_edit.tpl (.../base_style_edit.tpl) (revision 1410)
@@ -15,20 +15,19 @@
@@ -38,25 +37,26 @@
-
-
-
+
+ " value="1">
-
-
+
+
+
+
">
:
|
-
+
|
|
-
+
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php
===================================================================
diff -u -r1407 -r1410
--- branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1407)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1410)
@@ -34,11 +34,11 @@
'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.base'),
+ '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.base_status# '#selectors.base_titlefield#'"),
+ 'format' => "#css_status# '#css_titlefield#' - #selectors_status# '#selectors_titlefield#'"),
'style_edit' => Array('prefixes' => Array('selectors'), 'format' => "!la_title_EditingStyle! '#selectors_titlefield#'"),
),
@@ -74,6 +74,7 @@
'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),
),
Index: branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_event_handler.php
===================================================================
diff -u -r1407 -r1410
--- branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_event_handler.php (.../selectors_event_handler.php) (revision 1407)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_event_handler.php (.../selectors_event_handler.php) (revision 1410)
@@ -61,6 +61,17 @@
*/
function OnOpenStyleEditor(&$event)
{
+ $this->SaveChanges($event);
+ $event->redirect = false;
+ }
+
+ /**
+ * Saves Changes to Item
+ *
+ * @param kEvent $event
+ */
+ function SaveChanges(&$event)
+ {
$this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
$object =& $event->getObject();
@@ -73,6 +84,69 @@
$object->Update();
}
}
+
+ /**
+ * Save style changes from style editor
+ *
+ * @param kEvent $event
+ */
+ function OnSaveStyle(&$event)
+ {
+ $this->SaveChanges($event);
+ $object =& $event->getObject();
+
+ $selector_data = $object->GetDBField('SelectorData');
+ $object->SetDBField('SelectorData', serialize($selector_data) );
+ $object->Update();
+
+ $this->finalizePopup($event,'selectors.base','in-commerce/stylesheets/base_style_edit');
+ }
+
+ /**
+ * Extract styles
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ $object =& $event->getObject();
+ $selector_data = $object->GetDBField('SelectorData');
+ if($selector_data)
+ {
+ $selector_data = unserialize($selector_data);
+ $object->SetDBField('SelectorData', $selector_data);
+ }
+ }
+
+ /**
+ * Serialize item before saving to db
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ $selector_data = $object->GetDBField('SelectorData');
+ if(!$selector_data) $selector_data = Array();
+ if( !IsSerialized($selector_data) ) $selector_data = serialize($selector_data);
+
+ $object->SetDBField('SelectorData', $selector_data);
+ }
+
+ /**
+ * Unserialize data back when update was made
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ $selector_data = $object->GetDBField('SelectorData');
+ if(!$selector_data) $selector_data = Array();
+ if( IsSerialized($selector_data) ) $selector_data = unserialize($selector_data);
+
+ $object->SetDBField('SelectorData', $selector_data);
+ }
}
?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php
===================================================================
diff -u -r1407 -r1410
--- branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 1407)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 1410)
@@ -39,7 +39,7 @@
'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('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'),
'ParentId' => Array('type' => 'int','not_null' => '1','default' => '0'),