Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Mon, Sep 29, 2:38 AM

in-portal

Index: branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_config.php (revision 1368)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_config.php (revision 1369)
@@ -1,67 +1,82 @@
<?php
$config = Array(
'Prefix' => 'confs',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ConfigSearchEventHandler','file'=>'config_search_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ConfigSearchTagProcessor','file'=>'config_search_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'hooks' => Array(),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
4 => 'module',
+ 5 => 'section',
),
+
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'cf',
+ 'HookToSpecial' => '',
+ 'HookToEvent' => Array( 'OnPreSaveCreated' ),
+ 'DoPrefix' => 'confs',
+ 'DoSpecial' => '',
+ 'DoEvent' => 'OnCreateCustomField',
+ ),
+ ),
+
'IDField' => 'SearchConfigId',
'TitlePresets' => Array(
'config_list' => Array('prefixes' => Array('confs_List'), 'format' => "!la_updating_config!"),
),
'TableName' => TABLE_PREFIX.'SearchConfig',
'ListSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'SearchConfig'),
'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'SearchConfig'),
'SubTables' => Array(),
'Fields' => Array(
'TableName' => Array('type' => 'string','not_null' => '1','default' => ''),
'FieldName' => Array('type' => 'string','not_null' => '1','default' => ''),
'SimpleSearch' => Array('type' => 'int','not_null' => '1','default' => '0'),
'AdvancedSearch' => Array('type' => 'int','not_null' => '1','default' => '0'),
'Description' => Array('type' => 'string','default' => ''),
'DisplayName' => Array('type' => 'string','default' => ''),
'ModuleName' => Array('type' => 'string','default' => ''),
'ConfigHeader' => Array('type' => 'string','default' => ''),
'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
'SearchConfigId' => Array('type' => 'int','not_null' => '1','default' => ''),
'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'),
'FieldType' => Array('type' => 'string','not_null' => '1','default' => 'text'),
'ForeignField' => Array('type' => 'string','default' => ''),
'JoinClause' => Array('type' => 'string','default' => ''),
'IsWhere' => Array('type' => 'string','default' => ''),
'IsNotWhere' => Array('type' => 'string','default' => ''),
'ContainsWhere' => Array('type' => 'string','default' => ''),
'NotContainsWhere' => Array('type' => 'string','default' => ''),
'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => '0'),
),
'VirtualFields' => Array(),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
'Fields' => Array(
'TableName' => Array( 'title'=>'la_col_TableName', 'data_block' => 'grid_data_td'),
'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_data_td' ),
'SimpleSearch' => Array( 'title'=>'la_col_SimpleSearch', 'data_block' => 'grid_data_td'),
),
),
),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.1
\ No newline at end of property
+1.1.2.2
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_event_handler.php (revision 1368)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_event_handler.php (revision 1369)
@@ -1,56 +1,108 @@
<?php
class ConfigSearchEventHandler 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('confs_module'));
$this->Application->SetVar("module", $module_owner);
}
+
+ $section=$this->Application->GetVar('section');
+ if ($section===false){
+ $section=$this->myUrlDecode($this->Application->GetVar('confs_section'));
+ $this->Application->SetVar("section", $section);
+ }
$object->addFilter('module_filter', '%1$s.ModuleName = "'.$module_owner.'"');
$object->AddOrderField('DisplayOrder', 'ASC');
}
function OnUpdate(&$event)
{
parent::OnUpdate($event);
$module_owner=$this->Application->GetVar('module');
+ $module_section=$this->Application->GetVar('section');
+
+ $conf_update = new kEvent( );
+ $conf_update->Init('conf');
+ $conf_update->Name = 'OnUpdate';
+ $conf_update->redirect = false;
+ $this->Application->HandleEvent($conf_update);
+
+ $event->redirect_params = Array('opener' => 's','confs_module'=>$this->myUrlEncode($module_owner),'confs_section'=>$this->myUrlEncode($module_section),'conf_module'=>$this->myUrlEncode($module_owner),'conf_section'=>$this->myUrlEncode($module_section),'pass'=>'all,confs,conf'); //stay!
- $event->redirect_params = Array('opener' => 's','confs_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay!
}
function OnCancel(&$event)
{
parent::OnCancel($event);
$module_owner=$this->Application->GetVar('module');
+ $module_section=$this->Application->GetVar('section');
- $event->redirect_params = Array('opener' => 's','confs_module'=>$this->myUrlEncode($module_owner),'pass'=>'all,conf'); //stay!
+ $event->redirect_params = Array('opener' => 's','confs_module'=>$this->myUrlEncode($module_owner),'confs_section'=>$this->myUrlEncode($module_section),'conf_module'=>$this->myUrlEncode($module_owner),'conf_section'=>$this->myUrlEncode($module_section),'pass'=>'all,confs,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 OnCreateCustomField(&$event)
+ {
+ $cf_object =& $event->MasterEvent->getObject();
+
+ $item_id = $this->getPassedID($event->MasterEvent);
+ if($item_id == '')
+ {
+ // only when creating new custom field
+ $cf_search = array();
+
+ $cf_search['CustomFieldId'] = $cf_object->FieldValues['CustomFieldId'];
+ $cf_search['DisplayOrder'] = $cf_object->FieldValues['DisplayOrder'];
+ $cf_search['ElementType'] = $cf_object->FieldValues['ElementType'];
+ $cf_search['DisplayName'] = $cf_object->FieldValues['FieldLabel'];
+ $cf_search['FieldName'] = $cf_object->FieldValues['FieldName'];
+ $cf_search['Description'] = $cf_object->FieldValues['Prompt'];
+
+ $cf_search['TableName'] = "CustomField";
+ $cf_search['ModuleName'] = "In-Commerce";
+ $cf_search['ForeignField'] = "CustomMetaData.Value";
+ $cf_search['JoinClause'] = "(inp_CustomMetaData.ResourceId={Table}.ResourceId)";
+
+ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
+ $cf_item = $event->getObject();
+ $cf_item->SetFieldsFromHash($cf_search);
+ $cf_item->Create();
+
+
+ }
+ }
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.1
\ No newline at end of property
+1.1.2.2
\ No newline at end of property

Event Timeline