[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8248] Merge 8226:8247 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8248] Merge 8226:8247 from trunk |
Date: |
Tue, 06 Dec 2011 19:35:35 +0000 |
Revision: 8248
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8248
Author: sigurdne
Date: 2011-12-06 19:35:34 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Merge 8226:8247 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
branches/Version-1_0-branch/controller/js/controller/ajax.js
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/setup/setup.inc.php
branches/Version-1_0-branch/controller/setup/tables_current.inc.php
branches/Version-1_0-branch/controller/setup/tables_update.inc.php
branches/Version-1_0-branch/controller/templates/base/control.xsl
branches/Version-1_0-branch/controller/templates/base/css/base.css
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
branches/Version-1_0-branch/phpgwapi/inc/class.acl.inc.php
Added Paths:
-----------
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_equipment.inc.php
branches/Version-1_0-branch/controller/js/yahoo/equipment_location.js
branches/Version-1_0-branch/controller/templates/base/add_location_to_control.xsl
branches/Version-1_0-branch/controller/templates/base/common.xsl
branches/Version-1_0-branch/controller/templates/base/control_location_tabs.xsl
branches/Version-1_0-branch/controller/templates/base/equipment.xsl
branches/Version-1_0-branch/controller/templates/base/view_locations_for_control.xsl
Removed Paths:
-------------
branches/Version-1_0-branch/controller/templates/base/locations.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247
Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -27,11 +27,25 @@
(
'text' => lang('Control'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol.control_list') ),
- 'image' => array('property',
'location_1')
+ 'image' => array('property',
'location_1'),
+ 'children' => array(
+
'location_for_check_list' => array
+
(
+
'text' => lang('Location'),
+
'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction'=> 'controller.uicheck_list_for_location.index') ),
+
'image' => array('property', 'location_1')
+
),
+
'equipment_for_check_list' => array
+
(
+
'text' => lang('Equipment'),
+
'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction'=> 'controller.uicheck_list_for_equipment.index') ),
+
'image' => array('property', 'entity_1')
+
)
+
)
),
'location_for_check_list' => array
(
- 'text' => lang('Location'),
+ 'text' =>
lang('location_connections'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicheck_list_for_location.index') ),
'image' => array('property',
'location_1')
),
Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -28,7 +28,6 @@
*/
function add(&$control)
{
-
$title = $control->get_title();
$sql = "INSERT INTO controller_control (title) VALUES
('$title')";
@@ -45,8 +44,7 @@
else
{
return false;
- }
-
+ }
}
/**
@@ -89,7 +87,7 @@
function get_controls_by_control_area($control_area_id)
{
- $results = array();
+ $controls_array = array();
$sql = "SELECT * FROM controller_control WHERE
control_area_id=$control_area_id";
$this->db->query($sql);
@@ -127,12 +125,12 @@
function get_locations_for_control($control_id)
{
- $results = array();
+ $controls_array = array();
- $sql = "SELECT DISTINCT c.id, c.title, cl.location_code ";
- $sql .= "FROM controller_control c, controller_check_list cl ";
- $sql .= "WHERE c.id = $control_id ";
- $sql .= "AND cl.control_id = c.id";
+ $sql = "SELECT c.id, c.title, cll.location_code ";
+ $sql .= "FROM controller_control c,
controller_control_location_list cll ";
+ $sql .= "WHERE cll.control_id = $control_id ";
+ $sql .= "AND cll.control_id = c.id";
$this->db->query($sql);
@@ -140,8 +138,10 @@
$control_id = $this->unmarshal($this->db->f('id',
true), 'int');
$title = $this->unmarshal($this->db->f('title', true),
'string');
$location_code =
$this->unmarshal($this->db->f('location_code', true), 'int');
-
- $controls_array[] = array("id" => $control_id, "title"
=> $title, "location_code" => $location_code);
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $controls_array[] = array("id" => $control_id, "title"
=> $title, "location_code" => $location_code, "loc1_name" =>
$location_array["loc1_name"]);
}
if( count( $controls_array ) > 0 ){
@@ -153,9 +153,12 @@
}
}
-
-
-
+ function add_location_to_control($control_id, $location_code)
+ {
+ $sql = "INSERT INTO controller_control_location_list
(control_id, location_code) values($control_id, $location_code)";
+ $this->db->query($sql);
+ }
+
function get_id_field_name($extended_info = false)
{
if(!$extended_info)
Copied:
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_equipment.inc.php
(from rev 8247, trunk/controller/inc/class.uicheck_list_for_equipment.inc.php)
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_equipment.inc.php
(rev 0)
+++
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_equipment.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -0,0 +1,226 @@
+<?php
+
+ phpgw::import_class('phpgwapi.yui');
+ phpgw::import_class('controller.uicommon');
+ phpgw::import_class('controller.socontrol_area');
+
+ class controller_uicheck_list_for_equipment extends controller_uicommon
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $currentapp;
+ var $type_id;
+ var $location_code;
+
+ private $so_control_area;
+
+ var $public_functions = array(
+
'index' => 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->type_id =
$this->bo->type_id;
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->status =
$this->bo->status;
+ $this->allrows =
$this->bo->allrows;
+ $this->lookup =
$this->bo->lookup;
+ $this->location_code =
$this->bo->location_code;
+
+
self::set_active_menu('controller::control::equipment_for_check_list');
+ }
+
+ function index()
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->query();
+ }
+ $building_types =
execMethod('property.soadmin_location.read',array());
+
+ $type_id = 1;
+
+ $category_types =
$this->bocommon->select_category_list(array(
+
'format'=>'filter',
+
'selected' =>
$this->cat_id,
+
'type'
=>'location',
+
'type_id'
=>$type_id,
+
'order'=>'descr'
+
));
+
+ $district_list =
$this->bocommon->select_district_list('filter',$this->district_id);
+ $default_value = array ('id'=>'','name'=>lang('no
district'));
+ array_unshift($district_list,$default_value);
+
+ $part_of_town_list =
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+ $default_value = array ('id'=>'','name'=>lang('no part
of town'));
+ array_unshift($part_of_town_list,$default_value);
+
+ $_role_criteria = array
+ (
+ 'type' =>
'responsibility_role',
+ 'filter' =>
array('location' => ".location.{$type_id}"),
+ 'order' => 'name'
+ );
+
+ $responsibility_roles_list =
execMethod('property.sogeneric.get_list',$_role_criteria);
+ $default_value = array ('id'=>'','name'=>lang('no
role'));
+ array_unshift ($responsibility_roles,$default_value);
+
+ $control_areas_array =
$this->so_control_area->get_control_areas_as_array();
+
+ // Fetches prosedures that are related to first control
area in list
+ $control_area_id = $control_areas_array[0]['id'];
+
+ $lists = array
+ (
+ 'building_types' =>
$building_types,
+ 'category_types' =>
$category_types,
+ 'district_list' =>
$district_list,
+ 'part_of_town_list' =>
$part_of_town_list,
+ 'responsibility_roles_list' =>
$responsibility_roles_list,
+ 'control_area_list' =>
$control_areas_array,
+ );
+
+
+
+
+ $data = array(
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'controller.uicheck_list_for_equipment.index',
'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' =>
'location_code',
+ 'label' =>
lang('Property'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' =>
'loc1_name',
+ 'label' =>
lang('Property name'),
+ 'sotrable' =>
false
+ ),
+ array(
+ 'key' => 'adresse1',
+ 'label' =>
lang('Address'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'postnummer',
+ 'label' => lang('Zip
code'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'checked',
+ 'label' => 'Velg',
+ 'sortable' => false,
+ 'formatter' =>
'YAHOO.widget.DataTable.formatCheckbox',
+ 'className' =>
'mychecks'
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ ),
+ array(
+ 'key' => 'actions',
+ 'hidden' => true
+ ),
+ array(
+ 'key' => 'labels',
+ 'hidden' => true
+ ),
+ array(
+ 'key' => 'ajax',
+ 'hidden' => true
+ ),
+ array(
+ 'key' => 'alert',
+ 'hidden' => true
+ )
+ )
+ ),
+ 'lists' => $lists
+ );
+
+ //self::add_javascript('controller', 'yahoo',
'datatable.js');
+ self::add_javascript('controller', 'controller',
'controller_datatable_test.js');
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ 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' );
+
+ //self::render_template_xsl('datatable', $data);
+ self::render_template_xsl('equipment', $data);
+ }
+
+ public function query(){
+
+ $type_id = 1;
+
+ $location_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));
+
+ $uicols = $this->bo->uicols;
+
+ $results = array();
+
+ foreach($location_list as $location)
+ {
+ //var_dump($location);
+ $location['checked'] = true;
+ $results['results'][]= $location;
+
+ }
+
+ $results['total_records'] = 10;
+ $results['start'] = 1;
+ $results['sort'] = 'location_code';
+
+ array_walk($results['results'], array($this,
'add_actions'), array($type));
+
+ return $this->yui_results($results);
+ }
+
+ public function add_actions(&$value, $key, $params)
+ {
+ unset($value['query_location']);
+
+ $value['ajax'] = array();
+ $value['actions'] = array();
+ $value['labels'] = array();
+
+ $value['ajax'][] = false;
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'property.uilocation.view',
'location_code' => $value['location_code'])));
+ $value['labels'][] = lang('show');
+
+ $value['ajax'][] = true;
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'rental.uicomposite.add_unit', 'location_code' => $value['location_code'])));
+ $value['labels'][] = lang('add_location');
+ }
+ }
\ No newline at end of file
Modified:
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -6,7 +6,6 @@
class controller_uicheck_list_for_location extends controller_uicommon
{
- var $grants;
var $cat_id;
var $start;
var $query;
@@ -22,15 +21,13 @@
var $public_functions = array(
'index' => true,
+
'add_location_to_control' => 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');
@@ -50,6 +47,8 @@
$this->allrows =
$this->bo->allrows;
$this->lookup =
$this->bo->lookup;
$this->location_code =
$this->bo->location_code;
+
+
self::set_active_menu('controller::control::location_for_check_list');
}
function index()
@@ -89,66 +88,120 @@
array_unshift ($responsibility_roles,$default_value);
$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'];
- $control_id = 186;
+ if($control_id == null)
+ $control_id = 0;
- $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
-
+ $tabs = array( array(
+ 'label' =>
lang('View_locations_for_control')
+ ), array(
+ 'label' =>
lang('Add_locations_for_control'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list_for_location.add_location_to_control'))
+ ));
+ $data = array(
+ 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, 0),
+ 'view' =>
"view_locations_for_control",
+ 'control_area_array' => $control_areas_array,
+ 'control_array' =>
$control_array,
+ 'locations_table' => array(
+ 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol.get_locations_for_control', 'control_id' => $control_id
,'phpgw_return_as' => 'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' =>
lang('ControlId'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => 'title',
+ 'label' =>
lang('Property name'),
+ 'sortable' =>
false
+ ),
+ array(
+ 'key' =>
'location_code',
+ 'label' =>
lang('Address'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'loc1_name',
+ 'label' =>
lang('Address'),
+ 'sortable' => false
+ )
+ )
+ )
+ );
- /*
- $lists = array
- (
- 'building_types' =>
$building_types,
- 'category_types' =>
$category_types,
- 'district_list' =>
$district_list,
- 'part_of_town_list' =>
$part_of_town_list,
- 'responsibility_roles_list' =>
$responsibility_roles_list,
- 'control_area_list' =>
$control_areas_array,
- );
-*/
+ 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_location_tabs', 'common',
'view_locations_for_control'), $data);
+ }
+
+ function add_location_to_control()
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json') {
+ return $this->query();
+ }
+ $building_types =
execMethod('property.soadmin_location.read',array());
+
+ $type_id = 1;
+
+ $category_types =
$this->bocommon->select_category_list(array(
+
'format'=>'filter',
+
'selected' =>
$this->cat_id,
+
'type'
=>'location',
+
'type_id'
=>$type_id,
+
'order'=>'descr'
+
));
+
+ $district_list =
$this->bocommon->select_district_list('filter',$this->district_id);
+ $default_value = array ('id'=>'','name'=>lang('no
district'));
+ array_unshift($district_list,$default_value);
+
+ $part_of_town_list =
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+ $default_value = array ('id'=>'','name'=>lang('no part
of town'));
+ array_unshift($part_of_town_list,$default_value);
+
+ $_role_criteria = array
+ (
+ 'type' =>
'responsibility_role',
+ 'filter' =>
array('location' => ".location.{$type_id}"),
+ 'order' => 'name'
+ );
+
+ $responsibility_roles_list =
execMethod('property.sogeneric.get_list',$_role_criteria);
+ $default_value = array ('id'=>'','name'=>lang('no
role'));
+ array_unshift ($responsibility_roles,$default_value);
+
+ $control_areas_array =
$this->so_control_area->get_control_areas_as_array();
+
+ $tabs = array( array(
+ 'label' =>
lang('View_locations_for_control'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list_for_location.index'))
+
+ ), array(
+ 'label' =>
lang('Add_locations_for_control')
+ ));
+
$data = array(
- 'form' => array(
- 'toolbar' => array(
- 'item' => array(
- array('type' =>
'filter',
- 'name' =>
'building_types',
- 'text' => lang('Building_types').':',
- 'list' => $building_types
- ),
- array('type' =>
'filter',
- 'name' =>
'cat_id',
- 'text' => lang('Category_types').':',
- 'list' => $category_types
- ),
- array('type' =>
'filter',
- 'name' =>
'district_id',
- 'text' => lang('District_list').':',
- 'list' => $district_list
- ),
- array('type' =>
'filter',
- 'name' =>
'part_of_town_list',
- 'text' => lang('Part_of_town_list').':',
- 'list' => $part_of_town_list
- ),
- array('type' =>
'filter',
- 'name' =>
'responsibility_roles_list',
- 'text' =>
lang('responsibility_roles_list').':',
- 'list' => $responsibility_roles_list
- ),
- array('type' => 'text',
- 'name' => 'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- ),
- ),
+ 'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
+ 'view'
=> "add_location_to_control",
+ 'control_filters' =>
array(
+ 'control_area_array' =>
$control_areas_array,
+ 'control_array'
=> $control_array
),
+ 'filter_form' =>
array(
+ 'building_types'
=> $building_types,
+ 'category_types'
=> $category_types,
+ 'district_list'
=> $district_list,
+ 'part_of_town_list' =>
$part_of_town_list
+ ),
'datatable' => array(
'source' =>
self::link(array('menuaction' => 'controller.uicheck_list_for_location.index',
'phpgw_return_as' => 'json')),
'field' => array(
@@ -161,7 +214,7 @@
array(
'key' =>
'loc1_name',
'label' =>
lang('Property name'),
- 'sotrable' =>
false
+ 'sortable' =>
false
),
array(
'key' => 'adresse1',
@@ -174,10 +227,6 @@
'sortable' => false
),
array(
- 'key' => 'link',
- 'hidden' => true
- ),
- array(
'key' => 'actions',
'hidden' => true
),
@@ -188,48 +237,49 @@
array(
'key' => 'ajax',
'hidden' => true
- ),
- array(
- 'key' => 'alert',
- 'hidden' => true
- )
+ )
)
- ),
- 'lists' =>
$lists,
- 'locations_for_control' =>
$locations_for_control_array,
- 'control_area_list' =>
$control_areas_array
- );
+ )
+ );
- //self::add_javascript('controller', 'yahoo',
'datatable.js');
- self::add_javascript('controller', 'controller',
'controller_datatable_test.js');
+
+ 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('datatable', $data);
- self::render_template_xsl('locations', $data);
+
self::render_template_xsl(array('control_location_tabs', 'common',
'add_location_to_control'), $data);
}
public function query(){
- $type_id = 1;
+ $type_id = phpgw::get_var('type_id');
+
+ if( empty($type_id) | $type_id == "" ){
+ $type_id = 1;
+ }
+
$location_list = array();
$this->bo->sort = "ASC";
-
+ $this->bo->start = phpgw::get_var('startIndex');
+
$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));
- $results = array();
-
+ $rows_total = $this->bo->read(array('type_id' =>
$type_id, 'allrows' => true));
+
foreach($location_list as $location)
{
$results['results'][]= $location;
}
- $results['total_records'] = 10;
- $results['start'] = 1;
+ $results['total_records'] = count($rows_total);
+ $results['start'] = $this->start;
$results['sort'] = 'location_code';
+ $results['dir'] = "ASC";
array_walk($results['results'], array($this,
'add_actions'), array($type));
@@ -249,7 +299,7 @@
$value['labels'][] = lang('show');
$value['ajax'][] = true;
- $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'controller.uilocation_check_list', 'location_code' =>
$value['location_code'])));
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'controller.uicontrol.add_location_to_control', 'location_code' =>
$value['location_code'])));
$value['labels'][] = lang('add_location');
}
}
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -462,20 +462,20 @@
// Build a YUI result style array
public function yui_results($results)
- {
- if (!$results) {
+ {
+ if (!$results) {
$results['total_records'] = 0;
$result['results'] = array();
}
return array(
'ResultSet' => array(
- 'totalResultsAvailable' =>
$results['total_records'],
- 'recordsReturned' =>
count($results['results']),
- 'startIndex' => $results['start'],
- 'sortKey' => $results['sort'],
- 'sortDir' => $results['dir'],
- 'Result' => $results['results']
+ 'totalRecords' =>
$results['total_records'],
+ 'recordsReturned' =>
count($results['results']),
+ 'startIndex' =>
$results['start'],
+ 'sortKey' =>
$results['sort'],
+ 'sortDir' =>
$results['dir'],
+ 'Result' =>
$results['results']
)
);
}
Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -41,7 +41,9 @@
'view_check_list'
=> true,
'generate_check_lists_for_control' => true,
'view_check_lists_for_control' => true,
- 'get_controls_by_control_area' => true
+ 'get_controls_by_control_area' => true,
+ 'get_locations_for_control' =>
true,
+ 'add_location_to_control' =>
true
);
public function __construct()
@@ -624,6 +626,34 @@
return null;
}
+ // Returns locations for a control
+ public function get_locations_for_control()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $locations_for_control_array =
$this->so->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));
+
+ return $this->yui_results($results);
+ }
+
+ public function add_location_to_control()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $location_code = phpgw::get_var('location_code');
+
+ $this->so->add_location_to_control($control_id,
$location_code);
+ }
+
public function query()
{
$params = array(
Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js
2011-12-06 19:35:34 UTC (rev 8248)
@@ -1,7 +1,7 @@
$(document).ready(function(){
- // uicheck_list_for_location.xsl when control area is selected control
list with control area is fetched form db
- // and control select list is populated
+ // file: uicheck_list_for_location.xsl
+ // When control area is selected, controls are fetched from db and
control select list is populated
$("#control_area_list option").click(function () {
var control_area_id = $(this).val();
@@ -21,20 +21,18 @@
htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].title + "</option>";
});
- $("#control_list").html( htmlString );
- }
- else
- {
+ $("#control_id").html( htmlString );
+ }else {
htmlString += "<option>Ingen
kontroller</option>"
- $("#control_list").html( htmlString
);
+ $("#control_id").html( htmlString );
}
}
});
});
- // Control.xsl when control area is selected procedures related to
control area is fetched form db
- // and procedure select list is populated
+ // file: control.xsl
+ // When control area is selected, procedures are fetched from db and
procedure select list is populated
$("#control_area_id option").click(function () {
var control_area_id = $(this).val();
var requestUrl =
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
@@ -64,6 +62,7 @@
});
});
+ // file: sort_check_list.xsl
// Saves order of control items for a group
$(".frm_save_order").submit(function(e){
e.preventDefault();
@@ -98,9 +97,9 @@
});
});
- // Used in file: view_check_lists_for_location.xsl
- // Fetches info about a check list when one hovers over an a tag
- $("a.view_list").mouseover(function(){
+ // file: view_check_lists_for_location.xsl
+ // Fetches info about a check list on hover status image icon
+ $("a.view_check_list").click(function(){
var thisA = $(this);
var divWrp = $(this).parent();
var requestUrl = $(thisA).attr("href");
@@ -149,9 +148,11 @@
}
}
});
+
+ return false;
});
- $("a.view_list").mouseout(function(){
+ $("a.view_check_list").mouseout(function(){
var thisA = $(this);
var divWrp = $(this).parent();
var requestUrl = $(thisA).attr("href");
Modified:
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
2011-12-06 12:33:18 UTC (rev 8247)
+++
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
2011-12-06 19:35:34 UTC (rev 8248)
@@ -36,27 +36,26 @@
}
);
}
-
-
// Reloads all data sources that are necessary based on the selected
related datatable
function reloadDataSources(selected_datatable){
-
+
//... hooks into the regular callback function
(onDataReturnInitializeTable) call to set empty payload array
var loaded = function ( sRequest , oResponse , oPayload ) {
var payload = new Array();
this.onDataReturnInitializeTable( sRequest , oResponse
, payload );
}
-
+
//... refresh the selected data tables
selected_datatable.getDataSource().sendRequest('',{success:loaded,
scope:selected_datatable});
-
+
//... traverse all datatables and refresh related (to the
selected) data tables
for(var i=0; i<YAHOO.controller.datatables.length; i++){
var datatable = YAHOO.controller.datatables[i];
for(var j=0;j<selected_datatable.related.length;j++){
var curr_related =
selected_datatable.related[j];
+
if(datatable.tid == curr_related){
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
}
@@ -216,12 +215,7 @@
//... check whether this action should be an
AJAX call
if( record.getData().ajax[task.index] ) {
-
- if(task.index == 1) {
-
-
- }
-
+
var alertStatus = false;
// Check if confirm box should be
displayed before request is executed
@@ -238,14 +232,14 @@
return false;
}
}
-
+
var request =
YAHOO.util.Connect.asyncRequest(
'GET',
record.getData().actions[
task.index ],
{
success:
ajaxResponseSuccess,
success:
ajaxResponseFailure,
- args:table
+ args: table
});
} else {
window.location =
record.getData().actions[task.index];
@@ -371,11 +365,12 @@
?>
*/
// ... create a paginator for this datasource
+
var pag = new YAHOO.widget.Paginator({
rowsPerPage: 10,
alwaysVisible: true,
rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
- firstPageLinkLabel: "<< <?php echo
lang('first') ?>",
+ firstPageLinkLabel: "<<asdasd <?php echo
lang('first') ?>",
previousPageLinkLabel: "< <?php echo
lang('previous') ?>",
nextPageLinkLabel: "<?php echo lang('next') ?>
>",
lastPageLinkLabel: "<?php echo lang('last') ?>
>>",
@@ -383,7 +378,7 @@
pageReportTemplate : "<?php echo
lang('shows_from') ?> {startRecord} <?php echo lang('to') ?> {endRecord} <?php
echo lang('of_total') ?> {totalRecords}.",
containers: [source_properties.paginator]
});
-
+
pag.render();
//... send data source properties and paginator to
wrapper function
Copied: branches/Version-1_0-branch/controller/js/yahoo/equipment_location.js
(from rev 8247, trunk/controller/js/yahoo/equipment_location.js)
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/equipment_location.js
(rev 0)
+++ branches/Version-1_0-branch/controller/js/yahoo/equipment_location.js
2011-12-06 19:35:34 UTC (rev 8248)
@@ -0,0 +1,323 @@
+//--------------------------------------------------------
+// Declaration of event.index vars
+//--------------------------------------------------------
+ //define SelectButton
+ var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4;//, oMenuButton_5;
+ var selectsButtons = [
+ {order:0, var_URL:'type_id', name:'btn_type_id',
style:'typebutton', dependiente:[], reload:1},
+ {order:1, var_URL:'cat_id', name:'btn_cat_id',
style:'categorybutton', dependiente:[]},
+ {order:2, var_URL:'district_id', name:'btn_district_id',
style:'districtbutton', dependiente:[3]},
+ {order:3,
var_URL:'part_of_town_id',name:'btn_part_of_town_id',style:'partOFTownbutton',dependiente:[]},
+ {order:4, var_URL:'role_id', name:'btn_role_id',
style:'roleIdbutton', dependiente:[]}
+// {order:5, var_URL:'user_id', name:'btn_user_id',
style:'userIdbutton', dependiente:[]}, // dummy - changed to
select
+ ];
+
+ // define buttons
+ var oNormalButton_0, oNormalButton_1;//, oNormalButton_2;
+ var normalButtons = [
+ {order:0, name:'btn_search', funct:"onSearchClick"},
+ {order:1, name:'btn_save', funct:"onSave"}
+ ];
+
+ // define Text buttons
+ var textImput = [
+ {order:0, name:'query', id:'txt_query'}
+ ];
+
+ var toolTips =
+ [
+ {name:'status', title:'Status',
description:'',ColumnDescription:'status'},
+ {name:'btn_export', title:'download', description:'Download
table to your browser',ColumnDescription:''}
+ ];
+
+ var linktoolTips =
+ [
+ {name:'btn_data_search', title:'Data search',
description:'Narrow the search dates'}
+ ];
+
+ var config_values =
+ [
+ {date_search : 0} //if search has link "Data search"
+ ];
+
+ var tableYUI;
+
/********************************************************************************
+ *
+ */
+
+ this.onChangeSelect = function()
+ {
+ var myselect=document.getElementById("sel_user_id");
+ for (var i=0; i<myselect.options.length; i++)
+ {
+ if (myselect.options[i].selected==true)
+ {
+ break;
+ }
+ }
+ eval("path_values.user_id='"+myselect.options[i].value+"'");
+ execute_ds();
+ }
+
+
+ this.myParticularRenderEvent = function()
+ {
+ delete_content_div("message",2); //find it in property.js
+ create_message();
+ tableYUI.deleteTFoot();
+ addFooterDatatable();
+ }
+
+
/********************************************************************************
+ * Delete all message un DIV 'message'
+ */
+ this.create_message = function()
+ {
+ div_message= YAHOO.util.Dom.get("message");
+
+ //SHOW message if exist 'values_ds.message'
+ if(window.values_ds.message)
+ {
+ // succesfull
+ if(window.values_ds.message[0].message)
+ {
+ for(i=0; i<values_ds.message[0].message.length;
i++)
+ {
+ oDiv=document.createElement("DIV");
+ txtNode =
document.createTextNode(values_ds.message[0].message[i].msg);
+ oDiv.appendChild(txtNode);
+ oDiv.style.color = '#009900';
+ oDiv.style.fontWeight = 'bold';
+
+ div_message.appendChild(oDiv);
+ }
+ }
+
+ // error
+ if(window.values_ds.message[0].error)
+ {
+ for(i=0; i<values_ds.message[0].error.length;
i++)
+ {
+ oDiv=document.createElement("DIV");
+ txtNode =
document.createTextNode(values_ds.message[0].error[i].msg);
+ oDiv.appendChild(txtNode);
+ oDiv.style.color = '#FF0000';
+ oDiv.style.fontWeight = 'bold';
+
+ div_message.appendChild(oDiv);
+ }
+ }
+ }
+ window.values_ds.message = null;
+ }
+
+ this.particular_setting = function()
+ {
+ if(flag_particular_setting=='init')
+ {
+ //locate (asign ID) to datatable
+ tableYUI =
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+ tableYUI.setAttribute("id","tableYUI");
+
+ //type
+ index =
locate_in_array_options(0,"value",path_values.type_id);
+ if(index)
+ {
+ oMenuButton_0.set("label", ("<em>" +
array_options[0][index][1] + "</em>"));
+ }
+ //category
+ index =
locate_in_array_options(1,"value",path_values.cat_id);
+ if(index)
+ {
+ oMenuButton_1.set("label", ("<em>" +
array_options[1][index][1] + "</em>"));
+ }
+
+ //district
+ index =
locate_in_array_options(2,"value",path_values.district_id);
+ if(index)
+ {
+ oMenuButton_2.set("label", ("<em>" +
array_options[2][index][1] + "</em>"));
+ }
+ //user
+ index =
locate_in_array_options(3,"value",path_values.user_id);
+ if(index)
+ {
+ oMenuButton_3.set("label", ("<em>" +
array_options[3][index][1] + "</em>"));
+ }
+
+// oMenuButton_0.focus();
+ YAHOO.util.Dom.get(textImput[0].id).focus();
+ }
+ else if(flag_particular_setting=='update')
+ {
+ }
+ }
+
+
+/****************************************************************************************/
+
+ this.Exchange_values = function()
+ {
+ //nothing
+ }
+
+/********************************************************************************/
+ var myFormatterCheck = function(elCell, oRecord, oColumn, oData)
+ {
+ var checked = '';
+ var hidden = '';
+ if(oRecord.getData('responsible_item'))
+ {
+ checked = "checked = 'checked'";
+ 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>";
+ }
+
+ var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+ {
+ elCell.innerHTML = "<center>"+oData+"</center>";
+ }
+
+/********************************************************************************/
+
+ this.onSave = function()
+ {
+ //get the last div in th form
+ var divs= YAHOO.util.Dom.getElementsByClassName('field');
+ var mydiv = divs[divs.length-1];
+ //remove all child of mydiv
+ if (mydiv.hasChildNodes())
+ {
+ while ( mydiv.childNodes.length >= 1 )
+ {
+ mydiv.removeChild( mydiv.firstChild );
+ }
+ }
+ // styles for dont show
+ mydiv.style.display = "none";
+
+ valuesForPHP =
YAHOO.util.Dom.getElementsByClassName('mychecks');
+ valuesForPHP_orig =
YAHOO.util.Dom.getElementsByClassName('orig_check');
+
+ var values_return =
+ {
+ assign:[],
+ assign_orig:[]
+ };
+
+ //add all control to form
+ for(i=0;i<valuesForPHP.length;i++)
+ {
+ //values_return.assign[i] = valuesForPHP[i].value;
+ if(valuesForPHP[i].checked)
+ {
+
values_return.assign.push(valuesForPHP[i].value);
+ }
+ }
+
+ for(i=0;i<valuesForPHP_orig.length;i++)
+ {
+ //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
+ YAHOO.util.Connect.setForm(formObject[0]);
+
+ maintain_pagination_order();
+ execute_ds();
+ }
+
+
+//----------------------------------------------------------
+
/********************************************************************************
+ *
+ */
+ this.addFooterDatatable = function()
+ {
+ //Create ROW
+ newTR = document.createElement('tr');
+ var i = 0;
+
+ for(var k=0 ; k<values_ds.headers.name.length; k++)
+ {
+ if (values_ds.headers.input_type[k] != 'hidden')
+ {
+ i++;
+ }
+ }
+
+ td_empty(i+2);
+
+ //RowChecked
+ CreateRowChecked("mychecks");
+
+ //Add to Table
+ myfoot = tableYUI.createTFoot();
+ myfoot.setAttribute("id","myfoot");
+ myfoot.appendChild(newTR.cloneNode(true));
+ //clean value for values_ds.message
+ values_ds.message = null;
+ }
+
+
/********************************************************************************
+ *
+ */
+ check_all = function(myclass)
+ {
+ controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+ for(i=0;i<controls.length;i++)
+ {
+ if(!controls[i].disabled)
+ {
+ //for class=mychecks, they have to be
interchanged
+ if(myclass=="mychecks")
+ {
+ if(controls[i].checked)
+ {
+ controls[i].checked = false;
+ }
+ else
+ {
+ controls[i].checked = true;
+ }
+ }
+ //for the rest, always id checked
+ else
+ {
+ controls[i].checked = true;
+ }
+ }
+ }
+ }
+
+
+ //YAHOO.util.Event.addListener(window, "load", function()
+ YAHOO.util.Event.onDOMReady(function()
+ {
+
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display =
'none';
+ var loader = new YAHOO.util.YUILoader();
+ loader.addModule({
+ name: "anyone", //module name; must be unique
+ type: "js", //can be "js" or "css"
+ fullpath: property_js //'property_js' have the path for
property.js, is render in HTML
+ });
+
+ loader.require("anyone");
+
+ //Insert JSON utility on the page
+
+ loader.insert();
+
+ });
+
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-12-06
12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-12-06
19:35:34 UTC (rev 8248)
@@ -1,4 +1,4 @@
-Assign location to control controller no Knytte kontrol til bygg
+location_connections controller no Byggknytning
control controller no Kontroll
controller common no Kontroll
control_helptext controller no Her kommer hjelpetekst for å
opprette en kontroll
@@ -7,6 +7,13 @@
Check_lists controller no Sjekklister
Choose_control_groups controller no Velg kontrollgrupper
Choose_control_items controller no Velg kontrollpunkt
+Choose_building_type controller no Velg byggtype
+Choose_building_category controller no Velg byggkategori
+Choose_district controller no Velg distrikt
+Choose_part_of_town controller no Velg bydel
+DATATABLE_MSG_EMPTY controller no Ingen data
+DATATABLE_MSG_ERROR controller no Datafeil
+DATATABLE_MSG_LOADING controller no Laster data
Sort_check_list controller no Sorter sjekkliste
Show_check_lists controller no Vis sjekklister
title controller no kontroll
@@ -118,6 +125,7 @@
last_updated controller no Sist oppdatert
level controller no Nivå
link controller no Lenke
+Locations_for_control controller no Bygg tilknyttet kontroll
make_pdf controller no Lag PDF for utskrift
message controller no Melding
messages_form_error controller no Skjemaet inneholder en feil.
@@ -212,7 +220,7 @@
third_quarter controller no 3. kvartal
t_functions controller no Funksjoner
title controller no Tittel
-to controller no Til
+to controller no til
to_the_top controller no Til toppen
type controller no Type
units controller no Enheter
@@ -276,4 +284,6 @@
Control title controller no Tittel
start_date controller no Start dato
planned_date controller no Planlagt dato
-end_date controller no Slutt dato
\ No newline at end of file
+end_date controller no Slutt dato
+View_locations_for_control controller no Vis
bygg/kontroll-knytning
+Add_locations_for_control controller no Legg til knytning for
bygg
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php 2011-12-06
12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php 2011-12-06
19:35:34 UTC (rev 8248)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.9';
+ $setup_info['controller']['version'] = '0.1.10';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -137,4 +137,26 @@
'ix' => array(),
'uc' => array()
),
+ 'controller_control_location_list', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'nullable' =>
false),
+ 'control_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'location_code' => array('type' =>
'int', 'precision' => '4', 'nullable' => false)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'controller_control_equipment_list', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'nullable' => false),
+ 'control_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'equipment_id' => array('type' =>
'int', 'precision' => '4', 'nullable' => false)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
);
Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php
2011-12-06 19:35:34 UTC (rev 8248)
@@ -170,4 +170,29 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.9';
return $GLOBALS['setup_info']['controller']['currentver'];
}
+
+ /* Update Controller from v 0.1.9 to 0.1.10
+ * Add table for connecting equipment (BIM) and control
+ */
+
+ $test[] = '0.1.9';
+ function controller_upgrade0_1_9()
+ {
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'controller_control_equipment_list', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'nullable' => false),
+ 'control_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'equipment_id' => array('type' =>
'int', 'precision' => '4', 'nullable' => false)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['setup_info']['controller']['currentver'] = '0.1.10';
+ return $GLOBALS['setup_info']['controller']['currentver'];
+ }
?>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/templates/base/add_location_to_control.xsl
(from rev 8247, trunk/controller/templates/base/add_location_to_control.xsl)
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/add_location_to_control.xsl
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/add_location_to_control.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -0,0 +1,199 @@
+<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_location_to_control">
+ <!-- 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="type_id" name="type_id">
+ <option value="">
+ <xsl:value-of select="php:function('lang',
'Choose_building_type')"/>
+ </option>
+ <xsl:for-each select="building_types">
+ <xsl:variable
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$building_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ <li>
+ <select id="cat_id" name="cat_id">
+ <option value="">
+ <xsl:value-of select="php:function('lang',
'Choose_building_category')"/>
+ </option>
+ <xsl:for-each select="category_types">
+ <xsl:variable
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$category_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ <li>
+ <select id="district_id" name="district_id">
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'Choose_district')"/>
+ </option>
+ <xsl:for-each select="district_list">
+ <xsl:variable name="district_id"><xsl:value-of
select="id"/></xsl:variable>
+ <option value="{$district_id}">
+ <xsl:value-of select="name"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </li>
+ <li>
+ <select id="part_of_town_id" name="part_of_town_id">
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'Choose_part_of_town')"/>
+ </option>
+ <xsl:for-each select="part_of_town_list">
+ <xsl:variable
name="part_of_town_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$part_of_town_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">
+ <div id="data_paginator"/>
+ <div id="datatable-container"/>
+ <xsl:call-template name="datasource-definition" />
+</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 = ['type_id', 'cat_id', 'district_id',
'part-of_town_list', 'responsibility_roles_list'];
+ 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
Copied: branches/Version-1_0-branch/controller/templates/base/common.xsl (from
rev 8247, trunk/controller/templates/base/common.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/common.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/common.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -0,0 +1,535 @@
+<xsl:template name="common" xmlns:php="http://php.net/xsl">
+
+
+<script type="text/javascript">
+
+<![CDATA[
+
+/**
+ * Javascript for the controller module. Holds datasource init functions and
form helpers.
+ *
+ * Functions and objects within this file are kept in the YAHOO.controller
namespace.
+ */
+
+ YAHOO.namespace('controller');
+
+ // Holds data source setup funtions
+ YAHOO.controller.setupDatasource = new Array();
+
+ //Holds all data sources
+ YAHOO.controller.datatables = new Array();
+
+ counter = 0;
+ // Adds data source setup funtions
+ function setDataSource(source_url, column_defs, form_id, filter_ids,
container_id, paginator_id, datatable_id,rel_id, editor_action,
disable_left_click) {
+ YAHOO.controller.setupDatasource.push(
+ function() {
+ this.url = source_url;
+ this.columns = column_defs;
+ this.form = form_id;
+ this.filters = filter_ids;
+ this.container = container_id;
+ this.paginator = paginator_id;
+ this.tid = datatable_id;
+ this.related_datatable = rel_id;
+ this.editor_action = editor_action;
+ if(disable_left_click) {
+ this.disable_left_click = true;
+ } else {
+ this.disable_left_click = false;
+ }
+ }
+ );
+ }
+
+ // Reloads all data sources that are necessary based on the selected
related datatable
+ function reloadDataSources(selected_datatable){
+
+ //... hooks into the regular callback function
(onDataReturnInitializeTable) call to set empty payload array
+ var loaded = function ( sRequest , oResponse , oPayload ) {
+ var payload = new Array();
+ this.onDataReturnInitializeTable( sRequest , oResponse
, payload );
+ }
+
+ //... refresh the selected data tables
+
selected_datatable.getDataSource().sendRequest('',{success:loaded,
scope:selected_datatable});
+
+ //... traverse all datatables and refresh related (to the
selected) data tables
+ for(var i=0; i<YAHOO.controller.datatables.length; i++){
+ var datatable = YAHOO.controller.datatables[i];
+
+ for(var j=0;j<selected_datatable.related.length;j++){
+ var curr_related =
selected_datatable.related[j];
+
+ if(datatable.tid == curr_related){
+
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
+ }
+ }
+ }
+ }
+
+ var highlightEditableCell = function(oArgs) {
+ var elCell = oArgs.target;
+ if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+ this.highlightCell(elCell);
+ }
+ };
+
+ // Wraps data sources setup logic
+ function dataSourceWrapper(source_properties,pag) {
+
+ this.properties = source_properties;
+ this.paginator = pag;
+
+ //... prepare base url
+ this.url = this.properties.url;
+ if(this.url[length-1] != '&') {
+ this.url += '&';
+ }
+
+ //... set up a new data source
+ this.source = new YAHOO.util.DataSource(this.url);
+
+ this.source.responseType = YAHOO.util.DataSource.TYPE_JSON;
+ this.source.connXhrMode = "queueRequests";
+
+ this.source.responseSchema = {
+ resultsList: "ResultSet.Result",
+ fields: this.properties.columns,
+ metaFields : {
+ totalRecords: "ResultSet.totalRecords"
+ }
+ };
+
+ //... set up a new data table
+
+ ]]>
+
+ this.table = new YAHOO.widget.DataTable(
+ this.properties.container,
+ this.properties.columns,
+ this.source,
+ {
+ paginator: this.paginator,
+ dynamicData: true,
+ MSG_EMPTY: '<xsl:value-of
select="php:function('lang', 'DATATABLE_MSG_EMPTY')"/>',
+ MSG_ERROR: '<xsl:value-of
select="php:function('lang', 'DATATABLE_MSG_ERROR')"/>',
+ MSG_LOADING: '<xsl:value-of
select="php:function('lang', 'DATATABLE_MSG_LOADING')"/>'
+ }
+ );
+
+ <![CDATA[
+
+ //... set table properties
+ this.table.related = this.properties.related_datatable;
+ this.table.tid = this.properties.tid;
+ this.table.container_id = this.properties.container;
+ this.table.editor_action = this.properties.editor_action;
+
+ //... push the data table on a stack
+ YAHOO.controller.datatables.push(this.table);
+
+ //... ?
+ this.table.handleDataReturnPayload = function(oRequest,
oResponse, oPayload) {
+ if(oPayload){
+ oPayload.totalRecords =
oResponse.meta.totalRecords;
+ return oPayload;
+ }
+ }
+
+ //... create context menu for each record after the table has
loaded the data
+ this.table.doAfterLoadData = function() {
+ onContextMenuBeforeShow = function(p_sType, p_aArgs)
+ {
+ var oTarget = this.contextEventTarget;
+ if (this.getRoot() == this)
+ {
+ if(oTarget.tagName != "TD")
+ {
+ oTarget =
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+ }
+ oSelectedTR =
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+ oSelectedTR.style.backgroundColor =
'#AAC1D8' ;
+ oSelectedTR.style.color = "black";
+ YAHOO.util.Dom.addClass(oSelectedTR,
prefixSelected);
+ }
+ }
+
+ onContextMenuHide = function(p_sType, p_aArgs)
+ {
+ if (this.getRoot() == this && oSelectedTR)
+ {
+ oSelectedTR.style.backgroundColor = ""
;
+ oSelectedTR.style.color = "";
+ YAHOO.util.Dom.removeClass(oSelectedTR,
prefixSelected);
+ }
+ }
+
+ var records = this.getRecordSet();
+
+ var validRecords = 0;
+ for(var i=0; i<records.getLength(); i++) {
+ var record = records.getRecord(i);
+
+ if(record == null)
+ {
+ continue;
+ }
+ else
+ {
+ validRecords++;
+ }
+
+ // use a global counter to create unique names
(even for the same datatable) for all context menues on the page
+ var menuName = this.container_id + "_cm_" +
counter;
+ counter++;
+
+ //... add menu items with label and handler
function for click events
+ var labels = record.getData().labels;
+
+ //create a context menu that triggers on the
HTML row element
+ record.menu = new
YAHOO.widget.ContextMenu(menuName,{trigger:this.getTrEl(validRecords -1
),itemdata: labels, lazyload: true});
+
+ //... subscribe handler for click events
+
record.menu.clickEvent.subscribe(onContextMenuClick, this);
+ record.menu.subscribe("beforeShow",
onContextMenuBeforeShow);
+ record.menu.subscribe("hide",
onContextMenuHide);
+
+ //... render the menu on the related table row
+
record.menu.render(this.getTrEl(validRecords-1));
+ }
+
+
+ }
+
+ //... calback methods for handling ajax calls
+ var ajaxResponseSuccess = function(o){
+ reloadDataSources(this.args);
+ };
+
+ var ajaxResponseFailure = function(o){
+ reloadDataSources(this.args);
+ };
+
+ //...create a handler for context menu clicks
+ var onContextMenuClick = function(eventString, args, table) {
+ //... the argument holds the selected index number in
the context menu
+ var task = args[1];
+
+ //... only act on a data table
+ if(table instanceof YAHOO.widget.DataTable) {
+ //... retrieve the record based on the selected
table row
+ var row =
table.getTrEl(this.contextEventTarget);
+ var record = table.getRecord(row);
+
+ //... check whether this action should be an
AJAX call
+ if( record.getData().ajax[task.index] ) {
+
+ var alertStatus = false;
+
+ // Check if confirm box should be
displayed before request is executed
+ if( record.getData().alert != null )
+ alertStatus =
record.getData().alert[0];
+
+ if( alertStatus ){
+ // Display confirm box with
message
+ var alertMessage =
record.getData().alert[1];
+ var answer = confirm(
alertMessage );
+
+ // Abort request if user clicks
the abort button
+ if (!answer){
+ return false;
+ }
+ }
+
+ if(record.getData().labels[task.index]
== "Legg enhet til kontrollen"){
+ var control_id =
YAHOO.util.Dom.get("control_id").value;
+
+ if(control_id > 0){
+ var requestUrl =
record.getData().actions[ task.index ] + "&control_id=" + control_id;
+ }
+ }else{
+ var requestUrl =
record.getData().actions[ task.index ];
+ }
+
+ if(requestUrl){
+ var request =
YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ requestUrl,
+ {
+ success:
ajaxResponseSuccess,
+ success:
ajaxResponseFailure,
+ args: table
+ });
+ }
+ } else {
+ window.location =
record.getData().actions[task.index];
+ }
+ }
+ };
+
+ // Handle mouseover and click events for inline editing
+ this.table.subscribe("cellMouseoverEvent",
highlightEditableCell);
+ this.table.subscribe("cellMouseoutEvent",
this.table.onEventUnhighlightCell);
+ this.table.subscribe("cellClickEvent",
this.table.onEventShowCellEditor);
+
+ this.table.subscribe("editorSaveEvent", function(oArgs) {
+ var field = oArgs.editor.getColumn().field;
+ var value = oArgs.newData;
+ var id = oArgs.editor.getRecord().getData().id;
+ var action = oArgs.editor.getDataTable().editor_action;
+
+ // Translate to unix time if the editor is a calendar.
+ if (oArgs.editor._sType == 'date') {
+ var selectedDate =
oArgs.editor.calendar.getSelectedDates()[0];
+ //alert("selDate1: " + selectedDate);
+ // Make sure we're at midnight GMT
+ selectedDate = selectedDate.toString().split("
");
+ //for(var e=0;e<selectedDate.length;e++){
+ // alert("element " + e + ": " +
selectedDate[e]);
+ //}
+ if(selectedDate[3] == "00:00:00"){
+ // alert("seldate skal byttes!");
+ selectedDate =
selectedDate.slice(0,3).join(" ") + " " + selectedDate[5] + " 00:00:00 GMT";
+ }
+ else{
+ selectedDate =
selectedDate.slice(0,4).join(" ") + " 00:00:00 GMT";
+ }
+ //selectedDate =
selectedDate.toString().split(" ").slice(0, 4).join(" ") + " 00:00:00 GMT";
+ //alert("selDate2: " + selectedDate);
+ var value = Math.round(Date.parse(selectedDate)
/ 1000);
+ //alert("selDate3 value: " + value);
+ }
+
+ var request = YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ 'index.php?menuaction=' + action +
"&field=" + field + "&value=" + value + "&id=" + id,
+ {
+ success: ajaxResponseSuccess,
+ failure: ajaxResponseFailure,
+ args:oArgs.editor.getDataTable()
+ }
+ );
+ });
+
+ // Don't set the row to be left-clickable if the table is
editable by inline editors.
+ // In that case we use cellClickEvents instead
+ var table_should_be_clickable = true;
+ for (i in this.properties.columns) {
+ if (this.properties.columns[i].editor) {
+ table_should_be_clickable = false;
+ }
+ }
+
+ if (table_should_be_clickable &&
!this.properties.disable_left_click) {
+ //... create a handler for regular clicks on a table row
+ this.table.subscribe("rowClickEvent", function(e,obj) {
+ YAHOO.util.Event.stopEvent(e);
+
+ //... trigger first action on row click
+ var row = obj.table.getTrEl(e.target);
+ if(row) {
+ var record = obj.table.getRecord(row);
+
+ //... check whether this action should
be an AJAX call
+ if(record.getData().ajax[0]) {
+ var request =
YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ //... execute first
action
+
record.getData().actions[0],
+ {
+ success:
ajaxResponseSuccess,
+ failure:
ajaxResponseFailure,
+ args:obj.table
+ }
+ );
+ } else {
+ //... execute first action
+ window.location =
record.getData().actions[0];
+ }
+ }
+ },this);
+
+ //... highlight rows on mouseover. This too only
happens if the table is
+ // not editable.
+ this.table.subscribe("rowMouseoverEvent",
this.table.onEventHighlightRow);
+ this.table.subscribe("rowMouseoutEvent",
this.table.onEventUnhighlightRow);
+ }
+
+
+ //... create context menues when the table renders
+ this.table.subscribe("renderEvent",this.table.doAfterLoadData);
+
+ //... listen for form submits and filter changes
+
YAHOO.util.Event.addListener(this.properties.form,'submit',formListener,this,true);
+ YAHOO.util.Event.addListener(this.properties.filters,
'change',formListener,this,true);
+ }
+
+
+ // Set up data sources when the document has loaded
+ YAHOO.util.Event.addListener(window, "load", function() {
+ var i = 0;
+ while(YAHOO.controller.setupDatasource.length > 0){
+ //... create a variable name, assign set up function to
that variable and instantiate properties
+ variableName = "YAHOO.controller.datasource" + i;
+ eval(variableName + " =
YAHOO.controller.setupDatasource.shift()");
+ var source_properties = eval("new " + variableName +
"()");
+
+]]>
+ // ... create a paginator for this datasource
+
+ var pag = new YAHOO.widget.Paginator({
+ rowsPerPage: 10,
+ alwaysVisible: true,
+ rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+ firstPageLinkLabel: "<< <xsl:value-of
select="php:function('lang', 'first')"/>",
+ previousPageLinkLabel: "< <xsl:value-of
select="php:function('lang', 'previous')"/>",
+ nextPageLinkLabel: "<xsl:value-of
select="php:function('lang', 'next')"/> >",
+ lastPageLinkLabel: "<xsl:value-of
select="php:function('lang', 'last')"/> >>",
+ template :
"{RowsPerPageDropdown}<xsl:value-of select="php:function('lang',
'elements_pr_page')"/>.{CurrentPageReport}<br/> {FirstPageLink}
{PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",
+ pageReportTemplate : "<xsl:value-of
select="php:function('lang', 'shows_from')"/> {startRecord} <xsl:value-of
select="php:function('lang', 'to')"/> {endRecord} <xsl:value-of
select="php:function('lang', 'of_total')"/> {totalRecords}.",
+ containers: [source_properties.paginator]
+ });
+
+<![CDATA[
+
+ pag.render();
+
+ //... send data source properties and paginator to
wrapper function
+ this.wrapper = new dataSourceWrapper(source_properties,
pag);
+ i+=1;
+/*
+ <?php
+ $populate = phpgw::get_var('populate_form');
+ if(isset($populate)){?>
+ var qs =
YAHOO.controller.serializeForm(source_properties.form);
+ this.wrapper.source.liveData =
this.wrapper.url + qs + '&';
+ this.wrapper.source.sendRequest('',
{success: function(sRequest, oResponse, oPayload) {
+
this.wrapper.table.onDataReturnInitializeTable(sRequest, oResponse,
this.wrapper.paginator);
+ }, scope: this});
+ <?php }
+ ?>
+*/
+ // XXX: Create generic column picker for all datasources
+
+ // Shows dialog, creating one when necessary
+ var newCols = true;
+ var showDlg = function(e) {
+ YAHOO.util.Event.stopEvent(e);
+
+ if(newCols) {
+ // Populate Dialog
+ // Using a template to create elements
for the SimpleDialog
+ var allColumns =
this.wrapper.table.getColumnSet().keys;
+ var elPicker =
YAHOO.util.Dom.get("dt-dlg-picker");
+ var elTemplateCol =
document.createElement("div");
+ YAHOO.util.Dom.addClass(elTemplateCol,
"dt-dlg-pickercol");
+ var elTemplateKey =
elTemplateCol.appendChild(document.createElement("span"));
+ YAHOO.util.Dom.addClass(elTemplateKey,
"dt-dlg-pickerkey");
+ var elTemplateBtns =
elTemplateCol.appendChild(document.createElement("span"));
+ YAHOO.util.Dom.addClass(elTemplateBtns,
"dt-dlg-pickerbtns");
+ var onclickObj = {fn:handleButtonClick,
obj:this, scope:false };
+
+ // Create one section in the
SimpleDialog for each Column
+ var elColumn, elKey, elButton,
oButtonGrp;
+
+ for(var
i=0,l=allColumns.length;i<l;i++) {
+ var oColumn = allColumns[i];
+ if(oColumn.label !=
'unselectable') { // We haven't marked the column as unselectable for the user
+ // Use the template
+ elColumn =
elTemplateCol.cloneNode(true);
+
+ // Write the Column key
+ elKey =
elColumn.firstChild;
+ elKey.innerHTML =
oColumn.label;
+
+ // Create a ButtonGroup
+ oButtonGrp = new
YAHOO.widget.ButtonGroup({
+ id:
"buttongrp"+i,
+ name:
oColumn.getKey(),
+ container:
elKey.nextSibling
+ });
+ oButtonGrp.addButtons([
+ { label: "Vis",
value: "Vis", checked: ((!oColumn.hidden)), onclick: onclickObj},
+ { label:
"Skjul", value: "Skjul", checked: ((oColumn.hidden)), onclick: onclickObj}
+ ]);
+
+
elPicker.appendChild(elColumn);
+ }
+ }
+
+ newCols = false;
+ }
+
+ myDlg.show();
+ };
+
+ var storeColumnsUrl = YAHOO.controller.storeColumnsUrl;
+ var hideDlg = function(e) {
+ this.hide();
+ // After we've hidden the dialog we send a post
call to store the columns the user has selected
+ var postData = 'values[save]=1';
+ var allColumns =
wrapper.table.getColumnSet().keys;
+ for(var i=0; i < allColumns.length; i++) {
+ if(!allColumns[i].hidden){
+ postData +=
'&values[columns][]=' + allColumns[i].getKey();
+ }
+ }
+
+ YAHOO.util.Connect.asyncRequest('POST',
storeColumnsUrl, null, postData);
+ };
+
+ var handleButtonClick = function(e, oSelf) {
+ var sKey = this.get("name");
+ if(this.get("value") === "Skjul") {
+ // Hides a Column
+ wrapper.table.hideColumn(sKey);
+ } else {
+ // Shows a Column
+ wrapper.table.showColumn(sKey);
+ }
+ };
+
+ // Create the SimpleDialog
+ YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
+ var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
+ width: "30em",
+ visible: false,
+ modal: false, // modal: true doesn't work for
some reason - the dialog becomes unclickable
+ buttons: [
+ {text:"Lukk", handler:hideDlg}
+ ],
+ fixedcenter: true,
+ constrainToViewport: true
+ });
+ myDlg.render();
+
+ // Nulls out myDlg to force a new one to be created
+ wrapper.table.subscribe("columnReorderEvent",
function(){
+ newCols = true;
+ YAHOO.util.Event.purgeElement("dt-dlg-picker",
true);
+ YAHOO.util.Dom.get("dt-dlg-picker").innerHTML =
"";
+ }, this, true);
+
+ // Hook up the SimpleDialog to the link
+ YAHOO.util.Event.addListener("dt-options-link",
"click", showDlg, this, true);
+ }
+ });
+
+ /*
+ * Listen for events in form. Serialize all form elements. Stop
+ * the original request and send new request.
+ */
+ function formListener(event){
+ YAHOO.util.Event.stopEvent(event);
+ var qs = YAHOO.portico.serializeForm(this.properties.form);
+ this.source.liveData = this.url + qs + '&';
+ this.source.sendRequest('', {success: function(sRequest, oResponse,
oPayload) {
+ this.table.onDataReturnInitializeTable(sRequest, oResponse,
this.paginator);
+ }, scope: this});
+ }
+
+]]>
+
+</script>
+</xsl:template>
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/templates/base/control.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control.xsl
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/templates/base/control.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -70,16 +70,16 @@
<label for="title">Tittel</label>
</dt>
<dd>
- <xsl:choose>
- <xsl:when test="editable">
- <input type="text" name="title"
id="title" value="{control/title}" size="80"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="control/title" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <input type="text"
name="title" id="title" value="{control/title}" size="80"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="control/title" />
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
-<dt>
+ <dt>
<label
for="start_date">Startdato</label>
</dt>
<dd>
Copied:
branches/Version-1_0-branch/controller/templates/base/control_location_tabs.xsl
(from rev 8247, trunk/controller/templates/base/control_location_tabs.xsl)
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location_tabs.xsl
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/control_location_tabs.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -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_location_tabview">
+ <xsl:choose>
+ <xsl:when test="view = 'view_locations_for_control'">
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang',
'Locations_for_control')"/></h1>
+ </div>
+ <!-- Prints tabs array -->
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+
+ <xsl:call-template name="view_locations_for_control" />
+ </xsl:when>
+ <xsl:when test="view = 'add_location_to_control'">
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang',
'Add_location_to_control')"/></h1>
+ </div>
+ <!-- Prints tabs array -->
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+ <xsl:call-template name="add_location_to_control" />
+ </xsl:when>
+ </xsl:choose>
+</div>
+
+</xsl:template>
Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css
2011-12-06 19:35:34 UTC (rev 8248)
@@ -500,11 +500,11 @@
margin-right:5px;
}
-#control_tabview .yui-navset{
+#control_tabview .yui-navset, #control_location_tabview .yui-navset{
margin:0;
}
-#control_tabview .identifier-header{
+#control_tabview .identifier-header, #control_location_tabview
.identifier-header {
padding-left:0;
}
@@ -643,9 +643,19 @@
}
#toolbar {
- padding: 10px 20px;
+ padding: 10px;
}
+#toolbar input[type="text"] {
+ font-size: 100%;
+ padding: 3px;
+}
+
+#toolbar input[type="submit"] {
+ padding:0 8px;
+ margin-top:0;
+}
+
#innertoolbar-button{
/*background: none repeat scroll 0 0 #CCCCCC;*/
color: #111111;
@@ -829,28 +839,41 @@
ul.calendar li.heading div {
font-weight: bold;
}
+ul.calendar{
+ float: left;
+}
ul.calendar li div {
float: left;
+ width: 30px;
+ padding: 3px;
text-align: center;
- width: 40px;
- padding: 3px;
}
+ul.calendar.info {
+ background:none;
+ border:0;
+ float: left;
+}
-ul.calendar.days li div {
+#days_wrp {
float: left;
- text-align: center;
- width: 30px;
- padding: 3px;
+ position: relative;
+ width: 500px;
+ overflow-x: hidden;
+ height: 800px;
}
+ul.calendar.days {
+ position: absolute;
+ width: 1120px;
+}
-ul.calendar li div.date, ul.calendar.days div.date {
+ul.calendar li div.date, ul.calendar.info div.date {
width: 80px;
}
-ul.calendar div.title, ul.calendar.days div.title {
+ul.calendar div.title, ul.calendar.info div.title {
width: 200px;
}
-ul.calendar div.frequency, ul.calendar.days div.frequency {
+ul.calendar div.frequency, ul.calendar.info div.frequency {
width: 120px;
}
@@ -893,4 +916,30 @@
font-size: 16px;
font-weight: bold;
padding: 0 0 5px;
+}
+.yui-pg-first{
+ margin-left: 14px;
+ margin-top: 5px;
+}
+#data_paginator, #loc_paginator{
+ margin:8px;
+ clear:left;
+}
+ul#filters li, ul#search_list li{
+ float:left;
+}
+ul#filters input[type='text'], ul#filters select{
+ padding:3px;
+}
+ul#search_list input[type="submit"] {
+ margin: 0;
+ padding: 0 10px;
+}
+ul#search_list input[type="text"] {
+ margin: 0 5px 0 0;
+ padding: 3px;
+}
+#queryForm{
+ overflow:hidden;
+ margin: 20px;
}
\ No newline at end of file
Copied: branches/Version-1_0-branch/controller/templates/base/equipment.xsl
(from rev 8247, trunk/controller/templates/base/equipment.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/equipment.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/equipment.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -0,0 +1,319 @@
+<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 match="data">
+
+ <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:call-template name="yui_booking_i18n"/>
+ <xsl:apply-templates select="form" />
+ <xsl:apply-templates select="paging"/>
+ <div id="list_flash">
+ <xsl:call-template name="msgbox"/>
+ </div>
+ <xsl:apply-templates select="datatable"/>
+ <xsl:apply-templates select="form/list_actions"/>
+
+</xsl:template>
+
+<xsl:template match="form">
+ <form id="queryForm" style="margin: 20px; width: 65%;">
+ <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:apply-templates select="toolbar"/>
+ </form>
+
+ <form id="update_table_dummy" method='POST' action='' >
+ </form>
+
+</xsl:template>
+
+
+<xsl:template match="toolbar">
+ <div id="toolbar">
+ <table class='yui-skin-sam' border="0" cellspacing="0"
cellpadding="0" style="padding:0px; margin:0px;">
+ <tr>
+ <xsl:for-each select="item">
+ <xsl:variable name="filter_key"
select="concat('filter_', name)"/>
+ <xsl:variable name="filter_key_name"
select="concat(concat('filter_', name), '_name')"/>
+ <xsl:variable name="filter_key_id"
select="concat(concat('filter_', name), '_id')"/>
+
+ <xsl:choose>
+ <xsl:when test="type = 'date-picker'">
+ <td valign="top">
+ <div class="date-picker">
+ <input id="filter_{name}" name="filter_{name}"
type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key]"/></xsl:attribute>
+ </input>
+ </div>
+ </td>
+ </xsl:when>
+ <xsl:when test="type = 'autocomplete'">
+ <td valign="top" width="160px">
+ <div style="width:140px">
+ <input
id="filter_{name}_name" name="filter_{name}_name" type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key_name]"/></xsl:attribute>
+ </input>
+ <input
id="filter_{name}_id" name="filter_{name}_id" type="hidden">
+ <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key_id]"/></xsl:attribute>
+ </input>
+ <div
id="filter_{name}_container"/>
+ </div>
+ <script type="text/javascript">
+
YAHOO.util.Event.onDOMReady(function() {
+ var name = "<xsl:value-of
select="name"/>";
+ var ui = "<xsl:value-of
select="ui"/>";
+
+ var itemSelectCallback
= false;
+ <xsl:if
test="onItemSelect">
+
itemSelectCallback = <xsl:value-of select="onItemSelect"/>;
+ </xsl:if>
+
+ var
onClearSelectionCallback = false;
+ <xsl:if
test="onClearSelection">
+
onClearSelectionCallback = <xsl:value-of select="onClearSelection"/>;
+ </xsl:if>
+
+ var requestGenerator =
false;
+ <xsl:if
test="requestGenerator">
+
requestGenerator = <xsl:value-of select="requestGenerator"/>;
+ </xsl:if>
+
+ <![CDATA[
+ var oAC =
YAHOO.portico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&',
+
'filter_'+name+'_name', 'filter_'+name+'_id', 'filter_'+name+'_container');
+
+ if (requestGenerator) {
+
oAC.generateRequest = requestGenerator;
+ }
+
+ if (itemSelectCallback)
{
+
oAC.itemSelectEvent.subscribe(itemSelectCallback);
+ }
+
+
YAHOO.util.Event.addBlurListener('filter_'+name+'_name', function()
+ {
+ if
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "")
+ {
+
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
+ if
(onClearSelectionCallback) {
+
onClearSelectionCallback();
+ }
+ }
+ });
+
+
YAHOO.portico.addPreSerializeQueryFormListener(function(form)
+ {
+ if
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "")
+ {
+
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
+ }
+ });
+ ]]>
+ });
+ </script>
+ </td>
+ </xsl:when>
+ <xsl:when test="type = 'filter'">
+ <td valign="top">
+ <xsl:variable name="name"><xsl:value-of
select="name"/></xsl:variable>
+
+ <select id="{$name}" name="{$name}"
onMouseout="window.status='';return true;">
+ <xsl:for-each select="list">
+ <xsl:variable name="id"><xsl:value-of
select="id"/></xsl:variable>
+ <xsl:if test="id =
'NEW'">
+ <option value="{$id}"
selected="selected">
+
<xsl:value-of select="name"/>
+ </option>
+ </xsl:if>
+ <xsl:if test="id !=
'NEW'">
+ <option value="{$id}">
+
<xsl:value-of select="name"/>
+ </option>
+ </xsl:if>
+ </xsl:for-each>
+ </select>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td valign="top">
+ <input id="innertoolbar">
+ <xsl:attribute
name="type"><xsl:value-of select="phpgw:conditional(not(type), '',
type)"/></xsl:attribute>
+ <xsl:attribute
name="name"><xsl:value-of select="phpgw:conditional(not(name), '',
name)"/></xsl:attribute>
+ <xsl:attribute
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '',
onClick)"/></xsl:attribute>
+ <xsl:attribute
name="value"><xsl:value-of select="phpgw:conditional(not(value), '',
value)"/></xsl:attribute>
+ <xsl:attribute
name="href"><xsl:value-of select="phpgw:conditional(not(href), '',
href)"/></xsl:attribute>
+ <xsl:attribute
name="class"><xsl:value-of select="phpgw:conditional(not(class), '',
class)"/></xsl:attribute>
+ </input>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+ <xsl:if test="item/text and normalize-space(item/text)">
+ <thead style="background:none">
+ <tr>
+ <xsl:for-each select="item">
+ <td>
+ <xsl:if
test="name">
+ <label
style='margin:auto 0.25em'>
+
<xsl:attribute name="for"><xsl:value-of select="phpgw:conditional(not(name),
'', name)"/></xsl:attribute>
+
<xsl:value-of select="phpgw:conditional(not(text), '', text)"/>
+ </label>
+ </xsl:if>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </thead>
+ </xsl:if>
+ </table>
+ </div>
+</xsl:template>
+
+<xsl:template match="datatable">
+ <div id="paginator"/>
+ <div id="datatable-container"/>
+ <xsl:call-template name="datasource-definition" />
+</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>
+ ];
+
+ setDataSource('<xsl:value-of select="source"/>',
YAHOO.controller.columnDefs, 'queryForm', ['building_types', 'cat_id',
'district_id', 'part-of_town_list', 'responsibility_roles_list'],
'datatable-container', '_form', '_paginator', null);
+
+ </script>
+
+</xsl:template>
+<!--
+<xsl:template match="lists">
+
+<div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px solid
#243356;margin: 20px;padding: 20px;">
+-->
+ <!-- When control area is chosen an ajax request is executed.
The operation fetches controls from db and populates the control list below.
+ The ajax opearation is handled in file ajax.js
+ -->
+ <!--
+ <select id="control_area_list" name="control_area_list">
+ <xsl:for-each select="control_area_list">
+ <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>
+
+ <select id="control_list" name="control_list">
+ <xsl:for-each select="control_list">
+ <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>
+ </select>
+ </div>
+
+ <div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px
solid #243356;margin: 20px;padding: 20px;">
+ <select id="building_types" name="building_types">
+ <xsl:for-each select="building_types">
+ <xsl:variable
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$building_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+
+ </xsl:for-each>
+ </select>
+
+ <select id="category_types" name="category_types">
+ <xsl:for-each select="category_types">
+ <xsl:variable
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$category_type_id}">
+ <xsl:value-of select="name"/>
+ </option>
+
+ </xsl:for-each>
+ </select>
+
+ <select id="district_list" name="district_list">
+ <xsl:for-each select="district_list">
+ <xsl:variable
name="district_list_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$district_list_id}">
+ <xsl:value-of select="name"/>
+ </option>
+
+ </xsl:for-each>
+ </select>
+
+ <select id="part_of_town_list" name="part_of_town_list">
+ <xsl:for-each select="part_of_town_list">
+ <xsl:variable
name="part_of_town_list_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$part_of_town_list_id}">
+ <xsl:value-of select="name"/>
+ </option>
+
+ </xsl:for-each>
+ </select>
+ <select id="responsibility_roles" name="responsibility_roles">
+ <xsl:for-each select="responsibility_roles_list">
+ <xsl:variable
name="responsibility_roles_list_id"><xsl:value-of select="id"/></xsl:variable>
+ <option value="{$responsibility_roles_list_id}">
+ <xsl:value-of select="name"/>
+ </option>
+
+ </xsl:for-each>
+ </select>
+ </div>
+</xsl:template>
+-->
\ No newline at end of file
Deleted: branches/Version-1_0-branch/controller/templates/base/locations.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/locations.xsl
2011-12-06 12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/controller/templates/base/locations.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -1,319 +0,0 @@
-<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 match="data">
-
- <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:call-template name="yui_booking_i18n"/>
- <xsl:apply-templates select="form" />
- <xsl:apply-templates select="paging"/>
- <div id="list_flash">
- <xsl:call-template name="msgbox"/>
- </div>
- <xsl:apply-templates select="datatable"/>
- <xsl:apply-templates select="form/list_actions"/>
-
-</xsl:template>
-
-<xsl:template match="form">
- <form id="queryForm" style="margin: 20px; width: 65%;">
- <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:apply-templates select="toolbar"/>
- </form>
-
- <form id="update_table_dummy" method='POST' action='' >
- </form>
-
-</xsl:template>
-
-
-<xsl:template match="toolbar">
- <div id="toolbar">
- <table class='yui-skin-sam' border="0" cellspacing="0"
cellpadding="0" style="padding:0px; margin:0px;">
- <tr>
- <xsl:for-each select="item">
- <xsl:variable name="filter_key"
select="concat('filter_', name)"/>
- <xsl:variable name="filter_key_name"
select="concat(concat('filter_', name), '_name')"/>
- <xsl:variable name="filter_key_id"
select="concat(concat('filter_', name), '_id')"/>
-
- <xsl:choose>
- <xsl:when test="type = 'date-picker'">
- <td valign="top">
- <div class="date-picker">
- <input id="filter_{name}" name="filter_{name}"
type="text">
- <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key]"/></xsl:attribute>
- </input>
- </div>
- </td>
- </xsl:when>
- <xsl:when test="type = 'autocomplete'">
- <td valign="top" width="160px">
- <div style="width:140px">
- <input
id="filter_{name}_name" name="filter_{name}_name" type="text">
- <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key_name]"/></xsl:attribute>
- </input>
- <input
id="filter_{name}_id" name="filter_{name}_id" type="hidden">
- <xsl:attribute
name="value"><xsl:value-of select="../../../filters/*[local-name() =
$filter_key_id]"/></xsl:attribute>
- </input>
- <div
id="filter_{name}_container"/>
- </div>
- <script type="text/javascript">
-
YAHOO.util.Event.onDOMReady(function() {
- var name = "<xsl:value-of
select="name"/>";
- var ui = "<xsl:value-of
select="ui"/>";
-
- var itemSelectCallback
= false;
- <xsl:if
test="onItemSelect">
-
itemSelectCallback = <xsl:value-of select="onItemSelect"/>;
- </xsl:if>
-
- var
onClearSelectionCallback = false;
- <xsl:if
test="onClearSelection">
-
onClearSelectionCallback = <xsl:value-of select="onClearSelection"/>;
- </xsl:if>
-
- var requestGenerator =
false;
- <xsl:if
test="requestGenerator">
-
requestGenerator = <xsl:value-of select="requestGenerator"/>;
- </xsl:if>
-
- <![CDATA[
- var oAC =
YAHOO.portico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&',
-
'filter_'+name+'_name', 'filter_'+name+'_id', 'filter_'+name+'_container');
-
- if (requestGenerator) {
-
oAC.generateRequest = requestGenerator;
- }
-
- if (itemSelectCallback)
{
-
oAC.itemSelectEvent.subscribe(itemSelectCallback);
- }
-
-
YAHOO.util.Event.addBlurListener('filter_'+name+'_name', function()
- {
- if
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "")
- {
-
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
- if
(onClearSelectionCallback) {
-
onClearSelectionCallback();
- }
- }
- });
-
-
YAHOO.portico.addPreSerializeQueryFormListener(function(form)
- {
- if
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "")
- {
-
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
- }
- });
- ]]>
- });
- </script>
- </td>
- </xsl:when>
- <xsl:when test="type = 'filter'">
- <td valign="top">
- <xsl:variable name="name"><xsl:value-of
select="name"/></xsl:variable>
-
- <select id="{$name}" name="{$name}"
onMouseout="window.status='';return true;">
- <xsl:for-each select="list">
- <xsl:variable name="id"><xsl:value-of
select="id"/></xsl:variable>
- <xsl:if test="id =
'NEW'">
- <option value="{$id}"
selected="selected">
-
<xsl:value-of select="name"/>
- </option>
- </xsl:if>
- <xsl:if test="id !=
'NEW'">
- <option value="{$id}">
-
<xsl:value-of select="name"/>
- </option>
- </xsl:if>
- </xsl:for-each>
- </select>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <td valign="top">
- <input id="innertoolbar">
- <xsl:attribute
name="type"><xsl:value-of select="phpgw:conditional(not(type), '',
type)"/></xsl:attribute>
- <xsl:attribute
name="name"><xsl:value-of select="phpgw:conditional(not(name), '',
name)"/></xsl:attribute>
- <xsl:attribute
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '',
onClick)"/></xsl:attribute>
- <xsl:attribute
name="value"><xsl:value-of select="phpgw:conditional(not(value), '',
value)"/></xsl:attribute>
- <xsl:attribute
name="href"><xsl:value-of select="phpgw:conditional(not(href), '',
href)"/></xsl:attribute>
- <xsl:attribute
name="class"><xsl:value-of select="phpgw:conditional(not(class), '',
class)"/></xsl:attribute>
- </input>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </tr>
- <xsl:if test="item/text and normalize-space(item/text)">
- <thead style="background:none">
- <tr>
- <xsl:for-each select="item">
- <td>
- <xsl:if
test="name">
- <label
style='margin:auto 0.25em'>
-
<xsl:attribute name="for"><xsl:value-of select="phpgw:conditional(not(name),
'', name)"/></xsl:attribute>
-
<xsl:value-of select="phpgw:conditional(not(text), '', text)"/>
- </label>
- </xsl:if>
- </td>
- </xsl:for-each>
- </tr>
- </thead>
- </xsl:if>
- </table>
- </div>
-</xsl:template>
-
-<xsl:template match="datatable">
- <div id="paginator"/>
- <div id="datatable-container"/>
- <xsl:call-template name="datasource-definition" />
-</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>
- ];
-
- setDataSource('<xsl:value-of select="source"/>',
YAHOO.controller.columnDefs, 'queryForm', ['building_types', 'cat_id',
'district_id', 'part-of_town_list', 'responsibility_roles_list'],
'datatable-container', '_form', '_paginator', null);
-
- </script>
-
-</xsl:template>
-<!--
-<xsl:template match="lists">
-
-<div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px solid
#243356;margin: 20px;padding: 20px;">
--->
- <!-- When control area is chosen an ajax request is executed.
The operation fetches controls from db and populates the control list below.
- The ajax opearation is handled in file ajax.js
- -->
- <!--
- <select id="control_area_list" name="control_area_list">
- <xsl:for-each select="control_area_list">
- <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>
-
- <select id="control_list" name="control_list">
- <xsl:for-each select="control_list">
- <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>
- </select>
- </div>
-
- <div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px
solid #243356;margin: 20px;padding: 20px;">
- <select id="building_types" name="building_types">
- <xsl:for-each select="building_types">
- <xsl:variable
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$building_type_id}">
- <xsl:value-of select="name"/>
- </option>
-
- </xsl:for-each>
- </select>
-
- <select id="category_types" name="category_types">
- <xsl:for-each select="category_types">
- <xsl:variable
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$category_type_id}">
- <xsl:value-of select="name"/>
- </option>
-
- </xsl:for-each>
- </select>
-
- <select id="district_list" name="district_list">
- <xsl:for-each select="district_list">
- <xsl:variable
name="district_list_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$district_list_id}">
- <xsl:value-of select="name"/>
- </option>
-
- </xsl:for-each>
- </select>
-
- <select id="part_of_town_list" name="part_of_town_list">
- <xsl:for-each select="part_of_town_list">
- <xsl:variable
name="part_of_town_list_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$part_of_town_list_id}">
- <xsl:value-of select="name"/>
- </option>
-
- </xsl:for-each>
- </select>
- <select id="responsibility_roles" name="responsibility_roles">
- <xsl:for-each select="responsibility_roles_list">
- <xsl:variable
name="responsibility_roles_list_id"><xsl:value-of select="id"/></xsl:variable>
- <option value="{$responsibility_roles_list_id}">
- <xsl:value-of select="name"/>
- </option>
-
- </xsl:for-each>
- </select>
- </div>
-</xsl:template>
--->
\ No newline at end of file
Modified:
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
2011-12-06 12:33:18 UTC (rev 8247)
+++
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -9,76 +9,117 @@
<div>Periode: <xsl:value-of select="period"/></div>
</fieldset>
- <h2>Sjekklister</h2>
+ <h2 style="float:left;">Sjekklister</h2>
+ <div style="float:left;margin-top: 30px;margin-left: 585px;"><a
class="move_cal_right" href="#"><<</a></div>
+ <div style="float:left;margin-top: 30px;margin-left: 95px;"><a
class="move_cal_left" href="#">>></a></div>
-
+ <script>
+
+ $(document).ready(function() {
+
+ $(".move_cal_left").click(function(){
+
+ $("#days_view").animate({
+ left: '-=502'
+ }, 800);
+ });
+
+
+ $(".move_cal_right").click(function(){
+
+ $("#days_view").animate({
+ left: '+=502'
+ }, 800);
+ });
+
+
+
+ });
+
+ </script>
+
+
+
<xsl:choose>
<xsl:when
test="controls_calendar_array/child::node()">
- <ul class="calendar days">
- <li class="heading">
- <div class="id">ID</div><div
class="title">Tittel</div><div class="frequency">Frekvenstype</div><div
class="frequency">Frekvensintervall</div>
- <xsl:for-each select="heading_array">
- <div><xsl:value-of
select="."/></div>
+ <ul style="clear:left;" class="calendar info">
+ <li class="heading">
+ <div class="id">ID</div>
+ <div class="title">Tittel</div>
+ <div
class="frequency">Frekvenstype</div>
+ <div
class="frequency">Frekvensintervall</div>
+ </li>
+
+ <xsl:for-each
select="controls_calendar_array">
+ <li>
+ <div class="id">
+ <xsl:value-of
select="control/id"/>
+ </div>
+ <div class="title">
+ <xsl:value-of
select="control/title"/>
+ </div>
+ <div class="frequency">
+ <xsl:value-of
select="control/repeat_type"/>
+ </div>
+ <div class="frequency">
+ <xsl:value-of
select="control/repeat_interval"/>
+ </div>
+ </li>
</xsl:for-each>
- </li>
-
- <xsl:for-each select="controls_calendar_array">
- <li>
- <div class="id">
- <xsl:value-of
select="control/id"/>
- </div>
- <div class="title">
- <xsl:value-of
select="control/title"/>
- </div>
- <div class="frequency">
- <xsl:value-of
select="control/repeat_type"/>
- </div>
- <div class="frequency">
- <xsl:value-of
select="control/repeat_interval"/>
- </div>
- <xsl:for-each
select="calendar_array">
- <div>
- <xsl:choose>
- <xsl:when
test="calendar_array/child::node() = 1">
- <xsl:value-of
select="." />
- </xsl:when>
- <xsl:otherwise>
- <div
style="position:relative;">
- <div
id="info_box" style="position:absolute;display:none;">
- </div>
-
<xsl:choose>
-
<xsl:when test="id">
-
<xsl:variable name="status"><xsl:value-of
select="status"/></xsl:variable>
-
<xsl:choose>
-
<xsl:when test="status = 1">
-
<img height="15"
src="controller/images/status_icon_light_green.png" />
+ </ul>
+
+ <div id="days_wrp">
+
+ <ul id="days_view" class="calendar
days">
+ <li>
+ <xsl:for-each
select="heading_array">
+
<div><xsl:value-of select="."/></div>
+ </xsl:for-each>
+ </li>
+ <li>
+ <xsl:for-each
select="controls_calendar_array/calendar_array">
+ <div>
+ <xsl:choose>
+
<xsl:when test="calendar_array/child::node() = 1">
+
<xsl:value-of select="." />
+
</xsl:when>
+
<xsl:otherwise>
+
<div style="position:relative;">
+
<div id="info_box" style="position:absolute;display:none;">
+
</div>
+
<xsl:choose>
+
<xsl:when test="id">
+
<xsl:variable
name="status"><xsl:value-of select="status"/></xsl:variable>
+
<xsl:choose>
+
<xsl:when test="status = 1">
+
<img height="15"
src="controller/images/status_icon_light_green.png" />
+
</xsl:when>
+
<xsl:otherwise>
+
<a class="view_check_list">
+
<xsl:attribute
name="href">
+
<xsl:text>index.php?menuaction=controller.uicheck_list.get_check_list_info</xsl:text>
+
<xsl:text>&phpgw_return_as=json</xsl:text>
+
<xsl:text>&check_list_id=</xsl:text>
+
<xsl:value-of
select="id"/>
+
</xsl:attribute>
+
<img height="15"
src="controller/images/status_icon_red.png" />
+
</a>
+
</xsl:otherwise>
+
</xsl:choose>
</xsl:when>
<xsl:otherwise>
-
<a class="view_list">
-
<xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicheck_list.get_check_list_info</xsl:text>
-
<xsl:text>&phpgw_return_as=json</xsl:text>
-
<xsl:text>&check_list_id=</xsl:text>
-
<xsl:value-of select="id"/>
-
</xsl:attribute>
-
<img height="15"
src="controller/images/status_icon_red.png" />
-
</a>
+
<img height="15"
src="controller/images/status_icon_yellow.png" />
</xsl:otherwise>
-
</xsl:choose>
-
</xsl:when>
-
<xsl:otherwise>
-
<img height="15"
src="controller/images/status_icon_yellow.png" />
-
</xsl:otherwise>
-
</xsl:choose>
-
</div>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </xsl:for-each>
- </li>
- </xsl:for-each>
- </ul>
+
</xsl:choose>
+
</div>
+
</xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </xsl:for-each>
+ </li>
+ </ul>
+ </div>
</xsl:when>
<xsl:otherwise>
<div>Ingen sjekklister for bygg i angitt
periode</div>
Modified:
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
2011-12-06 12:33:18 UTC (rev 8247)
+++
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -67,7 +67,7 @@
<img height="15"
src="controller/images/status_icon_light_green.png" />
</xsl:when>
<xsl:otherwise>
-
<a class="view_list">
+
<a class="view_check_list">
<xsl:attribute name="href">
<xsl:text>index.php?menuaction=controller.uicheck_list.get_check_list_info</xsl:text>
<xsl:text>&phpgw_return_as=json</xsl:text>
Modified:
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
2011-12-06 12:33:18 UTC (rev 8247)
+++
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -59,7 +59,7 @@
<img height="15"
src="controller/images/status_icon_light_green.png" />
</xsl:when>
<xsl:otherwise>
-
<a class="view_list">
+
<a class="view_check_list">
<xsl:attribute name="href">
<xsl:text>index.php?menuaction=controller.uicheck_list.get_check_list_info</xsl:text>
<xsl:text>&phpgw_return_as=json</xsl:text>
Copied:
branches/Version-1_0-branch/controller/templates/base/view_locations_for_control.xsl
(from rev 8247, trunk/controller/templates/base/view_locations_for_control.xsl)
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/view_locations_for_control.xsl
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/view_locations_for_control.xsl
2011-12-06 19:35:34 UTC (rev 8248)
@@ -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_locations_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
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.acl.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.acl.inc.php 2011-12-06
12:33:18 UTC (rev 8247)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.acl.inc.php 2011-12-06
19:35:34 UTC (rev 8248)
@@ -1321,6 +1321,12 @@
*/
public function get_grants($app = '', $location = '')
{
+ $grant_rights = phpgwapi_cache::session_get('phpgwapi',
"get_grants_{$app}_{$location}");
+ if ( !is_null($grant_rights) )
+ {
+ return $grant_rights; // nothing more to do
+ }
+
$grant_rights = $this->get_grants_type($app,
$location, 0);
$grant_mask = $this->get_grants_type($app,
$location, 1);
if ( is_array($grant_mask) )
@@ -1337,6 +1343,7 @@
}
}
}
+ phpgwapi_cache::session_set('phpgwapi',
"get_grants_{$app}_{$location}", $grant_rights);
return $grant_rights;
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8248] Merge 8226:8247 from trunk,
Sigurd Nes <=