[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.uitenant.php, 1.1.1.10
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.uitenant.php, 1.1.1.10 |
Date: |
Tue, 18 May 2004 08:19:43 +0200 |
Update of /property
Modified Files:
Branch:
class.uitenant.php
date: 2004/05/18 06:19:43; author: sigurdne; state: Exp; lines: +555 -89
Log Message:
no message
=====================================================================
Index: property/class.uitenant.php
diff -u property/class.uitenant.php:1.1.1.9 property/class.uitenant.php:1.1.1.10
--- property/class.uitenant.php:1.1.1.9 Fri Apr 30 17:35:58 2004
+++ property/class.uitenant.php Tue May 18 06:19:43 2004
@@ -31,7 +31,9 @@
'index' => True,
'view' => True,
'edit' => True,
- 'delete' => True
+ 'delete' => True,
+ 'list_attribute' => True,
+ 'edit_attrib' => True
);
function property_uitenant()
@@ -43,9 +45,17 @@
$this->bo =
CreateObject($this->currentapp.'_botenant',True);
$this->bocommon =
CreateObject($this->currentapp.'_bocommon');
$this->menu =
CreateObject($this->currentapp.'_menu');
- $this->menu->sub ='admin';
+
$this->fm_session =
CreateObject($this->currentapp.'_session');
+ $this->acl2 =
CreateObject($this->currentapp.'_acl2');
+ $this->acl2_location = '.tenant';
+
+ $this->acl_read =
$this->acl2->check($this->acl2_location,1);
+ $this->acl_add =
$this->acl2->check($this->acl2_location,2);
+ $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
+ $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
+
$this->start = $this->bo->start;
$this->query = $this->bo->query;
$this->sort = $this->bo->sort;
@@ -70,8 +80,56 @@
$this->bo->save_sessiondata($data);
}
+
+ function columns()
+ {
+
+ $this->bocommon->xsl_add_file(array('columns'));
+
+ $GLOBALS['phpgw_info']['flags']['headonly']=true;
+
+ $values =
$this->bocommon->get_var2('values',array('POST','GET'));
+
+ if ($values['save'])
+ {
+ $GLOBALS['phpgw']->prefs->set($this->currentapp
. '.tenant_columns',serialize($values['columns']),$this->account);
+ $receipt['message'][] = array('msg' =>
lang('columns is updated'));
+ }
+
+ $function_msg = lang('Select Column');
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitenant.columns'
+ );
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ //'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
+ 'function_msg' => $function_msg,
+ 'form_action' =>
$this->bocommon->link('/index.php',$link_data),
+ 'lang_columns' => lang('columns'),
+ 'lang_none' => lang('None'),
+ 'lang_save' => lang('save'),
+ 'select_name' => 'period'
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
+ return array('columns' => $data);
+ }
+
function index()
{
+ $this->menu->sub ='tenant';
+ if(!$this->acl_read)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
$this->bocommon->xsl_add_file(array('tenant',
'menu',
'receipt',
@@ -81,87 +139,109 @@
$links = $this->menu->links();
$receipt =
$this->fm_session->appsession('session_data','tenant_receipt');
-
$this->fm_session->appsession('session_data','tenant_receipt','');
+
$this->fm_session->appsession('session_data','tenant_receipt','x');
$tenants_list = $this->bo->read();
- while (is_array($tenants_list) && list(,$tenant) =
each($tenants_list))
+ $uicols = $this->bo->uicols;
+
+//html_print_r($tenants_list);
+ $j=0;
+
+ if (isset($tenants_list) AND is_array($tenants_list))
{
- $content[] = array
- (
- 'tenant_id'
=> $tenant['tenant_id'],
- 'name'
=> $tenant['name'],
- 'entry_date'
=> $tenant['entry_date'],
- 'category'
=> $tenant['category'],
- 'link_view'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.view&tenant_id='
. $tenant['tenant_id']),
- 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit&tenant_id='
. $tenant['tenant_id']),
- 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
. $tenant['tenant_id']),
- 'lang_view_statustext' =>
lang('view the tenant'),
- 'lang_edit_statustext' =>
lang('edit the tenant'),
- 'lang_delete_statustext' =>
lang('delete the tenant'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
+ foreach($tenants_list as $tenant_entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$tenant_entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.view&tenant_id='
. $tenant_entry['tenant_id']);
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
tenant');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit&tenant_id='
. $tenant_entry['tenant_id']);
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
tenant');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
. $tenant_entry['tenant_id']);
+ }
+
+ $j++;
+ }
}
- $table_header = array
- (
- 'lang_name' => lang('name'),
- 'lang_time_created' => lang('time created'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'lang_tenant_id' => lang('tenant
id'),
- 'sort_name' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'last_name',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitenant.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_tenant_id' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'tenant_id',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitenant.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_time_created' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'entry_date',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitenant.index',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_category' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'descr',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitenant.index',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_category' => lang('category')
- );
+//html_print_r($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
+ (
+ 'sort' =>
$this->sort,
+ 'var' =>
$uicols['name'][$i],
+ 'order' =>
$this->order,
+ 'extra'
=> array('sid=cookie&op' => $this->currentapp.'.uitenant.index',
+
'query' =>$this->query,
+
'lookup' =>$lookup,
+
'district_id' => $this->district_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date)
+ ));
+ }
+ }
+ }
- $table_add = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a tenant'),
- 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit')
- );
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+ if($this->acl_add)
+ {
+ $table_add = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
tenant'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit')
+ );
+ }
$link_data = array
(
@@ -184,9 +264,18 @@
$msgbox_data = $this->bocommon->msgbox_data($receipt);
+ $link_columns = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitenant.columns'
+ );
+
$data = array
(
//'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_columns'
=> lang('columns'),
+ 'link_columns'
=> $this->bocommon->link('/index.php',$link_columns),
+ 'lang_columns_help'
=> lang('Choose columns'),
+
'links'
=> $links,
'allow_allrows'
=> false,
'allrows'
=> $this->allrows,
@@ -211,6 +300,8 @@
'values'
=> $content,
'table_add'
=> $table_add
);
+//html_print_r($data);
+
//$this->save_sessiondata();
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('tenant') . ': ' . lang('list tenant');
@@ -219,10 +310,12 @@
function edit()
{
- $tenant_id =
$this->bocommon->get_var2('tenant_id',array('POST','GET'));
- $values =
$this->bocommon->get_var2('values',array('POST'));
+ $tenant_id =
$this->bocommon->get_var2('tenant_id',array('POST','GET'));
+ $values =
$this->bocommon->get_var2('values',array('POST'));
+ $values_attribute =
$this->bocommon->get_var2('values_attribute',array('POST','GET'));
- $this->bocommon->xsl_add_file(array('tenant'));
+//html_print_r($values);
+
$this->bocommon->xsl_add_file(array('tenant','attributes_form'));
if (is_array($values))
{
@@ -242,7 +335,7 @@
if(!$receipt['error'])
{
$values['tenant_id'] =
$tenant_id;
- $receipt =
$this->bo->save($values);
+ $receipt =
$this->bo->save($values,$values_attribute);
$tenant_id =
$receipt['tenant_id'];
$this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
@@ -260,12 +353,20 @@
}
+ $tenant =
$this->bo->read_single(array('tenant_id'=>$tenant_id));
+
if ($tenant_id)
{
- $tenant = $this->bo->read_single($tenant_id);
$this->cat_id =
($tenant['cat_id']?$tenant['cat_id']:$this->cat_id);
}
+ $attributes_header[] = array(
+ 'lang_name' => lang('Name'),
+ 'lang_descr' => lang('Description'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_value' => lang('Value')
+ );
+
$link_data = array
(
'sid=cookie&op' =>
$this->currentapp.'.uitenant.edit',
@@ -273,6 +374,35 @@
);
//html_print_r($link_data);
+ $dateformat =
strtolower($GLOBALS['phpgw_data']['prefs'][$this->currentapp . '.dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
@@ -301,28 +431,50 @@
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the tenant belongs to. To do not use a category
select NO CATEGORY'),
'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id)
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/dateformat.js',
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $tenant['attributes'],
+ 'lookup_functions'
=> $tenant['lookup_functions'],
+ 'dateformat'
=> $dateformat,
);
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('tenant') . ': ' . ($tenant_id?lang('edit tenant'):lang('add tenant'));
+//html_print_r($data);
return array('edit' => $data);
}
function delete()
{
+ $attrib =
$this->bocommon->get_var2('attrib',array('POST','GET'));
+ $id =
$this->bocommon->get_var2('id',array('POST','GET'));
$tenant_id =
$this->bocommon->get_var2('tenant_id',array('POST','GET'));
$delete =
$this->bocommon->get_var2('delete',array('POST'));
$confirm =
$this->bocommon->get_var2('confirm',array('POST'));
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
$link_data = array
(
- 'sid=cookie&op' =>
$this->currentapp.'.uitenant.index'
+ 'sid=cookie&op' =>
$this->currentapp.'.uitenant.'.$function
);
if ($this->bocommon->get_var2('confirm',array('POST')))
{
- $this->bo->delete($tenant_id);
+ $this->bo->delete($tenant_id,$id,$attrib);
// Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
$this->bocommon->redirect_link('/index.php',$link_data);
}
@@ -332,7 +484,7 @@
$data = array
(
'done_action' =>
$this->bocommon->link('/index.php',$link_data),
- 'delete_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
. $tenant_id),
+ 'delete_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
. $tenant_id. '&id=' . $id . '&attrib=' . $attrib),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_statustext' => lang('Delete the
entry'),
@@ -356,9 +508,21 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('tenant') . ': ' . lang('view tenant');
- $this->bocommon->xsl_add_file(array('tenant'));
+
$this->bocommon->xsl_add_file(array('tenant','attributes_view'));
+
+ $tenant =
$this->bo->read_single(array('tenant_id'=>$tenant_id));
+
+ $attributes_values=$tenant['attributes'];
+
+ $dateformat =
strtolower($GLOBALS['phpgw_data']['prefs'][$this->currentapp . '.dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
- $tenant = $this->bo->read_single($tenant_id);
$data = array
(
@@ -373,10 +537,312 @@
'value_last_name' =>
$tenant['last_name'],
'value_contact_phone' =>
$tenant['contact_phone'],
'cat_list'
=> $this->bo->select_category_list('',$tenant['cat_id']),
- 'value_date' =>
$this->bocommon->show_date($tenant['entry_date'])
+ 'value_date' =>
$this->bocommon->show_date($tenant['entry_date']),
+ 'lang_dateformat' =>
lang(strtolower($dateformat)),
+ 'lang_attributes' =>
lang('Attributes'),
+ 'attributes_view' =>
$attributes_values,
+ 'dateformat' =>
$dateformat
);
return array('view' => $data);
}
+
+ function list_attribute()
+ {
+ $id =
$this->bocommon->get_var2('id',array('POST','GET'));
+ $resort =
$this->bocommon->get_var2('resort',array('POST','GET'));
+
+ $this->bocommon->xsl_add_file(array(
+
'tenant',
+
'nextmatchs',
+
'search_field'));
+
+ if($resort)
+ {
+
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
+ }
+
+ $attrib_list = $this->bo->read_attrib();
+
+ while (is_array($attrib_list) && list(,$attrib)
= each($attrib_list))
+ {
+ $content[] = array
+ (
+ 'name'
=> $attrib['name'],
+ 'type_name'
=> $attrib['type_name'],
+ 'datatype'
=> $attrib['datatype'],
+ 'column_name'
=> $attrib['column_name'],
+ 'input_text'
=> $attrib['input_text'],
+ 'sorting'
=> $attrib['attrib_sort'],
+ 'link_up'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows),
+ 'link_down'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows),
+ 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit_attrib&id='
. $attrib['id']),
+ 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&id='
. $attrib['id'].'&attrib=true'),
+ 'lang_view_attribtext'
=> lang('view the attrib'),
+ 'lang_attribute_attribtext'
=> lang('attributes for the attrib'). ' ' . lang('location'),
+ 'lang_edit_attribtext'
=> lang('edit the attrib'),
+ 'lang_delete_attribtext'
=> lang('delete the attrib'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_up'
=> lang('up'),
+ 'text_down'
=> lang('down'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ //html_print_r($content);
+
+ $table_header[] = array
+ (
+ 'lang_descr' =>
lang('Descr'),
+ 'lang_datatype' =>
lang('Datatype'),
+ 'lang_sorting' =>
lang('sorting'),
+ 'lang_edit' =>
lang('edit'),
+ 'lang_delete' =>
lang('delete'),
+ 'sort_sorting' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'attrib_sort',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitenant.list_attribute',
+
'allrows'=>$this->allrows)
+
)),
+
+ 'sort_name' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitenant.list_attribute',
+
'allrows'=>$this->allrows)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_attribtext' => lang('add a
attrib'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit_attrib'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_attribtext' => lang('back
to admin'),
+ 'done_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin.index'),
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_data']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit =
$this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitenant.list_attribute',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'query'
=>$this->query
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> 15,
//$GLOBALS['phpgw_data']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($attrib_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_searchfield_attribtext' =>
lang('Enter the search string. To show all entries, empty this field and press
the SUBMIT button again'),
+ 'lang_searchbutton_attribtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_attrib'
=> $table_header,
+ 'values_attrib'
=> $content,
+ 'table_add2'
=> $table_add
+ );
+
+ $appname
= lang('attribute');
+ $function_msg
= lang('list location attribute');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list_attribute' => $data);
+ }
+
+ function edit_attrib()
+ {
+ $id =
$this->bocommon->get_var2('id',array('POST','GET'));
+ $values =
$this->bocommon->get_var2('values',array('POST'));
+
+ $GLOBALS['msgbox']->add(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'),'warning');
+
+ //html_print_r($values);
+
$this->bocommon->xsl_add_file(array('tenant','choice',));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ $type_id =
$values['type_id'];
+
+ if (!$values['column_name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
+ }
+
+ if (!$values['input_text'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
+ }
+ if (!$values['statustext'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
+ }
+
+ if (!$values['column_info']['type'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
+ }
+
+
if(!ctype_digit($values['column_info']['precision']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
+
unset($values['column_info']['precision']);
+ }
+
+
if(!ctype_digit($values['column_info']['scale']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
+
unset($values['column_info']['scale']);
+ }
+
+ if (!$values['column_info']['nullable'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
+ }
+
+
+ if (!$receipt['error'])
+ {
+
+ $receipt =
$this->bo->save_attrib($values,$action);
+
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] =
array('msg' => lang('Attribute has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values =
$this->bo->read_single_attrib($id);
+ $function_msg = lang('edit attribute');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitenant.edit_attrib',
+ 'id' => $id
+ );
+ //html_print_r($values);
+
+ if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
+ {
+ $multiple_choice= True;
+ }
+
+
+ $msgbox_data =
$this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'lang_choice'
=> lang('Choice'),
+ 'lang_new_value'
=> lang('New value'),
+ 'lang_new_value_statustext' =>
lang('New value for mulitple choice'),
+ 'multiple_choice'
=> $multiple_choice,
+ 'value_choice'
=> $values['choice'],
+ 'lang_delete_value'
=> lang('Delete value'),
+ 'lang_value'
=> lang('value'),
+ 'lang_delete_choice_statustext'=>
lang('Delete this value from the list of multiple choice'),
+
+ //'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.list_attribute&type_id='.$type_id),
+ 'lang_id'
=> lang('Attribute ID'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+
+ 'lang_column_name'
=> lang('Column name'),
+ 'value_column_name'
=> $values['column_name'],
+ 'lang_column_name_statustext' =>
lang('enter the name for the column'),
+
+ 'lang_input_text'
=> lang('input text'),
+ 'value_input_text'
=> $values['input_text'],
+ 'lang_input_name_statustext' =>
lang('enter the input text for records'),
+
+ 'lang_id_attribtext' =>
lang('Enter the attribute ID'),
+ 'lang_entity_statustext' =>
lang('Select a tenant type'),
+
+ 'lang_statustext'
=> lang('Statustext'),
+ 'lang_statustext_attribtext'=>
lang('Enter a statustext for the inputfield in forms'),
+ 'value_statustext'
=> $values['statustext'],
+
+ 'lang_done_attribtext' =>
lang('Back to the list'),
+ 'lang_save_attribtext' =>
lang('Save the attribute'),
+
+ 'lang_datatype'
=> lang('Datatype'),
+ 'lang_datatype_statustext' =>
lang('Select a datatype'),
+ 'lang_no_datatype'
=> lang('No datatype'),
+ 'datatype_list'
=> $this->bocommon->select_datatype($values['column_info']['type']),
+
+ 'lang_precision'
=> lang('Precision'),
+ 'lang_precision_statustext' =>
lang('enter the record length'),
+ 'value_precision'
=> $values['column_info']['precision'],
+
+ 'lang_scale'
=> lang('scale'),
+ 'lang_scale_statustext' =>
lang('enter the scale if type is decimal'),
+ 'value_scale'
=> $values['column_info']['scale'],
+
+ 'lang_default'
=> lang('default'),
+ 'lang_default_statustext' =>
lang('enter the default value'),
+ 'value_default'
=> $values['column_info']['default'],
+
+ 'lang_nullable'
=> lang('Nullable'),
+ 'lang_nullable_statustext' =>
lang('Chose if this column is nullable'),
+ 'lang_select_nullable' =>
lang('Select nullable'),
+ 'nullable_list'
=> $this->bocommon->select_nullable($values['column_info']['nullable']),
+
+ 'value_list'
=> $values['list'],
+ 'lang_list'
=> lang('show in list'),
+ 'lang_list_statustext' =>
lang('check to show this attribute in location list')
+ );
+ //html_print_r($data);
+
+ $appname
= lang('location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('edit_attrib' => $data);
+ }
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.uitenant.php, 1.1.1.10,
nomail <=