fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13031] convert edit_attrib_group


From: Sigurd Nes
Subject: [Fmsystem-commits] [13031] convert edit_attrib_group
Date: Fri, 17 Apr 2015 11:00:26 +0000

Revision: 13031
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13031
Author:   sigurdne
Date:     2015-04-17 11:00:25 +0000 (Fri, 17 Apr 2015)
Log Message:
-----------
convert edit_attrib_group

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php
    branches/dev-syncromind/property/inc/class.boadmin_entity.inc.php
    branches/dev-syncromind/property/inc/class.uiadmin_entity.inc.php
    branches/dev-syncromind/property/setup/phpgw_no.lang

Modified: branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php    
2015-04-16 23:41:56 UTC (rev 13030)
+++ branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php    
2015-04-17 11:00:25 UTC (rev 13031)
@@ -1207,7 +1207,7 @@
                        $querymethod = '';
                        if ( $query )
                        {
-                               $querymethod = "AND 
(phpgw_cust_attribute_group.name {$this->_like} '%{$query}%'";
+                               $querymethod = "AND 
phpgw_cust_attribute_group.name {$this->_like} '%{$query}%'";
                        }
 
                        $sql = "SELECT * FROM phpgw_cust_attribute_group "

Modified: branches/dev-syncromind/property/inc/class.boadmin_entity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.boadmin_entity.inc.php   
2015-04-16 23:41:56 UTC (rev 13030)
+++ branches/dev-syncromind/property/inc/class.boadmin_entity.inc.php   
2015-04-17 11:00:25 UTC (rev 13031)
@@ -1,5 +1,4 @@
 <?php
-
        /**
         * phpGroupWare - property: a Facilities Management System.
         *
@@ -80,95 +79,94 @@
                 */
                protected $custom;
                var $public_functions = array
-               (
-                       'read'                          => true,
-                       'read_single'           => true,
-                       'save'                          => true,
-                       'delete'                        => true,
-                       'check_perms'           => true,
-                       'get_category_list'     => true,
-                       'get_attrib_list'       => true
+                       (
+                       'read'                           => true,
+                       'read_single'            => true,
+                       'save'                           => true,
+                       'delete'                         => true,
+                       'check_perms'            => true,
+                       'get_category_list'      => true,
+                       'get_attrib_list'        => true
                );
                var $type_app;
 
-               function __construct( $session = false )
+               function __construct($session = false)
                {
-                       $this->bocommon  = CreateObject( 'property.bocommon' );
-                       $this->custom    = createObject( 
'property.custom_fields' );
+                       $this->bocommon  = CreateObject('property.bocommon');
+                       $this->custom    = 
createObject('property.custom_fields');
 
-                       if ( $session )
+                       if($session)
                        {
                                $this->read_sessiondata();
                                $this->use_session = true;
                        }
 
-                       $start           = phpgw::get_var( 'start', 'int', 
'REQUEST', 0 );
-                       $query           = phpgw::get_var( 'query' );
-                       $sort            = phpgw::get_var( 'sort' );
-                       $order           = phpgw::get_var( 'order' );
-                       $type            = phpgw::get_var( 'type' );
-                       $cat_id          = phpgw::get_var( 'cat_id', 'int' );
-                       $allrows         = phpgw::get_var( 'allrows', 'bool' );
-                       $entity_id       = phpgw::get_var( 'entity_id', 'int' );
+                       $start           = phpgw::get_var('start', 'int', 
'REQUEST', 0);
+                       $query           = phpgw::get_var('query');
+                       $sort            = phpgw::get_var('sort');
+                       $order           = phpgw::get_var('order');
+                       $type            = phpgw::get_var('type');
+                       $cat_id          = phpgw::get_var('cat_id', 'int');
+                       $allrows         = phpgw::get_var('allrows', 'bool');
+                       $entity_id       = phpgw::get_var('entity_id', 'int');
 
-                       $this->start             = $start ? $start : 0;
-                       $this->query             = isset( $query ) ? $query : 
$this->query;
-                       $this->sort                      = isset( $sort ) && 
$sort ? $sort : '';
-                       $this->order             = isset( $order ) && $order ? 
$order : '';
-                       $this->type                      = isset( $type ) && 
$type && isset( $this->type_app[$type] ) ? $type : 'entity';
-                       $this->cat_id            = isset( $cat_id ) && $cat_id 
? $cat_id : '';
-                       $this->entity_id         = isset( $entity_id ) && 
$entity_id ? $entity_id : '';
-                       $this->allrows           = phpgw::get_var( 'allrows', 
'bool' );
-                       $this->so                        = CreateObject( 
'property.soadmin_entity', '', '',
-                                                               $this->bocommon 
);
-                       $this->so->type         = $this->type;
-                       $this->type_app         = $this->so->get_type_app();
+                       $this->start     = $start ? $start : 0;
+                       $this->query     = isset($query) ? $query : 
$this->query;
+                       $this->sort              = isset($sort) && $sort ? 
$sort : '';
+                       $this->order     = isset($order) && $order ? $order : 
'';
+                       $this->type              = isset($type) && $type && 
isset($this->type_app[$type]) ? $type : 'entity';
+                       $this->cat_id    = isset($cat_id) && $cat_id ? $cat_id 
: '';
+                       $this->entity_id = isset($entity_id) && $entity_id ? 
$entity_id : '';
+                       $this->allrows   = phpgw::get_var('allrows', 'bool');
+                       $this->so                = 
CreateObject('property.soadmin_entity', '', '', $this->bocommon);
+                       $this->so->type  = $this->type;
+                       $this->type_app  = $this->so->get_type_app();
                }
 
-               function save_sessiondata( $data )
+               function save_sessiondata($data)
                {
-                       if ( $this->use_session )
+                       if($this->use_session)
                        {
-                               $GLOBALS['phpgw']->session->appsession( 
'session_data', 'standard_e', $data );
+                               
$GLOBALS['phpgw']->session->appsession('session_data', 'standard_e', $data);
                        }
                }
 
                function read_sessiondata()
                {
-                       $data = $GLOBALS['phpgw']->session->appsession( 
'session_data', 'standard_e' );
+                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data', 'standard_e');
 
-                       $this->start     = isset( $data['start'] ) ? 
$data['start'] : '';
-                       $this->query     = isset( $data['query'] ) ? 
$data['query'] : '';
-                       $this->sort              = isset( $data['sort'] ) ? 
$data['sort'] : '';
-                       $this->order     = isset( $data['order'] ) ? 
$data['order'] : '';
-                       $this->cat_id    = isset( $data['cat_id'] ) ? 
$data['cat_id'] : '';
-                       $this->entity_id = isset( $data['entity_id'] ) ? 
$data['entity_id'] : '';
-                       $this->allrows   = isset( $data['allrows'] ) ? 
$data['allrows'] : '';
+                       $this->start     = isset($data['start']) ? 
$data['start'] : '';
+                       $this->query     = isset($data['query']) ? 
$data['query'] : '';
+                       $this->sort              = isset($data['sort']) ? 
$data['sort'] : '';
+                       $this->order     = isset($data['order']) ? 
$data['order'] : '';
+                       $this->cat_id    = isset($data['cat_id']) ? 
$data['cat_id'] : '';
+                       $this->entity_id = isset($data['entity_id']) ? 
$data['entity_id'] : '';
+                       $this->allrows   = isset($data['allrows']) ? 
$data['allrows'] : '';
                }
 
-               function get_location_level_list( $selected = '' )
+               function get_location_level_list($selected = '')
                {
 
-                       $soadmin_location        = CreateObject( 
'property.soadmin_location' );
+                       $soadmin_location        = 
CreateObject('property.soadmin_location');
                        $location_types          = 
$soadmin_location->select_location_type();
-                       $max_location_type       = count( $location_types );
+                       $max_location_type       = count($location_types);
 
-                       for ( $i = 1; $i <= $max_location_type; $i++ )
+                       for($i = 1; $i <= $max_location_type; $i++)
                        {
                                $location[$i]['id']              = $i;
                                $location[$i]['name']    = $i . '-' . 
$location_types[($i - 1)]['name'];
                        }
 
-                       return $this->bocommon->select_list( $selected, 
$location );
+                       return $this->bocommon->select_list($selected, 
$location);
                }
 
-               function get_entity_list( $selected = '' )
+               function get_entity_list($selected = '')
                {
-                       $list = $this->so->read( array('allrows' => true) );
-                       return $this->bocommon->select_multi_list( $selected, 
$list );
+                       $list = $this->so->read(array('allrows' => true));
+                       return $this->bocommon->select_multi_list($selected, 
$list);
                }
 
-               function get_entity_list_2( $selected = '' )
+               function get_entity_list_2($selected = '')
                {
                        $list[0]['id']   = 'project';
                        $list[0]['name'] = 'project';
@@ -182,112 +180,109 @@
                        $list[4]['name'] = 'investment';
                        $list[5]['id']   = 's_agreement';
                        $list[5]['name'] = 'service agreement';
-                       return $this->bocommon->select_multi_list( $selected, 
$list );
+                       return $this->bocommon->select_multi_list($selected, 
$list);
                }
 
-               function get_entity_list_3( $selected = '' )
+               function get_entity_list_3($selected = '')
                {
                        $list[0]['id']   = 'ticket';
                        $list[0]['name'] = 'ticket';
                        $list[1]['id']   = 'request';
                        $list[1]['name'] = 'request';
-                       return $this->bocommon->select_multi_list( $selected, 
$list );
+                       return $this->bocommon->select_multi_list($selected, 
$list);
                }
 
                function read($data = array())
-               {       
+               {
                        #$entity = $this->so->read(array
-                        #            (
-                        #                'start'=> $this->start, 
-                        #                'query'=> $this->query, 
-                        #                'sort'=> $this->sort, 
-                        #                'order'=> $this->order, 
-                        #                'allrows'=> $this->allrows
-                        #            ));
-                        $entity = $this->so->read($data);
+                       #            (
+                       #                'start'=> $this->start,
+                       #                'query'=> $this->query,
+                       #                'sort'=> $this->sort,
+                       #                'order'=> $this->order,
+                       #                'allrows'=> $this->allrows
+                       #            ));
+                       $entity                          = 
$this->so->read($data);
                        $this->total_records = $this->so->total_records;
                        return $entity;
                }
 
                function read_category($data = array())
                {
-                       /*$category = $this->so->read_category( array
-                                    (
-                                        'start' => $this->start, 
-                                        'query' => $this->query, 
-                                        'sort' => $this->sort,
-                                        'order' => $this->order, 
-                                        'allrows' => $this->allrows, 
-                                        'entity_id' => $entity_id
-                                    ));
-                         */
-                        $category = $this->so->read_category($data);
+                       /* $category = $this->so->read_category( array
+                         (
+                         'start' => $this->start,
+                         'query' => $this->query,
+                         'sort' => $this->sort,
+                         'order' => $this->order,
+                         'allrows' => $this->allrows,
+                         'entity_id' => $entity_id
+                         ));
+                        */
+                       $category                        = 
$this->so->read_category($data);
                        $this->total_records = $this->so->total_records;
 
                        return $category;
                }
 
-
                public function get_category_list()
                {
-                       $entity_id              = 
phpgw::get_var('entity_id','int');
-                       return 
$this->so->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+                       $entity_id = phpgw::get_var('entity_id', 'int');
+                       return $this->so->read_category(array('allrows' => 
true, 'entity_id' => $entity_id));
                }
 
-
                /**
-               * Fetch custom attributes for an given komponent type
-               */
+                * Fetch custom attributes for an given komponent type
+                */
                public function get_attrib_list()
                {
-                       $entity_id              = phpgw::get_var('entity_id');
-                       $cat_id                 = phpgw::get_var('cat_id');
+                       $entity_id       = phpgw::get_var('entity_id');
+                       $cat_id          = phpgw::get_var('cat_id');
 
-                       return 
$this->custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, 
'','','',true, true);
+                       return $this->custom->find('property', 
".entity.{$entity_id}.{$cat_id}", 0, '', '', '', true, true);
                }
 
-
-               function read_single( $id )
+               function read_single($id)
                {
-                       return $this->so->read_single( $id );
+                       return $this->so->read_single($id);
                }
 
-               function read_single_category( $entity_id, $cat_id )
+               function read_single_category($entity_id, $cat_id)
                {
-                       return $this->so->read_single_category( $entity_id, 
$cat_id );
+                       return $this->so->read_single_category($entity_id, 
$cat_id);
                }
 
-               function save( $values, $action = '' )
+               function save($values, $action = '')
                {
-                       if ( $action == 'edit' )
+                       if($action == 'edit')
                        {
-                               if ( $values['id'] != '' )
+                               if($values['id'] != '')
                                {
-                                       $receipt = $this->so->edit_entity( 
$values );
+                                       $receipt = 
$this->so->edit_entity($values);
                                }
                        }
                        else
                        {
-                               $receipt = $this->so->add_entity( $values );
-                               execMethod( 'phpgwapi.menu.clear' );
+                               $receipt = $this->so->add_entity($values);
+                               execMethod('phpgwapi.menu.clear');
                        }
                        return $receipt;
                }
 
-               function save_category( $values, $action = '' )
+               function save_category($values, $action = '')
                {
-                       if ( $action == 'edit' )
+                       if($action == 'edit')
                        {
-                               if ( $values['id'] != '' )
+                               if($values['id'] != '')
                                {
-                                       $receipt = $this->so->edit_category( 
$values );
+                                       $receipt = 
$this->so->edit_category($values);
                                }
                        }
                        else
                        {
-                               $receipt = $this->so->add_category( $values );
-                               execMethod( 'phpgwapi.menu.clear' );
-                               if ( isset( $values['category_template'] ) && 
$values['category_template'] && isset( $receipt['id'] ) && $receipt['id'] )
+                               $receipt = $this->so->add_category($values);
+                               execMethod('phpgwapi.menu.clear');
+                               if(isset($values['category_template']) && 
$values['category_template'] && isset($receipt['id']) && $receipt['id'])
                                {
                                        $values2 = array
                                                (
@@ -297,22 +292,21 @@
                                                'selected'                      
 => $values['template_attrib']
                                        );
 
-                                       $this->_add_attrib_from_template( 
$values2 );
+                                       
$this->_add_attrib_from_template($values2);
                                }
                        }
                        return $receipt;
                }
 
-               protected function _add_attrib_from_template( $values )
+               protected function _add_attrib_from_template($values)
                {
-                       $template_info           = explode( '_', 
$values['category_template'] );
+                       $template_info           = explode('_', 
$values['category_template']);
                        $template_entity_id      = $template_info[0];
                        $template_cat_id         = $template_info[1];
 
-                       $attrib_group_list = $this->read_attrib_group( 
$template_entity_id,
-                                                                               
                  $template_cat_id, true );
+                       $attrib_group_list = 
$this->read_attrib_group($template_entity_id, $template_cat_id, true);
 
-                       foreach ( $attrib_group_list as $attrib_group )
+                       foreach($attrib_group_list as $attrib_group)
                        {
                                $group = array
                                        (
@@ -322,338 +316,308 @@
                                        'descr'          => 
$attrib_group['descr'],
                                        'remark'         => 
$attrib_group['remark']
                                );
-                               $this->custom->add_group( $group );
+                               $this->custom->add_group($group);
                        }
 
-                       $attrib_list = $this->read_attrib( $template_entity_id, 
$template_cat_id,
-                                                                         true 
);
+                       $attrib_list = $this->read_attrib($template_entity_id, 
$template_cat_id, true);
 
                        $template_attribs = array();
-                       foreach ( $attrib_list as $attrib )
+                       foreach($attrib_list as $attrib)
                        {
-                               if ( in_array( $attrib['id'], 
$values['selected'] ) )
+                               if(in_array($attrib['id'], $values['selected']))
                                {
-                                       $template_attribs[] = 
$this->read_single_attrib( $template_entity_id,
-                                                                               
                          $template_cat_id, $attrib['id'] );
+                                       $template_attribs[] = 
$this->read_single_attrib($template_entity_id, $template_cat_id, $attrib['id']);
                                }
                        }
 
-                       foreach ( $template_attribs as $attrib )
+                       foreach($template_attribs as $attrib)
                        {
                                $attrib['appname']       = 
$this->type_app[$this->type];
                                $attrib['location']      = 
".{$this->type}.{$values['entity_id']}.{$values['cat_id']}";
 
                                $choices = array();
-                               if ( isset( $attrib['choice'] ) && 
$attrib['choice'] )
+                               if(isset($attrib['choice']) && 
$attrib['choice'])
                                {
                                        $choices = $attrib['choice'];
-                                       unset( $attrib['choice'] );
+                                       unset($attrib['choice']);
                                }
 
-                               $id = $this->custom->add( $attrib );
-                               if ( $choices )
+                               $id = $this->custom->add($attrib);
+                               if($choices)
                                {
-                                       foreach ( $choices as $choice )
+                                       foreach($choices as $choice)
                                        {
                                                $attrib['new_choice']    = 
$choice['value'];
                                                $attrib['id']                   
 = $id;
-                                               $this->custom->edit( $attrib );
+                                               $this->custom->edit($attrib);
                                        }
                                }
                        }
                }
 
-               function delete( $cat_id = '', $entity_id = '', $attrib_id = '',
-                                  $acl_location = '', $custom_function_id = 
'', $group_id = '' )
+               function delete($cat_id = '', $entity_id = '', $attrib_id = '', 
$acl_location = '', $custom_function_id = '', $group_id = '')
                {
-                       if ( !$attrib_id && !$cat_id && $entity_id && 
!$custom_function_id && !$group_id )
+                       if(!$attrib_id && !$cat_id && $entity_id && 
!$custom_function_id && !$group_id)
                        {
-                               $this->so->delete_entity( $entity_id );
-                               execMethod( 'phpgwapi.menu.clear' );
+                               $this->so->delete_entity($entity_id);
+                               execMethod('phpgwapi.menu.clear');
                        }
-                       else if ( !$attrib_id && $cat_id && $entity_id && 
!$custom_function_id && !$group_id )
+                       else if(!$attrib_id && $cat_id && $entity_id && 
!$custom_function_id && !$group_id)
                        {
-                               $this->so->delete_category( $entity_id, $cat_id 
);
-                               execMethod( 'phpgwapi.menu.clear' );
+                               $this->so->delete_category($entity_id, $cat_id);
+                               execMethod('phpgwapi.menu.clear');
                        }
-                       else if ( $group_id && $cat_id && $entity_id && 
!$custom_function_id && !$attrib_id )
+                       else if($group_id && $cat_id && $entity_id && 
!$custom_function_id && !$attrib_id)
                        {
-                               $this->custom->delete_group( 
$this->type_app[$this->type],
-                                                                
".{$this->type}.{$entity_id}.{$cat_id}", $group_id );
+                               
$this->custom->delete_group($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $group_id);
                        }
-                       else if ( $attrib_id && $cat_id && $entity_id && 
!$custom_function_id && !$group_id )
+                       else if($attrib_id && $cat_id && $entity_id && 
!$custom_function_id && !$group_id)
                        {
-                               $this->custom->delete( 
$this->type_app[$this->type],
-                                                  
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id );
-                               $this->so->delete_history( $entity_id, $cat_id, 
$attrib_id );
+                               
$this->custom->delete($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id);
+                               $this->so->delete_history($entity_id, $cat_id, 
$attrib_id);
                        }
-                       else if ( $custom_function_id && $acl_location )
+                       else if($custom_function_id && $acl_location)
                        {
-                               $GLOBALS['phpgw']->custom_functions->delete( 
$this->type_app[$this->type],
-                                                                               
                 $acl_location, $custom_function_id );
+                               
$GLOBALS['phpgw']->custom_functions->delete($this->type_app[$this->type], 
$acl_location, $custom_function_id);
                        }
                }
 
-               function get_attrib_group_list( $entity_id, $cat_id, $selected )
+               function get_attrib_group_list($entity_id, $cat_id, $selected)
                {
-                       $group_list = $this->read_attrib_group( $entity_id, 
$cat_id, true );
+                       $group_list = $this->read_attrib_group( 
array('entity_id' => $entity_id, 'cat_id' => $cat_id, 'allrows' =>true) );
 
-                       foreach ( $group_list as &$group )
+                       foreach($group_list as &$group)
                        {
-                               if ( $group['id'] == $selected )
+                               if($group['id'] == $selected)
                                {
                                        $group['selected'] = true;
                                }
                        }
-                       //_debug_array($group_list);die();
                        return $group_list;
                }
 
-               function read_attrib_group( $entity_id = '', $cat_id = '', 
$allrows = '' )
+               function read_attrib_group($data = array())
                {
-                       if ( $allrows )
+                       $entity_id = $data['entity_id'];
+                       $cat_id = $data['cat_id'];
+                       if($data['allrows'])
                        {
-                               $this->allrows = $allrows;
+                               $this->allrows = $data['allrows'];
                        }
 
-                       $attrib = $this->custom->find_group( 
$this->type_app[$this->type],
-                                                                               
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query,
-                                                                               
$this->sort, $this->order, $this->allrows );
+                       $attrib = 
$this->custom->find_group($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $data['start'], $data['query'], 
$data['sort'], $data['order'], $this->allrows);
 
                        $this->total_records = $this->custom->total_records;
 
                        return $attrib;
                }
 
-               function read_attrib( $data = array() )
-               {       
-                    #$entity_id = '', $cat_id = '', $allrows = '' 
-                        if ( $data['allrows'] )
+               function read_attrib($data = array())
+               {
+                       if($data['allrows'])
                        {
                                $this->allrows = $data['allrows'];
                        }
-                       #$attrib = $this->custom->find( 
$this->type_app[$this->type],
-                       #                                         
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query,
-                       #                                         $this->sort, 
$this->order, $this->allrows );
-                        
-                        #,                                                     
   $data['results']
-                       $attrib = $this->custom->find(
-                                                        
$this->type_app[$this->type],
-                                                       
".{$this->type}.{$data['entity_id']}.{$data['cat_id']}", 
-                                                        $data['start'],
-                                                        $data['query'], 
-                                                        $data['sort'],
-                                                        $data['order'],
-                                                        $this->allrows
-                                                     );
+                       $attrib  = $this->custom->find( 
$this->type_app[$this->type], 
".{$this->type}.{$data['entity_id']}.{$data['cat_id']}", $data['start'], 
$data['query'], $data['sort'], $data['order'], $this->allrows);
                        $this->total_records = $this->custom->total_records;
                        return $attrib;
                }
 
-               function read_single_attrib( $entity_id, $cat_id, $id )
+               function read_single_attrib($entity_id, $cat_id, $id)
                {
-                       return $this->custom->get( $this->type_app[$this->type],
-                                                         
".{$this->type}.{$entity_id}.{$cat_id}", $id, true );
+                       return $this->custom->get($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $id, true);
                }
 
-               function read_single_attrib_group( $entity_id, $cat_id, $id )
+               function read_single_attrib_group($entity_id, $cat_id, $id)
                {
-                       return $this->custom->get_group( 
$this->type_app[$this->type],
-                                                                       
".{$this->type}.{$entity_id}.{$cat_id}", $id, true );
+                       return 
$this->custom->get_group($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $id, true);
                }
 
-               function resort_attrib_group( $id, $resort )
+               function resort_attrib_group($id, $resort)
                {
-                       $this->custom->resort_group( $id, $resort, 
$this->type_app[$this->type],
-                                                               
".{$this->type}.{$this->entity_id}.{$this->cat_id}" );
+                       $this->custom->resort_group($id, $resort, 
$this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
                }
 
-               function resort_attrib( $id, $resort )
-               {       
-                       $this->custom->resort( $id, $resort, 
$this->type_app[$this->type],
-                                                 
".{$this->type}.{$this->entity_id}.{$this->cat_id}" );
+               function resort_attrib($id, $resort)
+               {
+                       $this->custom->resort($id, $resort, 
$this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
                }
 
-               public function save_attrib_group( $group, $action = '' )
+               public function save_attrib_group($group, $action = '')
                {
-                       $receipt = array();
+                       $receipt                         = array();
                        $group['appname']        = $this->type_app[$this->type];
                        $group['location']       = 
".{$this->type}.{$group['entity_id']}.{$group['cat_id']}";
-                       if ( $action == 'edit' && $group['id'] )
+                       if($action == 'edit' && $group['id'])
                        {
-                               if ( $this->custom->edit_group( $group ) )
+                               if($this->custom->edit_group($group))
                                {
-                                       $receipt['message'][] = array('msg' => 
lang( 'group has been updated' ));
+                                       $receipt['message'][] = array('msg' => 
lang('group has been updated'));
                                        return $receipt;
                                }
 
-                               $receipt['error'][] = array('msg' => lang( 
'unable to update group' ));
+                               $receipt['error'][] = array('msg' => 
lang('unable to update group'));
                                return $receipt;
                        }
                        else
                        {
-                               $id = $this->custom->add_group( $group );
-                               if ( $id <= 0 )
+                               $id = $this->custom->add_group($group);
+                               if($id <= 0)
                                {
-                                       $receipt['error'][] = array('msg' => 
lang( 'unable to add group' ));
+                                       $receipt['error'][] = array('msg' => 
lang('unable to add group'));
                                        return $receipt;
                                }
-                               else if ( $id == -1 )
+                               else if($id == -1)
                                {
                                        $receipt['id']           = 0;
-                                       $receipt['error'][]      = array('msg'  
                         => lang( 'group already exists, please choose another 
name' ));
-                                       $receipt['error'][]      = array('msg' 
=> lang( 'Attribute group has NOT been saved' ));
+                                       $receipt['error'][]      = array('msg' 
=> lang('group already exists, please choose another name'));
+                                       $receipt['error'][]      = array('msg' 
=> lang('Attribute group has NOT been saved'));
                                        return $receipt;
                                }
 
                                $receipt['id']                   = $id;
-                               $receipt['message'][]    = array('msg' => lang( 
'group has been created' ));
+                               $receipt['message'][]    = array('msg' => 
lang('group has been created'));
                                return $receipt;
                        }
                }
 
-               public function save_attrib( $attrib, $action = '' )
+               public function save_attrib($attrib, $action = '')
                {
-                       $receipt = array();
+                       $receipt                         = array();
                        $attrib['appname']       = $this->type_app[$this->type];
                        $attrib['location']      = 
".{$this->type}.{$attrib['entity_id']}.{$attrib['cat_id']}";
-                       $attrib_table = 
$GLOBALS['phpgw']->locations->get_attrib_table($attrib['appname'], 
$attrib['location']);
-                       if ( $action == 'edit' && $attrib['id'] )
+                       $attrib_table            = 
$GLOBALS['phpgw']->locations->get_attrib_table($attrib['appname'], 
$attrib['location']);
+                       if($action == 'edit' && $attrib['id'])
                        {
-                               if ( $this->custom->edit( $attrib ) )
+                               if($this->custom->edit($attrib))
                                {
                                        $receipt                                
 = $this->custom->receipt;
-                                       $receipt['message'][]    = array('msg'  
                         => lang( 'Field has been updated' ));
+                                       $receipt['message'][]    = array('msg' 
=> lang('Field has been updated'));
                                        return $receipt;
                                }
-                               $receipt['error'][]      = array('msg' => lang( 
'Unable to update field' ));
+                               $receipt['error'][] = array('msg' => 
lang('Unable to update field'));
                                return $receipt;
                        }
                        else
                        {
-                               $id = $this->custom->add( $attrib, 
$attrib_table);
-                               if ( $id <= 0 )
+                               $id = $this->custom->add($attrib, 
$attrib_table);
+                               if($id <= 0)
                                {
-                                       $receipt['error'][] = array('msg' => 
lang( 'Unable to add field' ));
+                                       $receipt['error'][] = array('msg' => 
lang('Unable to add field'));
                                        return $receipt;
                                }
-                               else if ( $id == -1 )
+                               else if($id == -1)
                                {
                                        $receipt['id']           = 0;
-                                       $receipt['error'][]      = array('msg'  
                         => lang( 'field already exists, please choose another 
name' ));
-                                       $receipt['error'][]      = array('msg' 
=> lang( 'Attribute has NOT been saved' ));
+                                       $receipt['error'][]      = array('msg' 
=> lang('field already exists, please choose another name'));
+                                       $receipt['error'][]      = array('msg' 
=> lang('Attribute has NOT been saved'));
                                        return $receipt;
                                }
 
                                $receipt['id']                   = $id;
-                               $receipt['message'][]    = array('msg' => lang( 
'Custom field has been created' ));
+                               $receipt['message'][]    = array('msg' => 
lang('Custom field has been created'));
                                return $receipt;
                        }
                }
 
-               function read_custom_function( $entity_id = '', $cat_id = '', 
$allrows = '',
-                                                                $acl_location 
= '' )
+               function read_custom_function($entity_id = '', $cat_id = '', 
$allrows = '', $acl_location = '')
                {
-                       if ( $allrows )
+                       if($allrows)
                        {
                                $this->allrows = $allrows;
                        }
 
-                       if ( !$acl_location && $entity_id && $cat_id )
+                       if(!$acl_location && $entity_id && $cat_id)
                        {
                                $acl_location = 
".{$this->type}.{$entity_id}.{$cat_id}";
                        }
 
-                       $values = $GLOBALS['phpgw']->custom_functions->find( 
array('start'               => $this->start, 'query'                => 
$this->query, 'sort'                 => $this->sort, 'order'                 => 
$this->order,
-                               'appname'        => 
$this->type_app[$this->type], 'location'     => $acl_location, 'allrows'     => 
$this->allrows) );
+                       $values = 
$GLOBALS['phpgw']->custom_functions->find(array('start'                => 
$this->start,
+                               'query'          => $this->query, 'sort'        
         => $this->sort, 'order'                 => $this->order,
+                               'appname'        => 
$this->type_app[$this->type], 'location'     => $acl_location, 'allrows'     => 
$this->allrows));
 
                        $this->total_records = 
$GLOBALS['phpgw']->custom_functions->total_records;
 
                        return $values;
                }
 
-               function resort_custom_function( $id, $resort )
+               function resort_custom_function($id, $resort)
                {
                        $location = 
".{$this->type}.{$this->entity_id}.{$this->cat_id}";
-                       return $GLOBALS['phpgw']->custom_functions->resort( 
$id, $resort,
-                                                                               
                           $this->type_app[$this->type], $location );
+                       return $GLOBALS['phpgw']->custom_functions->resort($id, 
$resort, $this->type_app[$this->type], $location);
                }
 
-               function save_custom_function( $custom_function, $action = '' )
+               function save_custom_function($custom_function, $action = '')
                {
-                       $receipt = array();
-                       $custom_function['appname'] = 
$this->type_app[$this->type];
-                       if ( !$custom_function['location'] && 
$custom_function['entity_id'] && $custom_function['cat_id'] )
+                       $receipt                                         = 
array();
+                       $custom_function['appname']      = 
$this->type_app[$this->type];
+                       if(!$custom_function['location'] && 
$custom_function['entity_id'] && $custom_function['cat_id'])
                        {
                                $custom_function['location'] = 
".{$this->type}.{$custom_function['entity_id']}.{$custom_function['cat_id']}";
                        }
 
-                       if ( $action == 'edit' )
+                       if($action == 'edit')
                        {
-                               if ( $custom_function['id'] != '' )
+                               if($custom_function['id'] != '')
                                {
 
                                        $receipt['id'] = $custom_function['id'];
-                                       if( 
$GLOBALS['phpgw']->custom_functions->edit( $custom_function ) )
+                                       
if($GLOBALS['phpgw']->custom_functions->edit($custom_function))
                                        {
-                                               $receipt['message'][] = 
array('msg'=>'OK');
+                                               $receipt['message'][] = 
array('msg' => 'OK');
                                        }
                                        else
                                        {
-                                               $receipt['error'][] = 
array('msg'=>'Error');
+                                               $receipt['error'][] = 
array('msg' => 'Error');
                                        }
                                }
                        }
                        else
                        {
-                               if($receipt['id'] = 
$GLOBALS['phpgw']->custom_functions->add( $custom_function ) )
+                               if($receipt['id'] = 
$GLOBALS['phpgw']->custom_functions->add($custom_function))
                                {
-                                       $receipt['message'][] = 
array('msg'=>'OK');
+                                       $receipt['message'][] = array('msg' => 
'OK');
                                }
                                else
                                {
-                                       $receipt['error'][] = 
array('msg'=>'Error');
+                                       $receipt['error'][] = array('msg' => 
'Error');
                                }
                        }
                        return $receipt;
                }
 
-               function select_custom_function( $selected = '' )
+               function select_custom_function($selected = '')
                {
-                       $admin_custom = createObject( 'admin.bo_custom' );
-                       return $admin_custom->select_custom_function( $selected,
-                                                                               
                 $this->type_app[$this->type] );
+                       $admin_custom = createObject('admin.bo_custom');
+                       return $admin_custom->select_custom_function($selected, 
$this->type_app[$this->type]);
                }
 
-               function read_single_custom_function( $entity_id = '', $cat_id 
= '', $id,
-                                                                               
$location = '' )
+               function read_single_custom_function($entity_id = '', $cat_id = 
'', $id, $location = '')
                {
-                       if ( !$location && $entity_id && $cat_id )
+                       if(!$location && $entity_id && $cat_id)
                        {
                                $location = 
".{$this->type}.{$entity_id}.{$cat_id}";
                        }
-                       return $GLOBALS['phpgw']->custom_functions->get( 
$this->type_app[$this->type],
-                                                                               
                        $location, $id );
+                       return 
$GLOBALS['phpgw']->custom_functions->get($this->type_app[$this->type], 
$location, $id);
                }
 
-               function get_path( $entity_id, $node )
+               function get_path($entity_id, $node)
                {
-                       return $this->so->get_path( $entity_id, $node );
+                       return $this->so->get_path($entity_id, $node);
                }
 
-               function read_category_tree2( $entity_id, $table )
+               function read_category_tree2($entity_id, $table)
                {
-                       return $this->so->read_category_tree2( $entity_id, 
$table );
+                       return $this->so->read_category_tree2($entity_id, 
$table);
                }
 
-               function get_children2( $entity_id, $parent, $level, $reset = 
false, $table )
+               function get_children2($entity_id, $parent, $level, $reset = 
false, $table)
                {
-                       return $this->so->get_children2( $entity_id, $parent, 
$level, $reset, $table );
+                       return $this->so->get_children2($entity_id, $parent, 
$level, $reset, $table);
                }
 
                function convert_to_eav()
                {
                        return $this->so->convert_to_eav();
                }
-
-       }
+       }
\ No newline at end of file

Modified: branches/dev-syncromind/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiadmin_entity.inc.php   
2015-04-16 23:41:56 UTC (rev 13030)
+++ branches/dev-syncromind/property/inc/class.uiadmin_entity.inc.php   
2015-04-17 11:00:25 UTC (rev 13031)
@@ -162,17 +162,17 @@
                                                array(
                                                        'key'            => 
'id',
                                                        'label'          => 
lang('Entity ID'),
-                                                       'sortable'       => TRUE
+                                                       'sortable'       => true
                                                ),
                                                array(
                                                        'key'            => 
'name',
                                                        'label'          => 
lang('Name'),
-                                                       'sortable'       => TRUE
+                                                       'sortable'       => true
                                                ),
                                                array(
                                                        'key'            => 
'descr',
                                                        'label'          => 
lang('Descr'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                )
                                        )
                                )
@@ -265,11 +265,15 @@
                        switch($data['method'])
                        {
                                case 'category':
-                                       $entity_id       = 
$data['entity_id'];break;
+                                       $entity_id       = $data['entity_id'];
+                                       break;
                                case 'list_attribute':
+                               case 'list_attribute_group':
                                        $entity_id       = $data['entity_id'];
-                                       $cat_id          = 
$data['cat_id'];break;
-                               default:$entity_id       = "";break;
+                                       $cat_id          = $data['cat_id'];
+                                       break;
+                               default:$entity_id       = "";
+                                       break;
                        }
 
                        $params = array(
@@ -289,11 +293,17 @@
                        switch($data['method'])
                        {
                                case 'category':
-                                       $values  = 
$this->bo->read_category($params);break;
+                                       $values  = 
$this->bo->read_category($params);
+                                       break;
                                case 'list_attribute':
-                                       $values  = 
$this->bo->read_attrib($params);break;
+                                       $values  = 
$this->bo->read_attrib($params);
+                                       break;
+                               case 'list_attribute_group':
+                                       $values  = 
$this->bo->read_attrib_group($params);
+                                       break;
                                default:
-                                       $values  = 
$this->bo->read($params);break;
+                                       $values  = $this->bo->read($params);
+                                       break;
                        }
 
                        $new_values = array();
@@ -322,6 +332,16 @@
                                        );
                                        array_walk($result_data['results'], 
array($this, '_add_links'), $variable);
                                        break;
+                               case 'list_attribute_group':
+                                       $variable = array(
+                                               'menuaction' => 
'property.uiadmin_entity.list_attribute_group',
+                                               'entity_id'      => $entity_id,
+                                               'cat_id'         => $cat_id,
+                                               'allrows'        => 
$this->allrows,
+                                               'type'           => $this->type
+                                       );
+                                       array_walk($result_data['results'], 
array($this, '_add_links'), $variable);
+                                       break;
                        }
                        return $this->jquery_results($result_data);
                }
@@ -384,56 +404,56 @@
                                                        (
                                                        'key'            => 
'location_id',
                                                        'label'          => 
lang('location_id'),
-                                                       'sortable'       => TRUE
+                                                       'sortable'       => true
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'id',
                                                        'label'          => 
lang('category ID'),
-                                                       'sortable'       => TRUE
+                                                       'sortable'       => true
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'name',
                                                        'label'          => 
lang('Name'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'descr',
                                                        'label'          => 
lang('Descr'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'prefix',
                                                        'label'          => 
lang('Prefix'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'entity_id',
                                                        'label'          => 
lang('id'),
-                                                       'sortable'       => 
FALSE,
-                                                       'hidden'         => TRUE
+                                                       'sortable'       => 
false,
+                                                       'hidden'         => true
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'is_eav',
                                                        'label'          => 
lang('is_eav'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'enable_bulk',
                                                        'label'          => 
lang('enable bulk'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array
                                                        (
                                                        'key'            => 
'enable_controller',
                                                        'label'          => 
lang('enable controller'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                )
                                        )
                                )
@@ -1156,152 +1176,117 @@
                        {
                                $this->bo->resort_attrib_group($id, $resort);
                        }
-
-                       $datatable = array();
-
-                       if(phpgw::get_var('phpgw_return_as') != 'json')
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
                        {
-                               $datatable['menu']                              
 = $this->bocommon->get_menu();
-                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                               if($resort)
+                               {
+                                       $this->bo->resort_attrib_group($id, 
$resort);
+                               }
+
+                               return $this->query(array
                                        (
-                                       'menuaction' => 
'property.uiadmin_entity.list_attribute_group',
-                                       'sort'           => $this->sort,
-                                       'order'          => $this->order,
-                                       'query'          => $this->query,
+                                       'method'         => 
'list_attribute_group',
                                        'entity_id'      => $entity_id,
-                                       'cat_id'         => $cat_id,
-                                       'type'           => $this->type
+                                       'cat_id'         => $cat_id
                                ));
+                       }
+                       self::add_javascript('phpgwapi', 'jquery', 
'editable/jquery.jeditable.js');
+                       self::add_javascript('phpgwapi', 'jquery', 
'editable/jquery.dataTables.editable.js');
 
-                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_entity.list_attribute_group',"
-                               . "sort:'{$this->sort}',"
-                               . "order:'{$this->order}',"
-                               . "query:'{$this->query}',"
-                               . "entity_id:'{$this->entity_id}',"
-                               . "cat_id:'{$this->cat_id}',"
-                               . "type:'{$this->type}'";
+                       $appname                 = lang('attribute group');
+                       $function_msg    = lang('list entity attribute group');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                               $datatable['config']['allow_allrows'] = true;
-
-                               $link_data = array
-                                       (
-                                       'menuaction' => 
'property.uiadmin_entity.list_attribute',
-                                       'sort'           => $this->sort,
-                                       'order'          => $this->order,
-                                       'query'          => $this->query,
-                                       'entity_id'      => $entity_id,
-                                       'cat_id'         => $cat_id,
-                                       'type'           => $this->type
-                               );
-
-                               $datatable['actions']['form'] = array(
-                                       array(
-                                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array(
-                                                       'menuaction' => 
'property.uiadmin_entity.list_attribute_group',
-                                                       'sort'           => 
$this->sort,
-                                                       'order'          => 
$this->order,
-                                                       'query'          => 
$this->query,
-                                                       'entity_id'      => 
$entity_id,
-                                                       'cat_id'         => 
$cat_id,
-                                                       'type'           => 
$this->type
-                                               )
-                                               ),
-                                               'fields' => array(
-                                                       'field'                 
 => array(
-                                                               array(
-                                                                       'type'  
         => 'button',
-                                                                       'id'    
         => 'btn_done',
-                                                                       'value' 
         => lang('done'),
-                                                                       
'tab_index'      => 1
-                                                               ),
-                                                               array(
-                                                                       'type'  
         => 'button',
-                                                                       'id'    
         => 'btn_new',
-                                                                       'value' 
         => lang('add'),
-                                                                       
'tab_index'      => 2
-                                                               ),
-                                                               array(//boton   
  SEARCH
-                                                                       'id'    
         => 'btn_search',
-                                                                       'name'  
         => 'search',
-                                                                       'value' 
         => lang('search'),
-                                                                       'type'  
         => 'button',
-                                                                       
'tab_index'      => 3
-                                                               ),
-                                                               array(// TEXT 
INPUT
-                                                                       'name'  
         => 'query',
-                                                                       'id'    
         => 'txt_query',
-                                                                       'value' 
         => '', //$query,
-                                                                       'type'  
         => 'text',
-                                                                       
'onkeypress' => 'return pulsar(event)',
-                                                                       'size'  
         => 28,
-                                                                       
'tab_index'      => 4
-                                                               )
+                       $data = array(
+                               'datatable_name' => $appname,
+                               'form'                   => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array
+                                                               (
+                                                               'type'   => 
'link',
+                                                               'value'  => 
lang('new'),
+                                                               'href'   => 
self::link(array(
+                                                                       
'menuaction' => 'property.uiadmin_entity.edit_attrib_group',
+                                                                       
'entity_id'      => $entity_id,
+                                                                       
'cat_id'         => $cat_id,
+                                                                       'type'  
         => $this->type
+                                                               )),
+                                                               'class'  => 
'new_item'
                                                        ),
-                                                       'hidden_value'   => 
array(
+                                                       array
+                                                               (
+                                                               'type'   => 
'link',
+                                                               'value'  => 
lang('cancel'),
+                                                               'href'   => 
self::link(array
+                                                                       (
+                                                                       
'menuaction' => 'property.uiadmin_entity.category',
+                                                                       
'entity_id'      => $entity_id,
+                                                                       'type'  
         => $this->type
+                                                               )),
+                                                               'class'  => 
'new_item'
                                                        )
                                                )
                                        )
-                               );
+                               ),
+                               'datatable'              => array(
+                                       'source'                 => 
self::link(array(
+                                               'menuaction'             => 
'property.uiadmin_entity.list_attribute_group',
+                                               'entity_id'                     
 => $entity_id,
+                                               'cat_id'                        
 => $cat_id,
+                                               'type'                          
 => $this->type,
+                                               'phpgw_return_as'        => 
'json'
+                                       )),
+                                       'allrows'                => true,
+                                       'editor_action'  => '',
+                                       'field'                  => array(
+                                               array(
+                                                       'key'            => 
'id',
+                                                       'label'          => 
lang('id'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'parent_id',
+                                                       'label'          => 
lang('parent'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'name',
+                                                       'label'          => 
lang('Name'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'text',
+                                                       'label'          => 
lang('Descr'),
+                                                       'sortable'       => 
false
+                                               ),
+                                               array(
+                                                       'key'            => 
'group_sort',
+                                                       'label'          => 
lang('sorting'),
+                                                       'sortable'       => true
+                                               ),
+                                               array(
+                                                       'key'            => 
'up',
+                                                       'label'          => 
lang('up'),
+                                                       'sortable'       => 
false,
+                                                       'formatter'      => 
'JqueryPortico.formatLinkGenericLlistAttribute'
+                                               ),
+                                               array(
+                                                       'key'            => 
'down',
+                                                       'label'          => 
lang('down'),
+                                                       'sortable'       => 
false,
+                                                       'formatter'      => 
'JqueryPortico.formatLinkGenericLlistAttribute'
+                                               ),
+                                               array(
+                                                       'key'            => 
'id',
+                                                       'label'          => 
lang('id'),
+                                                       'sortable'       => 
false,
+                                                       'hidden'         => true
+                                               )
+                                       )
+                               )
+                       );
 
-                               //                              $dry_run = true;
-                       }
-
-                       $attrib_list             = 
$this->bo->read_attrib_group($entity_id, $cat_id, phpgw::get_var('allrows', 
'bool'));
-                       $uicols['name'][0]       = 'id';
-                       $uicols['descr'][0]      = lang('id');
-                       $uicols['name'][1]       = 'parent_id';
-                       $uicols['descr'][1]      = lang('parent');
-                       $uicols['name'][2]       = 'name';
-                       $uicols['descr'][2]      = lang('Name');
-                       $uicols['name'][3]       = 'descr';
-                       $uicols['descr'][3]      = lang('Descr');
-                       $uicols['name'][4]       = 'group_sort_text';
-                       $uicols['descr'][4]      = lang('sorting');
-                       $uicols['name'][5]       = 'up';
-                       $uicols['descr'][5]      = lang('up');
-                       $uicols['name'][6]       = 'down';
-                       $uicols['descr'][6]      = lang('down');
-                       $j                                       = 0;
-                       $count_uicols_name       = count($uicols['name']);
-
-                       if(isset($attrib_list) AND is_array($attrib_list))
-                       {
-                               foreach($attrib_list as $attrib_entry)
-                               {
-                                       for($k = 0; $k < $count_uicols_name; 
$k++)
-                                       {
-                                               if($uicols['input_type'][$k] != 
'hidden')
-                                               {
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']      = $uicols['name'][$k];
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['value'] = 
$attrib_entry[$uicols['name'][$k]];
-                                               }
-
-                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'up')
-                                               {
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']    = 'link';
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']     = 
'up';//$uicols['name'][$k];
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']    = '_blank';
-                                                       $url                    
                                                                                
 = '"' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_entity.list_attribute_group',
-                                                               'resort' => 
'up', 'entity_id' => $entity_id, 'cat_id' => $cat_id, 'id' => 
$attrib_entry['id'],
-                                                               'allrows' => 
$this->allrows, 'type' => $this->type)) . '"';
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']              = 
'move_record(' . $url . ')';
-                                               }
-
-                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'down')
-                                               {
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']    = 'link';
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']     = 
'down';//$uicols['name'][$k];
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']    = '_blank';
-                                                       $url                    
                                                                                
 = '"' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_entity.list_attribute_group',
-                                                               'resort' => 
'down', 'entity_id' => $entity_id, 'cat_id' => $cat_id, 'id' => 
$attrib_entry['id'],
-                                                               'allrows' => 
$this->allrows, 'type' => $this->type)) . '"';
-                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']              = 
'move_record(' . $url . ')';
-                                               }
-                                       }
-                                       $j++;
-                               }
-                       }
-
                        $datatable['rowactions']['action'] = array();
 
                        $parameters = array
@@ -1328,7 +1313,7 @@
                                )
                        );
 
-                       $datatable['rowactions']['action'][] = array
+                       $data['datatable']['actions'][] = array
                                (
                                'my_name'        => 'edit',
                                'statustext' => lang('Edit'),
@@ -1343,10 +1328,10 @@
                                        'type'           => $this->type
                                )
                                ),
-                               'parameters' => $parameters
+                               'parameters' => json_encode($parameters)
                        );
 
-                       $datatable['rowactions']['action'][] = array
+                       $data['datatable']['actions'][] = array
                                (
                                'my_name'                => 'delete',
                                'statustext'     => lang('Delete'),
@@ -1362,163 +1347,48 @@
                                        'type'           => $this->type
                                )
                                ),
-                               'parameters'     => $parameters2
+                               'parameters'     => json_encode($parameters2)
                        );
 
-                       $datatable['rowactions']['action'][] = array(
-                               'my_name'        => 'add',
-                               'statustext' => lang('add'),
-                               'text'           => lang('add'),
-                               'action'         => 
$GLOBALS['phpgw']->link('/index.php', array
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name'                => 'list_attribute',
+                               'statustext'     => lang('list attribute'),
+                               'text'                   => lang('list 
attribute'),
+                               'action'                 => 
$GLOBALS['phpgw']->link
+                               (
+                               '/index.php', array
                                        (
-                                       'menuaction' => 
'property.uiadmin_entity.edit_attrib_group',
+                                       'menuaction' => 
'property.uiadmin_entity.list_attribute',
                                        'entity_id'      => $entity_id,
                                        'cat_id'         => $cat_id,
                                        'type'           => $this->type
-                               ))
+                               )
+                               ),
+                               'parameters'     => json_encode($parameters2)
                        );
 
-                       unset($parameters);
-                       unset($parameters2);
-
-                       for($i = 0; $i < $count_uicols_name; $i++)
-                       {
-                               if($uicols['input_type'][$i] != 'hidden')
-                               {
-                                       
$datatable['headers']['header'][$i]['formatter'] = ($uicols['formatter'][$i] == 
'' ? '""' : $uicols['formatter'][$i]);
-                                       
$datatable['headers']['header'][$i]['name']              = $uicols['name'][$i];
-                                       
$datatable['headers']['header'][$i]['text']              = $uicols['descr'][$i];
-                                       
$datatable['headers']['header'][$i]['visible']   = true;
-                                       
$datatable['headers']['header'][$i]['sortable']  = false;
-
-                                       if($uicols['name'][$i] == 'name')
-                                       {
-                                               
$datatable['headers']['header'][$i]['sortable']          = true;
-                                               
$datatable['headers']['header'][$i]['sort_field']        = 'name';
-                                       }
-                               }
-                       }
-
-                       //path for property.js
-                       $property_js = "/property/js/yahoo/property.js";
-
-                       
if(!isset($GLOBALS['phpgw_info']['server']['no_jscombine']) || 
!$GLOBALS['phpgw_info']['server']['no_jscombine'])
-                       {
-                               $cachedir        = 
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
-                               $property_js = 
"/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files=" . 
str_replace('/', '--', ltrim($property_js, '/'));
-                       }
-
-                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url'] . $property_js;
-
-                       // Pagination and sort values
-                       $datatable['pagination']['records_start']        = 
(int)$this->bo->start;
-                       $datatable['pagination']['records_limit']        = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       $datatable['pagination']['records_returned'] = 
count($attrib_list);
-                       $datatable['pagination']['records_total']        = 
$this->bo->total_records;
-
-                       $appname                 = lang('attribute');
-                       $function_msg    = lang('list entity attribute');
-
-                       if((phpgw::get_var("start") == "") && 
(phpgw::get_var("order", 'string') == ""))
-                       {
-                               $datatable['sorting']['order']   = 'name'; // 
name key Column in myColumnDef
-                               $datatable['sorting']['sort']    = 'asc'; // 
ASC / DESC
-                       }
-                       else
-                       {
-                               $datatable['sorting']['order']   = 
phpgw::get_var('order', 'string'); // name of column of Database
-                               $datatable['sorting']['sort']    = 
phpgw::get_var('sort', 'string'); // ASC / DESC
-                       }
-
-                       phpgwapi_yui::load_widget('dragdrop');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('menu');
-                       phpgwapi_yui::load_widget('connection');
-                       phpgwapi_yui::load_widget('loader');
-                       phpgwapi_yui::load_widget('tabview');
-                       phpgwapi_yui::load_widget('paginator');
-                       phpgwapi_yui::load_widget('animation');
-
-                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
-                       //values for Pagination
-                       $json = array
+                       $data['datatable']['actions'][] = array
                                (
-                               'recordsReturned'        => 
$datatable['pagination']['records_returned'],
-                               'totalRecords'           => 
(int)$datatable['pagination']['records_total'],
-                               'startIndex'             => 
$datatable['pagination']['records_start'],
-                               'sort'                           => 
$datatable['sorting']['order'],
-                               'dir'                            => 
$datatable['sorting']['sort'],
-                               'records'                        => array()
+                               'my_name'                => 'new_attribute',
+                               'statustext'     => lang('new attribute'),
+                               'text'                   => lang('new 
attribute'),
+                               'action'                 => 
$GLOBALS['phpgw']->link
+                               (
+                               '/index.php', array
+                                       (
+                                       'menuaction' => 
'property.uiadmin_entity.edit_attrib',
+                                       'entity_id'      => $entity_id,
+                                       'cat_id'         => $cat_id,
+                                       'type'           => $this->type
+                               )
+                               ),
+                               'parameters'     => json_encode($parameters2)
                        );
 
-                       // values for datatable
-                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
-                       {
-                               foreach($datatable['rows']['row'] as $row)
-                               {
-                                       $json_row = array();
-                                       foreach($row['column'] as $column)
-                                       {
-                                               if(isset($column['format']) && 
$column['format'] == "link" && $column['java_link'] == true)
-                                               {
-                                                       
//$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
-                                               }
-                                               elseif(isset($column['format']) 
&& $column['format'] == "link")
-                                               {
-                                                       
//$json_row[$column['name']] = "<a href='".$column['link']."'>" 
.$column['value']."</a>";
-                                                       
$json_row[$column['name']] = "<a href='#' onclick='" . $column['link'] . "'>" . 
$column['value'] . "</a>";
-                                                       
//$json_row[$column['name']] = '<a href="#" 
onclick="delete_record("/index.php?menuaction=property.uiasync.delete")">' 
.$column['value'].'</a>';
-                                               }
-                                               else
-                                               {
-                                                       
$json_row[$column['name']] = $column['value'];
-                                               }
-                                       }
-                                       $json['records'][] = $json_row;
-                               }
-                       }
-
-                       // right in datatable
-                       if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
-                       {
-                               $json ['rights'] = 
$datatable['rowactions']['action'];
-                       }
-
-                       // query parameters
-                       if(isset($current_Consult) && 
is_array($current_Consult))
-                       {
-                               $json ['current_consult'] = $current_Consult;
-                       }
-
-                       if(phpgw::get_var('phpgw_return_as') == 'json')
-                       {
-                               return $json;
-                       }
-
-
-                       $datatable['json_data'] = json_encode($json);
-                       //-------------------- JSON CODE ----------------------
-
-                       $template_vars                           = array();
-                       $template_vars['datatable']      = $datatable;
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
$template_vars);
-
-                       if(!isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css))
-                       {
-                               $GLOBALS['phpgw']->css = 
createObject('phpgwapi.css');
-                       }
-
-                       $GLOBALS['phpgw']->css->validate_file('datatable');
-                       $GLOBALS['phpgw']->css->validate_file('property');
-                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
-                       $GLOBALS['phpgw']->js->validate_file('yahoo', 
'admin_entity.attribute_group', 'property');
+                       unset($parameters);
+                       unset($parameters2);
+                       self::render_template_xsl('datatable_jquery', $data);
                }
 
                function list_attribute()
@@ -1586,9 +1456,10 @@
                                                                'value'  => 
lang('cancel'),
                                                                'href'   => 
self::link(array
                                                                        (
-                                                                       
'menuaction' => 'property.uiadmin_entity.edit',
+                                                                       
'menuaction' => 'property.uiadmin_entity.category',
+                                                                       
'entity_id'      => $entity_id,
                                                                        'type'  
         => $this->type
-                                                               )
+                                                                       )
                                                                ),
                                                                'class'  => 
'new_item'
                                                        )
@@ -1609,55 +1480,55 @@
                                                array(
                                                        'key'            => 
'column_name',
                                                        'label'          => 
lang('Name'),
-                                                       'sortable'       => TRUE
+                                                       'sortable'       => true
                                                ),
                                                array(
                                                        'key'            => 
'input_text',
                                                        'label'          => 
lang('Descr'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array(
                                                        'key'            => 
'trans_datatype',
                                                        'label'          => 
lang('Datatype'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array(
                                                        'key'            => 
'group_id',
                                                        'label'          => 
lang('group'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array(
                                                        'key'            => 
'attrib_sort',
                                                        'label'          => 
lang('sorting'),
-                                                       'sortable'       => TRUE
+                                                       'sortable'       => true
                                                ),
                                                array(
                                                        'key'            => 
'up',
                                                        'label'          => 
lang('up'),
-                                                       'sortable'       => 
FALSE,
+                                                       'sortable'       => 
false,
                                                        'formatter'      => 
'JqueryPortico.formatLinkGenericLlistAttribute'
                                                ),
                                                array(
                                                        'key'            => 
'down',
                                                        'label'          => 
lang('down'),
-                                                       'sortable'       => 
FALSE,
+                                                       'sortable'       => 
false,
                                                        'formatter'      => 
'JqueryPortico.formatLinkGenericLlistAttribute'
                                                ),
                                                array(
                                                        'key'            => 
'search',
                                                        'label'          => 
lang('search'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                ),
                                                array(
                                                        'key'            => 
'id',
                                                        'label'          => 
lang('id'),
-                                                       'sortable'       => 
FALSE,
-                                                       'hidden'         => TRUE
+                                                       'sortable'       => 
false,
+                                                       'hidden'         => true
                                                ),
                                                array(
                                                        'key'            => 
'short_description',
                                                        'label'          => 
lang('short description'),
-                                                       'sortable'       => 
FALSE
+                                                       'sortable'       => 
false
                                                )
                                        )
                                )
@@ -1914,6 +1785,7 @@
                        $cat_id          = phpgw::get_var('cat_id', 'int');
                        $id                      = phpgw::get_var('id', 'int');
                        $values          = phpgw::get_var('values');
+                       $group_id        = phpgw::get_var('group_id', 'int');
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$entity_id}::entity_{$entity_id}_{$cat_id}";
 
@@ -2056,14 +1928,17 @@
                                'msgbox_data'                                   
         => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                                   
         => $GLOBALS['phpgw']->link('/index.php', $link_data),
                                'done_action'                                   
         => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin_entity.list_attribute',
-                                       'entity_id' => $entity_id, 'cat_id' => 
$cat_id, 'type' => $this->type)),
+                                                                               
                                        'entity_id' => $entity_id,
+                                                                               
                                        'cat_id'        => $cat_id,
+                                                                               
                                        'type'          => $this->type)
+                                                                               
                                        ),
                                'value_id'                                      
                 => $id,
                                'value_column_name'                             
         => $values['column_name'],
                                'value_input_text'                              
         => $values['input_text'],
                                'value_statustext'                              
         => $values['statustext'],
                                'datatype_list'                                 
         => $this->bocommon->select_datatype($values['column_info']['type']),
                                'datatype'                                      
                 => $values['column_info']['type'],
-                               'attrib_group_list'                             
         => $this->bo->get_attrib_group_list($entity_id, $cat_id, 
$values['group_id']),
+                               'attrib_group_list'                             
         => $this->bo->get_attrib_group_list($entity_id, $cat_id, 
$values['group_id'] ? $values['group_id'] : $group_id),
                                'value_precision'                               
         => $values['column_info']['precision'],
                                'value_scale'                                   
         => $values['column_info']['scale'],
                                'value_default'                                 
         => $values['column_info']['default'],

Modified: branches/dev-syncromind/property/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/property/setup/phpgw_no.lang        2015-04-16 
23:41:56 UTC (rev 13030)
+++ branches/dev-syncromind/property/setup/phpgw_no.lang        2015-04-17 
11:00:25 UTC (rev 13031)
@@ -204,6 +204,8 @@
 attach file    property        no      Legg til som vedlegg
 attachments    property        no      Vedlegg
 attribute      property        no      Verdier
+list entity attribute group    property        no      List Attributt grupper
+attribute group        property        no      Attributt grupper
 attribute has been edited      property        no      Attributt er rettet
 attribute has been saved       property        no      Attributt er lagret
 attribute has not been deleted property        no      Attributt er IKKE 
slettet




reply via email to

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