Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 11:51 PM

in-portal

Index: trunk/kernel/units/configuration/configuration_config.php
===================================================================
--- trunk/kernel/units/configuration/configuration_config.php (nonexistent)
+++ trunk/kernel/units/configuration/configuration_config.php (revision 1557)
@@ -0,0 +1,53 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'conf',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ConfigurationEventHandler','file'=>'configuration_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ConfigurationTagProcessor','file'=>'configuration_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'Hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'module',
+ 5 => 'section',
+ ),
+
+ 'IDField' => 'VariableName',
+
+ 'TitlePresets' => Array(
+ 'config_list' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'ConfigurationValues',
+
+ 'ListSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
+
+ 'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
+
+ 'SubTables' => Array(),
+
+ 'Fields' => Array(
+ 'VariableName' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'VariableValue' => array('type'=>'string', 'default'=>''),
+ 'ModuleOwner' => array('type'=>'string', 'default'=>'In-Portal'),
+ 'Section' => array('type'=>'string','not_null' => '1','default'=>''),
+ ),
+
+ 'VirtualFields' => Array(
+ 'heading' => Array('type' => 'string','default' => ''),
+ 'prompt' => Array('type' => 'string','default' => ''),
+ 'element_type' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'validation' => Array('type' => 'string','default' => ''),
+ 'ValueList' => Array('type' => 'string','default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'Install' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ ),
+
+ 'Grids' => Array(),
+ );
+
+?>
\ No newline at end of file
Property changes on: trunk/kernel/units/configuration/configuration_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/units/configuration/configuration_tag_processor.php
===================================================================
--- trunk/kernel/units/configuration/configuration_tag_processor.php (nonexistent)
+++ trunk/kernel/units/configuration/configuration_tag_processor.php (revision 1557)
@@ -0,0 +1,146 @@
+<?php
+
+class ConfigurationTagProcessor extends kDBTagProcessor {
+
+ function PrintList($params)
+ {
+ $params['per_page'] = -1;
+ $list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params);
+ $id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
+
+ if ( !($list->OriginalParams == $params) ) {
+ $this->Application->removeObject($this->getPrefixSpecial());
+ $list =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix.'_List',$params);
+ }
+
+
+ $list->PerPage = -1;
+
+ $list->Query();
+ $o = '';
+ $list->GoFirst();
+
+ $block_params=$this->prepareTagParams($params);
+ $block_params['name']=$params['block'];
+ $block_params['pass_params']='true';
+ $block_params['IdField'] = $id_field;
+
+ $next_block=$params['full_block'];
+
+ $prev_title="";
+
+ while (!$list->EOL())
+ {
+ $nextItemPrompt=$list->Records[$list->CurrentIndex+1]['prompt'];
+ $thisItemPrompt=$list->Records[$list->CurrentIndex]['prompt'];
+
+ $this_title=$list->Records[$list->CurrentIndex]['heading'];
+
+ if ($this_title!=$prev_title){
+ $prev_title=$this_title;
+ $section_header_params=array();
+ $section_header_params['name']='config_section_header';
+ $section_header_params['title']=$this->Application->Phrase($this_title);
+ $o.= $this->Application->ParseBlock($section_header_params, 1);
+ }
+
+ if ($nextItemPrompt==$thisItemPrompt){
+ $curr_block=$params['half_block1'];
+ $next_block=$params['half_block2'];
+ }else{
+ $curr_block=$next_block;
+ $next_block=$params['full_block'];
+ }
+ $block_params['name']=$curr_block;
+
+ $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) );
+ $o.= $this->Application->ParseBlock($block_params, 1);
+
+ $list->GoNext();
+ }
+ return $o;
+ }
+
+ function PrintConfList($params){
+ $list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params);
+ $id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
+
+ $list->PerPage=-1;
+ $list->Query();
+ $o = '';
+ $list->GoFirst();
+
+ $tmp_row=array();
+
+ while (!$list->EOL())
+ {
+ $rec = $list->getCurrentRecord();
+ $tmp_row[0][$rec['VariableName']]=$rec['VariableValue'];
+ $tmp_row[0]['prompt']=$rec['prompt'];
+ $list->GoNext();
+ }
+
+ $list->Records = $tmp_row;
+
+ $block_params=$this->prepareTagParams($params);
+ $block_params['name']=$params['block'];
+
+ $list->GoFirst();
+
+ return $this->Application->ParseBlock($block_params, 1);
+
+ }
+
+
+ function GetToEnv($params){
+
+ $vars = explode(',', $params['vars']);
+
+ foreach ($vars as $key => $var){
+ $val=$this->Application->GetVar($var);
+ if ($val) {
+ $this->Application->SetVar("conf_".$var, $this->myUrlEncode($val));
+ }
+
+ }
+ }
+
+ function myUrlDecode($str){
+ $str=str_replace(';',':', $str);
+ $str=str_replace('!','-', $str);
+ return $str;
+ }
+
+ function myUrlEncode($str){
+ $str=str_replace('-', '!', $str);
+ $str=str_replace(':', ';', $str);
+ return $str;
+ }
+
+ function ConfigValue($params){
+
+ return $this->Application->ConfigValue($params['name']);
+
+ }
+
+ function Error($params)
+ {
+ $object =& $this->Application->recallObject( $this->getPrefixSpecial() );
+ $field = $object->GetDBField($params['id_field']);
+
+ $errors = $this->Application->GetVar('errormsgs');
+ $errors = $errors[$this->getPrefixSpecial()];
+
+ if (isset($errors[$field])){
+ $msg = $this->Application->Phrase($errors[$field]);
+ }
+ else {
+ $msg = '';
+ }
+
+ return $msg;
+ }
+
+}
+
+?>
\ No newline at end of file
Property changes on: trunk/kernel/units/configuration/configuration_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/units/configuration/configuration_event_handler.php
===================================================================
--- trunk/kernel/units/configuration/configuration_event_handler.php (nonexistent)
+++ trunk/kernel/units/configuration/configuration_event_handler.php (revision 1557)
@@ -0,0 +1,163 @@
+<?php
+
+ class ConfigurationEventHandler extends InpDBEventHandler {
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ $module_owner=$this->Application->GetVar('module');
+ if ($module_owner===false) {
+ $module_owner=$this->myUrlDecode($this->Application->GetVar('conf_module'));
+ $this->Application->SetVar("module", $module_owner);
+ }
+
+ $section=$this->Application->GetVar('section');
+ if ($section===false){
+ $section=$this->myUrlDecode($this->Application->GetVar('conf_section'));
+ $this->Application->SetVar("section", $section);
+ }
+
+ $object->addFilter('module_filter', '%1$s.ModuleOwner = "'.$module_owner.'"');
+ $object->addFilter('section_filter', '%1$s.Section = "'.$section.'"');
+ $object->AddOrderField('DisplayOrder', 'ASC');
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ if($object->GetDBField('element_type') == 'password')
+ {
+ if (trim($object->GetDBField('VariableValue'))=='') {
+ $field_options=$object->GetFieldOptions('VariableValue');
+ $field_options['skip_empty']=1;
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }else{
+ $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue')));
+ }
+ }
+
+ $this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State');
+
+ if ( isset($this->country_state_pairs[$object->GetDBField('VariableName')]) ){
+ $this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue');
+ }
+
+ if( isset($this->state_country_codes[$object->GetDBField('VariableName')]) )
+ {
+ $cs_helper = &$this->Application->recallObject('CountryStatesHelper');
+ $state_valid_code = $cs_helper->CheckState( $object->GetDBField('VariableValue'), $this->state_country_codes[$object->GetDBField('VariableName')] );
+ if ($state_valid_code !== false)
+ {
+ $object->SetDBField('VariableValue', $state_valid_code);
+ }
+ else
+ {
+ $errormsgs = $this->Application->GetVar('errormsgs');
+ $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special];
+
+ $errors[ $object->GetDBField('VariableName') ] = 'la_InvalidState';
+ $errormsgs[$event->Prefix_Special] = $errors;
+
+ $this->Application->SetVar('errormsgs', $errormsgs);
+
+ $event->redirect = false;
+ $event->status = erFAIL;
+ }
+ }
+
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ if($object->GetDBField('element_type') == 'password')
+ {
+ if (trim($object->GetDBField('VariableValue'))=='') {
+ $field_options=$object->GetFieldOptions('VariableValue');
+ unset($field_options['skip_empty']);
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }
+ }
+ }
+
+ function OnUpdate(&$event)
+ {
+ parent::OnUpdate($event);
+ $module_owner=$this->Application->GetVar('module');
+ $section=$this->Application->GetVar('section');
+
+ $event->redirect_params = Array('opener' => 's','conf_section'=>$this->myUrlEncode($section), 'conf_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay!
+ if ($this->Application->GetVar('errormsgs')){
+ $event->redirect = false;
+ }
+ }
+
+ function OnCancel(&$event)
+ {
+ parent::OnCancel($event);
+ $module_owner=$this->Application->GetVar('module');
+ $section=$this->Application->GetVar('section');
+
+ $event->redirect_params = Array('opener' => 's','conf_section'=>$this->myUrlEncode($section), 'conf_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay!
+ }
+
+ function myUrlDecode($str){
+ $str=str_replace(';',':', $str);
+ $str=str_replace('!','-', $str);
+ return $str;
+ }
+
+ function myUrlEncode($str){
+ $str=str_replace('-', '!', $str);
+ $str=str_replace(':', ';', $str);
+ return $str;
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnChangeCountry(&$event)
+ {
+ $event->setPseudoClass('_List');
+ $object = &$event->getObject( Array('per_page'=>-1) );
+ $object->Query();
+ //$object->SetDBField('');
+ $array_records = &$object->Records;
+ foreach($array_records as $i=>$record){
+ if ($record['VariableName']=='Comm_Country'){
+ $values = $this->Application->GetVar('conf');
+ $array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue'];
+ }
+ }
+
+ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay!
+ $event->redirect = false;
+ }
+
+
+
+ }
+
+
+
+?>
\ No newline at end of file
Property changes on: trunk/kernel/units/configuration/configuration_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/core/units/categories/categories_config.php
===================================================================
--- trunk/core/units/categories/categories_config.php (revision 1556)
+++ trunk/core/units/categories/categories_config.php (nonexistent)
@@ -1,59 +0,0 @@
-<?php
-
-$config = Array(
- 'Prefix' => 'c',
- 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
- 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
- 'EventHandlerClass' => Array('class'=>'CategoriesEventHandler','file'=>'categories_event_handler.php','build_event'=>'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'CategoriesTagProcessor','file'=>'categories_tag_processor.php','build_event'=>'OnBuild'),
- 'AutoLoad' => true,
- 'QueryString' => Array(
- 1 => 'id',
- 2 => 'page',
- 3 => 'event',
- ),
- 'IDField' => 'CategoryId',
- 'TableName' => TABLE_PREFIX.'Category',
-
- 'ListSQLs' => Array( ''=> 'SELECT * FROM %s'),
- // key - special, value - list select sql
- 'ItemSQLs' => Array( ''=> 'SELECT * FROM %s'),
-
- 'Fields' => Array
- (
- 'CategoryId' => Array('type' => 'int','not_null' => '1','default' => ''),
- 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'ParentId' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'Name' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'Description' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'CreatedOn' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'EditorsPick' => Array('type' => 'int','default' => ''),
- 'Status' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'Pop' => Array('type' => 'int','default' => ''),
- 'Priority' => Array('type' => 'int','default' => ''),
- 'MetaKeywords' => Array('type' => 'string','default' => ''),
- 'CachedDescendantCatsQty' => Array('type' => 'int','default' => ''),
- 'CachedNavbar' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'CreatedById' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'ResourceId' => Array('type' => 'int','default' => ''),
- 'ParentPath' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'MetaDescription' => Array('type' => 'string','default' => ''),
- 'HotItem' => Array('type' => 'int','not_null' => '1','default' => '2'),
- 'NewItem' => Array('type' => 'int','not_null' => '1','default' => '2'),
- 'PopItem' => Array('type' => 'int','not_null' => '1','default' => '2'),
- 'Modified' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'ModifiedById' => Array('type' => 'int','not_null' => '1','default' => '0'),
- ),
-
- 'Grids' => Array(
- 'Default' => Array(
- 'Icons' => Array('default'=>'icon16_cat.gif'),
- 'Fields' => Array(
- 'Name' => Array( 'width'=>150, 'title'=>'la_col_Title', 'data_block'=>'category_td' ),
- ),
-
- ),
- ),
- );
-
-?>
\ No newline at end of file
Property changes on: trunk/core/units/categories/categories_config.php
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.2
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: trunk/core/units/configuration/configuration_tag_processor.php
===================================================================
--- trunk/core/units/configuration/configuration_tag_processor.php (nonexistent)
+++ trunk/core/units/configuration/configuration_tag_processor.php (revision 1557)
@@ -0,0 +1,146 @@
+<?php
+
+class ConfigurationTagProcessor extends kDBTagProcessor {
+
+ function PrintList($params)
+ {
+ $params['per_page'] = -1;
+ $list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params);
+ $id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
+
+ if ( !($list->OriginalParams == $params) ) {
+ $this->Application->removeObject($this->getPrefixSpecial());
+ $list =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix.'_List',$params);
+ }
+
+
+ $list->PerPage = -1;
+
+ $list->Query();
+ $o = '';
+ $list->GoFirst();
+
+ $block_params=$this->prepareTagParams($params);
+ $block_params['name']=$params['block'];
+ $block_params['pass_params']='true';
+ $block_params['IdField'] = $id_field;
+
+ $next_block=$params['full_block'];
+
+ $prev_title="";
+
+ while (!$list->EOL())
+ {
+ $nextItemPrompt=$list->Records[$list->CurrentIndex+1]['prompt'];
+ $thisItemPrompt=$list->Records[$list->CurrentIndex]['prompt'];
+
+ $this_title=$list->Records[$list->CurrentIndex]['heading'];
+
+ if ($this_title!=$prev_title){
+ $prev_title=$this_title;
+ $section_header_params=array();
+ $section_header_params['name']='config_section_header';
+ $section_header_params['title']=$this->Application->Phrase($this_title);
+ $o.= $this->Application->ParseBlock($section_header_params, 1);
+ }
+
+ if ($nextItemPrompt==$thisItemPrompt){
+ $curr_block=$params['half_block1'];
+ $next_block=$params['half_block2'];
+ }else{
+ $curr_block=$next_block;
+ $next_block=$params['full_block'];
+ }
+ $block_params['name']=$curr_block;
+
+ $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) );
+ $o.= $this->Application->ParseBlock($block_params, 1);
+
+ $list->GoNext();
+ }
+ return $o;
+ }
+
+ function PrintConfList($params){
+ $list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params);
+ $id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
+
+ $list->PerPage=-1;
+ $list->Query();
+ $o = '';
+ $list->GoFirst();
+
+ $tmp_row=array();
+
+ while (!$list->EOL())
+ {
+ $rec = $list->getCurrentRecord();
+ $tmp_row[0][$rec['VariableName']]=$rec['VariableValue'];
+ $tmp_row[0]['prompt']=$rec['prompt'];
+ $list->GoNext();
+ }
+
+ $list->Records = $tmp_row;
+
+ $block_params=$this->prepareTagParams($params);
+ $block_params['name']=$params['block'];
+
+ $list->GoFirst();
+
+ return $this->Application->ParseBlock($block_params, 1);
+
+ }
+
+
+ function GetToEnv($params){
+
+ $vars = explode(',', $params['vars']);
+
+ foreach ($vars as $key => $var){
+ $val=$this->Application->GetVar($var);
+ if ($val) {
+ $this->Application->SetVar("conf_".$var, $this->myUrlEncode($val));
+ }
+
+ }
+ }
+
+ function myUrlDecode($str){
+ $str=str_replace(';',':', $str);
+ $str=str_replace('!','-', $str);
+ return $str;
+ }
+
+ function myUrlEncode($str){
+ $str=str_replace('-', '!', $str);
+ $str=str_replace(':', ';', $str);
+ return $str;
+ }
+
+ function ConfigValue($params){
+
+ return $this->Application->ConfigValue($params['name']);
+
+ }
+
+ function Error($params)
+ {
+ $object =& $this->Application->recallObject( $this->getPrefixSpecial() );
+ $field = $object->GetDBField($params['id_field']);
+
+ $errors = $this->Application->GetVar('errormsgs');
+ $errors = $errors[$this->getPrefixSpecial()];
+
+ if (isset($errors[$field])){
+ $msg = $this->Application->Phrase($errors[$field]);
+ }
+ else {
+ $msg = '';
+ }
+
+ return $msg;
+ }
+
+}
+
+?>
\ No newline at end of file
Property changes on: trunk/core/units/configuration/configuration_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/core/units/configuration/configuration_event_handler.php
===================================================================
--- trunk/core/units/configuration/configuration_event_handler.php (nonexistent)
+++ trunk/core/units/configuration/configuration_event_handler.php (revision 1557)
@@ -0,0 +1,163 @@
+<?php
+
+ class ConfigurationEventHandler extends InpDBEventHandler {
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ $module_owner=$this->Application->GetVar('module');
+ if ($module_owner===false) {
+ $module_owner=$this->myUrlDecode($this->Application->GetVar('conf_module'));
+ $this->Application->SetVar("module", $module_owner);
+ }
+
+ $section=$this->Application->GetVar('section');
+ if ($section===false){
+ $section=$this->myUrlDecode($this->Application->GetVar('conf_section'));
+ $this->Application->SetVar("section", $section);
+ }
+
+ $object->addFilter('module_filter', '%1$s.ModuleOwner = "'.$module_owner.'"');
+ $object->addFilter('section_filter', '%1$s.Section = "'.$section.'"');
+ $object->AddOrderField('DisplayOrder', 'ASC');
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ if($object->GetDBField('element_type') == 'password')
+ {
+ if (trim($object->GetDBField('VariableValue'))=='') {
+ $field_options=$object->GetFieldOptions('VariableValue');
+ $field_options['skip_empty']=1;
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }else{
+ $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue')));
+ }
+ }
+
+ $this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State');
+
+ if ( isset($this->country_state_pairs[$object->GetDBField('VariableName')]) ){
+ $this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue');
+ }
+
+ if( isset($this->state_country_codes[$object->GetDBField('VariableName')]) )
+ {
+ $cs_helper = &$this->Application->recallObject('CountryStatesHelper');
+ $state_valid_code = $cs_helper->CheckState( $object->GetDBField('VariableValue'), $this->state_country_codes[$object->GetDBField('VariableName')] );
+ if ($state_valid_code !== false)
+ {
+ $object->SetDBField('VariableValue', $state_valid_code);
+ }
+ else
+ {
+ $errormsgs = $this->Application->GetVar('errormsgs');
+ $errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special];
+
+ $errors[ $object->GetDBField('VariableName') ] = 'la_InvalidState';
+ $errormsgs[$event->Prefix_Special] = $errors;
+
+ $this->Application->SetVar('errormsgs', $errormsgs);
+
+ $event->redirect = false;
+ $event->status = erFAIL;
+ }
+ }
+
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ $object =& $event->getObject();
+ if($object->GetDBField('element_type') == 'password')
+ {
+ if (trim($object->GetDBField('VariableValue'))=='') {
+ $field_options=$object->GetFieldOptions('VariableValue');
+ unset($field_options['skip_empty']);
+ $object->SetFieldOptions('VariableValue', $field_options);
+ }
+ }
+ }
+
+ function OnUpdate(&$event)
+ {
+ parent::OnUpdate($event);
+ $module_owner=$this->Application->GetVar('module');
+ $section=$this->Application->GetVar('section');
+
+ $event->redirect_params = Array('opener' => 's','conf_section'=>$this->myUrlEncode($section), 'conf_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay!
+ if ($this->Application->GetVar('errormsgs')){
+ $event->redirect = false;
+ }
+ }
+
+ function OnCancel(&$event)
+ {
+ parent::OnCancel($event);
+ $module_owner=$this->Application->GetVar('module');
+ $section=$this->Application->GetVar('section');
+
+ $event->redirect_params = Array('opener' => 's','conf_section'=>$this->myUrlEncode($section), 'conf_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay!
+ }
+
+ function myUrlDecode($str){
+ $str=str_replace(';',':', $str);
+ $str=str_replace('!','-', $str);
+ return $str;
+ }
+
+ function myUrlEncode($str){
+ $str=str_replace('-', '!', $str);
+ $str=str_replace(':', ';', $str);
+ return $str;
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnChangeCountry(&$event)
+ {
+ $event->setPseudoClass('_List');
+ $object = &$event->getObject( Array('per_page'=>-1) );
+ $object->Query();
+ //$object->SetDBField('');
+ $array_records = &$object->Records;
+ foreach($array_records as $i=>$record){
+ if ($record['VariableName']=='Comm_Country'){
+ $values = $this->Application->GetVar('conf');
+ $array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue'];
+ }
+ }
+
+ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay!
+ $event->redirect = false;
+ }
+
+
+
+ }
+
+
+
+?>
\ No newline at end of file
Property changes on: trunk/core/units/configuration/configuration_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline