fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9113] Merge 9093:9112 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9113] Merge 9093:9112 from trunk
Date: Tue, 10 Apr 2012 11:06:42 +0000

Revision: 9113
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9113
Author:   sigurdne
Date:     2012-04-10 11:06:41 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
Merge 9093:9112 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
    
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
    
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
    
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.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_cases_for_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_lists.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/index.php
    branches/Version-1_0-branch/phpgwapi/inc/accounts/class.accounts_.inc.php
    branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.hook_helper.inc.php
    branches/Version-1_0-branch/property/inc/class.menu.inc.php
    branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/registration/inc/class.bopending.inc.php
    branches/Version-1_0-branch/registration/inc/class.boreg.inc.php
    branches/Version-1_0-branch/registration/inc/class.sopending.inc.php
    branches/Version-1_0-branch/registration/inc/class.soreg.inc.php
    branches/Version-1_0-branch/registration/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/registration/inc/class.uipending.inc.php
    branches/Version-1_0-branch/registration/inc/hook_logout.inc.php
    branches/Version-1_0-branch/registration/js/yahoo/pending.index.js
    branches/Version-1_0-branch/registration/main.php
    branches/Version-1_0-branch/registration/setup/default_records.inc.php
    branches/Version-1_0-branch/registration/setup/setup.inc.php
    branches/Version-1_0-branch/registration/setup/tables_current.inc.php
    branches/Version-1_0-branch/registration/setup/tables_update.inc.php
    branches/Version-1_0-branch/registration/templates/base/common.xsl
    branches/Version-1_0-branch/registration/templates/base/pending_users.xsl
    branches/Version-1_0-branch/registration/templates/base/user_edit.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/phpgwapi/templates/base/yui_phpgw_i18n.xsl
    branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php
    branches/Version-1_0-branch/property/js/portico/ajax_invoice.js
    branches/Version-1_0-branch/property/templates/base/common.xsl
    branches/Version-1_0-branch/property/templates/base/invoice2.xsl
    branches/Version-1_0-branch/registration/js/yahoo/common.js

Removed Paths:
-------------
    
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js

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


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092
   + 
/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

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2012-04-10 11:06:41 UTC (rev 9113)
@@ -1388,4 +1388,50 @@
                
                return $activities;
        }
+       
+       function get_connected_activities($org_id)
+       {
+               $activities = array();
+               $sql = "SELECT * FROM activity_activity WHERE 
organization_id={$org_id}";
+
+               $this->db->query($sql, __LINE__, __FILE__);
+               while ($this->db->next_record())
+               {                       
+                       $activity = new activitycalendar_activity((int) 
$this->db->f('id'));
+
+                       
$activity->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                       
$activity->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                       
$activity->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+                       
$activity->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                       
$activity->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                       
$activity->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                       
$activity->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                       
$activity->set_target($this->unmarshal($this->db->f('target'), 'string'));
+                       
$activity->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$activity->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                       
$activity->set_internal_arena($this->unmarshal($this->db->f('internal_arena'), 
'string'));
+                       
$activity->set_time($this->unmarshal($this->db->f('time'), 'string'));
+                       
$activity->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
+                       
$activity->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
+                       
$activity->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+                       
$activity->set_contact_person_2_address($this->unmarshal($this->db->f('contact_person_2_address'),
 'string'));
+                       
$activity->set_contact_person_2_zip($this->unmarshal($this->db->f('contact_person_2_zip'),
 'string'));
+                       
$activity->set_frontend($this->unmarshal($this->db->f('frontend', 'bool')));
+                       
$activity->set_new_org($this->unmarshal($this->db->f('new_org', 'bool')));
+                       
+                       $activities[] = $activity;
+               }
+               
+               return $activities;
+       }
+       
+       function update_organization_connection($activity_id, $organization_id)
+       {
+               $id = intval($activity_id);
+               $org_id = intval($organization_id);
+               
+               $result = $this->db->query("UPDATE activity_activity SET 
organization_id={$org_id} WHERE id={$id}", __LINE__,__FILE__);
+
+               return isset($result);
+       }
 }

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2012-04-10 11:06:41 UTC (rev 9113)
@@ -9,6 +9,11 @@
 {
        protected static $so;
 
+       var $public_functions = array
+       (
+               'fix_duplicates'                => true,
+       );
+       
        /**
         * Get a static reference to the storage object associated with this 
model object
         *
@@ -221,6 +226,117 @@
                return $result;
        }
        
+       function get_duplicates()
+       {
+               $result = array();
+               //$q1= "select bb.id as orgid, bb.name as orgname, 
bb.organization_number as orgno, bb.street as orgstreet, bb.zip_code as zip, 
bb.city, cp.* from bb_organization bb, bb_organization_contact cp where 
cp.organization_id=bb.id and bb.show_in_portal=1 and bb.active=1 order by 
bb.name, bb.id";
+               $q1= "select bb.id as orgid, bb.name as orgname, 
bb.organization_number as orgno, bb.street as orgstreet, bb.zip_code as zip, 
bb.city from bb_organization bb where bb.show_in_portal=1 and bb.active=1 order 
by bb.name, bb.id";
+//             $q1="SELECT name FROM bb_organization WHERE id={$org_id}";
+               $this->db->query($q1, __LINE__, __FILE__);
+               while($this->db->next_record()){
+                       //if($org->get_name() != $this->db->f('orgname')) //new 
organization
+                       //{
+/*                             $org = new activitycalendar_organization();
+                               $org->set_id($this->db->f('orgid'));
+                               $org->set_name($this->db->f('orgname'));
+                               $org->set_address($this->db->f('orgstreet').', 
'.$this->db->f('zip').' '.$this->db->f('city'));
+                               
$org->set_organization_number($this->db->f('orgno'));
+*/
+                               $result[$this->db->f('orgid')] = array(
+                                       'orgid' => $this->db->f('orgid'),
+                                       'orgname' => $this->db->f('orgname'),
+                                       'orgstreet' =>  
$this->db->f('orgstreet'),
+                                       'zip' => $this->db->f('zip'),
+                                       'city' => $this->db->f('city'),
+                                       'orgno' => $this->db->f('orgno')
+                               );
+                       //}
+                       //else if (isset($this->db->f('orgstreet')) && 
$this->db->f('orgstreet') != '')
+                       //{
+                       //      $org->set_address($this->db->f('orgstreet').', 
'.$this->db->f('zip').' '.$this->db->f('city'));
+                       //}
+                       //$result[] = $org;
+               }
+               //_debug_array($result);
+               return $result;
+       }
+       
+       function fix_duplicates()
+       {
+               $so_activity = CreateObject('activitycalendar.soactivity');
+               $orgs1 = $this->get_duplicates();
+               $orgs2 = $this->get_duplicates();
+               $new_orgs = array();
+               $removed_orgs = array();
+               $orgmappings = array();
+               foreach($orgs1 as $org)
+               {
+                       $tmpName = $org['orgname'];
+                       $curr_id = $org['orgid'];
+                       if(!in_array($curr_id, $removed_orgs))
+                       {
+                               foreach($orgs2 as $o2)
+                               {
+                                       $removeId = $o2['orgid'];
+                                       //var_dump($removeId .':'.$curr_id . 
'<br/>'); 
+                                       if($removeId != $curr_id && 
$o2['orgname'] == $tmpName)
+                                       {
+                                               //var_dump($removeId.'-' . 
$o2['orgname'].' skal fjernes <br/>');
+                                               //update previous instance
+                                               $org['orgstreet'] = 
$o2['orgstreet'];
+                                               $org['zip'] = $o2['zip'];
+                                               $org['city'] = $o2['city'];
+                                               $org['removed_org'] = $removeId;
+                                               $removed_orgs[] = $removeId;
+                                               $orgmappings[$curr_id][] = 
$removeId;
+                                               
+                                               //unset($orgs1[$removeId]);
+                                       }
+                               }
+                               $new_orgs[] = $org;
+                       }
+               }
+//             _debug_array($new_orgs);
+//             _debug_array($orgmappings);
+               
+               //loop through activities and update organization-connection
+               foreach($orgmappings as $key => $value)
+               {
+                       foreach($value as $orgmapping)
+                       {
+//                             var_dump($orgmapping.' skal flyttes til 
'.$key.'<br/>');
+                               //get activity connected to current orgid
+                               $activities = 
$so_activity->get_connected_activities($orgmapping);
+                               foreach($activities as $activity)
+                               {
+                                       var_dump($activity->get_title().' 
flyttes fra '.$orgmapping.' til '.$key.'</br>');
+                                       
$so_activity->update_organization_connection($activity->get_id(), $key);
+                               }
+                               var_dump("Oppdaterer organisasjon 
".$orgmapping.', settes til inaktiv.<br/>');
+                               $this->set_organization_inactive($orgmapping);
+                               //get affected stuff from booking
+                               $alloc = 
$this->get_affected_allocations($orgmapping);
+                               //if($alloc)
+                                       var_dump("allocation: ". 
$alloc."</br>");
+                               $res = 
$this->get_affected_reservations($orgmapping);
+                               //if($res)
+                                       var_dump("reservation: ". $res."</br>");
+                               $event = 
$this->get_affected_events($orgmapping);
+                               //if($event)
+                                       var_dump("event: ". $event."</br>");
+                       }
+               }
+               
+               //loop through organizations and update them.
+               foreach($new_orgs as $no)
+               {
+                       //update organization with new information
+                       //_debug_array($no);
+                       var_dump("Oppdaterer organisasjon 
".$no['orgid'].','.$no['orgname'].' med ny adresse.<br/>');
+                       $this->update_organization_with_new_info($no);
+               }
+       }
+       
        function get_organization_name_local($org_id)
        {
                $result = "Ingen";
@@ -663,6 +779,76 @@
                $result = $this->db->query('UPDATE bb_organization SET ' . 
join(',', $values) . " WHERE id=$orgid", __LINE__,__FILE__);
        }
        
+       function update_organization_with_new_info($organization)
+       {
+               $name = $organization['orgname'];
+               $orgid = (int)$organization['orgid'];
+               $street = $organization['orgstreet'];
+               if(!$street)
+               {
+                       $street = '';
+               }
+               $zip = $organization['zip'];
+               if(!$zip)
+               {
+                       $zip = '';
+               }
+               $city = $organization['city'];
+               if(!$city)
+               {
+                       $city = '';
+               } 
+               
+               $values = array(
+                       'street = ' . $this->marshal($street, 'string'),
+                       'zip_code = ' . $this->marshal($zip, 'string'),
+                       'city = ' . $this->marshal($city, 'string')
+               );
+               //var_dump("UPDATE bb_organization SET " . join(',', $values) . 
" WHERE id=$orgid");
+               $result = $this->db->query('UPDATE bb_organization SET ' . 
join(',', $values) . " WHERE id=$orgid", __LINE__,__FILE__);
+       }
+       
+       function set_organization_inactive($org_id)
+       {
+               $orgid = (int)$org_id;
+
+               //var_dump("UPDATE bb_organization SET active=0, 
show_in_portal=0 WHERE id={$orgid}");
+               $result = $this->db->query("UPDATE bb_organization SET 
active=0, show_in_portal=0 WHERE id={$orgid}", __LINE__,__FILE__);
+       }
+       
+       function get_affected_allocations($org_id)
+       {
+               $sql = "select id from bb_allocation where 
organization_id={$org_id}";
+               $this->db->query($q1, __LINE__, __FILE__);
+               while($this->db->next_record()){
+                       $result = $this->db->f('id');
+               }
+               
+               return $result;
+       }
+       
+       function get_affected_reservations($org_id)
+       {
+               $sql = "select id from bb_completed_reservation where 
organization_id={$org_id}";
+               $this->db->query($q1, __LINE__, __FILE__);
+               while($this->db->next_record()){
+                       $result = $this->db->f('id');
+               }
+               
+               return $result;
+       }
+       
+       function get_affected_events($org_id)
+       {
+               $sql = "select id from bb_event where 
customer_organization_id={$org_id}";
+               $this->db->query($q1, __LINE__, __FILE__);
+               while($this->db->next_record()){
+                       $result = $this->db->f('id');
+               }
+               
+               return $result;
+       }
+       
        function update($organization)
        {
                return false;

Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-04-10 11:06:41 UTC (rev 9113)
@@ -233,7 +233,7 @@
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $heading_array = array("Jan", "Feb", "Mar", "Apr", 
"Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des");
-                       
+                       print_r($controls_calendar_array);
                        $data = array
                        (
                                'my_locations'                    => 
$my_locations,
@@ -245,7 +245,7 @@
                                'period'                                  => 
$year,
                                'year'                                    => 
$year
                        );
-                       
+                       print_r( $controls_calendar_array );
                        
self::render_template_xsl('calendar/view_calendar_year', $data);
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');

Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-04-10 11:06:41 UTC (rev 9113)
@@ -99,9 +99,9 @@
                                $new_check_item->set_check_list_id( 
$check_list_id );
                                $new_check_item->set_control_item_id( 
$control_item_id );
                                if($status == 0)
-                                       $new_check_item->set_status( 0 );
+                                       $new_check_item->set_status( 
controller_check_item_case::STATUS_OPEN );
                                else
-                                       $new_check_item->set_status( 1 );
+                                       $new_check_item->set_status( 
controller_check_item_case::STATUS_CLOSED );
                                $new_check_item->set_comment( null );
                                
                                $saved_check_item_id = 
$this->so_check_item->store( $new_check_item );

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
 2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
 2012-04-10 11:06:41 UTC (rev 9113)
@@ -4,7 +4,7 @@
 include_class('controller', 'check_list_status_info', 'inc/helper/');
 include_class('controller', 'check_list_status_manager', 'inc/helper/');
                
-/* This class transforms controls with checklists or controls with aggregated 
values for number of open cases, 
+/* This class transforms controls with checklists or controls with aggregated 
number of open cases, 
 *  and puts these values in a calendar array for each control
 */  
 

Modified: 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
   2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.check_list_status_manager.inc.php
   2012-04-10 11:06:41 UTC (rev 9113)
@@ -45,31 +45,31 @@
        
                        $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
        
-                       if( $this->check_list->get_status() == 0 & 
$this->check_list->get_planned_date() > 0 & $this->check_list->get_deadline() > 
$todays_date_ts)
+                       if( $this->check_list->get_status() == 
controller_check_list::STATUS_OPEN & $this->check_list->get_planned_date() > 0 
& $this->check_list->get_deadline() > $todays_date_ts)
                        {
                                $status = "control_planned";
                        }
-                       else if( $this->check_list->get_status() == 0 & 
$this->check_list->get_planned_date() > 0 & $this->check_list->get_deadline() < 
$todays_date_ts )
+                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_OPEN & $this->check_list->get_planned_date() > 0 
& $this->check_list->get_deadline() < $todays_date_ts )
                        {
                                $status = "control_not_accomplished_with_info";
                        }
-                       else if( $this->check_list->get_status() == 0 & 
$this->check_list->get_deadline() < $todays_date_ts )
+                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_OPEN & $this->check_list->get_deadline() < 
$todays_date_ts )
                        {
                                $status = "control_not_accomplished";
                        }
-                       else if( $this->check_list->get_status() == 1 & 
$this->check_list->get_completed_date() > $this->check_list->get_deadline() & 
$this->check_list->get_num_open_cases() == 0)
+                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CLOSED & $this->check_list->get_completed_date() 
> $this->check_list->get_deadline() & $this->check_list->get_num_open_cases() 
== 0)
                        {
                                $status = 
"control_accomplished_over_time_without_errors";
                        }
-                       else if( $this->check_list->get_status() == 1 & 
$this->check_list->get_completed_date() < $this->check_list->get_deadline() & 
$this->check_list->get_num_open_cases() == 0)
+                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CLOSED & $this->check_list->get_completed_date() 
< $this->check_list->get_deadline() & $this->check_list->get_num_open_cases() 
== 0)
                        {
                                $status = 
"control_accomplished_in_time_without_errors";
                        }
-                       else if( $this->check_list->get_status() == 1 & 
$this->check_list->get_num_open_cases() > 0){
+                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CLOSED & $this->check_list->get_num_open_cases() 
> 0){
                                $status = "control_accomplished_with_errors";
                                
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
                        }
-                       else if( $this->check_list->get_status() == 3 )
+                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CANCELED)
                        {
                                $status = "control_canceled";
                        }

Modified: 
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php  
    2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/inc/helper/class.status_checker.inc.php  
    2012-04-10 11:06:41 UTC (rev 9113)
@@ -6,45 +6,42 @@
        include_class('controller', 'check_item', 'inc/model/');
 
        class status_checker {
-       
-       public function __construct()
-       {
-               $this->so_check_list = CreateObject('controller.socheck_list');
-               $this->so_check_item = CreateObject('controller.socheck_item');
-       }
                
-       public function update_check_list_status( $check_list_id )
-       {
-               $check_list = $this->so_check_list->get_single( $check_list_id 
);
-       
-               $status = null;
-               $control_item_type = null;
-               $messageStatus = null;
-               $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
$control_item_type, $status, $messageStatus, "return_object");
+               public function __construct()
+               {
+                       $this->so_check_list = 
CreateObject('controller.socheck_list');
+                       $this->so_check_item = 
CreateObject('controller.socheck_item');
+               }
+                       
+               public function update_check_list_status( $check_list_id )
+               {
+                       $check_list = $this->so_check_list->get_single( 
$check_list_id );
                
-               $num_open_cases = 0;
-               $num_pending_cases = 0;
-                               
-               foreach($check_items as $check_item){
+                       $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
$control_item_type = null, $status = null, $messageStatus = null, 
"return_object");
                        
-                       foreach($check_item->get_cases_array() as $case){
+                       $num_open_cases = 0;
+                       $num_pending_cases = 0;
+                                       
+                       foreach($check_items as $check_item){
                                
-                               if($case->get_status() == 0){
-                                       $num_open_cases++;
-                               }
-                               
-                               if($case->get_status() == 2){
-                                       $num_pending_cases++;
-                               }
-                       }       
+                               foreach($check_item->get_cases_array() as 
$case){
+                                       
+                                       if($case->get_status() == 
controller_check_item_case::STATUS_OPEN){
+                                               $num_open_cases++;
+                                       }
+                                       
+                                       if($case->get_status() == 
controller_check_item_case::STATUS_PENDING){
+                                               $num_pending_cases++;
+                                       }
+                               }       
+                       }
+                       
+                       $check_list->set_num_open_cases($num_open_cases);
+                       $check_list->set_num_pending_cases($num_pending_cases);
+                       
+                       if($num_open_cases > 0)
+                               
$check_list->set_status(controller_check_list::STATUS_OPEN);
+                       
+                       $this->so_check_list->store($check_list);
                }
-               
-               $check_list->set_num_open_cases($num_open_cases);
-               $check_list->set_num_pending_cases($num_pending_cases);
-               
-               if($num_open_cases > 0)
-                       $check_list->set_status(1);
-               
-               $this->so_check_list->store($check_list);
-       }
 }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php  
    2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php  
    2012-04-10 11:06:41 UTC (rev 9113)
@@ -34,6 +34,10 @@
        {
                public static $so;
 
+               const STATUS_OPEN = 0;
+               const STATUS_CLOSED = 1;
+               const STATUS_PENDING = 2;
+                               
                protected $id;
                protected $check_item_id;
                protected $status;

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2012-04-10 11:06:41 UTC (rev 9113)
@@ -33,11 +33,11 @@
        class controller_check_list extends controller_model
        {
                public static $so;
-               /*
+               
                const STATUS_OPEN = 0;
                const STATUS_CLOSED = 1;
-               const STATUS_PENDING = 2;
-               */
+               const STATUS_CANCELED = 3;
+               
                protected $id;
                protected $control_id;
                protected $status;

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-04-10 11:06:41 UTC (rev 9113)
@@ -295,6 +295,9 @@
                        
        // file: sort_check_list.xsl
        // Saves order of control items for a group
+       /*
+        * ERSTATTET AV FUNKSJONALITET SOM SORTERER GRUPPER OG ITEMS
+        * 
        $(".frm_save_order").submit(function(e){
                e.preventDefault();
                var thisForm = $(this);
@@ -327,7 +330,7 @@
                                }
                        });     
        });
-       
+       */
        $("#frm_save_control_groups").submit(function(e){
                var thisForm = $(this);
                var num_checked = $(this).find("input:checked").length;
@@ -575,8 +578,10 @@
                e.preventDefault();
 
                var thisForm = $(this);
+               var clickRow = $(this).closest("li");
+               var checkItemRow = $(this).closest("li.check_item_case");
                var requestUrl = $(thisForm).attr("action");
-               
+                               
                $.ajax({
                          type: 'POST',
                          url: requestUrl + "&" + $(thisForm).serialize(),
@@ -585,54 +590,46 @@
                                  var jsonObj = jQuery.parseJSON(data);
                 
                                  if(jsonObj.status == "saved"){
-                                         var case_id = "#case_" + 
jsonObj.caseObj.id; 
-                                         var case_descr = 
jsonObj.caseObj.descr;
-                                         
-                                         $(case_id).show();
-                                         
$(case_id).find(".case_descr").text(case_descr);
-                                         
$(thisForm).parents("li.quick_edit").remove();          
+                                       var type = 
$(checkItemRow).find(".control_item_type").text();
+                                       
+                                       if(type == "control_item_type_1"){
+                                               
+                                       }else if(type == "control_item_type_2"){
+                                               var measurement_text = 
$(thisForm).find("input[name='measurement']").val();
+                                               $(clickRow).find(".case_info 
.measurement").text(measurement_text);
+                                       }
+                                       
+                                       // Text from forms textarea
+                                       var desc_text = 
$(thisForm).find("textarea").val();
+                                       // Puts new text into description tag 
in case_info                                                                    
  
+                                       $(clickRow).find(".case_info 
.case_descr").text(desc_text);
+                                                                               
+                                       $(clickRow).find(".case_info").show();
+                                       
$(clickRow).find(".frm_update_case").hide();
                                          }
                                  }
                          }
-               });     
+               });
        });
        
        $("a.quick_edit").live("click", function(e){
                var clickElem = $(this);
                var clickRow = $(this).closest("li");
-               var order_nr = $(clickRow).find("span.order_nr").text();
+                                                                       
+               $(clickRow).find(".case_info").hide();
+               $(clickRow).find(".frm_update_case").show();
+               
+               return false;   
+       });
+       
+       $(".frm_update_case .cancel").live("click", function(e){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
                                
-               var case_info = $(clickRow).find(".case_info");
-               var case_id = $(case_info).find(".case_id").text();
-               var case_descr = $(case_info).find(".case_descr").text();
-               var case_status = $(case_info).find(".case_status").text();
-               var case_measurement = 
$(case_info).find(".case_measurement").text();
-               var case_type = $(case_info).find(".case_type").text();
-               var requestUrl = $(clickElem).attr('href');
                
-               $(clickRow).hide();
+               $(clickRow).find(".case_info").show();
+               $(clickRow).find(".frm_update_case").hide();
                
-               $(clickRow).attr("id", "case_" + case_id);
-               
-               var quickEditRowTagStr = "<li class='quick_edit 
check_item_case'><h4>" + order_nr + ": " + "Hurtigendring</h4><fieldset><form 
class='frm_update_case' action='" + requestUrl + "'>";
-                       
-               if(case_type == "control_item_type_2")
-                       quickEditRowTagStr += "<label>Måleverdi</label><input 
type='text' name='case_measurement'>" + case_measurement + "</input>";
-               
-               if(case_status == 1)
-                       quickEditRowTagStr += "<label>Status</label><select 
name='case_status'><option SELECTED='SELECTED' value='1'>Utført</option><option 
value='2'>Venter på tilbakemelding</option></select>";
-               else if(case_status == 2)
-                       quickEditRowTagStr += "<label>Status</label><select 
name='case_status'><option value='1'>Utført</option><option SELECTED='SELECTED' 
value='2'>Venter på tilbakemelding</option></select>";
-               
-               quickEditRowTagStr += "<label>Beskrivelse</label><textarea 
name='case_descr'>" + case_descr + "</textarea>";
-               
-               
-               quickEditRowTagStr += "<input class='btn_m focus' type='submit' 
value='Oppdater' /><input class='btn_m cancel' type='button' value='Avbryt' />";
-               
-               quickEditRowTagStr += "</fieldset></form></li>";
-               
-               $quickEditRow = $(clickRow).before(quickEditRowTagStr);
-               
                return false;   
        });
        

Deleted: 
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
===================================================================
--- 
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
   2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/js/controller/controller_datatable_test_rubbish.js
   2012-04-10 11:06:41 UTC (rev 9113)
@@ -1,516 +0,0 @@
-
-
-/**
- * Javascript for the controller module.  Holds datasource init functions and 
form helpers.
- *
- * Functions and objects within this file are kept in the YAHOO.controller 
namespace.
- */
-
-       YAHOO.namespace('controller');
-
-       // Holds data source setup funtions
-       YAHOO.controller.setupDatasource = new Array();
-
-       //Holds all data sources
-       YAHOO.controller.datatables = new Array();
-
-       counter = 0;
-       // Adds data source setup funtions
-       function setDataSource(source_url, column_defs, form_id, filter_ids, 
container_id, paginator_id, datatable_id,rel_id, editor_action, 
disable_left_click) {
-               YAHOO.controller.setupDatasource.push(
-                       function() {
-                               this.url = source_url;
-                               this.columns = column_defs;
-                               this.form = form_id;
-                               this.filters = filter_ids;
-                               this.container = container_id;
-                               this.paginator = paginator_id;
-                               this.tid = datatable_id;
-                               this.related_datatable = rel_id;
-                               this.editor_action = editor_action;
-                               if(disable_left_click) {
-                                       this.disable_left_click = true;
-                               } else {
-                                       this.disable_left_click = false;
-                               }
-                       }
-               );
-       }
-       
-       // Reloads all data sources that are necessary based on the selected 
related datatable
-       function reloadDataSources(selected_datatable){
-                               
-               //... hooks into  the regular callback function 
(onDataReturnInitializeTable) call to set empty payload array
-               var loaded =  function  ( sRequest , oResponse , oPayload ) {
-                       var payload = new Array();
-                       this.onDataReturnInitializeTable( sRequest , oResponse 
, payload );
-               }
-               
-               //... refresh the selected data tables
-               
selected_datatable.getDataSource().sendRequest('',{success:loaded, 
scope:selected_datatable});
-               
-               //... traverse all datatables and refresh related (to the 
selected) data tables
-               for(var i=0; i<YAHOO.controller.datatables.length; i++){
-                       var datatable = YAHOO.controller.datatables[i];
-
-                       for(var j=0;j<selected_datatable.related.length;j++){
-                               var curr_related = 
selected_datatable.related[j];
-                       
-                               if(datatable.tid == curr_related){
-                                       
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
-                               }
-                       }
-               }
-       }
-
-       var highlightEditableCell = function(oArgs) {
-               var elCell = oArgs.target;
-               if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
-                       this.highlightCell(elCell);
-               }
-       };
-
-       // Wraps data sources setup logic
-       function dataSourceWrapper(source_properties,pag) {
-
-               this.properties = source_properties;
-               this.paginator = pag;
-
-               //... prepare base url
-               this.url = this.properties.url;
-               if(this.url[length-1] != '&') {
-                       this.url += '&';
-               }
-
-               //... set up a new data source
-               this.source = new YAHOO.util.DataSource(this.url);
-
-               this.source.responseType = YAHOO.util.DataSource.TYPE_JSON;
-               this.source.connXhrMode = "queueRequests";
-
-               this.source.responseSchema = {
-                       resultsList: "ResultSet.Result",
-                       fields: this.properties.columns,
-                       metaFields : {
-                               totalRecords: "ResultSet.totalRecords"
-                       }
-               };
-       
-               //... set up a new data table
-               
-               this.table = new YAHOO.widget.DataTable(
-                       this.properties.container,
-                       this.properties.columns,
-                       this.source,
-                       {
-                               paginator: this.paginator,
-                               dynamicData: true,
-                               MSG_EMPTY: '<?php echo 
lang("DATATABLE_MSG_EMPTY")?>',
-                               MSG_ERROR: '<?php echo 
lang("DATATABLE_MSG_ERROR")?>',
-                               MSG_LOADING: '<?php echo 
lang("DATATABLE_MSG_LOADING")?>'
-                       }
-               );
-       
-               //... set table properties
-               this.table.related = this.properties.related_datatable;
-               this.table.tid = this.properties.tid;
-               this.table.container_id = this.properties.container;
-               this.table.editor_action = this.properties.editor_action;
-
-               //... push the data table on a stack
-               YAHOO.controller.datatables.push(this.table);
-
-               //... ?
-               this.table.handleDataReturnPayload = function(oRequest, 
oResponse, oPayload) {
-                       if(oPayload){
-                               oPayload.totalRecords = 
oResponse.meta.totalRecords;
-                               return oPayload;
-                       }
-               }
-
-               //... create context menu for each record after the table has 
loaded the data
-               this.table.doAfterLoadData = function() {
-                       onContextMenuBeforeShow = function(p_sType, p_aArgs)
-                       {
-                               var oTarget = this.contextEventTarget;
-                               if (this.getRoot() == this)
-                               {
-                                       if(oTarget.tagName != "TD")
-                                       {
-                                               oTarget = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
-                                       }
-                                       oSelectedTR = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
-                                       oSelectedTR.style.backgroundColor  = 
'#AAC1D8' ;
-                                       oSelectedTR.style.color = "black";
-                                       YAHOO.util.Dom.addClass(oSelectedTR, 
prefixSelected);
-                               }
-                       }
-
-                       onContextMenuHide = function(p_sType, p_aArgs)
-                       {
-                               if (this.getRoot() == this && oSelectedTR)
-                               {
-                                       oSelectedTR.style.backgroundColor  = "" 
;
-                                       oSelectedTR.style.color = "";
-                                       YAHOO.util.Dom.removeClass(oSelectedTR, 
prefixSelected);
-                               }
-                       }
-                       
-                       var records = this.getRecordSet();
-                       
-                       var validRecords = 0;
-                       for(var i=0; i<records.getLength(); i++) {
-                               var record = records.getRecord(i);
-                               
-                               if(record == null)
-                               {
-                                       continue;
-                               }
-                               else
-                               {
-                                       validRecords++;
-                               }
-                                       
-                               // use a global counter to create unique names 
(even for the same datatable) for all context menues on the page
-                               var menuName = this.container_id + "_cm_" + 
counter;
-                               counter++;
-
-                               //... add menu items with label and handler 
function for click events
-                               var labels = record.getData().labels;
-                                
-                               //create a context menu that triggers on the 
HTML row element
-                               record.menu = new 
YAHOO.widget.ContextMenu(menuName,{trigger:this.getTrEl(validRecords -1 
),itemdata: labels, lazyload: true});
-
-                               //... subscribe handler for click events
-                               
record.menu.clickEvent.subscribe(onContextMenuClick, this);
-                               record.menu.subscribe("beforeShow", 
onContextMenuBeforeShow);
-                               record.menu.subscribe("hide", 
onContextMenuHide);
-
-                               //... render the menu on the related table row
-                               
record.menu.render(this.getTrEl(validRecords-1));
-                       }
-
-                       
-               }
-
-               //... calback methods for handling ajax calls
-               var ajaxResponseSuccess = function(o){
-                       reloadDataSources(this.args);
-               };
-
-               var ajaxResponseFailure = function(o){
-                       reloadDataSources(this.args);
-               };
-
-               //...create a handler for context menu clicks
-               var onContextMenuClick = function(eventString, args, table) {
-                       //... the argument holds the selected index number in 
the context menu
-                       var task = args[1];
-                       
-                       //... only act on a data table
-                       if(table instanceof YAHOO.widget.DataTable) {
-                               //... retrieve the record based on the selected 
table row
-                               var row = 
table.getTrEl(this.contextEventTarget);
-                               var record = table.getRecord(row);
-                                                                               
                
-                               //... check whether this action should be an 
AJAX call
-                               if( record.getData().ajax[task.index] ) {
-                                                                       
-                                       var alertStatus = false;
-
-                                       // Check if confirm box should be 
displayed before request is executed
-                                       if( record.getData().alert != null )
-                                           alertStatus = 
record.getData().alert[0];
-
-                                       if( alertStatus ){
-                                               // Display confirm box with 
message
-                                               var alertMessage = 
record.getData().alert[1];
-                                               var answer = confirm( 
alertMessage );
-                                               
-                                               // Abort request if user clicks 
the abort button
-                                               if (!answer){
-                                                       return false;
-                                               }
-                                       }
-                               
-                                       var request = 
YAHOO.util.Connect.asyncRequest(
-                                               'GET',
-                                               record.getData().actions[ 
task.index ],
-                                               {
-                                                       success: 
ajaxResponseSuccess,
-                                                       success: 
ajaxResponseFailure,
-                                                       args: table
-                                               });
-                               } else {
-                                       window.location = 
record.getData().actions[task.index];
-                               }
-                       }
-               };
-
-               // Handle mouseover and click events for inline editing
-               this.table.subscribe("cellMouseoverEvent", 
highlightEditableCell);
-               this.table.subscribe("cellMouseoutEvent", 
this.table.onEventUnhighlightCell);
-               this.table.subscribe("cellClickEvent", 
this.table.onEventShowCellEditor);
-
-               this.table.subscribe("editorSaveEvent", function(oArgs) {
-                       var field = oArgs.editor.getColumn().field;
-                       var value = oArgs.newData;
-                       var id = oArgs.editor.getRecord().getData().id;
-                       var action = oArgs.editor.getDataTable().editor_action;
-
-                       // Translate to unix time if the editor is a calendar.
-                       if (oArgs.editor._sType == 'date') {
-                               var selectedDate = 
oArgs.editor.calendar.getSelectedDates()[0];
-                               //alert("selDate1: " + selectedDate);
-                               // Make sure we're at midnight GMT
-                               selectedDate = selectedDate.toString().split(" 
");
-                               //for(var e=0;e<selectedDate.length;e++){
-                               //      alert("element " + e + ": " + 
selectedDate[e]);
-                               //}
-                               if(selectedDate[3] == "00:00:00"){
-                               //      alert("seldate skal byttes!");
-                                       selectedDate = 
selectedDate.slice(0,3).join(" ") + " " + selectedDate[5] + " 00:00:00 GMT"; 
-                               }
-                               else{
-                                       selectedDate = 
selectedDate.slice(0,4).join(" ") + " 00:00:00 GMT";
-                               }
-                               //selectedDate = 
selectedDate.toString().split(" ").slice(0, 4).join(" ") + " 00:00:00 GMT";
-                               //alert("selDate2: " + selectedDate);
-                               var value = Math.round(Date.parse(selectedDate) 
/ 1000);
-                               //alert("selDate3 value: " + value);
-                       }
-
-                       var request = YAHOO.util.Connect.asyncRequest(
-                                       'GET',
-                                       'index.php?menuaction=' + action + 
"&amp;field=" + field + "&amp;value=" + value + "&amp;id=" + id,
-                                       {
-                                               success: ajaxResponseSuccess,
-                                               failure: ajaxResponseFailure,
-                                               args:oArgs.editor.getDataTable()
-                                       }
-                               );
-               });
-
-               // Don't set the row to be left-clickable if the table is 
editable by inline editors.
-               // In that case we use cellClickEvents instead
-               var table_should_be_clickable = true;
-               for (i in this.properties.columns) {
-                       if (this.properties.columns[i].editor) {
-                               table_should_be_clickable = false;
-                       }
-               }
-
-               if (table_should_be_clickable && 
!this.properties.disable_left_click) {
-                       //... create a handler for regular clicks on a table row
-                       this.table.subscribe("rowClickEvent", function(e,obj) {
-                               YAHOO.util.Event.stopEvent(e);
-
-                               //... trigger first action on row click
-                               var row = obj.table.getTrEl(e.target);
-                               if(row) {
-                                       var record = obj.table.getRecord(row);
-
-                                       //... check whether this action should 
be an AJAX call
-                                       if(record.getData().ajax[0]) {
-                                               var request = 
YAHOO.util.Connect.asyncRequest(
-                                                       'GET',
-                                                       //... execute first 
action
-                                                       
record.getData().actions[0],
-                                                       {
-                                                               success: 
ajaxResponseSuccess,
-                                                               failure: 
ajaxResponseFailure,
-                                                               args:obj.table
-                                                       }
-                                               );
-                                       } else {
-                                               //... execute first action
-                                               window.location = 
record.getData().actions[0];
-                                       }
-                               }
-                       },this);
-
-                       //... highlight rows on mouseover.  This too only 
happens if the table is
-                       // not editable.
-                       this.table.subscribe("rowMouseoverEvent", 
this.table.onEventHighlightRow);
-                       this.table.subscribe("rowMouseoutEvent", 
this.table.onEventUnhighlightRow);
-               }
-
-
-               //... create context menues when the table renders
-               this.table.subscribe("renderEvent",this.table.doAfterLoadData);
-
-               //... listen for form submits and filter changes
-               
YAHOO.util.Event.addListener(this.properties.form,'submit',formListener,this,true);
-               YAHOO.util.Event.addListener(this.properties.filters, 
'change',formListener,this,true);
-       }
-
-
-       // Set up data sources when the document has loaded
-       YAHOO.util.Event.addListener(window, "load", function() {
-               var i = 0; 
-               while(YAHOO.controller.setupDatasource.length > 0){
-                       //... create a variable name, assign set up function to 
that variable and instantiate properties
-                       variableName = "YAHOO.controller.datasource" + i;
-                       eval(variableName + " = 
YAHOO.controller.setupDatasource.shift()");
-                       var source_properties = eval("new " + variableName + 
"()");
-/*
-<?php
-       if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] 
> 0)
-       {
-               $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-       }
-       else {
-               $user_rows_per_page = 10;
-       }
-?>
-*/
-                       // ... create a paginator for this datasource
-
-                       var pag = new YAHOO.widget.Paginator({
-                               rowsPerPage: 10,
-                               alwaysVisible: true,
-                               rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
-                               firstPageLinkLabel: "<<asdasd <?php echo 
lang('first') ?>",
-                               previousPageLinkLabel: "< <?php echo 
lang('previous') ?>",
-                               nextPageLinkLabel: "<?php echo lang('next') ?> 
>",
-                               lastPageLinkLabel: "<?php echo lang('last') ?> 
>>",
-                               template                        : 
"{RowsPerPageDropdown}<?php echo lang('elements_pr_page') 
?>.{CurrentPageReport}<br/>  {FirstPageLink} {PreviousPageLink} {PageLinks} 
{NextPageLink} {LastPageLink}",
-                               pageReportTemplate      : "<?php echo 
lang('shows_from') ?> {startRecord} <?php echo lang('to') ?> {endRecord} <?php 
echo lang('of_total') ?> {totalRecords}.",
-                               containers: [source_properties.paginator]
-                       });
-                       
-                       pag.render();
-
-                       //... send data source properties and paginator to 
wrapper function
-                       this.wrapper = new dataSourceWrapper(source_properties, 
pag);
-                       i+=1;
-/*
-                       <?php
-                               $populate = phpgw::get_var('populate_form');
-                               if(isset($populate)){?>
-                                       var qs = 
YAHOO.controller.serializeForm(source_properties.form);
-                                   this.wrapper.source.liveData = 
this.wrapper.url + qs + '&';
-                                   this.wrapper.source.sendRequest('', 
{success: function(sRequest, oResponse, oPayload) {
-                                       
this.wrapper.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.wrapper.paginator);
-                                   }, scope: this});
-                       <?php }
-                       ?>
-*/
-                       // XXX: Create generic column picker for all datasources
-
-                       // Shows dialog, creating one when necessary
-                       var newCols = true;
-                       var showDlg = function(e) {
-                               YAHOO.util.Event.stopEvent(e);
-
-                               if(newCols) {
-                                       // Populate Dialog
-                                       // Using a template to create elements 
for the SimpleDialog
-                                       var allColumns = 
this.wrapper.table.getColumnSet().keys;
-                                       var elPicker = 
YAHOO.util.Dom.get("dt-dlg-picker");
-                                       var elTemplateCol = 
document.createElement("div");
-                                       YAHOO.util.Dom.addClass(elTemplateCol, 
"dt-dlg-pickercol");
-                                       var elTemplateKey = 
elTemplateCol.appendChild(document.createElement("span"));
-                                       YAHOO.util.Dom.addClass(elTemplateKey, 
"dt-dlg-pickerkey");
-                                       var elTemplateBtns = 
elTemplateCol.appendChild(document.createElement("span"));
-                                       YAHOO.util.Dom.addClass(elTemplateBtns, 
"dt-dlg-pickerbtns");
-                                       var onclickObj = {fn:handleButtonClick, 
obj:this, scope:false };
-
-                                       // Create one section in the 
SimpleDialog for each Column
-                                       var elColumn, elKey, elButton, 
oButtonGrp;
-
-                                       for(var 
i=0,l=allColumns.length;i<l;i++) {
-                                               var oColumn = allColumns[i];
-                                               if(oColumn.label != 
'unselectable') { // We haven't marked the column as unselectable for the user
-                                                       // Use the template
-                                                       elColumn = 
elTemplateCol.cloneNode(true);
-
-                                                       // Write the Column key
-                                                       elKey = 
elColumn.firstChild;
-                                                       elKey.innerHTML = 
oColumn.label;
-
-                                                       // Create a ButtonGroup
-                                                       oButtonGrp = new 
YAHOO.widget.ButtonGroup({
-                                                               id: 
"buttongrp"+i,
-                                                               name: 
oColumn.getKey(),
-                                                               container: 
elKey.nextSibling
-                                                       });
-                                                       oButtonGrp.addButtons([
-                                                               { label: "Vis", 
value: "Vis", checked: ((!oColumn.hidden)), onclick: onclickObj},
-                                                               { label: 
"Skjul", value: "Skjul", checked: ((oColumn.hidden)), onclick: onclickObj}
-                                                       ]);
-
-                                                       
elPicker.appendChild(elColumn);
-                                               }
-                                       }
-
-                                       newCols = false;
-                               }
-
-                               myDlg.show();
-                       };
-
-                       var storeColumnsUrl = YAHOO.controller.storeColumnsUrl;
-                       var hideDlg = function(e) {
-                               this.hide();
-                               // After we've hidden the dialog we send a post 
call to store the columns the user has selected
-                               var postData = 'values[save]=1';
-                               var allColumns = 
wrapper.table.getColumnSet().keys;
-                               for(var i=0; i < allColumns.length; i++) {
-                                       if(!allColumns[i].hidden){
-                                               postData += 
'&values[columns][]=' + allColumns[i].getKey();
-                                       }
-                               }
-
-                               YAHOO.util.Connect.asyncRequest('POST', 
storeColumnsUrl, null, postData);
-                       };
-
-                       var handleButtonClick = function(e, oSelf) {
-                               var sKey = this.get("name");
-                               if(this.get("value") === "Skjul") {
-                                       // Hides a Column
-                                       wrapper.table.hideColumn(sKey);
-                               } else {
-                                       // Shows a Column
-                                       wrapper.table.showColumn(sKey);
-                               }
-                       };
-
-                       // Create the SimpleDialog
-                       YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
-                       var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
-                               width: "30em",
-                               visible: false,
-                               modal: false, // modal: true doesn't work for 
some reason - the dialog becomes unclickable
-                               buttons: [
-                                       {text:"Lukk", handler:hideDlg}
-                               ],
-                               fixedcenter: true,
-                               constrainToViewport: true
-                       });
-                       myDlg.render();
-
-                       // Nulls out myDlg to force a new one to be created
-                       wrapper.table.subscribe("columnReorderEvent", 
function(){
-                               newCols = true;
-                               YAHOO.util.Event.purgeElement("dt-dlg-picker", 
true);
-                               YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = 
"";
-                       }, this, true);
-
-                       // Hook up the SimpleDialog to the link
-                       YAHOO.util.Event.addListener("dt-options-link", 
"click", showDlg, this, true);
-               }
-       });
-
-       /*
-        * Listen for events in form. Serialize all form elements. Stop
-        * the original request and send new request.
-        */
-       function formListener(event){
-               YAHOO.util.Event.stopEvent(event);
-               var qs = YAHOO.portico.serializeForm(this.properties.form);
-           this.source.liveData = this.url + qs + '&';
-           this.source.sendRequest('', {success: function(sRequest, oResponse, 
oPayload) {
-               this.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.paginator);
-           }, scope: this});
-       }

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-04-10 
09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-04-10 
11:06:41 UTC (rev 9113)
@@ -291,7 +291,7 @@
 start_date     controller      no      Start dato
 planned_date   controller      no      Planlagt dato
 end_date       controller      no      Slutt dato
-View_locations_for_control     controller      no      Vis knytning mot 
lokasjon
+View_locations_for_control     controller      no      Vis kontroller for 
lokasjon
 Add_locations_for_control      controller      no      Legg til knytning mot 
lokasjon
 View_component_for_control     controller      no      Vis knytning mot utstyr
 Add_component_for_control      controller      no      Legg til knytning mot 
utstyr

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-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-04-10 11:06:41 UTC (rev 9113)
@@ -214,7 +214,18 @@
                                                                        
</xsl:when>
                                                                        
<xsl:when test="status = 'control_not_accomplished'">
                                                                                
<div>
-                                                                               
        <img height="12" src="controller/images/status_icon_red_cross.png" />
+                                                                               
        <a>
+                                                                               
                <xsl:attribute name="href">
+                                                                               
                        
<xsl:text>index.php?menuaction=controller.uicheck_list.add_check_list</xsl:text>
+                                                                               
                        <xsl:text>&amp;date=</xsl:text>
+                                                                               
                        <xsl:value-of select="info/date"/>
+                                                                               
                        <xsl:text>&amp;control_id=</xsl:text>
+                                                                               
                        <xsl:value-of select="info/control_id"/>
+                                                                               
                        <xsl:text>&amp;location_code=</xsl:text>
+                                                                               
                        <xsl:value-of select="$view_location_code"/>
+                                                                               
                </xsl:attribute>
+                                                                               
                <img height="12" 
src="controller/images/status_icon_red_cross.png" />
+                                                                               
        </a>
                                                                                
</div>
                                                                        
</xsl:when>
                                                                        
<xsl:otherwise>

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,25 +2,29 @@
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
        
                <h1>Utførelse av kontroll: <xsl:value-of 
select="control/title"/></h1>
                <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>
                
                <xsl:call-template name="check_list_tab_menu" />
        
+               <!-- =======================  MESSAGE DETAILS  
========================= -->
                <h3 class="box_header">Meldingen gjelder</h3>
-               <div id="case_details">
-                       <h3 class="first">Tittel på kontroll: <xsl:value-of 
select="control/title"/></h3>
+               <div class="box">
+                       <div class="row"><label>Kontroll:</label> <xsl:value-of 
select="control/title"/></div>
+                       <div class="row"><label>Utført dato:</label>
+                               <xsl:choose>
+                                       <xsl:when 
test="check_list/completed_date != 0">
+                                               <xsl:value-of 
select="php:function('date', $date_format, number(check_list/completed_date))"/>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                                Ikke utført
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </div>
+                       <div class="row">
                        <xsl:choose>
-                               <xsl:when test="check_list/completed_date != 0">
-                                       <h3>Kontroll ble utført: <xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/completed_date))"/></h3>
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       <h3>Kontroll ble utført dato: Ikke 
registrert utført</h3>
-                               </xsl:otherwise>
-                       </xsl:choose>
-                       <xsl:choose>
                                <xsl:when test="buildings_array/child::node()">
                                        <select id="building_id" 
name="building_id">
                                                        <option value="0">
@@ -34,17 +38,19 @@
                                                </select>
                                </xsl:when>
                                <xsl:otherwise>
-                                       <h3 class="last">Bygg: <xsl:value-of 
select="building/loc1_name"/></h3> 
+                                       <label>Bygg:</label> <xsl:value-of 
select="building/loc1_name"/>        
                                </xsl:otherwise>
                        </xsl:choose>
+                       </div>
                </div>
                
+               <!-- =======================  MESSAGE DETAILS  
========================= -->
                <h3 class="box_header">Detaljer for meldingen</h3>
-               <fieldset id="case_details">
+               <div class="box">
                        <xsl:choose>
                                <xsl:when 
test="check_items_and_cases/child::node()">
                                        
-                               <form class="frm_save_case" 
action="index.php?menuaction=controller.uicase.register_case_message" 
method="post">
+                               <form id="frmRegCaseMessage" 
action="index.php?menuaction=controller.uicase.register_case_message" 
method="post">
                                        <input>
                                      <xsl:attribute 
name="name">check_list_id</xsl:attribute>
                                      <xsl:attribute 
name="type">hidden</xsl:attribute>
@@ -52,13 +58,14 @@
                                        <xsl:value-of select="check_list/id"/>
                                      </xsl:attribute>
                                    </input>
-                                   <div>
-                                               <label>Tittel på melding</label>
+                                   <!-- === TITLE === -->
+                                   <div class="row">
+                                               <label>Tittel på 
melding:</label>
                                                <input name="message_title" 
type="text" />
                                        </div>
-                                       
-                                       <div>
-                                               <label>Kategori</label>
+                                       <!-- === CATEGORY === -->
+                                       <div class="row">
+                                               <label>Kategori:</label>
                                                 <select name="message_cat_id">
                                                        <option value="0">Velg 
kategori</option>
                                                        <xsl:for-each 
select="categories/cat_list">
@@ -69,18 +76,18 @@
                                                        </xsl:for-each>
                                                </select>
                                        </div>
-                                       
-                                       <div>
-                                               <label>Last opp filvedlegg til 
meldingen:</label>
+                                       <!-- === UPLOAD FILE === -->
+                                       <div class="row">
+                                               <label>Filvedlegg:</label>
                                                <input type="file" id="file" 
name="file" />
                                        </div>
                        
-                                       <h3 class="check_item_details">Velg 
sjekkpunkter som skal være med i melding</h3>                                   
    
-                                       <ul class="check_items">
+                                       <h3>Velg sjekkpunkter som skal være med 
i melding</h3>                                  
+                                       <ul class="cases">
                                                <xsl:for-each 
select="check_items_and_cases">
                                                        <xsl:choose>
                                                                <xsl:when 
test="cases_array/child::node()">
-                                                                       <li 
class="check_item_case">
+                                                                       <li>
                                                                                
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
                                                                                
<ul>            
                                                                                
        <xsl:for-each select="cases_array">
@@ -96,7 +103,7 @@
                                        
                                        <div class="form-buttons">
                                                <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                               <input class="btn focus" 
type="submit" name="save_control" value="Registrer melding" 
title="{$lang_save}" />
+                                               <input class="btn focus" 
type="submit" name="save_control" value="Send melding" title="{$lang_save}" />
                                        </div>
                                </form>                 
                                </xsl:when>
@@ -104,7 +111,7 @@
                                        Ingen registrerte saker
                                </xsl:otherwise>
                        </xsl:choose>
-               </fieldset>
+               </div>
                        
 </div>
 </xsl:template>

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
        
                <h1>Melding registrert</h1>
                

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-04-10 11:06:41 UTC (rev 9113)
@@ -23,11 +23,11 @@
 </script>
                
 
-<div id="main_content">
+<div id="main_content" class="medium">
        
        <h1>Registrere sjekkliste for <xsl:value-of 
select="location_array/loc1_name"/></h1>
 
-       <div id="edit_check_list_menu" class="hor_menu">
+       <div id="check_list_menu">
                <a href="#" class="active">
                        Vis detaljer for sjekkliste
                </a>
@@ -68,7 +68,7 @@
                                </div>
                                <div>
                                        <label>Fristdato</label>
-                                       <input>
+                                       <input class="date">
                                      <xsl:attribute 
name="id">deadline_date</xsl:attribute>
                                      <xsl:attribute 
name="name">deadline_date</xsl:attribute>
                                      <xsl:attribute 
name="type">text</xsl:attribute>
@@ -77,7 +77,7 @@
                            </div>
                                <div>
                                        <label>Planlagt dato</label>
-                                       <input>
+                                       <input class="date">
                                      <xsl:attribute 
name="id">planned_date</xsl:attribute>
                                      <xsl:attribute 
name="name">planned_date</xsl:attribute>
                                      <xsl:attribute 
name="type">text</xsl:attribute>
@@ -86,7 +86,7 @@
                            </div>
                            <div>
                                        <label>Utført dato</label>
-                                       <input>
+                                       <input class="date">
                                      <xsl:attribute 
name="id">completed_date</xsl:attribute>
                                      <xsl:attribute 
name="name">completed_date</xsl:attribute>
                                      <xsl:attribute 
name="type">text</xsl:attribute>
@@ -95,7 +95,9 @@
                                      </xsl:if>
                                    </input>
                            </div>
-                               <div><label>Utstyr</label><input 
name="equipment_id" /></div>
+                               <!-- 
+                                       div><label>Utstyr</label><input 
name="equipment_id" /></div>
+                                -->
                                <div>
                                        <label class="comment">Kommentar</label>
                                        <textarea>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
    2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
    2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 
 <xsl:param name="active_tab" />
 
-<div id="edit_check_list_menu" class="hor_menu">
+<div id="check_list_menu">
                <a>
                        <xsl:if test="$active_tab = 'view_details'">
                                <xsl:attribute 
name="class">active</xsl:attribute>
@@ -36,7 +36,7 @@
                        </xsl:attribute>
                        Vis info om kontroll
                </a>
-               <div>
+               <div class="right_btns">
                        <a class="btn focus first">
                                <xsl:attribute name="href">
                                        
<xsl:text>index.php?menuaction=controller.uicheck_list.register_case</xsl:text>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
        2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
        2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
                
        <script>
                $(function() {
@@ -40,14 +40,14 @@
        
                <h3 class="box_header">Sjekklistedetaljer</h3>
                <fieldset class="check_list_details">
-                       <form id="frm_update_check_list" 
action="index.php?menuaction=controller.uicheck_list.update_check_list" 
method="post">
-                               
+                       <form id="frm_update_check_list" 
action="index.php?menuaction=controller.uicheck_list.update_check_list" 
method="post"> 
                        <xsl:variable name="check_list_id"><xsl:value-of 
select="check_list/id"/></xsl:variable>
                        <input id="check_list_id" type="hidden" 
name="check_list_id" value="{$check_list_id}" />
-                               
+                       
+                       <div class="col_1">
                        <div>
                                <label>ID</label>
-                               <input>
+                               <input class="id" disabled="disabled">
                             <xsl:attribute 
name="name">check_list_id</xsl:attribute>
                             <xsl:attribute name="value"><xsl:value-of 
select="check_list/id"/></xsl:attribute>
                            </input>
@@ -69,16 +69,8 @@
                                </select>
                        </div>
                        <div>
-                               <label>Antall åpne saker</label>
-                            <xsl:value-of select="check_list/num_open_cases"/>
-                   </div>
-                   <div>
-                               <label>Antall ventende saker</label>
-                            <xsl:value-of 
select="check_list/num_pending_cases"/>
-                   </div>
-                       <div>
                                <label>Skal utføres innen</label>
-                               <input>
+                               <input class="date">
                              <xsl:attribute 
name="id">deadline_date</xsl:attribute>
                              <xsl:attribute 
name="name">deadline_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
@@ -89,7 +81,7 @@
                        </div>
                        <div>
                                <label>Planlagt dato</label>
-                               <input>
+                               <input class="date">
                              <xsl:attribute 
name="id">planned_date</xsl:attribute>
                              <xsl:attribute 
name="name">planned_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
@@ -100,7 +92,7 @@
                    </div>
                    <div>
                                <label>Utført dato</label>
-                               <input>
+                               <input class="date">
                              <xsl:attribute 
name="id">completed_date</xsl:attribute>
                              <xsl:attribute 
name="name">completed_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
@@ -109,6 +101,18 @@
                              </xsl:if>
                            </input>
                    </div>
+                   </div>
+                   <div class="col_2">
+                           <div>
+                                       <label>Antall åpne saker</label>
+                                    <xsl:value-of 
select="check_list/num_open_cases"/>
+                           </div>
+                           <div>
+                                       <label>Antall ventende saker</label>
+                                    <xsl:value-of 
select="check_list/num_pending_cases"/>
+                           </div>
+                   </div>
+                   
                        <div>
                                <label class="comment">Kommentar</label>
                                <textarea>

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-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
 
-<div id="main_content">
+<div id="main_content" class="medium">
        
        <h1>Utførelse av kontroll: <xsl:value-of select="control/title"/></h1>
        <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
      2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
      2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
                
        <script>
        

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_list.xsl
        2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_list.xsl
        2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,18 +2,19 @@
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
                
          <!-- ===========================  SHOWS CONTROL ITEMS RECEIPT   
=============================== -->
                
                <h1>Sjekkliste</h1>
                <fieldset class="control_details">
-                       <label>Tittel</label><xsl:value-of 
select="check_list/status"/><br/>
-                       <label>Kommentar</label><xsl:value-of 
select="check_list/comment"/><br/>
-                       <label>Skal utføres innen</label>
-                       <xsl:if test="check_list/deadline != ''">
-                               <xsl:value-of select="php:function('date', 
$date_format, number(check_list/deadline))"/><br/>
-                       </xsl:if>
+                       <div class="row"><label>Tittel</label><xsl:value-of 
select="check_list/status"/></div>
+                       <div class="row"><label>Kommentar</label><xsl:value-of 
select="check_list/comment"/></div>
+                       <div class="row"><label>Skal utføres innen</label>
+                               <xsl:if test="check_list/deadline != ''">
+                                       <xsl:value-of 
select="php:function('date', $date_format, number(check_list/deadline))"/><br/>
+                               </xsl:if>
+                       </div>
                </fieldset>
                                
                <h2>Sjekkpunkter</h2>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_lists.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_lists.xsl
       2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_check_lists.xsl
       2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 <xsl:template match="data" name="view_check_lists" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
                
          <!-- ===========================  SHOWS CONTROL ITEMS RECEIPT   
=============================== -->
                <xsl:variable name="control_id"><xsl:value-of 
select="control_id"/></xsl:variable>      

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
      2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
      2012-04-10 11:06:41 UTC (rev 9113)
@@ -36,7 +36,7 @@
                                                                                
                        </div>
                                                                                
                </xsl:when>
                                                                                
                <xsl:otherwise>
-                                                                               
                        <div style="float:right;"><span style="color:red">Ingen 
melding registrert</span></div>
+                                                                               
                        <div class="message closed">Ingen melding</div>
                                                                                
                </xsl:otherwise>
                                                                                
        </xsl:choose>
                                                                                
</li>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
   2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
   2012-04-10 11:06:41 UTC (rev 9113)
@@ -4,7 +4,7 @@
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
        
        <fieldset id="control_details">
-               <div>
+               <div class="row">
                        <label>Kontrollområde</label>
                        <xsl:choose>
                        <xsl:when test="editable">
@@ -17,11 +17,11 @@
                        </xsl:otherwise>
                </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label>Prosedyre</label>
                        <xsl:value-of select="control/procedure_name" />
                </div>
-               <div>
+               <div class="row">
                        <label for="title">Tittel</label>
                        <xsl:choose>
                                <xsl:when test="editable">
@@ -32,7 +32,7 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label for="start_date">Startdato</label>
                        <xsl:choose>
                      <xsl:when test="not(control/start_date = '0') or 
not(control/start_date = '')">
@@ -43,7 +43,7 @@
                      </xsl:otherwise>
              </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label for="end_date">Sluttdato</label>
                        <xsl:choose>
                      <xsl:when test="not(control/end_date = '0') or 
not(control/end_date = '')">
@@ -54,7 +54,7 @@
                      </xsl:otherwise>
              </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label>Frekvenstype</label>
                        <xsl:choose>
                      <xsl:when test="control/repeat_type = 0">Dag</xsl:when>
@@ -63,7 +63,7 @@
                      <xsl:when test="control/repeat_type = 3">År</xsl:when>
              </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label>Frekvens</label>
                        <xsl:choose>
                                <xsl:when test="editable">
@@ -74,7 +74,7 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label>Rolle</label>
                        <xsl:choose>
                                <xsl:when test="editable">
@@ -91,7 +91,7 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </div>
-               <div>
+               <div class="row">
                        <label for="description">Beskrivelse</label>
                        <xsl:choose>
                                <xsl:when test="editable">

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
      2012-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
      2012-04-10 11:06:41 UTC (rev 9113)
@@ -2,7 +2,7 @@
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
 <xsl:variable name="date_format">d/m-Y</xsl:variable>
 
-<div id="main_content">
+<div id="main_content" class="medium">
                
        <script>
                $(document).ready(function() {

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-04-10 09:14:04 UTC (rev 9112)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-04-10 11:06:41 UTC (rev 9113)
@@ -19,76 +19,142 @@
                                                <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><span class="order_nr"><xsl:number /></span>. <xsl:value-of select="descr"/>
-                                                                               
        Status: 
-                                                                               
        <xsl:choose>
-                                                                               
                <xsl:when test="status = 1">Utført</xsl:when>
-                                                                               
                <xsl:when test="status = 2">Venter på tilbakemelding</xsl:when>
-                                                                               
        </xsl:choose>
-                                                                               
        <div class="quick_menu">
-                                                                               
                <a class="quick_edit">
-                                                                               
                        <xsl:attribute name="href">
-                                                                               
                                
<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>
-                                                                               
                        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>
+                                                                               
+                                                                               
<!--  ==================== COL1: ORDERNR ===================== -->
+                                                                               
<div class="col_1">
+                                                                               
        <span class="order_nr"><xsl:number /></span>.
+                                                                               
</div>
+                                                                               
+                                                                               
<!--  ==================== COL2: CASE CONTENT ===================== -->
+                                                                               
<div class="col_2">
+                                                                               
<!--  === FORM: UPDATE CASE === -->
+                                                                               
<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="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>
+                                                                               
+                                                                               
<!--  === CASE INFO === -->
+                                                                               
<div class="case_info">
+                                                                               
        <!-- STATUS -->
+                                                                               
        <div class="row first">
+                                                                               
                <label>Status:</label> 
                                                                                
                <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: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>
-                                                                               
                <xsl:choose>
-                                                                               
                        <xsl:when test="location_item_id > 0">
-                                                                               
                                <a target="_blank">
+                                                                               
        </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" 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=property.uitts.view</xsl:text>
-                                                                               
                                                        
<xsl:text>&amp;id=</xsl:text>
-                                                                               
                                                        <xsl:value-of 
select="location_item_id"/>
+                                                                               
                                                        
<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>
-                                                                               
                                                Vis melding
+                                                                               
                                                slett
                                                                                
                                        </a>
-                                                                               
                        </xsl:when>
-                                                                               
                        <xsl:otherwise>
-                                                                               
                                <span class="message">Ingen melding</span>
-                                                                               
                        </xsl:otherwise>
-                                                                               
                </xsl:choose>
+                                                                               
                                </xsl:when>
+                                                                               
                        </xsl:choose>
+                                                                               
                </div>
                                                                                
        </div>
-                                                                               
        <div style="display:none;" class="case_info">
-                                                                               
                <div class="case_id"><xsl:value-of select="id"/></div>
-                                                                               
                <div class="case_descr"><xsl:value-of select="descr"/></div>
-                                                                               
                <div class="case_status"><xsl:value-of select="status"/></div>
-                                                                               
                <div class="case_measurement"><xsl:value-of 
select="measurement"/></div>
-                                                                               
                <div class="case_type"><xsl:value-of 
select="control_item/type"/></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>
@@ -116,17 +182,31 @@
                                                                <ul>
                                                                        
<xsl:for-each select="cases_array">
                                                                                
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                               
<li><span class="order_nr"><xsl:number /></span>. <span 
class="case_descr"><xsl:value-of select="descr"/></span>
-                                                                               
        <div class="quick_menu">
-                                                                               
                <a class="quick_edit">
-                                                                               
                        <xsl:attribute name="href">
-                                                                               
                                
<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>
+                                                                               
<li>
+                                                                               
<div style="display: inline-block;padding: 2em 2%;vertical-align: top;">
+                                                                               
        <span class="order_nr"><xsl:number /></span>.
+                                                                               
</div>
+                                                                               
<div style="border-left: 1px solid #DDDDDD;border-right: 1px solid 
#DDDDDD;display: inline-block;padding: 1em 2%;width: 73%;">
+                                                                               
+                                                                               
<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 first" href="">
                                                                                
                        endre
                                                                                
                </a>
                                                                                
                <a class="close_case">
@@ -155,6 +235,10 @@
                                                                                
                                </a>
                                                                                
                        </xsl:when>
                                                                                
                </xsl:choose>
+                                                                               
        </div>
+                                                                               
        </div>
+                                                                               
        </div>
+                                                                               
        <div style="display: inline-block;padding: 3%;vertical-align: top;">
                                                                                
                <xsl:choose>
                                                                                
                        <xsl:when test="location_item_id > 0">
                                                                                
                                <a target="_blank">
@@ -171,12 +255,6 @@
                                                                                
                        </xsl:otherwise>
                                                                                
                </xsl:choose>
                                                                                
        </div>
-                                                                               
        <div style="display:none;" class="case_info">
-                                                                               
                <div class="case_id"><xsl:value-of select="id"/></div>
-                                                                               
                <div class="case_descr"><xsl:value-of select="descr"/></div>
-                                                                               
                <div class="case_status"><xsl:value-of select="status"/></div>
-                                                                               
                <div class="case_type"><xsl:value-of 
select="control_item/type"/></div>
-                                                                               
        </div>
                                                                                
</li>
                                                                        
</xsl:for-each>
                                                                </ul>
@@ -190,14 +268,6 @@
                                <p>Ingen åpne saker</p>
                        </xsl:otherwise>
                </xsl:choose>
-               <a style="font-size: 11px;margin-top: 20px;padding: 3px 20px;" 
class="btn focus">
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.register_case</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                       </xsl:attribute>
-                       Registrer melding
-               </a>
        </div>
 </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-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-04-10 11:06:41 UTC (rev 9113)
@@ -42,12 +42,20 @@
 }
 
 label {
-       margin-left: 0.3em;
-       margin-right: 0,3em;
-       font-style: normal;
        font-size: 13px;
+    font-weight: bold;
+    margin-right: 5px;
+    display: inline-block;
 }
 
+a{
+       cursor: pointer;        
+}
+
+.row{
+       padding: 0.3em 0;
+}
+
 #content {
     margin: 2em 1em;
 }
@@ -393,20 +401,21 @@
 }
 */
 /* Set up common form styles.  TODO: needs refinement. */
-legend, label, input, select {
+input{
     margin: 0 13px 0 0;
-    padding: 2px;
+    padding: 3px 6px;
 }
-       
-label {
-       line-height:1.5em;
+select{
+       padding: 3px 1px 3px 4px;
 }
        
 fieldset {
        border-bottom:0px solid #ccc;
        padding:5px 0px 5px 10px;
 }
-
+textarea{
+       padding: 4px;   
+}
 h1 em {
        font-style:italic;
 }
@@ -564,10 +573,6 @@
     padding: 3px;
 }
 
-ul.expand_list input {
-    margin: 0 8px 0 5px;
-}
-
 ul.expand_list h4 span {
     padding-left: 5px;
     vertical-align: middle;
@@ -662,6 +667,64 @@
     width: 100px;
 }
 
+/* =======================================  GENERAL CLASSES  
========================================= */
+.content_wrp {
+       background: none repeat scroll 0 0 #EDF5FF;
+    border: 1px solid #eee;
+    margin-bottom: 20px;
+    padding: 15px;
+    width: 800px;
+}
+.box {
+    background: none repeat scroll 0 0 #EDF5FF;
+    border: 1px solid #eee;
+    margin-bottom: 20px;
+    padding: 15px;
+}
+.box_header {
+    background: none repeat scroll 0 0 #DAE8F7;
+    border-color: #C9DBEE;
+    border-style: solid;
+    border-width: 1px 1px 0;
+    color: #333333;
+    font-size: 13px;
+    font-weight: bolder;
+    margin: 0;
+    padding: 5px 0 5px 15px;
+    text-align: left;
+}
+.btn, .btn_m, .btn_sm {
+    background: none repeat scroll 0 0 #4F9AEA;
+    border: 1px solid #658CB5;
+    color: #FFFFFF;
+    cursor: pointer;
+    display: inline-block;
+    margin-right: 5px;
+    padding: 5px 10px;
+    text-decoration: none;
+}
+.btn_m{
+    padding: 2px 10px;
+    font-size: 12px;
+}
+.btn_sm{
+    font-size: 11px;
+    padding: 1px 4px;
+}
+.btn.cancel, .btn_m.cancel {
+    background: none repeat scroll 0 0 #EEEEEE;
+    border: 1px solid #CCCCCC;
+    color: #333333;
+}
+.btn.focus, .btn_m.focus {
+    background: none repeat scroll 0 0 #F57056;
+    border-color: #EE836F -moz-use-text-color #CB563F;
+    border-style: solid none;
+    border-width: 1px 0;
+    color: #FFFFFF;
+    margin-top: 1px;
+}
+
 /* =======================================  MAIN CONTENT  
========================================= */
 
 #main_content {
@@ -681,16 +744,24 @@
        margin-top:0;
 }
 
+/* =======================================  CHECK LIST DETAILS 
========================================= */
+
 #main_content fieldset.check_list_details {
     background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #A3A3A3;
+    border: 1px solid #DBE5EF;
     padding: 15px;
 }
-#main_content fieldset.check_item_details{
-       background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #243356;
-    padding: 15px;
+
+input.id {
+    background: none repeat scroll 0 0 #FFFFFF;
+    border: 1px solid #DDDDDD;
+    text-align: right;
+    width: 50px;
 }
+input.date {
+    width: 65px;
+    text-align: right;
+}
 
 /* =======================================  CHECK LIST  
========================================= */
 
@@ -782,11 +853,12 @@
 h3.check_item_details{
        margin-bottom:0;        
 }
-.check_item textarea{
-       width:400px;
-       height:100px;   
-}
-.check_item label{
+.check_item textarea {
+    display: block;
+    height: 100px;
+    margin-top: 6px;
+    width: 63%;
+}.check_item label{
        width:150px;    
 }
 
@@ -918,6 +990,22 @@
     padding: 40px 20px;        
 }
 
+/* ======================  CALENDAR COLOR MAP ========================== */
+
+ul#icon_color_map {
+    border: 1px solid #DDDDDD;
+    padding: 5px;
+    margin-top: 40px;
+}
+ul#icon_color_map li {
+    font-size: 12px;
+    padding: 3px 10px;
+}
+ul#icon_color_map span{
+       margin-left: 10px;
+}
+
+
 /* ======================  CALENDAR  DATES ========================== */
 
 #calendar_dates{
@@ -1013,10 +1101,6 @@
        width:120px;
 }
 
-textarea{
-       padding: 4px;   
-}
-
 /*==================================  EXPAND MENU  
======================================== */
 
 .expand_menu div.focus{
@@ -1084,60 +1168,78 @@
        margin:10px;
        font-size: 13px;
 }
-.tab_menu {
-    overflow: hidden;
+
+.tab_menu a{
+       background: none repeat scroll 0 0 #CAE3FB;
+    border: 1px solid #D0D9F1;
+    display: inline-block;
+    font-weight: bold;
+    margin-right: 3px;
+    padding: 7px 0;
+    text-align: center;
+    text-decoration: none;
+    width: 150px;
+    color: #333;
 }
-.tab_menu a, .hor_menu a {
+.tab_menu a.active {
     background: none repeat scroll 0 0 #FAFAFA;
-    border-left: 1px solid #A3A3A3;
-    border-right: 1px solid #A3A3A3;
-    border-top: 1px solid #A3A3A3;
+    border: 1px solid #EEEEEE;
     color: #000000;
+    font-weight: bold;
+}
+.tab_menu a, .tab_menu a.active{
+       border-bottom: 0;       
+}
+
+/* ======================== CHECK LIST MENU ========================== */
+#check_list_menu {
+    margin: 0 0 20px;
+    overflow: hidden;
+}
+#check_list_menu a {
+    background: none repeat scroll 0 0 #CAE3FB;
+    border: 1px solid #D0D9F1;
+    color: #333333;
     cursor: pointer;
-    display: block;
-    float: left;
-    font-size: 12px;
-    font-weight: normal;
+    display: inline-block;
+    font-weight: bold;
     margin-right: 3px;
-    padding: 7px 0;
+    padding: 17px 0;
     text-align: center;
     text-decoration: none;
-    width: 150px;
+    width: 185px;
 }
-.hor_menu a {
-       border:1px solid #d0d9f1;
-       background: #ecf1ff;
+#check_list_menu div.right_btns {
+    float: right;
 }
-.tab_menu a.active, .hor_menu a.active {
-       background: #2647A0;
-       border-left: 1px solid #173073;
-       border-right: 1px solid #173073;
-       border-top: 1px solid #173073;
-       color: #FFF;
+#check_list_menu div.right_btns a{
+    display: block;
+    padding: 4px 0;
+    color:#fff;
+    background: none repeat scroll 0 0 #F57056;
+    border-color: #EE836F -moz-use-text-color #CB563F;
+    border-style: solid none;
+    border-width: 1px 0;
+    color: #FFFFFF;
 }
-.hor_menu a.active {
-       border-bottom: 1px solid #173073;
-}
+
+/* ======================== TAB ITEM ========================== */
+
 .tab_item {
-    background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #A3A3A3;
-    margin: 0 318px 0 0;
+    background: none repeat scroll 0 0 #F7FAFF;
+    border: 1px solid #DAE2EE;
     padding: 15px;
-    width: 800px;
 }
-.tab_item h2{
-       margin:0 0 10px;
-       font-size: 17px;        
+.tab_item h2 {
+    background: none repeat scroll 0 0 #E7EFF8;
+    font-size: 14px;
+    margin: 0 0 10px;
+    padding: 3px 6px;
 }
 .tab_item h2.last{
        margin:20px 0 10px;     
 }
-.tab_item.active {
-       display:block;  
-}
-fieldset.check_list_details{
-       width: 800px;   
-}
+
 #main_content fieldset.location_details{
        background: none repeat scroll 0 0 #EDF5FF;
     border: 1px solid #CCCCCC;
@@ -1148,18 +1250,7 @@
 fieldset.location_details div{
        margin:10px 0;
 }
-ul#icon_color_map {
-    border: 1px solid #DDDDDD;
-    padding: 5px;
-    margin-top: 40px;
-}
-ul#icon_color_map li {
-    font-size: 12px;
-    padding: 3px 10px;
-}
-ul#icon_color_map span{
-       margin-left: 10px;
-}
+
 #create_message_dialog{
        display:none;
        position:absolute;
@@ -1173,82 +1264,23 @@
     z-index: 1;
 }
 
-/* ======================  CASE DETAILS ========================== */
+/* ======================  CHECK LIST ========================== */
 
-#main_content #case_details {
-    background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #DDDDDD;
-    margin-bottom: 20px;
-    padding: 15px;
-    width: 800px;
+#main_content.medium {
+    overflow: hidden;
+    padding: 20px;
+    width: 900px;
 }
-#case_details label{
-       display: inline-block;
-       width: 130px;
-       font-weight: normal;
-       font-size: 15px;        
+.col_1, .col_2{
+       display:inline-block;
+       vertical-align: top;    
 }
-#case_details h3 {
-    font-size: 15px;
-    font-weight: normal;
-    margin: 10px 0;
+.col_2{
+       padding-left: 17%;
 }
-#case_details h3.first {
-    margin-top:0;
-}
-#case_details h3.last {
-    margin-bottom:0;
-}
-.btn, .btn_m, .btn_sm{
-       background: none repeat scroll 0 0 #2647A0;
-    color: #FFFFFF;
-    display: inline-block;
-    margin-right: 5px;
-    padding: 5px 10px;
-    text-decoration: none;
-    border: 1px solid #173073;
-    cursor: pointer;
-}
-.btn_m{
-    padding: 2px 10px;
-    font-size: 12px;
-}
-.btn_sm{
-    font-size: 11px;
-    padding: 1px 4px;
-}
-.btn.cancel{
-       background: none repeat scroll 0 0 #DDDDDD;
-    border: 1px solid #AAAAAA;
-    color: #333333;
-}
-.btn.focus, .btn_m.focus{
-       background: none repeat scroll 0 0 #DD624B;
-    border-bottom: 1px solid #CB563F;
-    border-top: 1px solid #EE836F;
-    border-left:0;
-    border-right:0;
-    box-shadow: 0 1px 0 #A9422E, 0 -1px 0 #A9422E;
-    color: #FFFFFF;
-    margin-top: 1px;   
-}
 
-#edit_check_list_menu div{
-       float:left;
-       margin-left: 75px;
-}
+/* ======================  CASE DETAILS ========================== */
 
-#edit_check_list_menu a.focus {
-    float: none;
-    font-size: 11px;
-    margin-top: 3px;
-    padding: 3px 0;
-}
-
-#edit_check_list_menu a.focus.first{
-    margin-top: 0;
-}
-
 #frm_update_check_list input[type="submit"]{
        width: 140px;   
 }
@@ -1262,45 +1294,10 @@
     margin: 2px 0;  
     display:block;
 }
-
-#view_cases {
-    float: left;
-    margin: 20px 0 0 0;
-}
 #register_errors_content {
     float: right;
     margin-top: 20px;   
 }
-#edit_check_list_menu a {
-    float: left;
-    padding: 14px 0;
-    text-align: center;
-    width: 185px;
-}
-#edit_check_list_menu {
-    margin: 0 0 20px;
-    overflow: hidden;
-}
-.content_wrp {
-       background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #DDDDDD;
-    margin-bottom: 20px;
-    padding: 15px;
-    width: 800px;
-}
-.box_header {
-    background: none repeat scroll 0 0 #2647A0;
-    border-left: 1px solid #173073;
-    border-right: 1px solid #173073;
-    border-top: 1px solid #173073;
-    color: #FFFFFF;
-    font-size: 13px;
-    font-weight: normal;
-    margin: 0;
-    padding: 3px 0 3px 15px;
-    text-align: left;
-    width: 815px;
-}
 
 /* ======================== VIEW CASES ============================= */
 
@@ -1313,37 +1310,72 @@
 li.check_item_case ul li {
     background: none repeat scroll 0 0 #E7EFF8;
     border: 1px solid #DDDDDD;
-    margin: 10px 0 0;
-    padding: 5px;
+    margin: 10px 0 0 20px;
 }
 li.check_item_case ul li.quick_edit {
     padding: 0;
 }
-
 li.check_item_case .quick_edit h4 {
-    background: none repeat scroll 0 0 #CCCCCC;
     color: #000000;
     margin: 0;
     padding: 2px 10px;
 }
 
+li.check_item_case .col_1 {
+       display: inline-block;
+       padding: 2em 2%;
+       vertical-align: top;
+}
+li.check_item_case .col_2 {
+       border-left: 1px solid #DDDDDD;
+       border-right: 1px solid #DDDDDD;
+       display: inline-block;
+       padding: 1em 2%;
+       width: 73%;
+}
+li.check_item_case .col_3 {
+       display: inline-block;
+       padding: 3%;
+       vertical-align: top;
+}
 #main_content .quick_edit fieldset {
     padding: 5px;
 }
+
+/* ======================== FORM UPDATE CASE ============================= */
+
 .frm_update_case label {
        display: block; 
 }
 .frm_update_case textarea {
-       width: 500px;
-       display: block;
+    display: block;
+    width: 98%;
 }
-.quick_edit hr {
-       color:#fafafa;
-}
 .frm_update_case input[type="submit"], .frm_update_case input[type="button"] {
     float: left;
     margin-top: 10px;
 }
+.frm_update_case input[type="text"]{
+       width: 170px;  
+}
+.frm_update_case select {
+    width: 184px;
+}
+.frm_update_case label {
+       width: 70px;
+       display:inline-block;
+       font-weight:bold;
+       margin-right: 5px;   
+}
+
+/* ======================== FORM REGISTER CASE ============================= */
+
+.frm_register_case input[type="text"]{
+       width: 170px;  
+}
+.frm_register_case select {
+    width: 184px;
+}
 a.view_check_list{
        color: #FFFFFF;
     display: block;
@@ -1353,30 +1385,37 @@
     text-decoration: none;
     width: 24px;       
 }
-.quick_edit label{
-       font-weight:bold;
-       vertical-align:top;
+
+/* ======================== CASE MESSAGE ============================= */
+#frmRegCaseMessage label {
+    width: 13%;
 }
-.quick_edit h3{
-       margin:0;
+#frmRegCaseMessage h3 {
+    font-size: 1.15em;
+    margin: 1.5em 0 0.5em;
 }
-.quick_edit select{
-       display: inline-block;
-       vertical-align:top;
+#frmRegCaseMessage ul.cases {
+    border: 1px solid #ddd;
+    padding: 0.5em 1%;
 }
+#frmRegCaseMessage ul.cases h4{
+       margin-top:0
+}
+#frmRegCaseMessage ul li ul li{
+       padding: 0 0 1em 1em;
+}
+
+/* ======================== QUICK MENU ============================= */
+
 .quick_menu {
     font-size: 12px;
-    margin-left: 10px;
-    padding: 10px 2px 0;
+    padding: 10px 0 0;
 }
-.quick_menu a{
-       margin: 0 5px;
-       text-decoration: underline;     
+.quick_menu a {
+    margin-right: 5px;
+    text-decoration: underline;
 }
-.quick_menu .message {
-    color: #333333;
-    margin-left: 30px;
-}
+
 ul#groups {
     margin-left: 10px;
     margin-top: 5px;
@@ -1415,9 +1454,18 @@
     padding: 7px 0;
 }
 
+/* ======================== 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;    
@@ -1428,11 +1476,3 @@
     padding: 3px 6px;
     display: none;
 }
-
-/* ======================== CONTROL DETAILS ============================== */
-
-#control_details label {
-    display: inline-block;
-    font-weight: bold;
-    width: 100px;
-}
\ No newline at end of file

Modified: branches/Version-1_0-branch/index.php
===================================================================
--- branches/Version-1_0-branch/index.php       2012-04-10 09:14:04 UTC (rev 
9112)
+++ branches/Version-1_0-branch/index.php       2012-04-10 11:06:41 UTC (rev 
9113)
@@ -109,13 +109,23 @@
                        // comply with RFC 4627
                        header('Content-Type: application/json'); 
                        $return_data = $GLOBALS[$class]->$method();
-                       echo json_encode($return_data);
+                       /*
+                       * JSON Serializer produces invalid JSON if a value ends 
with quote
+                       */
+                       $v = json_encode($return_data);
+                       if(preg_match('/^"(.*)"$/', $v, $matches))
+                       {
+                       $v = $matches[1];
+               }
+                       echo $v;
+//                     echo json_encode($return_data);
                        $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
 
                        //If debug info is not triggered elsewhere.
                        if 
(isset($GLOBALS['phpgw_info']['user']['apps']['admin']) && DEBUG_TIMER && 
!phpgwapi_cache::session_get($app,'id_debug'))
                        {
                                $debug_timer_stop = perfgetmicrotime();
+                               //BTW: wil not destroy the json output - click 
on the 'Debug-link' to view message
                                _debug_array(lang('page prepared in %1 
seconds.', $debug_timer_stop - $GLOBALS['debug_timer_start'] ));
                        }
 

Modified: 
branches/Version-1_0-branch/phpgwapi/inc/accounts/class.accounts_.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/accounts/class.accounts_.inc.php   
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/phpgwapi/inc/accounts/class.accounts_.inc.php   
2012-04-10 11:06:41 UTC (rev 9113)
@@ -309,10 +309,11 @@
                 *      - memberships for users / members for groups
                 * @param array  $acls    list of access controls to set for 
the user
                 * @param array  $modules the list of modules to enable for the 
user
+                * @param array  $contact_data for related contact in the 
addressbook
                 *
                 * @return integer the new account id
                 */
-               public function create($account, $group, $acls = array(), 
$modules = array())
+               public function create($account, $group, $acls = array(), 
$modules = array(),$contact_data = array())
                {
                // FIXME: Conflicting transactions - there is a transaction in 
acl::save_repository()
                //      $this->db->transaction_begin();
@@ -322,7 +323,7 @@
                                switch( $class )
                                {
                                        case phpgwapi_account::CLASS_TYPE_USER:
-                                               $this->_create_user($account, 
$group);
+                                               $this->_create_user($account, 
$group, $contact_data);
                                                break;
 
                                        case phpgwapi_account::CLASS_TYPE_GROUP:
@@ -860,9 +861,9 @@
                 *
                 * @return integer the id of the new user account
                 */
-               protected function _create_user($user, $groups)
+               protected function _create_user($user, $groups, $contact_data = 
array())
                {
-                       $this->_save_contact_for_user($user);
+                       $this->_save_contact_for_user($user, $contact_data);
                        if ( !$this->create_user_account($user) )
                        {
                                return false;
@@ -987,15 +988,22 @@
                 *
                 * @return boolean was the contact created/edited?
                 */
-               protected function _save_contact_for_user(&$user)
+               protected function _save_contact_for_user(&$user,$contact_data)
                {
-                       $primary = array
-                       (
-                               'owner'                         => 
$GLOBALS['phpgw_info']['server']['addressmaster'],
-                               'access'                        => 'public',
-                               'per_first_name'        => $user->firstname,
-                               'per_last_name'         => $user->lastname,
-                       );
+                       if(isset($contact_data['primary']) && 
$contact_data['primary'])
+                       {
+                               $primary = $contact_data['primary'];
+                       }
+                       else
+                       {
+                               $primary = array
+                               (
+                                       'owner'                         => 
$GLOBALS['phpgw_info']['server']['addressmaster'],
+                                       'access'                        => 
'public',
+                                       'per_first_name'        => 
$user->firstname,
+                                       'per_last_name'         => 
$user->lastname,
+                               );
+                       }
 
                        $contacts = createObject('phpgwapi.contacts');
 
@@ -1007,25 +1015,36 @@
 
                        $type = $contacts->search_contact_type('Persons');
 
-                       $comms = array();
-                       $domain = '';
-                       if ( 
isset($GLOBALS['phpgw_info']['server']['mail_server']) )
+                       if(isset($contact_data['comms']) && 
$contact_data['comms'])
                        {
-                               $domain = 
$GLOBALS['phpgw_info']['server']['mail_server'];
+                               $comms = $contact_data['comms'];
                        }
+                       else
+                       {
 
-                       if ( $domain )
-                       {
-                               $comm = array
-                               (
-                                       'comm_descr'            => 
$contacts->search_comm_descr('work email'),
-                                       'comm_data'                     => 
"{$user->address@hidden",
-                                       'comm_preferred'        => 'Y'
-                               );
-                               $comms = array($comm);
+                               $comms = array();
+                               $domain = '';
+                               if ( 
isset($GLOBALS['phpgw_info']['server']['mail_server']) )
+                               {
+                                       $domain = 
$GLOBALS['phpgw_info']['server']['mail_server'];
+                               }
+
+                               if ( $domain )
+                               {
+                                       $comm = array
+                                       (
+                                               'comm_descr'            => 
$contacts->search_comm_descr('work email'),
+                                               'comm_data'                     
=> "{$user->address@hidden",
+                                               'comm_preferred'        => 'Y'
+                                       );
+                                       $comms = array($comm);
+                               }
                        }
 
-                       $user->person_id = $contacts->add_contact($type, 
$primary, $comms);
+                       $locations = isset($contact_data['locations']) && 
$contact_data['locations'] ? $contact_data['locations'] : array();
+
+                       $user->person_id = $contacts->add_contact($type, 
$primary, $comms, $locations);
+
                        return !!$user->person_id;
                }
        }

Copied: branches/Version-1_0-branch/phpgwapi/templates/base/yui_phpgw_i18n.xsl 
(from rev 9112, trunk/phpgwapi/templates/base/yui_phpgw_i18n.xsl)
===================================================================
--- branches/Version-1_0-branch/phpgwapi/templates/base/yui_phpgw_i18n.xsl      
                        (rev 0)
+++ branches/Version-1_0-branch/phpgwapi/templates/base/yui_phpgw_i18n.xsl      
2012-04-10 11:06:41 UTC (rev 9113)
@@ -0,0 +1,17 @@
+<!-- $Id: yui_booking_i18n.xsl 8267 2011-12-11 12:27:18Z sigurdne $ -->
+       <xsl:template name="yui_phpgw_i18n" xmlns:php="http://php.net/xsl";>
+               <xsl:if test="yui_phpgw_i18n">
+                       <script type="text/javascript">
+                               YAHOO.portico.i18n = {};
+                               <xsl:for-each select="yui_phpgw_i18n/*">
+                                       YAHOO.portico.i18n.<xsl:value-of 
select="local-name()"/> = function(cfg)
+                                       {
+                                               cfg = cfg || {};
+                                               <xsl:for-each select="./*">
+                                                       cfg["<xsl:value-of 
select="local-name()"/>"] = <xsl:value-of disable-output-escaping="yes" 
select="."/>;
+                                               </xsl:for-each>
+                                       };
+                               </xsl:for-each>
+                       </script>
+               </xsl:if>
+       </xsl:template>

Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2012-04-10 11:06:41 UTC (rev 9113)
@@ -428,6 +428,13 @@
                                                );
                                }
                        }
+
+                       foreach ($user_list as &$user)
+                       {
+                               $user['id'] = $user['lid'];
+                               $user['name'] = ltrim("{$user['lastname']}, 
{$user['firstname']}",', ');
+                       }
+
                        return $user_list;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php    
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php    
2012-04-10 11:06:41 UTC (rev 9113)
@@ -240,15 +240,21 @@
 
                function period_list($selected='')
                {
+                       $year = date('Y');
+                       $period_list = array();
                        for ($i=1; $i<=12; $i++)
                        {
-                               $period_list[$i]['id'] = $i;
-                               $period_list[$i]['name'] = $i;
-                               if($i==$selected)
-                               {
-                                       $period_list[$i]['selected'] = 
'selected';
-                               }
+                               $period = sprintf("%s%02d",$year,$i);
+                               $period_list[] = array
+                               (
+                                       'id'    => $period,
+                                       'name'  => $period
+                               );
                        }
+                       foreach ($period_list as &$_period)
+                       {
+                               $_period['selected'] = $_period['id'] == 
$selected ? 1 : 0;
+                       }
                        return $period_list;
                }
 
@@ -789,6 +795,11 @@
 
                public function forward($data)
                {
-                       return $this->so->forward($data);               
+                       return $this->so->forward($data);
                }
+
+               public function get_vouchers($data)
+               {
+                       return $this->so->get_vouchers($data);
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.hook_helper.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.hook_helper.inc.php  
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/property/inc/class.hook_helper.inc.php  
2012-04-10 11:06:41 UTC (rev 9113)
@@ -44,4 +44,33 @@
                        $message =lang('%1 userlists cleared from 
cache',$cleared);
                        phpgwapi_cache::message_set($message, 'message');
                }
+
+               /**
+                * Add a contact to a location
+                *
+                * @return void
+                */
+               public function add_location_contact($data)
+               {
+                       if(!isset($data['location_code']) || 
!$data['location_code'])
+                       {
+                               phpgwapi_cache::message_set("location_code not 
set", 'error');
+                               return false;
+                       }
+
+                       $value_set = array();
+                       $value_set['location_code'] = $data['location_code'];
+                       $value_set['contact_id'] = $data['contact_id'];
+                       $value_set['user_id'] = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $value_set['entry_date'] = time();
+                       $value_set['modified_date'] = time();
+                       
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$GLOBALS['phpgw']->db->validate_insert(array_values($value_set));
+                       $sql = "INSERT INTO fm_location_contact ({$cols}) 
VALUES ({$values})";
+                       $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+
+                       $message =lang('user %1 added to 
%2',$data['account_lid'],$data['location_code']);
+                       phpgwapi_cache::message_set($message, 'message');
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.menu.inc.php 2012-04-10 
09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/property/inc/class.menu.inc.php 2012-04-10 
11:06:41 UTC (rev 9113)
@@ -328,6 +328,11 @@
                                                (
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.update_location') ),
                                                        'text'  => lang('update 
location')
+                                               ),
+                                               'location_contact'      => array
+                                               (
+                                                       'text'  => 
lang('location contact'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'location_contact') )
                                                )
                                        );
 
@@ -808,6 +813,14 @@
                                                        'text'  =>      
lang('Add')
                                                );
                                }
+//                             if ( $acl->check('.invoice', PHPGW_ACL_ADD, 
'property') )
+                               {
+                                       $children['invoice2'] = array
+                                               (
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice2.index')),
+                                                       'text'  =>      
'Faktura2'
+                                               );
+                               }
 
                                $menus['navigation']['invoice'] = array
                                        (

Modified: branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php    
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php    
2012-04-10 11:06:41 UTC (rev 9113)
@@ -1568,7 +1568,6 @@
                                break;
 
                        case 'event_action':
-
                                $info = array
                                        (
                                                'table'                         
=> 'fm_event_action',
@@ -2070,6 +2069,43 @@
                                        );
 
                                break;
+                       case 'location_contact':
+                               $info = array
+                                       (
+                                               'table'                         
=> 'fm_location_contact',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'contact_id',
+                                                               'descr' => 
lang('contact'),
+                                                               'type' => 
'int',//contact
+                                                               'nullable'      
=> false,
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'location_code',
+                                                               'descr' => 
lang('location_code'),
+                                                               'type' => 
'varchar',//location
+                                                               'nullable'      
=> false,
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('location contact'),
+                                               'acl_app'                       
=> 'property',
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::location::location_contact',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               )
+                                       );
+
+                               break;
 // START BOOKING TABLES
                        case 'bb_office':
                                $info = array

Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2012-04-10 09:14:04 UTC (rev 9112)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2012-04-10 11:06:41 UTC (rev 9113)
@@ -1225,21 +1225,31 @@
 
                function read_single_voucher($bilagsnr = 0, $id = 0)
                {
+                       $table = 'fm_ecobilag';
+
                        $bilagsnr =(int)$bilagsnr;
                        $id = (int)$id;
+
                        if($bilagsnr)
                        {
-                               $sql = "SELECT * from fm_ecobilag WHERE 
bilagsnr ='$bilagsnr'";
+                               $filtermethod= "WHERE bilagsnr ='$bilagsnr'";
                        }
                        else if ($id)
                        {
-                               $sql = "SELECT * from fm_ecobilag WHERE id 
='$id'";
+                               $filtermethod= " WHERE {$table}.id ='{$id}'";
                        }
                        else
                        {
                                return array();
                        }                       
 
+                       $sql = "SELECT {$table}.*,fm_workorder_status.descr as 
status, fm_workorder.charge_tenant,org_name,"
+                               . "fm_workorder.claim_issued, 
fm_workorder_status.closed FROM {$table}"
+                               . " {$this->left_join} fm_workorder ON 
fm_workorder.id = {$table}.pmwrkord_code"
+                               . " {$this->left_join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
+                               . " {$this->left_join} fm_project ON 
fm_workorder.project_id = fm_project.id"
+                               . " {$this->join} fm_vendor ON 
$table.spvend_code = fm_vendor.id {$filtermethod}";
+
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $values = array();
@@ -1247,16 +1257,19 @@
                        {
                                $values[] = array
                                        (
+                                               'voucher_id'                    
=> $this->db->f('bilagsnr'),
+                                               'voucher_out_id'                
=> $this->db->f('bilagsnr_ut'),
                                                'id'                            
        => $this->db->f('id'),
                                                'art'                           
        => $this->db->f('artid'),
                                                'type'                          
        => $this->db->f('typeid'),
                                                'dim_a'                         
        => $this->db->f('dima'),
                                                'dim_b'                         
        => $this->db->f('dimb'),
                                                'dim_d'                         
        => $this->db->f('dimd'),
-                                               'tax'                           
        => $this->db->f('mvakode'),
+                                               'tax_code'                      
        => $this->db->f('mvakode'),
                                                'invoice_id'                    
=> $this->db->f('fakturanr'),
                                                'kid_nr'                        
        => $this->db->f('kidnr'),
                                                'vendor_id'                     
        => $this->db->f('spvend_code'),
+                                               'vendor'                        
        => $this->db->f('org_name', true),
                                                'janitor'                       
        => $this->db->f('oppsynsmannid'),
                                                'supervisor'                    
=> $this->db->f('saksbehandlerid'),
                                                'budget_responsible'    => 
$this->db->f('budsjettansvarligid'),
@@ -1277,6 +1290,14 @@
                                                'oppsynsigndato'                
=> $this->db->f('oppsynsigndato'),
                                                'saksigndato'                   
=> $this->db->f('saksigndato'),
                                                'budsjettsigndato'              
=> $this->db->f('budsjettsigndato'),
+                                               'charge_tenant'                 
=> $this->db->f('charge_tenant'),
+                                               'external_ref'                  
=> $this->db->f('external_ref'),
+                                               'status'                        
        => $this->db->f('status'),
+                                               'closed'                        
        => $this->db->f('closed'),
+                                               'parked'                        
        => $this->db->f('kreditnota'),
+                                               'period'                        
        => $this->db->f('periode'),
+                                               'periodization'                 
=> $this->db->f('periodization'),
+                                               'periodization_start'   => 
$this->db->f('periodization_start'),
                                        );
                        }
 
@@ -1732,4 +1753,87 @@
 
                        return false;
                }
+
+               public function get_vouchers($data)
+               {
+                       $filtermethod = '';
+                       $querymethod = '';
+                       $where = 'WHERE';
+
+                       if($data['janitor_lid'])
+                       {
+                               $data['janitor_lid'] = 
ltrim($data['janitor_lid'],'*');
+                               $filtermethod = "$where oppsynsmannid = 
'{$data['janitor_lid']}'";
+                               $where = 'AND';
+                       }
+
+                       if($data['supervisor_lid'])
+                       {
+                               if( stripos($data['supervisor_lid'],'*') === 0)
+                               {
+                                       $data['supervisor_lid'] = 
ltrim($data['supervisor_lid'],'*');
+                                       $filtermethod .= " $where 
oppsynsigndato IS NOT NULL";
+                                       $where = 'AND';
+                               }
+
+                               $filtermethod .= " $where saksbehandlerid = 
'{$data['supervisor_lid']}'";
+                               $where = 'AND';
+                       }
+
+                       if($data['budget_responsible_lid'])
+                       {
+                               if( 
stripos($data['budget_responsible_lid'],'*') === 0)
+                               {
+                                       $data['budget_responsible_lid'] = 
ltrim($data['budget_responsible_lid'],'*');
+                                       $filtermethod .= " $where saksigndato 
IS NOT NULL";
+                                       $where = 'AND';
+                               }
+                               $filtermethod .= " $where budsjettansvarligid = 
'{$data['budget_responsible_lid']}'";
+                               $where = 'AND';
+                       }
+
+                       if($data['query'])
+                       {
+                               $query = (int) $data['query'];
+                               $querymethod = " $where (bilagsnr = {$query} OR 
bilagsnr_ut = {$query})";
+                               $where = 'AND';
+                       }
+
+                       $sql = "SELECT DISTINCT bilagsnr,bilagsnr_ut, org_name, 
currency, kreditnota, fm_ecoart.descr as type, sum(godkjentbelop) as 
godkjentbelop FROM fm_ecobilag"
+                       ." {$this->join} fm_vendor ON fm_vendor.id = 
fm_ecobilag.spvend_code"
+                       ." {$this->join} fm_ecoart ON fm_ecoart.id = 
fm_ecobilag.artid"
+                       ." $filtermethod $querymethod"
+                       ." GROUP BY bilagsnr,bilagsnr_ut, org_name, currency, 
kreditnota, fm_ecoart.descr";
+
+                       $lang_voucer = lang('voucher id');
+                       $lang_vendor = lang('vendor');
+                       $lang_currency = lang('currency');
+                       $lang_parked = lang('parked');
+                       $lang_type = lang('type');
+                       $lang_approved_amount = lang('approved amount');
+                       
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $values = array();
+
+                       while($this->db->next_record())
+                       {
+                               $voucher_id = $this->db->f('bilagsnr_ut') ? 
$this->db->f('bilagsnr_ut') : $this->db->f('bilagsnr');
+                               $name = sprintf("{$lang_voucer}:% 8s | 
{$lang_vendor}:% 20s | {$lang_currency}:% 3s | {$lang_parked}: % 1s | 
{$lang_type}: % 12s | {$lang_approved_amount}: % 19s",
+                                                       $voucher_id,
+                                                       
trim(strtoupper($this->db->f('org_name',true))),
+                                                       
$this->db->f('currency'),
+                                                       
$this->db->f('kreditnota') ? 'X' : '',
+                                                       $this->db->f('type'),
+                                                       
number_format($this->db->f('godkjentbelop'), 2, ',', ' ')
+                                               );
+
+                               $values[] = array
+                               (
+                                       'id'    => $this->db->f('bilagsnr'),
+                                       'name'  => $name
+                               );
+                       }
+                       return $values;
+               }
+
        }

Copied: branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php (from 
rev 9112, trunk/property/inc/class.uiinvoice2.inc.php)
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php           
                (rev 0)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php   
2012-04-10 11:06:41 UTC (rev 9113)
@@ -0,0 +1,345 @@
+<?php
+       /**
+       * phpGroupWare - registration
+       *
+       * @author Sigurd Nes <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 registration
+       * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z 
vator $
+       */
+
+       phpgw::import_class('phpgwapi.yui');
+       phpgw::import_class('registration.uicommon');
+/*
+       include_class('registration', 'check_list', 'inc/model/');
+       include_class('registration', 'date_generator', 'inc/component/');
+       include_class('registration', 'status_checker', 'inc/helper/');
+       include_class('registration', 'date_helper', 'inc/helper/');
+*/     
+       class property_uiinvoice2 extends registration_uicommon
+       {
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $currentapp;
+               var $type_id;
+               var $location_code;
+       
+               private $so_control_area;
+               private $so_control;
+               private $so_check_list;
+               private $so_control_item;
+               private $so_check_item;
+               private $so_procedure;
+
+               var $public_functions = array
+               (
+                       'index'                                                 
        => true,
+                       'query'                                                 
        => true,
+                       'edit'                                                  
        => true,
+                       'get_vouchers'                                          
=> true,
+                       'get_single_voucher'                            => true
+               );
+
+               function __construct()
+               {
+                       parent::__construct();
+               
+                       $this->account_id                       = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.boinvoice',true);
+                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->filter                           = 
$this->bo->filter;
+                       $this->status_id                        = 
$this->bo->status_id;
+                       $this->allrows                          = 
$this->bo->allrows;
+               
+                       self::set_active_menu('property::invoice::invoice2');
+               }
+
+               function index()
+               {
+                       $voucher_id     = phpgw::get_var('voucher_id', 'int');
+                       
+                       if($values = phpgw::get_var('values'))
+                       {
+                               $values['pending_users'] = 
isset($values['pending_users']) && $values['pending_users'] ? 
array_unique($values['pending_users']) : array();
+                               $values['pending_users_orig'] = 
isset($values['pending_users_orig']) && $values['pending_users_orig'] ? 
array_unique($values['pending_users_orig']) : array();
+                               
+                               $receipt = $this->bo->approve_users($values);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'registration.uipending.index'));
+                       }
+                       else
+                       {
+                               if(phpgw::get_var('phpgw_return_as') == 'json')
+                               {
+                                       return $this->query();
+                               }
+
+                               $status_list = array
+                               (
+                                       array
+                                       (
+                                               'id'    => 0,
+                                               'name'  => lang('Select status')
+                                       ),
+                                       array
+                                       (
+                                               'id'    => 1,
+                                               'name'  => lang('approved')
+                                       ),
+                                       array
+                                       (
+                                               'id'    => 2,
+                                               'name'  => lang('pending')
+                                       ),
+                               );
+
+
+
+                               $janitor_list                           = 
$this->bocommon->get_user_list_right(32,$janitor,'.invoice');
+                               $supervisor_list                        = 
$this->bocommon->get_user_list_right(64,$supervisor,'.invoice');
+                               $budget_responsible_list        = 
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice');
+
+                               $userlist_default = array();
+                               $userlist_default[] = array('id'=> '*' . 
$GLOBALS['phpgw']->accounts->get($this->account_id)->lid, 'name'=>lang('mine 
vouchers'));
+                               $userlist_default[] = 
array('id'=>'','name'=>lang('no user'));
+
+                               $voucher_list = array('id' => '', 'name' => 
lang('select'));
+
+                               foreach($userlist_default as $default)
+                               {
+                                       $janitor_list = 
array_merge(array($default), $janitor_list);
+                                       $supervisor_list = 
array_merge(array($default), $supervisor_list);
+                                       $budget_responsible_list = 
array_merge(array($default), $budget_responsible_list);
+                               }
+
+                               $data = array(
+                                       'filter_form'                           
=> array
+                                       (
+                                               'janitor_list'                  
        => array('options' => $janitor_list),
+                                               'supervisor_list'               
        => array('options' => $supervisor_list),
+                                               'budget_responsible_list'       
=> array('options' => $budget_responsible_list),
+                                       ),
+                                       'filter_invoice'                        
        => array
+                                       (
+                                               'voucher_list'                  
        => array('options' => $voucher_list),
+                                       ),
+                                       'voucher_info'                          
        => $this->get_single_voucher($voucher_id),
+                                       'datatable' => array(
+                                               'source' => 
self::link(array('menuaction' => 'registration.uipending.query', 
'phpgw_return_as' => 'json')),
+                                               'field' => array(
+                                                       array(
+                                                               'key' => 'id',
+                                                               'hidden' => true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'reg_id',
+                                                               'label' => 
lang('id'),
+                                                               'sortable'      
=> true,
+                                                               'formatter' => 
'formatLinkPending'
+                                                       ),
+                                                       array(
+                                                               'key'   =>      
'reg_lid',
+                                                               'label' =>      
lang('user'),
+                                                               'sortable'      
=>      true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'reg_dla',
+                                                               'label' => 
lang('time'),
+                                                               'sortable'      
=> true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'reg_approved',
+                                                               'label' => 
lang('approved'),
+                                                               'sortable'      
=> true,
+                                                               'formatter' => 
'FormatterCenter'
+                                                       ),
+                                                       array(
+                                                               'key' => 
'location_code',
+                                                               'label' => 
lang('location'),
+                                                               'sortable'      
=> false
+                                                       ),
+
+                                                       array(
+                                                                       'key' 
=> 'checked',
+                                                                       'label' 
=> lang('approve'),
+                                                                       
'sortable' => false,
+                                                                       
'formatter' => 'formatterCheckPending',
+                                                                       
'className' => 'mychecks'
+                                                       ),
+                                                       array(
+                                                               'key' => 
'actions',
+                                                               'hidden' => true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'labels',
+                                                               'hidden' => true
+                                                       ),
+                                                       array(
+                                                               'key' => 'ajax',
+                                                               'hidden' => true
+                                                       ),array(
+                                                               'key' => 
'parameters',
+                                                               'hidden' => true
+                                                       )                       
                
+                                               )
+                                       )
+                               );
+//_debug_array($data);die();                   
+                               phpgwapi_yui::load_widget('paginator');
+
+                               self::add_javascript('registration', 'yahoo', 
'pending.index.js');
+                               self::add_javascript('controller', 
'controller', 'jquery.js');
+                               self::add_javascript('property', 'portico', 
'ajax_invoice.js');
+
+                               self::render_template_xsl(array('invoice2', 
'common'), $data);
+                       }       
+               }
+       
+
+               public function query()
+               {
+                       $status_id = phpgw::get_var('status_id');
+
+                       $this->bo->start = phpgw::get_var('startIndex');
+               
+                       $user_list = $this->bo->read(array('user_id' => 
$user_id, 'role_id' =>$role_id, 
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
+                                                                               
                   'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run' 
=>$dry_run));
+                       
+                       foreach($user_list as &$user)
+                       {
+                               $reg_info = 
unserialize(base64_decode($user['reg_info']));
+                               $user['location_code'] = 
$reg_info['location_code'];
+                               $results['results'][]= $user;
+                       }
+                       $results['total_records'] = $this->bo->total_records;
+                       $results['start'] = $this->start;
+                       $results['sort'] = 'location_code';
+                       $results['dir'] = $this->bo->sort ? $this->bo->sort : 
'ASC';
+                                       
+                       array_walk($results['results'], array($this, 
'add_links'), array($type));
+                                               
+                       return $this->yui_results($results);
+               }
+
+               public function get_vouchers()
+               {
+                       $janitor_lid                    = 
phpgw::get_var('janitor_lid', 'string');
+                       $supervisor_lid                 = 
phpgw::get_var('supervisor_lid', 'string');
+                       $budget_responsible_lid = 
phpgw::get_var('budget_responsible_lid', 'string');
+                       $query                                  = 
phpgw::get_var('query', 'string');
+
+                       $vouchers = $this->bo->get_vouchers(array('janitor_lid' 
=> $janitor_lid, 'supervisor_lid' => $supervisor_lid, 'budget_responsible_lid' 
=>$budget_responsible_lid, 'query' => $query ));
+
+                       return $vouchers;
+               }
+               public function get_single_voucher($voucher_id = 0)
+               {
+                       $voucher_id     = $voucher_id ? $voucher_id : 
phpgw::get_var('voucher_id', 'int');
+                       $voucher_info = array();
+                       
+                       $voucher = $this->bo->read_single_voucher($voucher_id);
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       $custom_config  = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+                       $baseurl_invoice = 
isset($custom_config->config_data['common']['baseurl_invoice']) && 
$custom_config->config_data['common']['baseurl_invoice'] ? 
$custom_config->config_data['common']['baseurl_invoice'] : '';
+
+                       $_last_period_last_year = (string)(date('Y') -1) . '12';
+                       $period_list = $this->bo->period_list();
+                       $periodization_start_list = $period_list;
+                       array_unshift($period_list,array ('id'=> 
$_last_period_last_year,'name'=> $_last_period_last_year));
+
+                       $period_list = 
$this->bocommon->select_list(isset($voucher[0]['period']) ? 
$voucher[0]['period'] : '', $period_list);
+                       $periodization_start_list = 
$this->bocommon->select_list(isset($voucher[0]['period']) ? 
$voucher[0]['period'] : '', $periodization_start_list);
+
+                       array_unshift($period_list,array ('id'=> 0,'name'=> 
lang('select')));
+                       array_unshift($periodization_start_list,array ('id'=> 
0,'name'=> lang('select')));
+
+                       $voucher_info['generic']['period_list']['options'] = 
$period_list;
+                       
$voucher_info['generic']['periodization_start_list']['options'] = 
$periodization_start_list;
+                       
+                       if(count($voucher))
+                       {
+                               $voucher_info['generic']['approved_amount'] = 0;
+                               $voucher_info['generic']['amount'] = 0;
+                               foreach ($voucher as $line)
+                               {
+                                       
$voucher_info['generic']['approved_amount'] += $line['approved_amount'];
+                                       $voucher_info['generic']['amount']  += 
$line['amount']; 
+                               }
+
+                               $voucher_info['generic']['approved_amount'] = 
number_format($voucher_info['generic']['approved_amount'], 2, ',', ' ');
+                               $voucher_info['generic']['amount'] = 
number_format($voucher_info['generic']['amount'], 2, ',', ' ');
+                               
$voucher_info['generic']['dimb_list']['options']                = 
$this->bo->select_dimb_list($voucher[0]['dim_b']);
+                               
$voucher_info['generic']['tax_code_list']['options']    = 
$this->bo->tax_code_list($voucher[0]['tax_code']);
+                               
$voucher_info['generic']['periodization_list']['options'] = 
execMethod('property.bogeneric.get_list', array('type'=>'periodization', 
'selected' => $voucher[0]['periodization'] ));
+
+
+                               $voucher[0]['invoice_date'] = 
$voucher[0]['invoice_date'] ?  $GLOBALS['phpgw']->common->show_date( strtotime( 
$voucher[0]['invoice_date'] ), $dateformat ) : '';
+                               $voucher[0]['payment_date'] = 
$voucher[0]['payment_date'] ?  $GLOBALS['phpgw']->common->show_date( strtotime( 
$voucher[0]['payment_date'] ), $dateformat ) : '';
+                               $voucher[0]['oppsynsigndato'] = 
$voucher[0]['oppsynsigndato'] ?  $GLOBALS['phpgw']->common->show_date( 
strtotime( $voucher[0]['oppsynsigndato'] ), $dateformat ) : '';
+                               $voucher[0]['saksigndato'] = 
$voucher[0]['saksigndato'] ?  $GLOBALS['phpgw']->common->show_date( strtotime( 
$voucher[0]['saksigndato'] ), $dateformat) : '';
+                               $voucher[0]['budsjettsigndato'] = 
$voucher[0]['budsjettsigndato'] ?  $GLOBALS['phpgw']->common->show_date( 
strtotime( $voucher[0]['budsjettsigndato'] ),$dateformat ) : '';
+
+                               if($voucher[0]['remark'])
+                               {
+                                       $voucher[0]['remark_link']= " <a 
href=\"javascript:openwindow('".$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                                       'menuaction'=> 
'property.uiinvoice.remark',
+                                                       'id'            => 
$voucher[0]['id'],
+                                               )). "','550','400')\" 
>".lang('Remark')."</a>";
+                               }
+                               if($voucher[0]['order_id'])
+                               {
+                                       $voucher[0]['order_link']= 
$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                                       'menuaction'    => 
'property.uiinvoice.view_order',
+                                                       'order_id'              
=> $voucher[0]['order_id']
+                                               ));
+                               }
+
+                               if($voucher[0]['external_ref'])
+                               {
+                                       $voucher[0]['external_ref'] = " <a 
href=\"javascript:openwindow('{$baseurl_invoice}{$voucher[0]['external_ref']}','640','800')\"
 >" . lang('invoice id') . '</a>';
+                               }
+
+                       }
+                       else
+                       {
+                               
$voucher_info['generic']['dimb_list']['options']                = 
$this->bo->select_dimb_list();
+                               
$voucher_info['generic']['tax_code_list']['options']    = 
$this->bo->tax_code_list();
+                               
$voucher_info['generic']['periodization_list']['options'] = 
execMethod('property.bogeneric.get_list', array('type'=>'periodization'));
+                       }
+                       array_unshift 
($voucher_info['generic']['dimb_list']['options'],array 
('id'=>'','name'=>lang('select')));
+                       array_unshift 
($voucher_info['generic']['periodization_list']['options'],array('id' => '0', 
'name' => lang('none')));
+
+                       $voucher_info['voucher'] = $voucher;
+//_debug_array($voucher_info);
+
+                       return $voucher_info;
+               }
+       }

Copied: branches/Version-1_0-branch/property/js/portico/ajax_invoice.js (from 
rev 9112, trunk/property/js/portico/ajax_invoice.js)
===================================================================
--- branches/Version-1_0-branch/property/js/portico/ajax_invoice.js             
                (rev 0)
+++ branches/Version-1_0-branch/property/js/portico/ajax_invoice.js     
2012-04-10 11:06:41 UTC (rev 9113)
@@ -0,0 +1,977 @@
+$(document).ready(function(){
+       
+       // When janitor is selected, vouchers are fetched from db and voucer 
select list is populated
+       $("#janitor_lid").change(function () {
+//             var janitor_lid = $(this).val();
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+      
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       } 
+                       });
+               
+    });
+
+       $("#supervisor_lid").change(function () {
+//             var janitor_lid = $(this).val();
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+      
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       } 
+                       });
+               
+    });
+
+       $("#budget_responsible_lid").change(function () {
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+      
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       } 
+                       });
+               
+    });
+
+
+//     $("#queryForm").submit(function(e){
+       $("#search").click(function(e){
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       }
+                       });
+       });
+
+
+
+
+       $("#voucher_id_filter").change(function () {
+               var voucher_id = $(this).val();
+               var oArgs = 
{menuaction:'property.uiinvoice2.get_single_voucher'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&voucher_id=" + voucher_id,
+                       success: function(data) {
+                               var voucher = data['voucher'];
+                               if( voucher != null && voucher.length > 0)
+                               {
+                                       $("#voucher_id").val( voucher_id );
+               
+                                       if( voucher[0].voucher_out_id )
+                                       {
+                                               $("#voucher_id_text").html( 
voucher[0].voucher_out_id );                                        
+                                       }
+                                       else
+                                       {
+                                               $("#voucher_id_text").html( 
voucher_id );
+                                       }
+                                       $("#order_id").val( voucher[0].order_id 
);
+
+                                       if(voucher[0].order_id)
+                                       {
+                                               var oArgs_order = 
{menuaction:'property.uiinvoice.view_order', order_id: voucher[0].order_id};
+                                               var requestUrl_order = 
phpGWLink('index.php', oArgs_order);
+                                               var htmlString_order  =  " <a 
target= \"_blank\" href=\"" + requestUrl_order + "\" title=\"" + 
voucher[0].status + "\" > Bestilling</a>";
+                                               $("#order_text").html( 
htmlString_order );
+                                       }
+                                       else
+                                       {
+                                               $("#order_text").html( 
'Bestilling' );
+                                       }
+
+                                       $("#project_group").val( 
voucher[0].project_group );
+
+                                       if(voucher[0].external_ref)
+                                       {
+                                               
$("#invoice_id_text").html(voucher[0].external_ref );
+                                       }
+                                       else
+                                       {
+                                               
$("#invoice_id_text").html('FakturaNr');
+                                       }
+
+                                       $("#invoice_id").html( 
voucher[0].invoice_id );
+                                       $("#kid_nr").html( voucher[0].kid_nr );
+                                       $("#vendor").html( voucher[0].vendor );
+                                       $("#janitor").html( voucher[0].janitor 
);
+                                       $("#supervisor").html( 
voucher[0].supervisor );
+                                       $("#budget_responsible").html( 
voucher[0].budget_responsible );
+                                       $("#invoice_date").html( 
voucher[0].invoice_date );
+                                       $("#payment_date").html( 
voucher[0].payment_date );
+                                       $("#b_account_id").val( 
voucher[0].b_account_id );
+                                       $("#dim_a").val( voucher[0].dim_a );
+                                       $("#amount").html( 
data['generic'].amount );
+                                       $("#approved_amount").html( 
data['generic'].approved_amount );
+                                       $("#currency").html( 
voucher[0].currency );
+                                       $("#oppsynsigndato").html( 
voucher[0].oppsynsigndato );
+                                       $("#saksigndato").html( 
voucher[0].saksigndato );
+                                       $("#budsjettsigndato").html( 
voucher[0].budsjettsigndato );
+                                       if(voucher[0].merknad)
+                                       {
+                                               var oArgs_remark = 
{menuaction:'property.uiinvoice.remark', id: voucher[0].id};
+                                               var requestUrl_remark = 
phpGWLink('index.php', oArgs_remark);
+
+                                               var htmlString  =  " <a 
href=\"javascript:openwindow('" +requestUrl_remark + "','550','400')\" > 
Remark</a>";
+
+                                               $("#remark").html( htmlString );
+                                       }
+//---------
+                                       var checked_park_invoice = "";
+                                       var park_invoice_status = "";
+                                       if(voucher[0].parked)
+                                       {
+                                               checked_park_invoice = "checked 
= \"checked\"";
+                                               var park_invoice_status = " X";
+                                       }
+                                       var htmlString_park_invoice = "<input 
type=\"checkbox\" name=\"values[park_invoice]\" value=\"1\" title=\"park 
invoice\"" + checked_park_invoice + "></input>" + park_invoice_status;
+                                       $("#park_order").html( 
htmlString_park_invoice );
+//---------
+                                       var checked_close_order = "";
+                                       var close_order_status = " " + 
voucher[0].status;
+                                       if(voucher[0].closed)
+                                       {
+                                               checked_close_order = "checked 
= \"checked\"";
+                                       }
+                                       var htmlString_close_order = "<input 
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close 
order\"" + checked_close_order + "></input>" + close_order_status;
+                                       $("#close_order").html( 
htmlString_close_order );
+//---------
+
+                                       
if(data['generic']['dimb_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['dimb_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].dim_b)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#dim_b").html( htmlString );
+                                       }
+                                       
if(data['generic']['tax_code_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               htmlString  = 
"<option>Velg</option>"
+
+                                               var obj = 
data['generic']['tax_code_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].tax_code)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#tax_code").html( htmlString 
);
+                                       }
+
+                                       
if(data['generic']['period_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['period_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].period)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#period").html( htmlString );
+                                       }
+                                       
if(data['generic']['periodization_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['periodization_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].periodization)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#periodization").html( 
htmlString );
+                                       }
+                                       
if(data['generic']['periodization_start_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['periodization_start_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].periodization_start)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#periodization_start").html( 
htmlString );
+                                       }
+                               }
+                               else
+                               {
+                                       $("#voucher_id").val( '' );
+                                       $("#voucher_id_text").html( '' );
+                                       $("#order_id").val( '' );
+                                       $("#project_group").val( '' );
+                                       $("#invoice_id").html( '' );
+                                       $("#kid_nr").html( '' );
+                                       $("#vendor").html('' );
+                                       $("#janitor").html( '' );
+                                       $("#supervisor").html( '' );
+                                       $("#budget_responsible").html( '' );
+                                       $("#invoice_date").html( '' );
+                                       $("#payment_date").html( '' );
+                                       $("#b_account_id").val( '' );
+                                       $("#amount").html( '' );
+                                       $("#approved_amount").html( '' );
+                                       $("#currency").html( '' );
+                                       $("#oppsynsigndato").html( '' );
+                                       $("#saksigndato").html( '' );
+                                       $("#budsjettsigndato").html( '' );
+                                       $("#remark").html( '' );
+                                       $("#dim_a").val('' );
+                                       $("#dim_b").html( 
"<option>Velg</option>" );
+                                       $("#period").html( 
"<option>Velg</option>" );
+                                       $("#periodization").html( 
"<option>Velg</option>" );
+                                       $("#periodization_start").html( 
"<option>Velg</option>" );
+                                       $("#tax_code").html( 
"<option>0</option>" );
+                                       $("#order_text").html( 'Bestilling' );
+                                       $("#invoice_id_text").html('FakturaNr');
+                               }
+                       }
+                       });
+    });
+
+
+       // When control area is selected, controls are fetched from db and 
control select list is populated
+       $("#control_area").change(function () {
+                var control_area_id = $(this).val();
+                if(control_area_id == '')
+                        control_area_id = "all";
+                       
+               var oArgs = 
{menuaction:'controller.uicontrol_group.get_control_groups_by_control_area', 
phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               //var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_area_id=" + control_area_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
kontrollgruppe</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#control_group").html( htmlString );
+                                       }else {
+                                               htmlString  += "<option>Ingen 
kontrollgrupper</option>"
+                                               $("#control_group").html( 
htmlString );
+                                       }
+                       } 
+                       });
+               
+    });
+
+       // When control area is selected, controls are fetched from db and 
control select list is populated
+/*     $("#control_group").change(function () {
+                var control_group_id = $(this).val();
+               var oArgs = 
{menuaction:'controller.uicontrol_group.get_control_area_by_control_group', 
phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               //var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_group_id=" + 
control_group_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Ingen 
kontrollområde</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#control_group_id").html( htmlString 
);
+                                       }else {
+                                               htmlString  += "<option>Ingen 
kontrollområder</option>"
+                                               $("#control_group_id").html( 
htmlString );
+                                       }
+                       } 
+                       });
+               
+    });
+*/
+
+       // file: add_component_to_control.xsl
+       // When component category is selected, corresponding component types 
are fetched from db and component type select list is populated
+       $("#ifc").change(function () {
+                var ifc_id = $(this).val();
+               
+                var oArgs = 
{menuaction:'controller.uicheck_list_for_component.get_component_types_by_category',
 phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+               //var requestUrl = 
"index.php?menuaction=controller.uicheck_list_for_component.get_component_types_by_category&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&ifc=" + ifc_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
type</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#bim_type_id").html( htmlString );
+                                       }else {
+                                               htmlString  += "<option>Ingen 
typer</option>"
+                                               $("#bim_type_id").html( 
htmlString );
+                                       }
+                       } 
+                       });
+               
+    });
+
+       // file: control.xsl
+       // When control area is selected, procedures are fetched from db and 
procedure select list is populated
+       $("#control_area_id").change(function () {
+                var control_area_id = $(this).val();
+               
+                var oArgs = 
{menuaction:'controller.uiprocedure.get_procedures'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+               //var requestUrl = 
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_area_id=" + control_area_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
prosedyre</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].title + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#procedure_id").html( htmlString );
+                                       }
+                                       else
+                                       {
+                                               htmlString  += "<option>Ingen 
prosedyrer</option>"
+                                       $("#procedure_id").html( htmlString );  
                 
+                                       }
+                       } 
+                       });
+    });
+               
+       $("#frm_save_control_groups").submit(function(e){
+               var thisForm = $(this);
+               var num_checked = $(this).find("input:checked").length;
+       
+               if(num_checked == 0){
+                       e.preventDefault();             
+                       $(thisForm).before("<div style='margin: 10px 
0;text-align: center;width: 200px;' class='input_error_msg'>Du må velge en 
eller flere grupper</div>");
+               }
+       });
+
+       $("#frm_control_items").submit(function(e){
+               var thisForm = $(this);
+               var num_checked = $(this).find("input:checked").length;
+       
+               if(num_checked == 0){
+                       e.preventDefault();             
+                       $(thisForm).before("<div style='margin: 10px 
0;text-align: center;width: 200px;' class='input_error_msg'>Du må velge en 
eller flere punkter</div>");
+               }
+       });
+
+       $("#frm_save_control_details input").focus(function(e){
+               
$("#frm_save_control_details").find(".focus").removeClass("focus");
+               $(this).addClass("focus");
+       });
+
+       $("#frm_save_control_details input").focus(function(e){
+               
$("#frm_save_control_details").find(".focus").removeClass("focus");
+               $(this).addClass("focus");
+       });
+
+       $("#frm_save_control_details select").focus(function(e){
+               
$("#frm_save_control_details").find(".focus").removeClass("focus");
+               $(this).addClass("focus");
+       });
+
+       $("#frm_save_control_details").submit(function(e){
+       
+               var thisForm = $(this);
+
+               var $required_input_fields = $(this).find(".required");
+               var status = true;
+                       
+           $required_input_fields.each(function() {
+           
+               if($(this).val() == ''){
+                       var nextElem = $(this).next();
+               
+                       if( !$(nextElem).hasClass("input_error_msg") )
+                               $(this).after("<div class='input_error_msg'>Du 
må fylle ut dette feltet</div>");
+                                       
+                       status = false;
+               }else{
+                       var nextElem = $(this).next();
+
+                       if( $(nextElem).hasClass("input_error_msg") )
+                               $(nextElem).remove();
+               }
+           });
+
+           if( status ){
+               var saved_control_area_id = 
$(thisForm).find("input[name='saved_control_area_id']").val();
+               var new_control_area_id = $("#control_area_id").val();
+
+               if(saved_control_area_id != '' & saved_control_area_id != 
new_control_area_id)
+               {
+                       var answer = confirm("Du har endret kontrollområde til 
kontrollen. " +
+                                                                "Hvis du 
lagrer vil kontrollgrupper og kontrollpunkter til kontrollen bli slettet.")
+                       if (!answer){
+                               e.preventDefault();
+                       }
+               }
+           }else{
+               e.preventDefault();
+           }
+           
+       });
+
+       // file: view_check_lists_for_location.xsl
+       // Fetches info about a check list on hover status image icon
+       $('a.view_check_list').bind('contextmenu', function(){
+               var thisA = $(this);
+               var divWrp = $(this).parent();
+       
+               var add_param = $(thisA).find("span").text();
+       
+               var oArgs = 
{menuaction:'controller.uicheck_list.get_cases_for_check_list'};
+               var baseUrl = phpGWLink('index.php', oArgs, true);
+               var requestUrl = baseUrl + add_param
+       
+               //var requestUrl = 
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_cases_for_check_list";
 + add_param;
+       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl,
+                       dataType: 'json',
+                 success: function(data) {
+                         if(data){
+                               var obj = jQuery.parseJSON(data);
+
+                               // Show info box with info about check list
+                                 var infoBox = $(divWrp).find("#info_box");
+                                 $(infoBox).show();
+                                
+                                 var htmlStr = "<h5>Åpne saker</h5><ul>";
+                       
+                                 $.each(obj, function(i) {
+                                       htmlStr += "<li><label>" + (parseInt(i) 
+ 1) + ": Tittel</label><span>" + obj[i].control_item.title + "</span>";
+                                       htmlStr += "<ul>";
+                                        
+                                       $(obj[i].cases_array).each(function(j) {
+                                               htmlStr += "<li>" + "Sak " + 
(parseInt(j) + 1) + ":  " + obj[i].cases_array[j].descr + "</li>";
+                                       });
+                                       htmlStr += "</ul></li>";
+                                       });
+                                
+                                 htmlStr += "</ul>";
+                       
+                                 $(infoBox).html( htmlStr ); 
+                         }
+                 }
+                  });
+       
+               return false;
+       });
+
+       $("a.view_check_list").mouseout(function(){
+               var infoBox = $(this).parent().find("#info_box");
+       
+               $(infoBox).hide();
+       });
+
+       $(".frm_save_check_item").live("submit", function(e){
+               e.preventDefault();
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               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"){
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       $(submitBnt).val("Lagret");
+                                                
+                                               // Changes text on save button 
back to original
+                                               window.setTimeout(function() {
+                                               $(submitBnt).val('Oppdater 
måling');
+                                               
$(submitBnt).addClass("not_active");
+                                                        }, 1000);              
                         
+                                       }
+                               }
+                               }
+                       });
+       });
+
+       $(".frm_save_control_item").live("click", function(e){
+               e.preventDefault();
+               var thisForm = $(this);
+               var liWrp = $(this).parent();
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               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"){
+                                       $(liWrp).fadeOut('3000', function() {
+                                               $(liWrp).addClass("hidden");
+                                       });
+                                       }
+                               }
+                               }
+                       });
+       });
+
+       $("#frm_update_check_list").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               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 == "updated"){
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       $(submitBnt).val("Lagret");
+                                                
+                                       // Changes text on save button back to 
original
+                                       window.setTimeout(function() {
+                                                       $(submitBnt).val('Lagre 
sjekkpunkt');
+                                                       
$(submitBnt).addClass("not_active");
+                                       }, 1000);
+                                       }
+                               }
+                               }
+               });
+       });
+
+       $(".frm_register_case").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&" + $(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var jsonObj = jQuery.parseJSON(data);
+                       
+                               if(jsonObj.status == "saved"){
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       $(submitBnt).val("Lagret");
+                                        
+                                       clear_form( thisForm );
+                                                        
+                                       // Changes text on save button back to 
original
+                                       window.setTimeout(function() {
+                                                       
$(submitBnt).val('Registrer sak');
+                                                       
$(submitBnt).addClass("not_active");
+                                       }, 1000);
+                                       }
+                               }
+                               }
+               });
+       });
+
+       $(".frm_update_case").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var clickRow = $(this).closest("li");
+               var checkItemRow = $(this).closest("li.check_item_case");
+               var requestUrl = $(thisForm).attr("action");
+                       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&" + $(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var jsonObj = jQuery.parseJSON(data);
+               
+                               if(jsonObj.status == "saved"){
+                                       var type = 
$(checkItemRow).find(".control_item_type").text();
+                               
+                                       if(type == "control_item_type_1"){
+                                       
+                                       }else if(type == "control_item_type_2"){
+                                               var measurement_text = 
$(thisForm).find("input[name='measurement']").val();
+                                               $(clickRow).find(".case_info 
.measurement").text(measurement_text);
+                                       }
+                               
+                                       // Text from forms textarea
+                                       var desc_text = 
$(thisForm).find("textarea").val();
+                                       // Puts new text into description tag 
in case_info                                                              
+                                       $(clickRow).find(".case_info 
.case_descr").text(desc_text);
+                                                                       
+                                       $(clickRow).find(".case_info").show();
+                                       
$(clickRow).find(".frm_update_case").hide();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("a.quick_edit").live("click", function(e){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+                                                               
+               $(clickRow).find(".case_info").hide();
+               $(clickRow).find(".frm_update_case").show();
+       
+               return false;
+       });
+
+       $(".frm_update_case .cancel").live("click", function(e){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+                       
+       
+               $(clickRow).find(".case_info").show();
+               $(clickRow).find(".frm_update_case").hide();
+       
+               return false;
+       });
+
+       // Delete a case item from list
+       $(".delete_case").live("click", function(){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+               var clickItem = $(this).closest("ul");
+               var checkItemRow = $(this).parents("li.check_item_case");
+       
+               var url = $(clickElem).attr("href");
+
+               // Sending request for deleting a control item list
+               $.ajax({
+                       type: 'POST',
+                       url: url,
+                       success: function(data) {
+                               var obj = jQuery.parseJSON(data);
+                       
+                               if(obj.status == "deleted"){
+                                       if( $(clickItem).children("li").length 
> 1){
+                                               $(clickRow).fadeOut(300, 
function(){
+                                                       $(clickRow).remove();
+                                               });
+                                       
+                                               var next_row = 
$(clickRow).next();
+                                       
+                                               // Updating order numbers for 
rows below deleted row 
+                                               while( $(next_row).length > 0){
+                                                       
update_order_nr_for_row(next_row, "-");
+                                                       next_row = 
$(next_row).next();
+                                               }
+                                       }else{
+                                               $(checkItemRow).fadeOut(300, 
function(){
+                                                       
$(checkItemRow).remove();
+                                               });
+                                       }
+                               }
+                       }
+               });
+
+               return false;
+       });
+
+       // Closes a case
+       $(".close_case").live("click", function(){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+               var clickItem = $(this).closest("ul");
+               var checkItemRow = $(this).parents("li.check_item_case");
+       
+               var url = $(clickElem).attr("href");
+
+               // Sending request for deleting a control item list
+               $.ajax({
+                       type: 'POST',
+                       url: url,
+                       success: function(data) {
+                               var obj = jQuery.parseJSON(data);
+                       
+                               if(obj.status == "closed"){
+                                       if( $(clickItem).children("li").length 
> 1){
+                                               $(clickRow).fadeOut(300, 
function(){
+                                                       $(clickRow).remove();
+                                               });
+                                       
+                                               var next_row = 
$(clickRow).next();
+                                       
+                                               // Updating order numbers for 
rows below deleted row 
+                                               while( $(next_row).length > 0){
+                                                       
update_order_nr_for_row(next_row, "-");
+                                                       next_row = 
$(next_row).next();
+                                               }
+                                       }else{
+                                               $(checkItemRow).fadeOut(300, 
function(){
+                                                       
$(checkItemRow).remove();
+                                               });
+                                       }
+                               }
+                       }
+               });
+
+               return false;
+       });
+
+       $("#frm_update_check_list").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
+
+       $("#frm_add_check_list").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");

@@ Diff output truncated at 153600 characters. @@



reply via email to

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