fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8960] property: rebuilding responsibility


From: Sigurd Nes
Subject: [Fmsystem-commits] [8960] property: rebuilding responsibility
Date: Fri, 02 Mar 2012 07:35:49 +0000

Revision: 8960
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8960
Author:   sigurdne
Date:     2012-03-02 07:35:48 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
property: rebuilding responsibility

Modified Paths:
--------------
    trunk/controller/inc/class.cat_hooks.inc.php
    trunk/preferences/inc/class.boadmin_acl.inc.php
    trunk/property/inc/class.boresponsible.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.soresponsible.inc.php
    trunk/property/inc/class.uigeneric.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/inc/class.uiresponsible.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/responsible.xsl

Modified: trunk/controller/inc/class.cat_hooks.inc.php
===================================================================
--- trunk/controller/inc/class.cat_hooks.inc.php        2012-03-01 11:49:49 UTC 
(rev 8959)
+++ trunk/controller/inc/class.cat_hooks.inc.php        2012-03-02 07:35:48 UTC 
(rev 8960)
@@ -60,6 +60,7 @@
                        }
                        
$GLOBALS['phpgw']->locations->add("{$location}.category.{$data['cat_id']}", 
$data['cat_name'], 'controller');
                        
+/*
                        $this->soresponsible->add_type(array
                                (
                                        'name'  => $data['cat_name'],
@@ -69,6 +70,7 @@
                                        'active'        => true
                                )
                        );
+*/
                }
 
                /**
@@ -85,7 +87,7 @@
                                $location_info = 
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
                                $location = 
"{$location_info['location']}.category.{$data['cat_id']}";
                                
$GLOBALS['phpgw']->locations->delete('controller', $location, false);
-                               $this->_db->query("DELETE FROM 
fm_responsibility WHERE cat_id = " . (int) $data['cat_id'], __LINE__, __FILE__);
+//                             $this->_db->query("DELETE FROM 
fm_responsibility WHERE cat_id = " . (int) $data['cat_id'], __LINE__, __FILE__);
                        }
                }
 
@@ -105,11 +107,13 @@
                                $location = 
"{$location_info['location']}.category.{$data['cat_id']}";
                                
$GLOBALS['phpgw']->locations->update_description($location, $data['cat_name'], 
'controller');
 
+/*
                                $value_set['name']              = 
$this->_db->db_addslashes($data['cat_name']);
                                $value_set['descr']             = 
$value_set['name'];
 
                                $value_set      = 
$this->_db->validate_update($value_set);
                                $this->_db->query("UPDATE fm_responsibility SET 
$value_set WHERE cat_id = " . (int) $data['cat_id'], __LINE__, __FILE__);
+*/
                        }
                }
        }

Modified: trunk/preferences/inc/class.boadmin_acl.inc.php
===================================================================
--- trunk/preferences/inc/class.boadmin_acl.inc.php     2012-03-01 11:49:49 UTC 
(rev 8959)
+++ trunk/preferences/inc/class.boadmin_acl.inc.php     2012-03-02 07:35:48 UTC 
(rev 8960)
@@ -174,12 +174,14 @@
                {
                        $location_list = array();
        
-                       $grant          = isset($data['grant']) && 
$data['grant'] ? $data['grant'] : false;
-                       $grant          = isset($data['allow_c_attrib']) && 
$data['allow_c_attrib'] ? $data['allow_c_attrib'] : false;
-                       $acl_app        = isset($data['acl_app']) && 
$data['acl_app'] ? $data['acl_app'] : 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $selected       = isset($data['selected']) && 
$data['selected'] ? $data['selected'] : '';
+                       $grant                          = isset($data['grant']) 
&& $data['grant'] ? $data['grant'] : false;
+                       $grant                          = 
isset($data['allow_c_attrib']) && $data['allow_c_attrib'] ? 
$data['allow_c_attrib'] : false;
+                       $acl_app                        = 
isset($data['acl_app']) && $data['acl_app'] ? $data['acl_app'] : 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $selected                       = 
isset($data['selected']) && $data['selected'] ? $data['selected'] : '';
+                       $c_function                     = 
isset($data['$c_function']) && $data['$c_function'] ? true : false;
+                       $have_categories        = 
isset($data['have_categories']) && $data['have_categories'] ? true : false;
 
-                       $locations = 
$GLOBALS['phpgw']->locations->get_locations($grant, $acl_app, $allow_c_attrib);
+                       $locations = 
$GLOBALS['phpgw']->locations->get_locations($grant, $acl_app, $allow_c_attrib, 
$c_function, $have_categories);
 
                        foreach ( $locations as $loc_id => $loc_descr )
                        {

Modified: trunk/property/inc/class.boresponsible.inc.php
===================================================================
--- trunk/property/inc/class.boresponsible.inc.php      2012-03-01 11:49:49 UTC 
(rev 8959)
+++ trunk/property/inc/class.boresponsible.inc.php      2012-03-02 07:35:48 UTC 
(rev 8960)
@@ -289,6 +289,27 @@
                }
 
                /**
+                * Save responsibility role
+                *
+                * @param array $values values to be stored/edited and 
referencing ID if editing
+                *
+                * @return array $receip with result on the 
action(failed/success)
+                */
+
+               public function save_role($values)
+               {
+                       if (isset($values['id']) && $values['id'])
+                       {
+                               $receipt = $this->so->edit_role($values);
+                       }
+                       else
+                       {
+                               $receipt = $this->so->add_role($values);
+                       }
+                       return $receipt;
+               }
+
+               /**
                 * Save responsibility contact
                 *
                 * @param array $values values to be stored/edited and 
referencing ID if editing
@@ -430,6 +451,20 @@
                }
 
                /**
+                * Read single responsibility type
+                *
+                * @param integer $id ID of responsibility type
+                *
+                * @return array holding data of responsibility type
+                */
+
+               public function read_single_role($id)
+               {
+                       $values = $this->so->read_single_role($id);
+                       return $values;
+               }
+
+               /**
                 * Read single responsibility
                 *
                 * @param integer $id ID of responsibility type

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2012-03-01 11:49:49 UTC (rev 
8959)
+++ trunk/property/inc/class.sogeneric.inc.php  2012-03-02 07:35:48 UTC (rev 
8960)
@@ -1937,7 +1937,7 @@
                                                        ),
                                                        array
                                                        (
-                                                               'name'          
        => 'location',
+                                                               'name'          
        => 'location_level',
                                                                'descr'         
        => lang('location'),
                                                                'type'          
        => 'select',
                                                                'values_def'    
=> array
@@ -1945,6 +1945,7 @@
                                                                        
'valueset'              => false,
                                                                        
'method'                => 'preferences.boadmin_acl.get_locations',
                                                                        
'method_input'  => array('acl_app' => 'property',       'selected' => 
'##location##')
+//                                                                     
'method_input'  => array('acl_app' => '$this->appname', 'selected' => 
'##location##', 'have_categories' => true)
                                                                )
                                                        ),
                                                        array
@@ -1960,6 +1961,7 @@
                                                                )
                                                        )
                                                ),
+                                               'edit_action'           => 
'property.uiresponsible.edit_role',
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('responsibility role'),
@@ -2259,7 +2261,14 @@
                                $_filter = array();
                                foreach ($data['filter'] as $_field => $_value)
                                {
-                                       $_filter[] = "{$_field} = '{$_value}'";
+                                       if($data['filter_method'] == 'like')
+                                       {
+                                               $_filter[] = "{$_field} 
{$this->_db->like} '%{$_value}%'";
+                                       }
+                                       else
+                                       {
+                                               $_filter[] = "{$_field} = 
'{$_value}'";
+                                       }
                                }
                                if($_filter)
                                {

Modified: trunk/property/inc/class.soresponsible.inc.php
===================================================================
--- trunk/property/inc/class.soresponsible.inc.php      2012-03-01 11:49:49 UTC 
(rev 8959)
+++ trunk/property/inc/class.soresponsible.inc.php      2012-03-02 07:35:48 UTC 
(rev 8960)
@@ -93,7 +93,7 @@
                                $ordermethod = ' order by fm_responsibility.id 
DESC';
                        }
 
-                       $where= 'AND';
+                       $where= 'WHERE';
                        $filtermethod = '';
 
 /*
@@ -102,24 +102,25 @@
                                $filtermethod .= " $where cat_id IN (" . 
implode(',', $filter) . ')';
                                $where = 'AND';
                        }
- */
+
                        if($location)
                        {
                                $filtermethod .= " $where 
fm_responsibility_module.location_id =" . 
$GLOBALS['phpgw']->locations->get_id($this->appname, $location);
                                $where = 'AND';
                        }
-
+ */
                        $querymethod = '';
                        if($query)
                        {
                                $querymethod = "$where (fm_responsibility.name 
{$this->like} '%$query%' OR fm_responsibility.descr {$this->like} '%$query%')";
                        }
 
-                       $sql = "SELECT fm_responsibility.*, 
phpgw_locations.name as location FROM fm_responsibility"
-                       . " {$this->join} fm_responsibility_module ON 
fm_responsibility.id = fm_responsibility_module.responsibility_id"
-                       . " {$this->join} phpgw_locations ON 
fm_responsibility_module.location_id = phpgw_locations.location_id"
-                       . " {$this->join} phpgw_applications ON 
phpgw_locations.app_id = phpgw_applications.app_id"
-                       . " WHERE app_name = '{$appname}' $filtermethod 
$querymethod";
+                       $sql = "SELECT fm_responsibility.* FROM 
fm_responsibility"
+//                     . " {$this->join} fm_responsibility_module ON 
fm_responsibility.id = fm_responsibility_module.responsibility_id"
+//                     . " {$this->join} phpgw_locations ON 
fm_responsibility_module.location_id = phpgw_locations.location_id"
+//                     . " {$this->join} phpgw_applications ON 
phpgw_locations.app_id = phpgw_applications.app_id"
+                       . " {$filtermethod} {$querymethod}";
+//                     . " WHERE app_name = '{$appname}' $filtermethod 
$querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
@@ -138,42 +139,58 @@
                        while ($this->db->next_record())
                        {
                                $values[] = array
-                                       (
-                                               'id'                    => 
$this->db->f('id'),
-                                               'name'                  => 
$this->db->f('name', true),
-                                               'descr'                 => 
$this->db->f('descr', true),
-                                               'active'                => 
$this->db->f('active'),
-                                               'location'              => 
$this->db->f('location'),
-                                               'cat_id'                => 
$this->db->f('cat_id'),
-                                               'created_by'    => 
$this->db->f('created_by'),
-                                               'created_on'    => 
$this->db->f('created_on'),
-                                       );
+                               (
+                                       'id'                    => 
$this->db->f('id'),
+                                       'name'                  => 
$this->db->f('name', true),
+                                       'descr'                 => 
$this->db->f('descr', true),
+                                       'active'                => 
$this->db->f('active'),
+                                       'location'              => 
$this->db->f('location'),
+                                       'cat_id'                => 
$this->db->f('cat_id'),
+                                       'created_by'    => 
$this->db->f('created_by'),
+                                       'created_on'    => 
$this->db->f('created_on'),
+                               );
                        }
 
+                       foreach($values as &$entry)
+                       {
+                               $sql = "SELECT location_id FROM 
fm_responsibility_module WHERE responsibility_id = {$entry['id']}";
+                               $this->db->query($sql, __LINE__, __FILE__);     
                
+                               $locations = array();
+                               while ($this->db->next_record())
+                               {
+                                       $locations[$this->db->f('location_id')] 
= true;
+                               }               
+                               $__location_info = array();
+                               foreach($locations as $location_id => $dummy)
+                               {
+                                       $_location_info = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                                       $__location_info[] = 
"{$_location_info['appname']}::{$_location_info['location']}";
+                               }       
+                               $entry['appname'] = implode(' | ', 
$__location_info);
+                       }
+
+//_debug_array($values);die();
                        return $values;
                }
 
                /**
                 * Add responsibility type
                 *
-                * @param array $values values to be stored/edited and 
referencing ID if editing
+                * @param array $data values to be stored/edited and 
referencing ID if editing
                 *
                 * @return array $receip with result on the 
action(failed/success)
                 */
 
-               public function add_type($values)
+               public function add_type($data)
                {
                        $receipt = array();
-                       $values['name'] = 
$this->db->db_addslashes($values['name']);
-                       $values['descr'] = 
$this->db->db_addslashes($values['descr']);
+                       $data['name'] = $this->db->db_addslashes($data['name']);
+                       $data['descr'] = 
$this->db->db_addslashes($data['descr']);
 
                        $insert_values = array
                        (
-                               $values['name'],
-                               $values['descr'],
-                               
$GLOBALS['phpgw']->locations->get_id($this->appname, $values['location']),
-                               (int) $values['cat_id'],
-                               isset($values['active']) ? !!$values['active'] 
: '',
+                               $data['name'],
+                               $data['descr'],
                                $this->account,
                                time()
                        );
@@ -182,9 +199,32 @@
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("INSERT INTO fm_responsibility (name, 
descr,location_id, cat_id, active, created_by, created_on) "
+                       $this->db->query("INSERT INTO fm_responsibility (name, 
descr, created_by, created_on) "
                                . "VALUES ($insert_values)", __LINE__, 
__FILE__);
 
+                       if($data['cat_id'])
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id( $data['appname'],  $data['location']);
+
+                               $this->db->query("SELECT * FROM 
fm_responsibility_module  WHERE location_id = " . (int) $location_id . ' AND 
cat_id = ' . (int)$data['cat_id'], __LINE__, __FILE__);
+                               
+                               if(!$this->db->next_record())
+                               {
+                                       $value_set = array();
+
+                                       $value_set['responsibility_id']         
= (int) $data['id'];
+                                       $value_set['location_id']               
        = $location_id;
+                                       $value_set['cat_id']                    
        = (int) $data['cat_id'];
+                                       $value_set['active']                    
        = 1;//isset($data['active']) ? !!$data['active'] : '';
+                                       $value_set['created_on']                
        = time();                                                               
                
+                                       $value_set['created_by']                
        = $this->account;
+
+                                       $cols = implode(',', 
array_keys($value_set));
+                                       $values = 
$this->db->validate_insert(array_values($value_set));
+                                       $this->db->query("INSERT INTO 
fm_responsibility_module ({$cols}) VALUES ({$values})",__LINE__,__FILE__);
+                               }
+                       }
+
                        if($this->db->transaction_commit())
                        {
                                
$receipt['message'][]=array('msg'=>lang('Responsibility type has been saved'));
@@ -201,26 +241,69 @@
                /**
                 * Edit responsibility type
                 *
-                * @param array $values values to be stored/edited and 
referencing ID if editing
+                * @param array $data values to be stored/edited and 
referencing ID if editing
                 *
                 * @return array $receip with result on the 
action(failed/success)
                 */
 
-               public function edit_type($values)
+               public function edit_type($data)
                {
                        $receipt = array();
-                       $value_set['name']              = 
$this->db->db_addslashes($values['name']);
-                       $value_set['descr']             = 
$this->db->db_addslashes($values['descr']);
-                       $value_set['cat_id']    = (int) $values['cat_id'];
-                       $value_set['active']    = isset($values['active']) ? 
!!$values['active'] : '';
+                       $value_set = array();
+                       $value_set['name']              = 
$this->db->db_addslashes($data['name']);
+                       $value_set['descr']             = 
$this->db->db_addslashes($data['descr']);
 
                        $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("UPDATE fm_responsibility set 
$value_set WHERE id = " . (int) $values['id'], __LINE__, __FILE__);
+                       $this->db->query("UPDATE fm_responsibility SET 
$value_set WHERE id = " . (int) $data['id'], __LINE__, __FILE__);
+                       $this->db->query("UPDATE fm_responsibility_module SET 
active = NULL WHERE responsibility_id = " . (int) $data['id'], __LINE__, 
__FILE__);
 
-                       $receipt['id']= $values['id'];
+                       if($data['cat_id'])
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id( $data['appname'],  $data['location']);
+
+                               $this->db->query("SELECT * FROM 
fm_responsibility_module  WHERE responsibility_id = " . (int) $data['id'] . ' 
AND location_id = ' . (int) $location_id . ' AND cat_id = ' . 
(int)$data['cat_id'], __LINE__, __FILE__);
+//_debug_array("SELECT * FROM fm_responsibility_module  WHERE location_id = " 
. (int) $location_id . ' AND cat_id = ' . (int)$data['cat_id']);                
         
+                               if(!$this->db->next_record())
+                               {
+                                       $value_set = array();
+
+                                       $value_set['responsibility_id']         
= (int) $data['id'];
+                                       $value_set['location_id']               
        = $location_id;
+                                       $value_set['cat_id']                    
        = (int) $data['cat_id'];
+                                       $value_set['active']                    
        = 1;//isset($data['active']) ? !!$data['active'] : '';
+                                       $value_set['created_on']                
        = time();                                                               
                
+                                       $value_set['created_by']                
        = $this->account;
+
+                                       $cols = implode(',', 
array_keys($value_set));
+                                       $values = 
$this->db->validate_insert(array_values($value_set));
+                                       $this->db->query("INSERT INTO 
fm_responsibility_module ({$cols}) VALUES ({$values})",__LINE__,__FILE__);
+                               }
+                       }
+
+//_debug_array($data);die();
+                       if(isset($data['delete_module']) && 
$data['delete_module'])
+                       {
+                               foreach($data['delete_module'] as $to_delete)
+                               {
+                                       $_to_delete = explode('_', $to_delete);
+                                       $this->db->query("DELETE FROM 
fm_responsibility_module  WHERE location_id = " . (int) $_to_delete[0] . ' AND 
cat_id = ' . (int) $_to_delete[1], __LINE__, __FILE__);
+                               }
+                       }
+
+                       if(isset($data['set_active']) && $data['set_active'])
+                       {
+                               foreach($data['set_active'] as $set_active)
+                               {
+                                       $_set_active = explode('_', 
$set_active);
+                                       $this->db->query("UPDATE 
fm_responsibility_module SET active = 1 WHERE location_id = " . (int) 
$_set_active[0] . ' AND cat_id = ' . (int) $_set_active[1], __LINE__, __FILE__);
+                               }
+                       }
+//_debug_array($data);die();
+
+                       $receipt['id']= $data['id'];
                        if($this->db->transaction_commit())
                        {
                                
$receipt['message'][]=array('msg'=>lang('responsibility type has been edited'));
@@ -264,6 +347,72 @@
                }
 
                /**
+                * Read single responsibility role
+                *
+                * @param integer $id ID of responsibility role
+                *
+                * @return array Responsibility type
+                */
+
+               public function read_single_role($id)
+               {
+                       $sql = 'SELECT * FROM fm_responsibility_role WHERE id= 
' . (int) $id;
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $values = array();
+
+                       $this->db->next_record();
+                       $values = array
+                       (
+                               'id'                            => 
$this->db->f('id'),
+                               'name'                          => 
$this->db->f('name', true),
+                               'remark'                        => 
$this->db->f('remark', true),
+                               'location_level'        => explode(',', 
ltrim($this->db->f('location_level'), '.location.')),
+                               'responsibility_id'     => 
$this->db->f('responsibility_id'),
+                               'user_id'                       => 
$this->db->f('user_id'),
+                               'entry_date'            => 
$this->db->f('entry_date'),
+                               'modified_date'         => 
$this->db->f('modified_date'),
+                               'appname'                       => 
$this->db->f('appname'),
+                       );
+
+                       return $values;
+               }
+
+
+
+               public function edit_role($data)
+               {
+                       $receipt = array();
+
+                       $value_set['name']                                      
=$this->db->db_addslashes($data['name']);
+                       $value_set['remark']                            = 
$this->db->db_addslashes($data['remark']);
+                       $value_set['responsibility_id']         = 
$data['responsibility_id'];
+                       $value_set['location_level']                            
= implode(',', $data['location_level']);
+                       $value_set['modified_date']                     = 
time();
+
+
+                       $value_set      = 
$this->db->validate_update($value_set);
+
+                       $this->db->transaction_begin();
+
+                       $this->db->query("UPDATE fm_responsibility_role set 
$value_set WHERE id = " . (int) $data['id'], __LINE__, __FILE__);
+
+                       if($this->db->transaction_commit())
+                       {
+                               
$receipt['message'][]=array('msg'=>lang('Responsibility role has been 
changed'));
+                       }
+                       else
+                       {
+                               
$receipt['message'][]=array('msg'=>lang('Nothing changed'));
+                       }
+                       $receipt['id']= $data['id'];
+
+                       return $receipt;
+               }
+
+
+               /**
                 * Read single responsibility type
                 *
                 * @param integer $id ID of responsibility type

Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php  2012-03-01 11:49:49 UTC (rev 
8959)
+++ trunk/property/inc/class.uigeneric.inc.php  2012-03-02 07:35:48 UTC (rev 
8960)
@@ -406,8 +406,8 @@
                                                'text'                  => 
lang('edit'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'menuaction'            
=> 'property.uigeneric.edit',
-                                                       'appname'               
=> $this->appname,
+                                                       'menuaction'            
=> isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
+                                                       'appname'               
        => $this->appname,
                                                        'type'                  
        => $this->type,
                                                        'type_id'               
        => $this->type_id
                                                )),
@@ -419,7 +419,7 @@
                                                'text'                  => 
lang('open edit in new window'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'menuaction'            
=> 'property.uigeneric.edit',
+                                                       'menuaction'            
=> isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
                                                        'appname'               
=> $this->appname,
                                                        'type'                  
        => $this->type,
                                                        'type_id'               
        => $this->type_id,
@@ -458,7 +458,7 @@
                                                'text'                  => 
lang('add'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'menuaction'    => 
'property.uigeneric.edit',
+                                                       'menuaction'    => 
isset($this->location_info['edit_action']) &&  
$this->location_info['edit_action'] ?  $this->location_info['edit_action'] : 
'property.uigeneric.edit',
                                                        'appname'               
=> $this->appname,
                                                        'type'                  
=> $this->type,
                                                        'type_id'               
=> $this->type_id

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2012-03-01 11:49:49 UTC (rev 
8959)
+++ trunk/property/inc/class.uilocation.inc.php 2012-03-02 07:35:48 UTC (rev 
8960)
@@ -1239,9 +1239,10 @@
  */
                                $_role_criteria = array
                                        (
-                                               'type'          => 
'responsibility_role',
-                                               'filter'        => 
array('location' => ".location.{$type_id}"),
-                                               'order'         => 'name'
+                                               'type'                  => 
'responsibility_role',
+                                               'filter'                => 
array('location_level' => $type_id),
+                                               'filter_method' => 'like',
+                                               'order'                 => 
'name'
                                        );
 
                                $values_combo_box[4] =   
execMethod('property.sogeneric.get_list',$_role_criteria);

Modified: trunk/property/inc/class.uiresponsible.inc.php
===================================================================
--- trunk/property/inc/class.uiresponsible.inc.php      2012-03-01 11:49:49 UTC 
(rev 8959)
+++ trunk/property/inc/class.uiresponsible.inc.php      2012-03-02 07:35:48 UTC 
(rev 8960)
@@ -108,7 +108,7 @@
                                'index'                 => true,
                                'contact'               => true,
                                'edit'                  => true,
-                               'edit_type'     => true,
+                               'edit_role'             => true,
                                'edit_contact'  => true,
                                'no_access'             => true,
                                'delete_type'   => true
@@ -299,7 +299,7 @@
 
                        $uicols = array (
                                'input_type'    =>      
array('hidden','text','text','text','text','hidden','text','text','hidden','hidden'),
-                               'name'                  =>      
array('id','name','descr','category','created_by','created_on','app_name','active','loc','location'),
+                               'name'                  =>      
array('id','name','descr','category','created_by','created_on','appname','active','loc','location'),
                                'formatter'             =>      
array('','','','','','','','','',''),
                                'descr'                 =>      
array('',lang('name'),lang('descr'),lang('category'),lang('user'),'',lang('application'),lang('active'),'','')
                        );
@@ -418,7 +418,7 @@
                                                        'text'                  
=> lang('edit'),
                                                        'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                                                        (
-                                                               'menuaction'    
=> 'property.uiresponsible.edit_type',
+                                                               'menuaction'    
=> 'property.uiresponsible.edit',
                                                                'appname'       
=> $this->appname
 //                                                             'location'      
        => $this->location
                                                        )),
@@ -462,7 +462,7 @@
                                                        'text'                  
=> lang('add'),
                                                        'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                                                        (
-                                                               'menuaction'    
=> 'property.uiresponsible.edit_type',
+                                                               'menuaction'    
=> 'property.uiresponsible.edit',
                                                                'appname'       
        => $this->appname,
                                                                'location'      
        => $this->location
                                                        ))
@@ -608,8 +608,6 @@
 
                function edit()
                {
-//_debug_array($_POST); die();
-
                        if(!$this->acl_add && !$this->acl_edit)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
@@ -626,15 +624,14 @@
        //                              
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
                                }
 
-
                                if(!isset($values['location']) || 
!$values['location'])
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a location!'));
+//                                     
$receipt['error'][]=array('msg'=>lang('Please select a location!'));
                                }
 
-                               if(!isset($values['title']) || 
!$values['title'])
+                               if(!isset($values['name']) || !$values['name'])
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please enter a title!'));
+                                       
$receipt['error'][]=array('msg'=>lang('Please enter a name!'));
                                }
 
                                if($id)
@@ -648,20 +645,20 @@
 
                                if(!$receipt['error'])
                                {
-                                       $receipt = $this->bo->save($values);
+                                       $receipt = 
$this->bo->save_type($values);
                                        $id = $receipt['id'];
 
                                        if (isset($values['save']) && 
$values['save'])
                                        {
                                                
$GLOBALS['phpgw']->session->appsession('session_data','responsible_receipt',$receipt);
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiresponsible.index', 'app' => $this->appname));
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiresponsible.index', 'appname' => $this->appname));
                                        }
                                }
                        }
 
                        if (isset($values['cancel']) && $values['cancel'])
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiresponsible.index', 'app' => $this->appname));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiresponsible.index', 'appname' => $this->appname));
                        }
 
                        if ($id)
@@ -701,13 +698,13 @@
                        }
 
                        $location_list = array();
-                       foreach ( $locations as $location => $descr )
+                       foreach ( $locations as $_location => $descr )
                        {
                                $location_list[] = array
                                        (
-                                               'id'            => $location,
-                                               'name'          => "{$location} 
[{$descr}]",
-                                               'selected'      => $location == 
$selected_location
+                                               'id'            => $_location,
+                                               'name'          => 
"{$_location} [{$descr}]",
+                                               'selected'      => $_location 
== $selected_location
                                        );
                        }
 
@@ -733,7 +730,7 @@
                                if ($this->acl->check('admin', PHPGW_ACL_EDIT, 
$module['appname']))
                                {
                                        $_checked = $module['active'] ? 
'checked = "checked"' : '';
-                                       $module['active'] = "<input 
type='checkbox' name='values[set active][]' {$_checked} 
value='{$module['location_id']}_{$module['cat_id']}' title='".lang('Check to 
set active')."'>";
+                                       $module['active'] = "<input 
type='checkbox' name='values[set_active][]' {$_checked} 
value='{$module['location_id']}_{$module['cat_id']}' title='".lang('Check to 
set active')."'>";
                                        $module['delete_module'] = "<input 
type='checkbox' name='values[delete_module][]' 
value='{$module['location_id']}_{$module['cat_id']}' title='".lang('Check to 
delete')."'>";
                                }
                        }
@@ -761,6 +758,7 @@
                                        'msgbox_data'                           
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                        'form_action'                           
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                        'value_appname'                         
        => $this->appname,
+                                       'value_location'                        
        => $location,
                                        'value_id'                              
                => $id,
                                        'value_name'                            
        => $values['name'],
                                        'value_descr'                           
        => $values['descr'],
@@ -799,143 +797,144 @@
                }
 
 
-
-               /**
-                * Add or Edit available responsible types
-                *
-                * @return void
-                */
-
-               public function edit_type()
+               function edit_role()
                {
-                       if(!$this->acl_add)
+                       if(!$this->acl_add && !$this->acl_edit)
                        {
-                               $this->no_access();
-                               return;
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
                        }
 
-                       
if(!$GLOBALS['phpgw']->locations->get_id($this->appname, $this->location))
-                       {
-                               $receipt['error'][]=array('msg'=>lang('not a 
valid location!'));
-                       }
+                       $id                     = phpgw::get_var('id', 'int');
+                       $location       = phpgw::get_var('location', 'string');
+                       $values         = phpgw::get_var('values');
 
-                       $id             = phpgw::get_var('id', 'int');
-                       $values = phpgw::get_var('values', 'string', 'POST');
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('responsible'));
-
-                       if (isset($values) && is_array($values))
+                       if ((isset($values['save']) && $values['save']) || 
(isset($values['apply']) && $values['apply']))
                        {
-                               if(!$this->acl_edit)
+                               if($GLOBALS['phpgw']->session->is_repost())
                                {
-                                       $this->no_access();
-                                       return;
+       //                              
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
                                }
 
-                               if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
+                               if(!isset($values['location']) || 
!$values['location'])
                                {
-                                       $values['location'] = $this->location;
-                                       if(!$values['cat_id'] || 
$values['cat_id'] == 'none')
-                                       {
-                                               //                      
$receipt['error'][]=array('msg'=>lang('Please select a category!'));
-                                       }
-                                       if(!$values['name'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
-                                       }
+       //                              
$receipt['error'][]=array('msg'=>lang('Please select a location!'));
+                               }
 
-                                       if($id)
-                                       {
-                                               $values['id']=$id;
-                                       }
+                               if(!isset($values['name']) || !$values['name'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please enter a name!'));
+                               }
 
-                                       if(!isset($receipt['error']) || 
!$receipt['error'])
-                                       {
-                                               $receipt = 
$this->bo->save_type($values);
-                                               $id = $receipt['id'];
-
-                                               if (isset($values['save']) && 
$values['save'])
-                                               {
-                                                       
$GLOBALS['phpgw']->session->appsession('session_data', 'responsible_receipt', 
$receipt);
-                                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array
-                                                               (
-                                                                       
'menuaction'=> 'property.uiresponsible.index',
-                                                                       
'appname'       => $this->appname,
-                                                                       
'location' => $this->location
-                                                               ));
-                                               }
-                                       }
+                               if($id)
+                               {
+                                       $values['id']=$id;
                                }
                                else
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array
-                                               (
-                                                       'menuaction'=> 
'property.uiresponsible.index',
-                                                       'appname'       => 
$this->appname,
-                                                       'location' => 
$this->location
-                                               ));
+                                       $id = $values['id'];
                                }
+
+                               if(!$receipt['error'])
+                               {
+                                       $receipt = 
$this->bo->save_role($values);
+                                       $id = $receipt['id'];
+
+                                       if (isset($values['save']) && 
$values['save'])
+                                       {
+                                               
$GLOBALS['phpgw']->session->appsession('session_data','responsible_receipt',$receipt);
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uigeneric.index', 'type' => 'responsibility_role', 'appname' => 
$this->appname));
+                                       }
+                               }
                        }
 
+                       if (isset($values['cancel']) && $values['cancel'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uigeneric.index', 'type' => 'responsibility_role', 'appname' => 
$this->appname));
+                       }
 
                        if ($id)
                        {
-                               $function_msg = lang('edit responsible type');
-                               $values = $this->bo->read_single_type($id);
+                               $values = $this->bo->read_single_role($id);
+                               $function_msg = lang('edit role');
+/*
+                               $this->acl->set_account_id($this->account);
+                               $grants = 
$this->acl->get_grants('property','.responsible');
+                               
if(!$this->bocommon->check_perms($grants[$values['user_id']], PHPGW_ACL_READ))
+                               {
+                                       $values = array();
+                                       
$receipt['error'][]=array('msg'=>lang('You are not granted sufficient rights 
for this entry'));
+                               }
+
+*/
                        }
                        else
                        {
-                               $function_msg = lang('add responsible type');
+                               $function_msg = lang('add role');
                        }
 
+
                        $link_data = array
-                               (
-                                       'menuaction'    => 
'property.uiresponsible.edit_type',
-                                       'id'                    => $id,
-                                       'appname'               => 
$this->appname,
-                                       'location'              => 
$this->location
-                               );
+                       (
+                               'menuaction'    => 
'property.uiresponsible.edit_role',
+                               'id'            => $id,
+                               'app'           => $this->appname
+                       );
 
-                       $msgbox_data = 
(isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'');
+                       $location_types = 
execMethod('property.soadmin_location.get_location_type');
 
-                       $data = array
-                               (
-                                       'value_entry_date'                      
        => isset($values['entry_date']) ? $values['entry_date'] : '',
-                                       'value_name'                            
        => isset($values['name']) ? $values['name'] : '',
-                                       'value_descr'                           
        => isset($values['descr']) ? $values['descr'] : '',
-                                       'value_active'                          
        => isset($values['active']) ? $values['active'] : '',
+                       $levels = isset($values['location_level']) && 
$values['location_level'] ? $values['location_level'] : array();
+                       $level_list = array();
+                       foreach ( $location_types as $location_type )
+                       {
+                               $level_list[] = array
+                                       (
+                                               'id'            => 
$location_type['id'],
+                                               'name'          =>  
$location_type['name'],
+                                               'selected'      => 
in_array($location_type['id'], $levels)
+                                       );
+                       }
+                       //-----------------------------------------------
 
-                                       'lang_entry_date'                       
        => lang('Entry date'),
-                                       'lang_name'                             
                => lang('name'),
-                                       'lang_descr'                            
        => lang('descr'),
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($receipt);
 
+                       $data = array
+                               (
                                        'msgbox_data'                           
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                                       'form_action'                           
        => $GLOBALS['phpgw']->link('/index.php', $link_data),
-                                       'lang_id'                               
                => lang('ID'),
-                                       'lang_save'                             
                => lang('save'),
-                                       'lang_cancel'                           
        => lang('cancel'),
+                                       'form_action'                           
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                                       'value_appname'                         
        => $this->appname,
+                                       'value_location'                        
        => $location,
                                        'value_id'                              
                => $id,
-                                       'lang_active'                           
        => lang('active'),
-                                       'lang_active_on_statustext'             
=> lang('set this item inactive'),
-                                       'lang_active_off_statustext'    => 
lang('set this item active'),
-                                       'lang_cancel_status_text'               
=> lang('Back to the list'),
-                                       'lang_save_status_text'                 
=> lang('Save the responsible type'),
-                                       'lang_apply'                            
        => lang('apply'),
-                                       'lang_apply_status_text'                
=> lang('Apply the values'),
-
-                                       'lang_category'                         
        => lang('category'),
-                                       'lang_no_cat'                           
        => lang('no category'),
-                                       'cat_select'                            
        => $this->cats->formatted_xslt_list(array
-                                       (
-                                               'select_name' => 
'values[cat_id]',
-                                               'selected' => 
isset($values['cat_id'])?$values['cat_id']:''
-                                       )),
+                                       'value_name'                            
        => $values['name'],
+                                       'value_remark'                          
        => $values['remark'],
+                                       'value_access'                          
        => $values['access'],
+                                       'responsibility_list'                   
=> array('options' => execMethod('property.boresponsible.get_responsibilities', 
array('appname' => $this->appname,      'selected' => 
$values['responsibility_id']))),
+                                       'level_list'                            
        => array('checkbox' => $level_list),
+                                       'td_count'                              
                => '""',
+                                       'base_java_url'                         
        => "{menuaction:'property.uiresponsible.edit'}",
+                                       'property_js'                           
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                                       'datatable'                             
                => $datavalues,
+                                       'myColumnDefs'                          
        => $myColumnDefs,
                                );
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('responsible matrix') . "::{$this->location}::{$function_msg}";
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit_type' => $data));
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('loader');
+
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'responsible.edit', 'property' );
+                       //-----------------------datatable settings---
+
+                       $appname                                                
= 'Responsible';
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::$function_msg::".lang($this->appname);
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('responsible'));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_role' => $data));
                }
 
+
+
                /**
                 * List of contacts given responsibilities within locations
                 *

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-03-01 11:49:49 UTC (rev 
8959)
+++ trunk/property/setup/tables_current.inc.php 2012-03-02 07:35:48 UTC (rev 
8960)
@@ -2160,7 +2160,7 @@
                                'id' => array('type' => 'auto', 'precision' => 
4,'nullable' => False),
                                'name' => array('type' => 'varchar', 
'precision' => 200,'nullable' => False),
                                'remark' => array('type' => 'text','nullable' 
=> True),
-                               'location' => array('type' => 'varchar', 
'precision' => 200,'nullable' => False),
+                               'location_level' => array('type' => 'varchar', 
'precision' => 200),
                                'responsibility_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'appname' => array('type' => 'varchar', 
'precision' => 25,'nullable' => False),
                                'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-03-01 11:49:49 UTC (rev 
8959)
+++ trunk/property/setup/tables_update.inc.php  2012-03-02 07:35:48 UTC (rev 
8960)
@@ -5973,6 +5973,29 @@
                
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_responsibility',array(),'cat_id');
                
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_responsibility',array(),'active');
 
+
+               
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_responsibility_role','location','location_level');
             
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_responsibility_role','location_level',array('type'
 => 'varchar','precision' => '200','nullable' => True));
+
+               $sql = 'SELECT * FROM fm_responsibility_role';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               $roles = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $roles[] = array
+                       (
+                               'id' => $GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'location_level' => explode(',', 
ltrim($GLOBALS['phpgw_setup']->oProc->f('location_level'), '.location.'))
+                       );
+               }
+
+               foreach ($roles as $role)
+               {
+                       $sql = 'UPDATE fm_responsibility_role SET 
location_level = ' . implode(',', $role['location_level']) . " WHERE id = 
{$role['id']}";                     
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);          
+               }
+
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.635';

Modified: trunk/property/templates/base/responsible.xsl
===================================================================
--- trunk/property/templates/base/responsible.xsl       2012-03-01 11:49:49 UTC 
(rev 8959)
+++ trunk/property/templates/base/responsible.xsl       2012-03-02 07:35:48 UTC 
(rev 8960)
@@ -4,9 +4,6 @@
                        <xsl:when test="edit">
                                <xsl:apply-templates select="edit"/>
                        </xsl:when>
-                       <xsl:when test="edit_type">
-                               <xsl:apply-templates select="edit_type"/>
-                       </xsl:when>
                        <xsl:when test="edit_contact">
                                <xsl:apply-templates select="edit_contact"/>
                        </xsl:when>
@@ -19,8 +16,8 @@
                </xsl:choose>
        </xsl:template>
 
+       <!-- add / edit responsibility type-->
 
-       <!-- add / edit  -->
        <xsl:template xmlns:php="http://php.net/xsl"; match="edit">
                <xsl:variable name="form_action">
                        <xsl:value-of select="form_action"/>
@@ -212,172 +209,142 @@
                </script>
        </xsl:template>
 
-       <!-- New template-->
-       <xsl:template match="list_type">
-               <xsl:variable name="responsible_action">
-                       <xsl:value-of select="responsible_action"/>
+       <!-- add / edit  -->
+       <xsl:template xmlns:php="http://php.net/xsl"; match="edit_role">
+               <xsl:variable name="form_action">
+                       <xsl:value-of select="form_action"/>
                </xsl:variable>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <xsl:choose>
-                               <xsl:when test="msgbox_data != ''">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                       <tr>
+                               <td>
+                                       <table cellpadding="2" cellspacing="2" 
align="left">
+                                               <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>
                                        <tr>
-                                               <td align="left" colspan="3">
-                                                       <xsl:call-template 
name="msgbox"/>
+                                               <td>
+                                                       <form name="form" 
method="post" action="{$form_action}">
+                                                               <table 
cellpadding="2" cellspacing="2" align="left">
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="value_id != ''">
+                                                                               
        <tr>
+                                                                               
                <td valign="top">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'id')"/>
+                                                                               
                </td>
+                                                                               
                <td>
+                                                                               
                        <xsl:value-of select="value_id"/>
+                                                                               
                </td>
+                                                                               
        </tr>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                                       <tr>
+                                                                               
<td>
+                                                                               
        <xsl:value-of select="php:function('lang', 'name')"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <input type="text" name="values[name]" value="{value_name}" size="60">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'name')"/>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
</td>
+                                                                       </tr>
+                                                                       <tr>
+                                                                               
<td valign="top">
+                                                                               
        <xsl:value-of select="php:function('lang', 'descr')"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <textarea cols="60" rows="10" name="values[remark]">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'descr')"/>
+                                                                               
                </xsl:attribute>
+                                                                               
                <xsl:value-of select="value_remark"/>
+                                                                               
        </textarea>
+                                                                               
</td>
+                                                                       </tr>
+                                                                       <tr>
+                                                                               
<td>
+                                                                               
        <xsl:value-of select="php:function('lang', 'responsibility')"/>
+                                                                               
</td>
+                                                                               
<td align="left">
+                                                                               
        <select name="values[responsibility_id]">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'Select 
submodule')"/>
+                                                                               
                </xsl:attribute>
+                                                                               
                <option value="">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'select')"/>
+                                                                               
                </option>
+                                                                               
                <xsl:apply-templates select="responsibility_list/options"/>
+                                                                               
        </select>
+                                                                               
</td>
+                                                                       </tr>
+
+                                                                       <tr>
+                                                                               
<td valign = 'top'>
+                                                                               
        <xsl:value-of select="php:function('lang', 'level')"/>
+                                                                               
</td>
+                                                                               
<td align="left">
+                                                                               
        <table>
+                                                                               
                <xsl:apply-templates select="level_list/checkbox"/>
+                                                                               
        </table>
+                                                                               
</td>
+                                                                       </tr>
+
+                                                                       <tr>
+                                                                               
<td colspan="2">
+                                                                               
        <table cellpadding="2" cellspacing="2" width="50%" align="center">
+                                                                               
                <xsl:variable name="lang_save">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'save')"/>
+                                                                               
                </xsl:variable>
+                                                                               
                <xsl:variable name="lang_apply">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'apply')"/>
+                                                                               
                </xsl:variable>
+                                                                               
                <xsl:variable name="lang_cancel">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'cancel')"/>
+                                                                               
                </xsl:variable>
+                                                                               
                <tr height="50">
+                                                                               
                        <td>
+                                                                               
                                <input type="submit" name="values[save]" 
value="{$lang_save}">
+                                                                               
                                        <xsl:attribute name="title">
+                                                                               
                                                <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                                                               
                                        </xsl:attribute>
+                                                                               
                                </input>
+                                                                               
                        </td>
+                                                                               
                        <td>
+                                                                               
                                <input type="submit" name="values[apply]" 
value="{$lang_apply}">
+                                                                               
                                        <xsl:attribute name="title">
+                                                                               
                                                <xsl:value-of 
select="php:function('lang', 'apply')"/>
+                                                                               
                                        </xsl:attribute>
+                                                                               
                                </input>
+                                                                               
                        </td>
+                                                                               
                        <td>
+                                                                               
                                <input type="submit" name="values[cancel]" 
value="{$lang_cancel}">
+                                                                               
                                        <xsl:attribute name="title">
+                                                                               
                                                <xsl:value-of 
select="php:function('lang', 'cancel')"/>
+                                                                               
                                        </xsl:attribute>
+                                                                               
                                </input>
+                                                                               
                        </td>
+                                                                               
                </tr>
+                                                                               
        </table>
+                                                                               
</td>
+                                                                       </tr>
+                                                               </table>
+                                                       </form>
                                                </td>
                                        </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <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">
-                       <xsl:apply-templates select="table_header_type"/>
-                       <xsl:choose>
-                               <xsl:when test="values_type != ''">
-                                       <xsl:apply-templates 
select="values_type"/>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
-                               <xsl:when test="table_add != ''">
-                                       <xsl:apply-templates 
select="table_add"/>
-                               </xsl:when>
-                       </xsl:choose>
-               </table>
        </xsl:template>
 
        <!-- New template-->
-       <xsl:template match="table_header_type">
-               <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="30%" align="center">
-                               <xsl:value-of select="lang_descr"/>
-                       </td>
-                       <td class="th_text" width="10%" align="center">
-                               <xsl:value-of select="lang_category"/>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_created_by"/>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_app_name"/>
-                       </td>
-                       <td class="th_text" width="1%" align="center">
-                               <xsl:value-of select="lang_active"/>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_contacts"/>
-                       </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>
-
-       <!-- New template-->
-       <xsl:template match="values_type">
-               <tr>
-                       <xsl:attribute name="class">
-                               <xsl:choose>
-                                       <xsl:when test="position() mod 2 = 0">
-                                               <xsl:text>row_off</xsl:text>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <xsl:text>row_on</xsl:text>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </xsl:attribute>
-                       <td align="left">
-                               <xsl:value-of select="name"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="descr"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="category"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="created_by"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="app_name"/>
-                       </td>
-                       <td align="center">
-                               <xsl:value-of select="active"/>
-                       </td>
-                       <td align="center" title="{lang_contacts_text}">
-                               <xsl:variable name="link_contacts">
-                                       <xsl:value-of select="link_contacts"/>
-                               </xsl:variable>
-                               <a href="{link_contacts}">
-                                       <xsl:value-of select="text_contacts"/>
-                               </a>
-                       </td>
-                       <xsl:choose>
-                               <xsl:when test="link_edit != ''">
-                                       <td align="center" 
title="{lang_edit_text}">
-                                               <xsl:variable name="link_edit">
-                                                       <xsl:value-of 
select="link_edit"/>
-                                               </xsl:variable>
-                                               <a href="{link_edit}">
-                                                       <xsl:value-of 
select="text_edit"/>
-                                               </a>
-                                       </td>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
-                               <xsl:when test="link_delete != ''">
-                                       <td align="center" 
title="{lang_delete_text}">
-                                               <xsl:variable 
name="link_delete">
-                                                       <xsl:value-of 
select="link_delete"/>
-                                               </xsl:variable>
-                                               <a href="{link_delete}">
-                                                       <xsl:value-of 
select="text_delete"/>
-                                               </a>
-                                       </td>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
-                               <xsl:when test="lang_select != ''">
-                                       <form>
-                                               <td class="small_text" 
valign="top">
-                                                       <input type="hidden" 
name="" value="{id}"/>
-                                                       <input type="hidden" 
name="" value="{name}"/>
-                                                       <input type="button" 
name="select" value="{lang_select}" onClick="Exchange_values(this.form);" 
onMouseout="window.status='';return true;">
-                                                               <xsl:attribute 
name="onMouseover">
-                                                                       
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_select_statustext"/>
-                                                                       
<xsl:text>'; return true;</xsl:text>
-                                                               </xsl:attribute>
-                                                       </input>
-                                               </td>
-                                       </form>
-                               </xsl:when>
-                       </xsl:choose>
-               </tr>
-       </xsl:template>
-
-       <!-- New template-->
        <xsl:template match="list_contact">
                <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
                        <xsl:choose>
@@ -583,137 +550,6 @@
                </tr>
        </xsl:template>
 
-       <!-- New template-->
-       <!-- add / edit responsibility type-->
-       <xsl:template match="edit_type">
-               <div align="left">
-                       <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>
-                                       <xsl:choose>
-                                               <xsl:when test="value_id != ''">
-                                                       <tr>
-                                                               <td 
valign="top" width="30%">
-                                                                       
<xsl:value-of select="lang_id"/>
-                                                               </td>
-                                                               <td 
align="left">
-                                                                       
<xsl:value-of select="value_id"/>
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td 
valign="top">
-                                                                       
<xsl:value-of select="lang_entry_date"/>
-                                                               </td>
-                                                               <td>
-                                                                       
<xsl:value-of select="value_entry_date"/>
-                                                               </td>
-                                                       </tr>
-                                               </xsl:when>
-                                       </xsl:choose>
-                                       <tr>
-                                               <td>
-                                                       <xsl:value-of 
select="lang_category"/>
-                                               </td>
-                                               <td>
-                                                       <xsl:call-template 
name="categories"/>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td valign="top" width="10%" 
title="{lang_name_status_text}">
-                                                       <xsl:value-of 
select="lang_name"/>
-                                               </td>
-                                               <td>
-                                                       <input type="text" 
size="60" name="values[name]" value="{value_name}" 
onMouseout="window.status='';return true;">
-                                                       </input>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td valign="top" 
title="{lang_descr_status_text}">
-                                                       <xsl:value-of 
select="lang_descr"/>
-                                               </td>
-                                               <td>
-                                                       <textarea cols="60" 
rows="10" name="values[descr]" onMouseout="window.status='';return true;">
-                                                               <xsl:value-of 
select="value_descr"/>
-                                                       </textarea>
-                                               </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="title">
-                                                                               
        <xsl:value-of select="lang_active_on_statustext"/>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       <input 
type="checkbox" name="values[active]" value="1" 
onMouseout="window.status='';return true;">
-                                                                               
<xsl:attribute name="title">
-                                                                               
        <xsl:value-of select="lang_active_off_statustext"/>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                               </xsl:otherwise>
-                                                       </xsl:choose>
-                                               </td>
-                                       </tr>
-                                       <tr height="50">
-                                               <td colspan="2" align="center">
-                                                       <table>
-                                                               <tr>
-                                                                       <td 
valign="bottom">
-                                                                               
<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="title">
-                                                                               
                <xsl:value-of select="lang_save_status_text"/>
-                                                                               
        </xsl:attribute>
-                                                                               
</input>
-                                                                       </td>
-                                                                       <td 
valign="bottom">
-                                                                               
<xsl:variable name="lang_apply">
-                                                                               
        <xsl:value-of select="lang_apply"/>
-                                                                               
</xsl:variable>
-                                                                               
<input type="submit" name="values[apply]" value="{$lang_apply}" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:attribute name="title">
-                                                                               
                <xsl:value-of select="lang_apply_status_text"/>
-                                                                               
        </xsl:attribute>
-                                                                               
</input>
-                                                                       </td>
-                                                                       <td 
align="left" valign="bottom">
-                                                                               
<xsl:variable name="lang_cancel">
-                                                                               
        <xsl:value-of select="lang_cancel"/>
-                                                                               
</xsl:variable>
-                                                                               
<input type="submit" name="values[cancel]" value="{$lang_cancel}" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:attribute name="title">
-                                                                               
                <xsl:value-of select="lang_cancel_status_text"/>
-                                                                               
        </xsl:attribute>
-                                                                               
</input>
-                                                                       </td>
-                                                               </tr>
-                                                       </table>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </form>
-               </div>
-       </xsl:template>
-
        <!-- add / edit contact-->
        <xsl:template match="edit_contact">
                <div align="left">
@@ -884,3 +720,19 @@
                </option>
        </xsl:template>
 
+       <!-- New template-->
+       <xsl:template match="checkbox">
+               <tr>
+                       <td value="{id}">
+                               <input type="checkbox" 
name="values[location_level][]" value="{id}">
+                                       <xsl:attribute name="title">
+                                               <xsl:value-of select="name"/>
+                                       </xsl:attribute>
+                                       <xsl:if test="selected != 0">
+                                               <xsl:attribute name="checked" 
value="checked"/>
+                                       </xsl:if>
+                               </input>
+                               <xsl:value-of select="name"/>
+                       </td>
+               </tr>
+       </xsl:template>




reply via email to

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