Index: trunk/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r3373 -r3597
--- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3373)
+++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3597)
@@ -672,6 +672,26 @@
return $o;
}
+ function PredefinedSearchOptions($params)
+ {
+ $object =& $this->getObject($params);
+ $field = $params['field'];
+ $saved_value = $object->GetDBField($field);
+
+ $custom_filters = $this->Application->RecallVar( $this->getPrefixSpecial().'_custom_filters');
+ if ($custom_filters) {
+ $custom_filters = unserialize($custom_filters);
+ $append = getArrayValue($params, 'type') ? '_'.$params['type'] : '';
+ $object->SetDBField($field, $custom_filters[$field.$append]);
+ }
+ else {
+ $object->SetDBField($field, '');
+ }
+ $ret = $this->PredefinedOptions($params);
+ $object->SetDBField($field, $saved_value);
+ return $ret;
+ }
+
function Format($params)
{
$field = $params['field'];
@@ -1332,7 +1352,9 @@
function SearchInputName($params)
{
$field = $this->SelectParam($params, 'field,name');
- return 'custom_filters['.$this->getPrefixSpecial().']['.$field.'_'.$params['type'].']';
+ $append = getArrayValue($params, 'type') ? '_'.$params['type'] : '';
+
+ return 'custom_filters['.$this->getPrefixSpecial().']['.$field.$append.']';
}
/**
Index: trunk/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r3559 -r3597
--- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 3559)
+++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 3597)
@@ -1363,14 +1363,22 @@
{
case 'kOptionsFormatter':
$search_keys = Array();
- $use_phrases = getArrayValue($object->Fields[$search_field], 'use_phrases');
- foreach($object->Fields[$search_field]['options'] as $key => $val)
- {
- $pattern = '#'.$keyword.'#i';
- if ( preg_match($pattern, $use_phrases ? $this->Application->Phrase($val) : $val) ) {
- array_push($search_keys, $this->Conn->qstr($key));
+
+ $field_value = getArrayValue($custom_filters, $search_field);
+ if ($field_value !== false) {
+ array_push($search_keys, $this->Conn->qstr($field_value));
+ }
+ else {
+ $use_phrases = getArrayValue($object->Fields[$search_field], 'use_phrases');
+ foreach($object->Fields[$search_field]['options'] as $key => $val)
+ {
+ $pattern = '#'.$keyword.'#i';
+ if ( preg_match($pattern, $use_phrases ? $this->Application->Phrase($val) : $val) ) {
+ array_push($search_keys, $this->Conn->qstr($key));
+ }
}
}
+
if (count($search_keys) > 0) {
$filter_value = $table_name.'`'.$search_field.'` IN ('.implode(',', $search_keys).')';
}
Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl
===================================================================
diff -u -r3559 -r3597
--- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 3559)
+++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 3597)
@@ -157,6 +157,18 @@
+
+ ">
+
+