Index: branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php =================================================================== diff -u -r7642 -r7701 --- branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php (.../groups_config.php) (revision 7642) +++ branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php (.../groups_config.php) (revision 7701) @@ -26,7 +26,7 @@ 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('g' => '!la_title_Adding_Group!'), 'edit_status_labels' => Array('g' => '!la_title_Editing_Group!'), - 'new_titlefield' => Array('g' => '!la_title_New_Group!'), + 'new_titlefield' => Array('g' => ''), ), 'groups_list' => Array('prefixes' => Array('g.total_List'), 'format' => "!la_title_Groups! (#g.total_recordcount#)"), @@ -102,7 +102,7 @@ 'Name' => Array('title' => 'la_col_GroupName'), ), ), - + 'Radio' => Array ( 'Icons' => Array(1 => 'icon16_group.gif', 0 => 'icon16_group_disabled.gif'), 'Fields' => Array( @@ -111,7 +111,7 @@ 'Description' => Array('title' => 'la_col_Description'), ), ), - + 'GroupSelector' => Array ( 'Icons' => Array(1 => 'icon16_group.gif', 0 => 'icon16_group_disabled.gif'), 'Fields' => Array( @@ -121,8 +121,8 @@ ), ), ), - + ); ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.21.2/core/units/languages/languages_config.php =================================================================== diff -u -r7644 -r7701 --- branches/unlabeled/unlabeled-1.21.2/core/units/languages/languages_config.php (.../languages_config.php) (revision 7644) +++ branches/unlabeled/unlabeled-1.21.2/core/units/languages/languages_config.php (.../languages_config.php) (revision 7701) @@ -72,7 +72,7 @@ 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('lang'=>'!la_title_Adding_Language!'), 'edit_status_labels' => Array('lang'=>'!la_title_Editing_Language!'), - 'new_titlefield' => Array('lang'=>'!la_title_New_Language!'), + 'new_titlefield' => Array('lang'=>''), ), 'languages_list' => Array( 'prefixes' => Array('lang_List'), 'format' => "!la_title_Configuration! - !la_title_LanguagePacks! (#lang_recordcount#)"), @@ -96,7 +96,7 @@ 'format' => '#emailevents_status# - #emailevents_titlefield#'), 'email_messages_edit' => Array( 'prefixes' => Array('lang','emailmessages'), - 'new_titlefield' => Array('emailmessages' => '!la_NoSubject!'), + 'new_titlefield' => Array('emailmessages' => ''), 'format' => "#lang_status# '#lang_titlefield#' - !la_title_EditingEmailEvent! '#emailmessages_titlefield#'"), ), Index: branches/unlabeled/unlabeled-1.10.2/core/units/phrases/phrases_config.php =================================================================== diff -u -r7636 -r7701 --- branches/unlabeled/unlabeled-1.10.2/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 7636) +++ branches/unlabeled/unlabeled-1.10.2/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 7701) @@ -53,10 +53,10 @@ 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('phrases'=>'!la_title_Adding_Phrase!'), 'edit_status_labels' => Array('phrases'=>'!la_title_Editing_Phrase!'), - 'new_titlefield' => Array('phrases'=>'!la_title_New_Phrase!'), + 'new_titlefield' => Array('phrases'=>''), ), - 'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# - #phrases_titlefield#'), + 'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# #phrases_titlefield#'), ), Index: branches/unlabeled/unlabeled-1.23.2/core/kernel/db/dblist.php =================================================================== diff -u -r7645 -r7701 --- branches/unlabeled/unlabeled-1.23.2/core/kernel/db/dblist.php (.../dblist.php) (revision 7645) +++ branches/unlabeled/unlabeled-1.23.2/core/kernel/db/dblist.php (.../dblist.php) (revision 7701) @@ -280,6 +280,22 @@ } } + function GetNoFilterCount() + { + if (!$this->Counted) { + $this->CountRecs(); + } + return $this->NoFilterCount; + } + + function GetRecordsCount() + { + if (!$this->Counted) { + $this->CountRecs(); + } + return $this->RecordsCount; + } + function getCountSQL($sql) { if ( preg_match("/DISTINCT(.*?)FROM(?!_)/is",$sql,$regs ) ) @@ -604,7 +620,7 @@ $name = $field[0]; $ret .= isset($this->Fields[$name]) && !isset($this->VirtualFields[$name]) ? '`'.$this->TableName.'`.' : ''; - + if ($field[0] == 'RAND()' || $field[2]) { $ret .= $field[0].' '.$field[1].','; } Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/user_edit_password.tpl =================================================================== diff -u -r7698 -r7701 --- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/user_edit_password.tpl (.../user_edit_password.tpl) (revision 7698) +++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/user_edit_password.tpl (.../user_edit_password.tpl) (revision 7701) @@ -27,7 +27,6 @@ - Index: branches/unlabeled/unlabeled-1.34.2/core/units/users/users_config.php =================================================================== diff -u -r7696 -r7701 --- branches/unlabeled/unlabeled-1.34.2/core/units/users/users_config.php (.../users_config.php) (revision 7696) +++ branches/unlabeled/unlabeled-1.34.2/core/units/users/users_config.php (.../users_config.php) (revision 7701) @@ -69,7 +69,7 @@ 'default' => Array( 'new_status_labels' => Array('u'=>'!la_title_Adding_User!'), 'edit_status_labels' => Array('u'=>'!la_title_Editing_User!'), - 'new_titlefield' => Array('u'=>'!la_title_New_User!'), + 'new_titlefield' => Array('u'=>''), ), 'users_list' => Array('prefixes' => Array('u_List'), 'format' => "!la_title_Users! (#u_recordcount#)"), Index: branches/unlabeled/unlabeled-1.4.2/core/admin_templates/js/script.js =================================================================== diff -u -r7652 -r7701 --- branches/unlabeled/unlabeled-1.4.2/core/admin_templates/js/script.js (.../script.js) (revision 7652) +++ branches/unlabeled/unlabeled-1.4.2/core/admin_templates/js/script.js (.../script.js) (revision 7701) @@ -1318,3 +1318,41 @@ } return x1 + x2; } + +var last_shown_error = false; +var errors = new Object(); +var first_error = new Object(); +var fields = new Object(); +var textareas100 = new Array(); +function show_form_error(prefix, field, sticky) +{ + if (isset(errors[prefix]) && isset(errors[prefix][field])) { + span = document.getElementById('error_msg_'+prefix); + span.innerHTML = fields[prefix][field] + ' - ' + errors[prefix][field]; + if (sticky) last_shown_error = field; + } +} +function hide_form_error(prefix) +{ + span = document.getElementById('error_msg_'+prefix); + if (!span) return; + span.innerHTML = '
'; + if (typeof(last_shown_error) != 'undefined' && last_shown_error) { + show_form_error(prefix, last_shown_error); + } +} +function add_form_error(prefix, field, element, error_msg) { + if (error_msg != '') { + if (typeof(errors[prefix]) == 'undefined') { + errors[prefix] = new Object(); + } + errors[prefix][field] = error_msg; + document.getElementById(element).onfocus = function() { + show_form_error(prefix, field, true) + }; + document.getElementById(element).onblur = function() {last_shown_error = false}; + if (typeof(first_error[prefix]) == 'undefined' || first_error[prefix] == false) { + first_error[prefix] = [field, element]; + } + } +} \ No newline at end of file Index: branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php =================================================================== diff -u -r6626 -r7701 --- branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 6626) +++ branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 7701) @@ -1,5 +1,5 @@ 'cf', 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), @@ -15,7 +15,7 @@ 4 => 'type', 5 => 'mode', ), - + 'Hooks' => Array( Array( 'Mode' => hAFTER, @@ -28,50 +28,50 @@ 'DoEvent' => 'OnSaveCustomField', ), ), - + 'IDField' => 'CustomFieldId', - + 'TitleField' => 'FieldName', // field, used in bluebar when editing existing item - + 'TitlePhrase' => 'la_title_CustomFields', - + 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('cf'=>'!la_title_addingCustom!'), 'edit_status_labels' => Array('cf'=>'!la_title_Editing_CustomField!'), - 'new_titlefield' => Array('cf'=>'!la_title_NewCustomField!'), + 'new_titlefield' => Array('cf'=>''), ), - + 'custom_fields_list'=>Array( 'prefixes' => Array('cf_List'), 'format' => "!la_tab_ConfigCustom! (#cf_recordcount#)", ), - + 'custom_fields_edit'=>Array( 'prefixes' => Array('cf'), - 'new_titlefield' => Array('cf'=>'!la_title_NewCustomField!'), + 'new_titlefield' => Array('cf'=>''), 'format' => "#cf_status# '#cf_titlefield#'", ), ), - + 'TableName' => TABLE_PREFIX.'CustomField', - + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', ), // key - special, value - list select sql - - 'ListSortings' => Array( + + 'ListSortings' => Array( '' => Array( 'ForcedSorting' => Array('DisplayOrder' => 'asc'), 'Sorting' => Array('FieldName' => 'asc'), ), - + 'general' => Array( 'Sorting' => Array('DisplayOrder' => 'asc') ), - + ), - + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', ), 'SubItems' => Array('confs-cf'), - + 'Fields' => Array( 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => ''), 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'), @@ -89,9 +89,9 @@ 'Value' => Array('type' => 'string', 'default' => ''), 'OriginalValue' => Array('type' => 'string', 'default' => ''), 'Error' => Array('type' => 'string', 'default' => ''), - + ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_custom.gif'), @@ -102,7 +102,7 @@ 'DisplayOrder' => Array('title' => 'la_prompt_DisplayOrder'), ), ), - + 'SeparateTab' => Array( 'Icons' => Array('default'=>'icon16_custom.gif'), 'Fields' => Array( @@ -112,7 +112,7 @@ 'Error' => Array( 'title'=>'la_col_Error', 'data_block' => 'custom_error_td'), ), ), - + 'SeparateTabOriginal' => Array( 'Icons' => Array('default'=>'icon16_custom.gif'), 'Fields' => Array( @@ -122,12 +122,12 @@ 'OriginalValue' => Array( 'title'=>'la_col_OriginalValue', 'data_block' => 'grid_original_td'), ), ), - + ), ); if (constOn('DEBUG_MODE')) { $config['Grids']['Default']['Fields']['IsSystem'] = Array('title' => 'la_col_IsSystem'); } - + ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/users_edit.tpl =================================================================== diff -u -r7698 -r7701 --- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/users_edit.tpl (.../users_edit.tpl) (revision 7698) +++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/users_edit.tpl (.../users_edit.tpl) (revision 7701) @@ -59,16 +59,16 @@
-
- +
- + +
Index: branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php =================================================================== diff -u -r7648 -r7701 --- branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php (.../multilang_formatter.php) (revision 7648) +++ branches/unlabeled/unlabeled-1.3.2/core/kernel/utility/formatters/multilang_formatter.php (.../multilang_formatter.php) (revision 7701) @@ -59,6 +59,12 @@ if ( getArrayValue($grid, 'Fields', $field_name) ) { array_rename_key($grids[$name]['Fields'], $field_name, $lang_field_name); } + // update sort fields - used for sorting and filtering in SQLs + foreach ($grid['Fields'] as $grid_fld_name => $fld_options) { + if (isset($fld_options['sort_field']) && $fld_options['sort_field'] == $field_name) { + $grids[$name]['Fields'][$grid_fld_name]['sort_field'] = $lang_field_name; + } + } } $this->Application->setUnitOption($object->Prefix, 'Grids', $grids); Index: branches/unlabeled/unlabeled-1.71.2/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r7662 -r7701 --- branches/unlabeled/unlabeled-1.71.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7662) +++ branches/unlabeled/unlabeled-1.71.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7701) @@ -708,6 +708,7 @@ $params['field'] = 'any'; } if ($this->HasError($params)) { + $params['prefix'] = $this->getPrefixSpecial(); return $this->Application->ParseBlock($params); } } @@ -1318,8 +1319,11 @@ // b. setting object's titlefield value (in titlebar ONLY) to default in case if object beeing created with no titlefield filled in if( $object_status[ $prefix_data['prefix_special'] ] == 'new' ) { + $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', '#'.$prefix_data['prefix_special'].'_titlefield#', $title); $new_value = $this->getInfo( $objects[ $prefix_data['prefix_special'] ], 'titlefield' ); - if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); + if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) { + $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]); + } // old format had single quotes in the format $title = str_replace('\'#'.$prefix_data['prefix_special'].'_titlefield#\'', "'$new_value'", $title); // new format has no quotes and $new_value should be empty when creating items @@ -1385,15 +1389,15 @@ switch ($params['type']) { case 'filtered': - return $object->RecordsCount; + return $object->GetRecordsCount(); case 'total': - return $object->NoFilterCount; + return $object->GetNoFilterCount(); case 'from': return $object->RecordsCount ? $object->Offset+1 : 0; //0-based case 'to': return min($object->Offset + $object->PerPage, $object->RecordsCount); case 'total_pages': - return ceil($object->RecordsCount / $object->PerPage); + return $object->GetTotalPages(); case 'needs_pagination': return $object->RecordsCount > $object->PerPage; } Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl =================================================================== diff -u -r7648 -r7701 --- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 7648) +++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/incs/footer.tpl (.../footer.tpl) (revision 7701) @@ -17,14 +17,44 @@ function MakeHeight100(id) { if (!id) id = 'scroll_container'; + AdjustTextAreas(true); // reseting textareas to minimal size var el = document.getElementById(id); var h = (document.all ? window.document.body.offsetHeight : window.innerHeight) - el.offsetTop + 'px'; var w = (document.all ? window.document.body.offsetWidth : window.innerWidth) - el.offsetLeft + 'px'; // alert('h: '+h) el.style.height = h; // el.style.width=w; + AdjustTextAreas(); // adjusting textarea height } + function AdjustTextAreas(reset) + { + var tmp; + var sizes = new Array(); + if (isset(textareas100)) { + // we need separate cycle to get heights, because if we set the height in the same cycle + // it will recursively affect heights of other textareas + for (var i in textareas100) { + tmp = document.getElementById(textareas100[i]); + sizes[tmp.name] = tmp.parentNode.offsetHeight; + } + for (var i in textareas100) { + tmp = document.getElementById(textareas100[i]); + tmp.style.height = reset ? '70px' : (sizes[tmp.name] - 18) + 'px'; + } + } + } + + if (isset(first_error)) { + for (var i in first_error) { + if (first_error[i] != false) { +// show_form_error(i, first_error[i][0]); + document.getElementById(first_error[i][1]).focus(); +// alert('focused on '+first_error[i][1]) + } + } + } + Index: branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php =================================================================== diff -u -r7648 -r7701 --- branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 7648) +++ branches/unlabeled/unlabeled-1.3.2/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 7701) @@ -74,8 +74,8 @@ 'Default' => Array( 'Icons' => Array('default'=>'icon16_custom.gif'), 'Fields' => Array( - 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td'), 'Subject' => Array( 'title'=>'la_col_Subject'), + 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td'), 'Type' => Array( 'title'=>'la_col_Type'), ), Index: branches/unlabeled/unlabeled-1.4.2/core/units/translator/translator_config.php =================================================================== diff -u -r4935 -r7701 --- branches/unlabeled/unlabeled-1.4.2/core/units/translator/translator_config.php (.../translator_config.php) (revision 4935) +++ branches/unlabeled/unlabeled-1.4.2/core/units/translator/translator_config.php (.../translator_config.php) (revision 7701) @@ -24,7 +24,7 @@ 'default' => Array( 'new_status_labels' => Array('trans'=>'!la_title_Adding_Order!'), 'edit_status_labels' => Array('trans'=>'!la_title_Editing_Order!'), - 'new_titlefield' => Array('trans'=>'!la_title_New_Order!'), + 'new_titlefield' => Array('trans'=>''), ), 'trans_edit' => Array('prefixes' => Array('trans'), 'format' => '!la_title_EditingTranslation!'), Index: branches/unlabeled/unlabeled-1.55.2/core/units/categories/categories_config.php =================================================================== diff -u -r7657 -r7701 --- branches/unlabeled/unlabeled-1.55.2/core/units/categories/categories_config.php (.../categories_config.php) (revision 7657) +++ branches/unlabeled/unlabeled-1.55.2/core/units/categories/categories_config.php (.../categories_config.php) (revision 7701) @@ -54,7 +54,7 @@ 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('c' => '!la_title_Adding_Category!'), 'edit_status_labels' => Array('c' => '!la_title_Editing_Category!'), - 'new_titlefield' => Array('c' => '!la_title_New_Category!'), + 'new_titlefield' => Array('c' => ''), ), 'category_list' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), @@ -74,7 +74,7 @@ 'images_edit' => Array( 'prefixes' => Array('c', 'c-img'), 'new_status_labels' => Array('c-img'=>'!la_title_Adding_Image!'), 'edit_status_labels' => Array('c-img'=>'!la_title_Editing_Image!'), - 'new_titlefield' => Array('c-img'=>'!la_title_New_Image!'), + 'new_titlefield' => Array('c-img'=>''), 'format' => "#c_status# '#c_titlefield#' - #c-img_status# '#c-img_titlefield#'", ), Index: branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/search_helper.php =================================================================== diff -u -r7664 -r7701 --- branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 7664) +++ branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 7701) @@ -1,8 +1,8 @@ $kw) $final[$kw] = $res[1][$index]; $keyword = preg_replace($quotes_re, '', $keyword); $not_quoted_kw = preg_match_all($no_quotes_re, $keyword, $res); foreach ($res[2] as $index => $kw) $final[$kw] = $res[1][$index]; - + return $final; } - + function getPositiveKeywords($keyword) { $keywords = $this->splitKeyword($keyword); - + $ret = Array(); foreach ($keywords as $keyword => $sign) { if ($sign == '+' || $sign == '') { @@ -35,54 +35,54 @@ } return $ret; } - + function buildWhereClause($keyword, $fields) { $keywords = $this->splitKeyword($keyword); - + $normal_conditions = Array(); $plus_conditions = Array(); $minus_conditions = Array(); - + foreach ($keywords as $keyword => $sign) { switch ($sign) { case '+': $plus_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; break; - + case '-': foreach ($fields as $field) { $condition[] = $field.' NOT LIKE "%'.$keyword.'%" OR '.$field.' IS NULL'; } $minus_conditions[] = '('.implode(') AND (', $condition).')'; break; - + case '': $keyword = str_replace('"', '\"', $keyword); $normal_conditions[] = implode(' LIKE "%'.$keyword.'%" OR ', $fields).' LIKE "%'.$keyword.'%"'; break; } } - + // building where clause if ($normal_conditions) { $where_clause = '('.implode(') OR (', $normal_conditions).')'; } else { $where_clause = '1'; } - + if ($plus_conditions) { $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $plus_conditions).')'; } - + if ($minus_conditions) { $where_clause = '('.$where_clause.') AND ('.implode(') AND (', $minus_conditions).')'; } - + return $where_clause; } - + /** * Returns additional information about search field * @@ -104,16 +104,16 @@ } $table_name = ($sql_filter_type == 'where') ? $table_name : ''; - + // replace wid inside table name to WID_MARK constant value $is_temp_table = preg_match('/(.*)'.TABLE_PREFIX.'ses_'.$this->Application->GetSID().'(_[\d]+){0,1}_edit_(.*)/', $table_name, $regs); if ($is_temp_table) { $table_name = $regs[1].TABLE_PREFIX.'ses_'.EDIT_MARK.'_edit_'.$regs[3]; // edit_mark will be replaced with sid[_main_wid] in AddFilters } - + return Array ('field_name' => $field_name, 'field_type' => $field_type, 'table_name' => $table_name, 'sql_filter_type' => $sql_filter_type); } - + /** * Enter description here... * @@ -129,32 +129,32 @@ $search_keyword = str_replace('*', '%', $search_keyword); $custom_filter = $this->processCustomFilters($event); - + if(!$search_keyword && $custom_filter === false) { $this->resetSearch($event); return true; } - + if ($search_keyword) { $this->processAutomaticFilters($event, $search_keyword, $custom_filter); } } - - + + function processAutomaticFilters(&$event, $search_keyword, $custom_filter) { $grid_name = $this->Application->GetVar('grid_name'); $grids = $this->Application->getUnitOption($event->Prefix, 'Grids'); $search_fields = array_keys($grids[$grid_name]['Fields']); - + $search_filter = Array(); $object =& $event->getObject(); - + foreach ($search_fields as $search_field) { $custom_search = isset($custom_filter[$search_field]); - + $filter_data = $this->getSearchClause($object, $search_field, $search_keyword, $custom_search); - + if ($filter_data) { $search_filter[$search_field] = $filter_data; } @@ -164,7 +164,7 @@ } $this->Application->StoreVar($event->getPrefixSpecial().'_search_filter', serialize($search_filter) ); } - + /** * Returns search clause for any particular field * @@ -177,17 +177,17 @@ function getSearchClause(&$object, $field_name, $search_keyword, $custom_search) { $search_keywords = $this->splitKeyword($search_keyword); - + extract( $this->getFieldInformation($object, $field_name) ); // see getFieldInformation for more details - + $filter_value = ''; - + // get field clause by formatter name and/or parameters $formatter = getArrayValue($object->Fields[$field_name], 'formatter'); switch ($formatter) { case 'kOptionsFormatter': $search_keys = Array(); - + if ($custom_search === false) { // if keywords passed through simple search filter (on each grid) $use_phrases = getArrayValue($object->Fields[$field_name], 'use_phrases'); @@ -271,14 +271,14 @@ break; } } - + if ($filter_value) { return Array('type' => $sql_filter_type, 'value' => $filter_value); } - + return false; } - + /** * Processes custom filters from submit * @@ -288,7 +288,7 @@ function processCustomFilters(&$event) { $grid_name = $this->Application->GetVar('grid_name'); - + // update "custom filter" with values from submit: begin $view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view'); $custom_filters = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name); @@ -312,7 +312,7 @@ if (isset($custom_filter[$field_name])) { // use isset, because non-existing key will cause "php notice"! unset($custom_filter[$field_name][$filter_type]); // remove filter - + if (!$custom_filter[$field_name]) { // if no filters left for field, then delete record at all unset($custom_filter[$field_name]); @@ -325,21 +325,21 @@ } } } - + if ($custom_filter) { $custom_filters[$grid_name] = $custom_filter; } else { unset($custom_filters[$grid_name]); } // update "custom filter" with values from submit: end - + if (!$custom_filter) { // in case when no filters specified, there are nothing to process $this->Application->StorePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, serialize($custom_filters) ); return false; } - + $object =& $event->getObject(); // don't recall it each time in getCustomFilterSearchClause $grid_info = $this->Application->getUnitOption($event->Prefix.'.'.$grid_name, 'Grids'); foreach ($custom_filter as $field_name => $field_options) { @@ -351,12 +351,12 @@ $custom_filter[$field_name][$filter_type] = $field_options; } } - + $custom_filters[$grid_name] = $custom_filter; $this->Application->StorePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, serialize($custom_filters) ); return $custom_filter; } - + /** * Return numeric range filter value + checking that it's number * @@ -367,23 +367,22 @@ { return strlen($value) && is_numeric($value) ? $this->Conn->qstr($value) : false; } - + function getCustomFilterSearchClause(&$object, $field_name, $filter_type, $field_options) { - if ($filter_type == 'date_range') { - // use timestamp field, not formatted one + // this is usually used for mutlilingual fields and date fields + if (isset($field_options['grid_options']['sort_field'])) { $field_name = $field_options['grid_options']['sort_field']; } - extract( $this->getFieldInformation($object, $field_name) ); // see getFieldInformation for more details - + $filter_value = ''; - + switch ($filter_type) { case 'range': $from = $this->getRangeValue($field_options['submit_value']['from']); $to = $this->getRangeValue($field_options['submit_value']['to']); - + if ($from !== false && $to !== false) { // add range filter $filter_value = $table_name.'`'.$field_name.'` >= '.$from.' AND '.$table_name.'`'.$field_name.'` <= '.$to; @@ -397,12 +396,12 @@ $filter_value = $table_name.'`'.$field_name.'` = '.$to; } break; - + case 'float_range': // MySQL can't compare values in "float" type columns using "=" operator $from = $this->getRangeValue($field_options['submit_value']['from']); $to = $this->getRangeValue($field_options['submit_value']['to']); - + if ($from !== false && $to !== false) { // add range filter $filter_value = $table_name.'`'.$field_name.'` >= '.$from.' AND '.$table_name.'`'.$field_name.'` <= '.$to; @@ -416,11 +415,11 @@ $filter_value = 'ABS('.$table_name.'`'.$field_name.'` - '.$to.') <= 0.0001'; } break; - + case 'date_range': $from = $this->processRangeField($object, $field_name, $field_options['submit_value'], 'from'); $to = $this->processRangeField($object, $field_name, $field_options['submit_value'], 'to'); - + $day_seconds = 23 * 60 * 60 + 59 * 60 + 59; if ($from !== false && $to === false) { $from = strtotime(date('Y-m-d', $from).' 00:00:00', $from); // reset to morning @@ -430,34 +429,34 @@ $to = strtotime(date('Y-m-d', $to).' 23:59:59', $to); // reset to evening $from = $to - $day_seconds; } - + if ($from !== false && $to !== false) { $filter_value = $table_name.'`'.$field_name.'` >= '.$from.' AND '.$table_name.'`'.$field_name.'` <= '.$to; } break; - + case 'equals': - case 'options': + case 'options': $field_value = strlen($field_options['submit_value']) ? $this->Conn->qstr($field_options['submit_value']) : false; if ($field_value) { $filter_value = $table_name.'`'.$field_name.'` = '.$field_value; } break; - + case 'like': $filter_value = $this->buildWhereClause($field_options['submit_value'], Array($table_name.'`'.$field_name.'`')); - break; - + break; + default: break; } - + $field_options['sql_filter_type'] = $sql_filter_type; $field_options['value'] = $filter_value; - + return $field_options; } - + /** * Enter description here... * @@ -471,11 +470,11 @@ if (!strlen($value[$type])) { return false; } - + $lang_current =& $this->Application->recallObject('lang.current'); $options = $object->GetFieldOptions($search_field); $dt_separator = isset($options['date_time_separator']) ? $options['date_time_separator'] : ' '; - + $tmp_value = explode($dt_separator, $value[$type], 2); if (count($tmp_value) == 1) { // time is missing, then guess it and add to date @@ -495,7 +494,7 @@ } return $value_ts; } - + /** * Resets current search * @@ -509,10 +508,10 @@ $view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view'); $this->Application->RemovePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name); } - - - - + + + + } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl =================================================================== diff -u -r7648 -r7701 --- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 7648) +++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 7701) @@ -34,7 +34,8 @@ - +
+
"> @@ -56,5 +57,6 @@
+ Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/root_edit_password.tpl =================================================================== diff -u -r7698 -r7701 --- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/root_edit_password.tpl (.../root_edit_password.tpl) (revision 7698) +++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/users/root_edit_password.tpl (.../root_edit_password.tpl) (revision 7701) @@ -28,7 +28,6 @@ -