fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17207] FDV 178 controller, serie at locations


From: sigurdne
Subject: [Fmsystem-commits] [17207] FDV 178 controller, serie at locations
Date: Mon, 30 Oct 2017 11:26:59 -0400 (EDT)

Revision: 17207
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17207
Author:   sigurdne
Date:     2017-10-30 11:26:58 -0400 (Mon, 30 Oct 2017)
Log Message:
-----------
FDV 178 controller, serie at locations

Modified Paths:
--------------
    trunk/property/inc/class.soadmin_location.inc.php
    trunk/property/inc/class.solocation.inc.php
    trunk/property/inc/class.uiadmin_location.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/admin_location.xsl
    trunk/property/templates/base/location.xsl

Added Paths:
-----------
    trunk/property/inc/class.controller_helper.inc.php

Added: trunk/property/inc/class.controller_helper.inc.php
===================================================================
--- trunk/property/inc/class.controller_helper.inc.php                          
(rev 0)
+++ trunk/property/inc/class.controller_helper.inc.php  2017-10-30 15:26:58 UTC 
(rev 17207)
@@ -0,0 +1,502 @@
+<?php
+       /**
+        * phpGroupWare - property: a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2017 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 entity
+        * @version $Id: class.uientity.inc.php 16615 2017-04-23 10:01:37Z 
sigurdne $
+        */
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_controller_helper
+       {
+
+               protected
+                       $check_lst_time_span,
+                       $type_app,
+                       $type,
+                       $acl_read,
+                       $acl_add,
+                       $acl_edit,
+                       $acl_delete;
+
+               public $public_functions = array
+                       (
+                       'get_controls_at_component' => true,
+                       'get_assigned_history' => true,
+                       'get_cases' => true,
+                       'get_checklists'=>true,
+                       'get_cases_for_checklist' => true,
+               );
+
+               function __construct($data = array())
+               {
+                       $this->acl_read = !empty($data['acl_read']) ? 
$data['acl_read'] : false;
+                       $this->acl_add = !empty($data['acl_add']) ? 
$data['acl_add'] : false;
+                       $this->acl_edit = !empty($data['acl_edit']) ? 
$data['acl_edit'] : false;
+                       $this->acl_delete = !empty($data['acl_delete']) ? 
$data['acl_delete'] : false;
+                       $this->type_app = !empty($data['type_app']) ? 
$data['type_app'] : array();
+                       $this->type = !empty($data['type']) ? $data['type'] : 
false;
+               }
+
+               public function jquery_results( $result = array() )
+               {
+                       if (!$result)
+                       {
+                               $result['recordsTotal'] = 0;
+                               $result['recordsFiltered'] = 0;
+                               $result['data'] = array();
+                       }
+
+                       $result['recordsTotal'] = $result['total_records'];
+                       $result['recordsFiltered'] = $result['recordsTotal'];
+                       $result['data'] = (array)$result['results'];
+                       unset($result['results']);
+                       unset($result['total_records']);
+
+                       return $result;
+               }
+
+               function get_assigned_history()
+               {
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+                       if ($this->acl_read)
+                       {
+                               phpgw::no_access();
+                       }
+                       $serie_id = phpgw::get_var('serie_id', 'int');
+                       $history = 
execMethod('controller.socontrol.get_assigned_history', array('serie_id' => 
$serie_id));
+                       $lang_user = lang('user');
+                       $lang_date = lang('date');
+
+                       $ret = <<<HTML
+                       <html>
+                               <head>
+                               </head>
+                               <body>
+                                       <table style="width:90%" align = 
'center'>
+                                               <tr align = 'left'>
+                                                       <th>
+                                                               {$lang_user}
+                                                       </th>
+                                                       <th>
+                                                               {$lang_date}
+                                                       </th>
+                                               </tr>
+
+HTML;
+                       foreach ($history as $entry)
+                       {
+                               $date = 
$GLOBALS['phpgw']->common->show_date($entry['assigned_date']);
+                               $ret .= <<<HTML
+                                               <tr align = 'left'>
+                                                       <td>
+                                                               
{$entry['assigned_to_name']}
+                                                       </td>
+                                                       <td>
+                                                               {$date}
+                                                       </td>
+                                               </tr>
+HTML;
+                       }
+                       $ret .= <<<HTML
+                                       </table>
+                               </body>
+                       </html>
+HTML;
+                       echo $ret;
+               }
+
+               public function get_controls_at_component( $location_id = 0, 
$id = 0, $skip_json = false )
+               {
+                       $location_id = $location_id ? $location_id : 
phpgw::get_var('location_id', 'int'); 
+
+                       if (!$location_id)
+                       {
+                               $entity_id = phpgw::get_var('entity_id', 'int');
+                               $cat_id = phpgw::get_var('cat_id', 'int');
+                               $type = phpgw::get_var('type', 'string', 
'REQUEST', 'entity');
+
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$type], 
".{$type}.{$entity_id}.{$cat_id}");
+                       }
+
+                       $id = $id ? $id : phpgw::get_var('id', 'int');
+                       if (!$id)
+                       {
+                               return array();
+                       }
+
+                       if (!$this->acl_read)
+                       {
+                               phpgw::no_access();
+                       }
+
+                       $repeat_type_array = array
+                               (
+                               "0" => lang('day'),
+                               "1" => lang('week'),
+                               "2" => lang('month'),
+                               "3" => lang('year')
+                       );
+
+                       $lang_history = lang('history');
+                       $controls = 
execMethod('controller.socontrol.get_controls_at_component', array(
+                               'location_id' => $location_id, 'component_id' 
=> $id));
+                       foreach ($controls as &$entry)
+                       {
+                               $menuaction = 'controller.uicomponent.index';
+
+                               $control_link_data = array
+                                       (
+                                       'menuaction' => $menuaction,
+                                       'location_id' => $location_id,
+                                       'component_id' => $id,
+                               );
+
+                               $entry['title_text'] = $entry['title'];
+                               $entry['title'] = '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $control_link_data) . '" 
target="_blank">' . $entry['title'] . '</a>';
+                               $entry['assigned_to_name'] = "<a 
title=\"{$lang_history}\" 
onclick='javascript:showlightbox_assigned_history({$entry['serie_id']});'>{$entry['assigned_to_name']}</a>";
+
+                               $entry['start_date'] = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $entry['repeat_type'] = 
$repeat_type_array[$entry['repeat_type']];
+                               $entry['total_time'] = $entry['service_time'] + 
$entry['controle_time'];
+                       }
+
+                       $phpgw_return_as = phpgw::get_var('phpgw_return_as');
+
+                       if (($phpgw_return_as == 'json' && $skip_json) || 
$phpgw_return_as != 'json')
+                       {
+                               return $controls;
+                       }
+
+                       $result_data = array
+                               (
+                               'results' => $controls,
+                               'total_records' => count($controls),
+                               'draw' => phpgw::get_var('draw', 'int')
+                       );
+
+                       return $this->jquery_results($result_data);
+               }
+
+               /**
+                * Get controller cases related to this item.
+                * @param integer $location_id
+                * @param integer $id
+                * @param integer $year
+                * @return string
+                */
+               public function get_cases( $location_id = 0, $id = 0, $year = 0 
)
+               {
+                       if (!$location_id)
+                       {
+                               $location_id = phpgw::get_var('location_id', 
'int');
+                       }
+                       if (!$id)
+                       {
+                               $id = phpgw::get_var('id', 'int');
+                       }
+                       if (!$year)
+                       {
+                               $year = phpgw::get_var('year', 'int');
+                       }
+
+//                     $year = $year ? $year : -1; //all
+
+                       $_controls = 
$this->get_controls_at_component($location_id, $id, $skip_json = true);
+
+                       $socase = CreateObject('controller.socase');
+                       $controller_cases = 
$socase->get_cases_by_component($location_id, $id);
+                       $_statustext = array();
+                       $_statustext[0] = lang('open');
+                       $_statustext[1] = lang('closed');
+                       $_statustext[2] = lang('pending');
+
+                       $_cases = array();
+                       foreach ($controller_cases as $case)
+                       {
+                               $_case_year = date('Y', $case['modified_date']);
+
+                               if ($_case_year != $year && $year != -1)
+                               {
+                                       continue;
+                               }
+
+                               $socheck_list = 
CreateObject('controller.socheck_list');
+                               $control_id = 
$socheck_list->get_single($case['check_list_id'])->get_control_id();
+                               foreach ($_controls as $_control)
+                               {
+                                       if ($_control['control_id'] == 
$control_id)
+                                       {
+                                               $_control_name = 
$_control['title_text'];
+                                               break;
+                                       }
+                               }
+//                                             _debug_array($check_list);die();
+
+                               switch ($case['status'])
+                               {
+                                       case 0:
+                                       case 2:
+                                               $_method = 'view_open_cases';
+                                               break;
+                                       case 1:
+                                               $_method = 'view_closed_cases';
+                                               break;
+                                       default:
+                                               $_method = 'view_open_cases';
+                               }
+
+                               $_link = $GLOBALS['phpgw']->link('/index.php', 
array
+                                       (
+                                       'menuaction' => 
"controller.uicase.{$_method}",
+                                       'check_list_id' => 
$case['check_list_id']
+                                       )
+                               );
+
+
+                               $_value_arr = array();
+
+                               if($case['measurement'])
+                               {
+                                       $_value_arr[] = $case['measurement'];
+                               }
+                               if($case['descr'])
+                               {
+                                       $_value_arr[] = $case['descr'];
+                               }
+
+                               $_cases[] = array
+                                       (
+                                       'url' => "<a href=\"{$_link}\" > 
{$case['check_list_id']}</a>",
+                                       'type' => $_control_name,
+                                       'title' => "<a href=\"{$_link}\" > 
{$case['title']}</a>",
+                                       'value' => implode('</br>', 
$_value_arr),
+                                       'status' => 
$_statustext[$case['status']],
+                                       'user' => 
$GLOBALS['phpgw']->accounts->get($case['user_id'])->__toString(),
+                                       'entry_date' => 
$GLOBALS['phpgw']->common->show_date($case['modified_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                               );
+                               unset($_link);
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               $result_data = array
+                                       (
+                                       'results' => $_cases,
+                                       'total_records' => count($_cases),
+                                       'draw' => phpgw::get_var('draw', 'int')
+                               );
+
+                               return $this->jquery_results($result_data);
+                       }
+                       return $_cases;
+               }
+
+               /**
+                * Get controller cases related to this item and a spesific 
checklist.
+                * @return array
+                */
+               public function get_cases_for_checklist()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id', 'int');
+                       $so_check_item = 
CreateObject('controller.socheck_item');
+                       $controller_cases = 
$so_check_item->get_check_items_with_cases($check_list_id, $_type = null, 
'all', null, null);
+
+                       $_statustext = array();
+                       $_statustext[0] = lang('open');
+                       $_statustext[1] = lang('closed');
+                       $_statustext[2] = lang('pending');
+
+                       $_case_years = array();
+                       $_cases = array();
+
+                       $socheck_list = CreateObject('controller.socheck_list');
+                       $socontrol = CreateObject('controller.socontrol');
+
+                       foreach ($controller_cases as $check_item)
+                       {
+                               $checklist_id = 
$check_item->get_check_list_id();
+                               $control_id = 
$socheck_list->get_single($checklist_id)->get_control_id();
+
+                               $_control_name = 
$socontrol->get_single($control_id)->get_title();
+
+                               $cases_array = $check_item->get_cases_array();
+                               foreach ($cases_array as $case)
+                               {
+                                       switch ($case->get_status())
+                                       {
+                                               case 0:
+                                               case 2:
+                                                       $_method = 
'view_open_cases';
+                                                       break;
+                                               case 1:
+                                                       $_method = 
'view_closed_cases';
+                                                       break;
+                                               default:
+                                                       $_method = 
'view_open_cases';
+                                       }
+
+                                       $_link = 
$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                               'menuaction' => 
"controller.uicase.{$_method}",
+                                               'check_list_id' => 
$check_list_id
+                                               )
+                                       );
+                                       $_value_arr = array();
+
+                                       if($case->get_measurement())
+                                       {
+                                               $_value_arr[] = 
$case->get_measurement();
+                                       }
+                                       if($case->get_descr())
+                                       {
+                                               $_value_arr[] = 
$case->get_descr();
+                                       }
+
+                                       $_cases[] = array
+                                               (
+                                               'url' => "<a href=\"{$_link}\" 
> {$check_list_id}</a>",
+                                               'type' => $_control_name,
+                                               'title' => "<a 
href=\"{$_link}\" >" . $check_item->get_control_item()->get_title() . "</a>",
+                                               'value' => implode('</br>', 
$_value_arr),
+                                               'status' => 
$_statustext[$case->get_status()],
+                                               'user' => 
$GLOBALS['phpgw']->accounts->get($case->get_user_id())->__toString(),
+                                               'entry_date' => 
$GLOBALS['phpgw']->common->show_date($case->get_modified_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                       );
+                                       unset($_link);
+                               }
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               $result_data = array
+                                       (
+                                       'results' => $_cases,
+                                       'total_records' => count($_cases),
+                                       'draw' => phpgw::get_var('draw', 'int')
+                               );
+
+                               return $this->jquery_results($result_data);
+                       }
+                       return $_cases;
+               }
+
+               /**
+                * Get controller checklists related to this item.
+                * @param integer $location_id
+                * @param integer $id
+                * @param integer $year
+                * @return string
+                */
+               public function get_checklists( $location_id = 0, $id = 0, 
$year = 0 )
+               {
+                       if (!$location_id)
+                       {
+                               $location_id = phpgw::get_var('location_id', 
'int');
+                       }
+                       if (!$id)
+                       {
+                               $id = phpgw::get_var('id', 'int');
+                       }
+                       if (!$year)
+                       {
+                               $year = phpgw::get_var('year', 'int', 
'REQUEST', date('Y'));
+                       }
+                       $socheck_list = CreateObject('controller.socheck_list');
+
+                       $start_and_end = 
$socheck_list->get_start_and_end_for_component($location_id, $id);
+                       $start_year = date('Y', 
$start_and_end['start_timestamp']);
+                       $end_year = date('Y', $start_and_end['end_timestamp']);
+                       if (!$year)
+                       {
+                               $year = $end_year;
+                       }
+
+                       for ($j = $start_year; $j < ($end_year + 1); $j++)
+                       {
+                               $this->check_lst_time_span[] = array(
+                                       'id' => $j,
+                                       'name' => $j,
+                                       'selected' => $j == date('Y') ? 1 : 0
+                               );
+                       }
+
+                       $from_date_ts = mktime(0, 0, 0, 1, 1, $year);
+                       $to_date_ts = mktime(23, 59, 59, 12, 31, $year);
+                       $socontrol = CreateObject('controller.socontrol');
+
+                       $control_id_with_check_list_array = 
$socheck_list->get_check_lists_for_component($location_id, $id, $from_date_ts, 
$to_date_ts);
+
+                       $_statustext = array();
+                       $_statustext[0] = lang('open');
+                       $_statustext[1] = lang('closed');
+                       $_statustext[2] = lang('pending');
+                       $_check_list = array();
+                       foreach ($control_id_with_check_list_array as $control)
+                       {
+                               $_control_name = 
$socontrol->get_single($control->get_id())->get_title();
+                               $check_lists = 
$control->get_check_lists_array();
+
+                               foreach ($check_lists as $check_list)
+                               {
+                                       $_link = 
$GLOBALS['phpgw']->link('/index.php', array(
+                                                       'menuaction' => 
"controller.uicheck_list.edit_check_list",
+                                                       'check_list_id' => 
$check_list->get_id()
+                                                       )
+                                       );
+                                       $_check_list[] = array
+                                               (
+                                               'id' => $check_list->get_id(),
+                                               'control_name' => "<a 
href=\"{$_link}\" >{$_control_name}</a>",
+                                               'status' => 
$_statustext[$check_list->get_status()],
+                                               'user' => 
$GLOBALS['phpgw']->accounts->get($check_list->get_assigned_to())->__toString(),
+                                               'deadline' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_deadline(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               'planned_date' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_planned_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               'completed_date' => 
$GLOBALS['phpgw']->common->show_date($check_list->get_completed_date(), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               'num_open_cases' => 
$check_list->get_num_open_cases(),
+                                               'num_pending_cases' => 
$check_list->get_num_pending_cases(),
+                                       );
+                                       unset($_link);
+                               }
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               $result_data = array
+                                       (
+                                       'results' => $_check_list,
+                                       'total_records' => count($_check_list),
+                                       'draw' => phpgw::get_var('draw', 'int')
+                               );
+
+                               return $this->jquery_results($result_data);
+                       }
+                       return $_check_list;
+               }
+       }
\ No newline at end of file

Modified: trunk/property/inc/class.soadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_location.inc.php   2017-10-30 10:19:40 UTC 
(rev 17206)
+++ trunk/property/inc/class.soadmin_location.inc.php   2017-10-30 15:26:58 UTC 
(rev 17207)
@@ -100,7 +100,8 @@
                                        (
                                        'id' => $this->db->f('id'),
                                        'name' => $this->db->f('name'),
-                                       'descr' => $this->db->f('descr')
+                                       'descr' => $this->db->f('descr'),
+                                       'enable_controller' => 
$this->db->f('enable_controller')
                                );
                        }
                        return $standard;
@@ -196,7 +197,8 @@
                                        'descr' => $this->db->f('descr'),
                                        'list_info' => 
$this->db->f('list_info', true),
                                        'list_address' => 
$this->db->f('list_address'),
-                                       'list_documents' => 
$this->db->f('list_documents')
+                                       'list_documents' => 
$this->db->f('list_documents'),
+                                       'enable_controller' => 
$this->db->f('enable_controller')
                                );
                        }
                        return $standard;
@@ -546,6 +548,7 @@
                                'list_info' => (isset($values['list_info']) ? 
serialize($values['list_info']) : ''),
                                'list_address' => 
(isset($values['list_address']) ? $values['list_address'] : ''),
                                'list_documents' => 
(isset($values['list_documents']) ? $values['list_documents'] : ''),
+                               'enable_controller' => 
$values['enable_controller'],
                        );
 
                        $value_set = $this->db->validate_update($value_set);
@@ -714,7 +717,8 @@
                                        'descr' => 
stripslashes($this->db->f('descr')),
                                        'list_info' => 
unserialize($this->db->f('list_info')),
                                        'list_address' => 
$this->db->f('list_address'),
-                                       'list_documents' => 
$this->db->f('list_documents')
+                                       'list_documents' => 
$this->db->f('list_documents'),
+                                       'enable_controller' => 
$this->db->f('enable_controller')
                                );
                        }
                        //_debug_array($location_type);

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-10-30 10:19:40 UTC (rev 
17206)
+++ trunk/property/inc/class.solocation.inc.php 2017-10-30 15:26:58 UTC (rev 
17207)
@@ -1281,8 +1281,10 @@
                        {
                                $values['attributes'] = 
$this->custom->find('property', '.location.' . $type_id, 0, '', 'ASC', 
'attrib_sort', true, true);
                        }
+                       $cols = "fm_location{$type_id}.id";
+                       $cols_return[] = 'id';
 
-                       $cols = "fm_location{$type_id}.category as cat_id";
+                       $cols .= ",fm_location{$type_id}.category as cat_id";
                        $cols .= ",fm_location{$type_id}_category.descr as 
category_name";
                        $cols_return[] = 'cat_id';
                        $cols_return[] = 'category_name';
@@ -1352,7 +1354,10 @@
                        }
 
                        //_debug_array($cols_return);
-                       //_debug_array($values);
+                       if(empty($values['id']))
+                       {
+                               $this->update_location();
+                       }
 
                        $location[$location_code] = $values;
                        return $values;

Modified: trunk/property/inc/class.uiadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_location.inc.php   2017-10-30 10:19:40 UTC 
(rev 17206)
+++ trunk/property/inc/class.uiadmin_location.inc.php   2017-10-30 15:26:58 UTC 
(rev 17207)
@@ -173,7 +173,13 @@
                                                        'key' => 'descr',
                                                        'label' => 
lang('Descr'),
                                                        'sortable' => FALSE
-                                               )
+                                               ),
+                                               array
+                                                       (
+                                                       'key' => 
'enable_controller',
+                                                       'label' => lang('enable 
controller'),
+                                                       'sortable' => false
+                                               ),
                                        )
                                )
                        );
@@ -466,11 +472,6 @@
                                'lang_name_standardtext' => lang('Enter a name 
of the standard'),
                                'form_action' => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
                                'done_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_location.index')),
-                               'lang_id' => lang('standard ID'),
-                               'lang_name' => lang('Name'),
-                               'lang_descr' => lang('Descr'),
-                               'lang_save' => lang('save'),
-                               'lang_done' => lang('done'),
                                'value_id' => (isset($id) ? $id : ''),
                                'value_name' => (isset($values['name']) ? 
$values['name'] : ''),
                                'lang_id_standardtext' => lang('Enter the 
standard ID'),
@@ -478,11 +479,10 @@
                                'lang_done_standardtext' => lang('Back to the 
list'),
                                'lang_save_standardtext' => lang('Save the 
standard'),
                                'value_descr' => (isset($values['descr']) ? 
$values['descr'] : ''),
-                               'lang_list_info' => lang('list info'),
                                'lang_select' => lang('select'),
                                'value_list_info' => 
$this->bo->get_list_info((isset($id) ? $id : ''), $values['list_info']),
-                               'lang_location' => lang('location'),
                                'lang_list_info_statustext' => lang('Names of 
levels to list at this level'),
+                               'value_enable_controller'=> 
$values['enable_controller'],
                                'value_list_address' => 
isset($values['list_address']) ? $values['list_address'] : '',
                                'value_list_documents' => 
isset($values['list_documents']) ? $values['list_documents'] : '',
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2017-10-30 10:19:40 UTC (rev 
17206)
+++ trunk/property/inc/class.uilocation.inc.php 2017-10-30 15:26:58 UTC (rev 
17207)
@@ -48,6 +48,7 @@
                var $type_id;
                var $lookup;
                var $location_code;
+               var $controller_helper;
                var $public_functions = array
                        (
                        'query' => true,
@@ -71,6 +72,11 @@
                        'responsiblility_role' => true,
                        'get_delivery_address'  => true,
                        'get_location_exception'=> true,
+                       'get_controls_at_component' => true,
+                       'get_assigned_history' => true,
+                       'get_cases' => true,
+                       'get_checklists'=>true,
+                       'get_cases_for_checklist' => true,
                );
 
                function __construct()
@@ -103,6 +109,15 @@
                        $this->location_code = $this->bo->location_code;
                        $this->type = $this->bo->type;
                        $this->type_id = $this->bo->type_id;
+
+                       $this->controller_helper = 
CreateObject('property.controller_helper', array(
+                               'acl_location' => $this->acl_location,
+                               'acl_read' => $this->acl_read,
+                               'acl_add' => $this->acl_add,
+                               'acl_edit' => $this->acl_edit,
+                               'acl_delete' => $this->acl_delete,
+                               'acl_manage' => $this->acl_manage
+                       ));
                }
 
                /**
@@ -2028,7 +2043,10 @@
                        }
 
                        $tabs = array();
+                       $active_tab = phpgw::get_var('active_tab');
+
                        $tabs['general'] = array('label' => 
$location_types[($type_id - 1)]['name'], 'link' => '#general');
+                       $active_tab = $active_tab ? $active_tab : 'general';
 
                        if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
@@ -2042,7 +2060,7 @@
                                                        'entity_id' => 
$this->entity_id,
                                                        'cat_id' => 
$this->cat_id,
                                                        'attrib_id' => 
$attribute['id'],
-                                                       'id' => $id,
+                                                       'id' => $values['id'],
                                                        'edit' => true
                                                );
 
@@ -2050,6 +2068,15 @@
                                        }
                                }
 
+                               $_enable_controller = 
!!$location_types[($type_id - 1)]['enable_controller'];
+                               if ($_enable_controller && $location_code)
+                               {
+                                       $tabs['controller'] = array('label' => 
lang('controller'), 'link' => '#controller',
+                                               'function' => 
"set_tab('controller')");
+                                       $active_tab = $active_tab ? $active_tab 
: 'general';
+                                       
$GLOBALS['phpgw']->jqcal->add_listener('control_start_date');
+                               }
+
                                $location = ".location.{$type_id}";
                                $attributes_groups = 
$this->bo->get_attribute_groups($location, $values['attributes']);
 //     _debug_array($attributes_groups);die();
@@ -2440,6 +2467,140 @@
                                        }
                                }
 // ---- END INTEGRATION -------------------------
+                               if ($_enable_controller)
+                               {
+                                       $id = (int)$values['id'];
+                                       $_controls = 
$this->get_controls_at_component($location_id, $id);
+
+                                       $controls_def = array
+                                               (
+                                               array('key' => 'serie_id', 
'label' => 'serie', 'sortable' => false, 'resizeable' => true),
+                                               array('key' => 'control_id', 
'label' => lang('controller'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'title', 'label' 
=> lang('title'), 'sortable' => false, 'resizeable' => true),
+                                               array('key' => 
'assigned_to_name', 'label' => lang('user'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'start_date', 
'label' => lang('start date'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'repeat_type', 
'label' => lang('repeat type'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 
'repeat_interval', 'label' => lang('interval'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'controle_time', 
'label' => lang('controle time'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'service_time', 
'label' => lang('service time'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'total_time', 
'label' => lang('total time'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                               array('key' => 'serie_enabled', 
'label' => lang('enabled'), 'sortable' => false,
+                                                       'resizeable' => true),
+//                                     array('key' => 
'select','label'=>lang('select'),'sortable'=>false,'resizeable'=>true),
+                                               array('key' => 'location_id', 
'hidden' => true),
+                                               array('key' => 'component_id', 
'hidden' => true),
+                                               array('key' => 'id', 'hidden' 
=> true),
+                                               array('key' => 'assigned_to', 
'hidden' => true),
+                                       );
+                                       $tabletools = array
+                                               (
+                                               array(
+                                                       'my_name' => 'add',
+                                                       'text' => lang('add'),
+                                                       'type' => 'custom',
+                                                       'className' => 'add',
+                                                       'custom_code' => "
+                                                                               
add_control();"
+                                               ),
+                                               array(
+                                                       'my_name' => 'enable',
+                                                       'text' => 
lang('enable'),
+                                                       'type' => 'custom',
+                                                       'custom_code' => "
+                                                                               
onActionsClick('enable');"
+                                               ),
+                                               array(
+                                                       'my_name' => 'disable',
+                                                       'text' => 
lang('disable'),
+                                                       'type' => 'custom',
+                                                       'custom_code' => "
+                                                                               
onActionsClick('disable');"
+                                               ),
+                                               array(
+                                                       'my_name' => 'edit',
+                                                       'text' => lang('edit'),
+                                                       'type' => 'custom',
+                                                       'custom_code' => "
+                                                                               
onActionsClick('edit');"
+                                               )
+                                       );
+
+                                       $datatable_def[] = array
+                                               (
+                                               'container' => 
'datatable-container_4',
+                                               'requestUrl' => "''",
+                                               'tabletools' => $tabletools,
+                                               'ColumnDefs' => $controls_def,
+                                               'data' => 
json_encode($_controls),
+                                               'config' => array(
+                                                       array('disableFilter' 
=> true),
+                                                       
array('disablePagination' => true)
+                                               )
+                                       );
+
+                                       $_checklists = 
$this->get_checklists($location_id, $id, date('Y'));
+                                       $check_lst_time_span = 
$this->check_lst_time_span;
+
+                                       $_checklists_def = array
+                                               (
+                                               array('key' => 'id', 'label' => 
lang('id'), 'sortable' => false),
+                                               array('key' => 'control_name', 
'label' => lang('name'), 'sortable' => false),
+                                               array('key' => 'status', 
'label' => lang('status'), 'sortable' => true),
+                                               array('key' => 'user', 'label' 
=> lang('user'), 'sortable' => false),
+                                               array('key' => 'deadline', 
'label' => lang('deadline'), 'sortable' => false),
+                                               array('key' => 'planned_date', 
'label' => lang('planned date'), 'sortable' => true),
+                                               array('key' => 
'completed_date', 'label' => lang('completed date'), 'sortable' => false),
+                                               array('key' => 
'num_open_cases', 'label' => lang('open_cases'), 'sortable' => false),
+                                               array('key' => 
'num_pending_cases', 'label' => lang('pending_cases'), 'sortable' => false),
+                                       );
+
+                                       $datatable_def[] = array
+                                               (
+                                               'container' => 
'datatable-container_5',
+                                               'requestUrl' => "''",
+                                               'ColumnDefs' => 
$_checklists_def,
+                                               'data' => 
json_encode($_checklists),
+                                               'config' => array(
+                                                       array('disableFilter' 
=> true),
+                                                       
array('disablePagination' => true),
+                                                       array('singleSelect' => 
true)
+                                               )
+                                       );
+                                       $_cases = 
$this->get_cases($location_id, $id, date('Y')); // initial search
+
+                                       $_case_def = array
+                                               (
+                                               array('key' => 'url', 'label' 
=> lang('id'), 'sortable' => true, 'resizeable' => true),
+                                               array('key' => 'type', 'label' 
=> lang('type'), 'sortable' => true, 'resizeable' => true),
+                                               array('key' => 'title', 'label' 
=> lang('title'), 'sortable' => false, 'resizeable' => true),
+                                               array('key' => 'value', 'label' 
=> lang('value'), 'sortable' => false, 'resizeable' => true),
+                                               array('key' => 'status', 
'label' => lang('status'), 'sortable' => false, 'resizeable' => true),
+                                               array('key' => 'user', 'label' 
=> lang('user'), 'sortable' => true, 'resizeable' => true),
+                                               array('key' => 'entry_date', 
'label' => lang('entry date'), 'sortable' => false,
+                                                       'resizeable' => true),
+                                       );
+
+                                       $datatable_def[] = array
+                                               (
+                                               'container' => 
'datatable-container_6',
+                                               'requestUrl' => "''",
+                                               'ColumnDefs' => $_case_def,
+                                               'data' => json_encode($_cases),
+                                               'config' => array(
+                                                       array('disableFilter' 
=> true),
+                                       //              
array('disablePagination' => true)
+                                               )
+                                       );
+                               }
+
                        }
 
                        unset($values['attributes']);
@@ -2448,6 +2609,7 @@
                                (
                                'datatable_def' => $datatable_def,
                                'integration' => $integration,
+                               'controller' => $_enable_controller && 
$location_code,
                                'roles' => $roles,
                                'edit' => ($mode == 'view') ? '' : true,
                                'lang_change_type' => lang('Change type'),
@@ -2516,7 +2678,8 @@
                                'doc_type_filter' => array('options' => 
$doc_type_filter),
                                '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_jquery::tabview_generate($tabs, 'general'),
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'active_tab' => $active_tab,
                                'documents' => $documents,
                                //'file_tree' => $file_tree,
                                'lang_expand_all' => lang('expand all'),
@@ -2924,4 +3087,30 @@
                        );
 
                }
+
+               public function get_controls_at_component( $location_id = 0, 
$id = 0, $skip_json = false )
+               {
+                       return 
$this->controller_helper->get_controls_at_component($location_id, $id, 
$skip_json);
+               }
+
+               public function get_cases( $location_id = 0, $id = 0, $year = 0 
)
+               {
+                       return 
$this->controller_helper->get_cases($location_id, $id, $year);
+               }
+
+               public function get_cases_for_checklist()
+               {
+                       return 
$this->controller_helper->get_cases_for_checklist();
+               }
+
+               public function get_checklists( $location_id = 0, $id = 0, 
$year = 0 )
+               {
+                       return 
$this->controller_helper->get_checklists($location_id, $id, $year);
+                       
+               }
+
+               function get_assigned_history()
+               {
+                       return $this->controller_helper->get_assigned_history();
+               }
        }
\ No newline at end of file

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2017-10-30 10:19:40 UTC (rev 17206)
+++ trunk/property/setup/setup.inc.php  2017-10-30 15:26:58 UTC (rev 17207)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.723';
+       $setup_info['property']['version']              = '0.9.17.724';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2017-10-30 10:19:40 UTC (rev 
17206)
+++ trunk/property/setup/tables_current.inc.php 2017-10-30 15:26:58 UTC (rev 
17207)
@@ -148,6 +148,7 @@
                                'list_info' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => True),
                                'list_address' => array('type' => 'int', 
'precision' => '2', 'nullable' => True),
                                'list_documents' => array('type' => 'int', 
'precision' => '2', 'nullable' => True),
+                               'enable_controller' => array('type' => 'int', 
'precision' => '2', 'nullable' => True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2017-10-30 10:19:40 UTC (rev 
17206)
+++ trunk/property/setup/tables_update.inc.php  2017-10-30 15:26:58 UTC (rev 
17207)
@@ -9921,4 +9921,28 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.723 to 0.9.17.724
+       *
+       */
+       $test[] = '0.9.17.723';
 
+       function property_upgrade0_9_17_723()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type', 
'enable_controller', array(
+                               'type' =>       'int',
+                               'precision' => 2,
+                               'nullable' => true
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.724';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/admin_location.xsl
===================================================================
--- trunk/property/templates/base/admin_location.xsl    2017-10-30 10:19:40 UTC 
(rev 17206)
+++ trunk/property/templates/base/admin_location.xsl    2017-10-30 15:26:58 UTC 
(rev 17207)
@@ -131,7 +131,7 @@
                        <xsl:variable name="link_categories">
                                <xsl:value-of select="link_categories"/>
                        </xsl:variable>
-                       <a href="{$link_categories}" 
onMouseover="window.status='{lang_category_text}';return true;" 
onMouseout="window.status='';return true;">
+                       <a href="{$link_categories}" 
onMouseover="window.status='{lang_category_text}';return true;">
                                <xsl:value-of select="text_categories"/>
                        </a>
                </td>
@@ -139,7 +139,7 @@
                        <xsl:variable name="link_attribute_group">
                                <xsl:value-of select="link_attribute_group"/>
                        </xsl:variable>
-                       <a href="{$link_attribute_group}" 
onMouseover="window.status='';return true;" onMouseout="window.status='';return 
true;">
+                       <a href="{$link_attribute_group}" 
onMouseover="window.status='';return true;">
                                <xsl:value-of select="text_attribute_group"/>
                        </a>
                </td>
@@ -147,7 +147,7 @@
                        <xsl:variable name="link_attribute">
                                <xsl:value-of select="link_attribute"/>
                        </xsl:variable>
-                       <a href="{$link_attribute}" 
onMouseover="window.status='{$lang_attribute_standardtext}';return true;" 
onMouseout="window.status='';return true;">
+                       <a href="{$link_attribute}" 
onMouseover="window.status='{$lang_attribute_standardtext}';return true;">
                                <xsl:value-of select="text_attribute"/>
                        </a>
                </td>
@@ -155,7 +155,7 @@
                        <xsl:variable name="link_edit">
                                <xsl:value-of select="link_edit"/>
                        </xsl:variable>
-                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_standardtext}';return true;" 
onMouseout="window.status='';return true;">
+                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_standardtext}';return true;">
                                <xsl:value-of select="text_edit"/>
                        </a>
                </td>
@@ -163,7 +163,7 @@
                        <xsl:variable name="link_delete">
                                <xsl:value-of select="link_delete"/>
                        </xsl:variable>
-                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_standardtext}';return true;" 
onMouseout="window.status='';return true;">
+                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_standardtext}';return true;">
                                <xsl:value-of select="text_delete"/>
                        </a>
                </td>
@@ -198,7 +198,7 @@
                                                <td align="left">
                                                        <xsl:choose>
                                                                <xsl:when 
test="selected='selected' or selected = 1">
-                                                                       <input 
type="radio" name="values[{//column_name}]" value="{id}" checked="checked" 
onMouseout="window.status='';return true;">
+                                                                       <input 
type="radio" name="values[{//column_name}]" value="{id}" checked="checked">
                                                                                
<xsl:attribute name="title">
                                                                                
        <xsl:value-of select="//lang_config_statustext"/>
                                                                                
</xsl:attribute>
@@ -205,7 +205,7 @@
                                                                        </input>
                                                                </xsl:when>
                                                                <xsl:otherwise>
-                                                                       <input 
type="radio" name="values[{//column_name}]" value="{id}" 
onMouseout="window.status='';return true;">
+                                                                       <input 
type="radio" name="values[{//column_name}]" value="{id}">
                                                                                
<xsl:attribute name="title">
                                                                                
        <xsl:value-of select="//lang_config_statustext"/>
                                                                                
</xsl:attribute>
@@ -220,7 +220,7 @@
                                                <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;">
+                                               <input type="submit" 
name="values[save]" value="{$lang_save}">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_save_standardtext"/>
                                                        </xsl:attribute>
@@ -239,7 +239,7 @@
                                                <xsl:value-of 
select="lang_done"/>
                                        </xsl:variable>
                                        <form method="post" 
action="{$done_action}">
-                                               <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+                                               <input type="submit" 
name="done" value="{$lang_done}">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_done_standardtext"/>
                                                        </xsl:attribute>
@@ -262,7 +262,7 @@
                                <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;">
+                               <input type="submit" name="add" 
value="{$lang_add}">
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_add_standardtext"/>
                                        </xsl:attribute>
@@ -277,7 +277,7 @@
                                <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;">
+                               <input type="submit" name="add" 
value="{$lang_done}">
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_add_standardtext"/>
                                        </xsl:attribute>
@@ -310,108 +310,117 @@
                <div id="tab-content">
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
                        <div id="general">
-                               <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-
-                                       <div class="pure-control-group">
-                                               <label>
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="value_id != ''">
-                                                                       
<xsl:value-of select="lang_id"/>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                               </xsl:otherwise>
-                                                       </xsl:choose>
-                                               </label>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="value_id != ''">
-                                                               <xsl:value-of 
select="value_id"/>
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </div>
-                                       <div class="pure-control-group">
-                                               <label>
-                                                       <xsl:value-of 
select="lang_name"/>
-                                               </label>
-                                               <input type="text" 
name="values[name]" data-validation="required" value="{value_name}" 
onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_name_standardtext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </div>
-                                       <div class="pure-control-group">
-                                               <label>
-                                                       <xsl:value-of 
select="lang_descr"/>
-                                               </label>
-                                               <textarea cols="60" rows="10" 
name="values[descr]" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_descr_standardtext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                                       <xsl:value-of 
select="value_descr"/>
-                                               </textarea>
-                                       </div>
+                               <div class="pure-control-group">
                                        <xsl:choose>
-                                               <xsl:when test="value_id != ''">
-                                                       <div 
class="pure-control-group">
-                                                               <label>
-                                                                       
<xsl:value-of select="lang_list_info"/>
-                                                               </label>
-                                                               <td 
align="right">
-                                                                       
<xsl:call-template name="list_info"/>
-                                                               </td>
-                                                       </div>
-                                                       <div 
class="pure-control-group">
-                                                               <label>
-                                                                       
<xsl:value-of select="php:function('lang', 'list address')"/>
-                                                               </label>
-                                                               <input 
type="checkbox" name="values[list_address]" value="1">
-                                                                       
<xsl:attribute name="title">
-                                                                               
<xsl:value-of select="php:function('lang', 'list address at this level')"/>
-                                                                       
</xsl:attribute>
-                                                                       <xsl:if 
test="value_list_address = '1'">
-                                                                               
<xsl:attribute name="checked">
-                                                                               
        <xsl:text>checked</xsl:text>
-                                                                               
</xsl:attribute>
-                                                                       
</xsl:if>
-                                                               </input>
-                                                       </div>
-                                                       <div 
class="pure-control-group">
-                                                               <label>
-                                                                       
<xsl:value-of select="php:function('lang', 'list documents')"/>
-                                                               </label>
-                                                               <input 
type="checkbox" name="values[list_documents]" value="1">
-                                                                       
<xsl:attribute name="title">
-                                                                               
<xsl:value-of select="php:function('lang', 'list documents at level')"/>
-                                                                       
</xsl:attribute>
-                                                                       <xsl:if 
test="value_list_documents = '1'">
-                                                                               
<xsl:attribute name="checked">
-                                                                               
        <xsl:text>checked</xsl:text>
-                                                                               
</xsl:attribute>
-                                                                       
</xsl:if>
-                                                               </input>
-                                                       </div>
+                                               <xsl:when test="value_id > 0">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'id')"/>
+                                                       </label>
+                                                       <xsl:value-of 
select="value_id"/>
                                                </xsl:when>
                                        </xsl:choose>
-                                       <tr height="50">
-                                               <td>
-                                                       <xsl:variable 
name="lang_save">
-                                                               <xsl:value-of 
select="lang_save"/>
-                                                       </xsl:variable>
-                                                       <input type="submit" 
class="pure-button pure-button-primary" 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_standardtext"/>
-                                                                       
<xsl:text>'; return true;</xsl:text>
+                               </div>
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'name')"/>
+                                       </label>
+                                       <input type="text" name="values[name]" 
data-validation="required" value="{value_name}">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:value-of 
select="lang_name_standardtext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </div>
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'descr')"/>
+                                       </label>
+                                       <textarea cols="60" rows="10" 
name="values[descr]">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:value-of 
select="lang_descr_standardtext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_descr"/>
+                                       </textarea>
+                               </div>
+                               <xsl:choose>
+                                       <xsl:when test="value_id > 0">
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'Names of levels to list at this 
level')"/>
                                                                </xsl:attribute>
+                                                               <xsl:value-of 
select="php:function('lang', 'list info')"/>
+                                                       </label>
+                                                       <xsl:call-template 
name="list_info"/>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'list address')"/>
+                                                       </label>
+                                                       <input type="checkbox" 
name="values[list_address]" value="1">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'list address at this level')"/>
+                                                               </xsl:attribute>
+                                                               <xsl:if 
test="value_list_address = '1'">
+                                                                       
<xsl:attribute name="checked">
+                                                                               
<xsl:text>checked</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
                                                        </input>
-                                               </td>
-                                       </tr>
-                               </table>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'list documents')"/>
+                                                       </label>
+                                                       <input type="checkbox" 
name="values[list_documents]" value="1">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'list documents at level')"/>
+                                                               </xsl:attribute>
+                                                               <xsl:if 
test="value_list_documents = '1'">
+                                                                       
<xsl:attribute name="checked">
+                                                                               
<xsl:text>checked</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'enable controller')"/>
+                                                       </label>
+                                                       <input type="checkbox" 
name="values[enable_controller]" value="1">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'This location level is allowed to 
link to controller')"/>
+                                                               </xsl:attribute>
+                                                               <xsl:if 
test="value_enable_controller > '0'">
+                                                                       
<xsl:attribute name="checked">
+                                                                               
<xsl:text>checked</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
+                                                               <xsl:if 
test="value_enable_controller > '1'">
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
+
+                                                       </input>
+                                               </div>
+                                       </xsl:when>
+                               </xsl:choose>
+                               <tr height="50">
+                                       <td>
+                                               <xsl:variable name="lang_save">
+                                                       <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                               </xsl:variable>
+                                               <input type="submit" 
class="pure-button pure-button-primary" name="values[save]" 
value="{$lang_save}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_save_standardtext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
                        </div>
                </div>
        </form>
@@ -422,14 +431,12 @@
                                        <xsl:value-of select="done_action"/>
                                </xsl:variable>
                                <xsl:variable name="lang_done">
-                                       <xsl:value-of select="lang_done"/>
+                                       <xsl:value-of 
select="php:function('lang', 'done')"/>
                                </xsl:variable>
                                <form method="post" action="{$done_action}">
-                                       <input type="submit" class="pure-button 
pure-button-primary" name="done" value="{$lang_done}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                       <input type="submit" class="pure-button 
pure-button-primary" name="done" value="{$lang_done}">
+                                               <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_done_standardtext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </form>
@@ -554,7 +561,7 @@
                                                <xsl:variable name="link_up">
                                                        <xsl:value-of 
select="link_up"/>
                                                </xsl:variable>
-                                               <a href="{$link_up}" 
onMouseover="window.status='{$lang_up_text}';return true;" 
onMouseout="window.status='';return true;">
+                                               <a href="{$link_up}" 
onMouseover="window.status='{$lang_up_text}';return true;">
                                                        <xsl:value-of 
select="text_up"/>
                                                </a>
                                                <xsl:text> | </xsl:text>
@@ -561,7 +568,7 @@
                                                <xsl:variable name="link_down">
                                                        <xsl:value-of 
select="link_down"/>
                                                </xsl:variable>
-                                               <a href="{$link_down}" 
onMouseover="window.status='{$lang_down_text}';return true;" 
onMouseout="window.status='';return true;">
+                                               <a href="{$link_down}" 
onMouseover="window.status='{$lang_down_text}';return true;">
                                                        <xsl:value-of 
select="text_down"/>
                                                </a>
                                        </td>
@@ -572,7 +579,7 @@
                        <xsl:variable name="link_edit">
                                <xsl:value-of select="link_edit"/>
                        </xsl:variable>
-                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_attribtext}';return true;" 
onMouseout="window.status='';return true;">
+                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_attribtext}';return true;">
                                <xsl:value-of select="text_edit"/>
                        </a>
                </td>
@@ -580,7 +587,7 @@
                        <xsl:variable name="link_delete">
                                <xsl:value-of select="link_delete"/>
                        </xsl:variable>
-                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_attribtext}';return true;" 
onMouseout="window.status='';return true;">
+                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_attribtext}';return true;">
                                <xsl:value-of select="text_delete"/>
                        </a>
                </td>
@@ -806,7 +813,7 @@
                                        <xsl:variable name="lang_save">
                                                <xsl:value-of 
select="lang_save"/>
                                        </xsl:variable>
-                                       <input type="submit" class="pure-button 
pure-button-primary" name="values[save]" value="{$lang_save}" 
onMouseout="window.status='';return true;">
+                                       <input type="submit" class="pure-button 
pure-button-primary" name="values[save]" value="{$lang_save}">
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_save_attribtext"/>
                                                </xsl:attribute>
@@ -964,7 +971,7 @@
                                                        </input>
                                                </td>
                                                <td align="center">
-                                                       <input type="checkbox" 
name="values[delete_choice][]" value="{id}" onMouseout="window.status='';return 
true;">
+                                                       <input type="checkbox" 
name="values[delete_choice][]" value="{id}">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="//lang_delete_choice_statustext"/>
                                                                </xsl:attribute>
@@ -979,7 +986,7 @@
                                <xsl:value-of select="lang_new_value"/>
                        </td>
                        <td valign="top" colspan="2">
-                               <input type="text" name="values[new_choice]" 
onMouseout="window.status='';return true;">
+                               <input type="text" name="values[new_choice]">
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_new_value_statustext"/>
                                        </xsl:attribute>
@@ -990,31 +997,21 @@
 </xsl:template>
 
 <!-- New template-->
-<xsl:template name="list_info">
-       <table cellpadding="2" cellspacing="2" width="80%" align="left">
-               <tr class="th">
-                       <td class="th_text" width="85%" align="left">
-                               <xsl:value-of select="lang_location"/>
-                       </td>
-                       <td class="th_text" width="15%" align="center">
-                               <xsl:value-of select="lang_select"/>
-                       </td>
-               </tr>
+<xsl:template name="list_info" xmlns:php="http://php.net/xsl";>
+       <table class="pure-table pure-table-bordered pure-table-striped 
pure-custom">
+               <thead>
+                       <tr>
+                               <th class="th_text" width="85%" align="left">
+                                       <xsl:value-of 
select="php:function('lang', 'location')"/>
+                               </th>
+                               <th class="th_text" width="15%" align="center">
+                                       <xsl:value-of 
select="php:function('lang', 'select')"/>
+                               </th>
+                       </tr>
+               </thead>
+
                <xsl:for-each select="value_list_info">
                        <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>
                                <td align="left">
                                        <xsl:value-of select="name"/>
                                        <xsl:text> </xsl:text>
@@ -1022,7 +1019,7 @@
                                <td align="center">
                                        <xsl:choose>
                                                <xsl:when 
test="selected='selected' or selected = 1">
-                                                       <input type="checkbox" 
name="values[list_info][{id}]" value="{id}" checked="checked" 
onMouseout="window.status='';return true;">
+                                                       <input type="checkbox" 
name="values[list_info][{id}]" value="{id}" checked="checked">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="//lang_list_type_statustext"/>
                                                                </xsl:attribute>
@@ -1029,7 +1026,7 @@
                                                        </input>
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <input type="checkbox" 
name="values[list_info][{id}]" value="{id}" onMouseout="window.status='';return 
true;">
+                                                       <input type="checkbox" 
name="values[list_info][{id}]" value="{id}">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="//lang_list_type_statustext"/>
                                                                </xsl:attribute>

Modified: trunk/property/templates/base/location.xsl
===================================================================
--- trunk/property/templates/base/location.xsl  2017-10-30 10:19:40 UTC (rev 
17206)
+++ trunk/property/templates/base/location.xsl  2017-10-30 15:26:58 UTC (rev 
17207)
@@ -293,6 +293,7 @@
                        <xsl:value-of select="form_action"/>
                </xsl:variable>
                <form method="post" name="form" id="form" 
action="{$form_action}" class="pure-form pure-form-aligned">
+                       <input type="hidden" name="active_tab" 
value="{active_tab}"/>
                        <div id="tab-content">
                                <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
                                <div id="general">
@@ -567,6 +568,161 @@
                                                </div>
                                        </xsl:when>
                                </xsl:choose>
+                               <xsl:if test="controller=1">
+                                       <div id="controller">
+                                               <script type="text/javascript">
+                                                       
lookup_control_responsible = function()
+                                                       {
+                                                       var oArgs = 
{menuaction:'property.uilookup.phpgw_user', column:'control_responsible', 
acl_app:'controller', acl_location: '.checklist', acl_required:4};
+                                                       var requestUrl = 
phpGWLink('index.php', oArgs);
+                                                       
TINY.box.show({iframe:requestUrl, 
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
 mask:true, animate:true, close: true});
+                                                       }
+
+                                                       lookup_control = 
function()
+                                                       {
+                                                       var oArgs = 
{menuaction:'controller.uilookup.control'};
+                                                       var requestUrl = 
phpGWLink('index.php', oArgs);
+                                                       
TINY.box.show({iframe:requestUrl, 
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
 mask:true, animate:true, close: true});
+                                                       }
+
+                                               </script>
+                                               <div 
id="controller_receipt"></div>
+                                               <fieldset>
+                                                       <legend>
+                                                               <xsl:value-of 
select="php:function('lang', 'new')" />
+                                                       </legend>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'user')" />
+                                                               </label>
+                                                               <input 
type="text" name="control_responsible" id="control_responsible" value="" 
onClick="lookup_control_responsible();" readonly="readonly" size="6">
+                                                               </input>
+                                                               <input 
size="30" type="text" name="control_responsible_user_name" 
id="control_responsible_user_name" value="" 
onClick="lookup_control_responsible();" readonly="readonly">
+                                                               </input>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'controller')" />
+                                                               </label>
+                                                               <input 
type="text" name="control_id" id="control_id" value="" 
onClick="lookup_control();" readonly="readonly" size="6">
+                                                               </input>
+                                                               <input 
type="text" name="control_name" id="control_name" value="" 
onClick="lookup_control();" readonly="readonly" size="30">
+                                                               </input>
+                                                       </div>
+                                                       <xsl:variable 
name="lang_add">
+                                                               <xsl:value-of 
select="php:function('lang', 'add')"/>
+                                                       </xsl:variable>
+
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'start date')" />
+                                                               </label>
+
+                                                               <input 
type="text" name="control_start_date" id="control_start_date" value=""  
readonly="readonly" size="10">
+                                                               </input>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'repeat type')" />
+                                                               </label>
+                                                               <select 
id="repeat_type" name="repeat_type">
+                                                                       <option 
value="">
+                                                                               
<xsl:value-of select="php:function('lang', 'select')"/>
+                                                                       
</option>
+                                                                       
<xsl:apply-templates select="repeat_types/options"/>
+                                                               </select>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'interval')" />
+                                                               </label>
+                                                               <input 
type="text" name="repeat_interval" id="repeat_interval" value="0" size="2">
+                                                               </input>
+                                                       </div>
+
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'controle time')" />
+                                                               </label>
+                                                               <input 
type="text" name="controle_time" id="controle_time" value="" size="">
+                                                               </input>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'service time')" />
+                                                               </label>
+                                                               <input 
type="text" name="service_time" id="service_time" value="" size="">
+                                                               </input>
+                                                       </div>
+                                               </fieldset>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'controller')" />
+                                                       </label>
+                                                       <xsl:for-each 
select="datatable_def">
+                                                               <xsl:if 
test="container = 'datatable-container_4'">
+                                                                       
<xsl:call-template name="table_setup">
+                                                                               
<xsl:with-param name="container" select ='container'/>
+                                                                               
<xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
<xsl:with-param name="tabletools" select ='tabletools' />
+                                                                               
<xsl:with-param name="data" select ='data' />
+                                                                               
<xsl:with-param name="config" select ='config' />
+                                                                       
</xsl:call-template>
+                                                               </xsl:if>
+                                                       </xsl:for-each>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'checklist')" />
+                                                       </label>
+                                                       <select id = 
"check_lst_time_span" name="check_lst_time_span">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'select')"/>
+                                                               </xsl:attribute>
+                                                               <option 
value="0">
+                                                                       
<xsl:value-of select="php:function('lang', 'select')"/>
+                                                               </option>
+                                                               
<xsl:apply-templates select="check_lst_time_span/options"/>
+                                                       </select>
+                                                       <xsl:for-each 
select="datatable_def">
+                                                               <xsl:if 
test="container = 'datatable-container_5'">
+                                                                       
<xsl:call-template name="table_setup">
+                                                                               
<xsl:with-param name="container" select ='container'/>
+                                                                               
<xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
<xsl:with-param name="tabletools" select ='tabletools' />
+                                                                               
<xsl:with-param name="data" select ='data' />
+                                                                               
<xsl:with-param name="config" select ='config' />
+                                                                       
</xsl:call-template>
+                                                               </xsl:if>
+                                                       </xsl:for-each>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'cases')" />
+                                                       </label>
+                                                       <xsl:for-each 
select="datatable_def">
+                                                               <xsl:if 
test="container = 'datatable-container_6'">
+                                                                       
<xsl:call-template name="table_setup">
+                                                                               
<xsl:with-param name="container" select ='container'/>
+                                                                               
<xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
<xsl:with-param name="tabletools" select ='tabletools' />
+                                                                               
<xsl:with-param name="data" select ='data' />
+                                                                               
<xsl:with-param name="config" select ='config' />
+                                                                       
</xsl:call-template>
+                                                               </xsl:if>
+                                                       </xsl:for-each>
+                                               </div>
+                                               <xsl:call-template 
name="controller_integration">
+                                                       <xsl:with-param 
name="controller" select ='controller'/>
+                                               </xsl:call-template>
+                                       </div>
+                               </xsl:if>
                                <xsl:for-each select="integration">
                                        <div id="{section}">
                                                <fieldset>
@@ -815,4 +971,9 @@
                <xsl:attribute name="title" value="description" />
                <xsl:value-of disable-output-escaping="yes" select="name"/>
        </option>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
+
+<xsl:template name="controller_integration">
+       <xsl:param name="controller" />
+
+</xsl:template>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]