[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6552] Property: More on roles
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6552] Property: More on roles |
Date: |
Mon, 08 Nov 2010 14:21:49 +0000 |
Revision: 6552
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6552
Author: sigurdne
Date: 2010-11-08 14:21:48 +0000 (Mon, 08 Nov 2010)
Log Message:
-----------
Property: More on roles
Modified Paths:
--------------
trunk/property/inc/class.socategory.inc.php
trunk/property/inc/class.solocation.inc.php
trunk/property/inc/class.uilocation.inc.php
trunk/property/js/yahoo/location.responsiblility_role.js
Modified: trunk/property/inc/class.socategory.inc.php
===================================================================
--- trunk/property/inc/class.socategory.inc.php 2010-11-08 11:59:24 UTC (rev
6551)
+++ trunk/property/inc/class.socategory.inc.php 2010-11-08 14:21:48 UTC (rev
6552)
@@ -144,6 +144,7 @@
}
$sql = "SELECT * FROM $table $filtermethod
$querymethod";
+
$this->_db->query($sql,__LINE__,__FILE__);
$this->total_records = $this->_db->num_rows();
@@ -1211,7 +1212,20 @@
return $values;
}
- $order = isset($data['order']) &&
$data['order'] == 'id' ? 'id' :'descr';
+ $filtermthod = '';
+ if (isset($data['filter']) && is_array($data['filter']))
+ {
+ $_filter = array();
+ foreach ($data['filter'] as $_field => $_value)
+ {
+ $_filter[] = "{$_field} = '{$_value}'";
+ }
+ if($_filter)
+ {
+ $filtermthod = 'WHERE ' . implode(' AND
', $_filter);
+ }
+ }
+ $order = isset($data['order']) &&
$data['order'] ? $data['order'] :'descr';
foreach ($this->location_info['fields'] as $field)
{
@@ -1230,13 +1244,16 @@
$fields = implode(',', $fields);
- $this->_db->query("SELECT id, {$fields} FROM {$table}
ORDER BY {$order}");
+ $this->_db->query("SELECT id, {$fields} FROM {$table}
{$filtermthod} ORDER BY {$order}");
while ($this->_db->next_record())
{
$_extra = $this->_db->f($id_in_name);
$id = $this->_db->f('id');
- $name = $this->_db->f('descr', true);
+ if(!$name = $this->_db->f('name', true))
+ {
+ $name = $this->_db->f('descr', true);
+ }
if($_extra)
{
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2010-11-08 11:59:24 UTC (rev
6551)
+++ trunk/property/inc/class.solocation.inc.php 2010-11-08 14:21:48 UTC (rev
6552)
@@ -293,6 +293,7 @@
$uicols['exchange'][] = false;
$uicols['align'][] = '';
$uicols['datatype'][] = '';
+ $uicols['formatter'][] = '';
for ($i=0; $i<($type_id); $i++)
{
@@ -303,6 +304,7 @@
$uicols['exchange'][] = true;
$uicols['align'][]
= 'center';
$uicols['datatype'][] =
'link';
+ $uicols['formatter'][] = '';
$cols
.= ",fm_location" . ($type_id) .".loc" . $location_types[$i]['id'];
$cols_return[]
= 'loc' . $location_types[$i]['id'];
}
@@ -324,6 +326,7 @@
$uicols['exchange'][]
= true;
$uicols['align'][]
= 'left';
$uicols['datatype'][]
= 'V';
+ $uicols['formatter'][]
= '';
}
}
@@ -362,6 +365,7 @@
$uicols['exchange'][] = true;
$uicols['align'][]
= '';
$uicols['datatype'][] = '';
+ $uicols['formatter'][] = '';
$cols.= ',fm_tenant.last_name';
$cols_return[]
= 'last_name';
@@ -373,6 +377,7 @@
$uicols['exchange'][] = true;
$uicols['align'][]
= 'left';
$uicols['datatype'][] = 'V';
+ $uicols['formatter'][] = '';
$cols.= ',fm_tenant.first_name';
$cols_return[]
= 'first_name';
@@ -384,6 +389,7 @@
$uicols['exchange'][] = true;
$uicols['align'][]
= 'left';
$uicols['datatype'][] = 'V';
+ $uicols['formatter'][] = '';
$cols.= ',fm_tenant.contact_phone';
$cols_return[]
= 'contact_phone';
@@ -395,6 +401,7 @@
$uicols['exchange'][] = true;
$uicols['align'][]
= 'left';
$uicols['datatype'][] = 'V';
+ $uicols['formatter'][] = '';
$sub_query_tenant=1;
$this->socommon->fm_cache('sub_query_tenant_'. $type_id . '_' . $lookup_tenant
. '_' . $lookup,$sub_query_tenant);
@@ -436,6 +443,7 @@
$uicols['exchange'][] = true;
$uicols['align'][] = 'left';
$uicols['datatype'][] = 'V';
+
$uicols['formatter'][] = '';
$cols.=
',street_number';
$cols_return[]
= 'street_number';
@@ -446,6 +454,7 @@
$uicols['exchange'][] = true;
$uicols['align'][] = 'left';
$uicols['datatype'][] = 'V';
+
$uicols['formatter'][] = '';
$cols.=
',fm_location' . $config[$i]['location_type'] . '.' .
$config[$i]['column_name'];
$cols_return[]
= $config[$i]['column_name'];
@@ -456,6 +465,7 @@
$uicols['exchange'][] = true;
$uicols['align'][] = '';
$uicols['datatype'][] = '';
+
$uicols['formatter'][] = '';
}
}
else
@@ -468,6 +478,8 @@
$uicols['statustext'][]
= $config[$i]['input_text'];
$uicols['exchange'][]
= true;
$uicols['align'][]
= '';
+ $uicols['datatype'][]
= '';
+ $uicols['formatter'][]
= '';
}
}
}
@@ -535,6 +547,7 @@
$uicols['descr'][]
= $this->db->f('input_text');
$uicols['statustext'][] =
$this->db->f('statustext');
$uicols['datatype'][$i] =
$this->db->f('datatype');
+ $uicols['formatter'][] = '';
$uicols['exchange'][] =
$exchange;
$uicols['cols_return_extra'][$i] = array
(
@@ -568,6 +581,7 @@
$uicols['descr'][]
= $this->db->f('input_text') . ' ' . lang('name');
$uicols['statustext'][]
= '';
$uicols['datatype'][$i]
= 'V';
+ $uicols['formatter'][]
= '';
$uicols['exchange'][]
= false;
$uicols['align'][]
= 'right';
$uicols['cols_return_extra'][$i] = array();
Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2010-11-08 11:59:24 UTC (rev
6551)
+++ trunk/property/inc/class.uilocation.inc.php 2010-11-08 14:21:48 UTC (rev
6552)
@@ -863,6 +863,7 @@
else
{
$datatable['pagination']['records_returned']=
count($location_list);
+
}
$datatable['pagination']['records_total'] =
$this->bo->total_records;
@@ -1009,16 +1010,9 @@
function responsiblility_role()
{
- $GLOBALS['phpgw_info']['flags']['noframework'] = true;
- $GLOBALS['phpgw_info']['flags']['headonly']=true;
- $type_id = $this->type_id;
- // $lookup use for pop-up
- $lookup = $this->lookup;
- // $lookup_name use in pop-up option "project"
- $lookup_name = phpgw::get_var('lookup_name');
- // use in option menu TENANT
- $lookup_tenant = phpgw::get_var('lookup_tenant',
'bool');
- $block_query = phpgw::get_var('block_query', 'bool');
+
+ $type_id = phpgw::get_var('type_id', 'int');
+
$dry_run=false;
if(!$type_id)
@@ -1026,7 +1020,43 @@
$type_id = 1;
}
+ if ( $type_id && !$lookup_tenant )
+ {
+
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
+ }
+ else
+ {
+
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
+ }
+ if (!$this->acl_read)
+ {
+ $this->bocommon->no_access();
+ return;
+ }
+
+ $values = phpgw::get_var('values');
+
+ $receipt = array();
+ if($values && $this->acl_edit)
+ {
+_debug_array($values);
+ $receipt = $this->bo->update_roles($values);
+ }
+
+
+ $second_display = phpgw::get_var('second_display',
'bool');
+ $default_district =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+
+ if ($default_district && !$second_display &&
!$this->district_id)
+ {
+ $this->bo->district_id = $default_district;
+ $this->district_id =
$default_district;
+ }
+
+ $datatable = array();
+ $values_combo_box = array();
+
if( phpgw::get_var('phpgw_return_as') != 'json' )
{
@@ -1061,7 +1091,7 @@
."block_query:'{$block_query}'";
- $values_combo_box[0] =
execMethod('property.soadmin_location.read');
+ $values_combo_box[0] =
execMethod('property.soadmin_location.read',array());
$values_combo_box[1] =
$this->bocommon->select_category_list(array('format'=>'filter',
'selected' => $this->cat_id,
@@ -1069,6 +1099,7 @@
'type_id' =>$type_id,
'order'=>'descr'));
+
$default_value = array
('id'=>'','name'=>lang('no category'));
array_unshift
($values_combo_box[1],$default_value);
@@ -1086,6 +1117,34 @@
array_unshift
($values_combo_box[4],$default_value);
+
+ $_role_criteria = array
+ (
+ 'allrows' => true,
+ 'order' => 'name'
+ );
+
+ $_role = CreateObject('property.socategory');
+
+
$_role->get_location_info('responsibility_role','');
+
+ $roles = $_role->read($_role_criteria);
+ foreach ($roles as $role)
+ {
+
if(ctype_digit(ltrim($role['location'],'.location')))
+ {
+ $values_combo_box[5][] = array
+ (
+ 'id' =>
$role['id'],
+ 'name' =>
$role['name'],
+ 'type_id' =>
ltrim($role['location'],'.location')
+ );
+ }
+ }
+
+ $default_value = array
('id'=>'','name'=>lang('no role'));
+ array_unshift
($values_combo_box[5],$default_value);
+
$datatable['actions']['form'] = array(
array(
'action' =>
$GLOBALS['phpgw']->link('/index.php',
@@ -1132,7 +1191,7 @@
'style' => 'filter',
'tab_index' => 4
),
- array( //boton
PART OF TOWN
+ array( //boton
contact
'id' => 'btn_contact_id',
'name' => 'contact_id',
'value' => lang('user'),
@@ -1140,12 +1199,27 @@
'style' => 'filter',
'tab_index' => 5
),
+ array( //boton
role
+
'id' => 'btn_role_id',
+
'name' => 'role_id',
+
'value' => lang('role'),
+
'type' => 'button',
+
'style' => 'filter',
+
'tab_index' => 6
+ ),
+
array( // boton SAVE
+
'id' => 'btn_save',
+
//'name' => 'save',
+
'value' => lang('save'),
+
'tab_index' => 7,
+
'type' => 'button'
+
),
array( //boton SEARCH
'id' => 'btn_search',
'name' => 'search',
'value' => lang('search'),
'type' => 'button',
-
'tab_index' => 6
+
'tab_index' => 8
),
array( // TEXT IMPUT
'name' => 'query',
@@ -1177,87 +1251,292 @@
array( //div values combo_box_4
'id' =>
'values_combo_box_4',
'value' =>
$this->bocommon->select2String($values_combo_box[4]) //i.e. id,value/id,vale/
+
),
+
array( //div values combo_box_5
+
'id' =>
'values_combo_box_5',
+
'value' =>
$this->bocommon->select2String($values_combo_box[5]) //i.e. id,value/id,vale/
)
)
)
)
);
+
+ $dry_run=true;
+
}
- $input_name = array();
+ $location_list = array();
- $entity_list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
+ $location_list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
$uicols = $this->bo->uicols;
- if (count($uicols['name']) > 0)
- {
- for ($m = 0; $m<count($input_name); $m++)
- {
- if
(!array_search($input_name[$m],$uicols['name']))
- {
- $uicols['name'][] =
$input_name[$m];
- $uicols['descr'][] = '';
- $uicols['input_type'][]
= 'hidden';
- }
- }
- }
- else
- {
+ $uicols['name'][] = 'select';
+ $uicols['descr'][] = lang('select');
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = 'myFormatterCheck';
+ $uicols['input_type'][] = '';
- $uicols['name'][] =
'location_code';
- $uicols['descr'][] = 'location
code';
- $uicols['input_type'][] =
'text';
- }
-
$content = array();
$j=0;
- if (isset($entity_list) && is_array($entity_list))
+ if (isset($location_list) && is_array($location_list))
{
- foreach($entity_list as $entity_entry)
+ foreach($location_list as $location)
{
for
($i=0;$i<count($uicols['name']);$i++)
{
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
($entity_entry[$uicols['name'][$i]] == null ? '' :
$entity_entry[$uicols['name'][$i]]);
-
$datatable['rows']['row'][$j]['column'][$i]['name'] = $uicols['name'][$i];
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
if(isset($location['query_location'][$uicols['name'][$i]]))
+ {
+
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
+
$datatable['rows']['row'][$j]['column'][$i]['statustext'] =
lang('search');
+
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$location[$uicols['name'][$i]];
+
$datatable['rows']['row'][$j]['column'][$i]['format'] =
'link';
+
$datatable['rows']['row'][$j]['column'][$i]['java_link'] = true;
+
$datatable['rows']['row'][$j]['column'][$i]['link']
= $location['query_location'][$uicols['name'][$i]];
+ }
+ else
+ {
+
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$location[$uicols['name'][$i]];
+
//$datatable['rows']['row'][$j]['column'][$i]['value'] = $i;
- if(isset($uicols['datatype'])
&& isset($uicols['datatype'][$i]) && $uicols['datatype'][$i]=='link' &&
$entity_entry[$uicols['name'][$i]])
+
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
+
$datatable['rows']['row'][$j]['column'][$i]['lookup'] =
$lookup;
+
$datatable['rows']['row'][$j]['column'][$i]['align'] =
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) &&
$uicols['datatype'][$i]=='link' && $location[$uicols['name'][$i]])
+ {
+
$datatable['rows']['row'][$j]['column'][$i]['format'] =
'link';
+
$datatable['rows']['row'][$j]['column'][$i]['value'] = lang('link');
+
$datatable['rows']['row'][$j]['column'][$i]['link'] =
$location[$uicols['name'][$i]];
+
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
+ }
+ }
+ }
+ else
{
-
$datatable['rows']['row'][$j]['column'][$i]['format'] = 'link';
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = lang('link');
-
$datatable['rows']['row'][$j]['column'][$i]['link'] =
$entity_entry[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
+
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
+
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$location[$uicols['name'][$i]];
}
+
+
$datatable['rows']['row'][$j]['hidden'][$i]['value'] =
$location[$uicols['name'][$i]];
+
$datatable['rows']['row'][$j]['hidden'][$i]['name'] =
$uicols['name'][$i];
}
- /*for ($i=0;$i<count($input_name);$i++)
- {
-
$datatable['rows']['row'][$j]['hidden'][$i]['value'] =
$entity_entry[$input_name[$i]];
-
$datatable['rows']['row'][$j]['hidden'][$i]['name'] = $input_name[$i];
- }*/
$j++;
}
}
+ // NO pop-up
+ $datatable['rowactions']['action'] = array();
+ if(!$lookup)
+ {
+ $parameters = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' =>
'location_code',
+ 'source' =>
'location_code'
+ ),
+ )
+ );
+ $parameters2 = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' =>
'sibling',
+ 'source' =>
'location_code'
+ ),
+ )
+ );
+
+ $parameters3 = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' =>
'search_for',
+ 'source' =>
'location_code'
+ ),
+ )
+ );
+
+ if($this->acl->check('run', PHPGW_ACL_READ,
'rental'))
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'view',
+ 'text'
=> lang('contracts'),
+ 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'rental.uicontract.index',
+
'search_type' => 'location_id',
+
'contract_status' => 'all',
+
'populate_form' => 'yes'
+
)),
+ 'parameters' => $parameters3
+ );
+ }
+
+ if($this->acl_read)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name' =>
'view',
+ 'text' =>
lang('view'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.view',
+
'lookup_tenant' => $lookup_tenant
+
)),
+ 'parameters' => $parameters
+ );
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name' =>
'view',
+ 'text' =>
lang('open view in new window'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.view',
+
'lookup_tenant' => $lookup_tenant,
+
'target' => '_blank'
+
)),
+ 'parameters' => $parameters
+ );
+ }
+ if($this->acl_add)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'edit',
+ 'text' =>
lang('add'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.edit',
+
'lookup_tenant' => $lookup_tenant
+
)),
+ 'parameters' => $parameters2
+ );
+ }
+ if($this->acl_edit)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'edit',
+ 'text' =>
lang('edit'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.edit',
+
'lookup_tenant' => $lookup_tenant
+
)),
+ 'parameters' => $parameters
+ );
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'edit',
+ 'text' =>
lang('open edit in new window'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.edit',
+
'lookup_tenant' => $lookup_tenant,
+
'target' => '_blank'
+
)),
+ 'parameters' => $parameters
+ );
+
+ }
+ $jasper = execMethod('property.sojasper.read',
array('location_id' => $GLOBALS['phpgw']->locations->get_id('property',
$this->acl_location)));
+
+ foreach ($jasper as $report)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'edit',
+ 'text'
=> lang('open JasperReport %1 in new window', $report['title']),
+ 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' =>
'property.uijasper.view',
+
'jasper_id'
=> $report['id'],
+
'target'
=> '_blank'
+
)),
+ 'parameters'
=> $parameters
+ );
+ }
+
+
+ if($integrationurl)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'integration',
+ 'text'
=> $integration_name,
+ 'action'
=> $integrationurl.'&target=_blank',
+ 'parameters' =>
$parameters_integration
+ );
+ }
+
+ if($this->acl_delete)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name' =>
'delete',
+ 'text' =>
lang('delete'),
+ 'confirm_msg' => lang('do you
really want to delete this entry'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.delete',
+
'lookup_tenant' => $lookup_tenant
+
)),
+ 'parameters' => $parameters
+ );
+ }
+ if($this->acl_add)
+ {
+ $datatable['rowactions']['action'][] =
array(
+ 'my_name'
=> 'add',
+ 'text'
=> lang('add'),
+ 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
+
(
+
'menuaction' => 'property.uilocation.edit',
+
'type_id' => $type_id,
+
'parent' => $this->location_code
+
))
+ );
+ }
+
+ unset($parameters);
+ }
+ //$uicols_count indicates the number of columns to
display in actuall option-menu. this variable was set in $this->bo->read()
$uicols_count = count($uicols['descr']);
- $datatable['rowactions']['action'] = array();
+
for ($i=0;$i<$uicols_count;$i++)
{
//all colums should be have formatter
-
$datatable['headers']['header'][$i]['formatter'] =
($uicols['formatter'][$i]==''? '""' : $uicols['formatter'][$i]);
+
$datatable['headers']['header'][$i]['formatter'] =
!isset($uicols['formatter'][$i]) || !$uicols['formatter'][$i] ? '""' :
$uicols['formatter'][$i];
if($uicols['input_type'][$i]!='hidden')
{
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
$datatable['headers']['header'][$i]['visible'] = true;
+
$datatable['headers']['header'][$i]['format'] =
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
$datatable['headers']['header'][$i]['sortable'] = false;
-
- if($uicols['name'][$i]=='loc1' ||
$uicols['name'][$i]=='num')
+
//$datatable['headers']['header'][$i]['formatter'] =
(isset($uicols['formatter'][$i])? $uicols['formatter'][$i]:"");
+ if($uicols['name'][$i]=='loc1'):
{
$datatable['headers']['header'][$i]['sortable'] = true;
+
$datatable['headers']['header'][$i]['sort_field'] = 'fm_location1.loc1';
+ }
+
elseif($uicols['name'][$i]=='street_name'):
+ {
+
$datatable['headers']['header'][$i]['sortable'] = true;
+
$datatable['headers']['header'][$i]['sort_field'] = 'street_name';
+ }
+
elseif(isset($uicols['cols_return_extra'][$i]) &&
($uicols['cols_return_extra'][$i]!='T' ||
$uicols['cols_return_extra'][$i]!='CH')):
+ {
+
$datatable['headers']['header'][$i]['sortable'] = true;
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
}
+ endif;
}
else
{
@@ -1269,36 +1548,28 @@
}
}
- $function_exchange_values = '';
+ // path for property.js
+ $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
- for ($i=0;$i<count($input_name);$i++)
+ // Pagination and sort values
+ $datatable['pagination']['records_start'] =
(int)$this->bo->start;
+ $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+
+ if($dry_run)
{
- $function_exchange_values .=
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = "";'
."\r\n";
+
$datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
-
- for ($i=0;$i<count($input_name);$i++)
+ else
{
- $function_exchange_values .=
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value =
data.getData("'.$input_name[$i].'");' ."\r\n";
+ $datatable['pagination']['records_returned']=
count($location_list);
}
- $function_exchange_values .= 'window.close()';
+ $datatable['pagination']['records_total'] =
$this->bo->total_records;
- $datatable['exchange_values'] =
$function_exchange_values;
- $datatable['valida'] = '';
-
- // path for property.js
- $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
-
- // Pagination and sort values
- $datatable['pagination']['records_start'] =
(int)$this->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $datatable['pagination']['records_returned']=
count($entity_list);
- $datatable['pagination']['records_total'] =
$boentity->total_records;
-
if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
{
- $datatable['sorting']['order']
= 'num'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'desc'; // ASC / DESC
+ $datatable['sorting']['order']
= 'loc1'; // name key Column in myColumnDef
+ $datatable['sorting']['sort']
= 'asc'; // ASC / DESC
}
else
{
@@ -1306,6 +1577,10 @@
$datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
}
+ $appname = lang('location');
+
+ $function_msg =
lang('role');
+
//-- BEGIN----------------------------- JSON CODE
------------------------------
//values for Pagination
@@ -1318,9 +1593,10 @@
'dir' =>
$datatable['sorting']['sort'],
'records' =>
array(),
'headers' =>
$uicols
-
);
+ $json['integrationurl'] = $integrationurl;
+
// values for datatable
if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
foreach( $datatable['rows']['row'] as $row )
@@ -1328,7 +1604,7 @@
$json_row = array();
foreach( $row['column'] as $column)
{
- if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
+ if(isset($column['format']) &&
$column['format']== "link" && isset($column['java_link']) &&
$column['java_link']==true)
{
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
}
@@ -1345,28 +1621,67 @@
}
}
+ // values for control select
+ //address@hidden 10/09/08 values passed for
update select in YUI
+ $opt_cb_depend =
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+ $default_value = array ('id'=>'','name'=>'!no
part of town');
+ array_unshift ($opt_cb_depend,$default_value);
+
+ $json['hidden']['dependent'][] = array ( 'id'
=> $this->part_of_town_id,
+ 'value' =>
$this->bocommon->select2String($opt_cb_depend)
+
);
+
+ $_role_criteria = array
+ (
+ 'type' => 'responsibility_role',
+ 'filter' => array('location' =>
".location.{$type_id}"),
+ 'order' => 'name'
+ );
+
+ $_roles =
execMethod('property.socategory.get_list',$_role_criteria);
+ $default_value = array
('id'=>'','name'=>lang('no role'));
+ array_unshift ($_roles,$default_value);
+
+ $json['hidden']['dependent'][] = array ( 'id'
=> $type_id,
+ 'value' =>
$this->bocommon->select2String($_roles)
+
);
+
// right in datatable
if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
{
$json ['rights'] =
$datatable['rowactions']['action'];
}
+ if(isset($receipt) && is_array($receipt) &&
count($receipt))
+ {
+ $json['message'][] = $receipt;
+ }
+
if( phpgw::get_var('phpgw_return_as') == 'json'
)
{
return $json;
}
+
$datatable['json_data'] = json_encode($json);
//-------------------- JSON CODE ----------------------
- phpgwapi_yui::load_widget('tabview');
+ // Prepare template variables and process XSLT
+ $template_vars = array();
+ $template_vars['datatable'] = $datatable;
+
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
phpgwapi_yui::load_widget('dragdrop');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('menu');
phpgwapi_yui::load_widget('connection');
+ //// cramirez: necesary for include a partucular js
phpgwapi_yui::load_widget('loader');
+ //cramirez: necesary for use opener . Avoid error JS
phpgwapi_yui::load_widget('tabview');
phpgwapi_yui::load_widget('paginator');
+ //FIXME this one is only needed when $lookup==true - so
there is probably an error
phpgwapi_yui::load_widget('animation');
if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
@@ -1381,33 +1696,15 @@
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
- // Prepare template variables and process XSLT
- $template_vars = array();
- $template_vars['datatable'] = $datatable;
-
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
-
- if($this->entity_id)
- {
- $entity =
$boadmin_entity->read_single($this->entity_id,false);
- $appname = $entity['name'];
- }
- if($this->cat_id)
- {
- $category =
$boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $function_msg
= lang('lookup') . ' ' . $category['name'];
- }
-
//Title of Page
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . '::' . $appname . '::' . $function_msg;
// Prepare YUI Library
-// $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'lookup.entity.index', 'property' );
$GLOBALS['phpgw']->js->validate_file( 'yahoo',
'location.responsiblility_role', 'property' );
- $this->save_sessiondata();
- }
+ //$this->save_sessiondata();
+ }
function edit($view = '')
Modified: trunk/property/js/yahoo/location.responsiblility_role.js
===================================================================
--- trunk/property/js/yahoo/location.responsiblility_role.js 2010-11-08
11:59:24 UTC (rev 6551)
+++ trunk/property/js/yahoo/location.responsiblility_role.js 2010-11-08
14:21:48 UTC (rev 6552)
@@ -2,13 +2,14 @@
// Declaration of event.index vars
//--------------------------------------------------------
//define SelectButton
- var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4;
+ var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4, oMenuButton_5;
var selectsButtons = [
- {order:0, var_URL:'type_id', name:'btn_type_id',
style:'categorybutton', dependiente:[]},
+ {order:0, var_URL:'type_id', name:'btn_type_id',
style:'typebutton', dependiente:[3,5]},
{order:1, var_URL:'cat_id', name:'btn_cat_id',
style:'categorybutton', dependiente:[]},
- {order:2, var_URL:'district_id', name:'btn_district_id',
style:'districtbutton', dependiente:[3]},
+ {order:2, var_URL:'district_id', name:'btn_district_id',
style:'districtbutton', dependiente:[3,5]},
{order:3,
var_URL:'part_of_town_id',name:'btn_part_of_town_id',style:'partOFTownbutton',dependiente:[]},
- {order:4, var_URL:'contact_id', name:'btn_contact_id',
style:'userIdbutton', dependiente:[]}
+ {order:4, var_URL:'contact_id', name:'btn_contact_id',
style:'userIdbutton', dependiente:[]},
+ {order:5, var_URL:'role_id', name:'btn_role_id',
style:'roleIdbutton', dependiente:[]}
];
// define buttons
@@ -16,7 +17,6 @@
var normalButtons = [
{order:0, name:'btn_search', funct:"onSearchClick"},
{order:1, name:'btn_save', funct:"onSave"}
-// {order:2, name:'btn_export', funct:"onDownloadClick"}
];
// define Text buttons
@@ -37,7 +37,7 @@
var config_values =
{
- date_search : 1 //if search has link "Data search"
+ date_search : 0 //if search has link "Data search"
}
var tableYUI;
@@ -141,14 +141,31 @@
}
else if(flag_particular_setting=='update')
{
-// path_values.currentPage = '';
-// path_values.start = '';
-// path_values.allrows = 0;
+ myColumnDefs = [];
+ for(var k=0 ; k<values_ds.headers.name.length; k++)
+ {
+ if (values_ds.headers.input_type[k] == 'hidden')
+ {
+ var obj_temp = {key: values_ds.headers.name[k],
label: values_ds.headers.descr[k], visible: false, resizeable:true,
sortable: false, source: ""};
+ }
+ else
+ {
+ if (values_ds.headers.name[k] == 'num')
+ {
+ var obj_temp = {key:
values_ds.headers.name[k], label: values_ds.headers.descr[k], visible: true,
resizeable:true, sortable: true, source: "num"};
+ }
+ else
+ {
+ var obj_temp = {key:
values_ds.headers.name[k], label: values_ds.headers.descr[k], visible: true,
resizeable:true, sortable: false, source: ""};
+ }
+ }
+ myColumnDefs.push(obj_temp);
+ }
+ init_datatable();
}
}
-
/****************************************************************************************/
this.Exchange_values = function()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6552] Property: More on roles,
Sigurd Nes <=