[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7398] frontend: show generic entities from property
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7398] frontend: show generic entities from property |
Date: |
Sun, 19 Jun 2011 17:29:42 +0000 |
Revision: 7398
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7398
Author: sigurdne
Date: 2011-06-19 17:29:42 +0000 (Sun, 19 Jun 2011)
Log Message:
-----------
frontend: show generic entities from property
Modified Paths:
--------------
trunk/frontend/inc/class.uifrontend.inc.php
trunk/frontend/inc/hook_config.inc.php
trunk/frontend/templates/base/config.tpl
Added Paths:
-----------
trunk/frontend/inc/class.uientity.inc.php
trunk/frontend/js/yahoo/entity.list.js
trunk/frontend/templates/base/entity.xsl
trunk/frontend/templates/base/entityview.xsl
Added: trunk/frontend/inc/class.uientity.inc.php
===================================================================
--- trunk/frontend/inc/class.uientity.inc.php (rev 0)
+++ trunk/frontend/inc/class.uientity.inc.php 2011-06-19 17:29:42 UTC (rev
7398)
@@ -0,0 +1,1158 @@
+<?php
+
+ /**
+ * Frontend : a simplified tool for end users.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2010 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package Frontend
+ * @version $Id: class.uientity.inc.php 7224 2011-04-15 11:48:27Z
sigurdne $
+ */
+
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ phpgw::import_class('frontend.uifrontend');
+
+ /**
+ * Helpdesk
+ *
+ * @package Frontend
+ */
+
+ class frontend_uientity extends frontend_uifrontend
+ {
+
+ public $public_functions = array
+ (
+ 'index' => true,
+ 'download' => true,
+ 'view' => true,
+ );
+
+ public function __construct()
+ {
+ $this->location_id =
phpgw::get_var('location_id', 'int', 'REQUEST', 0);
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($this->location_id);
+ $this->acl_location =
$location_info['location'];
+ $location_arr = explode('.',
$this->acl_location);
+
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject('property.boentity',true);
+ $this->bocommon = &
$this->bo->bocommon;
+ $this->soadmin_entity = &
$this->bo->soadmin_entity;
+
+ $this->entity_id =
isset($location_arr[2]) && $location_arr[2] ? $location_arr[2] :
$this->bo->entity_id;
+ $this->cat_id =
isset($location_arr[3]) && $location_arr[3] ? $location_arr[3] :
$this->bo->cat_id;
+
+ $this->type =
$this->bo->type;
+ $this->type_app =
$this->bo->type_app;
+
+ if(isset($location_arr[3]))
+ {
+ $this->bo->entity_id = $this->entity_id;
+ $this->bo->cat_id = $this->cat_id;
+ $this->acl_location =
".{$this->type}.$this->entity_id";
+ if( $this->cat_id )
+ {
+ $this->acl_location .=
".{$this->cat_id}";
+ }
+ }
+
+
+ $this->acl = &
$GLOBALS['phpgw']->acl;
+ $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->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->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->status =
$this->bo->status;
+// $this->location_code =
$this->bo->location_code;
+ $this->p_num =
$this->bo->p_num;
+ $this->category_dir =
$this->bo->category_dir;
+
$GLOBALS['phpgw']->session->appsession('entity_id','property',$this->entity_id);
+ $this->start_date =
$this->bo->start_date;
+ $this->end_date =
$this->bo->end_date;
+ $this->allrows =
$this->bo->allrows;
+
+
+
phpgwapi_cache::session_set('frontend','tab',$this->location_id);
+ parent::__construct();
+ $this->location_code =
$this->header_state['selected_location'];
+ $this->bo->location_code = $this->location_code;
+ }
+
+
+ function download()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = true;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+
+ $list =
$this->bo->read(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'allrows'=>true,'start_date'=>$start_date,'end_date'=>$end_date,
'type' => $this->type));
+ $uicols = $this->bo->uicols;
+
+
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+ }
+
+
+ public function index()
+ {
+ $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'entity.index';
+ $this->insert_links_on_header_state();
+
+ if($this->entity_id && !$this->cat_id)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'frontend.uientity.index', 'entity_id'=>$this->entity_id, 'cat_id'=> 1, 'type'
=> $this->type));
+ }
+
+ //redirect if no rights
+ if(!$this->acl_read && $this->cat_id)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+ }
+
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+ $dry_run = false;
+ $second_display = phpgw::get_var('second_display',
'bool');
+
+// $this->save_sessiondata();
+
+ //Preferencias sets
+
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters']
== 'yes')
+ {
+ $group_filters = 'select';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
+ }
+ else
+ {
+ $group_filters = 'filter';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
+ }
+ $default_district =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+
+ if ($default_district && !$second_display &&
!$this->district_id)
+ {
+ $this->bo->district_id = $default_district;
+ $this->district_id =
$default_district;
+ }
+
+ $datatable = array();
+ $values_combo_box = array();
+
+ if($this->cat_id)
+ {
+ $category =
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ }
+
+ // enters the first time
+ if( phpgw::get_var('phpgw_return_as') != 'json' )
+ {
+
+ $datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction'
=> 'frontend.uientity.index',
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id' =>
$this->cat_id,
+ 'type'
=> $this->type,
+ 'district_id'
=> $this->district_id,
+ 'p_num'
=> $this->p_num,
+ 'location_id' =>
$this->location_id
+ ));
+ $datatable['config']['allow_allrows'] = true;
+
+ $datatable['config']['base_java_url'] =
"menuaction:'frontend.uientity.index',".
+ "second_display:1,".
+ "entity_id:'{$this->entity_id}',".
+ "cat_id:'{$this->cat_id}',".
+ "type:'{$this->type}',".
+ "district_id:'{$this->district_id}',".
+ "p_num:'{$this->p_num}',".
+ "location_id:'{$this->location_id}'";
+
+ // this array "$arr_filter_hide" indicate what
filters are hidden or not
+ $arr_filter_hide = array();
+
+ //// ---- DISTRICT filter----------------------
+ if($this->cat_id)
+ {
+ //this validation comes to previous
versions
+ if (isset($category['location_level'])
&& $category['location_level']>0)
+ {
+ $values_combo_box[1] =
$this->bocommon->select_district_list($group_filters,$this->district_id);
+ if(count($values_combo_box[1]))
+ {
+ $default_value = array
('id'=>'','name'=>lang('no district'));
+ array_unshift
($values_combo_box[1],$default_value);
+ $arr_filter_hide[1] = 0;
+ }
+ else
+ {
+ $arr_filter_hide[1] = 1;
+ }
+ }
+ else
+ {
+ $values_combo_box[1] = array();
+ $arr_filter_hide[1] = 1;
+ }
+ }
+
+ //// ---- USER filter----------------------
+ $values_combo_box[2] =
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
+
+ if(count($values_combo_box[2]))
+ {
+ $default_value = array
('id'=>'','name'=>lang('no user'));
+ array_unshift
($values_combo_box[2],$default_value);
+ $arr_filter_hide[2] = 0;
+ }
+ else
+ {
+ $arr_filter_hide[2] = 1;
+ }
+
+ $values_combo_box[3] =
$this->bo->get_criteria_list($this->criteria_id);
+ $default_value = array
('id'=>'','name'=>lang('no criteria'));
+ array_unshift
($values_combo_box[3],$default_value);
+
+ $datatable['actions']['form'] = array
+ (
+ array
+ (
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',
+ array
+ (
+ 'menuaction'
=> 'frontend.uientity.index',
+
'second_display' => $second_display,
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id'
=> $this->cat_id,
+ 'type'
=> $this->type,
+ 'location_id'
=> $this->location_id
+ )),
+ 'fields' => array
+ (
+ 'field' => array
+ (
+ /* array
+ (
//boton CATEGORY
+
'id' => 'btn_cat_id',
+
'name' => 'cat_id',
+
'value'=> lang('Category'),
+
'type' => 'button',
+
'style' => 'filter',
+
'tab_index' => 1
+
),
+ array
+ (
//boton DISTINT
+
'id' => 'btn_district_id',
+
'name' => 'district_id',
+
'value'=> lang('District'),
+
'type' => 'button',
+
'style' => 'filter',
+
'tab_index' => 2
+ ),
+ array
+ (
//boton USER
+
'id' => 'btn_user_id',
+
'name' => 'user_id',
+
'value'=> lang('User'),
+
'type' => 'button',
+
'style' => 'filter',
+
'tab_index' => 3
+ ),*/
+ array
+ (
//boton search criteria
+
'id' => 'btn_criteria_id',
+
'name' => 'criteria_id',
+
'value' => lang('search criteria'),
+
'type' => 'button',
+
'style' => 'filter',
+
'tab_index' => 4
+ ),
+ array
+ (//for
link "columns", next to Export button
+
'type'=> 'link',
+
'id' => 'btn_columns',
+
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+
array
+
(
+
'menuaction' => 'property.uientity.columns',
+
'entity_id' => $this->entity_id,
+
'cat_id' => $this->cat_id,
+
'type' => $this->type
+
))."','link','width=300,height=600,scrollbars=1')",
+
'value' => lang('columns'),
+
'tab_index' => 11
+ ),
+ array
+ (
+
'type' => 'button',
+
'id' => 'btn_export',
+
'value'=> lang('download'),
+
'tab_index' => 10
+ ),
+ array
+ (
+
'type' => 'button',
+
'id' => 'btn_new',
+
'value'=> lang('add'),
+
'tab_index' => 9
+ ),
+ array
+ (
//boton SEARCH
+
'id' => 'btn_search',
+
'name' => 'search',
+
'value'=> lang('search'),
+
'type' => 'button',
+
'tab_index' => 8
+ ),
+ array
+ ( //
TEXT IMPUT
+
'name' => 'query',
+
'id' => 'txt_query',
+
'value'=> $this->query,
+
'type' => 'text',
+
'size' => 28,
+
'onkeypress' => 'return pulsar(event)',
+
'tab_index' => 7
+ ),
+ array
+ (//for
link "None",
+
'type'=> 'label_date'
+ ),
+ array
+ (
//hidden end_date
+
'type' => 'hidden',
+
'id' => 'end_date',
+
'name' => 'end_date',
+
'value' => $end_date
+ ),
+ array
+ (
//hidden start_date
+
'type' => 'hidden',
+
'id' => 'start_date',
+
'name' => 'start_date',
+
'value' => $start_date
+ ),
+ array
+ (//for
link "Date search",
+
'type'=> 'link',
+
'id' => 'btn_data_search',
+
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+
array
+
(
+
'menuaction' =>
'property.uiproject.date_search'))."','link','width=350,height=250')",
+
'value' => lang('Date search'),
+
'tab_index' => 6
+
)),
+ 'hidden_value'
=> array
+ (
+ array
+ (
+
'id' => 'values_combo_box_0',
+
'value'=> $this->bocommon->select2String($values_combo_box[0])
+ ),
+ array
+ (
+
'id' => 'values_combo_box_1',
+
'value' => $this->bocommon->select2String($values_combo_box[1])
+ ),
+ array
+ (
+
'id' => 'values_combo_box_2',
+
'value' => $this->bocommon->select2String($values_combo_box[2])
+ ),
+ array
+ (
+
'id' => 'values_combo_box_3',
+
'value' => $this->bocommon->select2String($values_combo_box[3])
+ ),
+ )
+ )));
+
+ $custom =
createObject('phpgwapi.custom_fields');
+ $attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+
+ $button_def[] = "oMenuButton_0";
+ // $button_def[] = "oMenuButton_1";
+ // $button_def[] = "oMenuButton_2";
+ $button_def[] = "oMenuButton_3";
+ $code_inner[] = "{order:0,
var_URL:'cat_id',name:'btn_cat_id',style:'genericbutton',dependiente:[]}";
+ // $code_inner[] = "{order:1,
var_URL:'district_id',name:'btn_district_id',style:'genericbutton',dependiente:[]}";
+ // $code_inner[] = "{order:2,
var_URL:'filter',name:'btn_user_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:3,
var_URL:'criteria_id',name:'btn_criteria_id',style:'genericbutton',dependiente:[]}";
+
+
+ if($attrib_data)
+ {
+ $i = 4;
+ foreach ( $attrib_data as $attrib )
+ {
+ if($attrib['datatype'] == 'LB'
|| $attrib['datatype'] == 'CH' || $attrib['datatype'] == 'R')
+ {
+
$datatable['actions']['form'][0]['fields']['field'][] = array
+ (
+ 'id' =>
"btn_{$attrib['column_name']}",
+ 'name' =>
$attrib['column_name'],
+ 'value' =>
$attrib['input_text'],
+ 'type' =>
'button',
+ 'style' =>
'filter',
+ 'tab_index' =>
$i
+ );
+
+ $button_def[] =
"oMenuButton_{$i}";
+ $code_inner[] =
"{order:{$i},
var_URL:'{$attrib['column_name']}',name:'btn_{$attrib['column_name']}',style:'genericbutton',dependiente:[]}";
+
+ $values_combo_box[$i][]
= array
+ (
+ 'id' => '',
+ 'name' =>
$attrib['input_text'],
+ );
+
+
+
foreach($attrib['choice'] as $choice)
+ {
+
$values_combo_box[$i][] = array
+ (
+ 'id'
=> $choice['id'],
+ 'name'
=> htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
+ );
+ }
+
+
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
+ (
+ 'id' =>
"values_combo_box_{$i}",
+ 'value' =>
$this->bocommon->select2String($values_combo_box[$i])
+ );
+ $i++;
+ }
+ }
+ }
+
+ $code = 'var ' . implode(',', $button_def) .
";\n";
+ $code .= 'var selectsButtons = [' . "\n" .
implode(",\n",$code_inner) . "\n];";
+
+ $GLOBALS['phpgw']->js->add_code('', $code);
+
+ // eliminates those empty filters
+ $eliminate = 0;
+ foreach( $arr_filter_hide as $key => $value )
+ {
+ if ($value)
+ {
+ //eliminates the respective
entry in $datatable..['field']
+
array_splice($datatable['actions']['form'][0]['fields']['field'],$eliminate, 1);
+ }
+ else
+ {
+ $eliminate++;
+ }
+ }
+
+ // sets for initial ordering
+ $this->sort = "ASC";
+ $this->order = "num";
+// $dry_run = true;
+ }
+
+ $entity_list = array();
+
+ $entity_list =
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date,
'dry_run' => $dry_run));
+
+ $uicols = $this->bo->uicols;
+
+ $content = array();
+ $j=0;
+ if (isset($entity_list) && is_array($entity_list))
+ {
+ foreach($entity_list as $entity_entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
if(isset($entity_entry['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'] =
$entity_entry[$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']
= $entity_entry['query_location'][$uicols['name'][$i]];
+ }
+ else
+ {
+
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$entity_entry[$uicols['name'][$i]];
+
//$datatable['rows']['row'][$j]['column'][$i]['value'] = $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' && $entity_entry[$uicols['name'][$i]])
+ {
+
$datatable['rows']['row'][$j]['column'][$i]['format'] = 'link';
+
$datatable['rows']['row'][$j]['column'][$i]['value'] = lang('link');
+
$datatable['rows']['row'][$j]['column'][$i]['link'] =
$entity_entry[$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'] =
$entity_entry[$uicols['name'][$i]];
+ }
+
$datatable['rows']['row'][$j]['hidden'][$i]['value']
= $entity_entry[$uicols['name'][$i]];
+
$datatable['rows']['row'][$j]['hidden'][$i]['name']
= $uicols['name'][$i];
+ }
+
+ $j++;
+ }
+ }
+
+ //indica que de la fila seleccionada escogera de la
columna "id" el valor "id". Para agregarlo al URL
+ $parameters = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' => 'id',
+ 'source' => 'id'
+ ),
+ )
+ );
+
+ $parameters2 = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' =>
'location_code',
+ 'source' =>
'location_code'
+ ),
+ array
+ (
+ 'name' =>
'origin_id',
+ 'source' => 'id'
+ ),
+ array
+ (
+ 'name' =>
'p_num',
+ 'source' => 'id'
+ ),
+ )
+ );
+
+ if($this->acl_read)
+ {
+ $datatable['rowactions']['action'][] = array
+ (
+ 'my_name' =>
'view',
+ 'text' =>
lang('view'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'frontend.uientity.view',
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id'
=> $this->cat_id,
+ 'type'
=> $this->type
+ )),
+ 'parameters'
=> $parameters
+ );
+ }
+ if($this->acl_edit)
+ {
+ $datatable['rowactions']['action'][] = array
+ (
+ 'my_name' =>
'edit',
+ 'text' =>
lang('edit'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'frontend.uientity.edit',
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id'
=> $this->cat_id,
+ 'type'
=> $this->type
+ )),
+ 'parameters'
=> $parameters
+ );
+ }
+
+ if( $category['start_ticket'])
+ {
+ $datatable['rowactions']['action'][] = array
+ (
+ 'my_name' =>
'edit',
+ 'text' =>
lang('start ticket'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction'
=> 'frontend.uihelpdesk.add_ticket',
+ 'noframework'
=> 1,
+ 'target'
=> '_lightbox'
+ )),
+ 'parameters'
=> $parameters2
+ );
+ }
+
+ $jasper = execMethod('property.sojasper.read',
array('location_id' =>
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type],
$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_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' =>
'frontend.uientity.delete',
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id'
=> $this->cat_id,
+ 'type'
=> $this->type
+ )),
+ 'parameters' => $parameters
+ );
+ }
+
+
+ if($this->acl_add)
+ {
+ $datatable['rowactions']['action'][] = array
+ (
+ 'my_name' =>
'add',
+ 'text' =>
lang('add'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'frontend.uientity.edit',
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id'
=> $this->cat_id,
+ 'type'
=> $this->type
+ ))
+ );
+ }
+*/
+ unset($parameters);
+
+ //$uicols_count indicates the number of columns to
display in actuall option-menu. this variable was set in $this->bo->read()
+ $link = $GLOBALS['phpgw']->link(
+ '/index.php',
+ array('menuaction' =>
'frontend.uientity.view'));
+ $datatable['exchange_values'] = "document.location =
'{$link}&id=' + data.getData().id + '&location_id={$this->location_id}';";
+
+
+ $uicols_count = count($uicols['descr']);
+
+ //Columns Order
+ 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'] =
$uicols['sortable'][$i];;
+
$datatable['headers']['header'][$i]['sort_field'] =
$uicols['name'][$i];
+
//$datatable['headers']['header'][$i]['formatter'] =
$uicols['formatter'][$i];
+ //according to stable bruch this
columns is not SORTABLE'
+ $denied = array('merknad');//$denied =
array('merknad','account_lid');
+ //if not include
+ if(in_array ($uicols['name'][$i],
$denied))
+ {
+
$datatable['headers']['header'][$i]['sortable'] = false;
+ }
+ else
if(isset($uicols['cols_return_extra'][$i]) &&
($uicols['cols_return_extra'][$i]!='T' ||
$uicols['cols_return_extra'][$i]!='CH'))
+ {
+
$datatable['headers']['header'][$i]['sortable'] = true;
+ }
+
+ }
+ else
+ {
+
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
+
$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'];
+
+ if($dry_run)
+ {
+ $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $datatable['pagination']['records_returned']=
count($entity_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 ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
+ {
+ $datatable['sorting']['order']
= 'id'; // name key Column in myColumnDef
+ $datatable['sorting']['sort']
= 'desc'; // 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
+ }
+
+
+ //-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>";
+ }
+ else
if(isset($column['format']) && $column['format']== "link")
+ {
+
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>"
.$column['value']."</a>";
+ }
+ else
+ {
+
$json_row[$column['name']] = $column['value'];
+ }
+ }
+ $json['records'][] = $json_row;
+ }
+ }
+
+ //---no exits depended filters
+ $json['hidden']['dependent'][] = array ( );
+
+ // checks 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);
+ //-END------------------- 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');
+ }
+
+
+ $appname = lang('entity');
+
+ 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');
+
+ // 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
+ if($this->entity_id && $this->cat_id)
+ {
+ $entity =
$this->soadmin_entity->read_single($this->entity_id,false);
+ $appname = $entity['name'];
+ $category =
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $function_msg = 'list ' . $category['name'];
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
+ }
+
+ // Prepare YUI Library
+
+
+ $GLOBALS['phpgw']->js->validate_file('yahoo',
'entity.list' , 'frontend');
+
+ $msglog =
phpgwapi_cache::session_get('frontend','msgbox');
+ phpgwapi_cache::session_clear('frontend','msgbox');
+
+ $data = array(
+ 'header' => $this->header_state,
+ 'tabs' => $this->tabs,
+ 'entity' => array('datatable' =>
$datatable, 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))),
+ 'lightbox_name' => lang('add ticket')
+ );
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('frontend',
'entity', 'datatable'));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('app_data' => $data));
+ }
+
+
+
+ private function cmp($a, $b)
+ {
+ $timea = explode('/', $a['date']);
+ $timeb = explode('/', $b['date']);
+ $year_and_maybe_time_a = explode(' - ', $timea[2]);
+ $year_and_maybe_time_b = explode(' - ', $timeb[2]);
+ $time_of_day_a = explode(':',
$year_and_maybe_time_a[1]);
+ $time_of_day_b = explode(':',
$year_and_maybe_time_b[1]);
+
+ $timestamp_a = mktime($time_of_day_a[0],
$time_of_day_a[1], 0, $timea[1], $timea[0], $year_and_maybe_time_a[0]);
+ $timestamp_b = mktime($time_of_day_b[0],
$time_of_day_b[1], 0, $timeb[1], $timeb[0], $year_and_maybe_time_b[0]);
+
+ if($timestamp_a < $timestamp_b)
+ {
+ return 1;
+ }
+
+ return -1;
+ }
+
+
+ public function view()
+ {
+ $GLOBALS['phpgw']->translation->add_app('property');
+ $bo = CreateObject('property.botts');
+ $entityid = phpgw::get_var('id');
+ $entity = $bo->read_single($entityid);
+
+ $assignedto = $entity['assignedto'];
+ if(isset($assignedto) && $assignedto != '')
+ {
+ $assignedto_account =
$GLOBALS['phpgw']->accounts->get($assignedto);
+ //var_dump($assignedto_account);
+ if($assignedto_account)
+ {
+ $entity['assigned_to_name'] =
$assignedto_account->__toString();
+ }
+ }
+
+ $contact_id = $entity['contact_id'];
+ if(isset($contact_id) && $contact_id != '')
+ {
+ $contacts
= CreateObject('phpgwapi.contacts');
+ $contact_data
= $contacts->read_single_entry($contact_id,
array('fn','tel_work','email'));
+ $entity['value_contact_name'] =
$contact_data[0]['fn'];
+ $entity['value_contact_email'] =
$contact_data[0]['email'];
+ $entity['value_contact_tel'] =
$contact_data[0]['tel_work'];
+ }
+
+ $vendor_id = $entity['vendor_id'];
+ if(isset($vendor_id) && $vendor_id != '')
+ {
+ $contacts =
CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
+
+ $custom =
createObject('property.custom_fields');
+ $vendor_data['attributes'] =
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
+
+ $vendor_data =
$contacts->read_single(array('id' => $vendor_id),$vendor_data);
+
+ if(is_array($vendor_data))
+ {
+ foreach($vendor_data['attributes'] as
$attribute)
+ {
+
if($attribute['name']=='org_name')
+ {
+
$entity['value_vendor_name']=$attribute['value'];
+ break;
+ }
+ }
+ }
+ }
+
+ $notes = $bo->read_additional_notes($entityid);
+ //$history = $bo->read_record_history($entityid);
+
+ $entityhistory = array();
+
+ foreach($notes as $note)
+ {
+ if($note['value_publish'])
+ {
+ $entityhistory[] = array(
+ 'date' => $note['value_date'],
+ 'user' => $note['value_user'],
+ 'note' => $note['value_note']
+ );
+ }
+ }
+
+
+ usort($entityhistory, array($this, "cmp"));
+
+
+ $i=0;
+ foreach($entityhistory as $foo)
+ {
+ $entityhistory2['record'.$i] = $foo;
+ $i++;
+ }
+
+ $msglog =
phpgwapi_cache::session_get('frontend','msgbox');
+ phpgwapi_cache::session_clear('frontend','msgbox');
+
+ $data = array(
+ 'header' => $this->header_state,
+ 'msgbox_data' => isset($msglog) ?
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))
: array(),
+ 'tabs' => $this->tabs,
+ 'entityinfo' => array(
+ 'entitylist' =>
$GLOBALS['phpgw']->link('/index.php',
+ array
+ (
+
'menuaction' => 'frontend.uientity.index',
+
'location_id' => $this->location_id
+ )),
+
+ 'entity' => $entity,
+ 'entityhistory' => $entityhistory2)
+ );
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('frontend',
'entityview'));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('app_data' => $data));
+ }
+
+
+ public function add_ticket()
+ {
+ $bo = CreateObject('property.botts',true);
+ $boloc = CreateObject('property.bolocation',true);
+
+ $location_details =
$boloc->read_single($this->location_code, array('noattrib' => true));
+
+ $values = phpgw::get_var('values');
+ $missingfields = false;
+ $msglog = array();
+
+ // Read default assign-to-group from config
+ $config = CreateObject('phpgwapi.config', 'frontend');
+ $config->read();
+ $default_cat = $config->config_data['tts_default_cat']
? $config->config_data['tts_default_cat'] : 0;
+
+ if(!$default_cat)
+ {
+ throw new Exception('Default category is not
set in config');
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ if(isset($values['save']))
+ {
+ foreach($values as $key => $value)
+ {
+ if(empty($value) && $key !== 'file')
+ {
+ $missingfields = true;
+ }
+ }
+
+ if(!$missingfields && !phpgw::get_var('added'))
+ {
+ $location = array
+ (
+ 'loc1' =>
$location_details['loc1'],
+ 'loc2' =>
$location_details['loc2']
+ );
+
+ $assignedto =
execMethod('property.boresponsible.get_responsible', array('location' =>
$location, 'cat_id' => $default_cat));
+
+ if(!$assignedto)
+ {
+ $default_group =
$config->config_data['tts_default_group'];
+ }
+ else
+ {
+ $default_group = 0;
+ }
+
+ $ticket = array(
+ 'origin' => null,
+ 'origin_id' => null,
+ 'cat_id' =>
$values['cat_id'],
+ 'group_id' => ($default_group
? $default_group : null),
+ 'assignedto'=> $assignedto,
+ 'priority' => 3,
+ 'status' => 'O', // O = Open
+ 'subject' => $values['title'],
+ 'details' =>
$values['locationdesc'].":\n\n".$values['description'],
+ 'apply' => lang('Apply'),
+ 'contact_id'=> 0,
+ 'location' => $location,
+ 'street_name' =>
$location_details['street_name'],
+ 'street_number' =>
$location_details['street_number'],
+ 'location_name' =>
$location_details['loc1_name'],
+ //'locationdesc' =>
$values['locationdesc']
+ );
+
+ $result = $bo->add($ticket);
+ if($result['message'][0]['msg'] != null
&& $result['id'] > 0)
+ {
+ $msglog['message'][] =
array('msg' => lang('Ticket added'));
+ $noform = true;
+
+
+ // Files
+ $values['file_name'] =
@str_replace(' ','_',$_FILES['file']['name']);
+ if($values['file_name'] &&
$msglog['id'])
+ {
+ $bofiles =
CreateObject('property.bofiles');
+ $to_file =
$bofiles->fakebase . '/fmticket/' . $msglog['id'] . '/' . $values['file_name'];
+
+
if($bofiles->vfs->file_exists(array(
+ 'string' =>
$to_file,
+ 'relatives' =>
array(RELATIVE_NONE)
+ )))
+ {
+
$msglog['error'][] = array('msg'=>lang('This file already exists !'));
+ }
+ else
+ {
+
$bofiles->create_document_dir("fmticket/{$result['id']}");
+
$bofiles->vfs->override_acl = 1;
+
+
if(!$bofiles->vfs->cp(array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' =>
$to_file,
+ 'relatives'
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$msglog['error'][] = array('msg' => lang('Failed to upload file!'));
+ }
+
$bofiles->vfs->override_acl = 0;
+ }
+ }
+
+ $redirect = true;
+
phpgwapi_cache::session_set('frontend', 'msgbox', $msglog);
+ // /Files
+ }
+ }
+ else
+ {
+ $msglog['error'][] =
array('msg'=>lang('Missing field(s)'));
+ }
+ }
+
+
+ $tts_frontend_cat_selected =
$config->config_data['tts_frontend_cat'] ?
$config->config_data['tts_frontend_cat'] : array();
+
+ $cats = CreateObject('phpgwapi.categories', -1,
'property', '.ticket');
+ $cats->supress_info = true;
+ $categories = $cats->return_sorted_array(0, false, '',
'', '', true, '', false);
+
+ $category_list = array();
+ foreach ( $categories as $category)
+ {
+ if ( in_array($category['id'],
$tts_frontend_cat_selected))
+ {
+ $category_list[] = array
+ (
+ 'id' =>
$category['id'],
+ 'name' =>
$category['name'],
+ 'selected' =>
$category['id'] == $default_cat ? 1 : 0
+ );
+ }
+ }
+
+ $data = array(
+ 'redirect' =>
isset($redirect) ? $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'frontend.uientity.index')) : null,
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog)),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'frontend.uientity.add_ticket', 'noframework' => '1')),
+ 'title' => $values['title'],
+ 'locationdesc' =>
$values['locationdesc'],
+ 'description' =>
$values['description'],
+ 'noform' => $noform,
+ 'category_list' => $category_list
+ );
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('frontend','helpdesk'));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('add_ticket' => $data));
+ }
+
+ }
Modified: trunk/frontend/inc/class.uifrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.uifrontend.inc.php 2011-06-17 13:54:27 UTC (rev
7397)
+++ trunk/frontend/inc/class.uifrontend.inc.php 2011-06-19 17:29:42 UTC (rev
7398)
@@ -54,10 +54,10 @@
// This module uses XSLT templates
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $config = CreateObject('phpgwapi.config','frontend');
- $config->read();
- $use_fellesdata =
$config->config_data['use_fellesdata'];
- $logo_path = $config->config_data['logo_path'];
+ $this->config =
CreateObject('phpgwapi.config','frontend');
+ $this->config->read();
+ $use_fellesdata =
$this->config->config_data['use_fellesdata'];
+ $logo_path = $this->config->config_data['logo_path'];
// Get the mode: in frame or full screen
$mode = phpgwapi_cache::session_get('frontend',
'noframework');
@@ -77,7 +77,7 @@
$this->header_state['logo_path'] = $logo_path;
// Get navigation parameters
- $param_selected_location = phpgw::get_var('location');
// New location selected from locations list
+ $param_selected_location =
'1102';//phpgw::get_var('location'); // New location
selected from locations list
$param_selected_org_unit =
phpgw::get_var('org_unit_id'); // New organisational unit
selected from organisational units list
$param_only_org_unit = phpgw::get_var('org_enhet_id');
// Frontend access from rental module regarding specific organisational unit
@@ -281,8 +281,33 @@
'link' =>
$GLOBALS['phpgw']->link('/',array('menuaction' => "frontend.ui{$name}.index",
'type'=>$location_id, 'noframework' => $noframework))
);
}
+ unset($location);
}
+
+ // this one is for generic entitysupport from the app
'property'
+ $entity_frontend =
isset($this->config->config_data['entity_frontend']) &&
$this->config->config_data['entity_frontend'] ?
$this->config->config_data['entity_frontend'] : array();
+
+ if($entity_frontend)
+ {
+ $entity =
CreateObject('property.soadmin_entity');
+ }
+
+ foreach ($entity_frontend as $location)
+ {
+ if ( $GLOBALS['phpgw']->acl->check($location,
PHPGW_ACL_READ, 'property') )
+ {
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $location);
+ $location_arr = explode('.', $location);
+
+ $category =
$entity->read_single_category($location_arr[2], $location_arr[3]);
+ $tabs[$location_id] = array(
+ 'label' => $category['name'],
+ 'link' =>
$GLOBALS['phpgw']->link('/',array('menuaction' => "frontend.uientity.index",
'location_id' => $location_id, 'noframework' => $noframework))
+ );
+ }
+ }
+
$extra_tabs = phpgwapi_cache::session_get('frontend',
'extra_tabs');
if(isset($extra_tabs))
@@ -446,9 +471,7 @@
$GLOBALS['phpgw_info']['flags']['nofooter'] = true;
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
- $config = CreateObject('phpgwapi.config','frontend');
- $config->read();
- $doc_type =
$config->config_data['picture_building_cat'] ?
$config->config_data['picture_building_cat'] : 'profilbilder';
+ $doc_type =
$this->config->config_data['picture_building_cat'] ?
$this->config->config_data['picture_building_cat'] : 'profilbilder';
// Get object id from params or use 'dummy'
$location_code = phpgw::get_var('loc_code') ?
phpgw::get_var('loc_code') : 'dummy';
Modified: trunk/frontend/inc/hook_config.inc.php
===================================================================
--- trunk/frontend/inc/hook_config.inc.php 2011-06-17 13:54:27 UTC (rev
7397)
+++ trunk/frontend/inc/hook_config.inc.php 2011-06-19 17:29:42 UTC (rev
7398)
@@ -218,3 +218,37 @@
}
return $out;
}
+ /**
+ * Get HTML checkbox with categories that are candidates for frontend
documents cat
+ *
+ * @param $config
+ * @return string options for selectbox
+ */
+ function entity_frontend($config)
+ {
+ $entity =
CreateObject('property.soadmin_entity');
+ $entity_list = $entity->read(array('allrows' => true));
+ $entity_frontend_selected = isset($config['entity_frontend']) ?
$config['entity_frontend'] : array();
+ $out = '';
+ foreach($entity_list as $entry)
+ {
+ $out .= <<<HTML
+ <tr><td><input type="checkbox" disabled
="disabled" name="entity_{$entry['id']}" value="entity_{$entry['id']}"
{$checked}><label><b>{$entry['name']}</b></label></td></tr>
+HTML;
+ $categories =
$entity->read_category_tree2($entry['id']);
+
+ foreach ($categories as $category)
+ {
+ $checked = '';
+ if (
in_array(".entity.{$entry['id']}.{$category['id']}", $entity_frontend_selected))
+ {
+ $checked = ' checked';
+ }
+
+ $out .= <<<HTML
+ <tr><td><input type="checkbox"
name="newsettings[entity_frontend][]"
value=".entity.{$entry['id']}.{$category['id']}"
{$checked}><label>{$category['name']}</label></td></tr>
+HTML;
+ }
+ }
+ return $out;
+ }
Added: trunk/frontend/js/yahoo/entity.list.js
===================================================================
--- trunk/frontend/js/yahoo/entity.list.js (rev 0)
+++ trunk/frontend/js/yahoo/entity.list.js 2011-06-19 17:29:42 UTC (rev
7398)
@@ -0,0 +1,142 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+ //define SelectButton
+/*
+ var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4;
+ var selectsButtons = [
+ {order:0, var_URL:'cat_id', name:'btn_cat_id',
style:'categorybutton', dependiente:''},
+ {order:1, var_URL:'district_id',name:'btn_district_id',
style:'districtbutton', dependiente:''},
+ {order:2, var_URL:'status', name:'btn_status_id',
style:'statusbutton', dependiente:''},
+ {order:3, var_URL:'filter', name:'btn_user_id',
style:'userIdbutton', dependiente:''},
+ {order:4, var_URL:'criteria_id',
name:'btn_criteria_id',style:'criteriabutton',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"}
+ ]
+
+ var toolTips = [
+ {name:'btn_export', title:'download', description:'Download table to your
browser',ColumnDescription:''}
+ ]
+
+ // define Text buttons
+ var textImput = [
+ {order:0, name:'query', id:'txt_query'}
+ ]
+
+ // define the hidden column in datatable
+ var config_values = {
+ date_search : 1 //if search has link "Data search"
+ }
+
+ var linktoolTips =[
+ {name:'btn_columns', title:'columns', description:'Choose columns'},
+ {name:'btn_data_search', title:'Data search', description:'Narrow the
search by dates'}
+ ]
+
+
+/****************************************************************************************/
+ this.particular_setting = function()
+ {
+ if(flag_particular_setting=='init')
+ {
+ //category
+/*
+ index =
locate_in_array_options(0,"value",path_values.cat_id);
+ if(index)
+ {
+ oMenuButton_0.set("label", ("<em>" +
array_options[0][index][1] + "</em>"));
+ }
+*/
+ //district
+ index =
locate_in_array_options(1,"value",path_values.district_id);
+ if(index)
+ {
+ oMenuButton_1.set("label", ("<em>" +
array_options[1][index][1] + "</em>"));
+ }
+
+ //status
+ index =
locate_in_array_options(2,"value",path_values.status);
+ if(index)
+ {
+ oMenuButton_2.set("label", ("<em>" +
array_options[2][index][1] + "</em>"));
+ }
+
+ //filter
+ index =
locate_in_array_options(3,"value",path_values.filter);
+ if(index)
+ {
+ oMenuButton_3.set("label", ("<em>" +
array_options[3][index][1] + "</em>"));
+ }
+
+ //district
+ index =
locate_in_array_options(4,"value",path_values.criteria_id);
+ if(index)
+ {
+ oMenuButton_4.set("label", ("<em>" +
array_options[4][index][1] + "</em>"));
+ }
+
+ //eliminate "no category" option because is necesary
have a category in the PHP query
+ // delete oMenuButton_0.getMenu().itemData[0];
+ //correcting it. now look for value
+ // index =
locate_in_array_options(0,"value",path_values.cat_id);
+ //only change LABEL, because value (cat_id) is include
un URL (PHP use redirect)
+ // oMenuButton_0.set("label", ("<em>" +
array_options[0][index][1] + "</em>"));
+ // oMenuButton_0.focus();
+ YAHOO.util.Dom.get(textImput[0].id).focus();
+ }
+ else if(flag_particular_setting=='update')
+ {
+ //nothing
+ }
+
+ }
+
+
+ this.showlightbox = function(sUrl)
+ {
+ var onDialogShow = function(e, args, o)
+ {
+ var frame = document.createElement('iframe');
+ frame.src = sUrl;
+ frame.width = "100%";
+ frame.height = "460";
+ o.setBody(frame);
+ };
+ lightbox.showEvent.subscribe(onDialogShow, lightbox);
+ lightbox.show();
+ }
+
+
+/****************************************************************************************/
+
+ this.myParticularRenderEvent = function()
+ {
+ //don't delete it
+ }
+
+/****************************************************************************************/
+ YAHOO.util.Event.addListener(window, "load", function()
+ {
+ //avoid render buttons html
+ 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();
+
+
+ });
Modified: trunk/frontend/templates/base/config.tpl
===================================================================
--- trunk/frontend/templates/base/config.tpl 2011-06-17 13:54:27 UTC (rev
7397)
+++ trunk/frontend/templates/base/config.tpl 2011-06-19 17:29:42 UTC (rev
7398)
@@ -82,6 +82,16 @@
</td>
</tr>
<tr class="row_on">
+ <td>{lang_entity_frontend}:</td>
+ <td>
+ <!--to be able to blank the setting - need an empty value-->
+ <input type = 'hidden' name="newsettings[entity_frontend][]"
value="">
+ <table>
+{hook_entity_frontend}
+ </table>
+ </td>
+ </tr>
+ <tr class="row_on">
<td>{lang_document_valid_types}(comma separated list of
valid filetypes):</td>
<td><input name="newsettings[document_valid_types]"
value="{value_document_valid_types}"></td>
</tr>
Added: trunk/frontend/templates/base/entity.xsl
===================================================================
--- trunk/frontend/templates/base/entity.xsl (rev 0)
+++ trunk/frontend/templates/base/entity.xsl 2011-06-19 17:29:42 UTC (rev
7398)
@@ -0,0 +1,143 @@
+<!-- $Id: helpdesk.xsl 6663 2010-12-09 10:45:28Z sigurdne $ -->
+<xsl:template match="entity" xmlns:php="http://php.net/xsl">
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <div class="yui-navset" id="ticket_tabview">
+ <xsl:value-of disable-output-escaping="yes" select="tabs" />
+ <div class="yui-content">
+ <xsl:choose>
+ <xsl:when
test="normalize-space(//header/selected_location) != ''">
+ <div class="toolbar-container">
+ <div class="toolbar">
+ <xsl:apply-templates
select="datatable/actions" />
+ </div>
+ </div>
+ <div class="tickets">
+ <table cellpadding="2" cellspacing="2"
width="95%" 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>
+ </table>
+ <xsl:apply-templates select="datatable" />
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <div class="tickets">
+ <xsl:value-of select="php:function('lang',
'no_buildings')"/>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </div>
+ </div>
+
+</xsl:template>
+
+<xsl:template match="lightbox_name" xmlns:php="http://php.net/xsl">
+</xsl:template>
+
+<xsl:template match="add_ticket" xmlns:php="http://php.net/xsl">
+ <xsl:choose>
+ <xsl:when test="normalize-space(redirect) != ''">
+ <script>
+ window.parent.location = '<xsl:value-of select="redirect"/>';
+ window.close();
+ </script>
+ </xsl:when>
+ </xsl:choose>
+ <h2>Ny skademelding</h2>
+ <form ENCTYPE="multipart/form-data" name="form" method="post"
action="{form_action}">
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="2">
+ <xsl:call-template name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+
+ <xsl:if test="noform != 1">
+ <tr>
+ <td class="th_text" valign="top">
+ <xsl:value-of select="php:function('lang',
'category')" />
+ </td>
+ <td class="th_text" valign="top">
+ <select name="values[cat_id]" >
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'category')" />
+ </xsl:attribute>
+ <xsl:apply-templates
select="category_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" valign="top">
+ <xsl:value-of select="php:function('lang', 'subject')"
/>
+ </td>
+ <td class="th_text" valign="top">
+ <input type="text" name="values[title]"
value="{title}"/>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="th_text" valign="top">
+ <xsl:value-of select="php:function('lang',
'locationdesc')" />
+ </td>
+ <td class="th_text" valign="top">
+ <input type="text" name="values[locationdesc]"
value="{locationdesc}"/>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="php:function('lang',
'description')" />
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[description]" wrap="virtual" onMouseout="window.status='';return
true;">
+ <xsl:value-of select="description"/>
+ </textarea>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="php:function('lang', 'file')" />
+ </td>
+ <td>
+ <input type="file" name="file" size="50">
+ <xsl:attribute name="title">
+ <xsl:value-of select="php:function('lang',
'file')" />
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable name="lang_send"><xsl:value-of
select="php:function('lang', 'send')" /></xsl:variable>
+ <input type="submit" name="values[save]"
value="{$lang_send}" title='{$lang_send}'/>
+ </td>
+ </tr>
+ </xsl:if>
+ </table>
+ </form>
+</xsl:template>
+
+<xsl:template match="category_list">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
+
+
Added: trunk/frontend/templates/base/entityview.xsl
===================================================================
--- trunk/frontend/templates/base/entityview.xsl
(rev 0)
+++ trunk/frontend/templates/base/entityview.xsl 2011-06-19 17:29:42 UTC
(rev 7398)
@@ -0,0 +1,84 @@
+<xsl:template match="entityinfo" xmlns:php="http://php.net/xsl">
+
+ <table cellpadding="2" cellspacing="2" width="95%" 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>
+ </table>
+
+ <div class="yui-navset" id="entity_tabview">
+ <div class="yui-content">
+ <div id="entityinfo">
+ <ul style="margin: 2em;">
+ <li style="margin-bottom: 1em;">
+ <a href="{entitylist}"> <<
<xsl:value-of select="php:function('lang', 'show_all_entities')"/></a>
+ </li>
+ <li>
+ <ul>
+ <li style="margin-bottom: 5px;">
+ <img
src="frontend/templates/base/images/16x16/comment.png" class="list_image"/>
<strong><xsl:value-of select="entity/subject"/></strong>
+ </li>
+ <li class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/clock_edit.png" class="list_image"/>
<xsl:value-of select="php:function('lang', 'entry_date')"/> <xsl:value-of
select="entity/entry_date"/><xsl:value-of select="php:function('lang',
'of')"/><xsl:value-of select="entity/user_name"/>
+ </li>
+ <li class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/timeline_marker.png"
class="list_image"/> <xsl:value-of select="php:function('lang', 'status')"/>:
<xsl:value-of select="entity/status_name"/>
+ </li>
+ <xsl:choose>
+ <xsl:when
test="entity/value_vendor_name">
+ <li
class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/user_suit.png" class="list_image"/>
<xsl:value-of select="php:function('lang', 'vendor')"/>: <xsl:value-of
select="entity/value_vendor_name"/>
+ </li>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="entity/assigned_to_name">
+ <li
class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/user_red.png" class="list_image"/>
<xsl:value-of select="php:function('lang', 'assigned_to')"/>: <xsl:value-of
select="entity/assigned_to_name"/>
+ </li>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="entity/value_contact_name">
+ <li
class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/user_green.png" class="list_image"/>
<xsl:value-of select="php:function('lang', 'contact')"/>: <xsl:value-of
select="entity/value_contact_name"/>
+
Telefon: <xsl:value-of select="entity/value_contact_tel"/>
+ E-post:
<xsl:value-of select="entity/value_contact_email"/>
+ </li>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="entity/publish_note = 1">
+ <li
class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/page_white_edit.png"
class="list_image"/><xsl:value-of select="php:function('lang', 'message')"/>:
<xsl:value-of select="entity/details"/>
+ </li>
+ </xsl:when>
+ </xsl:choose>
+ <li class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/comments.png" class="list_image"/>
<xsl:value-of select="php:function('lang', 'comments')"/>:<br/>
+ <hr/>
+ <ul>
+ <xsl:for-each
select="entityhistory/*[starts-with(name(), 'record')]">
+ <li
class="entity_detail">
+ <img
src="frontend/templates/base/images/16x16/page_white_edit.png"
class="list_image"/> <xsl:value-of select="date"/> -
+ <img
src="frontend/templates/base/images/16x16/user_gray.png" class="list_image"/>
<xsl:value-of select="user"/><br/>
+ <p
style="padding: 10px;"><xsl:value-of select="note"/></p>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</xsl:template>
+
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7398] frontend: show generic entities from property,
Sigurd Nes <=