[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6615] Property: more on generic code
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6615] Property: more on generic code |
Date: |
Thu, 18 Nov 2010 07:45:08 +0000 |
Revision: 6615
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6615
Author: sigurdne
Date: 2010-11-18 07:45:07 +0000 (Thu, 18 Nov 2010)
Log Message:
-----------
Property: more on generic code
Modified Paths:
--------------
trunk/property/inc/class.uigeneric.inc.php
Removed Paths:
-------------
trunk/property/inc/class.boactor.inc.php
trunk/property/inc/class.bocategory.inc.php
trunk/property/inc/class.soactor.inc.php
trunk/property/inc/class.socategory.inc.php
trunk/property/inc/class.uiactor.inc.php
trunk/property/inc/class.uicategory.inc.php
trunk/property/js/yahoo/actor.index.js
trunk/property/js/yahoo/category.index.js
trunk/property/templates/base/actor.xsl
trunk/property/templates/base/category.xsl
Deleted: trunk/property/inc/class.boactor.inc.php
===================================================================
--- trunk/property/inc/class.boactor.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.boactor.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,264 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare 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.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_boactor
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $role;
- var $member_id;
-
- protected $valid_role = array(
- 'tenant'=>true,
- 'owner' =>true,
- 'vendor'=>true
- );
-
- /**
- * @var object $custom reference to custom fields object
- */
- protected $custom;
-
- var $public_functions = array
- (
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
- );
-
- function __construct($session=false)
- {
- $this->so =
CreateObject('property.soactor');
- $this->bocommon = & $this->so->bocommon;
- $this->custom = & $this->so->custom;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = true;
- }
-
- $start = phpgw::get_var('start', 'int',
'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $filter = phpgw::get_var('filter', 'int');
- $cat_id = phpgw::get_var('cat_id', 'int');
- $allrows = phpgw::get_var('allrows', 'bool');
- $role = phpgw::get_var('role');
- $member_id = phpgw::get_var('member_id', 'int');
-
- $this->role = $role;
- $this->so->role = $role;
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(!empty($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id) && !empty($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- else
- {
- $this->cat_id = '';
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- if(isset($member_id))
- {
- $this->member_id = $member_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','actor_' .
$this->role,$data);
- }
- }
-
- public function check_valid_role($role)
- {
- return $this->valid_role[$role];
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','actor_' . $this->role);
-
- //_debug_array($data);
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->member_id= $data['member_id'];
- $this->allrows = $data['allrows'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == true);
- }
-
- function read($dry_run='')
- {
- $actor = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,
-
'member_id'=>$this->member_id, 'dry_run' => $dry_run));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($actor); $i++)
- {
- if(isset($actor[$i]['entry_date']) &&
$actor[$i]['entry_date'])
- {
- $actor[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($actor[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- }
- return $actor;
- }
-
- function read_single($data)
- {
- $values['attributes'] =
$this->custom->find('property','.' . $this->role, 0, '', 'ASC', 'attrib_sort',
true, true);
- if(isset($data['actor_id']) && $data['actor_id'])
- {
- $values =
$this->so->read_single($data['actor_id'], $values);
- }
-
- $values = $this->custom->prepare($values,
'property','.' . $this->role, $data['view']);
- return $values;
- }
-
- /**
- * Arrange attributes within groups
- *
- * @param string $location the name of the location of the
attribute
- * @param array $attributes the array of the attributes to be
grouped
- *
- * @return array the grouped attributes
- */
-
- public function get_attribute_groups($location, $attributes =
array())
- {
- return $this->custom->get_attribute_groups('property',
$location, $attributes);
- }
-
- function save($actor,$values_attribute='')
- {
- if(is_array($values_attribute))
- {
- $values_attribute =
$this->custom->convert_attribute_save($values_attribute);
- }
-
- if ($actor['actor_id'])
- {
- if ($actor['actor_id'] != 0)
- {
- $actor_id = $actor['actor_id'];
-
$receipt=$this->so->edit($actor,$values_attribute);
- }
- }
- else
- {
- $receipt =
$this->so->add($actor,$values_attribute);
- }
- return $receipt;
- }
-
- function delete($actor_id)
- {
- $this->so->delete($actor_id);
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property']["actor_columns_"
. $this->role];
- }
- $filter = array('list' => ''); // translates to "list
IS NULL"
- $columns = $this->custom->find('property','.' .
$this->role, 0, '','','',true, false, $filter);
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- /**
- * Preserve attribute values from post in case of an error
- *
- * @param array $values_attribute attribute definition and
values from posting
- * @param array $values value set with
- * @return array Array with attribute definition and values
- */
- function preserve_attribute_values($values,$values_attribute)
- {
- return
$this->bocommon->preserve_attribute_values($values,$values_attribute);
- }
- }
Deleted: trunk/property/inc/class.bocategory.inc.php
===================================================================
--- trunk/property/inc/class.bocategory.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.bocategory.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,230 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare 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.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_bocategory
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $location_info = array();
-
- var $soap_functions = array(
- 'list' => array(
- 'in' =>
array('int','int','struct','string','int'),
- 'out' => array('array')
- ),
- 'read' => array(
- 'in' => array('int','struct'),
- 'out' => array('array')
- ),
- 'save' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- ),
- 'delete' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- )
- );
-
- function __construct($session=false)
- {
- $this->so =
CreateObject('property.socategory');
- $this->custom = & $this->so->custom;
- $this->bocommon =
CreateObject('property.bocommon');
-
- $start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
- $query =
phpgw::get_var('query');
- $sort =
phpgw::get_var('sort');
- $order =
phpgw::get_var('order');
- $filter =
phpgw::get_var('filter', 'int');
- $cat_id =
phpgw::get_var('cat_id', 'int');
- $allrows =
phpgw::get_var('allrows', 'bool');
- $type =
phpgw::get_var('type');
- $type_id =
phpgw::get_var('type_id', 'int');
-
- $this->type_id = $type;
- $this->type_id = $type_id;
-
- if ($session)
- {
- $this->read_sessiondata($type);
- $this->use_session = true;
- }
-
- $this->start = $start ? $start : 0;
- $this->query = isset($_REQUEST['query']) ?
$query : $this->query;
- $this->sort =
isset($_REQUEST['sort']) ? $sort : $this->sort;
- $this->order = isset($_REQUEST['order']) &&
$_REQUEST['order'] ? $order : $this->order;
- $this->filter = isset($_REQUEST['filter']) ?
$filter : $this->filter;
- $this->cat_id = isset($_REQUEST['cat_id']) ?
$cat_id : $this->cat_id;
- $this->allrows = isset($allrows) ? $allrows :
false;
-
- $this->location_info =
$this->so->get_location_info($type, $type_id);
-
- }
-
- public function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$data['type']}",$data);
- }
- }
-
- function read_sessiondata($type)
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$type}");
-
- // _debug_array($data);
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->allrows = $data['allrows'];
- }
-
- public function get_location_info($type,$type_id)
- {
- return $this->so->get_location_info($type,$type_id);
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
- $selected =
$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"];
- }
- $filter = array('list' => ''); // translates to "list
IS NULL"
- $columns =
$this->custom->find('property',$this->location_info['acl_location'], 0,
'','','',true, false, $filter);
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- public function read($filter = array())
- {
- if (! $filter )
- {
- foreach ( $this->location_info['fields'] as
$field )
- {
- if (isset($field['filter']) &&
$field['filter'])
- {
- $filter[$field['name']] =
phpgw::get_var($field['name']);
- }
- }
- }
-
- $values = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'allrows'=>$this->allrows),$filter);
-
- $this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
-
- return $values;
- }
-
- public function read_single($data=array())
- {
- $custom_fields = false;
-
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
- {
- $custom_fields = true;
- $values = array();
- $values['attributes'] =
$this->custom->find('property', $this->location_info['acl_location'], 0, '',
'ASC', 'attrib_sort', true, true);
- }
-
- if(isset($data['id']) && $data['id'])
- {
- $values = $this->so->read_single($data,
$values);
- }
- if($custom_fields)
- {
- $values = $this->custom->prepare($values,
'property',$this->location_info['acl_location'], $data['view']);
- }
- return $values;
- }
-
- public function save($data,$action='',$values_attribute =
array())
- {
- if(is_array($values_attribute))
- {
- $values_attribute =
$this->custom->convert_attribute_save($values_attribute);
- }
-
- if ($action=='edit')
- {
- if ($data['id'] != '')
- {
-
- $receipt =
$this->so->edit($data,$values_attribute);
- }
- }
- else
- {
- $receipt =
$this->so->add($data,$values_attribute);
- }
-
- return $receipt;
- }
-
- /**
- * Get a list from and tag the selected item
- *
- * @param array $data
- *
- * @return array with information to include in forms
- */
-
- public function get_list($data)
- {
- $values = $this->so->get_list($data);
- foreach ($values as &$entry)
- {
- $entry['selected'] = isset($data['selected'])
&& trim($data['selected']) == trim($entry['id']) ? 1 : 0;
- }
- return $values;
- }
-
- public function delete($id)
- {
- $this->so->delete($id);
- }
- }
Deleted: trunk/property/inc/class.soactor.inc.php
===================================================================
--- trunk/property/inc/class.soactor.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.soactor.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,492 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare 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.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_soactor
- {
- var $role;
-
- function __construct()
- {
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bocommon =
CreateObject('property.bocommon');
- $this->custom =
createObject('property.custom_fields');
- $this->db = & $GLOBALS['phpgw']->db;
- $this->join = & $this->db->join;
- $this->left_join = & $this->db->left_join;
- $this->like = & $this->db->like;
- }
-
- function read($data)
- {
- if(is_array($data))
- {
- $start =
isset($data['start'])?$data['start']:0;
- $filter = isset($data['filter']) &&
$data['filter'] ?$data['filter']:'none';
- $query =
isset($data['query'])?$data['query']:'';
- $sort = isset($data['sort']) &&
$data['sort'] ? $data['sort']:'DESC';
- $order =
isset($data['order'])?$data['order']:'';
- $cat_id =
isset($data['cat_id'])?$data['cat_id']:'';
- $allrows =
isset($data['allrows'])?$data['allrows']:'';
- $member_id = isset($data['member_id']) &&
$data['member_id'] ? $data['member_id']:0;
- $dry_run = isset($data['dry_run']) ?
$data['dry_run'] : '';
- }
-
- $sql = $this->bocommon->fm_cache('sql_actor_' .
$this->role);
-
- $entity_table = 'fm_' . $this->role;
- $category_table = 'fm_' . $this->role . '_category';
- $choice_table = 'phpgw_cust_choice';
- $attribute_table = 'phpgw_cust_attribute';
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".{$this->role}");
- $attribute_filter = " location_id = {$location_id}";
-
- if(!$sql)
- {
- $cols_return = array();
- $uicols = array();
- $cols = $entity_table .
".*,$category_table.descr as category";
-
- $cols_return[] = 'id';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] = 'id';
- $uicols['descr'][] =
lang('ID');
- $uicols['statustext'][] = lang('ID');
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $cols_return[] = 'id';
- $uicols['input_type'][] = 'hidden';
- $uicols['name'][] = 'id';
- $uicols['descr'][] = false;
- $uicols['statustext'][] = false;
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $cols_return[] =
'category';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'category';
- $uicols['descr'][] =
lang('category');
- $uicols['statustext'][] =
lang('category');
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $cols_return[] =
'entry_date';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'entry_date';
- $uicols['descr'][] =
lang('entry date');
- $uicols['statustext'][] = lang('entry
date');
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $paranthesis .='(';
-
- $joinmethod .= " $this->join " . $entity_table
. "_category ON ( $entity_table" . ".category =" .$entity_table .
"_category.id))";
-
- $from .= " FROM $paranthesis $entity_table ";
-
- $sql = "SELECT $cols $from $joinmethod";
-
- $this->bocommon->fm_cache('sql_actor_' .
$this->role,$sql);
- $this->bocommon->fm_cache('uicols_actor_' .
$this->role,$uicols);
- $this->bocommon->fm_cache('cols_return_actor_'
. $this->role,$cols_return);
-
- }
- else
- {
- $uicols
= $this->bocommon->fm_cache('uicols_actor_'. $this->role);
- $cols_return
= $this->bocommon->fm_cache('cols_return_actor_' . $this->role);
- }
-
-
$user_columns=isset($GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
.
$this->role])?$GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
. $this->role]:'';
- $user_column_filter = '';
- if (isset($user_columns) AND is_array($user_columns)
AND $user_columns[0])
- {
- $user_column_filter = " OR ($attribute_filter
AND id IN (" . implode(',',$user_columns) .'))';
- }
-
- $this->db->query("SELECT * FROM $attribute_table WHERE
list=1 AND $attribute_filter $user_column_filter ORDER BY attrib_sort ASC");
-
- while ($this->db->next_record())
- {
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
$this->db->f('column_name');
- $uicols['descr'][] =
$this->db->f('input_text');
- $uicols['statustext'][] =
$this->db->f('statustext');
- $uicols['datatype'][] =
$this->db->f('datatype');
- $uicols['attib_id'][] =
$this->db->f('id');
- }
-
- $this->uicols = $uicols;
-
- if ($order)
- {
- $ordermethod = " order by $entity_table.$order
$sort";
- }
- else
- {
- $ordermethod = " order by $entity_table.id
DESC";
- }
-
- $where= 'WHERE';
-
- $grants =
$GLOBALS['phpgw']->session->appsession('grants_' . $this->role ,'property');
-
- if(!$grants)
- {
- $this->acl = &
$GLOBALS['phpgw']->acl;
- $grants = $this->acl->get_grants('property','.'
. $this->role);
-
$GLOBALS['phpgw']->session->appsession('grants_' .
$this->role,'property',$grants);
- }
-
- $filtermethod = '';
- if (is_array($grants))
- {
- foreach($grants as $user => $right)
- {
- $public_user_list[] = $user;
- }
- reset($public_user_list);
- $filtermethod .= " $where (
$entity_table.owner_id IN(" . implode(',',$public_user_list) . "))";
- $where= 'AND';
- }
-
- if ($cat_id)
- {
- $filtermethod .= " $where
$entity_table.category='$cat_id' ";
- $where= 'AND';
- }
-
- if ($member_id>0)
- {
- $filtermethod .= " $where
$entity_table.member_of $this->like '%,$member_id,%' ";
- $where= 'AND';
- }
-
-/* if ($status)
- {
- $filtermethod .= " $where
$entity_table.status='$status' ";
- $where= 'AND';
- }
-*/
-
- $querymethod = '';
- $_querymethod = array();
- if($query)
- {
- $query = $this->db->db_addslashes($query);
-
- if(ctype_digit($query))
- {
- $_querymethod[]= "$entity_table.id =" .
(int)$query;
- }
-
- $where= 'AND';
-
- $this->db->query("SELECT * FROM
$attribute_table WHERE $attribute_filter AND search='1'");
-
- while ($this->db->next_record())
- {
- if($this->db->f('datatype')=='V' ||
$this->db->f('datatype')=='email' || $this->db->f('datatype')=='CH'):
- {
- $_querymethod[]=
"$entity_table." . $this->db->f('column_name') . " $this->like '%$query%'";
- }
- elseif($this->db->f('datatype')=='I'):
- {
- if(ctype_digit($query))
- {
- $_querymethod[]=
"$entity_table." . $this->db->f('column_name') . '=' . (int)$query;
- }
- }
- else:
- {
- $_querymethod[]=
"$entity_table." . $this->db->f('column_name') . " = '$query'";
- }
- endif;
- }
-
- if (isset($_querymethod) AND
is_array($_querymethod))
- {
- $querymethod = " $where (" . implode ('
OR ',$_querymethod) . ')';
- }
- }
-
- $sql .= " $filtermethod $querymethod";
-//echo $sql;
- $values = array();
-
- if(!$dry_run)
- {
- $this->db->query('SELECT count(*) as cnt ' .
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
- $this->db->next_record();
- $this->total_records = $this->db->f('cnt');
- if(!$allrows)
- {
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- $cols_return = $uicols['name'];
- $j=0;
-
- $dataset = array();
- while ($this->db->next_record())
- {
- foreach($cols_return as $key => $field)
- {
- $dataset[$j][$field] = array
- (
- 'value' =>
$this->db->f($field),
- 'datatype' =>
$uicols['datatype'][$key],
- 'attrib_id' =>
$uicols['attib_id'][$key]
- );
- }
- $j++;
- }
-
- $values =
$this->custom->translate_value($dataset, $location_id);
-
- return $values;
- }
- return $values;
- }
-
- function read_single($actor_id, $values = array())
- {
- if(is_array($actor_id))
- {
- $actor_id = $actor_id['actor_id'];
- $bt = debug_backtrace();
- echo "<b>wrong call to soactor::" .
$bt[0]['function'] . "<br/>Called from file: " . $bt[0]['file'] . "<br/> line:
" . $bt[0]['line'] . '<br/>args: ' . print_r($bt[0]['args'][0],true) . '</b>';
- unset($bt);
- }
- $table = 'fm_' . $this->role;
-
- $this->db->query("SELECT * from $table where
id='$actor_id'");
-
- if($this->db->next_record())
- {
- $values['id'] =
(int)$this->db->f('id');
- $values['entry_date'] =
$this->db->f('entry_date');
- $values['cat_id'] =
$this->db->f('category');
- $values['member_of'] =
explode(',',$this->db->f('member_of'));
-
- if ( isset($values['attributes']) &&
is_array($values['attributes']) )
- {
- foreach ( $values['attributes'] as
&$attr )
- {
- $attr['value'] =
$this->db->f($attr['column_name']);
- }
- }
- }
- return $values;
- }
-
- function add($actor,$values_attribute='')
- {
- $table = 'fm_' . $this->role;
-
- if($actor['member_of'])
- {
- $actor['member_of']=',' .
implode(',',$actor['member_of']) . ',';
- }
-
- if(isset($actor['extra']) && is_array($actor['extra']))
- {
- foreach ($actor['extra'] as $input_name =>
$value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
-
- if (isset($values_attribute) AND
is_array($values_attribute))
- {
- foreach($values_attribute as $entry)
- {
- if($entry['value'])
- {
- if($entry['datatype']!='AB' &&
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
- {
- if($entry['datatype']
== 'C' || $entry['datatype'] == 'T' || $entry['datatype'] == 'V' ||
$entry['datatype'] == 'link')
- {
- $entry['value']
= $this->db->db_addslashes($entry['value']);
- }
-
- if($entry['datatype']
== 'pwd' && $entry['value'] && $entry['value2'])
- {
-
if($entry['value'] == $entry['value2'])
- {
- $cols[]
= $entry['name'];
- $vals[]
= md5($entry['value']);
- }
- else
- {
-
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
- }
- }
- else
- {
- $cols[] =
$entry['name'];
- $vals[] =
$entry['value'];
- }
-
- if($entry['history'] ==
1)
- {
-
$history_set[$entry['attrib_id']] = $entry['value'];
- }
- }
- }
- }
- }
-
- if($this->role == 'vendor')
- {
- $cols[] = 'member_of';
- $vals[] = $actor['member_of'];
- }
-
- $cols[] = 'owner_id';
- $vals[] = $this->account;
-
- if($cols)
- {
- $cols = "," . implode(",", $cols);
- $vals = "," .
$this->bocommon->validate_db_insert($vals);
- }
-
- $this->db->transaction_begin();
- if($actor['new_actor_id'])
- {
- $id = $actor['new_actor_id'];
- }
- else
- {
- $id = $this->bocommon->next_id($table);
- }
-
- $this->db->query("INSERT INTO $table
(id,entry_date,category $cols) "
- . "VALUES ($id,'" . time() . "','" .
$actor['cat_id'] . "' $vals)");
-
- $receipt['actor_id']=
$id;//$this->db->get_last_insert_id($table,'id');
-
- $receipt['message'][] = array('msg'=>lang('actor %1 has
been saved',$receipt['actor_id']));
-
- $this->db->transaction_commit();
- return $receipt;
- }
-
- function edit($actor,$values_attribute='')
- {
-//_debug_array($actor);
-//_debug_array($values_attribute);
- $table = 'fm_' . $this->role;
-
- if($actor['member_of'])
- {
- $actor['member_of']=',' .
implode(',',$actor['member_of']) . ',';
- }
-
- if(isset($actor['extra']) && is_array($actor['extra']))
- {
- foreach ($actor['extra'] as $column => $value)
- {
- $value_set[$column] = $value;
- }
- }
-
- if (isset($values_attribute) AND
is_array($values_attribute))
- {
- foreach($values_attribute as $entry)
- {
- if($entry['datatype']!='AB' &&
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
- {
- if($entry['datatype'] == 'C' ||
$entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] ==
'link')
- {
- $entry['value'] =
$this->db->db_addslashes($entry['value']);
- }
- if($entry['datatype'] == 'pwd')
- {
- if($entry['value'] ||
$entry['value2'])
- {
-
if($entry['value'] == $entry['value2'])
- {
-
$value_set[$entry['name']] = md5($entry['value']);
- }
- else
- {
-
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
- }
- }
- }
- else
- {
-
$value_set[$entry['name']] = $entry['value'];
- }
- }
- }
- }
-
- $value_set['entry_date'] = time();
- $value_set['category'] = $actor['cat_id'];
-
- if($this->role == 'vendor')
- {
- $value_set['member_of'] = $actor['member_of'];
- }
-
- if($value_set)
- {
- $value_set =
$this->bocommon->validate_db_update($value_set);
- }
-
- $this->db->query("UPDATE $table set $value_set WHERE
id=" . intval($actor['actor_id']));
-
- $receipt['actor_id']= $actor['actor_id'];
- $receipt['message'][] = array('msg'=>lang('actor %1 has
been edited',$actor['actor_id']));
- return $receipt;
- }
-
- function delete($actor_id)
- {
- $table = 'fm_' . $this->role;
- $this->db->query("DELETE FROM $table WHERE id=" .
intval($actor_id));
- }
- }
-
Deleted: trunk/property/inc/class.socategory.inc.php
===================================================================
--- trunk/property/inc/class.socategory.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.socategory.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,1771 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare 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.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_socategory
- {
- var $type;
- var $type_id;
- var $location_info = array();
-
- function __construct()
- {
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->custom =
createObject('property.custom_fields');
- $this->_db = & $GLOBALS['phpgw']->db;
- $this->_like = & $this->_db->like;
- $this->_join = & $this->_db->join;
- }
-
- function read($data, $filter)
- {
- $start = isset($data['start']) &&
$data['start'] ? $data['start']:0;
- $query =
isset($data['query'])?$data['query']:'';
- $sort = isset($data['sort']) && $data['sort']
? $data['sort']:'DESC';
- $order =
isset($data['order'])?$data['order']:'';
- $allrows =
isset($data['allrows'])?$data['allrows']:'';
-
- $values = array();
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return $values;
- }
-
-/*
- $valid_order = false;
-
- if($order)
- {
- if($this->location_info['id']['name'] != $order)
- {
-
- foreach ($this->location_info['fields']
as $field)
- {
- if($field['name'] == $order)
- {
- $valid_order = true;
- break;
- }
- }
- }
- else
- {
- $valid_order = true;
- }
-
- if(!$valid_order)
- {
-// $order = '';
- }
- }
-*/
- $_filter_array = array();
- $get_single = array();
- foreach ( $this->location_info['fields'] as $field )
- {
- if (isset($field['filter']) && $field['filter'])
- {
- if(isset($filter[$field['name']]) &&
$filter[$field['name']] && $field['type'] == 'multiple_select')
- {
- $_filter_array[] =
"{$field['name']} {$this->_like} '%,{$filter[$field['name']]},%'";
- }
- else if(isset($filter[$field['name']])
&& $filter[$field['name']])
- {
- $_filter_array[] =
"{$field['name']} = '{$filter[$field['name']]}'";
- }
- }
- if (isset($field['get_single']) &&
$field['get_single'])
- {
- $get_single[$field['name']] =
$field['get_single'];
- }
- }
-
- $uicols = array();
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
$this->location_info['id']['name'];
- $uicols['descr'][] = lang('id');
- $uicols['datatype'][] =
$this->location_info['id']['type'] == 'varchar' ? 'V' : 'I';
- $uicols['sortable'][] = true;
-
- foreach($this->location_info['fields'] as $field)
- {
- $uicols['input_type'][] =
isset($field['hidden']) && $field['hidden'] ? 'hidden' : 'text';
- $uicols['name'][] =
$field['name'];
- $uicols['descr'][] =
$field['descr'];
- $uicols['datatype'][] = 'V';
- $uicols['sortable'][] =
isset($field['sortable']) && $field['sortable'] ? true : false;
- }
-
-
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
- {
- $choice_table = 'phpgw_cust_choice';
- $attribute_table = 'phpgw_cust_attribute';
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
$this->location_info['acl_location']);
- $attribute_filter = " location_id =
{$location_id}";
-
- $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"]:'';
-
- $user_column_filter = '';
- if (isset($user_columns) AND
is_array($user_columns) AND $user_columns[0])
- {
- $user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$user_columns) .'))';
- }
-
- $this->_db->query("SELECT * FROM
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER
BY attrib_sort ASC");
-
- $i = count($uicols['name']);
- while ($this->_db->next_record())
- {
- $uicols['input_type'][] =
'text';
- $uicols['name'][]
= $this->_db->f('column_name');
- $uicols['descr'][]
= $this->_db->f('input_text');
- $uicols['statustext'][] =
$this->_db->f('statustext');
- $uicols['datatype'][$i] =
$this->_db->f('datatype');
- $uicols['attib_id'][$i] =
$this->_db->f('id');
- $cols_return_extra[]= array(
- 'name' =>
$this->_db->f('column_name'),
- 'datatype' =>
$this->_db->f('datatype'),
- 'attrib_id' =>
$this->_db->f('id')
- );
-
- $i++;
- }
- }
-
- $where = 'WHERE';
- $filtermethod = '';
- if(isset($this->location_info['check_grant']) &&
$this->location_info['check_grant'])
- {
- $filtermethod = "{$where} user_id =
{$this->account} OR public = 1";
- $where = 'AND';
- }
-
- if($_filter_array)
- {
- $filtermethod .= " $where " . implode(' AND ',
$_filter_array);
- $where = 'AND';
- }
-
- $this->uicols = $uicols;
-
- if ($order)
- {
- $ordermethod = " ORDER BY {$table}.{$order}
{$sort}";
- }
- else
- {
- $ordermethod = " ORDER BY
{$table}.{$this->location_info['id']['name']} ASC";
- }
-
- if($query)
- {
- if($this->location_info['id']['type']=='auto'
|| $this->location_info['id']['type']=='int')
- {
- $id_query = (int) $query;
- }
- else
- {
- $id_query = "'{$query}'";
- }
- $query = $this->_db->db_addslashes($query);
- $querymethod = " {$where }
({$table}.{$this->location_info['id']['name']} = {$id_query}";
-//_debug_array($filtermethod);
-//_debug_array($where);die();
-
- foreach($this->location_info['fields'] as
$field)
- {
- if($field['type'] == 'varchar')
- {
- $querymethod .= " OR
{$table}.{$field['name']} $this->_like '%$query%'";
- }
- $where = 'OR';
- }
- $querymethod .= ')';
-
- $_querymethod = array();
-
- $this->_db->query("SELECT * FROM
$attribute_table WHERE $attribute_filter AND search='1'",__LINE__,__FILE__);
-
- while ($this->_db->next_record())
- {
- if($this->_db->f('datatype')=='V' ||
$this->_db->f('datatype')=='email' || $this->_db->f('datatype')=='CH'):
- {
- $_querymethod[]= "$table." .
$this->_db->f('column_name') . " {$this->_like} '%{$query}%'";
- }
- elseif($this->_db->f('datatype')=='I'):
- {
- if(ctype_digit($query))
- {
- $_querymethod[]=
"$table." . $this->_db->f('column_name') . '=' . (int)$query;
- }
- }
- else:
- {
- $_querymethod[]= "$table." .
$this->_db->f('column_name') . " = '$query'";
- }
- endif;
- }
-
- if (isset($_querymethod) AND
is_array($_querymethod))
- {
- $querymethod .= " $where (" . implode
(' OR ',$_querymethod) . ')';
- }
-
- }
-
- $sql = "SELECT * FROM $table $filtermethod
$querymethod";
-
- $this->_db->query('SELECT count(*) as cnt ' .
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
- $this->_db->next_record();
- $this->total_records = $this->_db->f('cnt');
-
- if(!$allrows)
- {
- $this->_db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->_db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- $cols_return = $uicols['name'];
- $j=0;
-
- $dataset = array();
- while ($this->_db->next_record())
- {
- foreach($cols_return as $key => $field)
- {
- $dataset[$j][$field] = array
- (
- 'value' =>
$this->_db->f($field),
- 'datatype' =>
$uicols['datatype'][$key],
- 'attrib_id' =>
$uicols['attib_id'][$key]
- );
- }
- $j++;
- }
-
- $values = $this->custom->translate_value($dataset,
$location_id);
-
- if($get_single)
- {
- foreach($values as $set => &$entry)
- {
- foreach ($entry as $field => &$value)
- {
- foreach ($get_single as $key =>
$method)
- {
- if($field == $key)
- {
- switch ($method)
- {
- case
'get_user':
-
if($value)
-
{
-
$value = $GLOBALS['phpgw']->accounts->get($value)->__toString();
-
}
-
break;
- default:
- //
nothing
- }
- }
- }
- }
- }
- }
- return $values;
- }
-
-
- function get_location_info($type,$type_id)
- {
- $type_id = (int)$type_id;
- $this->type = $type;
- $this->type_id = $type_id;
-
- $info = array();
- switch($type)
- {
-//-------- ID type integer
- case 'part_of_town':
- $info = array
- (
- 'table'
=> 'fm_part_of_town',
- 'id'
=> array('name' => 'part_of_town_id', 'type' => 'int', 'descr' => lang('id')),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar',
- 'nullable'
=> false,
- 'size'
=> 20
- ),
- array
- (
- 'name'
=> 'district_id',
- 'descr'
=> lang('district'),
- 'type'
=> 'select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocategory.get_list',
-
'method_input' => array('type' => 'district', 'selected' => '##district_id##')
- )
- ),
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('part of town'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::location::town',
-/*
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
-*/
- 'check_grant' => false
- );
-
- break;
-
- case 'project_group':
- $info = array
- (
- 'table' => 'fm_project_group',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::project_group'
- );
- break;
- case 'dimb':
- $info = array
- (
- 'table' => 'fm_ecodimb',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('dimb'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_dimb'
- );
- break;
- case 'dimd':
- $info = array
- (
- 'table' => 'fm_ecodimd',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('dimd'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_dimd'
- );
- break;
- case 'tax':
- $info = array
- (
- 'table' => 'fm_ecomva',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_tax'
- );
- break;
- case 'voucher_cat':
- $info = array
- (
- 'table' =>
'fm_ecobilag_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::voucher_cats'
- );
- break;
- case 'voucher_type':
- $info = array
- (
- 'table' => 'fm_ecoart',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::voucher_type'
- );
- break;
- case 'tender_chapter':
- $info = array
- (
- 'table' => 'fm_chapter',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::tender'
- );
- break;
- case 'location':
-
- $this->_db->query("SELECT id FROM
fm_location_type WHERE id ={$type_id}",__LINE__,__FILE__);
-
- if($this->_db->next_record())
- {
- $info = array
- (
- 'table' =>
"fm_location{$type_id}_category",
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name'
=> 'descr',
-
'descr' => lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' =>
lang('edit'),
- 'add_msg' =>
lang('add'),
- 'name' => '',
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
"admin::property::location::location::category_{$type_id}"
- );
- }
- else
- {
- throw new
Exception(lang('ERROR: illegal type %1', $type_id));
- }
- break;
- case 'owner_cats':
- $info = array
- (
- 'table' => 'fm_owner_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::owner::owner_cats'
- );
- break;
- case 'tenant_cats':
- $info = array
- (
- 'table' => 'fm_tenant_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('tenant
category'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::tenant::tenant_cats'
- );
- break;
- case 'vendor_cats':
- $info = array
- (
- 'table' => 'fm_vendor_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('vendor
category'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::vendor::vendor_cats'
- );
- break;
- case 'vendor':
- $info = array
- (
- 'table'
=> 'fm_vendor',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'contact_phone',
- 'descr' =>
lang('contact phone'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name'
=> 'category',
- 'descr'
=> lang('category'),
- 'type'
=> 'select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'sortable'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocategory.get_list',
-
'method_input' => array('type' => 'vendor_cats', 'selected' =>
'##category##')
- )
- ),
- array
- (
- //FIXME
- 'name'
=> 'member_of',
- 'descr'
=> lang('member'),
- 'type'
=> 'multiple_select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'sortable'
=> false,
- 'hidden'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocommon.get_categories',
-
'method_input' => array('app' => 'property', 'acl_location' => '.vendor',
'selected' => '##member_of##')
- )
- ),
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' =>
lang('vendor'),
- 'acl_location' => '.vendor',
- 'menu_selection' =>
'property::invoice::vendor',
- 'default'
=> array
- (
- 'owner_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- // 'modified_date' =>
array('edit' => 'time()'),
- )
-
- );
- break;
- case 'district':
- $info = array
- (
- 'table' => 'fm_district',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' =>
lang('district'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::location::district'
- );
- break;
- case 'street':
- $info = array
- (
- 'table' => 'fm_streetaddress',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' =>
lang('streetaddress'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::location::street'
- );
- break;
- case 's_agreement':
- $info = array
- (
- 'table' =>
'fm_s_agreement_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::agreement::service_agree_cats'
- );
- break;
- case 'tenant_claim':
- $info = array
- (
- 'table' =>
'fm_tenant_claim_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::tenant::claims_cats'
- );
- break;
- case 'wo_hours':
- $info = array
- (
- 'table' =>
'fm_wo_hours_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::workorder_detail'
- );
- break;
- case 'r_condition_type':
- $info = array
- (
- 'table' =>
'fm_request_condition_type',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::request_condition'
- );
- break;
- case 'b_account':
- $info = array
- (
- 'table' =>
'fm_b_account_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('budget
account'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_cats'
- );
- break;
-//-------- ID type varchar
- case 'project_status':
- $info = array
- (
- 'table'
=> 'fm_project_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'approved',
- 'descr' =>
lang('approved'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'closed',
- 'descr' =>
lang('closed'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('project status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::project_status'
- );
- break;
- case 'workorder_status':
- $info = array
- (
- 'table'
=> 'fm_workorder_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'approved',
- 'descr' =>
lang('approved'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'in_progress',
- 'descr' =>
lang('In progress'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'delivered',
- 'descr' =>
lang('delivered'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'closed',
- 'descr' =>
lang('closed'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('workorder status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::workorder_status'
- );
- break;
- case 'request_status':
- $info = array
- (
- 'table'
=> 'fm_request_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('request status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::request_status'
- );
- break;
- case 'agreement_status':
- $info = array
- (
- 'table'
=> 'fm_agreement_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('agreement status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::agreement::agreement_status'
- );
- break;
- case 'building_part':
- $info = array
- (
- 'table'
=> 'fm_building_part',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('building part'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::building_part'
- );
- break;
- case 'document_status':
- $info = array
- (
- 'table'
=> 'fm_document_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('document status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::document_status'
- );
- break;
- case 'unit':
- $info = array
- (
- 'table'
=> 'fm_standard_unit',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit unit'),
- 'add_msg'
=> lang('add unit'),
- 'name'
=> lang('unit'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::unit'
- );
- break;
- case 'budget_account':
- $info = array
- (
- 'table'
=> 'fm_b_account',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar',
- 'nullable'
=> false,
- 'size'
=> 60,
- 'sortable'
=> true
- ),
- array
- (
- 'name'
=> 'category',
- 'descr'
=> lang('category'),
- 'type'
=> 'select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'sortable'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocategory.get_list',
-
'method_input' => array('type' => 'b_account', 'selected' =>
'##category##')//b_account_category
- )
- ),
- array
- (
- 'name'
=> 'mva',
- 'descr'
=> lang('tax code'),
- 'type'
=> 'int',
- 'nullable'
=> true,
- 'size'
=> 4,
- 'sortable'
=> true
- ),
- array
- (
- 'name'
=> 'responsible',
- 'descr'
=> lang('responsible'),
- 'type'
=> 'select',
- 'filter'
=> true,
- 'get_single'
=> 'get_user',
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocommon.get_user_list_right2',
-
'method_input' => array('selected' => '##responsible##', 'right' => 128,
'acl_location' => '.invoice')
- )
- ),
- array
- (
- 'name' =>
'active',
- 'descr' =>
lang('active'),
- 'type' =>
'checkbox',
- 'default' =>
'checked'
- ),
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('budget account'),
- 'acl_location' =>
'.b_account',
- 'menu_selection' =>
'property::invoice::budget_account',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
- 'check_grant' => false
- );
-
- break;
-
-//-------- ID type auto
- case 'order_dim1':
- $info = array
- (
- 'table'
=> 'fm_order_dim1',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' => 'num',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar',
- 'nullable' =>
false
- ),
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('order_dim1'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::order_dim1'
- );
- break;
- case 'branch':
- $info = array
- (
- 'table'
=> 'fm_branch',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' => 'num',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('branch'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::branch'
- );
-
- break;
- case 'key_location':
- $info = array
- (
- 'table'
=> 'fm_key_loc',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' => 'num',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('key location'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('branch'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::key_location'
- );
-
- break;
-
- case 'async':
- $info = array
- (
- 'table'
=> 'fm_async_method',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'data',
- 'descr' =>
lang('data'),
- 'type' => 'text'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('Async services'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::async'
- );
- break;
-
- case 'event_action':
-
- $info = array
- (
- 'table'
=> 'fm_event_action',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'action',
- 'descr' =>
lang('action'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'data',
- 'descr' =>
lang('data'),
- 'type' => 'text'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('event action'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::event_action',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- )
- );
-
- break;
-
- case 'ticket_status':
-
- $info = array
- (
- 'table'
=> 'fm_tts_status',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'sorting',
- 'descr' =>
lang('sorting'),
- 'type' =>
'integer',
- 'sortable'=>
true
- ),
- array
- (
- 'name' =>
'color',
- 'descr' =>
lang('color'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'approved',
- 'descr' =>
lang('approved'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'in_progress',
- 'descr' =>
lang('In progress'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'delivered',
- 'descr' =>
lang('delivered'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'closed',
- 'descr' =>
lang('closed'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('event action'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::ticket_status'
- );
- break;
- case 'pending_action_type':
- $info = array
- (
- 'table'
=> 'fm_action_pending_category',
- 'id'
=> array('name' => 'num', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('Pending action type'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::action_type'
- );
-
- break;
-
- case 'order_template':
-
- $info = array
- (
- 'table'
=> 'fm_order_template',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'content',
- 'descr' =>
lang('content'),
- 'type' => 'text'
- ),
- array
- (
- 'name' =>
'public',
- 'descr' =>
lang('public'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('order template'),
- 'acl_location' =>
'.ticket.order',
- 'menu_selection' =>
'property::helpdesk::order_template',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
- 'check_grant' => true
- );
-
- break;
-
- case 'responsibility_role':
-
- $info = array
- (
- 'table'
=> 'fm_responsibility_role',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'remark',
- 'descr' =>
lang('remark'),
- 'type' => 'text'
- ),
- array
- (
- 'name'
=> 'location',
- 'descr'
=> lang('location'),
- 'type'
=> 'select',
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'preferences.boadmin_acl.get_locations',
-
'method_input' => array('acl_app' => 'property', 'selected' =>
'##location##')
- )
- ),
- array
- (
- 'name'
=> 'responsibility_id',
- 'descr'
=> lang('responsibility'),
- 'type'
=> 'select',
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.boresponsible.get_responsibilities',
-
'method_input' => array('acl_app' => 'property', 'selected' =>
'##responsibility_id##')
- )
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('responsibility role'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::responsibility_role',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
- 'check_grant' => false
- );
-
- break;
-
- default:
- $receipt = array();
-
$receipt['error'][]=array('msg'=>lang('ERROR: illegal type %1', $type));
- phpgwapi_cache::session_set('phpgwapi',
'phpgw_messages', $receipt);
- // throw new Exception(lang('ERROR:
illegal type %1', $type));
- }
-
- $this->location_info = $info;
- return $info;
- }
-
- function read_single($data,$values = array())
- {
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return $values;
- }
-
- if($this->location_info['id']['type']=='auto' ||
$this->location_info['id']['type']=='int')
- {
- $id = (int) $data['id'];
- }
- else
- {
- $id = "'{$data['id']}'";
- }
-
- $sql = "SELECT * FROM $table WHERE
{$this->location_info['id']['name']} = {$id}";
-
- $this->_db->query($sql,__LINE__,__FILE__);
-
- if ($this->_db->next_record())
- {
- $values['id'] =
$this->_db->f($this->location_info['id']['name']);
-
- // FIXME - add field to $values['attributes']
- foreach($this->location_info['fields'] as
$field)
- {
- $values[$field['name']] =
$this->_db->f($field['name'], true);
- }
-
- if ( isset($values['attributes']) &&
is_array($values['attributes']) )
- {
- foreach ( $values['attributes'] as
&$attr )
- {
- $attr['value'] =
$this->_db->f($attr['column_name']);
- }
- }
- }
- return $values;
- }
-
-
- //deprecated
- function select_category_list($data)
- {
- return $this->get_entity_list($data);
- }
-
- function get_list($data)
- {
- $values = array();
-
- $this->get_location_info($data['type'],
$data['type_id']);
-
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return $values;
- }
-
- $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)
- {
- $fields[] = $field['name'];
- }
-
- // Add extra info to name
- if(isset($data['id_in_name']) && $data['id_in_name'])
- {
- $id_in_name = 'id';
- if (in_array($data['id_in_name'], $fields))
- {
- $id_in_name = $data['id_in_name'];
- }
- }
-
- $fields = implode(',', $fields);
-
- $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');
- if(!$name = $this->_db->f('name', true))
- {
- $name = $this->_db->f('descr', true);
- }
-
- if($_extra)
- {
- $name = "{$_extra} - {$name}";
- }
-
- $values[] = array
- (
- 'id' => $id,
- 'name' => $name
- );
- }
- return $values;
- }
-
- function add($data,$values_attribute)
- {
- $receipt = array();
-
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- $receipt['error'][] = array('msg' => lang('not
a valid type'));
- return $receipt;
- }
-
- if(isset($data['save']))
- {
- unset($data['save']);
- }
- if(isset($data['apply']))
- {
- unset($data['apply']);
- }
-
- foreach ( $this->location_info['fields'] as $field )
- {
- if (isset($field['filter']) && $field['filter'])
- {
- if(isset($data[$field['name']]) &&
$data[$field['name']] && $field['type'] == 'multiple_select')
- {
- $data[$field['name']] = ',' .
implode(',',$data[$field['name']]) . ',';
- }
- }
- }
-
- $cols = array();
- $vals = array();
-
- $data['descr'] =
$this->_db->db_addslashes($data['descr']);
-
- if(isset($data['extra']))
- {
- foreach ($data['extra'] as $input_name =>
$value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
- unset($data['extra']);
-
- foreach ($data as $input_name => $value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] =
$this->_db->db_addslashes($value);
- }
- }
-
- $data_attribute = $this->custom->prepare_for_db($table,
$values_attribute);
- if(isset($data_attribute['value_set']))
- {
- foreach($data_attribute['value_set'] as
$input_name => $value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
-
-
- if(isset($this->location_info['default']) &&
is_array($this->location_info['default']))
- {
- foreach ($this->location_info['default'] as
$field => $default)
- {
- if(isset($default['add']))
- {
- $cols[] = $field;
- eval('$vals[] = ' .
$default['add'] .';');
- }
- }
- }
-
- $this->_db->transaction_begin();
-
- if($this->location_info['id']['type']!='auto')
- {
- $this->_db->query("SELECT id FROM {$table}
WHERE {$this->location_info['id']['name']} =
'{$data['id']}'",__LINE__,__FILE__);
- if($this->_db->next_record())
- {
-
$receipt['error'][]=array('msg'=>lang('duplicate key value'));
-
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
- return $receipt;
- }
- $id = $data['id'];
- }
- else
- {
- $id = $this->_db->next_id($table);
- $cols[] = 'id';
- $vals[] = $id;
- }
-
- $cols = implode(",", $cols);
- $vals = $this->_db->validate_insert($vals);
-
- $this->_db->query("INSERT INTO {$table} ({$cols})
VALUES ({$vals})",__LINE__,__FILE__);
-
-/* if($this->location_info['id']['type']=='auto')
- {
- if(!$data['id'] =
$this->_db->get_last_insert_id($table, 'id'))
- {
- $this->_db->transaction_abort();
-
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
- }
- }
-*/
- $this->_db->transaction_commit();
- $receipt['id'] = $id;
- $receipt['message'][]=array('msg'=>lang('record has
been saved'));
- return $receipt;
- }
-
- function edit($data,$values_attribute)
- {
- $receipt = array();
-
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- $receipt['error'][] = array('msg' => lang('not
a valid type'));
- return $receipt;
- }
-
- $value_set = array();
-
- if(isset($data['extra']))
- {
- foreach ($data['extra'] as $input_name =>
$value)
- {
- $value_set[$input_name] = $value;
- }
- unset($data['extra']);
- }
-
- $data_attribute = $this->custom->prepare_for_db($table,
$values_attribute, $data['id']);
-
- if(isset($data_attribute['value_set']))
- {
- $value_set = array_merge($value_set,
$data_attribute['value_set']);
- }
- foreach($this->location_info['fields'] as $field)
- {
- if (isset($field['filter']) && $field['filter'])
- {
- if(isset($data[$field['name']]) &&
$data[$field['name']] && $field['type'] == 'multiple_select')
- {
- $data[$field['name']] = ',' .
implode(',',$data[$field['name']]) . ',';
- }
- }
-
- $value_set[$field['name']] =
$this->_db->db_addslashes($data[$field['name']]);
- }
-
- if(isset($this->location_info['default']) &&
is_array($this->location_info['default']))
- {
- foreach ($this->location_info['default'] as
$field => $default)
- {
- if(isset($default['edit']))
- {
- eval('$value_set[$field] = ' .
$default['edit'] .';');
- }
- }
- }
-
- $value_set =
$this->_db->validate_update($value_set);
- $this->_db->transaction_begin();
- $this->_db->query("UPDATE $table SET {$value_set} WHERE
{$this->location_info['id']['name']}='" . $data['id']. "'",__LINE__,__FILE__);
-
-/* //FIXME
- if (isset($data_attribute['history_set']) &&
is_array($data_attribute['history_set']))
- {
- $historylog =
CreateObject('phpgwapi.historylog','property',
$this->location_info['acl_location']);
- foreach ($data_attribute['history_set'] as
$attrib_id => $history)
- {
-
$historylog->add('SO',$data['id'],$history['value'],false,
$attrib_id,$history['date']);
- }
- }
-*/
- $this->_db->transaction_commit();
-
- $receipt['id'] = $data['id'];
-
- $receipt['message'][]=array('msg'=>lang('record has
been edited'));
- return $receipt;
- }
-
- function delete($id)
- {
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return false;
- }
- $this->_db->query("DELETE FROM $table WHERE
{$this->location_info['id']['name']}='{$id}'",__LINE__,__FILE__);
- }
- }
-
Deleted: trunk/property/inc/class.uiactor.inc.php
===================================================================
--- trunk/property/inc/class.uiactor.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.uiactor.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,962 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare 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.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- phpgw::import_class('phpgwapi.yui');
-
- /**
- * uiactor class
- *
- * uiactor is the ui-class for three set of actors, separarated by
their roles:
- * - Tenant
- * - Vendor
- * - Owner
- * @package property
- */
-
- class property_uiactor
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => true,
- 'view' => true,
- 'edit' => true,
- 'delete' => true,
- 'columns' => true,
- 'download' => true
- );
-
- function __construct()
- {
- $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; //
menus added where needed via bocommon::get_menu
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject('property.boactor',true);
- $this->bocommon = & $this->bo->bocommon;
-
- $this->role =
$this->bo->role;
-
- $this->cats =
CreateObject('phpgwapi.categories', -1, 'property', ".{$this->role}");
-
- $this->acl = &
$GLOBALS['phpgw']->acl;
- $this->acl_location = '.' . $this->role;
-
- $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
- $this->acl_add =
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
- $this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
- $this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
- $this->acl_manage =
$this->acl->check($this->acl_location, 16, 'property');
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
- $this->allrows = $this->bo->allrows;
- $this->member_id = $this->bo->member_id;
-
- if( !$this->bo->check_valid_role($this->role) )
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.index'));
- }
-
- if (phpgw::get_var('admin', 'bool'))
- {
-
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::property::{$this->role}";
- }
- else
- {
-
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"property::invoice::{$this->role}";
- }
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'allrows' => $this->allrows,
- 'member_id' => $this->member_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function columns()
- {
-
- //cramirez: necesary for windows.open . Avoid error JS
- phpgwapi_yui::load_widget('tabview');
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
- $GLOBALS['phpgw_info']['flags']['noframework'] = true;
- $values = phpgw::get_var('values');
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->preferences->account_id=$this->account;
- $GLOBALS['phpgw']->preferences->read();
-
$GLOBALS['phpgw']->preferences->add('property','actor_columns_'
.$this->role,$values['columns'],'user');
-
$GLOBALS['phpgw']->preferences->save_repository();
-
- $receipt['message'][] = array('msg' =>
lang('columns is updated'));
- }
-
- $function_msg = lang('Select Column');
-
- $link_data = array
- (
- 'menuaction' => 'property.uiactor.columns',
- 'role' => $this->role
- );
-
- $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' =>
$GLOBALS['phpgw']->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;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function download()
- {
- $list = $this->bo->read();
- $uicols = $this->bo->uicols;
-
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
- function index()
- {
- $menu_sub = array(
- 'tenant'=>'invoice',
- 'owner' =>'admin',
- 'vendor'=>'invoice'
- );
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
- }
-
- $lookup = ''; //Fix this
-
- $datatable = array();
- $values_combo_box = array();
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt_' .
$this->role);
-
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt_' .
$this->role,'');
-
-
- if( phpgw::get_var('phpgw_return_as') != 'json' )
- {
-
- if(!$lookup)
- {
- $datatable['menu'] =
$this->bocommon->get_menu();
- }
-
- $datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
- (
- 'menuaction'=>
'property.uiactor.index',
-
'lookup' => $lookup,
-
'cat_id' =>$this->cat_id,
- 'query'
=>$this->query,
- 'role'
=> $this->role,
-
'member_id' => $this->member_id
-
- ));
- $datatable['config']['allow_allrows'] = true;
-
- $datatable['config']['base_java_url'] =
"menuaction:'property.uiactor.index',"
-
-
."lookup:'{$lookup}',"
-
."query:'{$this->query}',"
-
."cat_id:'{$this->cat_id}',"
-
."role:'{$this->role}',"
-
."member_id:'{$this->member_id}'";
- //die(_debug_array($datatable));
-
- $values_combo_box[0] =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> true));
- $default_value = array
('cat_id'=>'','name'=>lang('no member'));
- array_unshift
($values_combo_box[0]['cat_list'],$default_value);
-
- $values_combo_box[1] =
$this->bocommon->select_category_list(array('format'=>'filter','selected' =>
$this->cat_id,'type' => "{$this->role}_cats",'order'=>'descr'));
- $default_value = array ('id'=>'','name'=>
lang('no category'));
- array_unshift
($values_combo_box[1],$default_value);
-
- $datatable['actions']['form'] = array(
- array(
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
- array(
-
'menuaction' => 'property.uiactor.index',
-
'lookup' => $lookup,
-
'cat_id' => $this->cat_id,
- 'query'
=> $this->query,
- 'role'
=> $this->role,
-
'member_id' => $this->member_id
- )
- ),
- 'fields' => array(
- 'field' => array(
- array(
- 'id' =>
'btn_member_id',
- 'name' =>
'member_id',
- 'value'
=> lang('Member'),
- 'type' =>
'button',
- 'style' =>
'filter',
- 'tab_index'
=> 1
- ),
- array(
- 'id' =>
'btn_cat_id',
- 'name' =>
'cat_id',
- 'value'
=> lang('Category'),
- 'type' =>
'button',
- 'style' =>
'filter',
- 'tab_index'
=> 2
- ),
-
array(
-
'type'=> 'link',
-
'id' => 'btn_columns',
-
'url' =>
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
-
array(
-
'menuaction' => 'property.uiactor.columns',
-
'role' => $this->role
-
))."','','width=350,height=370')",
-
'value' => lang('columns'),
-
'tab_index' => 7
-
),
-
array
-
(
-
'type' => 'button',
-
'id' => 'btn_export',
-
'value' => lang('download'),
-
'tab_index' => 6
-
),
-
array(
-
'type' => 'button',
-
'id' => 'btn_new',
-
'value' => lang('add'),
-
'tab_index' => 5
- ),
- array( //boton
SEARCH
- 'id' =>
'btn_search',
- 'name' =>
'search',
- 'value'
=> lang('search'),
- 'type' =>
'button',
- 'tab_index'
=> 4
- ),
-
array( // TEXT IMPUT
- 'name'
=> 'query',
- 'id' =>
'txt_query',
- 'value'
=> '',//$query,
- 'type' =>
'text',
-
'onkeypress' => 'return pulsar(event)',
- 'size'
=> 28,
- 'tab_index'
=> 3
- )
- ),
- 'hidden_value' => array(
-
array( //div values combo_box_0
-
'id' => 'values_combo_box_0',
-
'value' =>
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id')
//i.e. id,value/id,vale/
-
),
-
array( //div values combo_box_1
-
'id' => 'values_combo_box_1',
-
'value' =>
$this->bocommon->select2String($values_combo_box[1])
-
)
-
)
-
)
-
)
- );
-
- if($this->role == 'tenant')
- {
-
unset($datatable['actions']['form'][0]['fields']['field'][0]);
- }
-
- if(!$this->acl_add)
- {
-
unset($datatable['actions']['form'][0]['fields']['field'][3]);
- }
- }
-
- $actor_list = array();
- $actor_list = $this->bo->read();
-
- $uicols = $this->bo->uicols;
-
- $j=0;
- if (isset($actor_list) && is_array($actor_list))
- {
- foreach($actor_list as $actor)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
if(isset($actor['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'] =
$actor[$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']
= $actor['query_location'][$uicols['name'][$i]];
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$actor[$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' && $actor[$uicols['name'][$i]])
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = lang('link');
-
$datatable['rows']['row'][$j]['column'][$i]['link'] =
$actor[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
- }
- }
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$actor[$uicols['name'][$i]];
- }
-
-
$datatable['rows']['row'][$j]['hidden'][$i]['value'] =
$actor[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['hidden'][$i]['name'] =
$uicols['name'][$i];
- }
-
- $j++;
- }
- }
-
- // NO pop-up
- $datatable['rowactions']['action'] = array();
- if(!$lookup)
- {
- $parameters = array
- (
- 'parameter' => array
- (
- array
- (
- 'name' =>
'actor_id',
- 'source' => 'id'
- )
- )
- );
-
- if($this->acl_read)
- {
- $datatable['rowactions']['action'][] =
array(
- 'my_name'
=> 'view',
- 'text' =>
lang('view'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
-
(
-
'menuaction' => 'property.uiactor.view',
-
'role' => $this->role
-
)),
- '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.uiactor.view',
-
'role' => $this->role,
-
'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($this->acl_edit)
- {
- $datatable['rowactions']['action'][] =
array(
- 'my_name'
=> 'edit',
- 'text' =>
lang('edit'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
-
(
-
'menuaction' => 'property.uiactor.edit',
-
'role' => $this->role
-
)),
- '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.uiactor.edit',
-
'role' => $this->role,
-
'target' => '_blank'
-
)),
- 'parameters' => $parameters
- );
- }
- 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.uiactor.delete',
-
'role' => $this->role
-
)),
- '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.uiactor.edit',
-
'role' => $this->role
-
))
- );
- }
- unset($parameters);
- }
-
- $uicols_count = count($uicols['descr']);
-
- for ($i=0;$i<$uicols_count;$i++)
- {
-
- //all colums should be have formatter
-
$datatable['headers']['header'][$i]['formatter'] =
($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(isset($uicols['datatype'][$i]) &&
$uicols['datatype'][$i]!='T' && $uicols['datatype'][$i]!='CH')
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
- }
- }
- else
- {
-
$datatable['headers']['header'][$i]['name'] = 'id2';
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = false;
-
$datatable['headers']['header'][$i]['sortable'] = false;
-
$datatable['headers']['header'][$i]['format'] = 'hidden';
- }
- }
-
- // 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->bo->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $datatable['pagination']['records_returned'] =
count($actor_list);
- $datatable['pagination']['records_total'] =
$this->bo->total_records;
-
- //$datatable['sorting']['order'] =
phpgw::get_var('order', 'string'); // Column
- //$datatable['sorting']['sort'] =
phpgw::get_var('sort', 'string'); // ASC / DESC
-
- if($this->role == 'tenant')
- {
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
- {
- $datatable['sorting']['order']
= 'first_name'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'asc'; // ASC / DESC
- }
- else
- {
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
- }
- }
- else
- {
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
- {
- $datatable['sorting']['order']
= 'org_name'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'asc'; // ASC / DESC
- }
- else
- {
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
- }
- }
-
- 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');
-
-//-- BEGIN----------------------------- JSON CODE
------------------------------
-
- //values for Pagination
- $json = array
- (
- 'recordsReturned' =>
$datatable['pagination']['records_returned'],
- 'totalRecords' =>
(int)$datatable['pagination']['records_total'],
- 'startIndex' =>
$datatable['pagination']['records_start'],
- 'sort' =>
$datatable['sorting']['order'],
- 'dir' =>
$datatable['sorting']['sort'],
- 'records' =>
array()
- );
-
- // values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
- foreach( $datatable['rows']['row'] as $row )
- {
- $json_row = array();
- foreach( $row['column'] as $column)
- {
- if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
- {
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
- }
- elseif(isset($column['format'])
&& $column['format']== "link")
- {
- $json_row[$column['name']] =
"<a href='".$column['link']."'>" .$column['value']."</a>";
- }else
- {
- $json_row[$column['name']] =
$column['value'];
- }
- }
- $json['records'][] = $json_row;
- }
- }
-
- // right in datatable
- if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
- {
- $json ['rights'] =
$datatable['rowactions']['action'];
- }
-
- if( phpgw::get_var('phpgw_return_as') == 'json'
)
- {
- return $json;
- }
-
-
- $datatable['json_data'] = json_encode($json);
-//-------------------- JSON CODE ----------------------
-
-
- // 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 ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
- {
- $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
- }
- // Prepare CSS Style
- $GLOBALS['phpgw']->css->validate_file('datatable');
- $GLOBALS['phpgw']->css->validate_file('property');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$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');
-
- //Title of Page
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . lang('list ' . $this->role);
-
- // Prepare YUI Library
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'actor.index', 'property' );
-
- //$this->save_sessiondata();
- }
-
- function edit()
- {
-
- if(!$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
- }
-
- $actor_id = phpgw::get_var('actor_id', 'int');
- $values = phpgw::get_var('values');
- $values_attribute = phpgw::get_var('values_attribute');
-
- $insert_record_actor =
$GLOBALS['phpgw']->session->appsession('insert_record_values.' .
$this->role,'property');
-
-//_debug_array($insert_record_actor);
-//_debug_array($values_attribute);
- for ($j=0;$j<count($insert_record_actor);$j++)
- {
-
$insert_record['extra'][$insert_record_actor[$j]] =
$insert_record_actor[$j];
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','attributes_form'));
- $receipt = array();
-
- if (is_array($values))
- {
- if(isset($insert_record) &&
is_array($insert_record))
- {
- foreach ($insert_record['extra'] as
$key => $column)
- {
- if($_POST[$key])
- {
-
$values['extra'][$column] = phpgw::get_var($key, 'string', 'POST');
- }
- }
- }
-
-//_debug_array($values);
-
- if ((isset($values['save']) && $values['save'])
|| (isset($values['apply']) && $values['apply']))
- {
-
-
if($GLOBALS['phpgw']->session->is_repost())
- {
-
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
- }
-
- if(!isset($values['cat_id']) ||
!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
- if(!$values['last_name'])
- {
-//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
- }
-
- if(isset($values_attribute) &&
is_array($values_attribute))
- {
- foreach ($values_attribute as
$attribute )
- {
-
if($attribute['nullable'] != 1 && !$attribute['value'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1',
$attribute['input_text']));
- }
- }
- }
-
- if(!isset($receipt['error']) ||
!$receipt['error'])
- {
- $values['actor_id'] =
$actor_id;
- $receipt =
$this->bo->save($values,$values_attribute);
- $actor_id =
$receipt['actor_id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if (isset($values['save']) &&
$values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt_' .
$this->role,$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiactor.index', 'role'=> $this->role));
- }
- }
- }
- else
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiactor.index', 'role'=> $this->role));
- }
- }
-
-
- $values =
$this->bo->read_single(array('actor_id'=>$actor_id));
-
- /* Preserve attribute values from post */
- if(isset($receipt['error']) && (isset(
$values_attribute) && is_array( $values_attribute)))
- {
- $values =
$this->bo->preserve_attribute_values($values,$values_attribute);
- }
-
- if ($actor_id)
- {
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
- $this->member_id =
($values['member_of']?$values['member_of']:$this->member_id);
- }
-
- $link_data = array
- (
- 'menuaction' => 'property.uiactor.edit',
- 'actor_id' => $actor_id,
- 'role' => $this->role
- );
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> true, 'link_data' =>array()));
-
- $tabs = array();
-
- if (isset($values['attributes']) &&
is_array($values['attributes']))
- {
- foreach ($values['attributes'] as & $attribute)
- {
- if($attribute['history'] == true)
- {
- $link_history_data = array
- (
- 'menuaction' =>
'property.uiactor.attrib_history',
- 'attrib_id' =>
$attribute['id'],
- 'actor_id' =>
$actor_id,
- 'role' =>
$this->role,
- 'edit' => true
- );
-
- $attribute['link_history'] =
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
- }
- }
-
-
phpgwapi_yui::tabview_setup('actor_edit_tabview');
- $tabs['general'] = array('label' =>
lang('general'), 'link' => '#general');
-
- $location = $this->acl_location;
- $attributes_groups =
$this->bo->get_attribute_groups($location, $values['attributes']);
-
- $attributes = array();
- foreach ($attributes_groups as $group)
- {
- if(isset($group['attributes']))
- {
- $tabs[str_replace(' ', '_',
$group['name'])] = array('label' => $group['name'], 'link' => '#' .
str_replace(' ', '_', $group['name']));
- $group['link'] = str_replace('
', '_', $group['name']);
- $attributes[] = $group;
- }
- }
- unset($attributes_groups);
- unset($values['attributes']);
- }
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_actor_id'
=> lang($this->role) . ' ID',
- 'value_actor_id'
=> $actor_id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- // 'value_cat'
=> $values['cat'],
- 'lang_id_statustext' =>
lang('Choose an ID'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the actor untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the actor and return back to the list'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the actor belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=>
$this->bocommon->select_category_list(array('format'=>'select','selected' =>
$this->cat_id,'type' => "{$this->role}_cats",'order'=>'descr')),
-
- 'lang_member_of'
=> lang('member of'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_group'
=> $attributes,
- 'lookup_functions'
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
- 'dateformat'
=> $dateformat,
- 'lang_edit'
=> lang('edit'),
- 'lang_add'
=> lang('add'),
- 'textareacols' =>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
- 'textarearows' =>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
- 'tabs'
=> phpgwapi_yui::tabview_generate($tabs, 'general')
- );
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . ($actor_id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- }
-
-
- function delete()
- {
-
- $actor_id = phpgw::get_var('actor_id', 'int');
-
- //cramirez add JsonCod for Delete
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- $this->bo->delete($actor_id);
- return "actor_id ".$actor_id." ".lang("has been
deleted");
- }
-
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
- }
-
- $confirm = phpgw::get_var('confirm', 'bool',
'POST');
-
- $link_data = array
- (
- 'menuaction' => 'property.uiactor.index',
- 'role' => $this->role
- );
-
- if (phpgw::get_var('confirm', 'bool', 'POST'))
- {
- $this->bo->delete($actor_id);
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiactor.delete', 'actor_id'=> $actor_id, 'role'=> $this->role)),
- 'lang_confirm_msg' => lang('do you really
want to delete this entry'),
- 'lang_yes' => lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' => lang('no')
- );
-
- $appname = lang('actor');
- $function_msg = lang('delete') . ' ' .
lang($this->role);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
- }
-
- $actor_id = phpgw::get_var('actor_id', 'int');
- $action = phpgw::get_var('action');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . lang('view') . ' ' . lang($this->role);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','attributes_view'));
-
- $actor =
$this->bo->read_single(array('actor_id'=>$actor_id, 'view'=>true));
-
- $attributes_values=$actor['attributes'];
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' =>
$actor['member_of'],'globals' => true, 'link_data' =>array()));
-
- $data = array
- (
- 'lang_actor_id' =>
lang($this->role) . ' ID',
- 'value_actor_id' =>
$actor_id,
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiactor.index', 'role'=> $this->role)),
- 'lang_category' =>
lang('category'),
- 'lang_time_created' =>
lang('time created'),
- 'lang_done' =>
lang('done'),
- 'cat_list' =>
$this->bocommon->select_category_list(array('format'=>'select','selected' =>
$actor['cat_id'],'type' => "{$this->role}_cats",'order'=>'descr')),
-
- 'lang_member_of' =>
lang('member of'),
- 'member_of_list' =>
$member_of_data['cat_list'],
-
- 'value_date' =>
$GLOBALS['phpgw']->common->show_date($actor['entry_date']),
- 'lang_dateformat' =>
lang(strtolower($dateformat)),
- 'lang_attributes' =>
lang('Attributes'),
- 'attributes_view' =>
$attributes_values,
- 'dateformat' =>
$dateformat,
- 'textareacols' =>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
- 'textarearows' =>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-
Deleted: trunk/property/inc/class.uicategory.inc.php
===================================================================
--- trunk/property/inc/class.uicategory.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.uicategory.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,815 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare 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.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
- phpgw::import_class('phpgwapi.yui');
-
- /**
- * Description
- * @package property
- */
-
- class property_uicategory
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
- var $location_info;
-
- var $public_functions = array
- (
- 'index' => true,
- 'view' => true,
- 'edit' => true,
- 'delete' => true,
- 'download' => true,
- 'columns' => true,
- );
-
- function __construct()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject('property.bocategory',true);
- $this->bocommon = &
$this->bo->bocommon;
- $this->custom = &
$this->bo->custom;
-
- $this->location_info =
$this->bo->location_info;
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
$this->location_info['menu_selection'];
- $this->acl = &
$GLOBALS['phpgw']->acl;
- $this->acl_location =
$this->location_info['acl_location'];
- $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
- $this->acl_add =
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
- $this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
- $this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
- $this->acl_manage =
$this->acl->check($this->acl_location, 16, 'property');
-
- $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;
- }
-
- function save_sessiondata($type)
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows,
- 'type' => $type
- );
- $this->bo->save_sessiondata($data);
- }
-
- function download()
- {
- $list = $this->bo->read();
- $uicols = $this->bo->uicols;
-
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
- function columns()
- {
-
- //cramirez: necesary for windows.open . Avoid error JS
- phpgwapi_yui::load_widget('tabview');
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
- $GLOBALS['phpgw_info']['flags']['noframework'] = true;
- $values = phpgw::get_var('values');
-
- $type = phpgw::get_var('type');
- $type_id = phpgw::get_var('type_id', 'int');
-
- if ($values['save'])
- {
- $GLOBALS['phpgw']->preferences->account_id =
$this->account;
- $GLOBALS['phpgw']->preferences->read();
-
$GLOBALS['phpgw']->preferences->add('property',"generic_columns_{$type}_{$type_id}",$values['columns'],'user');
-
$GLOBALS['phpgw']->preferences->save_repository();
-
- $receipt['message'][] = array('msg' =>
lang('columns is updated'));
- }
-
- $function_msg = lang('Select Column');
-
- $link_data = array
- (
- 'menuaction' => 'property.uicategory.columns',
- 'type' => $type,
- 'type_id' => $type_id
-
- );
-
- $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' =>
$GLOBALS['phpgw']->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;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
- }
-
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
- }
-
- $type = phpgw::get_var('type');
- $type_id = phpgw::get_var('type_id', 'int');
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data',
"general_receipt_{$type}_{$type_id}");
- $this->save_sessiondata($type);
-
- $GLOBALS['phpgw_info']['apps']['manual']['section'] =
"general.index.{$type}";
-
- $datatable = array();
-
- if( phpgw::get_var('phpgw_return_as') != 'json' )
- {
- $datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
- (
- 'menuaction' => 'property.uicategory.index',
- 'type' => $type,
- 'type_id' => $type_id
- ));
-
- $datatable['config']['base_java_url'] =
"menuaction:'property.uicategory.index',"
-
."type:'{$type}',"
-
."type_id:'{$type_id}'";
-
- $link_data = array
- (
- 'menuaction' =>
'property.uicategory.index',
- 'type' => $type,
- 'type_id' => $type_id
- );
-
-
- $datatable['config']['allow_allrows'] = true;
-
- $datatable['actions']['form'] = array
- (
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
- array
- (
-
'menuaction' => 'property.uicategory.index',
- 'type'
=> $type,
-
'type_id' => $type_id
- )
- ),
- 'fields' => array
- (
- 'field' => array
- (
- array
- (
- 'type'
=> 'button',
- 'id'
=> 'btn_export',
- 'value'
=> lang('download'),
-
'tab_index' => 10
- ),
- array
- (
- 'type'
=> 'button',
- 'id'
=> 'btn_done',
- 'value'
=> lang('done'),
-
'tab_index' => 9
- ),
- array
- (
- 'type'
=> 'button',
- 'id'
=> 'btn_new',
- 'value'
=> lang('add'),
-
'tab_index' => 8
- ),
- array
- ( //button
SEARCH
- 'id' =>
'btn_search',
- 'name'
=> 'search',
- 'value'
=> lang('search'),
- 'type'
=> 'button',
-
'tab_index' => 7
- ),
- array
- ( // TEXT INPUT
- 'name'
=> 'query',
- 'id'
=> 'txt_query',
- 'value'
=> $this->query,
- 'type'
=> 'text',
-
'onkeypress' => 'return pulsar(event)',
- 'size'
=> 28,
-
'tab_index' => 6
- )
- )
- )
- )
- );
-
-
-
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
- {
-
$datatable['actions']['form'][0]['fields']['field'][] = array(
-
'type'=> 'link',
-
'id' => 'btn_columns',
-
'url' =>
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
-
array(
-
'menuaction' =>
'property.uicategory.columns',
-
'type' => $type,
-
'type_id' => $type_id
-
))."','','width=350,height=370')",
-
'value' => lang('columns'),
-
'tab_index' => 7
-
);
- }
-
- $values_combo_box = array();
- $i = 0;
- $button_def = array();
- $code_inner = array();
- foreach ( $this->location_info['fields'] as
$field )
- {
- if (isset($field['filter']) &&
$field['filter'])
- {
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'id' =>
"btn_{$field['name']}",
- 'name' =>
$field['name'],
- 'value' =>
$field['descr'],
- 'type' => 'button',
- 'style' => 'filter',
- 'tab_index' => $i
- );
-
- $button_def[] =
"oMenuButton_{$i}";
- $code_inner[] = "{order:{$i},
var_URL:'{$field['name']}',name:'btn_{$field['name']}',style:'categorybutton',dependiente:[]}";
-
-
if($field['values_def']['valueset'])
- {
- $values_combo_box[] =
$field['values_def']['valueset'];
- // TODO find selected
value
- }
- else
if(isset($field['values_def']['method']))
- {
-
foreach($field['values_def']['method_input'] as $_argument => $_argument_value)
- {
-
if(preg_match('/^##/', $_argument_value))
- {
-
$_argument_value_name = trim($_argument_value,'#');
-
$_argument_value = $values[$_argument_value_name];
- }
-
$method_input[$_argument] = $_argument_value;
- }
-
- $values_combo_box[] =
execMethod($field['values_def']['method'],$method_input);
- }
- $default_value = array
('id'=>'','name'=> lang('select') . ' ' . $field['descr']);
- array_unshift
($values_combo_box[$i],$default_value);
- $i++;
- }
- }
- $code = '';
- if($button_def)
- {
- $code = 'var ' . implode(',',
$button_def) . ";\n";
- $code .= 'var selectsButtons = [' .
"\n" . implode(",\n",$code_inner) . "\n];";
- $GLOBALS['phpgw']->js->add_code('',
$code);
- }
-
- if($values_combo_box)
- {
- $i = 0;
- foreach ( $values_combo_box as $combo )
- {
-
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
- (
- 'id' =>
"values_combo_box_{$i}",
- 'value' =>
$this->bocommon->select2String($combo)
- );
- $i++;
- }
- }
-
-// $dry_run = true;
- }
-
- $values = $this->bo->read();
- $uicols = $this->bo->uicols;
-
- $j = 0;
- $count_uicols_name = count($uicols['name']);
-
- if (isset($values) AND is_array($values))
- {
- foreach($values as $category_entry)
- {
- for ($k=0;$k<$count_uicols_name;$k++)
- {
-
if($uicols['input_type'][$k]!='hidden')
- {
-
$datatable['rows']['row'][$j]['column'][$k]['name'] =
$uicols['name'][$k];
-
$datatable['rows']['row'][$j]['column'][$k]['value'] =
$category_entry[$uicols['name'][$k]];
- }
- }
- $j++;
- }
- }
-
- $datatable['rowactions']['action'] = array();
-
- $parameters = array
- (
- 'parameter' => array
- (
- array
- (
- 'name' =>
$this->location_info['id']['name'],
- 'source' =>
$this->location_info['id']['name']
- ),
- )
- );
-
- if($this->acl_edit)
- {
- $datatable['rowactions']['action'][] = array
- (
- 'my_name' => 'edit',
- 'statustext' => lang('edit the
actor'),
- 'text' => lang('edit'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
-
(
-
'menuaction' => 'property.uicategory.edit',
-
'type' => $type,
-
'type_id' => $type_id
-
)),
- '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.uicategory.edit',
-
'type' => $type,
-
'type_id' => $type_id,
-
'target' => '_blank'
-
)),
- 'parameters' => $parameters
- );
- }
-
- if($this->acl_delete)
- {
- $datatable['rowactions']['action'][] = array
- (
- 'my_name' => 'delete',
- 'statustext' => lang('delete the
actor'),
- 'text' =>
lang('delete'),
- 'confirm_msg' => lang('do you really
want to delete this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
-
(
-
'menuaction' => 'property.uicategory.delete',
-
'type' => $type,
-
'type_id' => $type_id
-
)),
- 'parameters' => $parameters
- );
- }
- unset($parameters);
-
- if($this->acl_add)
- {
- $datatable['rowactions']['action'][] = array
- (
- 'my_name' =>
'add',
- 'statustext' => lang('add'),
- 'text' => lang('add'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
-
(
-
'menuaction' => 'property.uicategory.edit',
-
'type' => $type,
-
'type_id' => $type_id
-
))
- );
- }
-
- for ($i=0;$i<$count_uicols_name;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
-
$datatable['headers']['header'][$i]['formatter'] =
($uicols['formatter'][$i]==''? '""' : $uicols['formatter'][$i]);
-
$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]['sortable'] =
$uicols['sortable'][$i];
-
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
- }
- }
-
- //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->bo->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $datatable['pagination']['records_returned']=
count($values);
- $datatable['pagination']['records_total'] =
$this->bo->total_records;
-
- $appname =
$this->location_info['name'];
- $function_msg = lang('list %1', $appname);
-
- if ( ($this->start == 0) && (!$this->order))
- {
- $datatable['sorting']['order']
= $this->location_info['id']['name']; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'asc'; // ASC / DESC
- }
- else
- {
- $datatable['sorting']['order']
= $this->order; // name of column of Database
- $datatable['sorting']['sort']
= $this->sort; // ASC / DESC
- }
-
- phpgwapi_yui::load_widget('dragdrop');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('menu');
- phpgwapi_yui::load_widget('connection');
- phpgwapi_yui::load_widget('loader');
- phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::load_widget('paginator');
- phpgwapi_yui::load_widget('animation');
-
- //-- BEGIN----------------------------- JSON CODE
------------------------------
- //values for Pagination
- $json = array
- (
- 'recordsReturned' =>
$datatable['pagination']['records_returned'],
- 'totalRecords' =>
(int)$datatable['pagination']['records_total'],
- 'startIndex' =>
$datatable['pagination']['records_start'],
- 'sort' =>
$datatable['sorting']['order'],
- 'dir' =>
$datatable['sorting']['sort'],
- 'records' =>
array()
- );
-
- // values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
- foreach( $datatable['rows']['row'] as $row )
- {
- $json_row = array();
- foreach( $row['column'] as $column)
- {
- if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
- {
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
- }
- elseif(isset($column['format'])
&& $column['format']== "link")
- {
- $json_row[$column['name']] =
"<a href='".$column['link']."'>" .$column['value']."</a>";
- }else
- {
- $json_row[$column['name']] =
$column['value'];
- }
- }
- $json['records'][] = $json_row;
- }
- }
-
- // right in datatable
- if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
- {
- $json ['rights'] =
$datatable['rowactions']['action'];
- }
-
- if( phpgw::get_var('phpgw_return_as') == 'json'
)
- {
- return $json;
- }
-
-
- $datatable['json_data'] = json_encode($json);
- //-------------------- JSON CODE ----------------------
-
- $template_vars = array();
- $template_vars['datatable'] = $datatable;
-
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
-
- if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
- {
- $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
- }
-
- $GLOBALS['phpgw']->css->validate_file('datatable');
- $GLOBALS['phpgw']->css->validate_file('property');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . "::{$appname}::{$function_msg}";
-
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'category.index', 'property' );
- }
-
- function edit()
- {
- if(!$this->acl_add)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
- }
-
- $type = phpgw::get_var('type');
- $type_id = phpgw::get_var('type_id', 'int');
- $id =
phpgw::get_var($this->location_info['id']['name']);
- $values = phpgw::get_var('values');
-
- $values_attribute = phpgw::get_var('values_attribute');
-
- $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'general.edit.' . $type;
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('category','attributes_form'));
- $receipt = array();
-
- if (is_array($values))
- {
- $insert_record_values =
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
-
- if(is_array($insert_record_values))
- {
- foreach($insert_record_values as $field)
- {
- $values['extra'][$field] =
phpgw::get_var($field);
- }
- }
-
- if ((isset($values['save']) && $values['save'])
|| (isset($values['apply']) && $values['apply']))
- {
-
if($GLOBALS['phpgw']->session->is_repost())
- {
-
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
- }
-
- if(!$id &&
!$values[$this->location_info['id']['name']] &&
$this->location_info['id']['type'] !='auto')
- {
-
$receipt['error'][]=array('msg'=>lang('missing value for %1', lang('id')));
- }
-
- foreach (
$this->location_info['fields'] as $field_info )
- {
- if
(isset($field_info['nullable']) && $field_info['nullable'] != true)
- {
- if(
!$values[$field_info['name']] )
- {
-
$receipt['error'][]=array('msg'=>lang('missing value for %1',
$field_info['descr']));
- }
- }
- }
-
- if($values['id'] &&
$this->location_info['id']['type'] == 'int' && !ctype_digit($values['id']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
- unset($values['id']);
- }
-
- if(isset($values_attribute) &&
is_array($values_attribute))
- {
- foreach ($values_attribute as
$attribute )
- {
-
if($attribute['nullable'] != 1 && !$attribute['value'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1',
$attribute['input_text']));
- }
- }
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- $id = $values['id'];
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values,$action,$values_attribute);
-
- if (isset($values['save']) &&
$values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data',
"general_receipt_{$type}_{$type_id}", $receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uicategory.index', 'type'=> $type, 'type_id' => $type_id));
- }
- $id = $receipt['id'];
- }
- else
- {
- unset($values['id']);
- $id = '';
- }
-
- }
- else
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uicategory.index', 'type'=> $type, 'type_id' => $type_id));
- }
- }
-
- if ($id)
- {
- $values = $this->bo->read_single(array('id' =>
$id));
- $function_msg =
$this->location_info['edit_msg'];
- $action='edit';
- }
- else
- {
- $values = $this->bo->read_single();
- $function_msg = $this->location_info['add_msg'];
- $action='add';
- }
-
- /* Preserve attribute values from post */
- if(isset($receipt['error']))
- {
- foreach ( $this->location_info['fields'] as
$field )
- {
- $values[$field['name']] =
phpgw::clean_value($_POST['values'][$field['name']]);
- }
-
- if(isset( $values_attribute) && is_array(
$values_attribute))
- {
- $values =
$this->custom->preserve_attribute_values($values,$values_attribute);
- }
- }
-
- $link_data = array
- (
- 'menuaction' => 'property.uicategory.edit',
- 'id' => $id,
- 'type' => $type,
- 'type_id' => $type_id
- );
-
- $tabs = array();
-
- if (isset($values['attributes']) &&
is_array($values['attributes']))
- {
- foreach ($values['attributes'] as & $attribute)
- {
- if($attribute['history'] == true)
- {
- $link_history_data = array
- (
- 'menuaction' =>
'property.uiactor.attrib_history',
- 'attrib_id' =>
$attribute['id'],
- 'actor_id' =>
$actor_id,
- 'role' =>
$this->role,
- 'edit' => true
- );
-
- $attribute['link_history'] =
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
- }
- }
-
-
phpgwapi_yui::tabview_setup('general_edit_tabview');
- $tabs['general'] = array('label' =>
lang('general'), 'link' => '#general');
-
- $attributes_groups =
$this->custom->get_attribute_groups('property', $this->acl_location,
$values['attributes']);
-
- $attributes = array();
- foreach ($attributes_groups as $group)
- {
- if(isset($group['attributes']))
- {
- $tabs[str_replace(' ', '_',
$group['name'])] = array('label' => $group['name'], 'link' => '#' .
str_replace(' ', '_', $group['name']));
- $group['link'] = str_replace('
', '_', $group['name']);
- $attributes[] = $group;
- }
- }
- unset($attributes_groups);
- unset($values['attributes']);
- }
-
- foreach ($this->location_info['fields'] as & $field)
- {
- $field['value'] =
isset($values[$field['name']]) ? $values[$field['name']] : '';
- if(isset($field['values_def']))
- {
- if($field['values_def']['valueset'])
- {
- $field['valueset'] =
$field['values_def']['valueset'];
- // TODO find selected value
- }
- else
if(isset($field['values_def']['method']))
- {
-
-
foreach($field['values_def']['method_input'] as $_argument => $_argument_value)
- {
- if(preg_match('/^##/',
$_argument_value))
- {
-
$_argument_value_name = trim($_argument_value,'#');
-
$_argument_value = $values[$_argument_value_name];
- }
-
$method_input[$_argument] = $_argument_value;
- }
-
- $field['valueset'] =
execMethod($field['values_def']['method'],$method_input);
- }
- }
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uicategory.index', 'type'=> $type, 'type_id'=> $type_id)),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_id'
=> isset($values['id']) ? $values['id'] : '',
- 'value_descr'
=> $values['descr'],
-
- 'attributes_group'
=> $attributes,
- 'lookup_functions'
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
- 'textareacols'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
- 'textarearows'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 10,
- 'tabs'
=> phpgwapi_yui::tabview_generate($tabs, 'general'),
- 'id_name'
=> $this->location_info['id']['name'],
- 'id_type'
=> $this->location_info['id']['type'],
- 'fields'
=> $this->location_info['fields']
- );
-
- $appname = $this->location_info['name'];
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . "::{$appname}::{$function_msg}";
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
- return lang('no access');
- }
-
- $id =
phpgw::get_var($this->location_info['id']['name']);
-
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- $this->bo->delete($id);
- return lang('id %1 has been deleted', $id);
- }
- }
- }
-
Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/inc/class.uigeneric.inc.php 2010-11-18 07:45:07 UTC (rev
6615)
@@ -47,7 +47,6 @@
var $public_functions = array
(
'index' => true,
- 'view' => true,
'edit' => true,
'delete' => true,
'download' => true,
Deleted: trunk/property/js/yahoo/actor.index.js
===================================================================
--- trunk/property/js/yahoo/actor.index.js 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/js/yahoo/actor.index.js 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,84 +0,0 @@
-//--------------------------------------------------------
-// Declaration of actor.index vars
-//--------------------------------------------------------
-
- //define SelectButton
- var oMenuButton_0, oMenuButton_1;
- var selectsButtons = [
- {order:0,
var_URL:'member_id',name:'btn_member_id',style:'categorybutton',dependiente:''},
- {order:1,
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''}
- ]
-
- // define buttons
- var oNormalButton_0, oNormalButton_1, oNormalButton_2;
- var normalButtons = [
- {order:0, name:'btn_search', funct:"onSearchClick"},
- {order:1, name:'btn_new', funct:"onNewClick"},
- {order:2, name:'btn_export', funct:"onDownloadClick"}
- ]
-
- // define Text buttons
- var textImput = [
- {order:0, name:'query', id:'txt_query'}
- ]
-
- // define the hidden column in datatable
- var config_values = {
- date_search : 0 //if search has link "Data search"
- }
-
- var linktoolTips =[
- {name:'btn_columns', title:'columns', description:'Choose
columns'},
- {name:'btn_export', title:'download', description:'Download
table to your browser',ColumnDescription:''}
- ]
-/****************************************************************************************/
-
- this.particular_setting = function()
- {
- if(flag_particular_setting=='init')
- {
- //focus initial
- if(path_values.role == 'vendor')
- {
- oMenuButton_0.focus();
- }
- else
- {
- oMenuButton_1.focus();
- }
- }
- else if(flag_particular_setting=='update')
- {
- // nothing
- }
- }
-/****************************************************************************************/
-
- this.myParticularRenderEvent = function()
- {
- //don't delete it
- }
-/****************************************************************************************/
-
- YAHOO.util.Event.addListener(window, "load", function()
- {
-
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display =
'none';
- var loader = new YAHOO.util.YUILoader();
- loader.addModule({
- name: "anyone", //module name; must be unique
- type: "js", //can be "js" or "css"
- fullpath: property_js //'property_js' have the path for
property.js, is render in HTML
- });
-
- loader.require("anyone");
-
- //Insert JSON utility on the page
-
- loader.insert();
- });
-
-
-
-
-
-
Deleted: trunk/property/js/yahoo/category.index.js
===================================================================
--- trunk/property/js/yahoo/category.index.js 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/js/yahoo/category.index.js 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,65 +0,0 @@
-//--------------------------------------------------------
-// Declaration of location.index vars
-//--------------------------------------------------------
- // define buttons
-// var selectsButtons = [];
-
- var oNormalButton_0,oNormalButton_1,oNormalButton_2,oNormalButton_3;
- var normalButtons = [
- {order:0, name:'btn_search', funct:"onSearchClick"},
- {order:1, name:'btn_new', funct:"onNewClick"},
- {order:2, name:'btn_done', funct:"onDoneClick"},
- {order:3, name:'btn_export', funct:"onDownloadClick"}
- ];
-
- // define Text buttons
- var textImput = [
- {order:0, name:'query',id:'txt_query'}
- ];
-
- var toolTips =
- [
- {name:'btn_export', title:'download', description:'Download
table to your browser',ColumnDescription:''}
- ]
-
- // define the hidden column in datatable
- var config_values =
- {
- date_search : 0, //if search has link "Data search"
- particular_done : "admin.uimainscreen.mainscreen"
- }
-/****************************************************************************************/
- this.particular_setting = function()
- {
- if(flag_particular_setting=='init')
- {
- }
- else if(flag_particular_setting=='update')
- {
- }
- }
-/****************************************************************************************/
-
- this.myParticularRenderEvent = function()
- {
- //don't delete it
- document.getElementById('txt_query').focus();
- }
-/****************************************************************************************/
- YAHOO.util.Event.addListener(window, "load", function()
- {
-
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display =
'none';
-
- var loader = new YAHOO.util.YUILoader();
- loader.addModule({
- name: "anyone", //module name; must be unique
- type: "js", //can be "js" or "css"
- fullpath: property_js //'property_js' have the path for
property.js, is render in HTML
- });
-
- loader.require("anyone");
-
- //Insert JSON utility on the page
-
- loader.insert();
- });
Deleted: trunk/property/templates/base/actor.xsl
===================================================================
--- trunk/property/templates/base/actor.xsl 2010-11-17 22:01:34 UTC (rev
6614)
+++ trunk/property/templates/base/actor.xsl 2010-11-18 07:45:07 UTC (rev
6615)
@@ -1,762 +0,0 @@
-
- <xsl:template name="app_data">
- <xsl:choose>
- <xsl:when test="edit">
- <xsl:apply-templates select="edit"/>
- </xsl:when>
- <xsl:when test="view">
- <xsl:apply-templates select="view"/>
- </xsl:when>
- <xsl:when test="list_attribute">
- <xsl:apply-templates select="list_attribute"/>
- </xsl:when>
- <xsl:when test="edit_attrib">
- <xsl:apply-templates select="edit_attrib"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="list"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="list">
- <xsl:apply-templates select="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <xsl:choose>
- <xsl:when test="member_of_list != ''">
- <td align="left">
- <xsl:call-template
name="filter_member_of"/>
- </td>
- </xsl:when>
- </xsl:choose>
-
- <td align="left">
- <xsl:call-template name="cat_filter"/>
- </td>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- <td valign ="top">
- <table>
- <tr>
- <td class="small_text" valign="top"
align="left">
- <xsl:variable
name="link_columns"><xsl:value-of select="link_columns"/></xsl:variable>
- <xsl:variable
name="lang_columns_help"><xsl:value-of
select="lang_columns_help"/></xsl:variable>
- <xsl:variable
name="lang_columns"><xsl:value-of select="lang_columns"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_columns}','','width=300,height=600')"
-
onMouseOver="overlib('{$lang_columns_help}', CAPTION, '{$lang_columns}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_columns"/></a>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:call-template name="table_header"/>
- <xsl:call-template name="values"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template name="table_header">
- <tr class="th">
- <xsl:for-each select="table_header" >
- <td class="th_text" width="{with}"
align="{align}">
- <xsl:choose>
- <xsl:when
test="sort_link!=''">
- <a
href="{sort}" onMouseover="window.status='{header}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="header"/></a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="header"/>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </xsl:for-each>
- </tr>
- </xsl:template>
-
-
- <xsl:template name="values">
- <xsl:for-each select="values" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:for-each select="row" >
- <xsl:choose>
- <xsl:when test="link">
- <td class="small_text"
align="center">
- <a
href="{link}" onMouseover="window.status='{statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text"/></a>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <td class="small_text"
align="left">
- <xsl:value-of
select="value"/>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="table_add">
- <tr>
- <td height="50">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </xsl:template>
-
-<!-- add / edit -->
-
- <xsl:template match="edit">
- <script type="text/javascript">
- self.name="first_Window";
- <xsl:value-of select="lookup_functions"/>
- </script>
- <div class="yui-navset" id="actor_edit_tabview">
- <xsl:variable name="edit_url"><xsl:value-of
select="edit_url"/></xsl:variable>
- <form name="form" method="post" action="{$edit_url}">
- <xsl:value-of disable-output-escaping="yes"
select="tabs" />
- <div class="yui-content">
- <div id="general">
-
- <table cellpadding="2" cellspacing="2" width="79%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr >
- <td align="left">
- <xsl:value-of select="lang_actor_id"/>
- </td>
- <xsl:choose>
- <xsl:when test="value_actor_id!=''">
- <td align="left">
- <xsl:value-of
select="value_actor_id"/>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <td align="left">
- <input type="text" size = "15"
name="values[new_actor_id]" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_id_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
-
- <tr >
- <td align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td align="left">
- <xsl:call-template name="cat_select"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="member_of_list != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_member_of"/>
- </td>
- <td>
- <xsl:variable
name="lang_member_of_statustext"><xsl:value-of
select="lang_member_of_statustext"/></xsl:variable>
- <select
name="values[member_of][]" class="forms" multiple="multiple"
onMouseover="window.status='{$lang_member_of_statustext}'; return true;"
onMouseout="window.status='';return true;">
-
<xsl:apply-templates select="member_of_list"/>
- </select>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </table>
- </div>
-
- <xsl:call-template name="attributes_values"/>
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <tr height="50">
- <td valign="bottom">
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- <td valign="bottom">
- <xsl:variable
name="lang_apply"><xsl:value-of select="lang_apply"/></xsl:variable>
- <input type="submit"
name="values[apply]" value="{$lang_apply}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_apply_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- <td align="right" valign="bottom">
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <input type="submit"
name="values[cancel]" value="{$lang_cancel}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_cancel_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </table>
- </div>
- </form>
- </div>
- </xsl:template>
-
-<!-- view -->
-
- <xsl:template match="view">
- <table cellpadding="2" cellspacing="2" width="79%"
align="center">
- <tr >
- <td align="left">
- <xsl:value-of select="lang_actor_id"/>
- </td>
- <td align="left">
- <xsl:value-of select="value_actor_id"/>
- </td>
- </tr>
- <tr class="row_off">
- <td width="19%">
- <xsl:value-of
select="lang_time_created"/>
- </td>
- <td width="81%">
- <xsl:value-of select="value_date"/>
- </td>
- </tr>
- <tr class="row_on">
- <td>
- <xsl:value-of select="lang_category"/>
- </td>
- <xsl:for-each select="cat_list" >
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <td>
- <xsl:value-of
select="name"/>
- </td>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </tr>
- <tr>
- <td colspan="2" width="50%" align="left">
- <xsl:apply-templates
select="attributes_view"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="member_of_list != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_member_of"/>
- </td>
- <td>
- <xsl:variable
name="lang_member_of_statustext"><xsl:value-of
select="lang_member_of_statustext"/></xsl:variable>
- <select
disabled="disabled" name="values[member_of][]" class="forms"
multiple="multiple" onMouseover="window.status='{$lang_member_of_statustext}';
return true;" onMouseout="window.status='';return true;">
-
<xsl:apply-templates select="member_of_list"/>
- </select>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr height="50">
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit" class="forms"
name="done" value="{$lang_done}" onMouseover="window.status='Back to the
list.';return true;" onMouseout="window.status='';return true;"/>
- </form>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="table_add2">
- <tr>
- <td height="50">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- <td height="50">
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit" name="add"
value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </xsl:template>
-
-
-
-<!-- list attribute -->
-
- <xsl:template match="list_attribute">
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_attrib"/>
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6615] Property: more on generic code,
Sigurd Nes <=