[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8254]
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [8254] |
Date: |
Fri, 09 Dec 2011 06:47:12 +0000 |
Revision: 8254
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8254
Author: erikhl
Date: 2011-12-09 06:47:09 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/class.uicheck_list_for_equipment.inc.php
trunk/controller/inc/class.uicontrol.inc.php
Added Paths:
-----------
trunk/controller/templates/base/add_equipment_to_control.xsl
trunk/controller/templates/base/control_equipment_tabs.xsl
trunk/controller/templates/base/view_equipment_for_control.xsl
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2011-12-08 13:24:04 UTC
(rev 8253)
+++ trunk/controller/inc/class.socontrol.inc.php 2011-12-09 06:47:09 UTC
(rev 8254)
@@ -158,6 +158,12 @@
$sql = "INSERT INTO controller_control_location_list
(control_id, location_code) values($control_id, $location_code)";
$this->db->query($sql);
}
+
+ function add_equipment_to_control($control_id, $equipment_id)
+ {
+ $sql = "INSERT INTO controller_control_equipment_list
(control_id, equipment_id) values($control_id, $equipment_id)";
+ $this->db->query($sql);
+ }
function get_id_field_name($extended_info = false)
{
@@ -339,4 +345,103 @@
}
return $ret_array;
}
+
+ function get_bim_types($ifc = null)
+ {
+ $ret_array = array();
+ if($ifc != null)
+ {
+ if($ifc == 1)
+ $where_clause = "WHERE is_ifc";
+ else
+ $where_clause = "WHERE NOT is_ifc";
+ }
+ $sql = "select * from fm_bim_type {$where_clause} ORDER BY
name";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $i = 1;
+ while($this->db->next_record())
+ {
+ $ret_array[$i]['id'] = $this->db->f('id');
+ $ret_array[$i]['name'] = $this->db->f('name');
+ $i++;
+ }
+ return $ret_array;
+ }
+
+ public function getAllBimItems($noOfObjects = null, $bim_type = null) {
+ $filters = array();
+ if($noOfObjects != null && is_numeric($noOfObjects))
+ {
+ $limit = "LIMIT {$noOfObjects}";
+ }
+ else
+ {
+ $limit = "LIMIT 10";
+ }
+ if($bim_type != null && is_numeric($bim_type))
+ {
+ $filter = " AND fm_bim_type.id = {$bim_type}";
+ }
+ $sql = "SELECT fm_bim_item.id, fm_bim_type.name AS type,
fm_bim_item.guid FROM public.fm_bim_item, public.fm_bim_type WHERE
fm_bim_item.type = fm_bim_type.id {$filter} {$limit}";
+ $bimItemArray = array();
+ $this->db->query($sql, __LINE__, __FILE__);
+ $i=1;
+ while($this->db->next_record())
+ {
+ $bimItemArray[$i]['id'] = $this->db->f('id');
+ $bimItemArray[$i]['guid'] = $this->db->f('guid');
+ $bimItemArray[$i]['type'] = $this->db->f('type');
+ //$bimItemArray[$i]['xml_representation'] =
$this->db->f('xml_representation',true);
+ //$bimItemArray[] = $bimItem;
+ $i++;
+ }
+
+ return $bimItemArray;
+ }
+
+ public function get_control_equipment($noOfObjects = null, $bim_type =
null)
+ {
+ $filters = array();
+ if($noOfObjects != null && is_numeric($noOfObjects))
+ {
+ $limit = "LIMIT {$noOfObjects}";
+ }
+ else
+ {
+ $limit = "LIMIT 10";
+ }
+
+ $joins = " {$this->left_join} controller_control_equipment_list
ON (c.id = controller_control_equipment_list.control_id)";
+ $joins .= " {$this->left_join} fm_bim_item ON
(controller_control_equipment_list.equipment_id = fm_bim_item.id)";
+ $joins .= " {$this->left_join} fm_bim_type ON
(fm_bim_item.type= fm_bim_type.id)";
+ //$joins .= " {$this->left_join} fm_responsibility_role ON
(c.responsibility_id = fm_responsibility_role.id)";
+ $sql = "SELECT c.id AS control_id, c.title AS control_title,
fm_bim_type.name AS type_name, fm_bim_item.id AS bim_id, fm_bim_item.guid as
bim_item_guid FROM controller_control c {$joins} {$limit}";
+ $controlArray = array();
+ $this->db->query($sql, __LINE__, __FILE__);
+ $i=1;
+ while($this->db->next_record())
+ {
+ $controlArray[$i]['id'] = $this->db->f('control_id');
+ $controlArray[$i]['title'] =
$this->db->f('control_title');
+ $controlArray[$i]['bim_id'] = $this->db->f('bim_id');
+ $controlArray[$i]['bim_item_guid'] =
$this->db->f('bim_item_guid');
+ $controlArray[$i]['bim_type'] =
$this->db->f('type_name');
+ $i++;
+ }
+
+ return $controlArray;
+ }
+
+ public function getBimItemAttributeValue($bimItemGuid, $attribute)
+ {
+ $columnAlias = "attribute_values";
+ $sql = "select
array_to_string(xpath('descendant-or-self::*[{$attribute}]/{$attribute}/text()',
(select xml_representation from fm_bim_item where guid='{$bimItemGuid}')),
',') as $columnAlias";
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->num_rows() > 0)
+ {
+ $this->db->next_record();
+ $result = $this->db->f($columnAlias,true);
+ return preg_split('/,/', $result);
+ }
+ }
}
Modified: trunk/controller/inc/class.uicheck_list_for_equipment.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list_for_equipment.inc.php
2011-12-08 13:24:04 UTC (rev 8253)
+++ trunk/controller/inc/class.uicheck_list_for_equipment.inc.php
2011-12-09 06:47:09 UTC (rev 8254)
@@ -3,10 +3,10 @@
phpgw::import_class('phpgwapi.yui');
phpgw::import_class('controller.uicommon');
phpgw::import_class('controller.socontrol_area');
+ //phpgw::import_class('bim.sobimitem');
class controller_uicheck_list_for_equipment extends controller_uicommon
{
- var $grants;
var $cat_id;
var $start;
var $query;
@@ -17,23 +17,27 @@
var $type_id;
var $location_code;
- private $so_control_area;
+ private $so_control_area;
+ private $so_control;
+ private $so_bim;
var $public_functions = array(
'index' => true,
+
'add_equipment_to_control' => true,
+
'get_equipment_types_by_category' => true
);
function __construct()
{
parent::__construct();
- $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; //
menus added where needed via bocommon::get_menu
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-
$this->bo =
CreateObject('property.bolocation',true);
$this->bocommon = &
$this->bo->bocommon;
$this->so_control_area =
CreateObject('controller.socontrol_area');
-
+ $this->so_control =
CreateObject('controller.socontrol');
+ //$this->so_bim =
CreateObject('bim.sobimitem_impl');
+ //$this->so_bim = new
sobimitem_impl();
+
$this->type_id =
$this->bo->type_id;
$this->start =
$this->bo->start;
@@ -54,7 +58,7 @@
function index()
{
- if(phpgw::get_var('phpgw_return_as') == 'json') {
+/* if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->query();
}
$building_types =
execMethod('property.soadmin_location.read',array());
@@ -169,40 +173,246 @@
self::add_javascript('controller', 'controller',
'ajax.js');
//self::add_javascript('controller', 'yahoo',
'equipment_location.js');
- //$GLOBALS['phpgw']->js->validate_file( 'yahoo',
'location.responsiblility_role', 'property' );
+ //$GLOBALS['phpgw']->js->validate_file( 'yahoo',
'equipmens_location', 'controller' );
//self::render_template_xsl('datatable', $data);
self::render_template_xsl('equipment', $data);
+*/
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->query();
+ }
+ $bim_types = $this->so_control->get_bim_types();
+
+ $control_areas_array =
$this->so_control_area->get_control_areas_as_array();
+ $controls_array =
$this->so_control->get_controls_by_control_area($control_areas_array[0]['id']);
+ $control_id = $control_areas_array[0]['id'];
+
+ if($control_id == null)
+ $control_id = 0;
+
+ $tabs = array( array(
+ 'label' =>
lang('View_equipment_for_control')
+ ), array(
+ 'label' =>
lang('Add_equipment_for_control'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list_for_equipment.add_equipment_to_control'))
+ ));
+
+ $data = array(
+ 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, 0),
+ 'view' =>
"view_equipment_for_control",
+ 'control_area_array' => $control_areas_array,
+ 'control_array' =>
$control_array,
+ 'locations_table' => array(
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicheck_list_for_equipment.index','phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' =>
lang('ControlId'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => 'title',
+ 'label' =>
lang('Title'),
+ 'sortable' =>
false
+ ),
+ array(
+ 'key' => 'bim_id',
+ 'label' =>
lang('Bim_id'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'bim_name',
+ 'label' =>
lang('Bim_name'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'bim_type',
+ 'label' =>
lang('Bim_type'),
+ 'sortable' => false
+ )
+ )
+ )
+ );
+
+
+ phpgwapi_yui::load_widget('paginator');
+
+ self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+
+
self::render_template_xsl(array('control_equipment_tabs', 'common',
'view_equipment_for_control'), $data);
}
- public function query(){
+ function add_equipment_to_control()
+ {
+ if(phpgw::get_var('save_equipment'))
+ {
+ //add equipment to control using equipment item
ID
+ $items_checked = array();
+ $items = phpgw::get_var('values_assign');
+ $item_arr = explode('|',$items);
+ foreach($item_arr as $item)
+ {
+ $items_checked[] = explode(';',$item);
+ }
+ //var_dump($items_checked);
+
+ $control_id = phpgw::get_var('control_id');
+ //var_dump($control_id);
+ if($control_id != null &&
is_numeric($control_id))
+ {
+ //add chosen equipment to control
+ foreach($items_checked as $it)
+ {
+
$this->so_control->add_equipment_to_control($control_id, $it[0]);
+ }
+ }
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uicheck_list_for_equipment.index'));
+
+ }
+ else
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json')
{
+ return $this->get_equipment();
+ }
+
+ $bim_types = $this->so_control->get_bim_types();
+
+ $control_areas_array =
$this->so_control_area->get_control_areas_as_array();
+
+ $tabs = array( array(
+ 'label' =>
lang('View_equipment_for_control'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list_for_equipment.index'))
+
+ ), array(
+ 'label' =>
lang('Add_equipment_for_control')
+ ));
+
+ $data = array(
+ 'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
+ 'view'
=> "add_equipment_to_control",
+ 'control_filters'
=> array(
+ 'control_area_array'
=> $control_areas_array,
+ 'control_array'
=> $control_array
+ ),
+ 'filter_form'
=> array(
+ 'bim_types'
=> $bim_types
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicheck_list_for_equipment.add_equipment_to_control',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' =>
lang('ID'),
+ 'sortable'
=> true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' =>
'guid',
+ 'label' =>
lang('GUID'),
+ 'sortable'
=> false
+ ),
+ array(
+ 'key' => 'type',
+ 'label' =>
lang('type'),
+ 'sortable'
=> false
+ ),
+ array(
+ 'key' =>
'checked',
+ 'label' =>
'Velg',
+ 'sortable' =>
false,
+ 'formatter' =>
'YAHOO.widget.DataTable.formatCheckbox',
+ 'className' =>
'mychecks'
+ ),
+ array(
+ 'key' =>
'actions',
+ 'hidden' => true
+ ),
+ array(
+ 'key' =>
'labels',
+ 'hidden' => true
+ ),
+ array(
+ 'key' => 'ajax',
+ 'hidden' => true
+ )
+ )
+ )
+ );
+
+
+ phpgwapi_yui::load_widget('paginator');
+
+ self::add_javascript('controller', 'yahoo',
'control_tabs.js');
+ self::add_javascript('controller',
'controller', 'jquery.js');
+ self::add_javascript('controller',
'controller', 'ajax.js');
+
+
self::render_template_xsl(array('control_equipment_tabs', 'common',
'add_equipment_to_control'), $data);
+ }
+ }
+
+ public function query()
+ {
+ $control_list =
$this->so_control->get_control_equipment();
- $type_id = 1;
+ foreach($control_list as $control)
+ {
+ $control['bim_name'] =
$this->so_control->getBimItemAttributeValue($control['bim_item_guid'],
'description');
+ $results['results'][]= $control;
+ }
- $location_list = array();
+ $results['total_records'] = 10;
+ $results['start'] = 1;
+ $results['sort'] = 'id';
+ array_walk($results['results'], array($this,
'add_links'), array($type));
+
+ return $this->yui_results($results);
+ }
+
+ public function get_equipment()
+ {
+
+ /*$start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
+ $query =
phpgw::get_var('query');
+ $sort =
phpgw::get_var('sort');
+ $order =
phpgw::get_var('order');
+ $filter =
phpgw::get_var('filter', 'int');
+ $cat_id =
phpgw::get_var('cat_id');
+ $lookup_tenant =
phpgw::get_var('lookup_tenant', 'bool');
+ $district_id =
phpgw::get_var('district_id', 'int');
+ $part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
+ $status =
phpgw::get_var('status');
+ $type_id =
phpgw::get_var('type_id', 'int');
+ $allrows =
phpgw::get_var('allrows', 'bool');
+ $location_code =
phpgw::get_var('location_code');*/
+
+ $type_id = phpgw::get_var('bim_type_id');
+
+ $start = phpgw::get_var('startIndex');
+
+ $equipment_list = array();
- $this->bo->sort = "ASC";
-
- $location_list = $this->bo->read(array('user_id' =>
$user_id, 'role_id' =>$role_id,
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
-
'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
+ $sort = "ASC";
- $uicols = $this->bo->uicols;
+ $equipment_list =
$this->so_control->getAllBimItems(10,$type_id);
+ //var_dump($equipment_list);
+
$results = array();
-
- foreach($location_list as $location)
+ foreach($equipment_list as $equipment)
{
- //var_dump($location);
- $location['checked'] = true;
- $results['results'][]= $location;
-
+ $equipment['checked'] = false;
+ $results['results'][]= $equipment;
+ $i++;
}
- $results['total_records'] = 10;
- $results['start'] = 1;
- $results['sort'] = 'location_code';
+ $results['total_records'] = count($equipment_list);
+ $results['start'] = $start;
+ $results['sort'] = 'id';
+ $results['dir'] = "ASC";
- array_walk($results['results'], array($this,
'add_actions'), array($type));
+ array_walk($results['results'], array($this,
'add_links'), array($type));
return $this->yui_results($results);
}
@@ -223,4 +433,23 @@
$value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'rental.uicomposite.add_unit', 'location_code' => $value['location_code'])));
$value['labels'][] = lang('add_location');
}
+
+ public function get_equipment_types_by_category()
+ {
+ $category = phpgw::get_var('ifc');
+ if($ifc != null)
+ {
+ if($ifc = 1)
+ $ifc = true;
+ else
+ $ifc = false;
+ }
+
+
+ $bim_types = $this->so_control->get_bim_types($ifc);
+ if(count($bim_types)>0)
+ return json_encode( $bim_types );
+ else
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php 2011-12-08 13:24:04 UTC
(rev 8253)
+++ trunk/controller/inc/class.uicontrol.inc.php 2011-12-09 06:47:09 UTC
(rev 8254)
@@ -654,6 +654,11 @@
$this->so->add_location_to_control($control_id,
$location_code);
}
+ public function get_bim_types()
+ {
+ return $this->so->get_bim_types();
+ }
+
public function query()
{
$params = array(
Added: trunk/controller/templates/base/add_equipment_to_control.xsl
===================================================================
--- trunk/controller/templates/base/add_equipment_to_control.xsl
(rev 0)
+++ trunk/controller/templates/base/add_equipment_to_control.xsl
2011-12-09 06:47:09 UTC (rev 8254)
@@ -0,0 +1,247 @@
+<func:function name="phpgw:conditional">
+ <xsl:param name="test"/>
+ <xsl:param name="true"/>
+ <xsl:param name="false"/>
+
+ <func:result>
+ <xsl:choose>
+ <xsl:when test="$test">
+ <xsl:value-of select="$true"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:result>
+</func:function>
+
+<xsl:template name="add_equipment_to_control" xmlns:php="http://php.net/xsl">
+ <!-- IMPORTANT!!! Loads YUI javascript -->
+ <xsl:call-template name="common"/>
+
+ <div class="yui-content">
+ <div id="control_details">
+ <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:apply-templates select="control_filters" />
+ <xsl:apply-templates select="filter_form" />
+ <xsl:apply-templates select="paging"/>
+ <xsl:apply-templates select="datatable"/>
+ <xsl:apply-templates select="form/list_actions"/>
+ </div>
+ </div>
+</xsl:template>
+
+<xsl:template match="control_filters" name="control_filters">
+ <div style="margin: 10px;padding: 10px; width: 25%;">
+
+ <!-- When control area is chosen, an ajax request is executed.
The operation fetches controls from db and populates the control list.
+ The ajax opearation is handled in ajax.js -->
+ <select style="float:left;" id="control_area_list"
name="control_area_list">
+ <xsl:for-each select="control_area_array">
+ <xsl:variable
name="control_area_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$control_area_id}">
+ <xsl:value-of select="title"/>
+ </option>
+ </xsl:for-each>
+ </select>
+
+ <form id="loc_form" action="" method="GET">
+ <select id="control_id" name="control_id">
+ <xsl:choose>
+ <xsl:when
test="control_array/child::node()">
+ <xsl:for-each
select="control_array">
+ <xsl:variable
name="control_id"><xsl:value-of select="id"/></xsl:variable>
+ <option
value="{$control_id}">
+ <xsl:value-of
select="title"/>
+ </option>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <option>
+ Ingen kontroller
+ </option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </select>
+ </form>
+ </div>
+</xsl:template>
+
+<xsl:template match="filter_form">
+ <form id="queryForm">
+ <xsl:attribute name="method">
+ <xsl:value-of select="phpgw:conditional(not(method),
'GET', method)"/>
+ </xsl:attribute>
+
+ <xsl:attribute name="action">
+ <xsl:value-of select="phpgw:conditional(not(action),
'', action)"/>
+ </xsl:attribute>
+ <xsl:call-template name="filter_list"/>
+ </form>
+
+ <form id="update_table_dummy" method='POST' action='' >
+ </form>
+
+</xsl:template>
+
+<xsl:template name="filter_list" xmlns:php="http://php.net/xsl">
+ <div>
+ <ul id="filters">
+ <li>
+ <select id="ifc" name="ifc">
+ <option value="">
+ <xsl:value-of select="php:function('lang',
'Choose_equipment_category')"/>
+ </option>
+ <option value="0">
+ <xsl:value-of select="php:function('lang',
'equipment_category_internal')"/>
+ </option>
+ <option value="1">
+ <xsl:value-of select="php:function('lang',
'equipment_category_ifc')"/>
+ </option>
+ </select>
+ </li>
+ <li>
+ <select id="bim_type_id" name="bim_type_id">
+ <option value="">
+ <xsl:value-of select="php:function('lang',
'Choose_equipment_type')"/>
+ </option>
+ <xsl:for-each select="bim_types">
+ <xsl:variable name="bim_type_id"><xsl:value-of
select="id"/></xsl:variable>
+ <option value="{$bim_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ </ul>
+ <ul id="search_list">
+ <li>
+ <input type="text" name="query" />
+ </li>
+ <li>
+ <xsl:variable name="lang_search"><xsl:value-of
select="php:function('lang', 'Search')" /></xsl:variable>
+ <input type="submit" name="search"
value="{$lang_search}" title = "{$lang_search}" />
+ </li>
+ </ul>
+
+ </div>
+</xsl:template>
+
+<xsl:template match="datatable">
+ <script type="text/javascript">
+ <![CDATA[
+ function checkAll(myclass)
+ {
+ controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+ for(i=0;i<controls.length;i++)
+ {
+ //for class=mychecks, they have to be interchanged
+ //checkbox is located within td->div->input. To get the
input-object, use controls[i].children[0].children[0]
+ if(myclass=='mychecks')
+ {
+ if(controls[i].children[0].children[0].checked)
+ {
+
controls[i].children[0].children[0].checked = false;
+ }
+ else
+ {
+
controls[i].children[0].children[0].checked = true;
+ }
+ }
+ //for the rest, always id checked
+ else
+ {
+ controls[i].children[0].children[0].checked =
true;
+ }
+ }
+ }
+
+ function saveEquipmentToControl()
+ {
+ var divs =
YAHOO.util.Dom.getElementsByClassName('equipment_submit');
+ var mydiv = divs[divs.length-1];
+
+ // styles for dont show
+ mydiv.style.display = "none";
+
+ valuesForPHP =
YAHOO.util.Dom.getElementsByClassName('mychecks');
+ var values_return = ""; //new Array();
+
+ for(i=0;i<valuesForPHP.length;i++)
+ {
+ if(valuesForPHP[i].children[0].children[0].checked)
+ {
+ if(values_return != "")
+ values_return
+="|"+valuesForPHP[i].parentNode.firstChild.firstChild.firstChild.firstChild.nodeValue+';'+valuesForPHP[i].children[0].children[0].value;
+ else
+ values_return +=
valuesForPHP[i].parentNode.firstChild.firstChild.firstChild.firstChild.nodeValue+';'+valuesForPHP[i].children[0].children[0].value;
+ }
+ }
+
+ //alert(document.getElementById('control_id').value);
+ var control_id_value =
document.getElementById('control_id').value;
+
+ var returnfield = document.createElement('input');
+ returnfield.setAttribute('name', 'values_assign');
+ returnfield.setAttribute('type', 'text');
+ returnfield.setAttribute('value', values_return);
+ mydiv.appendChild(returnfield);
+
+ var control_id_field = document.createElement('input');
+ control_id_field.setAttribute('name', 'control_id');
+ control_id_field.setAttribute('type', 'text');
+ control_id_field.setAttribute('value', control_id_value);
+ mydiv.appendChild(control_id_field);
+
+ }
+ ]]>
+ </script>
+ <div id="data_paginator"/>
+ <div id="datatable-container"/>
+ <xsl:call-template name="datasource-definition" />
+ <xsl:variable name="label_submit"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
+ <xsl:variable name="label_checkAll"><xsl:value-of
select="php:function('lang', 'invert_checkboxes')" /></xsl:variable>
+ <div><input type="button" id="select_all" value="{$label_checkAll}"
onclick="checkAll('mychecks')"/></div>
+ <form action="#" name="equipment_form" id="equipment_form"
method="post">
+ <div class="equipment_submit"><input type="submit"
name="save_equipment" id="save_equipment" value="{$label_submit}"
onclick="return saveEquipmentToControl()"/></div>
+ </form>
+</xsl:template>
+
+
+<xsl:template name="datasource-definition">
+ <script>
+ YAHOO.namespace('controller');
+
+ YAHOO.controller.columnDefs = [
+ <xsl:for-each select="//datatable/field">
+ {
+ key: "<xsl:value-of
select="key"/>",
+ <xsl:if test="label">
+ label: "<xsl:value-of
select="label"/>",
+ </xsl:if>
+ sortable: <xsl:value-of
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+ <xsl:if test="hidden">
+ hidden: true,
+ </xsl:if>
+ <xsl:if test="formatter">
+ formatter: <xsl:value-of
select="formatter"/>,
+ </xsl:if>
+ className: "<xsl:value-of
select="className"/>"
+ }<xsl:value-of
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+ </xsl:for-each>
+ ];
+
+ var main_source = '<xsl:value-of select="source"/>';
+ var main_columnDefs = YAHOO.controller.columnDefs;
+ var main_form = 'queryForm';
+ var main_filters = ['bim_type_id'];
+ var main_container = 'datatable-container';
+ var main_table_id = 'datatable';
+ var main_pag = 'data_paginator';
+ var related_table = new Array('locations_table');
+
+ setDataSource(main_source, main_columnDefs, main_form,
main_filters, main_container, main_pag, main_table_id, related_table );
+
+ </script>
+
+</xsl:template>
\ No newline at end of file
Property changes on:
trunk/controller/templates/base/add_equipment_to_control.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/controller/templates/base/control_equipment_tabs.xsl
===================================================================
--- trunk/controller/templates/base/control_equipment_tabs.xsl
(rev 0)
+++ trunk/controller/templates/base/control_equipment_tabs.xsl 2011-12-09
06:47:09 UTC (rev 8254)
@@ -0,0 +1,26 @@
+<!-- separate tabs and inline tables-->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+<div class="yui-navset yui-navset-top" id="control_equipment_tabview">
+ <xsl:choose>
+ <xsl:when test="view = 'view_equipment_for_control'">
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang',
'equipment_for_control')"/></h1>
+ </div>
+ <!-- Prints tabs array -->
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+
+ <xsl:call-template name="view_equipment_for_control" />
+ </xsl:when>
+ <xsl:when test="view = 'add_equipment_to_control'">
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang',
'Add_equipment_for_control')"/></h1>
+ </div>
+ <!-- Prints tabs array -->
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+ <xsl:call-template name="add_equipment_to_control" />
+ </xsl:when>
+ </xsl:choose>
+</div>
+
+</xsl:template>
Property changes on: trunk/controller/templates/base/control_equipment_tabs.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/controller/templates/base/view_equipment_for_control.xsl
===================================================================
--- trunk/controller/templates/base/view_equipment_for_control.xsl
(rev 0)
+++ trunk/controller/templates/base/view_equipment_for_control.xsl
2011-12-09 06:47:09 UTC (rev 8254)
@@ -0,0 +1,124 @@
+<func:function name="phpgw:conditional">
+ <xsl:param name="test"/>
+ <xsl:param name="true"/>
+ <xsl:param name="false"/>
+
+ <func:result>
+ <xsl:choose>
+ <xsl:when test="$test">
+ <xsl:value-of select="$true"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:result>
+</func:function>
+
+<xsl:template name="view_equipment_for_control">
+ <!-- IMPORTANT!!! Loads YUI javascript -->
+ <xsl:call-template name="common"/>
+
+ <div class="yui-content">
+ <div id="control_details">
+ <div style="margin: 10px;padding: 10px; width: 25%;">
+
+ <!-- When control area is chosen, an ajax
request is executed.
+ The operation fetches controls from db
and populates the control list.
+ The ajax operation is handled in
ajax.js
+ -->
+ <select style="float:left;"
id="control_area_list" name="control_area_list">
+ <xsl:for-each
select="control_area_array">
+ <xsl:variable
name="control_area_id"><xsl:value-of select="id"/></xsl:variable>
+ <option
value="{$control_area_id}">
+ <xsl:value-of
select="title"/>
+ </option>
+ </xsl:for-each>
+ </select>
+
+ <form id="loc_form" action="" method="GET">
+
+ <select id="control_id"
name="control_id">
+ <xsl:choose>
+ <xsl:when
test="control_array/child::node()">
+ <xsl:for-each
select="control_array">
+ <xsl:variable
name="control_id"><xsl:value-of select="id"/></xsl:variable>
+ <option
value="{$control_id}">
+
<xsl:value-of select="title"/>
+ </option>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <option>
+ Ingen kontroller
+ </option>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </select>
+ </form>
+ </div>
+
+ <div id="addedProperties">
+ <ul id="locations_for_control"
name="locations_for_control">
+ <xsl:for-each
select="locations_for_control">
+ <li>
+ <div><xsl:value-of
select="id"/></div>
+ <div><xsl:value-of
select="title"/></div>
+ <div><xsl:value-of
select="location_code"/></div>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </div>
+
+ <iframe id="yui-history-iframe"
src="phpgwapi/js/yahoo/history/assets/blank.html"
style="position:absolute;top:0; left:0;width:1px;
height:1px;visibility:hidden;"></iframe>
+ <input id="yui-history-field" type="hidden"/>
+
+ <xsl:apply-templates select="locations_table"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+ </div>
+ </div>
+</xsl:template>
+
+<xsl:template match="locations_table" xmlns:php="http://php.net/xsl">
+
+ <div id="loc_paginator"/>
+ <div style="margin:20px;" id="locations-container"/>
+ <xsl:call-template name="locations-definition" />
+</xsl:template>
+
+<xsl:template name="locations-definition">
+ <script>
+
+ YAHOO.controller.columnDefs = [
+ <xsl:for-each select="//locations_table/field">
+ {
+ key: "<xsl:value-of
select="key"/>",
+ <xsl:if test="label">
+ label: "<xsl:value-of
select="label"/>",
+ </xsl:if>
+ sortable: <xsl:value-of
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+ <xsl:if test="hidden">
+ hidden: true,
+ </xsl:if>
+ <xsl:if test="formatter">
+ formatter: <xsl:value-of
select="formatter"/>,
+ </xsl:if>
+ className: "<xsl:value-of
select="className"/>"
+ }<xsl:value-of
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+ </xsl:for-each>
+ ];
+
+ var loc_source = '<xsl:value-of select="source"/>';
+ var loc_columnDefs = YAHOO.controller.columnDefs;
+ var loc_form = 'loc_form';
+ var loc_filters = ['control_id'];
+ var loc_container = 'locations-container';
+ var loc_table_id = 'locations_table';
+ var loc_data_table_pag = 'loc_paginator';
+
+ setDataSource(loc_source, loc_columnDefs, loc_form,
loc_filters, loc_container, loc_data_table_pag, loc_table_id, null, null,
null);
+
+ </script>
+
+</xsl:template>
\ No newline at end of file
Property changes on:
trunk/controller/templates/base/view_equipment_for_control.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8254],
Erik Holm-Larsen <=