phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.soentity.inc.php, 1.2, 1.3 class.s


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] property/inc class.soentity.inc.php, 1.2, 1.3 class.soadmin_entity.inc.php, 1.3, 1.4 class.uiadmin_entity.inc.php, 1.3, 1.4 class.boadmin_entity.inc.php, 1.2, 1.3
Date: Sun, 19 Oct 2003 12:22:36 +0000

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

Modified Files:
        class.soentity.inc.php class.soadmin_entity.inc.php 
        class.uiadmin_entity.inc.php class.boadmin_entity.inc.php 
Log Message:
no message

Index: class.soadmin_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soadmin_entity.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** class.soadmin_entity.inc.php        18 Oct 2003 22:15:51 -0000      1.3
--- class.soadmin_entity.inc.php        19 Oct 2003 12:22:34 -0000      1.4
***************
*** 699,702 ****
--- 699,708 ----
                        $attrib['id'] = 
$this->next_id('fm_entity_attribute',array('entity_id'=>$attrib['entity_id'],'cat_id'=>$attrib['cat_id']));
  
+                       $sql = "SELECT max(attrib_sort) as max_sort FROM 
fm_entity_attribute where entity_id=" . $attrib['entity_id'] . " AND cat_id=" . 
$attrib['cat_id'];
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $attrib_sort    = $this->db->f('max_sort')+1;
+ 
+ 
                        $values= array(
                                $attrib['entity_id'],
***************
*** 707,710 ****
--- 713,717 ----
                                $attrib['statustext'],
                                $attrib['list'],
+                               $attrib_sort,
                                $attrib['column_info']['type'],
                                $attrib['column_info']['precision'],
***************
*** 718,722 ****
                        $this->db->transaction_begin();
  
!                       $this->db->query("INSERT INTO fm_entity_attribute 
(entity_id,cat_id,id,column_name, input_text, statustext,list, 
datatype,precision_,scale,default_value,nullable) "
                                . "VALUES ($values)",__LINE__,__FILE__);
  
--- 725,729 ----
                        $this->db->transaction_begin();
  
!                       $this->db->query("INSERT INTO fm_entity_attribute 
(entity_id,cat_id,id,column_name, input_text, statustext,list,attrib_sort, 
datatype,precision_,scale,default_value,nullable) "
                                . "VALUES ($values)",__LINE__,__FILE__);
  
***************
*** 842,845 ****
--- 849,896 ----
  
                        return $receipt;
+               }
+               function resort_attrib($data)
+               {
+                       if(is_array($data))
+                       {
+                               $resort = 
(isset($data['resort'])?$data['resort']:'up');
+                               $entity_id = 
(isset($data['entity_id'])?$data['entity_id']:0);
+                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
+                               $id = (isset($data['id'])?$data['id']:'');
+                       }
+ 
+                       $sql = "SELECT attrib_sort FROM fm_entity_attribute 
where entity_id=$entity_id AND cat_id=$cat_id AND id=$id";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $attrib_sort    = $this->db->f('attrib_sort');
+                       $sql2 = "SELECT max(attrib_sort) as max_sort FROM 
fm_entity_attribute where entity_id=$entity_id AND cat_id=$cat_id";
+                       $this->db->query($sql2,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $max_sort       = $this->db->f('max_sort');
+ 
+                       switch($resort)
+                       {
+                               case 'up':
+                                       if($attrib_sort>1)
+                                       {
+                                               $sql = "UPDATE 
fm_entity_attribute set attrib_sort=$attrib_sort WHERE entity_id=$entity_id AND 
cat_id=$cat_id AND attrib_sort =" . ($attrib_sort-1);
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               $sql = "UPDATE 
fm_entity_attribute set attrib_sort=" . ($attrib_sort-1) ." WHERE 
entity_id=$entity_id AND cat_id=$cat_id AND id=$id";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                       }
+                                       break;
+                               case 'down':
+                                       if($max_sort > $attrib_sort)
+                                       {
+                                               $sql = "UPDATE 
fm_entity_attribute set attrib_sort=$attrib_sort WHERE entity_id=$entity_id AND 
cat_id=$cat_id AND attrib_sort =" . ($attrib_sort+1);
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               $sql = "UPDATE 
fm_entity_attribute set attrib_sort=" . ($attrib_sort+1) ." WHERE 
entity_id=$entity_id AND cat_id=$cat_id AND id=$id";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                       }
+                                       break;
+                               default:
+                                       return;
+                                       break;
+                       }
                }
        }

Index: class.soentity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soentity.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** class.soentity.inc.php      18 Oct 2003 22:31:53 -0000      1.2
--- class.soentity.inc.php      19 Oct 2003 12:22:33 -0000      1.3
***************
*** 302,306 ****
                        $id =$data['id'];
  
!                       $this->db->query("SELECT * FROM fm_entity_attribute 
WHERE entity_id =$entity_id AND cat_id =$cat_id ");
  
                        while ($this->db->next_record())
--- 302,306 ----
                        $id =$data['id'];
  
!                       $this->db->query("SELECT * FROM fm_entity_attribute 
WHERE entity_id =$entity_id AND cat_id =$cat_id ORDER BY attrib_sort");
  
                        while ($this->db->next_record())

Index: class.boadmin_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boadmin_entity.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** class.boadmin_entity.inc.php        18 Oct 2003 22:15:51 -0000      1.2
--- class.boadmin_entity.inc.php        19 Oct 2003 12:22:34 -0000      1.3
***************
*** 287,290 ****
--- 287,295 ----
                }
  
+               function resort_attrib($id,$resort)
+               {
+                       
$this->so->resort_attrib(array('resort'=>$resort,'entity_id' => 
$this->entity_id,'cat_id' => $this->cat_id,'id'=>$id));
+               }
+ 
                function save_attrib($attrib,$action='')
                {

Index: class.uiadmin_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiadmin_entity.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** class.uiadmin_entity.inc.php        18 Oct 2003 22:15:51 -0000      1.3
--- class.uiadmin_entity.inc.php        19 Oct 2003 12:22:34 -0000      1.4
***************
*** 792,797 ****
                function list_attribute()
                {
!                       $entity_id      = 
get_var('entity_id',array('POST','GET'));
!                       $cat_id = get_var('cat_id',array('POST','GET'));
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
--- 792,799 ----
                function list_attribute()
                {
!                       $entity_id      = $this->entity_id;
!                       $cat_id = $this->cat_id;
!                       $id     = get_var('id',array('POST','GET'));
!                       $resort = get_var('resort',array('POST','GET'));
  
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
***************
*** 800,803 ****
--- 802,809 ----
                                                                                
'search_field'));
  
+                       if($resort)
+                       {
+                               $this->bo->resort_attrib($id,$resort);
+                       }
                        $attrib_list = 
$this->bo->read_attrib($entity_id,$cat_id);
  
***************
*** 813,823 ****
                                                'column_name'                   
        => $entry['column_name'],
                                                'input_text'                    
        => $entry['input_text'],
                                                'link_edit'                     
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit_attrib&entity_id='
 . $entity_id . '&cat_id=' . $cat_id . '&id=' . $entry['id']),
                                                'link_delete'                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.delete&entity_id='
 . $entity_id . '&cat_id=' . $cat_id . '&attrib_id=' . $entry['id']),
!                                               'lang_view_attribtext'          
=> lang('view the attrib'),
!                                               'lang_attribute_attribtext'     
=> lang('attributes for the attrib'). ' ' . lang('entity'),
!                                               'lang_edit_attribtext'          
=> lang('edit the attrib'),
!                                               'lang_delete_attribtext'        
=> lang('delete the attrib'),
                                                'text_attribute'                
        => lang('Attributes'),
                                                'text_edit'                     
                => lang('edit'),
                                                'text_delete'                   
        => lang('delete')
--- 819,834 ----
                                                'column_name'                   
        => $entry['column_name'],
                                                'input_text'                    
        => $entry['input_text'],
+                                               'sorting'                       
                => $entry['attrib_sort'],
+                                               'link_up'                       
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.list_attribute&resort=up&entity_id='
 . $entity_id . '&cat_id=' . $cat_id . '&id=' . $entry['id']),
+                                               'link_down'                     
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.list_attribute&resort=down&entity_id='
 . $entity_id . '&cat_id=' . $cat_id . '&id=' . $entry['id']),
                                                'link_edit'                     
                => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.edit_attrib&entity_id='
 . $entity_id . '&cat_id=' . $cat_id . '&id=' . $entry['id']),
                                                'link_delete'                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_entity.delete&entity_id='
 . $entity_id . '&cat_id=' . $cat_id . '&attrib_id=' . $entry['id']),
!                                               'lang_up_text'                  
        => lang('shift up'),
!                                               'lang_down_text'                
        => lang('shift down'),
!                                               'lang_edit_text'                
        => lang('edit the attrib'),
!                                               'lang_delete_text'              
        => lang('delete the attrib'),
                                                'text_attribute'                
        => lang('Attributes'),
+                                               'text_up'                       
                => lang('up'),
+                                               'text_down'                     
                => lang('down'),
                                                'text_edit'                     
                => lang('edit'),
                                                'text_delete'                   
        => lang('delete')
***************
*** 832,835 ****
--- 843,847 ----
                                'lang_descr'            => lang('Descr'),
                                'lang_datatype'         => lang('Datatype'),
+                               'lang_sorting'          => lang('sorting'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
***************
*** 838,841 ****
--- 850,862 ----
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'column_name',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiadmin_entity.list_attribute',
+                                                                               
                                                        'entity_id'     
=>$entity_id,
+                                                                               
                                                        'cat_id'        
=>$cat_id)
+                                                                               
)),
+                               'sort_sorting'  => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'attrib_sort',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiadmin_entity.list_attribute',





reply via email to

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