[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9625] Merge 9590:9624 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9625] Merge 9590:9624 from trunk |
Date: |
Tue, 19 Jun 2012 10:23:39 +0000 |
Revision: 9625
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9625
Author: sigurdne
Date: 2012-06-19 10:23:39 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Merge 9590:9624 from trunk
Modified Paths:
--------------
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.uicalendar.inc.php
branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_group_component.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
branches/Version-1_0-branch/controller/inc/hook_home.inc.php
branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
branches/Version-1_0-branch/controller/js/controller/ajax.js
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
branches/Version-1_0-branch/controller/js/yahoo/common.js
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/templates/base/add_component_to_control.xsl
branches/Version-1_0-branch/controller/templates/base/add_component_to_control_group.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
branches/Version-1_0-branch/controller/templates/base/component.xsl
branches/Version-1_0-branch/controller/templates/base/control/control_tabs.xsl
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
branches/Version-1_0-branch/controller/templates/base/control_group/control_group_items.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
branches/Version-1_0-branch/controller/templates/base/css/base.css
branches/Version-1_0-branch/controller/templates/base/datatable.xsl
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
branches/Version-1_0-branch/controller/templates/base/view_component_for_control.xsl
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
branches/Version-1_0-branch/phpgwapi/inc/class.jquery.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.translation.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.yui.inc.php
branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang
branches/Version-1_0-branch/phpgwapi/templates/base/yui_phpgw_i18n.xsl
branches/Version-1_0-branch/property/inc/class.boentity.inc.php
branches/Version-1_0-branch/property/inc/class.soentity.inc.php
branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
branches/Version-1_0-branch/rental/inc/class.uicommon.inc.php
Added Paths:
-----------
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component2.js
branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
Removed Paths:
-------------
branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624
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
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -118,9 +118,7 @@
$counter = 0;
$check_list = null;
-
while ($this->db->next_record()) {
-
if($counter == 0){
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'bool'));
@@ -148,7 +146,6 @@
$control_item->set_type($this->db->f('type',
true), 'string');
$check_item->set_control_item($control_item->toArray());
-
$check_items_array[] = $check_item->toArray();
}
@@ -171,15 +168,13 @@
$sql .= "WHERE cl.control_id = $control_id ";
$sql .= "AND cl.id = ci.check_list_id ";
$sql .= "ORDER BY cl.id;";
- //var_dump($sql);
+
$this->db->query($sql);
$check_list_id = 0;
$check_list = null;
- while ($this->db->next_record()) {
-
+ while ($this->db->next_record()) {
if( $this->db->f('cl_id', true) != $check_list_id ){
-
if($check_list_id != 0){
$check_list->set_check_item_array($check_items_array);
$check_list_array[] =
$check_list->toArray();
@@ -202,7 +197,6 @@
$check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
-
$check_items_array[] = $check_item->toArray();
$check_list_id = $check_list->get_id();
@@ -227,7 +221,7 @@
$sql .= "AND NOT cl.planned_date IS NULL ";
$sql .= "AND cl.completed_date IS NULL ";
$sql .= "ORDER BY cl.id;";
- //var_dump($sql);
+
$this->db->query($sql);
$check_list_id = 0;
@@ -256,7 +250,6 @@
if($check_list != null){
$check_list_array[] = $check_list;
-
return $check_list_array;
}else {
return null;
@@ -278,9 +271,51 @@
$check_list_id = 0;
$check_list = null;
while ($this->db->next_record()) {
+ if( $this->db->f('cl_id', true) != $check_list_id ){
+ if($check_list_id != 0){
+ $check_list_array[] = $check_list;
+ }
+
+ $check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'int'));
+
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
+
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
+
$check_list->set_component_id($this->unmarshal($this->db->f('component_id',
true), 'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
+
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases',
true), 'int'));
+
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases',
true), 'int'));
+ }
+ $check_list_id = $check_list->get_id();
+ }
+ if($check_list != null){
+ $check_list_array[] = $check_list;
+ return $check_list_array;
+ }else {
+ return null;
+ }
+ }
+
+ function get_open_check_lists_for_control($control_id, $location_code,
$from_date){
+ $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, ";
+ $sql .= "completed_date, component_id, location_code,
num_open_cases, num_pending_cases ";
+ $sql .= "FROM controller_check_list cl ";
+ $sql .= "WHERE cl.control_id = $control_id ";
+ $sql .= "AND cl.location_code = '{$location_code}' ";
+ $sql .= "AND (cl.planned_date IS NULL OR cl.planned_date <
$from_date) ";
+ $sql .= "AND cl.deadline < $from_date ";
+ $sql .= "AND cl.completed_date IS NULL ";
+ $sql .= "ORDER BY cl.id;";
+
+ $this->db->query($sql);
+
+ $check_list_id = 0;
+ $check_list = null;
+ while ($this->db->next_record()) {
+
if( $this->db->f('cl_id', true) != $check_list_id ){
-
if($check_list_id != 0){
$check_list_array[] = $check_list;
}
@@ -301,14 +336,15 @@
if($check_list != null){
$check_list_array[] = $check_list;
-
return $check_list_array;
}else {
return null;
}
}
- function get_agg_check_lists_for_location( $location_code,
$from_date_ts, $to_date_ts, $control_id = 0 ){
+ /*
+ * TROR IKKE VI BRUKER DENNE: TORSTEIN 18.06.2012
+ function get_agg_check_lists_for_location( $location_code,
$from_date_ts, $to_date_ts, $control_id = 0 ){
$sql = "SELECT c.id as c_id, title, start_date, end_date,
cl.id as cl_id, c.repeat_type, c.repeat_interval, cl.deadline,
count(cl.num_open_cases) ";
$sql .= "FROM controller_check_list cl, controller_control c,
controller_check_item ci ";
@@ -339,13 +375,13 @@
}
$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'),
-
"start_date" => $this->unmarshal($this->db->f('start_date', true),
'int'),
-
"end_date" => $this->unmarshal($this->db->f('end_date',
true), 'int')
- );
+
"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'),
+
"start_date"
=> $this->unmarshal($this->db->f('start_date', true), 'int'),
+
"end_date"
=> $this->unmarshal($this->db->f('end_date', true), 'int')
+
);
}
$check_list_array[] = array(
@@ -365,19 +401,20 @@
return null;
}
}
+*/
- function get_num_open_cases_for_control( $control_id, $location_code,
$from_date_ts, $to_date_ts, $component ){
+ function get_num_open_cases_for_control( $cl_criteria, $from_date_ts,
$to_date_ts ){
$sql = "SELECT c.id as c_id, sum(cl.num_open_cases) as count ";
$sql .= "FROM controller_check_list cl, controller_control c ";
- if($component)
- {
- $sql .= "WHERE cl.component_id = {$location_code} ";
+
+ if($cl_criteria->get_component_id() > 0 &&
$cl_criteria->get_location_id() > 0){
+ $sql .= "WHERE cl.component_id =
{$cl_criteria->get_component_id()} ";
+ $sql .= "AND cl.location_id =
{$cl_criteria->get_location_id()} ";
+ }else{
+ $sql .= "WHERE cl.location_code =
'{$cl_criteria->get_location_code()}' ";
}
- else
- {
- $sql .= "WHERE cl.location_code = '{$location_code}' ";
- }
+
$sql .= "AND c.id = $control_id ";
$sql .= "AND cl.control_id = c.id ";
$sql .= "AND cl.deadline >= $from_date_ts AND $to_date_ts >
cl.deadline ";
@@ -386,18 +423,18 @@
$this->db->query($sql);
if ($this->db->next_record() & $this->db->f('count', true) > 0)
{
-
- $control_array = array(
- "id"
=> $this->unmarshal($this->db->f('c_id', true), 'int'),
- "count"
=> $this->db->f('count', true)
- );
+ $control_array = array(
+ "id" =>
$this->unmarshal($this->db->f('c_id', true), 'int'),
+
"count" => $this->db->f('count', true)
+ );
}
-
return $control_array;
}
- // Fetches all controls as objects with check lists
+
+ // Fetches all controls as objects with check lists
+ /* DET SER UT TIL AT DENNE IKKE BRUKES: TORSTEIN 18.06.2012
function get_check_lists_for_location( $location_code, $from_date_ts,
$to_date_ts, $repeat_type = null, $control_id = 0 ){
$use_location_inparam = false;
$sql = "SELECT c.id as c_id, title, description, start_date,
end_date, control_area_id, c.location_code as c_location_code, repeat_type,
repeat_interval, ";
@@ -467,6 +504,7 @@
return $controls_array;
}
+ */
// Fetches control id and check lists for period and location
function get_check_lists_for_location_2( $location_code, $from_date_ts,
$to_date_ts, $repeat_type ){
@@ -526,6 +564,65 @@
return $controls_array;
}
+ function get_check_lists_for_component( $location_id, $component_id,
$from_date_ts, $to_date_ts, $repeat_type_expr = null ){
+ $sql = "SELECT c.id as c_id, ";
+ $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as
cl_comment, deadline, planned_date, completed_date, ";
+ $sql .= "cl.component_id, cl.location_id, cl.location_code as
cl_location_code, num_open_cases, num_pending_cases ";
+ $sql .= "FROM controller_control c ";
+ $sql .= "LEFT JOIN controller_check_list cl on cl.control_id =
c.id ";
+ $sql .= "WHERE cl.location_id = $location_id ";
+ $sql .= "AND cl.component_id = $component_id ";
+
+ if( $repeat_type != null )
+ $sql .= "AND c.repeat_type $repeat_type_expr ";
+
+ $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
+ $sql .= "ORDER BY c.id;";
+
+ $this->db->query($sql);
+
+ $control_id = 0;
+ $control = null;
+ $controls_array = array();
+ while ($this->db->next_record()) {
+
+ if( $this->db->f('c_id', true) != $control_id ){
+
+ if($control_id != 0){
+
$control->set_check_lists_array($check_lists_array);
+ $controls_array[] = $control;
+ }
+
+ $control = new
controller_control($this->unmarshal($this->db->f('c_id', true), 'int'));
+
+ $check_lists_array = array();
+ }
+
+ $check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'int'));
+
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
+
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
+
$check_list->set_component_id($this->unmarshal($this->db->f('component_id',
true), 'int'));
+
$check_list->set_location_id($this->unmarshal($this->db->f('location_id',
true), 'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
true), 'string'));
+
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases',
true), 'int'));
+
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases',
true), 'int'));
+
+ $check_lists_array[] = $check_list;
+
+ $control_id = $control->get_id();
+ }
+
+ if($control != null){
+ $control->set_check_lists_array($check_lists_array);
+ $controls_array[] = $control;
+ }
+
+ return $controls_array;
+ }
+
// Fetches check lists for location and control id
function get_check_lists_for_control_and_location( $control_id,
$location_code, $from_date_ts, $to_date_ts, $repeat_type = null ){
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
@@ -560,7 +657,7 @@
return array( "location_code" => $location_code,
"check_lists_array" => $check_lists_array);
}
-// Fetches check lists for component and control id
+ // Fetches check lists for component and control id
function get_check_lists_for_control_and_component( $control_id,
$component_id, $from_date_ts, $to_date_ts, $repeat_type = null ){
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
$sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases, num_pending_cases ";
@@ -602,13 +699,10 @@
$sql .= "LEFT JOIN controller_check_list cl on cl.control_id =
c.id ";
$sql .= "WHERE c.id = {$control_id} ";
$sql .= "AND NOT planned_date IS NULL ";
-// $sql .= "AND planned_date = {$current_date}";
-
-// var_dump($sql);
$this->db->query($sql);
+
$check_lists_array = array();
-
while ($this->db->next_record()) {
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
$check_list->set_control_id($control_id);
@@ -624,7 +718,7 @@
$check_lists_array[] = $check_list;
}
-// if()
+
return $check_lists_array;
}
Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,14 +28,15 @@
* @version $Id$
*/
- phpgw::import_class('controller.socommon');
+ phpgw::import_class('controller.socommon');
- include_class('controller', 'control', 'inc/model/');
- include_class('controller', 'control_location', 'inc/model/');
+ include_class('controller', 'control', 'inc/model/');
+ include_class('controller', 'component', 'inc/model/');
+ include_class('controller', 'control_location', 'inc/model/');
- class controller_socontrol extends controller_socommon
- {
- protected static $so;
+ class controller_socontrol extends controller_socommon
+ {
+ protected static $so;
/**
* Get a static reference to the storage object associated with
this model object
@@ -107,17 +108,13 @@
}else{
return 0;
}
-
- // Kommenterte denne ut midlertidig.
- //Trenger id-en når controllen blir lagret.
- //return isset($result);
}
- function get_controls_for_location($location_code, $from_date,
$to_date, $repeat_type)
+ function get_controls_for_location($location_code, $role_id,
$from_date, $to_date, $repeat_type)
{
$controls = array();
- $controls_loc =
$this->get_controls_by_location($location_code, $from_date, $to_date,
$repeat_type );
- $controls_comp =
$this->get_controls_for_components_by_location($location_code, $from_date,
$to_date, $repeat_type );
+ $controls_loc =
$this->get_controls_by_location($location_code, $from_date, $to_date,
$repeat_type, '', $role_id );
+ $controls_comp =
$this->get_controls_for_components_by_location($location_code, $from_date,
$to_date, $repeat_type, '', $role_id );
foreach($controls_loc as $cl)
{
@@ -131,22 +128,24 @@
return $controls;
}
- public function get_controls_by_location($location_code,
$from_date, $to_date, $repeat_type, $return_type = "return_object")
+ public function get_controls_by_location($location_code,
$from_date, $to_date, $repeat_type, $return_type = "return_object", $role_id =
'')
{
$controls_array = array();
- $joins .= " {$this->left_join} fm_responsibility_role
ON (c.responsibility_id = fm_responsibility_role.id)";
- $sql = "SELECT distinct c.*,
fm_responsibility_role.name AS responsibility_name FROM
controller_control_location_list cll ";
+ $sql = "SELECT distinct c.*,
fm_responsibility_role.name AS responsibility_name ";
+ $sql .= "FROM controller_control_location_list cll ";
$sql .= "LEFT JOIN controller_control c on
cll.control_id=c.id ";
$sql .= "LEFT JOIN fm_responsibility_role ON
fm_responsibility_role.id = c.responsibility_id ";
$sql .= "WHERE cll.location_code = '$location_code' ";
if( is_numeric($repeat_type) )
$sql .= "AND c.repeat_type = $repeat_type ";
+ if( is_numeric($role_id))
+ $sql .= "AND c.responsibility_id = $role_id ";
$sql .= "AND (c.start_date <= $from_date AND c.end_date
IS NULL ";
$sql .= "OR c.start_date > $from_date AND c.start_date
< $to_date)";
- //var_dump($sql."<br/>");
+
$this->db->query($sql);
while($this->db->next_record()) {
@@ -174,35 +173,34 @@
if( count( $controls_array ) > 0 ){
return $controls_array;
}
- else
- {
+ else {
return null;
}
}
- public function get_controls_by_component($location_code,
$from_date, $to_date, $repeat_type = null, $return_type = "return_object")
+ public function
get_controls_for_components_by_location($location_code, $from_date, $to_date,
$repeat_type, $return_type = "return_object", $role_id = '')
{
$controls_array = array();
- $sql = "SELECT c.id as control_id, c.*, bim_item.id,
xpath('/beskrivelse/text()', xml_representation), bim_item.location_code,
bim_item.address ";
- $sql .= "FROM controller_control_component_list cl ";
- $sql .= "JOIN fm_bim_item bim_item on cl.component_id
= bim_item.id ";
- $sql .= "JOIN fm_bim_type bim_type on cl.location_id =
bim_type.location_id ";
- $sql .= "JOIN controller_control c on cl.control_id =
c.id ";
- $sql .= "AND bim_item.type = bim_type.id ";
- $sql .= "AND bim_item.location_code LIKE
'$location_code%'";
+ $sql = "SELECT distinct c.*,
fm_responsibility_role.name AS responsibility_name ";
+ $sql .= "FROM controller_control_component_list ccl ";
+ $sql .= "LEFT JOIN controller_control c on
ccl.control_id=c.id ";
+ $sql .= "LEFT JOIN fm_responsibility_role ON
fm_responsibility_role.id = c.responsibility_id ";
+ $sql .= "LEFT JOIN fm_bim_item ON fm_bim_item.id =
ccl.component_id ";
+ $sql .= "WHERE fm_bim_item.loc1 = '$location_code' ";
- if( $repeat_type != null){
+ if( is_numeric($repeat_type) )
$sql .= "AND c.repeat_type = $repeat_type ";
- }
+ if( is_numeric($role_id))
+ $sql .= "AND c.responsibility_id = $role_id ";
$sql .= "AND (c.start_date <= $from_date AND c.end_date
IS NULL ";
- $sql .= "OR c.start_date > $from_date AND c.start_date
< $to_date)";
-
+ $sql .= "OR c.end_date > $from_date AND c.start_date <
$to_date)";
+
$this->db->query($sql);
while($this->db->next_record()) {
- $control = new
controller_control($this->unmarshal($this->db->f('control_id', true), 'int'));
+ $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'));
@@ -225,58 +223,94 @@
if( count( $controls_array ) > 0 ){
return $controls_array;
- }
- else
- {
+ }else {
return null;
}
}
- public function
get_controls_for_components_by_location($location_code, $from_date, $to_date,
$repeat_type, $return_type = "return_object")
- {
+ public function get_controls_by_component($location_code,
$from_date, $to_date, $repeat_type = null, $return_type = "return_object")
+ {
$controls_array = array();
- $sql = "SELECT distinct c.*,
fm_responsibility_role.name AS responsibility_name FROM
controller_control_component_list ccl ";
- $sql .= "LEFT JOIN controller_control c on
ccl.control_id=c.id ";
- $sql .= "LEFT JOIN fm_responsibility_role ON
fm_responsibility_role.id = c.responsibility_id ";
- $sql .= "LEFT JOIN fm_bim_item ON fm_bim_item.id =
ccl.component_id ";
- $sql .= "WHERE fm_bim_item.loc1 = '$location_code' ";
+ $sql = "SELECT c.id as control_id, c.*, ";
+ $sql .= "bim_item.type as component_type, bim_item.id
as component_id, bim_item.location_code, bim_item.address, ";
+ $sql .=
"xpath('descendant-or-self::*/beskrivelse/text()', bim_item.xml_representation)
as xml ";
+ $sql .= "FROM controller_control_component_list cl ";
+ $sql .= "JOIN fm_bim_item bim_item on cl.component_id
= bim_item.id ";
+ $sql .= "JOIN fm_bim_type bim_type on cl.location_id =
bim_type.location_id ";
+ $sql .= "JOIN controller_control c on cl.control_id =
c.id ";
+ $sql .= "AND bim_item.type = bim_type.id ";
+ $sql .= "AND bim_item.location_code LIKE
'$location_code%' ";
- if( is_numeric($repeat_type) )
+ if( $repeat_type != null){
$sql .= "AND c.repeat_type = $repeat_type ";
+ }
$sql .= "AND (c.start_date <= $from_date AND c.end_date
IS NULL ";
- $sql .= "OR c.end_date > $from_date AND c.start_date <
$to_date)";
-
+ $sql .= "OR c.start_date > $from_date AND c.start_date
< $to_date) ";
+
+ $sql .= "ORDER BY bim_item.id ";
+
$this->db->query($sql);
+ $component_id = 0;
+ $component = null;
while($this->db->next_record()) {
- $control = new
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
+ if( $this->db->f('component_id', true) !=
$component_id ){
+ if($component_id != 0){
+
$component->set_controls_array($controls_array);
+ $controls_array = array();
+
+ if($return_type ==
"return_array"){
+ $components_array[] =
$component->toArray();
+ }else{
+ $components_array[] =
$component;
+ }
+ }
+
+ $component = new controller_component();
+
$component->set_type($this->unmarshal($this->db->f('component_type', true),
'int'));
+
$component->set_id($this->unmarshal($this->db->f('component_id', true), 'int'));
+
$component->set_guid($this->unmarshal($this->db->f('guid', true), 'string'));
+
$component->set_xml($this->unmarshal($this->db->f('xml', true), 'string'));
+
$component->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
+
$component->set_loc_1($this->unmarshal($this->db->f('loc_1', true), 'string'));
+
$component->set_address($this->unmarshal($this->db->f('address', true),
'string'));
+ }
+
+ $control = new
controller_control($this->unmarshal($this->db->f('control_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_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
true), 'string'));
$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_repeat_type($this->unmarshal($this->db->f('repeat_type', true),
'int'));
-
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type',
true), 'int'));
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval',
true), 'int'));
if($return_type == "return_object")
$controls_array[] = $control;
else
$controls_array[] = $control->toArray();
+
+ $component_id = $component->get_id();
}
-
- if( count( $controls_array ) > 0 ){
- return $controls_array;
- }
- else
- {
+
+ if($component != null){
+ $component->set_controls_array($controls_array);
+
+ if($return_type == "return_array")
+ $components_array[] =
$component->toArray();
+ else
+ $components_array[] = $component;
+
+ return $components_array;
+ }else {
return null;
}
}
@@ -310,9 +344,7 @@
if( count( $controls_array ) > 0 ){
return $controls_array;
- }
- else
- {
+ }else {
return null;
}
}
@@ -335,14 +367,17 @@
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $controls_array[] = array("id" => $control_id,
"title" => $title, "location_code" => $location_code, "loc1_name" =>
$location_array["loc1_name"]);
+ $controls_array[] = array(
+
"id" =>
$control_id,
+
"title" =>
$title,
+
"location_code"
=> $location_code,
+
"loc1_name" =>
$location_array["loc1_name"]
+
);
}
if( count( $controls_array ) > 0 ){
return $controls_array;
- }
- else
- {
+ }else {
return null;
}
}
@@ -352,7 +387,7 @@
$controls_array = array();
$sql = "SELECT c.id, c.title, ccl.component_id,
bim_type.description, bim.location_code ";
- $sql .= "FROM controller_control c,
controller_control_component_list ccl, fm_bim_item bim, fm_bim_type bim_type ";
+ $sql .= "FROM controller_control c, controller_control_component_list
ccl, fm_bim_item bim, fm_bim_type bim_type ";
$sql .= "WHERE ccl.control_id = $control_id ";
$sql .= "AND ccl.control_id = c.id ";
$sql .= "AND bim.id = ccl.component_id ";
@@ -388,7 +423,10 @@
function get_control_location($control_id, $location_code)
{
$control_id = (int)$control_id;
- $sql = "SELECT * FROM controller_control_location_list
WHERE control_id = $control_id AND location_code = '$location_code'";
+ $sql = "SELECT * ";
+ $sql .= "FROM controller_control_location_list ";
+ $sql .= "WHERE control_id = $control_id ";
+ $sql .= "AND location_code = '$location_code'";
$this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
@@ -431,18 +469,26 @@
$this->db->transaction_begin();
foreach ($delete_location as $location_code)
{
- $sql = "DELETE FROM
controller_control_location_list WHERE control_id = {$control_id} AND
location_code = '{$location_code}'";
+ $sql = "DELETE FROM
controller_control_location_list ";
+ $sql .= "WHERE control_id = {$control_id} ";
+ $sql .= "AND location_code =
'{$location_code}'";
+
$this->db->query($sql);
}
foreach ($add_location as $location_code)
{
- $sql = "SELECT * FROM
controller_control_location_list WHERE control_id = {$control_id} AND
location_code = '$location_code'";
+ $sql = "SELECT * ";
+ $sql .= "FROM controller_control_location_list
";
+ $sql .= "WHERE control_id = {$control_id} ";
+ $sql .= "AND location_code = '$location_code'";
+
$this->db->query($sql, __LINE__, __FILE__);
if(!$this->db->next_record())
{
- $sql = "INSERT INTO
controller_control_location_list (control_id, location_code) VALUES (
{$control_id}, '{$location_code}')";
+ $sql = "INSERT INTO
controller_control_location_list (control_id, location_code) ";
+ $sql .= "VALUES ( {$control_id},
'{$location_code}')";
$this->db->query($sql);
}
}
@@ -455,7 +501,13 @@
$control_id = (int) $control_id;
$location_id = (int) $location_id;
$component_id = (int) $component_id;
- $sql = "SELECT * FROM
controller_control_component_list WHERE control_id = {$control_id} AND
location_id = {$location_id} AND component_id = {$component_id}";
+
+ $sql = "SELECT * ";
+ $sql .= "FROM controller_control_component_list ";
+ $sql .= "WHERE control_id = {$control_id} ";
+ $sql .= "AND location_id = {$location_id} ";
+ $sql .= "AND component_id = {$component_id}";
+
$this->db->query($sql, __LINE__, __FILE__);
return $this->db->next_record();
}
@@ -486,12 +538,19 @@
return false;
}
- $sql = "SELECT * FROM
controller_control_component_list WHERE control_id = {$control_id} AND
location_id = {$location_id} AND component_id = {$component_id}";
+ $sql = "SELECT * ";
+ $sql .= "FROM
controller_control_component_list ";
+ $sql .= "WHERE control_id =
{$control_id} ";
+ $sql .= "AND location_id =
{$location_id} ";
+ $sql .= "AND component_id =
{$component_id}";
+
$this->db->query($sql, __LINE__,
__FILE__);
if(!$this->db->next_record())
{
- $sql = "INSERT INTO
controller_control_component_list (control_id, location_id, component_id)
VALUES ( {$control_id}, {$location_id}, {$component_id})";
+ $sql = "INSERT INTO
controller_control_component_list (control_id, location_id, component_id) ";
+ $sql .= "VALUES (
{$control_id}, {$location_id}, {$component_id})";
+
$this->db->query($sql);
}
}
Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,7 +28,7 @@
* @version $Id$
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socheck_list');
include_class('controller', 'check_list', 'inc/model/');
@@ -39,7 +39,7 @@
include_class('controller', 'year_calendar', 'inc/component/');
include_class('controller', 'month_calendar', 'inc/component/');
- class controller_uicalendar extends controller_uicommon
+ class controller_uicalendar extends phpgwapi_uicommon
{
private $so;
private $so_control;
@@ -187,21 +187,23 @@
// Fetches all controls for the location within time
period
$controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type = null);
- // Fetches all controls for the components on location
within time period
- $controls_for_component_array =
$this->so_control->get_controls_by_component($location_code, $from_date_ts,
$to_date_ts, $repeat_type = null);
-
- print_r( $controls_for_component_array );
-
+ // Fetches all controls for the components for a
location within time period
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($location_code, $from_date_ts,
$to_date_ts, $repeat_type = null);
+
$controls_calendar_array = array();
- // Loops through controls with repeat type day or week
in controls_for_location_array
- // and populates array that contains aggregate open
cases pr month.
+ // Loops through controls with repeat type day or week
+ // and populates array that contains aggregated open
cases pr month.
foreach($controls_for_location_array as $control){
if($control->get_repeat_type() == 0 |
$control->get_repeat_type() == 1){
- // Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
- $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($control, $location_code, $year);
+ $cl_criteria = new
controller_check_list();
+
$cl_criteria->set_control_id($control->get_id());
+
$cl_criteria->set_location_code($location_code);
+ // Loops through controls and populates
aggregate open cases pr month array.
+ $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year);
+
$year_calendar = new
year_calendar($control, $year);
$calendar_array =
$year_calendar->build_agg_month_calendar($agg_open_cases_pr_month_array);
@@ -233,6 +235,44 @@
}
}
+ // COMPONENTS
+ foreach($components_with_controls_array as $component){
+
+ $controls_for_component_array =
$component->get_controls_array();
+ $controls_components_calendar_array = array();
+
+ foreach($controls_for_component_array as $control){
+
+ if($control->get_repeat_type() == 0 |
$control->get_repeat_type() == 1){
+ $cl_criteria = new
controller_check_list();
+ $cl_criteria->set_control_id(
$control->get_id() );
+ $cl_criteria->set_component_id(
$component->get_id() );
+ $cl_criteria->set_location_id(
$component->get_type() );
+
+ $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year);
+
+ $year_calendar = new
year_calendar($control, $year);
+ $calendar_array =
$year_calendar->build_agg_month_calendar($agg_open_cases_pr_month_array);
+
+ $controls_components_calendar_array[]
= array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ }else {
+ // Fetches control ids with check lists for
specified time period
+
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_type(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+
+ // Loops through all controls
for location and populates controls with check lists
+ $controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
+
+ $year_calendar = new
year_calendar($control, $year, $component, null, "component");
+ $calendar_array =
$year_calendar->build_calendar( $control->get_check_lists_array() );
+
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+ }
+ }
+
+ $components_calendar_array[] = array("component" =>
$component->toArray(), "controls_calendar" =>
$controls_components_calendar_array);
+ }
+ print_r($components_calendar_array);
+
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
// Gets array of locations assigned to current user
@@ -242,14 +282,15 @@
$data = array
(
- 'buildings_on_property' =>
$buildings_on_property,
- 'my_locations'
=> $my_locations,
- 'current_location' =>
$location_array,
- 'heading_array' =>
$heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'date_format'
=> $date_format,
- 'current_year'
=> $year,
- 'location_level'
=> $level,
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'my_locations'
=> $my_locations,
+ 'current_location' =>
$location_array,
+ 'heading_array'
=> $heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'components_calendar_array' =>
$components_calendar_array,
+ 'date_format'
=> $date_format,
+ 'current_year'
=> $year,
+ 'location_level'
=> $level,
);
self::render_template_xsl(array('calendar/view_calendar_year',
'calendar/check_list_status_checker',
@@ -285,19 +326,24 @@
$locations_with_calendar_array = array();
+ // Process aggregated values for controls with repeat
type day or week
if($control->get_repeat_type() <= 1 ){
foreach($locations_for_control_array as
$location){
$curr_location_code =
$location['location_code'];
+ $cl_criteria = new
controller_check_list();
+ $cl_criteria->set_control_id(
$control->get_id() );
+ $cl_criteria->set_location_code(
$curr_location_code );
+
// Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
- $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($control, $curr_location_code,
$year);
+ $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year);
$year_calendar = new
year_calendar($control, $year);
$calendar_array =
$year_calendar->build_agg_month_calendar($agg_open_cases_pr_month_array);
- $locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
+ $locations_with_calendar_array[] =
array( "location" => $location, "calendar_array" => $calendar_array );
}
- foreach($components_for_control_array as
$component){
+ foreach($components_for_control_array as $component){
$curr_component_id =
$component['component_id'];
// Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
@@ -307,18 +353,9 @@
$calendar_array =
$year_calendar->build_agg_calendar($agg_open_cases_pr_month_array);
$components_with_calendar_array[] =
array("component" => $component, "calendar_array" => $calendar_array);
}
-
- foreach($components_for_control_array as
$component){
- $curr_component_id =
$component['component_id'];
-
- // Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
- $agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($control, $curr_component_id, $year,
true);
-
- $year_calendar = new
year_calendar($control, $year);
- $calendar_array =
$year_calendar->build_agg_calendar($agg_open_cases_pr_month_array);
- $components_with_calendar_array[] =
array("component" => $component, "calendar_array" => $calendar_array);
- }
- }else if($control->get_repeat_type() > 1){
+ }
+ // Process values for controls with repeat type month
or year
+ else if($control->get_repeat_type() > 1){
foreach($locations_for_control_array as
$location){
$curr_location_code =
$location['location_code'];
@@ -453,7 +490,7 @@
}
// Generates array of aggregated number of open cases for each
month in time period
- function build_agg_open_cases_pr_month_array($control,
$location_code, $year, $component=false ){
+ function build_agg_open_cases_pr_month_array( $cl_criteria,
$year ){
// Checks if control starts in the year that is
displayed
if( date("Y", $control->get_start_date()) == $year ){
@@ -471,23 +508,16 @@
$agg_open_cases_pr_month_array = array();
- // Fetches aggregate value for open cases in each month
in time period
- for($from_month;$from_month<=$to_month;$from_month++){
+ // Fetches aggregate value for open cases in each month
in time period
+ for($from_month; $from_month <= $to_month;
$from_month++){
- $month_start_ts =
strtotime("$from_month/01/$year");
- $end_month = $from_month + 1;
+ $month_start_ts =
$this->get_month_start_date_ts($year, $from_month);
+ $month_end_ts =
$this->get_month_start_date_ts($year, $from_month+1);
- if($end_month > 12){
- $year = $year + 1;
- $end_month = 1;
- }
-
- $month_end_ts =
strtotime("$end_month/01/$year");
-
$num_open_cases_for_control_array = array();
// Fetches aggregate value for open cases in a
month from db
- $num_open_cases_for_control_array =
$this->so_check_list->get_num_open_cases_for_control( $control->get_id(),
$location_code, $month_start_ts, $month_end_ts, $component );
+ $num_open_cases_for_control_array =
$this->so_check_list->get_num_open_cases_for_control( $cl_criteria,
$month_start_ts, $month_end_ts );
// If there is a aggregated value for the
month, add aggregated status object to agg_open_cases_pr_month_array
if( !empty($num_open_cases_for_control_array) ){
@@ -567,6 +597,15 @@
return $my_locations;
}
+ function get_month_start_ts($year, $month){
+ if($month > 12){
+ $year = $year + 1;
+ $month = $month % 12;
+ }
+
+ return strtotime("$month/01/$year");
+ }
+
function get_start_date_year_ts($year){
$start_date_year_ts = strtotime("01/01/$year");
Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -29,7 +29,7 @@
*/
phpgw::import_class('phpgwapi.yui');
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socase');
phpgw::import_class('controller.socheck_list');
phpgw::import_class('controller.socheck_item');
@@ -38,7 +38,7 @@
include_class('controller', 'check_item_case', 'inc/model/');
include_class('controller', 'status_checker', 'inc/helper/');
- class controller_uicase extends controller_uicommon
+ class controller_uicase extends phpgwapi_uicommon
{
private $so;
private $so_check_list;
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
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -29,7 +29,7 @@
*/
phpgw::import_class('phpgwapi.yui');
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socontrol_area');
phpgw::import_class('controller.socheck_list');
@@ -39,7 +39,7 @@
include_class('controller', 'status_checker', 'inc/helper/');
include_class('controller', 'date_helper', 'inc/helper/');
- class controller_uicheck_list extends controller_uicommon
+ class controller_uicheck_list extends phpgwapi_uicommon
{
private $so;
private $so_control_area;
Modified:
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -30,11 +30,11 @@
phpgw::import_class('phpgwapi.yui');
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socontrol_area');
//phpgw::import_class('bim.sobimitem');
- class controller_uicheck_list_for_component extends controller_uicommon
+ class controller_uicheck_list_for_component extends phpgwapi_uicommon
{
var $cat_id;
var $start;
Deleted: branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicommon.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -1,807 +0,0 @@
-<?php
- /**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-
- phpgw::import_class('phpgwapi.yui');
-
- /**
- * Cherry pick selected values into a new array
- *
- * @param array $array input array
- * @param array $keys array of keys to pick
- *
- * @return array containg values from $array for the keys in $keys.
- */
- function extract_values($array, $keys, $options = array())
- {
- static $default_options = array(
- 'prefix' => '',
- 'suffix' => '',
- 'preserve_prefix' => false,
- 'preserve_suffix' => false
- );
-
- $options = array_merge($default_options, $options);
-
- $result = array();
- foreach($keys as $write_key)
- {
- $array_key =
$options['prefix'].$write_key.$options['suffix'];
- if(isset($array[$array_key])) {
- $result[($options['preserve_prefix'] ?
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ?
$options['suffix'] : '')] = $array[$array_key];
- }
- }
- return $result;
- }
-
- function array_set_default(&$array, $key, $value)
- {
- if(!isset($array[$key])) $array[$key] = $value;
- }
-
- /**
- * Reformat an ISO timestamp into norwegian format
- *
- * @param string $date date
- *
- * @return string containg timestamp in norwegian format
- */
- function pretty_timestamp($date)
- {
- if (empty($date)) return "";
-
- if(is_array($date) && is_object($date[0]) && $date[0]
instanceof DOMNode)
- {
- $date = $date[0]->nodeValue;
- }
- preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})(
([0-9]{2}):([0-9]{2}))?/', $date, $match);
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- if($match[4])
- {
- $dateformat .= ' H:i';
- $timestamp = mktime($match[5], $match[6], 0, $match[2],
$match[3], $match[1]);
- }
- else
- {
- $timestamp = mktime(0, 0, 0, $match[2], $match[3],
$match[1]);
- }
- $text = date($dateformat,$timestamp);
-
- return $text;
- }
-
- /**
- * Generates a javascript translator object/hash for the specified
fields.
- */
- function js_lang()
- {
- $keys = func_get_args();
- $strings = array();
- foreach($keys as $key)
- {
- $strings[$key] = is_string($key) ? lang($key) :
call_user_func_array('lang', $key);
- }
- return json_encode($strings);
- }
-
- /**
- * Creates an array of translated strings.
- */
- function lang_array()
- {
- $keys = func_get_args();
- foreach($keys as &$key)
- {
- $key = lang($key);
- }
- return $keys;
- }
-
- abstract class controller_uicommon
- {
- const UI_SESSION_FLASH = 'flash_msgs';
-
- protected
- $filesArray;
-
- protected static
- $old_exception_handler;
-
- private
- $ui_session_key,
- $flash_msgs;
-
-
- const LOCATION_ROOT = '.';
- const LOCATION_SUPERUSER = '.usertype.superuser';
-// const LOCATION_ADMINISTRATOR = '.RESPONSIBILITY.ADMIN';
- const LOCATION_USER = '.usertype.user';
-
- public $dateFormat;
-
- public $type_of_user;
-
- // public $flash_msgs;
-
- public function __construct()
- {
- self::set_active_menu('controller');
-
self::add_stylesheet('phpgwapi/js/yahoo/calendar/assets/skins/sam/calendar.css');
-
self::add_stylesheet('phpgwapi/js/yahoo/autocomplete/assets/skins/sam/autocomplete.css');
-
self::add_stylesheet('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
self::add_stylesheet('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
self::add_stylesheet('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
self::add_stylesheet('phpgwapi/js/yahoo/treeview/assets/skins/sam/treeview.css');
-
//self::add_stylesheet('controller/templates/base/css/base.css');
- self::add_javascript('controller', 'yahoo',
'common.js');
- $this->tmpl_search_path = array();
- array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/phpgwapi/templates/base');
- array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set']);
- array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT .
'/' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '/templates/base');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('history');
- phpgwapi_yui::load_widget('paginator');
- phpgwapi_yui::load_widget('menu');
- phpgwapi_yui::load_widget('calendar');
- phpgwapi_yui::load_widget('autocomplete');
- phpgwapi_yui::load_widget('animation');
-
- $this->url_prefix = str_replace('_', '.',
get_class($this));
-
- $this->dateFormat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $this->acl = & $GLOBALS['phpgw']->acl;
- $this->locations = & $GLOBALS['phpgw']->locations;
-
- $this->type_of_user = array(
- MANAGER => $this->isManager(),
- EXECUTIVE_OFFICER =>
$this->isExecutiveOfficer(),
- ADMINISTRATOR => $this->isAdministrator()
- );
- //var_dump($this->type_of_user);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($GLOBALS['phpgw_info']['flags']['currentapp']);
- }
-
- private function get_ui_session_key() {
- return $this->ui_session_key;
- }
-
- private function restore_flash_msgs() {
- if (($flash_msgs =
$this->session_get(self::UI_SESSION_FLASH))) {
- if (is_array($flash_msgs)) {
- $this->flash_msgs = $flash_msgs;
-
$this->session_set(self::UI_SESSION_FLASH, array());
- return true;
- }
- }
-
- $this->flash_msgs = array();
- return false;
- }
-
- private function store_flash_msgs() {
- return $this->session_set(self::UI_SESSION_FLASH,
$this->flash_msgs);
- }
-
- private function reset_flash_msgs() {
- $this->flash_msgs = array();
- $this->store_flash_msgs();
- }
-
- private function session_set($key, $data) {
- return
phpgwapi_cache::session_set($this->get_ui_session_key(), $key, $data);
- }
-
- private function session_get($key) {
- return
phpgwapi_cache::session_get($this->get_ui_session_key(), $key);
- }
-
- /**
- * Provides a private session cache setter per ui class.
- */
- protected function ui_session_set($key, $data) {
- return $this->session_set(get_class($this).'_'.$key,
$data);
- }
-
- /**
- * Provides a private session cache getter per ui class .
- */
- protected function ui_session_get($key) {
- return $this->session_get(get_class($this).'_'.$key);
- }
-
- protected function generate_secret($length = 10)
- {
- return
substr(base64_encode(rand(1000000000,9999999999)),0, $length);
- }
-
- public function add_js_event($event, $js) {
- $GLOBALS['phpgw']->js->add_event($event, $js);
- }
-
- public function add_js_load_event($js) {
- $this->add_js_event('load', $js);
- }
-
- /**
- * Permission check. Proxy method for method check in
phpgwapi->acl
- *
- * @param $location
- * @param $permission
- * @return true if check is ok, false othewise
- */
- protected function hasPermissionOn($location =
controller_uicommon::LOCATION_ROOT, $permission = PHPGW_ACL_PRIVATE){
- return
$this->acl->check($location,$permission,'controller');
- }
-
-
- /**
- * Check to see if this user is an administrator
- *
- * @return true if private permission on root, false otherwise
- */
- protected function isAdministrator(){
- return
$this->acl->check(controller_uicommon::LOCATION_ROOT,PHPGW_ACL_PRIVATE,'controller');
- }
-
- /**
- * Check to see if the user is an executive officer
- *
- * @return true if at least add permission on fields of
responsibilities (locations: .RESPONSIBIITY.*)
- */
- protected function isExecutiveOfficer(){
- return (
-
$this->acl->check(controller_uicommon::LOCATION_SUPERUSER,PHPGW_ACL_ADD,'controller')
||
-
$this->acl->check(controller_uicommon::LOCATION_USER,PHPGW_ACL_ADD,'controller')
- );
- }
-
- /**
- * Check to see if the user is a manager
- *
- * @return true if no read,add,delete,edit permission on fields
of responsibilities (locations: .RESPONSIBILITY.*)
- */
- protected function isManager(){
- return !$this->isExecutiveOfficer();
- }
-
- public static function
process_controller_unauthorized_exceptions()
- {
- self::$old_exception_handler =
set_exception_handler(array(__CLASS__,
'handle_controller_unauthorized_exception'));
- }
-
- public static function
handle_controller_unauthorized_exception(Exception $e)
- {
- if ($e instanceof controller_unauthorized_exception)
- {
- $message = htmlentities('HTTP/1.0 401
Unauthorized - '.$e->getMessage(), null, self::encoding());
- header($message);
- echo
"<html><head><title>$message</title></head><body><strong>$message</strong></body></html>";
- } else {
- call_user_func(self::$old_exception_handler,
$e);
- }
- }
-
- public function link($data)
- {
- return $GLOBALS['phpgw']->link('/index.php', $data);
- }
-
- public function redirect($link_data)
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
$link_data);
- }
-
- public function flash($msg, $type='success')
- {
- $this->flash_msgs[$msg] = $type == 'success';
- }
-
- public function flash_form_errors($errors)
- {
- foreach($errors as $field => $msg)
- {
- $this->flash_msgs[$msg] = false;
- }
- }
-
- public function add_stylesheet($path)
- {
- $GLOBALS['phpgw']->css->add_external_file($path);
- }
-
- public function add_javascript($app, $pkg, $name)
- {
- return $GLOBALS['phpgw']->js->validate_file($pkg,
str_replace('.js', '', $name), $app);
- }
-
- public function set_active_menu($item)
- {
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
$item;
- }
-
- /**
- * A more flexible version of xslttemplate.add_file
- */
- public function add_template_file($tmpl)
- {
- if(is_array($tmpl))
- {
- foreach($tmpl as $t)
- {
- $this->add_template_file($t);
- }
- return;
- }
- foreach(array_reverse($this->tmpl_search_path) as $path)
- {
- $filename = $path . '/' . $tmpl . '.xsl';
- if (file_exists($filename))
- {
-
$GLOBALS['phpgw']->xslttpl->xslfiles[$tmpl] = $filename;
- return;
- }
- }
- echo "Template $tmpl not found in search path: ";
- print_r($this->tmpl_search_path);
- die;
- }
-
- public function render_template($output)
- {
- $GLOBALS['phpgw']->common->phpgw_header(true);
- if($this->flash_msgs)
- {
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
- foreach($msgbox_data as & $message)
- {
- echo "<div
class='{$message['msgbox_class']}'>";
- echo $message['msgbox_text'];
- echo '</div>';
- }
- }
- echo htmlspecialchars_decode($output);
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
-
- public function add_yui_translation(&$data)
- {
- $this->add_template_file('yui_booking_i18n');
- $previous = lang('prev');
- $next = lang('next');
-
- $data['yui_booking_i18n'] = array(
- 'Calendar' => array(
- 'WEEKDAYS_SHORT' =>
json_encode(lang_array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa')),
- 'WEEKDAYS_FULL' =>
json_encode(lang_array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday')),
- 'MONTHS_LONG' =>
json_encode(lang_array('January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December')),
- ),
- 'DataTable' => array(
- 'MSG_EMPTY' => json_encode(lang('No
records found.')),
- 'MSG_LOADING' =>
json_encode(lang("Loading...")),
- 'MSG_SORTASC' =>
json_encode(lang('Click to sort ascending')),
- 'MSG_SORTDESC' =>
json_encode(lang('Click to sort descending')),
- ),
- 'setupDatePickerHelper' => array(
- 'LBL_CHOOSE_DATE' =>
json_encode(lang('Choose a date')),
- ),
- 'setupPaginator' => array(
- 'pageReportTemplate' =>
json_encode(lang("Showing items {startRecord} - {endRecord} of
{totalRecords}")),
- 'previousPageLinkLabel' =>
json_encode("< {$previous}"),
- 'nextPageLinkLabel' =>
json_encode("{$next} >"),
- ),
- 'common' => array(
- 'LBL_NAME' => json_encode(lang('Name')),
- 'LBL_TIME' => json_encode(lang('Time')),
- 'LBL_WEEK' => json_encode(lang('Week')),
- 'LBL_RESOURCE' =>
json_encode(lang('Resource')),
- ),
- );
- }
-
-
- public function add_template_helpers() {
- $this->add_template_file('helpers');
- }
-
- public function render_template_xsl($files, $data)
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-
- if($this->flash_msgs) {
- $data['msgbox_data'] =
$GLOBALS['phpgw']->common->msgbox($this->flash_msgs);
- } else {
- $this->add_template_file('msgbox');
- }
-
- $this->reset_flash_msgs();
-
- $this->add_yui_translation($data);
- $data['webserver_url'] =
$GLOBALS['phpgw_info']['server']['webserver_url'];
-
- $output = phpgw::get_var('output', 'string', 'REQUEST',
'html');
- $GLOBALS['phpgw']->xslttpl->set_output($output);
- $this->add_template_file($files);
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
- }
-
-
- public function check_active($url)
- {
- if($_SERVER['REQUEST_METHOD'] == 'POST')
- {
- $activate = extract_values($_POST,
array("status", "activate_id"));
-
$this->bo->set_active(intval($activate['activate_id']),
intval($activate['status']));
- $this->redirect(array('menuaction' => $url,
'id' => $activate['activate_id']));
- }
- }
-
- // Add link key to a result array
- public function _add_links(&$value, $key, $menuaction)
- {
- $unset = 0;
- // FIXME: Fugly workaround
- // I cannot figure out why this variable isn't set, but
it is needed
- // by the ->link() method, otherwise we wind up in the
phpgroupware
- // errorhandler which does lot of weird things and
breaks the output
- if
(!isset($GLOBALS['phpgw_info']['server']['webserver_url'])) {
-
$GLOBALS['phpgw_info']['server']['webserver_url'] = "/";
- $unset = 1;
- }
-
- $value['link'] = self::link(array('menuaction' =>
$menuaction, 'id' => $value['id']));
-
- // FIXME: Fugly workaround
- // I kid you not my friend. There is something very
wonky going on
- // in phpgroupware which I cannot figure out.
- // If this variable isn't unset() (if it wasn't set
before that is)
- // then it will contain extra slashes and break URLs
- if ($unset) {
-
unset($GLOBALS['phpgw_info']['server']['webserver_url']);
- }
- }
-
- // Build a YUI result style array
- public function yui_results($results)
- {
- if (!$results) {
- $results['total_records'] = 0;
- $result['results'] = array();
- }
-
- return array(
- 'ResultSet' => array(
- 'totalRecords' =>
$results['total_records'],
- 'recordsReturned' =>
count($results['results']),
- 'startIndex' =>
$results['start'],
- 'sortKey' =>
$results['sort'],
- 'sortDir' =>
$results['dir'],
- 'Result' =>
$results['results']
- )
- );
- }
-
- public function use_yui_editor($targets)
- {
- /*
-
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
- self::add_javascript('yahoo', 'yahoo/editor',
'simpleeditor-min.js');
- */
- $lang_font_style = lang('Font Style');
- $lang_lists = lang('Lists');
- $lang_insert_item = lang('Insert Item');
- $js = '';
- foreach ( $targets as $target )
- {
- $js .= <<<SCRIPT
- (function() {
- var Dom = YAHOO.util.Dom,
- Event = YAHOO.util.Event;
-
- var editorConfig = {
- toolbar:
- {buttons: [
- { group: 'textstyle',
label: '{$lang_font_style}',
- buttons: [
- { type:
'push', label: 'Fet CTRL + SHIFT + B', value: 'bold' }
- ]
- },
- { type: 'separator' },
- { group: 'indentlist',
label: '{$lang_lists}',
- buttons: [
- { type:
'push', label: 'Opprett punktliste', value: 'insertunorderedlist' },
- { type:
'push', label: 'Opprett nummerert liste', value: 'insertorderedlist' }
- ]
- },
- { type: 'separator' },
- { group: 'insertitem',
label: '{$lang_insert_item}',
- buttons: [
- { type:
'push', label: 'HTML Lenke CTRL + SHIFT + L', value: 'createlink', disabled:
true },
- { type:
'push', label: 'Sett inn bilde', value: 'insertimage' }
- ]
- },
- { type: 'separator' },
- { group: 'undoredo',
label: 'Angre/Gjenopprett',
- buttons: [
- { type:
'push', label: 'Angre', value: 'undo' },
- { type:
'push', label: 'Gjenopprett', value: 'redo' }
- ]
- }
- ]
- },
- height: '200px',
- width: '700px',
- animate: true,
- dompath: true,
- handleSubmit: true
- };
-
- var editorWidget = new
YAHOO.widget.Editor('{$target}', editorConfig);
- editorWidget.render();
- })();
-
-SCRIPT;
- }
-
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/editor/assets/skins/sam/editor.css');
- phpgw::import_class('phpgwapi.yui');
- phpgwapi_yui::load_widget('editor');
- $GLOBALS['phpgw']->js->add_event('load', $js);
- }
-
- /**
- * Returns formatted version of gab id. The format of the
string returned
- * is '[Cadastral unit number] / [Property unit number] /
[Leasehold unit number] / [Section unit number]'.
- *
- * @param $gab_id string with id to to format.
- * @return string formatted version of the string passed to the
method,
- * or the same string if the one passed is of an incorrect
format.
- */
- public static function get_nicely_formatted_gab_id(string
$gab_id)
- {
- if(strlen($gab_id) == 20)
- {
- $gab_id = substr($gab_id,4,5).' /
'.substr($gab_id,9,4).' / '.substr($gab_id,13,4).' / '.substr($gab_id,17,3);
- }
- return $gab_id;
- }
-
- public function render($template,$local_variables = array())
- {
- foreach($local_variables as $name => $value)
- {
- $$name = $value;
-
- }
-
- ob_start();
- foreach(array_reverse($this->tmpl_search_path) as $path)
- {
- $filename = $path . '/' . $template;
- if (file_exists($filename))
- {
- include($filename);
- break;
- }
- }
- $output = ob_get_contents();
- ob_end_clean();
- self::render_template($output);
- }
-
- /**
- * Method for JSON queries.
- *
- * @return YUI result
- */
- public abstract function query();
-
- /**
- * Generate javascript for the extra column definitions for a
partial list
- *
- * @param $array_name the name of the javascript variable that
contains the column definitions
- * @param $extra_cols the list of extra columns to set
- * @return string javascript
- */
- public static function get_extra_column_defs($array_name,
$extra_cols = array())
- {
- $result = "";
-
- foreach($extra_cols as $col){
- $literal = '{';
- $literal .= 'key: "' . $col['key'] . '",';
- $literal .= 'label: "' . $col['label'] . '"';
- if (isset($col['formatter'])) {
- $literal .= ',formatter: ' .
$col['formatter'];
- }
- if (isset($col['parser'])) {
- $literal .= ',parser: ' .
$col['parser'];
- }
- $literal .= '}';
-
- if($col["index"]){
- $result .=
"{$array_name}.splice(".$col["index"].", 0,".$literal.");";
- } else {
- $result .=
"{$array_name}.push($literal);";
- }
- }
-
- return $result;
- }
-
- /**
- * Generate javascript definitions for any editor widgets set
on columns for
- * a partial list.
- *
- * @param $array_name the name of the javascript variable that
contains the column definitions
- * @param $editors the list of editors, keyed by column key
- * @return string javascript
- */
- public static function get_column_editors($array_name, $editors
= array())
- {
- $result = "for (var i in {$array_name}) {\n";
- $result .= " switch ({$array_name}[i].key) {\n";
- foreach ($editors as $field => $editor) {
- $result .= " case '{$field}':\n";
- $result .= "
{$array_name}[i].editor = {$editor};\n";
- $result .= " break;\n";
- }
- $result .= " }\n";
- $result .= "}";
-
- return $result;
- }
-
- /**
- * Returns a html-formatted error message if one is defined in
the
- * list of validation errors on the object we're given. If no
- * error is defined, an empty string is returned.
- *
- * @param $object the object to display errors for
- * @param $field the name of the attribute to display errors for
- * @return string a html formatted error message
- */
- public static function get_field_error($object, $field)
- {
- if(isset($object))
- {
- $errors = $object->get_validation_errors();
-
- if ($errors[$field]) {
- return '<label class="error" for="' .
$field . '">' . $errors[$field] . '</label>';
- }
- return '';
- }
- }
-
- public static function get_messages($messages, $message_type)
- {
- $output = '';
- if(is_array($messages) && count($messages) > 0) //
Array of messages
- {
- $output = "<div class=\"{$message_type}\">";
- foreach($messages as $message)
- {
- $output .= "<p
class=\"message\">{$message}</p>";
- }
- $output .= "</div>";
- }
- else if($messages) {
- $output = "<div class=\"{$message_type}\"><p
class=\"message\">{$messages}</p></div>";
- }
- return $output;
- }
- /**
- * Returns a html-formatted error message to display on top of
the page. If
- * no error is defined, an empty string is returned.
- *
- * @param $error the error to display
- * @return string a html formatted error message
- */
- public static function get_page_error($errors)
- {
- return self::get_messages($errors, 'error');
- }
-
- /**
- * Returns a html-formatted error message to display on top of
the page. If
- * no error is defined, an empty string is returned.
- *
- * @param $error the error to display
- * @return string a html formatted error message
- */
- public static function get_page_warning($warnings)
- {
- return self::get_messages($warnings, 'warning');
- }
-
- /**
- * Returns a html-formatted info message to display on top of
the page. If
- * no message is defined, an empty string is returned.
- *
- * @param $message the message to display
- * @return string a html formatted info message
- */
- public static function get_page_message($messages)
- {
- return self::get_messages($messages, 'info');
- }
-
- /**
- * Download xls, csv or similar file representation of a data
table
- */
- public function download()
- {
- $list = $this->query();
- $list = $list['ResultSet']['Result'];
-
- $keys = array();
-
- if(count($list[0]) > 0) {
- foreach($list[0] as $key => $value) {
- if(!is_array($value)) {
- array_push($keys, $key);
- }
- }
- }
-
- // Remove newlines from output
- $count = count($list);
- for($i = 0; $i < $count; $i++)
- {
- foreach ($list[$i] as $key => &$data)
- {
- $data = str_replace(array("\n","\r\n",
"<br>"),'',$data);
- }
- }
-
- // Use keys as headings
- $headings = array();
- $count_keys = count($keys);
- for($j=0;$j<$count_keys;$j++)
- {
- array_push($headings, lang($keys[$j]));
- }
-
- $property_common = CreateObject('property.bocommon');
- $property_common->download($list, $keys, $headings);
- }
-
- /**
- * Added because error reporting facilities in phpgw tries to
serialize the PDO
- * instance in $this->db which causes an error. This method
removes $this->db from the
- * serialized values to avoid this problem.
- */
- public function __sleep()
- {
- return array('table_name', 'fields');
- }
- }
Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,7 +28,7 @@
* @version $Id$
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('property.boevent');
phpgw::import_class('controller.socontrol');
phpgw::import_class('controller.socontrol_group');
@@ -45,7 +45,7 @@
include_class('controller', 'control_group_list', 'inc/model/');
include_class('controller', 'check_item', 'inc/model/');
- class controller_uicontrol extends controller_uicommon
+ class controller_uicontrol extends phpgwapi_uicommon
{
private $bo;
private $so;
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,7 +28,7 @@
* @version $Id$
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('property.boevent');
phpgw::import_class('controller.socontrol');
phpgw::import_class('controller.socontrol_item');
@@ -38,7 +38,7 @@
include_class('controller', 'control_group', 'inc/model/');
- class controller_uicontrol_group extends controller_uicommon
+ class controller_uicontrol_group extends phpgwapi_uicommon
{
private $so;
private $so_procedure;
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group_component.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicontrol_group_component.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/inc/class.uicontrol_group_component.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -30,11 +30,11 @@
phpgw::import_class('phpgwapi.yui');
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socontrol_area');
//phpgw::import_class('bim.sobimitem');
- class controller_uicontrol_group_component extends controller_uicommon
+ class controller_uicontrol_group_component extends phpgwapi_uicommon
{
var $cat_id;
var $start;
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
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,7 +28,7 @@
* @version $Id$
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('property.boevent');
phpgw::import_class('controller.socontrol');
phpgw::import_class('controller.socontrol_item');
@@ -38,7 +38,7 @@
include_class('controller', 'control_item', 'inc/model/');
- class controller_uicontrol_item extends controller_uicommon
+ class controller_uicontrol_item extends phpgwapi_uicommon
{
private $so;
private $so_control_item;
@@ -191,6 +191,7 @@
public function edit()
{
$control_item_id = phpgw::get_var('id');
+ $control_item = $this->so->get_single( $control_item_id
);
// Sigurd: START as categories
$cats = CreateObject('phpgwapi.categories', -1,
'controller', '.control');
@@ -200,15 +201,13 @@
$control_areas_array = $control_areas['cat_list'];
$control_groups_array =
$this->so_control_group->get_control_group_array();
-
- /*
- * hack to fix display of char
- */
+
+ // Hack to fix display of char
$control_item->set_what_to_do(str_replace(" ", "
",$control_item->get_what_to_do()));
$control_item->set_how_to_do(str_replace(' ', ' ',
$control_item->get_how_to_do()));
$control_item_array = $control_item->toArray();
-
+
$data = array
(
'editable' => true,
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,12 +28,12 @@
* @version $Id: class.uicontrol_item.inc.php 9082 2012-03-29 12:58:24Z
vator $
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socontrol_item_option');
include_class('controller', 'control_item_option', 'inc/model/');
- class controller_uicontrol_item_option extends controller_uicommon
+ class controller_uicontrol_item_option extends phpgwapi_uicommon
{
private $so;
private $so_control_item;
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -4,6 +4,7 @@
*
* @author Erink Holm-Larsen <address@hidden>
* @author Torstein Vadla <address@hidden>
+ * @author Sigurd Nes <address@hidden>
* @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
* This file is part of phpGroupWare.
*
@@ -35,7 +36,7 @@
*/
phpgw::import_class('phpgwapi.jquery');
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.socontrol_area');
include_class('controller', 'check_list', 'inc/model/');
@@ -43,7 +44,7 @@
include_class('controller', 'status_checker', 'inc/helper/');
include_class('controller', 'date_helper', 'inc/helper/');
- class controller_uicontrol_location extends controller_uicommon
+ class controller_uicontrol_location extends phpgwapi_uicommon
{
var $cat_id;
var $start;
@@ -284,6 +285,7 @@
);
}
+/*
$control_info =
execMethod('controller.socontrol.get_single', $control_id);
if($control_info)
{
@@ -293,7 +295,7 @@
'title' =>
$control_info->get_title()
);
}
-
+*/
$tabs = array
(
array
@@ -304,23 +306,14 @@
array
(
'label' =>
lang('Add_locations_for_control')
- ),
- array
- (
- 'label' => lang('add components
for control'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol_location.register_control_to_component'))
)
-
);
$data = array(
'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
'view'
=> "register_control_to_location",
'control_id'
=> $control_id,
- 'control_filters'
=> array(
- 'control_areas_array' =>
$control_areas_array,
- 'control_array'
=> $control_array
- ),
+ 'control_areas_array' =>
$control_areas_array,
'filter_form'
=> array(
'building_types'
=> $building_types,
'category_types'
=> $category_types,
@@ -655,12 +648,13 @@
(
'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 2),
'td_count'
=> '""',
- 'property_js'
=>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+ // 'property_js'
=>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
'datatable'
=> $datavalues,
'myColumnDefs'
=> $myColumnDefs,
'myButtons'
=> $myButtons,
'msgbox_data'
=> $msgbox_data,
+ 'control_area_list' =>
array('options' => $control_area_list),
'filter_form'
=> array
(
'control_area_list' =>
array('options' => $control_area_list),
@@ -677,22 +671,22 @@
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+ $theme = 'ui-lightness';
+
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/development-bundle/themes/{$theme}/jquery.ui.autocomplete.css");
- phpgwapi_yui::load_widget('dragdrop');
- phpgwapi_yui::load_widget('datatable');
+
phpgwapi_yui::load_widget('connection');
phpgwapi_yui::load_widget('loader');
phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::load_widget('paginator');
- phpgwapi_yui::load_widget('animation');
phpgwapi_jquery::load_widget('core');
+ phpgwapi_jquery::load_widget('autocomplete');
self::add_javascript('controller', 'controller',
'ajax_control_to_component.js');
- self::add_javascript('controller', 'yahoo',
'register_control_to_component.js');
+ // self::add_javascript('controller', 'yahoo',
'register_control_to_component.js');
+ self::add_javascript('controller', 'yahoo',
'register_control_to_component2.js');
-
$GLOBALS['phpgw']->xslttpl->add_file(array('control_location/register_control_to_component'));
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
+
self::render_template_xsl(array('control_location/register_control_to_component'
), $data);
}
@@ -727,7 +721,7 @@
(
'key' => 'select',
'label' => lang('select'),
- 'sortable' => true,
+ 'sortable' => false,
'formatter' => false,
'hidden' => false,
'formatter' => '',
@@ -795,18 +789,21 @@
$district_id = phpgw::get_var('district_id',
'int');
$part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
$control_id =
phpgw::get_var('control_id', 'int');
+ $results =
phpgw::get_var('results', 'int');
+ $control_registered =
phpgw::get_var('control_registered', 'bool');
if(!$entity_id && !$cat_id)
{
- return json_encode(array());
+ $values = array();
}
+ else
+ {
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
".entity.{$entity_id}.{$cat_id}");
+ $boentity =
CreateObject('property.boentity',false, 'entity');
+ $boentity->results = $results;
+ $values =
$boentity->read(array('control_registered' => $control_registered, 'control_id'
=> $control_id));
+ }
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
".entity.{$entity_id}.{$cat_id}");
- $boentity =
CreateObject('property.boentity',false, 'entity');
- $boentity->allrows = true;
-
- $values = $boentity->read();
-
foreach($values as &$entry)
{
$checked = '';
@@ -818,7 +815,18 @@
$entry['select'] = "<input class
=\"mychecks_add\" type =\"checkbox\" $checked
name=\"values[register_component][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
}
- return json_encode($values);
+
+ $results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $return_data['recordsReturned'] = count($values);
+ $return_data['totalRecords'] = $boentity->total_records;
+ $return_data['startIndex'] = $this->start;
+ $return_data['sort'] = 'location_code';
+ $return_data['dir'] = "ASC";
+ $return_data['pageSize'] = $results;
+ $return_data['activePage'] = floor($this->start /
$results) + 1;
+ $return_data['records'] = $values;
+
+ return $return_data;
}
public function edit_component()
Modified: branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,12 +28,12 @@
* @version $Id$
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.sodocument');
phpgw::import_class('controller.soprocedure');
include_class('controller', 'document', 'inc/model/');
- class controller_uidocument extends controller_uicommon
+ class controller_uidocument extends phpgwapi_uicommon
{
private $so;
private $so_procedure;
@@ -507,4 +507,4 @@
self::render_template_xsl('datatable', $data);
}
- }
\ No newline at end of file
+ }
Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -28,14 +28,14 @@
* @version $Id$
*/
- phpgw::import_class('controller.uicommon');
+ phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('controller.soprocedure');
phpgw::import_class('controller.socontrol_area');
phpgw::import_class('controller.socontrol');
include_class('controller', 'procedure', 'inc/model/');
- class controller_uiprocedure extends controller_uicommon
+ class controller_uiprocedure extends phpgwapi_uicommon
{
private $so;
private $so_control_area;
Modified:
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -6,43 +6,70 @@
class year_calendar {
- private $period_start_date_ts;
- private $period_end_date_ts;
private $year;
private $control;
+ private $type;
+ private $component;
+ private $location_code;
+
private $calendar_array = array();
- public function __construct($control, $year){
+ public function __construct($control, $year, $component, $location_code,
$type){
$this->year = $year;
$this->control = $control;
+ $this->component = $component;
+ $this->location_code = $location_code;
+ $this->type = $type;
- $this->period_start_date_ts = strtotime("01/01/$year");
- $to_year = $year + 1;
- $this->period_end_date_ts = strtotime("01/01/$to_year");
-
$this->init_calendar();
}
+ /* Initializes calendar by setting status for each month in calendar array.
+ * - CONTROL_NOT_DONE if month date is in the past
+ * - CONTROL_REGISTERED if month date is in the future
+ */
function init_calendar(){
for($i = 1;$i <= 12;$i++){
$this->calendar_array[$i] = null;
}
- $date_generator = new date_generator($this->control->get_start_date(),
$this->control->get_end_date(), $this->period_start_date_ts,
$this->period_end_date_ts, $this->control->get_repeat_type(),
$this->control->get_repeat_interval());
+ $ctr_start_date_ts = $this->control->get_start_date();
+ $ctr_end_date_ts = $this->control->get_end_date();
+ $period_start_date_ts = $this->get_start_date_year_ts($this->year);
+ $period_end_date_ts = $this->get_start_date_year_ts($this->year+1);
+ $repeat_type = $this->control->get_repeat_type();
+ $repeat_interval = $this->control->get_repeat_interval();
+
+ $date_generator = new date_generator($ctr_start_date_ts, $ctr_end_date_ts,
$period_start_date_ts, $period_end_date_ts, $repeat_type, $repeat_interval);
$dates_array = $date_generator->get_dates();
// Inserts dates
- foreach($dates_array as $date){
- $todays_date = mktime(0,0,0,date("m"), date("d"), date("Y"));
-
- if($date < $todays_date){
+ foreach($dates_array as $date_ts){
+ $todays_date_ts = $this->get_todays_date_ts();
+
+ if($date_ts < $todays_date_ts){
$status = "CONTROL_NOT_DONE";
}else{
$status = "CONTROL_REGISTERED";
}
- $this->calendar_array[ date("n", $date) ]["status"] = $status;
- $this->calendar_array[ date("n", $date) ]["info"] = array("date" =>
$date, "control_id" => $this->control->get_id());
+ $this->calendar_array[ date("n", $date_ts) ]["status"] = $status;
+
+ if($this->type = "component"){
+ $this->calendar_array[ date("n", $date_ts) ]["info"] = array(
+
"date" => $date_ts,
+
"control_id" => $this->control->get_id(),
+
"type" => "component",
+
"component" = $component->toArray()
+
);
+ }else{
+ $this->calendar_array[ date("n", $date_ts) ]["info"] = array(
+
"date" => $date_ts,
+
"control_id" => $this->control->get_id(),
+
"type" => "location",
+
"location_code" = $location_code
+
);
+ }
}
}
@@ -83,4 +110,15 @@
return $heading_array;
}
+
+ public static function get_todays_date_ts(){
+ $todays_date_ts = mktime(0,0,0,date("m"), date("d"), date("Y"));
+ return $todays_date_ts;
+ }
+
+ public static function get_start_date_year_ts($year){
+ $start_date_year_ts = strtotime("01/01/$year");
+
+ return $start_date_year_ts;
+ }
}
\ No newline at end of file
Modified: branches/Version-1_0-branch/controller/inc/hook_home.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/hook_home.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/hook_home.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -67,21 +67,14 @@
$location_finder = new location_finder();
$my_locations = $location_finder->get_responsibilities( $criteria );
- $unique_locations = array();
- foreach($my_locations as $loc)
- {
- if(!in_array($loc["location_code"],$unique_locations))
- {
- $unique_locations[] = $loc["location_code"];
- }
- }
$repeat_type = null;
$controls_for_location_array = array();
- foreach($unique_locations as $location)
+ foreach($my_locations as $location)
{
- $controls_for_location_array[] = array($location,
$so_control->get_controls_for_location($location, $from_date_ts, $to_date_ts,
$repeat_type ));
+ $controls_for_location_array[] = array($location["location_code"],
$so_control->get_controls_for_location($location["location_code"],
$location["role_id"], $from_date_ts, $to_date_ts, $repeat_type ));
}
+
$controls_array = array();
$control_dates = array();
@@ -90,11 +83,89 @@
$controls_for_loc_array = $control_arr[1];
foreach($controls_for_loc_array as $control)
{
- $date_generator = new
date_generator($control->get_start_date(), $control->get_end_date(),
$from_date_ts, $to_date_ts, $control->get_repeat_type(),
$control->get_repeat_interval());
+ $date_generator = new
date_generator($control["start_date"], $control["end_date"], $from_date_ts,
$to_date_ts, $control["repeat_type"], $control["repeat_interval"]);
$controls_array[] = array($current_location, $control,
$date_generator->get_dates());
}
}
+
+ $portalbox0 = CreateObject('phpgwapi.listbox', array
+ (
+ 'title' => "Mine glemte kontroller",
+ 'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
+ 'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
+ 'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
+ 'width' => '100%',
+ 'outerborderwidth' => '0',
+ 'header_background_image' =>
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+ ));
+ $app_id = $GLOBALS['phpgw']->applications->name2id('controller');
+ if( !isset($GLOBALS['portal_order']) ||!in_array($app_id,
$GLOBALS['portal_order']) )
+ {
+ $GLOBALS['portal_order'][] = $app_id;
+ }
+ $var = array
+ (
+ 'up' => array('url' => '/set_box.php', 'app' =>
$app_id),
+ 'down' => array('url' => '/set_box.php', 'app' =>
$app_id),
+ 'close' => array('url' => '/set_box.php', 'app' =>
$app_id),
+ 'question' => array('url' => '/set_box.php', 'app'
=> $app_id),
+ 'edit' => array('url' => '/set_box.php', 'app' =>
$app_id)
+ );
+
+ foreach ( $var as $key => $value )
+ {
+ // $portalbox->set_controls($key,$value);
+ }
+
+ $category_name = array(); // caching
+
+ $cats = CreateObject('phpgwapi.categories', -1, 'controller',
'.control');
+ $cats->supress_info = true;
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' => '','globals'
=> true,'use_acl' => $this->_category_acl));
+
+ $portalbox0->data = array();
+ $portalbox0_data = array();
+ foreach ($controls_array as $control_instance)
+ {
+ $curr_location = $control_instance[0];
+ $current_control = $control_instance[1];
+ $check_lists =
$so->get_open_check_lists_for_control($current_control["id"], $curr_location,
$from_date_ts);
+ $location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
+ $location_name = $location_array["loc1_name"];
+ foreach($control_areas['cat_list'] as $area)
+ {
+ if($area['cat_id'] ==
$current_control["control_area_id"])
+ {
+ $control_area_name = $area['name'];
+ }
+ }
+ foreach($check_lists as $check_list)
+ {
+ $next_date = "Frist: " . date('d/m/Y',
$check_list->get_deadline());
+ $portalbox0_data[] = array
+ ($check_list->get_deadline(), array
+ (
+ 'text' => "{$location_name} -
{$control_area_name} - {$current_control["title"]} :: {$next_date}",
+ 'link' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'controller.uicheck_list.edit_check_list',
'check_list_id' => $check_list->get_id()))
+ ));
+ }
+ }
+ //sort data by planned date for check list
+ sort($portalbox0_data);
+ //$limit = 5;
+ $tmp = 0;
+ foreach($portalbox0_data as $check_list_dates)
+ {
+ if($tmp < $limit_no_of_planned)
+ {
+ $portalbox0->data[] = $check_list_dates[1];
+ }
+ $tmp++;
+ }
+
+ echo "\n".'<!-- BEGIN checklist info -->'."\n<div
class='controller_checklist' style='padding-left: 10px; background-color:
red;'>".$portalbox0->draw()."</div>\n".'<!-- END checklist info -->'."\n";
+
$portalbox1 = CreateObject('phpgwapi.listbox', array
(
'title' => "Mine planlagte kontroller",
@@ -137,12 +208,12 @@
{
$curr_location = $control_instance[0];
$current_control = $control_instance[1];
- $check_lists =
$so->get_planned_check_lists_for_control($current_control->get_id(),
$curr_location);
+ $check_lists =
$so->get_planned_check_lists_for_control($current_control["id"],
$curr_location);
$location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
$location_name = $location_array["loc1_name"];
foreach($control_areas['cat_list'] as $area)
{
- if($area['cat_id'] ==
$current_control->get_control_area_id())
+ if($area['cat_id'] ==
$current_control["control_area_id"])
{
$control_area_name = $area['name'];
}
@@ -153,7 +224,7 @@
$portalbox1_data[] = array
($check_list->get_planned_date(), array
(
- 'text' => "{$location_name} -
{$control_area_name} - {$current_control->get_title()} :: {$next_date}",
+ 'text' => "{$location_name} -
{$control_area_name} - {$current_control["title"]} :: {$next_date}",
'link' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'controller.uicheck_list.edit_check_list',
'check_list_id' => $check_list->get_id()))
));
}
@@ -210,14 +281,14 @@
{
$curr_location = $control_instance[0];
$current_control = $control_instance[1];
- unset($check_lists);
- $check_lists =
$so->get_unplanned_check_lists_for_control($current_control->get_id(),
$curr_location);
+ //unset($check_lists);
+ $check_lists =
$so->get_unplanned_check_lists_for_control($current_control["id"],
$curr_location);
//$control_location =
$so_control->getLocationCodeFromControl($current_control->get_id());
$location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
$location_name = $location_array["loc1_name"];
foreach($control_areas['cat_list'] as $area)
{
- if($area['cat_id'] ==
$current_control->get_control_area_id())
+ if($area['cat_id'] ==
$current_control["control_area_id"])
{
$control_area_name = $area['name'];
}
@@ -231,23 +302,23 @@
{
foreach($check_lists as $check_list)
{
- if(intval($current_date) >
intval($check_list->get_deadline()) && intval($current_date) !=
intval($check_list->get_deadline()))
+ if($current_date >
$check_list->get_deadline() && $current_date != $check_list->get_deadline())
{
$next_date = "Fristdato: " .
date('d/m/Y', $current_date);
$portalbox2_data[] = array
($current_date, array
(
- 'text' =>
"{$location_name} - {$control_area_name} - {$current_control->get_title()} ::
{$next_date}",
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control->get_id(), 'location_code' => $curr_location))
+ 'text' =>
"{$location_name} - {$control_area_name} - {$current_control["title"]} ::
{$next_date}",
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control["id"], 'location_code' => $curr_location))
));
}
else
{
$next_date = "Fristdato: " .
date('d/m/Y', $check_list->get_deadline());
$portalbox2_data[] = array
- ($current_date, array
+ ($check_list->get_deadline(),
array
(
- 'text' =>
"{$location_name} - {$control_area_name} - {$current_control->get_title()} ::
{$next_date}",
+ 'text' =>
"{$location_name} - {$control_area_name} - {$current_control["title"]} ::
{$next_date}",
'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' =>
$check_list->get_id()))
));
}
@@ -259,8 +330,8 @@
$portalbox2_data[] = array
($current_date, array
(
- 'text' => "{$location_name} -
{$control_area_name} - {$current_control->get_title()} :: {$next_date}",
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control->get_id(), 'location_code' => $curr_location))
+ 'text' => "{$location_name} -
{$control_area_name} - {$current_control["title"]} :: {$next_date}",
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id'
=> $current_control["id"], 'location_code' => $curr_location))
));
}
}
Modified:
branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -47,6 +47,7 @@
protected $completed_date;
protected $location_code;
protected $component_id;
+ protected $location_id;
// Aggregate fields. Fields not in a table
protected $num_open_cases;
@@ -136,6 +137,13 @@
}
public function get_component_id() { return
$this->component_id; }
+
+ public function set_location_id($location_id)
+ {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id() { return $this->location_id; }
public function get_num_open_cases() { return
$this->num_open_cases; }
@@ -170,6 +178,7 @@
'completed_date' => $this->get_completed_date(),
'location_code' => $this->get_location_code(),
'component_id' => $this->get_component_id(),
+ 'location_id' => $this->get_location_id(),
'num_open_cases' => $this->get_num_open_cases()
);
}
Copied:
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php (from
rev 9624, trunk/controller/inc/model/class.component.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
(rev 0)
+++ branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -0,0 +1,123 @@
+<?php
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id: class.control.inc.php 9548 2012-06-11 12:40:52Z vator $
+ */
+
+ include_class('controller', 'model', 'inc/model/');
+ include_class('controller', 'date_helper', 'inc/helper/');
+
+ class controller_component extends controller_model
+ {
+ protected $type;
+ protected $id;
+ protected $guid;
+ protected $xml;
+ protected $location_code;
+ protected $loc_1;
+ protected $address;
+
+ // Objects
+ protected $controls_array = array();
+
+ /**
+ * Constructor. Takes an optional ID. If a contract is
created from outside
+ * the database the ID should be empty so the database can add
one according to its logic.
+ *
+ * @param int $id the id of this composite
+ */
+
+ public function set_type($type)
+ {
+ $this->type = $type;
+ }
+
+ public function get_type() { return $this->type; }
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
+
+ public function get_id() { return $this->id; }
+
+ public function set_guid($guid)
+ {
+ $this->guid = $guid;
+ }
+
+ public function get_guid() { return $this->guid; }
+
+
+ public function set_xml($xml)
+ {
+ $this->xml = $xml;
+ }
+
+ public function get_xml() { return $this->xml; }
+
+ public function set_location_code($location_code)
+ {
+ $this->location_code = $location_code;
+ }
+
+ public function get_location_code() { return
$this->location_code; }
+
+ public function set_loc_1($loc_1)
+ {
+ $this->loc_1 = $loc_1;
+ }
+
+ public function get_loc_1() { return $this->loc_1; }
+
+ public function set_address($address)
+ {
+ $this->address = $address;
+ }
+
+ public function get_address() { return $this->address; }
+
+ public function set_controls_array($controls_array)
+ {
+ $this->controls_array = $controls_array;
+ }
+
+ public function get_controls_array() { return
$this->controls_array; }
+
+ public function serialize()
+ {
+ return array(
+ 'type' => $this->get_type(),
+ 'id' => $this->get_id(),
+ 'guid' => $this->get_guid(),
+ 'xml' => $this->get_xml(),
+ 'location_code' => $this->get_location_code(),
+ 'loc_1' => $this->get_loc_1(),
+ 'address' => $this->get_address()
+ );
+ }
+ }
Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js
2012-06-19 10:23:39 UTC (rev 9625)
@@ -380,6 +380,10 @@
}
});
+ $("#control_item_options li .delete").live("click", function(e){
+ $(this).closest("li").fadeOut();
+ });
+
$("#add_control_item_list_value input[type=button]").live("click",
function(e){
e.preventDefault();
Modified:
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
2012-06-19 10:23:39 UTC (rev 9625)
@@ -18,7 +18,7 @@
if( data != null){
htmlString = "<option>Velg
kontroll</option>"
var obj = jQuery.parseJSON(data);
-
+
$.each(obj, function(i) {
var selected = '';
@@ -30,7 +30,7 @@
*/
htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
});
-
+
$("#control_id").html( htmlString );
}
else
@@ -41,7 +41,7 @@
}
}
});
-
+
});
@@ -73,9 +73,8 @@
*/
htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
});
-
+
$("#cat_id").html( htmlString );
- // update_component_table();
}
else
{
@@ -84,7 +83,7 @@
}
}
});
-
+
});
@@ -102,12 +101,12 @@
if( data != null)
{
var obj = data;
-
+
$.each(obj, function(i)
{
htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
});
-
+
$("#location_type_category").html(
htmlString );
$("#loc1").html( "<option
value=''>Velg</option>" );
$("#loc2").html( "<option
value=''>Velg</option>" );
@@ -128,6 +127,43 @@
update_loc(level);
});
+ var oArgs = {menuaction:'property.bolocation.get_locations_by_name'};
+ var baseUrl = phpGWLink('index.php', oArgs, true);
+
+ $("#search-location-name").autocomplete({
+ source: function( request, response ) {
+ location_type = $("#location_type").val();
+ $.ajax({
+ url: baseUrl,
+ dataType: "json",
+ data: {
+ location_name: request.term,
+ level: location_type
+ },
+ success: function( data ) {
+ response( $.map( data, function( item )
{
+ return {
+ label: item.name,
+ value:
item.location_code
+ }
+ }));
+ }
+ });
+ },
+ focus: function (event, ui) {
+ $(event.target).val(ui.item.label);
+ return false;
+ },
+ minLength: 1,
+ select: function( event, ui ) {
+// console.log(ui.item);
+// $("#search-location-name").val( ui.item.label );
+ $("#search-location_code").val( ui.item.value );
+ update_component_table();
+ }
+ });
+
+
//update part of town category based on district
$("#district_id").change(function () {
var district_id = $(this).val();
@@ -144,12 +180,12 @@
if( data != null)
{
var obj = jQuery.parseJSON(data);
-
+
$.each(obj, function(i)
{
htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
});
-
+
$("#part_of_town_id").html( htmlString
);
$("#loc1").html( "<option
value=''>Velg</option>" );
$("#loc2").html( "<option
value=''>Velg</option>" );
@@ -163,6 +199,9 @@
}
}
});
+
+ $("#search-location_code").val('');
+ update_component_table();
});
@@ -181,12 +220,12 @@
if( data != null)
{
var obj = data;
-
+
$.each(obj, function(i)
{
htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].id + " " + obj[i].name + "</option>";
});
-
+
$("#loc1").html( htmlString );
$("#loc2").html( "<option
value=''>Velg</option>" );
}
@@ -199,6 +238,8 @@
}
});
+ $("#search-location_code").val('');
+ update_component_table();
});
$("#loc1").change(function ()
@@ -216,12 +257,12 @@
if( data != null)
{
var obj = data;
-
+
$.each(obj, function(i)
{
htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].id + " " + obj[i].name + "</option>";
});
-
+
$("#loc2").html( htmlString );
}
else
@@ -232,12 +273,27 @@
}
});
+ $("#search-location_code").val('');
+ update_component_table();
+
});
+ $("#control_registered").change(function ()
+ {
+ init_component_table();
+ });
$("#control_id").change(function ()
{
+ $("#control_id_hidden").val( $(this).val() );
+
+ init_component_table();
+ });
+
+ $("#loc2").change(function ()
+ {
+ $("#search-location_code").val('');
update_component_table();
});
@@ -257,6 +313,14 @@
$("#acl_form").live("submit", function(e){
e.preventDefault();
+ var control_id = $("#control_id_hidden").val();
+
+ if(!control_id || control_id == null)
+ {
+ alert('du må velge kontroll');
+ return;
+ }
+
var thisForm = $(this);
var submitBnt = $(thisForm).find("input[type='submit']");
var requestUrl = $(thisForm).attr("action");
@@ -273,29 +337,19 @@
}
var obj = data;
-
+
var submitBnt =
$(thisForm).find("input[type='submit']");
if(obj.status == "updated")
{
$(submitBnt).val("Lagret");
- var oArgs = {
-
menuaction:'controller.uicontrol_location.query2',
- entity_id:$("#entity_id").val(),
- cat_id:$("#cat_id").val(),
-
district_id:$("#district_id").val(),
-
part_of_town_id:$("#part_of_town_id").val(),
- location_code:$("#loc1").val(),
-
control_id:$("#control_id").val()
- };
-
-
execute_async(myDataTable_0,oArgs);
+
YAHOO.portico.update_datatable();
}
else
{
- $(submitBnt).val("Feil ved lagring");
+ $(submitBnt).val("Feil ved lagring");
}
-
+
// Changes text on save button back to original
window.setTimeout(function() {
$(submitBnt).val('Lagre');
@@ -311,7 +365,7 @@
htmlString +=
data['receipt']['error'][i]['msg'];
htmlString += '</div>';
}
-
+
}
if(typeof(data['receipt']['message'])
!= 'undefined')
{
@@ -321,7 +375,7 @@
htmlString +=
data['receipt']['message'][i]['msg'];
htmlString += '</div>';
}
-
+
}
$("#receipt").html(htmlString);
}
@@ -354,12 +408,12 @@
if( data != null)
{
var obj = data;
-
+
$.each(obj, function(i)
{
htmlString += "<option
value='" + obj[i].location_code + "'>" + obj[i].location_code + " " +
obj[i]["loc"+level+"_name"] + "</option>";
});
-
+
$("#loc" + level).html( htmlString );
if(level == 1)
{
@@ -398,11 +452,9 @@
url: requestUrl,
success: function(data) {
if( data != null)
- {
- myColumnDefs = [];
- myColumnDefs.push(data);
- update_component_table_def();
-// update_component_table();
+ {
+ myColumnDefs = data;
+ init_component_table();
}
else
{
@@ -413,26 +465,95 @@
}
-function update_component_table_def()
+
+function init_component_table()
{
- pager = YAHOO.util.Dom.get("paging_0");
- div = YAHOO.util.Dom.get("datatable-container_0");
- this.init_datatable(datatable[0],div,pager,myColumnDefs[0],0);
-}
+ var control_registered = 0;
+ if (typeof($($("#control_registered")).attr("checked")) != 'undefined'
&& $($("#control_registered")).attr("checked") == 'checked')
+ {
+ control_registered = 1;
+ }
-function update_component_table()
-{
+
+ var cat_id = $("#cat_id").val() != null ? $("#cat_id").val():'';
+
+ if(!cat_id)
+ {
+ return false;
+ }
+
+ var location_code = '';
+
+ if( $("#search-location_code").val() != null &&
$("#search-location_code").val())
+ {
+ location_code = $("#search-location_code").val();
+ }
+ else if( $("#loc2").val() != null && $("#loc2").val())
+ {
+ location_code = $("#loc2").val();
+ }
+ else if ( $("#loc1").val() != null && $("#loc1").val())
+ {
+ location_code = $("#loc1").val();
+ }
+
var oArgs = {
menuaction:'controller.uicontrol_location.query2',
entity_id:$("#entity_id").val(),
- cat_id:$("#cat_id").val(),
+ cat_id:cat_id,
district_id:$("#district_id").val(),
part_of_town_id:$("#part_of_town_id").val(),
- location_code:$("#loc1").val(),
- control_id:$("#control_id").val()
+ location_code:location_code,
+ control_id:$("#control_id_hidden").val() != null ?
$("#control_id_hidden").val():'',
+ control_registered:control_registered
};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
- execute_async(myDataTable_0, oArgs);
+ YAHOO.portico.init_datatable(myColumnDefs,requestUrl);
+}
+
+
+function update_component_table()
+{
+
+ var control_registered = 0;
+ if (typeof($($("#control_registered")).attr("checked")) != 'undefined'
&& $($("#control_registered")).attr("checked") == 'checked')
+ {
+ control_registered = 1;
+ }
+
+ if($("#cat_id").val() != null)
+ {
+ var location_code = '';
+
+ if( $("#search-location_code").val() != null &&
$("#search-location_code").val())
+ {
+ location_code = $("#search-location_code").val();
+ }
+ else if( $("#loc2").val() != null && $("#loc2").val())
+ {
+ location_code = $("#loc2").val();
+ }
+ else if ( $("#loc1").val() != null && $("#loc1").val())
+ {
+ location_code = $("#loc1").val();
+ }
+
+ var oArgs = {
+ menuaction:'controller.uicontrol_location.query2',
+ entity_id:$("#entity_id").val(),
+ cat_id:$("#cat_id").val(),
+ district_id:$("#district_id").val(),
+ part_of_town_id:$("#part_of_town_id").val(),
+ location_code:location_code,
+ control_id:$("#control_id_hidden").val() != null ?
$("#control_id_hidden").val():'',
+ control_registered:control_registered
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ YAHOO.portico.update_datatable(requestUrl);
+ }
// $("#receipt").html('');
}
Modified: branches/Version-1_0-branch/controller/js/yahoo/common.js
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/common.js 2012-06-19
10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/js/yahoo/common.js 2012-06-19
10:23:39 UTC (rev 9625)
@@ -8,7 +8,7 @@
YAHOO.portico.lang = function(section, config) {
config = config || {};
- if (YAHOO && YAHOO.booking && YAHOO.portico.i18n &&
YAHOO.portico.i18n[section]) {
+ if (YAHOO && YAHOO.portico && YAHOO.portico.i18n &&
YAHOO.portico.i18n[section]) {
YAHOO.portico.i18n[section](config);
}
return config;
Deleted:
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
===================================================================
---
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
2012-06-19 10:23:39 UTC (rev 9625)
@@ -1,66 +0,0 @@
-var myPaginator_0, myDataTable_0
-
- this.myParticularRenderEvent = function()
- {
-
- }
-
-
-
- var FormatterRight = function(elCell, oRecord, oColumn, oData)
- {
- elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
- }
-
- var FormatterCenter = function(elCell, oRecord, oColumn, oData)
- {
- elCell.innerHTML = "<center>"+oData+"</center>";
- }
-
-
- function checkAll(myclass)
- {
- controls = YAHOO.util.Dom.getElementsByClassName(myclass);
-
- for(i=0;i<controls.length;i++)
- {
- if(!controls[i].disabled)
- {
-// if(myclass=="mychecks")
- {
- if(controls[i].checked)
- {
- controls[i].checked = false;
- }
- else
- {
- controls[i].checked = true;
- }
- }
- //for the rest, always id checked
-// else
-// {
-// controls[i].checked = true;
-// }
- }
- }
- }
-
-
/********************************************************************************/
-
-
-YAHOO.util.Event.addListener(window, "load", function()
-{
- loader = new YAHOO.util.YUILoader();
- loader.addModule({
- name: "anyone",
- type: "js",
- fullpath: property_js
- });
-
- loader.require("anyone");
- loader.insert();
-});
-
-
-
Copied:
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component2.js
(from rev 9624, trunk/controller/js/yahoo/register_control_to_component2.js)
===================================================================
---
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component2.js
(rev 0)
+++
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component2.js
2012-06-19 10:23:39 UTC (rev 9625)
@@ -0,0 +1,205 @@
+YAHOO.namespace('portico');
+
+YAHOO.portico.requestUrl = null;
+YAHOO.portico.DataTable = null;
+YAHOO.portico.Paginator = null;
+
+
+YAHOO.portico.update_datatable = function(requestUrl) {
+
+ requestUrl = requestUrl ? requestUrl : YAHOO.portico.requestUrl;
+
+ var callback =
+ {
+ success: function(o)
+ {
+/*
+ if(config_values.PanelLoading)
+ {
+ myLoading.hide();
+ }
+*/
+ values_ds = JSON.parse(o.responseText);
+
+ if(values_ds && values_ds['sessionExpired'] == true)
+ {
+ window.alert('sessionExpired - please log in');
+// lightboxlogin();//defined i
phpgwapi/templates/portico/js/base.js
+ }
+ else
+ {
+
+
YAHOO.portico.Paginator.setRowsPerPage(values_ds.recordsReturned,true);
+
+ //delete values of datatable
+ YAHOO.portico.DataTable.getRecordSet().reset();
+
+ //reset total records always to zero
+ YAHOO.portico.Paginator.setTotalRecords(0,true);
+/*
+ //change PaginatorŽs configuration.
+ if(path_values.allrows == 1 )
+ {
+
YAHOO.portico.Paginator.set("rowsPerPage",values_ds.totalRecords)
+ }
+*/
+ //obtain records of the last DS and add to
datatable
+ var record = values_ds.records;
+ var newTotalRecords = values_ds.totalRecords;
+
+ if(record.length)
+ {
+ YAHOO.portico.DataTable.addRows(record);
+ }
+ else
+ {
+ YAHOO.portico.DataTable.render();
+ }
+
+ //update paginator with news values
+
YAHOO.portico.Paginator.setTotalRecords(newTotalRecords,true);
+
+ //update globals variables for pagination
+ myrowsPerPage = values_ds.recordsReturned;
+ mytotalRows = values_ds.totalRecords;
+
+ //update combo box pagination
+//
YAHOO.portico.Paginator.set('rowsPerPageOptions',[myrowsPerPage,mytotalRows]);
+
+
YAHOO.portico.Paginator.setPage(values_ds.activePage,true); //true no fuerza un
recarge solo cambia el paginator
+
+ //update "sortedBy" values
+
+ (values_ds.dir == "asc")? dir_ds =
YAHOO.widget.DataTable.CLASS_ASC : dir_ds = YAHOO.widget.DataTable.CLASS_DESC;
+
YAHOO.portico.DataTable.set("sortedBy",{key:values_ds.sort,dir:dir_ds});
+ }
+ },
+ failure: function(o) {window.alert('Server or your connection
is dead.')},
+ timeout: 10000,
+ cache: false
+ }
+
+ try
+ {
+ YAHOO.util.Connect.asyncRequest('POST',requestUrl,callback);
+ }
+ catch(e_async)
+ {
+ alert(e_async.message);
+ }
+};
+
+YAHOO.portico.init_datatable = function(myColumnDefs,requestUrl) {
+
+ fields = new Array();
+ for(i=0; i < myColumnDefs.length;i++)
+ {
+ fields[i] = myColumnDefs[i].key;
+ }
+
+ // DataSource instance
+ var myDataSource = new YAHOO.util.DataSource( requestUrl );
+ myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+ myDataSource.responseSchema = {
+ resultsList: "records",
+ fields: fields,
+ // Access to values in the server response
+ metaFields: {
+ totalRecords: "totalRecords",
+ startIndex: "startIndex",
+ pageSize: "pageSize"
+ }
+ };
+
+ // Customize request sent to server to be able to set total # of records
+ var generateRequest = function(oState, oSelf) {
+ // Get states or use defaults
+ oState = oState || { pagination: null, sortedBy: null };
+ var sort = (oState.sortedBy) ? oState.sortedBy.key : "id";
+ var dir = (oState.sortedBy && oState.sortedBy.dir ===
YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
+ var startIndex = (oState.pagination) ? oState.pagination.recordOffset
: 0;
+ var results = (oState.pagination) ? oState.pagination.rowsPerPage : 0;
+
+ // Build custom request
+ return "&order=" + sort +
+ "&sort=" + dir +
+ "&start=" + startIndex +
+ "&results=" + results;
+ };
+
+ myPaginatorConfig = {
+ containers : ['paging'],
+// alwaysVisible : true,
+// rowsPerPageOptions : [5, 10, 25, 50, 100, 200],
+ }
+
+ // from common.js
+ myPaginatorConfig = YAHOO.portico.lang('setupPaginator',
myPaginatorConfig);
+// myPaginatorConfig.template = "{RowsPerPageDropdown} elements_pr_page.
{CurrentPageReport}<br/> {FirstPageLink} {PreviousPageLink} {PageLinks}
{NextPageLink} {LastPageLink}";
+
+ myPaginator = new YAHOO.widget.Paginator(myPaginatorConfig);
+
+ YAHOO.portico.Paginator = myPaginator
+
+ // DataTable configuration
+ var myConfigs = {
+ generateRequest: generateRequest,
+ initialRequest: generateRequest(), // Initial request for first page
of data
+ dynamicData: true, // Enables dynamic server-driven data
+ sortedBy : {key:"id", dir:YAHOO.widget.DataTable.CLASS_ASC}, // Sets
UI initial sort arrow
+ paginator: myPaginator // Enables pagination
+ };
+
+ // DataTable instance
+ var myDataTable = new YAHOO.widget.DataTable("datatable-container",
myColumnDefs, myDataSource, myConfigs);
+ // Update totalRecords on the fly with values from server
+ myDataTable.doBeforeLoadData = function(oRequest, oResponse, oPayload) {
+ YAHOO.portico.requestUrl = requestUrl + oRequest;
+ oPayload.totalRecords = oResponse.meta.totalRecords;
+ oPayload.pagination.rowsPerPage = oResponse.meta.pageSize;
+ oPayload.pagination.recordOffset = oResponse.meta.startIndex;
+ return oPayload;
+ };
+
+ YAHOO.portico.DataTable = myDataTable;
+
+ return {
+ ds: myDataSource,
+ dt: myDataTable
+ };
+
+};
+//YAHOO.util.Event.onDOMReady( YAHOO.portico.init_datatable );
+
+ var FormatterRight = function(elCell, oRecord, oColumn, oData)
+ {
+ elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+ }
+
+ var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+ {
+ elCell.innerHTML = "<center>"+oData+"</center>";
+ }
+
+
+ function checkAll(myclass)
+ {
+ controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+
+ for(i=0;i<controls.length;i++)
+ {
+ if(!controls[i].disabled)
+ {
+
+ if(controls[i].checked)
+ {
+ controls[i].checked = false;
+ }
+ else
+ {
+ controls[i].checked = true;
+ }
+ }
+ }
+ }
+
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2012-06-19
10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2012-06-19
10:23:39 UTC (rev 9625)
@@ -197,6 +197,7 @@
property controller no Eiendom
quarterly controller no Kvartalvis
recurrence controller no Gjentakelse
+registered controller no Registrert
remove controller no Fjern
controller controller no Kontroll
reports controller no Rapporter
@@ -334,7 +335,7 @@
component_for_control_group controller no Utstyr tilknyttet
kontrollgrupper
View_component_for_control_group controller no Vis knytning
mot utstyr
Add_component_for_control_group controller no Legg til
knytning mot utstyr
-show_controls_for_location controller no Vis lokasjoner
+show_controls_for_location controller no Vis lokasjoner/
komponenter
Property name controller no Lokasjonsnavn
Address controller no Adresse
Zip code controller no Postnummer
@@ -347,4 +348,5 @@
components for control controller no Komponenter tilknyttet kontroll
add components for control controller no Legg til knytning
mellom kontroll og komponent(er)
location category controller no Lokaliseringskategori
-select delete controller no slett
\ No newline at end of file
+select add controller no Velg for å legge til
+select delete controller no Velg for sletting
Modified:
branches/Version-1_0-branch/controller/templates/base/add_component_to_control.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/add_component_to_control.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/add_component_to_control.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -22,7 +22,7 @@
<div class="yui-content">
<div id="control_details">
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
<xsl:apply-templates select="control_filters" />
<xsl:apply-templates select="filter_form" />
<xsl:apply-templates select="paging"/>
Modified:
branches/Version-1_0-branch/controller/templates/base/add_component_to_control_group.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/add_component_to_control_group.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/add_component_to_control_group.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -22,7 +22,7 @@
<div class="yui-content">
<div id="control_group_details">
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
<xsl:apply-templates select="control_group_filters" />
<xsl:apply-templates select="filter_form" />
<xsl:apply-templates select="paging"/>
Modified:
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -78,20 +78,23 @@
<!-- ===================== SEARCH FOR LOCATION
================= -->
<div id="search-location" class="select-box">
<div id="choose-loc">
- <label>Søk etter andre <a
href="loc_type_2" class="btn active">Bygg</a><a href="loc_type_1"
class="btn">Eiendom</a>
- <input id="loc_type"
type="hidden" name="loc_type" value="2" />
- </label>
- </div>
- <input type="hidden" id="currentYear">
+ <input id="loc_type" type="hidden" name="loc_type"
value="2" />
+ <input type="hidden" id="currentYear">
<xsl:attribute name="value">
<xsl:value-of
select="current_year"/>
</xsl:attribute>
</input>
<input type="hidden" id="currentMonth">
- <xsl:attribute name="value">
+ <xsl:attribute name="value">
<xsl:value-of
select="current_month_nr"/>
</xsl:attribute>
</input>
+ <label>Søk etter</label>
+ <span>
+ <a href="loc_type_2" class="btn
first active">Bygg</a>
+ <a href="loc_type_1"
class="btn">Eiendom</a>
+ </span>
+ </div>
<input type="text" value=""
id="search-location-name" />
</div>
Modified:
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -77,15 +77,18 @@
<!-- ===================== SEARCH FOR LOCATION
================= -->
<div id="search-location" class="select-box">
<div id="choose-loc">
- <label>Søk etter andre <a
href="loc_type_2" class="btn active">Bygg</a><a href="loc_type_1"
class="btn">Eiendom</a>
- <input id="loc_type"
type="hidden" name="loc_type" value="2" />
- </label>
+ <input id="loc_type" type="hidden"
name="loc_type" value="2" />
+ <input type="hidden" id="currentYear">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="current_year"/>
+ </xsl:attribute>
+ </input>
+ <label>Søk etter</label>
+ <span>
+ <a href="loc_type_2" class="btn
first active">Bygg</a>
+ <a href="loc_type_1"
class="btn">Eiendom</a>
+ </span>
</div>
- <input type="hidden" id="currentYear">
- <xsl:attribute name="value">
- <xsl:value-of
select="current_year"/>
- </xsl:attribute>
- </input>
<input type="text" value=""
id="search-location-name" />
</div>
@@ -202,9 +205,12 @@
<td class="frequency">
<span>
<xsl:choose>
-
<xsl:when test="control/repeat_interval = 1">
+
<xsl:when test="control/repeat_interval = 1 and control/repeat_type < 3">
<span class="pre">Hver</span>
</xsl:when>
+
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
+
<span class="pre">Hvert</span>
+
</xsl:when>
<xsl:when test="control/repeat_interval = 2">
<span class="pre">Annenhver</span>
</xsl:when>
@@ -228,6 +234,85 @@
<tr class="cal_info_msg"><td colspan="3">Ingen
sjekklister for bygg i angitt periode</td></tr>
</xsl:otherwise>
</xsl:choose>
+
+ <xsl:for-each select="components_calendar_array">
+
+ <tr>
+
+ <td>
+ <h3><xsl:value-of
select="component/location_code"/></h3>
+ </td>
+ <xsl:for-each select="controls_calendar">
+ <xsl:variable
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
+
+ <tr>
+
+
+
+ <xsl:choose>
+ <xsl:when test="(position() mod
2) != 1">
+ <xsl:attribute
name="class">odd</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute
name="class">even</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td class="title">
+ <span><xsl:value-of
select="control/title"/></span>
+ </td>
+ <td class="assigned">
+ <span><xsl:value-of
select="control/responsibility_name"/></span>
+ </td>
+ <td class="frequency">
+ <span>
+ <xsl:choose>
+
<xsl:when test="control/repeat_interval = 1 and control/repeat_type < 3">
+
<span class="pre">Hver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
+
<span class="pre">Hvert</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval = 2">
+
<span class="pre">Annenhver</span>
+
</xsl:when>
+
<xsl:when test="control/repeat_interval > 2">
+
<span class="pre">Hver</span><span><xsl:value-of
select="control/repeat_interval"/>.</span>
+
</xsl:when>
+ </xsl:choose>
+
+ <span
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
+ </span>
+ </td>
+ <xsl:for-each
select="calendar_array">
+
<xsl:call-template name="check_list_status_checker" >
+
<xsl:with-param name="location_code"><xsl:value-of
select="//current_location/location_code"/></xsl:with-param>
+
</xsl:call-template>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+
+ </tr>
+
+ </xsl:for-each>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
</table>
</div>
</div>
Modified: branches/Version-1_0-branch/controller/templates/base/component.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/component.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/templates/base/component.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -32,7 +32,7 @@
<iframe id="yui-history-iframe"
src="phpgwapi/js/yahoo/history/assets/blank.html" ></iframe>
<input id="yui-history-field" type="hidden"/>
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
<xsl:apply-templates select="form" />
<xsl:apply-templates select="paging"/>
<div id="list_flash">
@@ -236,4 +236,4 @@
</script>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/control/control_tabs.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control/control_tabs.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control/control_tabs.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -6,7 +6,7 @@
<xsl:choose>
<xsl:when test="view = 'control_details'">
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
<div class="identifier-header">
<h1><xsl:value-of select="php:function('lang',
'Control')"/></h1>
</div>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -2,7 +2,7 @@
<!-- item -->
<xsl:template name="control_group" xmlns:php="http://php.net/xsl">
-<xsl:call-template name="yui_booking_i18n"/>
+<xsl:call-template name="yui_phpgw_i18n"/>
<div id="details">
<form action="#" method="post">
Modified:
branches/Version-1_0-branch/controller/templates/base/control_group/control_group_items.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_group/control_group_items.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_group/control_group_items.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -1,7 +1,7 @@
<!-- $Id$ -->
<xsl:template name="control_group_items" xmlns:php="http://php.net/xsl">
-<xsl:call-template name="yui_booking_i18n"/>
+<xsl:call-template name="yui_phpgw_i18n"/>
<div class="identifier-header">
</div>
<div>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -3,7 +3,7 @@
<xsl:template match="data" xmlns:php="http://php.net/xsl">
-<xsl:call-template name="yui_booking_i18n"/>
+<xsl:call-template name="yui_phpgw_i18n"/>
<div id="main_content">
@@ -28,7 +28,7 @@
<form action="#" method="post">
<input type="hidden" name="id"
value="{control_item/id}">
</input>
- <dl class="proplist-col">
+ <dl class="proplist">
<dt>
<label for="title">Tittel</label>
<xsl:choose>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -5,7 +5,7 @@
-<xsl:call-template name="yui_booking_i18n"/>
+<xsl:call-template name="yui_phpgw_i18n"/>
<div id="main_wrp">
@@ -29,4 +29,4 @@
</div>
</div>
</div>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -19,11 +19,20 @@
<!-- separate tabs and inline tables-->
-
<xsl:template match="data" xmlns:php="http://php.net/xsl">
+ <xsl:call-template name="yui_phpgw_i18n"/>
<style type="text/css">
select { width: 100px; }
</style>
+ <div id="choose_control" class="select-box">
+ <label>Velg kontrollen du vil vise komponent for</label>
+ <select id="control_area_id" name="control_area_id">
+ <xsl:apply-templates
select="control_area_list/options"/>
+ </select>
+ <select id="control_id" name="control_id">
+ <xsl:apply-templates select="control/options"/>
+ </select>
+ </div>
<div class="yui-navset yui-navset-top" id="control_location_tabview">
<div class="identifier-header">
@@ -54,7 +63,6 @@
</xsl:choose>
<div class="body">
<div id="voucher_details">
- <!--<xsl:call-template
name="yui_phpgw_i18n"/>-->
<table align = "center"
width="95%">
<xsl:apply-templates
select="filter_form" />
</table>
@@ -62,7 +70,6 @@
<table align = "center"
width="95%">
<tr>
<td
colspan = '6'>
-
<xsl:apply-templates select="paging"/>
<xsl:apply-templates select="datatable"/>
</td>
</tr>
@@ -83,40 +90,6 @@
<td colspan = '6'>
<table>
<tr>
- <td>
- <xsl:value-of select="php:function('lang', 'control
area')" />
- </td>
- <td>
- <xsl:value-of select="php:function('lang', 'control')"
/>
- </td>
- <td>
- <xsl:value-of select="php:function('lang', 'location
type')" />
- </td>
- <td>
- <xsl:value-of select="php:function('lang', 'location
category')" />
- </td>
- </tr>
- <tr id="filter1">
- <td>
- <select id="control_area_id" name="control_area_id">
- <xsl:apply-templates
select="control_area_list/options"/>
- </select>
- </td>
- <td>
- <select id="control_id" name="control_id">
- <xsl:apply-templates select="control/options"/>
- </select>
- </td>
- <td >
- <select id="location_type" name="location_type">
- <xsl:apply-templates
select="location_type_list/options"/>
- </select>
- </td>
- <td >
- <select id="location_type_category"
name="location_type_category">
- </select>
- </td>
- </tr>
<tr>
<td>
<xsl:value-of select="php:function('lang', 'entity')" />
@@ -136,9 +109,11 @@
<td>
<xsl:value-of select="php:function('lang', 'building')"
/>
</td>
+<!--
<td >
<xsl:value-of select="php:function('lang', 'search')" />
</td>
+-->
</tr>
<tr id="filter2">
<td>
@@ -171,11 +146,47 @@
<xsl:apply-templates select="loc2_list/options"/>
</select>
</td>
+<!--
<td>
<xsl:variable name="lang_search"><xsl:value-of
select="php:function('lang', 'Search')" /></xsl:variable>
<input type="button" id = "search" name="search"
value="{$lang_search}" title = "{$lang_search}" />
- </td>
+ </td>
+-->
</tr>
+
+ <td>
+ <xsl:value-of select="php:function('lang',
'registered')" />
+ </td>
+ <td>
+ <xsl:value-of select="php:function('lang', 'location
type')" />
+ </td>
+ <td>
+ <xsl:value-of select="php:function('lang', 'location
category')" />
+ </td>
+ <td>
+ <xsl:value-of select="php:function('lang', 'name')" />
+ </td>
+ </tr>
+ <tr id="filter1">
+ <td >
+ <input id= "control_registered" type="checkbox"
name="control_registered" value="1"/>
+ </td>
+
+ <td >
+ <input id= "control_id_hidden" type="hidden"
name="control_id"/>
+ <select id="location_type" name="location_type">
+ <xsl:apply-templates
select="location_type_list/options"/>
+ </select>
+ </td>
+ <td >
+ <select id="location_type_category"
name="location_type_category">
+ </select>
+ </td>
+ <td colspan = '2'>
+ <input type="text" value="" id="search-location-name" />
+ <input id= "search-location_code" type="hidden"
name="search-location_code"/>
+ </td>
+ </tr>
</table>
</td>
</tr>
@@ -185,15 +196,15 @@
<xsl:template match="datatable" xmlns:php="http://php.net/xsl">
- <div id="paging_0"/>
- <div id="datatable-container_0"/>
-
+ <div id="paging"></div>
+ <div id="datatable-container"></div>
+
<xsl:call-template name="datasource-definition" />
<div id="receipt"></div>
<xsl:variable name="label_submit"><xsl:value-of
select="php:function('lang', 'save')" /></xsl:variable>
<div><input type="submit" name="update_acl" id="frm_update_acl"
value="{$label_submit}"/></div>
- <xsl:variable name="label_select_add"><xsl:value-of
select="php:function('lang', 'select')" /></xsl:variable>
+ <xsl:variable name="label_select_add"><xsl:value-of
select="php:function('lang', 'select add')" /></xsl:variable>
<div><input type="button" name="select_add" id="frm_update_add"
value="{$label_select_add}" onclick="checkAll('mychecks_add')"/></div>
<xsl:variable name="label_select_delete"><xsl:value-of
select="php:function('lang', 'select delete')" /></xsl:variable>
@@ -205,7 +216,6 @@
<!-- DATATABLE DEFINITIONS-->
<script type="text/javascript">
- var property_js = <xsl:value-of
select="//property_js"/>;
var datatable = new Array();
var myColumnDefs = new Array();
var myButtons = new Array();
Modified:
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -22,7 +22,7 @@
<div class="yui-content">
<div id="control_details">
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
<xsl:apply-templates select="control_filters" />
<xsl:apply-templates select="filter_form" />
<xsl:apply-templates select="paging"/>
Modified:
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -40,7 +40,7 @@
<input id="yui-history-field" type="hidden"/>
<xsl:apply-templates select="locations_table"/>
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
</div>
</div>
Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css
2012-06-19 10:23:39 UTC (rev 9625)
@@ -127,12 +127,6 @@
margin: 1em 0;
padding-left: 2em;
}
-dl.proplist dt,
-dl.proplist-col dt {
- font-weight: bolder;
- font-size: 90%;
- margin: .8em 0 .1em 0;
-}
dl.proplist-col,
dl.form-col {
@@ -666,60 +660,64 @@
/* ======================================= EXPAND LIST
========================================= */
ul.expand_list h4 {
- cursor: pointer;
- font-size: 1.1em;
- margin-bottom: 6px;
- margin-top: 0;
+ cursor: pointer;
+ font-size: 1.1em;
+ margin-bottom: 6px;
+ margin-top: 0;
}
ul.expand_list h4 img {
height: 12px;
}
ul.expand_list li ul {
- display:none;
- margin-left:21px;
+ display:none;
+ margin-left:21px;
}
ul.expand_list li ul li {
- margin-bottom: 3px;
- padding: 3px;
+ margin-bottom: 3px;
+ padding: 3px;
}
ul.expand_list h4 span {
- padding-left: 5px;
- vertical-align: middle;
+ padding-left: 5px;
+ vertical-align: middle;
}
ul.expand_list .expand_item {
- display: none;
+ display: none;
}
dl.proplist, dl.proplist-col {
- margin: 0;
- padding-left: 0;
+ margin: 0;
+ padding-left: 0;
}
+#details .proplist dd, #details .proplist-col dd{
+ margin-bottom: 0.5em;
+}
+
.frm_save_order input[type='submit']{
- margin: 10px 0 15px 0;
- width: 120px;
+ margin: 10px 0 15px 0;
+ width: 120px;
}
.delete {
- cursor: pointer;
- margin-left: 5px;
+ cursor: pointer;
+ margin-left: 5px;
}
.yui-navset .yui-content.tab_content {
- padding: 20px;
+ padding: 20px;
}
#datatable-container {
- margin: 20px;
+ margin: 20px;
}
#paginator {
- margin: 20px;
+ margin: 20px;
}
#paginator.top {
- margin: 20px 0 0 20px;
+ margin: 20px 0 0 20px;
}
#toolbar {
@@ -820,7 +818,6 @@
color: #FFFFFF;
cursor: pointer;
display: inline-block;
- margin-right: 10px;
padding: 5px 10px;
text-decoration: none;
}
@@ -1019,12 +1016,12 @@
.check_item label{
width:150px;
-}
+}
.new_item a#innertoolbar-button{
background: grey;
font-weight: bold;
-}
+}
#frm_save_check_items input[type="submit"]{
padding: 3px 30px;
@@ -1076,8 +1073,9 @@
margin-bottom: 10px;
}
-#search-location-name {
- width: 16em;
+#search-location-name {
+ margin: 2px 0 0;
+ width: 16em;
}
#choose-my-location {
@@ -1119,9 +1117,16 @@
padding: 2px 8px;
}
+#choose-loc .btn.first {
+ margin-right: 0.3em;
+}
+
#choose-loc .btn.active{
background: #3F7EC1;
}
+#choose-loc label {
+ display: inline-block;
+}
/* ================== COLOR MAP ============================= */
@@ -1795,6 +1800,10 @@
margin-bottom: 20px;
}
+#control_details .proplist-col dd{
+ margin-bottom: 1em;
+}
+
.help_text {
background: none repeat scroll 0 0 #CCDBED;
display: none;
@@ -1815,6 +1824,14 @@
padding: 10px;
}
+#frm_save_control_groups .itemlist {
+ margin-bottom: 1em;
+}
+
+#frm_save_control_groups .itemlist li{
+ margin-bottom: 0.5em;
+}
+
ul.control_groups li ul {
margin-left: 1em;
}
@@ -1936,4 +1953,4 @@
p.no_items_msg {
padding: 5px;
-}
\ No newline at end of file
+}
Modified: branches/Version-1_0-branch/controller/templates/base/datatable.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/datatable.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/controller/templates/base/datatable.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -19,7 +19,7 @@
<xsl:template name="datatable">
<iframe id="yui-history-iframe"
src="phpgwapi/js/yahoo/history/assets/blank.html"></iframe>
<input id="yui-history-field" type="hidden"/>
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
<xsl:apply-templates select="form" />
<xsl:apply-templates select="paging"/>
<div id="list_flash">
Modified:
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -3,7 +3,7 @@
<xsl:template name="view_procedure" xmlns:php="http://php.net/xsl">
-<xsl:call-template name="yui_booking_i18n"/>
+<xsl:call-template name="yui_phpgw_i18n"/>
<xsl:variable name="dateformat"><xsl:value-of select="dateformat"
/></xsl:variable>
<div class="yui-content">
Modified:
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -2,7 +2,7 @@
<!-- separate tabs and inline tables-->
<xsl:template match="data" xmlns:php="http://php.net/xsl">
-<xsl:call-template name="yui_booking_i18n"/>
+<xsl:call-template name="yui_phpgw_i18n"/>
<div class="yui-navset yui-navset-top" id="procedure_tabview">
<xsl:choose>
<xsl:when test="view = 'view_procedure'">
@@ -29,4 +29,4 @@
</xsl:choose>
</div>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/view_component_for_control.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/view_component_for_control.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/view_component_for_control.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -77,7 +77,7 @@
<input id="yui-history-field" type="hidden"/>
<xsl:apply-templates select="locations_table"/>
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
</div>
</div>
</xsl:template>
Modified:
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
2012-06-19 10:15:48 UTC (rev 9624)
+++
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
2012-06-19 10:23:39 UTC (rev 9625)
@@ -74,7 +74,7 @@
<input id="yui-history-field" type="hidden"/>
<xsl:apply-templates select="locations_table"/>
- <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:call-template name="yui_phpgw_i18n"/>
</div>
</div>
</xsl:template>
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.jquery.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.jquery.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -65,6 +65,23 @@
$load =
array("js/jquery-1.7.2{$_type}", "js/jquery-ui-1.8.19.custom{$_type}",
"development-bundle/ui/i18n/jquery.ui.datepicker-{$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']}");
break;
+ case 'autocomplete':
+/*
+ $load = array
+ (
+ "js/jquery-1.7.2{$_type}",
+
'development-bundle/ui/minified/jquery.ui.core.min',
+
'development-bundle/ui/minified/jquery.ui.widget.min',
+
'development-bundle/ui/minified/jquery.ui.position.min',
+
'development-bundle/ui/minified/jquery.ui.autocomplete.min'
+ );
+*/
+ $load = array
+ (
+
"js/jquery-ui-1.8.19.custom{$_type}"
+ );
+ break;
+
default:
$err = "Unsupported YUI widget '%1'
supplied to phpgwapi_yui::load_widget()";
trigger_error(lang($err, $widget),
E_USER_WARNING);
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.translation.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.translation.inc.php
2012-06-19 10:15:48 UTC (rev 9624)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.translation.inc.php
2012-06-19 10:23:39 UTC (rev 9625)
@@ -428,7 +428,7 @@
}
}
-
$GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app['name']] =
filectime($appfile);
+
$GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app] =
filectime($appfile);
}
foreach($raw as $app_name => $ids)
Copied: branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php (from
rev 9624, trunk/phpgwapi/inc/class.uicommon.inc.php)
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
(rev 0)
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9625] Merge 9590:9624 from trunk,
Sigurd Nes <=