[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6589] property: prepare for more generic code
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6589] property: prepare for more generic code |
Date: |
Sun, 14 Nov 2010 00:02:02 +0000 |
Revision: 6589
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6589
Author: sigurdne
Date: 2010-11-14 00:02:01 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
property: prepare for more generic code
Modified Paths:
--------------
trunk/property/inc/class.menu.inc.php
trunk/property/inc/class.socategory.inc.php
trunk/property/inc/class.uicategory.inc.php
Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php 2010-11-13 17:15:50 UTC (rev
6588)
+++ trunk/property/inc/class.menu.inc.php 2010-11-14 00:02:01 UTC (rev
6589)
@@ -258,9 +258,19 @@
'text' => lang('District'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'district') )
),
+ 'district' => array
+ (
+ 'text' => lang('District'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'district') )
+ ),
'town' => array
(
'text' => lang('Part of town'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'part_of_town') )
+ ),
+ 'town2' => array
+ (
+ 'text' => lang('Part of town'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uip_of_town.index') )
),
'location' => array
Modified: trunk/property/inc/class.socategory.inc.php
===================================================================
--- trunk/property/inc/class.socategory.inc.php 2010-11-13 17:15:50 UTC (rev
6588)
+++ trunk/property/inc/class.socategory.inc.php 2010-11-14 00:02:01 UTC (rev
6589)
@@ -59,6 +59,30 @@
return $values;
}
+ $valid_order = false;
+ if($order)
+ {
+ if($this->location_info['id']['type'] != $order)
+ {
+ foreach
($$this->location_info['fields'] as $field)
+ {
+ if($field['name'] == $order)
+ {
+ $valid_order = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ $valid_order = true;
+ }
+ if(!$valid_order)
+ {
+ $order = '';
+ }
+ }
+
$uicols = array();
$uicols['input_type'][] = 'text';
$uicols['name'][] =
$this->location_info['id']['name'];
@@ -118,7 +142,7 @@
}
else
{
- $ordermethod = ' ORDER BY id ASC';
+ $ordermethod = " ORDER BY
{$this->location_info['id']['name']} ASC";
}
if($query)
@@ -189,6 +213,54 @@
switch($type)
{
//-------- ID type integer
+ case 'part_of_town':
+ $info = array
+ (
+ 'table'
=> 'fm_part_of_town',
+ 'id'
=> array('name' => 'part_of_town_id', 'type' => 'int', 'descr' => lang('id')),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar',
+ 'nullable'
=> false,
+ 'size'
=> 20
+ ),
+ array
+ (
+ 'name'
=> 'district_id',
+ 'descr'
=> lang('district'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bocategory.get_list',
+
'method_input' => array('type' => 'district', 'selected' => '##district_id##')
+ )
+ ),
+ ),
+ 'edit_msg'
=> lang('edit'),
+ 'add_msg'
=> lang('add'),
+ 'name'
=> lang('part of town'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::location::town',
+/*
+ 'default'
=> array
+ (
+ 'user_id'
=> array('add' => '$this->account'),
+ 'entry_date' =>
array('add' => 'time()'),
+ 'modified_date' =>
array('edit' => 'time()'),
+ ),
+*/
+ 'check_grant' => false
+ );
+
+ break;
+
case 'project_group':
$info = array
(
Modified: trunk/property/inc/class.uicategory.inc.php
===================================================================
--- trunk/property/inc/class.uicategory.inc.php 2010-11-13 17:15:50 UTC (rev
6588)
+++ trunk/property/inc/class.uicategory.inc.php 2010-11-14 00:02:01 UTC (rev
6589)
@@ -57,7 +57,7 @@
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject('property.bocategory',true);
+ $this->bo =
CreateObject('property.bocategory');
$this->bocommon =
CreateObject('property.bocommon');
$this->custom = &
$this->bo->custom;
@@ -107,6 +107,7 @@
$type = phpgw::get_var('type');
$type_id = phpgw::get_var('type_id', 'int');
+
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data',
"general_receipt_{$type}_{$type_id}");
$this->save_sessiondata();
@@ -134,6 +135,7 @@
'type_id' => $type_id
);
+
$datatable['config']['allow_allrows'] = true;
$datatable['actions']['form'] = array
@@ -195,6 +197,75 @@
)
)
);
+
+ $values_combo_box = array();
+ $i = 0;
+ $button_def = array();
+ $code_inner = array();
+ foreach ( $this->location_info['fields'] as
$field )
+ {
+ if (isset($field['filter']) &&
$field['filter'])
+ {
+
$datatable['actions']['form'][0]['fields']['field'][] = array
+ (
+ 'id' =>
"btn_{$field['name']}",
+ 'name' =>
$field['name'],
+ 'value' =>
$field['descr'],
+ 'type' => 'button',
+ 'style' => 'filter',
+ 'tab_index' => $i
+ );
+
+ $button_def[] =
"oMenuButton_{$i}";
+ $code_inner[] = "{order:{$i},
var_URL:'{$field['name']}',name:'btn_{$field['name']}',style:'categorybutton',dependiente:[]}";
+
+
if($field['values_def']['valueset'])
+ {
+ $values_combo_box[] =
$field['values_def']['valueset'];
+ // TODO find selected
value
+ }
+ else
if(isset($field['values_def']['method']))
+ {
+
foreach($field['values_def']['method_input'] as $_argument => $_argument_value)
+ {
+
if(preg_match('/^##/', $_argument_value))
+ {
+
$_argument_value_name = trim($_argument_value,'#');
+
$_argument_value = $values[$_argument_value_name];
+ }
+
$method_input[$_argument] = $_argument_value;
+ }
+
+ $values_combo_box[] =
execMethod($field['values_def']['method'],$method_input);
+ }
+ $default_value = array
('id'=>'','name'=>lang('select value'));
+ array_unshift
($values_combo_box[$i],$default_value);
+ $i++;
+ }
+ }
+ $code = '';
+ if($button_def)
+ {
+ $code = 'var ' . implode(',',
$button_def) . ";\n";
+ $code .= 'var selectsButtons = [' .
"\n" . implode(",\n",$code_inner) . "\n];";
+ $GLOBALS['phpgw']->js->add_code('',
$code);
+ }
+
+
+ if($values_combo_box)
+ {
+ $i = 0;
+ foreach ( $values_combo_box as $combo )
+ {
+
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
+ (
+ 'id' =>
"values_combo_box_{$i}",
+ 'value' =>
$this->bocommon->select2String($combo)
+ );
+ $i++;
+ }
+ }
+
// $dry_run = true;
}
@@ -212,8 +283,8 @@
{
if($uicols['input_type'][$k]!='hidden')
{
-
$datatable['rows']['row'][$j]['column'][$k]['name'] =
$uicols['name'][$k];
-
$datatable['rows']['row'][$j]['column'][$k]['value']
= $category_entry[$uicols['name'][$k]];
+
$datatable['rows']['row'][$j]['column'][$k]['name'] =
$uicols['name'][$k];
+
$datatable['rows']['row'][$j]['column'][$k]['value'] =
$category_entry[$uicols['name'][$k]];
}
}
$j++;
@@ -425,7 +496,7 @@
$type = phpgw::get_var('type');
$type_id = phpgw::get_var('type_id', 'int');
- $id = phpgw::get_var('id');
+ $id =
phpgw::get_var($this->location_info['id']['name']);
$values = phpgw::get_var('values');
$values_attribute = phpgw::get_var('values_attribute');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6589] property: prepare for more generic code,
Sigurd Nes <=