phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property inc/class.boactor.inc.php inc/class.bo...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.boactor.inc.php inc/class.bo...
Date: Tue, 31 Oct 2006 09:50:57 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   06/10/31 09:50:56

Modified files:
        inc            : class.boactor.inc.php class.bocommon.inc.php 
                         class.soactor.inc.php 
                         class.soadmin_entity.inc.php 
                         class.soadmin_location.inc.php 
                         class.soagreement.inc.php 
                         class.soentity.inc.php 
                         class.sor_agreement.inc.php 
                         class.sos_agreement.inc.php 
                         class.uiactor.inc.php 
        templates/base : attributes_form.xsl 

Log message:
        More work on password as custom attribute

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.boactor.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.bocommon.inc.php?cvsroot=phpgroupware&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soactor.inc.php?cvsroot=phpgroupware&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soadmin_entity.inc.php?cvsroot=phpgroupware&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soadmin_location.inc.php?cvsroot=phpgroupware&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soagreement.inc.php?cvsroot=phpgroupware&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soentity.inc.php?cvsroot=phpgroupware&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.sor_agreement.inc.php?cvsroot=phpgroupware&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.sos_agreement.inc.php?cvsroot=phpgroupware&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uiactor.inc.php?cvsroot=phpgroupware&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/property/templates/base/attributes_form.xsl?cvsroot=phpgroupware&r1=1.7&r2=1.8

Patches:
Index: inc/class.boactor.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.boactor.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- inc/class.boactor.inc.php   30 Oct 2006 22:20:34 -0000      1.12
+++ inc/class.boactor.inc.php   31 Oct 2006 09:50:56 -0000      1.13
@@ -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.boactor.inc.php,v 1.12 2006/10/30 22:20:34 
sigurdne Exp $
+       * @version $Id: class.boactor.inc.php,v 1.13 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -93,7 +93,7 @@
                        }
                        else
                        {
-                               unset($this->cat_id);
+                               $this->cat_id = '';
                        }
                        if(isset($allrows))
                        {
@@ -343,16 +343,12 @@
                        $this->so->resort_attrib($data);
                }
 
-               function save_attrib($attrib,$action='')
-               {
-                       if ($action=='edit')
+               function save_attrib($attrib)
                        {
                                if ($attrib['id'] != '')
                                {
-
                                        $receipt = 
$this->so->edit_attrib($attrib);
                                }
-                       }
                        else
                        {
                                $receipt = $this->so->add_attrib($attrib);

Index: inc/class.bocommon.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- inc/class.bocommon.inc.php  30 Oct 2006 22:20:34 -0000      1.49
+++ inc/class.bocommon.inc.php  31 Oct 2006 09:50:56 -0000      1.50
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.bocommon.inc.php,v 1.49 2006/10/30 22:20:34 
sigurdne Exp $
+       * @version $Id: class.bocommon.inc.php,v 1.50 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -1288,7 +1288,7 @@
                        return $this->socommon->next_id($table,$key);
                }
 
-               function select_datatype($selected='')
+               function select_datatype($selected='', $sub_module = '')
                {
                        $datatypes[0]['id']= 'V';
                        $datatypes[0]['name']= lang('varchar');
@@ -1316,8 +1316,12 @@
                        $datatypes[11]['name']= lang('Email');
                        $datatypes[12]['id']= 'link';
                        $datatypes[12]['name']= lang('Link');
+                       
+                       if($sub_module == 'actor')
+                       {
                        $datatypes[13]['id']= 'pwd';
                        $datatypes[13]['name']= lang('Password');
+                       }
 
                        return $this->select_list($selected,$datatypes);
 

Index: inc/class.soactor.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soactor.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- inc/class.soactor.inc.php   30 Oct 2006 22:20:34 -0000      1.18
+++ inc/class.soactor.inc.php   31 Oct 2006 09:50:56 -0000      1.19
@@ -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.soactor.inc.php,v 1.18 2006/10/30 22:20:34 
sigurdne Exp $
+       * @version $Id: class.soactor.inc.php,v 1.19 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -405,7 +405,7 @@
                                                        $entry['value'] = 
$this->db->db_addslashes($entry['value']);
                                                }
                                                
-                                               if($entry['datatype'] == 'pwd')
+                                               if($entry['datatype'] == 'pwd' 
&& $entry['value'] && $entry['value2'])
                                                {
                                                        if($entry['value'] == 
$entry['value2'])
                                                        {
@@ -486,10 +486,31 @@
                                {
                                        if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR')
                                        {
+                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+                                               if($entry['datatype'] == 'pwd')
+                                               {
+                                                       if($entry['value'] || 
$entry['value2'])
+                                                       {
+                                                               
if($entry['value'] == $entry['value2'])
+                                                               {
+                                                                       
$value_set[$entry['name']]      = md5($entry['value']);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
                                                $value_set[$entry['name']]      
= $entry['value'];
                                        }
                                }
                        }
+                       }
 
                        $value_set['entry_date']        = time();
                        $value_set['category']  = $actor['cat_id'];
@@ -658,6 +679,18 @@
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
                        $attrib['id'] = 
$this->bocommon->next_id($attribute_table);
 
+                       $sql = "SELECT * FROM $attribute_table WHERE 
column_name = '{$attrib['column_name']}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ( $this->db->next_record() )
+                       {
+                               $receipt['id'] = '';
+                               $receipt['error'] = array();
+                               $receipt['error'][] = array('msg' => 
lang('field already exists, please choose another name'));
+                               $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been saved'));
+                               return $receipt; //no point continuing
+                       }
+
+
                        $sql = "SELECT max(attrib_sort) as max_sort FROM 
$attribute_table";
                        $this->db->query($sql);
                        $this->db->next_record();
@@ -688,17 +721,11 @@
 
                        $receipt['id']= $attrib['id'];
 
-                       
                        if(!$attrib['column_info']['precision'])
                        {
-                               $attrib['column_info']['precision'] = 
$this->bocommon->translate_datatype_precision($this->db->f('datatype'));
+                               $attrib['column_info']['precision'] = 
$this->bocommon->translate_datatype_precision($attrib['column_info']['type']);
                        }
 
-/*                     if($attrib['column_info']['type']=='email' && 
!$attrib['column_info']['precision'])
-                       {
-                               $attrib['column_info']['precision']=64;
-                       }
-*/
                        $attrib['column_info']['type']  = 
$this->bocommon->translate_datatype_insert($attrib['column_info']['type']);
 
                        if($attrib['column_info']['type']=='int' && 
!$attrib['column_info']['precision'])
@@ -722,16 +749,9 @@
                        else
                        {
                                $receipt['error'][] = array('msg'       => 
lang('column could not be added')    );
-                               if($this->db->Transaction)
-                               {
-                                       $GLOBALS['phpgw']->db->rollbacktrans();
-                               }
-                               else
-                               {
-                                       $GLOBALS['phpgw']->db->Execute("DELETE 
FROM $attribute_table WHERE id='" . $receipt['id'] . "'");
+                               $this->db->transaction_abort();
+                               $this->db->query("DELETE FROM $attribute_table 
WHERE id='" . $receipt['id'] . "'"); // in case transactions is not supported.
                                        unset($receipt['id']);
-
-                               }
                        }
 
                        return $receipt;
@@ -851,7 +871,7 @@
                        $attrib['column_name'] = 
$this->db->db_addslashes($attrib['column_name']);
                        $attrib['input_text'] = 
$this->db->db_addslashes($attrib['input_text']);
                        $attrib['statustext'] = 
$this->db->db_addslashes($attrib['statustext']);
-                       $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
+                       $attrib['default'] = 
$this->db->db_addslashes((isset($attrib['default'])?$attrib['default']:''));
 
                        $choice_table = 'fm_' . $this->role . '_choice';
 
@@ -861,7 +881,7 @@
                        $OldDataType            = $this->db->f('datatype');
                        $OldPrecision           = $this->db->f('precision_');   
                
 
-                       $table_def = 
$this->get_table_def($attrib['entity_id'],$attrib['cat_id']);      
+                       $table_def = $this->get_table_def();    
 
                        $this->init_process();
                        $this->oProc->m_odb->transaction_begin();
@@ -870,9 +890,9 @@
                        $value_set=array(
                                'input_text'            => 
$attrib['input_text'],
                                'statustext'            => 
$attrib['statustext'],
-                               'lookup_form'           => 
$attrib['lookup_form'],
-                               'search'                => $attrib['search'],
-                               'list'                  => $attrib['list'],
+                               'lookup_form'           => 
(isset($attrib['lookup_form'])?$attrib['lookup_form']:''),
+                               'search'                => 
(isset($attrib['search'])?$attrib['search']:''),
+                               'list'                  => 
(isset($attrib['list'])?$attrib['list']:''),
                                );
 
                        $value_set      = 
$this->bocommon->validate_db_update($value_set);
@@ -928,7 +948,7 @@
                                
$this->oProc->AlterColumn($table,$attrib['column_name'],$attrib['column_info']);
                        }
 
-                       if($attrib['new_choice'])
+                       if(isset($attrib['new_choice']) && 
$attrib['new_choice'])
                        {
                                $choice_id = 
$this->bocommon->next_id($choice_table ,array('attrib_id'=>$attrib['id']));
 
@@ -944,7 +964,7 @@
                                . "VALUES ($values)");
                        }
 
-                       if($attrib['delete_choice'])
+                       if(isset($attrib['delete_choice']) && 
is_array($attrib['delete_choice']))
                        {
                                for 
($i=0;$i<count($attrib['delete_choice']);$i++)
                                {

Index: inc/class.soadmin_entity.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soadmin_entity.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- inc/class.soadmin_entity.inc.php    20 Oct 2006 11:50:40 -0000      1.26
+++ inc/class.soadmin_entity.inc.php    31 Oct 2006 09:50:56 -0000      1.27
@@ -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.soadmin_entity.inc.php,v 1.26 2006/10/20 11:50:40 
sigurdne Exp $
+       * @version $Id: class.soadmin_entity.inc.php,v 1.27 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -926,6 +926,18 @@
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
                        $attrib['id'] = 
$this->bocommon->next_id('fm_entity_attribute',array('entity_id'=>$attrib['entity_id'],'cat_id'=>$attrib['cat_id']));
 
+                       $sql = "SELECT * FROM fm_entity_attribute WHERE 
entity_id= '{$attrib['entity_id']}' AND cat_id='{$attrib['cat_id']}' AND 
column_name = '{$attrib['column_name']}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ( $this->db->next_record() )
+                       {
+                               $receipt['id'] = '';
+                               $receipt['error'] = array();
+                               $receipt['error'][] = array('msg' => 
lang('field already exists, please choose another name'));
+                               $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been saved'));
+                               return $receipt; //no point continuing
+                       }
+
+
                        $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();

Index: inc/class.soadmin_location.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soadmin_location.inc.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- inc/class.soadmin_location.inc.php  27 Oct 2006 06:49:01 -0000      1.31
+++ inc/class.soadmin_location.inc.php  31 Oct 2006 09:50:56 -0000      1.32
@@ -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.soadmin_location.inc.php,v 1.31 2006/10/27 
06:49:01 sigurdne Exp $
+       * @version $Id: class.soadmin_location.inc.php,v 1.32 2006/10/31 
09:50:56 sigurdne Exp $
        */
 
        /**
@@ -654,6 +654,17 @@
                        $attrib['default'] = 
$this->db->db_addslashes($attrib['default']);
                        $attrib['id'] = 
$this->bocommon->next_id('fm_location_attrib',array('type_id'=>$attrib['type_id']));
 
+                       $sql = "SELECT * FROM fm_location_attrib WHERE type_id= 
'{$attrib['type_id']}' AND column_name = '{$attrib['column_name']}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ( $this->db->next_record() )
+                       {
+                               $receipt['id'] = '';
+                               $receipt['error'] = array();
+                               $receipt['error'][] = array('msg' => 
lang('field already exists, please choose another name'));
+                               $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been saved'));
+                               return $receipt; //no point continuing
+                       }
+
                        $sql = "SELECT max(attrib_sort) as max_sort FROM 
fm_location_attrib where type_id=" . $attrib['type_id'];
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();

Index: inc/class.soagreement.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soagreement.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- inc/class.soagreement.inc.php       18 Sep 2006 08:22:32 -0000      1.16
+++ inc/class.soagreement.inc.php       31 Oct 2006 09:50:56 -0000      1.17
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage agreement
-       * @version $Id: class.soagreement.inc.php,v 1.16 2006/09/18 08:22:32 
sigurdne Exp $
+       * @version $Id: class.soagreement.inc.php,v 1.17 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -1150,6 +1150,18 @@
                                $filtermethod= 'WHERE attrib_detail=1';
                                $table = 'fm_agreement';
                        }
+
+                       $sql = "SELECT * FROM $attribute_table $filtermethod 
AND column_name = '{$attrib['column_name']}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ( $this->db->next_record() )
+                       {
+                               $receipt['id'] = '';
+                               $receipt['error'] = array();
+                               $receipt['error'][] = array('msg' => 
lang('field already exists, please choose another name'));
+                               $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been saved'));
+                               return $receipt; //no point continuing
+                       }
+
                        $sql = "SELECT max(attrib_sort) as max_sort FROM 
$attribute_table $filtermethod";
                        $this->db->query($sql);
                        $this->db->next_record();

Index: inc/class.soentity.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soentity.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- inc/class.soentity.inc.php  30 Oct 2006 10:46:48 -0000      1.28
+++ inc/class.soentity.inc.php  31 Oct 2006 09:50:56 -0000      1.29
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage entity
-       * @version $Id: class.soentity.inc.php,v 1.28 2006/10/30 10:46:48 
sigurdne Exp $
+       * @version $Id: class.soentity.inc.php,v 1.29 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -692,9 +692,25 @@
                                                        $entry['value'] = 
$this->db->db_addslashes($entry['value']);
                                                }
 
+                                               if($entry['datatype'] == 'pwd' 
&& $entry['value'] && $entry['value2'])
+                                               {
+                                                       if($entry['value'] || 
$entry['value2'])
+                                                       {
+                                                               
if($entry['value'] == $entry['value2'])
+                                                               {
+                                                                       
$value_set[$entry['name']]      = md5($entry['value']);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
                                                $value_set[$entry['name']]      
= $entry['value'];
                                        }
-
+                                       }
 
                                        if($entry['history'] == 1)
                                        {                                       
        

Index: inc/class.sor_agreement.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.sor_agreement.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- inc/class.sor_agreement.inc.php     18 Sep 2006 08:22:32 -0000      1.15
+++ inc/class.sor_agreement.inc.php     31 Oct 2006 09:50:56 -0000      1.16
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage agreement
-       * @version $Id: class.sor_agreement.inc.php,v 1.15 2006/09/18 08:22:32 
sigurdne Exp $
+       * @version $Id: class.sor_agreement.inc.php,v 1.16 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -1258,6 +1258,18 @@
                                $filtermethod= 'WHERE attrib_detail=1';
                                $table = 'fm_r_agreement';
                        }
+
+                       $sql = "SELECT * FROM $attribute_table $filtermethod 
AND column_name = '{$attrib['column_name']}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ( $this->db->next_record() )
+                       {
+                               $receipt['id'] = '';
+                               $receipt['error'] = array();
+                               $receipt['error'][] = array('msg' => 
lang('field already exists, please choose another name'));
+                               $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been saved'));
+                               return $receipt; //no point continuing
+                       }
+
                        $sql = "SELECT max(attrib_sort) as max_sort FROM 
$attribute_table $filtermethod";
                        $this->db->query($sql);
                        $this->db->next_record();

Index: inc/class.sos_agreement.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.sos_agreement.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- inc/class.sos_agreement.inc.php     29 Sep 2006 12:51:29 -0000      1.23
+++ inc/class.sos_agreement.inc.php     31 Oct 2006 09:50:56 -0000      1.24
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage agreement
-       * @version $Id: class.sos_agreement.inc.php,v 1.23 2006/09/29 12:51:29 
sigurdne Exp $
+       * @version $Id: class.sos_agreement.inc.php,v 1.24 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -1136,6 +1136,18 @@
                                $filtermethod= 'WHERE attrib_detail=1';
                                $table = 'fm_s_agreement';
                        }
+
+                       $sql = "SELECT * FROM $attribute_table $filtermethod 
AND column_name = '{$attrib['column_name']}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ( $this->db->next_record() )
+                       {
+                               $receipt['id'] = '';
+                               $receipt['error'] = array();
+                               $receipt['error'][] = array('msg' => 
lang('field already exists, please choose another name'));
+                               $receipt['error'][] = array('msg'       => 
lang('Attribute has NOT been saved'));
+                               return $receipt; //no point continuing
+                       }
+
                        $sql = "SELECT max(attrib_sort) as max_sort FROM 
$attribute_table $filtermethod";
                        $this->db->query($sql);
                        $this->db->next_record();

Index: inc/class.uiactor.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uiactor.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- inc/class.uiactor.inc.php   30 Oct 2006 22:20:34 -0000      1.23
+++ inc/class.uiactor.inc.php   31 Oct 2006 09:50:56 -0000      1.24
@@ -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.uiactor.inc.php,v 1.23 2006/10/30 22:20:34 
sigurdne Exp $
+       * @version $Id: class.uiactor.inc.php,v 1.24 2006/10/31 09:50:56 
sigurdne Exp $
        */
 
        /**
@@ -59,7 +59,7 @@
                        $this->cats->app_name = 'fm_' . $this->role;
 
                        $this->acl                      = 
CreateObject('phpgwapi.acl');
-                       $this->acl_location= '.' . $this->role;
+                       $this->acl_location             = '.' . $this->role;
 
                        $this->acl_read         = 
$this->acl->check($this->acl_location,1);
                        $this->acl_add          = 
$this->acl->check($this->acl_location,2);
@@ -515,6 +515,8 @@
                                'attributes_values'                     => 
$actor['attributes'],
                                'lookup_functions'                      => 
$actor['lookup_functions'],
                                'dateformat'                            => 
$dateformat,
+                               'lang_edit'                                     
        => lang('edit'),
+                               'lang_add'                                      
        => lang('add'),
                        );
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('actor') . ': ' . ($actor_id?lang('edit') . ' ' . 
lang($this->role):lang('add') . ' ' . lang($this->role));
 
@@ -784,14 +786,12 @@
        //html_print_r($values);
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','choice',));
 
-                       if ($values['save'])
+                       if (isset($values['save']) && $values['save'])
                        {
                                if($id)
                                {
                                        $values['id']=$id;
-                                       $action='edit';
                                }
-                               $type_id                        = 
$values['type_id'];
 
                                if (!$values['column_name'])
                                {
@@ -829,10 +829,9 @@
                                        $receipt['error'][] = 
array('msg'=>lang('Nullable not chosen!'));
                                }
 
-
-                               if (!$receipt['error'])
+                               if (!isset($receipt['error']) || 
!$receipt['error'])
                                {
-                                       $receipt = 
$this->bo->save_attrib($values,$action);
+                                       $receipt = 
$this->bo->save_attrib($values);
 
                                        if(!$id)
                                        {
@@ -865,9 +864,9 @@
                                'role'          => $this->role
 
                        );
-       //html_print_r($values);
+//     _debug_array($values);
 
-                       if(is_array($values['column_info']))
+                       if(isset($values['column_info']) && 
is_array($values['column_info']))
                        {
                                if($values['column_info']['type']=='R' || 
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
                                {
@@ -880,31 +879,31 @@
                                $column_nullable  = 
$values['column_info']['nullable'];
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
                        $data = array
                        (
                                'lang_choice'                                   
=> lang('Choice'),
                                'lang_new_value'                                
=> lang('New value'),
                                'lang_new_value_statustext'             => 
lang('New value for multiple choice'),
-                               'multiple_choice'                               
=> $multiple_choice,
-                               'value_choice'                                  
=> $values['choice'],
+                               'multiple_choice'                               
=> (isset($multiple_choice)?$multiple_choice:''),
+                               'value_choice'                                  
=> (isset($values['choice'])?$values['choice']:''),
                                'lang_delete_value'                             
=> lang('Delete value'),
                                'lang_value'                                    
=> lang('value'),
                                'lang_delete_choice_statustext' => lang('Delete 
this value from the list of multiple choice'),
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
$this->currentapp.'.uiactor.list_attribute', 'type_id'=> $type_id, 'role'=> 
$this->role)),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
$this->currentapp.'.uiactor.list_attribute', 'role'=> $this->role)),
                                'lang_id'                                       
        => lang('Attribute ID'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'value_id'                                      
        => $id,
 
                                'lang_column_name'                              
=> lang('Column name'),
-                               'value_column_name'                             
=> $values['column_name'],
+                               'value_column_name'                             
=> (isset($values['column_name'])?$values['column_name']:''),
                                'lang_column_name_statustext'   => lang('enter 
the name for the column'),
 
                                'lang_input_text'                               
=> lang('input text'),
-                               'value_input_text'                              
=> $values['input_text'],
+                               'value_input_text'                              
=> (isset($values['input_text'])?$values['input_text']:''),
                                'lang_input_name_statustext'    => lang('enter 
the input text for records'),
 
                                'lang_id_attribtext'                    => 
lang('Enter the attribute ID'),
@@ -912,7 +911,7 @@
 
                                'lang_statustext'                               
=> lang('Statustext'),
                                'lang_statustext_attribtext'    => lang('Enter 
a statustext for the inputfield in forms'),
-                               'value_statustext'                              
=> $values['statustext'],
+                               'value_statustext'                              
=> (isset($values['statustext'])?$values['statustext']:''),
 
                                'lang_done_attribtext'                  => 
lang('Back to the list'),
                                'lang_save_attribtext'                  => 
lang('Save the attribute'),
@@ -920,30 +919,30 @@
                                'lang_datatype'                                 
=> lang('Datatype'),
                                'lang_datatype_statustext'              => 
lang('Select a datatype'),
                                'lang_no_datatype'                              
=> lang('No datatype'),
-                               'datatype_list'                                 
=> $this->bocommon->select_datatype($column_type),
+                               'datatype_list'                                 
=> 
$this->bocommon->select_datatype((isset($column_type)?$column_type:''),'actor'),
 
                                'lang_precision'                                
=> lang('Precision'),
                                'lang_precision_statustext'             => 
lang('enter the record length'),
-                               'value_precision'                               
=> $column_precision,
+                               'value_precision'                               
=> (isset($column_precision)?$column_precision:''),
 
                                'lang_scale'                                    
=> lang('scale'),
                                'lang_scale_statustext'                 => 
lang('enter the scale if type is decimal'),
-                               'value_scale'                                   
=> $column_scale,
+                               'value_scale'                                   
=> (isset($column_scale)?$column_scale:''),
 
                                'lang_default'                                  
=> lang('default'),
                                'lang_default_statustext'               => 
lang('enter the default value'),
-                               'value_default'                                 
=> $column_default,
+                               'value_default'                                 
=> (isset($column_default)?$column_default:''),
 
                                '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($column_nullable),
+                               'nullable_list'                                 
=> 
$this->bocommon->select_nullable((isset($column_nullable)?$column_nullable:'')),
 
-                               'value_list'                                    
=> $values['list'],
+                               'value_list'                                    
=> (isset($values['list'])?$values['list']:''),
                                'lang_list'                                     
        => lang('show in list'),
                                'lang_list_statustext'                  => 
lang('check to show this attribute in location list'),
 
-                               'value_search'                                  
=> $values['search'],
+                               'value_search'                                  
=> (isset($values['search'])?$values['search']:''),
                                'lang_include_search'                   => 
lang('Include in search'),
                                'lang_include_search_statustext'=> lang('check 
to show this attribute in location list'),
                        );

Index: templates/base/attributes_form.xsl
===================================================================
RCS file: /sources/phpgroupware/property/templates/base/attributes_form.xsl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- templates/base/attributes_form.xsl  30 Oct 2006 22:20:34 -0000      1.7
+++ templates/base/attributes_form.xsl  31 Oct 2006 09:50:56 -0000      1.8
@@ -1,4 +1,4 @@
-<!-- $Id: attributes_form.xsl,v 1.7 2006/10/30 22:20:34 sigurdne Exp $ -->
+<!-- $Id: attributes_form.xsl,v 1.8 2006/10/31 09:50:56 sigurdne Exp $ -->
 
        <xsl:template name="attributes_form">
                <xsl:apply-templates select="attributes_values"/>
@@ -36,6 +36,21 @@
                                                        
<xsl:text>[</xsl:text><xsl:value-of 
select="//lang_dateformat"/><xsl:text>]</xsl:text>                  
                                                </xsl:when>
                                        </xsl:choose>
+                                       <xsl:choose>
+                                               <xsl:when test="datatype='pwd'">
+                                                       <br/>
+                                                       <xsl:text>[ </xsl:text>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="value!=''">
+                                                                       
<xsl:value-of select="//lang_edit"/>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       
<xsl:value-of select="//lang_add"/>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                                       <xsl:text> ]</xsl:text>
+                                               </xsl:when>
+                                       </xsl:choose>
                                </td>
                                <td align="left">
                                        <xsl:choose>




reply via email to

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