phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.bostandard_entity.inc.php,1.


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bostandard_entity.inc.php,1.1,1.2 class.sostandard_entity.inc.php,1.1,1.2 class.uistandard_entity.inc.php,1.1,1.2
Date: Sat, 14 Dec 2002 04:00:19 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv24839/inc

Modified Files:
        class.bostandard_entity.inc.php 
        class.sostandard_entity.inc.php 
        class.uistandard_entity.inc.php 
Log Message:
no message

Index: class.bostandard_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bostandard_entity.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.bostandard_entity.inc.php     13 Dec 2002 18:13:33 -0000      1.1
--- class.bostandard_entity.inc.php     14 Dec 2002 09:00:12 -0000      1.2
***************
*** 143,159 ****
                }
  
!               function save_attrib($standard,$action='',$type ='')
                {
                        if ($action=='edit')
                        {
!                               if ($standard['id'] != '')
                                {
  
!                                       $message = 
$this->so->edit_sttrib($standard,$type);
                                }
                        }
                        else
                        {
!                               $message = 
$this->so->add_attrib($standard,$type);
                        }
                        return $message;
--- 143,159 ----
                }
  
!               function save_attrib($attrib,$action='',$type ='')
                {
                        if ($action=='edit')
                        {
!                               if ($attrib['id'] != '')
                                {
  
!                                       $message = 
$this->so->edit_attrib($attrib,$type);
                                }
                        }
                        else
                        {
!                               $message = $this->so->add_attrib($attrib,$type);
                        }
                        return $message;

Index: class.sostandard_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sostandard_entity.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.sostandard_entity.inc.php     13 Dec 2002 18:13:33 -0000      1.1
--- class.sostandard_entity.inc.php     14 Dec 2002 09:00:14 -0000      1.2
***************
*** 221,225 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " and (num LIKE '%$query%' or 
descr LIKE '%$query%')";
                        }
  
--- 221,225 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " and ($table.num LIKE 
'%$query%' or $table.descr LIKE '%$query%')";
                        }
  
***************
*** 267,270 ****
--- 267,367 ----
                        }
                }
+ 
+ 
+               function add_attrib($attrib,$type)
+               {
+                       $errorcount = 0;
+ 
+                       if (!$attrib['type_id'])
+                       {
+                               $error[$errorcount++] = 
array('msg'=>lang('Entity type not choosen!'));
+                       }
+ 
+                       if (!$attrib['datatype'])
+                       {
+                               $error[$errorcount++] = 
array('msg'=>lang('Datatype type not choosen!'));
+                       }
+ 
+                       if (!$attrib['num'])
+                       {
+                               $error[$errorcount++] = array('msg'=>lang('Name 
not entered!'));
+                       }
+ 
+                       if (! $error)
+                       {
+ 
+                               $table = $this->select_table_attrib($type);
+ 
+                               $attrib['id'] = 
$this->socommon->next_id($table);
+                               $attrib['num'] = 
$this->db->db_addslashes($attrib['num']);
+                               $attrib['descr'] = 
$this->db->db_addslashes($attrib['descr']);
+ 
+                               $this->db->query("INSERT INTO $table (id, 
type_id, num, descr, datatype) "
+                                       . "VALUES ('" . $attrib['id'] . "','" . 
$attrib['type_id'] . "','" . $attrib['num'] . "','" . $attrib['descr'] . "','" 
. $attrib['datatype']. "')",__LINE__,__FILE__);
+ 
+                               $receipt = array(
+                                       'id'            => $attrib['id'],
+                                       'message'       => lang('Attribute has 
been saved')
+                               );
+ 
+ 
+                       }
+                       else
+                       {
+                               $receipt = array(
+                                       'error'         => $error,
+                                       'message'       => lang('Attribute has 
NOT been saved')
+                               );
+                       }
+                       return $receipt;
+               }
+ 
+               function edit_attrib($attrib,$type)
+               {
+ 
+                       $errorcount = 0;
+ 
+                       if (!$attrib['type_id'])
+                       {
+                               $error[$errorcount++] = 
array('msg'=>lang('Entity type not choosen!'));
+                       }
+ 
+                       if (!$attrib['datatype'])
+                       {
+                               $error[$errorcount++] = 
array('msg'=>lang('Datatype type not choosen!'));
+                       }
+ 
+                       if (!$attrib['num'])
+                       {
+                               $error[$errorcount++] = array('msg'=>lang('Name 
not entered!'));
+                       }
+ 
+                       if (! $error)
+                       {
+ 
+                               $table = $this->select_table_attrib($type);
+ 
+                               $attrib['num'] = 
$this->db->db_addslashes($attrib['num']);
+                               $attrib['descr'] = 
$this->db->db_addslashes($attrib['descr']);
+ 
+                               $this->db->query("UPDATE $table set descr='" . 
$attrib['descr'] . "', num='". $attrib['num'] . "', type_id='". 
$attrib['type_id'] . "', datatype='". $attrib['datatype']
+                                       . "' WHERE id='" . $attrib['id']. 
"'",__LINE__,__FILE__);
+ 
+ 
+                               $receipt = array(
+                                       'message'       => lang('Attribute has 
been edited')
+                               );
+ 
+                       }
+                       else
+                       {
+                               $receipt = array(
+                                       'error'         => $error,
+                                       'message'       => lang('Attribute has 
NOT been edited')
+                               );
+                       }
+                       return $receipt;
+               }
+ 
  
                function select_entity_type($type='')

Index: class.uistandard_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uistandard_entity.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.uistandard_entity.inc.php     13 Dec 2002 18:13:33 -0000      1.1
--- class.uistandard_entity.inc.php     14 Dec 2002 09:00:14 -0000      1.2
***************
*** 23,28 ****
                        'edit'                          => True,
                        'delete'                        => True,
!                       'list_attribute'        => True,
!                       'edit_attrib'           => True
                );
  
--- 23,29 ----
                        'edit'                          => True,
                        'delete'                        => True,
!                       'list_attribute'        => True,
!                       'edit_attrib'           => True,
!                       'delete_attrib'         => True
                );
  
***************
*** 370,377 ****
                {
                        $type_id        = 
get_var('type_id',array('POST','GET'));
!                       $type   = get_var('type',array('POST','GET'));
!                       $id     = get_var('id',array('POST','GET'));
!                       $values                 = 
get_var('values',array('POST'));
  
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_entity',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
--- 371,379 ----
                {
                        $type_id        = 
get_var('type_id',array('POST','GET'));
!                       $type           = get_var('type',array('POST','GET'));
!                       $id                     = 
get_var('id',array('POST','GET'));
!                       $values         = get_var('values',array('POST'));
  
+ //_debug_array($values);
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_entity',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
***************
*** 383,399 ****
                                        $action='edit';
                                }
!                               else
!                               {
!                       //              $id                             = 
$values['id'];
!                                       $attrib['num']          = 
$values['num'];
!                                       $attrib['descr']        = 
$values['descr'];
!                               }
  
  
-                               $message = 
$this->bo->save($values,$action,$type);
                                if(!$id)
                                {
!                                       $id=$message['id'];
!                                       $message=$message['message'];
                                }
  
--- 385,398 ----
                                        $action='edit';
                                }
!                               $attrib['num']          = $values['num'];
!                               $attrib['descr']        = $values['descr'];
!                               $type_id                        = 
$values['type_id'];
  
+                               $receipt = 
$this->bo->save_attrib($values,$action,$type);
+ //_debug_array($receipt);
  
                                if(!$id)
                                {
!                                       $id=$receipt['id'];
                                }
  
***************
*** 436,440 ****
                                'value_id'                                      
=> $id,
                                'value_num'                                     
=> $attrib['num'],
!                               'message'                                       
=> $message,
                                'lang_id_attribtext'            => lang('Enter 
the attribute ID'),
                                'lang_entity_statustext'        => lang('Select 
a entity type'),
--- 435,440 ----
                                'value_id'                                      
=> $id,
                                'value_num'                                     
=> $attrib['num'],
!                               'message'                                       
=> $receipt['message'],
!                               'error'                                         
=> $receipt['error'],
                                'lang_id_attribtext'            => lang('Enter 
the attribute ID'),
                                'lang_entity_statustext'        => lang('Select 
a entity type'),
***************
*** 444,448 ****
                                'type_id'                                       
=> $attrib['type_id'],
                                'value_descr'                           => 
$attrib['descr'],
!                               'entity_list'                           => 
$this->bo->select_entity_type($type,$attrib['type_id']),
                                'select_entity_type'            => 
'values[type_id]',
                                'lang_datatype'                         => 
lang('Datatype'),
--- 444,448 ----
                                'type_id'                                       
=> $attrib['type_id'],
                                'value_descr'                           => 
$attrib['descr'],
!                               'entity_list'                           => 
$this->bo->select_entity_type($type,$type_id),
                                'select_entity_type'            => 
'values[type_id]',
                                'lang_datatype'                         => 
lang('Datatype'),
***************
*** 452,458 ****
--- 452,497 ----
                                'select_datatype'                       => 
'values[datatype]'
                        );
+ //_debug_array($data);
  
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
                }
+               function delete_attrib()
+               {
+                       $type   = get_var('type',array('POST','GET'));
+                       $id             = get_var('id',array('POST','GET'));
+                       $confirm                = 
get_var('confirm',array('POST'));
+ 
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->currentapp.'.uistandard_entity.index',
+                               'type' => $type
+                       );
+ 
+                       if (get_var('confirm',array('POST')))
+                       {
+                               $this->bo->delete($id,$type);
+                               Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       }
+ 
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_delete',
+                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header'));
+ 
+                       $data = array
+                       (
+                               'appname'                               => 
lang($type),
+                               'function_msg'                  => lang('delete 
standard'),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
 . $id.'&type='.$type),
+                               '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'                               => 
lang('no')
+                       );
+ 
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+               }
+ 
+ 
        }
  ?>




reply via email to

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