Index: trunk/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -N -r5096 -r5340
--- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5096)
+++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5340)
@@ -147,7 +147,7 @@
return count($grid_config);
}
-
+
/**
* Prints list content using block specified
*
@@ -296,9 +296,9 @@
$direction = (isset($params['direction']) && $params['direction']=="H")?"H":"V";
$columns = (isset($params['columns'])) ? $params['columns'] : 1;
-
+
$id_field = (isset($params['id_field'])) ? $params['id_field'] : $this->Application->getUnitOption($this->Prefix, 'IDField');
-
+
if ($columns>1 && $direction=="V") {
$list->Records = $this->LinearToVertical($list->Records, $columns, $list->GetPerPage());
$list->SelectedCount=count($list->Records);
@@ -313,10 +313,10 @@
$block_params['column_width'] = 100 / $columns;
$block_start_row_params=$this->prepareTagParams($params);
$block_start_row_params['name'] = $this->SelectParam($params, 'row_start_render_as,block_row_start,row_start_block');
-
+
$block_end_row_params=$this->prepareTagParams($params);
$block_end_row_params['name'] = $this->SelectParam($params, 'row_end_render_as,block_row_end,row_end_block');
-
+
$block_empty_cell_params = $this->prepareTagParams($params);
$block_empty_cell_params['name'] = $this->SelectParam($params, 'empty_cell_render_as,block_empty_cell,empty_cell_block');
@@ -338,7 +338,7 @@
else {
$column_number++;
}
-
+
$block_params['column_number'] = $column_number;
$o.= $this->Application->ParseBlock($block_params, 1);
array_push($displayed, $list->GetDBField($id_field));
@@ -351,19 +351,19 @@
$list->GoNext();
$i++;
}
-
+
// append empty cells in place of missing cells in last row
while ($i % $columns != 0) {
// until next cell will be in new row append empty cells
$o .= $block_empty_cell_params['name'] ? $this->Application->ParseBlock($block_empty_cell_params, 1) : '
| ';
-
+
if (($i+1) % $columns == 0) {
// record in next iteration is first in row too, then close this row
$o .= $block_end_row_params['name'] ? $this->Application->ParseBlock($block_end_row_params, 1) : '';
}
$i++;
}
-
+
$cur_displayed = $this->Application->GetVar($this->Prefix.'_displayed_ids');
if (!$cur_displayed) {
$cur_displayed = Array();
@@ -413,7 +413,7 @@
if (isset($params['page'])) {
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $params['page']);
}
-
+
// $http_query =& $this->Application->recallObject('HTTPQuery');
// $get = $http_query->getRedirectParams();
$pass = Array('pass' => 'all,'.$this->getPrefixSpecial());
@@ -443,7 +443,7 @@
$list =& $this->GetList($tag_params);
$this->Init($list->Prefix, $list->Special);
}*/
-
+
$ret = $tag_params;
$ret['Prefix'] = $this->Prefix;
$ret['Special'] = $this->Special;
@@ -502,9 +502,9 @@
$field = $this->SelectParam($params, 'name,field');
if( !$this->Application->IsAdmin() ) $params['no_special'] = 'no_special';
-
+
$object =& $this->getObject($params);
-
+
if ( $this->HasParam($params, 'db') )
{
$value = $object->GetDBField($field);
@@ -577,19 +577,19 @@
return $value;
}
-
+
function SetField($params)
{
//
-
+
$object =& $this->getObject($params);
$dst_field = $this->SelectParam($params, 'name,field');
-
+
list($prefix_special, $src_field) = explode(':', $params['src']);
$src_object =& $this->Application->recallObject($prefix_special);
$object->SetDBField($dst_field, $src_object->GetDBField($src_field));
}
-
+
/**
* Checks if parameter is passed
* Note: works like Tag and line simple method too
@@ -629,7 +629,7 @@
if ($params['field'] == 'any')
{
$object =& $this->getObject($params);
-
+
$skip_fields = getArrayValue($params, 'except');
$skip_fields = $skip_fields ? explode(',', $skip_fields) : Array();
@@ -653,7 +653,7 @@
{
$field = $params['field'];
$object =& $this->getObject($params);;
-
+
$options = $object->GetFieldOptions($field);
return getArrayValue($options,'required');
}
@@ -662,7 +662,7 @@
{
$field = $params['field'];
$object =& $this->getObject($params);
-
+
$value = $object->GetDBField($field);
$options = $object->GetFieldOptions($field);
if( $this->HasParam($params,'has_empty') )
@@ -718,7 +718,7 @@
$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);
@@ -732,16 +732,16 @@
$object->SetDBField($field, $saved_value);
return $ret;
}
-
+
function Format($params)
{
$field = $params['field'];
$object =& $this->getObject($params);
-
+
$options = $object->GetFieldOptions($field);
$format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ];
-
+
$formatter_class = getArrayValue($options,'formatter');
if($formatter_class)
{
@@ -777,7 +777,7 @@
$prefix_special = $list->getPrefixSpecial();
$total_pages = $list->GetTotalPages();
- if ($total_pages) $this->Application->Parser->DataExists = true;
+ if ($total_pages > 1) $this->Application->Parser->DataExists = true;
if($total_pages == 0) $total_pages = 1; // display 1st page as selected in case if we have no pages at all
$o = '';
@@ -883,9 +883,9 @@
function PaginationBar($params)
{
return $this->PrintPages($params);
- }
-
-
+ }
+
+
/**
* Returns field name (processed by kMultiLanguage formatter
* if required) and item's id from it's IDField or field required
@@ -898,21 +898,21 @@
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
-
+
$formatter_class = getArrayValue($object->Fields, $field, 'formatter');
if ($formatter_class == 'kMultiLanguage')
{
- $formatter =& $this->Application->recallObject($formatter_class);
+ $formatter =& $this->Application->recallObject($formatter_class);
$field = $formatter->LangFieldName($field);
}
-
+
$id_field = getArrayValue($params, 'IdField');
$id = $id_field ? $object->GetDBField($id_field) : $object->GetID();
-
+
return Array($id, $field);
}
-
-
+
+
/**
* Returns input field name to
* be placed on form (for correct
@@ -925,12 +925,12 @@
function InputName($params)
{
list($id, $field) = $this->prepareInputName($params);
-
+
$ret = $this->getPrefixSpecial().'['.$id.']['.$field.']';
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
-
+
/**
* Allows to override various field options through hidden fields with specific names in submit.
* This tag generates this special names
@@ -942,12 +942,12 @@
function FieldModifier($params)
{
list($id, $field) = $this->prepareInputName($params);
-
+
$ret = 'field_modifiers['.$this->getPrefixSpecial().']['.$field.']['.$params['type'].']';
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
-
+
/**
* Returns index where 1st changable sorting field begins
*
@@ -1063,9 +1063,9 @@
{
$object =& $this->getObject($params);
$ids = explode(',', $this->Application->RecallVar($this->getPrefixSpecial().'_selected_ids'));
-
+
$cur_id = $object->GetID();
-
+
$i = array_search($cur_id, $ids);
if ($i !== false) {
return $i < count($ids) - 1 ? $ids[$i + 1] : '';
@@ -1077,9 +1077,9 @@
{
$object =& $this->getObject($params);
$ids = explode(',', $this->Application->RecallVar($this->getPrefixSpecial().'_selected_ids'));
-
+
$cur_id = $object->GetID();
-
+
$i = array_search($cur_id, $ids);
if ($i !== false) {
return $i > 0 ? $ids[$i - 1] : '';
@@ -1119,7 +1119,7 @@
function ItemIcon($params)
{
$object =& $this->getObject($params);
-
+
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$icons =& $grids[ $params['grid'] ]['Icons'];
@@ -1271,12 +1271,12 @@
$object->SetFieldOptions($field, $field_options);
break;
+ case 'text':
case 'textarea':
$params['field_params'] = $helper->ParseConfigSQL($object->GetDBField($params['value_list_field']));
break;
case 'password':
- case 'text':
case 'checkbox':
default:
break;
@@ -1300,7 +1300,7 @@
function CustomFieldLabel($params)
{
$object =& $this->getObject($params);
-
+
$field = $this->SelectParam($params, 'name,field');
$sql = 'SELECT FieldLabel
@@ -1361,7 +1361,7 @@
$temp_tables = $this->Application->GetVar($top_prefix.'_mode') == 't';
$modified = $this->Application->RecallVar($top_prefix.'_modified');
-
+
if ($temp_tables && $modified) {
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,name');
@@ -1395,7 +1395,7 @@
{
$field = $this->SelectParam($params, 'field,name');
$append = getArrayValue($params, 'type') ? '_'.$params['type'] : '';
-
+
return 'custom_filters['.$this->getPrefixSpecial().']['.$field.$append.']';
}
@@ -1421,11 +1421,11 @@
{
$field = $params['field'];
$object =& $this->GetList($params);
-
+
$options = $object->GetFieldOptions($field);
$format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ];
-
+
$formatter_class = getArrayValue($options,'formatter');
if($formatter_class)
{
@@ -1457,15 +1457,15 @@
{
$field = $this->SelectParam($params, 'field,name');
-
-
+
+
$error_var_name = $this->getPrefixSpecial().'_'.$field.'_'.$params['type'].'_error';
$error_msg = $this->Application->RecallVar($error_var_name);
if($error_msg)
{
$this->Application->StoreVar($error_var_name, '');
}
-
+
$object =& $this->Application->recallObject($this->Prefix.'.'.$this->Special.'-item', null, Array('skip_autoload' => true));
return $object->ErrorMsgs[$error_msg];
}
@@ -1487,15 +1487,15 @@
else {
$force_module = strtolower($force_module);
}
-
+
$module_folder = trim( $this->Application->findModule('Name', $force_module, 'Path'), '/');
}
else {
$module_folder = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder');
}
return '../../'.$module_folder.'/admin_templates/';
}
-
+
/**
* Returns object used in tag processor
*
@@ -1507,7 +1507,7 @@
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
return $object;
}
-
+
/**
* Checks if object propery value matches value passed
*
@@ -1520,7 +1520,7 @@
$property_name = $this->SelectParam($params, 'name,var,property');
return $object->$property_name == $params['value'];
}
-
+
/**
* Group list records by header, saves internal order in group
*
@@ -1535,7 +1535,7 @@
$sorted[ $records[$i][$heading_field] ][] = $records[$i];
$i++;
}
-
+
$records = Array();
foreach ($sorted as $heading => $heading_records) {
$records = array_merge_recursive($records, $heading_records);