fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16616] more on substitute


From: sigurdne
Subject: [Fmsystem-commits] [16616] more on substitute
Date: Mon, 24 Apr 2017 10:23:10 -0400 (EDT)

Revision: 16616
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16616
Author:   sigurdne
Date:     2017-04-24 10:23:10 -0400 (Mon, 24 Apr 2017)
Log Message:
-----------
more on substitute

Modified Paths:
--------------
    trunk/property/inc/class.bodimb_role_user.inc.php
    trunk/property/inc/class.hook_helper.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.sodimb_role_user.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uidimb_role_user.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/templates/base/dimb_role_user.xsl

Added Paths:
-----------
    trunk/property/inc/class.bosubstitute.inc.php
    trunk/property/inc/class.sosubstitute.inc.php
    trunk/property/inc/class.uisubstitute.inc.php
    trunk/property/js/portico/substitute.index.js
    trunk/property/templates/base/substitute.xsl

Removed Paths:
-------------
    trunk/property/templates/base/role_user_substitute.xsl

Modified: trunk/property/inc/class.bodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.bodimb_role_user.inc.php   2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/inc/class.bodimb_role_user.inc.php   2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -69,14 +69,4 @@
                        $values = $this->so->edit($data);
                        return $values;
                }
-
-               public function update_substitute( $user_id, 
$substitute_user_id )
-               {
-                       return $this->so->update_substitute($user_id, 
$substitute_user_id);
-               }
-
-               public function get_substitute( $user_id)
-               {
-                       return $this->so->get_substitute($user_id);
-               }
        }
\ No newline at end of file

Added: trunk/property/inc/class.bosubstitute.inc.php
===================================================================
--- trunk/property/inc/class.bosubstitute.inc.php                               
(rev 0)
+++ trunk/property/inc/class.bosubstitute.inc.php       2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -0,0 +1,92 @@
+<?php
+
+       /**
+        * phpGroupWare - registration
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package registration
+        * @version $Id: class.bodimb_role_user.inc.php 16604 2017-04-20 
14:53:00Z sigurdne $
+        */
+       class property_bosubstitute
+       {
+
+               var $public_functions = array
+                       (
+               );
+
+               function __construct()
+               {
+                       $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->so = CreateObject('property.sosubstitute');
+                       $this->allrows = $this->bo->allrows;
+               }
+
+               public function read( $data )
+               {
+                       static $users = array();
+                       $values = $this->so->read($data);
+
+                       foreach ($values as &$entry)
+                       {
+                               if ($entry['user_id'])
+                               {
+                                       if (!$entry['user'] = 
$users[$entry['user_id']])
+                                       {
+                                               $entry['user'] = 
$GLOBALS['phpgw']->accounts->get($entry['user_id'])->__toString();
+                                               $users[$entry['user_id']] = 
$entry['user'];
+                                       }
+                               }
+                               if ($entry['substitute_user_id'])
+                               {
+                                       if (!$entry['substitute'] = 
$users[$entry['substitute_user_id']])
+                                       {
+                                               $entry['substitute'] = 
$GLOBALS['phpgw']->accounts->get($entry['substitute_user_id'])->__toString();
+                                               
$users[$entry['substitute_user_id']] = $entry['substitute'];
+                                       }
+                               }
+
+                       }
+
+                       return $values;
+               }
+
+               public function delete( $data )
+               {
+                       return $this->so->delete($data);
+               }
+
+               public function edit( $data )
+               {
+                       $values = $this->so->edit($data);
+                       return $values;
+               }
+
+               public function update_substitute( $user_id, 
$substitute_user_id )
+               {
+                       return $this->so->update_substitute($user_id, 
$substitute_user_id);
+               }
+
+               public function get_substitute( $user_id)
+               {
+                       return $this->so->get_substitute($user_id);
+               }
+       }
\ No newline at end of file

Modified: trunk/property/inc/class.hook_helper.inc.php
===================================================================
--- trunk/property/inc/class.hook_helper.inc.php        2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/inc/class.hook_helper.inc.php        2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -1003,7 +1003,7 @@
                                        //                      
$portalbox->set_controls($key,$value);
                                }
 
-                               $users_for_substitute = 
CreateObject('property.sodimb_role_user')->get_users_for_substitute( 
$accound_id);
+                               $users_for_substitute = 
CreateObject('property.sosubstitute')->get_users_for_substitute( $accound_id);
                                $users_for_substitute[] = $accound_id;
 
 
@@ -1176,9 +1176,9 @@
 
                function after_navbar( )
                {
-                       $sodimb_role_user = 
CreateObject('property.sodimb_role_user');
+                       $sosubstitute = CreateObject('property.sosubstitute');
                        $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
-                       $substitute_user_id = 
$sodimb_role_user->get_substitute( $user_id);
+                       $substitute_user_id = $sosubstitute->get_substitute( 
$user_id);
                        $lang_substitute = 
$GLOBALS['phpgw']->translation->translate('substitute', array(), false, 
'property');
                        if($substitute_user_id)
                        {
@@ -1187,7 +1187,7 @@
                                echo '</div>';
                        }
 
-                       $users_for_substitute = 
$sodimb_role_user->get_users_for_substitute( $user_id);
+                       $users_for_substitute = 
$sosubstitute->get_users_for_substitute( $user_id);
                        $names = array();
                        foreach ($users_for_substitute as $user_for_substitute)
                        {

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2017-04-23 10:01:37 UTC (rev 
16615)
+++ trunk/property/inc/class.menu.inc.php       2017-04-24 14:23:10 UTC (rev 
16616)
@@ -354,7 +354,7 @@
                                                        'substitute' => array
                                                        (
                                                                'text' => 
lang('substitute'),
-                                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uidimb_role_user.list_substitute')),
+                                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uisubstitute.index')),
                                                        )
                                                )
                                        ),
@@ -806,7 +806,7 @@
                                        ),
                                        array(
                                                'text' => lang('substitute'),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uidimb_role_user.substitute',
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uisubstitute.edit',
                                                        'acl_app' => 
'property'))
                                        )
                                );

Modified: trunk/property/inc/class.sodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.sodimb_role_user.inc.php   2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/inc/class.sodimb_role_user.inc.php   2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -303,60 +303,4 @@
 
                        return $ok;
                }
-
-               /**
-                * A user can only have one substitute
-                * @param int $user_id
-                * @param int $substitute_user_id
-                * @return boolean true on success
-                */
-               public function update_substitute( $user_id, 
$substitute_user_id = 0 )
-               {
-                       $this->db->transaction_begin();
-                       $this->db->query('DELETE FROM 
fm_ecodimb_role_user_substitute WHERE user_id = ' . (int)$user_id, __LINE__, 
__FILE__);
-                       if($substitute_user_id)
-                       {
-                               $this->db->query('INSERT INTO 
fm_ecodimb_role_user_substitute (user_id, substitute_user_id ) VALUES (' . 
(int)$user_id . ',' . (int) $substitute_user_id . ')', __LINE__, __FILE__);
-                       }
-                       if($this->db->transaction_commit())
-                       {
-                               if($substitute_user_id)
-                               {
-                                       
phpgwapi_cache::message_set(lang('substitute') .': ' . 
$GLOBALS['phpgw']->accounts->get($substitute_user_id)->__toString(), 'message');
-                               }
-                               else
-                               {
-                                       
phpgwapi_cache::message_set(lang('substitute') . ' ' .lang('deleted'), 
'message');
-                               }
-                               return true;
-                       }
-               }
-
-               /**
-                * Get the substitute for a user
-                * @param int $user_id
-                * @return int $substitute_user_id
-                */
-               public function get_substitute( $user_id)
-               {
-                       $this->db->query('SELECT substitute_user_id FROM 
fm_ecodimb_role_user_substitute WHERE user_id = ' . (int)$user_id, __LINE__, 
__FILE__);
-                       $this->db->next_record();
-                       return (int)$this->db->f('substitute_user_id');
-               }
-
-               /**
-                * Get the users that the substitute is given responsibility for
-                * @param int $substitute_user_id
-                * @return array $users
-                */
-               public function get_users_for_substitute( $substitute_user_id)
-               {
-                       $this->db->query('SELECT user_id FROM 
fm_ecodimb_role_user_substitute WHERE substitute_user_id = ' . 
(int)$substitute_user_id, __LINE__, __FILE__);
-                       $users = array();
-                       while ($this->db->next_record())
-                       {
-                               $users[] = $this->db->f('user_id');
-                       }
-                       return $users;
-               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2017-04-23 10:01:37 UTC (rev 
16615)
+++ trunk/property/inc/class.soproject.inc.php  2017-04-24 14:23:10 UTC (rev 
16616)
@@ -1760,8 +1760,8 @@
                                        $close_pending_action = true;
 
 
-                                       $sodimb_role_user = 
CreateObject('property.sodimb_role_user');
-                                       $users_for_substitute = 
$sodimb_role_user->get_users_for_substitute($this->account);
+                                       $sosubstitute = 
CreateObject('property.sosubstitute');
+                                       $users_for_substitute = 
$sosubstitute->get_users_for_substitute($this->account);
                                        $take_responsibility_for = 
array($this->account);
 
                                        $action_params = array
@@ -3441,11 +3441,11 @@
                        }
 
                        $historylog = CreateObject('property.historylog', 
'workorder');
-                       $sodimb_role_user = 
CreateObject('property.sodimb_role_user');
+                       $sosubstitute = CreateObject('property.sosubstitute');
 
                        foreach ($ids as $order_id)
                        {
-                               $users_for_substitute = 
$sodimb_role_user->get_users_for_substitute($this->account);
+                               $users_for_substitute = 
$sosubstitute->get_users_for_substitute($this->account);
                                $take_responsibility_for = 
array($this->account);
 
                                $action_params = array(

Added: trunk/property/inc/class.sosubstitute.inc.php
===================================================================
--- trunk/property/inc/class.sosubstitute.inc.php                               
(rev 0)
+++ trunk/property/inc/class.sosubstitute.inc.php       2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -0,0 +1,148 @@
+<?php
+       /**
+        * phpGroupWare - registration
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package registration
+        * @version $Id: class.sodimb_role_user.inc.php 16610 2017-04-21 
14:21:03Z sigurdne $
+        */
+       phpgw::import_class('phpgwapi.datetime');
+
+       class property_sosubstitute
+       {
+
+               var $total_records = 0;
+
+               function __construct()
+               {
+                       $this->account_id = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db = & $GLOBALS['phpgw']->db;
+                       $this->db2 = clone($this->db);
+                       $this->join = & $this->db->join;
+                       $this->left_join = & $this->db->left_join;
+                       $this->like = & $this->db->like;
+               }
+
+               function read( $data )
+               {
+                       if (!empty($data['user_id']))
+                       {
+                               $user_id = (int)$data['user_id'];
+                       }
+
+                       $substitute_user_id = (int)$data['substitute_user_id'];
+
+                       $filtermethod = '';
+                       $where = 'WHERE';
+                       if ($user_id)
+                       {
+                               $filtermethod .= "{$where} user_id = $user_id";
+                               $where = 'AND';
+                       }
+                       if ($substitute_user_id)
+                       {
+                               $filtermethod .= "{$where} substitute_user_id = 
$substitute_user_id";
+                               $where = 'AND';
+                       }
+
+                       $sql = "SELECT id, user_id, substitute_user_id FROM 
fm_ecodimb_role_user_substitute {$filtermethod}";
+
+//_debug_array($sql);
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $values = array();
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array(
+                                       'id' => $this->db->f('id'),
+                                       'user_id' => $this->db->f('user_id'),
+                                       'substitute_user_id' => 
$this->db->f('substitute_user_id'),
+                               );
+                       }
+
+                       return $values;
+               }
+
+               public function delete( $data = array())
+               {
+                       if($data)
+                       {
+                               return $this->db->query('DELETE FROM 
fm_ecodimb_role_user_substitute WHERE id IN (' . implode(', ', $data) . ')', 
__LINE__, __FILE__);
+                       }
+               }
+
+               /**
+                * A user can only have one substitute
+                * @param int $user_id
+                * @param int $substitute_user_id
+                * @return boolean true on success
+                */
+               public function update_substitute( $user_id, 
$substitute_user_id = 0 )
+               {
+                       $this->db->transaction_begin();
+                       $this->db->query('DELETE FROM 
fm_ecodimb_role_user_substitute WHERE user_id = ' . (int)$user_id, __LINE__, 
__FILE__);
+                       if($substitute_user_id)
+                       {
+                               $this->db->query('INSERT INTO 
fm_ecodimb_role_user_substitute (user_id, substitute_user_id ) VALUES (' . 
(int)$user_id . ',' . (int) $substitute_user_id . ')', __LINE__, __FILE__);
+                       }
+                       if($this->db->transaction_commit())
+                       {
+                               if($substitute_user_id)
+                               {
+                                       
phpgwapi_cache::message_set(lang('substitute') .': ' . 
$GLOBALS['phpgw']->accounts->get($substitute_user_id)->__toString(), 'message');
+                               }
+                               else
+                               {
+                                       
phpgwapi_cache::message_set(lang('substitute') . ' ' .lang('deleted'), 
'message');
+                               }
+                               return true;
+                       }
+               }
+
+               /**
+                * Get the substitute for a user
+                * @param int $user_id
+                * @return int $substitute_user_id
+                */
+               public function get_substitute( $user_id)
+               {
+                       $this->db->query('SELECT substitute_user_id FROM 
fm_ecodimb_role_user_substitute WHERE user_id = ' . (int)$user_id, __LINE__, 
__FILE__);
+                       $this->db->next_record();
+                       return (int)$this->db->f('substitute_user_id');
+               }
+
+               /**
+                * Get the users that the substitute is given responsibility for
+                * @param int $substitute_user_id
+                * @return array $users
+                */
+               public function get_users_for_substitute( $substitute_user_id)
+               {
+                       $this->db->query('SELECT user_id FROM 
fm_ecodimb_role_user_substitute WHERE substitute_user_id = ' . 
(int)$substitute_user_id, __LINE__, __FILE__);
+                       $users = array();
+                       while ($this->db->next_record())
+                       {
+                               $users[] = $this->db->f('user_id');
+                       }
+                       return $users;
+               }
+       }
\ No newline at end of file

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/inc/class.soworkorder.inc.php        2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -1638,8 +1638,8 @@
                                $this->db->next_record();
                                if ($this->db->f('approved') || 
$workorder['approved'])
                                {
-                                       $sodimb_role_user = 
CreateObject('property.sodimb_role_user');
-                                       $users_for_substitute = 
$sodimb_role_user->get_users_for_substitute($this->account);
+                                       $sosubstitute = 
CreateObject('property.sosubstitute');
+                                       $users_for_substitute = 
$sosubstitute->get_users_for_substitute($this->account);
                                        $take_responsibility_for = 
array($this->account);
 
                                        $action_params = array
@@ -3044,8 +3044,8 @@
                                $this->db->next_record();
                                if ($this->db->f('approved'))
                                {
-                                       $sodimb_role_user = 
CreateObject('property.sodimb_role_user');
-                                       $users_for_substitute = 
$sodimb_role_user->get_users_for_substitute($this->account);
+                                       $sosubstitute = 
CreateObject('property.sosubstitute');
+                                       $users_for_substitute = 
$sosubstitute->get_users_for_substitute($this->account);
                                        $take_responsibility_for = 
array($this->account);
 
                                        $action_params = array

Modified: trunk/property/inc/class.uidimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.uidimb_role_user.inc.php   2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/inc/class.uidimb_role_user.inc.php   2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -306,63 +306,4 @@
                                        'user_id' => $user_id, 'dimb_id' => 
$dimb_id, 'role_id' => $role_id, 'query' => $query));
                        }
                }
-
-               public function substitute()
-               {
-                       $user_id = $this->account_id;
-                       $substitute_user_id = 
phpgw::get_var('substitute_user_id', 'int', 'POST');
-                       $save = phpgw::get_var('save', 'string', 'POST');
-
-                       if($save)
-                       {
-                               $this->bo->update_substitute($user_id, 
$substitute_user_id);
-                       }
-
-                       $selected = $this->bo->get_substitute($user_id);
-
-                       $appname = lang('substitute');
-                       $function_msg = lang('set substitute');
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('role_user_substitute'));
-
-                       $data = array
-                       (
-                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uidimb_role_user.substitute')),
-                               'user_list' => array('options' => 
$this->_get_user_list($selected)),
-                       );
-
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit' => $data));
-               }
-
-               private function _get_user_list($selected)
-               {
-                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, '.project', 
'property');
-                       $user_list = array();
-                       $selected_found = false;
-                       foreach ($users as $user)
-                       {
-                               $name = (isset($user['account_lastname']) ? 
$user['account_lastname'] . ' ' : '') . $user['account_firstname'];
-                               $user_list[] = array(
-                                       'id' => $user['account_id'],
-                                       'name' => $name,
-                                       'selected' => $user['account_id'] == 
$selected ? 1 : 0
-                               );
-
-                               if (!$selected_found)
-                               {
-                                       $selected_found = $user['account_id'] 
== $selected ? true : false;
-                               }
-                       }
-                       if ($selected && !$selected_found)
-                       {
-                               $user_list[] = array
-                                       (
-                                       'id' => $selected,
-                                       'name' => 
$GLOBALS['phpgw']->accounts->get($selected)->__toString(),
-                                       'selected' => 1
-                               );
-                       }
-                       return $user_list;
-               }
-
        }
\ No newline at end of file

Added: trunk/property/inc/class.uisubstitute.inc.php
===================================================================
--- trunk/property/inc/class.uisubstitute.inc.php                               
(rev 0)
+++ trunk/property/inc/class.uisubstitute.inc.php       2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -0,0 +1,306 @@
+<?php
+       /**
+        * phpGroupWare - registration
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2011,2012 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/
+        * @package registration
+        * @version $Id: class.uidimb_role_user.inc.php 16610 2017-04-21 
14:21:03Z sigurdne $
+        */
+       phpgw::import_class('phpgwapi.uicommon_jquery');
+
+       class property_uisubstitute extends phpgwapi_uicommon_jquery
+       {
+
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $currentapp;
+               var $type_id;
+               var $location_code;
+               private $config;
+               var $public_functions = array
+                       (
+                       'index' => true,
+                       'query' => true,
+                       'edit' => true,
+                       'edit2' => true,
+                       'substitute' => true
+               );
+
+               function __construct()
+               {
+                       parent::__construct();
+
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo = CreateObject('property.bosubstitute');
+                       $this->bocommon = CreateObject('property.bocommon');
+                       $this->start = $this->bo->start;
+                       $this->query = $this->bo->query;
+                       $this->sort = $this->bo->sort;
+                       $this->order = $this->bo->order;
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'admin::property::accounting::dimb_role_user2::substitute';
+               }
+
+               function index()
+               {
+                       $receipt = array();
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       $msgbox_data = array();
+                       if (phpgw::get_var('phpgw_return_as') != 'json' && 
$receipt = phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                       {
+                               phpgwapi_cache::session_clear('phpgwapi', 
'phpgw_messages');
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($receipt);
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                       }
+
+                       $myColumnDefs = array
+                               (
+                               array
+                                       (
+                                       'key' => 'id',
+                                       'hidden' => true
+                               ),
+                               array
+                                       (
+                                       'key' => 'user',
+                                       'label' => lang('user'),
+                                       'sortable' => false
+                               ),
+                               array
+                                       (
+                                       'key' => 'substitute',
+                                       'label' => lang('substitute'),
+                                       'sortable' => false
+                               ),
+                               array
+                                       (
+                                       'key' => 'delete',
+                                       'label' => lang('delete'),
+                                       'sortable' => false,
+                                       'formatter' => 
'JqueryPortico.FormatterCenter',
+                               )
+                       );
+
+
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_0',
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 'property.uisubstitute.query',
+                                               'phpgw_return_as' => 'json'))),
+                               'ColumnDefs' => $myColumnDefs,
+                               'data' => '',
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+                       $user_list = 
$this->bocommon->get_user_list_right2('select', PHPGW_ACL_READ, 0, '.invoice');
+                       $substitute_list = $user_list;
+
+                       array_unshift($user_list, array('id' => '', 'name' => 
lang('select')));
+                       array_unshift($substitute_list, array('id' => '', 
'name' => lang('select')));
+
+                       $data = array
+                               (
+                               'datatable_def' => $datatable_def,
+                               'msgbox_data' => $msgbox_data,
+                               'filter_form' => array
+                                       (
+                                       'user_list' => array('options' => 
$user_list),
+                                       'substitute_list' => array('options' => 
$substitute_list),
+                               ),
+                               'update_action' => 
self::link(array('menuaction' => 'property.uisubstitute.edit2'))
+                       );
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('query_start');
+                       $GLOBALS['phpgw']->jqcal->add_listener('query_end');
+                       $GLOBALS['phpgw']->jqcal->add_listener('active_from');
+                       $GLOBALS['phpgw']->jqcal->add_listener('active_to');
+
+                       self::add_javascript('property', 'portico', 
'substitute.index.js');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('substitute', 'datatable_inline'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('table' => $data));
+               }
+
+               public function query()
+               {
+                       $user_id = phpgw::get_var('user_id', 'int');
+                       $substitute_user_id = 
phpgw::get_var('substitute_user_id', 'int');
+
+
+                       $values = $this->bo->read(array('user_id' => $user_id, 
'substitute_user_id' => $substitute_user_id));
+
+                       foreach ($values as &$entry)
+                       {
+                               $entry['delete'] = "<input class=\"delete\" 
id=\"delete\" type =\"checkbox\" name=\"delete[]\" value=\"{$entry['id']}\">";
+                               $results['results'][] = $entry;
+                       }
+
+                       $result_data = array
+                               (
+                               'results' => $values,
+                               'total_records' => count($values),
+                               'draw' => phpgw::get_var('draw', 'int')
+                       );
+
+
+                       return $this->jquery_results($result_data);
+
+                       //      return json_encode($values);
+               }
+
+               public function edit2()
+               {
+                       if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_EDIT, 'property'))
+                       {
+                               $receipt['error'][] = true;
+                               phpgwapi_cache::message_set(lang('you are not 
approved for this task'), 'error');
+                       }
+
+                       $user_id = phpgw::get_var('user_id', 'int');
+                       $substitute_user_id = 
phpgw::get_var('substitute_user_id', 'int');
+
+                       $save = phpgw::get_var('save', 'string');
+
+                       if($save && $user_id && $substitute_user_id)
+                       {
+                               if($this->bo->update_substitute($user_id, 
$substitute_user_id))
+                               {
+                                       $result = array
+                                               (
+                                               'status' => 'updated'
+                                       );
+                               }
+                       }
+
+                       if ($delete = phpgw::get_var('delete', 'int'))
+                       {
+                               if (!$receipt['error'])
+                               {
+                                       if ($this->bo->delete($delete))
+                                       {
+                                               $result = array
+                                                       (
+                                                       'status' => 'updated'
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $result = array
+                                                       (
+                                                       'status' => 'error'
+                                               );
+                                       }
+                               }
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               if ($receipt = 
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                               {
+                                       
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                       $result['receipt'] = $receipt;
+                               }
+                               else
+                               {
+                                       $result['receipt'] = array();
+                               }
+                               return $result;
+                       }
+                       else
+                       {
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uisubstitute.index',
+                                       'user_id' => $user_id, 
'substitute_user_id' => $substitute_user_id));
+                       }
+               }
+
+               public function edit()
+               {
+                       $user_id = $this->account_id;
+                       $substitute_user_id = 
phpgw::get_var('substitute_user_id', 'int', 'POST');
+                       $save = phpgw::get_var('save', 'string', 'POST');
+
+                       if($save)
+                       {
+                               $this->bo->update_substitute($user_id, 
$substitute_user_id);
+                       }
+
+                       $selected = $this->bo->get_substitute($user_id);
+
+                       $appname = lang('substitute');
+                       $function_msg = lang('set substitute');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('substitute'));
+
+                       $data = array
+                       (
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uisubstitute.edit')),
+                               'user_list' => array('options' => 
$this->_get_user_list($selected)),
+                       );
+
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit' => $data));
+               }
+
+               private function _get_user_list($selected)
+               {
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, '.project', 
'property');
+                       $user_list = array();
+                       $selected_found = false;
+                       foreach ($users as $user)
+                       {
+                               $name = (isset($user['account_lastname']) ? 
$user['account_lastname'] . ' ' : '') . $user['account_firstname'];
+                               $user_list[] = array(
+                                       'id' => $user['account_id'],
+                                       'name' => $name,
+                                       'selected' => $user['account_id'] == 
$selected ? 1 : 0
+                               );
+
+                               if (!$selected_found)
+                               {
+                                       $selected_found = $user['account_id'] 
== $selected ? true : false;
+                               }
+                       }
+                       if ($selected && !$selected_found)
+                       {
+                               $user_list[] = array
+                                       (
+                                       'id' => $selected,
+                                       'name' => 
$GLOBALS['phpgw']->accounts->get($selected)->__toString(),
+                                       'selected' => 1
+                               );
+                       }
+                       return $user_list;
+               }
+
+       }
\ No newline at end of file

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/inc/class.uiworkorder.inc.php        2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -913,7 +913,7 @@
                                }
 
                                $_budget_amount = 
$this->bo->get_budget_amount($id);
-                               $sodimb_role_user = 
CreateObject('property.sodimb_role_user');
+                               $sosubstitute = 
CreateObject('property.sosubstitute');
 
                                if (isset($values['approval']) && 
$values['approval'] && $config->config_data['workorder_approval'])
                                {
@@ -960,7 +960,7 @@
 
                                                                if(!$approvals)
                                                                {
-                                                                       
$substitute = $sodimb_role_user->get_substitute($_account_id);
+                                                                       
$substitute = $sosubstitute->get_substitute($_account_id);
                                                                        
                                                                        
if($substitute)
                                                                        {
@@ -1048,7 +1048,7 @@
                                                        $bcc = 
'';//$coordinator_email;
                                                        foreach 
($values['approval'] as $_account_id => $_address)
                                                        {
-                                                               $substitute = 
$sodimb_role_user->get_substitute($_account_id);
+                                                               $substitute = 
$sosubstitute->get_substitute($_account_id);
 
                                                                /**
                                                                 * Alert the 
substitute
@@ -1111,7 +1111,7 @@
 
                                        foreach ($values['do_approve'] as 
$_account_id => $_dummy)
                                        {
-                                               $users_for_substitute = 
$sodimb_role_user->get_users_for_substitute($_account_id);
+                                               $users_for_substitute = 
$sosubstitute->get_users_for_substitute($_account_id);
 
                                                $approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
 

Added: trunk/property/js/portico/substitute.index.js
===================================================================
--- trunk/property/js/portico/substitute.index.js                               
(rev 0)
+++ trunk/property/js/portico/substitute.index.js       2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -0,0 +1,99 @@
+$(document).ready(function ()
+{
+
+       $("#user_id").change(function ()
+       {
+               update_substitute_table();
+       });
+
+       $("#substitute_user_id").change(function ()
+       {
+               update_substitute_table();
+       });
+
+       $("#acl_form").on("submit", function (e)
+       {
+               e.preventDefault();
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + 
"&phpgw_return_as=json&save=save&substitute_user_id=" + 
$("#substitute_user_id").val() +'&user_id=' + $("#user_id").val() + '&' + 
$(thisForm).serialize(),
+                       success: function (data)
+                       {
+                               if (data)
+                               {
+                                       if (data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                                       var obj = data;
+
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       if (obj.status == "updated")
+                                       {
+                                               $(submitBnt).val("Lagret");
+                                               var oArgs = {menuaction: 
'property.uisubstitute.query', substitute_user_id: 
$("#substitute_user_id").val(), user_id: $("#user_id").val()};
+                                               var requestUrl = 
phpGWLink('index.php', oArgs, true);
+                                               
JqueryPortico.updateinlineTableHelper(oTable0, requestUrl);
+                                       }
+                                       else
+                                       {
+                                               $(submitBnt).val("Feil ved 
lagring");
+                                       }
+
+                                       // Changes text on save button back to 
original
+                                       window.setTimeout(function ()
+                                       {
+                                               $(submitBnt).val('Lagre');
+                                               
$(submitBnt).addClass("not_active");
+                                       }, 1000);
+
+                                       var htmlString = "";
+                                       if (typeof (data['receipt']['error']) 
!= 'undefined')
+                                       {
+                                               for (var i = 0; i < 
data['receipt']['error'].length; ++i)
+                                               {
+                                                       htmlString += "<div 
class=\"error\">";
+                                                       htmlString += 
data['receipt']['error'][i]['msg'];
+                                                       htmlString += '</div>';
+                                               }
+
+                                       }
+                                       if (typeof (data['receipt']['message']) 
!= 'undefined')
+                                       {
+                                               for (var i = 0; i < 
data['receipt']['message'].length; ++i)
+                                               {
+                                                       htmlString += "<div 
class=\"msg_good\">";
+                                                       htmlString += 
data['receipt']['message'][i]['msg'];
+                                                       htmlString += '</div>';
+                                               }
+
+                                       }
+                                       $("#receipt").html(htmlString);
+                               }
+                       }
+               });
+       });
+});
+
+
+function update_substitute_table()
+{
+       var oArgs = {menuaction: 'property.uisubstitute.query',  user_id: 
$("#user_id").val(), substitute_user_id: $("#substitute_user_id").val()};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+
+       JqueryPortico.updateinlineTableHelper(oTable0, requestUrl);
+//     execute_async(myDataTable_0,  oArgs);
+       $("#receipt").html('');
+}
+
+var addFooterDatatable = function (oTable)
+{
+       var api = oTable.api();
+       var newTD = JqueryPortico.CreateRowChecked("delete");
+       $(api.column(2).footer()).html(newTD);
+};

Modified: trunk/property/templates/base/dimb_role_user.xsl
===================================================================
--- trunk/property/templates/base/dimb_role_user.xsl    2017-04-23 10:01:37 UTC 
(rev 16615)
+++ trunk/property/templates/base/dimb_role_user.xsl    2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -5,57 +5,48 @@
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
        <style type="text/css">
-       #box { width: 200px; height: 5px; background: blue; }
-       select { width: 200px; }
-       .row_on,.th_bright
-       {
+               #box { width: 200px; height: 5px; background: blue; }
+               select { width: 200px; }
+               .row_on,.th_bright
+               {
                background-color: #CCEEFF;
-       }
+               }
 
-       .row_off
-       {
+               .row_off
+               {
                background-color: #DDF0FF;
-       }
+               }
 
        </style>
 
-       <xsl:call-template name="invoice" />
+       <xsl:call-template name="table" />
        <div id="popupBox"></div>       
        <div id="curtain"></div>
 </xsl:template>
 
-<xsl:template name="invoice" xmlns:php="http://php.net/xsl";>
-       <!-- loads translations into array for use with javascripts -->
-       <!--
-       <script type="text/javascript">
-               var lang = <xsl:value-of select="php:function('js_lang', 
'edit')"/>;
-       </script>
-       -->
-
-       <div class="yui-content">
+<xsl:template name="table" xmlns:php="http://php.net/xsl";>
+       <div class="body">
                <div id="invoice-layout">
-                               <div class="header">
+                       <div class="header">
                                <h2>
-                                       <xsl:value-of 
select="php:function('lang', 'invoice')"/>
+                                       <xsl:value-of 
select="php:function('lang', 'role')"/>
                                </h2>
-                               </div>
+                       </div>
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <xsl:call-template name="msgbox"/>
                                </xsl:when>
                        </xsl:choose>
-                               <div class="body">
-                                       <div id="voucher_details">
+                       <div class="body">
+                               <div id="voucher_details">
+                                       <table align = "center" width="95%">
+                                               <xsl:apply-templates 
select="filter_form" />
+                                       </table>
+                                       <form action="{update_action}" 
name="acl_form" id="acl_form" method="post">
                                                <table align = "center" 
width="95%">
-                                                       <xsl:apply-templates 
select="filter_form" />
-                                               </table>
-                                               <form action="{update_action}" 
name="acl_form" id="acl_form" method="post">
-                                               <table align = "center" 
width="95%">
-                                                               
<xsl:call-template name="role_fields" />
-                                                               <tr>
-                                                                       <td 
colspan = '6'>
-                                                                       
<!--xsl:apply-templates select="paging"/>
-                                                                       
<xsl:apply-templates select="datatable"/-->
+                                                       <xsl:call-template 
name="role_fields" />
+                                                       <tr>
+                                                               <td colspan = 
'6'>
                                                                        
<xsl:for-each select="datatable_def">
                                                                                
<xsl:if test="container = 'datatable-container_0'">
                                                                                
        <xsl:call-template name="table_setup">
@@ -68,9 +59,9 @@
                                                                                
</xsl:if>
                                                                        
</xsl:for-each>
 
-                                                                       </td>
-                                                               </tr>
-                                                       </table>
+                                                               </td>
+                                                       </tr>
+                                               </table>
                                                <div id="receipt"></div>
                                                <xsl:variable 
name="label_submit">
                                                        <xsl:value-of 
select="php:function('lang', 'save')" />
@@ -78,142 +69,92 @@
                                                <div class="row_on">
                                                        <input type="submit" 
name="update_acl" id="frm_update_acl" value="{$label_submit}"/>
                                                </div>
-                                               </form>
-                                       </div>
+                                       </form>
                                </div>
+                       </div>
                </div>
        </div>
 </xsl:template>
 
 <xsl:template match="filter_form" xmlns:php="http://php.net/xsl";>
-               <xsl:call-template name="filter_list"/>
+       <xsl:call-template name="filter_list"/>
 </xsl:template>
 
 <xsl:template name="filter_list" xmlns:php="http://php.net/xsl";>
        <tr>
-       <td colspan = '6'>
-       <table>
-       <tr>
-               <td>
-                       <xsl:value-of select="php:function('lang', 'dim b')" />
+               <td colspan = '6'>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'dim b')" />
+                                       </td>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'role')" />
+                                       </td>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'user')" />
+                                       </td>
+                                       <td colspan = "2" align = "center">
+                                               <xsl:value-of 
select="php:function('lang', 'search')" />
+                                               <xsl:text> </xsl:text>
+                                               <xsl:value-of 
select="php:function('lang', 'date')" />
+                                       </td>
+                               </tr>
+                               <tr id="filters">
+                                       <td>
+                                               <select id="dimb_id" 
name="dimb">
+                                                       <xsl:apply-templates 
select="dimb_list/options"/>
+                                               </select>
+                                       </td>
+                                       <td>
+                                               <select id="role_id" 
name="role_id">
+                                                       <xsl:apply-templates 
select="role_list/options"/>
+                                               </select>
+                                       </td>
+                                       <td>
+                                               <select id="user_id" 
name="user_id">
+                                                       <xsl:apply-templates 
select="user_list/options"/>
+                                               </select>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="query_start" id="query_start" size = "10"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="query_end" id="query_end" size = "10"/>
+                                       </td>
+                                       <td>
+                                               <xsl:variable 
name="lang_search">
+                                                       <xsl:value-of 
select="php:function('lang', 'Search')" />
+                                               </xsl:variable>
+                                               <input type="button" id = 
"search" name="search" value="{$lang_search}" title = "{$lang_search}" />
+                                       </td>
+                               </tr>
+                       </table>
                </td>
+       </tr>
+</xsl:template>
+
+
+<xsl:template name="role_fields" xmlns:php="http://php.net/xsl";>
+       <tr class ='row_off'>
                <td>
-                       <xsl:value-of select="php:function('lang', 'role')" />
+                       <xsl:value-of select="php:function('lang', 'date 
from')" />
                </td>
                <td>
-                       <xsl:value-of select="php:function('lang', 'user')" />
+                       <input type="text" name="values[active_from]" 
id="active_from" value=""/>
                </td>
-               <td colspan = "2" align = "center">
-                       <xsl:value-of select="php:function('lang', 'search')" />
-                       <xsl:text> </xsl:text>
-                       <xsl:value-of select="php:function('lang', 'date')" />
-               </td>
        </tr>
-         <tr id="filters">
+       <tr class ='row_off'>
                <td>
-                 <select id="dimb_id" name="dimb">
-                       <xsl:apply-templates select="dimb_list/options"/>
-                 </select>
-               </td>           
-               <td>
-                 <select id="role_id" name="role_id">
-                       <xsl:apply-templates select="role_list/options"/>
-                 </select>
-               </td>           
-               <td>
-                 <select id="user_id" name="user_id">
-                       <xsl:apply-templates select="user_list/options"/>
-                 </select>
-               </td>           
-               <td>
-                       <input type="text" name="query_start" id="query_start" 
size = "10"/>
+                       <xsl:value-of select="php:function('lang', 'date to')" 
/>
                </td>
                <td>
-                       <input type="text" name="query_end" id="query_end" size 
= "10"/>
+                       <input type="text" name="values[active_to]" 
id="active_to" value=""/>
                </td>
-               <td>
-                                               <xsl:variable 
name="lang_search">
-                                                       <xsl:value-of 
select="php:function('lang', 'Search')" />
-                                               </xsl:variable>
-                       <input type="button" id = "search" name="search" 
value="{$lang_search}" title = "{$lang_search}" />
-               </td>                   
-         </tr>
-         </table>
-         </td>
-         </tr>
+       </tr>
 </xsl:template>
 
 
-<xsl:template name="role_fields" xmlns:php="http://php.net/xsl";>
-               <tr class ='row_off'>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'date from')" />
-                       </td>
-                       <td>
-                               <input type="text" name="values[active_from]" 
id="active_from" value=""/>
-                       </td>
-               </tr>   
-               <tr class ='row_off'>
-                       <td>
-                               <xsl:value-of select="php:function('lang', 
'date to')" />
-                       </td>
-                       <td>
-                               <input type="text" name="values[active_to]" 
id="active_to" value=""/>
-                       </td>
-               </tr>
-</xsl:template>
-
-
-
-<xsl:template match="datatable" xmlns:php="http://php.net/xsl";>
-       <div id="paging_0"/>
-       <div id="datatable-container_0"/>
-
-       <div id="data_paginator"/>
-       <div id="datatable-container"/>
-       
-       <xsl:call-template name="datasource-definition" />
-       <div id="receipt"></div>
-       <xsl:variable name="label_submit">
-               <xsl:value-of select="php:function('lang', 'save')" />
-       </xsl:variable>
-       <div class="row_on">
-               <input type="submit" name="update_acl" id="frm_update_acl" 
value="{$label_submit}"/>
-       </div>
-</xsl:template>
-
-<xsl:template name="datasource-definition" xmlns:php="http://php.net/xsl";>
-
-               <!--  DATATABLE DEFINITIONS-->
-               <script type="text/javascript">
-                       var property_js = <xsl:value-of 
select="//property_js"/>;
-                       var datatable = new Array();
-                       var myColumnDefs = new Array();
-                       var myButtons = new Array();
-                       var td_count = <xsl:value-of select="//td_count"/>;
-
-                       <xsl:for-each select="//datatable">
-                               datatable[<xsl:value-of select="name"/>] = [
-                                       {
-                                               values:<xsl:value-of 
select="values"/>,
-                                               total_records: <xsl:value-of 
select="total_records"/>,
-                                               is_paginator:  <xsl:value-of 
select="is_paginator"/>,
-                                               edit_action:  <xsl:value-of 
select="edit_action"/>,
-                                               footer:<xsl:value-of 
select="footer"/>
-                                       }
-                               ]
-                       </xsl:for-each>
-                       <xsl:for-each select="//myColumnDefs">
-                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
-                       </xsl:for-each>
-                       <xsl:for-each select="//myButtons">
-                               myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
-                       </xsl:for-each>
-               </script>
-
-
-</xsl:template>
-
 <!-- options for use with select-->
 <xsl:template match="options">
        <option value="{id}">

Deleted: trunk/property/templates/base/role_user_substitute.xsl
===================================================================
--- trunk/property/templates/base/role_user_substitute.xsl      2017-04-23 
10:01:37 UTC (rev 16615)
+++ trunk/property/templates/base/role_user_substitute.xsl      2017-04-24 
14:23:10 UTC (rev 16616)
@@ -1,68 +0,0 @@
-
-<!-- $Id: tts.xsl 16389 2017-02-28 17:35:22Z sigurdne $ -->
-
-<xsl:template match="data">
-       <xsl:choose>
-               <xsl:when test="view">
-                       <xsl:apply-templates select="edit"/>
-               </xsl:when>
-       </xsl:choose>
-       <xsl:call-template name="jquery_phpgw_i18n"/>
-</xsl:template>
-
-
-
-<!-- edit -->
-<xsl:template xmlns:php="http://php.net/xsl"; match="edit">
-       <xsl:variable name="form_action">
-               <xsl:value-of select="form_action"/>
-       </xsl:variable>
-       <form class="pure-form pure-form-aligned" id="form" name="form" 
method="post" action="{$form_action}">
-               <div id="tab-content">
-                       <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
-                       <div id="general">
-                               <fieldset>
-                                       <div class="pure-control-group">
-                                               <xsl:variable 
name="lang_substitute">
-                                                       <xsl:value-of 
select="php:function('lang', 'substitute')"/>
-                                               </xsl:variable>
-                                               <label>
-                                                       <xsl:value-of 
select="$lang_substitute"/>
-                                               </label>
-                                               <select 
name="substitute_user_id" id="substitute_user_id">
-                                                       <xsl:attribute 
name="title">
-                                                               <xsl:value-of 
select="$lang_substitute"/>
-                                                       </xsl:attribute>
-                                                       <option value="">
-                                                               <xsl:value-of 
select="php:function('lang', 'select')"/>
-                                                       </option>
-                                                       <xsl:apply-templates 
select="user_list/options"/>
-                                               </select>
-                                       </div>
-                               </fieldset>
-                       </div>
-               </div>
-               <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="save">
-                       <xsl:attribute name="value">
-                               <xsl:value-of select="$lang_save"/>
-                       </xsl:attribute>
-                       <xsl:attribute name="title">
-                               <xsl:value-of select="$lang_save"/>
-                       </xsl:attribute>
-               </input>
-       </form>
-</xsl:template>
-
-
-<!-- New template-->
-<xsl:template match="options">
-       <option value="{id}">
-               <xsl:if test="selected != 0">
-                       <xsl:attribute name="selected" value="selected"/>
-               </xsl:if>
-               <xsl:value-of disable-output-escaping="yes" select="name"/>
-       </option>
-</xsl:template>

Copied: trunk/property/templates/base/substitute.xsl (from rev 16615, 
trunk/property/templates/base/role_user_substitute.xsl)
===================================================================
--- trunk/property/templates/base/substitute.xsl                                
(rev 0)
+++ trunk/property/templates/base/substitute.xsl        2017-04-24 14:23:10 UTC 
(rev 16616)
@@ -0,0 +1,161 @@
+
+<!-- $Id: tts.xsl 16389 2017-02-28 17:35:22Z sigurdne $ -->
+
+<xsl:template match="data">
+       <xsl:choose>
+               <xsl:when test="view">
+                       <xsl:apply-templates select="edit"/>
+               </xsl:when>
+       </xsl:choose>
+</xsl:template>
+
+<xsl:template match="table" xmlns:php="http://php.net/xsl";>
+       <style type="text/css">
+               #box { width: 200px; height: 5px; background: blue; }
+               select { width: 200px; }
+       </style>
+       <xsl:call-template name="table_substitute" />
+       <div id="popupBox"></div>
+       <div id="curtain"></div>
+</xsl:template>
+
+<xsl:template name="table_substitute" xmlns:php="http://php.net/xsl";>
+       <div class="body">
+               <div id="invoice-layout">
+                       <div class="header">
+                               <h2>
+                                       <xsl:value-of 
select="php:function('lang', 'substitute')"/>
+                               </h2>
+                       </div>
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <xsl:call-template name="msgbox"/>
+                               </xsl:when>
+                       </xsl:choose>
+                       <div class="body">
+                               <div id="voucher_details">
+                                       <table align = "center" width="95%">
+                                               <xsl:apply-templates 
select="filter_form" />
+                                       </table>
+                                       <form action="{update_action}" 
name="acl_form" id="acl_form" method="post">
+                                               <table align = "center" 
width="95%">
+                                                       <tr>
+                                                               <td colspan = 
'2'>
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_0'">
+                                                                               
        <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="data" select ='data'/>
+                                                                               
                <xsl:with-param name="config" select ='config'/>
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                               <div id="receipt"></div>
+                                               <xsl:variable 
name="label_submit">
+                                                       <xsl:value-of 
select="php:function('lang', 'save')" />
+                                               </xsl:variable>
+                                               <div class="row_on">
+                                                       <input type="submit" 
name="update_acl" id="frm_update_acl" value="{$label_submit}"/>
+                                               </div>
+                                       </form>
+                               </div>
+                       </div>
+               </div>
+       </div>
+</xsl:template>
+
+<xsl:template match="filter_form" xmlns:php="http://php.net/xsl";>
+       <xsl:call-template name="filter_list"/>
+</xsl:template>
+
+<xsl:template name="filter_list" xmlns:php="http://php.net/xsl";>
+       <tr>
+               <td colspan = '1'>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'user')" />
+                                       </td>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'substitute')" />
+                                       </td>
+                               </tr>
+                               <tr id="filters">
+                                       <td>
+                                               <select id="user_id" 
name="user_id">
+                                                       <xsl:apply-templates 
select="user_list/options"/>
+                                               </select>
+                                       </td>
+                                       <td>
+                                               <select id="substitute_user_id" 
name="substitute_user_id">
+                                                       <xsl:apply-templates 
select="substitute_list/options"/>
+                                               </select>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</xsl:template>
+
+
+
+<!-- edit -->
+<xsl:template xmlns:php="http://php.net/xsl"; match="edit">
+       <xsl:variable name="form_action">
+               <xsl:value-of select="form_action"/>
+       </xsl:variable>
+       <form class="pure-form pure-form-aligned" id="form" name="form" 
method="post" action="{$form_action}">
+               <div id="tab-content">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                       <div id="general">
+                               <fieldset>
+                                       <div class="pure-control-group">
+                                               <xsl:variable 
name="lang_substitute">
+                                                       <xsl:value-of 
select="php:function('lang', 'substitute')"/>
+                                               </xsl:variable>
+                                               <label>
+                                                       <xsl:value-of 
select="$lang_substitute"/>
+                                               </label>
+                                               <select 
name="substitute_user_id" id="substitute_user_id">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="$lang_substitute"/>
+                                                       </xsl:attribute>
+                                                       <option value="">
+                                                               <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                                       </option>
+                                                       <xsl:apply-templates 
select="user_list/options"/>
+                                               </select>
+                                       </div>
+                               </fieldset>
+                       </div>
+               </div>
+               <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="save">
+                       <xsl:attribute name="value">
+                               <xsl:value-of select="$lang_save"/>
+                       </xsl:attribute>
+                       <xsl:attribute name="title">
+                               <xsl:value-of select="$lang_save"/>
+                       </xsl:attribute>
+               </input>
+       </form>
+</xsl:template>
+
+
+<!-- New template-->
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected"/>
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>




reply via email to

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