fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11174] controller: add component to control group


From: Sigurd Nes
Subject: [Fmsystem-commits] [11174] controller: add component to control group
Date: Fri, 14 Jun 2013 10:16:43 +0000

Revision: 11174
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11174
Author:   sigurdne
Date:     2013-06-14 10:16:43 +0000 (Fri, 14 Jun 2013)
Log Message:
-----------
controller: add component to control group

Modified Paths:
--------------
    trunk/controller/inc/class.uicontrol_group.inc.php
    trunk/controller/inc/model/class.control_group.inc.php
    trunk/controller/js/controller/control_group_to_component.js
    trunk/logistic/js/logistic/resource_type_requirement.js
    trunk/property/inc/class.boadmin_entity.inc.php

Modified: trunk/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_group.inc.php  2013-06-13 18:13:02 UTC 
(rev 11173)
+++ trunk/controller/inc/class.uicontrol_group.inc.php  2013-06-14 10:16:43 UTC 
(rev 11174)
@@ -225,9 +225,6 @@
                                $category_id = phpgw::get_var('category_id', 
'int');
                                $component_location_id = 
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$entity_id}.{$category_id}");
 
-//_debug_array($_POST);
-//die();
-
                                if(isset($control_group)) // Add new values to 
the control item
                                {
                                        
$control_group->set_group_name(phpgw::get_var('group_name'));
@@ -235,9 +232,8 @@
                                        $control_group->set_control_area_id( 
phpgw::get_var('control_area') );
                                        $control_group->set_building_part_id( 
phpgw::get_var('building_part') );
                                        
$control_group->set_component_location_id($component_location_id);
+                                       $control_group->set_component_criteria( 
phpgw::get_var('attributes') );
 
-                                       //$this->so->store($control_item);
-
                                        if(isset($control_group_id) && 
$control_group_id > 0)
                                        {
                                                $ctrl_group_id = 
$control_group_id;
@@ -532,6 +528,7 @@
                                                }
                                        }
                                        $category_list = 
$entity_so->read_category(array('allrows'=>true,'entity_id'=>$entity_arr[2]));
+                                       array_unshift($category_list,array 
('id'=>'','name'=> lang('select value')));
                                        foreach ($category_list as &$c)
                                        {
                                                if($c['id'] == $category['id'])

Modified: trunk/controller/inc/model/class.control_group.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group.inc.php      2013-06-13 
18:13:02 UTC (rev 11173)
+++ trunk/controller/inc/model/class.control_group.inc.php      2013-06-14 
10:16:43 UTC (rev 11174)
@@ -44,6 +44,7 @@
                protected $building_part_descr;
                protected $order_nr;
                protected $component_location_id;
+               protected $component_criteria = array();
                                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -130,6 +131,15 @@
                        return $this->component_location_id;
                }
 
+               public function set_component_criteria($component_criteria)
+               {
+                       $this->component_criteria = $component_criteria;
+               }
+               
+               public function get_component_criteria()
+               {
+                       return $this->component_criteria;
+               }
 
                public function serialize()
                {
@@ -141,6 +151,7 @@
                        $result['building_part'] = 
$this->get_building_part_descr();
                        $result['order_nr'] = $this->get_order_nr();
                        $result['component_location_id'] = 
$this->get_component_location_id();
+                       $result['component_criteria'] = 
$this->get_component_criteria();
                        
                        return $result;
                }

Modified: trunk/controller/js/controller/control_group_to_component.js
===================================================================
--- trunk/controller/js/controller/control_group_to_component.js        
2013-06-13 18:13:02 UTC (rev 11173)
+++ trunk/controller/js/controller/control_group_to_component.js        
2013-06-14 10:16:43 UTC (rev 11174)
@@ -1,6 +1,7 @@
 $(document).ready(function(){
 
         $("#entity_id").change(function () {
+               $("#attributes").html( '' );
                 var oArgs = 
{menuaction:'property.boadmin_entity.get_category_list', entity_id: 
$(this).val()};
                 var requestUrl = phpGWLink('index.php', oArgs, true);
 
@@ -14,7 +15,7 @@
                        {
                                if( data != null)
                                {
-                                       htmlString  = "<option>Velg</option>"
+                                       htmlString  = "<option value = 
''>Velg</option>";
 
                                        $.each(data, function(i) {
                                                var selected = '';
@@ -25,7 +26,6 @@
                                }
                                else
                                {
-                                       htmlString  += "";
                                        $("#category_id").html( htmlString );
                                }
                        }
@@ -46,10 +46,32 @@
                        {
                                if( data != null)
                                {
+                                       htmlString  += '<table>';
                                        $.each(data, function(i) {
-                                               htmlString  += "<input 
type='checkbox' name='attributes[]' id='attributes[]' value='" + data[i].id + 
"'/>" + data[i].input_text + "&nbsp;(" + data[i].trans_datatype + ")<br/>";
+                                               htmlString  += "<tr>";
+                                               htmlString  += "<td>" + 
data[i].input_text + "&nbsp;(" + data[i].trans_datatype + ')</td>';
+                                               htmlString  += "<td>";
+                                               
if(typeof(data[i].choice)!='undefined')
+                                               {
+                                                       htmlString  += 
"&nbsp;<select name='attributes["+ data[i].id +"]' id='attribute_"+ data[i].id 
+"'>";
+                                                       htmlString  += "<option 
value = ''>Velg</option>";
+                                                       choice = data[i].choice;
+                                                       $.each(choice, 
function(j) {
+                                                               selected = '';
+                                                               htmlString  += 
"<option value='" + choice[j].id + "'" + selected + ">" + choice[j].value + 
"</option>";
+                                                       });
+                                                       htmlString  += 
"</select>";                                                     
+                                               }
+                                               else
+                                               {
+                                                       htmlString  += 
"&nbsp;<input type= 'text' name='attributes["+ data[i].id +"]' id='attribute_"+ 
data[i].id +"'/>";                                               
+                                               }
+                                               
+                                               
+                                               htmlString  += "</td></tr>";
                                });
 
+                                       htmlString  += '</table>';
                                        $("#attributes").html( htmlString );
                                }
                                else

Modified: trunk/logistic/js/logistic/resource_type_requirement.js
===================================================================
--- trunk/logistic/js/logistic/resource_type_requirement.js     2013-06-13 
18:13:02 UTC (rev 11173)
+++ trunk/logistic/js/logistic/resource_type_requirement.js     2013-06-14 
10:16:43 UTC (rev 11174)
@@ -14,7 +14,7 @@
                        {
                                if( data != null)
                                {
-                                       htmlString  = "<option>Velg</option>"
+                                       htmlString  = "<option value = 
''>Velg</option>";
 
                                        $.each(data, function(i) {
                                                var selected = '';
@@ -61,4 +61,4 @@
                });
         });
 
-});
\ No newline at end of file
+});

Modified: trunk/property/inc/class.boadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_entity.inc.php     2013-06-13 18:13:02 UTC 
(rev 11173)
+++ trunk/property/inc/class.boadmin_entity.inc.php     2013-06-14 10:16:43 UTC 
(rev 11174)
@@ -232,7 +232,7 @@
                        $entity_id              = phpgw::get_var('entity_id');
                        $cat_id                 = phpgw::get_var('cat_id');
 
-                       return $attrib_data = 
$this->custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, 
'','','',true, true);
+                       return 
$this->custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, 
'','','',true, true);
                }
 
 




reply via email to

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