[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8197] Merge 8182:8196 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8197] Merge 8182:8196 from trunk |
Date: |
Fri, 25 Nov 2011 08:10:25 +0000 |
Revision: 8197
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8197
Author: sigurdne
Date: 2011-11-25 08:10:24 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
Merge 8182:8196 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/admin/inc/class.bo_custom.inc.php
branches/Version-1_0-branch/admin/inc/class.ui_custom.inc.php
branches/Version-1_0-branch/admin/templates/base/custom.xsl
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
branches/Version-1_0-branch/controller/js/controller/ajax.js
branches/Version-1_0-branch/controller/js/yahoo/datatable.js
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
branches/Version-1_0-branch/controller/templates/base/css/base.css
branches/Version-1_0-branch/controller/templates/base/sort_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
branches/Version-1_0-branch/property/inc/export/default/Basware_X114
Added Paths:
-----------
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
branches/Version-1_0-branch/controller/templates/base/locations.xsl
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
Removed Paths:
-------------
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php
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
+
/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
Modified: branches/Version-1_0-branch/admin/inc/class.bo_custom.inc.php
===================================================================
--- branches/Version-1_0-branch/admin/inc/class.bo_custom.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/admin/inc/class.bo_custom.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -405,4 +405,35 @@
}
return $entry_list;
}
+
+ function get_attrib_group_list($app,$location, $selected)
+ {
+ $group_list = $this->read_attrib_group($app, $location,
true);
+
+ foreach($group_list as &$group)
+ {
+ if( $group['id'] == $selected )
+ {
+ $group['selected'] = true;
+ }
+ }
+ //_debug_array($group_list);die();
+ return $group_list;
+ }
+
+ function read_attrib_group($app, $location, $allrows = false)
+ {
+ if($allrows)
+ {
+ $this->allrows = $allrows;
+ }
+
+ $attrib = $this->so->find_group($app, $location,
$this->start, $this->query, $this->sort, $this->order, $this->allrows);
+
+ $this->total_records = $this->so->total_records;
+
+ return $attrib;
+ }
+
+
}
Modified: branches/Version-1_0-branch/admin/inc/class.ui_custom.inc.php
===================================================================
--- branches/Version-1_0-branch/admin/inc/class.ui_custom.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/admin/inc/class.ui_custom.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -412,7 +412,7 @@
'lang_datatype_statustext'
=> lang('Select a datatype'),
'lang_no_datatype'
=> lang('No datatype'),
'datatype_list'
=>
$this->bo->select_datatype((isset($values['column_info']['type'])?$values['column_info']['type']:'')),
-
+ 'attrib_group_list'
=> array('options' =>
$this->bo->get_attrib_group_list($this->appname,$this->location,
$values['group_id'])),
'lang_precision'
=> lang('Precision'),
'lang_precision_statustext'
=> lang('enter the record length'),
'value_precision'
=>
(isset($values['column_info']['precision'])?$values['column_info']['precision']:''),
Modified: branches/Version-1_0-branch/admin/templates/base/custom.xsl
===================================================================
--- branches/Version-1_0-branch/admin/templates/base/custom.xsl 2011-11-24
21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/admin/templates/base/custom.xsl 2011-11-25
08:10:24 UTC (rev 8197)
@@ -178,7 +178,7 @@
<!-- add attribute / edit attribute -->
- <xsl:template match="edit_attrib">
+ <xsl:template match="edit_attrib" xmlns:php="http://php.net/xsl">
<div align="left">
<table cellpadding="2" cellspacing="2" width="80%"
align="center">
@@ -277,6 +277,22 @@
</tr>
<tr>
<td valign="top">
+ <xsl:value-of
select="php:function('lang', 'group')" />
+ </td>
+ <td valign="top">
+ <select name="values[group_id]"
class="forms">
+ <xsl:attribute name="title">
+ <xsl:value-of
select="php:function('lang', 'select a group')" />
+ </xsl:attribute>
+ <option value="">
+ <xsl:value-of
select="php:function('lang', 'no group')" />
+ </option>
+ <xsl:apply-templates
select="attrib_group_list/options"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
<xsl:value-of select="lang_datatype"/>
</td>
<td valign="top">
@@ -900,3 +916,11 @@
</tr>
</table>
</xsl:template>
+ <xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected"
/>
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes"
select="name"/>
+ </option>
+ </xsl:template>
Modified:
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
===================================================================
---
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -254,7 +254,8 @@
}
public function select_external($reservation) {
-
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
if ($config->config_data['output_files'] == 'single')
{
return true;
@@ -264,6 +265,8 @@
}
public function select_internal($reservation) {
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
if ($config->config_data['output_files'] == 'single')
{
return false;
Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -29,6 +29,12 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicontrol.control_list') ),
'image' => array('property',
'location_1')
),
+ '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')
+ ),
'control_item' => array
(
'text' => lang('Control_item'),
@@ -52,6 +58,12 @@
'text' => lang('Check_list'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicheck_list.index') ),
'image' => array('property',
'location_1'),
+ ),
+ 'location_check_list' => array
+ (
+ 'text' =>
lang('Check_list_location'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uilocation_check_list.view_agg_check_lists_for_location', 'year' =>
'2011', 'month' => '10') ),
+ 'image' => array('property', 'location_1'),
)
);
}
Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -194,11 +194,65 @@
}
}
- function get_check_lists_for_location($location_code){
- $sql = "SELECT c.id as c_id, cl.id as cl_id, cl.status as
cl_status, cl.comment as cl_comment, deadline, planned_date, completed_date,
cl.location_code as cl_loc, c.* ";
+ function get_agg_check_lists_for_location( $location_code, $from_date,
$to_date ){
+
+ $sql = "SELECT c.id as c_id, title, cl.id as cl_id,
c.repeat_type, c.repeat_interval, deadline, count(ci.id) ";
+ $sql .= "FROM controller_check_list cl, controller_control c,
controller_check_item ci ";
+ $sql .= "WHERE cl.location_code = $location_code ";
+ $sql .= "AND c.repeat_type < 2 ";
+ $sql .= "AND cl.control_id = c.id ";
+ $sql .= "AND cl.id = ci.check_list_id ";
+ $sql .= "AND deadline BETWEEN $from_date AND $to_date ";
+ $sql .= "GROUP BY c.id, title, cl.id, cl.deadline,
c.repeat_type, c.repeat_interval ";
+ $sql .= "ORDER BY c.id";
+
+ $this->db->query($sql);
+
+ $control_id = 0;
+ $controls_array = array();
+ $check_list_array = array();
+ while ($this->db->next_record()) {
+
+ if( $this->db->f('c_id', true) != $control_id ){
+ if($control_id != 0){
+ $controls_array[] = array( "control" =>
$control_array, "check_list" => $check_list_array);
+ $check_list_array = array();
+ }
+
+ $control_array = array(
+
"id" => $this->unmarshal($this->db->f('c_id', true),
'int'),
+
"title" => $this->unmarshal($this->db->f('title', true),
'string'),
+
"repeat_type" => $this->unmarshal($this->db->f('repeat_type', true), 'int'),
+
"repeat_interval" => $this->unmarshal($this->db->f('repeat_interval', true),
'int')
+ );
+ }
+
+ $check_list_array[] = array(
+
"cl_id" => $this->db->f('cl_id', true),
+
"deadline" => $this->db->f('deadline', true),
+
"count" => $this->db->f('count', true)
+ );
+
+ $control_id = $this->db->f('c_id', true);
+ }
+
+ if( !empty( $control_array ) ){
+ $controls_array[] = array( "control" => $control_array,
"check_list" => $check_list_array);
+
+ return $controls_array;
+ }else {
+ return null;
+ }
+ }
+
+ function get_check_lists_for_location( $location_code, $from_date,
$to_date, $repeat_type ){
+ $sql = "SELECT c.id as c_id, cl.id as cl_id, cl.status as
cl_status, cl.comment as cl_comment, ";
+ $sql .= "deadline, planned_date, completed_date,
cl.location_code as cl_loc, c.* ";
$sql .= "FROM controller_check_list cl, controller_control c ";
$sql .= "WHERE cl.location_code = $location_code ";
+ $sql .= "AND c.repeat_type = $repeat_type ";
$sql .= "AND cl.control_id = c.id ";
+ $sql .= "AND deadline BETWEEN $from_date AND $to_date";
$sql .= "ORDER BY c.id;";
$this->db->query($sql);
Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -85,8 +85,47 @@
//return isset($result);
}
- function get_procedure_list(){}
+
+ function get_controls_by_control_area($control_area_id)
+ {
+ $results = array();
+
+ $sql = "SELECT * FROM controller_control WHERE
control_area_id=$control_area_id";
+ $this->db->query($sql);
+
+ while($this->db->next_record()) {
+ $control = new
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
+
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+
$control->set_description($this->unmarshal($this->db->f('description', true),
'boolean'));
+
$control->set_start_date($this->unmarshal($this->db->f('start_date', true),
'int'));
+
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true),
'int'));
+
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name',
true), 'string'));
+
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id',
true), 'int'));
+
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
true), 'int'));
+
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
true), 'int'));
+
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
+
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
true), 'int'));
+
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true),
'int'));
+
$control->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'int'));
+
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true),
'int'));
+
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval',
true), 'int'));
+
+ $controls_array[] = $control->toArray();
+ }
+
+ if( count( $controls_array ) > 0 ){
+ return $controls_array;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
function get_id_field_name($extended_info = false)
{
if(!$extended_info)
Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -18,12 +18,13 @@
public $public_functions = array
(
'index' => true,
- 'view_check_lists_for_control' => true,
- 'save_check_list' =>
true,
- 'view_check_list' =>
true,
- 'edit_check_list' =>
true,
- 'save_check_items' =>
true,
- 'get_check_list_info' => true
+ 'view_check_lists_for_control' => true,
+ 'save_check_list'
=> true,
+ 'view_check_list'
=> true,
+ 'edit_check_list'
=> true,
+ 'save_check_items'
=> true,
+ 'get_check_list_info' =>
true,
+ 'control_calendar_status_overview' => true
);
public function __construct()
@@ -145,7 +146,7 @@
public function view_check_list()
{
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_control_item($check_list_id);
+ $check_list =
$this->so_check_list->get_single_with_control_items($check_list_id);
$date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -170,7 +171,7 @@
public function edit_check_list()
{
$check_list_id = phpgw::get_var('check_list_id');
- $check_list =
$this->so_check_list->get_single_with_control_item($check_list_id);
+ $check_list =
$this->so_check_list->get_single_with_control_items($check_list_id);
$date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
Copied:
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
(from rev 8196, trunk/controller/inc/class.uicheck_list_for_location.inc.php)
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
(rev 0)
+++
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -0,0 +1,211 @@
+<?php
+
+ phpgw::import_class('phpgwapi.yui');
+ phpgw::import_class('controller.uicommon');
+ phpgw::import_class('controller.socontrol_area');
+
+ class controller_uicheck_list_for_location 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;
+ }
+
+ 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_location.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' => '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::render_template_xsl('datatable', $data);
+ self::render_template_xsl('locations', $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)
+ {
+ $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.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -40,7 +40,8 @@
'save_control_items' =>
true,
'view_check_list'
=> true,
'generate_check_lists_for_control' => true,
- 'view_check_lists_for_control' => true
+ 'view_check_lists_for_control' => true,
+ 'get_controls_by_control_area' => true
);
public function __construct()
@@ -610,8 +611,19 @@
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
}
+ // Returns control list info as JSON
+ public function get_controls_by_control_area()
+ {
+ $control_area_id = phpgw::get_var('control_area_id');
+
+ $controls_array =
$this->so->get_controls_by_control_area($control_area_id);
+
+ if(count($controls_array)>0)
+ return json_encode( $controls_array );
+ else
+ return null;
+ }
-
public function query()
{
$params = array(
@@ -633,7 +645,7 @@
{
$filters['responsibilities'] = $responsibility;
}
-
+
$search_for = phpgw::get_var('query');
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -312,181 +312,7 @@
self::render_template_xsl('control_item',
$data);
}
}
-
-/* public function display_control_items()
- {
- //$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"controller::control_item_list";
-
-
self::set_active_menu('controller::control_item::control_item_list');
- if(phpgw::get_var('phpgw_return_as') == 'json') {
- return $this->display_control_items_json();
- }
-
- self::add_javascript('controller', 'yahoo',
'datatable.js');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('paginator');
-
- $data = array(
- 'form' => array(
- 'toolbar' => array(
- 'item' => array(
- array(
- 'type' =>
'link',
- 'value' =>
lang('New application'),
- 'href' =>
self::link(array('menuaction' => 'controller.uicontrol_item.index'))
- ),
- array('type' =>
'filter',
- 'name' =>
'status',
- 'text' => lang('Status').':',
- 'list' => array(
- array(
- 'id' => 'none',
- 'name' => lang('Not selected')
- ),
- array(
- 'id' => 'NEW',
- 'name' => lang('NEW')
- ),
- array(
- 'id' => 'PENDING',
- 'name' => lang('PENDING')
- ),
- array(
- 'id' => 'REJECTED',
- 'name' => lang('REJECTED')
- ),
- array(
- 'id' => 'ACCEPTED',
- 'name' => lang('ACCEPTED')
- )
- )
- ),
- array('type' =>
'filter',
- 'name' =>
'control_groups',
- 'text' => lang('Control_group').':',
- 'list' =>
$this->so_control_group->get_control_group_select_array(),
- ),
- array('type' =>
'filter',
- 'name' =>
'control_areas',
- 'text' => lang('Control_area').':',
- 'list' =>
$this->so_control_area->get_control_area_select_array(),
- ),
- array('type' => 'text',
- 'text' => lang('searchfield'),
- 'name' =>
'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- array(
- 'type' =>
'link',
- 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
- 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
- ),
- ),
- ),
- ),
- 'datatable' => array(
- 'source' =>
self::link(array('menuaction' =>
'controller.uicontrol_item.display_control_items', 'phpgw_return_as' =>
'json')),
- 'field' => array(
- array(
- 'key' => 'id',
- 'label' => lang('ID'),
- 'sortable' => true,
- 'formatter' =>
'YAHOO.portico.formatLink'
- ),
- array(
- 'key' => 'title',
- 'label' =>
lang('Title'),
- 'sortable' => false
- ),
- array(
- 'key' => 'required',
- 'label' =>
lang('Required'),
- 'sortable' => true
- ),
- array(
- 'key' => 'what_to_do',
- 'label' => lang('What
to do'),
- 'sortable' => false
- ),
- array(
- 'key' => 'how_to_do',
- 'label' => lang('How to
do'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'control_group_id',
- 'label' =>
lang('control_group_id'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'control_area_id',
- 'label' =>
lang('control_area_id'),
- 'sortable' => true
- ),
- array(
- 'key' => 'link',
- 'hidden' => true
- )
- )
- ),
- );
-//_debug_array($data);
-
- self::render_template_xsl('datatable', $data);
- }
-*/
-/* public function display_control_items_json()
- {
- $params = array(
- 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
- 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
- 'query' => phpgw::get_var('query'),
- 'sort' => phpgw::get_var('sort'),
- 'dir' => phpgw::get_var('dir'),
- 'filters' => $filters
- );
-
- $user_rows_per_page = 10;
-
- // YUI variables for paging and sorting
- $start_index = phpgw::get_var('startIndex', 'int');
- $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
- $sort_field = phpgw::get_var('sort');
- if($sort_field == null)
- {
- $sort_field = 'control_item_id';
- }
- $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
- //Create an empty result set
- $records = array();
-
- //Retrieve a contract identifier and load corresponding
contract
- $control_item_id = phpgw::get_var('control_item_id');
- if(isset($control_item_id))
- {
- $control_item =
rental_socontract::get_instance()->get_single($control_item_id);
- }
-
- $result_objects =
controller_socontrol_item::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
-
- $results = array();
-
- foreach($result_objects as $control_item_obj)
- {
- $results['results'][] =
$control_item_obj->serialize();
- }
-
- array_walk($results["results"], array($this,
"_add_links"), "controller.uicontrol_item.index");
-
- return $this->yui_results($results);
- }
-*/
-
public function query()
{
$params = array(
Modified:
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -24,7 +24,8 @@
'view_check_list'
=> true,
'edit_check_list'
=> true,
'save_check_items'
=> true,
- 'view_check_lists_for_location' => true
+ 'view_check_lists_for_location' => true,
+ 'view_agg_check_lists_for_location' => true
);
public function __construct()
@@ -41,47 +42,96 @@
self::set_active_menu('controller::location_check_list');
}
-
- public function view_check_lists_for_location()
+
+ public function view_agg_check_lists_for_location()
{
$control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
+ $location_code = phpgw::get_var('location_code');
+ $year = phpgw::get_var('year');
+ $month = phpgw::get_var('month');
- $view = "VIEW_YEAR";
+ if( empty($month) ){
+ $year = intval($year);
- $location_code = "1101";
+ $from_date = strtotime("01/01/$year");
+ $to_year = $year + 1;
+ $to_date = strtotime("01/01/$to_year");
+ }
+ else{
+ $year = intval($year);
+ $from_month = intval($month);
+
+ $from_date = strtotime("$from_month/01/$year");
+ $to_month = $from_month + 1;
+ $to_date = strtotime("$to_month/01/$year+1");
+ }
- // Gets an array of controls that contains check_lists
for the specified location
- $control_array =
$this->so->get_check_lists_for_location( $location_code );
+ $control = $this->so_control->get_single($control_id);
+
+ if(empty($location_code)){
+ $location_code = "1101";
+ }
- $controls_calendar_array = $this->build_calendar_array(
$control_array );
-
- $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ if( empty($month) )
+ {
+ // Gets an array of controls that contains
check_lists for the specified location
+ $controls_array =
$this->so->get_agg_check_lists_for_location( $location_code, $from_date,
$to_date );
+ $controls_calendar_array =
$this->build_agg_calendar_array( $controls_array );
- $data = array
- (
- 'location_array' =>
$location_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'date_format' =>
$date_format
- );
+ $repeat_type = 2;
+ $control_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type );
+ $controls_calendar_array =
$this->build_calendar_array( $control_array, $controls_calendar_array, 12,
"view_months" );
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $heading_array = array("Jan", "Feb", "Mar",
"Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des");
+
+ $data = array
+ (
+ 'location_array' =>
$location_array,
+ 'heading_array' =>
$heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'date_format' =>
$date_format,
+ 'period'
=> $year,
+ 'year'
=> $year
+ );
+
self::render_template_xsl('view_agg_check_lists_for_location_year', $data);
+ }
+ else
+ {
+ $repeat_type = 0;
+ $control_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type);
+ $controls_calendar_array =
$this->build_calendar_array( $control_array, null, 31, "view_days" );
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ for($i=1;$i<=31;$i++){
+ $heading_array[$i] = "$i";
+ }
+
+ $data = array
+ (
+
+ 'location_array' =>
$location_array,
+ 'heading_array' =>
$heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'date_format' =>
$date_format,
+ 'period'
=> $month,
+ 'year'
=> $year
+ );
+
self::render_template_xsl('view_agg_check_lists_for_location_month', $data);
+ }
self::add_javascript('controller', 'controller',
'jquery.js');
self::add_javascript('controller', 'controller',
'ajax.js');
-
self::render_template_xsl('view_check_lists_for_location', $data);
}
- // Function receives array with control objects that each
contain check_lists for a certain period
- public function build_calendar_array( $control_array ){
-
- $calendar_array = array();
-
+ public function build_calendar_array( $control_array,
$controls_calendar_array, $num, $period_type ){
+
foreach($control_array as $control){
-
- $start_date = $control->get_start_date();
- $end_date = $control->get_end_date();
-
+
// Initialises twelve_months_array
- for($i=0;$i<12;$i++){
+ for($i=1;$i<=$num;$i++){
$calendar_array[$i] = null;
}
@@ -91,21 +141,87 @@
$check_list_status_info = new
check_list_status_info();
$check_list_status_info->set_id($check_list->get_id());
$check_list_status_info->set_status_text($check_list->get_status());
+
if($check_list->get_status() == 'Ikke
utført'){
$check_list_status_info->set_status(0);
}
$check_list_status_info->set_deadline(
date("d/m-Y", $check_list->get_deadline()) );
-
- $calendar_array[ date("m",
$check_list->get_deadline()) - 1 ] = $check_list_status_info->serialize();
+ if($period_type == "view_months")
+ {
+ $calendar_array[ date("n",
$check_list->get_deadline()) ] = $check_list_status_info->serialize();
+ }
+ else{
+ $calendar_array[ date("j",
$check_list->get_deadline()) ] = $check_list_status_info->serialize();
+ }
}
- $control_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $calendar_array);
+ $controls_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $calendar_array);
}
+ return $controls_calendar_array;
+ }
+
+ // Function receives array with control objects that each
contain check_lists for a certain period
+ public function build_agg_calendar_array( $controls_array ){
+
+ $calendar_array = array();
+
+ foreach($controls_array as $control_array){
+
+ $control_info = $control_array['control'];
+ $check_list_array =
$control_array['check_list'];
+
+ $control_id = $control_info['id'];
+
+ // Initialises twelve_months_array
+ for($i=0;$i<12;$i++){
+ $calendar_array[$i] = null;
+ }
+
+ // Inserts check_list object on deadline month
in twelve_months_array
+ foreach($check_list_array as $check_list){
+ $calendar_array[ date("m",
$check_list['deadline']) - 1 ] += $check_list['count'];
+ }
+
+ $control_calendar_array[] = array("control" =>
$control_info, "calendar_array" => $calendar_array);
+ }
+
return $control_calendar_array;
}
+
+ public function view_check_lists_for_location()
+ {
+ $control_id = phpgw::get_var('control_id');
+ $control = $this->so_control->get_single($control_id);
+
+ $location_code = "1101";
+
+ $from_date = strtotime("01/01/2011");
+ $num_days_in_dec = cal_days_in_month(CAL_GREGORIAN, 12,
2011);
+ $to_date = strtotime("12/$num_days_in_dec/2011");
+
+ // Gets an array of controls that contains check_lists
for the specified location
+ $control_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date );
+
+ $controls_calendar_array = $this->build_calendar_array(
$control_array, $from_date, $to_date );
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+
+ $data = array
+ (
+ 'location_array' =>
$location_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'date_format' =>
$date_format,
+ 'from_date' => $from_date,
+ 'to_date' =>
$to_date
+ );
+
+ self::add_javascript('controller', 'controller',
'jquery.js');
+ self::add_javascript('controller', 'controller',
'ajax.js');
+
self::render_template_xsl('view_check_lists_for_location', $data);
+ }
public function view_check_lists_for_control()
{
Deleted:
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -1,983 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage location
- * @version $Id: class.uilocation.inc.php 7895 2011-10-19 06:58:43Z
sigurdne $
- */
-
- /**
- * Description
- * @package property
- */
- phpgw::import_class('phpgwapi.yui');
-
- class controller_uicheck_list_for_location 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;
-
- var $public_functions = array
- (
- 'index' => true,
- );
-
- function __construct()
- {
- $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; //
menus added where needed via bocommon::get_menu
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::location';
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject('property.bolocation',true);
- $this->bocommon = &
$this->bo->bocommon;
- $this->soadmin_location =
CreateObject('property.soadmin_location');
- $this->acl = &
$GLOBALS['phpgw']->acl;
-
- $this->type_id =
$this->bo->type_id;
-
- $this->acl_location =
$this->bo->acl_location;
- $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
- $this->acl_add =
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
- $this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
- $this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
-
- $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;
- }
-
- function index()
- {
-
- $type_id = $this->type_id;
- // $lookup use for pop-up
- $lookup = $this->lookup;
- // $lookup_name use in pop-up option "project"
- $lookup_name = phpgw::get_var('lookup_name');
- // use in option menu TENANT
- $lookup_tenant = phpgw::get_var('lookup_tenant',
'bool');
- $block_query = phpgw::get_var('block_query', 'bool');
- $dry_run=false;
-
- if(!$type_id)
- {
- $type_id = 1;
- }
- if($lookup)
- {
- $GLOBALS['phpgw_info']['flags']['noframework']
= true;
- }
-
- if ( $type_id && !$lookup_tenant )
- {
-
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
- }
- else
- {
-
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
- }
-
- if (!$this->acl_read)
- {
- $this->bocommon->no_access();
- return;
- }
-
- $second_display = phpgw::get_var('second_display',
'bool');
- $default_district =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
-
- if ($default_district && !$second_display &&
!$this->district_id)
- {
- $this->bo->district_id = $default_district;
- $this->district_id =
$default_district;
- }
-
- $datatable = array();
- $values_combo_box = array();
-
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
- $custom_config =
CreateObject('admin.soconfig',$location_id);
- $_config = isset($custom_config->config_data) &&
$custom_config->config_data ? $custom_config->config_data : array();
-
- $_integration_set = array();
- foreach ($_config as $_config_section =>
$_config_section_data)
- {
- $integrationurl = '';
- if(isset($_config_section_data['url']) &&
!isset($_config_section_data['tab']))
- {
-
if(isset($_config_section_data['auth_hash_name']) &&
$_config_section_data['auth_hash_name'] &&
isset($_config_section_data['auth_url']) && $_config_section_data['auth_url'])
- {
- //get session key from remote
system
-
- $arguments =
array($_config_section_data['auth_hash_name'] =>
$_config_section_data['auth_hash_value']);
- $query =
http_build_query($arguments);
- $auth_url =
$_config_section_data['auth_url'];
- $request =
"{$auth_url}?{$query}";
-
- $aContext = array
- (
- 'http' => array
- (
-
'request_fulluri' => true,
- ),
- );
-
-
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
- {
-
$aContext['http']['proxy'] =
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
- }
-
- $cxContext =
stream_context_create($aContext);
- $response =
trim(file_get_contents($request, False, $cxContext));
- }
-
-
- $_config_section_data['url']
= htmlspecialchars_decode($_config_section_data['url']);
- $_config_section_data['parametres']=
htmlspecialchars_decode($_config_section_data['parametres']);
- $integration_name =
isset($_config_section_data['name']) && $_config_section_data['name'] ?
$_config_section_data['name'] : lang('integration');
-
-
parse_str($_config_section_data['parametres'], $output);
-
- foreach ($output as $_dummy =>
$_substitute)
- {
- $_keys[] = $_substitute;
- $__substitute =
trim($_substitute, '_');
- $_values[] =
$this->$__substitute;
- }
- unset($output);
-
- $_sep = '?';
- if
(stripos($_config_section_data['url'],'?'))
- {
- $_sep = '&';
- }
- $_param = str_replace($_keys, $_values,
$_config_section_data['parametres']);
-
- $integrationurl =
"{$_config_section_data['url']}{$_sep}{$_param}";
- $integrationurl .=
"&{$_config_section_data['auth_key_name']}={$response}";
-
- $_config_section_data['location_data']=
htmlspecialchars_decode($_config_section_data['location_data']);
-
- $parameters_integration = array();
-
if($_config_section_data['location_data'])
- {
-
parse_str($_config_section_data['location_data'], $output);
-
- foreach ($output as $_name =>
$_substitute)
- {
- if($_substitute ==
'__loc1__') // This one is a link...
- {
- $_substitute =
'__location_code__';
- }
-
-
$parameters_integration['parameter'][] = array
- (
- 'name'
=> $_name,
- 'source'
=> trim($_substitute, '_'),
- );
- }
- }
-
- $_integration_set[] = array
- (
- 'name' =>
$integration_name,
- 'parameters' =>
$parameters_integration,
- 'url' =>
$integrationurl
- );
- }
- }
-
- if( phpgw::get_var('phpgw_return_as') != 'json' )
- {
- if(!$lookup)
- {
- $datatable['menu']
= $this->bocommon->get_menu();
- }
-
- $datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
- (
- 'menuaction'
=> 'property.uilocation.index',
- 'type_id'
=> $type_id,
- 'query'
=> $this->query,
- 'district_id' =>
$this->district_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'lookup'
=> $lookup,
- 'lookup_tenant' =>
$lookup_tenant,
- 'lookup_name' =>
$lookup_name,
- 'cat_id'
=> $this->cat_id,
- 'status'
=> $this->status,
- 'location_code'
=> $this->location_code
- ));
- $datatable['config']['allow_allrows'] = true;
-
- $datatable['config']['base_java_url'] =
"menuaction:'property.uilocation.index',"
- ."type_id:'{$type_id}',"
- ."query:'{$this->query}',"
- ."district_id: '{$this->district_id}',"
-
."part_of_town_id:'{$this->part_of_town_id}',"
- ."lookup:'{$lookup}',"
- ."second_display:1,"
- ."lookup_tenant:'{$lookup_tenant}',"
- ."lookup_name:'{$lookup_name}',"
- ."cat_id:'{$this->cat_id}',"
- ."status:'{$this->status}',"
-
."location_code:'{$this->location_code}',"
- ."block_query:'{$block_query}'";
-
- // $values_combo_box se usar� para escribir en
el HTML, usando el XSLT
- $values_combo_box[0] =
$this->bocommon->select_category_list(array
- ('format'=>'filter',
- 'selected' => $this->cat_id,
- 'type' =>'location',
- 'type_id' =>$type_id,
- 'order'=>'descr')
- );
- $default_value = array
('id'=>'','name'=>lang('no category'));
- array_unshift
($values_combo_box[0],$default_value);
-
- $values_combo_box[1] =
$this->bocommon->select_district_list('filter',$this->district_id);
- $default_value = array
('id'=>'','name'=>lang('no district'));
- array_unshift
($values_combo_box[1],$default_value);
-
- $values_combo_box[2] =
$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
($values_combo_box[2],$default_value);
-
-
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
&&
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] ==
'owner')
- {
- $values_combo_box[3] =
$this->bo->get_owner_list('filter', $this->filter);
- }
- else
- {
- $values_combo_box[3] =
$this->bo->get_owner_type_list('filter', $this->filter);
- }
- $default_value = array
('id'=>'','name'=>lang('show all'));
- array_unshift
($values_combo_box[3],$default_value);
-
- $datatable['actions']['form'] = array
- (
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
- array
- (
- 'menuaction'
=> 'property.uilocation.index',
- 'type_id'
=> $type_id,
- 'district_id'
=> $this->district_id,
-
'part_of_town_id' => $this->part_of_town_id,
- 'lookup'
=> $lookup,
- 'lookup_tenant'
=> $lookup_tenant,
- 'lookup_name'
=> $lookup_name,
- 'cat_id'
=> $this->cat_id,
- )
- ),
- 'fields' => array
- (
- 'field' => array
- (
- array
- ( //boton
CATEGORY
- 'id' =>
'btn_cat_id',
- 'name'
=> 'cat_id',
- 'value'
=> lang('Category'),
- 'type'
=> 'button',
- 'style'
=> 'filter',
-
'tab_index' => 1
- ),
- array
- ( //boton
DISTINT
- 'id' =>
'btn_district_id',
- 'name'
=> 'district_id',
- 'value'
=> lang('District'),
- 'type'
=> 'button',
- 'style'
=> 'filter',
-
'tab_index' => 2
- ),
- array
- ( //boton
PART OF TOWN
- 'id' =>
'btn_part_of_town_id',
- 'name'
=> 'part_of_town_id',
- 'value'
=> lang('Part of Town'),
- 'type'
=> 'button',
- 'style'
=> 'filter',
-
'tab_index' => 3
- ),
- array
- ( //boton
FILTER
- 'id' =>
'btn_owner_id',
- 'name'
=> 'owner_id',
- 'value'
=> lang('Filter'),
- 'type'
=> 'button',
- 'style'
=> 'filter',
-
'tab_index' => 4
- ),
- //for link
"columns", next to Export button
- array
- (
- 'type'
=> 'link',
- 'id' =>
'btn_columns',
- 'url'
=> "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
- array
- (
-
'menuaction' => 'property.uilocation.columns',
-
'type_id' => $type_id,
-
'lookup' => $this->lookup
-
))."','','width=300,height=600,scrollbars=1')",
- 'value'
=> lang('columns'),
-
'tab_index' => 9
- ),
- array
- (
- 'type'
=> 'button',
- 'id'
=> 'btn_export',
- 'value'
=> lang('download'),
-
'tab_index' => 8
- ),
- array
- ( //hidden
type_id
- 'type'
=> 'hidden',
- 'id'
=> 'type_id',
- 'value'
=> $type_id
- )
- ),
- 'hidden_value' => array
- (
- array
- ( //div values
combo_box_0
- 'id' =>
'values_combo_box_0',
- 'value'
=> $this->bocommon->select2String($values_combo_box[0]) //i.e.
id,value/id,vale/
- ),
- array
- ( //div values
combo_box_1
- 'id' =>
'values_combo_box_1',
- 'value'
=> $this->bocommon->select2String($values_combo_box[1])
- ),
- array
- ( //div values
combo_box_2
- 'id' =>
'values_combo_box_2',
- 'value'
=> $this->bocommon->select2String($values_combo_box[2])
- ),
- array
- ( //div values
combo_box_3
- 'id' =>
'values_combo_box_3',
- 'value'
=> $this->bocommon->select2String($values_combo_box[3])
- )
- )
- )
- )
- );
-
- $button_def[] = "oNormalButton_0";
- $button_def[] = "oNormalButton_1";
- $button_def[] = "oNormalButton_2";
- $code_inner[] = "{order:0,
name:'btn_search',funct:'onSearchClick'}";
- $code_inner[] = "{order:1, name:'btn_new',
funct:'onNewClick'}";
- $code_inner[] = "{order:2,
name:'btn_export',funct:'onDownloadClick'}";
- $_js_functions = '';
-
- foreach ($_integration_set as $i =>
$_integration)
- {
-
- $button_def[] = 'oNormalButton_' . ($i
+ 3);
- $code_inner[] = "{order:" . ($i + 3)
.", name:'btn_integration_{$i}',funct:'onIntegrationClick_{$i}'}";
-
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'type' => 'button',
- 'id' =>
"btn_integration_{$i}",
- 'value' =>
$_integration['name'],
- 'tab_index' => 10 + $i
- );
-
- $_js_functions .= <<<JS
- this.onIntegrationClick_{$i} =
function()
- {
-
window.open(values_ds.integrationurl_{$i},'window');
- }
-JS;
- }
-
- $code = 'var ' . implode(',', $button_def) .
";\n";
- $code .= 'var normalButtons = [' . "\n" .
implode(",\n",$code_inner) . "\n];";
- $code .= $_js_functions;
-
- $GLOBALS['phpgw']->js->add_code('', $code);
-
- if(!$block_query)
- {
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'id' => 'btn_search',
- 'name' => 'search',
- 'value' =>
lang('search'),
- 'type' => 'button',
- 'tab_index' => 6
- );
-
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'name' => 'query',
- 'id' => 'txt_query',
- 'value' =>
$this->query,//'',//$query,
- 'type' => 'text',
- 'size' => 28,
- 'onkeypress' => 'return
pulsar(event)',
- 'tab_index' => 5
- );
- }
-
- if(!$lookup)
- {
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'type' => 'button',
- 'id' => 'btn_new',
- 'value' => lang('add'),
- 'tab_index' => 7
- );
- }
-
- $dry_run=true;
-
- }
-
- $location_list = array();
- //cramirez: $dry_run avoid to load all data the first
time
- $location_list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
=>$dry_run));
-
- $uicols = $this->bo->uicols;
-
- $content = array();
- $j=0;
- if (isset($location_list) && is_array($location_list))
- {
- foreach($location_list as $location)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
if(isset($location['query_location'][$uicols['name'][$i]]))
- {
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['rows']['row'][$j]['column'][$i]['statustext'] =
lang('search');
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$location[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['format'] =
'link';
-
$datatable['rows']['row'][$j]['column'][$i]['java_link'] = true;
-
$datatable['rows']['row'][$j]['column'][$i]['link']
= $location['query_location'][$uicols['name'][$i]];
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$location[$uicols['name'][$i]];
-
//$datatable['rows']['row'][$j]['column'][$i]['value'] = $i;
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['rows']['row'][$j]['column'][$i]['lookup'] =
$lookup;
-
$datatable['rows']['row'][$j]['column'][$i]['align'] =
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
-
-
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) &&
$uicols['datatype'][$i]=='link' && $location[$uicols['name'][$i]])
- {
-
$datatable['rows']['row'][$j]['column'][$i]['format'] =
'link';
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = lang('link');
-
$datatable['rows']['row'][$j]['column'][$i]['link'] =
$location[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
- }
- }
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$location[$uicols['name'][$i]];
- }
-
-
$datatable['rows']['row'][$j]['hidden'][$i]['value'] =
$location[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['hidden'][$i]['name'] =
$uicols['name'][$i];
- }
-
- $j++;
- }
- }
- // NO pop-up
- $datatable['rowactions']['action'] = array();
- if(!$lookup)
- {
- $parameters = array
- (
- 'parameter' => array
- (
- array
- (
- 'name'
=> 'location_code',
- 'source'
=> 'location_code'
- ),
- )
- );
-
- $parameters2 = array
- (
- 'parameter' => array
- (
- array
- (
- 'name'
=> 'sibling',
- 'source'
=> 'location_code'
- ),
- )
- );
-
- $parameters3 = array
- (
- 'parameter' => array
- (
- array
- (
- 'name'
=> 'search_for',
- 'source'
=> 'location_code'
- ),
- )
- );
-
- if($this->acl->check('run', PHPGW_ACL_READ,
'rental'))
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'view',
- 'text'
=> lang('contracts'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'rental.uicontract.index',
- 'search_type'
=> 'location_id',
-
'contract_status' => 'all',
- 'populate_form'
=> 'yes'
- )),
- 'parameters' =>
$parameters3
- );
-
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'view',
- 'text'
=> lang('composites'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'rental.uicomposite.index',
- 'search_type'
=> 'location_id',
- 'populate_form'
=> 'yes'
- )),
- 'parameters' =>
$parameters3
- );
- }
-
-
-
- if($this->acl_read)
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'view',
- 'text'
=> lang('view'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.view',
- 'lookup_tenant'
=> $lookup_tenant
- )),
- 'parameters' =>
$parameters
- );
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'view',
- 'text'
=> lang('open view in new window'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.view',
- 'lookup_tenant'
=> $lookup_tenant,
- 'target'
=> '_blank'
- )),
- 'parameters' =>
$parameters
- );
- }
- if($this->acl_add)
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'edit',
- 'text'
=> lang('add'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.edit',
- 'lookup_tenant'
=> $lookup_tenant
- )),
- 'parameters' =>
$parameters2
- );
- }
- if($this->acl_edit)
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'edit',
- 'text'
=> lang('edit'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.edit',
- 'lookup_tenant'
=> $lookup_tenant
- )),
- 'parameters' =>
$parameters
- );
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'edit',
- 'text'
=> lang('open edit in new window'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.edit',
- 'lookup_tenant'
=> $lookup_tenant,
- 'target'
=> '_blank'
- )),
- 'parameters' =>
$parameters
- );
-
- }
- $jasper = execMethod('property.sojasper.read',
array('location_id' => $GLOBALS['phpgw']->locations->get_id('property',
$this->acl_location)));
-
- foreach ($jasper as $report)
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'edit',
- 'text'
=> lang('open JasperReport %1 in new window', $report['title']),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uijasper.view',
- 'jasper_id'
=> $report['id'],
- 'target'
=> '_blank'
- )),
- 'parameters'
=> $parameters
- );
- }
-
- foreach ($_integration_set as $_integration )
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name' =>
'integration',
- 'text' =>
$_integration['name'],
- 'action' =>
$_integration['url'].'&target=_blank',
- 'parameters' =>
$_integration['parameters']
- );
- }
-
- if($this->acl_delete)
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'delete',
- 'text'
=> lang('delete'),
- 'confirm_msg' =>
lang('do you really want to delete this entry'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.delete',
- 'lookup_tenant'
=> $lookup_tenant
- )),
- 'parameters' =>
$parameters
- );
- }
- if($this->acl_add)
- {
- $datatable['rowactions']['action'][] =
array
- (
- 'my_name'
=> 'add',
- 'text'
=> lang('add'),
- 'action'
=> $GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction'
=> 'property.uilocation.edit',
- 'type_id'
=> $type_id,
- 'parent'
=> $this->location_code
- ))
- );
- }
-
- unset($parameters);
- }
- //$uicols_count indicates the number of columns to
display in actuall option-menu. this variable was set in $this->bo->read()
- $uicols_count = count($uicols['descr']);
-
- for ($i=0;$i<$uicols_count;$i++)
- {
- //all colums should be have formatter
-
$datatable['headers']['header'][$i]['formatter'] =
!isset($uicols['formatter'][$i]) || !$uicols['formatter'][$i] ? '""' :
$uicols['formatter'][$i];
-
- if($uicols['input_type'][$i]!='hidden')
- {
-
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = true;
-
$datatable['headers']['header'][$i]['format'] =
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
-
$datatable['headers']['header'][$i]['sortable'] = false;
-
//$datatable['headers']['header'][$i]['formatter'] =
(isset($uicols['formatter'][$i])? $uicols['formatter'][$i]:"");
- if($uicols['name'][$i]=='loc1')
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = 'fm_location1.loc1';
- }
- else
if($uicols['name'][$i]=='street_name')
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = 'street_name';
- }
- else
if(isset($uicols['cols_return_extra'][$i]) &&
($uicols['cols_return_extra'][$i]!='T' ||
$uicols['cols_return_extra'][$i]!='CH'))
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] = $uicols['name'][$i];
- }
- }
- else
- {
-
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = false;
-
$datatable['headers']['header'][$i]['sortable'] = false;
-
$datatable['headers']['header'][$i]['format'] = 'hidden';
- }
- }
- // for POP-UPs
- if($lookup)
- {
- $input_name =
$GLOBALS['phpgw']->session->appsession('lookup_fields','property');
-
- $function_exchange_values = '';
-
- if(is_array($input_name))
- {
- for ($k=0;$k<count($input_name);$k++)
- {
- $function_exchange_values .=
"opener.document.forms[0]." . $input_name[$k] . ".value = '';" ."\r\n";
- }
- }
-
- /* for ($i=0;$i<count($uicols['name']);$i++)
- {
- if(isset($uicols['exchange'][$i]) &&
$uicols['exchange'][$i])
- {
- $function_exchange_values .=
'opener.document.getElementsByName("'.$uicols['name'][$i].'")[0].value = "";'
."\r\n";
- }
- }
- */
- for ($i=0;$i<count($uicols['name']);$i++)
- {
- if(isset($uicols['exchange'][$i]) &&
$uicols['exchange'][$i])
- {
- $function_exchange_values .=
'opener.document.getElementsByName("'.$uicols['name'][$i].'")[0].value = "";'
."\r\n";
- $function_exchange_values .=
'opener.document.getElementsByName("'.$uicols['name'][$i].'")[0].value =
valida(data.getData("'.$uicols['name'][$i].'"));' ."\r\n";
- //$function_exchange_values .=
'opener.document.forms[0].' . $uicols['name'][$i] .'.value =
valida(data.getData("'.$uicols['name'][$i].'"));' ."\r\n";
- }
- }
-
- $function_exchange_values .='window.close()';
-
- $datatable['exchange_values'] =
$function_exchange_values;
-
- $function_valida = "var pos =
data.indexOf('</a>');"."\r\n";
- $function_valida .= "if(pos==-1){"."\r\n";
- $function_valida .= "return data;"."\r\n";
- $function_valida .= "}else{"."\r\n";
- $function_valida .= "pos =
data.indexOf('>');"."\r\n";
- $function_valida .= "var valor =
data.slice(pos+1);"."\r\n";
- $function_valida .= "pos =
valor.indexOf('<');"."\r\n";
- $function_valida .= "valor =
valor.slice(0,pos);"."\r\n";
- $function_valida .= "return valor;"."\r\n";
- $function_valida .= "}"."\r\n";
-
- $datatable['valida'] = $function_valida;
- }
-
- // path for property.js
- $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
-
- // Pagination and sort values
- $datatable['pagination']['records_start'] =
(int)$this->bo->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-
- if($dry_run)
- {
- $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $datatable['pagination']['records_returned']=
count($location_list);
- }
-
- $datatable['pagination']['records_total'] =
$this->bo->total_records;
-
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
- {
- $datatable['sorting']['order']
= 'loc1'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'asc'; // ASC / DESC
- }
- else
- {
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
- }
-
- $appname = lang('location');
-
- if($lookup)
- {
- $lookup_list =
$GLOBALS['phpgw']->session->appsession('lookup_name','property');
- $function_msg = $lookup_list[$lookup_name];
- }
- else
- {
- if($lookup_tenant)
- {
- $function_msg = lang('Tenant');
- }
- else
- {
- $function_msg
= $uicols['descr'][($type_id)];
- }
- }
-
-
- //-- BEGIN----------------------------- JSON CODE
------------------------------
-
- //values for Pagination
- $json = array
- (
- 'recordsReturned' =>
$datatable['pagination']['records_returned'],
- 'totalRecords' =>
(int)$datatable['pagination']['records_total'],
- 'startIndex' =>
$datatable['pagination']['records_start'],
- 'sort' =>
$datatable['sorting']['order'],
- 'dir' =>
$datatable['sorting']['sort'],
- 'records' =>
array()
- );
-
- foreach ($_integration_set as $i =>
$_integration)
- {
- $json["integrationurl_{$i}"] =
$_integration['url'];
- }
-
- // values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
- foreach( $datatable['rows']['row'] as $row )
- {
- $json_row = array();
- foreach( $row['column'] as $column)
- {
- if(isset($column['format']) &&
$column['format']== "link" && isset($column['java_link']) &&
$column['java_link']==true)
- {
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
- }
- else
if(isset($column['format']) && $column['format']== "link")
- {
-
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>"
.$column['value']."</a>";
- }
- else
- {
-
$json_row[$column['name']] = $column['value'];
- }
- }
- $json['records'][] = $json_row;
- }
- }
-
- // values for control select
- //address@hidden 10/09/08 values passed for update
select in YUI
- $opt_cb_depend =
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
- $default_value = array ('id'=>'','name'=>'!no part of
town');
- array_unshift ($opt_cb_depend,$default_value);
-
- $json['hidden']['dependent'][] = array ( 'id' =>
$this->part_of_town_id,
- 'value' =>
$this->bocommon->select2String($opt_cb_depend)
- );
-
- // right in datatable
- if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
- {
- $json ['rights'] =
$datatable['rowactions']['action'];
- }
-
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- return $json;
- }
-
-
- $datatable['json_data'] = json_encode($json);
- //-------------------- JSON CODE ----------------------
-
- // Prepare template variables and process XSLT
- $template_vars = array();
- $template_vars['datatable'] = $datatable;
-
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
$template_vars);
-
- phpgwapi_yui::load_widget('dragdrop');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('menu');
- phpgwapi_yui::load_widget('connection');
- //// cramirez: necesary for include a partucular js
- phpgwapi_yui::load_widget('loader');
- //cramirez: necesary for use opener . Avoid error JS
- phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::load_widget('paginator');
- //FIXME this one is only needed when $lookup==true - so
there is probably an error
- phpgwapi_yui::load_widget('animation');
-
- if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
- {
- $GLOBALS['phpgw']->css =
createObject('phpgwapi.css');
- }
- // Prepare CSS Style
- $GLOBALS['phpgw']->css->validate_file('datatable');
- $GLOBALS['phpgw']->css->validate_file('property');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
- //Title of Page
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
- // Prepare YUI Library
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'location.index', 'property' );
-
- //$this->save_sessiondata();
- }
- }
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js
2011-11-25 08:10:24 UTC (rev 8197)
@@ -1,5 +1,38 @@
$(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
+ $("#control_area_list option").click(function () {
+ var control_area_id = $(this).val();
+
+ var requestUrl =
"index.php?menuaction=controller.uicontrol.get_controls_by_control_area&phpgw_return_as=json"
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&control_area_id=" +
control_area_id,
+ success: function(data) {
+ if( data != null){
+ var obj = jQuery.parseJSON(data);
+
+ $.each(obj, function(i) {
+ htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].title + "</option>";
+ });
+
+ $("#control_list").html( htmlString );
+ }
+ else
+ {
+ htmlString += "<option>Ingen
kontroller</option>"
+ $("#control_list").html( htmlString
);
+ }
+ }
+ });
+
+ });
+
// Control.xsl when control area is selected procedures related to
control area is fetched form db
// and procedure select list is populated
$("#control_area_id option").click(function () {
@@ -65,8 +98,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").hover(function(){
+ $("a.view_list").mouseover(function(){
var thisA = $(this);
var divWrp = $(this).parent();
var requestUrl = $(thisA).attr("href");
@@ -76,47 +110,53 @@
url: requestUrl,
dataType: 'json',
success: function(data) {
- var obj = jQuery.parseJSON(data);
- // Show info box with info about check list
- var infoBox = $(divWrp).find("#info_box");
- $(infoBox).show();
- $(infoBox).html("");
-
- if(obj.deadline == 0 ){
- var deadline_string = "Ikke satt";
- }else{
- var date = new Date(obj.deadline * 1000);
- var deadline_string = date.getDate() + "/" +
(parseInt(date.getMonth()) + 1) + "-" + date.getFullYear();
+ if(data){
+ var obj = jQuery.parseJSON(data);
+
+ // Show info box with info about check list
+ var infoBox = $(divWrp).find("#info_box");
+ $(infoBox).show();
+ $(infoBox).html("");
+
+ if(obj.deadline == 0 ){
+ var deadline_string = "Ikke satt";
+ }else{
+ var date = new Date(obj.deadline *
1000);
+ var deadline_string = date.getDate()
+ "/" + (parseInt(date.getMonth()) + 1) + "-" + date.getFullYear();
+ }
+
+ var months = ['Januar', 'Februar', 'Mars',
'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November',
'Desember'];
+
+
+ $(infoBox).html("<h5>Sjekkliste for " +
months[date.getMonth()]);
+
+ var htmlList = "<ul>" +
+
"<li><label>Frist</label><span> " + deadline_string + "</span></li>" +
+
"<li><label>Status</label><span> " + obj.status + "</span></li>" +
+
"<li><label>Kommentar</label><span>" + obj.comment + "</span></li>" +
+
"<li><label>Sjekkpunkter</label><li>";
+
+ $.each(obj.check_item_array, function(i) {
+ htmlList += "<ul><li><label>" +
(parseInt(i) + 1) + ": Tittel</label><span>" +
obj.check_item_array[i].control_item.title + "</span></li>" +
+
"<li><label>Status</label><span>" + obj.check_item_array[i].status +
"</span></li>" +
+
"<li><label>Kommentar</label><span>" + obj.check_item_array[i].comment +
"</span></li></ul>";
+ });
+
+ htmlList += "</li></ul>";
+
+ $(infoBox).append( htmlList );
}
-
- var months = ['Januar', 'Februar', 'Mars', 'April',
'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November',
'Desember'];
-
-
- $(infoBox).html("<h5>Sjekkliste for " +
months[date.getMonth()]);
-
- var htmlList = "<ul>" +
-
"<li><label>Frist</label><span> " + deadline_string + "</span></li>" +
-
"<li><label>Status</label><span> " + obj.status + "</span></li>" +
-
"<li><label>Kommentar</label><span>" + obj.comment + "</span></li>" +
-
"<li><label>Sjekkpunkter</label><li>";
-
- $.each(obj.check_item_array, function(i) {
- htmlList += "<ul><li><label>" +
(parseInt(i) + 1) + ": Tittel</label><span>" +
obj.check_item_array[i].control_item.title + "</span></li>" +
-
"<li><label>Status</label><span>" + obj.check_item_array[i].status +
"</span></li>" +
-
"<li><label>Kommentar</label><span>" + obj.check_item_array[i].comment +
"</span></li></ul>";
- });
-
- htmlList += "</li></ul>";
-
- $(infoBox).append( htmlList );
}
});
- },
- function(){
- // Hide info box when mouse not over status icon
- var infoBox = $(this).parent().find("#info_box");
+ });
+
+ $("a.view_list").mouseout(function(){
+ var thisA = $(this);
+ var divWrp = $(this).parent();
+ var requestUrl = $(thisA).attr("href");
+
+ var infoBox = $(divWrp).find("#info_box");
$(infoBox).hide();
-
});
-});
+});
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
(from rev 8196, trunk/controller/js/controller/controller_datatable_test.js)
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
(rev 0)
+++
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test.js
2011-11-25 08:10:24 UTC (rev 8197)
@@ -0,0 +1,516 @@
+
+
+/**
+ * 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: '<?php echo
lang("DATATABLE_MSG_EMPTY")?>',
+ MSG_ERROR: '<?php echo
lang("DATATABLE_MSG_ERROR")?>',
+ MSG_LOADING: '<?php echo
lang("DATATABLE_MSG_LOADING")?>'
+ }
+ );
+
+ //... 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;
+ }
+ }
+
+ var request =
YAHOO.util.Connect.asyncRequest(
+ 'GET',
+ record.getData().actions[
task.index ],
+ {
+ 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 +
"()");
+/*
+<?php
+ if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
> 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else {
+ $user_rows_per_page = 10;
+ }
+?>
+*/
+ // ... 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') ?>",
+ previousPageLinkLabel: "< <?php echo
lang('previous') ?>",
+ nextPageLinkLabel: "<?php echo lang('next') ?>
>",
+ lastPageLinkLabel: "<?php echo lang('last') ?>
>>",
+ template :
"{RowsPerPageDropdown}<?php echo lang('elements_pr_page')
?>.{CurrentPageReport}<br/> {FirstPageLink} {PreviousPageLink} {PageLinks}
{NextPageLink} {LastPageLink}",
+ 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
+ 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.controller.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});
+ }
Modified: branches/Version-1_0-branch/controller/js/yahoo/datatable.js
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/datatable.js
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/js/yahoo/datatable.js
2011-11-25 08:10:24 UTC (rev 8197)
@@ -96,21 +96,11 @@
//------------
myContextMenu = new YAHOO.widget.ContextMenu("mycontextmenu",
{trigger:myDataTable.getTbodyEl()});
myContextMenu.addItems(YAHOO.portico.GetMenuContext());
-
+ myContextMenu.addItem("Hei du!!");
+
myDataTable.subscribe("rowMouseoverEvent",
myDataTable.onEventHighlightRow);
myDataTable.subscribe("rowMouseoutEvent",
myDataTable.onEventUnhighlightRow);
- // myDataTable.subscribe("renderEvent", myRenderEvent);
-
- /*
- myDataTable.subscribe("rowClickEvent",function (oArgs)
-
{
-
var elTarget = oArgs.target;
-
var oRecord = this.getRecord(elTarget);
-
Exchange_values(oRecord);
-
}
- );*/
-
myContextMenu.subscribe("beforeShow",
YAHOO.portico.onContextMenuBeforeShow);
myContextMenu.subscribe("hide",
YAHOO.portico.onContextMenuHide);
//Render the ContextMenu instance to the parent container of
the DataTable
@@ -247,8 +237,7 @@
}
YAHOO.portico.onContextMenuClick = function(p_sType, p_aArgs,
p_myDataTable)
- {
-
+ {
var task = p_aArgs[1];
if(task)
{
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-11-24
21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2011-11-25
08:10:24 UTC (rev 8197)
@@ -38,6 +38,8 @@
month 12 capitalized controller no Desember
monthly controller no Månedlig
month controller no Måned
+no part of town controller no Bydel ikke valgt
+no district controller no Distrikt ikke valgt
calendar_months controller no
["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]
calendar_weekdays controller no
["Sø","Ma","Ti","On","To","Fr","Lø"]
select_date controller no Velg dato
Modified:
branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
2011-11-25 08:10:24 UTC (rev 8197)
@@ -5,7 +5,7 @@
<h2><xsl:value-of select="control_area/title"/></h2>
- <form
action="index.php?menuaction=controller.uicontrol.view_control_items"
method="post">
+ <form
action="index.php?menuaction=controller.uicontrol.save_control_groups"
method="post">
<xsl:variable name="control_area_id"><xsl:value-of
select="control_area/id"/></xsl:variable>
<input type="hidden" name="control_area_id"
value="{$control_area_id}" />
Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css
2011-11-25 08:10:24 UTC (rev 8197)
@@ -836,13 +836,23 @@
padding: 3px;
}
-ul.calendar li div.date {
+ul.calendar.days li div {
+ float: left;
+ text-align: center;
+ width: 30px;
+ padding: 3px;
+}
+
+ul.calendar li div.date, ul.calendar.days div.date {
width: 80px;
}
-ul.calendar div.title{
+ul.calendar div.title, ul.calendar.days div.title {
width: 200px;
}
+ul.calendar div.frequency, ul.calendar.days div.frequency {
+ width: 120px;
+}
#info_box {
background: none repeat scroll 0 0 #EDF5FF;
Copied: branches/Version-1_0-branch/controller/templates/base/locations.xsl
(from rev 8196, trunk/controller/templates/base/locations.xsl)
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/locations.xsl
(rev 0)
+++ branches/Version-1_0-branch/controller/templates/base/locations.xsl
2011-11-25 08:10:24 UTC (rev 8197)
@@ -0,0 +1,155 @@
+<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">
+ <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:apply-templates select="lists"/>
+ <xsl:apply-templates select="paging"/>
+ <xsl:apply-templates select="datatable"/>
+</xsl:template>
+
+<xsl:template match="lists">
+
+<div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px solid
#243356;margin: 20px;padding: 20px;">
+ <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>
+
+
+
+
+
+<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.setupDatasource = function() {
+ <xsl:if test="source">
+ YAHOO.controller.dataSourceUrl = '<xsl:value-of
select="source"/>';
+ YAHOO.controller.initialSortedBy =
false;
+ YAHOO.controller.initialFilters = false;
+ <xsl:if test="sorted_by">
+
YAHOO.controller.initialSortedBy = {key: '<xsl:value-of
select="sorted_by/key"/>', dir: '<xsl:value-of select="sorted_by/dir"/>'};
+ </xsl:if>
+ </xsl:if>
+*/
+ -->
+
+ 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, null, null, 'datatable-container', '_form',
'_paginator', null);
+
+ </script>
+
+</xsl:template>
\ No newline at end of file
Modified:
branches/Version-1_0-branch/controller/templates/base/sort_check_list.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/sort_check_list.xsl
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/controller/templates/base/sort_check_list.xsl
2011-11-25 08:10:24 UTC (rev 8197)
@@ -55,14 +55,5 @@
</li>
</xsl:for-each>
</ul>
-
- <a>
- <xsl:attribute name="href">
-
<xsl:text>index.php?menuaction=controller.uicontrol.generate_check_lists_for_control</xsl:text>
- <xsl:text>&control_id=</xsl:text>
- <xsl:value-of select="//control_id"/>
- </xsl:attribute>
- <div>Vis sjekklister</div>
- </a>
</div>
</xsl:template>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
(from rev 8196,
trunk/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
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_month.xsl
2011-11-25 08:10:24 UTC (rev 8197)
@@ -0,0 +1,88 @@
+<xsl:template match="data" name="view_check_lists"
xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format">d/m-Y</xsl:variable>
+
+<div id="main_content">
+
+ <h1>Kalenderoversikt</h1>
+ <fieldset class="check_list_details">
+ <div><xsl:value-of
select="location_array/loc1_name"/></div>
+ <div>Periode: <xsl:value-of select="period"/></div>
+ </fieldset>
+
+ <h2>Sjekklister</h2>
+
+
+ <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>
+ </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" />
+
</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>
+
</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:when>
+ <xsl:otherwise>
+ <div>Ingen sjekklister for bygg i angitt
periode</div>
+ </xsl:otherwise>
+ </xsl:choose>
+</div>
+</xsl:template>
\ No newline at end of file
Copied:
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
(from rev 8196,
trunk/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
(rev 0)
+++
branches/Version-1_0-branch/controller/templates/base/view_agg_check_lists_for_location_year.xsl
2011-11-25 08:10:24 UTC (rev 8197)
@@ -0,0 +1,100 @@
+<xsl:template match="data" name="view_check_lists"
xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format">d/m-Y</xsl:variable>
+<xsl:variable name="year"><xsl:value-of select="year"/></xsl:variable>
+
+<div id="main_content">
+
+ <h1>Kalenderoversikt</h1>
+ <fieldset class="check_list_details">
+ <div><xsl:value-of
select="location_array/loc1_name"/></div>
+ <div>Periode: <xsl:value-of select="period"/></div>
+ </fieldset>
+
+ <h2>Sjekklister</h2>
+
+ <ul class="calendar">
+ <xsl:choose>
+ <xsl:when
test="controls_calendar_array/child::node()">
+
+ <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>
+ <a>
+ <xsl:attribute
name="href">
+
<xsl:text>index.php?menuaction=controller.uilocation_check_list.view_agg_check_lists_for_location</xsl:text>
+
<xsl:text>&year=</xsl:text>
+
<xsl:value-of select="$year"/>
+
<xsl:text>&month=</xsl:text>
+
<xsl:number/>
+ </xsl:attribute>
+ <xsl:value-of
select="."/>
+ </a>
+ </div>
+ </xsl:for-each>
+ </li>
+
+ <xsl:for-each select="controls_calendar_array">
+ <xsl:variable
name="repeat_type"><xsl:value-of select="control/repeat_type"/></xsl:variable>
+ <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="$repeat_type = 0">
+ <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_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>
+
<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>
+ </xsl:when>
+ <xsl:otherwise>
+ <div>Ingen sjekklister for bygg i angitt
periode</div>
+ </xsl:otherwise>
+ </xsl:choose>
+ </ul>
+</div>
+</xsl:template>
\ No newline at end of file
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-11-24 21:50:37 UTC (rev 8196)
+++
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
2011-11-25 08:10:24 UTC (rev 8197)
@@ -5,7 +5,8 @@
<h1>Kalenderoversikt</h1>
<fieldset class="check_list_details">
- Oversikt for <xsl:value-of
select="location_array/loc1_name"/>
+ <div><xsl:value-of
select="location_array/loc1_name"/></div>
+ <div>Periode: <xsl:value-of
select="php:function('date', 'd/m-Y', number(from_date))"/> - <xsl:value-of
select="php:function('date', 'd/m-Y', number(to_date))"/></div>
</fieldset>
<h2>Sjekklister</h2>
@@ -13,6 +14,7 @@
<ul class="calendar">
<li class="heading">
<div>Id</div><div
class="title">Tittel</div><div class="date">Startdato</div><div
class="date">Sluttdato</div>
+ <div class="frequency">Frekvenstype</div><div
class="frequency">Frekvensintervall</div>
<div>Jan</div><div>Feb</div><div>Mar</div><div>Apr</div><div>Mai</div><div>Jun</div>
<div>Jul</div><div>Aug</div><div>Sep</div><div>Okt</div><div>Nov</div><div>Des</div>
</li>
@@ -39,6 +41,12 @@
</xsl:otherwise>
</xsl:choose>
</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
style="position:relative;">
<div id="info_box"
style="position:absolute;display:none;">
Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -1470,105 +1470,24 @@
* - And orders related to active (not processed) invoices.
*/
public function get_deposition()
- {
-
-
+ {
$sql = "SELECT "
-// ." fm_project.location_code as location,"
- . "fm_project.loc1 as eiendom,"
-// . "fm_workorder.address as adresse,"
-// . "fm_workorder.*,"
- . "bilagsnr,"
-// . "kidnr,"
- . "belop,"
- . "godkjentbelop,"
- . "fakturadato,"
- . "periode,"
- . "forfallsdato,"
- . "fakturanr,"
- . "spvend_code as vendor,"
-// . "dima,"
-// . "fm_ecobilag.loc1 as eiendom,"
+ . "spbudact_code as art,"
+ . "sum(belop) as belop,"
. "dimb as kostnadssted,"
-// . "mvakode,"
-// . "dimd,"
- . "saksbehandlerid,"
- . "budsjettansvarligid,"
- . "utbetalingid,"
- . "oppsynsigndato,"
- . "saksigndato,"
- . "budsjettsigndato,"
- . "utbetalingsigndato,"
- . "merknad,"
- . "kreditnota"
-// . "kostra_id,"
-// . "item_type,"
-// . "item_id"
-// . "external_ref,"
-// . "currency,"
-// . "process_log'"
+ . "currency"
. ' FROM fm_workorder'
. " {$this->join} fm_project ON
(fm_workorder.project_id = fm_project.id)"
. " {$this->join} fm_ecobilag ON (fm_workorder.id =
fm_ecobilag.pmwrkord_code)"
- . " ORDER BY periode ASC";
+ . " GROUP BY kostnadssted, art, currency ORDER BY
kostnadssted, art, currency ASC";
$this->db->query($sql,__LINE__,__FILE__);
$values = array();
while ($this->db->next_record())
{
- $orders[] = $this->db->f('id');
$values[] = $this->db->Record;
}
return $values;
-
-
-
-
-
-
-
- $this->db->query("SELECT id FROM fm_workorder_status
WHERE delivered IS NOT NULL");
- $delivered = array();
- while ($this->db->next_record())
- {
- $delivered[] = "'" . $this->db->f('id') . "'";
- }
-
- $orders = array();
- $values = array();
-
- $sql = 'SELECT fm_project.location_code as location,
fm_project.address as adresse,fm_workorder.*, bilagsnr,kidnr,belop as
invoice_amount,fakturadato,periode,forfallsdato,fakturanr,spvend_code as
vendor,'
- . ' dima, fm_ecobilag.loc1 as loc1, dimb, mvakode,
dimd, saksbehandlerid, budsjettansvarligid, utbetalingid, oppsynsigndato,
saksigndato, budsjettsigndato,'
- . ' utbetalingsigndato, merknad, kreditnota, kostra_id,
item_type, item_id, external_ref, currency, process_log'
- . ' FROM fm_workorder'
- . " {$this->join} fm_project ON
(fm_workorder.project_id = fm_project.id)"
- . " {$this->join} fm_ecobilag ON (fm_workorder.id =
fm_ecobilag.pmwrkord_code)";
- $this->db->query($sql,__LINE__,__FILE__);
-
- while ($this->db->next_record())
- {
- $orders[] = $this->db->f('id');
- $values[] = $this->db->Record;
- }
-
- if($delivered)
- {
- $sql = 'SELECT fm_project.location_code as
location, fm_project.address as adresse,fm_workorder.* FROM fm_workorder'
- . " {$this->join} fm_project ON
(fm_workorder.project_id = fm_project.id)"
- . " {$this->left_join} fm_ecobilagoverf ON
(fm_workorder.id = fm_ecobilagoverf.pmwrkord_code)"
- . ' WHERE fm_workorder.status IN(' .
implode(",", $delivered) . ')'
- . ' AND pmwrkord_code IS NULL';
- $this->db->query($sql,__LINE__,__FILE__);
-
- while ($this->db->next_record())
- {
- if(
!in_array($this->db->f('id'),$orders ) )
- {
- $values[] = $this->db->Record;
- }
- }
- }
- return $values;
}
}
Modified: branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -612,7 +612,7 @@
if(!$receipt['error'])
{
- $receipt =
$this->bo->rollback($values['conv_type'],$values['file'],$date);
+ $receipt =
$this->bo->rollback($values['conv_type'],$values['file'],$date,$values['voucher_id']);
}
}
else
Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -1642,6 +1642,7 @@
array('key' =>
'invoice_id','label'=>lang('invoice
number'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'vendor','label'=>lang('vendor'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'amount','label'=>lang('amount'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'currency','label'=>lang('currency'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budget_responsible','label'=>lang('budget
responsible'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'transfer_time','label'=>lang('transfer
time'),'sortable'=>false,'resizeable'=>true),
Modified: branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -1172,6 +1172,7 @@
}
}
+
if($id)
{
$record_history =
$this->bo->read_record_history($id);
@@ -1478,7 +1479,7 @@
'transfer_time' =>
$entry['transfer_time'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
);
}
-
+//_debug_array($content_invoice);
$datavalues[2] = array
(
'name'
=> "2",
@@ -1497,6 +1498,7 @@
array('key' =>
'invoice_id','label'=>lang('invoice
number'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'vendor','label'=>lang('vendor'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'amount','label'=>lang('amount'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'currency','label'=>lang('currency'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budget_responsible','label'=>lang('budget
responsible'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'transfer_time','label'=>lang('transfer
time'),'sortable'=>false,'resizeable'=>true),
Modified:
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
---
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
2011-11-24 21:50:37 UTC (rev 8196)
+++
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
2011-11-25 08:10:24 UTC (rev 8197)
@@ -365,7 +365,7 @@
$fakturanr = $_data['KEY'];
$fakturadato =
date($this->dateformat,strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
$forfallsdato =
date($this->dateformat,strtotime(str_replace('.', '-', $_data['MATURITY'])));
- $periode =
date('Ym',strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
+ $periode =
'';//date('Ym',strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
$belop =
$_data['AMOUNT']/100;
if( $belop < 0 )
Modified: branches/Version-1_0-branch/property/inc/export/default/Basware_X114
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Basware_X114
2011-11-24 21:50:37 UTC (rev 8196)
+++ branches/Version-1_0-branch/property/inc/export/default/Basware_X114
2011-11-25 08:10:24 UTC (rev 8197)
@@ -392,7 +392,7 @@
protected function errorhandler($batchid,$error_desr)
{
- if($this->db->Transaction)
+ if($this->db->get_transaction())
{
$this->db->transaction_abort();
}
@@ -400,7 +400,7 @@
$meld = $error_desr;
//Vis feilmelding
-// echo $meld;
+ echo $meld;
//Lagre feilmelding
$this->log_error($batchid,$error_desr);
@@ -464,7 +464,7 @@
}
else
{
- $receipt['error'][]= array('msg' => lang('Sorry
- None hits'));
+ $receipt['error'][]= array('msg' => lang('Sorry
- No hits'));
}
return $receipt;
}
@@ -476,12 +476,12 @@
$Filnavn = $fil_katalog .
"/x114_14_{$external_ref}.xml";
//Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
+ if (file_exists($Filnavn))
{
- return $Filnavn;
+ unlink($Filnavn);
}
- return False;
+ return $Filnavn;
}
protected function transfer_voucher($batchid, $voucher_id,
$download, $force_period_year = '')
@@ -490,7 +490,7 @@
//Velg ut alle hoved bilag som skal overføres
$oRsBilag = $this->get_voucher($voucher_id);
-//_debug_array($oRsBilag);die();
+
if(!isset($oRsBilag[0]['external_ref']) ||
!$oRsBilag[0]['external_ref'])
{
$oRsBilag[0]['external_ref'] = mt_rand();
@@ -570,7 +570,14 @@
$accountline = array();
- $periode = $oRsBilag[0]['periode'];
+ if($oRsBilag[0]['periode'])
+ {
+ $periode = $oRsBilag[0]['periode'];
+ }
+ else
+ {
+ $periode = date('Ym',time());
+ }
$comment = array();
foreach ($oRsBilag as $line)
@@ -649,31 +656,6 @@
$this->soXport->add_OverfBilag($oRsOverfBilag);
}
-/*
- $Resk_nr =
sprintf("%-9s",$oRsBilag[$k]['spvend_code']);// verdi: Blank., type: i4, plass:
382 - 390
- $Att_ansvarlig =
sprintf("%-6s",utf8_decode($oRsBilag[$k]['saksbehandler']));// verdi: Blank,
type: c6, plass: 424 - 429
-
- $vendor_info =
$this->get_vendor_info($oRsBilag[$k]['spvend_code']);
-
- if(!$vendor_info['org_nr'])
- {
- $message = 'mangler org_nr for
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
- $this->errorhandler($batchid,$message);
- return $message;
- }
-
- if(!$vendor_info['konto_nr'])
- {
- $message = 'mangler konto for
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
- $this->errorhandler($batchid,$message);
- return $message;
- }
-
- $Resk_navn =
sprintf("%-50s",$vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass:
430 - 479
- $Bank_Postgiro_kontonr =
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi:
konto_nr, type: c35, plass: 740 - 774
-
-*/
-
$descr = '';
if($line['merknad'])
{
@@ -705,21 +687,11 @@
'RECEIVER.FULLNAME' =>
$GLOBALS['phpgw_info']['user']['fullname'], // Batch 04 - 14
'STATUS'
=> 5,
'SUBACCOUNT' =>
$periode, //200905 Accounting period YYYYMM
- 'ALLOCATION.KEY' =>
0,//$distribution_code, //0
- 'ALLOCATION.PERIOD' => ''
//dummy
+ 'ALLOCATION.KEY' =>
$line['periodization'],//0
+ 'ALLOCATION.PERIOD' =>
$line['periodization_start'] //dummy
);
}
-
-/*
- $Dim_1 =
sprintf("%8s",$oRsOverfBilag['district_id']);// verdi: Ansvarssted, type: c8,
plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",$oRsOverfBilag['kostra_id']);// verdi: Tjeneste, type: c8,
plass: 37 - 44
- $Dim_3 =
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,6));// verdi: Objekt-bygg, type:
c8, plass: 45 - 52
- $Dim_4 = sprintf("%-8s",'');// verdi: Ressurs,
type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",$oRsOverfBilag['project_id']);// verdi: Prosjekt, type: c12,
plass: 61 - 72
- $Dim_6 =
sprintf("%-4s",$oRsOverfBilag['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
- $Dim_7 = sprintf("%-4s",'');// verdi: Blank,
type: c4, plass: 77 - 80
-*/
$invoiceheader[0]['GENERALCOMMENT'] =
implode("\n",$comment);
$invoices = array
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8197] Merge 8182:8196 from trunk,
Sigurd Nes <=