phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] admin/inc class.ui_custom_fields2.inc.php class...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] admin/inc class.ui_custom_fields2.inc.php class...
Date: Wed, 29 Mar 2006 09:41:20 +0000

CVSROOT:        /sources/phpgroupware
Module name:    admin
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/03/29 09:41:20

Modified files:
        inc            : class.ui_custom_fields2.inc.php 
                         class.so_custom_fields2.inc.php 
                         class.bo_custom_fields2.inc.php 
                         hook_admin.inc.php 

Log message:
        Custom functions

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/admin/inc/class.ui_custom_fields2.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/admin/inc/class.so_custom_fields2.inc.php.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/admin/inc/class.bo_custom_fields2.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/admin/inc/hook_admin.inc.php.diff?tr1=1.40&tr2=1.41&r1=text&r2=text

Patches:
Index: admin/inc/class.bo_custom_fields2.inc.php
diff -u admin/inc/class.bo_custom_fields2.inc.php:1.2 
admin/inc/class.bo_custom_fields2.inc.php:1.3
--- admin/inc/class.bo_custom_fields2.inc.php:1.2       Mon Mar 27 08:09:44 2006
+++ admin/inc/class.bo_custom_fields2.inc.php   Wed Mar 29 09:41:20 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.bo_custom_fields2.inc.php,v 1.2 2006/03/27 
08:09:44 sigurdne Exp $
+       * @version $Id: class.bo_custom_fields2.inc.php,v 1.3 2006/03/29 
09:41:20 sigurdne Exp $
        */
 
        /**
@@ -140,15 +140,15 @@
 
 
 
-               function 
delete($location='',$appname='',$attrib_id='',$acl_location='',$custom_function_id='')
+               function 
delete($location='',$appname='',$attrib_id='',$custom_function_id='')
                {
                        if($attrib_id && $location && $appname && 
!$custom_function_id):
                        {
                                
$this->so->delete_attrib($location,$appname,$attrib_id);
                        }
-                       elseif($custom_function_id && $acl_location):
+                       elseif($custom_function_id && $appname && $location):
                        {
-                               
$this->so->delete_custom_function($acl_location,$custom_function_id);
+                               
$this->so->delete_custom_function($appname,$location,$custom_function_id);
                        }
                        endif;
                }
@@ -201,20 +201,15 @@
                }
 
 
-               function 
read_custom_function($appname='',$location='',$allrows='', $acl_location='')
+               function 
read_custom_function($appname='',$location='',$allrows='')
                {
                        if($allrows)
                        {
                                $this->allrows = $allrows;
                        }
 
-                       if (!$acl_location && $appname && $location)
-                       {
-                               $acl_location = '.entity.' . $appname . '.' . 
$location;
-                       }
-
                        $custom_function = 
$this->so->read_custom_function(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
-                                                                               
        'acl_location' => $acl_location,'allrows'=>$this->allrows));
+                                                                               
        'appname' => $appname,'location' => 
$location,'allrows'=>$this->allrows));
 
                        $this->total_records = $this->so->total_records;
 
@@ -243,21 +238,24 @@
                        return $receipt;
                }
 
-               function select_custom_function($selected='')
+               function select_custom_function($selected='', $appname)
                {
 
-                       $dir_handle = @opendir(PHPGW_APP_INC . SEP . 'custom');
+                       $dir_handle = @opendir(PHPGW_SERVER_ROOT . SEP . 
$appname . SEP . 'inc' . SEP . 'custom');
                        $i=0; $myfilearray = '';
-                       while ($file = readdir($dir_handle))
+                       if ($dir_handle)
                        {
-                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_APP_INC . SEP . 'custom' . SEP . $file) )
+                               while ($file = readdir($dir_handle))
                                {
-                                       $myfilearray[$i] = $file;
-                                       $i++;
+                                       if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . 'custom' . SEP 
. $file) )
+                                       {
+                                               $myfilearray[$i] = $file;
+                                               $i++;
+                                       }
                                }
+                               closedir($dir_handle);
+                               sort($myfilearray);
                        }
-                       closedir($dir_handle);
-                       sort($myfilearray);
 
                        for ($i=0;$i<count($myfilearray);$i++)
                        {
@@ -287,13 +285,9 @@
                        return $file_list;
                }
 
-               function 
read_single_custom_function($appname='',$location='',$id,$acl_location='')
+               function 
read_single_custom_function($appname='',$location='',$id)
                {
-                       if (!$acl_location && $appname && $location)
-                       {
-                               $acl_location = '.entity.' . $appname . '.' . 
$location;
-                       }
-                       return 
$this->so->read_single_custom_function($acl_location,$id);
+                       return 
$this->so->read_single_custom_function($appname,$location,$id);
                }
        }
 ?>
Index: admin/inc/class.so_custom_fields2.inc.php
diff -u admin/inc/class.so_custom_fields2.inc.php:1.1 
admin/inc/class.so_custom_fields2.inc.php:1.2
--- admin/inc/class.so_custom_fields2.inc.php:1.1       Sun Mar 26 20:00:56 2006
+++ admin/inc/class.so_custom_fields2.inc.php   Wed Mar 29 09:41:19 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.so_custom_fields2.inc.php,v 1.1 2006/03/26 
20:00:56 sigurdne Exp $
+       * @version $Id: class.so_custom_fields2.inc.php,v 1.2 2006/03/29 
09:41:19 sigurdne Exp $
        */
 
        /**
@@ -69,7 +69,7 @@
                        }
 
                        $this->db->query("DELETE FROM phpgw_cust_attribute 
WHERE appname='$appname' AND location='$location' AND 
id=$attrib_id",__LINE__,__FILE__);
-       //              $this->db->query("DELETE FROM fm_entity_history WHERE 
history_appname = 'entity_" . $appname  . '_' . $location . "' AND 
history_entity_attrib_id = $attrib_id",__LINE__,__FILE__);
+       //              $this->db->query("DELETE FROM history...
                        $this->db->transaction_commit();
                        $this->oProc->m_odb->transaction_commit();
 
@@ -446,6 +446,7 @@
                                $id = (isset($data['id'])?$data['id']:'');
                        }
 
+                       $this->db->transaction_begin();
                        $sql = "SELECT attrib_sort FROM phpgw_cust_attribute 
where appname='$appname' AND location='$location' AND id=$id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
@@ -479,6 +480,7 @@
                                        return;
                                        break;
                        }
+                       $this->db->transaction_commit();
                }
 
                function read_custom_function($data)
@@ -497,10 +499,11 @@
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $acl_location = 
(isset($data['acl_location'])?$data['acl_location']:'');
+                               $appname = 
(isset($data['appname'])?$data['appname']:'');
+                               $location = 
(isset($data['location'])?$data['location']:'');
                        }
 
-                       if(!$acl_location)
+                       if(!$location || !$appname)
                        {
                                return;
                        }
@@ -515,17 +518,17 @@
                                $ordermethod = ' order by custom_sort asc';
                        }
 
-                       $table = 'fm_custom_function';
+                       $table = 'phpgw_cust_function';
 
                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);
 
-                               $querymethod = " AND name $this->like 
'%$query%' or descr $this->like '%$query%'";
+                               $querymethod = " AND file_name $this->like 
'%$query%' or descr $this->like '%$query%'";
                        }
 
-                       $sql = "SELECT * FROM $table WHERE 
acl_location='$acl_location' $querymethod";
+                       $sql = "SELECT * FROM $table WHERE appname='$appname' 
AND location='$location' $querymethod";
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -554,10 +557,10 @@
                }
 
 
-               function read_single_custom_function($acl_location,$id)
+               function read_single_custom_function($appname,$location,$id)
                {
 
-                       $sql = "SELECT * FROM fm_custom_function where 
acl_location='$acl_location' AND id=$id";
+                       $sql = "SELECT * FROM phpgw_cust_function where 
appname='$appname' AND location='$location' AND id=$id";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -575,34 +578,31 @@
 
                function add_custom_function($custom_function)
                {
-                       if(!$custom_function['acl_location'] && 
$custom_function['appname'] && $custom_function['location'])
+                       if(!$custom_function['location'] || 
!$custom_function['appname'])
                        {
-                               $acl_location = '.entity.' . 
$custom_function['appname'] . '.' . $custom_function['location'];
+                               return  $receipt['error'][] = array('msg' => 
lang('location or appname is missing'));
                        }
                        else
                        {
-                               $acl_location = 
$custom_function['acl_location'];
-                       }
-
-                       if(!$acl_location)
-                       {
-                               return  $receipt['error'][] = array('msg' => 
lang('acl_locastion is missing'));
+                               $location = $custom_function['location'];
+                               $appname = $custom_function['appname'];
                        }
 
                        $custom_function['descr'] = 
$this->db->db_addslashes($custom_function['descr']);
 
-
-                       $this->db->query("SELECT max(id) as maximum FROM 
fm_custom_function WHERE acl_location='$acl_location'",__LINE__,__FILE__);
+                       $this->db->transaction_begin();
+                       $this->db->query("SELECT max(id) as maximum FROM 
phpgw_cust_function WHERE appname='$appname' AND 
location='$location'",__LINE__,__FILE__);
                        $this->db->next_record();
                        $custom_function['id'] = $this->db->f('maximum')+1;
 
-                       $sql = "SELECT max(custom_sort) as max_sort FROM 
fm_custom_function where acl_location='$acl_location'";
+                       $sql = "SELECT max(custom_sort) as max_sort FROM 
phpgw_cust_function where appname='$appname' AND location='$location'";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        $custom_sort    = $this->db->f('max_sort')+1;
 
                        $values= array(
-                               $acl_location,
+                               $appname,
+                               $location,
                                $custom_function['id'],
                                $custom_function['custom_function_file'],
                                $custom_function['descr'],
@@ -612,9 +612,7 @@
 
                        $values = $this->bocommon->validate_db_insert($values);
 
-                       $this->db->transaction_begin();
-
-                       $this->db->query("INSERT INTO fm_custom_function 
(acl_location, id, file_name, descr, active, custom_sort) "
+                       $this->db->query("INSERT INTO phpgw_cust_function 
(appname,location, id, file_name, descr, active, custom_sort) "
                                . "VALUES ($values)",__LINE__,__FILE__);
 
                        $receipt['id']= $custom_function['id'];
@@ -626,18 +624,14 @@
 
                function edit_custom_function($custom_function)
                {
-                       if(!$custom_function['acl_location'] && 
$custom_function['appname'] && $custom_function['location'])
+                       if(!$custom_function['location'] || 
!$custom_function['appname'])
                        {
-                               $acl_location = '.entity.' . 
$custom_function['appname'] . '.' . $custom_function['location'];
+                               return  $receipt['error'][] = array('msg' => 
lang('location or appname is missing'));
                        }
                        else
                        {
-                               $acl_location = 
$custom_function['acl_location'];
-                       }
-
-                       if(!$acl_location)
-                       {
-                               return  $receipt['error'][] = array('msg' => 
lang('acl_locastion is missing'));
+                               $location = $custom_function['location'];
+                               $appname = $custom_function['appname'];
                        }
 
                        $custom_function['descr'] = 
$this->db->db_addslashes($custom_function['descr']);
@@ -652,7 +646,7 @@
 
                                $value_set      = 
$this->bocommon->validate_db_update($value_set);
 
-                               $this->db->query("UPDATE fm_custom_function set 
$value_set WHERE acl_location='" . $acl_location . "' AND id=" . 
$custom_function['id'],__LINE__,__FILE__);
+                               $this->db->query("UPDATE phpgw_cust_function 
set $value_set WHERE appname='$appname' AND location='$location' AND id=" . 
$custom_function['id'],__LINE__,__FILE__);
 
                        $this->db->transaction_commit();
 
@@ -668,29 +662,21 @@
                                $resort = 
(isset($data['resort'])?$data['resort']:'up');
                                $appname = 
(isset($data['appname'])?$data['appname']:'');
                                $location = 
(isset($data['location'])?$data['location']:'');
-                               $acl_location = 
(isset($data['acl_location'])?$data['acl_location']:'');
                                $id = (isset($data['id'])?$data['id']:'');
                        }
 
-                       if(!$acl_location && $appname && $location)
-                       {
-                               $acl_location = '.entity.' . $appname . '.' . 
$location;
-                       }
-                       else
-                       {
-                               $acl_location = $acl_location;
-                       }
-
-                       if(!$acl_location)
+                       if(!$location || !$appname)
                        {
-                               return  $receipt['error'][] = array('msg' => 
lang('acl_locastion is missing'));
+                               return  $receipt['error'][] = array('msg' => 
lang('location or appname is missing'));
                        }
 
-                       $sql = "SELECT custom_sort FROM fm_custom_function 
where acl_location='$acl_location' AND id=$id";
+                       $this->db->transaction_begin();
+                       
+                       $sql = "SELECT custom_sort FROM phpgw_cust_function 
where appname='$appname' AND location='$location' AND id=$id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        $custom_sort    = $this->db->f('custom_sort');
-                       $sql2 = "SELECT max(custom_sort) as max_sort FROM 
fm_custom_function where acl_location='$acl_location'";
+                       $sql2 = "SELECT max(custom_sort) as max_sort FROM 
phpgw_cust_function where appname='$appname' AND location='$location'";
                        $this->db->query($sql2,__LINE__,__FILE__);
                        $this->db->next_record();
                        $max_sort       = $this->db->f('max_sort');
@@ -700,18 +686,18 @@
                                case 'up':
                                        if($custom_sort>1)
                                        {
-                                               $sql = "UPDATE 
fm_custom_function set custom_sort=$custom_sort WHERE 
acl_location='$acl_location' AND custom_sort =" . ($custom_sort-1);
+                                               $sql = "UPDATE 
phpgw_cust_function set custom_sort=$custom_sort WHERE appname='$appname' AND 
location='$location' AND custom_sort =" . ($custom_sort-1);
                                                
$this->db->query($sql,__LINE__,__FILE__);
-                                               $sql = "UPDATE 
fm_custom_function set custom_sort=" . ($custom_sort-1) ." WHERE 
acl_location='$acl_location' AND id=$id";
+                                               $sql = "UPDATE 
phpgw_cust_function set custom_sort=" . ($custom_sort-1) ." WHERE 
location='$location' AND id=$id";
                                                
$this->db->query($sql,__LINE__,__FILE__);
                                        }
                                        break;
                                case 'down':
                                        if($max_sort > $custom_sort)
                                        {
-                                               $sql = "UPDATE 
fm_custom_function set custom_sort=$custom_sort WHERE 
acl_location='$acl_location' AND custom_sort =" . ($custom_sort+1);
+                                               $sql = "UPDATE 
phpgw_cust_function set custom_sort=$custom_sort WHERE appname='$appname' AND 
location='$location' AND custom_sort =" . ($custom_sort+1);
                                                
$this->db->query($sql,__LINE__,__FILE__);
-                                               $sql = "UPDATE 
fm_custom_function set custom_sort=" . ($custom_sort+1) ." WHERE 
acl_location='$acl_location' AND id=$id";
+                                               $sql = "UPDATE 
phpgw_cust_function set custom_sort=" . ($custom_sort+1) ." WHERE 
appname='$appname' AND location='$location' AND id=$id";
                                                
$this->db->query($sql,__LINE__,__FILE__);
                                        }
                                        break;
@@ -719,24 +705,27 @@
                                        return;
                                        break;
                        }
+                       $this->db->transaction_commit();
                }
 
-               function 
delete_custom_function($acl_location,$custom_function_id)
+               function 
delete_custom_function($appname,$location,$custom_function_id)
                {
-                       $sql = "SELECT custom_sort FROM fm_custom_function 
where acl_location='$acl_location' AND id=$custom_function_id";
+                       $this->db->transaction_begin();
+                       $sql = "SELECT custom_sort FROM phpgw_cust_function 
where appname='$appname' AND location='$location' AND id=$custom_function_id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        $custom_sort    = $this->db->f('custom_sort');
-                       $sql2 = "SELECT max(custom_sort) as max_sort FROM 
fm_custom_function where acl_location='$acl_location'";
+                       $sql2 = "SELECT max(custom_sort) as max_sort FROM 
phpgw_cust_function where appname='$appname' AND location='$location'";
                        $this->db->query($sql2,__LINE__,__FILE__);
                        $this->db->next_record();
                        $max_sort       = $this->db->f('max_sort');
                        if($max_sort>$custom_sort)
                        {
-                               $sql = "UPDATE fm_custom_function set 
custom_sort=custom_sort-1 WHERE acl_location='$acl_location' AND custom_sort > 
$custom_sort";
+                               $sql = "UPDATE phpgw_cust_function set 
custom_sort=custom_sort-1 WHERE appname='$appname' AND location='$location' AND 
custom_sort > $custom_sort";
                                $this->db->query($sql,__LINE__,__FILE__);
                        }
-                       $this->db->query("DELETE FROM fm_custom_function WHERE 
acl_location='$acl_location' AND id=$custom_function_id",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM phpgw_cust_function WHERE 
appname='$appname' AND location='$location' AND 
id=$custom_function_id",__LINE__,__FILE__);
+                       $this->db->transaction_commit();
                }
        }
 ?>
Index: admin/inc/class.ui_custom_fields2.inc.php
diff -u admin/inc/class.ui_custom_fields2.inc.php:1.2 
admin/inc/class.ui_custom_fields2.inc.php:1.3
--- admin/inc/class.ui_custom_fields2.inc.php:1.2       Mon Mar 27 08:09:44 2006
+++ admin/inc/class.ui_custom_fields2.inc.php   Wed Mar 29 09:41:19 2006
@@ -10,7 +10,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.ui_custom_fields2.inc.php,v 1.2 2006/03/27 
08:09:44 sigurdne Exp $
+       * @version $Id: class.ui_custom_fields2.inc.php,v 1.3 2006/03/29 
09:41:19 sigurdne Exp $
        */
 
        /**
@@ -45,6 +45,8 @@
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                               = 
CreateObject($this->currentapp.'.bo_custom_fields2',True);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->bolocation                       = 
CreateObject('preferences.boadmin_acl');
+                       $this->bolocation->acl_app              = 
$this->bo->appname;
 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
@@ -156,10 +158,10 @@
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_attribtext'   => lang('add an 
attrib'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.edit_attrib&appname='.$appname
 . '&location=' . $location),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_attribtext'  => lang('back to 
admin'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.category&appname='.$appname),
+                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.edit_attrib&appname='.$appname
 . '&location=' . $location),
+                               'lang_done'             => lang('done'),
+                               'lang_done_attribtext'  => lang('Return to 
admin'),
+                               'done_action'           => 
$GLOBALS['phpgw']->link('/admin/index.php'),
                        );
 
                        if(!$this->allrows)
@@ -181,9 +183,6 @@
                                                'location'              
=>$location
                        );
 
-                       $this->bolocation       = 
CreateObject('preferences.boadmin_acl');
-                       $this->bolocation->acl_app = $appname;
-
                        $data = array
                        (
                                'lang_appname'                                  
=> lang('application'),
@@ -212,10 +211,9 @@
 
                        );
 
-                       $appname                                                
= lang('attribute');
                        $function_msg                                   = 
lang('list custom attribute');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' .lang('attribute') . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
                        $this->save_sessiondata();
                }
@@ -428,9 +426,9 @@
                        $resort = get_var('resort',array('POST','GET'));
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                                               
'custom_fields2',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                                                                       
'custom_fields2',
+                                                                       
'nextmatchs',
+                                                                       
'search_field'));
 
                        if($resort)
                        {
@@ -445,22 +443,22 @@
 
                                        $content[] = array
                                        (
-                                               'file_name'                     
                        => $entry['file_name'],
+                                               'file_name'                     
        => $entry['file_name'],
                                                'descr'                         
        => $entry['descr'],
-                                               'sorting'                       
                => $entry['sorting'],
-                                               'active'                        
                => $entry['active']?'X':'',
-                                               'link_up'                       
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.list_custom_function&resort=up&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id'] . '&allrows=' . 
$this->allrows),
-                                               'link_down'                     
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.list_custom_function&resort=down&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id'] . '&allrows=' . 
$this->allrows),
-                                               'link_edit'                     
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.edit_custom_function&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id']),
+                                               'sorting'                       
        => $entry['sorting'],
+                                               'active'                        
        => $entry['active']?'X':'',
+                                               'link_up'                       
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.list_custom_function&resort=up&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id'] . '&allrows=' . 
$this->allrows),
+                                               'link_down'                     
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.list_custom_function&resort=down&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id'] . '&allrows=' . 
$this->allrows),
+                                               'link_edit'                     
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.edit_custom_function&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id']),
                                                'link_delete'                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.delete&appname='
 . $appname . '&location=' . $location . '&custom_function_id=' . $entry['id']),
                                                'lang_up_text'                  
        => lang('shift up'),
                                                'lang_down_text'                
        => lang('shift down'),
                                                'lang_edit_text'                
        => lang('edit the custom_function'),
                                                'lang_delete_text'              
        => lang('delete the custom_function'),
                                                'text_custom_function'          
        => lang('custom functions'),
-                                               'text_up'                       
                => lang('up'),
-                                               'text_down'                     
                => lang('down'),
-                                               'text_edit'                     
                => lang('edit'),
+                                               'text_up'                       
        => lang('up'),
+                                               'text_down'                     
        => lang('down'),
+                                               'text_edit'                     
        => lang('edit'),
                                                'text_delete'                   
        => lang('delete')
                                        );
                                }
@@ -499,12 +497,12 @@
 
                        $table_add[] = array
                        (
-                               'lang_add'                              => 
lang('add'),
+                               'lang_add'                      => lang('add'),
                                'lang_add_custom_functiontext'  => lang('add a 
custom_function'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.edit_custom_function&appname='.$appname
 . '&location=' . $location),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_custom_functiontext' => lang('back 
to admin'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom_fields2.category&appname='.$appname),
+                               'lang_done'                     => lang('done'),
+                               'lang_done_custom_functiontext' => lang('Return 
to admin'),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
                        );
 
                        if(!$this->allrows)
@@ -526,15 +524,10 @@
                                                'location'              
=>$location
                        );
 
-                       $entity = $this->bo->read_single($appname,false);
-                       $category = 
$this->bo->read_single_category($appname,$location);
-
                        $data = array
                        (
-                               'lang_entity'                                   
=> lang('entity'),
-                               'entity_name'                                   
=> $entity['name'],
-                               'lang_category'                                 
=> lang('category'),
-                               'category_name'                                 
=> $category['name'],
+                               'lang_appname'                                  
=> lang('application'),
+                               'appname'                                       
=> $appname,
                                'allow_allrows'                                 
=> True,
                                'allrows'                                       
=> $this->allrows,
                                'start_record'                                  
=> $this->start,
@@ -542,21 +535,25 @@
                                'start_record'                                  
=> $this->start,
                                'num_records'                                   
=> count($custom_function_list),
                                'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
                                'lang_searchfield_custom_functiontext'  => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
                                'lang_searchbutton_custom_functiontext' => 
lang('Submit the search string'),
-                               'query'                                         
        => $this->query,
+                               'query'                                         
=> $this->query,
                                'lang_search'                                   
=> lang('search'),
                                'table_header_custom_function'                  
=> $table_header,
-                               'values_custom_function'                        
                => $content,
-                               'table_add'                                     
        => $table_add
+                               'values_custom_function'                        
=> $content,
+                               'table_add'                                     
=> $table_add,
+                               'lang_no_location'                              
=> lang('No location'),
+                               'lang_location_statustext'                      
=> lang('Select submodule'),
+                               'select_name_location'                          
=> 'location',
+                               'location_list'                                 
=> $this->bolocation->select_location('filter',$location,False,True),
+
                        );
 
-                       $appname                                                
= lang('custom function');
-                       $function_msg                                   = 
lang('list entity custom function');
+                       $function_msg                                   = 
lang('list custom function');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' .lang('custom function') . ': ' . 
$function_msg;        
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_custom_function' => 
$data));
                        $this->save_sessiondata();
                }
@@ -634,17 +631,14 @@
 
 //_debug_array($values);
 
-                       $entity = $this->bo->read_single($appname,false);
-                       $category = 
$this->bo->read_single_category($appname,$location);
-
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
                        (
-                               'lang_entity'                                   
=> lang('entity'),
-                               'entity_name'                                   
=> $entity['name'],
-                               'lang_category'                                 
=> lang('category'),
-                               'category_name'                                 
=> $category['name'],
+                               'lang_appname'                                  
=> lang('appname'),
+                               'appname'                                       
=> $appname,
+                               'lang_location'                                 
=> lang('location'),
+                               'location'                                      
=> $location,
 
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
@@ -666,16 +660,15 @@
                                'lang_custom_function'                          
=> lang('custom function'),
                                'lang_custom_function_statustext'       => 
lang('Select a custom function'),
                                'lang_no_custom_function'                       
=> lang('No custom function'),
-                               'custom_function_list'                          
=> $this->bo->select_custom_function($values['custom_function_file']),
+                               'custom_function_list'                          
=> $this->bo->select_custom_function($values['custom_function_file'],$appname),
 
                                'value_active'                  => 
$values['active'],
                                'lang_active'                           => 
lang('Active'),
                                'lang_active_statustext'        => lang('check 
to activate custom function'),
                        );
 
-                       $appname                                                
= lang('entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . lang('custom function') . ': ' . 
$function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_custom_function' => 
$data));
                }
 
@@ -684,7 +677,6 @@
                        $appname                = 
get_var('appname',array('POST','GET'));
                        $location               = 
get_var('location',array('POST','GET'));
                        $attrib_id              = 
get_var('attrib_id',array('POST','GET'));
-                       $acl_location           = 
get_var('acl_location',array('POST','GET'));
                        $custom_function_id     = 
get_var('custom_function_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));
 
@@ -712,13 +704,12 @@
                                'location' => $location,
                                'appname' => $appname,
                                'attrib_id' => $attrib_id,
-                               'acl_location' => $acl_location,
                                'custom_function_id' => $custom_function_id
                        );
 
                        if (get_var('confirm',array('POST')))
                        {
-                               
$this->bo->delete($location,$appname,$attrib_id,$acl_location,$custom_function_id);
+                               
$this->bo->delete($location,$appname,$attrib_id,$custom_function_id);
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
@@ -731,7 +722,7 @@
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                      => lang('yes'),
                                'lang_yes_standardtext' => lang('Delete the 
entry'),
-                               'lang_no_standardtext'  => lang('Back to the 
list'),
+                               'lang_no_standardtext'  => lang('Return to 
list'),
                                'lang_no'                               => 
lang('no')
                        );
 
Index: admin/inc/hook_admin.inc.php
diff -u admin/inc/hook_admin.inc.php:1.40 admin/inc/hook_admin.inc.php:1.41
--- admin/inc/hook_admin.inc.php:1.40   Sun Mar 26 19:58:40 2006
+++ admin/inc/hook_admin.inc.php        Wed Mar 29 09:41:20 2006
@@ -8,7 +8,7 @@
        *  Free Software Foundation; either version 2 of the License, or (at 
your  *
        *  option) any later version.                                           
   *
        
\**************************************************************************/
-       /* $Id: hook_admin.inc.php,v 1.40 2006/03/26 19:58:40 sigurdne Exp $ */
+       /* $Id: hook_admin.inc.php,v 1.41 2006/03/29 09:41:20 sigurdne Exp $ */
 
        if (! $GLOBALS['phpgw']->acl->check('site_config_access',1,'admin'))
        {
@@ -58,6 +58,11 @@
                $file['custom fields2'] = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'admin.ui_custom_fields2.list_attribute', 'appname' => 
'tts') );
        }
 
+       if (! $GLOBALS['phpgw']->acl->check('custom_fields_access',1,'admin'))
+       {
+               $file['custom functions'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom_fields2.list_custom_function', 'appname' => 'tts') );
+       }
+
        if 
(!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',1,'admin') || 
!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',2,'admin'))
        {
                $file['Change Main Screen Message'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uimainscreen.index') );




reply via email to

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