[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11164] controller: add component to control group
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11164] controller: add component to control group |
Date: |
Tue, 11 Jun 2013 08:32:52 +0000 |
Revision: 11164
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11164
Author: sigurdne
Date: 2013-06-11 08:32:51 +0000 (Tue, 11 Jun 2013)
Log Message:
-----------
controller: add component to control group
Modified Paths:
--------------
trunk/controller/inc/class.socontrol_group.inc.php
trunk/controller/inc/class.uicontrol_group.inc.php
trunk/controller/inc/model/class.control_group.inc.php
trunk/controller/setup/phpgw_no.lang
trunk/controller/setup/setup.inc.php
trunk/controller/setup/tables_update.inc.php
trunk/property/inc/class.boadmin_entity.inc.php
Added Paths:
-----------
trunk/controller/js/controller/control_group_to_component.js
Modified: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php 2013-06-10 18:54:03 UTC
(rev 11163)
+++ trunk/controller/inc/class.socontrol_group.inc.php 2013-06-11 08:32:51 UTC
(rev 11164)
@@ -62,7 +62,8 @@
'group_name',
'procedure_id',
'control_area_id',
- 'building_part_id'
+ 'building_part_id',
+ 'component_location_id'
);
$values = array(
@@ -70,6 +71,7 @@
$this->marshal($control_group->get_procedure_id(), 'int'),
$this->marshal($control_group->get_control_area_id(), 'int'),
$this->marshal($control_group->get_building_part_id(), 'string'),
+
$this->marshal($control_group->get_component_location_id(), 'int'),
);
$result = $this->db->query('INSERT INTO
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',',
$values) . ')', __LINE__,__FILE__);
@@ -100,7 +102,8 @@
'group_name = ' .
$this->marshal($control_group->get_group_name(), 'string'),
'procedure_id = '.
$this->marshal($control_group->get_procedure_id(), 'int'),
'control_area_id = ' .
$this->marshal($control_group->get_control_area_id(), 'int'),
- 'building_part_id = ' .
$this->marshal($control_group->get_building_part_id(), 'string')
+ 'building_part_id = ' .
$this->marshal($control_group->get_building_part_id(), 'string'),
+ 'component_location_id = '.
$this->marshal($control_group->get_component_location_id(), 'int'),
);
$result = $this->db->query('UPDATE
controller_control_group SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
@@ -136,6 +139,9 @@
$category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
$control_group->set_control_area_name($category[0]['name']);
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
+
+
return $control_group;
}
@@ -225,6 +231,7 @@
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
$results[] = $control_group->toArray();
}
@@ -322,6 +329,9 @@
$category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
$control_group->set_control_area_name($category[0]['name']);
+
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
+
}
return $control_group;
@@ -353,7 +363,7 @@
$control_group->set_control_area_name($category[0]['name']);
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'string'));
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr',
true), 'string'));
-
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
$control_groups_array[] =
$control_group->toArray();
}
@@ -439,13 +449,16 @@
* @param $component id component id
* @return void
*/
+
+ //FIXME: Sigurd : Not used
function add_component_to_control_group($control_group_id,
$location_id)
{
$sql = "INSERT INTO
controller_control_group_component_list (control_group_id, location_id)
values($control_group_id, $location_id)";
$this->db->query($sql);
}
- function exist_component_control_group($control_group_id,
$location_id)
+ //FIXME: Sigurd : Not used
+ function exist_component_control_group($control_group_id,
$location_id)
{
$sql = "SELECT * FROM
controller_control_group_component_list WHERE
control_group_id=$control_group_id AND location_id=$location_id";
$this->db->query($sql);
Modified: trunk/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_group.inc.php 2013-06-10 18:54:03 UTC
(rev 11163)
+++ trunk/controller/inc/class.uicontrol_group.inc.php 2013-06-11 08:32:51 UTC
(rev 11164)
@@ -221,12 +221,20 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_group.index'));
}
+ $entity_id = phpgw::get_var('entity_id', 'int');
+ $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'));
$control_group->set_procedure_id(
phpgw::get_var('procedure') );
$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);
//$this->so->store($control_item);
@@ -532,12 +540,15 @@
//--- sigurd 10.juni 13
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $entity_list = $entity_so->read(array('allrows'
=> true));
+
array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
- if($location_id)
+ $component_location_id =
$control_group->get_component_location_id();
+ if($component_location_id)
{
- $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
$entity_arr =
explode('.',$loc_arr['location']);
$entity =
$entity_so->read_single($entity_arr[2]);
@@ -563,8 +574,8 @@
$data = array
(
- 'entities' => $entity_list,
- 'categories' => $category_list,
+ 'entities'
=> $entity_list,
+ 'categories'
=> $category_list,
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, $tab_to_display),
'value_id'
=> !empty($control_group) ? $control_group->get_id() : 0,
@@ -592,7 +603,7 @@
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
self::add_javascript('controller',
'controller', 'ajax.js');
- self::add_javascript('logistic', 'logistic',
'resource_type_requirement.js');
+ self::add_javascript('controller',
'controller', 'control_group_to_component.js');
self::render_template_xsl(array('control_group/control_group_tabs','control_group/control_group','control_group/control_group_items'),
$data);
}
}
@@ -768,6 +779,8 @@
{
$GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
+ $entity_so =
CreateObject('property.soadmin_entity');
+
$tabs = array
(
'control_group' => array('label' =>
lang('Control_group'), 'link' => '#control_group'),
@@ -802,6 +815,13 @@
$control_group_array =
$control_group->toArray();
//var_dump($control_group_array);
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($control_group->get_component_location_id());
+ $entity_arr = explode('.',$loc_arr['location']);
+
+ $entity =
$entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+
+
$control_items_array =
$this->so_control_item_list->get_control_items($control_group_id);
$control_items = array();
@@ -818,6 +838,8 @@
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, 'control_group'),
'value_id'
=> !empty($control_group) ? $control_group->get_id() : 0,
'control_group'
=> $control_group_array,
+ 'entity'
=> $entity,
+ 'category'
=> $category,
'selected_control_items' =>
$control_items,
);
Modified: trunk/controller/inc/model/class.control_group.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group.inc.php 2013-06-10
18:54:03 UTC (rev 11163)
+++ trunk/controller/inc/model/class.control_group.inc.php 2013-06-11
08:32:51 UTC (rev 11164)
@@ -43,6 +43,7 @@
protected $building_part_id;
protected $building_part_descr;
protected $order_nr;
+ protected $component_location_id;
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -118,6 +119,18 @@
public function get_order_nr(){ return $this->order_nr; }
+
+ public function
set_component_location_id($component_location_id)
+ {
+ $this->component_location_id = $component_location_id;
+ }
+
+ public function get_component_location_id()
+ {
+ return $this->component_location_id;
+ }
+
+
public function serialize()
{
$result = array();
@@ -127,6 +140,7 @@
$result['control_area'] =
$this->get_control_area_name();
$result['building_part'] =
$this->get_building_part_descr();
$result['order_nr'] = $this->get_order_nr();
+ $result['component_location_id'] =
$this->get_component_location_id();
return $result;
}
Added: trunk/controller/js/controller/control_group_to_component.js
===================================================================
--- trunk/controller/js/controller/control_group_to_component.js
(rev 0)
+++ trunk/controller/js/controller/control_group_to_component.js
2013-06-11 08:32:51 UTC (rev 11164)
@@ -0,0 +1,34 @@
+$(document).ready(function(){
+
+ $("#entity_id").change(function () {
+ var oArgs =
{menuaction:'property.boadmin_entity.get_category_list', entity_id:
$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ htmlString = "<option>Velg</option>"
+
+ $.each(data, function(i) {
+ var selected = '';
+ htmlString += "<option
value='" + data[i].id + "'" + selected + ">" + data[i].name + "</option>";
+ });
+
+ $("#category_id").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#category_id").html( htmlString );
+ }
+ }
+ });
+ });
+});
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2013-06-10 18:54:03 UTC (rev
11163)
+++ trunk/controller/setup/phpgw_no.lang 2013-06-11 08:32:51 UTC (rev
11164)
@@ -4,6 +4,7 @@
controller common no Kontroll
Register control item controller no Legg til nytt kontrollpunkt
Edit control item controller no Endre kontrollpunkt
+Entity controller no Komponentregister
View control item controller no Vis kontrollpunkt
control_item_type_1 controller no Ved innskriving av kommentar
control_item_type_2 controller no Ved innskriving av måling i et
tekstfelt
@@ -364,4 +365,4 @@
Register new message controller no Registrer ny melding
Show message controller no Vis melding
Status not done controller no Status: Ikke utført
-Status done controller no Status: Utført
\ No newline at end of file
+Status done controller no Status: Utført
Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php 2013-06-10 18:54:03 UTC (rev
11163)
+++ trunk/controller/setup/setup.inc.php 2013-06-11 08:32:51 UTC (rev
11164)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.44';
+ $setup_info['controller']['version'] = '0.1.45';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php 2013-06-10 18:54:03 UTC
(rev 11163)
+++ trunk/controller/setup/tables_update.inc.php 2013-06-11 08:32:51 UTC
(rev 11164)
@@ -889,3 +889,21 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
+
+ $test[] = '0.1.44';
+ function controller_upgrade0_1_44()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','component_location_id',array(
+ 'type' => 'int',
+ 'precision' => '4',
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.45';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
Modified: trunk/property/inc/class.boadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_entity.inc.php 2013-06-10 18:54:03 UTC
(rev 11163)
+++ trunk/property/inc/class.boadmin_entity.inc.php 2013-06-11 08:32:51 UTC
(rev 11164)
@@ -81,11 +81,12 @@
protected $custom;
var $public_functions = array
(
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
+ 'read' => true,
+ 'read_single' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'check_perms' => true,
+ 'get_category_list' => true
);
var $type_app = array
(
@@ -214,6 +215,14 @@
return $category;
}
+
+ public function get_category_list()
+ {
+ $entity_id =
phpgw::get_var('entity_id','int');
+ return
$this->so->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+ }
+
+
function read_single( $id )
{
return $this->so->read_single( $id );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11164] controller: add component to control group,
Sigurd Nes <=