fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9656] Merge 9625:9655 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9656] Merge 9625:9655 from trunk
Date: Mon, 25 Jun 2012 10:25:30 +0000

Revision: 9656
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9656
Author:   sigurdne
Date:     2012-06-25 10:25:30 +0000 (Mon, 25 Jun 2012)
Log Message:
-----------
Merge 9625:9655 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socommon.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.uicontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_current.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    
branches/Version-1_0-branch/controller/templates/base/calendar/check_list_status_checker.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/check_list/add_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/functions.inc.php
    branches/Version-1_0-branch/property/inc/class.bobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.boentity.inc.php
    branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
    branches/Version-1_0-branch/property/inc/class.boproject.inc.php
    branches/Version-1_0-branch/property/inc/class.botts.inc.php
    branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.menu.inc.php
    branches/Version-1_0-branch/property/inc/class.notify.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
    branches/Version-1_0-branch/registration/js/yahoo/pending.index.js
    branches/Version-1_0-branch/registration/templates/base/pending_users.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/booking/inc/functions.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
    branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js
    branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js
    branches/Version-1_0-branch/phpgwapi/templates/base/datatable_common.xsl

Removed Paths:
-------------
    
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php
    branches/Version-1_0-branch/registration/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/registration/js/yahoo/common.js
    branches/Version-1_0-branch/registration/templates/base/common.xsl

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,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
   + 
/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,9626-9655

Modified: branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php      
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php      
2012-06-25 10:25:30 UTC (rev 9656)
@@ -1,94 +1,7 @@
 <?php
        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 booking_uicommon
        {
                const UI_SESSION_FLASH = 'flash_msgs';
@@ -137,6 +50,17 @@
                        }
                }
                
+
+               /**
+                * Creates an array of translated strings.
+                */
+               function lang_array()
+               {
+                       $keys = func_get_args();
+                       foreach($keys as &$key) $key = lang($key);
+                       return $keys;
+               }
+
                private function get_ui_session_key() {
                        return $this->ui_session_key;
                }
@@ -348,9 +272,9 @@
                                                        
                        $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')),
+                                       'WEEKDAYS_SHORT' => 
json_encode($this->lang_array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa')),
+                                       'WEEKDAYS_FULL' => 
json_encode($this->lang_array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 
'Thursday', 'Friday', 'Saturday')),
+                                       'MONTHS_LONG' => 
json_encode($this->lang_array('January', 'February', 'March', 'April', 'May', 
'June', 'July', 'August', 'September', 'October', 'November', 'December')),
                                ),
                                'DataTable' => array(
                                        'MSG_EMPTY' => json_encode(lang('No 
records found.')),

Copied: branches/Version-1_0-branch/booking/inc/functions.inc.php (from rev 
9655, trunk/booking/inc/functions.inc.php)
===================================================================
--- branches/Version-1_0-branch/booking/inc/functions.inc.php                   
        (rev 0)
+++ branches/Version-1_0-branch/booking/inc/functions.inc.php   2012-06-25 
10:25:30 UTC (rev 9656)
@@ -0,0 +1,76 @@
+<?php
+       /**
+       * @package booking
+       * @subpackage utilities
+       * @version $Id: functions.inc.php 9188 2012-04-19 20:13:58Z sigurdne $
+       */
+
+       /**
+        * 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;
+       }
+
+

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-06-25 10:25:30 UTC (rev 9656)
@@ -53,7 +53,7 @@
        
        public function get_single($check_list_id){
                $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date, "; 
-               $sql .= "completed_date, location_code, component_id, 
num_open_cases, num_pending_cases, ci.id as ci_id, control_item_id, "; 
+               $sql .= "completed_date, location_code, component_id, 
num_open_cases, num_pending_cases, location_id, ci.id as ci_id, 
control_item_id, "; 
                $sql .= "check_list_id "; 
                $sql .= "FROM controller_check_list cl ";
                $sql .= "LEFT JOIN controller_check_item as ci ON cl.id = 
ci.check_list_id ";
@@ -75,6 +75,7 @@
                                
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int'));
                                
$check_list->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$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_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'));   
                        }
@@ -507,7 +508,7 @@
        */
        
        // 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 ){
+       function get_check_lists_for_location_2( $location_code, $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 as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases, num_pending_cases "; 
@@ -515,8 +516,8 @@
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
                $sql .= "WHERE cl.location_code = '{$location_code}' ";
                
-               if( is_numeric($repeat_type) )
-                       $sql .= "AND c.repeat_type = $repeat_type ";
+               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;";
@@ -810,6 +811,7 @@
                        
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
                        
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
                        
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
+                       
$control->set_location_id($this->unmarshal($this->db->f('location_id', true), 
'string'));
                        
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                        
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
                }
@@ -821,33 +823,34 @@
        {
                $cols = array(
                                'control_id',
-                               'status',
                                'comment',
                                'deadline',
                                'planned_date',
                                'completed_date',
+                               'component_id',
                                'location_code',
-                               'component_id',
                                'num_open_cases',
-                               'num_pending_cases'
+                               'num_pending_cases',
+                               'location_id',
+                               'status'
                );
-               
-               
+                               
                $values = array(
                        $this->marshal($check_list->get_control_id(), 'int'),
-                       $check_list->get_status(),
                        $this->marshal($check_list->get_comment(), 'string'),
                        $this->marshal($check_list->get_deadline(), 'int'),
                        $this->marshal($check_list->get_planned_date(), 'int'),
                        $this->marshal($check_list->get_completed_date(), 
'int'),
+                       $this->marshal($check_list->get_component_id(), 'int'),
                        $this->marshal($check_list->get_location_code(), 
'string'),
-                       $this->marshal($check_list->get_component_id(), 'int'),
                        $this->marshal($check_list->get_num_open_cases(), 
'int'),
-                       $this->marshal($check_list->get_num_pending_cases(), 
'int')
+                       $this->marshal($check_list->get_num_pending_cases(), 
'int'),
+                       $this->marshal($check_list->get_location_id(), 'int'),
+                       $check_list->get_status()
                );
                
                $result = $this->db->query('INSERT INTO controller_check_list 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
-
+                       
                return isset($result) ? 
$this->db->get_last_insert_id('controller_check_list', 'id') : 0;
        }
        
@@ -864,6 +867,7 @@
                        'completed_date = ' . 
$this->marshal($check_list->get_completed_date(), 'int'),
                        'location_code = ' . 
$this->marshal($check_list->get_location_code(), 'string'),
                        'component_id = ' . 
$this->marshal($check_list->get_component_id(), 'int'),
+                       'location_id = ' . 
$this->marshal($check_list->get_location_id(), 'int'),
                        'num_open_cases = ' . 
$this->marshal($check_list->get_num_open_cases(), 'int'),
                        'num_pending_cases = ' . 
$this->marshal($check_list->get_num_pending_cases(), 'int')
                );

Modified: branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2012-06-25 10:25:30 UTC (rev 9656)
@@ -71,6 +71,10 @@
                        {
                                return $this->db->db_addslashes($value);
                        }
+                       else if($type == 'string' & $value == '')
+                       {
+                               return 'NULL';
+                       }
 
                        return "'" . $this->db->db_addslashes($value) . "'";
                }

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-06-25 10:25:30 UTC (rev 9656)
@@ -228,13 +228,15 @@
                        }
                }
                
-               public function get_controls_by_component($location_code, 
$from_date, $to_date, $repeat_type = null, $return_type = "return_object")
+               public function get_controls_by_component($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.*, ";
                        $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  .= "cast(xpath('*/text()', xml_representation) 
as text[]) AS xml ";
+                       //$sql  .= "xpath('/', bim_item.xml_representation) as 
xml ";
+                       $sql  .= "bim_item.xml_representation as xml, 
cl.location_id ";
                        $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 ";
@@ -242,10 +244,13 @@
                        $sql  .= "AND bim_item.type = bim_type.id ";
                        $sql  .= "AND bim_item.location_code LIKE 
'$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) ";
                        
@@ -271,6 +276,7 @@
                                        $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_location_id($this->unmarshal($this->db->f('location_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'));

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-06-25 10:25:30 UTC (rev 9656)
@@ -124,6 +124,27 @@
                                $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $calendar_array);
                        }
                        
+                       // 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){
+                           // 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);
+                       }
+                       
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                
                        $property_array = 
execMethod('property.solocation.read', array('type_id' => 1, 'allrows' => 
true));
@@ -133,6 +154,8 @@
                        
                        $heading_array = 
month_calendar::get_heading_array($year, $month);
                        
+                       $roles_array = $this->so_control->get_roles();
+                       
                        $data = array
                        (               
                                'buildings_on_property'         => 
$buildings_on_property,
@@ -145,6 +168,7 @@
                                'current_year'                                  
=> $year,
                                'current_month_nr'                      => 
$month,
                                'location_level'                                
=> $level,
+                               'roles_array'                                   
        => $roles_array,
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -161,6 +185,8 @@
                {
                        $location_code = phpgw::get_var('location_code');
                        $year = phpgw::get_var('year');
+                       $role = phpgw::get_var('role');
+                       $repeat_type = phpgw::get_var('repeat_type');
                        
                        // Validates year. If year is not set, current year is 
chosen
                        $year = $this->validate_year($year);
@@ -185,10 +211,10 @@
       $buildings_on_property = $this->get_buildings_on_property($user_role, 
$location_code, $level);
                        
                        // 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);
+                       $controls_for_location_array = 
$this->so_control->get_controls_by_location($location_code, $from_date_ts, 
$to_date_ts, $repeat_type, "return_object", $role);
                        
                        // 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);
+                       $components_with_controls_array = 
$this->so_control->get_controls_by_component($location_code, $from_date_ts, 
$to_date_ts, $repeat_type, "return_object", $role);
                
                        $controls_calendar_array = array();
                        
@@ -211,24 +237,17 @@
                                }
                        }
                        
-                       $repeat_type = 2;
+                       $repeat_type_expr = ">=2";
                        // Fetches control ids with check lists for specified 
time period
-                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
+                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr);
                        
                        // Loops through all controls for location and 
populates controls with check lists
                        $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
                        
-                       $repeat_type = 3;
-                       // Fetches control ids with check lists for specified 
time period
-                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
-                       
-                       // Loops through all controls for location and 
populates controls with check lists
-                       $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
-
                        foreach($controls_for_location_array as $control){
                                if($control->get_repeat_type() == 2 | 
$control->get_repeat_type() == 3){
                                        
-                                       $year_calendar = new 
year_calendar($control, $year);
+                                       $year_calendar = new 
year_calendar($control, $year, null, $location_code, "location" );
                                        $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
                                                                                
        
                                        $controls_calendar_array[] = 
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
@@ -238,11 +257,31 @@
                        // COMPONENTS
                        foreach($components_with_controls_array as $component){
                                
+                               //$location_id = 2295; //Eksempel: Valglokaler
+                               
+                               $location_id = $component->get_location_id();
+                               echo " location_id: " . $location_id;
+                               $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $filters = array("short_description" => "IS NOT 
NULL");
+                               $attributes['attributes'] = 
$GLOBALS['phpgw']->custom_fields->find($system_location['appname'],$system_location['location'],
 0, '', 'ASC', 'attrib_sort', true, true);
+                       
+                               print_r( $attributes['attributes'][1] );
+                       
+                               $fields['attributes']= $attributes[0][0];
+                               //print_r($fields);
+                               $params = array
+                               (
+                                       'location_id' => $component->get_type(),
+                                       'id' => $component->get_id()
+                               );
+                       
+                               $prop_array = 
execMethod('property.soentity.read_single_eav', $params, $attributes);
+                               //print_r($prop_array);
+
                                $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() );
@@ -261,18 +300,17 @@
 
                                                // 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");
+
+                                               $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
@@ -280,6 +318,14 @@
                        
                        $heading_array = year_calendar::get_heading_array();
                        
+                       $roles_array = $this->so_control->get_roles();
+                       $repeat_type_array = array(
+                                                                       
array('id'      => "0", 'value' => "Dag"),
+                                                                       
array('id'      => "1", 'value' => "Uke"),
+                                                                       
array('id'      => "2", 'value' => "Måned"),
+                                                                       
array('id'      => "3", 'value' => "År")
+                                                               );
+                                                               
                        $data = array
                        (
                                'buildings_on_property'                 => 
$buildings_on_property,
@@ -291,6 +337,8 @@
                                'date_format'                                   
        => $date_format,
                                'current_year'                                  
        => $year,
                                'location_level'                                
        => $level,
+                               'roles_array'                                   
                => $roles_array,
+                               'repeat_type_array'                             
=> $repeat_type_array
                        );
                        
                        
self::render_template_xsl(array('calendar/view_calendar_year', 
'calendar/check_list_status_checker', 

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-06-25 10:25:30 UTC (rev 9656)
@@ -36,7 +36,7 @@
        phpgw::import_class('controller.socontrol');
        
        include_class('controller', 'check_item_case', 'inc/model/');
-       include_class('controller', 'status_checker', 'inc/helper/');
+       include_class('controller', 'check_list_status_updater', 'inc/helper/');
                        
        class controller_uicase extends phpgwapi_uicommon
        {
@@ -133,8 +133,8 @@
                        $case_id = $this->so->store($case);
                        
                        if($case_id > 0){
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );
+                               $cl_status_updater = new 
check_list_status_updater();
+                               $cl_status_updater->update_check_list_status( 
$check_list_id );
                                                
                                return json_encode( array( "status" => "saved" 
) );
                        }
@@ -162,8 +162,8 @@
                        $case = $this->so->get_single($case_id);
                        
                        if($case_id > 0){
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );
+                               $cl_status_updater = new 
check_list_status_updater();
+                               $cl_status_updater->update_check_list_status( 
$check_list_id );
                                                
                                $check_item = 
$this->so_check_item->get_single($case->get_check_item_id());
                                $control_item = 
$this->so_control_item->get_single($check_item->get_control_item_id());
@@ -376,8 +376,8 @@
                                $check_list_id = 
$check_item->get_check_list_id(); 
                                
                                // Updates number of open cases for check list 
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );    
+                               $cl_status_updater = new 
check_list_status_updater();
+                               $cl_status_updater->update_check_list_status( 
$check_list_id ); 
                        }
                }
                
@@ -389,8 +389,8 @@
                        $status = $this->so->delete($case_id);
                
                        if($status){
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );
+                               $cl_status_updater = new 
check_list_status_updater();
+                               $cl_status_updater->update_check_list_status( 
$check_list_id );
                                                
                                return json_encode( array( "status" => 
"deleted" ) );
                        }
@@ -410,8 +410,8 @@
                        $case_id = $this->so->store($case);
                                        
                        if($case_id > 0){
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );
+                               $cl_status_updater = new 
check_list_status_updater();
+                               $cl_status_updater->update_check_list_status( 
$check_list_id );
                                                
                                return json_encode( array( "status" => "true" ) 
);
                        }
@@ -431,8 +431,8 @@
                        $case_id = $this->so->store($case);
                                        
                        if($case_id > 0){
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );
+                               $cl_status_updater = new 
check_list_status_updater();
+                               $cl_status_updater->update_check_list_status( 
$check_list_id );
                                                
                                return json_encode( array( "status" => "true" ) 
);
                        }

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-06-25 10:25:30 UTC (rev 9656)
@@ -36,7 +36,7 @@
        include_class('controller', 'check_list', 'inc/model/');
        include_class('controller', 'check_item', 'inc/model/');
        include_class('controller', 'date_generator', 'inc/component/');
-       include_class('controller', 'status_checker', 'inc/helper/');
+       include_class('controller', 'check_list_status_updater', 'inc/helper/');
        include_class('controller', 'date_helper', 'inc/helper/');
        
        class controller_uicheck_list extends phpgwapi_uicommon
@@ -191,44 +191,34 @@
                 * @return data array
                */
                function add_check_list(){
-                       $location_code = phpgw::get_var('location_code');
+                       $type = phpgw::get_var('type');
                        $control_id = phpgw::get_var('control_id');
-                       $date = phpgw::get_var('date');
+                       $deadline_ts = phpgw::get_var('deadline_ts');
                        
+                       $check_list = new controller_check_list();
+                       $check_list->set_control_id($control_id);
+                       $check_list->set_deadline($deadline_ts);
+                       
+                       if($type == "component"){
+                               $location_id = phpgw::get_var('location_id');
+                               $check_list->set_location_id($location_id);
+                               $component_id = phpgw::get_var('component_id');
+                               $check_list->set_component_id($component_id);
+                       }else{
+                               $location_code = 
phpgw::get_var('location_code');       
+                       }
+                       
                        $control = $this->so_control->get_single($control_id);
                        
-                       if($date == null || $date == ''){
-                               $todays_date = mktime(0,0,0, date("m"), 
date("d"), date("Y"));
-                               $period_start_date = $todays_date;
-                               
-                               if( $control->get_repeat_type() == 1 )
-                               {
-                                       $period_end_date = mktime(0,0,0, 
date("m")+1, date("d"), date("Y"));
-                               }else if( $control->get_repeat_type() == 2 )
-                               {
-                                       $period_end_date = mktime(0,0,0, 
date("m"), date("d"), date("Y") + 1);
-                               }else if( $control->get_repeat_type() == 3 )
-                               {
-                                       $period_end_date = mktime(0,0,0, 
date("m"), date("d"), date("Y") + $control->get_repeat_interval());             
               
-                               }
-                               
-                               $date_generator = new 
date_generator($control->get_start_date(), $control->get_end_date(), 
$period_start_date, $period_end_date, $control->get_repeat_type(), 
$control->get_repeat_interval());
-                                                       
-                               $calendar_array = $date_generator->get_dates();
-                       }
-                       else
-                       {
-                               $calendar_array[] = $date;
-                       }                       
-
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $data = array
                        (
                                'location_array'        => $location_array,
-                               'control'                       => 
$control->toArray(),
-                               'deadline'                      => 
$calendar_array[0],
-                               'date_format'           => $date_format         
        
+                               'control'                                       
=> $control->toArray(),
+                               'date_format'           => $date_format,
+                               'check_list'                    => 
$check_list->toArray(),
+                               'type'                                          
=> $type
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -248,25 +238,28 @@
                 * @return data array
                */
                function save_check_list(){
-                       $location_code = phpgw::get_var('location_code');
                        $control_id = phpgw::get_var('control_id');
                        $status = (int)phpgw::get_var('status');
-
+                       $type = phpgw::get_var('type');
                        $deadline_date = phpgw::get_var('deadline_date', 
'string');
                        $planned_date = phpgw::get_var('planned_date', 
'string');
                        $completed_date = phpgw::get_var('completed_date', 
'string');
+                       $comment = phpgw::get_var('comment', 'string');
                        
-                       $comment = phpgw::get_var('comment', 'string');
-                                                       
-                       if($planned_date != '')
+                       $deadline_date_ts = 
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
+                       
+                       if($planned_date != ''){
                                $planned_date_ts = 
date_helper::get_timestamp_from_date( $planned_date, "d/m-Y" );
-
-                       if($deadline_date != '')
-                               $deadline_date_ts = 
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
+                       }else{
+                               $planned_date_ts = 0;
+                       } 
                        
-                       if($completed_date != '')
+                       if($completed_date != ''){
                                $completed_date_ts = 
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
-                       
+                       }else{
+                               $completed_date_ts = 0;
+                       }               
+
                        $check_list = new controller_check_list();
                        $check_list->set_location_code($location_code);
                        $check_list->set_control_id($control_id);
@@ -276,9 +269,21 @@
                        $check_list->set_planned_date($planned_date_ts);
                        $check_list->set_completed_date($completed_date_ts);
                        
+                       if($type == "component"){
+                               $location_id = phpgw::get_var('location_id');
+                               $component_id = phpgw::get_var('component_id');
+                               $check_list->set_location_id( $location_id );
+                               $check_list->set_component_id( $component_id );
+                       }else {
+                               $location_code = 
phpgw::get_var('location_code');
+                               $check_list->set_location_code( $location_code 
);
+                       }
+                       
                        $check_list_id = $this->so->store($check_list);
                        
-                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));
+                       if( $check_list_id > 0 ){
+                               $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));   
  
+                       }
                }
                
                /**
@@ -290,22 +295,28 @@
                function edit_check_list(){
                        $check_list_id = phpgw::get_var('check_list_id');
 
-                       $status_checker = new status_checker();
-                       $status_checker->update_check_list_status( 
$check_list_id );
-                               
+                       $cl_status_updater = new check_list_status_updater();
+                       $cl_status_updater->update_check_list_status( 
$check_list_id );
+               
                        $check_list = $this->so->get_single($check_list_id);
-                       
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                        
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $location_code = $check_list->get_location_code();
+                       
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0){
+                               
+                       }else{
+                               $location_code = 
$check_list->get_location_code();
        
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                                               
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));      
+                       }
+                       
                        $data = array
                        (
-                               'control'                       => 
$control->toArray(),
-                               'check_list'            => 
$check_list->toArray(),
+                               'control'                               => 
$control->toArray(),
+                               'check_list'                    => 
$check_list->toArray(),
                                'location_array'        => $location_array,
                                'date_format'           => $date_format
                        );

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2012-06-25 10:25:30 UTC (rev 9656)
@@ -118,7 +118,13 @@
                                                                'type' => 
'link',
                                                                'value' => 
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
                                                                'href' => 
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
-                                                       )
+                                                       ),
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('New control group'),
+                                                               'href' => 
self::link(array('menuaction' => 'controller.uicontrol_group.add')),
+                                                               'class' => 
'new_item'
+                                                       ),
                                                ),
                                        ),
                                ),

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2012-06-25 10:25:30 UTC (rev 9656)
@@ -123,7 +123,13 @@
                                                                'type' => 
'submit',
                                                                'name' => 
'search',
                                                                'value' => 
lang('Search')
-                                                       )
+                                                       ),
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('New control item'),
+                                                               'href' => 
self::link(array('menuaction' => 'controller.uicontrol_item.add')),
+                                                               'class' => 
'new_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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php 
2012-06-25 10:25:30 UTC (rev 9656)
@@ -41,7 +41,7 @@
        
        include_class('controller', 'check_list', 'inc/model/');
        include_class('controller', 'date_generator', 'inc/component/');
-       include_class('controller', 'status_checker', 'inc/helper/');
+       include_class('controller', 'check_list_status_updater', 'inc/helper/');
        include_class('controller', 'date_helper', 'inc/helper/');
                
        class controller_uicontrol_location extends phpgwapi_uicommon

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-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
    2012-06-25 10:25:30 UTC (rev 9656)
@@ -1,8 +1,10 @@
 <?php
 phpgw::import_class('controller.socheck_list');
 include_class('controller', 'date_generator', 'inc/component/');
+include_class('controller', 'date_generator', 'inc/component/');
 include_class('controller', 'check_list_status_info', 'inc/helper/');
 include_class('controller', 'check_list_status_manager', 'inc/helper/');
+include_class('controller', 'check_list', 'inc/model/');
        
 
 class year_calendar {
@@ -26,8 +28,7 @@
                
   /* 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
-   */ 
+   *   - CONTROL_REGISTERED if month date is in the future */ 
        function init_calendar(){
     for($i = 1;$i <= 12;$i++){
                  $this->calendar_array[$i] = null;
@@ -45,43 +46,38 @@
                
     // Inserts dates 
     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_ts) ]["status"]  = $status;
+       $check_list = new controller_check_list();
+       $check_list->set_deadline( $date_ts );
+       $check_list->set_control_id( $this->control->get_id() );
+       
+       if($this->type == "component"){
+               $check_list->set_component_id( $this->component->get_id() );
+               $check_list->set_location_id( $this->component->get_type() );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "component" );
+       }else {
+               $check_list->set_location_code( $this->location_code );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "location" );
+       } 
+       
+                       $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
+       
+                       $month_nr = date("n", $date_ts);
       
-      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 
-                                                                               
                                                                                
                                                                                
                );
-      }
+      $this->calendar_array[ $month_nr ]["status"] = 
$check_list_status_info->get_status();
+      $this->calendar_array[ $month_nr ]["info"]   = 
$check_list_status_info->serialize();
                }
        }
        
        public function build_calendar( $check_lists_array ){
                
                foreach($check_lists_array as $check_list){
-                                                               
                        $check_list_status_manager = new 
check_list_status_manager( $check_list );
                        $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
-                                                       
-                       $this->calendar_array[ date("n", 
$check_list_status_info->get_deadline_date_ts()) ]["status"]  = 
$check_list_status_info->get_status();
-                       $this->calendar_array[ date("n", 
$check_list_status_info->get_deadline_date_ts()) ]["info"]  = 
$check_list_status_info->serialize();
+
+                       $month_nr = date("n", 
$check_list_status_info->get_deadline_date_ts());
+                       
+                       $this->calendar_array[ $month_nr ]["status"] = 
$check_list_status_info->get_status();
+                       $this->calendar_array[ $month_nr ]["info"]   = 
$check_list_status_info->serialize();
                }
                
                return $this->calendar_array;
@@ -92,7 +88,7 @@
                foreach($agg_open_cases_pr_month_array as 
$status_agg_month_info)
                {
                        $status = "CONTROLS_DONE_WITH_ERRORS";
-                                       
+                       
                        
$this->calendar_array[$status_agg_month_info->get_month_nr()]["status"] = 
$status;
                        
$this->calendar_array[$status_agg_month_info->get_month_nr()]["info"]["agg_open_errors"]
 = $status_agg_month_info->get_agg_open_cases();
                }
@@ -111,11 +107,6 @@
                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");
                        

Modified: 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
      2012-06-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_info.inc.php
      2012-06-25 10:25:30 UTC (rev 9656)
@@ -31,12 +31,16 @@
        class check_list_status_info
        {               
                private $check_list_id;
+               private $control_id;
                private $status;
                private $status_text;
                private $deadline_date_ts;
                private $deadline_date_txt;
                private $info_text;
                private $location_code;
+               private $component_id;
+               private $location_id;
+               private $type;
                private $num_open_cases;
                        
                public function __construct(){}
@@ -48,6 +52,13 @@
                
                public function get_check_list_id() { return 
$this->check_list_id; }
                
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
                public function set_status($status)
                {
                        $this->status = $status;
@@ -90,6 +101,27 @@
                
                public function get_location_code() { return 
$this->location_code; }
                
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_id() { return $this->location_id; }
+               
+               public function set_component_id($component_id)
+               {
+                       $this->component_id = $component_id;
+               }
+               
+               public function get_component_id() { return 
$this->component_id; }
+               
+               public function get_type() { return $this->type; }
+               
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+               
                public function set_num_open_cases($num_open_cases)
                {
                        $this->num_open_cases = $num_open_cases;
@@ -102,12 +134,16 @@
                {
                        return array(
                                'check_list_id' => $this->get_check_list_id(),
+                               'control_id' => $this->get_control_id(),
                                'status' => $this->get_status(),
                                'status_text' => $this->get_status_text(),
                                'deadline_date_ts' => 
$this->get_deadline_date_ts(),
                                'deadline_date_txt' => 
$this->get_deadline_date_txt(),
                                'info_text' => $this->get_info_text(),
                                'location_code' => $this->get_location_code(),
+                               'location_id' => $this->get_location_id(),
+                               'component_id' => $this->get_component_id(),
+                               'type' => $this->get_type(),
                                'num_open_cases' => $this->get_num_open_cases()
                        );
                }

Modified: 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
   2012-06-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
   2012-06-25 10:25:30 UTC (rev 9656)
@@ -33,54 +33,79 @@
        class check_list_status_manager
        {               
                private $check_list;
-               
-               public function __construct($check_list){
-                       $this->check_list = $check_list;
+               private $type;
+                                               
+               public function __construct($check_list, $type) {
+                       $this->check_list               = $check_list;
+       $this->type                                     = $type;
                }
                
-               function get_status_for_check_list(){
-               
+               function get_status_for_check_list() {
                        $check_list_status_info = new check_list_status_info();
-                       $check_list_status_info->set_check_list_id( 
$this->check_list->get_id() );
-       
-                       $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
+                               
+                       $todays_date_ts = $this->get_todays_date_ts();
                        
-                       // Control PLANNED - the checklist has a planned date
-                       if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
-                       {
-                               $status = "CONTROL_PLANNED";
+                       if( $this->check_list->get_id() == 0){
+                               
+                               if($this->check_list->get_deadline() < 
$todays_date_ts){
+               $status = "CONTROL_NOT_DONE";
+             }else{
+               $status = "CONTROL_REGISTERED";
+             }
+                       }else {
+                               if($this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
+                               {
+                                       $status = "CONTROL_PLANNED";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() < 
$todays_date_ts )
+                               {
+                                       $status = 
"CONTROL_NOT_DONE_WITH_CHECKLIST";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() < $todays_date_ts )
+                               {
+                                       $status = 
"CONTROL_NOT_DONE_WITH_PLANNED_DATE";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() > 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
+                               {
+                                       $status = 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() < 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
+                               {
+                                       $status = 
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() > 
0){
+                                       $status = "CONTROL_DONE_WITH_ERRORS";
+                                       
+                                       
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CANCELED)
+                               {
+                                       $status = "CONTROL_CANCELED";
+                               }
+                               
+                               $check_list_status_info->set_check_list_id( 
$this->check_list->get_id() );
                        }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() < $todays_date_ts )
-                       {
-                               $status = "CONTROL_NOT_DONE_WITH_PLANNED_DATE";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() < 
$todays_date_ts )
-                       {
-                               $status = "CONTROL_NOT_DONE";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() > 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
-                       {
-                               $status = 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() < 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
-                       {
-                               $status = "CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() > 
0){
-                               $status = "CONTROL_DONE_WITH_ERRORS";
-                               
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CANCELED)
-                       {
-                               $status = "CONTROL_CANCELED";
-                       }
                        
-                       
+                       $check_list_status_info->set_control_id( 
$this->check_list->get_control_id() );
                        $check_list_status_info->set_deadline_date_txt( 
date("d/m-Y", $this->check_list->get_deadline()) );
                        $check_list_status_info->set_deadline_date_ts( 
$this->check_list->get_deadline() );
-                       $check_list_status_info->set_location_code( 
$this->check_list->get_location_code() );
+                       $check_list_status_info->set_type( $this->type );
+                       
+                       if($this->type == "component"){
+                               $check_list_status_info->set_component_id( 
$this->check_list->get_component_id() );
+                               $check_list_status_info->set_location_id( 
$this->check_list->get_location_id() );
+                       }else {
+                               $check_list_status_info->set_location_code( 
$this->check_list->get_location_code() );
+                       }
+                       
                        $check_list_status_info->set_status($status);
-               
+                       
                        return $check_list_status_info; 
                }
+               
+               public static function get_todays_date_ts(){
+                 $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
+                 
+                 return $todays_date_ts;
+         }
        }

Copied: 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
 (from rev 9655, 
trunk/controller/inc/helper/class.check_list_status_updater.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
                           (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_updater.inc.php
   2012-06-25 10:25:30 UTC (rev 9656)
@@ -0,0 +1,47 @@
+<?php
+       phpgw::import_class('controller.socheck_list');
+       phpgw::import_class('controller.socheck_item');
+       
+       include_class('controller', 'check_list', 'inc/model/');
+       include_class('controller', 'check_item', 'inc/model/');
+
+       class check_list_status_updater {
+               
+               public function __construct()
+               {
+                       $this->so_check_list = 
CreateObject('controller.socheck_list');
+                       $this->so_check_item = 
CreateObject('controller.socheck_item');
+               }
+                       
+               public function update_check_list_status( $check_list_id )
+               {
+                       $check_list = $this->so_check_list->get_single( 
$check_list_id );
+               
+                       $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
$control_item_type = null, $status = null, $messageStatus = null, 
"return_object");
+               
+                       $num_open_cases = 0;
+                       $num_pending_cases = 0;
+                                       
+                       foreach($check_items as $check_item){
+                               
+                               foreach($check_item->get_cases_array() as 
$case){
+                                       
+                                       if($case->get_status() == 
controller_check_item_case::STATUS_OPEN){
+                                               $num_open_cases++;
+                                       }
+                                       
+                                       if($case->get_status() == 
controller_check_item_case::STATUS_PENDING){
+                                               $num_pending_cases++;
+                                       }
+                               }       
+                       }
+                       
+                       if($num_open_cases > 0)
+                               
$check_list->set_status(controller_check_list::STATUS_DONE);
+                               
+                       $check_list->set_num_open_cases($num_open_cases);
+                       $check_list->set_num_pending_cases($num_pending_cases);
+                       
+                       $this->so_check_list->store($check_list);
+               }
+}
\ No newline at end of file

Deleted: 
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php  
    2012-06-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php  
    2012-06-25 10:25:30 UTC (rev 9656)
@@ -1,47 +0,0 @@
-<?php
-       phpgw::import_class('controller.socheck_list');
-       phpgw::import_class('controller.socheck_item');
-       
-       include_class('controller', 'check_list', 'inc/model/');
-       include_class('controller', 'check_item', 'inc/model/');
-
-       class status_checker {
-               
-               public function __construct()
-               {
-                       $this->so_check_list = 
CreateObject('controller.socheck_list');
-                       $this->so_check_item = 
CreateObject('controller.socheck_item');
-               }
-                       
-               public function update_check_list_status( $check_list_id )
-               {
-                       $check_list = $this->so_check_list->get_single( 
$check_list_id );
-               
-                       $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
$control_item_type = null, $status = null, $messageStatus = null, 
"return_object");
-               
-                       $num_open_cases = 0;
-                       $num_pending_cases = 0;
-                                       
-                       foreach($check_items as $check_item){
-                               
-                               foreach($check_item->get_cases_array() as 
$case){
-                                       
-                                       if($case->get_status() == 
controller_check_item_case::STATUS_OPEN){
-                                               $num_open_cases++;
-                                       }
-                                       
-                                       if($case->get_status() == 
controller_check_item_case::STATUS_PENDING){
-                                               $num_pending_cases++;
-                                       }
-                               }       
-                       }
-                       
-                       if($num_open_cases > 0)
-                               
$check_list->set_status(controller_check_list::STATUS_DONE);
-                               
-                       $check_list->set_num_open_cases($num_open_cases);
-                       $check_list->set_num_pending_cases($num_pending_cases);
-                       
-                       $this->so_check_list->store($check_list);
-               }
-}
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.component.inc.php    
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/inc/model/class.component.inc.php    
2012-06-25 10:25:30 UTC (rev 9656)
@@ -35,8 +35,11 @@
        {
                protected $type;
                protected $id;
+               protected $location_id;
                protected $guid;
                protected $xml;
+               // Not a table column
+               protected $xml_short_desc;
                protected $location_code;
                protected $loc_1;
                protected $address;
@@ -65,6 +68,13 @@
                
                public function get_id() { return $this->id; }
                
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_id() { return $this->location_id; }
+               
                public function set_guid($guid)
                {
                        $this->guid = $guid;

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-06-25 10:25:30 UTC (rev 9656)
@@ -6,7 +6,6 @@
                
        }
        
-       
        /* ================================  SEARCH LOCATION BOX  
========================== */
        
        // Changes location level between building and property in serch 
location select box
@@ -50,6 +49,22 @@
                 window.location.href = requestUrl;
     });
        
+       $("#filter-repeat_type").change(function () {
+      var repeat_type = $(this).val();
+         var thisForm = $(this).closest("form");
+                
+         $(thisForm).find("input[name=repeat_type]").val(repeat_type);
+         $(thisForm).submit();
+       });
+       
+       $("#filter-role").change(function () {
+         var role = $(this).val();
+         var thisForm = $(this).closest("form");
+               
+         $(thisForm).find("input[name=role]").val(role);
+         $(thisForm).submit();
+       });
+       
        /* ================================  CONTROL LOCATION 
================================== */
        
        // Update location category based on location type
@@ -374,6 +389,12 @@
                var control_item_type = $(this).find("input[type=radio]").val();
                
                if(control_item_type == "control_item_type_3" | 
control_item_type == "control_item_type_4"){
+                       if(control_item_type == "control_item_type_3"){
+                         
$("#add_control_item_option_panel").find(".type").text("Nedtrekksliste");     
+                       }else{
+                         
$("#add_control_item_option_panel").find(".type").text("Radioknapper");
+                       }
+                       
                        $("#add_control_item_option_panel").slideDown(500);
                }else if(control_item_type == "control_item_type_1" | 
control_item_type == "control_item_type_2"){
                        $("#add_control_item_option_panel").slideUp(500);
@@ -511,7 +532,6 @@
        
        // ADD CHECKLIST
        $("#frm_add_check_list").live("submit", function(e){
-               
                var thisForm = $(this);
                var statusFieldVal = $("#status").val();
                var completedDateVal = $("#completed_date").val();

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-06-25 
10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-06-25 
10:25:30 UTC (rev 9656)
@@ -8,7 +8,7 @@
 control_item_type_1    controller      no      Ved innskriving av kommentar i 
et kommentarfelt
 control_item_type_2    controller      no      Ved innskriving av måling i et 
tekstfelt
 control_item_type_3    controller      no      Ved valg av verdi fra 
nedtrekksliste
-control_item_type_4    controller      no      Ved valg av verdi fra 
Radioknapper
+control_item_type_4    controller      no      Ved valg av verdi fra 
radioknapper
 control_helptext       controller      no      Her kommer hjelpetekst for å 
opprette en kontroll
 Check_list     controller      no      Sjekkliste
 Calendar_overview      controller      no      Kontrollplan

Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-06-25 
10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-06-25 
10:25:30 UTC (rev 9656)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.38';
+       $setup_info['controller']['version'] = '0.1.39';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-06-25 10:25:30 UTC (rev 9656)
@@ -64,13 +64,13 @@
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
                                'control_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'status' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'status' => array('type' => 'int','precision' 
=> '2','nullable' => false),
                                'comment' => array('type' => 'text', 'nullable' 
=> True),
                                'deadline' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'planned_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'completed_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'component_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'location_code' => array('type' => 'varchar', 
'precision' => 30, 'nullable' => false),
+                               'location_code' => array('type' => 'varchar', 
'precision' => 30, 'nullable' => True),
                                'location_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
                                'num_open_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'num_pending_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)

Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-06-25 10:25:30 UTC (rev 9656)
@@ -732,4 +732,59 @@
                                
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.38';
                return $GLOBALS['setup_info']['controller']['currentver'];
-       }
\ No newline at end of file
+       }
+
+       $test[] = '0.1.38';
+       function controller_upgrade0_1_38()
+       {
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $sql = 'SELECT id,status FROM controller_check_list';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               $status_list = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $status_list[] = array
+                       (
+                               'id'            => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'status'        => (int) 
$GLOBALS['phpgw_setup']->oProc->f('status'),
+                       );
+               }
+
+
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_list', array(), 
'status');
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','status',array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => true
+               ));
+
+
+               foreach ($status_list as $entry)
+               {
+                       $sql = "UPDATE controller_check_list SET status = 
{$entry['status']} WHERE id = {$entry['id']} ";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               }
+                               
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','status',array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => false
+               ));
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','location_code',array(
+                       'type' => 'varchar', 
+                       'precision' => '30',
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.39';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }
+       }
+

Modified: 
branches/Version-1_0-branch/controller/templates/base/calendar/check_list_status_checker.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/calendar/check_list_status_checker.xsl
        2012-06-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/check_list_status_checker.xsl
        2012-06-25 10:25:30 UTC (rev 9656)
@@ -9,12 +9,24 @@
                        <a>
                                <xsl:attribute name="href">
                                        
<xsl:text>index.php?menuaction=controller.uicheck_list.add_check_list</xsl:text>
-                                       <xsl:text>&amp;date=</xsl:text>
-                                       <xsl:value-of select="info/date"/>
+                                       <xsl:text>&amp;deadline_ts=</xsl:text>
+                                       <xsl:value-of 
select="info/deadline_date_ts"/>
                                        <xsl:text>&amp;control_id=</xsl:text>
                                        <xsl:value-of select="info/control_id"/>
-                                       <xsl:text>&amp;location_code=</xsl:text>
-                                       <xsl:value-of select="$location_code"/>
+                                       <xsl:text>&amp;type=</xsl:text>
+                                       <xsl:value-of select="info/type"/>
+                                       <xsl:choose>
+                                         <xsl:when test="info/type = 
'component'">
+                                               
<xsl:text>&amp;location_id=</xsl:text>
+                                                       <xsl:value-of 
select="info/location_id"/>
+                                                       
<xsl:text>&amp;component_id=</xsl:text>
+                                                       <xsl:value-of 
select="info/component_id"/>
+                                         </xsl:when>
+                                         <xsl:otherwise>
+                                                       
<xsl:text>&amp;location_code=</xsl:text>
+                                                       <xsl:value-of 
select="info/location_code"/>  
+                                         </xsl:otherwise>
+                                       </xsl:choose>
                                </xsl:attribute>
                                <img height="15" 
src="controller/images/status_icon_yellow_ring.png" />
                        </a>
@@ -37,17 +49,41 @@
                                <a>
                                        <xsl:attribute name="href">
                                                
<xsl:text>index.php?menuaction=controller.uicheck_list.add_check_list</xsl:text>
-                                               <xsl:text>&amp;date=</xsl:text>
-                                               <xsl:value-of 
select="info/date"/>
+                                               
<xsl:text>&amp;deadline_ts=</xsl:text>
+                                               <xsl:value-of 
select="info/deadline_date_ts"/>
                                                
<xsl:text>&amp;control_id=</xsl:text>
                                                <xsl:value-of 
select="info/control_id"/>
-                                               
<xsl:text>&amp;location_code=</xsl:text>
-                                               <xsl:value-of 
select="$location_code"/>
+                                               <xsl:text>&amp;type=</xsl:text>
+                                               <xsl:value-of 
select="info/type"/>
+                                               <xsl:choose>
+                                                 <xsl:when test="info/type = 
'component'">
+                                                       
<xsl:text>&amp;location_id=</xsl:text>
+                                                               <xsl:value-of 
select="info/location_id"/>
+                                                               
<xsl:text>&amp;component_id=</xsl:text>
+                                                               <xsl:value-of 
select="info/component_id"/>
+                                                 </xsl:when>
+                                                 <xsl:otherwise>
+                                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                                               <xsl:value-of 
select="info/location_code"/>  
+                                                 </xsl:otherwise>
+                                         </xsl:choose>
                                        </xsl:attribute>
                                        <img height="15" 
src="controller/images/status_icon_red_cross.png" />
                                </a>
                        </td>
                </xsl:when>
+               <xsl:when test="status = 'CONTROL_NOT_DONE_WITH_CHECKLIST'">
+                       <td>
+                               <a>
+                                       <xsl:attribute name="href">
+                                               
<xsl:text>index.php?menuaction=controller.uicheck_list.edit_check_list</xsl:text>
+                                               
<xsl:text>&amp;check_list_id=</xsl:text>
+                                               <xsl:value-of 
select="info/check_list_id"/>
+                                       </xsl:attribute>
+                                       <img height="15" 
src="controller/images/status_icon_red_cross.png" />
+                               </a>
+                       </td>
+               </xsl:when>
                <xsl:when test="status = 'CONTROL_NOT_DONE_WITH_PLANNED_DATE'">
                        <td>
                        <a>
@@ -116,9 +152,9 @@
                                                <xsl:attribute name="href">
                                                        
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
                                                        
<xsl:text>&amp;control_id=</xsl:text>
-                                                       <xsl:value-of 
select="//control/id"/>
+                                                       <xsl:value-of 
select="info/control_id"/>
                                                        
<xsl:text>&amp;location_code=</xsl:text>
-                                                       <xsl:value-of 
select="//current_location/location_code"/>
+                                                       <xsl:value-of 
select="info/location_code"/>
                                                        
<xsl:text>&amp;year=</xsl:text>
                                                        <xsl:value-of 
select="//current_year"/>
                                                        
<xsl:text>&amp;month=</xsl:text>

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-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
      2012-06-25 10:25:30 UTC (rev 9656)
@@ -121,6 +121,53 @@
                <!-- =====================  COLOR ICON MAP  ================= 
-->
                <xsl:call-template name="icon_color_map" />
                
+               <!-- =====================  FILTERS  ================= -->
+                       <form id="filters" class="select-box" 
action="index.php?menuaction=controller.uicalendar.view_calendar_for_year" 
method="post">
+                               <input type="hidden" name="year">
+                                       <xsl:attribute name="value">
+                                       <xsl:value-of select="current_year"/>
+                                       </xsl:attribute>
+                               </input>
+                               <input type="hidden" name="location_code">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="current_location/location_code"/>
+                                               </xsl:attribute>
+                               </input>
+                               <input type="hidden" name="repeat_type">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="current_repeat_type"/>
+                                       </xsl:attribute>
+                               </input>
+                               <input type="hidden" name="role">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="current_role"/>
+                                       </xsl:attribute>
+                               </input>
+                               
+                               <div class="filter first">
+                                       <label>Filtrer på rolle</label>
+                                       <select id="filter-role">
+                                               <xsl:for-each 
select="roles_array">
+                                                       <xsl:variable 
name="role_id"><xsl:value-of select="id"/></xsl:variable>
+                                                       <option 
value="{$role_id}">
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                                                       </option>
+                                               </xsl:for-each>
+                                       </select>
+                               </div>
+                               <div class="filter">
+                               <label>Filtrer på frekvenstype</label>
+                                       <select class="required" 
id="filter-repeat_type" name="repeat_type">
+                                               <option value="" 
selected="selected" >Velg frekvenstype</option>
+                                               <xsl:for-each 
select="repeat_type_array">
+                                                       <option value="{id}">
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="value"/>
+                                                       </option>
+                                               </xsl:for-each>
+                                       </select>
+                               </div>
+                       </form>
+               
                <!-- =====================  CHOOSE ANOTHER BUILDING ON PROPERTY 
 ================= -->
                        <div id="choose-building" class="select-box">
                                <xsl:if test="location_level > 1">

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-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-06-25 10:25:30 UTC (rev 9656)
@@ -123,6 +123,53 @@
                        
                        <!-- =====================  COLOR ICON MAP  
================= -->
                        <xsl:call-template name="icon_color_map" />
+                                       
+                       <!-- =====================  FILTERS  ================= 
-->
+                       <form id="filters" class="select-box" 
action="index.php?menuaction=controller.uicalendar.view_calendar_for_year" 
method="post">
+                               <input type="hidden" name="year">
+                                       <xsl:attribute name="value">
+                                       <xsl:value-of select="current_year"/>
+                                       </xsl:attribute>
+                               </input>
+                               <input type="hidden" name="location_code">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="current_location/location_code"/>
+                                               </xsl:attribute>
+                               </input>
+                               <input type="hidden" name="repeat_type">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="current_repeat_type"/>
+                                       </xsl:attribute>
+                               </input>
+                               <input type="hidden" name="role">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="current_role"/>
+                                       </xsl:attribute>
+                               </input>
+                               
+                               <div class="filter first">
+                                       <label>Filtrer på rolle</label>
+                                       <select id="filter-role">
+                                               <xsl:for-each 
select="roles_array">
+                                                       <xsl:variable 
name="role_id"><xsl:value-of select="id"/></xsl:variable>
+                                                       <option 
value="{$role_id}">
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                                                       </option>
+                                               </xsl:for-each>
+                                       </select>
+                               </div>
+                               <div class="filter">
+                               <label>Filtrer på frekvenstype</label>
+                                       <select class="required" 
id="filter-repeat_type" name="repeat_type">
+                                               <option value="" 
selected="selected" >Velg frekvenstype</option>
+                                               <xsl:for-each 
select="repeat_type_array">
+                                                       <option value="{id}">
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="value"/>
+                                                       </option>
+                                               </xsl:for-each>
+                                       </select>
+                               </div>
+                       </form>
                        
                        <!-- =====================  CALENDAR NAVIGATION  
================= -->
                        <div id="calNav">
@@ -169,7 +216,7 @@
                                                                        
<xsl:text>&amp;year=</xsl:text>
                                                                        
<xsl:value-of select="//current_year"/>
                                                                        
<xsl:text>&amp;location_code=</xsl:text>
-                                                                       
<xsl:value-of select="current_location/location_code"/>
+                                                                       
<xsl:value-of select="//current_location/location_code"/>
                                                                        
<xsl:text>&amp;month=</xsl:text>
                                                                        
<xsl:number/>
                                                                </xsl:attribute>
@@ -234,21 +281,47 @@
                                <tr class="cal_info_msg"><td colspan="3">Ingen 
sjekklister for bygg i angitt periode</td></tr>
                        </xsl:otherwise>
                </xsl:choose>
+               </table>
                
+               <h2>Komponenter</h2>
+               
+               <table id="calendar" class="year">
+                               <tr class="heading">
+                                               <th 
class="title"><span>Tittel</span></th>
+                                               <th 
class="assigned"><span>Tildelt</span></th>
+                                               <th 
class="frequency"><span>Frekvens</span></th>
+                                       <xsl:for-each select="heading_array">
+                                               <th>
+                                                       <a>
+                                                               <xsl:attribute 
name="href">
+                                                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                                                       
<xsl:text>&amp;year=</xsl:text>
+                                                                       
<xsl:value-of select="//current_year"/>
+                                                                       
<xsl:text>&amp;location_code=</xsl:text>
+                                                                       
<xsl:value-of select="current_location/location_code"/>
+                                                                       
<xsl:text>&amp;month=</xsl:text>
+                                                                       
<xsl:number/>
+                                                               </xsl:attribute>
+                                                               
+                                                               <xsl:variable 
name="month_str">short_month <xsl:number/> capitalized</xsl:variable>
+                                                               <xsl:value-of 
select="php:function('lang', $month_str)" />
+                                                       </a>                    
        
+                                               </th>
+                                       </xsl:for-each>
+                               </tr>
+                               
+                               
                <xsl:for-each select="components_calendar_array">
+                 <tr>
+                   <td>
+                           <h3><xsl:value-of select="component/xml"/></h3>
+                   </td>
+                 </tr>
                
-               <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>
@@ -290,29 +363,10 @@
                                                        </xsl:for-each>
                                        </tr>   
                                </xsl:for-each> 
-                       
-               </tr>
                
                </xsl:for-each>
                
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
+                       
        </table>
        </div>
 </div>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-06-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-06-25 10:25:30 UTC (rev 9656)
@@ -45,12 +45,24 @@
        <div id="check_list_details">
                <h3 class="box_header">Sjekklistedetaljer</h3>
                <form id="frm_add_check_list" 
action="index.php?menuaction=controller.uicheck_list.save_check_list" 
method="post">
-                       <xsl:variable name="location_code"><xsl:value-of 
select="location_array/location_code"/></xsl:variable>
                        <xsl:variable name="control_id"><xsl:value-of 
select="control/id"/></xsl:variable>
-               
                        <input type="hidden" name="control_id" 
value="{$control_id}" />
-                       <input type="hidden" name="location_code" 
value="{$location_code}" />
+                       <xsl:variable name="type"><xsl:value-of 
select="type"/></xsl:variable>
+                       <input type="hidden" name="type" value="{$type}" />
                        
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <xsl:variable 
name="location_id"><xsl:value-of 
select="check_list/location_id"/></xsl:variable>
+                                       <input type="hidden" name="location_id" 
value="{$location_id}" />
+                                       <xsl:variable 
name="component_id"><xsl:value-of 
select="check_list/component_id"/></xsl:variable>
+                                       <input type="hidden" 
name="component_id" value="{$component_id}" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:variable 
name="location_code"><xsl:value-of 
select="location_array/location_code"/></xsl:variable>
+                                       <input type="hidden" 
name="location_code" value="{$location_code}" />
+                               </xsl:otherwise>
+                       </xsl:choose>
+                       
                        <fieldset>
                                <div class="row">
                                        <label>Status</label>
@@ -62,7 +74,7 @@
                                <div class="row">
                                        <label>Fristdato</label>
                                        <input type="text" id="deadline_date" 
name="deadline_date" class="date">
-                                     <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, number(deadline))"/></xsl:attribute>
+                                     <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/deadline))"/></xsl:attribute>
                                    </input>
                            </div>
                                <div class="row">

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-25 10:21:02 UTC (rev 9655)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
 2012-06-25 10:25:30 UTC (rev 9656)
@@ -100,6 +100,8 @@
                                                                <!-- 
==============  FORM FOR SAVING OPTION VALUES FOR LIST  =============  -->
                                                                <div 
id="add_control_item_option_panel">
                                                                        <hr />
+                                                                       
+                                                                       <h2 
class="type"></h2>
                                                                        
<h3>Legg til verdier som listen skal inneholde</h3>
                                                                        
                                                                        <input 
type="hidden" name="control_item_id">

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-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-06-25 10:25:30 UTC (rev 9656)
@@ -365,12 +365,16 @@
 }
 
 #innertoolbar-button {
-    font-size: 1em;
-    line-height: 1.2em;
-    min-height: 1.2em;
-    padding: 2px 15px;
+  font-size: 1em;
+  line-height: 1.2em;
+  min-height: 1.2em;
+  padding: 2px 15px;
 }
 
+a#innertoolbar-button {
+  padding: 3px 15px;
+}
+
 .row input[type="submit"] {
   padding: 2px 10px;
 }
@@ -432,9 +436,10 @@
 }
 
 .yui-skin-sam .yui-button .first-child {
-  border: 0;
-  margin:0;
+    border: 0 none;
+    margin: 0 10px 0 0;
 }
+
 .yui-skin-sam .yui-button {
   background: none;
   border:0;
@@ -1018,9 +1023,10 @@
        width:150px;    
 }
 
-.new_item a#innertoolbar-button{
-       background: grey;
-       font-weight: bold;
+.new_item a#innertoolbar-button {
+    background: none repeat scroll 0 0 grey;
+    border: 1px solid #666666;
+    font-weight: bold;
 }
 
 #frm_save_check_items input[type="submit"]{
@@ -1047,24 +1053,24 @@
 
 /* ====================================  CALENDAR  
========================================= */
 #control_plan .top h3 {
-    float: left;
-    font-size: 19px;
-    margin: 0;
+  float: left;
+  font-size: 19px;
+  margin: 0;
 }
 
 #control_plan .top h3 .year{
-   margin-left:5px;
+  margin-left:5px;
 }
 
 #control_plan .middle {
-    background: none repeat scroll 0 0 #EDF5FF;
-    border-color: #DBE5EF;
-    border-style: solid solid none;
-    border-width: 1px 1px 0;
-    clear: both;
-    margin-top: 1em;
-    overflow: hidden;
-    padding: 1em 1em 0;
+  background: none repeat scroll 0 0 #EDF5FF;
+  border-color: #DBE5EF;
+  border-style: solid solid none;
+  border-width: 1px 1px 0;
+  clear: both;
+  margin-top: 1em;
+  overflow: hidden;
+  padding: 1em 1em 0;
 }
 
 /* =============================  SEARCH LOCATION BOX  ======================= 
*/
@@ -1079,14 +1085,33 @@
 }
 
 #choose-my-location {
-    float: right;
-    margin-right: 10px;
+  float: right;
+  margin-right: 10px;
 }
 
 #choose-building {
+  float: left;
+}
+
+#filters {
+    clear: left;
     float: left;
+    margin-top: 1em;
 }
 
+#filters.select-box {
+  background: none repeat scroll 0 0 #DEEAF8;
+  border: 1px solid #BDD3ED;
+}
+
+#filters .filter {
+    float: left;
+}
+
+#filters .filter.first {
+    margin-right: 1em;
+}
+
 .month_view #choose-building {
     clear:left;
     margin-top: 1em;

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2012-06-25 10:25:30 UTC (rev 9656)
@@ -958,11 +958,19 @@
                                {
                                        if($value)
                                        {
-                                               $condition[] = "$column = 
'{$value}'";
+                                               switch($value)
+                                               {
+                                                       case 'IS NOT NULL':
+                                                               $condition[] = 
"{$column} IS NOT NULL";
+                                                               break;
+                                                       default:
+                                                               $condition[] = 
"{$column} = '{$value}'";                                                       
 
+                                               }
+
                                        }
                                        else
                                        {
-                                               $condition[] = "$column IS 
NULL";                                       
+                                               $condition[] = "{$column} IS 
NULL";                                     
                                        }
                                }
 

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php     
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php     
2012-06-25 10:25:30 UTC (rev 9656)
@@ -32,20 +32,6 @@
        phpgw::import_class('phpgwapi.yui');
 
 
-       /**
-        * 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);
-       }
-*/
        abstract class phpgwapi_uicommon
        {
                const UI_SESSION_FLASH = 'flash_msgs';
@@ -77,7 +63,6 @@
                        
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']);
@@ -90,6 +75,8 @@
                        phpgwapi_yui::load_widget('autocomplete');
                        phpgwapi_yui::load_widget('animation');
 
+                       self::add_javascript('phpgwapi', 'yahoo', 'common.js');
+
                        $this->url_prefix = str_replace('_', '.', 
get_class($this));
 
                        $this->dateFormat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -322,7 +309,8 @@
                }
   
 
-               public function add_template_helpers() {
+               public function add_template_helpers()
+               {
                        $this->add_template_file('helpers');
                }
 
@@ -330,9 +318,12 @@
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
 
-                       if($this->flash_msgs) {
+                       if($this->flash_msgs)
+                       {
                                $data['msgbox_data'] = 
$GLOBALS['phpgw']->common->msgbox($this->flash_msgs);
-                       } else {
+                       }
+                       else
+                       {
                                $this->add_template_file('msgbox');
                        }
 
@@ -375,7 +366,8 @@
                // Build a YUI result style array
                public function yui_results($results)
                { 
-                       if (!$results) { 
+                       if (!$results)
+                       { 
                                $results['total_records'] = 0;
                                $result['results'] = array();
                        }
@@ -679,6 +671,488 @@
                }
 
                /**
+                * Returns a human-readable string from a lower case and 
underscored word by replacing underscores
+                * with a space, and by upper-casing the initial characters.
+                *
+                * @param  string $lower_case_and_underscored_word String to 
make more readable.
+                *
+                * @return string Human-readable string.
+                */
+               public static function 
humanize($lower_case_and_underscored_word)
+               {
+                       if (substr($lower_case_and_underscored_word, -3) === 
'_id')
+                       {
+                               $lower_case_and_underscored_word = 
substr($lower_case_and_underscored_word, 0, -3);
+                       }
+
+                       return ucfirst(str_replace('_', ' ', 
$lower_case_and_underscored_word));
+               }
+               
+         /**
+          * Retrieves an array of files from $_FILES
+          *
+          * @param  string $key        A key
+          * @return array              An associative array of files
+          */
+               public function get_files($key = null)
+               {
+                       if (!$this->filesArray)
+                       {
+                               $this->filesArray = 
self::convert_file_information($_FILES);
+                       }
+
+                       return is_null($key) ? $this->filesArray : 
(isset($this->filesArray[$key]) ? $this->filesArray[$key] : array());
+               }
+
+               public function toggle_show_showall()
+               {
+                       if(isset($_SESSION['showall']) && 
!empty($_SESSION['showall']))
+                       {
+                               $this->bo->unset_show_all_objects();
+                       }
+                       else
+                       {
+                               $this->bo->show_all_objects();
+                       }
+                       $this->redirect(array('menuaction' => 
$this->url_prefix.'.index'));
+               }
+
+/*             
+               public function use_yui_editor()
+               {
+                       
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
+                       self::add_javascript('yahoo', 'yahoo/editor', 
'simpleeditor-min.js');
+               }
+
+*/             static protected function fix_php_files_array($data)
+               {
+                       $fileKeys = array('error', 'name', 'size', 'tmp_name', 
'type');
+                       $keys = array_keys($data);
+                       sort($keys);
+
+                       if ($fileKeys != $keys || !isset($data['name']) || 
!is_array($data['name']))
+                       {
+                               return $data;
+                       }
+
+                       $files = $data;
+                       foreach ($fileKeys as $k)
+                       {
+                               unset($files[$k]);
+                       }
+                       foreach (array_keys($data['name']) as $key)
+                       {
+                               $files[$key] = self::fix_php_files_array(array(
+                                       'error'    => $data['error'][$key],
+                                       'name'     => $data['name'][$key],
+                                       'type'     => $data['type'][$key],
+                                       'tmp_name' => $data['tmp_name'][$key],
+                                       'size'     => $data['size'][$key],
+                               ));
+                       }
+
+                       return $files;
+               }
+               
+               /**
+               * It's safe to pass an already converted array, in which case 
this method just returns the original array unmodified.
+               *
+               * @param  array $taintedFiles An array representing uploaded 
file information
+               *
+               * @return array An array of re-ordered uploaded file information
+               */
+               static public function convert_file_information(array 
$taintedFiles)
+               {
+                       $files = array();
+                       foreach ($taintedFiles as $key => $data)
+                       {
+                               $files[$key] = self::fix_php_files_array($data);
+                       }
+
+                       return $files;
+               }
+               
+               protected static function get_file_type_from_extension($file, 
$defaultType = 'application/octet-stream')
+               {
+                       if (false === ($extension = (false === $pos = 
strrpos($file, '.')) ? false : substr($file, $pos+1)))
+                       {
+                               return $defaultType;
+                       }
+                       
+                       if (strlen($extension) == 0)
+                       {
+                               return $defaultType;
+                       }
+                       
+                       switch ($extension) {
+                               case 'ez':                      return 
'application/andrew-inset';
+                               case 'base64':          return 
'application/x-word';
+                               case 'dp':                      return 
'application/commonground';
+                               case 'pqi':             return 
'application/cprplayer';
+                               case 'tsp':             return 
'application/dsptype';
+                               case 'xls':             return 
'application/x-msexcel';
+                               case 'pfr':             return 
'application/font-tdpfr';
+                               case 'spl':             return 
'application/x-futuresplash';
+                               case 'stk':             return 
'application/hyperstudio';
+                               case 'js':                      return 
'application/x-javascript';
+                               case 'hqx':             return 
'application/mac-binhex40';
+                               case 'cpt':             return 
'application/x-mac-compactpro';
+                               case 'mbd':             return 
'application/mbed';
+                               case 'mfp':             return 
'application/mirage';
+                               case 'doc':             return 
'application/x-msword';
+                               case 'orq':             return 
'application/ocsp-request';
+                               case 'ors':             return 
'application/ocsp-response';
+                               case 'bin':             return 
'application/octet-stream';
+                               case 'oda':             return 
'application/oda';
+                               case 'ogg':             return 
'application/ogg';
+                               case 'pdf':             return 
'application/x-pdf';
+                               case '7bit':            return 
'application/pgp-keys';
+                               case 'sig':             return 
'application/pgp-signature';
+                               case 'p10':             return 
'application/pkcs10';
+                               case 'p7m':             return 
'application/pkcs7-mime';
+                               case 'p7s':             return 
'application/pkcs7-signature';
+                               case 'cer':             return 
'application/pkix-cert';
+                               case 'crl':             return 
'application/pkix-crl';
+                               case 'pkipath':         return 
'application/pkix-pkipath';
+                               case 'pki':             return 
'application/pkixcmp';
+                               case 'ps':                      return 
'application/postscript';
+                               case 'shw':             return 
'application/presentations';
+                               case 'cw':                      return 
'application/prs.cww';
+                               case 'rnd':             return 
'application/prs.nprend';
+                               case 'qrt':             return 
'application/quest';
+                               case 'rtf':             return 'text/rtf';
+                               case 'soc':             return 
'application/sgml-open-catalog';
+                               case 'siv':             return 
'application/sieve';
+                               case 'smi':             return 
'application/smil';
+                               case 'tbk':             return 
'application/toolbook';
+                               case 'plb':             return 
'application/vnd.3gpp.pic-bw-large';
+                               case 'psb':             return 
'application/vnd.3gpp.pic-bw-small';
+                               case 'pvb':             return 
'application/vnd.3gpp.pic-bw-var';
+                               case 'sms':             return 
'application/vnd.3gpp.sms';
+                               case 'atc':             return 
'application/vnd.acucorp';
+                               case 'xfdf':            return 
'application/vnd.adobe.xfdf';
+                               case 'ami':             return 
'application/vnd.amiga.amu';
+                               case 'mpm':             return 
'application/vnd.blueice.multipass';
+                               case 'cdy':             return 
'application/vnd.cinderella';
+                               case 'cmc':             return 
'application/vnd.cosmocaller';
+                               case 'wbs':             return 
'application/vnd.criticaltools.wbs+xml';
+                               case 'curl':            return 
'application/vnd.curl';
+                               case 'rdz':             return 
'application/vnd.data-vision.rdz';
+                               case 'dfac':            return 
'application/vnd.dreamfactory';
+                               case 'fsc':             return 
'application/vnd.fsc.weblauch';
+                               case 'txd':             return 
'application/vnd.genomatix.tuxedo';
+                               case 'hbci':            return 
'application/vnd.hbci';
+                               case 'les':             return 
'application/vnd.hhe.lesson-player';
+                               case 'plt':             return 
'application/vnd.hp-hpgl';
+                               case 'emm':             return 
'application/vnd.ibm.electronic-media';
+                               case 'irm':             return 
'application/vnd.ibm.rights-management';
+                               case 'sc':                      return 
'application/vnd.ibm.secure-container';
+                               case 'rcprofile':       return 
'application/vnd.ipunplugged.rcprofile';
+                               case 'irp':             return 
'application/vnd.irepository.package+xml';
+                               case 'jisp':            return 
'application/vnd.jisp';
+                               case 'karbon':          return 
'application/vnd.kde.karbon';
+                               case 'chrt':            return 
'application/vnd.kde.kchart';
+                               case 'kfo':             return 
'application/vnd.kde.kformula';
+                               case 'flw':             return 
'application/vnd.kde.kivio';
+                               case 'kon':             return 
'application/vnd.kde.kontour';
+                               case 'kpr':             return 
'application/vnd.kde.kpresenter';
+                               case 'ksp':             return 
'application/vnd.kde.kspread';
+                               case 'kwd':             return 
'application/vnd.kde.kword';
+                               case 'htke':            return 
'application/vnd.kenameapp';
+                               case 'kia':             return 
'application/vnd.kidspiration';
+                               case 'kne':             return 
'application/vnd.kinar';
+                               case 'lbd':             return 
'application/vnd.llamagraphics.life-balance.desktop';
+                               case 'lbe':             return 
'application/vnd.llamagraphics.life-balance.exchange+xml';
+                               case 'wks':             return 
'application/vnd.lotus-1-2-3';
+                               case 'mcd':             return 
'application/x-mathcad';
+                               case 'mfm':             return 
'application/vnd.mfmp';
+                               case 'flo':             return 
'application/vnd.micrografx.flo';
+                               case 'igx':             return 
'application/vnd.micrografx.igx';
+                               case 'mif':             return 
'application/x-mif';
+                               case 'mpn':             return 
'application/vnd.mophun.application';
+                               case 'mpc':             return 
'application/vnd.mophun.certificate';
+                               case 'xul':             return 
'application/vnd.mozilla.xul+xml';
+                               case 'cil':             return 
'application/vnd.ms-artgalry';
+                               case 'asf':             return 'video/x-ms-asf';
+                               case 'lrm':             return 
'application/vnd.ms-lrm';
+                               case 'ppt':             return 
'application/vnd.ms-powerpoint';
+                               case 'mpp':             return 
'application/vnd.ms-project';
+                               case 'wpl':             return 
'application/vnd.ms-wpl';
+                               case 'mseq':            return 
'application/vnd.mseq';
+                               case 'ent':             return 
'application/vnd.nervana';
+                               case 'rpst':            return 
'application/vnd.nokia.radio-preset';
+                               case 'rpss':            return 
'application/vnd.nokia.radio-presets';
+                               case 'odt':             return 
'application/vnd.oasis.opendocument.text';
+                               case 'ott':             return 
'application/vnd.oasis.opendocument.text-template';
+                               case 'oth':             return 
'application/vnd.oasis.opendocument.text-web';
+                               case 'odm':             return 
'application/vnd.oasis.opendocument.text-master';
+                               case 'odg':             return 
'application/vnd.oasis.opendocument.graphics';
+                               case 'otg':             return 
'application/vnd.oasis.opendocument.graphics-template';
+                               case 'odp':             return 
'application/vnd.oasis.opendocument.presentation';
+                               case 'otp':             return 
'application/vnd.oasis.opendocument.presentation-template';
+                               case 'ods':             return 
'application/vnd.oasis.opendocument.spreadsheet';
+                               case 'ots':             return 
'application/vnd.oasis.opendocument.spreadsheet-template';
+                               case 'odc':             return 
'application/vnd.oasis.opendocument.chart';
+                               case 'odf':             return 
'application/vnd.oasis.opendocument.formula';
+                               case 'odb':             return 
'application/vnd.oasis.opendocument.database';
+                               case 'odi':             return 
'application/vnd.oasis.opendocument.image';
+                               case 'prc':             return 
'application/vnd.palm';
+                               case 'efif':            return 
'application/vnd.picsel';
+                               case 'pti':             return 
'application/vnd.pvi.ptid1';
+                               case 'qxd':             return 
'application/vnd.quark.quarkxpress';
+                               case 'sdoc':            return 
'application/vnd.sealed.doc';
+                               case 'seml':            return 
'application/vnd.sealed.eml';
+                               case 'smht':            return 
'application/vnd.sealed.mht';
+                               case 'sppt':            return 
'application/vnd.sealed.ppt';
+                               case 'sxls':            return 
'application/vnd.sealed.xls';
+                               case 'stml':            return 
'application/vnd.sealedmedia.softseal.html';
+                               case 'spdf':            return 
'application/vnd.sealedmedia.softseal.pdf';
+                               case 'see':             return 
'application/vnd.seemail';
+                               case 'mmf':             return 
'application/vnd.smaf';
+                               case 'sxc':             return 
'application/vnd.sun.xml.calc';
+                               case 'stc':             return 
'application/vnd.sun.xml.calc.template';
+                               case 'sxd':             return 
'application/vnd.sun.xml.draw';
+                               case 'std':             return 
'application/vnd.sun.xml.draw.template';
+                               case 'sxi':             return 
'application/vnd.sun.xml.impress';
+                               case 'sti':             return 
'application/vnd.sun.xml.impress.template';
+                               case 'sxm':             return 
'application/vnd.sun.xml.math';
+                               case 'sxw':             return 
'application/vnd.sun.xml.writer';
+                               case 'sxg':             return 
'application/vnd.sun.xml.writer.global';
+                               case 'stw':             return 
'application/vnd.sun.xml.writer.template';
+                               case 'sus':             return 
'application/vnd.sus-calendar';
+                               case 'vsc':             return 
'application/vnd.vidsoft.vidconference';
+                               case 'vsd':             return 
'application/vnd.visio';
+                               case 'vis':             return 
'application/vnd.visionary';
+                               case 'sic':             return 
'application/vnd.wap.sic';
+                               case 'slc':             return 
'application/vnd.wap.slc';
+                               case 'wbxml':           return 
'application/vnd.wap.wbxml';
+                               case 'wmlc':            return 
'application/vnd.wap.wmlc';
+                               case 'wmlsc':           return 
'application/vnd.wap.wmlscriptc';
+                               case 'wtb':             return 
'application/vnd.webturbo';
+                               case 'wpd':             return 
'application/vnd.wordperfect';
+                               case 'wqd':             return 
'application/vnd.wqd';
+                               case 'wv':                      return 
'application/vnd.wv.csp+wbxml';
+                               case '8bit':            return 
'multipart/parallel';
+                               case 'hvd':             return 
'application/vnd.yamaha.hv-dic';
+                               case 'hvs':             return 
'application/vnd.yamaha.hv-script';
+                               case 'hvp':             return 
'application/vnd.yamaha.hv-voice';
+                               case 'saf':             return 
'application/vnd.yamaha.smaf-audio';
+                               case 'spf':             return 
'application/vnd.yamaha.smaf-phrase';
+                               case 'vmd':             return 
'application/vocaltec-media-desc';
+                               case 'vmf':             return 
'application/vocaltec-media-file';
+                               case 'vtk':             return 
'application/vocaltec-talker';
+                               case 'wif':             return 
'image/cewavelet';
+                               case 'wp5':             return 
'application/wordperfect5.1';
+                               case 'wk':                      return 
'application/x-123';
+                               case '7ls':             return 
'application/x-7th_level_event';
+                               case 'aab':             return 
'application/x-authorware-bin';
+                               case 'aam':             return 
'application/x-authorware-map';
+                               case 'aas':             return 
'application/x-authorware-seg';
+                               case 'bcpio':           return 
'application/x-bcpio';
+                               case 'bleep':           return 
'application/x-bleeper';
+                               case 'bz2':             return 
'application/x-bzip2';
+                               case 'vcd':             return 
'application/x-cdlink';
+                               case 'chat':            return 
'application/x-chat';
+                               case 'pgn':             return 
'application/x-chess-pgn';
+                               case 'z':                       return 
'application/x-compress';
+                               case 'cpio':            return 
'application/x-cpio';
+                               case 'pqf':             return 
'application/x-cprplayer';
+                               case 'csh':             return 
'application/x-csh';
+                               case 'csm':             return 
'chemical/x-csml';
+                               case 'co':                      return 
'application/x-cult3d-object';
+                               case 'deb':             return 
'application/x-debian-package';
+                               case 'dcr':             return 
'application/x-director';
+                               case 'dvi':             return 
'application/x-dvi';
+                               case 'evy':             return 
'application/x-envoy';
+                               case 'gtar':            return 
'application/x-gtar';
+                               case 'gz':                      return 
'application/x-gzip';
+                               case 'hdf':             return 
'application/x-hdf';
+                               case 'hep':             return 
'application/x-hep';
+                               case 'rhtml':           return 
'application/x-html+ruby';
+                               case 'mv':                      return 
'application/x-httpd-miva';
+                               case 'phtml':           return 
'application/x-httpd-php';
+                               case 'ica':             return 
'application/x-ica';
+                               case 'imagemap':        return 
'application/x-imagemap';
+                               case 'ipx':             return 
'application/x-ipix';
+                               case 'ips':             return 
'application/x-ipscript';
+                               case 'jar':             return 
'application/x-java-archive';
+                               case 'jnlp':            return 
'application/x-java-jnlp-file';
+                               case 'ser':             return 
'application/x-java-serialized-object';
+                               case 'class':           return 
'application/x-java-vm';
+                               case 'skp':             return 
'application/x-koan';
+                               case 'latex':           return 
'application/x-latex';
+                               case 'frm':             return 
'application/x-maker';
+                               case 'mid':             return 'audio/x-midi';
+                               case 'mda':             return 
'application/x-msaccess';
+                               case 'com':             return 
'application/x-msdos-program';
+                               case 'nc':                      return 
'application/x-netcdf';
+                               case 'pac':             return 
'application/x-ns-proxy-autoconfig';
+                               case 'pm5':             return 
'application/x-pagemaker';
+                               case 'pl':                      return 
'application/x-perl';
+                               case 'rp':                      return 
'application/x-pn-realmedia';
+                               case 'py':                      return 
'application/x-python';
+                               case 'qtl':             return 
'application/x-quicktimeplayer';
+                               case 'rar':             return 
'application/x-rar-compressed';
+                               case 'rb':                      return 
'application/x-ruby';
+                               case 'sh':                      return 
'application/x-sh';
+                               case 'shar':            return 
'application/x-shar';
+                               case 'swf':             return 
'application/x-shockwave-flash';
+                               case 'spr':             return 
'application/x-sprite';
+                               case 'sav':             return 
'application/x-spss';
+                               case 'spt':             return 
'application/x-spt';
+                               case 'sit':             return 
'application/x-stuffit';
+                               case 'sv4cpio':         return 
'application/x-sv4cpio';
+                               case 'sv4crc':          return 
'application/x-sv4crc';
+                               case 'tar':             return 
'application/x-tar';
+                               case 'tcl':             return 
'application/x-tcl';
+                               case 'tex':             return 
'application/x-tex';
+                               case 'texinfo':         return 
'application/x-texinfo';
+                               case 't':                       return 
'application/x-troff';
+                               case 'man':             return 
'application/x-troff-man';
+                               case 'me':                      return 
'application/x-troff-me';
+                               case 'ms':                      return 
'application/x-troff-ms';
+                               case 'vqf':             return 
'application/x-twinvq';
+                               case 'vqe':             return 
'application/x-twinvq-plugin';
+                               case 'ustar':           return 
'application/x-ustar';
+                               case 'bck':             return 
'application/x-vmsbackup';
+                               case 'src':             return 
'application/x-wais-source';
+                               case 'wz':                      return 
'application/x-wingz';
+                               case 'wp6':             return 
'application/x-wordperfect6.1';
+                               case 'crt':             return 
'application/x-x509-ca-cert';
+                               case 'zip':             return 
'application/zip';
+                               case 'xhtml':           return 
'application/xhtml+xml';
+                               case '3gpp':            return 'audio/3gpp';
+                               case 'amr':             return 'audio/amr';
+                               case 'awb':             return 'audio/amr-wb';
+                               case 'au':                      return 
'audio/basic';
+                               case 'evc':             return 'audio/evrc';
+                               case 'l16':             return 'audio/l16';
+                               case 'mp3':             return 'audio/mpeg';
+                               case 'sid':             return 'audio/prs.sid';
+                               case 'qcp':             return 'audio/qcelp';
+                               case 'smv':             return 'audio/smv';
+                               case 'koz':             return 
'audio/vnd.audiokoz';
+                               case 'eol':             return 
'audio/vnd.digital-winds';
+                               case 'plj':             return 
'audio/vnd.everad.plj';
+                               case 'lvp':             return 
'audio/vnd.lucent.voice';
+                               case 'mxmf':            return 
'audio/vnd.nokia.mobile-xmf';
+                               case 'vbk':             return 
'audio/vnd.nortel.vbk';
+                               case 'ecelp4800':       return 
'audio/vnd.nuera.ecelp4800';
+                               case 'ecelp7470':       return 
'audio/vnd.nuera.ecelp7470';
+                               case 'ecelp9600':       return 
'audio/vnd.nuera.ecelp9600';
+                               case 'smp3':            return 
'audio/vnd.sealedmedia.softseal.mpeg';
+                               case 'vox':             return 'audio/voxware';
+                               case 'aif':             return 'audio/x-aiff';
+                               case 'mp2':             return 'audio/x-mpeg';
+                               case 'mpu':             return 
'audio/x-mpegurl';
+                               case 'rm':                      return 
'audio/x-pn-realaudio';
+                               case 'rpm':             return 
'audio/x-pn-realaudio-plugin';
+                               case 'ra':                      return 
'audio/x-realaudio';
+                               case 'wav':             return 'audio/x-wav';
+                               case 'emb':             return 
'chemical/x-embl-dl-nucleotide';
+                               case 'cube':            return 
'chemical/x-gaussian-cube';
+                               case 'gau':             return 
'chemical/x-gaussian-input';
+                               case 'jdx':             return 
'chemical/x-jcamp-dx';
+                               case 'mol':             return 
'chemical/x-mdl-molfile';
+                               case 'rxn':             return 
'chemical/x-mdl-rxnfile';
+                               case 'tgf':             return 
'chemical/x-mdl-tgf';
+                               case 'mop':             return 
'chemical/x-mopac-input';
+                               case 'pdb':             return 
'x-chemical/x-pdb';
+                               case 'scr':             return 
'chemical/x-rasmol';
+                               case 'xyz':             return 
'x-chemical/x-xyz';
+                               case 'dwf':             return 'x-drawing/dwf';
+                               case 'ivr':             return 'i-world/i-vrml';
+                               case 'bmp':             return 'image/x-bmp';
+                               case 'cod':             return 'image/cis-cod';
+                               case 'fif':             return 'image/fif';
+                               case 'gif':             return 'image/gif';
+                               case 'ief':             return 'image/ief';
+                               case 'jp2':             return 'image/jp2';
+                               case 'jpg':             return 'image/pjpeg';
+                               case 'jpm':             return 'image/jpm';
+                               case 'jpf':             return 'image/jpx';
+                               case 'pic':             return 'image/pict';
+                               case 'png':             return 'image/x-png';
+                               case 'tga':             return 'image/targa';
+                               case 'tif':             return 'image/tiff';
+                               case 'tiff':            return 'image/tiff';
+                               case 'svf':             return 'image/vn-svf';
+                               case 'dgn':             return 'image/vnd.dgn';
+                               case 'djvu':            return 'image/vnd.djvu';
+                               case 'dwg':             return 'image/vnd.dwg';
+                               case 'pgb':             return 
'image/vnd.glocalgraphics.pgb';
+                               case 'ico':             return 
'image/vnd.microsoft.icon';
+                               case 'mdi':             return 
'image/vnd.ms-modi';
+                               case 'spng':            return 
'image/vnd.sealed.png';
+                               case 'sgif':            return 
'image/vnd.sealedmedia.softseal.gif';
+                               case 'sjpg':            return 
'image/vnd.sealedmedia.softseal.jpg';
+                               case 'wbmp':            return 
'image/vnd.wap.wbmp';
+                               case 'ras':             return 
'image/x-cmu-raster';
+                               case 'fh4':             return 
'image/x-freehand';
+                               case 'pnm':             return 
'image/x-portable-anymap';
+                               case 'pbm':             return 
'image/x-portable-bitmap';
+                               case 'pgm':             return 
'image/x-portable-graymap';
+                               case 'ppm':             return 
'image/x-portable-pixmap';
+                               case 'rgb':             return 'image/x-rgb';
+                               case 'xbm':             return 
'image/x-xbitmap';
+                               case 'xpm':             return 
'image/x-xpixmap';
+                               case 'xwd':             return 
'image/x-xwindowdump';
+                               case 'igs':             return 'model/iges';
+                               case 'msh':             return 'model/mesh';
+                               case 'x_b':             return 
'model/vnd.parasolid.transmit.binary';
+                               case 'x_t':             return 
'model/vnd.parasolid.transmit.text';
+                               case 'wrl':             return 'x-world/x-vrml';
+                               case 'csv':             return 
'text/comma-separated-values';
+                               case 'css':             return 'text/css';
+                               case 'html':            return 'text/html';
+                               case 'txt':             return 'text/plain';
+                               case 'rst':             return 
'text/prs.fallenstein.rst';
+                               case 'rtx':             return 'text/richtext';
+                               case 'sgml':            return 'text/x-sgml';
+                               case 'tsv':             return 
'text/tab-separated-values';
+                               case 'ccc':             return 
'text/vnd.net2phone.commcenter.command';
+                               case 'jad':             return 
'text/vnd.sun.j2me.app-descriptor';
+                               case 'si':                      return 
'text/vnd.wap.si';
+                               case 'sl':                      return 
'text/vnd.wap.sl';
+                               case 'wml':             return 
'text/vnd.wap.wml';
+                               case 'wmls':            return 
'text/vnd.wap.wmlscript';
+                               case 'hdml':            return 'text/x-hdml';
+                               case 'etx':             return 'text/x-setext';
+                               case 'talk':            return 'text/x-speech';
+                               case 'vcs':             return 
'text/x-vcalendar';
+                               case 'vcf':             return 'text/x-vcard';
+                               case 'xml':             return 'text/xml';
+                               case 'uvr':             return 'ulead/vrml';
+                               case '3gp':             return 'video/3gpp';
+                               case 'dl':                      return 
'video/dl';
+                               case 'gl':                      return 
'video/gl';
+                               case 'mj2':             return 'video/mj2';
+                               case 'mpeg':            return 'video/mpeg';
+                               case 'mov':             return 
'video/quicktime';
+                               case 'vdo':             return 'video/vdo';
+                               case 'viv':             return 'video/vivo';
+                               case 'fvt':             return 'video/vnd.fvt';
+                               case 'mxu':             return 
'video/vnd.mpegurl';
+                               case 'nim':             return 
'video/vnd.nokia.interleaved-multimedia';
+                               case 'mp4':             return 
'video/vnd.objectvideo';
+                               case 's11':             return 
'video/vnd.sealed.mpeg1';
+                               case 'smpg':            return 
'video/vnd.sealed.mpeg4';
+                               case 'sswf':            return 
'video/vnd.sealed.swf';
+                               case 'smov':            return 
'video/vnd.sealedmedia.softseal.mov';
+                               case 'vivo':            return 'video/vnd.vivo';
+                               case 'fli':             return 'video/x-fli';
+                               case 'wmv':             return 'video/x-ms-wmv';
+                               case 'avi':             return 
'video/x-msvideo';
+                               case 'movie':           return 
'video/x-sgi-movie';
+                               case 'ice':             return 
'x-conference/x-cooltalk';
+                               case 'd':                       return 
'x-world/x-d96';
+                               case 'svr':             return 'x-world/x-svr';
+                               case 'vrw':             return 
'x-world/x-vream';
+                               default: 
+                                       return $defaultType;
+                       }
+               }
+               /**
                 * 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.

Modified: branches/Version-1_0-branch/phpgwapi/inc/functions.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/functions.inc.php  2012-06-25 
10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/phpgwapi/inc/functions.inc.php  2012-06-25 
10:25:30 UTC (rev 9656)
@@ -76,7 +76,7 @@
         * Generates a javascript translator object/hash for the specified 
fields.
         */
 
-       /*
+       
        function js_lang()
        {
                $keys = func_get_args();
@@ -87,7 +87,7 @@
                }
                return json_encode($strings);
        }
-       */
+       
 
        /**
        * cleans up a backtrace array and converts it to a string
@@ -828,7 +828,7 @@
                * Load the app include files if the exists                      
          *
                
\*************************************************************************/
                /* Then the include file */
-               if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && 
file_exists(PHPGW_APP_INC . '/functions.inc.php') && 
!isset($GLOBALS['phpgw_info']['menuaction']))
+               if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && 
file_exists(PHPGW_APP_INC . '/functions.inc.php') )
                {
                        include_once(PHPGW_APP_INC . '/functions.inc.php');
                }

Copied: branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js (from rev 9655, 
trunk/phpgwapi/js/yahoo/common.js)
===================================================================
--- branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js                     
        (rev 0)
+++ branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js     2012-06-25 
10:25:30 UTC (rev 9656)
@@ -0,0 +1,777 @@
+/*$Id: yui_booking_i18n.xsl 8267 2011-12-11 12:27:18Z sigurdne $*/
+YAHOO.namespace('portico');
+
+YAHOO.portico.js_alias_method_chain = function(constructor_func, func_name, 
new_feature_name, feature_impl_func) {
+       constructor_func.prototype[func_name+'_without_'+new_feature_name] = 
constructor_func.prototype[func_name];
+       constructor_func.prototype[func_name+'_with_'+new_feature_name] = 
feature_impl_func;
+       constructor_func.prototype[func_name] = 
constructor_func.prototype[func_name+'_with_'+new_feature_name];
+};
+
+YAHOO.portico.lang = function(section, config) {
+       config = config || {};
+       if (YAHOO && YAHOO.portico && YAHOO.portico.i18n && 
YAHOO.portico.i18n[section]) {
+               YAHOO.portico.i18n[section](config);
+       }
+       return config;
+};
+
+/** Hook widgets to translations **/
+YAHOO.portico.js_alias_method_chain(YAHOO.widget.Calendar, 'init', 'i18n', 
function(id, container, config) {
+       YAHOO.portico.lang('Calendar', config);
+       return this.init_without_i18n(id, container, config);
+});
+
+YAHOO.portico.js_alias_method_chain(YAHOO.widget.DataTable, '_initConfigs', 
'i18n', function(config) {
+       YAHOO.portico.lang('DataTable', config);
+       return this._initConfigs_without_i18n(config);
+});
+
+function y2k(number) { return (number < 1000) ? number + 1900 : number; }
+YAHOO.portico.weeknumber = function(when) {
+       var year = when.getFullYear();
+       var month = when.getMonth();
+       var day = when.getDate();
+
+       var newYear = new Date(year,0,1);
+       var modDay = newYear.getDay();
+       if (modDay == 0) modDay=6; else modDay--;
+
+       var daynum = ((Date.UTC(y2k(year),when.getMonth(),when.getDate(),0,0,0) 
- Date.UTC(y2k(year),0,1,0,0,0)) /1000/60/60/24) + 1;
+
+  if (modDay < 4 ) {
+       var weeknum = Math.floor((daynum+modDay-1)/7)+1;
+  } else {
+       var weeknum = Math.floor((daynum+modDay-1)/7);
+       if (weeknum == 0) {
+         year--;
+         var prevNewYear = new Date(year,0,1);
+         var prevmodDay = prevNewYear.getDay();
+         if (prevmodDay == 0) prevmodDay = 6; else prevmodDay--;
+         if (prevmodDay < 4) weeknum = 53; else weeknum = 52;
+       }
+  }
+  return + weeknum;
+}
+
+parseISO8601 = function (string) {
+       var regexp = "(([0-9]{4})(-([0-9]{1,2})(-([0-9]{1,2}))))?( 
)?(([0-9]{1,2}):([0-9]{1,2}))?";
+       var d = string.match(new RegExp(regexp));
+       var year = d[2] ? (d[2] * 1) : 0;
+       date = new Date(year, (d[4]||1)-1, d[6]||0);
+       if(d[9])
+               date.setHours(d[9]);
+       if(d[10])
+               date.setMinutes(d[10]);
+       return date;
+};
+
+YAHOO.portico.serializeForm = function(formID) {
+       var form = YAHOO.util.Dom.get(formID);
+       var values = [];
+       for(var i=0; i < form.elements.length; i++) {
+               var e = form.elements[i];
+               if(e.type=='checkbox' || e.type=='radio') {
+                       if(e.checked) {
+                               values.push(e.name + '=' + 
encodeURIComponent(e.value));
+                       }
+               } 
+               else if(e.name) {
+                       values.push(e.name + '=' + encodeURIComponent(e.value));
+               }
+       }
+       return values.join('&');
+};
+
+YAHOO.portico.fillForm = function(formID, params) {
+       var form = YAHOO.util.Dom.get(formID);
+       var values = [];
+       for(var i=0; i < form.elements.length; i++) {
+               var e = form.elements[i];
+               if((e.type=='checkbox' || e.type=='radio') && params[e.name]) {
+                       e.checked = true;
+               } 
+               else if(e.name && params[e.name] != undefined) {
+                       e.value = params[e.name];
+                       if(e._update) { // Is this connected to a date picker?
+                               e._update();
+                       }
+               }
+       }
+       return values.join('&');
+};
+
+YAHOO.portico.parseQS = function(qs) {
+       qs = qs.replace(/\+/g, ' ');
+       var args = qs.split('&');
+       var params = {};
+       for (var i = 0; i < args.length; i++) {
+               var pair = args[i].split('=');
+               var name = decodeURIComponent(pair[0]);
+               var value = (pair.length==2) ? decodeURIComponent(pair[1]) : 
name;
+               params[name] = value;
+       }
+       return params;
+}
+
+YAHOO.portico.formatLink = function(elCell, oRecord, oColumn, oData) { 
+       var name = oRecord.getData(oColumn.key);
+       var link = oRecord.getData('link');
+       elCell.innerHTML = '<a href="' + link + '">' + name + '</a>'; 
+};
+
+YAHOO.portico.formatGenericLink = function(elCell, oRecord, oColumn, oData)
+{
+       var data = oRecord.getData(oColumn.key);
+       //console.log(data['href']);
+       var link = data['href'];
+       var name = data['label'];
+       
+       elCell.innerHTML = '<a href="' + link + '">' + name + '</a>';
+};
+
+/*
+YAHOO.portico.formatGenericLink = function() {
+       var links = [];
+       var nOfLinks = arguments.length;
+
+       for (var i=0; i < nOfLinks; i++) { links[i] = arguments[i]; }
+       
+       return function(elCell, oRecord, oColumn, oData)
+       {
+               var nOfLinks = links.length;
+               var data = oRecord.getData(oColumn.key);
+               
+               var linksHtml = '';
+               if (nOfLinks > 0) {
+                       //Use specified link names
+                       for (var i=0; i < nOfLinks; i++) {
+                               if (data[i])
+                               {
+                                       linksHtml += '<div><a href="' + data[i] 
+ '">' + links[i] + '</a></div>';
+                               }
+                       }
+               } else {
+                       //Get label from embedded data
+                       if (data['href'] != undefined && data['label'] != 
undefined) {
+                               linksHtml += '<div><a href="' + data['href'] + 
'">' + data['label'] + '</a></div>';
+                       } else if(data['href'] == undefined && data['label'] != 
undefined) {
+                               linksHtml += '<div>'+data['label']+'</div>';
+                       }
+               }
+               
+               elCell.innerHTML = linksHtml;
+       };
+};
+*/
+YAHOO.portico.autocompleteHelper = function(url, field, hidden, container, 
label_attr) {
+       label_attr = label_attr || 'name';
+       var myDataSource = new YAHOO.util.DataSource(url);
+       myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+       myDataSource.connXhrMode = "queueRequests";
+       myDataSource.responseSchema = {
+               resultsList: "ResultSet.Result",
+               fields: [label_attr, 'id']
+       };
+       myDataSource.maxCacheEntries = 5; 
+       var ac = new YAHOO.widget.AutoComplete(field, container, myDataSource);
+       ac.queryQuestionMark = false;
+       ac.resultTypeList = false;
+       ac.forceSelection = true;
+       ac.itemSelectEvent.subscribe(function(sType, aArgs) {
+               YAHOO.util.Dom.get(hidden).value = aArgs[2].id;
+       });
+       return ac;
+};
+
+YAHOO.portico.setupInlineTablePaginator = function(container) {
+       var paginatorConfig = {
+               rowsPerPage: 10,
+               alwaysVisible: false,
+               template: "{PreviousPageLink} 
<strong>{CurrentPageReport}</strong> {NextPageLink}",
+               pageReportTemplate: "Showing items {startRecord} - {endRecord} 
of {totalRecords}",
+               containers: [YAHOO.util.Dom.get(container)]
+       };
+       
+       YAHOO.portico.lang('setupPaginator', paginatorConfig);
+       var pag = new YAHOO.widget.Paginator(paginatorConfig);
+   pag.render();
+       return pag;
+};
+
+YAHOO.portico.inlineTableHelper = function(container, url, colDefs, options, 
disablePagination) {
+       var Dom = YAHOO.util.Dom;
+       
+       var container = Dom.get(container);
+       if(!disablePagination) {
+               var paginatorContainer = 
container.appendChild(document.createElement('div'));
+               var dataTableContainer = 
container.appendChild(document.createElement('div'));
+       }
+       else {
+               dataTableContainer = container;
+       }
+       options = options || {};
+       options.dynamicData = true;
+       
+       if(!disablePagination) {
+               options.paginator = 
YAHOO.portico.setupInlineTablePaginator(paginatorContainer);
+               url += '&results=' + options.paginator.getRowsPerPage() + '&';
+       }
+       var myDataSource = new YAHOO.util.DataSource(url);
+       myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+       myDataSource.connXhrMode = "queueRequests";
+       myDataSource.responseSchema = {
+               resultsList: "ResultSet.Result",
+               metaFields : { totalResultsAvailable: 
"ResultSet.totalResultsAvailable", actions: 'Actions' }
+       };
+       
+       var myDataTable = new YAHOO.widget.DataTable(dataTableContainer, 
colDefs, myDataSource, options);
+       
+       myDataTable.handleDataReturnPayload = function(oRequest, oResponse, 
oPayload) {
+          oPayload.totalRecords = oResponse.meta.totalResultsAvailable;
+          return oPayload;
+   }
+       
+       myDataTable.doBeforeLoadData = function(nothing, data) {
+               if (!data.meta.actions) return data;
+               
+               actions = data.meta.actions;
+               
+               for (var key in actions) {
+                       var actionLink = document.createElement('a');
+                       actionLink.href = actions[key].href.replace(/&amp;/gi, 
'&');
+                       actionLink.innerHTML = actions[key].text;
+                       YAHOO.util.Dom.insertAfter(actionLink, container);
+               };
+               
+               return data;
+       };
+       return {dataTable: myDataTable, dataSource: myDataSource};
+};
+
+YAHOO.portico.inlineImages = function(container, url, options)
+{
+       options = options || {};
+       var myDataSource = new YAHOO.util.DataSource(url);
+       myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+       myDataSource.connXhrMode = "queueRequests";
+       myDataSource.responseSchema = {
+               resultsList: "ResultSet.Result",
+               metaFields : { totalResultsAvailable: 
"ResultSet.totalResultsAvailable", actions: 'Actions' }
+       };
+       
+       myDataSource.sendRequest('', {success: function(sRequest, oResponse, 
oPayload) {
+               var dlImages = new 
YAHOO.util.Element(document.createElement('dl'));
+               dlImages.addClass('proplist images');
+               
+               var displayContainer = false;
+               
+               for(var key in oResponse.results) { 
+                       displayContainer = true;
+                       var imgEl = 
dlImages.appendChild(document.createElement('dd')).appendChild(document.createElement('img'));
+                       var captionEl = 
dlImages.appendChild(document.createElement('dt'));
+                       imgEl.src = 
oResponse.results[key].src.replace(/&amp;/gi, '&');
+                       
captionEl.appendChild(document.createTextNode(oResponse.results[key].description));
+               }
+               
+               if (displayContainer)
+               {
+                       new YAHOO.util.Element(container).appendChild(dlImages);
+               } else {
+                       new YAHOO.util.Element(container).setStyle('display', 
'none');
+               }
+       }});
+};
+
+YAHOO.portico.radioTableHelper = function(container, url, name, selection) {
+       return YAHOO.portico.checkboxTableHelper(container, url, name, 
selection, {type: 'radio'});
+};
+
+YAHOO.portico.checkboxTableHelper = function(container, url, name, selection, 
options) {
+       options = YAHOO.lang.isObject(options) ? options : {};
+       
+       options = YAHOO.lang.merge(
+               {type: 'checkbox', selectionFieldOptions: {}, nameFieldOptions: 
{}, defaultChecked: false}, 
+               options
+       );
+       
+       var type = options['type'] || 'checkbox';
+       selection = selection || [];
+       var myDataSource = new YAHOO.util.DataSource(url);
+       myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+       myDataSource.connXhrMode = "queueRequests";
+       myDataSource.responseSchema = {
+               resultsList: "ResultSet.Result",
+               metaFields : { totalResultsAvailable: 
"ResultSet.totalResultsAvailable" }
+       };
+       
+       var lang = {LBL_NAME: 'Name'};
+       YAHOO.portico.lang('common', lang);
+       
+       var changeListener = false;
+       
+       if (options.onSelectionChanged) {
+               changeListener = function(e) {
+                       var selectedItems = [];
+                       var items = 
YAHOO.util.Dom.getElementsBy(function(i){return i.checked;}, 'input', 
container);
+                       
+                       YAHOO.util.Dom.batch(items, function(e, selectedItems) {
+                               selectedItems.push(e.value);
+                       }, selectedItems);
+                       
+                       options.onSelectionChanged(selectedItems);
+               };
+       }
+       
+       var checkboxFormatter = function(elCell, oRecord, oColumn, oData) { 
+               var checked = false;
+               var newInput; 
+               for(var i=0; i < selection.length; i++) {
+                       if (selection[i] == oData) {
+                               checked = true;
+                               break;
+                       }
+               }
+               
+               newInput = document.createElement('input');
+               newInput.setAttribute('type', type);
+               newInput.setAttribute('name', name);
+               newInput.setAttribute('value', oData);
+               if (checked || options.defaultChecked) {
+                       newInput.setAttribute('checked', 'checked');
+                       newInput.setAttribute('defaultChecked', true); //Needed 
for IE compatibility
+               }
+               
+               if (changeListener != false) {
+                       //Using 'click' event on IE as the change event does 
not work as expected there.
+                       YAHOO.util.Event.addListener(newInput, (YAHOO.env.ua.ie 
> 0 ? 'click' : 'change'), changeListener);
+               }
+               
+               elCell.appendChild(newInput);
+               
+       };
+       var colDefs = [
+               YAHOO.lang.merge({key: "id", formatter: checkboxFormatter, 
label: ''}, options.selectionFieldOptions),
+               YAHOO.lang.merge({key: "name", label: lang['LBL_NAME'], 
sortable: true}, options.nameFieldOptions)
+       ];
+       
+       if (options['additional_fields'] && 
YAHOO.lang.isArray(options['additional_fields'])) {
+               for (var i=0; i < options['additional_fields'].length; i++) {
+                       colDefs.push(options['additional_fields'][i]);
+               }
+       }
+       
+       var myDataTable = new YAHOO.widget.DataTable(container, colDefs, 
myDataSource, {
+          sortedBy: {key: 'name', dir: YAHOO.widget.DataTable.CLASS_ASC}
+       });
+};
+
+YAHOO.portico.setupDatePickers = function() { 
+       YAHOO.util.Dom.getElementsByClassName('date-picker', null, null, 
YAHOO.portico.setupDatePickerHelper, [true, false]);
+       YAHOO.util.Dom.getElementsByClassName('time-picker', null, null, 
YAHOO.portico.setupDatePickerHelper, [false, true]);
+       YAHOO.util.Dom.getElementsByClassName('datetime-picker', null, null, 
YAHOO.portico.setupDatePickerHelper, [true, true]);
+};
+
+YAHOO.portico.setupDatePickerHelper = function(field, args) {
+       if (!YAHOO.portico.setupDatePickerHelper.groups) {
+               YAHOO.portico.setupDatePickerHelper.groups = {};
+       }
+       
+       var groups = YAHOO.portico.setupDatePickerHelper.groups;
+       var Dom = YAHOO.util.Dom;
+       
+       if(field._converted)
+               return;
+       field._converted = true;
+       var date = args[0];
+       var time = args[1];
+       var Dom = YAHOO.util.Dom;
+       var Event = YAHOO.util.Event;
+       var oCalendarMenu = new YAHOO.widget.Overlay(Dom.generateId(), { 
visible: false});
+       var oButton = new YAHOO.widget.Button({type: "menu", id: 
Dom.generateId(), menu: oCalendarMenu, container: field});
+       
+       oButton.with_time = time;
+       oButton.with_date = date;
+       
+       var lang = {LBL_CHOOSE_DATE: 'Choose a date'};
+       YAHOO.portico.lang('setupDatePickerHelper', lang);
+       
+       oButton._calendarMenu = oCalendarMenu;
+       oButton._input = field._input = Dom.getElementsBy(function(){return 
true;}, 'input', field)[0];
+       
+       oButton.hasDateSection = function() { return this.with_date; };
+       oButton.hasTimeSection = function() { return this.with_time; };
+       
+       oButton.fireUpdateEvent = function() {
+               if (oButton.on_update) {
+                       oButton.on_update.func.call(oButton.on_update.context, 
oButton);
+               }
+       };
+       
+       oButton.on("appendTo", function () {
+               this._calendarMenu.setBody(" ");
+               this._calendarMenu.body.id = Dom.generateId();
+       });
+       if(!date)
+               oButton.setStyle('display', 'none');
+       //oButton._input.setAttribute('type', 'hidden');
+       oButton._input.style.display = 'none';
+       if(oButton._input.value)
+               oButton._date = parseISO8601(oButton._input.value);
+       else
+               oButton._date = new Date(1, 1, 1);
+       oButton._input._update = function() {
+               if(oButton._input.value)
+                       oButton._date = parseISO8601(oButton._input.value);
+               else
+                       oButton._date = new Date(1, 1, 1);
+               oButton._update(false);
+       };
+       oButton._update = function(fire_update_event) {
+               var year = this._date.getFullYear();
+               var month = this._date.getMonth() + 1;
+               var day = this._date.getDate();
+               var hours = this._date.getHours();
+               var minutes = this._date.getMinutes();
+               var month = month < 10 ? '0' + month : '' + month;
+               var day = day < 10 ? '0' + day : '' + day;
+               var hours = hours < 10 ? '0' + hours : '' + hours;
+               var minutes = minutes  < 10 ? '0' + minutes : '' + minutes;
+               var dateValue = year + '-' + month + '-' + day;
+               var timeValue = hours + ':' + minutes;
+               if(year == 1901) {
+                       this.set('label', lang.LBL_CHOOSE_DATE);
+               } else {
+                       this.set('label', dateValue);
+               }
+               if(time) {
+                       this._hours.set('value', parseInt(hours, 10));
+                       this._minutes.set('value', parseInt(minutes, 10));
+                       this._hours.update();
+                       this._minutes.update();
+               }
+               if(year != 1901 && date && time)
+                       this._input.value = dateValue + ' ' + timeValue;
+               else if (year != 1901 && date)
+                       this._input.value = dateValue;
+               else if(!date && time)
+                       this._input.value = timeValue;
+               
+               if (fire_update_event) {
+                       oButton.fireUpdateEvent();
+               }
+       };
+       
+       oButton.getDate = function() {
+               return this._date;
+       };
+
+       oButton.on("click", function () {
+               YAHOO.widget.DateMath.WEEK_ONE_JAN_DATE = 4;
+               var oCalendar = new YAHOO.widget.Calendar(Dom.generateId(), 
this._calendarMenu.body.id, {START_WEEKDAY: 1,SHOW_WEEK_HEADER:true});
+               oCalendar._button = this;
+               if(this._date.getFullYear() == 1901) {
+                       var d = new Date();
+                       oCalendar.cfg.setProperty("pagedate", (d.getMonth()+1) 
+ "/" + d.getFullYear());
+               } else {
+                       oCalendar.select(this._date);
+                       oCalendar.cfg.setProperty("pagedate", 
(this._date.getMonth()+1) + "/" + this._date.getFullYear());
+               }
+               
+               oCalendar.render();
+               // Hide date picker on ESC
+               Event.on(this._calendarMenu.element, "keydown", function 
(p_oEvent) {
+                       if (Event.getCharCode(p_oEvent) === 27) {
+                               this._calendarMenu.hide();
+                               this.focus();
+                       }
+               }, null, this);
+               oCalendar.selectEvent.subscribe(function (p_sType, p_aArgs) {
+                       if (p_aArgs) {
+                               var aDate = p_aArgs[0][0];
+                               this._date.setFullYear(aDate[0]);
+                               this._date.setMonth(aDate[1]-1);
+                               this._date.setDate(aDate[2]);
+                               this._update(true);
+                               //this._input.value = value;
+                       }
+                       this._calendarMenu.hide();
+               }, this, true);
+       });
+       if(time) {
+               oButton._hours = new YAHOO.portico.InputNumberRange({min: 0, 
max:23});
+               oButton._minutes = new YAHOO.portico.InputNumberRange({min: 0, 
max:59});
+               
+               oButton._hours.on('updateEvent', function() {
+                       oButton._date.setHours(this.get('value'));
+                       oButton._update(true);
+               });
+               
+               oButton._minutes.on('updateEvent', function() {
+                       oButton._date.setMinutes(this.get('value'));
+                       oButton._update(true);
+               });
+               
+               oButton.on("appendTo", function () {
+                       var timePicker = 
Dom.get(field).appendChild(document.createElement('span'));
+                       Dom.addClass(timePicker, 'time-picker-inputs');
+                       timePicker.appendChild(document.createTextNode(' '));
+                       oButton._hours.render(timePicker);
+                       timePicker.appendChild(document.createTextNode(' : '));
+                       oButton._minutes.render(timePicker);
+                       oButton._update(false);
+               });
+       }
+       oButton._update(false);
+       
+       var id = Dom.getAttribute(oButton._input, 'id');
+       var matches = /^([a-zA-Z][\w0-9\-_.:]+)_(from|to)$/.exec(id);
+       
+       var group_name = matches ? matches[1] : false;
+       var from_to = matches ? matches[2] : false;
+       
+       if (group_name && from_to && oButton.hasDateSection()) {
+               if (!groups[group_name]) { groups[group_name] = {}; }
+               
+               groups[group_name][from_to] = oButton;
+
+               if (groups[group_name]['from'] && groups[group_name]['to']) {
+                       groups[group_name]['from'].on_update = {
+                               context: groups[group_name]['to'], 
+                               func: function(fromDateButton) {
+                                       var fromDate = fromDateButton.getDate();
+                                       var currentYear = 
this._date.getFullYear();
+                                       
+                                       if (this._date.getFullYear() == 1901) {
+                                               
this._date.setFullYear(fromDate.getFullYear());
+                                               
this._date.setMonth(fromDate.getMonth());
+                                               
this._date.setDate(fromDate.getDate());
+                                       } else if (fromDate.getFullYear() <= 
this._date.getFullYear() && fromDate.getMonth() <= this._date.getMonth() && 
fromDate.getDate() <= this._date.getDate()) {
+                                               //this._date.
+                                       }
+                               
+                                       this._update(false);
+                               }
+                       };
+                       
+                       delete groups[group_name];
+               }
+       }
+};
+
+// Executed on all booking.uicommon-based pages
+YAHOO.util.Event.addListener(window, "load", function() {
+       YAHOO.portico.setupDatePickers(); 
+});
+var showIfNotEmpty = function(event, fieldname) {
+       if (document.getElementById(fieldname).value.length > 1) {
+               YAHOO.util.Dom.replaceClass(fieldname + "_edit", "hideit", 
"showit");
+       } else {
+               YAHOO.util.Dom.replaceClass(fieldname + "_edit", "showit", 
"hideit");
+       }
+};
+
+YAHOO.portico.rtfEditorHelper = function(textarea_id, options) {
+       options = YAHOO.lang.merge({width:522, height:300}, (options || {}));
+       var descEdit = new YAHOO.widget.SimpleEditor(textarea_id, {
+               height: options.height+'px',
+               width: options.width+'px',
+               dompath: true,
+               animate: true,
+               handleSubmit: true
+       });
+       descEdit.render();
+       return descEdit;
+};
+
+YAHOO.portico.postToUrl = function(path, params, method) {
+       method = method || "post"; // Set method to post by default, if not 
specified.
+       var form = document.createElement("form");
+       form.setAttribute("method", method);
+       form.setAttribute("action", path);
+
+       for(var key in params) {
+               var hiddenField = document.createElement("input");
+               hiddenField.setAttribute("type", "hidden");
+               hiddenField.setAttribute("name", params[key][0]);
+               hiddenField.setAttribute("value", params[key][1]);
+               form.appendChild(hiddenField);
+       }
+       document.body.appendChild(form);        // Not entirely sure if this is 
necessary
+       form.submit();
+};
+
+(function(){
+       var Dom = YAHOO.util.Dom,
+               Event = YAHOO.util.Event,
+               Panel = YAHOO.widget.Panel,
+               Lang = YAHOO.lang;
+
+       var CSS_PREFIX = 'booking_number_range_';
+ 
+       var InputNumberRange = function(oConfigs) {
+               InputNumberRange.superclass.constructor.call(this, 
document.createElement('span'), oConfigs);
+               this.createEvent('updateEvent');
+               this.refresh(['id'],true);
+       };
+
+       YAHOO.portico.InputNumberRange = InputNumberRange;
+
+       Lang.extend(InputNumberRange, YAHOO.util.Element, {
+               initAttributes: function (oConfigs) { 
+                       InputNumberRange.superclass.initAttributes.call(this, 
oConfigs);
+                       
+                       var container = this.get('element');
+               
+                       this.setAttributeConfig('inputEl', {
+                               readOnly: true,
+                               value: 
container.appendChild(document.createElement('span'))
+                       });
+       
+                       this.setAttributeConfig('id', {
+                               writeOnce: true,
+                               validator: function (value) {
+                                       return 
/^[a-zA-Z][\w0-9\-_.:]*$/.test(value);
+                               },
+                               value: Dom.generateId(),
+                               method: function (value) {
+                                       this.get('inputEl').id = value;
+                               }
+                       });
+       
+                       this.setAttributeConfig('value', {
+                               value: 0,
+                               validator: Lang.isNumber
+                 });
+               
+                       this.setAttributeConfig('input', {
+                               value: null
+                 });
+               
+                       this.setAttributeConfig('min', {
+                               validator: Lang.isNumber,
+                               value: 100
+                 });
+               
+                       this.setAttributeConfig('max', {
+                               validator: Lang.isNumber,
+                               value: 0
+                       });
+               
+                       this.setAttributeConfig('input_length', {
+                               validator: Lang.isNumber,
+                               value: null
+                       });
+               },
+       
+               destroy: function () { 
+                       var el = this.get('element');
+                       Event.purgeElement(el, true);
+                       el.parentNode.removeChild(el);
+               },
+               
+               _padValue: function(value)
+               {
+                       value = value.toString('10');
+                       var padding = this.get('input_length') - value.length;
+                       if (padding > 0) {
+                               return ((new Array(padding+1).join('0')) + 
value);
+                       }
+                       return value;
+               },
+               
+               _updateValue: function() {
+                       var input = this.get('input');
+                       var value;
+                       
+                       if (input.value.length > 0) {
+                               value = parseInt(input.value, 10);
+                       } else {
+                               value = 0;
+                       }
+                               
+                       if (isNaN(value)) { 
+                               value = this.get('min');
+                       }
+                       
+                       if (value < this.get('min')) {
+                               value = this.get('min');
+                       }
+                       
+                       if (value > this.get('max')) {
+                               value = this.get('max');
+                       }
+                       
+                       this.set('value', value);
+               },
+               
+               _fireUpdateEvent: function()
+               {
+                       this._updateValue();
+                       this.update();
+                       
+                       this.fireEvent('updateEvent');
+               },
+               
+               update: function() {
+                       if (!this.get('input')) { return; }
+                       this.get('input').value = 
this._padValue(this.get('value'));
+               },
+               
+               render: function (parentEl) {
+                       parentEl = Dom.get(parentEl);
+               
+                       if (!parentEl) {
+                               YAHOO.log('Missing mandatory argument in 
YAHOO.portico.InputNumberRange.render:  parentEl','error','Field');
+                               return null;
+                 }
+               
+                       var containerEl = this.get('element');
+                       this.addClass(CSS_PREFIX + 'container');
+               
+                       var inputEl = this.get('inputEl');
+                       Dom.addClass(inputEl, CSS_PREFIX + 'input');
+               
+                       this._renderInputEl(inputEl);
+               
+                       parentEl.appendChild(containerEl); //Appends to 
document to show the component
+               },
+               
+               _renderInputEl: function (containerEl) { 
+                       var input = 
containerEl.appendChild(document.createElement('input'));
+               
+                       if (!this.get('input_length')) {
+                               this.set('input_length', 
this.get('max').toString().length);
+                       }
+               
+                       var size = this.get('input_length');
+                       input.setAttribute('size', size);
+                       input.setAttribute('maxlength', size);
+                       
+                       if (YAHOO.env.ua.ie > 6) {
+                               YAHOO.util.Dom.setStyle(input, 'width', '2em');
+                       }
+                       
+                       input.value = this._padValue(this.get('value'));
+               
+                       this.set('input', input);
+               
+                       Event.on(input,'keyup', function (oArgs) {
+                               this._updateValue();
+                               }, this, true);
+               
+                       Event.on(input, 'change', function(oArgs) {
+                               this._fireUpdateEvent();
+                       }, this, true);
+                       
+                       oForm = input.form;
+                       
+                       if (oForm) {
+                               Event.on(oForm, "submit", function() {
+                                       this._fireUpdateEvent();
+                               }, null, this);
+                       }
+                       
+               }
+       });
+
+})();

Copied: branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js (from rev 
9655, trunk/phpgwapi/js/yahoo/datatable.js)
===================================================================
--- branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js                  
        (rev 0)
+++ branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js  2012-06-25 
10:25:30 UTC (rev 9656)
@@ -0,0 +1,178 @@
+YAHOO.portico.setupToolbar = function() {
+       YAHOO.portico.renderUiFormItems('toolbar');
+};
+
+YAHOO.portico.setupListActions = function() {
+       YAHOO.portico.renderUiFormItems('list_actions');
+};
+
+YAHOO.portico.renderUiFormItems = function(container) {
+       var items = YAHOO.util.Dom.getElementsBy(function(){return true;}, 
'input', container);
+   for(var i=0; i < items.length; i++) {
+       var type = items[i].getAttribute('type');
+       if(type == 'link') {
+           new YAHOO.widget.Button(items[i], 
+                                   {type: 'link', 
+                                    href: items[i].getAttribute('href')});
+       }
+       else if(type == 'submit') {
+           new YAHOO.widget.Button(items[i], {type: 'submit'});
+       }
+   }
+};
+
+YAHOO.portico.setupPaginator = function() {
+       var paginatorConfig = {
+        rowsPerPage: 10,
+        alwaysVisible: false,
+        template: "{PreviousPageLink} <strong>{CurrentPageReport}</strong> 
{NextPageLink}",
+        pageReportTemplate: "Showing items {startRecord} - {endRecord} of 
{totalRecords}",
+        containers: ['paginator']
+    };
+       
+       YAHOO.portico.lang('setupPaginator', paginatorConfig);
+       var pag = new YAHOO.widget.Paginator(paginatorConfig);
+    pag.render();
+       return pag;
+};
+
+YAHOO.portico.preSerializeQueryFormListeners = new Array();
+
+       YAHOO.portico.addPreSerializeQueryFormListener = function(func) {
+       YAHOO.portico.preSerializeQueryFormListeners.push(func);
+}
+
+YAHOO.portico.preSerializeQueryForm = function(form) {
+       for (var key in YAHOO.portico.preSerializeQueryFormListeners) {
+               YAHOO.portico.preSerializeQueryFormListeners[key](form);
+       }
+}
+
+YAHOO.portico.initializeDataTable = function()
+{
+       YAHOO.portico.setupToolbar();
+       YAHOO.portico.setupListActions();
+       YAHOO.portico.setupDatasource();
+       var pag = YAHOO.portico.setupPaginator();
+
+    var fields = [];
+    for(var i=0; i < YAHOO.portico.columnDefs.length; i++) {
+        fields.push(YAHOO.portico.columnDefs[i].key);
+    }
+    var baseUrl = YAHOO.portico.dataSourceUrl;
+    if(baseUrl[baseUrl.length - 1] != '&') {
+        baseUrl += '&';
+    }
+    
+    if (YAHOO.portico.initialSortedBy) {
+      baseUrl += 'sort=' + YAHOO.portico.initialSortedBy.key + '&dir=' + 
YAHOO.portico.initialSortedBy.dir;
+    } else {
+      baseUrl += 'sort=' + fields[0];
+    }
+       
+         baseUrl += '&results=' + pag.getRowsPerPage() + '&';
+    var myDataSource = new YAHOO.util.DataSource(baseUrl);
+
+    myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+    myDataSource.connXhrMode = "queueRequests";
+    myDataSource.responseSchema = {
+        resultsList: "ResultSet.Result",
+        fields: fields,
+        metaFields : {
+            totalResultsAvailable: "ResultSet.totalResultsAvailable",
+                       startIndex: 'ResultSet.startIndex',
+                       sortKey: 'ResultSet.sortKey',
+                       sortDir: 'ResultSet.sortDir'
+        }
+    };
+    var myDataTable = new YAHOO.widget.DataTable("datatable-container", 
+        YAHOO.portico.columnDefs, myDataSource, {
+            paginator: pag,
+            dynamicData: true,
+            sortedBy: YAHOO.portico.initialSortedBy || {key: fields[0], dir: 
YAHOO.widget.DataTable.CLASS_ASC}
+    });
+    var handleSorting = function (oColumn) {
+        var sDir = this.getColumnSortDir(oColumn);
+        var newState = getState(oColumn.key, sDir);
+        History.navigate("state", newState);
+    };
+    myDataTable.sortColumn = handleSorting;
+
+    var handlePagination = function(state) {
+        var sortedBy  = this.get("sortedBy");
+        var newState = getState(sortedBy.key, sortedBy.dir, 
state.recordOffset);
+        History.navigate("state", newState);
+     };
+    pag.unsubscribe("changeRequest", myDataTable.onPaginatorChangeRequest);
+    pag.subscribe("changeRequest", handlePagination, myDataTable, true);
+    myDataTable.doBeforeLoadData = function(oRequest, oResponse, oPayload) {
+        oPayload.totalRecords = oResponse.meta.totalResultsAvailable;
+               oPayload.pagination = { 
+                       rowsPerPage: oResponse.meta.paginationRowsPerPage || 
10, 
+                       recordOffset: oResponse.meta.startIndex || 0 
+           }
+               oPayload.sortedBy = { 
+                       key: oResponse.meta.sortKey || "id", 
+                       dir: (oResponse.meta.sortDir) ? "yui-dt-" + 
oResponse.meta.sortDir : "yui-dt-asc" 
+               };
+               return true;
+    }
+
+       YAHOO.util.Event.on(
+           YAHOO.util.Selector.query('select'), 'change', function (e) {
+               //var val = this.value;
+                       var state = getState();
+                       YAHOO.util.Dom.setStyle('list_flash', 'display', 
'none');
+                       History.navigate('state', state);
+       });
+
+    YAHOO.util.Event.addListener('queryForm', "submit", function(e){
+        YAHOO.util.Event.stopEvent(e);
+               var state = getState();
+               YAHOO.util.Dom.setStyle('list_flash', 'display', 'none');
+               History.navigate('state', state);
+    });
+
+       YAHOO.util.Event.addListener('list_actions_form', "submit", function(e){
+               YAHOO.util.Event.stopEvent(e);
+               window.setTimeout(function() {
+                       var state = getState();
+                       var action = myDataSource.liveData + '&' + state;
+                       action = action.replace('&phpgw_return_as=json', '');
+                       
YAHOO.util.Dom.setAttribute(document.getElementById('list_actions_form'), 
'action', action);
+                  document.getElementById('list_actions_form').submit();
+               }, 0);
+       });
+
+       var History = YAHOO.util.History; 
+       var getState = function(skey, sdir, start) {
+               var state = YAHOO.portico.serializeForm('queryForm');
+               var sortedBy  = myDataTable.get("sortedBy");
+               skey = skey ? skey : sortedBy.key;
+               sdir = sdir ? sdir : sortedBy.dir; 
+               sdir = sdir == 'yui-dt-asc' ? 'asc' : 'desc';
+               start = start ? start : 0;
+               state += '&sort=' + skey;
+               state += '&dir=' + sdir;
+               state += '&startIndex=' + start;
+               return state;
+       }
+
+       var handleHistoryNavigation = function (state) {
+               var params = YAHOO.portico.parseQS(state);
+               YAHOO.portico.fillForm('queryForm', params);
+               myDataSource.sendRequest(state, {success: function(sRequest, 
oResponse, oPayload) {
+                       myDataTable.onDataReturnInitializeTable(sRequest, 
oResponse, pag);
+               }});
+       };
+       
+       var initialRequest = History.getBookmarkedState("state") || getState();
+       History.register("state", initialRequest, handleHistoryNavigation);
+       History.onReady(function() {
+               var state = YAHOO.util.History.getCurrentState('state');
+               handleHistoryNavigation(state);
+       });
+       History.initialize("yui-history-field", "yui-history-iframe");
+};
+
+YAHOO.util.Event.addListener(window, "load", 
YAHOO.portico.initializeDataTable);

Copied: 
branches/Version-1_0-branch/phpgwapi/templates/base/datatable_common.xsl (from 
rev 9655, trunk/phpgwapi/templates/base/datatable_common.xsl)
===================================================================
--- branches/Version-1_0-branch/phpgwapi/templates/base/datatable_common.xsl    
                        (rev 0)
+++ branches/Version-1_0-branch/phpgwapi/templates/base/datatable_common.xsl    
2012-06-25 10:25:30 UTC (rev 9656)
@@ -0,0 +1,252 @@
+<func:function name="phpgw:conditional">
+       <xsl:param name="test"/>
+       <xsl:param name="true"/>
+       <xsl:param name="false"/>
+
+       <func:result>
+               <xsl:choose>
+                       <xsl:when test="$test">
+                       <xsl:value-of select="$true"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$false"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </func:result>
+</func:function>
+
+<xsl:template match="data">
+       <xsl:choose>
+               <xsl:when test="js_lang != ''">
+                       <script>
+                               var lang = <xsl:value-of select="js_lang"/>;
+                       </script>
+               </xsl:when>
+       </xsl:choose>
+
+       <iframe id="yui-history-iframe" 
src="phpgwapi/js/yahoo/history/assets/blank.html" 
style="position:absolute;top:0; left:0;width:1px; 
height:1px;visibility:hidden;"></iframe>
+       <input id="yui-history-field" type="hidden"/>
+       <xsl:call-template name="yui_phpgw_i18n"/>
+       <xsl:apply-templates select="form" />
+       <xsl:apply-templates select="paging"/>
+       <div id="list_flash">
+               <xsl:call-template name="msgbox"/>
+       </div>
+       <xsl:apply-templates select="datatable"/> 
+       <xsl:apply-templates select="form/list_actions"/>
+</xsl:template>
+
+<xsl:template match="toolbar">
+    <div id="toolbar">
+                 <table class='yui-skin-sam' border="0" cellspacing="0" 
cellpadding="0" style="padding:0px; margin:0px;">
+                       <tr>
+        <xsl:for-each select="item">
+                       <xsl:variable name="filter_key" 
select="concat('filter_', name)"/>
+                       <xsl:variable name="filter_key_name" 
select="concat(concat('filter_', name), '_name')"/>
+                       <xsl:variable name="filter_key_id" 
select="concat(concat('filter_', name), '_id')"/>
+               
+                       <xsl:choose>
+                               <xsl:when test="type = 'date-picker'">
+                                       <td valign="top">
+                                       <div class="date-picker">
+                       <input id="filter_{name}" name="filter_{name}" 
type="text">
+                                                       <xsl:attribute 
name="value"><xsl:value-of select="../../../filters/*[local-name() = 
$filter_key]"/></xsl:attribute>
+                                               </input>
+                </div>
+                                       </td>
+                               </xsl:when>
+                               <xsl:when test="type = 'autocomplete'">
+                                       <td valign="top" width="160px">
+                                               <div style="width:140px">
+                                                       <input 
id="filter_{name}_name" name="filter_{name}_name" type="text">
+                                                               <xsl:attribute 
name="value"><xsl:value-of select="../../../filters/*[local-name() = 
$filter_key_name]"/></xsl:attribute>
+                                                       </input>
+                                                       <input 
id="filter_{name}_id" name="filter_{name}_id" type="hidden">
+                                                               <xsl:attribute 
name="value"><xsl:value-of select="../../../filters/*[local-name() = 
$filter_key_id]"/></xsl:attribute>
+                                                       </input>
+                                                       <div 
id="filter_{name}_container"/>
+                                               </div>
+                                               <script type="text/javascript"> 
+                                               
YAHOO.util.Event.onDOMReady(function() {
+                                                  var app = "<xsl:value-of 
select="app"/>";
+                                                  var name = "<xsl:value-of 
select="name"/>";
+                                                       var ui = "<xsl:value-of 
select="ui"/>";
+
+                                                       var itemSelectCallback 
= false;
+                                                       <xsl:if 
test="onItemSelect">
+                                                               
itemSelectCallback = <xsl:value-of select="onItemSelect"/>;
+                                                       </xsl:if>
+
+                                                       var 
onClearSelectionCallback = false;
+                                                       <xsl:if 
test="onClearSelection">
+                                                               
onClearSelectionCallback = <xsl:value-of select="onClearSelection"/>;
+                                                       </xsl:if>
+
+                                                       var requestGenerator = 
false;
+                                                       <xsl:if 
test="requestGenerator">
+                                                               
requestGenerator = <xsl:value-of select="requestGenerator"/>;
+                                                       </xsl:if>
+
+                                                       <![CDATA[
+                                                       var oArgs = 
{menuaction: app + '.ui'+ui+'.index'};
+                                                       var requestUrl = 
phpGWLink('index.php', oArgs, true);
+                                                       requestUrl += 
'filter_'+name+'_name', 'filter_'+name+'_id', 'filter_'+name+'_container';
+                                                       alert('FIXME: 
autocompleteHelper::requestUrl ' + requestUrl );
+
+                                                       var oAC = 
YAHOO.portico.autocompleteHelper(requestUrl);
+
+                                                       if (requestGenerator) {
+                                                               
oAC.generateRequest = requestGenerator;
+                                                       }
+
+                                                       if (itemSelectCallback) 
{
+                                                               
oAC.itemSelectEvent.subscribe(itemSelectCallback);
+                                                       }
+
+                                                       
YAHOO.util.Event.addBlurListener('filter_'+name+'_name', function() {
+                                                               if 
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "") {
+                                                                       
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
+                                                                       if 
(onClearSelectionCallback) {
+                                                                               
onClearSelectionCallback();
+                                                                       }
+                                                               }
+                                                       });
+
+                                                       
YAHOO.portico.addPreSerializeQueryFormListener(function(form) {
+                                                               if 
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "") {
+                                                                       
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
+                                                               } 
+                                                       });
+                                                       ]]>
+                                               });
+                                               </script>
+                                       </td>
+                               </xsl:when>
+                               <xsl:when test="type = 'filter'">
+                                       <td valign="top">
+                    <xsl:variable name="name"><xsl:value-of 
select="name"/></xsl:variable>
+                       <select name="{$name}" 
onMouseout="window.status='';return true;">
+                        <xsl:for-each select="list">
+                               <xsl:variable name="id"><xsl:value-of 
select="id"/></xsl:variable>
+                                                       <xsl:if test="id = ''">
+                                       <option value="{$id}" 
selected="selected">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </option>
+                                                       </xsl:if>
+                                                       <xsl:if test="id != ''">
+                                       <option value="{$id}">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </option>
+                                                       </xsl:if>
+                        </xsl:for-each>
+                       </select>
+                    </td>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <td valign="top">
+                                       <input id="innertoolbar">
+                                               <xsl:attribute 
name="type"><xsl:value-of select="phpgw:conditional(not(type), '', 
type)"/></xsl:attribute>
+                                               <xsl:attribute 
name="name"><xsl:value-of select="phpgw:conditional(not(name), '', 
name)"/></xsl:attribute>
+                                               <xsl:attribute 
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '', 
onClick)"/></xsl:attribute>
+                                               <xsl:attribute 
name="value"><xsl:value-of select="phpgw:conditional(not(value), '', 
value)"/></xsl:attribute>
+                                               <xsl:attribute 
name="href"><xsl:value-of select="phpgw:conditional(not(href), '', 
href)"/></xsl:attribute>
+                                       </input>
+                                       </td>
+                               </xsl:otherwise>
+                       </xsl:choose>
+        </xsl:for-each>
+                 </tr>
+                       <xsl:if test="item/text and normalize-space(item/text)">
+                               <thead style="background:none">
+                                       <tr>
+                                               <xsl:for-each select="item">
+                                                       <td>
+                                                               <xsl:if 
test="name">
+                                                                       <label 
style='margin:auto 0.25em'>
+                                                                               
<xsl:attribute name="for"><xsl:value-of select="phpgw:conditional(not(name), 
'', name)"/></xsl:attribute>
+                                                                               
<xsl:value-of select="phpgw:conditional(not(text), '', text)"/>
+                                                                       </label>
+                                                               </xsl:if>
+                                                       </td>
+                                               </xsl:for-each>
+                                       </tr>
+                               </thead>
+                       </xsl:if>
+               </table>
+    </div>
+</xsl:template>
+
+<xsl:template match="form/list_actions">
+       <form id="list_actions_form" method="POST">
+               <!-- Form action is set by javascript listener -->
+               <div id="list_actions" class='yui-skin-sam'>
+                       <table cellpadding="0" cellspacing="0">
+                               <tr>
+                                       <xsl:for-each select="item">
+                                               <td valign="top">
+                                                       <input 
id="innertoolbar">
+                                                               <xsl:attribute 
name="type"><xsl:value-of select="phpgw:conditional(not(type), '', 
type)"/></xsl:attribute>
+                                                               <xsl:attribute 
name="name"><xsl:value-of select="phpgw:conditional(not(name), '', 
name)"/></xsl:attribute>
+                                                               <xsl:attribute 
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '', 
onClick)"/></xsl:attribute>
+                                                               <xsl:attribute 
name="value"><xsl:value-of select="phpgw:conditional(not(value), '', 
value)"/></xsl:attribute>
+                                                               <xsl:attribute 
name="href"><xsl:value-of select="phpgw:conditional(not(href), '', 
href)"/></xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </xsl:for-each>
+                               </tr>
+                       </table>
+               </div>
+       </form>
+</xsl:template>
+<xsl:template match="form">
+       <form id="queryForm">
+               <xsl:attribute name="method">
+                       <xsl:value-of select="phpgw:conditional(not(method), 
'GET', method)"/>
+               </xsl:attribute>
+
+               <xsl:attribute name="action">
+                       <xsl:value-of select="phpgw:conditional(not(action), 
'', action)"/>
+               </xsl:attribute>
+        <xsl:apply-templates select="toolbar"/>
+       </form>
+</xsl:template>
+
+<xsl:template match="datatable">
+    <div id="paginator"/>
+    <div id="datatable-container"/>
+       <xsl:call-template name="datasource-definition" />
+</xsl:template>
+
+<xsl:template name="datasource-definition">
+       <script>
+               YAHOO.portico.setupDatasource = function() {
+                       <xsl:if test="source">
+                   YAHOO.portico.dataSourceUrl = '<xsl:value-of 
select="source"/>';
+                                       YAHOO.portico.initialSortedBy = false;
+                                       YAHOO.portico.initialFilters = false;
+                                       <xsl:if test="sorted_by">
+                                               YAHOO.portico.initialSortedBy = 
{key: '<xsl:value-of select="sorted_by/key"/>', dir: '<xsl:value-of 
select="sorted_by/dir"/>'};
+                                       </xsl:if>
+               </xsl:if>
+
+                       YAHOO.portico.columnDefs = [
+                               <xsl:for-each select="//datatable/field">
+                                       {
+                                               key: "<xsl:value-of 
select="key"/>",
+                                               <xsl:if test="label">
+                                               label: "<xsl:value-of 
select="label"/>",
+                                           </xsl:if>
+                                               sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+                                               <xsl:if test="hidden">
+                                               hidden: true,
+                                           </xsl:if>
+                                               <xsl:if test="formatter">
+                                               formatter: <xsl:value-of 
select="formatter"/>,
+                                           </xsl:if>
+                                               className: "<xsl:value-of 
select="className"/>"
+                                       }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+                               </xsl:for-each>
+                       ];
+               }
+       </script>
+</xsl:template>

Modified: branches/Version-1_0-branch/property/inc/class.bobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bobudget.inc.php     
2012-06-25 10:21:02 UTC (rev 9655)
+++ branches/Version-1_0-branch/property/inc/class.bobudget.inc.php     
2012-06-25 10:25:30 UTC (rev 9656)
@@ -80,6 +80,7 @@
                        $filter                                 = 
phpgw::get_var('filter', 'int');
                        $cat_id                                 = 
phpgw::get_var('cat_id', 'int');
                        $dimb_id                                = 
phpgw::get_var('dimb_id', 'int');
+                       $department                             = 
phpgw::get_var('department', 'int');
                        $allrows                                = 
phpgw::get_var('allrows', 'bool');
                        $district_id                    = 
phpgw::get_var('district_id', 'int');
                        $year                                   = 
phpgw::get_var('year', 'int');
@@ -95,6 +96,8 @@
                        $this->order                    = isset($order) && 
$order ? $order : '';
                        $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
                        $this->dimb_id                  = isset($dimb_id) && 
$dimb_id ? $dimb_id : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb'];
+                       $this->department                       = 
isset($department) && $department ? $department : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['department'];
+
                        $this->part_of_town_id  = isset($part_of_town_id) && 
$part_of_town_id ? $part_of_town_id : '';
                        $this->district_id              = isset($district_id) 
&& $district_id ? $district_id : '';
                        $this->grouping                 = isset($grouping) && 
$grouping ? $grouping : '';
@@ -143,7 +146,7 @@
                        $budget = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,
                                'district_id' => $this->district_id,'year' => 
$this->year,'grouping' => $this->grouping,'revision' => $this->revision,
-                               'cat_id' => $this->cat_id, 'dimb_id' => 
$this->dimb_id));
+                               'cat_id' => $this->cat_id, 'dimb_id' => 
$this->dimb_id, 'department' => $this->department));
 
                        $this->total_records            = 
$this->so->total_records;
                        $this->sum_budget_cost          = 
$this->so->sum_budget_cost;
@@ -180,7 +183,7 @@
                                'sort' => strtoupper($this->sort), 'order' => 
$this->order, 'filter' => $this->filter,
                                'cat_id' => $this->cat_id, 
'allrows'=>$this->allrows, 'district_id' => $this->district_id,
                                'year' => $this->year, 'grouping' => 
$this->grouping, 'revision' => $this->revision,
-                               'details' => $this->details,'dimb_id' => 
$this->dimb_id));
+                               'details' => $this->details,'dimb_id' => 
$this->dimb_id, 'department' => $this->department));
 
                        $this->total_records            = 
$this->so->total_records;
                        $this->sum_budget_cost          = 
$this->so->sum_budget_cost;

Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php

@@ Diff output truncated at 153600 characters. @@



reply via email to

[Prev in Thread] Current Thread [Next in Thread]