Index: trunk/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r5979 -r6093
--- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5979)
+++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6093)
@@ -91,29 +91,32 @@
$filters = Array();
$prefix_special = $this->getPrefixSpecial();
- foreach($filter_menu['Filters'] as $filter_key => $filter_params)
- {
- if(!$filter_params)
- {
+ foreach ($filter_menu['Filters'] as $filter_key => $filter_params) {
+ $group_params = isset($filter_params['group_id']) ? $filter_menu['Groups'][ $filter_params['group_id'] ] : Array();
+ if (!isset($group_params['element_type'])) {
+ $group_params['element_type'] = 'checkbox';
+ }
+
+ if (!$filter_params) {
$filters[] = $separator;
continue;
}
$block_params['label'] = addslashes( $this->Application->Phrase($filter_params['label']) );
- if( getArrayValue($view_filter,$filter_key) )
- {
+ if (getArrayValue($view_filter,$filter_key)) {
$submit = 0;
- $status = 1;
+ $status = $group_params['element_type'] == 'checkbox' ? 1 : 2;
}
- else
- {
+ else {
$submit = 1;
$status = 0;
}
$block_params['filter_action'] = 'set_filter("'.$prefix_special.'","'.$filter_key.'","'.$submit.'",'.$params['ajax'].');';
- $block_params['filter_status'] = $status;
+ $block_params['filter_status'] = $status; // 1 - checkbox, 2 - radio, 0 - no image
$filters[] = $this->Application->ParseBlock($block_params);
}
+
+
return implode('', $filters);
}
@@ -311,7 +314,7 @@
$block_params['name']=$this->SelectParam($params, 'render_as,block');
$block_params['pass_params']='true';
$block_params['column_width'] = 100 / $columns;
- $block_start_row_params=$this->prepareTagParams($params);
+ $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);
@@ -325,27 +328,39 @@
$backup_id=$this->Application->GetVar($this->Prefix."_id");
$displayed = array();
$column_number = 1;
+
+ $cache_mod_rw = $this->Application->getUnitOption($this->Prefix, 'CacheModRewrite') && $this->Application->RewriteURLs();
+
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
$this->Application->SetVar( $this->Prefix.'_id', $list->GetDBField($id_field) );
+ if ($cache_mod_rw) {
+ $this->Application->setCache('filenames', $this->Prefix.'_'.$list->GetDBField($id_field), $list->GetDBField('Filename'));
+ $this->Application->setCache('filenames', 'c_'.$list->GetDBField('CategoryId'), $list->GetDBField('CategoryFilename'));
+ }
+
if ($i % $columns == 0) {
// record in this iteration is first in row, then open row
$column_number = 1;
- $o.= $block_start_row_params['name'] ? $this->Application->ParseBlock($block_start_row_params, 1) : '
';
+ $o.= $block_start_row_params['name'] ?
+ $this->Application->ParseBlock($block_start_row_params, 1) :
+ (!isset($params['no_table']) ? '
' : '');
}
else {
$column_number++;
}
- $block_params['column_number'] = $column_number;
- $o.= $this->Application->ParseBlock($block_params, 1);
- array_push($displayed, $list->GetDBField($id_field));
+ $block_params['column_number'] = $column_number;
+ $o.= $this->Application->ParseBlock($block_params, 1);
+ array_push($displayed, $list->GetDBField($id_field));
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) : '
';
+ $o.= $block_end_row_params['name'] ?
+ $this->Application->ParseBlock($block_end_row_params, 1) :
+ (!isset($params['no_table']) ? '' : '');
}
$list->GoNext();
@@ -401,8 +416,8 @@
function NotLastItem($params)
{
- $object =& $this->getObject($params); // maybe we should use $this->GetList($params) instead
- return ($object->CurrentIndex < min($object->PerPage, $object->RecordsCount) - 1);
+ $object =& $this->getList($params); // maybe we should use $this->GetList($params) instead
+ return ($object->CurrentIndex < min($object->PerPage == -1 ? $object->RecordsCount : $object->PerPage, $object->RecordsCount) - 1);
}
function PageLink($params)
@@ -416,7 +431,7 @@
// $http_query =& $this->Application->recallObject('HTTPQuery');
// $get = $http_query->getRedirectParams();
- $pass = Array('pass' => 'all,'.$this->getPrefixSpecial());
+ $pass = Array('pass' => 'm,'.$this->getPrefixSpecial());
// $pass = array_merge($get, $pass);
return $this->Application->HREF($t, '', $pass);
@@ -553,9 +568,8 @@
}
}
- if( getArrayValue($params,'nl2br' ) ) $value = nl2br($value);
if( !$this->HasParam($params, 'no_special') ) $value = htmlspecialchars($value);
- if( getArrayValue($params,'checked' ) ) $value = ($value == 1) ? 'checked' : '';
+ if( getArrayValue($params,'checked' ) ) $value = ($value == ( isset($params['value']) ? $params['value'] : 1)) ? 'checked' : '';
if( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value);
$first_chars = $this->SelectParam($params,'first_chars,cut_first');
@@ -565,6 +579,7 @@
$value = substr($value,0,$first_chars);
if($needs_cut) $value .= ' ...';
}
+ if( getArrayValue($params,'nl2br' ) ) $value = nl2br($value);
if ($value != '') $this->Application->Parser->DataExists = true;
@@ -617,7 +632,7 @@
function Error($params)
{
- $field = $params['field'];
+ $field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
$msg = $object->GetErrorMsg($field, false);
return $msg;
@@ -734,7 +749,7 @@
function Format($params)
{
- $field = $params['field'];
+ $field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
$options = $object->GetFieldOptions($field);
@@ -1180,7 +1195,7 @@
$tag_params = array_merge_recursive2($params, $tag_params);
$objects[ $prefix_data['prefix_special'] ] =& $this->Application->recallObject($prefix_data['prefix_special'], $prefix_data['prefix'], $tag_params);
- $object_status[ $prefix_data['prefix_special'] ] = $objects[ $prefix_data['prefix_special'] ]->GetID() ? 'edit' : 'new';
+ $object_status[ $prefix_data['prefix_special'] ] = $objects[ $prefix_data['prefix_special'] ]->IsNewItem() ? 'new' : 'edit';
// a. set object's status field (adding item/editing item) for each object in title
if( getArrayValue($title_info[ $object_status[ $prefix_data['prefix_special'] ].'_status_labels' ],$prefix_data['prefix_special']) )
@@ -1456,8 +1471,6 @@
{
$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)
@@ -1541,7 +1554,11 @@
}
}
-
+ function DisplayOriginal($params)
+ {
+ return false;
+ }
+
function MultipleEditing($params)
{
$selected_ids = $this->Application->RecallVar($this->getPrefixSpecial().'_selected_ids');