fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9464] Merge 9433:9463 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9464] Merge 9433:9463 from trunk
Date: Tue, 29 May 2012 12:21:41 +0000

Revision: 9464
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9464
Author:   sigurdne
Date:     2012-05-29 12:21:39 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Merge 9433:9463 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
    
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.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.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
    branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.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/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/register_case.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
    branches/Version-1_0-branch/controller/templates/base/control/control.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_item/sort_check_list.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css

Added Paths:
-----------
    
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.control_item_option.inc.php
    
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.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
   + 
/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

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-05-29 12:21:39 UTC (rev 9464)
@@ -287,12 +287,11 @@
                                $sql .= "AND cic.status = 2 ";
                        else if($status == 'open_or_waiting')
                                $sql .= "AND (cic.status = 0 OR cic.status = 2) 
";
-                               
-                       if($type == 'control_item_type_1')
-                               $sql .= "AND coi.type = 'control_item_type_1' ";
-                       else if($type == 'control_item_type_2')
-                               $sql .= "AND coi.type = 'control_item_type_2' ";
-                                                       
+                       
+                       if($type != null){
+                               $sql .= "AND coi.type = '$type' ";
+                       }
+                                                                               
                        if($messageStatus != null & $messageStatus == 
'no_message_registered')
                                $sql .= "AND cic.location_item_id IS NULL ";
                        else if($messageStatus != null &  $messageStatus == 
'message_registered')

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-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-05-29 12:21:39 UTC (rev 9464)
@@ -384,15 +384,6 @@
                                
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
                                
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
                                
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                                                               
-                               if($use_location_inparam)
-                               {
-                                       
$control->set_location_code($location_code);
-                               }
-                               else
-                               {
-                                       
$control->set_location_code($this->unmarshal($this->db->f('c_location_code', 
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'));
                                                                

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2012-05-29 12:21:39 UTC (rev 9464)
@@ -164,7 +164,7 @@
                                $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
                                
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
 
-                               $results[] = $control_group;
+                               $results[] = $control_group->toArray();
                        }
 
                        return $results;

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php   
    2012-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php   
    2012-05-29 12:21:39 UTC (rev 9464)
@@ -200,23 +200,6 @@
 
                function get_id_field_name($extended_info = false){}
 
-               function populate(int $control_group_id, &$control_group)
-               {
-                       /*
-                       if($control_group == null) {
-                               $control_group = new 
controller_control_group((int) $control_group_id);
+               function populate(int $control_group_id, &$control_group){}
 
-                               
$control_group->set_group_name($this->unmarshal($this->db->f('group_name'), 
'string'));
-                               
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
-                               
$control_group->set_procedure_name($this->unmarshal($this->db->f('procedure_title'),
 'string'));
-                               
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
 'int'));
-                               
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
-                               
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
-                               
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
-                       }
-                       //var_dump($control_group);
-                       return $control_group;
-                       */
-               }
-
        }

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php     
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php     
2012-05-29 12:21:39 UTC (rev 9464)
@@ -147,17 +147,49 @@
                        
                        return $control_item;
                }
+               
+               public function get_single_with_options($id){
+                       $sql  = "SELECT ci.id as ci_id, ci.*, cio.id as cio_id, 
cio.* ";
+                       $sql .= "FROM controller_control_item ci "; 
+                       $sql .= "LEFT JOIN controller_control_item_option as 
cio ON cio.control_item_id = ci.id ";
+                       $sql .= "WHERE ci.id = $id";
+                                                                               
        
+                       $this->db->query($sql);
+                       
+                       $counter = 0;
+                       $control_item = null;
+                       while ($this->db->next_record()) {
+                               
+                               if( $counter == 0 ){
+                                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                                       
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
+                                       
$control_item->set_required($this->unmarshal($this->db->f('required', true), 
'bool'));
+                                       
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do', 
true), 'string'));
+                                       
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true), 
'string'));
+                                       
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                                       
$control_item->set_control_group_name($this->unmarshal($this->db->f('control_group_name',
 true), 'string'));
+                                       
$control_item->set_control_area_id($this->unmarshal($this->db->f('control_area_id')));
+                                       $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', true), 'int'));
+                                       
$control_item->set_control_area_name($category[0]['name']);
+                                       
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
+                               }
+                               
+                               if($this->db->f('cio_id', true) != ''){
+                                       $control_item_option = new 
controller_control_item_option();
+                                       
$control_item_option->set_id($this->unmarshal($this->db->f('cio_id', true), 
'int'));
+                                       
$control_item_option->set_option_value($this->unmarshal($this->db->f('option_value',
 true), 'string'));
+                                       
$control_item_option->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
+                                       $options_array[] = 
$control_item_option->toArray();
+                               }
+                               
+                               $counter++;
+                       }
+                       $control_item->set_options_array( $options_array );
+                       
+                       return $control_item->toArray();
+               }
 
-               /**
-                * Get a list of procedure objects matching the specific filters
-                * 
-                * @param $start search result offset
-                * @param $results number of results to return
-                * @param $sort field to sort by
-                * @param $query LIKE-based query string
-                * @param $filters array of custom filters
-                * @return list of rental_composite objects
-                */
                function get_control_item_array($start = 0, $results = 1000, 
$sort = null, $dir = '', $query = null, $search_option = null, $filters = 
array())
                {
                        $results = array();
@@ -330,7 +362,7 @@
                        $results = array();
                        
                        $sql = "select ci.* from controller_control_item ci, 
controller_control_item_list cil where ci.control_group_id = 
{$control_group_id} and cil.control_id = {$control_id} and ci.id = 
cil.control_item_id";
-                       //var_dump($sql);
+
                        $this->db->query($sql, __LINE__, __FILE__);
                        
                        while($this->db->next_record())

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php    
    2012-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php    
    2012-05-29 12:21:39 UTC (rev 9464)
@@ -31,6 +31,7 @@
        phpgw::import_class('controller.socommon');
 
        include_class('controller', 'control_item_list', 'inc/model/');
+       include_class('controller', 'control_item_option', 'inc/model/');
 
        class controller_socontrol_item_list extends controller_socommon
        {
@@ -68,13 +69,10 @@
                        );
 
                        $result = $this->db->query( 'INSERT INTO 
controller_control_item_list (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
-                       //$result = $this->db->query($sql, __LINE__,__FILE__);
 
                        if(isset($result)) {
                                // return the new control item ID
                                return 
$this->db->get_last_insert_id('controller_control_item_list', 'id');
-                               // Forward this request to the update method
-                               //return $this->update($control_item);
                        }
                        else
                        {
@@ -221,6 +219,73 @@
                        return $results;
                }
 
+               function 
get_control_items_and_options_by_control_and_group($control_id, 
$control_group_id, $return_type = "return_array")
+               {
+                       $results = array();
+
+                       $sql  = "SELECT ci.id as ci_id, ci.*, cio.id as cio_id, 
cio.* ";
+                       $sql .= "FROM controller_control_item ci ";
+                       $sql .= "LEFT JOIN controller_control_item_list cl ON 
cl.control_item_id = ci.id ";
+                       $sql .= "LEFT JOIN controller_control c ON c.id = 
cl.control_id ";
+                       $sql .= "LEFT JOIN controller_control_item_option cio 
ON ci.id = cio.control_item_id ";
+                       $sql .= "WHERE c.id=$control_id ";
+                       $sql .= "AND ci.control_group_id=$control_group_id ";
+                       $sql .= "ORDER BY cl.order_nr";
+                       
+                       $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
+                       
+                       $control_item_id = 0;
+                       $control_item = null;
+                       $control_item_array = array();
+                       while ($this->db->next_record()) {
+                               if( $this->db->f('ci_id', true) != 
$control_item_id ){
+                                       if($control_item_id != 0){
+                                               
$control_item->set_options_array($options_array);
+                                               
+                                               if($return_type == 
"return_array")
+                                                       $control_item_array[] = 
$control_item->toArray();
+                                               else
+                                                       $control_item_array[] = 
$control_item;
+                                       }
+                                               
+                                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                                       
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
+                                       
$control_item->set_required($this->unmarshal($this->db->f('required', true), 
'boolean'));
+                                       
$control_item->set_what_to_do($this->unmarshal($this->db->f('what_to_do', 
true), 'string'));
+                                       
$control_item->set_how_to_do($this->unmarshal($this->db->f('how_to_do', true), 
'string'));
+                                       
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
+                                       
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
+
+                                       $options_array = array();
+                               }
+                               
+                               $control_item_option = new 
controller_control_item_option($this->db->f('option_value', true), 
$this->db->f('control_item_id', true));
+                               
$control_item_option->set_id($this->db->f('cio_id', true));
+                               
+                               if($return_type == "return_array")
+                                       $options_array[] = 
$control_item_option->toArray();
+                               else
+                                       $options_array[] = $control_item_option;
+                                
+                               
+                               $control_item_id = $control_item->get_id();
+                       }
+                       
+                       if($control_item != null){
+                               
$control_item->set_options_array($options_array);
+
+                               if($return_type == "return_array"){
+                                       $control_item_array[] = 
$control_item->toArray();
+                               }else{
+                                       $control_item_array[] = $control_item;
+                               }
+                               
+                               return $control_item_array;
+                       }else {
+                               return null;
+                       }
+               }
+               
                // Deletes control list item defines by control id and control 
item id
                function delete($control_id, $control_item_id)
                {

Copied: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php 
(from rev 9463, trunk/controller/inc/class.socontrol_item_option.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php  
                            (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php  
    2012-05-29 12:21:39 UTC (rev 9464)
@@ -0,0 +1,102 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.socontrol_item.inc.php 8909 2012-02-17 08:51:35Z 
erikhl $
+       */      
+
+       phpgw::import_class('controller.socommon');
+
+       include_class('controller', 'control_item_option', 'inc/model/');
+
+       class controller_socontrol_item_option extends controller_socommon
+       {
+               protected static $so;
+
+               public static function get_instance()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol_item_option');
+                       }
+                       return self::$so;
+               }
+
+               function add(&$control_item_option)
+               {
+                       $cols = array(
+                                       'option_value',
+                                       'control_item_id'
+                       );
+
+                       $values = array(
+                               
$this->marshal($control_item_option->get_option_value(), 'string'),
+                               
$this->marshal($control_item_option->get_control_item_id(), 'int')
+                       );
+
+                       $result = $this->db->query('INSERT INTO 
controller_control_item_option (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
+
+                       if(isset($result)) {
+                               // return the new control item ID
+                               return 
$this->db->get_last_insert_id('controller_control_item_option', 'id');
+                       }
+                       else
+                       {
+                               return 0;
+                       }
+               }
+
+               function update($control_item_option)
+               {
+                       $id = intval($control_item_option->get_id());
+
+                       $values = array(
+                               'option_value = ' . 
$this->marshal($control_item_option->get_option_value(), 'string'),
+                               'control_item_id = ' . 
$this->marshal($control_item->get_control_item_id(), 'int')
+                       );
+
+                       $result = $this->db->query('UPDATE 
controller_control_item_option SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
+
+                       return isset($result);
+               }
+               
+               function get_single($id)
+               {
+                       $id = (int)$id;
+                       $sql = "SELECT p.* FROM controller_control_item_option 
p {$joins} WHERE p.id = " . $id;
+                       $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+                       $this->db->next_record();
+
+                       $control_item_option = new 
controller_control_item_option($this->unmarshal($this->db->f('id', true), 
'int'));
+                       
$control_item_option->set_option_value($this->unmarshal($this->db->f('option_value',
 true), 'string'));
+                       
$control_item_option->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                                               
+                       return $control_item_option;
+               }
+               
+               function get_id_field_name(){}
+               function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean 
$return_count){}
+               function populate(int $object_id, &$object){}
+       }

Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-05-29 12:21:39 UTC (rev 9464)
@@ -75,7 +75,6 @@
                        $control_item_id = phpgw::get_var('control_item_id');
                        $case_descr = phpgw::get_var('case_descr');
                        $type = phpgw::get_var('type');
-                       $measurement = phpgw::get_var('measurement');
                        $status = phpgw::get_var('status');
                         
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
@@ -95,6 +94,7 @@
                        
                        */
                        
+                       // Makes a check item if there isn't already made one  
                        if($check_item == null){
                                $new_check_item = new controller_check_item();
                                $new_check_item->set_check_list_id( 
$check_list_id );
@@ -116,9 +116,20 @@
                        $case->set_modified_date($todays_date_ts);
                        $case->set_modified_by($user_id);
                        $case->set_modified_by($user_id);
-                       $case->set_measurement($measurement);
                        $case->set_status($status);
-                               
+
+                       // Saves selected value from  or measurement
+                       if($type == 'control_item_type_2'){
+                               $measurement = phpgw::get_var('measurement');
+                               $case->set_measurement( $measurement );
+                       }else if($type == 'control_item_type_3'){
+                               $option_value = phpgw::get_var('option_value');
+                               $case->set_measurement( $option_value );
+                       }else if($type == 'control_item_type_4'){
+                               $option_value = phpgw::get_var('option_value');
+                               $case->set_measurement( $option_value );
+                       }
+                       
                        $case_id = $this->so->store($case);
                        
                        if($case_id > 0){
@@ -127,8 +138,9 @@
                                                
                                return json_encode( array( "status" => "saved" 
) );
                        }
-                       else
-                               return json_encode( array( "status" => 
"not_saved" ) ); 
+                       else{
+                               return json_encode( array( "status" => 
"not_saved" ) );
+                       }       
                }
                
                function save_case(){
@@ -160,9 +172,9 @@
                                
                                return json_encode( array( "status" => "saved", 
"type" => $type, "caseObj" => $case->toArray() ) );
                        }
-                       else
+                       else{
                                return json_encode( array( "status" => 
"not_saved" ) );
-                       
+                       }
                }
                
                function create_case_message(){
@@ -382,8 +394,9 @@
                                                
                                return json_encode( array( "status" => 
"deleted" ) );
                        }
-                       else
+                       else{
                                return json_encode( array( "status" => 
"not_deleted" ) );
+                       }
                }
                
                public function close_case()
@@ -402,8 +415,9 @@
                                                
                                return json_encode( array( "status" => "true" ) 
);
                        }
-                       else
+                       else{
                                return json_encode( array( "status" => "false" 
) );
+                       }
                }
                
                public function open_case()
@@ -422,8 +436,9 @@
                                                
                                return json_encode( array( "status" => "true" ) 
);
                        }
-                       else
+                       else{
                                return json_encode( array( "status" => "false" 
) );
+                       }
                }
                
                public function query(){}

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-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-05-29 12:21:39 UTC (rev 9464)
@@ -561,10 +561,11 @@
                        //Populating array with saved control items for each 
group
                        foreach ($saved_control_groups as $control_group)
                        {       
-                               $saved_control_items = 
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
 $control_group->get_id());
-                               
-                               if(count($saved_control_items) > 0)             
                
+                               $saved_control_items = 
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
 $control_group->get_id(), "return_array");
+
+                               if(count($saved_control_items) > 0){            
                
                                        $control_groups_with_items_array[] = 
array("control_group" => $control_group->toArray(), "control_items" => 
$saved_control_items);
+                               }
                        }
                        
                        /* ================  Ikke slett!!! Kode som henter ut  
utstyr basert på lokasjon  ==================       
@@ -628,14 +629,20 @@
                        $check_list_id = phpgw::get_var('check_list_id');
                        
                        $check_list = $this->so->get_single($check_list_id);
+
+                       $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null, 
'open_or_waiting', null, 'return_array');
+
+                       foreach($open_check_items_and_cases as $key => 
$check_item){
+                               
+                               $check_item_with_options = 
$this->so_control_item->get_single_with_options($check_item['control_item_id']);
+                               $check_item['control_item']['options_array'] = 
$check_item_with_options['options_array'];
+                               
+                               $open_check_items_and_cases[$key] = $check_item;
+                       }
                        
-                       $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
"control_item_type_1", 'open', null, 'return_array');
-                       $open_check_items_and_measurements = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
"control_item_type_2", 'open_or_waiting', null, 'return_array');
-                       
                        $data = array
                        (
                                'open_check_items_and_cases'            => 
$open_check_items_and_cases,
-                               'open_check_items_and_measurements'     => 
$open_check_items_and_measurements,
                                'check_list'                                    
        => $check_list->toArray()
                        );
                        

Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-05-29 12:21:39 UTC (rev 9464)
@@ -88,9 +88,7 @@
                        $manage     = $GLOBALS['phpgw']->acl->check('.control', 
16, 'controller');//16
 
                        //if(!$manage)
-                               
                        
-                       
                        $this->so = CreateObject('controller.socontrol');
                        $this->bo = CreateObject('property.boevent',true);
                        $this->so_procedure = 
CreateObject('controller.soprocedure');
@@ -299,22 +297,14 @@
                        {
                                $control = $this->so->get_single($control_id);  
                        }
-
+                       
                        // Sigurd: START as categories
                        $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
                        $cats->supress_info     = true;
                        
                        $control_areas = 
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl' 
=> $this->_category_acl));
-                                                       
-                       $control_areas_array2 = array();
-                       foreach($control_areas['cat_list'] as $cat_list)
-                       {
-                               $control_areas_array2[] = array
-                               (
-                                       'id'    => $cat_list['cat_id'],
-                                       'name'  => $cat_list['name'],
-                               );              
-                       }
+                       $control_areas_array = $control_areas['cat_list'];
+                       
                        // END as categories
                
                        if($control != null)
@@ -337,7 +327,7 @@
                                'view'                                          
=> "control_details",
                                'editable'                                      
=> true,
                                'control'                                       
=> ($control != null) ? $control->toArray() : null,
-                               'control_areas_array2'          => 
$control_areas_array2,
+                               'control_areas_array'           => 
$control_areas_array,
                                'procedures_array'                      => 
$procedures_array,
                                'role_array'                            => 
$role_array,
                                'repeat_type_array'                     => 
$repeat_type_array
@@ -371,7 +361,7 @@
                        {
                                $control = $this->so->get_single($control_id);
                        }
-                       // Add control details 
+                       // Add control details
                        else {
                                $control = new controller_control();
                        }

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-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2012-05-29 12:21:39 UTC (rev 9464)
@@ -44,6 +44,8 @@
                private $so_control_item;
                private $so_control_group;
                private $so_control_area;
+               private $so_control_item_option;
+               
 
                public $public_functions = array
                (
@@ -59,11 +61,12 @@
                public function __construct()
                {
                        parent::__construct();
-                       $this->so = CreateObject('controller.socontrol');
-                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
+                       $this->so = CreateObject('controller.socontrol_item');
                        $this->so_control_item_list = 
CreateObject('controller.socontrol_item_list');
                        $this->so_control_group = 
CreateObject('controller.socontrol_group');
                        $this->so_control_area = 
CreateObject('controller.socontrol_area');
+                       $this->so_control_item_option = 
CreateObject('controller.socontrol_item_option');
+                       
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"controller::control_item";
                }
 
@@ -184,7 +187,6 @@
                }
 
                public function delete_item_list(){
-
                        $control_id = phpgw::get_var('control_id');
                        $control_item_id = phpgw::get_var('control_item_id');
 
@@ -196,9 +198,10 @@
                public function edit()
                {
                        $control_item_id = phpgw::get_var('id');
+               
                        if(isset($control_item_id) && $control_item_id > 0)
                        {
-                               $control_item = 
$this->so_control_item->get_single($control_item_id);
+                               $control_item = 
$this->so->get_single($control_item_id);
                        }
                        else
                        {
@@ -215,29 +218,30 @@
                                        $how_to_do_txt = str_replace("&nbsp;", 
" ", $how_to_do_txt);
                                        
$control_item->set_title(phpgw::get_var('title'));
                                        
$control_item->set_required(phpgw::get_var('required') == 'on' ? true : false);
-                                       
$control_item->set_type(phpgw::get_var('measurement') == 'on' ? 
'control_item_type_2' : 'control_item_type_1');
+                                       
$control_item->set_type(phpgw::get_var('control_item_type'));
                                        $control_item->set_what_to_do( 
$what_to_do_txt );
                                        $control_item->set_how_to_do( 
$how_to_do_txt );
                                        $control_item->set_control_group_id( 
phpgw::get_var('control_group') );
                                        $control_item->set_control_area_id( 
phpgw::get_var('control_area') );
-
-                                       //$this->so->store($control_item);
-
-                                       if(isset($control_item_id) && 
$control_item_id > 0)
+                               
+                                       $control_item_id = 
$this->so->store($control_item);
+                                               
+                                       if($control_item_id > 0)
                                        {
-                                               $ctrl_item_id = 
$control_item_id;
-                                               
if($this->so_control_item->store($control_item))
-                                               {
-                                                       $message = 
lang('messages_saved_form');
+                                               $message = 
lang('messages_saved_form');
+                                               
+                                               if($control_item->get_type() == 
'control_item_type_3' | $control_item->get_type() == 'control_item_type_4'){
+                                                       $option_values = 
phpgw::get_var('option_values');
+                               
+                                                       foreach($option_values 
as $option_value){
+                                                               
$control_item_option = new controller_control_item_option($option_value, 
$control_item_id);
+                                                               
$control_item_option_id = $this->so_control_item_option->store( 
$control_item_option );
+                                                       }
                                                }
-                                               else
-                                               {
-                                                       $error = 
lang('messages_form_error');
-                                               }
                                        }
                                        else
                                        {
-                                               $ctrl_item_id = 
$this->so_control_item->add($control_item);
+                                               $ctrl_item_id = 
$this->so->add($control_item);
                                                if($ctrl_item_id)
                                                {
                                                        $message = 
lang('messages_saved_form');
@@ -247,6 +251,7 @@
                                                        $error = 
lang('messages_form_error');
                                                }
                                        }
+
                                        
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uicontrol_item.index', 'dir' => 'desc'));
                                }
                        }
@@ -263,76 +268,14 @@
                        }
                        else
                        {
-                               //Sigurd: START as categories
+                               // Sigurd: START as categories
                                $cats   = CreateObject('phpgwapi.categories', 
-1, 'controller', '.control');
                                $cats->supress_info     = true;
                                
                                $control_areas = 
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl' 
=> $this->_category_acl));
-                               array_unshift($control_areas['cat_list'],array 
('cat_id'=>'','name'=> lang('select value')));
-                                                               
-                               $control_area_array = array();
-                               foreach($control_areas['cat_list'] as $cat_list)
-                               {
-                                       if($cat_list['cat_id'] == 
$control_item->get_control_area_id())
-                                       {
-                                               $control_area_array[] = array
-                                               (
-                                                       'id'    => 
$cat_list['cat_id'],
-                                                       'name'  => 
$cat_list['name'],
-                                                       'selected' => 1,
-                                               );
-                                       }
-                                       else
-                                       {
-                                               $control_area_array[] = array
-                                               (
-                                                       'id'    => 
$cat_list['cat_id'],
-                                                       'name'  => 
$cat_list['name'],
-                                               );
-                                       }
-                               }                               
-                               // END as categories
-                               //$control_area_array = 
$this->so_control_area->get_control_area_array();
-                               $control_group_array = 
$this->so_control_group->get_control_group_array();
+                               $control_areas_array = 
$control_areas['cat_list'];
 
-
-                               if($this->flash_msgs)
-                               {
-                                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
-                                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
-                               }
-
-/*                             foreach ($control_area_array as $control_area)
-                               {
-                                       $control_area_options[] = array
-                                       (
-                                               'id'    => 
$control_area->get_id(),
-                                               'name'  => 
$control_area->get_title()
-                                                
-                                       );
-                               }
-*/
-                               foreach ($control_group_array as $control_group)
-                               {
-                                       if($control_group->get_id() == 
$control_item->get_control_group_id())
-                                       {
-                                               $control_group_options[] = array
-                                               (
-                                                       'id'    => 
$control_group->get_id(),
-                                                       'name'  => 
$control_group->get_group_name(),
-                                                       'selected' => 1
-                                               );
-                                       }
-                                       else
-                                       {
-                                               $control_group_options[] = array
-                                               (
-                                                       'id'    => 
$control_group->get_id(),
-                                                       'name'  => 
$control_group->get_group_name()
-                                                        
-                                               );
-                                       }
-                               }
+                               $control_groups_array = 
$this->so_control_group->get_control_group_array();
                                
                                /*
                                 * hack to fix display of &nbsp; char 
@@ -341,22 +284,15 @@
                                
$control_item->set_how_to_do(str_replace('&nbsp;', ' ', 
$control_item->get_how_to_do()));
 
                                $control_item_array = $control_item->toArray();
-
+                               
                                $data = array
                                (
-                                       'value_id'                              
=> !empty($control_item) ? $control_item->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable'                              
=> true,
                                        'control_item'                  => 
$control_item_array,
-                                       'control_area'                  => 
array('options' => $control_area_array),
-                                       'control_group'                 => 
array('options' => $control_group_options),
+                                       'control_areas'                 => 
$control_areas_array,
+                                       'control_groups'                => 
$control_groups_array,
                                );
 
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Control_item');
-
-                               
/*$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
-                               
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
-                               
$GLOBALS['phpgw']->richtext->generate_script();*/
                                
$this->use_yui_editor(array('what_to_do','how_to_do'));
                                
                                self::add_javascript('controller', 
'controller', 'jquery.js');
@@ -426,11 +362,11 @@
                        $control_item_id = phpgw::get_var('control_item_id');
                        if(isset($control_item_id))
                        {
-                               $control_item = 
$this->so_control_item->get_single($control_item_id);
+                               $control_item = 
$this->so->get_single($control_item_id);
                        }
 
-                       $result_objects = 
$this->so_control_item->get($start_index, $num_of_objects, $sort_field, 
$sort_ascending, $search_for, $search_type, $filters);
-                       $object_count = 
$this->so_control_item->get_count($search_for, $search_type, $filters);
+                       $result_objects = $this->so->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
+                       $object_count = $this->so->get_count($search_for, 
$search_type, $filters);
                        //var_dump($result_objects);
 
                        $results = array();
@@ -467,7 +403,7 @@
                        {
                                if(isset($control_item_id) && $control_item_id 
> 0)
                                {
-                                       $control_item = 
$this->so_control_item->get_single($control_item_id);
+                                       $control_item = 
$this->so->get_single($control_item_id);
                                }
                                else
                                {

Copied: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php 
(from rev 9463, trunk/controller/inc/class.uicontrol_item_option.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php  
                            (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php  
    2012-05-29 12:21:39 UTC (rev 9464)
@@ -0,0 +1,104 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.uicontrol_item.inc.php 9082 2012-03-29 12:58:24Z 
vator $
+       */
+
+       phpgw::import_class('controller.uicommon');
+       phpgw::import_class('controller.socontrol_item_option');
+               
+       include_class('controller', 'control_item_option', 'inc/model/');
+
+       class controller_uicontrol_item_option extends controller_uicommon
+       {
+               private $so;
+               private $so_control_item;
+       
+               public $public_functions = array
+               (
+                       'add'           => true,
+                       'edit'          => true,
+                       'save'          => true,
+                       'delete'        => true,
+                       'query'         => true
+               );
+
+               public function __construct()
+               { 
+                       parent::__construct();
+                       $this->so = 
CreateObject('controller.socontrol_item_option');
+                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
+               }
+
+               public function add()
+               {
+                       $control_item_id = phpgw::get_var('control_item_id');
+                       
+                       $control_item = 
$this->so_control_item->get_single($control_item_id);   
+                       
+                       $data = array
+                       (
+                               'control_item'  => $control_item->toArray()
+                       );
+                       
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+                       self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
+
+                       
self::render_template_xsl('control_item/control_item_option', $data);
+               }
+               
+               public function save()
+               {       
+                       $option_value = phpgw::get_var('option_value');
+                       $control_item_id = phpgw::get_var('control_item_id');
+                       
+                       $control_item_option = new 
controller_control_item_option($option_value, $control_item_id);
+                       $control_item_option_id = $this->so->store( 
$control_item_option );
+                       
+                       if($control_item_option_id > 0){
+                               $control_item_option = 
$this->so->get_single($control_item_option_id);   
+                               
+                               return json_encode( array( "status" => "saved", 
"saved_object" => $control_item_option->toArray() ) );
+                       }
+                       else{
+                               return json_encode( array("status" => 
"not_saved") );
+                       }
+               }
+
+               public function edit()
+               {
+                       $control_item_option_id = phpgw::get_var('id');
+                       $label = phpgw::get_var('label');
+                       $control_item_id = phpgw::get_var('control_item_id');
+                       
+                       $control_item_option = new 
controller_control_item_option($label, $control_item_id);
+                       $control_item_option_id = $this->so->store( 
$control_item_option );
+               }
+               
+               public function query(){}
+       }

Modified: branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php 
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php 
2012-05-29 12:21:39 UTC (rev 9464)
@@ -1,519 +1,510 @@
 <?php
-       /**
-       * phpGroupWare - controller: a part of a Facilities Management System.
-       *
-       * @author Erik Holm-Larsen <address@hidden>
-       * @author Torstein Vadla <address@hidden>
-       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
-       * @package property
-       * @subpackage controller
-       * @version $Id$
-       */      
+    /**
+    * phpGroupWare - controller: a part of a Facilities Management System.
+    *
+    * @author Erik Holm-Larsen <address@hidden>
+    * @author Torstein Vadla <address@hidden>
+    * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+    * This file is part of phpGroupWare.
+    *
+    * phpGroupWare is free software; you can redistribute it and/or modify
+    * it under the terms of the GNU General Public License as published by
+    * the Free Software Foundation; either version 2 of the License, or
+    * (at your option) any later version.
+    *
+    * phpGroupWare is distributed in the hope that it will be useful,
+    * but WITHOUT ANY WARRANTY; without even the implied warranty of
+    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    * GNU General Public License for more details.
+    *
+    * You should have received a copy of the GNU General Public License
+    * along with phpGroupWare; if not, write to the Free Software
+    * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
USA
+    *
+    * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+    * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+    * @package property
+    * @subpackage controller
+    * @version $Id$
+    */ 
 
-       phpgw::import_class('controller.uicommon');
-       phpgw::import_class('controller.sodocument');
-       phpgw::import_class('controller.soprocedure');
-       include_class('controller', 'document', 'inc/model/');
+    phpgw::import_class('controller.uicommon');
+    phpgw::import_class('controller.sodocument');
+    phpgw::import_class('controller.soprocedure');
+    include_class('controller', 'document', 'inc/model/');
 
-       class controller_uidocument extends controller_uicommon
-       {       
-               private $so;
-               private $so_procedure;
-               
-               public $public_functions = array
-               (
+    class controller_uidocument extends controller_uicommon
+    {
+        private $so;
+        private $so_procedure;
+
+        public $public_functions = array
+        (
                                'query'         => true,
                                'add'           => true,
                                'view'          => true,
                                'delete'        => true,
                                'show'          => true,
                                'document_types'        => true
-                       );
-               
-               public function __construct()
-               {
-                       parent::__construct();
-                       $this->so = controller_sodocument::get_instance();
-                       $this->so_procedure = 
controller_soprocedure::get_instance();
-               }
-               
-               public function query()
-               {
-                       // YUI variables for paging and sorting
-                       $start_index    = phpgw::get_var('startIndex', 'int');
-                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', 10);
-                       $sort_field             = phpgw::get_var('sort');
-                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
-                       // Form variables
-                       $search_for     = phpgw::get_var('query');
-                       $search_type    = phpgw::get_var('search_option');
-                       // Create an empty result set
-                       $result_objects = array();
-                       $result_count = 0;
-                       
-                       //Retrieve a contract identifier and load corresponding 
contract
-                       $procedure_id = phpgw::get_var('procedure_id');
-                       if(isset($procedure_id))
-                       {
-                               $procedure = 
$this->so_procedure->get_single($procedure_id);
-                       }
-                       
-                       $type = phpgw::get_var('type');
-                       switch($type)
-                       {
-                               case 'documents_for_procedure':
-                                       $filters = array('procedure_id' => 
$procedure_id, 'document_type' => phpgw::get_var('document_type'));
-                                       break;
-                       }
+        );
 
-                       $result_objects = $this->so->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
-                       $result_count = $this->so->get_count($search_for, 
$search_type, $filters);
-                       
-                       //Serialize the documents found
-                       $rows = array();
-                       foreach ($result_objects as $result) {
-                               if(isset($result))
-                               {
-                                       $rows[] = $result->serialize();
-                               }
-                       }
-                       
-                       $editable = phpgw::get_var('editable') == '1' ? true : 
false;
-                       
-                       //Add context menu columns (actions and labels)
-                       array_walk($rows, array($this, 'add_actions'), 
array($type, isset($procedure) ? $procedure->has_permission(PHPGW_ACL_EDIT) : 
false, $this->type_of_user, $editable));
-                               
-                       
-                       //Build a YUI result from the data
-                       $result_data = array('results' => $rows, 
'total_records' => $result_count);     
-                       return $this->yui_results($result_data, 
'total_records', 'results');
-               }
-               
-               public function get_document_types()
-               {
-                       $result_objects = $this->so->list_document_types();
-                       
-                       //Serialize the documents found
-/*                     $rows = array();
-                       foreach ($result_objects as $result) {
-                               if(isset($result))
-                               {
-                                       $rows[] = $result->serialize();
-                               }
-                       }
-*/
-                       
-                       $editable = phpgw::get_var('editable') == '1' ? true : 
false;
-                       $result_data = array('results' => $result_objects);
-                       
-                       //Add context menu columns (actions and labels)
-                       //array_walk($result_objects, array($this, 
'add_actions'), array('admin', isset($procedure) ? 
$procedure->has_permission(PHPGW_ACL_EDIT) : false, $this->type_of_user, 
$editable));
-                       array_walk(
-                                       $result_data['results'],
-                                       array($this, '_add_links'),
-                                       
"controller.uidocument.edit_document_type");
-                               
-                       
-                       //Build a YUI result from the data
-                       //$result_data = array('results' => $result_objects, 
'total_records' => $result_count); 
-                       return $this->yui_results($result_data, 
'total_records', 'results');
-               }
-               
-               /**
-                * Add data for context menu
-                *
-                * @param $value pointer to
-                * @param $key ?
-                * @param $params [type of query, editable]
-                */
-               public function add_actions(&$value, $key, $params)
-               {
-                       
-                       $value['ajax'] = array();
-                       $value['actions'] = array();
-                       $value['labels'] = array();
+        public function __construct()
+        {
+            parent::__construct();
+            $this->so = controller_sodocument::get_instance();
+            $this->so_procedure = controller_soprocedure::get_instance();
+        }
 
-                       //view/download
-                       $value['ajax'][] = false;
-                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uidocument.view', 'id' => $value['id'])));
-                       $value['labels'][] = lang('view');
+        public function query()
+        {
+            // YUI variables for paging and sorting
+            $start_index       = phpgw::get_var('startIndex', 'int');
+            $num_of_objects    = phpgw::get_var('results', 'int', 'GET', 10);
+            $sort_field                = phpgw::get_var('sort');
+            $sort_ascending    = phpgw::get_var('dir') == 'desc' ? false : 
true;
+            // Form variables
+            $search_for        = phpgw::get_var('query');
+            $search_type       = phpgw::get_var('search_option');
+            // Create an empty result set
+            $result_objects = array();
+            $result_count = 0;
+
+            //Retrieve a contract identifier and load corresponding contract
+            $procedure_id = phpgw::get_var('procedure_id');
+            if(isset($procedure_id))
+            {
+                $procedure = $this->so_procedure->get_single($procedure_id);
+            }
+
+            $type = phpgw::get_var('type');
+            switch($type)
+            {
+                case 'documents_for_procedure':
+                    $filters = array('procedure_id' => $procedure_id, 
+                                               'document_type' => 
phpgw::get_var('document_type'));
+                    break;
+            }
+
+            $result_objects = $this->so->get($start_index, 
+                                            $num_of_objects, 
+                                            $sort_field, 
+                                            $sort_ascending, 
+                                            $search_for, 
+                                            $search_type, 
+                                            $filters);
+            $result_count = $this->so->get_count($search_for, $search_type, 
$filters);
+            
+            //Serialize the documents found
+            $rows = array();
+            foreach ($result_objects as $result) {
+                if(isset($result))
+                {
+                    $rows[] = $result->serialize();
+                }
+            }
                        
-                       $type = $params[0];
-                       $edit_permission = $params[1];
-                       $user_is = $params[2];
-                       $editable = $params[3];
+            $editable = phpgw::get_var('editable') == '1' ? true : false;
                        
-                       switch($type)
-                       {
-                               case 'documents_for_procedure':
-                                       if($edit_permission && $editable) {
-                                               $value['ajax'][] = true;
-                                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uidocument.delete', 'id' => $value['id'])));
-                                               $value['labels'][] = 
lang('delete');
-                                       }
-                                       break;
-                               case 'admin':
-                                       $value['ajax'][] = true;
-                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uidocument.edit_document_type', 'id' => $value['id'])));
-                                       $value['labels'][] = lang('Edit 
document type');
-                                       break;
-                       }
-               }
-               
-               /**
-                * Public function to add a document.
-                * 
-                * @param HTTP::procedure_id    the procedure id
-                * @return unknown_type
-                */
-               public function add()
-               {       
-                       // Get target ids
-                       $procedure_id = intval(phpgw::get_var('procedure_id'));
-                       
-                       $data = array();
-                       // Check permissions if contract id is set
-                       if(isset($procedure_id) && $procedure_id > 0)
-                       {
-                               //Load contract
-                               $procedure = 
$this->so_procedure->get_single($procedure_id);
-/*                             if(!$procedure->has_permission(PHPGW_ACL_EDIT))
-                               {
-                                       $data['error'] = 
lang('permission_denied_add_document');
-                                       $this->render('permission_denied.php', 
$data);
-                                       return;
-                               }*/
-                       }
-                       
-                       // If no contract or party is loaded
-                       if(!isset($procedure))
-                       {
-                               $data['error'] = lang('error_no_procedure');
-                               $this->render('permission_denied.php', $data);
-                               return;
-                       }
-                       
-                       
-                       if($_SERVER['REQUEST_METHOD'] == 'POST')
-                       {
-                               //Create a document object
-                               $document = new controller_document();
-                               
$document->set_title(phpgw::get_var('document_title'));
-                               
$document->set_name($_FILES["file_path"]["name"]);
-                               
$document->set_type_id(phpgw::get_var('document_type'));
-                               $desc = 
phpgw::get_var('document_description','html');
-                               $desc = str_replace("&nbsp;", " ", $desc);
-                               //var_dump($desc);
-                               $document->set_description($desc);
-                               $document->set_procedure_id($procedure_id);
-                               //var_dump($document);
+            //Add context menu columns (actions and labels)
+            array_walk($rows, array($this, 'add_actions'), array($type, 
+                                                                
isset($procedure) ? $procedure->has_permission(PHPGW_ACL_EDIT) : false, 
+                                                                
$this->type_of_user, 
+                                                                $editable));
                                
-                               //Retrieve the document properties
-                               $document_properties = 
$this->get_type_and_id($document);
-                               
-                               // Move file from temporary storage to vfs
-                               $result = $this->so->write_document_to_vfs
-                               (
-                                       $document_properties['document_type'], 
-                                       $_FILES["file_path"]["tmp_name"],
-                                       $document_properties['id'],
-                                       $_FILES["file_path"]["name"]
-                               );
-                               
-                               if($result)
-                               {
-                                       if($this->so->store($document))
-                                       {
-                                               if(isset($procedure))
-                                               {
-                                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uidocument.show', 'procedure_id' => $procedure->get_id(), 'tab' => 
'documents'));
-                                               }
-                                       }
-                                       else
-                                       {
-                                               // Handle failure on storing 
document
-                                               $this->redirect($document, 
$document_propeties,'','');
-                                       }
-                               }
-                               else
-                               {
-                                       //Handle vfs failure to store document
-                                       $this->redirect($document, 
$document_propeties,'','');
-                               }
-                       }
-               }
+            //Build a YUI result from the data
+            $result_data = array('results' => $rows, 'total_records' => 
$result_count);        
+            return $this->yui_results($result_data, 'total_records', 
'results');
+        }
                
-               /**
-                * Public function for viewing/downloading a document.
-                * 
-                * @param HTTP::id      the document id
-                * @return document on success, error message on failure
-                */
-               public function view()
-               {
-                       $document_id = intval(phpgw::get_var('id'));
-                       $document = $this->so->get_single($document_id);
-//                     if($document->has_permission(PHPGW_ACL_READ))
-//                     {
-                               $document_properties = 
$this->get_type_and_id($document);
-                               
-                               header("Content-Disposition: attachment; 
filename={$document->get_name()}");
-                               header("Content-Type: $file_type");
-                               header("Cache-Control: must-revalidate, 
post-check=0, pre-check=0");
-                               
-                               echo $this->so->read_document_from_vfs
-                               (
-                                       $document_properties['document_type'],  
-                                       $document_properties['id'],
-                                       $document->get_name()
-                               );
-/*                     }
-                       else
-                       {
-                               $this->redirect($document, 
$document_properties, lang('no_access'), '');
-                       }
-                       exit;*/
+        public function get_document_types()
+        {
+            $result_objects = $this->so->list_document_types();
+            
+            $editable = phpgw::get_var('editable') == '1' ? true : false;
+            $result_data = array('results' => $result_objects);
+            
+            //Add context menu columns (actions and labels)
+            array_walk(
+                       $result_data['results'],
+                       array($this, '_add_links'),
+                       "controller.uidocument.edit_document_type");
+               
+            
+            //Build a YUI result from the data 
+            return $this->yui_results($result_data, 'total_records', 
'results');
                }
                
-               /**
-                * Public function for deleting a document. Deletes the 
document from
-                * the database and the virtual file system (vfs).
-                * 
-                * @param HTTP::id      the document id
-                * @return true if successful, false if error, permission 
denied message on
-                *                      not enough privileges
-                */
-               public function delete()
-               {       
-                       $document_id = intval(phpgw::get_var('id'));
-                       $document = $this->so->get_single($document_id);
-                       $document_properties = 
$this->get_type_and_id($document);
+        /**
+         * Add data for context menu
+         *
+         * @param $value pointer to
+         * @param $key ?
+         * @param $params [type of query, editable]
+         */
+        public function add_actions(&$value, $key, $params)
+        {
+            $value['ajax'] = array();
+            $value['actions'] = array();
+            $value['labels'] = array();
+            
+            //view/download
+            $value['ajax'][] = false;
+            $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uidocument.view', 
+                                                                               
                                        'id' => $value['id'])));
+            $value['labels'][] = lang('view');
+            
+            $type = $params[0];
+            $edit_permission = $params[1];
+            $user_is = $params[2];
+            $editable = $params[3];
+            
+            switch($type)
+            {
+                case 'documents_for_procedure':
+                    if($edit_permission && $editable) {
+                        $value['ajax'][] = true;
+                        $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uidocument.delete', 
+                                                                               
                                                        'id' => $value['id'])));
+                        $value['labels'][] = lang('delete');
+                    }
+                    break;
+                case 'admin':
+                    $value['ajax'][] = true;
+                    $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uidocument.edit_document_type', 
+                                                                               
                                                'id' => $value['id'])));
+                    $value['labels'][] = lang('Edit document type');
+                    break;
+            }
+        }
 
-                       
if(!$this->check_permissions($document,$document_properties))
-                       {
-                               $this->render('permission_denied.php');
-                               return;
-                       }
-                       
-                       $result = 
rental_sodocument::get_instance()->delete_document_from_vfs
-                       (
-                               $document_properties['document_type'],  
-                               $document_properties['id'],
-                               $document->get_name()
-                       );
-                       
-                       if($result)
-                       {
-                               return $this->so->delete_document($document_id);
-                       } 
-                       // TODO: communicate error/message to user
-                       return false;
-               }
-               
-               /**
-                * Utitity function for redirecting to correct edit mode 
(procedure)
-                * 
-                * @param $document     the target document
-                * @param $document_properties  the document properies 
(name/value array)
-                * @param $error        an error message
-                * @param $message      a user message
-                */
-               public function redirect($document, $document_properties, 
$error, $message)
-               {
-                       if($document_properties['document_type'] == 
controller_sodocument::$PROCEDURE_DOCUMENTS)
-                       {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uiprocedure.edit', 'id' => 
$document_properties['id'], 'error' => $error, 'message' => $message));         
    
-                       }
-               }
-               
-               /**
-                * Utiity method for checking the users permission on this 
document. If the
-                * document is bound to a procedure, then the user must have 
edit privileges
-                * on the given procedure. If no procedure, the user must be an 
executive 
-                * officer or an administrator.
-                * 
-                * @param $document     the document in question
-                * @param $document_properties  the document type and object id
-                * @return true if correct privileges, false otherwise
-                */
-               private function check_permissions($document, 
$document_properties)
-               {
-                       if($document_properties == 
controller_sodocument::$PROCEDURE_DOCUMENTS)
-                       {
-                               $procedure = 
$this->so_procedure->get_single($document_properties['id']);
-                               if(!$procedure->has_permission(PHPGW_ACL_EDIT))
-                               {
-                                       return false;
-                               }
-                       } 
-                       else
-                       {
-                               if(!($this->isExecutiveOfficer() || 
$this->isAdministrator()))
-                               {
-                                       return false;
-                               }
-                       }
-                       return true;
-               }
-               
-               /**
-                * Utility method for finding out whether a document is bound 
to a
-                * procedure.
-                * 
-                * @param $document     the given document
-                * @return name/value array ('document_type','id')
-                */
-               private function get_type_and_id($document)
-               {
-                       $document_type;
-                       $id;
-                       $procedure_id = $document->get_procedure_id();
-                       if(isset($procedure_id) && $procedure_id > 0)
-                       {
-                               $document_type = 
controller_sodocument::$PROCEDURE_DOCUMENTS;
-                               $id = $procedure_id;
-                       }
-                       return array
-                       (
-                               'document_type' => $document_type,
-                               'id' => $id
-                       );
-               }
-               
-               public function show()
-               {
-                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
-                       $procedure_id = (int)phpgw::get_var('procedure_id');
-                       $document_type = phpgw::get_var('type');
-                       if(isset($_POST['edit_procedure']))
-                       {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uiprocedure.edit', 'id' => $procedure_id));
-                       }
-                       else
-                       {
-                               if(isset($procedure_id) && $procedure_id > 0)
-                               {
-                                       $procedure = 
$this->so_procedure->get_single($procedure_id);
-                               }
-                               else
-                               {
-                                       
$this->render('permission_denied.php',array('error' => 
lang('invalid_request')));
-                                       return;
-                               }
+        /**
+         * Public function to add a document.
+         * 
+         * @param HTTP::procedure_id   the procedure id
+         * @return unknown_type
+         */
+        public function add()
+        {      
+            // Get target ids
+            $procedure_id = intval(phpgw::get_var('procedure_id'));
+            
+            $data = array();
+            // Check permissions if procedure id is set
+            if(isset($procedure_id) && $procedure_id > 0)
+            {
+               //Load procedure
+               $procedure = $this->so_procedure->get_single($procedure_id);
+            }
+            
+            // If no contract or party is loaded
+            if(!isset($procedure))
+            {
+               $data['error'] = lang('error_no_procedure');
+               $this->render('permission_denied.php', $data);
+               return;
+            }
+            
+            if($_SERVER['REQUEST_METHOD'] == 'POST')
+            {
+                //Create a document object
+                $document = new controller_document();
+                $document->set_title(phpgw::get_var('document_title'));
+                $document->set_name($_FILES["file_path"]["name"]);
+                $document->set_type_id(phpgw::get_var('document_type'));
+                $desc = phpgw::get_var('document_description','html');
+                $desc = str_replace("&nbsp;", " ", $desc);
+                $document->set_description($desc);
+                $document->set_procedure_id($procedure_id);
+                
+                //Retrieve the document properties
+                $document_properties = $this->get_type_and_id($document);
+                
+                // Move file from temporary storage to vfs
+                $result = $this->so->write_document_to_vfs
+                (
+                       $document_properties['document_type'], 
+                       $_FILES["file_path"]["tmp_name"],
+                       $document_properties['id'],
+                       $_FILES["file_path"]["name"]
+                );
+                
+                if($result)
+                {
+                    if($this->so->store($document))
+                    {
+                        if(isset($procedure))
+                        {
+                            $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uidocument.show', 
+                                                                               
                                        'procedure_id' => $procedure->get_id(), 
+                                                                               
                                        'tab' => 'documents'));
+                        }
+                    }
+                    else
+                    {
+                        // Handle failure on storing document
+                        $this->redirect($document, $document_propeties,'','');
+                    }
+                }
+                else
+                {
+                    //Handle vfs failure to store document
+                    $this->redirect($document, $document_propeties,'','');
+                }
+            }
+        }
 
-                               if($this->flash_msgs)
-                               {
-                                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
-                                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
-                               }
-                               
-                               $documents = 
$this->so->get(null,null,null,null,null,null,array('procedure_id' => 
$procedure_id, 'type' => $document_type));
-                               //$document_array = array();
-                               //var_dump($documents);
-                                       
-                               //$document_array[] = array('document' => 
$document->toArray());
-                               $table_header[] = array('header' => 
lang('Document title'));
-                               $table_header[] = array('header' => 
lang('Document name'));
-                               $table_header[] = array('header' => 
lang('Document description'));
-                               
-                               foreach($documents as $document)
-                               {
-                                       /*
-                                        * hack to fix display of &nbsp; char 
-                                        */
-                                       
$document->set_description(str_replace("&nbsp;", " 
",$document->get_description()));
-                                       $doc_array = $document->toArray();
-                                       $doc_array['link'] = 
self::link(array('menuaction' => 'controller.uidocument.view', 'id' => 
$doc_array['id']));
-                                       $table_values[] = array('document' => 
$doc_array);
-                               }
-                               //var_dump($table_values);
+        /**
+         * Public function for viewing/downloading a document.
+         * 
+         * @param HTTP::id     the document id
+         * @return document on success, error message on failure
+         */
+        public function view()
+        {
+            $document_id = intval(phpgw::get_var('id'));
+            $document = $this->so->get_single($document_id);
+            $document_properties = $this->get_type_and_id($document);
+            
+            header("Content-Disposition: attachment; 
filename={$document->get_name()}");
+            header("Content-Type: $file_type");
+            header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");
+            
+            echo $this->so->read_document_from_vfs
+            (
+                $document_properties['document_type'], 
+                $document_properties['id'],
+                $document->get_name()
+            );
+        }
 
-                               $procedure_array = $procedure->toArray();
-                               
-                               $tabs = array( array(
-                                                       'label' => 
lang('Procedure'),
-                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiprocedure.view', 'id' => $procedure->get_id()))
-
-                                               ), array(
-                                                       'label' => 
lang('View_documents_for_procedure')
-                                               ));
-
-                               $data = array
-                               (
-                                       'tabs'                                  
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
-                                       'view'                                  
=> "view_documents_for_procedure",
-                                       'procedure_id'                  => 
!empty($procedure) ? $procedure->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                                       'procedure'                             
=> $procedure_array,
-                                       'dateformat'                    => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
-                                       'values'                                
=> $table_values,
-                                       'table_header'                  => 
$table_header,
-                               );
-                               
-                               
$this->use_yui_editor(array('document_description'));
-
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Procedure');
-
-                               //self::render_template_xsl('procedure_item', 
$data);
-                               
self::render_template_xsl(array('procedure/procedure_tabs', 'common', 
'procedure/procedure_documents'), $data);
-                       }
-               }
+        /**
+         * Public function for deleting a document. Deletes the document from
+         * the database and the virtual file system (vfs).
+         * 
+         * @param HTTP::id     the document id
+         * @return true if successful, false if error, permission denied 
message on
+         *                     not enough privileges
+         */
+        public function delete()
+        {      
+            $document_id = intval(phpgw::get_var('id'));
+            $document = $this->so->get_single($document_id);
+            $document_properties = $this->get_type_and_id($document);
+            
+            if(!$this->check_permissions($document,$document_properties))
+            {
+                $this->render('permission_denied.php');
+                return;
+            }
+            
+            $result = 
rental_sodocument::get_instance()->delete_document_from_vfs
+            (
+                $document_properties['document_type'], 
+                $document_properties['id'],
+                $document->get_name()
+            );
+            
+            if($result)
+            {
+                return $this->so->delete_document($document_id);
+            } 
+            // TODO: communicate error/message to user
+            return false;
+        }
                
-               public function document_types()
-               {
-                       
//self::set_active_menu('controller::control_item2::control_item_list2');
-                       if(phpgw::get_var('phpgw_return_as') == 'json') {
-                               return $this->get_document_types();
-                               
self::render_template_xsl(array('procedure/procedure_tabs', 'common', 
'procedure/procedure_documents'), $data);
-                       }
-                       self::add_javascript('controller', 'yahoo', 
'datatable.js');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('paginator');
+        /**
+         * Utitity function for redirecting to correct edit mode (procedure)
+         * 
+         * @param $document    the target document
+         * @param $document_properties the document properies (name/value 
array)
+         * @param $error       an error message
+         * @param $message     a user message
+         */
+        public function redirect($document, $document_properties, $error, 
$message)
+        {
+            if($document_properties['document_type'] == 
controller_sodocument::$PROCEDURE_DOCUMENTS)
+            {
+                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uiprocedure.edit', 
+                                                                               
                                        'id' => $document_properties['id'], 
+                                                                               
                                        'error' => $error, 
+                                                                               
                                        'message' => $message));                
+            }
+        }
+               
+        /**
+         * Utiity method for checking the users permission on this document. 
If the
+         * document is bound to a procedure, then the user must have edit 
privileges
+         * on the given procedure. If no procedure, the user must be an 
executive 
+         * officer or an administrator.
+         * 
+         * @param $document    the document in question
+         * @param $document_properties the document type and object id
+         * @return true if correct privileges, false otherwise
+         */
+        private function check_permissions($document, $document_properties)
+        {
+            if($document_properties == 
controller_sodocument::$PROCEDURE_DOCUMENTS)
+            {
+                $procedure = 
$this->so_procedure->get_single($document_properties['id']);
+                if(!$procedure->has_permission(PHPGW_ACL_EDIT))
+                {
+                    return false;
+                }
+            } 
+            else
+            {
+                if(!($this->isExecutiveOfficer() || $this->isAdministrator()))
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
 
-                       $data = array(
-                               'form' => array(
-                               ),
-                               'datatable' => array(
-                                       'source' => 
self::link(array('menuaction' => 'controller.uidocument.document_types', 
'phpgw_return_as' => 'json')),
-                                       'field' => array(
-                                               array(
-                                                       'key' => 'id',
-                                                       'label' => lang('ID'),
-                                                       'sortable'      => true,
-                                                       'formatter' => 
'YAHOO.portico.formatLink'
-                                               ),
-                                               array(
-                                                       'key' => 'title',
-                                                       'label' => 
lang('Procedure title'),
-                                                       'sortable'      => false
-                                               ),
-                                               array(
-                                                       'key' => 'link',
-                                                       'hidden' => true
-                                               )
-                                       )
-                               ),
-                       );
-//_debug_array($data);
-
-                       self::render_template_xsl('datatable', $data);
-               }
-       }
\ No newline at end of file
+        /**
+         * Utility method for finding out whether a document is bound to a
+         * procedure.
+         * 
+         * @param $document    the given document
+         * @return name/value array ('document_type','id')
+         */
+        private function get_type_and_id($document)
+        {
+            $document_type;
+            $id;
+            $procedure_id = $document->get_procedure_id();
+            if(isset($procedure_id) && $procedure_id > 0)
+            {
+                $document_type = controller_sodocument::$PROCEDURE_DOCUMENTS;
+                $id = $procedure_id;
+            }
+            return array
+            (
+                       'document_type' => $document_type,
+                       'id' => $id
+            );
+        }
+               
+        public function show()
+        {
+            $GLOBALS['phpgw_info']['flags']['app_header'] .= '::'.lang('view');
+            $procedure_id = (int)phpgw::get_var('procedure_id');
+            $document_type = phpgw::get_var('type');
+            if(isset($_POST['edit_procedure']))
+            {
+                $GLOBALS['phpgw']->redirect_link('/index.php', array(
+                                                                       
'menuaction' => 'controller.uiprocedure.edit', 
+                                                                       'id' => 
$procedure_id));
+            }
+            else
+            {
+                if(isset($procedure_id) && $procedure_id > 0)
+                {
+                    $procedure = 
$this->so_procedure->get_single($procedure_id);
+                }
+                else
+                {
+                    $this->render('permission_denied.php',array('error' => 
lang('invalid_request')));
+                    return;
+                }
+                
+                if($this->flash_msgs)
+                {
+                    $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+                    $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                }
+                
+                $documents = 
$this->so->get(null,null,null,null,null,null,array(
+                                                                       
'procedure_id' => $procedure_id, 
+                                                                       'type' 
=> $document_type));
+                       
+                $table_header[] = array('header' => lang('Document title'));
+                $table_header[] = array('header' => lang('Document name'));
+                $table_header[] = array('header' => lang('Document 
description'));
+                
+                foreach($documents as $document)
+                {
+                       /* hack to fix display of &nbsp; char */
+                    $document->set_description(str_replace("&nbsp;", " 
",$document->get_description()));
+                    $doc_array = $document->toArray();
+                    $doc_array['link'] = self::link(array('menuaction' => 
'controller.uidocument.view', 
+                                                                               
        'id' => $doc_array['id']));
+                    $table_values[] = array('document' => $doc_array);
+                }
+                
+                $procedure_array = $procedure->toArray();
+                
+                $tabs = array( array(
+                                       'label' => lang('Procedure'),
+                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array(
+                                                                               
'menuaction' => 'controller.uiprocedure.view', 
+                                                                               
'id' => $procedure->get_id()))
+                
+                               ), array(
+                                       'label' => 
lang('View_documents_for_procedure')
+                               ));
+                
+                $data = array
+                (
+                       'tabs'                                  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 1),
+                       'view'                                  => 
"view_documents_for_procedure",
+                       'procedure_id'                  => !empty($procedure) ? 
$procedure->get_id() : 0,
+                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
+                       'procedure'                             => 
$procedure_array,
+                       'dateformat'                    => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
+                       'values'                                => 
$table_values,
+                       'table_header'                  => $table_header,
+                );
+                
+                $this->use_yui_editor(array('document_description'));
+                
+                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Procedure');
+                
+                self::render_template_xsl(array('procedure/procedure_tabs', 
+                                                                               
'common', 
+                                                                               
'procedure/procedure_documents'), $data);
+            }
+        }
+               
+        public function document_types()
+        {
+            if(phpgw::get_var('phpgw_return_as') == 'json') {
+                return $this->get_document_types();
+                self::render_template_xsl(array('procedure/procedure_tabs', 
+                                                                               
'common', 
+                                                                               
'procedure/procedure_documents'), 
+                                        $data);
+           }
+               self::add_javascript('controller', 'yahoo', 'datatable.js');
+               phpgwapi_yui::load_widget('datatable');
+               phpgwapi_yui::load_widget('paginator');
+        
+               $data = array(
+                       'form' => array(
+                   ),
+                       'datatable' => array(
+                               'source' => self::link(array('menuaction' => 
'controller.uidocument.document_types', 
+                                                                               
        'phpgw_return_as' => 'json')),
+                               'field' => array(
+                           array(
+                                               'key' => 'id',
+                                               'label' => lang('ID'),
+                                               'sortable'      => true,
+                                               'formatter' => 
'YAHOO.portico.formatLink'
+                                       ),
+                                       array(
+                                               'key' => 'title',
+                                               'label' => lang('Procedure 
title'),
+                                               'sortable'      => false
+                                       ),
+                                       array(
+                                               'key' => 'link',
+                                               'hidden' => true
+                                       )
+                               )
+                       ),
+               );
+    
+            self::render_template_xsl('datatable', $data);
+        }
+    }
\ No newline at end of file

Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2012-05-29 12:21:39 UTC (rev 9464)
@@ -414,9 +414,13 @@
                        $procedures_array = 
$this->so->get_procedures_by_control_area($control_area_id);
 
                        if(count($procedures_array)>0)
+                       {
                                return json_encode( $procedures_array );
+                       }
                        else
+                       {
                                return null;
+                       }
                }
 
 
@@ -436,7 +440,6 @@
                {
                        $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
                        $view_revision = phpgw::get_var('view_revision');
-                       //Retrieve the procedure object
                        $procedure_id = (int)phpgw::get_var('id');
                        if(isset($_POST['edit_procedure']))
                        {
@@ -444,7 +447,8 @@
                        }
                        else
                        {
-                               if(isset($procedure_id) && $procedure_id > 0)
+                       //Retrieve the procedure object
+                           if(isset($procedure_id) && $procedure_id > 0)
                                {
                                        $procedure = 
$this->so->get_single($procedure_id);
                                }
@@ -463,27 +467,24 @@
                                $category    = 
execMethod('phpgwapi.categories.return_single', 
$procedure->get_control_area_id());
                                
$procedure->set_control_area_name($category[0]['name']);
                                
-                               /*
-                                * hack to fix display of &nbsp; char 
-                                */
-                               
+                               /* hack to fix display of &nbsp; char */
                                
$procedure->set_description(str_replace("&nbsp;", " 
",$procedure->get_description()));
                                
$procedure->set_responsibility(str_replace('&nbsp;', ' ', 
$procedure->get_responsibility()));
                                $procedure->set_reference(str_replace('&nbsp;', 
' ', $procedure->get_reference()));
-/*
-                               
$procedure->set_description(htmlspecialchars_decode($procedure->get_description()));
-                               
$procedure->set_responsibility(htmlspecialchars_decode($procedure->get_responsibility()));
-                               
$procedure->set_reference(htmlspecialchars_decode($procedure->get_reference()));
-*/                             
 
                                $procedure_array = $procedure->toArray();
                                if($procedure->get_start_date() && 
$procedure->get_start_date() != null)
+                               {
                                        $procedure_start_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_start_date());
+                               }
                                if($procedure->get_end_date() && 
$procedure->get_end_date() != null)
+                               {
                                        $procedure_end_date     = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_end_date());
+                               }
                                if($procedure->get_revision_date() && 
$procedure->get_revision_date() != null)
-                                       $procedure_revision_date        = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_revision_date());
-                               //_debug_array($procedure_array);
+                               {
+                                       $procedure_revision_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_revision_date());
+                               }
 
                                if(!$view_revision)
                                {
@@ -493,7 +494,6 @@
                                        $table_header[] = array('header' => 
lang('Procedure end date'));
 
                                        $revised_procedures = 
$this->so->get_old_revisions($procedure->get_id());
-                                       //var_dump($revised_procedures);
                                        foreach($revised_procedures as $rev)
                                        {
                                                $rev['link'] = 
self::link(array('menuaction' => 'controller.uiprocedure.view', 'id' => 
$rev['id'], 'view_revision' => 'yes'));
@@ -501,14 +501,15 @@
                                        }
                                }
                                
-                               $tabs = array( array(
-                                                       'label' => 
lang('Procedure')
+                               $tabs = array(
+                                           array(
+                                                               'label' => 
lang('Procedure')
+                                                   ), array(
+                                                               'label' => 
lang('View_documents_for_procedure'),
+                                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uidocument.show', 'procedure_id' => $procedure->get_id(), 'type' => 
'procedure'))
+                                                   )
+                                               );
 
-                                               ), array(
-                                                       'label' => 
lang('View_documents_for_procedure'),
-                                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uidocument.show', 'procedure_id' => $procedure->get_id(), 'type' => 
'procedure'))
-                                               ));
-
                                $data = array
                                (
                                        'tabs'                                  
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
@@ -526,10 +527,7 @@
                                        $data['inactive'] = true;
                                }
 
-
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Procedure');
-
-                               //self::render_template_xsl('procedure_item', 
$data);
                                
self::render_template_xsl(array('procedure/procedure_tabs', 'common', 
'procedure/procedure_item'), $data);
                        }
                }

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php 
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php 
2012-05-29 12:21:39 UTC (rev 9464)
@@ -34,16 +34,8 @@
        {
                public static $so;
                
-               /*
-               const "CONTROL_ITEM_TYPE_MAALING" = "control_item_type_1";
-               const CONTROL_ITEM_TYPE_MAALING = "control_item_type_1";
-               */
+               public $type_array = array("control_item_type_1", 
"control_item_type_2", "control_item_type_3", "control_item_type_4");
                
-               public static $type_array = array("CONTROL_ITEM_TYPE_1" => 
"Vanlig", 
-                                                                               
 "CONTROL_ITEM_TYPE_2" => "Måling",
-                                                                               
 "CONTROL_ITEM_TYPE_3" => "Nedtrekksliste",
-                                                                               
 "CONTROL_ITEM_TYPE_4" => "Radioknapper");
-               
                protected $id;
                protected $title;
                protected $required;
@@ -55,6 +47,8 @@
                protected $control_area_name;
                protected $type;
                
+               protected $options_array;
+               
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
                 * the database the ID should be empty so the database can add 
one according to its logic.
@@ -135,6 +129,18 @@
                }
                
                public function get_type() { return $this->type; }
+               
+               public function set_options_array($options_array)
+               {
+                       $this->options_array = $options_array;
+               }
+               
+               public function get_options_array() { return 
$this->options_array; }
+               
+               public function get_control_item_types()
+               {
+                       return array_values( $this->type_array );
+               }
                        
                /**
                 * Get a static reference to the storage object associated with 
this model object
@@ -161,6 +167,7 @@
                        $result['how_to_do'] = $this->get_how_to_do();
                        $result['control_group'] = 
$this->get_control_group_name();
                        $result['control_area'] = 
$this->get_control_area_name();
+                       $result['control_area'] = 
$this->get_control_area_name();
                                                
                        return $result;
                }

Copied: 
branches/Version-1_0-branch/controller/inc/model/class.control_item_option.inc.php
 (from rev 9463, trunk/controller/inc/model/class.control_item_option.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/model/class.control_item_option.inc.php
                          (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/model/class.control_item_option.inc.php
  2012-05-29 12:21:39 UTC (rev 9464)
@@ -0,0 +1,67 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.control_item.inc.php 9404 2012-05-15 11:47:15Z 
vator $
+       */
+
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_item_option extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $option_value;
+               protected $control_item_id;
+               
+               public function __construct($option_value, $control_item_id)
+               {
+                       $this->option_value = $option_value;
+                       $this->control_item_id = $control_item_id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+
+               public function set_option_value($option_value)
+               {
+                       $this->option_value = $option_value;
+               }
+               
+               public function get_option_value() { return 
$this->option_value; }
+               
+               public function set_control_item_id($control_item_id)
+               {
+                       $this->control_item_id = $control_item_id;
+               }
+               
+               public function get_control_item_id() { return 
$this->control_item_id; }
+}

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-05-29 12:21:39 UTC (rev 9464)
@@ -1,5 +1,26 @@
 $(document).ready(function(){
 
+       $(".control_item_type").click(function(){
+               var thisBtn = $(this).find(".btn");
+               var thisRadio = $(this).find("input[type=radio]");
+               
+               // Clears active button and checked underlying radiobutton
+               
$(".control_item_type").find("input[type=radio]").removeAttr("checked");
+               $(".control_item_type").find(".btn").removeClass("active");
+               
+               // Makes button active and checkes underlying radiobutton
+               $(thisRadio).attr("checked", "checked");
+               $(thisBtn).addClass("active");
+               
+               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"){
+                       $("#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);
+               }
+       });
+       
        $(".choose_loc").live( "change", function () {
                var thisSelectBox = $(this);
                var loc_code = $(this).val();
@@ -383,9 +404,50 @@
                $(this).addClass("focus");
        });
        
+       /* =========================  CONTROL OPTION 
======================================== */
+       
+       $("#add_control_item_list_value input[type=button]").live("click", 
function(e){
+               e.preventDefault();
+               
+               var listValue = 
$(this).parent().find("input[name=option_value]").val();
+               var order_nr = 1;
+               
+               if($("ul#control_item_options").children().length == 0){
+                       order_nr = 1;
+               }else{
+                       order_nr = 
$("ul#control_item_options").find("li").last().find(".order_nr").text();
+                       order_nr++;
+               }
+               
+               $("ul#control_item_options").append("<li><label>Listeverdi<span 
class='order_nr'>" + order_nr + "</span></label><input type='text' 
name='option_values[]' value='" + listValue + "' /><span class='btn 
delete'>Slett</span></li>")
+               $(this).parent().find("input[name=option_value]").val('');
+       });
+       
+       /*
+       $("#frm_add_control_item_option").live("submit", function(e){
+               e.preventDefault();
+alert("feil")
+               var thisForm = $(this);
+               var requestUrl = $(thisForm).attr("action");
+               
+               $.ajax({
+                         type: 'POST',
+                         url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                         success: function(data) {
+                                 if(data){
+                                 var obj = jQuery.parseJSON(data);
+                                 
+                                 if(obj.status == "saved"){
+                                       
$("#control_item_options").append("<li><label>Valgverdi</label>" + 
obj.saved_object.label + "</li>")
+                                 }
+                                 }
+                               }
+                       });
+       });
+       */
        /* =========================  CONTROL  
=============================================== */
        
-       // =================  SAVE CONTROL DETAILS - FORM SUBMIT  
==================
+       // SAVE CONTROL DETAILS
        $("#frm_save_control_details").submit(function(e){
                
                var thisForm = $(this);
@@ -450,15 +512,6 @@
                $(wrpElem).find(".help_text").fadeOut(300);
        });
        
-       /*
-       $(".frm_save_control_item").click(function(e){
-               var thisForm = $(this);
-               var submitBnt = $(thisForm).find("input[type='submit']");
-               
-               $(submitBnt).removeClass("not_active");
-       });
-       */
-       
        $(".frm_save_control_item").live("click", function(e){
                e.preventDefault();
                var thisForm = $(this);

Modified: 
branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js    
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js    
2012-05-29 12:21:39 UTC (rev 9464)
@@ -27,9 +27,11 @@
        });
        
        // Saves group and item order
-       $("#frmSaveOrder").submit(function(e){
+       $("#saveOrder").click(function(e){
                e.preventDefault();
 
+               var thisForm = $(this).closest("form");
+               var submitBtn = $(this);
                var control_id = $("#control_id").val();
                
                var group_order_arr = new Array();
@@ -51,12 +53,21 @@
        
                var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.save_group_and_item_order";
                
+               $(submitBtn).find(".text").text("Lagrer");
+               
+               $(submitBtn).find(".text").append("<img id='loading' 
src='controller/images/loading.gif' />");
+               
                // Saves order for groups and items to db
                $.ajax({
                          type: 'POST',
                          url: requestUrl + "&control_id=" + control_id + 
"&group_order=" + group_order_arr.toString() + "&item_order=" + 
item_order_arr.toString(),
                          success: function() {
-                                 alert("Lagret");
+                                 
+                                 $(submitBtn).find("img").remove();
+                                       $(submitBtn).find(".text").text("Lagre 
rekkefølge");
+                                 
+                                 
+                                 
                          }
                });
        });

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-05-29 
02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-05-29 
12:21:39 UTC (rev 9464)
@@ -2,10 +2,11 @@
 location_connections   controller      no      Byggknytning
 control        controller      no      Kontroll
 controller     common  no      Kontroll
-control_item_type_1            no              Ingen ekstra felt
-control_item_type_2    no      Måling
-control_item_type_3    no      Nedtrekksliste
-control_item_type_4    no      Radioknapper
+Register control item  controller      no      Legg til nytt kontrollpunkt
+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_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-05-29 
02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-05-29 
12:21:39 UTC (rev 9464)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.33';
+       $setup_info['controller']['version'] = '0.1.34';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';
@@ -53,5 +53,6 @@
                'controller_document',
                'controller_document_types',
                'controller_check_item_case',
-               'controller_check_item_status'
+               'controller_check_item_status',
+               'controller_control_item_option'
        );

Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-05-29 12:21:39 UTC (rev 9464)
@@ -230,5 +230,16 @@
                        'ix' => array(),
                        'ix' => array(),
                        'uc' => array()
-               )
+               ),
+               'controller_control_item_option', array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'precision' =>  
4, 'nullable' => false),
+                               'option_value' =>  array('type' =>  
'varchar','precision' =>  '255','nullable' =>  False),
+                               'control_item_id' =>  array('type' =>  'int', 
'precision' =>  4, 'nullable' =>  True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )                       
        );

Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-05-29 12:21:39 UTC (rev 9464)
@@ -657,3 +657,24 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.33';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+       
+       $test[] = '0.1.33';
+       function controller_upgrade0_1_33()
+       {
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'controller_control_item_option', array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'precision' =>  
4, 'nullable' => false),
+                               'option_value' =>  array('type' =>  
'varchar','precision' =>  '255','nullable' =>  False),
+                               'control_item_id' =>  array('type' =>  'int', 
'precision' =>  4, 'nullable' =>  True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );                      
+               
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.34';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
\ No newline at end of file

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-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
      2012-05-29 12:21:39 UTC (rev 9464)
@@ -26,8 +26,10 @@
                                        <xsl:text>&amp;location_code=</xsl:text>
                                        <xsl:value-of 
select="current_location/location_code"/>
                                </xsl:attribute>
-                               <img height="25" 
src="controller/images/up_arrow.png" />Årsoversikt
+                               <img height="20" 
src="controller/images/left_arrow_simple_light_blue.png" />Årsoversikt
                        </a>
+                       
+                       <!-- =====================  CALENDAR NAVIGATION  
================= -->
                        <div id="calNav">
                                <xsl:choose>
                                        <xsl:when test="current_month_nr > 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-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-05-29 12:21:39 UTC (rev 9464)
@@ -18,6 +18,7 @@
                        <!-- =====================  COLOR ICON MAP  
================= -->
                        <xsl:call-template name="icon_color_map" />
                        
+                       <!-- =====================  CALENDAR NAVIGATION  
================= -->
                        <div id="calNav">
                                <a class="showPrev">
                                        <xsl:attribute name="href">

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-05-29 12:21:39 UTC (rev 9464)
@@ -79,6 +79,78 @@
                                                                                
                   <input type="submit" name="save_control" value="Lagre 
måling" class="not_active" title="{$lang_save}" />
                                                                                
                </form>
                                                                                
        </xsl:when>
+                                                                               
        <xsl:when test="type = 'control_item_type_3'">
+                                                                               
                <form class="frm_register_case expand_item" 
action="index.php?menuaction=controller.uicase.register_case&amp;phpgw_return_as=json"
 method="post">
+                                                                               
                        <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
+                                                                               
                        <input type="hidden" name="control_item_id" 
value="{$control_item_id}" /> 
+                                                                               
                        <input name="check_list_id" 
type="hidden"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
+                                                                               
                        <input name="type" type="hidden" 
value="control_item_type_3" />
+                                                                               
                
+                                                                               
                        <div class="row">
+                                                                               
                                <label>Status</label>
+                                                                               
                                <select name="status">
+                                                                               
                                        <option value="0" 
SELECTED="SELECTED">Åpen</option>
+                                                                               
                                        <option value="1" >Lukket</option>
+                                                                               
                                        <option value="2" >Venter på 
tilbakemelding</option>
+                                                                               
                                </select>
+                                                                               
                   </div>
+                                                                               
               <div class="row">
+                                                                               
                 <label class="comment">Velg verdi fra liste</label>
+                                                                               
                        <select name="option_value">
+                                                                               
                                <xsl:for-each select="options_array"> 
+                                                                               
                                                <option>
+                                                                               
                                                        <xsl:attribute 
name="value"><xsl:value-of select="option_value"/></xsl:attribute>
+                                                                               
                                                        <xsl:value-of 
select="option_value"/>
+                                                                               
                                                 </option>      
+                                                                               
                                        </xsl:for-each>
+                                                                               
                                </select>
+                                                                               
               </div>
+                                                                               
               <div class="row">
+                                                                               
                         <label class="comment">Beskrivelse av sak</label>
+                                                                               
                         <textarea name="case_descr">
+                                                                               
                                        <xsl:value-of select="comment"/>
+                                                                               
                                 </textarea>
+                                                                               
                   </div>
+                                                                               
               <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'register_error')" /></xsl:variable>
+                                                                               
                   <input type="submit" name="save_control" value="Lagre 
sak/måling" class="not_active" title="{$lang_save}" />
+                                                                               
                </form>
+                                                                               
        </xsl:when>
+                                                                               
        <xsl:when test="type = 'control_item_type_4'">
+                                                                               
                <form class="frm_register_case expand_item" 
action="index.php?menuaction=controller.uicase.register_case&amp;phpgw_return_as=json"
 method="post">
+                                                                               
                        <xsl:variable name="control_item_id"><xsl:value-of 
select="id"/></xsl:variable>
+                                                                               
                        <input type="hidden" name="control_item_id" 
value="{$control_item_id}" /> 
+                                                                               
                        <input name="check_list_id" 
type="hidden"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
+                                                                               
                        <input name="type" type="hidden" 
value="control_item_type_4" />
+                                                                               
                
+                                                                               
                        <div class="row">
+                                                                               
                                <label>Status</label>
+                                                                               
                                <select name="status">
+                                                                               
                                        <option value="0" 
SELECTED="SELECTED">Åpen</option>
+                                                                               
                                        <option value="1" >Lukket</option>
+                                                                               
                                        <option value="2" >Venter på 
tilbakemelding</option>
+                                                                               
                                </select>
+                                                                               
                   </div>
+                                                                               
               <div class="row">
+                                                                               
                 <label class="comment">Velg verdi fra liste</label>
+                                                                               
                        <select name="option_value">
+                                                                               
                                <xsl:for-each select="options_array"> 
+                                                                               
                                                <option>
+                                                                               
                                                        <xsl:attribute 
name="value"><xsl:value-of select="option_value"/></xsl:attribute>
+                                                                               
                                                        <xsl:value-of 
select="option_value"/>
+                                                                               
                                                 </option>      
+                                                                               
                                        </xsl:for-each>
+                                                                               
                                </select>
+                                                                               
               </div>
+                                                                               
               <div class="row">
+                                                                               
                         <label class="comment">Beskrivelse av sak</label>
+                                                                               
                         <textarea name="case_descr">
+                                                                               
                                        <xsl:value-of select="comment"/>
+                                                                               
                                 </textarea>
+                                                                               
                   </div>
+                                                                               
               <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'register_error')" /></xsl:variable>
+                                                                               
                   <input type="submit" name="save_control" value="Lagre 
sak/måling" class="not_active" title="{$lang_save}" />
+                                                                               
                </form>
+                                                                               
        </xsl:when>
                                                                                
</xsl:choose>   
                                                                        
                                                                </li>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-05-29 12:21:39 UTC (rev 9464)
@@ -9,269 +9,409 @@
        </xsl:call-template>
        
        <div class="tab_item active">
-               <h2>Målinger</h2>
                <xsl:choose>
-                       <xsl:when 
test="open_check_items_and_measurements/child::node()">
-                       
-                       <ul class="check_items">
-                               <xsl:for-each 
select="open_check_items_and_measurements">
-                                       <xsl:choose>
-                                               <xsl:when 
test="cases_array/child::node()">
-                                                       <li 
class="check_item_case">
-                                                               
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
-                                                               <span 
style="display:none;" class="control_item_type"><xsl:value-of 
select="control_item/type" /></span>
-                                                               <ul>
-                                                                       
<xsl:for-each select="cases_array">
+                       <xsl:when 
test="open_check_items_and_cases/child::node()">
+                               <ul class="check_items">
+                                       <xsl:for-each 
select="open_check_items_and_cases">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="control_item/type = 'control_item_type_1'">
+                                                               <h2>Saker</h2>
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="cases_array/child::node()">
+                                                                               
<li class="check_item_case">
+                                                                       
+                                                                       
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                                       <span 
style="display:none;" class="control_item_type"><xsl:value-of 
select="control_item/type" /></span>
+                                                                       <ul>
+                                                               
+                                                                       
<xsl:for-each select="cases_array">
                                                                                
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                               
<li>
-                                                                               
-                                                                               
<!--  ==================== COL1: ORDERNR ===================== -->
-                                                                               
<div class="col_1">
-                                                                               
        <span class="order_nr"><xsl:number /></span>.
-                                                                               
</div>
-                                                                               
-                                                                               
<!--  ==================== COL2: CASE CONTENT ===================== -->
-                                                                               
<div class="col_2">
-                                                                               
-                                                                               
<!--  =============== SHOW CASE INFO ==================== -->
-                                                                               
<div class="case_info">
-                                                                               
        <!-- STATUS -->
-                                                                               
        <div class="row first">
-                                                                               
                <label>Status:</label>
-                                                                               
                <span class="case_status">
-                                                                               
                        <xsl:choose>
-                                                                               
                                <xsl:when test="status = 0">Åpen</xsl:when>
-                                                                               
                                <xsl:when test="status = 1">Lukket</xsl:when>
-                                                                               
                                <xsl:when test="status = 2">Venter på 
tilbakemelding</xsl:when>
-                                                                               
                        </xsl:choose>
-                                                                               
                </span>
+                                                                               
        <li>
+                                                                               
        
+                                                                               
        <!--  ==================== COL1: ORDERNR ===================== -->
+                                                                               
        <div class="col_1">
+                                                                               
                <span class="order_nr"><xsl:number /></span>.
                                                                                
        </div>
-                                                                               
        <!--  MEASUREMENT -->
-                                                                               
        <div class="row">
-                                                                               
                <label>Måleverdi:</label> 
-                                                                               
                <span class="measurement"><xsl:value-of 
select="measurement"/></span>
-                                                                               
        </div>
-                                                                               
        <!--  DESCRIPTION -->
-                                                                               
        <div class="row">
-                                                                               
                <label>Beskrivelse:</label> 
-                                                                               
        </div>
-                                                                               
        <div class="case_descr"><xsl:value-of select="descr"/></div>
-                                                                               
        
-                                                                               
        <!-- === QUICK EDIT MENU === -->
-                                                                               
        <div class="quick_menu">
-                                                                               
                        <a class="quick_edit_case" href="">
-                                                                               
                                endre
-                                                                               
                        </a>
-                                                                               
                        <a class="close_case">
-                                                                               
                                <xsl:attribute name="href">
-                                                                               
                                        
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
-                                                                               
                                        <xsl:text>&amp;case_id=</xsl:text>
-                                                                               
                                        <xsl:value-of select="id"/>
-                                                                               
                                        <xsl:text>&amp;check_list_id=</xsl:text>
-                                                                               
                                        <xsl:value-of select="//check_list/id"/>
-                                                                               
                                        
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
-                                                                               
                                </xsl:attribute>
-                                                                               
                                lukk
-                                                                               
                        </a>
-                                                                               
                        <xsl:choose>
-                                                                               
                                <xsl:when test="location_item_id = 0">
-                                                                               
                                        <a class="delete_case">
+                                                                               
        <!--  ==================== COL2: CASE CONTENT ===================== -->
+                                                                               
        <div class="col_2">
+                                                                               
                <form style="display:none;" class="frm_update_case">
+                                                                               
                        <xsl:attribute name="action">
+                                                                               
                                
<xsl:text>index.php?menuaction=controller.uicase.save_case</xsl:text>
+                                                                               
                                <xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="id"/>
+                                                                               
                                <xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="//check_list/id"/>
+                                                                               
                                <xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                
+                                                                               
                        <textarea name="case_descr"><xsl:value-of 
select="descr"/></textarea>
+                                                                               
                        <div>
+                                                                               
                                <input class='btn_m' type='submit' 
value='Oppdater' /><input class='btn_m cancel' type='button' value='Avbryt' />
+                                                                               
                        </div>
+                                                                               
                </form>
+                                                                               
                <div class="case_info">
+                                                                               
                        <div class="case_descr"><xsl:value-of 
select="descr"/></div>
+                                                                               
                        <div class="quick_menu">
+                                                                               
                                        <a class="quick_edit_case first" 
href="">
+                                                                               
                                                endre
+                                                                               
                                        </a>
+                                                                               
                                        <a class="close_case">
                                                                                
                                                <xsl:attribute name="href">
-                                                                               
                                                        
<xsl:text>index.php?menuaction=controller.uicase.delete_case</xsl:text>
+                                                                               
                                                        
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
                                                                                
                                                        
<xsl:text>&amp;case_id=</xsl:text>
                                                                                
                                                        <xsl:value-of 
select="id"/>
                                                                                
                                                        
<xsl:text>&amp;check_list_id=</xsl:text>
                                                                                
                                                        <xsl:value-of 
select="//check_list/id"/>
                                                                                
                                                        
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
                                                                                
                                                </xsl:attribute>
-                                                                               
                                                slett
+                                                                               
                                                lukk
                                                                                
                                        </a>
-                                                                               
                                </xsl:when>
-                                                                               
                        </xsl:choose>
+                                                                               
                                        <xsl:choose>
+                                                                               
                                                <xsl:when 
test="location_item_id = 0">
+                                                                               
                                                        <a class="delete_case">
+                                                                               
                                                                <xsl:attribute 
name="href">
+                                                                               
                                                                        
<xsl:text>index.php?menuaction=controller.uicase.delete_case</xsl:text>
+                                                                               
                                                                        
<xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="id"/>
+                                                                               
                                                                        
<xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="//check_list/id"/>
+                                                                               
                                                                        
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                                                </xsl:attribute>
+                                                                               
                                                                slett
+                                                                               
                                                        </a>
+                                                                               
                                                </xsl:when>
+                                                                               
                                        </xsl:choose>
+                                                                               
                                </div>
+                                                                               
                        </div>
                                                                                
                </div>
-                                                                               
        </div>
-                                                                               
        <!--  =================== UPDATE CASE FORM =================== -->
-                                                                               
<form style="display:none;" class="frm_update_case">
-                                                                               
        <xsl:attribute name="action">
-                                                                               
                
<xsl:text>index.php?menuaction=controller.uicase.save_case</xsl:text>
-                                                                               
                <xsl:text>&amp;case_id=</xsl:text>
-                                                                               
                <xsl:value-of select="id"/>
-                                                                               
                <xsl:text>&amp;check_list_id=</xsl:text>
-                                                                               
                <xsl:value-of select="//check_list/id"/>
-                                                                               
                <xsl:text>&amp;phpgw_return_as=json</xsl:text>
-                                                                               
        </xsl:attribute>
-                                                                               
                                                                                
                
-                                                                               
        <!--  STATUS -->
-                                                                               
        <div class="row first">
-                                                                               
                <label>Status:</label> 
-                                                                               
                <select name="case_status">
+                                                                               
                <!--  ==================== COL3: MESSAGE LINK 
===================== -->
+                                                                               
                <div class="col_3">
+                                                                               
                
                                                                                
                        <xsl:choose>
-                                                                               
                                <xsl:when test="status = 0">
-                                                                               
                                        <option value="0" 
SELECTED="SELECTED">Åpen</option>
-                                                                               
                                        <option value="2">Venter på 
tilbakemelding</option>     
+                                                                               
                                <xsl:when test="location_item_id > 0">
+                                                                               
                                        <a target="_blank">
+                                                                               
                                                        <xsl:attribute 
name="href">
+                                                                               
                                                                
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
+                                                                               
                                                                
<xsl:text>&amp;id=</xsl:text>
+                                                                               
                                                                <xsl:value-of 
select="location_item_id"/>
+                                                                               
                                                        </xsl:attribute>
+                                                                               
                                                        Vis melding
+                                                                               
                                                </a>
                                                                                
                                </xsl:when>
-                                                                               
                                <xsl:when test="status = 1">
-                                                                               
                                        <option value="0">Åpen</option>
-                                                                               
                                        <option value="2">Venter på 
tilbakemelding</option>     
-                                                                               
                                </xsl:when>
-                                                                               
                                <xsl:when test="status = 2">
-                                                                               
                                        <option value="0">Åpen</option>
-                                                                               
                                        <option value="2" 
SELECTED="SELECTED">Venter på tilbakemelding</option>
-                                                                               
                                </xsl:when>
+                                                                               
                                <xsl:otherwise>
+                                                                               
                                        <span class="message">Ingen 
melding</span>
+                                                                               
                                </xsl:otherwise>
                                                                                
                        </xsl:choose>
-                                                                               
                </select>
-                                                                               
        </div>
-                                                                               
        <!--  MEASUREMENT -->
-                                                                               
        <div class="row">
-                                                                               
                <label>Måleverdi:</label> 
-                                                                               
                <input type="text" name="measurement">
-                                                                               
                <xsl:attribute name="value"><xsl:value-of 
select="measurement"/></xsl:attribute>
-                                                                               
                </input>
-                                                                               
        </div>
-                                                                               
        <!--  DESCRIPTION -->
-                                                                               
        <label style="font-weight: bold;">Beskrivelse:</label>
-                                                                               
        <div class="row"> 
-                                                                               
                <textarea name="case_descr"><xsl:value-of 
select="descr"/></textarea>
-                                                                               
        </div>
-                                                                               
        <div>
-                                                                               
                <input class='btn_m' type='submit' value='Oppdater' /><input 
class='btn_m cancel' type='button' value='Avbryt' />
-                                                                               
        </div>
-                                                                               
</form>
-                                                                               
</div>
-                                                                               
        
-                                                                               
<!--  ==================== COL3: MESSAGE LINK ===================== -->
-                                                                               
<div class="col_3">
-                                                                               
        <xsl:choose>
-                                                                               
                <xsl:when test="location_item_id > 0">
-                                                                               
                        <a target="_blank">
-                                                                               
                                        <xsl:attribute name="href">
-                                                                               
                                                
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
-                                                                               
                                                <xsl:text>&amp;id=</xsl:text>
-                                                                               
                                                <xsl:value-of 
select="location_item_id"/>
-                                                                               
                                        </xsl:attribute>
-                                                                               
                                        Vis melding
-                                                                               
                                </a>
-                                                                               
                </xsl:when>
-                                                                               
                <xsl:otherwise>
-                                                                               
                        <span class="message">Ingen melding</span>
-                                                                               
                </xsl:otherwise>
-                                                                               
        </xsl:choose>
-                                                                               
</div>
-                                                                               
</li>
-                                                                       
</xsl:for-each>
-                                                               </ul>
-                                                       </li>
-                                               </xsl:when>
-                                       </xsl:choose>
-                               </xsl:for-each>
-                       </ul>
-                       
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <p>Ingen åpne målinger</p>
-                       </xsl:otherwise>
-               </xsl:choose>
-               
-               <h2 class="last">Saker</h2>
-               <xsl:choose>
-                       <xsl:when 
test="open_check_items_and_cases/child::node()">
-                       <ul class="check_items">
-                               <xsl:for-each 
select="open_check_items_and_cases">
-                                       <xsl:choose>
-                                               <xsl:when 
test="cases_array/child::node()">
-                                                       <li 
class="check_item_case">
-                                                               
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
-                                                               <ul>
-                                                                       
<xsl:for-each select="cases_array">
-                                                                               
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                               
<li>
-                                                                               
-                                                                               
<!--  ==================== COL1: ORDERNR ===================== -->
-                                                                               
<div class="col_1">
-                                                                               
        <span class="order_nr"><xsl:number /></span>.
-                                                                               
</div>
-                                                                               
<!--  ==================== COL2: CASE CONTENT ===================== -->
-                                                                               
<div class="col_2">
-                                                                               
        <form style="display:none;" class="frm_update_case">
-                                                                               
                <xsl:attribute name="action">
-                                                                               
                        
<xsl:text>index.php?menuaction=controller.uicase.save_case</xsl:text>
-                                                                               
                        <xsl:text>&amp;case_id=</xsl:text>
-                                                                               
                        <xsl:value-of select="id"/>
-                                                                               
                        <xsl:text>&amp;check_list_id=</xsl:text>
-                                                                               
                        <xsl:value-of select="//check_list/id"/>
-                                                                               
                        <xsl:text>&amp;phpgw_return_as=json</xsl:text>
-                                                                               
                </xsl:attribute>
-                                                                               
        
-                                                                               
                <textarea name="case_descr"><xsl:value-of 
select="descr"/></textarea>
-                                                                               
                <div>
-                                                                               
                        <input class='btn_m' type='submit' value='Oppdater' 
/><input class='btn_m cancel' type='button' value='Avbryt' />
                                                                                
                </div>
-                                                                               
        </form>
-                                                                               
        <div class="case_info">
-                                                                               
                <div class="case_descr"><xsl:value-of select="descr"/></div>
-                                                                               
                <div class="quick_menu">
-                                                                               
                                <a class="quick_edit_case first" href="">
-                                                                               
                                        endre
-                                                                               
                                </a>
-                                                                               
                                <a class="close_case">
-                                                                               
                                        <xsl:attribute name="href">
-                                                                               
                                                
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
-                                                                               
                                                
<xsl:text>&amp;case_id=</xsl:text>
-                                                                               
                                                <xsl:value-of select="id"/>
-                                                                               
                                                
<xsl:text>&amp;check_list_id=</xsl:text>
-                                                                               
                                                <xsl:value-of 
select="//check_list/id"/>
-                                                                               
                                                
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
-                                                                               
                                        </xsl:attribute>
-                                                                               
                                        lukk
-                                                                               
                                </a>
+                                                                               
        </li>
+                                                                               
        </xsl:for-each>
+                                                                               
</ul>
+                                                                               
                                                
+                                                                               
</li>
+                                                                       
</xsl:when>     
+                                                                               
</xsl:choose>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control_item/type = 'control_item_type_2'">
+                                                                               
        <h2>Målinger</h2>
+                                                                               
        <h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                                               
        <span style="display:none;" class="control_item_type"><xsl:value-of 
select="control_item/type" /></span>
+                                                                               
        <ul>
+                                                                               
                <xsl:for-each select="cases_array">
+                                                                               
                        <xsl:variable name="cases_id"><xsl:value-of 
select="id"/></xsl:variable>
+                                                                               
                        <li>
+                                                                               
                        
+                                                                               
                        <!--  ==================== COL1: ORDERNR 
===================== -->
+                                                                               
                        <div class="col_1">
+                                                                               
                                <span class="order_nr"><xsl:number /></span>.
+                                                                               
                        </div>
+                                                                               
                        
+                                                                               
                        <!--  ==================== COL2: CASE CONTENT 
===================== -->
+                                                                               
                        <div class="col_2">
+                                                                               
                        
+                                                                               
                        <!--  =============== SHOW CASE INFO 
==================== -->
+                                                                               
                        <div class="case_info">
+                                                                               
                                <!-- STATUS -->
+                                                                               
                                <div class="row first">
+                                                                               
                                        <label>Status:</label>
+                                                                               
                                        <span class="case_status">
+                                                                               
                                                <xsl:choose>
+                                                                               
                                                        <xsl:when test="status 
= 0">Åpen</xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 1">Lukket</xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 2">Venter på tilbakemelding</xsl:when>
+                                                                               
                                                </xsl:choose>
+                                                                               
                                        </span>
+                                                                               
                                </div>
+                                                                               
                                <!--  MEASUREMENT -->
+                                                                               
                                <div class="row">
+                                                                               
                                        <label>Måleverdi:</label> 
+                                                                               
                                        <span class="measurement"><xsl:value-of 
select="measurement"/></span>
+                                                                               
                                </div>
+                                                                               
                                <!--  DESCRIPTION -->
+                                                                               
                                <div class="row">
+                                                                               
                                        <label>Beskrivelse:</label> 
+                                                                               
                                </div>
+                                                                               
                                <div class="case_descr"><xsl:value-of 
select="descr"/></div>
+                                                                               
                                
+                                                                               
                                <!-- === QUICK EDIT MENU === -->
+                                                                               
                                <div class="quick_menu">
+                                                                               
                                                <a class="quick_edit_case" 
href="">
+                                                                               
                                                        endre
+                                                                               
                                                </a>
+                                                                               
                                                <a class="close_case">
+                                                                               
                                                        <xsl:attribute 
name="href">
+                                                                               
                                                                
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
+                                                                               
                                                                
<xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                                                <xsl:value-of 
select="id"/>
+                                                                               
                                                                
<xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                                                <xsl:value-of 
select="//check_list/id"/>
+                                                                               
                                                                
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                                        </xsl:attribute>
+                                                                               
                                                        lukk
+                                                                               
                                                </a>
+                                                                               
                                                <xsl:choose>
+                                                                               
                                                        <xsl:when 
test="location_item_id = 0">
+                                                                               
                                                                <a 
class="delete_case">
+                                                                               
                                                                        
<xsl:attribute name="href">
+                                                                               
                                                                                
<xsl:text>index.php?menuaction=controller.uicase.delete_case</xsl:text>
+                                                                               
                                                                                
<xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                                                                
<xsl:value-of select="id"/>
+                                                                               
                                                                                
<xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                                                                
<xsl:value-of select="//check_list/id"/>
+                                                                               
                                                                                
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                                                        
</xsl:attribute>
+                                                                               
                                                                        slett
+                                                                               
                                                                </a>
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                </xsl:choose>
+                                                                               
                                        </div>
+                                                                               
                                </div>
+                                                                               
                                <!--  =================== UPDATE CASE FORM 
=================== -->
+                                                                               
                        <form style="display:none;" class="frm_update_case">
+                                                                               
                                <xsl:attribute name="action">
+                                                                               
                                        
<xsl:text>index.php?menuaction=controller.uicase.save_case</xsl:text>
+                                                                               
                                        <xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                        <xsl:value-of select="id"/>
+                                                                               
                                        <xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                        <xsl:value-of select="//check_list/id"/>
+                                                                               
                                        
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                </xsl:attribute>
+                                                                               
                                                                                
                                        
+                                                                               
                                <!--  STATUS -->
+                                                                               
                                <div class="row first">
+                                                                               
                                        <label>Status:</label> 
+                                                                               
                                        <select name="case_status">
+                                                                               
                                                <xsl:choose>
+                                                                               
                                                        <xsl:when test="status 
= 0">
+                                                                               
                                                                <option 
value="0" SELECTED="SELECTED">Åpen</option>
+                                                                               
                                                                <option 
value="2">Venter på tilbakemelding</option>     
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 1">
+                                                                               
                                                                <option 
value="0">Åpen</option>
+                                                                               
                                                                <option 
value="2">Venter på tilbakemelding</option>     
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 2">
+                                                                               
                                                                <option 
value="0">Åpen</option>
+                                                                               
                                                                <option 
value="2" SELECTED="SELECTED">Venter på tilbakemelding</option>
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                </xsl:choose>
+                                                                               
                                        </select>
+                                                                               
                                </div>
+                                                                               
                                <!--  MEASUREMENT -->
+                                                                               
                                <div class="row">
+                                                                               
                                        <label>Måleverdi:</label> 
+                                                                               
                                        <input type="text" name="measurement">
+                                                                               
                                        <xsl:attribute 
name="value"><xsl:value-of select="measurement"/></xsl:attribute>
+                                                                               
                                        </input>
+                                                                               
                                </div>
+                                                                               
                                <!--  DESCRIPTION -->
+                                                                               
                                <label style="font-weight: 
bold;">Beskrivelse:</label>
+                                                                               
                                <div class="row"> 
+                                                                               
                                        <textarea 
name="case_descr"><xsl:value-of select="descr"/></textarea>
+                                                                               
                                </div>
+                                                                               
                                <div>
+                                                                               
                                        <input class='btn_m' type='submit' 
value='Oppdater' /><input class='btn_m cancel' type='button' value='Avbryt' />
+                                                                               
                                </div>
+                                                                               
                        </form>
+                                                                               
                        </div>
+                                                                               
                                
+                                                                               
                        <!--  ==================== COL3: MESSAGE LINK 
===================== -->
+                                                                               
                        <div class="col_3">
                                                                                
                                <xsl:choose>
-                                                                               
                                        <xsl:when test="location_item_id = 0">
-                                                                               
                                                <a class="delete_case">
+                                                                               
                                        <xsl:when test="location_item_id > 0">
+                                                                               
                                                <a target="_blank">
+                                                                               
                                                                <xsl:attribute 
name="href">
+                                                                               
                                                                        
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
+                                                                               
                                                                        
<xsl:text>&amp;id=</xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="location_item_id"/>
+                                                                               
                                                                </xsl:attribute>
+                                                                               
                                                                Vis melding
+                                                                               
                                                        </a>
+                                                                               
                                        </xsl:when>
+                                                                               
                                        <xsl:otherwise>
+                                                                               
                                                <span class="message">Ingen 
melding</span>
+                                                                               
                                        </xsl:otherwise>
+                                                                               
                                </xsl:choose>
+                                                                               
                        </div>
+                                                                               
                        </li>
+                                                                               
                </xsl:for-each>
+                                                                               
        </ul>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control_item/type = 'control_item_type_3' or control_item/type 
= 'control_item_type_4'">
+                                                                               
        <h2>Målinger</h2>
+                                                                               
        <h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                                               
        <span style="display:none;" class="control_item_type"><xsl:value-of 
select="control_item/type" /></span>
+                                                                               
        <ul>
+                                                                               
                <xsl:for-each select="cases_array">
+                                                                               
                        <xsl:variable name="cases_id"><xsl:value-of 
select="id"/></xsl:variable>
+                                                                               
                        <li>
+                                                                               
                        
+                                                                               
                        <!--  ==================== COL1: ORDERNR 
===================== -->
+                                                                               
                        <div class="col_1">
+                                                                               
                                <span class="order_nr"><xsl:number /></span>.
+                                                                               
                        </div>
+                                                                               
                        
+                                                                               
                        <!--  ==================== COL2: CASE CONTENT 
===================== -->
+                                                                               
                        <div class="col_2">
+                                                                               
                        
+                                                                               
                        <!--  =============== SHOW CASE INFO 
==================== -->
+                                                                               
                        <div class="case_info">
+                                                                               
                                <!-- STATUS -->
+                                                                               
                                <div class="row first">
+                                                                               
                                        <label>Status:</label>
+                                                                               
                                        <span class="case_status">
+                                                                               
                                                <xsl:choose>
+                                                                               
                                                        <xsl:when test="status 
= 0">Åpen</xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 1">Lukket</xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 2">Venter på tilbakemelding</xsl:when>
+                                                                               
                                                </xsl:choose>
+                                                                               
                                        </span>
+                                                                               
                                </div>
+                                                                               
                                <!--  MEASUREMENT -->
+                                                                               
                                <div class="row">
+                                                                               
                                        <label>Måleverdi:</label> 
+                                                                               
                                        <span class="measurement"><xsl:value-of 
select="measurement"/></span>
+                                                                               
                                </div>
+                                                                               
                                <!--  DESCRIPTION -->
+                                                                               
                                <div class="row">
+                                                                               
                                        <label>Beskrivelse:</label> 
+                                                                               
                                </div>
+                                                                               
                                <div class="case_descr"><xsl:value-of 
select="descr"/></div>
+                                                                               
                                
+                                                                               
                                <!-- === QUICK EDIT MENU === -->
+                                                                               
                                <div class="quick_menu">
+                                                                               
                                                <a class="quick_edit_case" 
href="">
+                                                                               
                                                        endre
+                                                                               
                                                </a>
+                                                                               
                                                <a class="close_case">
                                                                                
                                                        <xsl:attribute 
name="href">
-                                                                               
                                                                
<xsl:text>index.php?menuaction=controller.uicase.delete_case</xsl:text>
+                                                                               
                                                                
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
                                                                                
                                                                
<xsl:text>&amp;case_id=</xsl:text>
                                                                                
                                                                <xsl:value-of 
select="id"/>
                                                                                
                                                                
<xsl:text>&amp;check_list_id=</xsl:text>
                                                                                
                                                                <xsl:value-of 
select="//check_list/id"/>
                                                                                
                                                                
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
                                                                                
                                                        </xsl:attribute>
-                                                                               
                                                        slett
+                                                                               
                                                        lukk
                                                                                
                                                </a>
+                                                                               
                                                <xsl:choose>
+                                                                               
                                                        <xsl:when 
test="location_item_id = 0">
+                                                                               
                                                                <a 
class="delete_case">
+                                                                               
                                                                        
<xsl:attribute name="href">
+                                                                               
                                                                                
<xsl:text>index.php?menuaction=controller.uicase.delete_case</xsl:text>
+                                                                               
                                                                                
<xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                                                                
<xsl:value-of select="id"/>
+                                                                               
                                                                                
<xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                                                                
<xsl:value-of select="//check_list/id"/>
+                                                                               
                                                                                
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                                                        
</xsl:attribute>
+                                                                               
                                                                        slett
+                                                                               
                                                                </a>
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                </xsl:choose>
+                                                                               
                                        </div>
+                                                                               
                                </div>
+                                                                               
                                <!--  =================== UPDATE CASE FORM 
=================== -->
+                                                                               
                        <form style="display:none;" class="frm_update_case">
+                                                                               
                                <xsl:attribute name="action">
+                                                                               
                                        
<xsl:text>index.php?menuaction=controller.uicase.save_case</xsl:text>
+                                                                               
                                        <xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                        <xsl:value-of select="id"/>
+                                                                               
                                        <xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                        <xsl:value-of select="//check_list/id"/>
+                                                                               
                                        
<xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                </xsl:attribute>
+                                                                               
                                                                                
                                        
+                                                                               
                                <!--  STATUS -->
+                                                                               
                                <div class="row first">
+                                                                               
                                        <label>Status:</label> 
+                                                                               
                                        <select name="case_status">
+                                                                               
                                                <xsl:choose>
+                                                                               
                                                        <xsl:when test="status 
= 0">
+                                                                               
                                                                <option 
value="0" SELECTED="SELECTED">Åpen</option>
+                                                                               
                                                                <option 
value="2">Venter på tilbakemelding</option>     
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 1">
+                                                                               
                                                                <option 
value="0">Åpen</option>
+                                                                               
                                                                <option 
value="2">Venter på tilbakemelding</option>     
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                        <xsl:when test="status 
= 2">
+                                                                               
                                                                <option 
value="0">Åpen</option>
+                                                                               
                                                                <option 
value="2" SELECTED="SELECTED">Venter på tilbakemelding</option>
+                                                                               
                                                        </xsl:when>
+                                                                               
                                                </xsl:choose>
+                                                                               
                                        </select>
+                                                                               
                                </div>
+                                                                               
                                <!--  MEASUREMENT -->
+                                                                               
                                <div class="row">
+                                                                               
                                         <label class="comment">Velg verdi fra 
liste</label>
+                                                                               
                                <select name="option_value">
+                                                                               
                                        <xsl:for-each 
select="../control_item/options_array">
+                                                                               
                                                <option>
+                                                                               
                                                                <xsl:attribute 
name="value"><xsl:value-of select="option_value"/></xsl:attribute>
+                                                                               
                                                                <xsl:value-of 
select="option_value"/>
+                                                                               
                                                        </option>       
+                                                                               
                                                </xsl:for-each>
+                                                                               
                                        </select>
+                                                                               
                                </div>
+                                                                               
                                <!--  DESCRIPTION -->
+                                                                               
                                <label style="font-weight: 
bold;">Beskrivelse:</label>
+                                                                               
                                <div class="row"> 
+                                                                               
                                        <textarea 
name="case_descr"><xsl:value-of select="descr"/></textarea>
+                                                                               
                                </div>
+                                                                               
                                <div>
+                                                                               
                                        <input class='btn_m' type='submit' 
value='Oppdater' /><input class='btn_m cancel' type='button' value='Avbryt' />
+                                                                               
                                </div>
+                                                                               
                        </form>
+                                                                               
                        </div>
+                                                                               
                                
+                                                                               
                        <!--  ==================== COL3: MESSAGE LINK 
===================== -->
+                                                                               
                        <div class="col_3">
+                                                                               
                                <xsl:choose>
+                                                                               
                                        <xsl:when test="location_item_id > 0">
+                                                                               
                                                <a target="_blank">
+                                                                               
                                                                <xsl:attribute 
name="href">
+                                                                               
                                                                        
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
+                                                                               
                                                                        
<xsl:text>&amp;id=</xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="location_item_id"/>
+                                                                               
                                                                </xsl:attribute>
+                                                                               
                                                                Vis melding
+                                                                               
                                                        </a>
                                                                                
                                        </xsl:when>
+                                                                               
                                        <xsl:otherwise>
+                                                                               
                                                <span class="message">Ingen 
melding</span>
+                                                                               
                                        </xsl:otherwise>
                                                                                
                                </xsl:choose>
                                                                                
                        </div>
-                                                                               
                </div>
-                                                                               
        </div>
-                                                                               
                <!--  ==================== COL3: MESSAGE LINK 
===================== -->
-                                                                               
                <div class="col_3">
-                                                                               
        
-                                                                               
                <xsl:choose>
-                                                                               
                        <xsl:when test="location_item_id > 0">
-                                                                               
                                <a target="_blank">
-                                                                               
                                                <xsl:attribute name="href">
-                                                                               
                                                        
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
-                                                                               
                                                        
<xsl:text>&amp;id=</xsl:text>
-                                                                               
                                                        <xsl:value-of 
select="location_item_id"/>
-                                                                               
                                                </xsl:attribute>
-                                                                               
                                                Vis melding
-                                                                               
                                        </a>
-                                                                               
                        </xsl:when>
-                                                                               
                        <xsl:otherwise>
-                                                                               
                                <span class="message">Ingen melding</span>
-                                                                               
                        </xsl:otherwise>
-                                                                               
                </xsl:choose>
-                                                                               
        </div>
-                                                                               
</li>
-                                                                       
</xsl:for-each>
-                                                               </ul>
-                                                       </li>
-                                               </xsl:when>
-                                       </xsl:choose>
-                               </xsl:for-each>
-                       </ul>
+                                                                               
                        </li>
+                                                                               
                </xsl:for-each>
+                                                                               
        </ul>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                       </xsl:for-each>
+                               </ul>
                        </xsl:when>
                        <xsl:otherwise>
-                               <p>Ingen åpne saker</p>
+                               <p>Ingen åpne målinger</p>
                        </xsl:otherwise>
                </xsl:choose>
        </div>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control/control.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control/control.xsl   
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/templates/base/control/control.xsl   
2012-05-29 12:21:39 UTC (rev 9464)
@@ -41,15 +41,15 @@
                                        <xsl:when test="editable">
                                                <select class="required" 
id="control_area_id" name="control_area_id">
                                                <option value="">Velg 
kontrollområde</option>
-                                                       <xsl:for-each 
select="control_areas_array2">
+                                                       <xsl:for-each 
select="control_areas_array">
                                                                <xsl:choose>
-                                                                       
<xsl:when test="id = $control_area_id">
-                                                                               
<option value="{id}" selected="selected">
+                                                                       
<xsl:when test="cat_id = $control_area_id">
+                                                                               
<option value="{cat_id}" selected="selected">
                                                                                
        <xsl:value-of disable-output-escaping="yes" select="name"/>
                                                                                
</option>
                                                                        
</xsl:when>
                                                                        
<xsl:otherwise>
-                                                                               
<option value="{id}">
+                                                                               
<option value="{cat_id}">
                                                                                
        <xsl:value-of disable-output-escaping="yes" select="name"/>
                                                                                
</option>
                                                                        
</xsl:otherwise>
@@ -86,13 +86,13 @@
                                                                </xsl:choose>   
                                                        
                                                        </xsl:for-each>
                                                </select>
-                                               <span class="help_text">Angi 
hvilken prosedyre kontrollen er basert på</span>
+                                               <span class="help_text">Angi 
hvilken prosedyre som ligger til grunn for kontrollen</span>
                                        </xsl:when>
                                        <xsl:otherwise>
                                                <xsl:value-of 
select="control/procedure_name" />
                                        </xsl:otherwise>
                                </xsl:choose>
-                               </dd>
+                               </dd>   
                                <dt>
                                        <label for="title">Tittel</label>
                                </dt>

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-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
 2012-05-29 12:21:39 UTC (rev 9464)
@@ -4,30 +4,26 @@
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
 
 <xsl:call-template name="yui_booking_i18n"/>
-<div class="identifier-header">
-<h1><img src="{img_go_home}" /> 
-               <xsl:value-of select="php:function('lang', 'Control_item')" />
-</h1>
-</div>
 
+<div id="main_content">
+
+<h1><xsl:value-of select="php:function('lang', 'Register control item')" 
/></h1>
+
 <ul class="check_list">
-                       <xsl:for-each select="check_list_array">
-                               <li>
-                                       <span>Tittel:</span><xsl:value-of 
select="title"/><span>Start dato:</span><xsl:value-of select="start_date"/>
-                               </li>
-                       </xsl:for-each>
-               </ul>                                   
-               
-       <div class="yui-content">
-               <div id="details">
-                       <form action="#" method="post">
-                               <input type="hidden" name="id" value = 
"{value_id}">
-                               </input>
-                               <dl class="proplist-col">
-                                       <dt>
-                                               <label 
for="title">Tittel</label>
-                                       </dt>
-                                       <dd>
+       <xsl:for-each select="check_list_array">
+               <li>
+                       <span>Tittel:</span><xsl:value-of 
select="title"/><span>Start dato:</span><xsl:value-of select="start_date"/>
+               </li>
+       </xsl:for-each>
+</ul>
+       
+       <div id="control_item_details">
+               <form action="#" method="post">
+                       <input type="hidden" name="id" 
value="{control_item/id}">
+                       </input>
+                       <dl class="proplist-col">
+                               <dt>
+                                       <label for="title">Tittel</label>
                                        <xsl:choose>
                                                <xsl:when test="editable">
                                                        <input type="text" 
name="title" id="title" value="{control_item/title}" size="80"/>
@@ -36,11 +32,9 @@
                                                        <xsl:value-of 
select="control_item/title"/>
                                                </xsl:otherwise>
                                        </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="required">Obligatorisk</label>
-                                       </dt>
-                                       <dd>
+                               </dt>
+                               <dt>
+                                       <label for="required">Skal det være 
obligatorisk å sjekke kontrollpunktet</label>
                                        <xsl:variable 
name="required_item"><xsl:value-of select="control_item/required" 
/></xsl:variable>
                                        <xsl:choose>
                                                <xsl:when test="editable">
@@ -64,113 +58,173 @@
                                                        </xsl:choose>
                                                </xsl:otherwise>
                                        </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="required">Måling</label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:variable 
name="measurement_item"><xsl:value-of select="control_item/type" 
/></xsl:variable>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="$measurement_item='control_item_type_2'">
-                                                                       <input 
type="checkbox" name="measurement" id="measurement" checked="true"/>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       <input 
type="checkbox" name="measurement" id="measurement"/>
-                                                               </xsl:otherwise>
-                                                       </xsl:choose>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="$measurement_item='control_item_type_2'">
-                                                                       <input 
type="checkbox" name="measurement" id="measurement" checked="true" 
disabled="true"/>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       <input 
type="checkbox" name="measurement" id="measurement" disabled="true" />
-                                                               </xsl:otherwise>
-                                                       </xsl:choose>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label for="what_to_do">Hva 
skal utføres</label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <textarea 
name="what_to_do" id="what_to_do" rows="5" cols="60"><xsl:value-of 
select="control_item/what_to_do" disable-output-escaping="yes" /></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="control_item/what_to_do" disable-output-escaping="yes" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="how_to_do">Utførelsesbeskrivelse</label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <textarea 
name="how_to_do" id="how_to_do" rows="5" cols="60"><xsl:value-of 
select="control_item/how_to_do" disable-output-escaping="yes" /></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="control_item/how_to_do" disable-output-escaping="yes" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                                       <dt>
+                               </dt>
+                               <dt>
+                                       <label class="top" for="required">Velg 
hvordan kontrollpunktet skal sjekkes av kontrollør</label>
+                                       <div class="styleWrp">
+                                               <xsl:variable 
name="control_item_type"><xsl:value-of select="control_item/type" 
/></xsl:variable>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                       
+                                                               <!-- 
==============  RADIOBUTTONS FOR CHOOSING CONTROL ITEM TYPE  ==============  -->
+                                                               <xsl:for-each 
select="control_item/control_item_types">
+                                                                       
+                                                                       
<xsl:variable name="classes">
+                                                                               
<xsl:choose>
+                                                                               
        <xsl:when test="position() = 1">
+                                                                               
                btn active
+                                                                               
        </xsl:when>
+                                                                               
        <xsl:otherwise>
+                                                                               
                btn
+                                                                               
        </xsl:otherwise>
+                                                                               
</xsl:choose>
+                                                                       
</xsl:variable>
+                                                                       
+                                                                       <div 
class="control_item_type">
+                                                                               
<xsl:variable name="lang_type"><xsl:value-of select="." /></xsl:variable>
+                                                                               
<xsl:variable name="current_control_item_type"><xsl:value-of select="." 
/></xsl:variable>
+                                                                               
+                                                                               
<input class="{$classes}" type="button" value="Velg" />
+                                                                               
<input type="radio" name="control_item_type" 
value="{$current_control_item_type}" />
+                                                                               
<xsl:value-of select="php:function('lang', $lang_type)" />
+                                                                       </div>
+                                                               </xsl:for-each>
+                                                               
+                                                               <!-- 
==============  FORM FOR SAVING OPTION VALUES FOR LIST  =============  -->
+                                                               <div 
id="add_control_item_option_panel">
+                                                                       <hr />
+                                                                       
<h3>Legg til verdier som listen skal inneholde</h3>
+                                                                       
+                                                                       <input 
type="hidden" name="control_item_id">
+                                                                               
<xsl:attribute name="value"><xsl:value-of 
select="control_item/id"/></xsl:attribute>
+                                                                       </input>
+                                                                               
+                                                                       <ul 
id="control_item_options"></ul>
+                                                                       
+                                                                       <div 
id="add_control_item_list_value" class="row">
+                                                                               
<label>Ny listeverdi</label>
+                                                                               
<input type="text" name="option_value" />
+                                                                               
<input class="btn" type="button" value="Legg til" />
+                                                                       </div>
+                                                               </div>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:variable 
name="lang_type"><xsl:value-of select="control_item/type" /></xsl:variable>
+                                                               <xsl:value-of 
select="php:function('lang', $lang_type)" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </div>
+                               </dt>
+                               <dt>
+                                       <label class="top" for="required">Velg 
hvilken kontrollgruppe kontrollpunktet skal tilhøre</label>
+                                       <div class="styleWrp">
+                                               <div class="row">
                                                <label 
for="control_area">Kontrollområde</label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <select 
id="control_area" name="control_area">
-                                                               
<xsl:apply-templates select="control_area/options"/>
-                                                       </select>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="control_item/control_area_name" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                                                                               
<dt>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <select 
class="required" id="control_area" name="control_area">
+                                                               <option 
value="">Velg kontrollområde</option>
+                                                                       
<xsl:for-each select="control_areas">
+                                                                       
<xsl:value-of disable-output-escaping="yes" select="name"/>
+                                                                               
<xsl:choose>
+                                                                               
        <xsl:when test="cat_id = //control_item/control_area_id">
+                                                                               
                <option value="{cat_id}" selected="selected">
+                                                                               
                        <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                                                                               
                </option>
+                                                                               
        </xsl:when>
+                                                                               
        <xsl:otherwise>
+                                                                               
                <option value="{cat_id}">
+                                                                               
                        <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                                                                               
                </option>
+                                                                               
        </xsl:otherwise>
+                                                                               
</xsl:choose>                                                           
+                                                                       
</xsl:for-each>
+                                                               </select>
+                                                               <span 
class="help_text">Angi hvilket kontrollområde kontrollen skal gjelde for</span>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="control_item/control_area_name" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                               </div>
+                                               <div class="row">
                                                <label 
for="control_group">Kontrollgruppe</label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <select 
id="control_group" name="control_group">
-                                                               <option 
value="0">Ingen valgt</option>
-                                                               
<xsl:apply-templates select="control_group/options"/>
-                                                       </select>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="control_item/control_group_name" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>                           
-                               </dl>
-                               
-                               <div class="form-buttons">
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="save_control_item" value="{$lang_save}" title = "{$lang_save}" />
-                                                       <input type="submit" 
name="cancel_control_item" value="{$lang_cancel}" title = "{$lang_cancel}" />
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="edit_control_item" value="{$lang_edit}" title = "{$lang_edit}" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </div>
-                               
-                       </form>
                                                
-               </div>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <select 
id="control_group" name="control_group">
+                                                                       <option 
value="0">Ingen valgt</option>
+                                                                       
<xsl:for-each select="control_groups">
+                                                                               
<xsl:choose>
+                                                                               
        <xsl:when test="id = //control_item/control_group_id">
+                                                                               
                <option value="{id}" selected="selected">
+                                                                               
                        <xsl:value-of disable-output-escaping="yes" 
select="group_name"/>
+                                                                               
                </option>
+                                                                               
        </xsl:when>
+                                                                               
        <xsl:otherwise>
+                                                                               
                <option value="{id}">
+                                                                               
                        <xsl:value-of disable-output-escaping="yes" 
select="group_name"/>
+                                                                               
                </option>
+                                                                               
        </xsl:otherwise>
+                                                                               
</xsl:choose>                                                           
+                                                                       
</xsl:for-each>
+                                                               </select>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="control_item/control_group_name" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                               </div>
+                                       </div>
+                               </dt>   
+                               <dt>
+                                       <label for="what_to_do">Hva skal 
utføres</label>
+                               </dt>
+                               <dd>
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                               <textarea name="what_to_do" 
id="what_to_do" rows="5" cols="60">
+                                                       <xsl:value-of 
select="control_item/what_to_do" disable-output-escaping="yes" />
+                                               </textarea>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:value-of 
select="control_item/what_to_do" disable-output-escaping="yes" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                               </dd>
+                               <dt>
+                                       <label 
for="how_to_do">Utførelsesbeskrivelse</label>
+                               </dt>
+                               <dd>
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                               <textarea name="how_to_do" 
id="how_to_do" rows="5" cols="60"><xsl:value-of select="control_item/how_to_do" 
disable-output-escaping="yes" /></textarea>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:value-of 
select="control_item/how_to_do" disable-output-escaping="yes" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                               </dd>
+                                                       
+                       </dl>
+                       
+                       <div class="form-buttons">
+                               <xsl:choose>
+                                       <xsl:when test="editable">
+                                               <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
+                                               <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
+                                               <input type="submit" 
name="save_control_item" value="{$lang_save}" title = "{$lang_save}" />
+                                               <input type="submit" 
name="cancel_control_item" value="{$lang_cancel}" title = "{$lang_cancel}" />
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
+                                               <input type="submit" 
name="edit_control_item" value="{$lang_edit}" title = "{$lang_edit}" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+               </form>
        </div>
+</div>
 </xsl:template>
        
 <xsl:template match="options">

Copied: 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
 (from rev 9463, 
trunk/controller/templates/base/control_item/control_item_option.xsl)
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
                          (rev 0)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
  2012-05-29 12:21:39 UTC (rev 9464)
@@ -0,0 +1,32 @@
+<!-- $Id: control_item.xsl 8913 2012-02-17 10:14:42Z erikhl $ -->
+<!-- item  -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+
+
+
+<xsl:call-template name="yui_booking_i18n"/>
+
+<div id="main_wrp">
+
+<h1>Legg verdier til liste</h1>
+       
+<div class="yui-content">
+       <div id="details">
+               <form id="frm_add_control_item_option" 
action="index.php?menuaction=controller.uicontrol_item_option.save" 
method="post">
+                       <input type="hidden" name="control_item_id">
+                               <xsl:attribute name="value"><xsl:value-of 
select="control_item/id"/></xsl:attribute>
+                       </input>
+                       
+                       <ul id="control_item_options"></ul>
+                       
+                       <div class="row">
+                               <label>Valgverdi</label>
+                               <input type="text" name="label" />
+                               <input type="submit" value="Lagre" />
+                       </div>
+               </form>
+       </div>
+</div>
+</div>
+</xsl:template>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_item/sort_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_item/sort_check_list.xsl
      2012-05-29 02:12:51 UTC (rev 9463)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/sort_check_list.xsl
      2012-05-29 12:21:39 UTC (rev 9464)
@@ -4,6 +4,8 @@
 <xsl:variable name="control_id"><xsl:value-of 
select="control/id"/></xsl:variable>
 
 <div class="yui-content tab_content">
+
+       <h2>Sorter kontrollgrupper og kontrollpunkt</h2>
                
          <!-- ===========================  SHOWS CONTROL ITEMS RECEIPT   
=============================== -->
                <form action="#" id="frmSaveOrder">
@@ -37,7 +39,7 @@
                                </xsl:choose>
                                </xsl:for-each>
                        </ul>
-                       <input type="submit" value="Lagre rekkefølge" />
+                       <span id="saveOrder" class="btn"><span 
class="text">Lagre rekkefølge</span></span>
                </form>
 </div>
 </xsl:template>

Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-05-29 02:12:51 UTC (rev 9463)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-05-29 12:21:39 UTC (rev 9464)
@@ -161,7 +161,6 @@
 }
 dl.proplist dt,
 dl.proplist-col dt { 
-    font-style: italic; 
     font-weight: bolder; 
     font-size: 90%; 
     margin: .8em 0 .1em 0;
@@ -409,6 +408,9 @@
     margin-top: 20px;
     padding: 5px 20px;
 }
+.row input[type="submit"] {
+    padding: 2px 10px;
+}
 select{
        padding: 3px 1px 3px 4px;
 }
@@ -486,6 +488,94 @@
     margin:0 0 10px;
 }
 
+
+/* =======================================  CONTROL ITEM  
========================================= */
+
+#control_item_details{
+       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;
+    width: 1150px;
+}
+#control_item_details label{
+       margin-right: 10px;
+}
+#control_item_details label.top {
+    display: block;
+    margin-bottom: 3px;
+}
+#control_item_details .styleWrp {
+    background: none repeat scroll 0 0 #F2F8FF;
+    border: 1px solid #DBE5EF;
+    border-radius: 5px 5px 5px 5px;
+    padding: 10px;
+}
+#control_item_details dl.proplist dt, dl.proplist-col dt {
+    font-size: 1em;
+    font-weight: normal;
+    margin-top: 1.5em;
+}
+#control_item_details .control_item_type {
+    margin-top: 0.5em;
+}
+#control_item_details .control_item_type .active {
+    background: none repeat scroll 0 0 #0F6CCF;
+}
+#control_item_details input[type=radio] {
+    display:none;
+}
+
+/* =======================================  ADD CONTROL ITEM LIST VALUES  
========================================= */
+
+#add_control_item_option_panel {
+       margin-top: 2em;
+       display: none;
+}
+#add_control_item_option_panel label{
+       display: inline-block;
+       width: 85px; 
+}
+#add_control_item_option_panel input[type=text]{
+       display: inline-block;
+       width: 150px; 
+}
+#add_control_item_option_panel hr{
+       border: 1px solid #CCD2D9;
+}
+
+ul#control_item_options{
+       margin-bottom: 1em;
+}
+ul#control_item_options li {
+    margin-bottom: 5px;
+    margin-right: 5px;
+}
+ul#control_item_options li .order_nr{
+    margin-left: 5px;
+}
+ul#control_item_options input[type="text"] {
+    background: none repeat scroll 0 0 transparent;
+    border: medium none;
+}
+ul#control_item_options label {
+    margin-right: 10px;
+}
+ul#control_item_options .btn.delete {
+    background: none repeat scroll 0 0 #EEEEEE;
+    border: 1px solid #CCCCCC;
+    color: #333333;
+    font-size: 1.1em;
+    font-weight: normal;
+    margin: 0 0 0 2px;
+    text-align: center;
+    width: 45px;
+}
+
 /* =======================================  CONTROL TAB VIEW  
========================================= */
 #control_tabview .yui-navset, #control_location_tabview .yui-navset{
        margin:0;
@@ -1421,6 +1511,7 @@
 .frm_update_case input[type="submit"], .frm_update_case input[type="button"] {
     float: left;
     margin-top: 10px;
+    padding: 3px 6px;
 }
 .frm_update_case input[type="text"]{
        width: 170px;  
@@ -1436,6 +1527,7 @@
 }
 
 /* ===============================  FORM REGISTER CASE  
============================= */
+
 .frm_register_case {
        margin-bottom: 1em;
 }
@@ -1459,6 +1551,7 @@
 
 
 /* ================================ CASE MESSAGE ============================= 
*/
+
 #caseMessage a#showMessage {
     float: right;
     font-size: 17px;
@@ -1477,7 +1570,6 @@
     border: 1px solid #EBE5DD;
     padding: 0.5em 1%;
 }
-
 #caseMessage ul.cases h4{
        margin-top:0
 }
@@ -1488,7 +1580,7 @@
        margin-top:20px;
 }
 
-/* ==============================  QUICK MENU  ============================= */
+/* ==============================  CASE QUICK MENU  
============================= */
 
 .quick_menu {
     font-size: 12px;
@@ -1498,7 +1590,6 @@
     margin-right: 5px;
     text-decoration: underline;
 }
-
 ul#groups {
     margin-left: 10px;
     margin-top: 5px;
@@ -1518,13 +1609,13 @@
 input.focus, select.focus{
        border: 2px solid #dae6f4;
 }
-
 div.controller_checklist {
        padding: 20px;
        border: 1px solid #ABABAB;
 }
 
-/* ======================== REGISTER CONTROL FOR LOCATION 
===================== */
+/* =====================  REGISTER CONTROL FOR LOCATION  ===================== 
*/
+
 #choose_control{
        margin: 10px;
        padding: 10px; 
@@ -1537,27 +1628,25 @@
     padding: 7px 0;
 }
 
-/* ======================== CONTROL DETAILS 
=================================== */
+/* ==========================  CONTROL DETAILS   ============================ 
*/
 
 #control_details label {
     display: inline-block;
     font-weight: bold;
     width: 100px;
 }
-
 #control_details #select_all{
        margin-left: 660px;     
 }
-
 #control_details #location_form{
        margin-left: 20px;
        margin-bottom: 20px;    
 }
-
 .help_text {
-    background: none repeat scroll 0 0 #DDDDDD;
-    padding: 3px 6px;
+    background: none repeat scroll 0 0 #CCDBED;
     display: none;
+    padding: 6px 10px;
+    vertical-align: baseline;
 }
 
 /* =============================  CONTROL GROUP AND ITEMS  
======================= */
@@ -1568,4 +1657,11 @@
 
 ul.control_groups h3 {
     margin-bottom: 0.5em;
-}
\ No newline at end of file
+}
+
+/* =============================  IMAGE LOADER  ======================= */
+
+img#loading {
+       margin-left: 5px;
+       vertical-align: middle;
+}




reply via email to

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