fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9287] property: invoice acl


From: Sigurd Nes
Subject: [Fmsystem-commits] [9287] property: invoice acl
Date: Sun, 06 May 2012 19:23:11 +0000

Revision: 9287
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9287
Author:   sigurdne
Date:     2012-05-06 19:23:10 +0000 (Sun, 06 May 2012)
Log Message:
-----------
property: invoice acl

Modified Paths:
--------------
    trunk/property/inc/class.menu.inc.php

Added Paths:
-----------
    trunk/property/inc/class.bodimb_role_user.inc.php
    trunk/property/inc/class.sodimb_role_user.inc.php
    trunk/property/inc/class.uidimb_role_user.inc.php
    trunk/property/js/portico/ajax_dimb_role_user.js
    trunk/property/js/yahoo/dimb_role_user.index.js
    trunk/property/templates/base/dimb_role_user.xsl

Added: trunk/property/inc/class.bodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.bodimb_role_user.inc.php                           
(rev 0)
+++ trunk/property/inc/class.bodimb_role_user.inc.php   2012-05-06 19:23:10 UTC 
(rev 9287)
@@ -0,0 +1,70 @@
+<?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.uiinvoice2.inc.php 9286 2012-05-05 11:12:02Z 
sigurdne $
+       */
+
+
+       class property_bodimb_role_user
+       {
+       
+
+               var $public_functions = array
+               (
+               );
+
+               function __construct()
+               {
+                       $this->account_id                       = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->so                                       = 
CreateObject('property.sodimb_role_user');
+                       $this->allrows                          = 
$this->bo->allrows;
+               }
+
+
+               function read($data)
+               {
+                       static $users = array();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $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'];
+                                       }
+                               }
+
+                               $entry['active_from']   =  
isset($entry['active_from']) && $entry['active_from'] ? 
$GLOBALS['phpgw']->common->show_date($entry['active_from'], $dateformat) : '';
+                               $entry['active_to']             = 
isset($entry['active_from']) && $entry['active_from'] ? 
$GLOBALS['phpgw']->common->show_date($entry['active_to'], $dateformat) :'';
+                       }
+
+                       return $values;
+
+               }
+       }

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2012-05-05 11:12:02 UTC (rev 
9286)
+++ trunk/property/inc/class.menu.inc.php       2012-05-06 19:23:10 UTC (rev 
9287)
@@ -213,6 +213,7 @@
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property', 'location' => 
'.invoice.dimb', 'global_cats' => 'true', 'menu_selection' => 
'admin::property::accounting::dimb_roles') )
                                                ),
 */
+/*
                                                'dimb_role'     => array
                                                (
                                                        'text'  => lang('dimb 
roles'),
@@ -223,6 +224,12 @@
                                                        'text'  => lang('dimb 
role user'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'dimb_role_user') )
                                                ),
+*/
+                                               'dimb_role_user2' => array
+                                               (
+                                                       'text'  => lang('dimb 
role user'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uidimb_role_user.index') )
+                                               ),
 
                                                'accounting_dimd'       => array
                                                (

Added: trunk/property/inc/class.sodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.sodimb_role_user.inc.php                           
(rev 0)
+++ trunk/property/inc/class.sodimb_role_user.inc.php   2012-05-06 19:23:10 UTC 
(rev 9287)
@@ -0,0 +1,173 @@
+<?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.uiinvoice2.inc.php 9286 2012-05-05 11:12:02Z 
sigurdne $
+       */
+
+
+       class property_sodimb_role_user
+       {
+       
+               var $total_records = 0;
+
+               function __construct()
+               {
+                       $this->account_id       = 
$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)
+               {
+                       $dimb_id = (int) $data['dimb_id'];                      
+                       if(isset($data['user_id']) && $data['user_id'])
+                       {
+                               $user_id = (int) $data['user_id'];
+                       }
+                       else if(!$dimb_id)
+                       {
+                               $user_id = $this->account_id;
+                       }
+
+                       $role_id = (int) $data['role_id'];
+                       $query = $this->db->db_addslashes($data['query']);
+
+                       $filtermethod = '';
+                       $where = 'AND';
+                       if($user_id)
+                       {
+                               $filtermethod .= "{$where} user_id = $user_id";
+                               $where = 'AND';
+                       }
+                       if($role_id)
+                       {
+                               $filterrole = "WHERE id = $role_id";
+                               $filtermethod .= "{$where} role_id = $role_id";
+                               $where = 'AND';
+                       }
+                       if($dimb_id)
+                       {
+                               $filterdimb = "WHERE id = $dimb_id";
+                               $filtermethod .= "{$where} ecodimb = $dimb_id";
+                               $where = 'AND';
+                       }
+
+
+                       $sql = "SELECT fm_ecodimb_role_user.id, fm_ecodimb.id 
as ecodimb, user_id,role_id, active_from, active_to, default_user, 
fm_ecodimb_role.name as role"
+                       . " FROM fm_ecodimb_role_user"
+                       . " {$this->join} fm_ecodimb ON fm_ecodimb.id = 
fm_ecodimb_role_user.ecodimb"
+                       . " {$this->join} fm_ecodimb_role ON fm_ecodimb_role.id 
= fm_ecodimb_role_user.role_id"
+                       . " WHERE expired_on IS NULL {$filtermethod}"
+                       . " ORDER BY ecodimb ASC ";
+                       
+//_debug_array($sql);
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $user_data = array();
+                       while ($this->db->next_record())
+                       {
+                               $user_data[$this->db->f('ecodimb')][ 
$this->db->f('role_id')][$this->db->f('user_id')] = array
+                               (
+                                       'id'                    => 
$this->db->f('id'),
+                                       'ecodimb'               => 
$this->db->f('ecodimb'),
+                                       'user_id'               => 
$this->db->f('user_id'),
+                                       'role_id'               => 
$this->db->f('role_id'),
+                                       'role'                  => 
$this->db->f('role',true),
+                                       'default_user'  => 
$this->db->f('default_user'),
+                                       'active_from'   => 
$this->db->f('active_from'),
+                                       'active_to'     => 
$this->db->f('active_to'),
+                                       'ecodimb'               => 
$this->db->f('ecodimb'),
+                               );
+                       }
+
+
+                       $sql = "SELECT id, name FROM fm_ecodimb_role 
{$filterrole} ORDER BY id ASC ";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $roles = array();
+
+                       while ($this->db->next_record())
+                       {
+                               $roles[] = array
+                               (
+                                       'id' => $this->db->f('id'),
+                                       'name'  => $this->db->f('name', true),
+                               );
+                       }
+
+
+
+                       $sql = "SELECT fm_ecodimb.id FROM fm_ecodimb 
{$filterdimb} ORDER BY id ASC ";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $dimbs = array();
+
+                       while ($this->db->next_record())
+                       {
+                               $dimbs[] = $this->db->f('id');
+                       }
+
+
+                       if($dimb_id && ! $user_id)
+                       {
+                               $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 
'.invoice','property');
+                       }
+                       else
+                       {
+                               $users = array(array('account_id' => $user_id));
+                       }
+
+                       $values = array();
+
+                       foreach($dimbs as $dimb)
+                       {
+                               foreach($roles as $role)
+                               {
+                                       foreach ($users as $dummy => $user)
+                                       {
+                                               
if(isset($user_data[$dimb][$role['id']][$user['account_id']]))
+                                               {
+                                                       $values[] = 
$user_data[$dimb][$role['id']][$user['account_id']];
+                                               }
+                                               else
+                                               {
+                                                       $values[] = array
+                                                       (
+                                                               'ecodimb'       
        => $dimb,
+                                                               'role_id'       
        => $role['id'],
+                                                               'role'          
        => $role['name'],
+                                                               'user_id'       
        => $user['account_id'],
+                                                               'default_user'  
=> ''
+                                                       );
+                                               }
+                                       }
+                               }
+                       }
+
+                       return $values;
+               }
+       }

Added: trunk/property/inc/class.uidimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.uidimb_role_user.inc.php                           
(rev 0)
+++ trunk/property/inc/class.uidimb_role_user.inc.php   2012-05-06 19:23:10 UTC 
(rev 9287)
@@ -0,0 +1,316 @@
+<?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.uiinvoice2.inc.php 9286 2012-05-05 11:12:02Z 
sigurdne $
+       */
+
+       phpgw::import_class('phpgwapi.yui');
+       /**
+       * Import the jQuery class
+       */
+       phpgw::import_class('phpgwapi.jquery');
+
+
+       class property_uidimb_role_user
+       {
+               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,
+               );
+
+               function __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $this->account_id                       = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.bodimb_role_user');
+                       $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;
+                       $this->filter                           = 
$this->bo->filter;
+                       $this->status_id                        = 
$this->bo->status_id;
+                       $this->allrows                          = 
$this->bo->allrows;
+               
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'admin::property::accounting::dimb_role_user2';
+                       $this->config                           = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read();
+
+               }
+
+               public function add_javascript($app, $pkg, $name)
+               {
+                       return $GLOBALS['phpgw']->js->validate_file($pkg, 
str_replace('.js', '', $name), $app);
+               }
+               /**
+               * A more flexible version of xslttemplate.add_file
+               */
+               public function add_template_file($tmpl)
+               {
+                       if(is_array($tmpl))
+                       {
+                               foreach($tmpl as $t)
+                               {
+                                       $this->add_template_file($t);
+                               }
+                               return;
+                       }
+                       foreach(array_reverse($this->tmpl_search_path) as $path)
+                       {
+                               $filename = $path . '/' . $tmpl . '.xsl';
+                               if (file_exists($filename))
+                               {
+                                       
$GLOBALS['phpgw']->xslttpl->xslfiles[$tmpl] = $filename;
+                                       return;
+                               }
+                       }
+                       echo "Template $tmpl not found in search path: ";
+                       print_r($this->tmpl_search_path);
+                       die;
+               }
+
+               public function link($data)
+               {
+                       return $GLOBALS['phpgw']->link('/index.php', $data);
+               }
+
+               public function redirect($link_data)
+               {
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+               }
+
+
+
+
+               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();
+                       $datavalues = array();
+                       $myButtons      = array();
+
+                       $datavalues[] = array
+                       (
+                               'name'                          => "0",
+                               'values'                        => 
$this->query(),//json_encode(array()),
+                               'total_records'         => 0,
+                               'permission'            => "''",
+                               'is_paginator'          => 0,
+                               'edit_action'           => "''",
+                               'footer'                        => 0
+                       );
+
+                       $datatable = array
+                       (
+                               array
+                               (
+                               'key' => 'id',
+                               'hidden' => true
+                               ),
+                               array
+                               (
+                                       'key' => 'user',
+                                       'label' => lang('user'),
+                                       'sortable' => false
+                               ),
+                               array
+                               (
+                                       'key' => 'ecodimb',
+                                       'label' => lang('dim b'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key'   =>      'role',
+                                       'label' =>      lang('role'),
+                                       'formatter' => 'FormatterRight',
+                                       'sortable'      =>      true
+                               ),
+                               array
+                               (
+                                       'key' => 'default_user',
+                                       'label' => lang('default'),
+                                       'sortable'      => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'active_from',
+                                       'label' => lang('date from'),
+                                       'sortable'      => true,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key' => 'active_to',
+                                       'label' => lang('date to'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'add',
+                                       'label' => lang('add'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'delete',
+                                       'label' => lang('delete'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'alter_date',
+                                       'label' => lang('alter_date'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode($datatable)
+                       );      
+
+
+
+                       $user_list = 
$this->bocommon->get_user_list_right2('select', PHPGW_ACL_READ, $this->filter, 
'.invoice', array(), $this->account_id);
+                       $role_list = execMethod('property.bogeneric.get_list', 
array('type'=>'dimb_role', 'selected' => $role ));
+                       $dimb_list = execMethod('property.bogeneric.get_list', 
array('type'=>'dimb', 'selected' => $dimb ));
+
+                       array_unshift ($user_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift ($role_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift ($dimb_list ,array 
('id'=>'','name'=>lang('select')));
+
+                       $data = array
+                       (
+                               'td_count'                                      
        => '""',
+                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,
+                               'myButtons'                                     
        => $myButtons,
+
+                               'msgbox_data'                                   
=> $msgbox_data,
+                               'filter_form'                                   
=> array
+                                                                               
                        (
+                                                                               
                                'user_list'     => array('options' => 
$user_list),
+                                                                               
                                'role_list'     => array('options' => 
$role_list),
+                                                                               
                                'dimb_list'     => array('options' => 
$dimb_list),
+                                                                               
                        ),
+                               'update_action'                                 
=> self::link(array('menuaction' => 'property.uidimb_role_user.edit'))
+                       );
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('start_date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('end_date');
+
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       phpgwapi_jquery::load_widget('core');
+
+                       self::add_javascript('property', 'portico', 
'ajax_dimb_role_user.js');
+                       self::add_javascript('property', 'yahoo', 
'dimb_role_user.index.js');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('dimb_role_user'));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
+               }
+       
+
+               public function query()
+               {
+                       $user_id =      phpgw::get_var('user_id', 'int');
+                       $dimb_id =      phpgw::get_var('dimb_id', 'int');
+                       $role_id =      phpgw::get_var('role_id', 'int');
+                       $query =        phpgw::get_var('query');
+
+//                     $this->bo->allrows = true;
+                       $values = $this->bo->read(array('user_id' => $user_id, 
'dimb_id' => $dimb_id, 'role_id' => $role_id, 'query' => $query));
+
+                       foreach($values as &$entry)
+                       {
+                               if($entry['active_from'])
+                               {
+                                       $default_user_checked = 
$entry['default_user'] == 1 ? 'checked = "checked"' : '';
+                                       $entry['default_user'] = "<input 
id=\"default_user\" type =\"checkbox\" $default_user_checked 
name=\"values[default_user][]\" value=\"{$entry['id']}\">";
+                                       $entry['delete'] = "<input 
id=\"delete\" type =\"checkbox\" name=\"values[delete][]\" 
value=\"{$entry['id']}\">";
+                                       $entry['alter_date'] = "<input 
id=\"alter_date\" type =\"checkbox\" name=\"values[alter_date][]\" 
value=\"{$entry['id']}\">";
+                                       $entry['add'] = '';
+                               }
+                               else
+                               {
+                                       $entry['default_user'] = '';
+                                       $entry['delete'] = '';
+                                       $entry['alter_date'] = '';
+                                       $entry['add'] = "<input id=\"add\" type 
=\"checkbox\" name=\"values[add][]\" 
value=\"{$entry['ecodimb']}_{$entry['role_id']}_{$entry['user_id']}\">";        
                   
+                               }
+                               $results['results'][]= $entry;
+                       }
+
+                       return json_encode($values);
+               }
+
+       }

Added: trunk/property/js/portico/ajax_dimb_role_user.js
===================================================================
--- trunk/property/js/portico/ajax_dimb_role_user.js                            
(rev 0)
+++ trunk/property/js/portico/ajax_dimb_role_user.js    2012-05-06 19:23:10 UTC 
(rev 9287)
@@ -0,0 +1,558 @@
+$(document).ready(function()
+{
+
+       $("#dimb_id").change(function ()
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#user_id").change(function ()
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#role_id").change(function ()
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#search").click(function(e)
+       {
+               update_dimb_role_user_table();
+    });
+
+
+       $("#voucher_id_filter").change(function () {
+
+               $("#voucher_id").val( '' );
+               $("#voucher_id_text").html( '' );
+               $("#line_id").val( '' );
+               $("#line_text").val( '' );
+               $("#order_id").val( '' );
+               $("#project_group").val( '' );
+               $("#invoice_id").html( '' );
+               $("#kid_nr").html( '' );
+               $("#vendor").html('' );
+//             $("#janitor").html( '' );
+//             $("#supervisor").html( '' );
+//             $("#budget_responsible").html( '' );
+               $("#close_order_orig").val( '' );
+               $("#my_initials").val( '' );
+               $("#sign_orig").val( '' );
+               $("#invoice_date").html( '' );
+               $("#payment_date").html( '' );
+               $("#b_account_id").val( '' );
+//             $("#amount").html( '' );
+//             $("#approved_amount").html( '' );
+               $("#currency").html( '' );
+               $("#oppsynsmannid").html( '' );
+               $("#saksbehandlerid").html( '' );
+               $("#budsjettansvarligid").html( '' );
+               $("#remark").html( '' );
+               $("#process_log").html( '' );
+               $("#dim_a").val('' );
+               $("#dim_b").html( "<option>Velg</option>" );
+               $("#dim_e").html( "<option>Velg</option>" );
+               $("#period").html( "<option>Velg</option>" );
+               $("#periodization").html( "<option>Velg</option>" );
+               $("#periodization_start").html( "<option>Velg</option>" );
+               $("#process_code").html( "<option>Velg</option>" );
+               $("#tax_code").html( "<option>0</option>" );
+               $("#approve_as").html( "<option>Velg</option>" );
+               $("#order_text").html( 'Bestilling' );
+               $("#invoice_id_text").html('FakturaNr');
+               $("#close_order").html( '' );
+               $("#close_order_orig").val( '' );
+               $("#park_order").html( '' );
+               $("#receipt").html('');
+
+               var voucher_id = $(this).val();
+               var oArgs = {menuaction:'property.uiinvoice2.get_first_line'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               var line_id = 0;
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&voucher_id=" + voucher_id,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       line_id = data['line_id'];
+                                       base_java_url['line_id'] = line_id;
+                                       base_java_url['voucher_id_filter'] = 
voucher_id;
+                                       execute_async(myDataTable_0);
+                                       update_form_values(line_id, 0);
+                               }
+                       }
+                       });
+
+
+       //      document.getElementById('image_content').src = '';
+       });
+
+       $("#approve_line").live("click", function(e){
+               $("#receipt").html('');
+               var line_id = $(this).val();
+               var voucher_id_orig = $("#voucher_id").val();
+               update_form_values(line_id, voucher_id_orig);
+    });
+
+
+       $("#voucher_form").live("submit", function(e){
+               e.preventDefault();
+               var line_id = $("#line_id").val();
+               var voucher_id_orig = $("#voucher_id").val();
+               if(!line_id)
+               {
+                       alert('Du må velge linje i bilag');
+                       return;
+               }
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(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.uiinvoice2.get_vouchers'};
+                                               var requestUrl = 
phpGWLink('index.php', oArgs, true);
+                                               requestUrl = requestUrl + 
"&voucher_id_filter=" + $("#voucher_id").val();
+                                               
execute_async(myDataTable_0,requestUrl);
+                               */
+
+                                               
base_java_url['voucher_id_filter'] = $("#voucher_id").val();
+                                               base_java_url['line_id'] = 
line_id;
+                                               execute_async(myDataTable_0);
+                                       }
+                                       else
+                                       {
+                                       $(submitBnt).val("Feil ved lagring");   
                                
+                                       }
+                                                
+                               // Changes text on save button back to original
+                               window.setTimeout(function() {
+                                               $(submitBnt).val('Lagre Linje');
+                                               
$(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);
+                                       
+                                       update_form_values(line_id, 
voucher_id_orig);
+                               }
+                       }
+               });
+       });
+});
+
+
+function update_form_values( line_id, voucher_id_orig ){
+       var oArgs = {menuaction:'property.uiinvoice2.get_single_line'};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: requestUrl + "&line_id=" + line_id,
+               success: function(data) {
+                       if(data.sessionExpired)
+                       {
+                               alert('Sesjonen er utløpt - du må logge inn på 
nytt');
+                               return;
+                       }
+                       var voucher = data['voucher'];
+                       if( voucher != null && voucher.length > 0)
+                       {
+                               $("#line_id").val( line_id );
+               
+                               var update_image = false;
+
+                               if(voucher_id_orig != voucher[0].voucher_id)
+                               {
+                                       update_image = true;
+                               }
+                               $("#voucher_id").val( voucher[0].voucher_id );
+                               if( voucher[0].voucher_out_id )
+                               {
+                                       $("#voucher_id_text").html( 
voucher[0].voucher_out_id );
+                               }
+                               else
+                               {
+                                       $("#voucher_id_text").html( 
voucher[0].voucher_id );
+                               }
+
+                               $("#order_id").val( voucher[0].order_id );
+
+                               if(voucher[0].order_id)
+                               {
+                                       var oArgs_order = 
{menuaction:'property.uiinvoice.view_order', order_id: voucher[0].order_id};
+                                       var requestUrl_order = 
phpGWLink('index.php', oArgs_order);
+//                                     var htmlString_order  =  " <a target= 
\"_blank\" href=\"" + requestUrl_order + "\" title=\"" + voucher[0].status + 
"\" > Bestilling</a>";
+
+                                       var htmlString_order  =  " <a 
href=\"javascript:load_order(" + voucher[0].order_id + ");\" title=\"" + 
voucher[0].status + "\" > Bestilling</a>";
+
+                                       $("#order_text").html( htmlString_order 
);
+                               }
+                               else
+                               {
+                                       $("#order_text").html( 'Bestilling' );
+                               }
+
+                               $("#project_group").val( 
voucher[0].project_group );
+
+                               if(update_image)
+                               {
+                                       if(voucher[0].external_ref)
+                                       {
+                                               
$("#invoice_id_text").html(voucher[0].external_ref );
+                                               
document.getElementById('image_content').src = voucher[0].image_url;
+                                       }
+                                       else
+                                       {
+                                               
$("#invoice_id_text").html('FakturaNr');
+                                               
document.getElementById('image_content').src = '';
+                                       }
+                               }
+
+                               $("#invoice_id").html( voucher[0].invoice_id );
+                               $("#kid_nr").html( voucher[0].kid_nr );
+                               $("#vendor").html( voucher[0].vendor );
+                               $("#invoice_date").html( 
voucher[0].invoice_date );
+                               $("#payment_date").html( 
voucher[0].payment_date );
+                               $("#b_account_id").val( voucher[0].b_account_id 
);
+                               $("#dim_a").val( voucher[0].dim_a );
+                               $("#currency").html( voucher[0].currency );
+                               $("#process_log").html( 
data['generic'].process_log );
+                               $("#my_initials").val( 
data['generic'].my_initials );
+                               $("#sign_orig").val( data['generic'].sign_orig 
);
+                               $("#line_text").val( voucher[0].line_text );
+
+                               if(voucher[0].merknad)
+                               {
+                                       var oArgs_remark = 
{menuaction:'property.uiinvoice.remark', id: voucher[0].id};
+                                       var requestUrl_remark = 
phpGWLink('index.php', oArgs_remark);
+                                       var htmlString  =  " <a 
href=\"javascript:openwindow('" +requestUrl_remark + "','550','400')\" > 
Remark</a>";
+
+                                       $("#remark").html( htmlString );
+                               }
+//---------
+                               var checked_park_invoice = "";
+                               var park_invoice_status = "";
+                               if(voucher[0].parked)
+                               {
+                                       checked_park_invoice = "checked = 
\"checked\"";
+                                       var park_invoice_status = " X";
+                               }
+                               var htmlString_park_invoice = "<input 
type=\"checkbox\" name=\"values[park_invoice]\" value=\"1\" title=\"park 
invoice\"" + checked_park_invoice + "></input>" + park_invoice_status;
+                               $("#park_order").html( htmlString_park_invoice 
);
+//---------
+                               var checked_close_order = "";
+                               var close_order_status = " " + 
voucher[0].status;
+                               if(voucher[0].closed)
+                               {
+                                       checked_close_order = "checked = 
\"checked\"";
+                               }
+                               var htmlString_close_order = "<input 
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close 
order\"" + checked_close_order + "></input>" + close_order_status;
+                               $("#close_order").html( htmlString_close_order 
);
+                               $("#close_order_orig").val( voucher[0].closed );
+//---------
+
+                               
if(typeof(data['generic']['dimb_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+                                       var obj = 
data['generic']['dimb_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].dim_b)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                               });
+
+                                       $("#dim_b").html( htmlString );
+                               }
+                               
if(typeof(data['generic']['dime_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+                                       var obj = 
data['generic']['dime_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].dim_e)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                               });
+
+                                       $("#dim_e").html( htmlString );
+                               }
+                               
if(typeof(data['generic']['tax_code_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+
+                                       htmlString  = "<option>Velg</option>"
+
+                                       var obj = 
data['generic']['tax_code_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].tax_code)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                               });
+
+                                       $("#tax_code").html( htmlString );
+                               }
+
+                               
if(typeof(data['generic']['period_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+                                       var obj = 
data['generic']['period_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].period)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                               });
+                                       $("#period").html( htmlString );
+                               }
+                               
if(typeof(data['generic']['periodization_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+
+                                       var obj = 
data['generic']['periodization_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].periodization)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                               });
+
+                                       $("#periodization").html( htmlString );
+                               }
+                               
if(typeof(data['generic']['periodization_start_list']['options']) != 
'undefined')
+                               {
+                                       var htmlString = "";
+
+                                       var obj = 
data['generic']['periodization_start_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].periodization_start)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                               });
+
+                                       $("#periodization_start").html( 
htmlString );
+                               }
+
+                               
if(typeof(data['generic']['process_code_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+
+                                       var obj = 
data['generic']['process_code_list']['options'];
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(obj[i].id == 
voucher[0].process_code)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#process_code").html( htmlString );
+                               }
+
+                               if(typeof(data['generic']['approved_list']) != 
'undefined')
+                               {
+                                       for ( var i = 0; i < 
data['generic']['approved_list'].length; ++i )
+                                       {
+                                               var role_sign = 
data['generic']['approved_list'][i].role_sign;
+
+                                               var role_initials = 
data['generic']['approved_list'][i].initials;
+
+                                               if( 
data['generic']['approved_list'][i].date )
+                                               {
+                                                       var htmlString = 
role_initials + ": " + data['generic']['approved_list'][i].date;
+                                               }
+                                               else
+                                               {
+                                                       var htmlString = 
"<select id=\"_" + role_sign + "\" name=\"values[forward][" + role_sign + 
"]\">";
+                                                       var obj = 
data['generic']['approved_list'][i]['user_list'].options;
+                                                       $.each(obj, function(i) 
{
+                                                               var selected = 
'';
+                                                               if(obj[i].id == 
role_initials)
+                                                               {
+                                                                       
selected = ' selected';
+                                                               }
+                                                               htmlString  += 
"<option value='" + obj[i].id + "'" + selected + ">" + obj[i].name + 
"</option>";
+                                                       });
+                                                       htmlString  += 
"</select>";
+                                               }
+
+                                               $("#" + role_sign).html( 
htmlString );
+                                       }
+                               }
+
+                               
if(typeof(data['generic']['approve_list']['options']) != 'undefined')
+                               {
+                                       var htmlString = "";
+
+                                       var obj = 
data['generic']['approve_list']['options'];
+
+                                       $.each(obj, function(i) {
+                                               var selected = '';
+                                               if(typeof(obj[i].selected) != 
'undefined' && obj[i].selected == 1)
+                                               {
+                                                       selected = ' selected';
+                                               }
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#approve_as").html( htmlString );
+                               }
+                       }
+                       else
+                       {
+                               $("#line_text").val( '' );
+                               $("#voucher_id").val( '' );
+                               $("#voucher_id_text").html( '' );
+                               $("#order_id").val( '' );
+                               $("#project_group").val( '' );
+                               $("#invoice_id").html( '' );
+                               $("#kid_nr").html( '' );
+                               $("#vendor").html('' );
+                               $("#close_order_orig").val( '' );
+                               $("#my_initials").val( '' );
+                               $("#sign_orig").val( '' );
+                               $("#invoice_date").html( '' );
+                               $("#payment_date").html( '' );
+                               $("#b_account_id").val( '' );
+                               $("#currency").html( '' );
+                               $("#oppsynsmannid").html( '' );
+                               $("#saksbehandlerid").html( '' );
+                               $("#budsjettansvarligid").html( '' );
+                               $("#remark").html( '' );
+                               $("#process_log").html( '' );
+                               $("#dim_a").val('' );
+                               $("#dim_b").html( "<option>Velg</option>" );
+                               $("#dim_e").html( "<option>Velg</option>" );
+                               $("#period").html( "<option>Velg</option>" );
+                               $("#periodization").html( 
"<option>Velg</option>" );
+                               $("#periodization_start").html( 
"<option>Velg</option>" );
+                               $("#process_code").html( 
"<option>Velg</option>" );
+                               $("#tax_code").html( "<option>0</option>" );
+                               $("#approve_as").html( "<option>Velg</option>" 
);
+                               $("#order_text").html( 'Bestilling' );
+                               $("#invoice_id_text").html('FakturaNr');
+                               $("#receipt").html('');
+                               document.getElementById('image_content').src = 
'';
+                       }
+               }
+       });
+}
+
+
+function update_dimb_role_user_table()
+{
+       var oArgs = {menuaction:'property.uidimb_role_user.query', 
dimb_id:$("#dimb_id").val(), 
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query:$("#query").val()};
+       execute_async(myDataTable_0,  oArgs);
+}
+
+
+//------------
+
+function load_order( id ){
+       var oArgs = {menuaction: 'property.uiinvoice.view_order', order_id: id, 
nonavbar: true, lean: true};
+       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,closejs:function(){closeJS_local()}});
+//     $("#curtain").show();
+//     $("#popupBox").fadeIn("slow");
+//     var htmlString = "";
+//     htmlString += "<iframe  width=\"100%\" height=\"100%\" src = \"" + 
requestUrl + "\" ><p>Your browser does not support iframes.</p></iframe>";
+//     $("#popupBox").html( htmlString );
+}
+
+function closeJS_local()
+{
+       var line_id = $("#line_id").val( );
+       var voucher_id_orig = $("#voucher_id").val();
+       $("#curtain").hide();
+       $("#popupBox").hide();
+       update_form_values(line_id, voucher_id_orig)
+}
+
+function closeJS_remote()
+{
+       TINY.box.hide();
+/*
+       var line_id = $("#line_id").val( );
+       var voucher_id_orig = $("#voucher_id").val();
+       $("#curtain").hide();
+       $("#popupBox").hide();
+       update_form_values(line_id, voucher_id_orig)
+*/
+}
+
+function hide_popupBox( ){
+       var line_id = $("#line_id").val( );
+       var voucher_id_orig = $("#voucher_id").val();
+       $("#curtain").hide();
+       $("#popupBox").hide();
+       update_form_values(line_id, voucher_id_orig);
+}
+
+
+

Added: trunk/property/js/yahoo/dimb_role_user.index.js
===================================================================
--- trunk/property/js/yahoo/dimb_role_user.index.js                             
(rev 0)
+++ trunk/property/js/yahoo/dimb_role_user.index.js     2012-05-06 19:23:10 UTC 
(rev 9287)
@@ -0,0 +1,38 @@
+var    myPaginator_0, myDataTable_0
+
+       this.myParticularRenderEvent = function()
+       {
+
+       }
+
+
+
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+       }       
+
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+
+ 
/********************************************************************************/
+
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+
+

Added: trunk/property/templates/base/dimb_role_user.xsl
===================================================================
--- trunk/property/templates/base/dimb_role_user.xsl                            
(rev 0)
+++ trunk/property/templates/base/dimb_role_user.xsl    2012-05-06 19:23:10 UTC 
(rev 9287)
@@ -0,0 +1,224 @@
+<!-- $Id: invoice2.xsl 9286 2012-05-05 11:12:02Z sigurdne $ -->
+
+<func:function name="phpgw:conditional">
+       <xsl:param name="test"/>
+       <xsl:param name="true"/>
+       <xsl:param name="false"/>
+
+       <func:result>
+               <xsl:choose>
+                       <xsl:when test="$test">
+                               <xsl:value-of select="$true"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$false"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </func:result>
+</func:function>
+
+<!-- separate tabs and  inline tables-->
+
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <style type="text/css">
+       #box { width: 200px; height: 5px; background: blue; }
+       //select { width: 200px; }
+       #voucher_id_filter { width: 800px; }
+       #dim_b { width: 200px; }
+       #dim_e { width: 200px; }
+       #period { width: 200px; }
+       #periodization { width: 200px; }
+       #periodization_start { width: 200px; }
+       #process_code { width: 200px; }
+       #tax_code { width: 200px; }
+       #approve_as { width: 200px; }
+       #_oppsynsmannid { width: 200px; }
+       #_saksbehandlerid { width: 200px; }
+       #_budsjettansvarligid { width: 200px; }
+       .row_on,.th_bright
+       {
+               background-color: #CCEEFF;
+       }
+
+       .row_off
+       {
+               background-color: #DDF0FF;
+       }
+
+       </style>
+
+       <xsl:call-template name="invoice" />
+       <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">
+               <div id="invoice-layout">
+                               <div class="header">
+                                       <h2><xsl:value-of 
select="php:function('lang', 'invoice')"/></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">
+                                               <!--<xsl:call-template 
name="yui_phpgw_i18n"/>-->
+                                               <table align = "center" 
width="95%">
+                                                       <xsl:apply-templates 
select="filter_form" />
+                                               </table>
+                                               <form action="{update_action}" 
name="voucher_form" id="voucher_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"/>
+                                                                       </td>
+                                                               </tr>
+                                                       </table>
+                                               </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 = '6'>
+       <table>
+       <tr>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'dim b')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'user')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'role')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'search')" />
+               </td>
+       </tr>
+         <tr id="filters">
+               <td>
+                 <select id="dimb_id" name="dimb">
+                       <xsl:apply-templates select="dimb_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="user_id" name="user_id">
+                       <xsl:apply-templates select="user_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="role_id" name="role_id">
+                       <xsl:apply-templates select="role_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                       <input type="text" name="query" id="query"/>
+               </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', 
'date from')" />
+                       </td>
+                       <td>
+                               <input type="text" name="values[start_date]" 
id="start_date" value="{voucher_info/voucher/line_text}"/>
+                       </td>
+               </tr>   
+               <tr class ='row_off'>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'date to')" />
+                       </td>
+                       <td>
+                               <input type="text" name="values[end_date]" 
id="end_date" value="{voucher_info/voucher/line_text}"/>
+                       </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="values[update_voucher]" 
id="frm_update_voucher" 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}">
+               <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]