[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8744]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8744] |
Date: |
Tue, 31 Jan 2012 18:38:03 +0000 |
Revision: 8744
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8744
Author: vator
Date: 2012-01-31 18:38:02 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/class.uicontrol.inc.php
trunk/controller/inc/class.uicontrol_location.inc.php
trunk/controller/js/controller/controller_datatable_test.js
trunk/controller/setup/phpgw_no.lang
trunk/controller/templates/base/control_location/control_location_tabs.xsl
trunk/controller/templates/base/control_location/register_control_to_location.xsl
Added Paths:
-----------
trunk/controller/inc/model/class.control_location.inc.php
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2012-01-31 16:38:23 UTC
(rev 8743)
+++ trunk/controller/inc/class.socontrol.inc.php 2012-01-31 18:38:02 UTC
(rev 8744)
@@ -31,6 +31,7 @@
phpgw::import_class('controller.socommon');
include_class('controller', 'control', 'inc/model/');
+ include_class('controller', 'control_location', 'inc/model/');
class controller_socontrol extends controller_socommon
{
@@ -228,10 +229,26 @@
}
}
+ function get_control_location($control_id, $location_code)
+ {
+ $sql = "SELECT * FROM controller_control_location_list
WHERE control_id = $control_id AND location_code=$location_code";
+
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+ $this->db->next_record();
+
+ $control_location = new
controller_control_location($this->unmarshal($this->db->f('id', true), 'int'));
+
+
$control_location->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
+
$control_location->set_control_id($this->unmarshal($this->db->f('control_id',
true), 'int'));
+
+ return $control_location
+ }
+
function register_control_to_location($control_id,
$location_code)
{
$sql = "INSERT INTO controller_control_location_list
(control_id, location_code) values($control_id, $location_code)";
- $this->db->query($sql);
+
+ return $this->db->query($sql);
}
function add_component_to_control($control_id, $component_id)
Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php 2012-01-31 16:38:23 UTC
(rev 8743)
+++ trunk/controller/inc/class.uicontrol.inc.php 2012-01-31 18:38:02 UTC
(rev 8744)
@@ -72,8 +72,6 @@
'generate_check_lists_for_control' => true,
'view_check_lists_for_control' => true,
'get_controls_by_control_area' => true,
- 'get_locations_for_control' =>
true,
- 'register_control_to_location' => true
);
public function __construct()
@@ -607,6 +605,9 @@
return null;
}
+ public function query(){}
+
+ /*
// Returns locations for a control
public function get_locations_for_control()
{
@@ -729,4 +730,5 @@
return $this->yui_results($results);
}
+ */
}
Modified: trunk/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_location.inc.php 2012-01-31
16:38:23 UTC (rev 8743)
+++ trunk/controller/inc/class.uicontrol_location.inc.php 2012-01-31
18:38:02 UTC (rev 8744)
@@ -59,7 +59,9 @@
var $public_functions = array(
'index' => true,
'view_locations_for_control' => true,
-
'register_control_to_location' => true,
+
'register_control_to_location' => true,
+
'register_control_to_location_2' => true,
+
'get_locations_for_control' => true
);
function __construct()
@@ -120,7 +122,7 @@
'label' =>
lang('View_locations_for_control')
), array(
'label' =>
lang('Add_locations_for_control'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_location.register_to_control_to_location'))
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_location.register_control_to_location'))
));
$data = array(
@@ -128,7 +130,7 @@
'view' =>
"view_locations_for_control",
'control_areas_array2' =>
$control_areas_array2,
'locations_table' => array(
- 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol.get_locations_for_control', 'control_id' => $control_id
,'phpgw_return_as' => 'json')),
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_location.get_locations_for_control', 'control_id' =>
$control_id ,'phpgw_return_as' => 'json')),
'field' => array(
array(
'key' => 'id',
@@ -305,6 +307,34 @@
self::render_template_xsl(array('control_location/control_location_tabs',
'control_location/register_control_to_location', 'common'), $data);
}
+ // Returns locations for a control
+ public function get_locations_for_control()
+ {
+ $control_id = phpgw::get_var('control_id');
+
+ if(is_numeric($control_id) & $control_id > 0)
+ {
+ $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
+
+ foreach($locations_for_control_array as
$location)
+ {
+ $results['results'][]= $location;
+ }
+
+ $results['total_records'] = count(
$locations_for_control_array );
+ $results['start'] = 1;
+ $results['sort'] = 'location_code';
+
+ array_walk($results['results'], array($this,
'add_actions'), array($type));
+ }
+ else
+ {
+ $results['total_records'] = 0;
+ }
+
+ return $this->yui_results($results);
+ }
+
public function query(){
$type_id = phpgw::get_var('type_id');
$return_results = phpgw::get_var('results', 'int',
'REQUEST', 0);
@@ -335,7 +365,20 @@
return $this->yui_results($results);
}
+
+ public function register_control_to_location_2()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $location_code = phpgw::get_var('location_code');
+ $control_location_id =
$this->so_control->register_control_to_location($control_id, $location_code);
+
+ if($control_location_id > 0)
+ return json_encode( array( "status" => "saved"
) );
+ else
+ return json_encode( array( "status" =>
"not_saved" ) );
+ }
+
public function add_actions(&$value, $key, $params)
{
unset($value['query_location']);
@@ -346,7 +389,7 @@
$value['parameters'] = array();
$value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'controller.uicontrol.register_control_to_location', 'location_code' =>
$value['location_code'])));
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'controller.uicontrol_location.register_control_to_location_2','location_code'
=> $value['location_code'], 'phpgw_return_as' => 'json')));
$value['labels'][] = lang('add_location');
$value['parameters'][] = "control_id";
}
Added: trunk/controller/inc/model/class.control_location.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_location.inc.php
(rev 0)
+++ trunk/controller/inc/model/class.control_location.inc.php 2012-01-31
18:38:02 UTC (rev 8744)
@@ -0,0 +1,77 @@
+<?php
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id: class.control.inc.php 8647 2012-01-23 07:28:36Z vator $
+ */
+
+ include_class('controller', 'model', 'inc/model/');
+
+ class controller_control_location extends controller_model
+ {
+ public static $so;
+
+ protected $id;
+ protected $location_code;
+ protected $control_id;
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is
created from outside
+ * the database the ID should be empty so the database can add
one according to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+ public function __construct(int $id = null)
+ {
+ $this->id = (int)$id;
+ }
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ public function get_id() { return $this->id; }
+
+ public function set_title($title)
+ {
+ $this->title = $title;
+ }
+
+ public function get_location_code() { return
$this->location_code; }
+
+ public function set_location_code($location_code)
+ {
+ $this->location_code = $location_code;
+ }
+
+ public function get_control_id() { return $this->control_id; }
+
+ public function set_control_id($control_id)
+ {
+ $this->control_id = $control_id;
+ }
+ }
Modified: trunk/controller/js/controller/controller_datatable_test.js
===================================================================
--- trunk/controller/js/controller/controller_datatable_test.js 2012-01-31
16:38:23 UTC (rev 8743)
+++ trunk/controller/js/controller/controller_datatable_test.js 2012-01-31
18:38:02 UTC (rev 8744)
@@ -212,12 +212,12 @@
//... retrieve the record based on the selected
table row
var row =
table.getTrEl(this.contextEventTarget);
var record = table.getRecord(row);
-
+
alert("!!")
//... check whether this action should be an
AJAX call
if( record.getData().ajax[task.index] ) {
var alertStatus = false;
-
+alert(record.getData().actions[ task.index ]);
// Check if confirm box should be
displayed before request is executed
if( record.getData().alert != null )
alertStatus =
record.getData().alert[0];
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2012-01-31 16:38:23 UTC (rev
8743)
+++ trunk/controller/setup/phpgw_no.lang 2012-01-31 18:38:02 UTC (rev
8744)
@@ -66,7 +66,7 @@
6 characters controller no 6 tegn
active controller no Aktiv
add controller no Legg til
-add_location controller no Legg enhet til kontrollen
+add_location controller no Registrer kontroll til bygg
all controller no Alle
all_locations controller no Enheter fra eiendomsregisteret
annually controller no Ă…rlig
Modified:
trunk/controller/templates/base/control_location/control_location_tabs.xsl
===================================================================
--- trunk/controller/templates/base/control_location/control_location_tabs.xsl
2012-01-31 16:38:23 UTC (rev 8743)
+++ trunk/controller/templates/base/control_location/control_location_tabs.xsl
2012-01-31 18:38:02 UTC (rev 8744)
@@ -13,13 +13,13 @@
<xsl:call-template name="view_locations_for_control" />
</xsl:when>
- <xsl:when test="view = 'add_location_to_control'">
+ <xsl:when test="view = 'register_control_to_location'">
<div class="identifier-header">
- <h1><xsl:value-of select="php:function('lang',
'Add_location_to_control')"/></h1>
+ <h1>Legg kontroll til bygg</h1>
</div>
<!-- Prints tabs array -->
<xsl:value-of disable-output-escaping="yes"
select="tabs" />
- <xsl:call-template name="add_location_to_control" />
+ <xsl:call-template name="register_control_to_location"
/>
</xsl:when>
</xsl:choose>
</div>
Modified:
trunk/controller/templates/base/control_location/register_control_to_location.xsl
===================================================================
---
trunk/controller/templates/base/control_location/register_control_to_location.xsl
2012-01-31 16:38:23 UTC (rev 8743)
+++
trunk/controller/templates/base/control_location/register_control_to_location.xsl
2012-01-31 18:38:02 UTC (rev 8744)
@@ -16,7 +16,7 @@
</func:result>
</func:function>
-<xsl:template name="add_location_to_control">
+<xsl:template name="register_control_to_location">
<!-- IMPORTANT!!! Loads YUI javascript -->
<xsl:call-template name="common"/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8744],
Torstein <=