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.inc.php class.bo_cust...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] admin/inc class.ui_custom.inc.php class.bo_cust...
Date: Mon, 09 Oct 2006 13:27:19 +0000

CVSROOT:        /sources/phpgroupware
Module name:    admin
Changes by:     Sigurd Nes <sigurdne>   06/10/09 13:27:19

Modified files:
        inc            : class.ui_custom.inc.php class.bo_custom.inc.php 

Log message:
        merging admin/inc/class.so_custom.inc.php and 
phpgwapi/inc/class.custom_fields.inc.php

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.ui_custom.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.bo_custom.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4

Patches:
Index: class.ui_custom.inc.php
===================================================================
RCS file: /sources/phpgroupware/admin/inc/class.ui_custom.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- class.ui_custom.inc.php     9 Oct 2006 11:51:50 -0000       1.4
+++ class.ui_custom.inc.php     9 Oct 2006 13:27:19 -0000       1.5
@@ -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.inc.php,v 1.4 2006/10/09 11:51:50 
sigurdne Exp $
+       * @version $Id: class.ui_custom.inc.php,v 1.5 2006/10/09 13:27:19 
sigurdne Exp $
        */
 
        /**
@@ -43,8 +43,7 @@
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bo                               = 
CreateObject($this->currentapp.'.bo_custom',True);
-                       $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->bo                                       = 
CreateObject('admin.bo_custom',True);
                        $this->bolocation                       = 
CreateObject('preferences.boadmin_acl');
                        $this->bolocation->acl_app              = 
$this->bo->appname;
 
@@ -89,7 +88,7 @@
                        {
                                $this->bo->resort_attrib($id,$resort);
                        }
-                       $attrib_list = 
$this->bo->read_attrib($appname,$location);
+                       $attrib_list = 
$this->bo->get_attribs($appname,$location);
 
                        if (isset($attrib_list) AND is_array($attrib_list))
                        {
@@ -202,7 +201,7 @@
                                'query'                                         
                => $this->query,
                                'lang_search'                                   
        => lang('search'),
                                'table_header_attrib'                           
=> $table_header,
-                               'values_attrib'                                 
        => $content,
+                               'values_attrib'                                 
        => (isset($content)?$content:''),
                                'table_add'                                     
                => $table_add,
 
                                'lang_no_location'                              
        => lang('No location'),
@@ -293,7 +292,7 @@
                                        $receipt['error'][] = 
array('msg'=>lang('Nullable not chosen!'));
                                }
 
-                               if (!$receipt['error'])
+                               if (!isset($receipt['error']))
                                {
                                        $receipt = 
$this->bo->save_attrib($values);
 
@@ -311,7 +310,7 @@
 
                        if ($id)
                        {
-                               $values = 
$this->bo->read_single_attrib($appname,$location,$id);
+                               $values = 
$this->bo->get_attrib_single($appname,$location,$id);
                                $type_name=$values['type_name'];
                                $function_msg = lang('edit attribute'). ' ' . 
lang($type_name);
                        }
@@ -324,7 +323,7 @@
                        (
                                'menuaction'    => 
$this->currentapp.'.ui_custom.edit_attrib',
                                'appname'       => $appname,
-                               'location'      => $location,
+                               'location'      => $values['location'],
                                'id'            => $id
                        );
 
@@ -336,7 +335,7 @@
 
 //_debug_array($values);
 
-                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
+                       $msgbox_data = 
(isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'');
 
                        $data = array
                        (
@@ -384,7 +383,7 @@
                                'lang_datatype'                                 
        => lang('Datatype'),
                                'lang_datatype_statustext'                      
=> lang('Select a datatype'),
                                'lang_no_datatype'                              
        => lang('No datatype'),
-                               'datatype_list'                                 
        => 
$this->bocommon->select_datatype((isset($values['column_info']['type'])?$values['column_info']['type']:'')),
+                               'datatype_list'                                 
        => 
$this->bo->select_datatype((isset($values['column_info']['type'])?$values['column_info']['type']:'')),
 
                                'lang_precision'                                
        => lang('Precision'),
                                'lang_precision_statustext'                     
=> lang('enter the record length'),
@@ -401,7 +400,7 @@
                                'lang_nullable'                                 
        => lang('Nullable'),
                                'lang_nullable_statustext'                      
=> lang('Chose if this column is nullable'),
                                'lang_select_nullable'                          
=> lang('Select nullable'),
-                               'nullable_list'                                 
        => 
$this->bocommon->select_nullable((isset($values['column_info']['nullable'])?$values['column_info']['nullable']:'')),
+                               'nullable_list'                                 
        => 
$this->bo->select_nullable((isset($values['column_info']['nullable'])?$values['column_info']['nullable']:'')),
                                'value_lookup_form'                             
        => (isset($values['lookup_form'])?$values['lookup_form']:''),
                                'lang_lookup_form'                              
        => lang('show in lookup forms'),
                                'lang_lookup_form_statustext'           => 
lang('check to show this attribue in lookup forms'),
@@ -420,7 +419,7 @@
                                'lang_location_statustext'                      
=> lang('Select submodule'),
                                'select_name_location'                          
=> 'values[location]',
 
-                               'location_list'                                 
        => 
$this->bolocation->select_location('select',$values['location'],False,True)
+                               'location_list'                                 
        => 
$this->bolocation->select_location('select',(isset($values['location'])?$values['location']:''),False,True)
                        );
 //_debug_array($values);
 
@@ -643,7 +642,7 @@
 
 //_debug_array($values);
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       $msgbox_data = 
(isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'');
 
                        $data = array
                        (

Index: class.bo_custom.inc.php
===================================================================
RCS file: /sources/phpgroupware/admin/inc/class.bo_custom.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- class.bo_custom.inc.php     9 Oct 2006 11:51:10 -0000       1.3
+++ class.bo_custom.inc.php     9 Oct 2006 13:27:19 -0000       1.4
@@ -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.inc.php,v 1.3 2006/10/09 11:51:10 
sigurdne Exp $
+       * @version $Id: class.bo_custom.inc.php,v 1.4 2006/10/09 13:27:19 
sigurdne Exp $
        */
 
        /**
@@ -57,8 +57,7 @@
                function bo_custom($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->so               = 
CreateObject($this->currentapp.'.so_custom');
-                       $this->bocommon = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->so               = 
CreateObject('phpgwapi.custom_fields');
 
                        if ($session)
                        {
@@ -153,19 +152,22 @@
                        endif;
                }
 
-               function read_attrib($appname='',$location='',$allrows='')
+               function get_attribs($appname='',$location='',$allrows='')
                {
                        if($allrows)
                        {
                                $this->allrows = $allrows;
                        }
 
-                       $attrib = $this->so->read_attrib(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'location' => $location,'appname' => 
$appname,'allrows'=>$this->allrows));
+                       //$attrib = $this->so->get_attribs(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                       //                                                      
        'location' => $location,'appname' => 
$appname,'allrows'=>$this->allrows));
+
+
+                       $attrib = $this->so->get_attribs($appname, $location, 
$this->start, $this->query, $this->sort, $this->order, $this->allrows, 
$inc_choices = false);
 
                        for ($i=0; $i<count($attrib); $i++)
                        {
-                               $attrib[$i]['datatype'] = 
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+                               $attrib[$i]['datatype'] = 
$this->so->translate_datatype($attrib[$i]['datatype']);
                        }
 
                        $this->total_records = $this->so->total_records;
@@ -173,14 +175,14 @@
                        return $attrib;
                }
 
-               function read_single_attrib($appname,$location,$id)
+               function get_attrib_single($appname,$location,$id)
                {
-                       return 
$this->so->read_single_attrib($appname,$location,$id);
+                       return 
$this->so->get_attrib_single($appname,$location,$id);
                }
 
                function resort_attrib($id,$resort)
                {
-                       
$this->so->resort_attrib(array('resort'=>$resort,'appname' => 
$this->appname,'location' => $this->location,'id'=>$id));
+                       $this->so->resort_attrib($id, $resort, $this->appname, 
$this->location);
                }
 
                function save_attrib($attrib)
@@ -285,5 +287,76 @@
                {
                        return 
$this->so->read_single_custom_function($appname,$location,$id);
                }
+
+               function select_datatype($selected='')
+               {
+                       $datatypes[0]['id']= 'V';
+                       $datatypes[0]['name']= lang('varchar');
+                       $datatypes[1]['id']= 'C';
+                       $datatypes[1]['name']= lang('Character');
+                       $datatypes[2]['id']= 'I';
+                       $datatypes[2]['name']= lang('Integer');
+                       $datatypes[3]['id']= 'N';
+                       $datatypes[3]['name']= lang('Decimal');
+                       $datatypes[4]['id']= 'D';
+                       $datatypes[4]['name']= lang('Date');
+                       $datatypes[5]['id']= 'T';
+                       $datatypes[5]['name']= lang('Memo');
+                       $datatypes[6]['id']= 'R';
+                       $datatypes[6]['name']= lang('Multiple radio');
+                       $datatypes[7]['id']= 'CH';
+                       $datatypes[7]['name']= lang('Multiple Checkbox');
+                       $datatypes[8]['id']= 'LB';
+                       $datatypes[8]['name']= lang('ListBox');
+                       $datatypes[9]['id']= 'AB';
+                       $datatypes[9]['name']= lang('Contact');
+                       $datatypes[10]['id']= 'VENDOR';
+                       $datatypes[10]['name']= lang('Vendor');
+                       $datatypes[11]['id']= 'email';
+                       $datatypes[11]['name']= lang('Email');
+                       $datatypes[12]['id']= 'link';
+                       $datatypes[12]['name']= lang('Link');
+
+                       return $this->select_list($selected,$datatypes);
+
+               }
+
+               function select_nullable($selected='')
+               {
+                       $nullable[0]['id']= 'True';
+                       $nullable[0]['name']= lang('True');
+                       $nullable[1]['id']= 'False';
+                       $nullable[1]['name']= lang('False');
+
+                       return $this->select_list($selected,$nullable);
+               }
+
+               function select_list($selected='',$input_list='')
+               {
+                       if (isset($input_list) AND is_array($input_list))
+                       {
+                               foreach($input_list as $entry)
+                               {
+                                       if ($entry['id']==$selected)
+                                       {
+                                               $entry_list[] = array
+                                               (
+                                                       'id'            => 
$entry['id'],
+                                                       'name'          => 
$entry['name'],
+                                                       'selected'      => 
'selected'
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $entry_list[] = array
+                                               (
+                                                       'id'            => 
$entry['id'],
+                                                       'name'          => 
$entry['name']
+                                               );
+                                       }
+                               }
+                       }
+                       return $entry_list;
+               }
        }
 ?>




reply via email to

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