Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 3:57 PM

in-portal

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 1373)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/config_search/config_search_event_handler.php (revision 1374)
@@ -1,139 +1,139 @@
<?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.'"');
}
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!
}
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),'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();
$is_new = $event->MasterEvent->getEventParam('IsNew');
$cf_search = array();
$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['ConfigHeader'] = $cf_object->FieldValues['Heading'];
+ $cf_search['ConfigHeader'] = 'Products';
$cf_search['TableName'] = "CustomField";
$cf_search['ModuleName'] = "In-Commerce";
$cf_search['ForeignField'] = "CustomMetaData.Value";
$cf_search['JoinClause'] = "{ForeignTable}.CustomFieldId={LocalTable}.CustomFieldId";
if($is_new)
{
$live_id = $this->Conn->GetOne("SELECT CustomFieldId FROM ".TABLE_PREFIX."CustomField WHERE FieldName='".$cf_search['FieldName']."'");
$cf_search['CustomFieldId'] = $live_id;
$this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
$confs_item = $event->getObject();
$confs_item->SetFieldsFromHash($cf_search);
$confs_item->Create();
}else{
$cf_search['CustomFieldId'] = $cf_object->FieldValues['CustomFieldId'];
$search_config_id = $this->Conn->GetOne("SELECT SearchConfigId FROM ".TABLE_PREFIX."SearchConfig WHERE CustomFieldId='".$cf_object->FieldValues['CustomFieldId']."'");
$cf_search['SearchConfigId'] = $search_config_id;
$this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
$confs_item = $event->getObject();
$confs_item->SetFieldsFromHash($cf_search);
$confs_item->Update($search_config_id);
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnDeleteCustomField(&$event){
$custom_field_id =&$event->MasterEvent->getEventParam('id');
$this->Conn->Query("DELETE FROM ".TABLE_PREFIX."SearchConfig WHERE CustomFieldId=".$custom_field_id);
}
}
?>
\ 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.6
\ No newline at end of property
+1.1.2.7
\ No newline at end of property

Event Timeline