Index: branches/RC/core/admin_templates/js/ajax_dropdown.js =================================================================== diff -u -N -r9276 -r9277 --- branches/RC/core/admin_templates/js/ajax_dropdown.js (.../ajax_dropdown.js) (revision 9276) +++ branches/RC/core/admin_templates/js/ajax_dropdown.js (.../ajax_dropdown.js) (revision 9277) @@ -13,6 +13,12 @@ return val ? val : item.innerHTML; }); new AJAXDropDown('combo_input1', function(cur_value) {return 'items1.xml?cur='+escape(cur_value)}); + + new AJAXDropDown('curr_search_keyword', function(cur_value) { + var $url = ''; + return $url.replace('#CUR_VALUE#', escape(cur_value)); + } + ); The AJAXDropDown constructor takes the following arguments: @@ -58,9 +64,8 @@ background-color: #3366CC; color: #fff; } + - - */ Index: branches/RC/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r9275 -r9277 --- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 9275) +++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 9277) @@ -2096,29 +2096,35 @@ } /** - * Enter description here... + * Returns auto-complete values for ajax-dropdown * * @param kEvent $event */ function OnSuggestValues(&$event) { - safeDefine('DBG_SKIP_REPORTING', 1); - $lang =& $this->Application->recallObject('lang.current'); - header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); + $this->Application->XMLHeader(); $field = $this->Application->GetVar('field'); $cur_value = $this->Application->GetVar('cur_value'); - if (!$field || !$cur_value) exit; - $obj =& $event->getObject(); - $q = 'SELECT DISTINCT '.$field.' FROM '.$obj->TableName.' - WHERE '.$field.' LIKE '.$this->Conn->qstr($cur_value.'%').' ORDER BY '.$field.' LIMIT 0,20'; - $data = $this->Conn->GetCol($q); + if (!$field || !$cur_value) { + exit; + } + + $object =& $event->getObject(); + $sql = 'SELECT DISTINCT '.$field.' + FROM '.$object->TableName.' + WHERE '.$field.' LIKE '.$this->Conn->qstr($cur_value.'%').' + ORDER BY '.$field.' + LIMIT 0,20'; + $data = $this->Conn->GetCol($sql); + echo ''; foreach ($data as $item) { - echo "$item"; + echo ''.$item.''; } echo ''; - exit; + + $event->status = erSTOP; } } Index: branches/RC/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r9274 -r9277 --- branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 9274) +++ branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 9277) @@ -1011,7 +1011,6 @@ function XMLTemplate($params) { safeDefine('DBG_SKIP_REPORTING', 1); - $lang =& $this->Application->recallObject('lang.current'); if (isset($params['cache']) && $params['cache']) { $nextyear = intval(date('Y') + 1); @@ -1038,11 +1037,7 @@ } } - header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); - - if (isset($params['xml_version']) && $params['xml_version']) { - return 'GetDBField('Charset').'"?>'; - } + return $this->Application->XMLHeader(getArrayValue($params, 'xml_version')); } function Header($params) Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r8953 -r9277 --- branches/RC/core/kernel/application.php (.../application.php) (revision 8953) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 9277) @@ -2537,6 +2537,21 @@ return $count_helper->resetCounters($tables); } + + /** + * Sends XML header + optionally displays xml heading + * + * @param string $xml_version + * @return string + * @author Alex + */ + function XMLHeader($xml_version = false) + { + $lang =& $this->recallObject('lang.current'); + header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); + + return $xml_version ? 'GetDBField('Charset').'"?>' : ''; + } } ?> \ No newline at end of file