[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6738] property: searchfilter on all custom fields de
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6738] property: searchfilter on all custom fields defined as listbox |
Date: |
Sat, 08 Jan 2011 20:44:09 +0000 |
Revision: 6738
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6738
Author: sigurdne
Date: 2011-01-08 20:44:08 +0000 (Sat, 08 Jan 2011)
Log Message:
-----------
property: searchfilter on all custom fields defined as listbox
Modified Paths:
--------------
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.soentity.inc.php
trunk/property/inc/class.uientity.inc.php
trunk/property/js/yahoo/entity.index.js
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2011-01-07 15:43:22 UTC (rev
6737)
+++ trunk/property/inc/class.boentity.inc.php 2011-01-08 20:44:08 UTC (rev
6738)
@@ -261,6 +261,24 @@
$data['allrows'] = true;
}
+ $custom = createObject('phpgwapi.custom_fields');
+ $attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+
+ $attrib_filter = array();
+ if($attrib_data)
+ {
+ foreach ( $attrib_data as $attrib )
+ {
+ if($attrib['datatype'] == 'LB')
+ {
+ if($_attrib_filter_value =
phpgw::get_var($attrib['column_name'], 'int'))
+ {
+ $attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']} =
'{$_attrib_filter_value}'";
+ }
+ }
+ }
+ }
+
$entity = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'district_id' => $this->district_id,
'lookup'=>isset($data['lookup'])?$data['lookup']:'','allrows'=>isset($data['allrows'])?$data['allrows']:'',
@@ -268,7 +286,7 @@
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),
'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
'dry_run'=>$data['dry_run'],
'type'=>$data['type'], 'location_code' => $this->location_code,
- 'criteria_id' => $this->criteria_id));
+ 'criteria_id' => $this->criteria_id,
'attrib_filter' => $attrib_filter));
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2011-01-07 15:43:22 UTC (rev
6737)
+++ trunk/property/inc/class.soentity.inc.php 2011-01-08 20:44:08 UTC (rev
6738)
@@ -118,6 +118,7 @@
$this->type = isset($data['type']) &&
$data['type'] ? $data['type'] : $this->type;
$location_code = isset($data['location_code']) ?
$data['location_code'] : '';
$criteria_id = isset($data['criteria_id']) ?
$data['criteria_id'] : '';
+ $attrib_filter = $data['attrib_filter'] ?
$data['attrib_filter'] : array();
if(!$entity_id || !$cat_id)
{
@@ -368,6 +369,13 @@
$where= 'AND';
}
+ if ($attrib_filter)
+ {
+ $filtermethod .= " $where " . implode(' AND ',
$attrib_filter);
+ $where= 'AND';
+ }
+
+
$_querymethod = array();
$__querymethod = array();
$_joinmethod_datatype = array();
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2011-01-07 15:43:22 UTC (rev
6737)
+++ trunk/property/inc/class.uientity.inc.php 2011-01-08 20:44:08 UTC (rev
6738)
@@ -368,6 +368,7 @@
// enters the first time
if( phpgw::get_var('phpgw_return_as') != 'json' )
{
+
$datatable['menu']
= $this->bocommon->get_menu($this->type_app[$this->type]);
$datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
@@ -375,12 +376,7 @@
'menuaction'
=> 'property.uientity.index',
'entity_id'
=> $this->entity_id,
'cat_id' =>
$this->cat_id,
- 'type'
=> $this->type,
- //
'district_id' => $this->district_id,
- //
'status' => $this->status,
- //
'filter' => $this->filter,
- //
'location_code' => $this->location_code,
- //
'criteria_id' => $this->criteria_id
+ 'type'
=> $this->type
));
$datatable['config']['allow_allrows'] = true;
@@ -388,11 +384,6 @@
"entity_id:'{$this->entity_id}',".
"cat_id:'{$this->cat_id}',".
"type:'{$this->type}'";
- //
"district_id:'{$this->district_id}',".
- // "status:'{$this->status}',".
- // "filter:'{$this->filter}',".
- //
"criteria_id:'{$this->criteria_id}',".
- //
"location_code:'{$this->location_code}'";
// this array "$arr_filter_hide" indicate what
filters are hidden or not
$arr_filter_hide = array();
@@ -435,12 +426,13 @@
$arr_filter_hide[1] = 1;
}
}
- //// ---- STATUS filter----------------------
- $values_combo_box[2] =
$this->bo->select_status_list($group_filters,$this->status);
+ //// ---- USER filter----------------------
+ $values_combo_box[2] =
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
+
if(count($values_combo_box[2]))
{
- $default_value = array
('id'=>'','name'=>lang('no status'));
+ $default_value = array
('id'=>'','name'=>lang('no user'));
array_unshift
($values_combo_box[2],$default_value);
$arr_filter_hide[2] = 0;
}
@@ -449,24 +441,9 @@
$arr_filter_hide[2] = 1;
}
-
- //// ---- USER filter----------------------
- $values_combo_box[3] =
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
-
- if(count($values_combo_box[3]))
- {
- $default_value = array
('id'=>'','name'=>lang('no user'));
- array_unshift
($values_combo_box[3],$default_value);
- $arr_filter_hide[3] = 0;
- }
- else
- {
- $arr_filter_hide[3] = 1;
- }
-
- $values_combo_box[4] =
$this->bo->get_criteria_list($this->criteria_id);
+ $values_combo_box[3] =
$this->bo->get_criteria_list($this->criteria_id);
$default_value = array
('id'=>'','name'=>lang('no criteria'));
- array_unshift
($values_combo_box[4],$default_value);
+ array_unshift
($values_combo_box[3],$default_value);
$datatable['actions']['form'] = array
(
@@ -478,10 +455,6 @@
'menuaction'
=> 'property.uientity.index',
'entity_id'
=> $this->entity_id,
'cat_id'
=> $this->cat_id,
- //
'district_id' => $this->district_id,
- //
'status' => $this->status,
- //
'filter' => $this->filter,
- //
'query' => $this->query,
'type'
=> $this->type
)),
'fields' => array
@@ -507,22 +480,13 @@
'tab_index' => 2
),
array
- (
//boton STATUS
-
'id' => 'btn_status_id',
-
'name' => 'status_id',
-
'value'=> lang('Status'),
-
'type' => 'button',
-
'style' => 'filter',
-
'tab_index' => 3
- ),
- array
(
//boton USER
'id' => 'btn_user_id',
'name' => 'user_id',
'value'=> lang('User'),
'type' => 'button',
'style' => 'filter',
-
'tab_index' => 4
+
'tab_index' => 3
),
array
(
//boton search criteria
@@ -531,7 +495,7 @@
'value' => lang('search criteria'),
'type' => 'button',
'style' => 'filter',
-
'tab_index' => 5
+
'tab_index' => 4
),
array
(//for
link "columns", next to Export button
@@ -631,14 +595,73 @@
'id' => 'values_combo_box_3',
'value' => $this->bocommon->select2String($values_combo_box[3])
),
- array
- (
-
'id' => 'values_combo_box_4',
-
'value' => $this->bocommon->select2String($values_combo_box[4])
- )
)
)));
+ $custom =
createObject('phpgwapi.custom_fields');
+ $attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+
+ $button_def[] = "oMenuButton_0";
+ $button_def[] = "oMenuButton_1";
+ $button_def[] = "oMenuButton_2";
+ $button_def[] = "oMenuButton_3";
+ $code_inner[] = "{order:0,
var_URL:'cat_id',name:'btn_cat_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:1,
var_URL:'district_id',name:'btn_district_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:2,
var_URL:'filter',name:'btn_user_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:3,
var_URL:'criteria_id',name:'btn_criteria_id',style:'genericbutton',dependiente:[]}";
+
+
+ if($attrib_data)
+ {
+ $i = 4;
+ foreach ( $attrib_data as $attrib )
+ {
+ if($attrib['datatype'] == 'LB')
+ {
+
$datatable['actions']['form'][0]['fields']['field'][] = array
+ (
+ 'id' =>
"btn_{$attrib['column_name']}",
+ 'name' =>
$attrib['column_name'],
+ 'value' =>
$attrib['input_text'],
+ 'type' =>
'button',
+ 'style' =>
'filter',
+ 'tab_index' =>
$i
+ );
+
+ $button_def[] =
"oMenuButton_{$i}";
+ $code_inner[] =
"{order:{$i},
var_URL:'{$attrib['column_name']}',name:'btn_{$attrib['column_name']}',style:'genericbutton',dependiente:[]}";
+
+ $values_combo_box[$i][]
= array
+ (
+ 'id' => '',
+ 'name' =>
$attrib['input_text'],
+ );
+
+
+
foreach($attrib['choice'] as $choice)
+ {
+
$values_combo_box[$i][] = array
+ (
+ 'id'
=> $choice['id'],
+ 'name'
=> htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
+ );
+ }
+
+
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
+ (
+ 'id' =>
"values_combo_box_{$i}",
+ 'value' =>
$this->bocommon->select2String($values_combo_box[$i])
+ );
+ $i++;
+ }
+ }
+ }
+
+ $code = 'var ' . implode(',', $button_def) .
";\n";
+ $code .= 'var selectsButtons = [' . "\n" .
implode(",\n",$code_inner) . "\n];";
+
+ $GLOBALS['phpgw']->js->add_code('', $code);
+
// eliminates those empty filters
$eliminate = 0;
foreach( $arr_filter_hide as $key => $value )
Modified: trunk/property/js/yahoo/entity.index.js
===================================================================
--- trunk/property/js/yahoo/entity.index.js 2011-01-07 15:43:22 UTC (rev
6737)
+++ trunk/property/js/yahoo/entity.index.js 2011-01-08 20:44:08 UTC (rev
6738)
@@ -2,6 +2,7 @@
// Declaration of location.index vars
//--------------------------------------------------------
//define SelectButton
+/*
var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4;
var selectsButtons = [
{order:0, var_URL:'cat_id', name:'btn_cat_id',
style:'categorybutton', dependiente:''},
@@ -10,7 +11,7 @@
{order:3, var_URL:'filter', name:'btn_user_id',
style:'userIdbutton', dependiente:''},
{order:4, var_URL:'criteria_id',
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
]
-
+*/
// define buttons
var oNormalButton_0, oNormalButton_1, oNormalButton_2;
var normalButtons = [
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6738] property: searchfilter on all custom fields defined as listbox,
Sigurd Nes <=