fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9522] Merge 9507:9521 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9522] Merge 9507:9521 from trunk
Date: Wed, 06 Jun 2012 12:59:29 +0000

Revision: 9522
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9522
Author:   sigurdne
Date:     2012-06-06 12:59:29 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
Merge 9507:9521 from trunk

Modified Paths:
--------------
    
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_org.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
    branches/Version-1_0-branch/controller/js/controller/custom_ui.js
    
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_current.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_items.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
    
branches/Version-1_0-branch/controller/templates/base/procedure/view_procedures_for_control.xsl
    branches/Version-1_0-branch/frontend/setup/default_records.inc.php
    branches/Version-1_0-branch/frontend/setup/phpgw_no.lang
    branches/Version-1_0-branch/frontend/setup/setup.inc.php
    branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/inc/class.boentity.inc.php
    branches/Version-1_0-branch/property/inc/class.socommon.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php

Added Paths:
-----------
    branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php
    branches/Version-1_0-branch/frontend/templates/base/document.xsl

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


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

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2012-06-06 12:59:29 UTC (rev 9522)
@@ -649,7 +649,7 @@
                $zip = $org_info['zip'];
                if($zip && strlen($zip) > 5)
                {
-                       $zip_code = substr($zip,0,4);
+                       $zip_code = substr($zip,0,5);
                        $city = substr($zip, 5);
                }
                else

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2012-06-06 12:59:29 UTC (rev 9522)
@@ -325,7 +325,7 @@
                                        $contact2 = array();
                                        $contact2['name'] = $contact2_name;
                                        $contact2['phone'] = $contact2_phone;
-                                       $contact2['mail'] = $contact_mail_2;
+                                       $contact2['mail'] = $contact2_email;
                                        $contact2['org_id'] = $new_org_id;
                                        
$so_activity->add_contact_person_org($contact2);
                                        

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2012-06-06 12:59:29 UTC (rev 9522)
@@ -285,7 +285,8 @@
                                        else if(isset($g_id) && 
is_numeric($g_id) && $g_id > 0)
                                        {
                                                $person_ids = 
$this->so_group->get_contacts($g_id);
-                                               $person_arr = 
$this->so_contact->get_local_contact_persons($g_id, true);
+                                               //$person_arr = 
$this->so_contact->get_local_contact_persons($g_id, true);
+                                               $person_arr = 
$this->so_contact->get_booking_contact_persons($g_id, true);
                                                foreach($person_arr as $p)
                                                {
                                                        //var_dump($p);
@@ -583,7 +584,7 @@
                                                $person_arr = 
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
                                                foreach($person_arr as $p)
                                                {
-                                                       $persons[] = $p;
+                                                       $persons_array[] = $p;
                                                }
                                                $desc = 
$this->so_group->get_description($activity->get_group_id());
                                                $group = 
$this->so_group->get_single($activity->get_group_id());
@@ -658,6 +659,8 @@
                                                                                
                'activity'      => $activity,
                                                                                
                'organization' => $organization,
                                                                                
                'group' => $group,
+                                                                               
        'contact1' => $persons_array[0],
+                                                                               
        'contact2' => $persons_array[1],
                                                                                
                'arenas' => $arenas,
                                                                                
                'buildings' => $buildings,
                                                                                
                'categories' => $categories,
@@ -684,6 +687,8 @@
                                                                        (
                                                                                
'activity'      => $activity,
                                                                                
'organization' => $organization,
+                                                                           
'contact1' => $persons_array[0],
+                                                                               
'contact2' => $persons_array[1],
                                                                                
'org_name' => $org_name,
                                                                                
'group' => $group,
                                                                                
'arenas' => $arenas,
@@ -711,6 +716,8 @@
                                                                                
'activity'      => $activity,
                                                                                
'organization' => $organization,
                                                                                
'group' => $group,
+                                                                               
'contact1' => $persons_array[0],
+                                                                               
'contact2' => $persons_array[1],
                                                                                
'arenas' => $arenas,
                                                                                
'buildings' => $buildings,
                                                                                
'categories' => $categories,

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2012-06-06 12:59:29 UTC (rev 9522)
@@ -130,7 +130,9 @@
                                </dt>
                                <dd>
                                        <?php echo $organization->get_name();?>
-                                       <a 
href="index.php?menuaction=activitycalendarfrontend.uiactivity.edit_organization_values&amp;organization_id=<?php
 echo $organization->get_id();?>"><?php echo lang('edit_organization');?></a>
+                                       <?php if(!$activity->get_new_org()){?>
+                                               <a 
href="index.php?menuaction=activitycalendarfrontend.uiactivity.edit_organization_values&amp;organization_id=<?php
 echo $organization->get_id();?>"><?php echo lang('edit_organization');?></a>
+                                       <?php }?>
                                </dd>
                                <dt>
                                        <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
       2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
       2012-06-06 12:59:29 UTC (rev 9522)
@@ -78,14 +78,15 @@
 
 function get_address_search()
 {
-       var address = document.getElementById('address_txt').value;
+       var address = document.getElementById('address').value;
        var div_address = document.getElementById('address_container');
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = "<?php echo 
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"address\" id=\"address\" size\"5\">";
-var divcontent_end = "</select>";
+       var divcontent_start = "<select name=\"address_select\" id=\"address\" 
size=\"5\" onChange='setAddressValue(this)'>";
+       var divcontent_end = "</select>";
        
        var callback = {
                success: function(response){
@@ -101,14 +102,15 @@
 
 function get_address_search_cp2()
 {
-       var address = document.getElementById('contact2_address_txt').value;
-       var div_address = document.getElementById('contact2_address_container');
+       var address = document.getElementById('contact2_address').value;
+       var div_address = 
document.getElementById('contact2_address_container');'
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = "<?php echo 
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"contact2_address\" id=\"address_cp2\" 
size\"5\">";
-var divcontent_end = "</select>";
+       var divcontent_start = "<select name=\"contact2_address_select\" 
id=\"address_cp2\" size=\"5\" onChange='setAddressValue(this)'>";
+       var divcontent_end = "</select>";
        
        var callback = {
                success: function(response){
@@ -122,6 +124,26 @@
        
 }
 
+function setAddressValue(field)
+{
+       if(field.name == 'contact2_address_select')
+       {
+       var address = document.getElementById('contact2_address');
+       var div_address = document.getElementById('contact2_address_container');
+    
+       address.value=field.value;
+               div_address.style.display="none";
+       }
+       else
+       {
+       var address = document.getElementById('address');
+       var div_address = document.getElementById('address_container');
+    
+       address.value=field.value;
+               div_address.style.display="none";
+       }
+}
+
 function allOK()
 {
        if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
@@ -234,7 +256,7 @@
                                        <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
                                </dt>
                                <dd>
-                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation" />
+                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation" <?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?>/>
                                </dd>
                                <hr />
                                <h2><?php echo lang('where_when')?></h2>

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
        2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
        2012-06-06 12:59:29 UTC (rev 9522)
@@ -35,13 +35,14 @@
 
 function get_address_search()
 {
-       var address = document.getElementById('address_txt').value;
+       var address = document.getElementById('address').value;
        var div_address = document.getElementById('address_container');
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = "<?php echo 
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"address\" id=\"address\" size\"5\">";
+var divcontent_start = "<select name=\"address\" id=\"address\" size=\"5\" 
onChange='setAddressValue(this)'>";
 var divcontent_end = "</select>";
        
        var callback = {
@@ -58,13 +59,14 @@
 
 function get_address_search_arena()
 {
-       var address = document.getElementById('arena_address_txt').value;
+       var address = document.getElementById('arena_address').value;
        var div_address = document.getElementById('arena_address_container');
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = "<?php echo 
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"arena_address\" id=\"arena_address\" 
size\"5\">";
+var divcontent_start = "<select name=\"arena_address_select\" 
id=\"arena_address\" size=\"5\" onChange='setAddressValue(this)'>";
 var divcontent_end = "</select>";
        
        var callback = {
@@ -81,13 +83,14 @@
 
 function get_address_search_cp2()
 {
-       var address = document.getElementById('contact2_address_txt').value;
+       var address = document.getElementById('contact2_address').value;
        var div_address = document.getElementById('contact2_address_container');
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = "<?php echo 
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"contact2_address\" id=\"address_cp2\" 
size\"5\">";
+var divcontent_start = "<select name=\"contact2_address_select\" 
id=\"address_cp2\" size=\"5\" onChange='setAddressValue(this)'>";
 var divcontent_end = "</select>";
        
        var callback = {
@@ -102,6 +105,34 @@
        
 }
 
+function setAddressValue(field)
+{
+       if(field.name == 'contact2_address_select')
+       {
+       var address = document.getElementById('contact2_address');
+       var div_address = document.getElementById('contact2_address_container');
+    
+       address.value=field.value;
+               div_address.style.display="none";
+       }
+       else if(field.name == 'arena_address_select')
+       {
+       var address = document.getElementById('arena_address');
+       var div_address = document.getElementById('arena_address_container');
+    
+       address.value=field.value;
+               div_address.style.display="none";
+       }
+       else
+       {
+               var address = document.getElementById('address');
+               var div_address = document.getElementById('address_container');
+
+               address.value=field.value;
+               div_address.style.display="none";
+       }
+}
+
 function run_checks()
 {
        check_external();
@@ -239,12 +270,10 @@
                                </dt>
                                <dd>
                                        <?php
-                                       $current_district_ids = 
$activity->get_district();
-                                       $current_district_id_array=explode(",", 
$current_district_ids);
                                        foreach($districts as $d)
                                        {
                                        ?>
-                                               <input name="district[]" 
type="checkbox" value="<?php echo $d['part_of_town_id']?>" <?php echo 
(in_array($d['part_of_town_id'], $current_district_id_array) ? 'checked' : 
"")?>/><?php echo $d['name']?><br/>
+                                               <input name="district[]" 
type="checkbox" value="<?php echo $d['part_of_town_id']?>" /><?php echo 
$d['name']?><br/>
                                        <?php
                                        }
                                        ?>
@@ -303,7 +332,7 @@
                                        <dt><label for="arena_name"><?php echo 
lang('name') ?></label></dt>
                                        <dd><input type="text" 
name="arena_name" id="arena_name" /></dd>
                                        <dt><label for="arena_address"><?php 
echo lang('address') ?></label></dt>
-                                       <dd><input type="text" 
name="arena_address_txt" id="arena_address_txt" 
onkeyup="javascript:get_address_search_arena()"/>
+                                       <dd><input type="text" 
name="arena_address" id="arena_address" 
onkeyup="javascript:get_address_search_arena()"/>
                                        <div id="arena_address_container"></div>
                                        <label for="arena_number">Nummer</label>
                                        <input type="text" 
name="arena_number"/><br/>
@@ -335,7 +364,7 @@
                                </dd>
                                <dt>Kontaktinformasjon for kulturkontoret 
(*)</dt>
                                <dt><label 
for="contact2_address">Adresse</label>
-                               <dd><input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
+                               <dd><input type="text" name="contact2_address" 
id="contact2_address" onkeyup="javascript:get_address_search_cp2()"/>
                                <div id="contact2_address_container"></div></dd>
                                <dt><label 
for="contact2_number">Husnummer</label></dt>
                                <dd><input type="text" 
name="contact2_number"/></dd>

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_org.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_org.php
    2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_org.php
    2012-06-06 12:59:29 UTC (rev 9522)
@@ -22,18 +22,19 @@
 
 function get_address_search()
 {
-       var address = document.getElementById('address_txt').value;
+       var address = document.getElementById('address').value;
        var div_address = document.getElementById('address_container');
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = "<?php echo 
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"address\" id=\"address\" size\"5\">";
+var divcontent_start = "<select name=\"address_select\" id=\"address_select\" 
size=\"5\" onChange='setAddressValue(this)'>";
 var divcontent_end = "</select>";
        
        var callback = {
                success: function(response){
-                                       div_address.innerHTML = 
divcontent_start + JSON.parse(response.responseText) + divcontent_end; 
+                                       div_address.innerHTML = 
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
                                },
                failure: function(o) {
                                         alert("AJAX doesn't work"); //FAILURE
@@ -43,6 +44,15 @@
        
 }
 
+function setAddressValue(field)
+{
+       var address = document.getElementById('address');
+       var div_address = document.getElementById('address_container');
+
+       address.value=field.value;
+       div_address.style.display="none";
+}
+
 function allOK()
 {
        if(document.getElementById('orgname').value == null || 
document.getElementById('orgname').value == '')
@@ -137,7 +147,7 @@
                                <dt><label for="phone">Telefon (*)</label></dt>
                                <dd><input type="text" name="phone"/></dd>
                                <dt><label for="street">Gate (*)</label></dt>
-                               <dd><input type="text" name="address_txt" 
id="address_txt" onkeyup="javascript:get_address_search()"/>
+                               <dd><input type="text" name="address" 
id="address" onkeyup="javascript:get_address_search()"/>
                                <div id="address_container"></div></dd>
                                <dt><label for="number">Husnummer</label></dt>
                                <dd><input type="text" name="number"/><br/></dd>

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
   2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
   2012-06-06 12:59:29 UTC (rev 9522)
@@ -6,13 +6,14 @@
 <script type="text/javascript">
 function get_address_search()
 {
-       var address = document.getElementById('address_txt').value;
+       var address = document.getElementById('address').value;
        var div_address = document.getElementById('address_container');
+       div_address.style.display="block";
 
        //url = 
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
        url = 
"index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
 
-var divcontent_start = "<select name=\"address\" id=\"address\" size\"5\">";
+var divcontent_start = "<select name=\"address_select\" id=\"address_select\" 
size\"5\">";
 var divcontent_end = "</select>";
        
        var callback = {
@@ -27,6 +28,15 @@
        
 }
 
+function setAddressValue(field)
+{
+       var address = document.getElementById('address');
+       var div_address = document.getElementById('address_container');
+
+       address.value=field.value;
+       div_address.style.display="none";
+}
+
 function allOK()
 {
        if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
@@ -359,6 +369,7 @@
                                                <dd><input type="text" 
name="phone" value="<?php echo $organization->get_phone()?>"/></dd>
                                                <dt><label 
for="street">Gate</label></dt>
                                                <dd><input type="text" 
name="address" id="address" value="<?php echo $organization->get_address()?>"/>
+                                               <div 
id="address_container"></div></dd>
                                                <dt><label 
for="org_description">Beskrivelse</label></dt>
                                                <dd><textarea rows="10" 
cols="100" name="org_description"><?php echo 
$organization->get_description()?></textarea></dd>
                                        <hr/>

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-06-06 12:59:29 UTC (rev 9522)
@@ -145,7 +145,6 @@
                                
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
                                
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
                                
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
-               //              
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                                
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type', 
true), 'int'));
                                
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
@@ -188,7 +187,6 @@
                                
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
                                
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
                                
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
-                       //      
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                                
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
                                
@@ -255,7 +253,7 @@
                        }
                }
                
-               function register_control_to_location($control_id, $data)
+               public function register_control_to_location($control_id, $data)
                {
 
                        $control_id = (int) $control_id;
@@ -299,6 +297,76 @@
                        return $this->db->transaction_commit();
                }
 
+               public function check_control_component($control_id, 
$location_id, $component_id)
+               {
+                       $control_id             = (int) $control_id;
+                       $location_id    = (int) $location_id;
+                       $component_id   = (int) $component_id;
+                       $sql =  "SELECT * FROM 
controller_control_component_list WHERE control_id = {$control_id} AND 
location_id = {$location_id} AND component_id = {$component_id}";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       return $this->db->next_record();
+               }
+
+               function register_control_to_component($data)
+               {
+
+                       $delete_component = array();
+                       $add_component = array();
+                       $this->db->transaction_begin();
+
+                       if(isset($data['register_component']) && 
is_array($data['register_component']))
+                       {
+                               foreach($data['register_component'] as 
$component_info)
+                               {
+                                       $component_arr = explode('_', 
$component_info);
+                                       if(count($component_arr)!=3)
+                                       {
+                                               continue;
+                                       }
+                                       
+                                       $control_id             = (int) 
$component_arr[0];
+                                       $location_id    = (int) 
$component_arr[1];
+                                       $component_id   = (int) 
$component_arr[2];
+
+                                       if(!$control_id)
+                                       {
+                                               return false;
+                                       }
+
+                                       $sql =  "SELECT * FROM 
controller_control_component_list WHERE control_id = {$control_id} AND 
location_id = {$location_id} AND component_id = {$component_id}";
+                                       $this->db->query($sql, __LINE__, 
__FILE__);
+                       
+                                       if(!$this->db->next_record())
+                                       {
+                                               $sql =  "INSERT INTO 
controller_control_component_list (control_id, location_id, component_id) 
VALUES ( {$control_id}, {$location_id}, {$component_id})";
+                                               $this->db->query($sql);
+                                       }
+                               }
+                       }
+
+                       if(isset($data['delete']) && is_array($data['delete']))
+                       {
+                               foreach($data['delete'] as $component_info)
+                               {
+                                       $component_arr = explode('_', 
$component_info);
+                                       if(count($component_arr)!=3)
+                                       {
+                                               continue;
+                                       }
+                                       
+                                       $control_id             = (int) 
$component_arr[0];
+                                       $location_id    = (int) 
$component_arr[1];
+                                       $component_id   = (int) 
$component_arr[2];
+                               
+                                       $sql =  "DELETE FROM 
controller_control_component_list WHERE control_id = {$control_id} AND 
location_id = {$location_id} AND component_id = {$component_id}";
+                                       $this->db->query($sql);
+                               }
+                       }
+
+                       return $this->db->transaction_commit();
+               }
+
+
                function add_component_to_control($control_id, $component_id)
                {
                        $sql =  "INSERT INTO controller_control_component_list 
(control_id, component_id) values($control_id, $component_id)";
@@ -371,8 +439,6 @@
                        $condition =  join(' AND ', $clauses);
 
                        $tables = "controller_control";
-                       //$joins = " {$this->left_join} rental_document_types 
ON (rental_document.type_id = rental_document_types.id)";
-                       //$joins = " {$this->left_join} controller_control_area 
ON (controller_control.control_area_id = controller_control_area.id)";
                        $joins .= " {$this->left_join} controller_procedure ON 
(controller_control.procedure_id = controller_procedure.id)";
                        $joins .= " {$this->left_join} fm_responsibility_role 
ON (controller_control.responsibility_id = fm_responsibility_role.id)";
 
@@ -382,7 +448,7 @@
                        }
                        else
                        {
-                               $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, 
controller_control.procedure_id, controller_control.control_area_id, 
controller_control.requirement_id, controller_control.costresponsibility_id, 
controller_control.responsibility_id, controller_control.component_type_id, 
controller_control.component_id, controller_control.location_code, 
controller_control.repeat_type, controller_control.repeat_interval, 
controller_control.enabled, controller_procedure.title AS procedure_name, 
fm_responsibility_role.name AS responsibility_name ';
+                               $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, 
controller_control.procedure_id, controller_control.control_area_id, 
controller_control.requirement_id, controller_control.costresponsibility_id, 
controller_control.responsibility_id, controller_control.component_type_id, 
controller_control.component_id, controller_control.repeat_type, 
controller_control.repeat_interval, controller_control.enabled, 
controller_procedure.title AS procedure_name, fm_responsibility_role.name AS 
responsibility_name ';
                        }
 
                        $dir = $ascending ? 'ASC' : 'DESC';
@@ -422,7 +488,6 @@
        //                      
$control->set_control_group_id($this->unmarshal($this->db->f('control_group_id',
 true), 'int'));
                                
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
                                
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
-                               
//$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                                
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                                
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
                        }
@@ -466,7 +531,6 @@
                        $control->set_control_area_name($category[0]['name']);
                        
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
 true), 'int'));
                        
$control->set_component_id($this->unmarshal($this->db->f('component_id', true), 
'int'));
-       //              
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
                        
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                        
$control->set_repeat_type_label($control->get_repeat_type());
                        
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));

Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-06-06 12:59:29 UTC (rev 9522)
@@ -764,22 +764,18 @@
                        $value['ajax'] = array();
                        $value['actions'] = array();
                        $value['labels'] = array();
-                       //$value['parameters'] = array();
                        
                        $value['ajax'][] = false;
                        $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.view_control_details', 'id' => $value['control_id'])));
                        $value['labels'][] = lang('View control');
-                       //$value['parameters'][] = "control_id";
                        
                        $value['ajax'][] = false;
                        $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.view_locations_for_control', 'id' => 
$value['control_id'])));
                        $value['labels'][] = lang('View locations for control');
-                       //$value['parameters'][] = "control_id";
                        
                        $value['ajax'][] = false;
                        $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicheck_list.add_check_list', 'location_code' => 
$value['location_code'])));
                        $value['labels'][] = lang('add_check_list_to_location');
-                       //$value['parameters'][] = "control_id";
                }
                
                public function register_control_to_location()
@@ -826,11 +822,14 @@
                        $start_index    = phpgw::get_var('startIndex', 'int');
                        $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
                        $sort_field             = phpgw::get_var('sort');
+                       
                        if($sort_field == null)
                        {
                                $sort_field = 'control_group_id';
                        }
+                       
                        $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       
                        //Create an empty result set
                        $records = array();
                        
@@ -843,18 +842,11 @@
 
                        $result_objects = $this->so->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
                        $object_count = $this->so->get_count($search_for, 
$search_type, $filters);
-                       //var_dump($result_objects);
                                                                
                        $results = array();
                        
                        foreach($result_objects as $control_obj)
                        {
-/*                             $obj_serialized = $control_obj->serialize();
-                               $obj_serialized['show_locations'] = array(
-                                       'href' => 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.view_locations_for_control', 'id' => 
$result['location_id']))),
-                                       'label' => 
lang('show_controls_for_location')
-                               );
-                               $results['results'][] = $obj_serialized;*/
                                $results['results'][] = 
$control_obj->serialize();      
                        }
                        
@@ -863,7 +855,6 @@
                        $results['sort'] = $params['sort'];
                        $results['dir'] = $params['dir'];
 
-                       //array_walk($results["results"], array($this, 
"add_actions"), array($type));
                        array_walk($results["results"], array($this, 
"_add_links"), "controller.uicontrol.view_control_details");
                        
                        foreach($results["results"] as &$res) {

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php 
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php 
2012-06-06 12:59:29 UTC (rev 9522)
@@ -62,19 +62,22 @@
                private $so_check_item;
                private $so_procedure;
        
-               var $public_functions = array(
-                                                                               
'index'                                                         => true,
-                                                                               
'view_locations_for_control'            => true,
-                                                                               
'register_control_to_location'          => true,
-                                                                               
'register_control_to_location_2'        => true,
-                                                                               
'register_control_to_component'         => true,
-                                                                               
'get_locations_for_control'             => true,
-                                                                               
'get_location_category'                         => true,
-                                                                               
'get_district_part_of_town'                     => true,
-                                                                               
'entity'                                                        => true,
-                                                                               
'index2'                                                        => true,
-                                                                               
'get_category_by_entity'                        => true
-                                                                       );
+               var $public_functions = array
+               (
+                       'index'                                                 
        => true,
+                       'view_locations_for_control'            => true,
+                       'register_control_to_location'          => true,
+                       'register_control_to_location_2'        => true,
+                       'register_control_to_component'         => true,
+                       'edit_component'                                        
=> true,
+                       'get_locations_for_control'             => true,
+                       'get_location_category'                         => true,
+                       'get_district_part_of_town'                     => true,
+                       'query2'                                                
        => true,
+                       'get_category_by_entity'                        => true,
+                       'get_entity_table_def'                          => true,
+                       'get_locations'                                         
=> true
+               );
 
                function __construct()
                {
@@ -130,12 +133,23 @@
                        }
                        // END as categories
 
-                       $tabs = array( array(
-                                               'label' => 
lang('View_locations_for_control')
-                                       ), array(
-                                               'label' => 
lang('Add_locations_for_control'),
-                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.register_control_to_location'))
-                                       ));
+                       $tabs = array
+                       (
+                               array
+                               (
+                                       'label' => 
lang('View_locations_for_control')
+                               ),
+                                array
+                               (
+                                       'label' => 
lang('Add_locations_for_control'),
+                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.register_control_to_location'))
+                               ),
+                               array
+                               (
+                                       'label' => lang('add components for 
control'),
+                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.register_control_to_component'))
+                               )
+                       );
                        
                        $data = array(
                                'tabs'                                  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 0),
@@ -383,578 +397,6 @@
                
 
 
-               function register_control_to_component()
-               {
-                       $control_id = phpgw::get_var('control_id');
-                       if(phpgw::get_var('save_location'))
-                       {
-                               $values = phpgw::get_var('values');
-                               //add component to control using component item 
ID
-                               $values['control_location'] = 
isset($values['control_location']) && $values['control_location'] ? 
array_unique($values['control_location']) : array();
-                               $values['control_location_orig'] = 
isset($values['control_location_orig']) && $values['control_location_orig'] ? 
array_unique($values['control_location_orig']) : array();
-
-                               $ok = 
$this->so_control->register_control_to_location($control_id, $values);
-
-/*                             if($ok)
-                               {
-                                       return json_encode( array( "status" => 
"saved" ) );
-                               }
-                               else
-                               {
-                                       return json_encode( array( "status" => 
"not_saved" ) );
-                               }
-*/
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 
'controller.uicontrol_location.register_control_to_location', 'control_id' => 
$control_id));
-
-                       }
-                       else
-                       {
-                               if(phpgw::get_var('phpgw_return_as') == 'json') 
{
-                                       return $this->query();
-                               }
-                               $building_types  = 
execMethod('property.soadmin_location.read',array());
-                               //$type_id=phpgw::get_var('type_id');
-                               //if(!isset($type_id))
-                               $type_id = 1;
-                               
-                               $category_types = 
$this->bocommon->select_category_list(array(
-                                                                               
                                                                        
'format'=>'filter',
-                                                                               
                                                                        
'selected' => $this->cat_id,
-                                                                               
                                                                        'type' 
=>'location',
-                                                                               
                                                                        
'type_id' =>$type_id,
-                                                                               
                                                                        
'order'=>'descr'
-                                                                               
                                                                ));
-                               $default_value = array 
('id'=>'','name'=>lang('no category selected'));
-                               array_unshift($category_types,$default_value);
-                                                                               
                                                                
-                               $district_list  = 
$this->bocommon->select_district_list('filter',$this->district_id);
-                               $default_value = array 
('id'=>'','name'=>lang('no district'));
-                               array_unshift($district_list,$default_value);
-                               
-                               $part_of_town_list =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
-                               $default_value = array 
('id'=>'','name'=>lang('no part of town'));
-                               
array_unshift($part_of_town_list,$default_value);
-                               
-                               $_role_criteria = array
-                                               (
-                                                       'type'          => 
'responsibility_role',
-                                                       'filter'        => 
array('location_level' => (int)$type_id),
-                                                       'order'         => 
'name'
-                                               );
-       
-                               $responsibility_roles_list = 
execMethod('property.sogeneric.get_list',$_role_criteria);
-                               $default_value = array 
('id'=>'','name'=>lang('no role'));
-                               array_unshift 
($responsibility_roles,$default_value);
-                               
-                               $cats   = CreateObject('phpgwapi.categories', 
-1, 'controller', '.control');
-                               $cats->supress_info     = true;
-                               
-                               $control_areas = 
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl' 
=> $this->_category_acl));
-                                                               
-                               $control_areas_array = array();
-                               foreach($control_areas['cat_list'] as $cat_list)
-                               {
-                                       $control_areas_array[] = array
-                                       (
-                                               'id'    => $cat_list['cat_id'],
-                                               'name'  => $cat_list['name'],
-                                       );              
-                               }
-
-                               $control_info = 
execMethod('controller.socontrol.get_single', $control_id);
-                               if($control_info)
-                               {
-                                       $control_array = array
-                                       (
-                                               'id' => $control_id,
-                                               'title' => 
$control_info->get_title()
-                                       );
-                               }
-
-                               $tabs = array
-                               ( 
-                                       array
-                                       (
-                                               'label' => 
lang('View_locations_for_control'),
-                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.index'))
-                                       ),
-                                       array
-                                       (
-                                               'label' => 
lang('Add_locations_for_control'),
-                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.register_control_to_location'))
-                                       ),
-                                       array
-                                       (
-                                               'label' => lang('add components 
for control'),
-                                       )
-
-                               );
-                                               
-                               $data = array(
-                                       'tabs'                                  
        => $GLOBALS['phpgw']->common->create_tabs($tabs, 2),
-                                       'view'                                  
        => "register_control_to_location",
-                                       'control_id'                            
=> $control_id,
-                                       'control_filters'                       
=> array(
-                                               'control_areas_array'   => 
$control_areas_array,
-                                               'control_array'                 
        => $control_array
-                                       ),
-                                       'filter_form'                           
=> array(
-                                               'building_types'                
        => $building_types,
-                                               'category_types'                
        => $category_types,
-                                               'district_list'                 
        => $district_list,
-                                               'part_of_town_list'             
=> $part_of_town_list
-                                       ),
-                                       'datatable' => array(
-                                               'source' => 
self::link(array('menuaction' => 'controller.uicontrol_location.index', 
'phpgw_return_as' => 'json', 'view_type' => 
'register_control','control_id_init'    => $control_id)),
-                                               'field' => array(
-                                                       array(
-                                                               'key' => 
'location_registered',
-                                                               'hidden' => true
-                                                       ),
-                                                       array(
-                                                               'key' => 
'location_code',
-                                                               'label' => 
lang('Property'),
-                                                               'sortable'      
=> true,
-                                                               'formatter' => 
'YAHOO.portico.formatLink'
-                                                       ),
-                                                       array(
-                                                               'key'   =>      
'loc1_name',
-                                                               'label' =>      
lang('Property name'),
-                                                               'sortable'      
=>      false
-                                                       ),
-                                                       array(
-                                                               'key' => 
'adresse1',
-                                                               'label' => 
lang('Address'),
-                                                               'sortable'      
=> false
-                                                       ),
-                                                       array(
-                                                               'key' => 
'postnummer',
-                                                               'label' => 
lang('Zip code'),
-                                                               'sortable'      
=> false
-                                                       ),
-                                                       array(
-                                                               'key' => 
'control_name',
-                                                               'label' => 
lang('control'),
-                                                               'sortable'      
=> false
-                                                       ),
-                                                       array(
-                                                                       'key' 
=> 'checked',
-                                                                       'label' 
=> 'Velg',
-                                                                       
'sortable' => false,
-                                                                       
'formatter' => 'formatterCheckLocation',
-                                                                       
'className' => 'mychecks'
-                                                       ),
-                                                       array(
-                                                               'key' => 
'actions',
-                                                               'hidden' => true
-                                                       ),
-                                                       array(
-                                                               'key' => 
'labels',
-                                                               'hidden' => true
-                                                       ),
-                                                       array(
-                                                               'key' => 'ajax',
-                                                               'hidden' => true
-                                                       ),array(
-                                                               'key' => 
'parameters',
-                                                               'hidden' => true
-                                                       )                       
                        
-                                               )
-                                       )
-                               );
-                               
-                               phpgwapi_yui::load_widget('paginator');
-                               
-                               self::add_javascript('controller', 
'controller', 'jquery.js');
-                               self::add_javascript('controller', 
'controller', 'ajax.js');
-                               self::add_javascript('controller', 'yahoo', 
'register_control_to_location.js');
-       
-                               
self::render_template_xsl(array('control_location/control_location_tabs', 
'control_location/register_control_to_location', 'common'), $data);
-                       }               
-               }
-
-
-
-               function entity()
-               {
-                       $bocommon                                       = 
CreateObject('property.bocommon');
-                       $boentity                                       = 
CreateObject('property.boentity');
-                       $boadmin_entity                         = 
CreateObject('property.boadmin_entity');
-                       $this->start                            = 
$boentity->start;
-                       $this->query                            = 
$boentity->query;
-                       $this->sort                                     = 
$boentity->sort;
-                       $this->order                            = 
$boentity->order;
-                       $this->filter                           = 
$boentity->filter;
-                       $this->cat_id                           = 
$boentity->cat_id;
-                       $this->part_of_town_id          = 
$boentity->part_of_town_id;
-                       $this->district_id                      = 
$boentity->district_id;
-                       $this->entity_id                        = 
$boentity->entity_id;
-                       $this->location_code            = 
$boentity->location_code;
-                       $this->criteria_id                      = 
$boentity->criteria_id;
-
-                       $second_display = phpgw::get_var('second_display', 
'bool');
-                       $default_district       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
-
-                       if ($default_district && !$second_display && 
!$this->district_id)
-                       {
-                               $this->bo->district_id  = $default_district;
-                               $this->district_id              = 
$default_district;
-                       }
-
-                       if( phpgw::get_var('phpgw_return_as') != 'json' )
-                       {
-
-                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
-                                       (
-                                               'menuaction'            => 
'property.uilookup.entity',
-                                               'entity_id'                     
=> $this->entity_id,
-                                               'cat_id'                        
=> $this->cat_id,
-                                               'district_id'           => 
$this->district_id,
-                                               'query'                         
=> $this->query,
-                                               'filter'                        
=> $this->filter,
-                                               'location_code'         => 
$this->location_code,
-                                               'criteria_id'           => 
$this->criteria_id
-                                       ));
-
-                               $datatable['config']['allow_allrows'] = true;
-
-                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.entity',"
-                                       ."second_display:1,"
-                                       ."entity_id:'{$this->entity_id}',"
-                                       ."cat_id:'{$this->cat_id}',"
-                                       ."district_id:'{$this->district_id}',"
-                                       ."query:'{$this->query}',"
-                                       ."filter:'{$this->filter}',"
-                                       ."criteria_id:'{$this->criteria_id}',"
-                                       
."location_code:'{$this->location_code}'";
-
-                               $values_combo_box[0] = 
$boentity->select_category_list('filter',$this->cat_id);
-                               $default_value = array 
('id'=>'','name'=>lang('no category'));
-                               array_unshift 
($values_combo_box[0],$default_value);
-
-                               $values_combo_box[1]  = 
$bocommon->select_district_list('filter',$this->district_id);
-                               $default_value = array 
('id'=>'','name'=>lang('no district'));
-                               array_unshift 
($values_combo_box[1],$default_value);
-
-                               $values_combo_box[2]  = 
$boentity->get_criteria_list($this->criteria_id);
-                               $default_value = array 
('id'=>'','name'=>lang('no criteria'));
-                               array_unshift 
($values_combo_box[2],$default_value);
-
-                               $datatable['actions']['form'] = array
-                                       (
-                                               array
-                                               (
-                                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
-                                                       array
-                                                       (
-                                                               'menuaction'    
        => 'property.uilookup.entity',
-                                                               
'second_display'        => $second_display,
-                                                               'entity_id'     
                => $this->entity_id,
-                                                               'cat_id'        
                => $this->cat_id,
-                                                               'district_id'   
        => $this->district_id,
-                                                               'query'         
                => $this->query,
-                                                               'filter'        
                => $this->filter
-                                                       )
-                                               ),
-                                               'fields'        => array
-                                               (
-                                                       'field' => array
-                                                       (
-                                                               array
-                                                               ( //boton       
CATEGORY
-                                                                       'id' => 
'btn_cat_id',
-                                                                       'name' 
=> 'cat_id',
-                                                                       'value' 
=> lang('Category'),
-                                                                       'type' 
=> 'button',
-                                                                       'style' 
=> 'filter',
-                                                                       
'tab_index' => 1
-                                                               ),
-                                                               array
-                                                               ( //boton       
CATEGORY
-                                                                       'id' => 
'btn_district_id',
-                                                                       'name' 
=> 'district_id',
-                                                                       'value' 
=> lang('District'),
-                                                                       'type' 
=> 'button',
-                                                                       'style' 
=> 'filter',
-                                                                       
'tab_index' => 2
-                                                               ),
-                                                               array
-                                                               ( //boton       
search criteria
-                                                                       'id' => 
'btn_criteria_id',
-                                                                       'name' 
=> 'criteria_id',
-                                                                       'value' 
=> lang('search criteria'),
-                                                                       'type' 
=> 'button',
-                                                                       'style' 
=> 'filter',
-                                                                       
'tab_index' => 3
-                                                               ),
-                                                               array
-                                                               ( //boton  
SEARCH
-                                                                       'id' => 
'btn_search',
-                                                                       'name' 
=> 'search',
-                                                                       'value' 
   => lang('search'),
-                                                                       'type' 
=> 'button',
-                                                                       
'tab_index' => 5
-                                                               ),
-                                                               array
-                                                               ( // TEXT IMPUT
-                                                                       'name'  
   => 'query',
-                                                                       'id'    
 => 'txt_query',
-                                                                       'value' 
   => '',//'',//$query,
-                                                                       'type' 
=> 'text',
-                                                                       'size'  
  => 28,
-                                                                       
'onkeypress' => 'return pulsar(event)',
-                                                                       
'tab_index' => 4
-                                                               )
-                                                       ),
-                                                       'hidden_value' => array
-                                                       (
-                                                               array
-                                                               ( //div values  
combo_box_0
-                                                                       'id' => 
'values_combo_box_0',
-                                                                       'value' 
=> $bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
-                                                               ),
-                                                               array
-                                                               ( //div values  
combo_box_1
-                                                                       'id' => 
'values_combo_box_1',
-                                                                       'value' 
=> $bocommon->select2String($values_combo_box[1]) //i.e.  id,value/id,vale/
-                                                               ),
-                                                               array
-                                                               ( //div values  
combo_box_2
-                                                                       'id' => 
'values_combo_box_2',
-                                                                       'value' 
=> $bocommon->select2String($values_combo_box[2]) //i.e.  id,value/id,vale/
-                                                               )
-                                                       )
-                                               )
-                                       )
-                               );
-                       }
-
-                       $entity_list = $boentity->read(array('lookup'=>true));
-                       $input_name = 
$GLOBALS['phpgw']->session->appsession('lookup_fields','property');
-                       $uicols = $boentity->uicols;
-
-                       if (count($uicols['name']) > 0)
-                       {
-                               for ($m = 0; $m<count($input_name); $m++)
-                               {
-                                       if 
(!array_search($input_name[$m],$uicols['name']))
-                                       {
-                                               $uicols['name'][]       = 
$input_name[$m];
-                                               $uicols['descr'][]      = '';
-                                               $uicols['input_type'][]         
= 'hidden';
-                                       }
-                               }
-                       }
-                       else
-                       {
-
-                               $uicols['name'][]       = 'num';
-                               $uicols['descr'][]      = 'ID';
-                               $uicols['input_type'][]         = 'text';
-                       }
-
-                       $content = array();
-                       $j=0;
-                       if (isset($entity_list) && is_array($entity_list))
-                       {
-                               foreach($entity_list as $entity_entry)
-                               {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
-                                       {
-                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
($entity_entry[$uicols['name'][$i]] == null ? '' : 
$entity_entry[$uicols['name'][$i]]);
-                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
-
-                                               if(isset($uicols['datatype']) 
&& isset($uicols['datatype'][$i]) && $uicols['datatype'][$i]=='link' && 
$entity_entry[$uicols['name'][$i]])
-                                               {
-                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
-                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = lang('link');
-                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$entity_entry[$uicols['name'][$i]];
-                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
-                                               }
-                                       }
-
-                                       /*for ($i=0;$i<count($input_name);$i++)
-                                       {
-                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']    = 
$entity_entry[$input_name[$i]];
-                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']     = $input_name[$i];
-                                       }*/
-                                       $j++;
-                               }
-                       }
-
-                       $uicols_count   = count($uicols['descr']);
-                       $datatable['rowactions']['action'] = array();
-                       for ($i=0;$i<$uicols_count;$i++)
-                       {
-                               //all colums should be have formatter
-                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
-
-                               if($uicols['input_type'][$i]!='hidden')
-                               {
-                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
-                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
-                                       
$datatable['headers']['header'][$i]['visible']                  = true;
-                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
-
-                                       if($uicols['name'][$i]=='loc1' || 
$uicols['name'][$i]=='num')
-                                       {
-                                               
$datatable['headers']['header'][$i]['sortable']         = true;
-                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
-                                       }
-                               }
-                               else
-                               {
-                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
-                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
-                                       
$datatable['headers']['header'][$i]['visible']                  = false;
-                                       
$datatable['headers']['header'][$i]['sortable']         = false;
-                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
-                               }
-                       }
-
-                       $function_exchange_values = '';
-
-                       for ($i=0;$i<count($input_name);$i++)
-                       {
-                               $function_exchange_values .= 
"opener.document.getElementsByName('{$input_name[$i]}')[0].value = '';\r\n";
-                       }
-
-                       for ($i=0;$i<count($input_name);$i++)
-                       {
-                               $function_exchange_values .= 
"opener.document.getElementsByName('{$input_name[$i]}')[0].value = 
data.getData('{$input_name[$i]}');\r\n";
-                       }
-
-                       $function_exchange_values .= 'window.close()';
-
-                       $datatable['exchange_values'] = 
$function_exchange_values;
-                       $datatable['valida'] = '';
-
-                       // path for property.js
-                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
-
-                       // Pagination and sort values
-                       $datatable['pagination']['records_start']       = 
(int)$this->start;
-                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       $datatable['pagination']['records_returned']= 
count($entity_list);
-                       $datatable['pagination']['records_total']       = 
$boentity->total_records;
-
-                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
-                       {
-                               $datatable['sorting']['order']                  
= 'num'; // name key Column in myColumnDef
-                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
-                       }
-                       else
-                       {
-                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
-                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
-                       }
-
-
-                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
-
-                       //values for Pagination
-                       $json = array
-                               (
-                                       'recordsReturned'       => 
$datatable['pagination']['records_returned'],
-                                       'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
-                                       'startIndex'            => 
$datatable['pagination']['records_start'],
-                                       'sort'                          => 
$datatable['sorting']['order'],
-                                       'dir'                           => 
$datatable['sorting']['sort'],
-                                       'records'                       => 
array(),
-                                       'headers'                       => 
$uicols
-
-                               );
-
-                       // values for datatable
-                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
-                               foreach( $datatable['rows']['row'] as $row )
-                               {
-                                       $json_row = array();
-                                       foreach( $row['column'] as $column)
-                                       {
-                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
-                                               {
-                                                       
$json_row[$column['name']] = "<a href='#' id='{$column['link']}' 
onclick='javascript:filter_data(this.id);'>{$column['value']}</a>";
-                                               }
-                                               else 
if(isset($column['format']) && $column['format']== "link")
-                                               {
-                                                       
$json_row[$column['name']] = "<a href='{$column['link']}' 
target='_blank'>{$column['value']}</a>";
-                                               }
-                                               else
-                                               {
-                                                       
$json_row[$column['name']] = $column['value'];
-                                               }
-                                       }
-                                       $json['records'][] = $json_row;
-                               }
-                       }
-
-                       // right in datatable
-                       if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
-                       {
-                               $json ['rights'] = 
$datatable['rowactions']['action'];
-                       }
-
-                       if( phpgw::get_var('phpgw_return_as') == 'json' )
-                       {
-                               return $json;
-                       }
-
-                       $datatable['json_data'] = json_encode($json);
-                       //-------------------- JSON CODE ----------------------
-
-                       // Prepare template variables and process XSLT
-                       $template_vars = array();
-                       $template_vars['datatable'] = $datatable;
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'),PHPGW_SERVER_ROOT . 
'/phpgwapi/templates/base');
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
$template_vars);
-
-                       if($this->entity_id)
-                       {
-                               $entity         = 
$boadmin_entity->read_single($this->entity_id,false);
-                               $appname        = $entity['name'];
-                       }
-                       if($this->cat_id)
-                       {
-                               $category = 
$boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
-                               $function_msg                                   
= lang('lookup') . ' ' . $category['name'];
-                       }
-
-                       //Title of Page
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
-                       // Prepare YUI Library
-                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.entity.index', 'property' );
-
-                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-
-                       phpgwapi_yui::load_widget('tabview');
-                       phpgwapi_yui::load_widget('dragdrop');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('menu');
-                       phpgwapi_yui::load_widget('connection');
-                       phpgwapi_yui::load_widget('loader');
-                       phpgwapi_yui::load_widget('tabview');
-                       phpgwapi_yui::load_widget('paginator');
-                       phpgwapi_yui::load_widget('animation');
-
-                       if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
-                       {
-                               $GLOBALS['phpgw']->css = 
createObject('phpgwapi.css');
-                       }
-                       // Prepare CSS Style
-                       $GLOBALS['phpgw']->css->validate_file('datatable');
-                       $GLOBALS['phpgw']->css->validate_file('property');
-                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
-
-//                     $this->save_sessiondata();
-               }
-
-
                // Returns locations for a control
                public function get_locations_for_control()
                {
@@ -1118,7 +560,7 @@
                        return $category_list;
                }
 
-               function index2()
+               function register_control_to_component()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $receipt = array();
@@ -1143,93 +585,20 @@
                        $datavalues[] = array
                        (
                                'name'                          => "0",
-                               'values'                        => 
$this->query2(),//json_encode(array()),
+                               'values'                        => 
json_encode(array()),
                                'total_records'         => 0,
                                'permission'            => "''",
-                               'is_paginator'          => 0,
+                               'is_paginator'          => 1,
                                'edit_action'           => "''",
                                'footer'                        => 0
                        );
 
-                       $datatable = array
-                       (
-                               array
-                               (
-                               'key' => 'id',
-                               'hidden' => true
-                               ),
-                               array
-                               (
-                                       'key' => 'user',
-                                       'label' => lang('user'),
-                                       'sortable' => false
-                               ),
-                               array
-                               (
-                                       'key' => 'ecodimb',
-                                       'label' => lang('dim b'),
-                                       'sortable' => false,
-                                       'formatter' => 'FormatterRight',
-                               ),
-                               array
-                               (
-                                       'key'   =>      'role',
-                                       'label' =>      lang('role'),
-                                       'formatter' => 'FormatterRight',
-                                       'sortable'      =>      true
-                               ),
-                               array
-                               (
-                                       'key' => 'default_user',
-                                       'label' => lang('default'),
-                                       'sortable'      => false,
-                                       'formatter' => 'FormatterCenter',
-                               ),
-                               array
-                               (
-                                       'key' => 'active_from',
-                                       'label' => lang('date from'),
-                                       'sortable'      => true,
-                                       'formatter' => 'FormatterRight',
-                               ),
-                               array
-                               (
-                                       'key' => 'active_to',
-                                       'label' => lang('date to'),
-                                       'sortable' => false,
-                                       'formatter' => 'FormatterCenter',
-                               ),
-                               array
-                               (
-                                       'key' => 'add',
-                                       'label' => lang('add'),
-                                       'sortable' => false,
-                                       'formatter' => 'FormatterCenter',
-                               ),
-                               array
-                               (
-                                       'key' => 'delete',
-                                       'label' => lang('delete'),
-                                       'sortable' => false,
-                                       'formatter' => 'FormatterCenter',
-                               ),
-                               array
-                               (
-                                       'key' => 'alter_date',
-                                       'label' => lang('alter_date'),
-                                       'sortable' => false,
-                                       'formatter' => 'FormatterCenter',
-                               ),
-                       );
-
                        $myColumnDefs[0] = array
                        (
                                'name'          => "0",
-                               'values'        =>      json_encode($datatable)
+                               'values'        =>      json_encode(array())
                        );      
 
-
-
                        $GLOBALS['phpgw']->translation->add_app('property');
                        $entity                 = 
CreateObject('property.soadmin_entity');
                        $entity_list    = $entity->read(array('allrows' => 
true));
@@ -1240,14 +609,8 @@
 
                        array_unshift($entity_list ,array 
('id'=>'','name'=>lang('select')));
                        array_unshift($district_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift($part_of_town_list ,array 
('id'=>'','name'=>lang('select')));
 
-
-
-                       array_unshift ($role_list ,array 
('id'=>'','name'=>lang('select')));
-                       array_unshift ($dimb_list ,array 
('id'=>'','name'=>lang('select')));
-
-
-
                        $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
                        $cats->supress_info     = true;
 
@@ -1266,8 +629,27 @@
 
                        array_unshift ($control_area_list ,array 
('id'=>'','name'=>lang('select')));
 
+                       $tabs = array
+                       ( 
+                               array
+                               (
+                                       'label' => 
lang('View_locations_for_control'),
+                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.index'))
+                               ),
+                               array
+                               (
+                                       'label' => 
lang('Add_locations_for_control'),
+                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.register_control_to_location'))
+                               ),
+                               array
+                               (
+                                       'label' => lang('add components for 
control')
+                               )
+                       );
+                                       
                        $data = array
                        (
+                               'tabs'                                          
        => $GLOBALS['phpgw']->common->create_tabs($tabs, 2),
                                'td_count'                                      
        => '""',
                                'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                'datatable'                                     
        => $datavalues,
@@ -1282,14 +664,11 @@
                                                                                
                                'district_list'         => array('options' => 
$district_list),
                                                                                
                                'part_of_town_list'     => array('options' => 
$part_of_town_list),
                                                                                
                        ),
-                               'update_action'                                 
=> self::link(array('menuaction' => 'controller.uicontrol_location.edit'))
+                               'update_action'                                 
=> self::link(array('menuaction' => 
'controller.uicontrol_location.edit_component'))
                        );
 
-                       $GLOBALS['phpgw']->jqcal->add_listener('query_start');
-                       $GLOBALS['phpgw']->jqcal->add_listener('query_end');
-                       $GLOBALS['phpgw']->jqcal->add_listener('active_from');
-                       $GLOBALS['phpgw']->jqcal->add_listener('active_to');
 
+
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
@@ -1312,47 +691,112 @@
                }
        
 
+               public function get_entity_table_def()
+               {
+                       $entity_id                      = 
phpgw::get_var('entity_id', 'int');
+                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
+                       $boentity       = 
CreateObject('property.boentity',false, 'entity');
+                       $boentity->read(array('dry_run' => true));
+                       $uicols = $boentity->uicols;
+                       $columndef = array();
+
+                       $columndef[] = array
+                       (
+                               'key'           => 'select',
+                               'label'         => lang('select'),
+                               'sortable'      => true,
+                               'formatter'     => false,
+                               'hidden'        => false,
+                               'formatter' => '',
+                               'className' => ''
+                       );
+
+                       $columndef[] = array
+                       (
+                               'key'           => 'delete',
+                               'label'         => lang('delete'),
+                               'sortable'      => false,
+                               'formatter'     => false,
+                               'hidden'        => false,
+                               'formatter' => '',
+                               'className' => ''
+                       );
+
+                       $count_fields =count($uicols['name']);
+
+                       for ($i=0;$i<$count_fields;$i++)
+                       {
+                               $columndef[] = array
+                               (
+                                       'key'           => $uicols['name'][$i],
+                                       'label'         => $uicols['descr'][$i],
+                                       'sortable'      => 
$uicols['sortable'][$i],
+                                       'formatter'     => 
$uicols['formatter'][$i],
+                                       'hidden'        => 
$uicols['input_type'][$i] == 'hidden' ? true : false ,               
+                                       'className'     => 
$uicols['classname'][$i],
+                               );
+                       }
+
+//_debug_array($columndef);
+                       return $columndef;
+               }
+
+
+               public function get_locations()
+               {
+                       $location_code = phpgw::get_var('location_code');
+                       $child_level = phpgw::get_var('child_level', 'int', 
'REQUEST', 1);
+                       $part_of_town_id = phpgw::get_var('part_of_town_id', 
'int');
+
+                       $criteria = array
+                       (
+                               'location_code'         => $location_code,
+                               'child_level'           => $child_level,
+                               'field_name'            => 
"loc{$child_level}_name",
+                               'part_of_town_id'       => $part_of_town_id
+                       );
+       
+                       $locations = 
execMethod('property.solocation.get_children',$criteria);
+                       return $locations;
+               }
+
+
+
                public function query2()
                {
-                       $user_id =      phpgw::get_var('user_id', 'int');
-                       $dimb_id =      phpgw::get_var('dimb_id', 'int');
-                       $role_id =      phpgw::get_var('role_id', 'int');
-                       $query_start =  phpgw::get_var('query_start');
-                       $query_end =    phpgw::get_var('query_end');
+                       $entity_id                      = 
phpgw::get_var('entity_id', 'int');
+                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
+                       $district_id            = phpgw::get_var('district_id', 
'int');
+                       $part_of_town_id        = 
phpgw::get_var('part_of_town_id', 'int');
+                       $control_id                     = 
phpgw::get_var('control_id', 'int');
 
-//                     $this->bo->allrows = true;
-                       $values = $this->bo->read(array('user_id' => $user_id, 
'dimb_id' => $dimb_id, 'role_id' => $role_id, 'query_start' => $query_start, 
'query_end' => $query_end));
+                       if(!$entity_id && !$cat_id)
+                       {
+                               return json_encode(array());
+                       }
 
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+                       $boentity       = 
CreateObject('property.boentity',false, 'entity');
+                       $boentity->allrows = true;
+                       
+                       $values = $boentity->read();
+
                        foreach($values as &$entry)
                        {
-                               if($entry['active_from'])
+                               $checked = '';
+                               
if($this->so_control->check_control_component($control_id,$location_id,$entry['id']))
                                {
-                                       $default_user_checked = 
$entry['default_user'] == 1 ? 'checked = "checked"' : '';
-                                       $entry['default_user'] = "<input 
id=\"default_user\" type =\"checkbox\" $default_user_checked 
name=\"values[default_user][]\" value=\"{$entry['id']}\">";
-                                       $entry['delete'] = "<input 
id=\"delete\" type =\"checkbox\" name=\"values[delete][]\" 
value=\"{$entry['id']}\">";
-                                       $entry['alter_date'] = "<input 
id=\"alter_date\" type =\"checkbox\" name=\"values[alter_date][]\" 
value=\"{$entry['id']}\">";
-                                       $entry['add'] = '';
+                                       $checked =  'checked = "checked" 
disabled = "disabled"';
+                                       $entry['delete'] = "<input class 
=\"mychecks_delete\" type =\"checkbox\" name=\"values[delete][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
                                }
-                               else
-                               {
-                                       $entry['default_user'] = '';
-                                       $entry['delete'] = '';
-                                       $entry['alter_date'] = '';
-                                       $entry['add'] = "<input id=\"add\" type 
=\"checkbox\" name=\"values[add][]\" 
value=\"{$entry['ecodimb']}_{$entry['role_id']}_{$entry['user_id']}\">";        
                   
-                               }
-                               $results['results'][]= $entry;
+                               $entry['select'] = "<input class 
=\"mychecks_add\" type =\"checkbox\" $checked 
name=\"values[register_component][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
                        }
 
                        return json_encode($values);
                }
 
-               public function edit()
+               public function edit_component()
                {
-                       $user_id =      phpgw::get_var('user_id', 'int');
-                       $dimb_id =      phpgw::get_var('dimb_id', 'int');
-                       $role_id =      phpgw::get_var('role_id', 'int');
-                       $query =        phpgw::get_var('query');
-
                        if($values = phpgw::get_var('values'))
                        {
                                if(!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_EDIT, 'property'))
@@ -1362,7 +806,8 @@
                                }
                                if(!$receipt['error'])
                                {
-                                       if($this->bo->edit($values))
+
+                                       
if($this->so_control->register_control_to_component($values))
                                        {
                                                $result =  array
                                                (
@@ -1394,7 +839,7 @@
                        }
                        else
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_location.index2', 'user_id' => 
$user_id, 'dimb_id' => $dimb_id, 'role_id' => $role_id, 'query' => $query));
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 
'controller.uicontrol_location.register_control_to_component'));
                        }
                }
        }

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-06-06 12:59:29 UTC (rev 9522)
@@ -1,5 +1,14 @@
 $(document).ready(function(){
 
+       
+       function ajaxRequest(request, callback_func, elem){
+               
+               
+       }
+       
+       
+       /* ================================  SEARCH LOCATION BOX  
========================== */
+       
        // Changes location level between building and property in serch 
location select box
        $("#choose-loc a").click(function(){
                
@@ -16,27 +25,6 @@
                return false;
        });
 
-       // Changes control type location level between building and property in 
serch location select box
-       $(".control_item_type").click(function(){
-               var thisBtn = $(this).find(".btn");
-               var thisRadio = $(this).find("input[type=radio]");
-               
-               // Clears active button and checked underlying radiobutton
-               
$(".control_item_type").find("input[type=radio]").removeAttr("checked");
-               $(".control_item_type").find(".btn").removeClass("active");
-               
-               // Makes button active and checkes underlying radiobutton
-               $(thisRadio).attr("checked", "checked");
-               $(thisBtn).addClass("active");
-               
-               var control_item_type = $(this).find("input[type=radio]").val();
-               
-               if(control_item_type == "control_item_type_3" | 
control_item_type == "control_item_type_4"){
-                       $("#add_control_item_option_panel").slideDown(500);
-               }else if(control_item_type == "control_item_type_1" | 
control_item_type == "control_item_type_2"){
-                       $("#add_control_item_option_panel").slideUp(500);
-               }
-       });
        
        $(".selectLocation").change(function () {
                 var location_code = $(this).val();
@@ -62,6 +50,8 @@
                 window.location.href = requestUrl;
     });
        
+       /* ================================  CONTROL LOCATION 
================================== */
+       
        // Update location category based on location type
        $("#type_id").change(function () {
                var location_type_id = $(this).val();
@@ -97,36 +87,6 @@
                        
     });
        
-       //update part of town category based on district
-       $("#district_id").change(function () {
-               var district_id = $(this).val();
-                var oArgs = 
{menuaction:'controller.uicontrol_location.get_district_part_of_town'};
-                var requestUrl = phpGWLink('index.php', oArgs, true);
-         //var requestUrl = 
"index.php?menuaction=controller.uicontrol.get_controls_by_control_area&phpgw_return_as=json"
-         
-         var htmlString = "";
-         
-         $.ajax({
-                         type: 'POST',
-                         dataType: 'json',
-                         url: requestUrl + "&district_id=" + district_id,
-                         success: function(data) {
-                                 if( data != null){
-                                         var obj = jQuery.parseJSON(data);
-                                               
-                                         $.each(obj, function(i) {
-                                                 htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
-                                       });
-                                                                               
                          
-                                         $("#part_of_town_id").html( 
htmlString );
-                                       }else {
-                                       htmlString  += "<option>Ingen 
kontroller</option>"
-                                       $("#part_of_town_id").html( htmlString 
);
-                               }
-                         }  
-         });
-    });
-       
        $("#control_area_list").change(function () {
                var control_area_id = $(this).val();
                 var oArgs = 
{menuaction:'controller.uicontrol.get_controls_by_control_area'};
@@ -168,11 +128,9 @@
                        
     });
 
-       $("#control_id").change(function () {
-               var control_id = $(this).val();
-               $("#hidden_control_id").val( control_id );
-    });
 
+       /* ================================  COMPONENT 
================================== */
+       
        // file: uicheck_list.xsl
        // When control area is selected, controls are fetched from db and 
control select list is populated
        $("#control_group_area_list").change(function () {
@@ -180,8 +138,6 @@
             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({
@@ -207,40 +163,34 @@
                        
     });
        
-       // 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'};
+       //update part of town category based on district
+       $("#district_id").change(function () {
+               var district_id = $(this).val();
+                var oArgs = 
{menuaction:'controller.uicontrol_location.get_district_part_of_town'};
                 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 requestUrl = 
"index.php?menuaction=controller.uicontrol.get_controls_by_control_area&phpgw_return_as=json"
          
          var htmlString = "";
          
          $.ajax({
                          type: 'POST',
                          dataType: 'json',
-                         url: requestUrl + "&control_area_id=" + 
control_area_id,
+                         url: requestUrl + "&district_id=" + district_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>";
+                                                 htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
                                        });
                                                                                
                          
-                                         $("#control_group").html( htmlString 
);
+                                         $("#part_of_town_id").html( 
htmlString );
                                        }else {
-                                       htmlString  += "<option>Ingen 
kontrollgrupper</option>"
-                                       $("#control_group").html( htmlString );
+                                       htmlString  += "<option>Ingen 
kontroller</option>"
+                                       $("#part_of_town_id").html( htmlString 
);
                                }
                          }  
-                       });
-                       
+         });
     });
        
        // file: add_component_to_control.xsl
@@ -277,12 +227,13 @@
                        
     });
        
+       /* ================================  PROCEDURE 
================================== */
+       
        $("#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 = "";
          
@@ -310,6 +261,42 @@
                        });     
     });
        
+       /* ================================  CONTROL AREA 
================================== */
+       
+       // When control area is selected, control groups 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 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 );
+                               }
+                         }  
+                       });
+                       
+    });
+       
        /* ================================  CONTROL GROUP 
================================== */
                        
        $("#frm_save_control_groups").submit(function(e){
@@ -324,6 +311,39 @@
        
        /* ================================  CONTROL ITEM 
================================== */
        
+       if( $("#frm_control_items").length > 0 ){
+               var check_box_arr = 
$("#frm_control_items").find("input[type='checkbox']");
+               
+               $(check_box_arr).each(function(index) {
+                       var check_box = check_box_arr[index];
+                       
+                       if( $(check_box).is(':checked') ){
+                               var chbox_id = $(check_box).attr("id");
+                               
+                               var control_group_id = chbox_id.substring( 
chbox_id.indexOf("_")+1, chbox_id.indexOf(":") );
+                               var control_item_id = chbox_id.substring( 
chbox_id.indexOf(":")+1,  chbox_id.length );
+                               
+                               $("#frm_control_items").prepend("<input 
type='hidden' id=hid_" + control_item_id +  " name='control_tag_ids[]' value=" 
+ control_group_id + ":" +  control_item_id + " />");
+                       }
+               });
+       }
+       
+       
+       $("#frm_control_items input[type='checkbox']").click(function(){
+               var thisCbox = $(this);
+               
+               var chbox_id = $(thisCbox).attr("id");
+               
+               var control_group_id = chbox_id.substring( 
chbox_id.indexOf("_")+1, chbox_id.indexOf(":") );
+               var control_item_id = chbox_id.substring( 
chbox_id.indexOf(":")+1,  chbox_id.length );
+               
+               if ($("#hid_" + control_item_id).length > 0){
+                       $("#hid_" + control_item_id).remove();
+               }else{
+                       $("#frm_control_items").prepend("<input type='hidden' 
id=hid_" + control_item_id +  " name='control_tag_ids[]' value=" + 
control_group_id + ":" +  control_item_id + " />");
+               }
+       });
+       
        $("#frm_control_items").submit(function(e){
                var thisForm = $(this);
                var num_checked = $(this).find("input:checked").length;
@@ -334,18 +354,32 @@
                }
        });
        
-       $("#frm_save_control_details input").focus(function(e){
-               
$("#frm_save_control_details").find(".focus").removeClass("focus");
-               $(this).addClass("focus");
-       });
+       
+       
+       /* =========================  CONTROL OPTION 
======================================== */
+         
+       // Changes control type location level between building and property in 
search location select box
+       $(".control_item_type").click(function(){
+               var thisBtn = $(this).find(".btn");
+               var thisRadio = $(this).find("input[type=radio]");
                
-       $("#frm_save_control_details select").focus(function(e){
-               
$("#frm_save_control_details").find(".focus").removeClass("focus");
-               $(this).addClass("focus");
+               // Clears active button and checked underlying radiobutton
+               
$(".control_item_type").find("input[type=radio]").removeAttr("checked");
+               $(".control_item_type").find(".btn").removeClass("active");
+               
+               // Makes button active and checkes underlying radiobutton
+               $(thisRadio).attr("checked", "checked");
+               $(thisBtn).addClass("active");
+               
+               var control_item_type = $(this).find("input[type=radio]").val();
+               
+               if(control_item_type == "control_item_type_3" | 
control_item_type == "control_item_type_4"){
+                       $("#add_control_item_option_panel").slideDown(500);
+               }else if(control_item_type == "control_item_type_1" | 
control_item_type == "control_item_type_2"){
+                       $("#add_control_item_option_panel").slideUp(500);
+               }
        });
        
-       /* =========================  CONTROL OPTION 
======================================== */
-       
        $("#add_control_item_list_value input[type=button]").live("click", 
function(e){
                e.preventDefault();
                
@@ -365,6 +399,21 @@
        
        /* =========================  CONTROL  
=============================================== */
        
+       $("#control_id").change(function () {
+               var control_id = $(this).val();
+               $("#hidden_control_id").val( control_id );
+    });
+
+       $("#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");
+       });
+       
        // SAVE CONTROL DETAILS
        $("#frm_save_control_details").submit(function(e){
                

Modified: 
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
===================================================================
--- 
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
   2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/js/controller/ajax_control_to_component.js
   2012-06-06 12:59:29 UTC (rev 9522)
@@ -5,21 +5,21 @@
                var control_area_id = $(this).val();
                 var oArgs = 
{menuaction:'controller.uicontrol.get_controls_by_control_area'};
                 var requestUrl = phpGWLink('index.php', oArgs, true);
-        
+
        //      $("#hidden_control_area_id").val( control_area_id );
     //     var control_id_init = $("#hidden_control_id").val();
          var htmlString = "";
-         
+
          $.ajax({
-                         type: 'POST',
-                         dataType: 'json',
-                         url: requestUrl + "&control_area_id=" + 
control_area_id,
-                         success: function(data) {
-                                 if( data != null){
-                                         htmlString  = "<option>Velg 
kontroll</option>"
-                                         var obj = jQuery.parseJSON(data);
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_area_id=" + control_area_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
kontroll</option>"
+                                       var obj = jQuery.parseJSON(data);
                                                
-                                         $.each(obj, function(i) {
+                                       $.each(obj, function(i) {
 
                                                var selected = '';
 /*
@@ -29,17 +29,17 @@
                                                }
 */
                                                        htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
-                                       });
-                                                                               
                          
-                                         $("#control_id").html( htmlString );
+                                       });
+                                                                               
                        
+                                       $("#control_id").html( htmlString );
                                        }
                                        else
                                        {
-                                       htmlString  += "<option>Ingen 
kontroller</option>"
-                                       $("#control_id").html( htmlString );
-//                                             
$("#hidden_control_id").val(-1); //reset
-                               }
-                         }  
+                                       htmlString  += "<option>Ingen 
kontroller</option>"
+                                       $("#control_id").html( htmlString );
+//                                             
$("#hidden_control_id").val(-1); //reset
+                               }
+                       }
                        });
                        
     });
@@ -49,19 +49,20 @@
        $("#entity_id").change(function () {
                 var oArgs = 
{menuaction:'controller.uicontrol_location.get_category_by_entity', entity_id: 
$(this).val()};
                 var requestUrl = phpGWLink('index.php', oArgs, true);
-        
+
          var htmlString = "";
-         
+
          $.ajax({
-                         type: 'POST',
-                         dataType: 'json',
-                         url: requestUrl,
-                         success: function(data) {
-                                 if( data != null){
-                                         htmlString  = "<option>Velg</option>"
-                                         var obj = data;
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option 
value=''>Velg</option>"
+                                       var obj = data;
 
-                                         $.each(obj, function(i) {
+                                       $.each(obj, function(i)
+                                       {
 
                                                var selected = '';
 /*
@@ -71,16 +72,17 @@
                                                }
 */
                                                        htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
-                                       });
-                                                                               
                          
-                                         $("#category_id").html( htmlString );
+                                       });
+                                                                               
                        
+                                       $("#cat_id").html( htmlString );
+       //                              update_component_table();
                                        }
                                        else
                                        {
-                                       htmlString  += "<option>Ingen 
kontroller</option>"
-                                       $("#category_id").html( htmlString );
-                               }
-                         }  
+                                       htmlString  += "<option>Ingen 
kontroller</option>"
+                                       $("#cat_id").html( htmlString );
+                               }
+                       }
                        });
                        
     });
@@ -91,53 +93,128 @@
                var district_id = $(this).val();
                 var oArgs = 
{menuaction:'controller.uicontrol_location.get_district_part_of_town'};
                 var requestUrl = phpGWLink('index.php', oArgs, true);
-         
+
          var htmlString = "";
-         
+
          $.ajax({
-                         type: 'POST',
-                         dataType: 'json',
-                         url: requestUrl + "&district_id=" + district_id,
-                         success: function(data) {
-                                 if( data != null){
-                                         var obj = jQuery.parseJSON(data);
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&district_id=" + district_id,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       var obj = jQuery.parseJSON(data);
                                                
-                                         $.each(obj, function(i) {
-                                                 htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
-                                       });
-                                                                               
                          
-                                         $("#part_of_town_id").html( 
htmlString );
-                                       }else {
-                                       htmlString  += "<option>Ingen 
kontroller</option>"
-                                       $("#part_of_town_id").html( htmlString 
);
-                               }
-                         }  
+                                       $.each(obj, function(i)
+                                       {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+                                                                               
                        
+                                       $("#part_of_town_id").html( htmlString 
);
+                               $("#loc1").html( "<option 
value=''>Velg</option>" );
+                               $("#loc2").html( "<option 
value=''>Velg</option>" );
+                               }
+                               else
+                               {
+                               htmlString  += "<option value=''>Velg</option>";
+                               $("#part_of_town_id").html( htmlString );
+                               $("#loc1").html( htmlString );
+                               $("#loc2").html( htmlString );
+                       }
+                       }
          });
     });
 
 
+       $("#part_of_town_id").change(function ()
+       {
+                var oArgs = 
{menuaction:'controller.uicontrol_location.get_locations', child_level:1, 
part_of_town_id: $(this).val()};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
 
+         var htmlString  = "<option value=''>Velg</option>";
 
-       $("#dimb_id").change(function ()
+         $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       var obj = data;
+                                               
+                                       $.each(obj, function(i)
+                                       {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" +  obj[i].id + " " + obj[i].name + "</option>";
+                                       });
+                                                                               
                        
+                                       $("#loc1").html( htmlString );
+                               $("#loc2").html( "<option 
value=''>Velg</option>" );
+                                       }
+                                       else
+                                       {
+                                       htmlString  = "<option>Ingen</option>";
+                                       $("#loc1").html( htmlString );
+                                       $("#loc2").html(htmlString);
+                               }
+                       }
+         });
+
+    });
+
+       $("#loc1").change(function ()
        {
-               update_dimb_role_user_table();
+                var oArgs = 
{menuaction:'controller.uicontrol_location.get_locations', child_level:2, 
location_code: $(this).val()};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+         var htmlString  = "<option value=''>Velg</option>";
+
+         $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       var obj = data;
+                                               
+                                       $.each(obj, function(i)
+                                       {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" +  obj[i].id + " " + obj[i].name + "</option>";
+                                       });
+                                                                               
                        
+                                       $("#loc2").html( htmlString );
+                                       }
+                                       else
+                                       {
+                                       htmlString  = "<option>Ingen</option>";
+                                       $("#loc2").html( htmlString );
+                               }
+                       }
+         });
+
     });
 
-       $("#user_id").change(function ()
+
+
+       $("#control_id").change(function ()
        {
-               update_dimb_role_user_table();
+               update_component_table();
     });
 
-       $("#role_id").change(function ()
+
+       $("#cat_id").change(function ()
        {
-               update_dimb_role_user_table();
+               get_table_def();
     });
 
+
+
        $("#search").click(function(e)
        {
-               update_dimb_role_user_table();
+               update_component_table();
     });
 
+
        $("#acl_form").live("submit", function(e){
                e.preventDefault();
                var thisForm = $(this);
@@ -155,62 +232,114 @@
                                                return;
                                        }
 
-                               var obj = data;
-                       
-                               var submitBnt = 
$(thisForm).find("input[type='submit']");
-                               if(obj.status == "updated")
-                               {
-                                       $(submitBnt).val("Lagret");
-                                               var oArgs = 
{menuaction:'property.uidimb_role_user.query', dimb_id:$("#dimb_id").val(), 
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query_start:$("#query_start").val(),query_end:$("#query_end").val()};
+                               var obj = data;
+                       
+                               var submitBnt = 
$(thisForm).find("input[type='submit']");
+                               if(obj.status == "updated")
+                               {
+                                       $(submitBnt).val("Lagret");
+
+                                       var oArgs = {
+                                               
menuaction:'controller.uicontrol_location.query2',
+                                               entity_id:$("#entity_id").val(),
+                                               cat_id:$("#cat_id").val(),
+                                               
district_id:$("#district_id").val(),
+                                               
part_of_town_id:$("#part_of_town_id").val(),
+                                               location_code:$("#loc1").val(),
+                                               
control_id:$("#control_id").val()
+                                               };
+       
                                                
execute_async(myDataTable_0,oArgs);
-                                       }
-                                       else
-                                       {
-                                       $(submitBnt).val("Feil ved lagring");   
                                
-                                       }
-                                                
-                               // Changes text on save button back to original
-                               window.setTimeout(function() {
+                               }
+                               else
+                               {
+                                       $(submitBnt).val("Feil ved lagring");   
                                
+                               }
+                                               
+                               // Changes text on save button back to original
+                               window.setTimeout(function() {
                                                $(submitBnt).val('Lagre');
                                                
$(submitBnt).addClass("not_active");
-                               }, 1000);
+                               }, 1000);
 
                                        var htmlString = "";
-                                       if(typeof(data['receipt']['error']) != 
'undefined')
-                                       {
+                                       if(typeof(data['receipt']['error']) != 
'undefined')
+                                       {
                                                for ( var i = 0; i < 
data['receipt']['error'].length; ++i )
                                                {
                                                        htmlString += "<div 
class=\"error\">";
                                                        htmlString += 
data['receipt']['error'][i]['msg'];
                                                        htmlString += '</div>';
                                                }
-                                       
-                                       }
-                                       if(typeof(data['receipt']['message']) 
!= 'undefined')
-                                       {
+                                       
+                                       }
+                                       if(typeof(data['receipt']['message']) 
!= 'undefined')
+                                       {
                                                for ( var i = 0; i < 
data['receipt']['message'].length; ++i )
                                                {
                                                        htmlString += "<div 
class=\"msg_good\">";
                                                        htmlString += 
data['receipt']['message'][i]['msg'];
                                                        htmlString += '</div>';
                                                }
-                                       
-                                       }
-                                       $("#receipt").html(htmlString);
+                                       
+                                       }
+                                       $("#receipt").html(htmlString);
                                }
                        }
                });
        });
 });
 
+function get_table_def()
+{
+       var oArgs = {
+               menuaction:'controller.uicontrol_location.get_entity_table_def',
+               entity_id:$("#entity_id").val(),
+               cat_id:$("#cat_id").val()
+       };
 
-function update_dimb_role_user_table()
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: requestUrl,
+               success: function(data) {
+                       if( data != null)
+                       {               
+                               myColumnDefs = [];
+                       myColumnDefs.push(data);
+                               update_component_table_def();
+//                             update_component_table();
+                       }
+                       else
+                       {
+                               alert('error');
+                       }
+               }
+       });
+
+}
+
+function update_component_table_def()
 {
-       var oArgs = {menuaction:'property.uidimb_role_user.query', 
dimb_id:$("#dimb_id").val(), 
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query_start:$("#query_start").val(),query_end:$("#query_end").val()};
-       execute_async(myDataTable_0,  oArgs);
-       $("#receipt").html('');
+       pager = YAHOO.util.Dom.get("paging_0");
+       div   = YAHOO.util.Dom.get("datatable-container_0");
+       this.init_datatable(datatable[0],div,pager,myColumnDefs[0],0);
 }
 
+function update_component_table()
+{
+       var oArgs = {
+               menuaction:'controller.uicontrol_location.query2',
+               entity_id:$("#entity_id").val(),
+               cat_id:$("#cat_id").val(),
+               district_id:$("#district_id").val(),
+               part_of_town_id:$("#part_of_town_id").val(),
+               location_code:$("#loc1").val(),
+               control_id:$("#control_id").val()
+       };
 
+       execute_async(myDataTable_0,  oArgs);
+//     $("#receipt").html('');
+}
 
-

Modified: branches/Version-1_0-branch/controller/js/controller/custom_ui.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/custom_ui.js   
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/js/controller/custom_ui.js   
2012-06-06 12:59:29 UTC (rev 9522)
@@ -40,38 +40,4 @@
                $("ul.expand_list").find("li h4 img").attr("src", 
"controller/images/arrow_right.png");
        });
        
-       /* 
============================================================================== 
*/
-       
-
-       if( $("#frm_control_items").length > 0 ){
-               var check_box_arr = 
$("#frm_control_items").find("input[type='checkbox']");
-               
-               $(check_box_arr).each(function(index) {
-                       var check_box = check_box_arr[index];
-                       
-                       if( $(check_box).is(':checked') ){
-                               var chbox_id = $(check_box).attr("id");
-                               
-                               var control_group_id = chbox_id.substring( 
chbox_id.indexOf("_")+1, chbox_id.indexOf(":") );
-                               var control_item_id = chbox_id.substring( 
chbox_id.indexOf(":")+1,  chbox_id.length );
-                               
-                               $("#frm_control_items").prepend("<input 
type='hidden' id=hid_" + control_item_id +  " name='control_tag_ids[]' value=" 
+ control_group_id + ":" +  control_item_id + " />");
-                       }
-               });
-       }
-       
-       $("#frm_control_items input[type='checkbox']").click(function(){
-               var thisCbox = $(this);
-               
-               var chbox_id = $(thisCbox).attr("id");
-               
-               var control_group_id = chbox_id.substring( 
chbox_id.indexOf("_")+1, chbox_id.indexOf(":") );
-               var control_item_id = chbox_id.substring( 
chbox_id.indexOf(":")+1,  chbox_id.length );
-               
-               if ($("#hid_" + control_item_id).length > 0){
-                       $("#hid_" + control_item_id).remove();
-               }else{
-                       $("#frm_control_items").prepend("<input type='hidden' 
id=hid_" + control_item_id +  " name='control_tag_ids[]' value=" + 
control_group_id + ":" +  control_item_id + " />");
-               }
-       });
 });
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
===================================================================
--- 
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
    2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/js/yahoo/register_control_to_component.js
    2012-06-06 12:59:29 UTC (rev 9522)
@@ -18,6 +18,34 @@
        }
 
 
+       function checkAll(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+//                             if(myclass=="mychecks")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+//                             else
+//                             {
+//                                     controls[i].checked = true;
+//                             }
+                       }
+               }
+       }
+ 
  
/********************************************************************************/
 
 

Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-06-06 
12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-06-06 
12:59:29 UTC (rev 9522)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.35';
+       $setup_info['controller']['version'] = '0.1.36';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-06-06 12:59:29 UTC (rev 9522)
@@ -152,6 +152,7 @@
                                'fd' => array(
                                        'id' => array('type' => 'auto', 
'nullable' => false),
                                        'control_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                                       'location_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
                                        'component_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => false)
                                ),
                        'pk' => array('id'),

Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-06-06 12:59:29 UTC (rev 9522)
@@ -686,4 +686,23 @@
                                
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.35';
                return $GLOBALS['setup_info']['controller']['currentver'];
-       }
\ No newline at end of file
+       }
+
+       $test[] = '0.1.35';
+       function controller_upgrade0_1_35()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_component_list','location_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => false
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.36';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }
+       }
+

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-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
   2012-06-06 12:59:29 UTC (rev 9522)
@@ -3,6 +3,8 @@
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
        
+       <h2>Kontrolldetaljer</h2>
+       
        <fieldset id="control_details">
                <div class="row">
                        <label>KontrollomrĂ¥de</label>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_items.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_items.xsl
     2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_items.xsl
     2012-06-06 12:59:29 UTC (rev 9522)
@@ -2,47 +2,62 @@
 
 <xsl:template match="data">
 
-<ul>
-       <xsl:for-each select="saved_groups_with_items_array">
-               <li>
-                       <h3><xsl:value-of 
select="control_group/group_name"/></h3>
+<div id="control-items">
+       <h2>Kontrollpunkter</h2>
        
-                               <xsl:variable 
name="control_group_id"><xsl:value-of select="control_group/id"/></xsl:variable>
+       <ul class="groups">
+               <xsl:for-each select="saved_groups_with_items_array">
+                       <li>
+                               <h3><xsl:value-of 
select="control_group/group_name"/></h3>
+                                                       
+                         <xsl:variable name="control_group_id"><xsl:value-of 
select="control_group/id"/></xsl:variable>
                                <input type="hidden" name="control_group_id" 
value="{$control_group_id}" />
                
-                               <ul>
-                                       <xsl:for-each select="control_items">
-                                               <xsl:variable 
name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
-                                               <xsl:variable name="order_tag">
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="order_nr > 0">
-                                                                       
<xsl:value-of select="order_nr"/>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       
<xsl:number/>
-                                                               </xsl:otherwise>
-                                                       
</xsl:choose>:<xsl:value-of select="id"/>
-                                               </xsl:variable>
-                                                                               
                                
-                                               <li>
-                                                       <span>
-                                                               <span 
class="order_nr"><xsl:number/></span>. <xsl:value-of select="title"/><input 
type="hidden" name="order_nr[]" value="{$order_tag}" />
-                                                       </span>
-                                               </li>
-                                       </xsl:for-each>
-                               </ul>
-               </li>
-       </xsl:for-each>
-</ul>
-
-<a id="print-control-items" class="btn" target="_blank">
-       <xsl:attribute name="href">
-               
<xsl:text>index.php?menuaction=controller.uicheck_list.print_check_list</xsl:text>
-               <xsl:text>&amp;check_list_id=</xsl:text>
-               <xsl:value-of select="check_list/id"/>
-               <xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-       </xsl:attribute>
-       Skriv ut
-</a>
-
+                               <xsl:choose>
+                                       <xsl:when 
test="control_items/child::node()">
+                                               <ul class="control_items">
+                                                       <xsl:for-each 
select="control_items">
+                                                               
+                                                               <!-- Control 
Item Id -->
+                                                               <xsl:variable 
name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
+                                                               
+                                                               <!-- Calculates 
order nr -->
+                                                               <xsl:variable 
name="order_tag">
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="order_nr > 0">
+                                                                               
        <xsl:value-of select="order_nr"/>
+                                                                               
</xsl:when>
+                                                                               
<xsl:otherwise>
+                                                                               
        <xsl:number/>
+                                                                               
</xsl:otherwise>
+                                                                       
</xsl:choose>:<xsl:value-of select="id"/>
+                                                               </xsl:variable>
+                                                               
+                                                               <!-- Prints the 
row -->                                                         
+                                                               <li>
+                                                                       <span>
+                                                                               
<span class="order_nr"><xsl:number/></span>. <xsl:value-of 
select="title"/><input type="hidden" name="order_nr[]" value="{$order_tag}" />
+                                                                       </span>
+                                                               </li>
+                                                       </xsl:for-each>
+                                               </ul>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <p class="no_items_msg">Ingen 
kontrollpunkt lagt til fra denne gruppen</p>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </li>
+               </xsl:for-each>
+       </ul>
+       
+       <a class="btn print" target="_blank">
+               <xsl:attribute name="href">
+                       
<xsl:text>index.php?menuaction=controller.uicheck_list.print_check_list</xsl:text>
+                       <xsl:text>&amp;check_list_id=</xsl:text>
+                       <xsl:value-of select="check_list/id"/>
+                       <xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
+               </xsl:attribute>
+               Skriv ut
+       </a>
+</div>
 </xsl:template>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
 2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/choose_control_items.xsl
 2012-06-06 12:59:29 UTC (rev 9522)
@@ -16,7 +16,7 @@
                        <xsl:variable name="control_group_ids"><xsl:value-of 
select="control_group_ids"/></xsl:variable>
                        <input type="hidden" name="control_group_ids" 
value="{control_group_ids}" />            
                        
-                       <ul class="control_items">
+                       
                                <xsl:for-each 
select="groups_with_control_items">
                                        <ul class="expand_list">
                                        <li>
@@ -46,7 +46,7 @@
                                        </li>
                                </ul>
                                </xsl:for-each>
-                       </ul>
+       
                        
                        <div>
                                <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
    2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
    2012-06-06 12:59:29 UTC (rev 9522)
@@ -22,26 +22,19 @@
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
        <style type="text/css">
-       #box { width: 200px; height: 5px; background: blue; }
-       select { width: 200px; }
-       .row_on,.th_bright
-       {
-               background-color: #CCEEFF;
-       }
-
-       .row_off
-       {
-               background-color: #DDF0FF;
-       }
-
+               select { width: 100px; }
        </style>
 
-       <xsl:call-template name="invoice" />
-       <div id="popupBox"></div>       
-       <div id="curtain"></div>
+<div class="yui-navset yui-navset-top" id="control_location_tabview">
+       <div class="identifier-header">
+               <h1><xsl:value-of select="php:function('lang', 'components for 
control')"/></h1>
+       </div>
+       <xsl:value-of disable-output-escaping="yes" select="tabs" />
+       <xsl:call-template name="register_control_to_component" />
+</div>
 </xsl:template>
 
-<xsl:template name="invoice" xmlns:php="http://php.net/xsl";>
+<xsl:template name="register_control_to_component" 
xmlns:php="http://php.net/xsl";>
        <!-- loads translations into array for use with javascripts -->
        <!--
        <script type="text/javascript">
@@ -94,7 +87,7 @@
                        <xsl:value-of select="php:function('lang', 'control 
area')" />
                </td>
                <td>
-                       <xsl:value-of select="php:function('lang', 'control 
id')" />
+                       <xsl:value-of select="php:function('lang', 'control')" 
/>
                </td>
        </tr>
          <tr id="filter1">
@@ -103,7 +96,7 @@
                        <xsl:apply-templates 
select="control_area_list/options"/>
                  </select>
                </td>           
-               <td>
+               <td colspan='4'>
                  <select id="control_id" name="control_id">
                        <xsl:apply-templates select="control/options"/>
                  </select>
@@ -122,6 +115,12 @@
                <td>
                        <xsl:value-of select="php:function('lang', 'part of 
town')" />
                </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'property')" 
/>
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'building')" 
/>
+               </td>
                <td >
                        <xsl:value-of select="php:function('lang', 'search')" />
                </td>
@@ -133,7 +132,7 @@
                  </select>
                </td>           
                <td>
-                 <select id="category_id" name="category_id">
+                 <select id="cat_id" name="cat_id">
                        <xsl:apply-templates select="category_list/options"/>
                  </select>
                </td>           
@@ -148,6 +147,16 @@
                  </select>
                </td>           
                <td>
+                 <select id="loc1" name="loc1">
+                       <xsl:apply-templates select="loc1_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="loc2" name="loc2">
+                       <xsl:apply-templates select="loc2_list/options"/>
+                 </select>
+               </td>
+               <td>
                        <xsl:variable name="lang_search"><xsl:value-of 
select="php:function('lang', 'Search')" /></xsl:variable>
                        <input type="button" id = "search" name="search" 
value="{$lang_search}" title = "{$lang_search}" />
                </td>                   
@@ -163,14 +172,18 @@
 <xsl:template match="datatable" xmlns:php="http://php.net/xsl";>
        <div id="paging_0"/>
        <div id="datatable-container_0"/>
-
-       <div id="data_paginator"/>
-       <div id="datatable-container"/>
        
        <xsl:call-template name="datasource-definition" />
        <div id="receipt"></div>
        <xsl:variable name="label_submit"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
-       <div class="row_on"><input type="submit" name="update_acl" 
id="frm_update_acl" value="{$label_submit}"/></div>
+       <div><input type="submit" name="update_acl" id="frm_update_acl" 
value="{$label_submit}"/></div>
+
+       <xsl:variable name="label_select_add"><xsl:value-of 
select="php:function('lang', 'select')" /></xsl:variable>
+       <div><input type="button" name="select_add" id="frm_update_add" 
value="{$label_select_add}" onclick="checkAll('mychecks_add')"/></div>
+       
+       <xsl:variable name="label_select_delete"><xsl:value-of 
select="php:function('lang', 'select delete')" /></xsl:variable>
+       <div><input type="button" name="select_add" id="frm_update_delete" 
value="{$label_select_delete}" onclick="checkAll('mychecks_delete')"/></div>
+       
 </xsl:template>
 
 <xsl:template name="datasource-definition" xmlns:php="http://php.net/xsl";>

Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-06-06 12:59:29 UTC (rev 9522)
@@ -1,34 +1,13 @@
-#invoice_details { float: left; width: 30%; }
 #list_navigation { float: left; width: 30%; }
 #user_messages { float: right; width: 40%;}
-#contract_lists {width: 100%; float: left; background-color: #EFEFEF; border: 
1px solid #ABABAB; padding-left: 1em; margin-top: 1em;}
-form#invoice_run {margin: 2em;}
-form#invoice_run th { 
-       background-color: #CDCDCD;
-       padding: 5px;
-       border: 1px solid #ABABAB;
-        font-weight: bolder;
-       }
 
-div#contract_lists td {
-       margin:0;
-       padding:4px 10px;
-}
-form#invoice_run td { 
-       border: 1px solid #CDCDCD;
-}
-div#invoice_details dt{
-       float:left;
-        font-weight: bolder;
-        margin-right: 1em;
-}
 div.content {
        margin: 2em;    
 }
 .hd {
        margin-bottom: 0;
        text-align: center;
-}      
+}
 .hd img {
        vertical-align: middle;
 }
@@ -65,17 +44,6 @@
 }
 .clr { clear: both;}
 
-#dashboard {padding: 1em;}
-#dashborad_column_1 { float:left; width:50%;}
-#dashboard_column_2 { margin-left:50%; width:50%;}
-
-#inactive {
-                               background-color: #ff5555;
-                               width: 10em;
-                               padding: 1em;
-                               border: 0.2em dotted #000000;
-                               letter-spacing: 2px;
-}
 #active {
                                background-color: #ffffff;
                                width: 10em;
@@ -268,23 +236,7 @@
 dl.proplist-col dd.address {
     white-space: pre;
 }
-#week-selector { margin: 1em 0;}
-#week-selector li { display: inline; padding-right: .5em;}
 
-#schedule_container tr td { border-top: 1px solid #ccc; background: white; 
white-space: nowrap; }
-#schedule_container tr td:first-child { background: #eee; }
-#schedule_container tr.time td { border-top: 1px solid #444;}
-#schedule_container .color1 { background: #ccf;}
-#schedule_container .color2 { background: #cfc;}
-#schedule_container .color3 { background: #fcc;}
-#schedule_container .color4 { background: #ffb;}
-#schedule_container .color5 { background: #bff;}
-#schedule_container .color6 { background: #fbf;}
-
-#boundary-table td, #boundary-table th { 
-    padding: .1em .2em;
-}
-
 .date-container {
     margin-bottom: .8em;
     white-space: nowrap;
@@ -563,6 +515,10 @@
     display:none;
 }
 
+#control-items .print{
+       margin-top: 20px;       
+}
+
 /* =======================================  ADD CONTROL ITEM LIST VALUES  
========================================= */
 
 #add_control_item_option_panel {
@@ -617,6 +573,11 @@
     width: 45px;
 }
 
+#frm_control_items{
+       clear:left;
+       margin-top:10px;        
+}
+
 /* =======================================  CONTROL TAB VIEW  
========================================= */
 #control_tabview .yui-navset, #control_location_tabview .yui-navset{
        margin:0;
@@ -653,6 +614,28 @@
 ul.groups a:visited{
        color:#000;
 }
+
+ul.items {
+    list-style: none outside none;
+    margin: 0 20px;
+    padding: 0;
+    position: relative;
+}
+ul.items li.list_item{
+  position:relative;
+  z-index: 1;
+  opacity: 1;
+  filter: alpha(opacity=100);
+  top: 0px;
+  left: 0px;
+}
+
+.control_items li{
+       padding: 5px;
+}
+
+/* =======================================  DRAG LIST  
========================================= */
+
 .drag_group{
   margin-bottom: 10px;
 }
@@ -668,20 +651,6 @@
   padding-left:0;
   background: #dedede;
 }
-ul.items {
-    list-style: none outside none;
-    margin: 0 20px;
-    padding: 0;
-    position: relative;
-}
-ul.items li.list_item{
-  position:relative;
-  z-index: 1;
-  opacity: 1;
-  filter: alpha(opacity=100);
-  top: 0px;
-  left: 0px;
-}
 
 /* =======================================  EXPAND LIST  
========================================= */
 
@@ -713,11 +682,6 @@
     display: none;
 }
 
-#frm_control_items{
-       clear:left;
-       margin-top:10px;        
-}
-
 dl.proplist, dl.proplist-col {
     margin: 0;
     padding-left: 0;
@@ -839,7 +803,7 @@
     color: #FFFFFF;
 }
 
-.btn, .btn_m, .btn_sm {
+.btn, .btn_m, .btn-sm {
     background: none repeat scroll 0 0 #4F9AEA;
     border: 1px solid #428AD7;
     border-radius: 4px 4px 4px 4px;
@@ -852,12 +816,12 @@
 }
 
 .btn_m{
-    padding: 2px 10px;
+    padding: 2px 6px;
     font-size: 12px;
 }
 
-.btn_sm{
-    font-size: 11px;
+.btn-sm {
+    font-size: 12px;
     padding: 1px 4px;
 }
 
@@ -1759,9 +1723,11 @@
     margin-top: 5px;
     padding: 4px 5px;
 }
+
 input.focus, select.focus{
        border: 2px solid #dae6f4;
 }
+
 div.controller_checklist {
        padding: 20px;
        border: 1px solid #ABABAB;
@@ -1769,11 +1735,15 @@
 
 /* =====================  CONTROL LOCATION  ===================== */
 
-#choose_control{
-       margin: 10px;
-       padding: 10px; 
-       width: 25%;
+#choose_control {
+    float: right;
+    width: 500px;
 }
+
+#choose_control select {
+    width: 245px;
+}
+
 .error_msg {
        color: red;
     display: none;
@@ -1834,6 +1804,20 @@
     margin-bottom: 0.5em;
 }
 
+/* =============================   PROCEDURES   ======================= */
+
+#view-procedures .btn-sm {
+    height: auto;
+    margin-left: 11px;
+    vertical-align: middle;
+}
+#view-procedures .box {
+    background: none repeat scroll 0 0 #E7EFF8;
+    border: 1px solid #DDDDDD;
+    margin-bottom: 20px;
+    padding: 0 20px;
+}
+
 /* =============================  IMAGE LOADER  ======================= */
 
 img#loading {
@@ -1841,10 +1825,6 @@
        vertical-align: middle;
 }
 
-#print-control-items{
-       margin-top:20px;
-}
-
 #exec-print {
        margin:20px 0 0 40px;
 }
@@ -1931,6 +1911,10 @@
        width: 140px;   
 }
 
-. yui-skin-sam thead{
+.yui-skin-sam thead{
        background: none;       
 }
+
+p.no_items_msg {
+       padding: 5px;   
+}
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
 2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
 2012-06-06 12:59:29 UTC (rev 9522)
@@ -75,16 +75,16 @@
        }
 
        .btn {
-           background: none repeat scroll 0 0 #2647A0;
-           border: 1px solid #173073;
-           color: #FFFFFF;
-           cursor: pointer;
-           display: inline-block;
-           font-family: arial;
-           padding: 5px 20px;
-           text-decoration: none;
-           margin-top:20px;
-       }
+    background: none repeat scroll 0 0 #4F9AEA;
+    border: 1px solid #428AD7;
+    border-radius: 4px 4px 4px 4px;
+    color: #FFFFFF;
+    cursor: pointer;
+    display: inline-block;
+    margin-right: 10px;
+    padding: 5px 10px;
+    text-decoration: none;
+}
        
        ol{
                margin: 0;

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure/view_procedures_for_control.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/procedure/view_procedures_for_control.xsl
     2012-06-06 12:57:05 UTC (rev 9521)
+++ 
branches/Version-1_0-branch/controller/templates/base/procedure/view_procedures_for_control.xsl
     2012-06-06 12:59:29 UTC (rev 9522)
@@ -2,44 +2,47 @@
 
 <xsl:template match="data">
        
-<div id="procedures">
-       <h2>Prosedyre for <xsl:value-of select="control_procedure/title"/></h2>
+<div id="view-procedures">
+       <h2>Prosedyrer</h2>
        
-
-               <a class="btn_m" id="print-control-items" target="_blank">
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uiprocedure.print_procedure</xsl:text>
-                               <xsl:text>&amp;procedure_id=</xsl:text>
-                               <xsl:value-of select="control_procedure/id"/>
-                               <xsl:text>&amp;control_id=</xsl:text>
-                               <xsl:value-of select="control/id"/>
-                               <xsl:text>&amp;location_code=</xsl:text>
-                               <xsl:value-of select="location/location_code"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Skriv ut prosedyre
-               </a>
-               
-       <xsl:if test="control_procedure/documents/child::node()">
-               <h4>Dokumenter</h4>
-               <xsl:for-each select="control_procedure/documents">
-                       <div class="doc">
-                               <xsl:variable name="doc_link"><xsl:value-of 
select='document_link'/></xsl:variable>
-                               <span><a href="{$doc_link}"><xsl:value-of 
select="title"/></a></span>
-                               <span class="desc"><xsl:value-of 
select="description" disable-output-escaping="yes"/></span>
-                       </div>  
-               </xsl:for-each>
-       </xsl:if>
+       <div class="box">
+               <h3>Prosedyre for kontroll</h3>
+               <h4><xsl:value-of select="control_procedure/title"/>
+                       <a class="btn-sm" id="print-control-items" 
target="_blank">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uiprocedure.print_procedure</xsl:text>
+                                       <xsl:text>&amp;procedure_id=</xsl:text>
+                                       <xsl:value-of 
select="control_procedure/id"/>
+                                       <xsl:text>&amp;control_id=</xsl:text>
+                                       <xsl:value-of select="control/id"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:value-of 
select="location/location_code"/>
+                                       
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
+                               </xsl:attribute>
+                               Skriv ut
+                       </a>
+               </h4>
+                       
+               <xsl:if test="control_procedure/documents/child::node()">
+                       <h4>Dokumenter</h4>
+                       <xsl:for-each select="control_procedure/documents">
+                               <div class="doc">
+                                       <xsl:variable 
name="doc_link"><xsl:value-of select='document_link'/></xsl:variable>
+                                       <span><a 
href="{$doc_link}"><xsl:value-of select="title"/></a></span>
+                                       <span class="desc"><xsl:value-of 
select="description" disable-output-escaping="yes"/></span>
+                               </div>  
+                       </xsl:for-each>
+               </xsl:if>
+       </div>
        
+       <div class="box">
        <h3>Prosedyrer for grupper</h3>
-       
-       <ul id="groups">
+       <ul>
                <xsl:for-each select="group_procedures_array">
                        <li>
-                               <h4><xsl:value-of 
select="procedure/title"/></h4>
-                               <div class="group">
-                                       <span>Gruppe: </span><xsl:value-of 
select="control_group/group_name"/>
-                                       <a class="btn_sm" 
id="print-control-items" target="_blank">
+                               <h4><xsl:value-of 
select="control_group/group_name"/>: <xsl:value-of select="procedure/title"/>
+                               
+                               <a class="btn-sm" id="print-control-items" 
target="_blank">
                                                <xsl:attribute name="href">
                                                        
<xsl:text>index.php?menuaction=controller.uiprocedure.print_procedure</xsl:text>
                                                        
<xsl:text>&amp;procedure_id=</xsl:text>
@@ -54,7 +57,8 @@
                                                </xsl:attribute>
                                                Skriv ut
                                        </a>
-                               </div>
+                               </h4>
+                       
                                <xsl:if test="documents/child::node()">
                                <h4>Dokumenter</h4>
                                        <xsl:for-each select="documents">
@@ -68,5 +72,6 @@
                        </li>
                </xsl:for-each>
        </ul>
+       </div>
 </div>
 </xsl:template>

Copied: 
branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php 
(from rev 9521, trunk/frontend/inc/class.uicontract_documents.inc.php)
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php 
                        (rev 0)
+++ branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php 
2012-06-06 12:59:29 UTC (rev 9522)
@@ -0,0 +1,229 @@
+<?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id:$
+        */
+
+       /*
+          This program 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.
+
+          This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+    phpgw::import_class('frontend.uifrontend');
+    phpgw::import_class('rental.uicontract');
+    phpgw::import_class('rental.socontract');
+    include_class('rental', 'document', 'inc/model/');
+
+       /**
+        * Drawings
+        *
+        * @package Frontend
+        */
+
+    class frontend_uicontract_documents extends frontend_uifrontend
+    {
+
+        public $public_functions = array
+        (
+            'index'            => true,
+        );
+
+               public function __construct()
+               {
+                   $this->contract_state_identifier_doc = "contract_state_in";
+                   $this->contracts_per_location_identifier_doc = 
"contracts_in_per_location";
+                   $this->form_url_doc = 
"index.php?menuaction=frontend.uicontract_documents.index";
+                       
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.document.contracts'));
+                       parent::__construct();
+                       $this->location_code = 
$this->header_state['selected_location'];
+//                     $this->location_code = '1102-01';
+               }
+
+               public function index()
+               {
+                   $contractdata = array();    // This is the main container 
for all contract data sent to XSLT template stuff
+                   $msglog = array();                  // Array of errors and 
other notifications displayed to us
+                   
+               $filter = phpgw::get_var('contract_filter');
+               // The user wants to change the contract status filter
+               if(isset($filter)) 
+               {
+                               $this->contract_filter_doc = $filter;
+                               phpgwapi_cache::session_set('frontend', 
'contract_filter_doc', $filter);                                
+    
+                               // ... if the user changes filter that may 
cause the
+                               if($filter == 'active' || $filter == 
'not_active')
+                               {
+                                       $change_contract = true;
+                               }       
+               }
+               else
+               {
+                       $filter = phpgwapi_cache::session_get('frontend', 
'contract_filter_doc');
+                       $this->contract_filter_doc = isset($filter) ? $filter : 
'active';
+               }
+               
+                       // If the user wants to view another contract connected 
to this location
+               // Request parameter: the user wants to view details about 
anther contract
+               // The current state of the contract view of this user's session
+               $this->contract_state_doc = 
phpgwapi_cache::session_get('frontend', $this->contract_state_identifier_doc);
+               $new_contract = phpgw::get_var('contract_id');
+               $contracts_per_location = 
phpgwapi_cache::session_get('frontend', 
$this->contracts_per_location_identifier_doc);
+               $contracts_for_selection = array();
+               $number_of_valid_contracts = 0;
+               
foreach($contracts_per_location[$this->header_state['selected_location']] as 
$contract)
+               {
+                       if(     ($this->contract_filter_doc == 'active' && 
$contract->is_active()) ||
+                               ($this->contract_filter_doc == 'not_active' && 
!$contract->is_active()) ||
+                               $this->contract_filter_doc == 'all'
+                       )
+                       {
+                               $number_of_valid_contracts += 1;
+                               //Only select necessary fields
+                               $contracts_for_selection[] = array(
+                                       'id'                            => 
$contract->get_id(),
+                                       'old_contract_id'       => 
$contract->get_old_contract_id(),
+                                       'contract_status'       => 
$contract->get_contract_status()
+                                       
+                               );
+
+                               if($change_contract || $new_contract == 
$contract->get_id() || !isset($this->contract_state_doc['contract']))
+                               {
+                                       $this->contract_state_doc['selected'] = 
$contract->get_id();
+                                       $this->contract_state_doc['contract'] = 
$contract;
+                                       //$this->contract = 
rental_socontract::get_instance()->get_single($new_contract);
+                                       phpgwapi_cache::session_set('frontend', 
$this->contract_state_identifier_doc , $this->contract_state_doc);
+                                       $change_contract = false;
+                               }
+                       }                       
+               }
+               
+               if($number_of_valid_contracts == 0)
+               {
+                       $this->contract_state_doc['selected'] = '';
+                       $this->contract_state_doc['contract'] = null;
+               }
+                   
+                       $config = CreateObject('phpgwapi.config','frontend');
+                       $config->read();
+                       //$doc_types = 
isset($config->config_data['document_frontend_cat']) && 
$config->config_data['document_frontend_cat'] ? 
$config->config_data['document_frontend_cat'] : array(); 
+                       $doc_types = array('type' => 1);
+
+                       $allrows = true;
+                       $sodocument     = CreateObject('rental.sodocument');
+            $filters = array('contract_id' => 
$this->contract_state_doc['selected'], 'document_type' => 1);
+                       $document_list = array();
+                       $total_records = 0;
+                       if( $this->location_code )
+                       {
+                               foreach ($doc_types as $doc_type)
+                               {
+                                       if($doc_type)
+                                       {
+                                               $document_list = 
array_merge($document_list, $sodocument->get($start_index, $num_of_objects, 
'id', true, $search_for, $search_type, $filters));
+                                       }
+
+                                       $total_records = $total_records + 
$sodocument->get_count($search_for, $search_type, $filters);;
+                               }
+                       }
+                       
+                       
//----------------------------------------------datatable settings--------
+
+                       $valid_types = 
isset($config->config_data['document_valid_types']) && 
$config->config_data['document_valid_types'] ? str_replace ( ',' , '|' , 
$config->config_data['document_valid_types'] ) : '';
+
+                       $content = array();
+                       if($valid_types)
+                       {
+                               foreach($document_list as $entry)
+                               {
+                                       if ( 
!preg_match("/({$valid_types})$/i", $entry->get_name()) )
+                                       {
+                                               continue;
+                                       }
+
+                                       $content[] = array
+                                       (
+                                               'document_id'                   
=> $entry->get_id(),
+                                               'document_name'                 
=> $entry->get_name(),
+                                               'link'                          
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'rental.uidocument.view', 'id' => $entry->get_id())),
+                                               'title'                         
        => $entry->get_title(),
+                                           'description'                       
=> $entry->get_description(),
+                                               'doc_type'                      
        => lang($entry->get_type()),
+                                       );      
+                               }
+                       }
+                       $datavalues[0] = array
+                       (
+                               'name'                                  => "0",
+                               'values'                                => 
json_encode($content),
+                               'total_records'                 => 
count($content),
+                               'edit_action'                   => 
isset($entry) && $entry->get_id() ? 
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'rental.uidocument.view', 'id' => $entry->get_id()))):'' ,
+                               'is_paginator'                  => 1,
+                               'footer'                                => 0
+                       );
+
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array('key' => 
'document_name','label'=>lang('filename'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
+                                                                               
                        array('key' => 
'document_id','label'=>lang('filename'),'sortable'=>false,'hidden' => true),
+                                                                               
                        array('key' => 
'title','label'=>lang('name'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 
'description','label'=>lang('description'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 
'doc_type','label'=>'Type','sortable'=>true,'resizeable'=>true)
+                                                                               
                        ))
+                       );
+
+                       
//----------------------------------------------datatable settings--------
+
+
+                       $datatable = array
+                       (
+                               'property_js'                   => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                             => 
$datavalues,
+                               'myColumnDefs'                  => $myColumnDefs
+                       );
+
+                       $data = array
+                       (
+                               'header'                                => 
$this->header_state,
+                               'tabs'                                  => 
$this->tabs,
+                       'contract_data' =>      array (
+                               'select' => $contracts_for_selection, 
+                               'selected_contract' =>  
$this->contract_state_doc['selected'], 
+                               'contract'      => 
isset($this->contract_state_doc['contract']) ? 
$this->contract_state_doc['contract']->serialize() : array(),
+                               'contract_filter' => $this->contract_filter_doc,
+                               'form_url' => $this->form_url_doc
+                           ),
+                               'documents'                             => 
array('datatable' => $datatable)
+                       );
+                       
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('app_data' => 
$data));
+               
$GLOBALS['phpgw']->xslttpl->add_file(array('frontend','document'));
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'drawing.list', 'frontend' );
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+               }
+    }

Modified: branches/Version-1_0-branch/frontend/setup/default_records.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/default_records.inc.php  
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/frontend/setup/default_records.inc.php  
2012-06-06 12:59:29 UTC (rev 9522)
@@ -15,6 +15,7 @@
        
$GLOBALS['phpgw']->locations->add('.rental.contract_ex','contract_ex','frontend',
 false);
        $GLOBALS['phpgw']->locations->add('.document.drawings', 'drawings', 
'frontend', false);
        $GLOBALS['phpgw']->locations->add('.document.pictures', 'pictures', 
'frontend', false);
+       
$GLOBALS['phpgw']->locations->add('.document.contracts','contract_documents','frontend',
 false);
        $GLOBALS['phpgw']->locations->add('.property.maintenance', 
'maintenance', 'frontend', false);
        $GLOBALS['phpgw']->locations->add('.property.refurbishment', 
'refurbishment', 'frontend', false);
        $GLOBALS['phpgw']->locations->add('.property.services', 'services', 
'frontend', false);

Modified: branches/Version-1_0-branch/frontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/frontend/setup/phpgw_no.lang    2012-06-06 
12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/frontend/setup/phpgw_no.lang    2012-06-06 
12:59:29 UTC (rev 9522)
@@ -8,6 +8,7 @@
 contract       frontend        no      Kontrakter
 contract_in    frontend        no      Innleiekontrakter
 contract_ex    frontend        no      Eksternleiekontrakter
+contract_documents     frontend        no      Kontraktsdokumenter
 helpdesk       frontend        no      Melding om avvik
 subject        frontend        no      Meldingstittel
 entry_date     frontend        no      Dato
@@ -130,3 +131,4 @@
 message_empty  frontend        no      Meldingen kan ikke være tom
 upload_userdoc frontend        no      Last opp brukerveiledning
 filename       frontend        no      Filnavn
+contracts      frontend        no      Kontrakt
\ No newline at end of file

Modified: branches/Version-1_0-branch/frontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/setup.inc.php    2012-06-06 
12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/frontend/setup/setup.inc.php    2012-06-06 
12:59:29 UTC (rev 9522)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['frontend']['name'] = 'frontend';
-       $setup_info['frontend']['version'] = '0.4';
+       $setup_info['frontend']['version'] = '0.5';
        $setup_info['frontend']['app_order'] = 9;
 //     $setup_info['frontend']['tables'] = array();
        $setup_info['frontend']['enable'] = 1;

Modified: branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/tables_update.inc.php    
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/frontend/setup/tables_update.inc.php    
2012-06-06 12:59:29 UTC (rev 9522)
@@ -38,7 +38,7 @@
        }
        
        /**
-       * Update frontend version from 0.1 to 0.2
+       * Update frontend version from 0.2 to 0.3
        * Add new location as placeholders for functions and menues
        * 
        */
@@ -51,7 +51,7 @@
        }
        
        /**
-       * Update frontend version from 0.2 to 0.3
+       * Update frontend version from 0.3 to 0.4
        * Add new location as placeholders for functions and menues
        * 
        */
@@ -62,3 +62,16 @@
                $GLOBALS['setup_info']['frontend']['currentver'] = '0.4';
                return $GLOBALS['setup_info']['frontend']['currentver'];
        }
+       
+       /**
+       * Update frontend version from 04 to 0.5
+       * Add new location as placeholders for functions and menues
+       * 
+       */
+       $test[] = '0.4';
+       function frontend_upgrade0_4()
+       {
+               
$GLOBALS['phpgw']->locations->add('.document.contracts','contract_documents','frontend',
 false);
+               $GLOBALS['setup_info']['frontend']['currentver'] = '0.5';
+               return $GLOBALS['setup_info']['frontend']['currentver'];
+       }

Copied: branches/Version-1_0-branch/frontend/templates/base/document.xsl (from 
rev 9521, trunk/frontend/templates/base/document.xsl)
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/document.xsl            
                (rev 0)
+++ branches/Version-1_0-branch/frontend/templates/base/document.xsl    
2012-06-06 12:59:29 UTC (rev 9522)
@@ -0,0 +1,105 @@
+<xsl:template match="contract_data" xmlns:php="http://php.net/xsl";>
+       <!-- <xsl:copy-of select="."/> -->
+    <div class="yui-navset" id="documents_tabview">
+    <xsl:value-of disable-output-escaping="yes" select="tabs" />
+        <div class="yui-content">
+               <div class="toolbar-container">
+                       <div class="toolbar" style="display: block; 
padding-bottom: 1em;">
+                       <div id="contract_selector">
+                                  <img 
src="frontend/templates/base/images/16x16/page_white_stack.png" 
class="list_image"/>
+                                  <form action="{form_url}" method="post" 
style="float:left;">
+                                               <select name="contract_filter" 
onchange="this.form.submit()">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="//contract_filter = 'active'">
+                                                                       <option 
value="active" selected="selected"><xsl:value-of select="php:function('lang', 
'active')"/></option>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <option 
value="active"><xsl:value-of select="php:function('lang', 'active')"/></option>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="//contract_filter = 'not_active'">
+                                                                       <option 
value="not_active" selected="selected"><xsl:value-of 
select="php:function('lang', 'not_active')"/></option>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <option 
value="not_active"><xsl:value-of select="php:function('lang', 
'not_active')"/></option>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="//contract_filter = 'all'">
+                                                                       <option 
value="all" selected="selected"><xsl:value-of select="php:function('lang', 
'all')"/></option>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <option 
value="all"><xsl:value-of select="php:function('lang', 'all')"/></option>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </select>
+                                       </form>
+                                       <xsl:choose>
+                                               <xsl:when 
test="not(normalize-space(select)) and (count(select) &lt;= 1)">
+                                                        <em 
style="margin-left: 1em; float: left;"><xsl:value-of 
select="php:function('lang', 'no_contracts')"/></em>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                    <form action="{form_url}" 
method="post" style="float: left;">
+                                                               <xsl:for-each 
select="select">
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="id = //selected_contract">
+                                                                               
        <input name="contract_id" type="radio" value="{id}" checked="" 
onclick="this.form.submit();" style="margin-left: 1em;"></input> 
+                                                                               
</xsl:when>
+                                                                               
<xsl:otherwise> 
+                                                                               
        <input name="contract_id" type="radio" value="{id}" onclick     
="this.form.submit();" style="margin-left: 1em;"></input>
+                                                                               
</xsl:otherwise>
+                                                                       
</xsl:choose>
+                                                                       <label 
style="margin-right: 1em; padding-left: 5px;"> <xsl:value-of 
select="old_contract_id"/> (<xsl:value-of select="contract_status"/>)</label>
+                                                               </xsl:for-each>
+                                                         </form>
+                                                </xsl:otherwise>
+                                               </xsl:choose>
+                                       </div>
+                               </div>
+                       </div>
+                       <div style="clear: both;"></div>
+                       <div class="tickets">
+                       <table cellpadding="2" cellspacing="2" width="95%" 
align="center">
+                               <xsl:choose>
+                                   <xsl:when test="msgbox_data != ''">
+                                       <tr>
+                                           <td align="left" colspan="3">
+                                               <xsl:call-template 
name="msgbox"/>
+                                           </td>
+                                       </tr>
+                                   </xsl:when>
+                               </xsl:choose>
+                           </table>
+                           <div id="paging_0"> </div>
+                               <div id="datatable-container_0"></div>
+                               <xsl:apply-templates select="datatable" />
+                       </div>
+        </div>
+    </div>
+</xsl:template>
+
+<xsl:template name="datatable" match="datatable">
+       <!--  DATATABLE DEFINITIONS-->
+       <script type="text/javascript">
+               var property_js = <xsl:value-of select="property_js" />;
+               var datatable = new Array();
+               var myColumnDefs = new Array();
+
+               <xsl:for-each select="datatable">
+                       datatable[<xsl:value-of select="name"/>] = [
+                       {
+                               values                  :       <xsl:value-of 
select="values"/>,
+                               total_records   :       <xsl:value-of 
select="total_records"/>,
+                               edit_action             :       <xsl:value-of 
select="edit_action"/>,
+                               is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                               footer                  :       <xsl:value-of 
select="footer"/>
+                       }
+                       ]
+               </xsl:for-each>
+
+               <xsl:for-each select="myColumnDefs">
+                       myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+               </xsl:for-each>
+       </script>
+</xsl:template>
\ No newline at end of file

Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boentity.inc.php     
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/property/inc/class.boentity.inc.php     
2012-06-06 12:59:29 UTC (rev 9522)
@@ -85,6 +85,7 @@
                        $order                                                  
= phpgw::get_var('order');
                        $filter                                                 
= phpgw::get_var('filter', 'int');
                        $district_id                                    = 
phpgw::get_var('district_id', 'int');
+                       $part_of_town_id                                = 
phpgw::get_var('part_of_town_id', 'int');
                        $status                                                 
= phpgw::get_var('status');
                        $start_date                                             
= phpgw::get_var('start_date');
                        $end_date                                               
= phpgw::get_var('end_date');
@@ -148,6 +149,10 @@
                        {
                                $this->district_id = $district_id;
                        }
+                       if(isset($_POST['part_of_town_id']) || 
isset($_GET['part_of_town_id']))
+                       {
+                               $this->part_of_town_id = $part_of_town_id;
+                       }
                        if(isset($_POST['criteria_id']) || 
isset($_GET['criteria_id']))
                        {
                                $this->criteria_id = $criteria_id;
@@ -346,7 +351,7 @@
                        }
 
                        $entity = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                               'filter' => $this->filter,'cat_id' => 
$this->cat_id,'district_id' => $this->district_id,
+                               'filter' => $this->filter,'cat_id' => 
$this->cat_id,'district_id' => $this->district_id, 'part_of_town_id' => 
$this->part_of_town_id,
                                
'lookup'=>isset($data['lookup'])?$data['lookup']:'','allrows'=>isset($data['allrows'])?$data['allrows']:'',
                                
'entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'status'=>$this->status,
                                
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),

Modified: branches/Version-1_0-branch/property/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.socommon.inc.php     
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/property/inc/class.socommon.inc.php     
2012-06-06 12:59:29 UTC (rev 9522)
@@ -167,7 +167,7 @@
 
                function reset_fm_cache_userlist()
                {
-                       $this->db->query("DELETE FROM fm_cache WHERE name 
$this->like 'acl_userlist_%'",__LINE__,__FILE__, true);
+                       $this->db->query("DELETE FROM fm_cache WHERE name 
{$this->like} 'acl_userlist_%'",__LINE__,__FILE__, true);
                        return $this->db->affected_rows();
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-06-06 12:59:29 UTC (rev 9522)
@@ -225,6 +225,7 @@
                        $order                  = isset($data['order']) && 
$data['order'] ? $data['order'] : 'id';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
                        $district_id    = isset($data['district_id']) && 
$data['district_id'] ? $data['district_id'] : 0;
+                       $part_of_town_id= isset($data['part_of_town_id']) && 
$data['part_of_town_id'] ? $data['part_of_town_id'] : 0;
                        $lookup                 = isset($data['lookup']) ? 
$data['lookup'] : '';
                        $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
                        $entity_id              = isset($data['entity_id']) ? 
$data['entity_id'] : '';
@@ -524,11 +525,16 @@
        //                      $where= 'AND';
                        }
 
-                       if ($district_id > 0 && $category['location_level'])
+                       if ($district_id > 0 && $category['location_level'] && 
!$part_of_town_id)
                        {
                                $filtermethod .= " $where  
fm_part_of_town.district_id='$district_id' ";
                                $where = 'AND';
                        }
+                       else if ($part_of_town_id > 0 && 
$category['location_level'])
+                       {
+                               $filtermethod .= " $where 
fm_part_of_town.part_of_town_id='$part_of_town_id' ";
+                               $where = 'AND';
+                       }
 
                        if ($start_date)
                        {
@@ -855,6 +861,7 @@
                        $order                  = isset($data['order']) ? 
$data['order'] : '';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
                        $district_id    = isset($data['district_id']) && 
$data['district_id'] ? $data['district_id'] : 0;
+                       $part_of_town_id= isset($data['part_of_town_id']) && 
$data['part_of_town_id'] ? $data['part_of_town_id'] : 0;
                        $lookup                 = isset($data['lookup']) ? 
$data['lookup'] : '';
                        $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
                        $entity_id              = isset($data['entity_id']) ? 
$data['entity_id'] : '';
@@ -1178,11 +1185,16 @@
                                $where= 'AND';
                        }
 
-                       if ($district_id > 0 && $category['location_level'])
+                       if ($district_id > 0 && $category['location_level'] && 
!$part_of_town_id)
                        {
                                $filtermethod .= " $where  
fm_part_of_town.district_id='$district_id' ";
                                $where = 'AND';
                        }
+                       else if ($part_of_town_id > 0 && 
$category['location_level'])
+                       {
+                               $filtermethod .= " $where  
fm_part_of_town.part_of_town_id='$part_of_town_id' ";
+                               $where = 'AND';
+                       }
 
                        if ($start_date)
                        {

Modified: branches/Version-1_0-branch/property/inc/class.solocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2012-06-06 12:57:05 UTC (rev 9521)
+++ branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2012-06-06 12:59:29 UTC (rev 9522)
@@ -1791,12 +1791,21 @@
 
                function get_children($criteria = '')
                {
+                       $join_method = '';
+                       $filtermethod = '';
                        if(is_array($criteria))
                        {
-                               $location_code  = $criteria['location_code'];
-                               $child_level    = $criteria['child_level'];
-                               $id_field               = 'location_code';
-                               $field_name             = 
$criteria['field_name'];
+                               $location_code          = 
$criteria['location_code'];
+                               $child_level            = 
$criteria['child_level'];
+                               $id_field                       = 
'location_code';
+                               $field_name                     = 
$criteria['field_name'];
+                               $part_of_town_id        = 
$criteria['part_of_town_id'];
+                               
+                               if($part_of_town_id)
+                               {
+                                       $join_method = "{$this->join} 
fm_part_of_town ON fm_part_of_town.part_of_town_id = 
fm_location1.part_of_town_id";
+                                       $filtermethod = 'AND 
fm_part_of_town.part_of_town_id =' . (int) $part_of_town_id;
+                               }
                        }
                        else
                        {
@@ -1824,7 +1833,7 @@
                                return $values;
                        }
                        
-                       $this->db->query("SELECT $id_field AS id, {$field_name} 
AS name FROM fm_location{$child_level} WHERE location_code {$this->like} 
'{$location_code}%' ORDER BY {$field_name} ASC",__LINE__,__FILE__);
+                       $this->db->query("SELECT $id_field AS id, {$field_name} 
AS name FROM fm_location{$child_level} {$join_method} WHERE location_code 
{$this->like} '{$location_code}%' {$filtermethod} ORDER BY {$field_name} 
ASC",__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $id = $this->db->f('id');




reply via email to

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