[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.uiadmin_location.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.uiadmin_location.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 16:22:10 -0000 |
Update of /property
Modified Files:
Branch:
class.uiadmin_location.php
date: 2004/04/23 21:26:33; author: sigurdne; state: Exp; lines: +778 -778
Log Message:
no message
=====================================================================
Index: property/class.uiadmin_location.php
diff -u property/class.uiadmin_location.php:1.1.1.2
property/class.uiadmin_location.php:1.1.1.3
--- property/class.uiadmin_location.php:1.1.1.2 Fri Apr 23 20:26:17 2004
+++ property/class.uiadmin_location.php Fri Apr 23 21:26:33 2004
@@ -1,778 +1,778 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - property
*
- * http://www.phpgroupware.org
*
- *
*
- * Facilities Management
*
- * Written by Sigurd Nes [sigurdne at online.no]
*
- *
------------------------------------------------------------------------ *
- * Copyright 2000 - 2003 Free Software Foundation, Inc
*
- * This program is part of the GNU project, see http://www.gnu.org/
*
- *
------------------------------------------------------------------------ *
- * This program is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU General Public License as published by the
*
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\**************************************************************************/
-
- class property_uiadmin_location
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'config' => True,
- 'edit_config' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'list_attribute' => True,
- 'edit_attrib' => True,
- );
-
- function property_uiadmin_location()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->account =
$GLOBALS['phpgw_data']['user']['id'];
- $this->bo =
CreateObject($this->currentapp.'_boadmin_location',True);
- $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
- $this->menu =
CreateObject($this->currentapp.'_menu');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='adm_loc';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
-
- $this->bo->reset_fm_cache();
- $this->bocommon->xsl_add_file(array(
-
'admin_location',
-
'nextmatchs',
-
'menu',
-
'search_field'));
- $links = $this->menu->links('loc_type');
-
- $standard_list = $this->bo->read();
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $words = split(' ',$standard['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- $content[] = array
- (
- 'id'
=> $standard['id'],
- 'name'
=> $standard['name'],
- 'prefix'
=> $standard['prefix'],
- 'first'
=> $first,
- 'link_categories'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uicategory.index&type=location&type_id='
. $standard['id']),
- 'link_attribute'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='
. $standard['id']),
- 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit&id='
. $standard['id']),
- 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.delete&id='
. $standard['id']),
- 'lang_view_standardtext' =>
lang('view the standard'),
- 'lang_category_text' =>
lang('categories for the location type'),
- 'lang_attribute_standardtext' =>
lang('attributes for the location type'),
- 'lang_edit_standardtext' =>
lang('edit the standard'),
- 'lang_delete_standardtext' =>
lang('delete the standard'),
- 'text_categories'
=> lang('Categories'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//html_print_r($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_prefix' => lang('prefix'),
- 'lang_categories' => lang('Categories'),
- 'lang_attribute' => lang('Attributes'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.index')
-
)),
- 'lang_id' => lang('standard id'),
- 'sort_name' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.index')
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit'),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$this->bocommon->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('location');
- $function_msg =
lang('list location standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('list' => $data);
- }
-
- function edit()
- {
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
- $this->bocommon->xsl_add_file(array('admin_location'));
-
- if ($values['save'])
- {
- if (!$values['name'])
- {
- $receipt['error'][] =
array('msg'=>lang('Name not entered!'));
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
-
- if (!$receipt['error'])
- {
-
- $receipt =
$this->bo->save($values,$action);
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'=>
lang('Table has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values = $this->bo->read_single($id);
- $function_msg = lang('edit standard');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add standard');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.edit',
- 'id' => $id
- );
-//html_print_r($link_data);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_prefix'
=> lang('Standard prefix'),
- 'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id'),
- 'lang_name_standardtext' =>
lang('Enter a name of the standard'),
-
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
- 'lang_id'
=> lang('standard ID'),
- 'lang_name'
=> lang('Name'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'value_name'
=> $values['name'],
- 'value_prefix'
=> $values['prefix'],
- 'lang_id_standardtext' =>
lang('Enter the standard ID'),
- 'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the standard'),
- 'type_id'
=> $values['type_id'],
- 'value_descr'
=> $values['descr']
- );
-
- $appname
= lang('location');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('edit' => $data);
- }
-
- function delete()
- {
- $attrib = get_var('attrib',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- if($attrib)
- {
- $function='list_attribute';
- }
- else
- {
- $function='index';
- }
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.'.$function,
- 'type_id' => $type_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id,$attrib);
- Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
- }
-
- $this->bocommon->xsl_add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$this->bocommon->link('/index.php',$link_data),
- 'delete_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.delete&id='
. $id.'&attrib='.$attrib.'&type_id='.$type_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_standardtext' => lang('Delete the
entry'),
- 'lang_no_standardtext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('location');
- $function_msg =
lang('delete location standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('delete' => $data);
- }
-
-
- function list_attribute()
- {
- $type_id =
get_var('type_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $resort = get_var('resort',array('POST','GET'));
-
- $this->bocommon->xsl_add_file(array(
-
'admin_location',
-
'nextmatchs',
-
'search_field'));
-
- if($resort)
- {
-
$this->bo->resort_attrib(array('resort'=>$resort,'type_id' =>
$type_id,'id'=>$id));
- }
-
- $attrib_list = $this->bo->read_attrib($type_id);
-
- 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.'.uiadmin_location.list_attribute&resort=up&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
- 'link_down'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.list_attribute&resort=down&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
- 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit_attrib&id='
. $attrib['id'].'&type_id='.$type_id),
- 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.delete&id='
. $attrib['id'].'&type_id='.$type_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_type_name' => lang('Type'),
- '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.'.uiadmin_location.list_attribute',
-
'type_id'
=>$type_id,
-
'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.'.uiadmin_location.list_attribute',
-
'type_id'
=>$type_id,
-
'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.'.uiadmin_location.edit_attrib&type_id='.$type_id),
- 'lang_done' =>
lang('done'),
- 'lang_done_attribtext' => lang('back to
admin'),
- 'done_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
- );
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.list_attribute',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'query'
=>$this->query,
- 'type_id'
=>$type_id
- );
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['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_add'
=> $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()
- {
- $type_id =
get_var('type_id',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
-
-//html_print_r($values);
- $this->bocommon->xsl_add_file(array('admin_location'));
-
- 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['type_id'])
- {
- $receipt['error'][] =
array('msg'=>lang('Location type not choosen!'));
- }
-
- 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($type_id,$id);
- $type_name=$attrib['type_name'];
- $function_msg = lang('edit attribute'). ' ' .
lang($type_name);
- $action='edit';
- }
- else
- {
- $function_msg = lang('add attribute');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.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.'.uiadmin_location.list_attribute&type_id='.$type_id),
- 'lang_id'
=> lang('Attribute ID'),
- 'lang_location_type' =>
lang('Type'),
- 'lang_no_location_type' => lang('No
entity type'),
- '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 entity 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'),
- 'type_id'
=> $values['type_id'],
- 'entity_list' =>
$this->bo->select_location_type($type_id),
- 'select_location_type' =>
'values[type_id]',
- '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_lookup_form' =>
$values['lookup_form'],
- 'lang_lookup_form'
=> lang('show in lookup forms'),
- 'lang_lookup_form_statustext'
=> lang('check to show this attribue in lookup forms'),
- '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);
- }
-
- function config()
- {
-
- $this->bocommon->xsl_add_file(array(
-
'admin_location',
-
'nextmatchs',
-
'menu',
-
'search_field'));
- $links = $this->menu->links('loc_config');
-
- $standard_list = $this->bo->read_config();
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $content[] = array
- (
- 'column_name'
=> $standard['column_name'],
- 'name'
=> $standard['location_name'],
- 'prefix'
=> $standard['prefix'],
- 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit_config&column_name='
. $standard['column_name']),
- 'lang_edit_standardtext' =>
lang('edit the column relation'),
- 'text_edit'
=> lang('edit')
- );
- }
-
-//html_print_r($content);
-
- $table_header[] = array
- (
-
- 'lang_attribute' => lang('Attributes'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_column_name' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'column_name',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.config')
-
)),
- 'lang_column_name' => lang('column name'),
- 'sort_name' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.config')
-
)),
- 'lang_name' => lang('Table Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit'),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$this->bocommon->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_list_config' =>
$table_header,
- 'values_list_config' =>
$content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('location');
- $function_msg =
lang('list config');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('list_config' => $data);
- }
-
- function edit_config()
- {
- $column_name =
get_var('column_name',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
- $this->bocommon->xsl_add_file(array('admin_location'));
-
- if ($values['save'])
- {
-
- if (!$receipt['error'])
- {
-
- $receipt =
$this->bo->save_config($values,$column_name);
- }
-
- }
-
- $type_id =
$this->bo->read_config_single($column_name);
-
- $function_msg = lang('edit location config for') . ' '
.$column_name;
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.edit_config',
- 'column_name' => $column_name
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- '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.'.uiadmin_location.config'),
-
- 'lang_column_name'
=> lang('Column name'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'column_name'
=> $column_name,
- 'value_name'
=> $values['name'],
-
- 'location_list'
=> $this->bo->select_location_type($type_id),
-
- 'lang_config_statustext' =>
lang('Select the level for this information'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the standard'),
- 'type_id'
=> $values['type_id'],
- 'value_descr'
=> $values['descr']
- );
-
- $appname
= lang('location');
-
-//html_print_r($data);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('edit_config' => $data);
- }
-
-
- }
-?>
+<?php
+
/**************************************************************************\
+ * phpGroupWare - property
*
+ * http://www.phpgroupware.org
*
+ *
*
+ * Facilities Management
*
+ * Written by Sigurd Nes [sigurdne at online.no]
*
+ *
------------------------------------------------------------------------ *
+ * Copyright 2000 - 2003 Free Software Foundation, Inc
*
+ * This program is part of the GNU project, see http://www.gnu.org/
*
+ *
------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by the
*
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+
+ class property_uiadmin_location
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'config' => True,
+ 'edit_config' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'list_attribute' => True,
+ 'edit_attrib' => True,
+ );
+
+ function property_uiadmin_location()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->account =
$GLOBALS['phpgw_data']['user']['id'];
+ $this->bo =
CreateObject($this->currentapp.'_boadmin_location',True);
+ $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
+ $this->menu =
CreateObject($this->currentapp.'_menu');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='adm_loc';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+
+ $this->bo->reset_fm_cache();
+ $this->bocommon->xsl_add_file(array(
+
'admin_location',
+
'nextmatchs',
+
'menu',
+
'search_field'));
+ $links = $this->menu->links('loc_type');
+
+ $standard_list = $this->bo->read();
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $words = split(' ',$standard['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ $content[] = array
+ (
+ 'id'
=> $standard['id'],
+ 'name'
=> $standard['name'],
+ 'prefix'
=> $standard['prefix'],
+ 'first'
=> $first,
+ 'link_categories'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uicategory.index&type=location&type_id='
. $standard['id']),
+ 'link_attribute'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='
. $standard['id']),
+ 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit&id='
. $standard['id']),
+ 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.delete&id='
. $standard['id']),
+ 'lang_view_standardtext' =>
lang('view the standard'),
+ 'lang_category_text' =>
lang('categories for the location type'),
+ 'lang_attribute_standardtext' =>
lang('attributes for the location type'),
+ 'lang_edit_standardtext' =>
lang('edit the standard'),
+ 'lang_delete_standardtext' =>
lang('delete the standard'),
+ 'text_categories'
=> lang('Categories'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//html_print_r($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_prefix' => lang('prefix'),
+ 'lang_categories' => lang('Categories'),
+ 'lang_attribute' => lang('Attributes'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.index')
+
)),
+ 'lang_id' => lang('standard id'),
+ 'sort_name' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.index')
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit'),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_standardtext' => lang('back
to admin'),
+ 'done_action' =>
$this->bocommon->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('location');
+ $function_msg =
lang('list location standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list' => $data);
+ }
+
+ function edit()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+ $this->bocommon->xsl_add_file(array('admin_location'));
+
+ if ($values['save'])
+ {
+ if (!$values['name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Name not entered!'));
+ }
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+
+ if (!$receipt['error'])
+ {
+
+ $receipt =
$this->bo->save($values,$action);
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'=>
lang('Table has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single($id);
+ $function_msg = lang('edit standard');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add standard');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.edit',
+ 'id' => $id
+ );
+//html_print_r($link_data);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_prefix'
=> lang('Standard prefix'),
+ 'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id'),
+ 'lang_name_standardtext' =>
lang('Enter a name of the standard'),
+
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
+ 'lang_id'
=> lang('standard ID'),
+ 'lang_name'
=> lang('Name'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+ 'value_name'
=> $values['name'],
+ 'value_prefix'
=> $values['prefix'],
+ 'lang_id_standardtext' =>
lang('Enter the standard ID'),
+ 'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the standard'),
+ 'type_id'
=> $values['type_id'],
+ 'value_descr'
=> $values['descr']
+ );
+
+ $appname
= lang('location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('edit' => $data);
+ }
+
+ function delete()
+ {
+ $attrib = get_var('attrib',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id =
get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.'.$function,
+ 'type_id' => $type_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id,$attrib);
+ Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
+ }
+
+ $this->bocommon->xsl_add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$this->bocommon->link('/index.php',$link_data),
+ 'delete_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.delete&id='
. $id.'&attrib='.$attrib.'&type_id='.$type_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_standardtext' => lang('Delete the
entry'),
+ 'lang_no_standardtext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('location');
+ $function_msg =
lang('delete location standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('delete' => $data);
+ }
+
+
+ function list_attribute()
+ {
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $resort = get_var('resort',array('POST','GET'));
+
+ $this->bocommon->xsl_add_file(array(
+
'admin_location',
+
'nextmatchs',
+
'search_field'));
+
+ if($resort)
+ {
+
$this->bo->resort_attrib(array('resort'=>$resort,'type_id' =>
$type_id,'id'=>$id));
+ }
+
+ $attrib_list = $this->bo->read_attrib($type_id);
+
+ 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.'.uiadmin_location.list_attribute&resort=up&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
+ 'link_down'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.list_attribute&resort=down&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
+ 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit_attrib&id='
. $attrib['id'].'&type_id='.$type_id),
+ 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.delete&id='
. $attrib['id'].'&type_id='.$type_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_type_name' => lang('Type'),
+ '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.'.uiadmin_location.list_attribute',
+
'type_id'
=>$type_id,
+
'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.'.uiadmin_location.list_attribute',
+
'type_id'
=>$type_id,
+
'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.'.uiadmin_location.edit_attrib&type_id='.$type_id),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_attribtext' => lang('back to
admin'),
+ 'done_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.list_attribute',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'query'
=>$this->query,
+ 'type_id'
=>$type_id
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['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_add'
=> $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()
+ {
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id =
get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+
+//html_print_r($values);
+ $this->bocommon->xsl_add_file(array('admin_location'));
+
+ 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['type_id'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Location type not choosen!'));
+ }
+
+ 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($type_id,$id);
+ $type_name=$attrib['type_name'];
+ $function_msg = lang('edit attribute'). ' ' .
lang($type_name);
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.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.'.uiadmin_location.list_attribute&type_id='.$type_id),
+ 'lang_id'
=> lang('Attribute ID'),
+ 'lang_location_type' =>
lang('Type'),
+ 'lang_no_location_type' => lang('No
entity type'),
+ '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 entity 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'),
+ 'type_id'
=> $values['type_id'],
+ 'entity_list' =>
$this->bo->select_location_type($type_id),
+ 'select_location_type' =>
'values[type_id]',
+ '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_lookup_form' =>
$values['lookup_form'],
+ 'lang_lookup_form'
=> lang('show in lookup forms'),
+ 'lang_lookup_form_statustext'
=> lang('check to show this attribue in lookup forms'),
+ '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);
+ }
+
+ function config()
+ {
+
+ $this->bocommon->xsl_add_file(array(
+
'admin_location',
+
'nextmatchs',
+
'menu',
+
'search_field'));
+ $links = $this->menu->links('loc_config');
+
+ $standard_list = $this->bo->read_config();
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $content[] = array
+ (
+ 'column_name'
=> $standard['column_name'],
+ 'name'
=> $standard['location_name'],
+ 'prefix'
=> $standard['prefix'],
+ 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit_config&column_name='
. $standard['column_name']),
+ 'lang_edit_standardtext' =>
lang('edit the column relation'),
+ 'text_edit'
=> lang('edit')
+ );
+ }
+
+//html_print_r($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_attribute' => lang('Attributes'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_column_name' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.config')
+
)),
+ 'lang_column_name' => lang('column name'),
+ 'sort_name' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.config')
+
)),
+ 'lang_name' => lang('Table Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.edit'),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_standardtext' => lang('back
to admin'),
+ 'done_action' =>
$this->bocommon->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiadmin_location.index'),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_list_config' =>
$table_header,
+ 'values_list_config' =>
$content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('location');
+ $function_msg =
lang('list config');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list_config' => $data);
+ }
+
+ function edit_config()
+ {
+ $column_name =
get_var('column_name',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+ $this->bocommon->xsl_add_file(array('admin_location'));
+
+ if ($values['save'])
+ {
+
+ if (!$receipt['error'])
+ {
+
+ $receipt =
$this->bo->save_config($values,$column_name);
+ }
+
+ }
+
+ $type_id =
$this->bo->read_config_single($column_name);
+
+ $function_msg = lang('edit location config for') . ' '
.$column_name;
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiadmin_location.edit_config',
+ 'column_name' => $column_name
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ '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.'.uiadmin_location.config'),
+
+ 'lang_column_name'
=> lang('Column name'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'column_name'
=> $column_name,
+ 'value_name'
=> $values['name'],
+
+ 'location_list'
=> $this->bo->select_location_type($type_id),
+
+ 'lang_config_statustext' =>
lang('Select the level for this information'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the standard'),
+ 'type_id'
=> $values['type_id'],
+ 'value_descr'
=> $values['descr']
+ );
+
+ $appname
= lang('location');
+
+//html_print_r($data);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('edit_config' => $data);
+ }
+
+
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.uiadmin_location.php, 1.1.1.3,
nomail <=