fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13814] booking: more on custom fields


From: Sigurd Nes
Subject: [Fmsystem-commits] [13814] booking: more on custom fields
Date: Mon, 31 Aug 2015 12:18:06 +0000

Revision: 13814
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13814
Author:   sigurdne
Date:     2015-08-31 12:18:04 +0000 (Mon, 31 Aug 2015)
Log Message:
-----------
booking: more on custom fields

Modified Paths:
--------------
    branches/dev-syncromind/admin/inc/class.bo_custom.inc.php
    branches/dev-syncromind/admin/inc/class.ui_custom.inc.php
    branches/dev-syncromind/admin/templates/base/custom.xsl
    branches/dev-syncromind/admin/templates/base/select_location.xsl
    branches/dev-syncromind/booking/inc/class.menu.inc.php

Modified: branches/dev-syncromind/admin/inc/class.bo_custom.inc.php
===================================================================
--- branches/dev-syncromind/admin/inc/class.bo_custom.inc.php   2015-08-31 
09:46:22 UTC (rev 13813)
+++ branches/dev-syncromind/admin/inc/class.bo_custom.inc.php   2015-08-31 
12:18:04 UTC (rev 13814)
@@ -172,6 +172,11 @@
                        $this->so->resort($id, $resort, $this->appname, 
$this->location);
                }
 
+               function resort_attrib_group($id, $resort)
+               {
+                       $this->so->resort_group($id, $resort, $this->appname, 
$this->location);
+               }
+
                function save_attrib($attrib)
                {
                        if (isset($attrib['id']) && $attrib['id'])
@@ -406,9 +411,9 @@
                        return $entry_list;
                }
 
-               function get_attrib_group_list($app,$location, $selected)
+               function get_attrib_group_list($appname,$location, $selected)
                {
-                       $group_list = $this->read_attrib_group($app, $location, 
true);
+                       $group_list = $this->read_attrib_group(array('appname' 
=> $appname, 'location' => $location, 'allrows' => true));
 
                        foreach($group_list as &$group)
                        {
@@ -421,14 +426,14 @@
                        return $group_list;
                }
 
-               function read_attrib_group($app, $location, $allrows = false)
+               function read_attrib_group($data = array())
                {
-                       if($allrows)
+                       if($data['allrows'])
                        {
-                               $this->allrows = $allrows;
+                               $this->allrows = $data['allrows'];
                        }
 
-                       $attrib = $this->so->find_group($app, $location, 
$this->start, $this->query, $this->sort, $this->order, $this->allrows);
+                       $attrib = $this->so->find_group($data['appname'], 
$data['location'], $data['start'], $data['query'], $data['sort'], 
$data['order'], $this->allrows);
 
                        $this->total_records = $this->so->total_records;
 
@@ -436,4 +441,56 @@
                }
 
 
+               function read_single_attrib_group($appname, $location, $id)
+               {
+                       return $this->so->get_group($appname, $location, $id, 
true);
+               }
+
+               public function save_attrib_group($group, $action = '')
+               {
+                       $receipt                         = array();
+
+                       if(!isset($group['appname']) || !$group['appname'])
+                       {
+                               throw new 
Exception("admin_bocustom::save_attrib_group() - Missing appname in input");
+                       }
+
+                       if(!isset($group['location']) || !$group['location'])
+                       {
+                               throw new 
Exception("admin_bocustom::save_attrib_group() - Missing location in input");
+                       }
+
+                       if($action == 'edit' && $group['id'])
+                       {
+                               if($this->so->edit_group($group))
+                               {
+                                       $receipt['message'][] = array('msg' => 
lang('group has been updated'));
+                                       return $receipt;
+                               }
+
+                               $receipt['error'][] = array('msg' => 
lang('unable to update group'));
+                               return $receipt;
+                       }
+                       else
+                       {
+                               $id = $this->so->add_group($group);
+                               if($id <= 0)
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('unable to add group'));
+                                       return $receipt;
+                               }
+                               else if($id == -1)
+                               {
+                                       $receipt['id']           = 0;
+                                       $receipt['error'][]      = array('msg' 
=> lang('group already exists, please choose another name'));
+                                       $receipt['error'][]      = array('msg' 
=> lang('Attribute group has NOT been saved'));
+                                       return $receipt;
+                               }
+
+                               $receipt['id']                   = $id;
+                               $receipt['message'][]    = array('msg' => 
lang('group has been created'));
+                               return $receipt;
+                       }
+               }
+
        }

Modified: branches/dev-syncromind/admin/inc/class.ui_custom.inc.php
===================================================================
--- branches/dev-syncromind/admin/inc/class.ui_custom.inc.php   2015-08-31 
09:46:22 UTC (rev 13813)
+++ branches/dev-syncromind/admin/inc/class.ui_custom.inc.php   2015-08-31 
12:18:04 UTC (rev 13814)
@@ -1,23 +1,24 @@
 <?php
        /**
-       * phpGroupWare
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
-       * @package admin
-       * @subpackage custom fields and functions
-       * @version $Id$
-       */
-
+        * phpGroupWare
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+        * @package admin
+        * @subpackage custom fields and functions
+        * @version $Id$
+        */
        /**
         * Description
         * @package property
         */
+       phpgw::import_class('phpgwapi.uicommon_jquery');
 
-       class admin_ui_custom
+       class admin_ui_custom extends phpgwapi_uicommon_jquery
        {
+
                var $grants;
                var $start;
                var $query;
@@ -25,63 +26,78 @@
                var $order;
                var $sub;
                var $local_menu_selection = false;
-
+               var $menu_selection;
                var $public_functions = array
-               (
-                       'delete'                                => True,
-                       'list_attribute'                => True,
-                       'edit_attrib'                   => True,
-                       'list_custom_function'  => True,
-                       'edit_custom_function'  => True
+                       (
+                       'delete'                                 => true,
+                       'list_attribute'                 => true,
+                       'edit_attrib'                    => true,
+                       'list_custom_function'   => true,
+                       'edit_custom_function'   => true,
+                       'list_attribute_group'   => true,
+                       'edit_attrib_group'              => true,
                );
 
                public function __construct()
                {
-                       $this->bo                                       = 
CreateObject('admin.bo_custom',True);
+                       parent::__construct();
 
-                       $this->start                            = 
$this->bo->start;
-                       $this->query                            = 
$this->bo->query;
-                       $this->sort                                     = 
$this->bo->sort;
-                       $this->order                            = 
$this->bo->order;
-                       $this->appname                          = 
$this->bo->appname;
-                       $this->location                         = 
$this->bo->location;
-                       $this->allrows                          = 
$this->bo->allrows;
+                       $this->bo = CreateObject('admin.bo_custom', true);
 
-                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
-                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bolocation                       = 
CreateObject('preferences.boadmin_acl');
-                       $this->bolocation->acl_app      = $this->appname;
+                       $this->start     = $this->bo->start;
+                       $this->query     = $this->bo->query;
+                       $this->sort              = $this->bo->sort;
+                       $this->order     = $this->bo->order;
+                       $this->appname   = $this->bo->appname;
+                       $this->location  = $this->bo->location;
+                       $this->allrows   = $this->bo->allrows;
 
-                       if(!$GLOBALS['phpgw_info']['flags']['menu_selection'] = 
phpgw::get_var('menu_selection'))
+                       $GLOBALS['phpgw_info']['flags']['xslt_app']      = true;
+                       $this->nextmatchs                                       
                 = CreateObject('phpgwapi.nextmatchs');
+                       $this->account                                          
                 = $GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bolocation                                       
                 = CreateObject('preferences.boadmin_acl');
+                       $this->bolocation->acl_app                              
         = $this->appname;
+
+                       $this->acl                       = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location      = 'admin';
+                       $this->acl_read          = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, $this->appname);
+                       $this->acl_add           = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, $this->appname);
+                       $this->acl_edit          = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, $this->appname);
+                       $this->acl_delete        = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, $this->appname);
+
+                       if($GLOBALS['phpgw_info']['flags']['menu_selection'] = 
phpgw::get_var('menu_selection'))
                        {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] = "admin::{$this->appname}";
-                               $this->local_menu_selection = true;
+                               $this->menu_selection = 
$GLOBALS['phpgw_info']['flags']['menu_selection'];
                        }
+                       else
+                       {
+
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection']        = 
"admin::{$this->appname}";
+                               $this->local_menu_selection                     
                                 = true;
+                       }
                }
 
                function save_sessiondata()
                {
                        $data = array
-                       (
-                               'start'         => $this->start,
-                               'query'         => $this->query,
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'allrows'       => $this->allrows,
-                               'appname'       => $this->appname,
-                               'location'      => $this->location
+                               (
+                               'start'          => $this->start,
+                               'query'          => $this->query,
+                               'sort'           => $this->sort,
+                               'order'          => $this->order,
+                               'allrows'        => $this->allrows,
+                               'appname'        => $this->appname,
+                               'location'       => $this->location
                        );
                        $this->bo->save_sessiondata($data);
                }
 
-
                function list_attribute()
                {
-                       $appname        = $this->appname;
-                       $location       = $this->location;
-                       $id                     = phpgw::get_var('id', 'int');
-                       $resort         = phpgw::get_var('resort');
+                       $appname         = $this->appname;
+                       $location        = $this->location;
+                       $id                      = phpgw::get_var('id', 'int');
+                       $resort          = phpgw::get_var('resort');
 
                        if($this->local_menu_selection)
                        {
@@ -89,9 +105,9 @@
                        }
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                               'custom',
-                                                               'nextmatchs',
-                                                               
'search_field'));
+                               'custom',
+                               'nextmatchs',
+                               'search_field'));
 
                        if($resort)
                        {
@@ -99,31 +115,39 @@
                        }
                        $attrib_list = $this->bo->get_attribs($appname, 
$location);
 
-                       if ( is_array($attrib_list))
+                       if(is_array($attrib_list))
                        {
                                foreach($attrib_list as $entry)
                                {
                                        $content[] = array
-                                       (
-                                               'name'                          
        => $entry['name'],
-                                               'datatype'                      
        => $entry['datatype'],
-                                               'column_name'                   
=> $entry['column_name'],
-                                               'input_text'                    
=> $entry['input_text'],
-                                               'sorting'                       
        => $entry['attrib_sort'],
-                                               'search'                        
        => $entry['search'],
-                                               'link_up'                       
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.list_attribute', 'resort'=>'up', 'appname'=> $appname, 
'location'=> $location, 'id'=> $entry['id'], 'allrows'=> $this->allrows, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                               'link_down'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.list_attribute', 'resort'=>'down', 'appname'=> $appname, 
'location'=> $location, 'id'=> $entry['id'], 'allrows'=> $this->allrows, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                               'link_edit'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.edit_attrib', 'appname'=> $appname, 'location'=> $location, 
'id'=> $entry['id'], 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                               'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.delete', 'appname'=> $appname, 'location'=> $location, 
'attrib_id'=> $entry['id'], 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                               'lang_up_text'                  
=> lang('shift up'),
-                                               'lang_down_text'                
=> lang('shift down'),
-                                               'lang_edit_text'                
=> lang('edit the attrib'),
-                                               'lang_delete_text'              
=> lang('delete the attrib'),
-                                               'text_attribute'                
=> lang('Attributes'),
-                                               'text_up'                       
        => lang('up'),
-                                               'text_down'                     
        => lang('down'),
-                                               'text_edit'                     
        => lang('edit'),
-                                               'text_delete'                   
=> lang('delete')
+                                               (
+                                               'name'                          
 => $entry['name'],
+                                               'datatype'                      
 => $entry['datatype'],
+                                               'column_name'            => 
$entry['column_name'],
+                                               'input_text'             => 
$entry['input_text'],
+                                               'group_id'                      
 => $entry['group_id'],
+                                               'sorting'                       
 => $entry['attrib_sort'],
+                                               'search'                        
 => $entry['search'],
+                                               'link_up'                       
 => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute',
+                                                       'resort' => 'up', 
'appname' => $appname, 'location' => $location, 'id' => $entry['id'],
+                                                       'allrows' => 
$this->allrows, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                                               'link_down'                     
 => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute',
+                                                       'resort' => 'down', 
'appname' => $appname, 'location' => $location, 'id' => $entry['id'],
+                                                       'allrows' => 
$this->allrows, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                                               'link_edit'                     
 => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.edit_attrib',
+                                                       'appname' => $appname, 
'location' => $location, 'id' => $entry['id'], 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                                               'link_delete'            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.delete',
+                                                       'appname' => $appname, 
'location' => $location, 'attrib_id' => $entry['id'],
+                                                       'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                                               'lang_up_text'           => 
lang('shift up'),
+                                               'lang_down_text'         => 
lang('shift down'),
+                                               'lang_edit_text'         => 
lang('edit the attrib'),
+                                               'lang_delete_text'       => 
lang('delete the attrib'),
+                                               'text_attribute'         => 
lang('Attributes'),
+                                               'text_up'                       
 => lang('up'),
+                                               'text_down'                     
 => lang('down'),
+                                               'text_edit'                     
 => lang('edit'),
+                                               'text_delete'            => 
lang('delete')
                                        );
                                }
                        }
@@ -131,204 +155,202 @@
 //_debug_array($content);
 
                        $table_header[] = array
-                       (
-                               'lang_descr'            => lang('Descr'),
-                               'lang_datatype'         => lang('Datatype'),
-                               'lang_sorting'          => lang('sorting'),
-                               'lang_search'           => lang('search'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_name'                     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'column_name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'admin.ui_custom.list_attribute',
-                                                                               
                                'appname'       => $appname,
-                                                                               
                                'location'      => $location,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                 )
-                                                                               
)),
-                               'sort_sorting'          => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'attrib_sort',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'admin.ui_custom.list_attribute',
-                                                                               
                                'appname'       => $appname,
-                                                                               
                                'location'      => $location,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )
-                                                                               
)),
-                               'lang_name'             => lang('Name'),
+                               (
+                               'lang_descr'     => lang('Descr'),
+                               'lang_datatype'  => lang('Datatype'),
+                               'lang_sorting'   => lang('sorting'),
+                               'lang_search'    => lang('search'),
+                               'lang_edit'              => lang('edit'),
+                               'lang_delete'    => lang('delete'),
+                               'lang_group'     => lang('group'),
+                               'sort_name'              => 
$this->nextmatchs->show_sort_order(array
+                                       (
+                                       'sort'   => $this->sort,
+                                       'var'    => 'column_name',
+                                       'order'  => $this->order,
+                                       'extra'  => array('menuaction'   => 
'admin.ui_custom.list_attribute',
+                                               'appname'                => 
$appname,
+                                               'location'               => 
$location,
+                                               'allrows'                => 
$this->allrows,
+                                               'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                       )
+                               )),
+                               'sort_sorting'   => 
$this->nextmatchs->show_sort_order(array
+                                       (
+                                       'sort'   => $this->sort,
+                                       'var'    => 'attrib_sort',
+                                       'order'  => $this->order,
+                                       'extra'  => array('menuaction'   => 
'admin.ui_custom.list_attribute',
+                                               'appname'                => 
$appname,
+                                               'location'               => 
$location,
+                                               'allrows'                => 
$this->allrows,
+                                               'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                       )
+                               )),
+                               'lang_name'              => lang('Name'),
                        );
 
 
                        $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_attribtext'   => lang('add an 
attrib'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.edit_attrib', 'appname'=> $appname, 'location'=> $location, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_attribtext'  => lang('Return to 
admin'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               (
+                               'lang_add'                               => 
lang('add'),
+                               'lang_add_attribtext'    => lang('add an 
attrib'),
+                               'add_action'                     => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.edit_attrib',
+                                       'appname' => $appname, 'location' => 
$location, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                               'lang_done'                              => 
lang('done'),
+                               'lang_done_attribtext'   => lang('Return to 
admin'),
+                               'done_action'                    => 
$GLOBALS['phpgw']->link('/admin/index.php'),
                        );
 
                        if(!$this->allrows)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $record_limit = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $record_limit = $this->bo->total_records;
                        }
 
                        $link_data = array
-                       (
-                               'menuaction'    => 
'admin.ui_custom.list_attribute',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'query'                 => $this->query,
-                               'appname'               => $appname,
-                               'location'              => $location,
+                               (
+                               'menuaction'     => 
'admin.ui_custom.list_attribute',
+                               'sort'                   => $this->sort,
+                               'order'                  => $this->order,
+                               'query'                  => $this->query,
+                               'appname'                => $appname,
+                               'location'               => $location,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
                        $data = array
-                       (
-                               'lang_appname'                                  
        => lang('application'),
-                               'appname'                                       
                => $appname,
-                               'allow_allrows'                                 
        => True,
-                               'allrows'                                       
                => $this->allrows,
-                               'start_record'                                  
        => $this->start,
-                               'record_limit'                                  
        => $record_limit,
-                               'start_record'                                  
        => $this->start,
-                               'num_records'                                   
        => count($attrib_list),
-                               'all_records'                                   
        => $this->bo->total_records,
-                               'link_url'                                      
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
                => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_attribtext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_attribtext'          => 
lang('Submit the search string'),
-                               'query'                                         
                => $this->query,
-                               'lang_search'                                   
        => lang('search'),
-                               'table_header_attrib'                           
=> $table_header,
-                               'values_attrib'                                 
        => (isset($content)?$content:''),
-                               'table_add'                                     
                => $table_add,
-
-                               'lang_no_location'                              
        => lang('No location'),
-                               'lang_location_statustext'                      
=> lang('Select submodule'),
-                               'select_name_location'                          
=> 'location',
-                               'location_list'                                 
        => $this->bolocation->select_location('filter',$location,False,True),
-
+                               (
+                               'lang_appname'                                  
 => lang('application'),
+                               'appname'                                       
         => $appname,
+                               'allow_allrows'                                 
 => True,
+                               'allrows'                                       
         => $this->allrows,
+                               'start_record'                                  
 => $this->start,
+                               'record_limit'                                  
 => $record_limit,
+                               'start_record'                                  
 => $this->start,
+                               'num_records'                                   
 => count($attrib_list),
+                               'all_records'                                   
 => $this->bo->total_records,
+                               'link_url'                                      
         => $GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'img_path'                                      
         => $GLOBALS['phpgw']->common->get_image_path('phpgwapi', 'default'),
+                               'lang_searchfield_attribtext'    => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_attribtext'   => 
lang('Submit the search string'),
+                               'query'                                         
         => $this->query,
+                               'lang_search'                                   
 => lang('search'),
+                               'table_header_attrib'                    => 
$table_header,
+                               'values_attrib'                                 
 => (isset($content) ? $content : ''),
+                               'table_add'                                     
         => $table_add,
+                               'lang_no_location'                       => 
lang('No location'),
+                               'lang_location_statustext'       => 
lang('Select submodule'),
+                               'select_name_location'           => 'location',
+                               'location_list'                          => 
$this->bolocation->select_location('filter', $location, False, True),
                        );
 
-                       $function_msg   = lang('list custom attribute');
+                       $function_msg = lang('list custom attribute');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' .lang('attribute') . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' . lang('attribute') . ': ' . $function_msg;
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('list_attribute' => $data));
                        $this->save_sessiondata();
                }
 
                function edit_attrib()
                {
-                       $appname        = $this->appname;
-                       $location       = $this->location;
-                       $id                     = phpgw::get_var('id', 'int');
-                       $values         = phpgw::get_var('values', 'string', 
'POST', array());
+                       $appname         = $this->appname;
+                       $location        = $this->location;
+                       $id                      = phpgw::get_var('id', 'int');
+                       $values          = phpgw::get_var('values', 'string', 
'POST', array());
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('custom'));
 
-                       if (isset($values['save']) && $values['save'])
+                       if(isset($values['save']) && $values['save'])
                        {
                                if($id)
                                {
-                                       $values['id']=$id;
-                                       $action='edit';
+                                       $values['id']    = $id;
+                                       $action                  = 'edit';
                                }
 
-                               $values['appname']= $appname;
-                               $values['location'] = $location ? $location : 
$values['location'];
+                               $values['appname']       = $appname;
+                               $values['location']      = $location ? 
$location : $values['location'];
 
-                               if (!$values['location'])
+                               if(!$values['location'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('location not selected!'));
+                                       $receipt['error'][] = array('msg' => 
lang('location not selected!'));
                                }
                                else
                                {
                                        $location = $values['location'];
                                }
 
-                               if (!$values['column_name'])
+                               if(!$values['column_name'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Column name not entered!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Column name not entered!'));
                                }
 
-                               
if(!preg_match('/^[a-z0-9_]+$/i',$values['column_name']))
+                               if(!preg_match('/^[a-z0-9_]+$/i', 
$values['column_name']))
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Column name %1 contains illegal character', 
$values['column_name']));
+                                       $receipt['error'][] = array('msg' => 
lang('Column name %1 contains illegal character', $values['column_name']));
                                }
 
-                               if (!$values['input_text'])
+                               if(!$values['input_text'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Input text not entered!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Input text not entered!'));
                                }
-                               if (!$values['statustext'])
+                               if(!$values['statustext'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Statustext not entered!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Statustext not entered!'));
                                }
 
-                               if (!$values['appname'])
+                               if(!$values['appname'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('application not chosen!'));
+                                       $receipt['error'][] = array('msg' => 
lang('application not chosen!'));
                                }
 
-                               if (!$values['column_info']['type'])
+                               if(!$values['column_info']['type'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Datatype type not chosen!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Datatype type not chosen!'));
                                }
 
                                
if(!ctype_digit($values['column_info']['precision']) && 
$values['column_info']['precision'])
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please enter precision as integer !'));
                                        
unset($values['column_info']['precision']);
                                }
 
                                if($values['column_info']['scale'] && 
!ctype_digit($values['column_info']['scale']))
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
+                                       $receipt['error'][] = array('msg' => 
lang('Please enter scale as integer !'));
                                        unset($values['column_info']['scale']);
                                }
 
-                               if (!$values['column_info']['nullable'])
+                               if(!$values['column_info']['nullable'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('Nullable not chosen!'));
+                                       $receipt['error'][] = array('msg' => 
lang('Nullable not chosen!'));
                                }
 
-                               if (!isset($receipt['error']))
+                               if(!isset($receipt['error']))
                                {
                                        $receipt = 
$this->bo->save_attrib($values);
 
                                        if(!$id)
                                        {
-                                               $id=$receipt['id'];
+                                               $id = $receipt['id'];
                                        }
-                               //      
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'admin.ui_custom.edit_attrib', 'appname' => $values['appname'], 'location' => 
$values['location'], 'id' => $id, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']));
-
+                                       //      
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'admin.ui_custom.edit_attrib', 'appname' => $values['appname'], 'location' => 
$values['location'], 'id' => $id, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']));
                                }
                                else
                                {
-                                       $receipt['error'][] = array('msg'       
=> lang('Attribute has NOT been saved'));
+                                       $receipt['error'][] = array('msg' => 
lang('Attribute has NOT been saved'));
                                }
-
                        }
 
-                       if ($id)
+                       if($id)
                        {
-                               $values = 
$this->bo->get_attrib_single($appname,$location,$id);
-                               $type_name=$values['type_name'];
-                               $function_msg = lang('edit attribute'). ' ' . 
lang($type_name);
+                               $values                  = 
$this->bo->get_attrib_single($appname, $location, $id);
+                               $type_name               = $values['type_name'];
+                               $function_msg    = lang('edit attribute') . ' ' 
. lang($type_name);
                        }
                        else
                        {
@@ -336,113 +358,98 @@
                        }
 
                        $link_data = array
-                       (
-                               'menuaction'    => 
'admin.ui_custom.edit_attrib',
-                               'appname'               => $appname,
-                               'location'              => $values['location'],
-                               'id'                    => $id,
+                               (
+                               'menuaction'     => 
'admin.ui_custom.edit_attrib',
+                               'appname'                => $appname,
+                               'location'               => $values['location'],
+                               'id'                     => $id,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
                        $multiple_choice = '';
-                       if(isset($values['column_info']['type']) && 
($values['column_info']['type']=='R' || $values['column_info']['type']=='CH' || 
$values['column_info']['type']=='LB'))
+                       if(isset($values['column_info']['type']) && 
($values['column_info']['type'] == 'R' || $values['column_info']['type'] == 
'CH' || $values['column_info']['type'] == 'LB'))
                        {
-                               $multiple_choice= True;
+                               $multiple_choice = True;
                        }
 
 //_debug_array($values);
 
-                       $msgbox_data = 
(isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'');
+                       $msgbox_data = (isset($receipt) ? 
$GLOBALS['phpgw']->common->msgbox_data($receipt) : '');
 
                        $data = array
-                       (
-                               'appname'                                       
                => $appname,
-
-                               'lang_choice'                                   
        => lang('Choice'),
-                               'lang_new_value'                                
        => lang('New value'),
-                               'lang_new_value_statustext'                     
=> lang('New value for multiple choice'),
-                               'multiple_choice'                               
        => $multiple_choice,
-                               'value_choice'                                  
        => (isset($values['choice'])?$values['choice']:''),
-                               'lang_delete_value'                             
        => lang('Delete value'),
-                               'lang_value'                                    
        => lang('value'),
-                               'lang_delete_choice_statustext'         => 
lang('Delete this value from the list of multiple choice'),
-
-                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.list_attribute', 'appname'=> $appname, 'location'=>$location, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_entity_type'                              
        => lang('Entity type'),
-                               'lang_no_entity_type'                           
=> lang('No entity type'),
-                               'lang_save'                                     
                => lang('save'),
-                               'lang_done'                                     
                => lang('done'),
-                               'value_id'                                      
                => $id,
-
-                               'value_column_name'                             
        => (isset($values['column_name'])?$values['column_name']:''),
-
-                               'value_input_text'                              
        => (isset($values['input_text'])?$values['input_text']:''),
-
-                               'lang_id_attribtext'                            
=> lang('Enter the attribute ID'),
-                               'lang_entity_statustext'                        
=> lang('Select a entity type'),
-
-                               'value_statustext'                              
        => (isset($values['statustext'])?$values['statustext']:''),
-
-                               'lang_done_attribtext'                          
=> lang('Back to the list'),
-                               'lang_save_attribtext'                          
=> lang('Save the attribute'),
-
-                               'lang_datatype_statustext'                      
=> lang('Select a datatype'),
-                               'lang_no_datatype'                              
        => lang('No datatype'),
-                               'datatype_list'                                 
        => 
$this->bo->select_datatype((isset($values['column_info']['type'])?$values['column_info']['type']:'')),
-                               'attrib_group_list'                             
        => array('options' => 
$this->bo->get_attrib_group_list($this->appname,$this->location, 
$values['group_id'])),
-                               'lang_precision'                                
        => lang('Precision'),
-                               'lang_precision_statustext'                     
=> lang('enter the record length'),
-                               'value_precision'                               
        => 
(isset($values['column_info']['precision'])?$values['column_info']['precision']:''),
-
-                               'lang_scale'                                    
        => lang('scale'),
-                               'lang_scale_statustext'                         
=> lang('enter the scale if type is decimal'),
-                               'value_scale'                                   
        => 
(isset($values['column_info']['scale'])?$values['column_info']['scale']:''),
-
-                               'lang_default'                                  
        => lang('default'),
-                               'lang_default_statustext'                       
=> lang('enter the default value'),
-                               'value_default'                                 
        => 
(isset($values['column_info']['default'])?$values['column_info']['default']:''),
-
-                               'lang_nullable'                                 
        => lang('Nullable'),
-                               'lang_nullable_statustext'                      
=> lang('Chose if this column is nullable'),
-                               'lang_select_nullable'                          
=> lang('Select nullable'),
-                               'nullable_list'                                 
        => 
$this->bo->select_nullable((isset($values['column_info']['nullable'])?$values['column_info']['nullable']:'')),
-                               'value_lookup_form'                             
        => (isset($values['lookup_form'])?$values['lookup_form']:''),
-                               'lang_lookup_form'                              
        => lang('show in lookup forms'),
-                               'lang_lookup_form_statustext'           => 
lang('check to show this attribue in lookup forms'),
-                               'value_list'                                    
        => (isset($values['list'])?$values['list']:''),
-                               'lang_list'                                     
                => lang('show in list'),
-                               'lang_list_statustext'                          
=> lang('check to show this attribute in entity list'),
-                               'value_search'                                  
        => (isset($values['search'])?$values['search']:''),
-                               'lang_include_search'                           
=> lang('Include in search'),
-                               'lang_include_search_statustext'        => 
lang('check to show this attribute in location list'),
-
-                               'value_history'                                 
        => (isset($values['history'])?$values['history']:''),
-                               'lang_history'                                  
        => lang('history'),
-                               'lang_history_statustext'                       
=> lang('Enable history for this attribute'),
-
-                               'lang_no_location'                              
        => lang('No location'),
-                               'lang_location_statustext'                      
=> lang('Select submodule'),
-                               'select_name_location'                          
=> 'values[location]',
-
-                               'location_list'                                 
        => $this->bolocation->select_location('select', $location, false, true),
-
-                               'value_disabled'                                
        => isset($values['disabled']) ? $values['disabled'] : '',
-                               'lang_disabled'                                 
        => lang('disabled'),
-                               'lang_disabled_statustext'                      
=> lang('This attribute turn up as disabled in the form'),
-
-                               'value_helpmsg'                                 
        => isset($values['helpmsg']) ? $values['helpmsg'] : '',
-                               'lang_helpmsg'                                  
        => lang('help message'),
-                               'lang_helpmsg_statustext'                       
=> lang('Enables help message for this attribute'),
-                               'value_location'                                
        => $location
+                               (
+                               'appname' => $appname,
+                               'lang_choice'                                   
 => lang('Choice'),
+                               'lang_new_value'                                
 => lang('New value'),
+                               'lang_new_value_statustext'              => 
lang('New value for multiple choice'),
+                               'multiple_choice'                               
 => $multiple_choice,
+                               'value_choice'                                  
 => (isset($values['choice']) ? $values['choice'] : ''),
+                               'lang_delete_value'                             
 => lang('Delete value'),
+                               'lang_value'                                    
 => lang('value'),
+                               'lang_delete_choice_statustext'  => 
lang('Delete this value from the list of multiple choice'),
+                               'msgbox_data'                    => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'done_action'                    => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute',
+                                       'appname' => $appname, 'location' => 
$location, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                               'lang_entity_type'               => 
lang('Entity type'),
+                               'lang_no_entity_type'    => lang('No entity 
type'),
+                               'lang_save'                              => 
lang('save'),
+                               'lang_done'                              => 
lang('done'),
+                               'value_id'                               => $id,
+                               'value_column_name' => 
(isset($values['column_name']) ? $values['column_name'] : ''),
+                               'value_input_text' => 
(isset($values['input_text']) ? $values['input_text'] : ''),
+                               'lang_id_attribtext'     => lang('Enter the 
attribute ID'),
+                               'lang_entity_statustext' => lang('Select a 
entity type'),
+                               'value_statustext' => 
(isset($values['statustext']) ? $values['statustext'] : ''),
+                               'lang_done_attribtext'   => lang('Back to the 
list'),
+                               'lang_save_attribtext'   => lang('Save the 
attribute'),
+                               'lang_datatype_statustext'       => 
lang('Select a datatype'),
+                               'lang_no_datatype'                       => 
lang('No datatype'),
+                               'datatype_list'                          => 
$this->bo->select_datatype((isset($values['column_info']['type']) ? 
$values['column_info']['type'] : '')),
+                               'attrib_group_list'                      => 
array('options' => $this->bo->get_attrib_group_list($this->appname, 
$this->location, $values['group_id'])),
+                               'lang_precision'                         => 
lang('Precision'),
+                               'lang_precision_statustext'      => lang('enter 
the record length'),
+                               'value_precision'                        => 
(isset($values['column_info']['precision']) ? 
$values['column_info']['precision'] : ''),
+                               'lang_scale'                     => 
lang('scale'),
+                               'lang_scale_statustext'  => lang('enter the 
scale if type is decimal'),
+                               'value_scale'                    => 
(isset($values['column_info']['scale']) ? $values['column_info']['scale'] : ''),
+                               'lang_default'                           => 
lang('default'),
+                               'lang_default_statustext'        => lang('enter 
the default value'),
+                               'value_default'                          => 
(isset($values['column_info']['default']) ? $values['column_info']['default'] : 
''),
+                               'lang_nullable'                                 
 => lang('Nullable'),
+                               'lang_nullable_statustext'               => 
lang('Chose if this column is nullable'),
+                               'lang_select_nullable'                   => 
lang('Select nullable'),
+                               'nullable_list'                                 
 => $this->bo->select_nullable((isset($values['column_info']['nullable']) ? 
$values['column_info']['nullable'] : '')),
+                               'value_lookup_form'                             
 => (isset($values['lookup_form']) ? $values['lookup_form'] : ''),
+                               'lang_lookup_form'                              
 => lang('show in lookup forms'),
+                               'lang_lookup_form_statustext'    => lang('check 
to show this attribue in lookup forms'),
+                               'value_list'                                    
 => (isset($values['list']) ? $values['list'] : ''),
+                               'lang_list'                                     
         => lang('show in list'),
+                               'lang_list_statustext'                   => 
lang('check to show this attribute in entity list'),
+                               'value_search'                                  
 => (isset($values['search']) ? $values['search'] : ''),
+                               'lang_include_search'                    => 
lang('Include in search'),
+                               'lang_include_search_statustext' => lang('check 
to show this attribute in location list'),
+                               'value_history'                          => 
(isset($values['history']) ? $values['history'] : ''),
+                               'lang_history'                           => 
lang('history'),
+                               'lang_history_statustext'        => 
lang('Enable history for this attribute'),
+                               'lang_no_location'                       => 
lang('No location'),
+                               'lang_location_statustext'       => 
lang('Select submodule'),
+                               'select_name_location'           => 
'values[location]',
+                               'location_list' => 
$this->bolocation->select_location('select', $location, false, true),
+                               'value_disabled'                         => 
isset($values['disabled']) ? $values['disabled'] : '',
+                               'lang_disabled'                          => 
lang('disabled'),
+                               'lang_disabled_statustext'       => lang('This 
attribute turn up as disabled in the form'),
+                               'value_helpmsg'                          => 
isset($values['helpmsg']) ? $values['helpmsg'] : '',
+                               'lang_helpmsg'                           => 
lang('help message'),
+                               'lang_helpmsg_statustext'        => 
lang('Enables help message for this attribute'),
+                               'value_location'                         => 
$location
                        );
 //_debug_array($values);
 
-                       $appname        = lang('appname');
+                       $appname = lang('appname');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit_attrib' => $data));
                }
 
                function list_custom_function()
@@ -452,339 +459,334 @@
                                
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::list_functions';
                        }
 
-                       $appname        = $this->appname;
-                       $location       = $this->location;
-                       $id                     = phpgw::get_var('id', 'int');
-                       $resort         = phpgw::get_var('resort');
+                       $appname         = $this->appname;
+                       $location        = $this->location;
+                       $id                      = phpgw::get_var('id', 'int');
+                       $resort          = phpgw::get_var('resort');
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                               'custom',
-                                                               'nextmatchs',
-                                                               
'search_field'));
+                               'custom',
+                               'nextmatchs',
+                               'search_field'));
 
                        if($resort)
                        {
-                               $this->bo->resort_custom_function($id,$resort);
+                               $this->bo->resort_custom_function($id, $resort);
                        }
-                       $custom_function_list = 
$this->bo->read_custom_function($appname,$location);
-                       $content = array();
-                       if (isset($custom_function_list) AND 
is_array($custom_function_list))
+                       $custom_function_list    = 
$this->bo->read_custom_function($appname, $location);
+                       $content                                 = array();
+                       if(isset($custom_function_list) AND 
is_array($custom_function_list))
                        {
                                foreach($custom_function_list as $entry)
                                {
 
                                        $content[] = array
-                                       (
-                                               'file_name'                     
                => $entry['file_name'],
-                                               'descr'                         
                => $entry['descr'],
-                                               'sorting'                       
                => $entry['sorting'],
-                                               'active'                        
                => $entry['active']?'X':'',
-                                               'client_side'                   
        => $entry['client_side']?'X':'',
-                                               'pre_commit'                    
        => $entry['pre_commit']?'X':'',
-                                               'link_up'                       
                => $GLOBALS['phpgw']->link('/index.php',array
-                                                                               
                                (
-                                                                               
                                        'menuaction'            => 
'admin.ui_custom.list_custom_function',
-                                                                               
                                        'resort'                        => 'up',
-                                                                               
                                        'appname'                       => 
$appname,
-                                                                               
                                        'location'                      => 
$location,
-                                                                               
                                        'id'                            => 
$entry['id'],
-                                                                               
                                        'allrows'                       => 
$this->allrows,
-                                                                               
                                        'menu_selection'        => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )),
-                                               'link_down'                     
                => $GLOBALS['phpgw']->link('/index.php',array
-                                                                               
                                (
-                                                                               
                                        'menuaction'            => 
'admin.ui_custom.list_custom_function',
-                                                                               
                                        'resort'                        => 
'down',
-                                                                               
                                        'appname'                       => 
$appname,
-                                                                               
                                        'location'                      => 
$location,
-                                                                               
                                        'id'                            => 
$entry['id'],
-                                                                               
                                        'allrows'                       => 
$this->allrows,
-                                                                               
                                        'menu_selection'        => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )),
-                                               'link_edit'                     
                => $GLOBALS['phpgw']->link('/index.php',array
-                                                                               
                                (
-                                                                               
                                        'menuaction'            => 
'admin.ui_custom.edit_custom_function',
-                                                                               
                                        'appname'                       => 
$appname,
-                                                                               
                                        'location'                      => 
$location,
-                                                                               
                                        'id'                            => 
$entry['id'],
-                                                                               
                                        'menu_selection'        => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                        )),
-                                               'link_delete'                   
        => $GLOBALS['phpgw']->link('/index.php',array
-                                                                               
                                (
-                                                                               
                                        'menuaction'            => 
'admin.ui_custom.delete',
-                                                                               
                                        'appname'                       => 
$appname,
-                                                                               
                                        'location'                      => 
$location,
-                                                                               
                                        'custom_function_id'=> $entry['id'],
-                                                                               
                                        'menu_selection'        => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )),
-                                               'lang_up_text'                  
        => lang('shift up'),
-                                               'lang_down_text'                
        => lang('shift down'),
-                                               'lang_edit_text'                
        => lang('edit the custom_function'),
-                                               'lang_delete_text'              
        => lang('delete the custom_function'),
-                                               'text_custom_function'          
        => lang('custom functions'),
-                                               'text_up'                       
                => lang('up'),
-                                               'text_down'                     
                => lang('down'),
-                                               'text_edit'                     
                => lang('edit'),
-                                               'text_delete'                   
        => lang('delete')
+                                               (
+                                               'file_name'                     
         => $entry['file_name'],
+                                               'descr'                         
         => $entry['descr'],
+                                               'sorting'                       
         => $entry['sorting'],
+                                               'active'                        
         => $entry['active'] ? 'X' : '',
+                                               'client_side'                   
 => $entry['client_side'] ? 'X' : '',
+                                               'pre_commit'                    
 => $entry['pre_commit'] ? 'X' : '',
+                                               'link_up'                       
         => $GLOBALS['phpgw']->link('/index.php', array
+                                                       (
+                                                       'menuaction'     => 
'admin.ui_custom.list_custom_function',
+                                                       'resort'                
 => 'up',
+                                                       'appname'               
 => $appname,
+                                                       'location'              
 => $location,
+                                                       'id'                    
 => $entry['id'],
+                                                       'allrows'               
 => $this->allrows,
+                                                       'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                               )),
+                                               'link_down'                     
         => $GLOBALS['phpgw']->link('/index.php', array
+                                                       (
+                                                       'menuaction'     => 
'admin.ui_custom.list_custom_function',
+                                                       'resort'                
 => 'down',
+                                                       'appname'               
 => $appname,
+                                                       'location'              
 => $location,
+                                                       'id'                    
 => $entry['id'],
+                                                       'allrows'               
 => $this->allrows,
+                                                       'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                               )),
+                                               'link_edit'                     
         => $GLOBALS['phpgw']->link('/index.php', array
+                                                       (
+                                                       'menuaction'     => 
'admin.ui_custom.edit_custom_function',
+                                                       'appname'               
 => $appname,
+                                                       'location'              
 => $location,
+                                                       'id'                    
 => $entry['id'],
+                                                       'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                               )),
+                                               'link_delete'                   
 => $GLOBALS['phpgw']->link('/index.php', array
+                                                       (
+                                                       'menuaction'            
 => 'admin.ui_custom.delete',
+                                                       'appname'               
         => $appname,
+                                                       'location'              
         => $location,
+                                                       'custom_function_id' => 
$entry['id'],
+                                                       'menu_selection'        
 => $GLOBALS['phpgw_info']['flags']['menu_selection']
+                                               )),
+                                               'lang_up_text'                  
 => lang('shift up'),
+                                               'lang_down_text'                
 => lang('shift down'),
+                                               'lang_edit_text'                
 => lang('edit the custom_function'),
+                                               'lang_delete_text'              
 => lang('delete the custom_function'),
+                                               'text_custom_function'   => 
lang('custom functions'),
+                                               'text_up'                       
         => lang('up'),
+                                               'text_down'                     
         => lang('down'),
+                                               'text_edit'                     
         => lang('edit'),
+                                               'text_delete'                   
 => lang('delete')
                                        );
                                }
                        }
 
                        $table_header[] = array
-                       (
-                               'lang_descr'            => lang('Descr'),
-                               'lang_active'           => lang('Active'),
-                               'lang_pre_commit'       => lang('pre commit'),
-                               'lang_client_side'      => lang('client side'),
-                               'lang_sorting'          => lang('sorting'),
-                               'lang_search'           => lang('search'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_name'                     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'file_name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 
'admin.ui_custom.list_custom_function',
-                                                                               
                                'appname'       => $appname,
-                                                                               
                                'location'      => $location,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )
-                                                                               
)),
-                               'sort_sorting'          => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'custom_sort',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 
'admin.ui_custom.list_custom_function',
-                                                                               
                                'appname'       => $appname,
-                                                                               
                                'location'      => $location,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )
-                                                                               
)),
-                               'lang_name'                     => lang('Name'),
+                               (
+                               'lang_descr'             => lang('Descr'),
+                               'lang_active'            => lang('Active'),
+                               'lang_pre_commit'        => lang('pre commit'),
+                               'lang_client_side'       => lang('client side'),
+                               'lang_sorting'           => lang('sorting'),
+                               'lang_search'            => lang('search'),
+                               'lang_edit'                      => 
lang('edit'),
+                               'lang_delete'            => lang('delete'),
+                               'sort_name'                      => 
$this->nextmatchs->show_sort_order(array
+                                       (
+                                       'sort'   => $this->sort,
+                                       'var'    => 'file_name',
+                                       'order'  => $this->order,
+                                       'extra'  => array('menuaction'   => 
'admin.ui_custom.list_custom_function',
+                                               'appname'                => 
$appname,
+                                               'location'               => 
$location,
+                                               'allrows'                => 
$this->allrows,
+                                               'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                       )
+                               )),
+                               'sort_sorting'           => 
$this->nextmatchs->show_sort_order(array
+                                       (
+                                       'sort'   => $this->sort,
+                                       'var'    => 'custom_sort',
+                                       'order'  => $this->order,
+                                       'extra'  => array('menuaction'   => 
'admin.ui_custom.list_custom_function',
+                                               'appname'                => 
$appname,
+                                               'location'               => 
$location,
+                                               'allrows'                => 
$this->allrows,
+                                               'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                                       )
+                               )),
+                               'lang_name'                      => 
lang('Name'),
                        );
 
                        $table_add[] = array
-                       (
-                               'lang_add'                                      
        => lang('add'),
-                               'lang_add_custom_functiontext'  => lang('add a 
custom_function'),
-                               'add_action'                                    
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.edit_custom_function', 'appname'=> $appname, 'location'=> 
$location, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_done'                                     
        => lang('done'),
-                               'lang_done_custom_functiontext' => lang('Return 
to admin'),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/admin/index.php'),
+                               (
+                               'lang_add'                                      
         => lang('add'),
+                               'lang_add_custom_functiontext'   => lang('add a 
custom_function'),
+                               'add_action'                                    
 => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.edit_custom_function',
+                                       'appname' => $appname, 'location' => 
$location, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                               'lang_done'                                     
         => lang('done'),
+                               'lang_done_custom_functiontext'  => 
lang('Return to admin'),
+                               'done_action'                                   
 => $GLOBALS['phpgw']->link('/admin/index.php'),
                        );
 
                        if(!$this->allrows)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $record_limit = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $record_limit = $this->bo->total_records;
                        }
 
                        $link_data = array
-                       (
-                               'menuaction'    => 
'admin.ui_custom.list_custom_function',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'query'                 => $this->query,
-                               'appname'               => $appname,
-                               'location'              => $location,
+                               (
+                               'menuaction'     => 
'admin.ui_custom.list_custom_function',
+                               'sort'                   => $this->sort,
+                               'order'                  => $this->order,
+                               'query'                  => $this->query,
+                               'appname'                => $appname,
+                               'location'               => $location,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
                        $data = array
-                       (
-                               'lang_appname'                                  
                        => lang('application'),
-                               'appname'                                       
                                => $appname,
-                               'allow_allrows'                                 
                        => True,
-                               'allrows'                                       
                                => $this->allrows,
-                               'start_record'                                  
                        => $this->start,
-                               'record_limit'                                  
                        => $record_limit,
-                               'start_record'                                  
                        => $this->start,
-                               'num_records'                                   
                        => count($custom_function_list),
-                               'all_records'                                   
                        => $this->bo->total_records,
-                               'link_url'                                      
                                => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
                                => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_custom_functiontext'          
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_custom_functiontext'         
=> lang('Submit the search string'),
-                               'query'                                         
                                => $this->query,
-                               'lang_search'                                   
                        => lang('search'),
-                               'table_header_custom_function'                  
        => $table_header,
-                               'values_custom_function'                        
                => $content,
-                               'table_add'                                     
                                => $table_add,
-                               'lang_no_location'                              
                        => lang('No location'),
-                               'lang_location_statustext'                      
                => lang('Select submodule'),
-                               'select_name_location'                          
                => 'location',
-                               'location_list'                                 
                        => $this->bolocation->select_location('filter', 
$location, false, false, true),
-
+                               (
+                               'lang_appname'                                  
                 => lang('application'),
+                               'appname'                                       
                         => $appname,
+                               'allow_allrows'                                 
                 => True,
+                               'allrows'                                       
                         => $this->allrows,
+                               'start_record'                                  
                 => $this->start,
+                               'record_limit'                                  
                 => $record_limit,
+                               'start_record'                                  
                 => $this->start,
+                               'num_records'                                   
                 => count($custom_function_list),
+                               'all_records'                                   
                 => $this->bo->total_records,
+                               'link_url'                                      
                         => $GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'img_path'                                      
                         => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi', 'default'),
+                               'lang_searchfield_custom_functiontext'   => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
+                               'lang_searchbutton_custom_functiontext'  => 
lang('Submit the search string'),
+                               'query'                                         
                         => $this->query,
+                               'lang_search'                                   
                 => lang('search'),
+                               'table_header_custom_function'                  
 => $table_header,
+                               'values_custom_function'                        
         => $content,
+                               'table_add'                                     
                         => $table_add,
+                               'lang_no_location'                              
                 => lang('No location'),
+                               'lang_location_statustext'                      
         => lang('Select submodule'),
+                               'select_name_location'                          
         => 'location',
+                               'location_list'                                 
                 => $this->bolocation->select_location('filter', $location, 
false, false, true),
                        );
 
-                       $function_msg   = lang('list custom function');
+                       $function_msg = lang('list custom function');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' .lang('custom function') . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_custom_function' => 
$data));
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' . lang('custom function') . ': ' . $function_msg;
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('list_custom_function' => $data));
                        $this->save_sessiondata();
                }
 
                function edit_custom_function()
                {
-       //              $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::list_functions';
-                       $appname        = $this->appname;
-                       $location       = $this->location;
-                       $id                     = phpgw::get_var('id', 'int');
-                       $values         = phpgw::get_var('values', 'string', 
'POST');
+                       //              
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::list_functions';
+                       $appname         = $this->appname;
+                       $location        = $this->location;
+                       $id                      = phpgw::get_var('id', 'int');
+                       $values          = phpgw::get_var('values', 'string', 
'POST');
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('custom'));
 
-                       if (isset($values['save']) && $values['save'])
+                       if(isset($values['save']) && $values['save'])
                        {
                                if(isset($id) && $id)
                                {
-                                       $values['id']=$id;
-                                       $action='edit';
+                                       $values['id']    = $id;
+                                       $action                  = 'edit';
                                }
                                else
                                {
-                                       $action='add';
+                                       $action = 'add';
                                }
 
-                               $values['appname']=$appname;
-                               $values['location']=$location;
+                               $values['appname']       = $appname;
+                               $values['location']      = $location;
 
-                               if (!$values['appname'])
+                               if(!$values['appname'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('entity type not chosen!'));
+                                       $receipt['error'][] = array('msg' => 
lang('entity type not chosen!'));
                                }
 
-                               if (!$values['custom_function_file'])
+                               if(!$values['custom_function_file'])
                                {
-                                       $receipt['error'][] = 
array('msg'=>lang('custom function file not chosen!'));
+                                       $receipt['error'][] = array('msg' => 
lang('custom function file not chosen!'));
                                }
 
                                if(!$values['location'] || !$values['appname'])
                                {
-                                       $receipt['error'][] = array('msg' => 
lang('location or appname is missing'));
+                                       $receipt['error'][] = array('msg' => 
lang('location or appname is missing'));
                                }
 
-                               if (!isset($receipt['error']) || 
!$receipt['error'])
+                               if(!isset($receipt['error']) || 
!$receipt['error'])
                                {
-                                       $receipt = 
$this->bo->save_custom_function($values,$action);
+                                       $receipt = 
$this->bo->save_custom_function($values, $action);
 
                                        if(!$id)
                                        {
-                                               $id=$receipt['id'];
+                                               $id = $receipt['id'];
                                        }
                                }
                                else
                                {
                                        $receipt['error'][] = array('msg' => 
lang('Custom function has NOT been saved'));
                                }
-
                        }
 
-                       if ($id)
+                       if($id)
                        {
-                               $values = 
$this->bo->read_single_custom_function($appname,$location,$id);
-                               $type_name=$values['custom_function_file'];
-                               $function_msg = lang('edit custom function'). 
': ' . $type_name;
-                               $action='edit';
+                               $values                  = 
$this->bo->read_single_custom_function($appname, $location, $id);
+                               $type_name               = 
$values['custom_function_file'];
+                               $function_msg    = lang('edit custom function') 
. ': ' . $type_name;
+                               $action                  = 'edit';
                        }
                        else
                        {
-                               $function_msg = lang('add custom function');
-                               $action='add';
+                               $function_msg    = lang('add custom function');
+                               $action                  = 'add';
                        }
 
                        $link_data = array
-                       (
-                               'menuaction'    => 
'admin.ui_custom.edit_custom_function',
-                               'appname'               => $appname,
-                               'location'              => $location,
-                               'id'                    => $id,
+                               (
+                               'menuaction'     => 
'admin.ui_custom.edit_custom_function',
+                               'appname'                => $appname,
+                               'location'               => $location,
+                               'id'                     => $id,
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
 
 //_debug_array($values);
 
-                       $msgbox_data = 
(isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'');
+                       $msgbox_data = (isset($receipt) ? 
$GLOBALS['phpgw']->common->msgbox_data($receipt) : '');
 
                        $data = array
-                       (
-                               'lang_appname'                                  
        => lang('appname'),
-                               'appname'                                       
                => $appname,
-                               'lang_location'                                 
        => lang('location'),
-                               'location'                                      
                => $location,
-
-                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'admin.ui_custom.list_custom_function', 'appname'=> $appname, 'location'=> 
$location, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_id'                                       
                => lang('Custom function ID'),
-                               'lang_entity_type'                              
        => lang('Entity type'),
-                               'lang_no_entity_type'                           
=> lang('No entity type'),
-                               'lang_save'                                     
                => lang('save'),
-                               'lang_done'                                     
                => lang('done'),
-                               'value_id'                                      
                => $id,
-
-                               'lang_descr'                                    
        => lang('descr'),
-                               'lang_descr_custom_functiontext'        => 
lang('Enter a descr for the custom function'),
-                               'value_descr'                                   
        => isset($values['descr']) ? $values['descr']:'',
-
-                               'lang_done_custom_functiontext'         => 
lang('Back to the list'),
-                               'lang_save_custom_functiontext'         => 
lang('Save the custom function'),
-
-                               'lang_custom_function'                          
=> lang('custom function'),
-                               'lang_custom_function_statustext'       => 
lang('Select a custom function'),
-                               'lang_no_custom_function'                       
=> lang('No custom function'),
-                               'custom_function_list'                          
=> 
$this->bo->select_custom_function(isset($values['custom_function_file'])?$values['custom_function_file']:'',$appname),
-
-                               'value_active'                                  
        => isset($values['active'])?$values['active']:'',
-                               'value_client_side'                             
        => $values['client_side'],
-                               'value_pre_commit'                              
        => $values['pre_commit'],
-                               'lang_active'                                   
        => lang('Active'),
-                               'lang_active_statustext'                        
=> lang('check to activate custom function'),
+                               (
+                               'lang_appname'   => lang('appname'),
+                               'appname'                => $appname,
+                               'lang_location'  => lang('location'),
+                               'location'               => $location,
+                               'msgbox_data'                    => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'done_action'                    => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_custom_function',
+                                       'appname' => $appname, 'location' => 
$location, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
+                               'lang_id'                                => 
lang('Custom function ID'),
+                               'lang_entity_type'               => 
lang('Entity type'),
+                               'lang_no_entity_type'    => lang('No entity 
type'),
+                               'lang_save'                              => 
lang('save'),
+                               'lang_done'                              => 
lang('done'),
+                               'value_id'                               => $id,
+                               'lang_descr'                                    
 => lang('descr'),
+                               'lang_descr_custom_functiontext' => lang('Enter 
a descr for the custom function'),
+                               'value_descr'                                   
 => isset($values['descr']) ? $values['descr'] : '',
+                               'lang_done_custom_functiontext'  => lang('Back 
to the list'),
+                               'lang_save_custom_functiontext'  => lang('Save 
the custom function'),
+                               'lang_custom_function'                          
 => lang('custom function'),
+                               'lang_custom_function_statustext'        => 
lang('Select a custom function'),
+                               'lang_no_custom_function'                       
 => lang('No custom function'),
+                               'custom_function_list'                          
 => $this->bo->select_custom_function(isset($values['custom_function_file']) ? 
$values['custom_function_file'] : '', $appname),
+                               'value_active'                   => 
isset($values['active']) ? $values['active'] : '',
+                               'value_client_side'              => 
$values['client_side'],
+                               'value_pre_commit'               => 
$values['pre_commit'],
+                               'lang_active'                    => 
lang('Active'),
+                               'lang_active_statustext' => lang('check to 
activate custom function'),
                        );
 
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' . lang('custom function') . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_custom_function' => 
$data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit_custom_function' => $data));
                }
 
                function delete()
                {
-                       $appname                                = 
phpgw::get_var('appname');
-                       $location                               = 
phpgw::get_var('location');
-                       $attrib_id                              = 
phpgw::get_var('attrib_id', 'int');
-                       $custom_function_id             = 
phpgw::get_var('custom_function_id', 'int');
+                       $appname                         = 
phpgw::get_var('appname');
+                       $location                        = 
phpgw::get_var('location');
+                       $attrib_id                       = 
phpgw::get_var('attrib_id', 'int');
+                       $custom_function_id      = 
phpgw::get_var('custom_function_id', 'int');
 
                        $function = 'list_attribute';
-                       if ( $custom_function_id )
+                       if($custom_function_id)
                        {
                                $function = 'list_custom_function';
                        }
 
                        $redirect_args = array
-                       (
-                               'menuaction'    => 
"admin.ui_custom.{$function}",
-                               'location'              => $location,
-                               'appname'               => $appname,
-                               'attrib_id'             => $attrib_id,
+                               (
+                               'menuaction'     => 
"admin.ui_custom.{$function}",
+                               'location'               => $location,
+                               'appname'                => $appname,
+                               'attrib_id'              => $attrib_id,
                                //FIXME this hack won't be merged upstream
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
-                       if ( phpgw::get_var('confirm', 'bool', 'POST') )
+                       if(phpgw::get_var('confirm', 'bool', 'POST'))
                        {
                                $this->bo->delete($location, $appname, 
$attrib_id, $custom_function_id);
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
$redirect_args);
                        }
 
-                       if ( phpgw::get_var('cancel', 'bool', 'POST') )
+                       if(phpgw::get_var('cancel', 'bool', 'POST'))
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
$redirect_args);
                        }
@@ -792,30 +794,508 @@
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_delete'));
 
                        $link_data = array
-                       (
-                               'menuaction'                    => 
'admin.ui_custom.delete',
-                               'location'                              => 
$location,
-                               'appname'                               => 
$appname,
-                               'attrib_id'                             => 
$attrib_id,
-                               'custom_function_id'    => $custom_function_id,
+                               (
+                               'menuaction'             => 
'admin.ui_custom.delete',
+                               'location'                       => $location,
+                               'appname'                        => $appname,
+                               'attrib_id'                      => $attrib_id,
+                               'custom_function_id' => $custom_function_id,
                                //FIXME this hack won't be merged upstream
-                               'menu_selection'                => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                               'menu_selection'         => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
                        $data = array
-                       (
-                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
-                               'lang_confirm_msg'                      => 
lang('do you really want to delete this entry'),
-                               'lang_yes'                                      
=> lang('yes'),
-                               'lang_yes_standardtext'         => lang('Delete 
the entry'),
-                               'lang_no_standardtext'          => lang('Return 
to list'),
-                               'lang_no'                                       
=> lang('no')
+                               (
+                               'form_action'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'lang_confirm_msg'               => lang('do 
you really want to delete this entry'),
+                               'lang_yes'                               => 
lang('yes'),
+                               'lang_yes_standardtext'  => lang('Delete the 
entry'),
+                               'lang_no_standardtext'   => lang('Return to 
list'),
+                               'lang_no'                                => 
lang('no')
                        );
 
-                       $appname        = lang('Custom fields');
-                       $function_msg   = lang('delete entity type');
+                       $appname                 = lang('Custom fields');
+                       $function_msg    = lang('delete entity type');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('admin') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('delete' => $data));
                }
-       }
+
+               function list_attribute_group()
+               {
+
+                       $location = phpgw::get_var('location', 'string');
+
+                       if($location && !$this->acl_read)
+                       {
+                               phpgwapi_cache::message_set("Go away...", 
'error');
+                               return;
+
+//                             $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
+//                                     'perm' => 1, 'acl_location' => 
$this->acl_location));
+                       }
+
+                       $id              = phpgw::get_var('id', 'int');
+                       $resort  = phpgw::get_var('resort');
+
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               if($resort)
+                               {
+                                       $this->bo->resort_attrib_group($id, 
$resort);
+                               }
+
+                               return $this->query(array
+                                       (
+                                       'method'         => 
'list_attribute_group',
+                                       'location'       => $location,
+                               ));
+                       }
+                       $location_list = 
$this->bolocation->select_location('filter', $this->location, false, true);
+                       foreach($location_list as &$entry)
+                       {
+                               $entry['name'] = $entry['descr'];
+                       }
+                       array_unshift($location_list, array('id' => '', 'name' 
=> lang('select')));
+
+                       $appname                                                
                                 = $this->appname;
+                       $function_msg                                           
                         = lang('list entity attribute group');
+                       $GLOBALS['phpgw_info']['flags']['app_header']    = 
$appname . ': ' . $function_msg;
+
+                       $data = array(
+                               'datatable_name' => $appname,
+                               'form'                   => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array('type'     => 
'filter',
+                                                               'name'   => 
'location',
+                                                               'text'   => 
lang('location'),
+                                                               'list'   => 
$location_list,
+                                                       ),
+                                                       array
+                                                               (
+                                                               'type'   => 
'link',
+                                                               'value'  => 
lang('new'),
+                                                               'href'   => 
self::link(array(
+                                                                       
'menuaction' => 'admin.ui_custom.edit_attrib_group',
+                                                                       
'appname'        => $this->appname,
+                                                                       
'menu_selection'         => $this->menu_selection
+//                                                                     
'location'       => $location,
+                                                               )),
+                                                               'class'  => 
'new_item'
+                                                       ),
+                                               )
+                                       )
+                               ),
+                               'datatable'              => array(
+                                       'source'                 => 
self::link(array(
+                                               'menuaction'             => 
'admin.ui_custom.list_attribute_group',
+                                               'appname'                       
 => $this->appname,
+                                               'phpgw_return_as'        => 
'json'
+                                       )),
+                                       'allrows'                => true,
+                                       'editor_action'  => '',
+                                       'field'                  => array(
+                                               array(
+                                                       'key'            => 
'id',
+                                                       'label'          => 
lang('id'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'parent_id',
+                                                       'label'          => 
lang('parent'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'name',
+                                                       'label'          => 
lang('Name'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'text',
+                                                       'label'          => 
lang('Descr'),
+                                                       'sortable'       => 
false
+                                               ),
+                                               array(
+                                                       'key'            => 
'group_sort',
+                                                       'label'          => 
lang('sorting'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'up',
+                                                       'label'          => 
lang('up'),
+                                                       'sortable'       => 
false,
+                                                       'formatter'      => 
'JqueryPortico.formatLinkGenericLlistAttribute'
+                                               ),
+                                               array(
+                                                       'key'            => 
'down',
+                                                       'label'          => 
lang('down'),
+                                                       'sortable'       => 
false,
+                                                       'formatter'      => 
'JqueryPortico.formatLinkGenericLlistAttribute'
+                                               ),
+                                               array(
+                                                       'key'            => 
'id',
+                                                       'label'          => 
lang('id'),
+                                                       'sortable'       => 
false,
+                                                       'hidden'         => true
+                                               )
+                                       )
+                               )
+                       );
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                               (
+                               'parameter' => array
+                                       (
+                                       array
+                                               (
+                                               'name'   => 'id',
+                                               'source' => 'id'
+                                       ),
+                                       array
+                                               (
+                                               'name'   => 'appname',
+                                               'source' => 'appname'
+                                       ),
+                                       array
+                                               (
+                                               'name'   => 'location',
+                                               'source' => 'location'
+                                       )
+                               )
+                       );
+
+                       $parameters2 = array
+                               (
+                               'parameter' => array
+                                       (
+                                       array
+                                               (
+                                               'name'   => 'group_id',
+                                               'source' => 'id'
+                                       ),
+                                       array
+                                               (
+                                               'name'   => 'appname',
+                                               'source' => 'appname'
+                                       ),
+                                       array
+                                               (
+                                               'name'   => 'location',
+                                               'source' => 'location'
+                                       )
+                               )
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name'        => 'edit',
+                               'statustext' => lang('Edit'),
+                               'text'           => lang('Edit'),
+                               'action'         => $GLOBALS['phpgw']->link
+                               (
+                               '/index.php', array
+                                       (
+                                       'menuaction'     => 
'admin.ui_custom.edit_attrib_group',
+                                       'menu_selection'         => 
$this->menu_selection
+                               )
+                               ),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name'                => 'delete',
+                               'statustext'     => lang('Delete'),
+                               'text'                   => lang('Delete'),
+                               'confirm_msg'    => lang('do you really want to 
delete this entry'),
+                               'action'                 => 
$GLOBALS['phpgw']->link
+                               (
+                               '/index.php', array
+                                       (
+                                       'menuaction'     => 
'admin.ui_custom.delete_group',
+                                       'menu_selection'         => 
$this->menu_selection
+                               )
+                               ),
+                               'parameters'     => json_encode($parameters2)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name'        => 'list_attribute',
+                               'statustext' => lang('list attribute'),
+                               'text'           => lang('list attribute'),
+                               'action'         => $GLOBALS['phpgw']->link
+                               (
+                               '/index.php', array
+                                       (
+                                       'menuaction'     => 
'admin.ui_custom.list_attribute',
+                                       'menu_selection' => 
str_replace('custom_field_groups', 'custom_fields', $this->menu_selection)
+                               )
+                               ),
+                               'parameters' => json_encode($parameters2)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name'        => 'new_attribute',
+                               'statustext' => lang('new attribute'),
+                               'text'           => lang('new attribute'),
+                               'action'         => $GLOBALS['phpgw']->link
+                               (
+                               '/index.php', array
+                                       (
+                                       'menuaction'     => 
'admin.ui_custom.edit_attrib',
+                                       'menu_selection' => 
str_replace('custom_field_groups', 'custom_fields', $this->menu_selection)
+                               )
+                               ),
+                               'parameters' => json_encode($parameters2)
+                       );
+
+                       unset($parameters);
+                       unset($parameters2);
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+
+               function edit_attrib_group()
+               {
+                       if(!$this->acl_add)
+                       {
+                               phpgwapi_cache::message_set("Go away...", 
'error');
+                               return;
+
+//                             $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
+//                                     'perm' => 2, 'acl_location' => 
$this->acl_location));
+                       }
+                       $location = phpgw::get_var('location', 'string');
+
+                       $id              = phpgw::get_var('id', 'int');
+                       $values  = phpgw::get_var('values');
+
+                       $tabs                    = array();
+                       $tabs['general'] = array('label' => lang('general'), 
'link' => '#general');
+                       $active_tab              = 'general';
+
+                       if(!$values)
+                       {
+                               $values = array();
+                       }
+
+//                     
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('custom'));
+
+
+                       if(isset($values['save']) && $values['save'])
+                       {
+                               $action                  = 'add';
+
+                               if($id)
+                               {
+                                       $values['id']    = $id;
+                                       $action                  = 'edit';
+                               }
+
+                               $values['location'] = $location;
+                               $values['appname'] = $this->appname;
+
+                               if(!$values['group_name'])
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('group name not entered!'));
+                               }
+
+                               if(!$values['descr'])
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('description not entered!'));
+                               }
+
+                               if(!$location)
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('Missing location'));
+                               }
+
+
+                               if(!isset($receipt['error']))
+                               {
+                                       $receipt = 
$this->bo->save_attrib_group($values, $action);
+
+                                       if(!$id)
+                                       {
+                                               $id = $receipt['id'];
+                                       }
+                               }
+                               else
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('Attribute group has NOT been saved'));
+                               }
+                       }
+
+                       if($id)
+                       {
+                               $values                  = 
$this->bo->read_single_attrib_group($this->appname, $location, $id);
+                               $type_name               = $values['type_name'];
+                               $function_msg    = lang('edit attribute group') 
. ' ' . lang($type_name);
+                               $action                  = 'edit';
+                       }
+                       else
+                       {
+                               $function_msg    = lang('add attribute group');
+                               $action                  = 'add';
+                       }
+
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->appname, $location);
+
+                       $parent_list = 
$GLOBALS['phpgw']->custom_fields->find_group($this->appname, $location, 0, '', 
'', '', true);
+
+                       $bocommon = CreateObject('property.bocommon');
+
+                       $parent_list = 
$bocommon->select_list($values['parent_id'], $parent_list);
+//_debug_array($parent_list);die();
+
+                       if($id)
+                       {
+                               $exclude         = array($id);
+                               $children        = 
$GLOBALS['phpgw']->custom_fields->get_attribute_group_children($location_id, 
$id, 0, 0, true);
+
+                               foreach($children as $child)
+                               {
+                                       $exclude[] = $child['id'];
+                               }
+
+                               $k = count($parent_list);
+                               for($i = 0; $i < $k; $i++)
+                               {
+                                       if(in_array($parent_list[$i]['id'], 
$exclude))
+                                       {
+                                               unset($parent_list[$i]);
+                                       }
+                               }
+                       }
+
+                       $link_data = array
+                               (
+                               'menuaction'             => 
'admin.ui_custom.edit_attrib_group',
+                               'appname'                        => 
$this->appname,
+                               'id'                             => $id,
+                               'menu_selection'         => 
$this->menu_selection
+                       );
+
+
+                       //              $entity          = 
$this->bo->read_single($entity_id, false);
+                       //              $category        = 
$this->bo->read_single_category($entity_id, $cat_id);
+
+                       $msgbox_data = (isset($receipt) ? 
$bocommon->msgbox_data($receipt) : '');
+
+                       $data = array
+                       (
+                               'appname'                                       
 => $this->appname,
+                               'value_location'                         => 
$location,
+                               'msgbox_data'                            => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                            => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
+                               'done_action'                            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute_group',
+                                                                               
                'appname'        => $this->appname,
+                                                                               
                'location'       => $location,
+                                                                               
                'menu_selection'         => $this->menu_selection)),
+                               'value_id'                                      
 => $id,
+                               'value_group_name'                       => 
$values['group_name'],
+                               'value_descr'                            => 
$values['descr'],
+                               'value_remark'                           => 
$values['remark'],
+                               'parent_list'                            => 
$parent_list,
+                               'select_name_location'           => 'location',
+                               'select_location_required'       => true,
+                               'location_list' => 
$this->bolocation->select_location('select', $location, false, true),
+                               'tabs'                                          
 => phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'validator'                                     
 => phpgwapi_jquery::formvalidator_generate(array('location',
+                                       'date', 'security', 'file'))
+                       );
+                       //_debug_array($values);
+
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->appname) . ' - ' . $location . ': ' . $function_msg;
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit_attrib_group' => $data));
+               }
+
+               public function query($data = array())
+               {
+
+                       $search  = phpgw::get_var('search');
+                       $order   = phpgw::get_var('order');
+                       $draw    = phpgw::get_var('draw', 'int');
+                       $columns = phpgw::get_var('columns');
+
+
+                       $params = array(
+                               'start'          => $this->start,
+                               'results'        => phpgw::get_var('length', 
'int', 'REQUEST', 0),
+                               'query'          => $search['value'],
+                               'sort'           => $order[0]['dir'],
+                               'order'          => 
$columns[$order[0]['column']]['data'],
+                               'allrows'        => phpgw::get_var('length', 
'int') == -1,
+                               'location'       => $data['location'],
+                               'appname'        => $this->appname
+                       );
+
+                       $result_objects  = array();
+                       $result_count    = 0;
+
+                       $values = array();
+                       switch($data['method'])
+                       {
+                               case 'category':
+                                       $values  = 
$this->bo->read_category($params);
+                                       break;
+                               case 'list_attribute':
+                                       $values  = 
$this->bo->read_attrib($params);
+                                       break;
+                               case 'list_attribute_group':
+                                       $values  = 
$this->bo->read_attrib_group($params);
+                                       break;
+                               default:
+                                       $values  = $this->bo->read($params);
+                                       break;
+                       }
+
+                       $new_values = array();
+                       foreach($values as &$value)
+                       {
+                               $value['appname'] = $this->appname;
+                               $value['location'] = $this->location;
+                       }
+
+                       if(phpgw::get_var('export', 'bool'))
+                       {
+                               return $values;
+                       }
+
+                       $result_data                                     = 
array('results' => $values);
+                       $result_data['total_records']    = 
$this->bo->total_records;
+                       $result_data['draw']                     = $draw;
+                       switch($data['method'])
+                       {
+                               case 'list_attribute':
+                                       $variable        = array(
+                                               'menuaction' => 
'admin.ui_custom.list_attribute',
+                                               'appname'                => 
$this->appname,
+                                               'location'               => 
$this->location,
+                                               'allrows'                => 
$this->allrows,
+                                               'menu_selection'=> 
$this->menu_selection
+
+                                       );
+                                       array_walk($result_data['results'], 
array($this, '_add_links'), $variable);
+                                       break;
+                               case 'list_attribute_group':
+                                       $variable        = array(
+                                               'menuaction' => 
'admin.ui_custom.list_attribute_group',
+                                               'appname'                => 
$this->appname,
+                                               'location'               => 
$this->location,
+                                               'allrows'                => 
$this->allrows,
+                                               'menu_selection'         => 
$this->menu_selection
+                                       );
+                                       array_walk($result_data['results'], 
array($this, '_add_links'), $variable);
+                                       break;
+                       }
+                       return $this->jquery_results($result_data);
+               }
+       }
\ No newline at end of file

Modified: branches/dev-syncromind/admin/templates/base/custom.xsl
===================================================================
--- branches/dev-syncromind/admin/templates/base/custom.xsl     2015-08-31 
09:46:22 UTC (rev 13813)
+++ branches/dev-syncromind/admin/templates/base/custom.xsl     2015-08-31 
12:18:04 UTC (rev 13814)
@@ -1,360 +1,414 @@
 <!-- $Id$ -->
 
-       <xsl:template name="custom">
-               <xsl:choose>
-                       <xsl:when test="list_attribute">
-                               <xsl:apply-templates select="list_attribute"/>
-                       </xsl:when>
-                       <xsl:when test="edit_attrib">
-                               <xsl:apply-templates select="edit_attrib"/>
-                       </xsl:when>
-                       <xsl:when test="list_custom_function">
-                               <xsl:apply-templates 
select="list_custom_function"/>
-                       </xsl:when>
-                       <xsl:when test="edit_custom_function">
-                               <xsl:apply-templates 
select="edit_custom_function"/>
-                       </xsl:when>
-               </xsl:choose>
-       </xsl:template>
+<xsl:template name="custom">
+       <xsl:choose>
+               <xsl:when test="list_attribute">
+                       <xsl:apply-templates select="list_attribute"/>
+               </xsl:when>
+               <xsl:when test="edit_attrib">
+                       <xsl:apply-templates select="edit_attrib"/>
+               </xsl:when>
+               <xsl:when test="list_custom_function">
+                       <xsl:apply-templates select="list_custom_function"/>
+               </xsl:when>
+               <xsl:when test="edit_custom_function">
+                       <xsl:apply-templates select="edit_custom_function"/>
+               </xsl:when>
+       </xsl:choose>
+</xsl:template>
        
-       <xsl:template match="table_add">
-                       <tr>
-                               <td height="50">
-                                       <xsl:variable 
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
-                                       <form method="post" 
action="{$add_action}">
-                                               <input type="submit" name="add" 
value="{$lang_add}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_add_standardtext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                               <td height="50">
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
-                                       <form method="post" 
action="{$done_action}">
-                                               <input type="submit" name="add" 
value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_add_standardtext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                       </tr>
-       </xsl:template>
+<xsl:template match="table_add">
+       <tr>
+               <td height="50">
+                       <xsl:variable name="add_action">
+                               <xsl:value-of select="add_action"/>
+                       </xsl:variable>
+                       <xsl:variable name="lang_add">
+                               <xsl:value-of select="lang_add"/>
+                       </xsl:variable>
+                       <form method="post" action="{$add_action}">
+                               <input type="submit" name="add" 
value="{$lang_add}" onMouseout="window.status='';return true;">
+                                       <xsl:attribute name="onMouseover">
+                                               
<xsl:text>window.status='</xsl:text>
+                                               <xsl:value-of 
select="lang_add_standardtext"/>
+                                               <xsl:text>'; return 
true;</xsl:text>
+                                       </xsl:attribute>
+                               </input>
+                       </form>
+               </td>
+               <td height="50">
+                       <xsl:variable name="done_action">
+                               <xsl:value-of select="done_action"/>
+                       </xsl:variable>
+                       <xsl:variable name="lang_done">
+                               <xsl:value-of select="lang_done"/>
+                       </xsl:variable>
+                       <form method="post" action="{$done_action}">
+                               <input type="submit" name="add" 
value="{$lang_done}" onMouseout="window.status='';return true;">
+                                       <xsl:attribute name="onMouseover">
+                                               
<xsl:text>window.status='</xsl:text>
+                                               <xsl:value-of 
select="lang_add_standardtext"/>
+                                               <xsl:text>'; return 
true;</xsl:text>
+                                       </xsl:attribute>
+                               </input>
+                       </form>
+               </td>
+       </tr>
+</xsl:template>
 
 
 <!-- list attribute -->
 
-       <xsl:template match="list_attribute">
+<xsl:template match="list_attribute">
                
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <tr>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="lang_appname"/>
-                                       <xsl:text>: </xsl:text>
-                                       <xsl:value-of select="appname"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td align="left">
-                                       <xsl:call-template 
name="filter_location"/>
-                               </td>
+       <table width="100%" cellpadding="2" cellspacing="2" align="center">
+               <tr>
+                       <td class="th_text" align="left">
+                               <xsl:value-of select="lang_appname"/>
+                               <xsl:text>: </xsl:text>
+                               <xsl:value-of select="appname"/>
+                       </td>
+               </tr>
+               <tr>
+                       <td align="left">
+                               <xsl:call-template name="filter_location"/>
+                       </td>
 
-                               <td align="right">
-                                       <xsl:call-template name="search_field"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan="3" width="100%">
-                                       <xsl:call-template name="nextmatchs"/>
-                               </td>
-                       </tr>
-               </table>
-               <table class="pure-table pure-table-bordered">
-                               <xsl:apply-templates 
select="table_header_attrib"/>
-                               <xsl:choose>
-                                       <xsl:when test="values_attrib != ''">
-                                       <xsl:apply-templates 
select="values_attrib"/>
-                                       </xsl:when>
-                               </xsl:choose>
-                               <xsl:apply-templates select="table_add"/>
-               </table>
-       </xsl:template>
-
-       <xsl:template match="table_header_attrib">
-               <xsl:variable name="sort_sorting"><xsl:value-of 
select="sort_sorting"/></xsl:variable>
-               <xsl:variable name="sort_name"><xsl:value-of 
select="sort_name"/></xsl:variable>
-               <tr class="th">
-                       <th class="th_text" width="10%" align="left">
-                               <a href="{$sort_name}"><xsl:value-of 
select="lang_name"/></a>
-                       </th>
-                       <th class="th_text" width="20%" align="left">
-                               <xsl:value-of select="lang_descr"/>
-                       </th>
-                       <th class="th_text" width="1%" align="left">
-                               <xsl:value-of select="lang_datatype"/>
-                       </th>
-                       <th class="th_text" width="5%" align="center">
-                               <a href="{$sort_sorting}"><xsl:value-of 
select="lang_sorting"/></a>
-                       </th>
-                       <th class="th_text" width="1%" align="center">
-                               <xsl:value-of select="lang_search"/>
-                       </th>
-                       <th class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_edit"/>
-                       </th>
-                       <th class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_delete"/>
-                       </th>
+                       <td align="right">
+                               <xsl:call-template name="search_field"/>
+                       </td>
                </tr>
-       </xsl:template>
+               <tr>
+                       <td colspan="3" width="100%">
+                               <xsl:call-template name="nextmatchs"/>
+                       </td>
+               </tr>
+       </table>
+       <table class="pure-table pure-table-bordered">
+               <xsl:apply-templates select="table_header_attrib"/>
+               <xsl:choose>
+                       <xsl:when test="values_attrib != ''">
+                               <xsl:apply-templates select="values_attrib"/>
+                       </xsl:when>
+               </xsl:choose>
+               <xsl:apply-templates select="table_add"/>
+       </table>
+</xsl:template>
 
-       <xsl:template match="values_attrib"> 
-               <xsl:variable name="lang_up_text"><xsl:value-of 
select="lang_up_text"/></xsl:variable>
-               <xsl:variable name="lang_down_text"><xsl:value-of 
select="lang_down_text"/></xsl:variable>
-               <xsl:variable name="lang_edit_text"><xsl:value-of 
select="lang_edit_text"/></xsl:variable>
-               <xsl:variable name="lang_delete_text"><xsl:value-of 
select="lang_delete_text"/></xsl:variable>
-                       <tr>
-                               <xsl:attribute name="class">
-                                       <xsl:choose>
-                                               <xsl:when test="@class">
-                                                       <xsl:value-of 
select="@class"/>
-                                               </xsl:when>
-                                               <xsl:when test="position() mod 
2 = 0">
-                                                       
<xsl:text>row_off</xsl:text>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       
<xsl:text>row_on</xsl:text>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
-                               <td align="left">
-                                       <xsl:value-of select="column_name"/>
-                               </td>
-                               <td>
-                                       <xsl:value-of select="input_text"/>
-                               </td>
-                               <td>
-                                       <xsl:value-of select="datatype"/>
-                               </td>
-                               <td>
-                                       <table align="left">
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="sorting"/>
-                                                       </td>
+<xsl:template match="table_header_attrib">
+       <xsl:variable name="sort_sorting">
+               <xsl:value-of select="sort_sorting"/>
+       </xsl:variable>
+       <xsl:variable name="sort_name">
+               <xsl:value-of select="sort_name"/>
+       </xsl:variable>
+       <tr class="th">
+               <th class="th_text" width="10%" align="left">
+                       <a href="{$sort_name}">
+                               <xsl:value-of select="lang_name"/>
+                       </a>
+               </th>
+               <th class="th_text" width="20%" align="left">
+                       <xsl:value-of select="lang_descr"/>
+               </th>
+               <th class="th_text" width="1%" align="left">
+                       <xsl:value-of select="lang_datatype"/>
+               </th>
+               <th class="th_text" width="1%" align="center">
+                       <xsl:value-of select="lang_group"/>
+               </th>
+               <th class="th_text" width="5%" align="center">
+                       <a href="{$sort_sorting}">
+                               <xsl:value-of select="lang_sorting"/>
+                       </a>
+               </th>
+               <th class="th_text" width="1%" align="center">
+                       <xsl:value-of select="lang_search"/>
+               </th>
+               <th class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_edit"/>
+               </th>
+               <th class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_delete"/>
+               </th>
+       </tr>
+</xsl:template>
 
-                                                       <td align="left">
-                                                               <xsl:variable 
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
-                                                               <a 
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
-                                                               <xsl:text> | 
</xsl:text>
-                                                               <xsl:variable 
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
-                                                               <a 
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return 
true;" onMouseout="window.status='';return true;"><xsl:value-of 
select="text_down"/></a>
-                                                       </td>
+<xsl:template match="values_attrib"> 
+       <xsl:variable name="lang_up_text">
+               <xsl:value-of select="lang_up_text"/>
+       </xsl:variable>
+       <xsl:variable name="lang_down_text">
+               <xsl:value-of select="lang_down_text"/>
+       </xsl:variable>
+       <xsl:variable name="lang_edit_text">
+               <xsl:value-of select="lang_edit_text"/>
+       </xsl:variable>
+       <xsl:variable name="lang_delete_text">
+               <xsl:value-of select="lang_delete_text"/>
+       </xsl:variable>
+       <tr>
+               <xsl:attribute name="class">
+                       <xsl:choose>
+                               <xsl:when test="@class">
+                                       <xsl:value-of select="@class"/>
+                               </xsl:when>
+                               <xsl:when test="position() mod 2 = 0">
+                                       <xsl:text>row_off</xsl:text>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:text>row_on</xsl:text>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:attribute>
+               <td align="left">
+                       <xsl:value-of select="column_name"/>
+               </td>
+               <td>
+                       <xsl:value-of select="input_text"/>
+               </td>
+               <td>
+                       <xsl:value-of select="datatype"/>
+               </td>
+               <td align="right">
+                       <xsl:value-of select="group_id"/>
+               </td>
+               <td>
+                       <table align="left">
+                               <tr>
+                                       <td>
+                                               <xsl:value-of select="sorting"/>
+                                       </td>
 
-                                               </tr>
-                                       </table>
-                               </td>
-                               <td align="center">
-                                       <xsl:value-of select="search"/>
-                               </td>
-                               <td align="center">
-                                       <xsl:variable 
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
-                                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_edit"/></a>
-                               </td>
-                               <td align="center">
-                                       <xsl:variable 
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
-                                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_delete"/></a>
-                               </td>
-                       </tr>
-       </xsl:template>
+                                       <td align="left">
+                                               <xsl:variable name="link_up">
+                                                       <xsl:value-of 
select="link_up"/>
+                                               </xsl:variable>
+                                               <a href="{$link_up}" 
onMouseover="window.status='{$lang_up_text}';return true;" 
onMouseout="window.status='';return true;">
+                                                       <xsl:value-of 
select="text_up"/>
+                                               </a>
+                                               <xsl:text> | </xsl:text>
+                                               <xsl:variable name="link_down">
+                                                       <xsl:value-of 
select="link_down"/>
+                                               </xsl:variable>
+                                               <a href="{$link_down}" 
onMouseover="window.status='{$lang_down_text}';return true;" 
onMouseout="window.status='';return true;">
+                                                       <xsl:value-of 
select="text_down"/>
+                                               </a>
+                                       </td>
 
+                               </tr>
+                       </table>
+               </td>
+               <td align="center">
+                       <xsl:value-of select="search"/>
+               </td>
+               <td align="center">
+                       <xsl:variable name="link_edit">
+                               <xsl:value-of select="link_edit"/>
+                       </xsl:variable>
+                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_text}';return true;" 
onMouseout="window.status='';return true;">
+                               <xsl:value-of select="text_edit"/>
+                       </a>
+               </td>
+               <td align="center">
+                       <xsl:variable name="link_delete">
+                               <xsl:value-of select="link_delete"/>
+                       </xsl:variable>
+                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_text}';return true;" 
onMouseout="window.status='';return true;">
+                               <xsl:value-of select="text_delete"/>
+                       </a>
+               </td>
+       </tr>
+</xsl:template>
 
+
 <!-- add attribute / edit attribute -->
 
-       <xsl:template match="edit_attrib" xmlns:php="http://php.net/xsl";>
-               <div align="left">
+<xsl:template match="edit_attrib" xmlns:php="http://php.net/xsl";>
+       <div align="left">
 
-                       <xsl:variable name="form_action">
-                               <xsl:value-of select="form_action"/>
-                       </xsl:variable>
-                       <form method="post" action="{$form_action}">
+               <xsl:variable name="form_action">
+                       <xsl:value-of select="form_action"/>
+               </xsl:variable>
+               <form method="post" action="{$form_action}">
                
-               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
-                       <xsl:choose>
-                               <xsl:when test="msgbox_data != ''">
-                                       <tr>
-                                               <td align="left" colspan="3">
-                                                       <xsl:call-template 
name="msgbox"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
+                       <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                               <xsl:choose>
+                                       <xsl:when test="msgbox_data != ''">
+                                               <tr>
+                                                       <td align="left" 
colspan="3">
+                                                               
<xsl:call-template name="msgbox"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
                        
 
-                       <tr>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of 
select="php:function('lang', 'appname')" />
-                               </td>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="appname"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="lang_location"/>
-                                       <xsl:value-of 
select="php:function('lang', 'location')" />
-                               </td>
-                               <td align="left">
-                                       <xsl:choose>
-                                               <xsl:when test="value_location 
!= ''">
-                                                       <xsl:value-of 
select="value_location"/>
-                                                       <input type="hidden" 
name="location" value="{value_location}" />
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:call-template 
name="select_location"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </td>
-                       </tr>
-                       <xsl:choose>
-                               <xsl:when test="value_id != ''">
-                                       <tr>
-                                               <td valign="top">
-                                       <xsl:value-of 
select="php:function('lang', 'Attribute ID')" />
-                                               </td>
-                                               <td>
-                                                       <xsl:value-of 
select="value_id"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="php:function('lang', 'column name')" />
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[column_name]" value="{value_column_name}" maxlength="20">
-                                               <xsl:attribute name="title">
-                                                   <xsl:value-of 
select="php:function('lang', 'enter the name for the column')" />
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="php:function('lang', 'input text')" />
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[input_text]" value="{value_input_text}" maxlength="20">
-                                               <xsl:attribute name="title">
-                                                   <xsl:value-of 
select="php:function('lang', 'enter the input text for records')" />
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="php:function('lang', 'statustext')" />
-                               </td>
-                               <td>
-                                       <textarea cols="60" rows="10" 
name="values[statustext]" wrap="virtual">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'Enter a statustext for the inputfield in forms')" 
/>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_statustext"/>               
-                                       </textarea>
+                               <tr>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of 
select="php:function('lang', 'appname')" />
+                                       </td>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of select="appname"/>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of 
select="lang_location"/>
+                                               <xsl:value-of 
select="php:function('lang', 'location')" />
+                                       </td>
+                                       <td align="left">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="value_location != ''">
+                                                               <xsl:value-of 
select="value_location"/>
+                                                               <input 
type="hidden" name="location" value="{value_location}" />
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               
<xsl:call-template name="select_location"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </td>
+                               </tr>
+                               <xsl:choose>
+                                       <xsl:when test="value_id != ''">
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="php:function('lang', 'Attribute ID')" />
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
select="value_id"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'column name')" />
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="values[column_name]" value="{value_column_name}" maxlength="20">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'enter the name for the column')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'input text')" />
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="values[input_text]" value="{value_input_text}" maxlength="20">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'enter the input text for records')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'statustext')" />
+                                       </td>
+                                       <td>
+                                               <textarea cols="60" rows="10" 
name="values[statustext]" wrap="virtual">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'Enter a statustext for the inputfield in forms')" 
/>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_statustext"/>
+                                               </textarea>
 
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="php:function('lang', 'group')" />
-                               </td>
-                               <td valign="top">
-                                       <select name="values[group_id]" 
class="forms">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'select a group')" />
-                                               </xsl:attribute>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'group')" />
+                                       </td>
+                                       <td valign="top">
+                                               <select name="values[group_id]" 
class="forms">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'select a group')" />
+                                                       </xsl:attribute>
                                                        <option value="">
-                                                       <xsl:value-of 
select="php:function('lang', 'no group')" />
-                                               </option>
-                                               <xsl:apply-templates 
select="attrib_group_list/options"/>
-                                       </select>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="php:function('lang', 'datatype')" />
-                               </td>
-                               <td valign="top">
-                                       <xsl:variable 
name="lang_datatype_statustext"><xsl:value-of 
select="lang_datatype_statustext"/></xsl:variable>
-                                       <select 
name="values[column_info][type]" class="forms">
-                                               <option value=""><xsl:value-of 
select="lang_no_datatype"/></option>
-                                               <xsl:apply-templates 
select="datatype_list"/>
-                                       </select>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_precision"/>
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[column_info][precision]" value="{value_precision}">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="lang_precision_statustext"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_scale"/>
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[column_info][scale]" value="{value_scale}">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="lang_scale_statustext"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_default"/>
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[column_info][default]" value="{value_default}">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="lang_default_statustext"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_nullable"/>
-                               </td>
-                               <td valign="top">
-                                       <xsl:variable 
name="lang_nullable_statustext"><xsl:value-of 
select="lang_nullable_statustext"/></xsl:variable>
-                                       <select 
name="values[column_info][nullable]" class="forms">
-                                               <option value=""><xsl:value-of 
select="lang_select_nullable"/></option>
-                                               <xsl:apply-templates 
select="nullable_list"/>
-                                       </select>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of select="lang_list"/>
-                               </td>
-                               <td>
-                                       <xsl:choose>
+                                                               <xsl:value-of 
select="php:function('lang', 'no group')" />
+                                                       </option>
+                                                       <xsl:apply-templates 
select="attrib_group_list/options"/>
+                                               </select>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'datatype')" />
+                                       </td>
+                                       <td valign="top">
+                                               <xsl:variable 
name="lang_datatype_statustext">
+                                                       <xsl:value-of 
select="lang_datatype_statustext"/>
+                                               </xsl:variable>
+                                               <select 
name="values[column_info][type]" class="forms">
+                                                       <option value="">
+                                                               <xsl:value-of 
select="lang_no_datatype"/>
+                                                       </option>
+                                                       <xsl:apply-templates 
select="datatype_list"/>
+                                               </select>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_precision"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="values[column_info][precision]" value="{value_precision}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_precision_statustext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_scale"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="values[column_info][scale]" value="{value_scale}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_scale_statustext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_default"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
name="values[column_info][default]" value="{value_default}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_default_statustext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_nullable"/>
+                                       </td>
+                                       <td valign="top">
+                                               <xsl:variable 
name="lang_nullable_statustext">
+                                                       <xsl:value-of 
select="lang_nullable_statustext"/>
+                                               </xsl:variable>
+                                               <select 
name="values[column_info][nullable]" class="forms">
+                                                       <option value="">
+                                                               <xsl:value-of 
select="lang_select_nullable"/>
+                                                       </option>
+                                                       <xsl:apply-templates 
select="nullable_list"/>
+                                               </select>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="lang_list"/>
+                                       </td>
+                                       <td>
+                                               <xsl:choose>
                                                        <xsl:when 
test="value_list = 1">
                                                                <input 
type="checkbox" name="values[list]" value="1" checked="checked" 
onMouseout="window.status='';return true;">
                                                                        
<xsl:attribute name="title">
@@ -369,15 +423,15 @@
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </xsl:otherwise>
-                                       </xsl:choose>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of 
select="lang_include_search"/>
-                               </td>
-                               <td>
-                                       <xsl:choose>
+                                               </xsl:choose>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="lang_include_search"/>
+                                       </td>
+                                       <td>
+                                               <xsl:choose>
                                                        <xsl:when 
test="value_search = 1">
                                                                <input 
type="checkbox" name="values[search]" value="1" checked="checked">
                                                                        
<xsl:attribute name="title">
@@ -392,15 +446,15 @@
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </xsl:otherwise>
-                                       </xsl:choose>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of select="lang_history"/>
-                               </td>
-                               <td>
-                                       <xsl:choose>
+                                               </xsl:choose>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="lang_history"/>
+                                       </td>
+                                       <td>
+                                               <xsl:choose>
                                                        <xsl:when 
test="value_history = 1">
                                                                <input 
type="checkbox" name="values[history]" value="1" checked="checked">
                                                                        
<xsl:attribute name="title">
@@ -415,15 +469,15 @@
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </xsl:otherwise>
-                                       </xsl:choose>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of select="lang_disabled"/>
-                               </td>
-                               <td>
-                                       <xsl:choose>
+                                               </xsl:choose>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="lang_disabled"/>
+                                       </td>
+                                       <td>
+                                               <xsl:choose>
                                                        <xsl:when 
test="value_disabled = 1">
                                                                <input 
type="checkbox" name="values[disabled]" value="1" checked="checked">
                                                                        
<xsl:attribute name="title">
@@ -438,53 +492,59 @@
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </xsl:otherwise>
-                                       </xsl:choose>
-                               </td>
-                       </tr>
+                                               </xsl:choose>
+                                       </td>
+                               </tr>
        
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_helpmsg"/>
-                               </td>
-                               <td>
-                                       <textarea cols="60" rows="10" 
name="values[helpmsg]" wrap="virtual">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="lang_helpmsg_statustext"/>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_helpmsg"/>          
-                                       </textarea>
-                               </td>
-                       </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_helpmsg"/>
+                                       </td>
+                                       <td>
+                                               <textarea cols="60" rows="10" 
name="values[helpmsg]" wrap="virtual">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_helpmsg_statustext"/>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_helpmsg"/>
+                                               </textarea>
+                                       </td>
+                               </tr>
        
-                       <xsl:choose>
-                               <xsl:when test="multiple_choice != ''">
-                                       <tr>
-                                               <td valign="top">
-                                                       <xsl:value-of 
select="lang_choice"/>
-                                               </td>
-                                               <td align="right">
-                                                       <xsl:call-template 
name="choice"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <tr height="50">
-                               <td>
-                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                       <input type="submit" 
name="values[save]" value="{$lang_save}">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="lang_save_attribtext"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-               </table>
-                       </form>
-                       <table>
+                               <xsl:choose>
+                                       <xsl:when test="multiple_choice != ''">
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_choice"/>
+                                                       </td>
+                                                       <td align="right">
+                                                               
<xsl:call-template name="choice"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
+                               <tr height="50">
+                                       <td>
+                                               <xsl:variable name="lang_save">
+                                                       <xsl:value-of 
select="lang_save"/>
+                                               </xsl:variable>
+                                               <input type="submit" 
name="values[save]" value="{$lang_save}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_save_attribtext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                       </table>
+               </form>
+               <table>
                        <tr>
                                <td>
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+                                       <xsl:variable name="done_action">
+                                               <xsl:value-of 
select="done_action"/>
+                                       </xsl:variable>
+                                       <xsl:variable name="lang_done">
+                                               <xsl:value-of 
select="lang_done"/>
+                                       </xsl:variable>
                                        <form method="post" 
action="{$done_action}">
                                                <input type="submit" 
name="done" value="{$lang_done}">
                                                        <xsl:attribute 
name="title">
@@ -495,226 +555,392 @@
                                </td>
                        </tr>
                </table>
+       </div>
+</xsl:template>
+
+<!-- add attribute group / edit attribute group -->
+<xsl:template match="edit_attrib_group" xmlns:php="http://php.net/xsl";>
+       <dl>
+               <xsl:choose>
+                       <xsl:when test="msgbox_data != ''">
+                               <dt>
+                                       <xsl:call-template name="msgbox"/>
+                               </dt>
+                       </xsl:when>
+               </xsl:choose>
+       </dl>
+       <xsl:variable name="form_action">
+               <xsl:value-of select="form_action"/>
+       </xsl:variable>
+       <form method="post" class="pure-form pure-form-aligned" id="form" 
name="form" action="{$form_action}">
+               <div id="tab-content">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                       <div id="general">
+
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'appname')"/>
+                                       </label>
+                                       <xsl:value-of select="appname"/>
+                               </div>
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'location')"/>
+                                       </label>
+                                       <xsl:choose>
+                                               <xsl:when test="value_location 
!= ''">
+                                                       <xsl:value-of 
select="value_location"/>
+                                                       <input type="hidden" 
name="location" value="{value_location}" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:call-template 
name="select_location"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </div>
+                               <xsl:choose>
+                                       <xsl:when test="value_id != ''">
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'Attribute group ID')"/>
+                                                       </label>
+                                                       <xsl:value-of 
select="value_id"/>
+                                               </div>
+                                       </xsl:when>
+                               </xsl:choose>
+                               <xsl:choose>
+                                       <xsl:when test="parent_list != ''">
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'parent')"/>
+                                                       </label>
+                                                       <select id="parent_id" 
name="values[parent_id]">
+                                                               <option 
value="">
+                                                                       
<xsl:value-of select="php:function('lang', 'select parent')"/>
+                                                               </option>
+                                                               
<xsl:apply-templates select="parent_list"/>
+                                                       </select>
+                                               </div>
+                                       </xsl:when>
+                               </xsl:choose>
+
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'group name')"/>
+                                       </label>
+                                       <input type="text" 
data-validation="required" name="values[group_name]" value="{value_group_name}" 
maxlength="100">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'enter the name for the group')"/>
+                                               </xsl:attribute>
+                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                       <xsl:value-of 
select="php:function('lang', 'group name')"/>
+                                               </xsl:attribute>
+
+                                       </input>
+                               </div>
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'descr')"/>
+                                       </label>
+                                       <input type="text" 
data-validation="required" name="values[descr]" value="{value_descr}" size="60" 
maxlength="150">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'enter the input text for records')"/>
+                                               </xsl:attribute>
+                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                       <xsl:value-of 
select="php:function('lang', 'descr')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </div>
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'remark')"/>
+                                       </label>
+                                       <textarea cols="60" rows="10" 
name="values[remark]">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Enter a remark for the group')"/>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_remark"/>
+                                       </textarea>
+                               </div>
+                               <div class="pure-control-group">
+                                       <xsl:variable name="lang_save">
+                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                       </xsl:variable>
+                                       <input type="submit" class="pure-button 
pure-button-primary" name="values[save]" value="{$lang_save}">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Save the attribute')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </div>
+                       </div>
                </div>
-       </xsl:template>
+       </form>
+       <div class="pure-control-group">
+               <xsl:variable name="done_action">
+                       <xsl:value-of select="done_action"/>
+               </xsl:variable>
+               <xsl:variable name="lang_done">
+                       <xsl:value-of select="php:function('lang', 'done')"/>
+               </xsl:variable>
+               <form method="post" action="{$done_action}">
+                       <input type="submit" class="pure-button 
pure-button-primary" name="done" value="{$lang_done}">
+                               <xsl:attribute name="title">
+                                       <xsl:value-of 
select="php:function('lang', 'Back to the list')"/>
+                               </xsl:attribute>
+                       </input>
+               </form>
+       </div>
+</xsl:template>
 
 
-
 <!-- list custom_function -->
 
-       <xsl:template match="list_custom_function">
+<xsl:template match="list_custom_function">
                
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <tr>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="lang_appname"/>
-                                       <xsl:text>: </xsl:text>
-                                       <xsl:value-of select="appname"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td align="left">
-                                       <xsl:call-template 
name="filter_location"/>
-                               </td>
-
-                               <td align="right">
-                                       <xsl:call-template name="search_field"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan="3" width="100%">
-                                       <xsl:call-template name="nextmatchs"/>
-                               </td>
-                       </tr>
-               </table>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center"  class="pure-table pure-table-bordered">
-                       <xsl:apply-templates 
select="table_header_custom_function"/>
-                       <xsl:choose>
-                               <xsl:when test="values_custom_function != ''">
-                                       <xsl:apply-templates 
select="values_custom_function"/>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:apply-templates select="table_add"/>
-               </table>
-       </xsl:template>
-       <xsl:template match="table_header_custom_function">
-               <xsl:variable name="sort_sorting"><xsl:value-of 
select="sort_sorting"/></xsl:variable>
-               <xsl:variable name="sort_name"><xsl:value-of 
select="sort_name"/></xsl:variable>
-               <tr class="th">
-                       <td class="th_text" width="10%" align="left">
-                               <a href="{$sort_name}"><xsl:value-of 
select="lang_name"/></a>
+       <table width="100%" cellpadding="2" cellspacing="2" align="center">
+               <tr>
+                       <td class="th_text" align="left">
+                               <xsl:value-of select="lang_appname"/>
+                               <xsl:text>: </xsl:text>
+                               <xsl:value-of select="appname"/>
                        </td>
-                       <td class="th_text" width="20%" align="left">
-                               <xsl:value-of select="lang_descr"/>
+               </tr>
+               <tr>
+                       <td align="left">
+                               <xsl:call-template name="filter_location"/>
                        </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_pre_commit"/>
+
+                       <td align="right">
+                               <xsl:call-template name="search_field"/>
                        </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_client_side"/>
+               </tr>
+               <tr>
+                       <td colspan="3" width="100%">
+                               <xsl:call-template name="nextmatchs"/>
                        </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_active"/>
-                       </td>
-                       <td class="th_text" width="10%" align="center">
-                               <a href="{$sort_sorting}"><xsl:value-of 
select="lang_sorting"/></a>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_edit"/>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_delete"/>
-                       </td>
                </tr>
-       </xsl:template>
+       </table>
+       <table width="100%" cellpadding="2" cellspacing="2" align="center"  
class="pure-table pure-table-bordered">
+               <xsl:apply-templates select="table_header_custom_function"/>
+               <xsl:choose>
+                       <xsl:when test="values_custom_function != ''">
+                               <xsl:apply-templates 
select="values_custom_function"/>
+                       </xsl:when>
+               </xsl:choose>
+               <xsl:apply-templates select="table_add"/>
+       </table>
+</xsl:template>
+<xsl:template match="table_header_custom_function">
+       <xsl:variable name="sort_sorting">
+               <xsl:value-of select="sort_sorting"/>
+       </xsl:variable>
+       <xsl:variable name="sort_name">
+               <xsl:value-of select="sort_name"/>
+       </xsl:variable>
+       <tr class="th">
+               <td class="th_text" width="10%" align="left">
+                       <a href="{$sort_name}">
+                               <xsl:value-of select="lang_name"/>
+                       </a>
+               </td>
+               <td class="th_text" width="20%" align="left">
+                       <xsl:value-of select="lang_descr"/>
+               </td>
+               <td class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_pre_commit"/>
+               </td>
+               <td class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_client_side"/>
+               </td>
+               <td class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_active"/>
+               </td>
+               <td class="th_text" width="10%" align="center">
+                       <a href="{$sort_sorting}">
+                               <xsl:value-of select="lang_sorting"/>
+                       </a>
+               </td>
+               <td class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_edit"/>
+               </td>
+               <td class="th_text" width="5%" align="center">
+                       <xsl:value-of select="lang_delete"/>
+               </td>
+       </tr>
+</xsl:template>
 
-       <xsl:template match="values_custom_function"> 
-               <xsl:variable name="lang_up_text"><xsl:value-of 
select="lang_up_text"/></xsl:variable>
-               <xsl:variable name="lang_down_text"><xsl:value-of 
select="lang_down_text"/></xsl:variable>
-               <xsl:variable name="lang_edit_text"><xsl:value-of 
select="lang_edit_text"/></xsl:variable>
-               <xsl:variable name="lang_delete_text"><xsl:value-of 
select="lang_delete_text"/></xsl:variable>
-                       <tr>
-                               <xsl:attribute name="class">
-                                       <xsl:choose>
-                                               <xsl:when test="@class">
-                                                       <xsl:value-of 
select="@class"/>
-                                               </xsl:when>
-                                               <xsl:when test="position() mod 
2 = 0">
-                                                       
<xsl:text>row_off</xsl:text>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       
<xsl:text>row_on</xsl:text>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
-                               <td align="left">
-                                       <xsl:value-of select="file_name"/>
-                               </td>
-                               <td>
-                                       <xsl:value-of select="descr"/>
-                               </td>
-                               <td align = 'center'>
-                                       <xsl:value-of select="pre_commit"/>
-                               </td>
-                               <td align = 'center'>
-                                       <xsl:value-of select="client_side"/>
-                               </td>
-                               <td align = 'center'>
-                                       <xsl:value-of select="active"/>
-                               </td>
-                               <td>
-                                       <table align="left">
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="sorting"/>
-                                                       </td>
+<xsl:template match="values_custom_function"> 
+       <xsl:variable name="lang_up_text">
+               <xsl:value-of select="lang_up_text"/>
+       </xsl:variable>
+       <xsl:variable name="lang_down_text">
+               <xsl:value-of select="lang_down_text"/>
+       </xsl:variable>
+       <xsl:variable name="lang_edit_text">
+               <xsl:value-of select="lang_edit_text"/>
+       </xsl:variable>
+       <xsl:variable name="lang_delete_text">
+               <xsl:value-of select="lang_delete_text"/>
+       </xsl:variable>
+       <tr>
+               <xsl:attribute name="class">
+                       <xsl:choose>
+                               <xsl:when test="@class">
+                                       <xsl:value-of select="@class"/>
+                               </xsl:when>
+                               <xsl:when test="position() mod 2 = 0">
+                                       <xsl:text>row_off</xsl:text>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:text>row_on</xsl:text>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:attribute>
+               <td align="left">
+                       <xsl:value-of select="file_name"/>
+               </td>
+               <td>
+                       <xsl:value-of select="descr"/>
+               </td>
+               <td align = 'center'>
+                       <xsl:value-of select="pre_commit"/>
+               </td>
+               <td align = 'center'>
+                       <xsl:value-of select="client_side"/>
+               </td>
+               <td align = 'center'>
+                       <xsl:value-of select="active"/>
+               </td>
+               <td>
+                       <table align="left">
+                               <tr>
+                                       <td>
+                                               <xsl:value-of select="sorting"/>
+                                       </td>
 
-                                                       <td align="left">
-                                                               <xsl:variable 
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
-                                                               <a 
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
-                                                               <xsl:text> | 
</xsl:text>
-                                                               <xsl:variable 
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
-                                                               <a 
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return 
true;" onMouseout="window.status='';return true;"><xsl:value-of 
select="text_down"/></a>
-                                                       </td>
+                                       <td align="left">
+                                               <xsl:variable name="link_up">
+                                                       <xsl:value-of 
select="link_up"/>
+                                               </xsl:variable>
+                                               <a href="{$link_up}" 
onMouseover="window.status='{$lang_up_text}';return true;" 
onMouseout="window.status='';return true;">
+                                                       <xsl:value-of 
select="text_up"/>
+                                               </a>
+                                               <xsl:text> | </xsl:text>
+                                               <xsl:variable name="link_down">
+                                                       <xsl:value-of 
select="link_down"/>
+                                               </xsl:variable>
+                                               <a href="{$link_down}" 
onMouseover="window.status='{$lang_down_text}';return true;" 
onMouseout="window.status='';return true;">
+                                                       <xsl:value-of 
select="text_down"/>
+                                               </a>
+                                       </td>
 
-                                               </tr>
-                                       </table>
-                               </td>
-                               <td align="center">
-                                       <xsl:variable 
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
-                                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_edit"/></a>
-                               </td>
-                               <td align="center">
-                                       <xsl:variable 
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
-                                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_delete"/></a>
-                               </td>
-                       </tr>
-       </xsl:template>
+                               </tr>
+                       </table>
+               </td>
+               <td align="center">
+                       <xsl:variable name="link_edit">
+                               <xsl:value-of select="link_edit"/>
+                       </xsl:variable>
+                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_text}';return true;" 
onMouseout="window.status='';return true;">
+                               <xsl:value-of select="text_edit"/>
+                       </a>
+               </td>
+               <td align="center">
+                       <xsl:variable name="link_delete">
+                               <xsl:value-of select="link_delete"/>
+                       </xsl:variable>
+                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_text}';return true;" 
onMouseout="window.status='';return true;">
+                               <xsl:value-of select="text_delete"/>
+                       </a>
+               </td>
+       </tr>
+</xsl:template>
 
 
 <!-- add custom_function / edit custom_function -->
 
-       <xsl:template match="edit_custom_function" 
xmlns:php="http://php.net/xsl";>
-               <div align="left">
+<xsl:template match="edit_custom_function" xmlns:php="http://php.net/xsl";>
+       <div align="left">
 
                <form method="post" action="{form_action}">
-               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
-                       <xsl:choose>
-                               <xsl:when test="msgbox_data != ''">
-                                       <tr>
-                                               <td align="left" colspan="3">
-                                                       <xsl:call-template 
name="msgbox"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
+                       <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                               <xsl:choose>
+                                       <xsl:when test="msgbox_data != ''">
+                                               <tr>
+                                                       <td align="left" 
colspan="3">
+                                                               
<xsl:call-template name="msgbox"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
 
-                       <tr>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="lang_appname"/>
-                               </td>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="appname"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="lang_location"/>
-                               </td>
-                               <td class="th_text" align="left">
-                                       <xsl:value-of select="location"/>
-                               </td>
-                       </tr>
-                       <xsl:choose>
-                               <xsl:when test="value_id != ''">
-                                       <tr>
-                                               <td valign="top">
-                                                       <xsl:value-of 
select="lang_id"/>
-                                               </td>
-                                               <td>
-                                                       <xsl:value-of 
select="value_id"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_descr"/>
-                               </td>
-                               <td>
-                                       <textarea cols="60" rows="10" 
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                               <tr>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of 
select="lang_appname"/>
+                                       </td>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of select="appname"/>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of 
select="lang_location"/>
+                                       </td>
+                                       <td class="th_text" align="left">
+                                               <xsl:value-of 
select="location"/>
+                                       </td>
+                               </tr>
+                               <xsl:choose>
+                                       <xsl:when test="value_id != ''">
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_id"/>
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
select="value_id"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_descr"/>
+                                       </td>
+                                       <td>
+                                               <textarea cols="60" rows="10" 
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+                                                       <xsl:attribute 
name="onMouseover">
+                                                               
<xsl:text>window.status='</xsl:text>
                                                                <xsl:value-of 
select="lang_descr_custom_functiontext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_descr"/>            
-                                       </textarea>
+                                                               <xsl:text>'; 
return true;</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_descr"/>
+                                               </textarea>
 
-                               </td>
-                       </tr>
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of 
select="lang_custom_function"/>
-                               </td>
-                               <td valign="top">
-                                       <select 
name="values[custom_function_file]" class="forms">
-                                               <option value=""><xsl:value-of 
select="lang_no_custom_function"/></option>
-                                               <xsl:apply-templates 
select="custom_function_list"/>
-                                       </select>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of select="lang_active"/>
-                               </td>
-                               <td>
-                                       <xsl:choose>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_custom_function"/>
+                                       </td>
+                                       <td valign="top">
+                                               <select 
name="values[custom_function_file]" class="forms">
+                                                       <option value="">
+                                                               <xsl:value-of 
select="lang_no_custom_function"/>
+                                                       </option>
+                                                       <xsl:apply-templates 
select="custom_function_list"/>
+                                               </select>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="lang_active"/>
+                                       </td>
+                                       <td>
+                                               <xsl:choose>
                                                        <xsl:when 
test="value_active = 1">
                                                                <input 
type="checkbox" name="values[active]" value="1" checked="checked" 
onMouseout="window.status='';return true;">
                                                                        
<xsl:attribute name="onMouseover">
                                                                                
<xsl:text>window.status='</xsl:text>
-                                                                               
        <xsl:value-of select="lang_active_statustext"/>
+                                                                               
<xsl:value-of select="lang_active_statustext"/>
                                                                                
<xsl:text>'; return true;</xsl:text>
                                                                        
</xsl:attribute>
                                                                </input>
@@ -723,72 +949,78 @@
                                                                <input 
type="checkbox" name="values[active]" value="1" 
onMouseout="window.status='';return true;">
                                                                        
<xsl:attribute name="onMouseover">
                                                                                
<xsl:text>window.status='</xsl:text>
-                                                                               
        <xsl:value-of select="lang_active_statustext"/>
+                                                                               
<xsl:value-of select="lang_active_statustext"/>
                                                                                
<xsl:text>'; return true;</xsl:text>
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </xsl:otherwise>
-                                       </xsl:choose>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of 
select="php:function('lang', 'pre commit')"/>
-                               </td>
-                               <td>
-                                       <input type="checkbox" 
name="values[pre_commit]" value="1">
-                                               <xsl:attribute name="title">
-                                                       <xsl:text>otherwise: 
post commit</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:if test="value_pre_commit 
= '1'">
-                                                       <xsl:attribute 
name="checked">
-                                                               
<xsl:text>checked</xsl:text>
-                                               </xsl:attribute>
-                                               </xsl:if>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of 
select="php:function('lang', 'client-side')"/>
-                               </td>
-                               <td>
-                                       <input type="checkbox" 
name="values[client_side]" value="1">
-                                               <xsl:attribute name="title">
-                                                       <xsl:text>otherwise: 
server-side</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:if test="value_client_side 
= '1'">
-                                                       <xsl:attribute 
name="checked">
-                                                               
<xsl:text>checked</xsl:text>
-                                               </xsl:attribute>
-                                               </xsl:if>
-                                       </input>
-                               </td>
-                       </tr>
-                       <tr height="50">
-                               <td>
-                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               </xsl:choose>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'pre commit')"/>
+                                       </td>
+                                       <td>
+                                               <input type="checkbox" 
name="values[pre_commit]" value="1">
+                                                       <xsl:attribute 
name="title">
+                                                               
<xsl:text>otherwise: post commit</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:if 
test="value_pre_commit = '1'">
+                                                               <xsl:attribute 
name="checked">
+                                                                       
<xsl:text>checked</xsl:text>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <xsl:value-of 
select="php:function('lang', 'client-side')"/>
+                                       </td>
+                                       <td>
+                                               <input type="checkbox" 
name="values[client_side]" value="1">
+                                                       <xsl:attribute 
name="title">
+                                                               
<xsl:text>otherwise: server-side</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:if 
test="value_client_side = '1'">
+                                                               <xsl:attribute 
name="checked">
+                                                                       
<xsl:text>checked</xsl:text>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                       </td>
+                               </tr>
+                               <tr height="50">
+                                       <td>
+                                               <xsl:variable name="lang_save">
+                                                       <xsl:value-of 
select="lang_save"/>
+                                               </xsl:variable>
+                                               <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
+                                                       <xsl:attribute 
name="onMouseover">
+                                                               
<xsl:text>window.status='</xsl:text>
                                                                <xsl:value-of 
select="lang_save_custom_functiontext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-               </table>
-       </form>
+                                                               <xsl:text>'; 
return true;</xsl:text>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                       </table>
+               </form>
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+                                       <xsl:variable name="done_action">
+                                               <xsl:value-of 
select="done_action"/>
+                                       </xsl:variable>
+                                       <xsl:variable name="lang_done">
+                                               <xsl:value-of 
select="lang_done"/>
+                                       </xsl:variable>
                                        <form method="post" 
action="{$done_action}">
                                                <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
                                                        <xsl:attribute 
name="onMouseover">
                                                                
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_done_custom_functiontext"/>
+                                                               <xsl:value-of 
select="lang_done_custom_functiontext"/>
                                                                <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
@@ -796,85 +1028,103 @@
                                </td>
                        </tr>
                </table>
-               </div>
-       </xsl:template>
+       </div>
+</xsl:template>
 
 
 
 <!-- location_level_list -->   
 
-       <xsl:template match="location_level_list">
-       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
-               <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
+<xsl:template match="location_level_list">
+       <xsl:variable name="id">
+               <xsl:value-of select="id"/>
+       </xsl:variable>
+       <xsl:choose>
+               <xsl:when test="selected">
+                       <option value="{$id}" selected="selected">
+                               <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                       </option>
+               </xsl:when>
+               <xsl:otherwise>
+                       <option value="{$id}">
+                               <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                       </option>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
 
 <!-- datatype_list --> 
 
-       <xsl:template match="datatype_list">
-       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
-               <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
+<xsl:template match="datatype_list">
+       <xsl:variable name="id">
+               <xsl:value-of select="id"/>
+       </xsl:variable>
+       <xsl:choose>
+               <xsl:when test="selected">
+                       <option value="{$id}" selected="selected">
+                               <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                       </option>
+               </xsl:when>
+               <xsl:otherwise>
+                       <option value="{$id}">
+                               <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                       </option>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
 
 <!-- custom_function_list -->  
 
-       <xsl:template match="custom_function_list">
-               <option value="{id}">
-                       <xsl:if test="selected = 1">
-                               <xsl:attribute name="selected" value="selected" 
/>
-                       </xsl:if>
-                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
-               </option>
-       </xsl:template>
+<xsl:template match="custom_function_list">
+       <option value="{id}">
+               <xsl:if test="selected = 1">
+                       <xsl:attribute name="selected" value="selected" />
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>
 
 <!-- nullable_list --> 
 
-       <xsl:template match="nullable_list">
-       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+<xsl:template match="nullable_list">
+       <xsl:variable name="id">
+               <xsl:value-of select="id"/>
+       </xsl:variable>
+       <xsl:choose>
+               <xsl:when test="selected">
+                       <option value="{$id}" selected="selected">
+                               <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                       </option>
+               </xsl:when>
+               <xsl:otherwise>
+                       <option value="{$id}">
+                               <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                       </option>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+<xsl:template name="choice" xmlns:php="http://php.net/xsl";>
+       <table cellpadding="2" cellspacing="2" width="80%" align="left">
                <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
-
-       <xsl:template name="choice" xmlns:php="http://php.net/xsl";>
-                       <table cellpadding="2" cellspacing="2" width="80%" 
align="left">
-                       <xsl:choose>
-                               <xsl:when test="value_choice!=''">
-                                       <tr class="th">
-                                               <td class="th_text" width="5%" 
align="left">
-                                                       <xsl:value-of 
select="php:function('lang', 'id')" />
-                                               </td>
-                                               <td class="th_text" width="40%" 
align="left">
-                                                       <xsl:value-of 
select="php:function('lang', 'value')" />
-                                               </td>
-                                               <td class="th_text" width="40%" 
align="left">
-                                                       <xsl:value-of 
select="php:function('lang', 'title')" />
-                                               </td>
-                                               <td class="th_text" width="5%" 
align="left">
-                                                       <xsl:value-of 
select="php:function('lang', 'order')" />
-                                               </td>
-                                               <td class="th_text" width="10%" 
align="center">
-                                                       <xsl:value-of 
select="lang_delete_value"/>
-                                               </td>
-                                       </tr>
+                       <xsl:when test="value_choice!=''">
+                               <tr class="th">
+                                       <td class="th_text" width="5%" 
align="left">
+                                               <xsl:value-of 
select="php:function('lang', 'id')" />
+                                       </td>
+                                       <td class="th_text" width="40%" 
align="left">
+                                               <xsl:value-of 
select="php:function('lang', 'value')" />
+                                       </td>
+                                       <td class="th_text" width="40%" 
align="left">
+                                               <xsl:value-of 
select="php:function('lang', 'title')" />
+                                       </td>
+                                       <td class="th_text" width="5%" 
align="left">
+                                               <xsl:value-of 
select="php:function('lang', 'order')" />
+                                       </td>
+                                       <td class="th_text" width="10%" 
align="center">
+                                               <xsl:value-of 
select="lang_delete_value"/>
+                                       </td>
+                               </tr>
                                <xsl:for-each select="value_choice" >
                                        <tr>
                                                <xsl:attribute name="class">
@@ -890,71 +1140,71 @@
                                                                </xsl:otherwise>
                                                        </xsl:choose>
                                                </xsl:attribute>
-                                       <td align="left">
-                                               <xsl:value-of select="id"/>
-                                       </td>
-                                       <td align="left">
-                                               <input type="textbox" 
name="values[edit_choice][{id}]" value="{value}" size='15'>
-                                                       <xsl:attribute 
name="title">
-                                                               <xsl:value-of 
select="php:function('lang', 'value')" />
-                                                       </xsl:attribute>
-                                               </input>
-                                       </td>
-                                       <td align="left">
-                                               <input type="textbox" 
name="values[title_choice][{id}]" value="{title}" size='15'>
-                                                       <xsl:attribute 
name="title">
-                                                               <xsl:value-of 
select="php:function('lang', 'value')" />
-                                                       </xsl:attribute>
-                                               </input>
-                                       </td>
-                                       <td align="center">
-                                               <input type="textbox" 
name="values[order_choice][{id}]" value="{order}" size='4'>
-                                                       <xsl:attribute 
name="title">
-                                                               <xsl:value-of 
select="php:function('lang', 'order')" />
-                                                       </xsl:attribute>
-                                               </input>
-                                       </td>
-                                       <td align="center">
-                                               <input type="checkbox" 
name="values[delete_choice][]" value="{id}">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
+                                               <td align="left">
+                                                       <xsl:value-of 
select="id"/>
+                                               </td>
+                                               <td align="left">
+                                                       <input type="textbox" 
name="values[edit_choice][{id}]" value="{value}" size='15'>
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'value')" />
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                               <td align="left">
+                                                       <input type="textbox" 
name="values[title_choice][{id}]" value="{title}" size='15'>
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'value')" />
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                               <td align="center">
+                                                       <input type="textbox" 
name="values[order_choice][{id}]" value="{order}" size='4'>
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'order')" />
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                               <td align="center">
+                                                       <input type="checkbox" 
name="values[delete_choice][]" value="{id}">
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
                                                                        
<xsl:value-of select="//lang_delete_choice_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </td>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
                                        </tr>
                                </xsl:for-each>
-                               </xsl:when>
-                       </xsl:choose>
-                       <tr>
-                               <td valign="top" colspan='2'>
-                                       <xsl:value-of select="lang_new_value"/>
-                               </td>
-                               <td valign="top">
-                                       <input type="text" 
name="values[new_choice_id]" size = '3'>
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'new id for multiple choice')"/>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                               <td valign="top">
-                                       <input type="text" 
name="values[new_choice]" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_new_value_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-                       </table>
-       </xsl: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>
+                       </xsl:when>
+               </xsl:choose>
+               <tr>
+                       <td valign="top" colspan='2'>
+                               <xsl:value-of select="lang_new_value"/>
+                       </td>
+                       <td valign="top">
+                               <input type="text" name="values[new_choice_id]" 
size = '3'>
+                                       <xsl:attribute name="title">
+                                               <xsl:value-of 
select="php:function('lang', 'new id for multiple choice')"/>
+                                       </xsl:attribute>
+                               </input>
+                       </td>
+                       <td valign="top">
+                               <input type="text" name="values[new_choice]" 
onMouseout="window.status='';return true;">
+                                       <xsl:attribute name="onMouseover">
+                                               
<xsl:text>window.status='</xsl:text>
+                                               <xsl:value-of 
select="lang_new_value_statustext"/>
+                                               <xsl:text>'; return 
true;</xsl:text>
+                                       </xsl:attribute>
+                               </input>
+                       </td>
+               </tr>
+       </table>
+</xsl: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>

Modified: branches/dev-syncromind/admin/templates/base/select_location.xsl
===================================================================
--- branches/dev-syncromind/admin/templates/base/select_location.xsl    
2015-08-31 09:46:22 UTC (rev 13813)
+++ branches/dev-syncromind/admin/templates/base/select_location.xsl    
2015-08-31 12:18:04 UTC (rev 13814)
@@ -1,24 +1,40 @@
 <!-- $Id$ -->
-       <xsl:template name="select_location">
-               <xsl:variable name="select_name_location"><xsl:value-of 
select="select_name_location"/></xsl:variable>
-                       <select name="{$select_name_location}" 
onMouseout="window.status='';return true;">
-                               <xsl:attribute name="onMouseover">
-                                       <xsl:text>window.status='</xsl:text>
-                                               <xsl:value-of 
select="lang_location_statustext"/>
-                                       <xsl:text>'; return true;</xsl:text>
-                               </xsl:attribute>
-                               <option value=""><xsl:value-of 
select="lang_no_location"/></option>
-                                       <xsl:apply-templates 
select="location_list"/>
-                       </select>
-       </xsl:template>
+<xsl:template name="select_location" xmlns:php="http://php.net/xsl";>
+       <xsl:variable name="select_name_location">
+               <xsl:value-of select="select_name_location"/>
+       </xsl:variable>
+       <select name="{$select_name_location}" 
onMouseout="window.status='';return true;">
+               <xsl:attribute name="title">
+                       <xsl:value-of select="lang_location_statustext"/>
+               </xsl:attribute>
+               <xsl:if test="select_location_required = '1'">
+                       <xsl:attribute name="data-validation">
+                               <xsl:text>required</xsl:text>
+                       </xsl:attribute>
+                       <xsl:attribute name="data-validation-error-msg">
+                               <xsl:value-of select="php:function('lang', 
'Please enter a location !')"/>
+                       </xsl:attribute>
 
-       <xsl:template match="location_list">
-               <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="descr"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{id}"><xsl:value-of 
disable-output-escaping="yes" select="descr"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
+               </xsl:if>
+
+               <option value="">
+                       <xsl:value-of select="lang_no_location"/>
+               </option>
+               <xsl:apply-templates select="location_list"/>
+       </select>
+</xsl:template>
+
+<xsl:template match="location_list">
+       <xsl:choose>
+               <xsl:when test="selected">
+                       <option value="{id}" selected="selected">
+                               <xsl:value-of disable-output-escaping="yes" 
select="descr"/>
+                       </option>
+               </xsl:when>
+               <xsl:otherwise>
+                       <option value="{id}">
+                               <xsl:value-of disable-output-escaping="yes" 
select="descr"/>
+                       </option>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>

Modified: branches/dev-syncromind/booking/inc/class.menu.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.menu.inc.php      2015-08-31 
09:46:22 UTC (rev 13813)
+++ branches/dev-syncromind/booking/inc/class.menu.inc.php      2015-08-31 
12:18:04 UTC (rev 13814)
@@ -241,6 +241,11 @@
                                                                'text'  => 
lang('Activity'),
                                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uiactivity.index', 'appname' => 'booking') )
                                                        ),
+                                                       'custom_field_groups'   
=> array
+                                                       (
+                                                               'text'  => 
lang('custom field groups'),
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute_group', 'appname' => 'booking', 
'menu_selection' => 'booking::settings::custom_field_groups') )
+                                                       ),
                                                        'custom_fields' => array
                                                        (
                                                                'text'  => 
lang('custom fields'),




reply via email to

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