fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6585] Frontend: More on roles


From: Sigurd Nes
Subject: [Fmsystem-commits] [6585] Frontend: More on roles
Date: Fri, 12 Nov 2010 11:36:48 +0000

Revision: 6585
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6585
Author:   sigurdne
Date:     2010-11-12 11:36:47 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
Frontend: More on roles

Modified Paths:
--------------
    trunk/property/inc/class.boresponsible.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/js/yahoo/location.responsiblility_role.js

Modified: trunk/property/inc/class.boresponsible.inc.php
===================================================================
--- trunk/property/inc/class.boresponsible.inc.php      2010-11-12 09:45:23 UTC 
(rev 6584)
+++ trunk/property/inc/class.boresponsible.inc.php      2010-11-12 11:36:47 UTC 
(rev 6585)
@@ -299,11 +299,13 @@
                        $dont_add = array();
                        if( isset($values['assign_orig']) && 
is_array($values['assign_orig']) )
                        {
-                               foreach( $values['assign_orig'] as $assign_orig 
=> $location_code )
+                               foreach( $values['assign_orig'] as $assign_orig 
)
                                {
                                        $assign_arr                     = 
explode('_', $assign_orig);
                                        $contact_id                     = 
$assign_arr[0];
                                        $responsible_item       = 
$assign_arr[1];
+                                       $location_code          = 
$assign_arr[2];
+
                                        $dont_add[]             = 
$location_code;                               
        
                                        if( !in_array($location_code, 
$values['assign']) )

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2010-11-12 09:45:23 UTC (rev 
6584)
+++ trunk/property/inc/class.uilocation.inc.php 2010-11-12 11:36:47 UTC (rev 
6585)
@@ -870,6 +870,7 @@
 
 
 
+
                        }
 
                        $datatable['pagination']['records_total']       = 
$this->bo->total_records;
@@ -1035,6 +1036,7 @@
                        }
 
                        $values = phpgw::get_var('values');
+                       $values_assign = $_POST['values_assign'];
                        $role_id = phpgw::get_var('role_id', 'int');
                        $receipt = array();
                $_role = CreateObject('property.socategory');
@@ -1044,8 +1046,9 @@
 
                        $user_id = phpgw::get_var('user_id', 'int', 'request', 
$this->account);
 
-                       if($values && $this->acl_edit)
+                       if($values_assign && $this->acl_edit)
                        {
+                               $values_assign = 
phpgw::clean_value(json_decode($values_assign,true));
                                $user_id = abs($user_id);
                                $account = 
$GLOBALS['phpgw']->accounts->get($user_id);
                                $contact_id = $account->person_id;
@@ -1058,7 +1061,8 @@
                                        $role = 
$_role->read_single($data=array('id' => $role_id));
                                        $values['contact_id']                   
= $contact_id;
                                        $values['responsibility_id']    = 
$role['responsibility_id'];
-
+                                       $values['assign']                       
        = $values_assign['assign'];
+                                       $values['assign_orig']                  
= $values_assign['assign_orig'];
                                        $boresponsible = 
CreateObject('property.boresponsible');
                                        $receipt = 
$boresponsible->update_role_assignment($values);
                                }

Modified: trunk/property/js/yahoo/location.responsiblility_role.js
===================================================================
--- trunk/property/js/yahoo/location.responsiblility_role.js    2010-11-12 
09:45:23 UTC (rev 6584)
+++ trunk/property/js/yahoo/location.responsiblility_role.js    2010-11-12 
11:36:47 UTC (rev 6585)
@@ -169,7 +169,7 @@
                if(oRecord.getData('responsible_item'))
                {
                        checked = "checked = 'checked'";
-                       hidden = "<input type=\"hidden\" class=\"orig_check\"  
name=\"values[assign_orig]["+oRecord.getData('responsible_contact_id')+"_"+oRecord.getData('responsible_item')+"]\"
 value=\""+oRecord.getData('location_code')+"\"/>";
+                       hidden = "<input type=\"hidden\" class=\"orig_check\"  
name=\"values[assign_orig][]\" 
value=\""+oRecord.getData('responsible_contact_id')+"_"+oRecord.getData('responsible_item')+"_"+oRecord.getData('location_code')+"\"/>";
                }
                        
                elCell.innerHTML = hidden + "<center><input type=\"checkbox\" 
"+checked+" class=\"mychecks\"  name=\"values[assign][]\" 
value=\""+oRecord.getData('location_code')+"\"/></center>";
@@ -201,21 +201,34 @@
                valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
                valuesForPHP_orig = 
YAHOO.util.Dom.getElementsByClassName('orig_check');
 
-               var myclone = null;
+               var values_return =
+               {
+                       assign:[],
+                       assign_orig:[]
+               };
+
                //add all control to form
                for(i=0;i<valuesForPHP.length;i++)
                {
-//alert(valuesForPHP[i].name);
-//alert(valuesForPHP[i].checked);
+                       //values_return.assign[i] = valuesForPHP[i].value;
+                       if(valuesForPHP[i].checked)
+                       {
+                               
values_return.assign.push(valuesForPHP[i].value);
+                       }
+               }
 
-                       myclone = valuesForPHP[i].cloneNode(true);
-                       mydiv.appendChild(myclone);
-               }
                for(i=0;i<valuesForPHP_orig.length;i++)
                {
-                       myclone = valuesForPHP_orig[i].cloneNode(true);
-                       mydiv.appendChild(myclone);
+                       //console.log(valuesForPHP_orig[i].name); // firebug
+                       values_return.assign_orig[i] = 
valuesForPHP_orig[i].value;
                }
+
+               var returnfield = document.createElement('input');
+               returnfield.setAttribute('name', 'values_assign');
+               returnfield.setAttribute('type', 'text');
+               returnfield.setAttribute('value', 
JSON.stringify(values_return));
+               mydiv.appendChild(returnfield);
+
                // find out the unique form
                formObject = document.body.getElementsByTagName('form');
                // modify the 'form' for send it as POST using asyncronize call




reply via email to

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