fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8109] Merge 8090:8108 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8109] Merge 8090:8108 from trunk
Date: Tue, 15 Nov 2011 07:51:12 +0000

Revision: 8109
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8109
Author:   sigurdne
Date:     2011-11-15 07:51:11 +0000 (Tue, 15 Nov 2011)
Log Message:
-----------
Merge 8090:8108 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/model/class.activity.inc.php
    branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
    branches/Version-1_0-branch/activitycalendar/templates/base/activity.php
    
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
    
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
    branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    branches/Version-1_0-branch/bim/setup/setup.inc.php
    branches/Version-1_0-branch/bim/setup/tables_current.inc.php
    branches/Version-1_0-branch/bim/setup/tables_update.inc.php
    branches/Version-1_0-branch/catch/setup/setup.inc.php
    branches/Version-1_0-branch/catch/setup/tables_current.inc.php
    branches/Version-1_0-branch/catch/setup/tables_update.inc.php
    branches/Version-1_0-branch/controller/inc/class.menu.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/controller/templates/base/view_check_lists.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/admin_entity.xsl
    branches/Version-1_0-branch/sms/bin/default/config_BR_log
    branches/Version-1_0-branch/sms/bin/default/config_ST_log

Added Paths:
-----------
    
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php
    branches/Version-1_0-branch/controller/inc/helper/
    
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl

Removed Paths:
-------------
    branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php
    branches/Version-1_0-branch/controller/templates/base/control_items.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
   + 
/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

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2011-11-15 07:51:11 UTC (rev 8109)
@@ -152,6 +152,10 @@
                        $activity_state = 
$this->marshal($filters['activity_state'],'int');
                        $filter_clauses[] = "activity.state = 
{$activity_state}";
                }
+               if(isset($filters['activity_category']) && 
$filters['activity_category'] != 'all'){
+                       $activity_category = 
$this->marshal($filters['activity_category'],'int');
+                       $filter_clauses[] = "activity.category = 
{$activity_category}";
+               }
                if(isset($filters['activity_district'])){
                        if($filters['activity_district'] != 'all')
                        {
@@ -490,9 +494,13 @@
                $i = 0;
                while ($this->db->next_record())
                {
-                       $district[$i]['part_of_town_id'] = 
$this->db->f('part_of_town_id');
-                       $district[$i]['name'] = 
stripslashes($this->db->f('name'));
-                       $i++;
+                       $name = $this->db->f('name');
+                       if($name != 'ØVRIGE')
+                       {
+                               $district[$i]['part_of_town_id'] = 
$this->db->f('part_of_town_id');
+                               $district[$i]['name'] = 
stripslashes($this->db->f('name'));
+                               $i++;
+                       }
                }
 
                return $district;
@@ -549,10 +557,14 @@
                $sql = "SELECT * FROM bb_agegroup where active=1 ORDER BY sort";
                $this->db->query($sql, __LINE__, __FILE__);
                while($this->db->next_record()){
-                       $target = new 
activitycalendar_target($this->db->f('id'));
-                       $target->set_description($this->db->f('description'));
-                       $target->set_name($this->db->f('name'));
-                       $targets[] = $target;
+                       $name = $this->db->f('name');
+                       if($name != 'Tilskuere')
+                       {
+                               $target = new 
activitycalendar_target($this->db->f('id'));
+                               
$target->set_description($this->db->f('description'));
+                               $target->set_name($this->db->f('name'));
+                               $targets[] = $target;
+                       }
                }
                return $targets;
        }
@@ -619,7 +631,7 @@
        function get_activities()
        {
                $activities = array();
-               $sql = "SELECT * FROM activity_activity";
+               $sql = "SELECT * FROM activity_activity where state=3";
                $this->db->query($sql, __LINE__, __FILE__);
                while ($this->db->next_record())
                {                       

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-11-15 07:51:11 UTC (rev 8109)
@@ -193,31 +193,74 @@
                                
$activity->set_contact_person_2_zip(phpgw::get_var('contact_person_2_zip'));
                                
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
                                
-                               if($so_activity->store($activity)) // ... and 
then try to store the object
+                               $target_ok = false;
+                               $district_ok = false;
+                               if($activity->get_target() && 
$activity->get_target() != '')
                                {
-                                       $message = lang('messages_saved_form'); 
+                                       $target_ok = true;
                                }
-                               else
+                               if($activity->get_district() && 
$activity->get_district() != '')
                                {
-                                       $error = lang('messages_form_error');
+                                       $district_ok = true;
                                }
-
-                               if($new_state == 3 || $new_state == 5 )
+                               
+                               if($target_ok && $district_ok)
                                {
-                                       $kontor = 
$so_activity->get_office_name($activity->get_office());
-                                       $subject = "Melding fra AktivBy";
-                                       $body = lang('mail_body_state_' . 
$new_state, $kontor);
-                                       
-                                       if(isset($g_id) && $g_id > 0)
+                                       if($so_activity->store($activity)) // 
... and then try to store the object
                                        {
-                                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                               $message = 
lang('messages_saved_form'); 
                                        }
-                                       else if (isset($o_id) && $o_id > 0)
+                                       else
                                        {
-                                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                               $error = 
lang('messages_form_error');
                                        }
+       
+                                       if($new_state == 3 || $new_state == 5 )
+                                       {
+                                               $kontor = 
$so_activity->get_office_name($activity->get_office());
+                                               $subject = "Melding fra 
AktivBy";
+                                               $body = lang('mail_body_state_' 
. $new_state, $kontor);
+                                               
+                                               if(isset($g_id) && $g_id > 0)
+                                               {
+                                                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                               }
+                                               else if (isset($o_id) && $o_id 
> 0)
+                                               {
+                                                       
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                               }
+                                       }
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $activity->get_id(), 'saved_ok' 
=> 'yes'));
                                }
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.view', 'id' => 
$activity->get_id(), 'saved_ok' => 'yes'));
+                               else
+                               {
+                                       if(!$target_ok)
+                                       {
+                                               $error .= "<br/>" . 
lang('target_not_selected');
+                                       }
+                                       if(!$district_ok)
+                                       {
+                                               $error .= "<br/>" . 
lang('district_not_selected');
+                                       }
+                                       return $this->render('activity.php', 
array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'organizations' => 
$organizations,
+                                                       'org_name' => $org_name,
+                                                       'groups' => $groups,
+                                                       'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
+                                                       'categories' => 
$categories,
+                                                       'targets' => $targets,
+                                                       'districts' => 
$districts,
+                                                       'offices' => $offices,
+                                                       'editable' => true,
+                                                       'cancel_link' => 
$cancel_link,
+                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                               )       
+                                       );
+                               }
                        }
                }
 
@@ -288,7 +331,7 @@
                                break;
                        case 'all_activities':
                        default:
-                               $filters = array('activity_state' => 
phpgw::get_var('activity_state'), 'activity_district' => 
phpgw::get_var('activity_district'), 'user_id' => $uid);
+                               $filters = array('activity_state' => 
phpgw::get_var('activity_state'), 'activity_category' => 
phpgw::get_var('activity_category'), 'activity_district' => 
phpgw::get_var('activity_district'), 'user_id' => $uid);
                                $result_objects = 
activitycalendar_soactivity::get_instance()->get($start_index, $num_of_objects, 
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
                                $object_count = 
activitycalendar_soactivity::get_instance()->get_count($search_for, 
$search_type, $filters);
                                break;
@@ -353,6 +396,15 @@
                                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.send_mail', 'activity_id' => 
$value['id'],'message_type' => 'update')));
                                $value['labels'][] = lang('send_mail');
                                break;
+                       
+                       case 'new_activities':
+                               $value['ajax'][] = false;
+                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $value['id'])));
+                               $value['labels'][] = lang('edit');
+                               $value['ajax'][] = false;
+                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $value['id'])));
+                               $value['labels'][] = lang('show');
+                               break;
                }
     }
     

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php     
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php     
2011-11-15 07:51:11 UTC (rev 8109)
@@ -480,14 +480,14 @@
                                else    //add org unit without org no
                                {
                                        $org_info = array();
-                                       if($activity_group && !$activity_group 
== '')
-                                       {
-                                               $org_info['name'] = 
$activity_group;
-                                       }
-                                       else
-                                       {
+                                       //if($activity_group && 
!$activity_group == '')
+                                       //{
+                                       //      $org_info['name'] = 
$activity_group;
+                                       //}
+                                       //else
+                                       //{
                                                $org_info['name'] = 
$org_name_tmp;
-                                       }
+                                       //}
                                         
                                        //$org_info['orgnr'] = 
$this->decode($data[2]);
                                        $org_info['homepage'] = 
$this->decode($data[16]);

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-11-15 07:44:27 UTC (rev 8108)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-11-15 07:51:11 UTC (rev 8109)
@@ -642,6 +642,29 @@
                                        $value['labels'][] = lang('edit');
                                }
                                break;
+                       case 'new_organizations':
+                               $value['ajax'][] = false;
+                               if($value['organization_id'] != '' && 
$value['organization_id'] != null){
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' => 
'group')));
+                               }
+                               else
+                               {
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'])));
+                               }
+                               $value['labels'][] = lang('show');
+                               if($value['transferred'] == false)
+                               {
+                                       $value['ajax'][] = false;
+                                       if($value['organization_id'] != '' && 
$value['organization_id'] != null){
+                                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' => 
'group')));
+                                       }
+                                       else
+                                       {
+                                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.edit', 'id' => $value['id'])));
+                                       }
+                                       $value['labels'][] = lang('edit');
+                               }
+                               break;
                        case 'changed_groups':
                                $value['ajax'][] = false;
                                if($value['organization_id'] != '' && 
$value['organization_id'] != null){
@@ -665,6 +688,29 @@
                                        $value['labels'][] = lang('edit');
                                }
                                break;
+                       case 'new_groups':
+                               $value['ajax'][] = false;
+                               if($value['organization_id'] != '' && 
$value['organization_id'] != null){
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' => 
'group')));
+                               }
+                               else
+                               {
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'])));
+                               }
+                               $value['labels'][] = lang('show');
+                               if($value['transferred'] == false)
+                               {
+                                       $value['ajax'][] = false;
+                                       if($value['organization_id'] != '' && 
$value['organization_id'] != null){
+                                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.edit', 'id' => $value['id'], 'type' => 
'group')));
+                                       }
+                                       else
+                                       {
+                                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.edit', 'id' => $value['id'])));
+                                       }
+                                       $value['labels'][] = lang('edit');
+                               }
+                               break;
                }
     }
 }

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/model/class.activity.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/model/class.activity.inc.php   
    2011-11-15 07:44:27 UTC (rev 8108)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/model/class.activity.inc.php   
    2011-11-15 07:51:11 UTC (rev 8109)
@@ -246,8 +246,14 @@
                public function serialize()
                {
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       if(isset($this->organization_id) && 
$this->get_organization_id() > 0)
+                       if(isset($this->group_id) && $this->get_group_id() > 0)
                        {
+                               $contact_1 = 
activitycalendar_socontactperson::get_instance()->get_group_contact_name($this->get_contact_person_1());
+                               $contact_2 = 
activitycalendar_socontactperson::get_instance()->get_group_contact_name($this->get_contact_person_2());
+                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($this->get_group_id());
+                       }
+                       else if(isset($this->organization_id) && 
$this->get_organization_id() > 0)
+                       {
                                if($this->get_new_org())
                                {
                                        $org_name = 
activitycalendar_soorganization::get_instance()->get_organization_name_local($this->get_organization_id());
@@ -262,13 +268,7 @@
                                        $contact_2 = 
activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_2());
                                        $desc = 
activitycalendar_soorganization::get_instance()->get_description($this->get_organization_id());
                                }
-                       }
-                       else if(isset($this->group_id) && $this->get_group_id() 
> 0)
-                       {
-                               $contact_1 = 
activitycalendar_socontactperson::get_instance()->get_group_contact_name($this->get_contact_person_1());
-                               $contact_2 = 
activitycalendar_socontactperson::get_instance()->get_group_contact_name($this->get_contact_person_2());
-                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($this->get_group_id());
-                       }
+                       } 
                        else
                        {
                                $contact_1 = "";

Modified: branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-11-15 07:51:11 UTC (rev 8109)
@@ -367,8 +367,8 @@
 state_0        activitycalendar        no      Ingen
 state_1        activitycalendar        no      Ny
 state_2        activitycalendar        no      Endring
-state_3        activitycalendar        no      Akseptert
-state_4        activitycalendar        no      Behandlet
+state_3        activitycalendar        no      Publisert
+state_4        activitycalendar        no      Publisert
 state_5        activitycalendar        no      Avvist
 activity_import        activitycalendar        no      Importer aktiviteter
 office activitycalendar        no      Hovedansvarlig kulturkontor
@@ -402,4 +402,6 @@
 published      activitycalendar        no      Publisert
 contactperson_not_set  activitycalendar        no      Kontaktpersoner hentes 
fra valgt organisasjon/gruppe ved lagring.
 description_not_set    activitycalendar        no      Beskrivelse hentes fra 
valgt organisasjon/gruppe ved lagring (Max 255 tegn).
-back_to_list   activitycalendar        no      Tilbake til oversikt
\ No newline at end of file
+back_to_list   activitycalendar        no      Tilbake til oversikt
+target_not_selected    activitycalendar        no      Målgruppe må velges!
+district_not_selected  activitycalendar        no      Distrikt må velges!
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/activitycalendar/templates/base/activity.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/templates/base/activity.php    
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/activitycalendar/templates/base/activity.php    
2011-11-15 07:51:11 UTC (rev 8109)
@@ -37,8 +37,48 @@
 {
        get_available_groups();
 });
+
+function allOK()
+{
+       if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
+       {
+               alert("Tittel må fylles ut!");
+               return false;
+       } 
+       if(document.getElementById('organization_id').value == null || 
document.getElementById('organization_id').value == '')
+       {
+               alert("Organisasjon må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('internal_arena_id').value == null || 
document.getElementById('internal_arena_id').value == 0)
+       {
+               if(document.getElementById('arena_id').value == null || 
document.getElementById('arena_id').value == 0)
+               {
+                       alert("Arena må fylles ut!");
+                       return false;
+               }
+       }
+       if(document.getElementById('time').value == null || 
document.getElementById('time').value == '')
+       {
+               alert("Tid må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('category').value == null || 
document.getElementById('category').value == 0)
+       {
+               alert("Kategori må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('office').value == null || 
document.getElementById('office').value == 0)
+       {
+               alert("Hovedansvarlig kulturkontor må fylles ut!");
+               return false;
+       }
+       else
+               return true;
+}
 </script>
 <?php echo activitycalendar_uicommon::get_page_message($message) ?>
+<?php echo activitycalendar_uicommon::get_page_error($error) ?>
 <div class="yui-content">
        <div id="details">
                <h1><img src="<?php echo ACTIVITYCALENDAR_IMAGE_PATH 
?>images/32x32/custom/contact.png" /><?php echo lang('activity') ?></h1>
@@ -212,7 +252,7 @@
                                        if ($editable)
                                        {
                                                ?>
-                                               <select 
name="internal_arena_id">
+                                               <select 
name="internal_arena_id" id="internal_arena_id">
                                                        <option value="0">Ingen 
kommunale bygg valgt</option>
                                                        <?php
                                                        foreach($buildings as 
$building_id => $building_name)
@@ -242,7 +282,7 @@
                                        if ($editable)
                                        {
                                                ?>
-                                               <select name="arena_id">
+                                               <select name="arena_id" 
id="arena_id">
                                                        <option value="0">Ingen 
arena valgt</option>
                                                        <?php
                                                        foreach($arenas as 
$arena)
@@ -291,7 +331,7 @@
                                        if ($editable)
                                        {
                                                ?>
-                                               <select name="category">
+                                               <select name="category" 
id="category">
                                                        <option value="0">Ingen 
kategori valgt</option>
                                                        <?php
                                                        foreach($categories as 
$category)
@@ -325,7 +365,7 @@
                                                foreach($targets as $t)
                                                {
                                                ?>
-                                                       <input name="target[]" 
type="checkbox" value="<?php echo $t->get_id()?>" <?php echo 
(in_array($t->get_id(), $current_target_id_array) ? 'checked' : "")?>/><?php 
echo $t->get_name()?><br/>
+                                                       <input name="target[]" 
id="target[]" type="checkbox" value="<?php echo $t->get_id()?>" <?php echo 
(in_array($t->get_id(), $current_target_id_array) ? 'checked' : "")?>/><?php 
echo $t->get_name()?><br/>
                                                <?php
                                                }
                                        }
@@ -386,7 +426,7 @@
                                        {
                                                $selected_office = 
$activity->get_office();
                                        ?>
-                                               <select name="office">
+                                               <select name="office" 
id="office">
                                                        <option value="0">Ingen 
kontor valgt</option>
                                                        <?php
                                                        foreach($offices as 
$office)
@@ -480,7 +520,7 @@
                        <div class="form-buttons">
                                <?php
                                        if ($editable) {
-                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '"/>';
+                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '" onclick="return allOK();"/>';
                                                echo '<a href="' . $cancel_link 
. '">' . lang('back_to_list') . '</a>';
                                        }
                                        else

Modified: 
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
       2011-11-15 07:44:27 UTC (rev 8108)
+++ 
branches/Version-1_0-branch/activitycalendar/templates/base/activity_list_partial.php
       2011-11-15 07:51:11 UTC (rev 8109)
@@ -114,7 +114,7 @@
                
'index.php?menuaction=activitycalendar.uiactivities.query&amp;phpgw_return_as=json<?php
 echo $url_add_on; ?>&amp;editable=<?php echo $editable ? "true" : "false"; ?>',
                columnDefs,
                '<?php echo $list_id ?>_form',
-               ['<?php echo $list_id ?>_ctrl_toggle_activity_state', '<?php 
echo $list_id ?>_ctrl_toggle_activity_district', '<?php echo $list_id 
?>_ctrl_search_query'],
+               ['<?php echo $list_id ?>_ctrl_toggle_activity_state', '<?php 
echo $list_id ?>_ctrl_toggle_activity_district', '<?php echo $list_id 
?>_ctrl_toggle_activity_category', '<?php echo $list_id ?>_ctrl_search_query'],
                '<?php echo $list_id ?>_container',
                '<?php echo $list_id ?>_paginator',
                '<?php echo $list_id ?>',
@@ -207,6 +207,19 @@
                        }
                        ?>
                </select>
+               <label class="toolbar_element_label" 
for="ctrl_toggle_activity_category"><?php echo lang('category') ?></label>
+               <?php
+                       $categories = 
activitycalendar_soactivity::get_instance()->get_categories(); 
+               ?>
+               <select name="activity_category" id="<?php echo $list_id 
?>_ctrl_toggle_activity_category">
+                       <option value="all"><?php echo lang('all') ?></option>
+                       <?php
+                       foreach($categories as $category)
+                       {
+                               echo "<option 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
+                       }
+                       ?>
+               </select>
        </fieldset>
        
        

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-11-15 07:44:27 UTC (rev 8108)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-11-15 07:51:11 UTC (rev 8109)
@@ -57,26 +57,10 @@
 
                        $id = intval(phpgw::get_var('id', 'GET'));
                        $action = phpgw::get_var('action', 'GET');
-                       //var_dump($id);
+
                        $so_activity = 
activitycalendar_soactivity::get_instance();
                        $so_arena = activitycalendar_soarena::get_instance();
-                       //$activity = $so->get_single($id);
-                       
-                       //var_dump(phpgw::get_var('secret', 'GET'));
-                       //var_dump($activity->get_secret());
 
-                       
-                       
-                       //var_dump($activity->get_title());
-                       //$this->redirect(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $id, 'frontend' => 'true'));
-                                               
-/*                     $application['resource_ids'] = $resource_ids;
-                       $agegroups = $this->agegroup_bo->fetch_age_groups();
-                       $agegroups = $agegroups['results'];
-                       $audience = $this->audience_bo->fetch_target_audience();
-                       $audience = $audience['results'];
-                       self::render_template('application', 
array('application' => $application, 'audience' => $audience, 'agegroups' => 
$agegroups, 'frontend'=>'true'));
-*/
                        $categories = $so_activity->get_categories();
                        $targets = $so_activity->get_targets();
                        $offices = $so_activity->select_district_list();
@@ -254,14 +238,11 @@
                        {
                                if(isset($activity)) // If an activity object 
is created
                                {
-//                                     var_dump("lagre1");
+
                                        $old_state = $activity->get_state();
                                        $new_state = phpgw::get_var('state');
-//     var_dump("lagre2");
                                        // ... set all parameters
                                        
$activity->set_title(phpgw::get_var('title'));
-                                       
//$activity->set_organization_id(phpgw::get_var('organization_id'));
-                                       
//$activity->set_group_id(phpgw::get_var('group_id'));
                                        $activity->set_organization_id($o_id);
                                        $activity->set_group_id($g_id);
                                        
$activity->set_arena(phpgw::get_var('arena_id'));
@@ -278,7 +259,6 @@
                                        {
                                                
$activity->set_state($new_state);
                                        }
-//                                     var_dump("lagre3");
                                        
$activity->set_category(phpgw::get_var('category'));
                                        $target_array = 
phpgw::get_var('target');
                                        $activity->set_target(implode(",", 
$target_array));
@@ -287,33 +267,92 @@
                                        
$activity->set_contact_persons($persons);
                                        
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
                                        $activity->set_frontend(true);
-                                       
-//                                     var_dump("storing"); 
-                                       
-                                       if($so_activity->store($activity)) // 
... and then try to store the object
+
+                                       $target_ok = false;
+                                       $district_ok = false;
+                                       if($activity->get_target() && 
$activity->get_target() != '')
                                        {
-                                               $message = 
lang('messages_saved_form'); 
+                                               $target_ok = true;
                                        }
-                                       else
+                                       if($activity->get_district() && 
$activity->get_district() != '')
                                        {
-                                               $error = 
lang('messages_form_error');
+                                               $district_ok = true;
                                        }
-       
-                                       if($new_state == 3 || $new_state == 4 
|| $new_state == 5 )
+                                       
+                                       if($target_ok && $district_ok)
                                        {
-                                               $kontor = 
$so_activity->get_office_name($activity->get_office());
-                                               $subject = "Melding fra 
AktivBy";
-                                               $body = lang('mail_body_state_' 
. $new_state, $kontor);
                                                
-                                               if(isset($g_id) && $g_id > 0)
+                                               
if($so_activity->store($activity)) // ... and then try to store the object
                                                {
-                                                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                                       $message = 
lang('messages_saved_form'); 
                                                }
-                                               else if (isset($o_id) && $o_id 
> 0)
+                                               else
                                                {
-                                                       
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                                       $error = 
lang('messages_form_error');
                                                }
+               
+                                               if($new_state == 3 || 
$new_state == 4 || $new_state == 5 )
+                                               {
+                                                       $kontor = 
$so_activity->get_office_name($activity->get_office());
+                                                       $subject = "Melding fra 
AktivBy";
+                                                       $body = 
lang('mail_body_state_' . $new_state, $kontor);
+                                                       
+                                                       if(isset($g_id) && 
$g_id > 0)
+                                                       {
+                                                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                                       }
+                                                       else if (isset($o_id) 
&& $o_id > 0)
+                                                       {
+                                                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                                       }
+                                               }
+                                               
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+       
+                                               $this->render('activity.php', 
array
+                                                                       (
+                                                                               
'activity'      => $activity,
+                                                                               
'organizations' => $organizations,
+                                                                               
'groups' => $groups,
+                                                                               
'arenas' => $arenas,
+                                                                               
'buildings' => $buildings,
+                                                                               
'categories' => $categories,
+                                                                               
'targets' => $targets,
+                                                                               
'districts' => $districts,
+                                                                               
'offices' => $offices,
+                                                                               
'message' => isset($message) ? $message : phpgw::get_var('message'),
+                                                                               
'error' => isset($error) ? $error : phpgw::get_var('error')
+                                                                       )
+                                               );
                                        }
+                                       else
+                                       {
+                                               if(!$target_ok)
+                                               {
+                                                       $error .= "<br/>" . 
lang('target_not_selected');
+                                               }
+                                               if(!$district_ok)
+                                               {
+                                                       $error .= "<br/>" . 
lang('district_not_selected');
+                                               }
+                                               return 
$this->render('activity.php', array
+                                                       (
+                                                               'activity'      
=> $activity,
+                                                               'organizations' 
=> $organizations,
+                                                               'org_name' => 
$org_name,
+                                                               'groups' => 
$groups,
+                                                               'arenas' => 
$arenas,
+                                                               'buildings' => 
$buildings,
+                                                               'categories' => 
$categories,
+                                                               'targets' => 
$targets,
+                                                               'districts' => 
$districts,
+                                                               'offices' => 
$offices,
+                                                               'editable' => 
true,
+                                                               'cancel_link' 
=> $cancel_link,
+                                                               'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                               'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                                       )       
+                                               );
+                                       }
                                }
                        }
                        

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2011-11-15 07:51:11 UTC (rev 8109)
@@ -61,4 +61,6 @@
 arena_helptext activitycalendarfrontend        no      Dersom aktiviteten skal 
finne sted på en ikke-kommunal arena, velges dette her.<br/>Dersom aktiviteten 
finner sted på flere arenaer, velg hovedarena her.
 messages_saved_form    activitycalendarfrontend        no      Aktiviteten ble 
lagret
 messages_form_error    activitycalendarfrontend        no      Det oppstod et 
problem under lagring
-change_request_ok      activitycalendarfrontend        no      Endringsønske 
for organisasjon er sendt inn for organisasjon %1
\ No newline at end of file
+change_request_ok      activitycalendarfrontend        no      Endringsønske 
for organisasjon er sendt inn for organisasjon %1
+target_not_selected    activitycalendarfrontend        no      Målgruppe må 
velges!
+district_not_selected  activitycalendarfrontend        no      Distrikt må 
velges!
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-11-15 07:44:27 UTC (rev 8108)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-11-15 07:51:11 UTC (rev 8109)
@@ -23,12 +23,16 @@
                //alert('new_org');
                document.getElementById('new_org').style.display = "block";
                document.getElementById('new_org_fields').style.display = 
"block";
+               document.getElementById('group_label').style.display = "none";
+               document.getElementById('group_select').style.display = "none";
        }
        else if(org_id != null && org_id == 'change_org')
        {
                document.getElementById('new_org').style.display = "block";
                document.getElementById('new_org_fields').style.display = 
"none";
                document.getElementById('change_org_fields').style.display = 
"block";
+               document.getElementById('group_label').style.display = "none";
+               document.getElementById('group_select').style.display = "none";
        }
        else
        {
@@ -114,6 +118,45 @@
        
 }
 
+function allOK()
+{
+       if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
+       {
+               alert("Tittel må fylles ut!");
+               return false;
+       } 
+       if(document.getElementById('organization_id').value == null || 
document.getElementById('organization_id').value == '')
+       {
+               alert("Organisasjon må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('internal_arena_id').value == null || 
document.getElementById('internal_arena_id').value == 0)
+       {
+               if(document.getElementById('arena_id').value == null || 
document.getElementById('arena_id').value == 0)
+               {
+                       alert("Arena må fylles ut!");
+                       return false;
+               }
+       }
+       if(document.getElementById('time').value == null || 
document.getElementById('time').value == '')
+       {
+               alert("Tid må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('category').value == null || 
document.getElementById('category').value == 0)
+       {
+               alert("Kategori må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('office').value == null || 
document.getElementById('office').value == 0)
+       {
+               alert("Hovedansvarlig kulturkontor må fylles ut!");
+               return false;
+       }
+       else
+               return true;
+}
+
 </script>
 
 <div class="yui-content" style="width: 100%;">
@@ -216,7 +259,7 @@
                                                        <option value="<?php 
echo $d['part_of_town_id']?>"><?php echo $d['name']?></option>
                                                <?php
                                                }?>
-                                                       </select>
+                                                       </select><br/>
                                                <label 
for="homepage">Hjemmeside</label>
                                                <input type="text" 
name="homepage"/><br/>
                                                <label 
for="email">E-post</label>
@@ -228,7 +271,7 @@
                                                <div 
id="address_container"></div><br/>
                                                <label 
for="number">Nummer</label>
                                                <input type="text" 
name="number"/><br/>
-                                               <label 
for="postaddress">Postnummer / Sted</label>
+                                               <label 
for="postaddress">Postnummer og Sted</label>
                                                <input type="text" 
name="postaddress"/>
                                                <label 
for="org_description">Beskrivelse</label>
                                                <textarea rows="10" cols="100" 
name="org_description"></textarea>
@@ -253,13 +296,13 @@
                                        <div 
id="contact2_address_container"></div><br/>
                                        <label 
for="contact2_number">Nummer</label>
                                        <input type="text" 
name="contact2_number"/><br/>
-                                       <label 
for="contact2_postaddress">Postnummer / Sted</label>
+                                       <label 
for="contact2_postaddress">Postnummer og Sted</label>
                                        <input type="text" 
name="contact2_postaddress"/>
                                        <hr/>
                                </div>
                                <dt>
                                        <?php if($activity->get_group_id() || 
$editable) { ?>
-                                       <label for="group_id"><?php echo 
lang('group') ?></label>
+                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
                                        <?php } ?>
                                </dt>
                                <dd>
@@ -330,7 +373,7 @@
                                        {
                                                ?>
                                                <?php echo 
lang('int_arena_helptext')?><br/>
-                                               <select 
name="internal_arena_id">
+                                               <select 
name="internal_arena_id" id="internal_arena_id">
                                                        <option value="0">Ingen 
kommunale bygg valgt</option>
                                                        <?php
                                                        foreach($buildings as 
$building_id => $building_name)
@@ -361,7 +404,7 @@
                                        {
                                                ?>
                                                <?php echo 
lang('arena_helptext')?><br/>
-                                               <select name="arena_id" 
style="width: 60%">
+                                               <select name="arena_id" 
id="arena_id" style="width: 60%">
                                                        <option value="0">Ingen 
arena valgt</option>
                                                        <?php
                                                        foreach($arenas as 
$arena)
@@ -418,7 +461,7 @@
                                        if ($editable)
                                        {
                                                ?>
-                                               <select name="category">
+                                               <select name="category" 
id="category">
                                                        <option value="0">Ingen 
kategori valgt</option>
                                                        <?php
                                                        foreach($categories as 
$category)
@@ -480,7 +523,7 @@
                                        {
                                                $selected_office = 
$activity->get_office();
                                        ?>
-                                               <select name="office">
+                                               <select name="office" 
id="office">
                                                        <option value="0">Ingen 
kontor valgt</option>
                                                        <?php
                                                        foreach($offices as 
$office)
@@ -602,7 +645,7 @@
                        <div class="form-buttons">
                                <?php
                                        if ($editable) {
-                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '"/>';
+                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '" onclick="return allOK();"/>';
                                        }
                                ?>
                        </div>

Modified: branches/Version-1_0-branch/bim/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/setup.inc.php 2011-11-15 07:44:27 UTC 
(rev 8108)
+++ branches/Version-1_0-branch/bim/setup/setup.inc.php 2011-11-15 07:51:11 UTC 
(rev 8109)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['bim']['name']                      = 'bim';
-       $setup_info['bim']['version']           = '0.9.17.500';
+       $setup_info['bim']['version']           = '0.9.17.501';
        $setup_info['bim']['app_order']         = 8;
        $setup_info['bim']['enable']            = 1;
        $setup_info['bim']['app_group']         = 'office';

Modified: branches/Version-1_0-branch/bim/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/tables_current.inc.php        
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/bim/setup/tables_current.inc.php        
2011-11-15 07:51:11 UTC (rev 8109)
@@ -15,6 +15,8 @@
                'fm_bim_type' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
+                               'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'is_ifc' => array('type' => 'int','precision' 
=> 2,'default' => 1,'nullable' => True),
                                'name' => array('type' => 'varchar', 
'precision' => 64,'nullable' => False),
                                'description' => array('type' => 'varchar', 
'precision' => 512,'nullable' => True)
                        ),
@@ -47,13 +49,20 @@
                        'fd' => array(
                                'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
                                'type' => array('type' => 'int', 'precision' => 
4,'nullable' => False),
-                               'guid' => array('type' => 'varchar', 
'precision' => 24,'nullable' => False),
+                               'guid' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'xml_representation' => array('type' => 
'xml','nullable' => False),
                                'model' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False),
+                               'p_location_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_id' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                        ),
                        'pk' => array('id'),
-                       'fk' => array('fm_bim_model' => array('model' => 'id'),
-                                                       'fm_bim_type' => 
array('type' => 'id')),
+                       'fk' => array('fm_bim_type' => array('type' => 'id')),
+//                     'fk' => array('fm_bim_model' => array('model' => 'id'),
+//                                                     'fm_bim_type' => 
array('type' => 'id')),
                        'ix' => array(),
                        'uc' => array('guid')
                )

Modified: branches/Version-1_0-branch/bim/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/tables_update.inc.php 2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/bim/setup/tables_update.inc.php 2011-11-15 
07:51:11 UTC (rev 8109)
@@ -14,19 +14,24 @@
        /**
        * Update bim version from 0.9.17.500 to 0.9.17.501
        */
-
-
-/*
        $test[] = '0.9.17.500';
        function bim_upgrade0_9_17_500()
        {
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_type','location_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_type','is_ifc',array('type' 
=> 'int','precision' => 2,'default' => 1,'nullable' => True));
 
-
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','p_location_id', 
array('type' => 'int','precision' => '4','nullable' => True));
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','p_id', 
array('type' => 'int','precision' => '4','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','location_code', 
array('type' => 'varchar','precision' => '20','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','address', array('type' 
=> 'varchar','precision' => '150','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','entry_date', 
array('type' => 'int','precision' => '4','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','user_id', array('type' 
=> 'int','precision' => '4','nullable' => True));
+               
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['bim']['currentver'] = 
'0.9.17.501';
                        return $GLOBALS['setup_info']['bim']['currentver'];
                }
        }
-*/
+

Modified: branches/Version-1_0-branch/catch/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/setup.inc.php       2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/catch/setup/setup.inc.php       2011-11-15 
07:51:11 UTC (rev 8109)
@@ -27,7 +27,7 @@
         */
 
        $setup_info['catch']['name']                    = 'catch';
-       $setup_info['catch']['version']                 = '0.9.17.511';
+       $setup_info['catch']['version']                 = '0.9.17.512';
        $setup_info['catch']['app_order']               = 20;
        $setup_info['catch']['enable']                  = 1;
        $setup_info['catch']['globals_checked'] = True;

Modified: branches/Version-1_0-branch/catch/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/tables_current.inc.php      
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/catch/setup/tables_current.inc.php      
2011-11-15 07:51:11 UTC (rev 8109)
@@ -56,6 +56,7 @@
                                'loc_link' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'start_project' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'start_ticket' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'is_eav' => array('type' => 'int','precision' 
=> '2','nullable' => True),
                                'jasperupload' => array('type' => 
'int','precision' => 2,'nullable' => True),
                                'parent_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => True),

Modified: branches/Version-1_0-branch/catch/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/tables_update.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/catch/setup/tables_update.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -344,3 +344,23 @@
                        return $GLOBALS['setup_info']['catch']['currentver'];
                }
        }
+
+       /**
+       * Update catch version from 0.9.17.511 to 0.9.17.512
+       * Add flag for eav modelling
+       */
+
+       $test[] = '0.9.17.511';
+       function catch_upgrade0_9_17_511()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_catch_category','is_eav',array('type'
 => 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['catch']['currentver'] = 
'0.9.17.512';
+                       return $GLOBALS['setup_info']['catch']['currentver'];
+               }
+       }
+

Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -52,7 +52,7 @@
                                                'text'  => lang('Check_list'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list.index') ),
                                    'image'     => array('property', 
'location_1'),
-                                       ),
+                                       )
                                );
                        }
                        else
@@ -65,6 +65,12 @@
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicheck_list.index') ),
                                    'image'     => array('property', 
'location_1'),
                                        ),
+                                       'location_check_list' => array
+                                       (
+                                               'text'  => 
lang('Check_list_location'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uilocation_check_list.view_check_lists_for_location') ),
+                               'image' => array('property', 'location_1'),
+                                       ),
                                );
                        }
                        

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -48,10 +48,10 @@
        function update($check_item){
                
                $id = $check_item->get_id();
-               
+
                $values = array(
                        'control_item_id = ' . 
$this->marshal($check_item->get_control_item_id(), 'int'),
-                       'status = ' . $this->marshal($check_item->get_status(), 
'string'),
+                       'status = ' . $this->marshal($check_item->get_status(), 
'bool'),
                        'comment = ' . 
$this->marshal($check_item->get_comment(), 'string'),
                        'check_list_id = ' . 
$this->marshal($check_item->get_check_list_id(), 'int')
                );

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -53,17 +53,8 @@
                        return null;
                }
        }
-       
-       
-               protected $id;
-               protected $title;
-               protected $required;
-               protected $what_to_do;
-               protected $how_to_do;
-               protected $control_group_id;
                
-       
-       public function get_single_with_control_item($check_list_id){
+       public function get_single_with_control_items($check_list_id){
                $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
                $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id, "; 
                $sql .= "coi.title as coi_id, coi.title as coi_title, 
coi.required as coi_required, coi.required as coi_required, ";
@@ -155,7 +146,12 @@
        }
        
        function get_check_lists_for_control($control_id){
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id FROM 
controller_check_list cl, controller_check_item ci WHERE cl.control_id = 
$control_id AND cl.id = ci.check_list_id ORDER BY cl.id;";
+               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
+               $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id ";
+               $sql .= "FROM controller_check_list cl, controller_check_item 
ci ";
+               $sql .= "WHERE cl.control_id = $control_id ";
+               $sql .= "AND cl.id = ci.check_list_id "; 
+               $sql .= "ORDER BY cl.id;";
                $this->db->query($sql);
                
                $check_list_id = 0;
@@ -196,7 +192,70 @@
                }else {
                        return null;
                }
+       }
+       
+       function get_check_lists_for_location($location_code){
+               $sql =  "SELECT c.id as c_id, cl.id as cl_id, cl.status as 
cl_status, cl.comment as cl_comment, deadline, planned_date, completed_date, 
cl.location_code as cl_loc, c.* ";
+               $sql .= "FROM controller_check_list cl, controller_control c ";
+               $sql .= "WHERE cl.location_code = $location_code ";
+               $sql .= "AND cl.control_id = c.id ";
+               $sql .= "ORDER BY c.id;";
                
+               $this->db->query($sql);
+               
+               $control_id = 0;
+               $control = null;
+               while ($this->db->next_record()) {
+                       
+                       if( $this->db->f('c_id', true) != $control_id ){
+                               
+                               if($control_id != 0){
+                                       
$control->set_check_lists_array($check_lists_array);
+                                       $controls_array[] = $control;
+                               }
+                       
+                               $control = new 
controller_control($this->unmarshal($this->db->f('c_id', true), 'int'));
+                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
+                               
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
+                               
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+                               
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true), 
'int'));
+                               
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', 
true), 'string'));
+                               
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id', 
true), 'int'));
+                               
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
 true), 'int'));
+                               
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
 true), 'int'));
+                               
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
+                               
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 true), 'string'));
+                               
$control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id',
 true), 'int'));
+                               
$control->set_equipment_id($this->unmarshal($this->db->f('equipment_id', true), 
'int'));
+                               
$control->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));
+                               
$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'));
+                                                               
+                               $check_lists_array = array();
+                       }
+
+                       $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+                       
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'string'));
+                       
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
+                       
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));     
+                       
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date', 
true), 'int'));
+                       
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int'));
+                       
$check_list->set_location_code($this->unmarshal($this->db->f('cl_loc', true), 
'int'));
+               
+                       $check_lists_array[] = $check_list;
+
+                       $control_id =  $control->get_id();
+               }
+               
+               if($control != null){
+                       $control->set_check_lists_array($check_lists_array);
+                       $controls_array[] = $control;
+                       
+                       return $controls_array;
+               }else {
+                       return null;
+               }       
        }
        
        function get_query(string $sort_field, boolean $ascending, string 
$search_for, string $search_type, array $filters, boolean $return_count)
@@ -266,10 +325,11 @@
 
        function populate(int $control_id, &$control)
        {
-               $start_date = date("d.m.Y",  $this->db->f('start_date'));
-               $end_date = date("d.m.Y",  $this->db->f('end_date'));
+               
                        
                if($control == null) {
+                       $start_date = date("d.m.Y",  
$this->db->f('start_date'));
+                       $end_date = date("d.m.Y",  $this->db->f('end_date'));
                        $control = new controller_control((int) $control_id);
 
                        
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
@@ -317,5 +377,22 @@
        
        function update($object){}
        
-       function get_id_field_name(){}  
+       function get_id_field_name($extended_info = false)
+       {
+               if(!$extended_info)
+               {
+                       $ret = 'id';
+               }
+               else
+               {
+                       $ret = array
+                       (
+                               'table'                 => 'control', // alias
+                               'field'                 => 'id',
+                               'translated'    => 'id'
+                       );
+               }
+               
+               return $ret;
+       }       
 }

Modified: branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2011-11-15 07:51:11 UTC (rev 8109)
@@ -42,6 +42,7 @@
                {
                        return $this->db->db_addslashes($value);
                }
+                               
                return "'" . $this->db->db_addslashes($value) . "'";
        }
 

Modified: branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php        
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php        
2011-11-15 07:51:11 UTC (rev 8109)
@@ -135,6 +135,39 @@
                return $procedure;
        }
        
+       function get_procedures_by_control_area_id($control_area_id)
+       {
+               $results = array();
+               
+               $sql = "SELECT * FROM controller_procedure WHERE 
control_area_id=$control_area_id";
+               $this->db->query($sql);
+               
+               while($this->db->next_record()) {
+                       $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id', true), 'int'));
+                       
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                       
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
+                       
$procedure->set_responsibility($this->unmarshal($this->db->f('responsibility', 
true), 'string'));
+                       
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
+                       
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
+                       
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+                       
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+                       
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+                       
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
+                       
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
+                       
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
+                       
+                       $procedures_array[] = $procedure->toArray();
+               }
+               
+               if( count( $procedures_array ) > 0 ){
+                       return $procedures_array; 
+               }
+               else
+               {
+                       return null;
+               }
+       }
+       
        function get_procedures($start = 0, $results = 1000, $sort = null, $dir 
= '', $query = null, $search_option = null, $filters = array())
        {
                $results = array();
@@ -177,7 +210,7 @@
                
                //$sql = "SELECT * FROM controller_procedure WHERE $condition 
$order";
                
-               $condition = "WHERE end_date IS NULL";
+               //$condition = "WHERE end_date IS NULL";
                $sql = "SELECT * FROM controller_procedure $condition $order";
                $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
                

Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -19,10 +19,11 @@
                (
                        'index' =>      true,
                        'view_check_lists_for_control'  =>      true,
-                       'save_check_list'       =>      true,
-                       'view_check_list'       =>      true,
-                       'edit_check_list'       =>      true,
-                       'save_check_items'      =>      true
+                       'save_check_list'                               =>      
true,
+                       'view_check_list'                               =>      
true,
+                       'edit_check_list'                               =>      
true,
+                       'save_check_items'                              =>      
true,
+                       'get_check_list_info'                   =>      true
                );
 
                public function __construct()
@@ -157,6 +158,15 @@
                        self::render_template_xsl('view_check_list', $data);
                }
                
+               // Returns check list info as JSON
+               public function get_check_list_info()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $check_list = 
$this->so_check_list->get_single_with_control_items($check_list_id);
+                       
+                       return json_encode( $check_list );
+               }
+               
                public function edit_check_list()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -173,7 +183,7 @@
                        self::render_template_xsl('edit_check_list', $data);
                }
                
-               public function view_check_lists_for_control()
+               public function control_calendar_status_overview()
                {
                        $control_id = phpgw::get_var('control_id');
                        $control = $this->so_control->get_single($control_id);
@@ -189,6 +199,26 @@
                                'date_format'           => $date_format
                        );
                        
+                       
self::render_template_xsl('control_calendar_status_overview', $data);
+               }
+               
+               
+               public function view_check_lists_for_control()
+               {
+                       $control_id = phpgw::get_var('id');
+                       $control = $this->so_control->get_single($control_id);
+                       
+                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+               
+                       $check_list_array = 
$this->so->get_check_lists_for_control( $control_id );      
+                       
+                       $data = array
+                       (
+                               'control_as_array'      => $control->toArray(),
+                               'check_list_array'      => $check_list_array,
+                               'date_format'           => $date_format
+                       );
+                       
                        self::render_template_xsl('view_check_lists', $data);
                }
                
@@ -246,7 +276,7 @@
                        $repeat_type = $control->get_repeat_type();
                        $repeat_interval = $control->get_repeat_interval();
                        
-                       $status = true;
+                       $status = "FALSE";
                        $comment = "Kommentar for sjekkliste";
                        $deadline = $start_date;
                        
@@ -263,7 +293,7 @@
                        
                        foreach($control_items_list as $control_item){
                                
-                               $status = true;
+                               $status = 0;
                                $comment = "Kommentar for sjekk item";
                                
                                // Saving check_items for a list

Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2011-11-15 07:51:11 UTC (rev 8109)
@@ -165,17 +165,18 @@
                }
                
                public function view_control_details()
-               {                       
+               {
                        $control_id = phpgw::get_var('id');
                
                        if(isset($control_id) && $control_id > 0)
                        {
                                $control = $this->so->get_single($control_id);  
                        }
-                                                               
-                       $procedures_array = 
$this->so_procedure->get_procedures_as_array();
+
                        $control_areas_array = 
$this->so_control_area->get_control_areas_as_array();
-
+                       $control_area_id = $control_areas_array[0]['id'];
+                       $procedures_array = 
$this->so_procedure->get_procedures_by_control_area_id($control_area_id);
+                       
                        $tabs = array( array(
                                                        'label' => "1: " . 
lang('Details')
                                                ), array(
@@ -201,6 +202,8 @@
                        );
                        
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
                        self::render_template_xsl(array('control_tabs', 
'control'), $data);
                        
                        $this->use_yui_editor(array('description'));
@@ -227,15 +230,16 @@
                        $this->redirect(array('menuaction' => 
'controller.uicontrol.view_control_groups', 'control_id'=>$control_id, 
'control_area_id'=>$control->get_control_area_id(), 
'control_title'=>$control_title));     
                }
                                                
-               // Displays control groups based on which chosen control area
+               // Displays control groups based on previously chosen control 
area
                public function view_control_groups(){
                        
                        $control_id = phpgw::get_var('control_id');
                        $control_area_id = phpgw::get_var('control_area_id');
                        $control_title = phpgw::get_var('control_title');
+                       $control_group_ids = 
phpgw::get_var('control_group_ids');
+                                       
+                       $control_area = $this->so_control_area->get_single( 
$control_area_id );
                        
-                       $control_area = $this->so_control_area->get_single( 
$control_area_id );
-                                               
                        $control_groups_as_array = 
$this->so_control_group->get_control_groups_as_array($control_area->get_id(), 
25);
                        
                        $tabs = array(
@@ -266,7 +270,8 @@
                                'control_id'                            => 
$control_id,
                                'control_title'                         => 
$control_title,
                                'control_area'                          => 
$control_area->toArray(),
-                               'control_groups'                        => 
$control_groups_as_array
+                               'control_groups'                        => 
$control_groups_as_array,
+                               'chosen_control_groups'         => 
$control_group_ids
                        );
                        
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
@@ -452,7 +457,7 @@
                        $repeat_type = $control->get_repeat_type();
                        $repeat_interval = $control->get_repeat_interval();
                        
-                       $status = false;
+                       $status = FALSE;
                        $comment = "Kommentar for sjekkliste";
                        $deadline = $start_date;
                        
@@ -469,7 +474,7 @@
                        
                        foreach($control_items_list as $control_item){
                                
-                               $status = true;
+                               $status = '0';
                                $comment = "Kommentar for sjekk item";
                                
                                // Saving check_items for a list
@@ -479,7 +484,7 @@
                                $new_check_item->set_control_item_id( 
$control_item->get_id() );
                                $new_check_item->set_status( $status );
                                $new_check_item->set_comment( $comment );
-
+                                                               
                                $saved_check_item = 
$this->so_check_item->store( $new_check_item );
                        }       
                        

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2011-11-15 07:51:11 UTC (rev 8109)
@@ -303,17 +303,12 @@
                                        'control_group'                 => 
array('options' => $control_group_options),
                                );
        
-       
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Control_item');
        
-       
                                
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
                                
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
                                $GLOBALS['phpgw']->richtext->generate_script();
-       
-       
-       //                      $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'controller.item', 'controller' );
-       
+
                                self::render_template_xsl('control_item', 
$data);
                        }
                }

Deleted: branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php  
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.uiexample.inc.php  
2011-11-15 07:51:11 UTC (rev 8109)
@@ -1,515 +0,0 @@
-<?php
-       phpgw::import_class('controller.uicommon');
-       phpgw::import_class('property.boevent');
-       phpgw::import_class('controller.socontrol');
-       phpgw::import_class('controller.socontrol_item');
-       phpgw::import_class('controller.socontrol_group');
-       
-       include_class('controller', 'control', 'inc/model/');
-
-       class controller_uiexample extends controller_uicommon
-       {
-               private $bo; 
-               private $so;
-               private $so_proc; 
-               
-               public $public_functions = array
-               (
-                       'index'                                 => true,
-                       'edit'                                  => true,
-                       'normal_tabs'                   => true,
-                       'separate_tabs'                 => true,
-                       'delete'                                => true,
-                       'js_poll'                               => true
-               );
-
-               public function __construct()
-               {
-                       parent::__construct();
-                       $this->so = CreateObject('controller.socontrol');
-                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
-                       $this->so_control_group = 
CreateObject('controller.socontrol_group');
-                       $this->bo = CreateObject('property.boevent',true);
-               }
-
-               public function index()
-               {
-                       self::set_active_menu('controller::example');
-                       if(phpgw::get_var('phpgw_return_as') == 'json') {
-                               return $this->index_json();
-                       }
-                       $this->bo = CreateObject('booking.boapplication');
-                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
'booking_manual';
-                       self::add_javascript('controller', 'yahoo', 
'datatable.js');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('paginator');
-
-                       $data = array(
-                               'form' => array(
-                                       'toolbar' => array(
-                                               'item' => array(
-                                                       array(
-                                                               'type' => 
'link',
-                                                               'value' => 
lang('New application'),
-                                                               'href' => 
self::link(array('menuaction' => 'controller.uiexample.index'))
-                                                       ),
-                                                       array('type' => 
'filter', 
-                                                               'name' => 
'status',
-                                'text' => lang('Status').':',
-                                'list' => array(
-                                    array(
-                                        'id' => 'none',
-                                        'name' => lang('Not selected')
-                                    ), 
-                                    array(
-                                        'id' => 'NEW',
-                                        'name' => lang('NEW')
-                                    ), 
-                                    array(
-                                        'id' => 'PENDING',
-                                        'name' =>  lang('PENDING')
-                                    ), 
-                                    array(
-                                        'id' => 'REJECTED',
-                                        'name' => lang('REJECTED')
-                                    ), 
-                                    array(
-                                        'id' => 'ACCEPTED',
-                                        'name' => lang('ACCEPTED')
-                                    )
-                                )
-                            ),
-                                                       array('type' => 
'filter', 
-                                                               'name' => 
'buildings',
-                                'text' => lang('Building').':',
-                                'list' => $this->bo->so->get_buildings(),
-                                                               
'onChangeSelect'=> 'requestWithBuildingFilter',
-                                                       ),
-                                                       array('type' => 
'filter', 
-                                                               'name' => 
'activities',
-                                'text' => lang('Activity').':',
-                                'list' => 
$this->bo->so->get_activities_main_level(),
-                                                       ),
-                                                       array('type' => 'text', 
-                                'text' => lang('searchfield'),
-                                                               'name' => 
'query'
-                                                       ),
-                                                       array(
-                                                               'type' => 
'submit',
-                                                               'name' => 
'search',
-                                                               'value' => 
lang('Search')
-                                                       ),
-                                                       array(
-                                                               'type' => 
'link',
-                                                               'value' => 
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
-                                                               'href' => 
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
-                                                       ),
-                                               ),
-                                       ),
-                               ),
-                               'datatable' => array
-                               (
-                                       'source' => 
self::link(array('menuaction' => 'controller.uiexample.index', 
'phpgw_return_as' => 'json')),
-                                       'field' => array(
-                                               array(
-                                                       'key' => 'id',
-                                                       'label' => lang('ID'),
-                                                       'sortable'      => true,
-                                                       'formatter' => 
'YAHOO.portico.formatLink'
-                                               ),
-                                               array(
-                                                       'key' => 'status',
-                                                       'label' => 
lang('Status'),
-                                                       'sortable'      => false
-                                               ),
-                                               array(
-                                                       'key' => 
'building_name',
-                                                       'label' => 
lang('Building'),
-                                                       'sortable'      => true
-                                               ),
-                                               array(
-                                                       'key' => 'what',
-                                                       'label' => lang('What'),
-                                                       'sortable'      => false
-                                               ),
-                                               array(
-                                                       'key' => 'created',
-                                                       'label' => 
lang('Created'),
-                                                       'sortable'      => true
-                                               ),
-                                               array(
-                                                       'key' => 'modified',
-                                                       'label' => lang('last 
modified'),
-                                                       'sortable'      => true
-                                               ),
-                                               array(
-                                                       'key' => 
'activity_name',
-                                                       'label' => 
lang('Activity'),
-                                                       'sortable'      => true
-                                               ),
-                                               array(
-                                                       'key' => 'contact_name',
-                                                       'label' => 
lang('Contact'),
-                                                       'sortable'      => true
-                                               ),
-                                               array(
-                                                       'key' => 'link',
-                                                       'hidden' => true
-                                               )
-                                       )
-                               ),
-                       );
-//_debug_array($data);
-                       $parameters = array
-                       (
-                               'parameter' => array
-                               (
-                                       array
-                                       (
-                                               'name'          => 'id',
-                                               'source'        => 'id'
-                                       ),
-                               )
-                       );
-
-                       $actions = array
-                       (
-                               array
-                               (
-                                       'my_name'               => 'view',
-                                       'text'                  => lang('view'),
-                               //      'confirm_msg'   => lang('do you really 
want to view this entry'),
-                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                       (
-                                               'menuaction'    => 
'controller.uiexample.edit',
-                                       )),
-                                       'parameters'    => $parameters
-                               ),
-                               array
-                               (
-                                       'my_name'               => 'edit',
-                                       'text'                  => lang('edit'),
-                                       'confirm_msg'   => lang('do you really 
want to edit this entry'),
-                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                       (
-                                               'menuaction'    => 
'controller.uiexample.edit',
-                                       )),
-                                       'parameters'    => $parameters
-                               ),
-                               array
-                               (
-                                       'my_name'               => 'delete',
-                                       'text'                  => 
lang('delete'),
-                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
-                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                       (
-                                               'menuaction'    => 
'controller.uiexample.delete',
-                                       )),
-                                       'parameters'    => $parameters
-                               )
-                       );
-
-                       $data['actions'] = json_encode($actions);
-
-//_debug_array($data);die();
-                       self::render_template_xsl('datatable', $data);
-               }
-
-               public function index_json()
-               {
-                       $this->bo = CreateObject('booking.boapplication');
-                       $this->resource_bo = CreateObject('booking.boresource');
-
-                       if ( 
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
-                            $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'controller') )
-                       {
-                               $filters['id'] = 
$this->bo->accessable_applications($GLOBALS['phpgw_info']['user']['id']);
-                       }
-                       $filters['status'] = 'NEW';
-                       if(isset($_SESSION['showall']))
-                       {
-                               $filters['status'] = array('NEW', 
'PENDING','REJECTED', 'ACCEPTED');
-                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
-                if ($testdata != 0)
-                {
-                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
-                }
-                else
-                {
-                    unset($filters['building_name']);                
-                }
-                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
-                if ($testdata2 != 0)
-                {
-                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
-                }
-                else
-                {
-                    unset($filters['activity_id']);                
-                }
-                
-                       }
-                       else
-                       {
-                               if (phpgw::get_var('status') == 'none')
-                               {
-                                       $filters['status'] = array('NEW', 
'PENDING', 'REJECTED', 'ACCEPTED');
-                               } 
-                               else
-                               {
-                       $filters['status'] = phpgw::get_var('status');
-                               }
-                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
-                if ($testdata != 0)
-                {
-                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
-                }
-                else
-                {
-                    unset($filters['building_name']);                
-                }
-                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
-                if ($testdata2 != 0)
-                {
-                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
-                }
-                else
-                {
-                    unset($filters['activity_id']);                
-                }
-            }
-
-                       $params = array(
-                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
-                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
-                               'query' => phpgw::get_var('query'),
-                               'sort'  => phpgw::get_var('sort'),
-                               'dir'   => phpgw::get_var('dir'),
-                               'filters' => $filters
-                       );
-
-                       $applications = $this->bo->so->read($params);
-
-                       foreach($applications['results'] as &$application)
-                       {
-                               if (strstr($application['building_name'],"%"))
-                               {
-                                       $search = array('%2C','%C3%85', 
'%C3%A5', '%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
-                                       $replace = array 
(',','Å','å','Ø','ø','Æ','æ');
-                                       $application['building_name'] = 
str_replace($search, $replace, $application['building_name']);
-                               }
-
-                               $application['status'] = 
lang($application['status']);
-                               $application['created'] = 
pretty_timestamp($application['created']);
-                               $application['modified'] = 
pretty_timestamp($application['modified']);
-                               $application['frontend_modified'] = 
pretty_timestamp($application['frontend_modified']);
-                               $application['resources'] = 
$this->resource_bo->so->read(array('filters'=>array('id'=>$application['resources'])));
-                               $application['resources'] = 
$application['resources']['results'];
-                               if($application['resources'])
-                               {
-                                       $names = array();
-                                       foreach($application['resources'] as 
$res)
-                                       {
-                                               $names[] = $res['name'];
-                                       }
-                                       $application['what'] = 
$application['resources'][0]['building_name']. ' ('.join(', ', $names).')';
-                               }
-                       }
-                       array_walk($applications["results"], array($this, 
"_add_links"), "controller.uiexample.edit");
-//_debug_array($this->yui_results($applications));
-                       return $this->yui_results($applications);
-               }
-
-               
-               public function edit()
-               {
-                       self::set_active_menu('controller::example::edit');     
                
-                       $repeat_type = $this->bo->get_rpt_type_list();
-                       $repeat_day = $this->bo->get_rpt_day_list();
-
-                       if(isset($_POST['save_control'])) // The user has 
pressed the save button
-                       {
-                               if(isset($control)) // Edit control
-                               {
-                                       
$control->set_title(phpgw::get_var('title'));
-                                       
$control->set_description(phpgw::get_var('description'));
-                                       $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
-                                       $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
-                                       $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
-                                       $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
-                                       $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
-                                       $control->set_enabled( true );
-                                                                       
-                                       $this->so->add($control);
-                               }
-                               else // Add new control
-                               {
-
-                                       $control = new controller_control();
-                                       
-                                       
$control->set_title(phpgw::get_var('title'));
-                                       
$control->set_description(phpgw::get_var('description'));
-                                       $control->set_start_date( strtotime( 
phpgw::get_var('start_date')  ) );
-                                       $control->set_end_date( strtotime( 
phpgw::get_var('end_date') ) );
-                                       $control->set_repeat_day( strtotime( 
phpgw::get_var('repeat_day') ) );
-                                       $control->set_repeat_type( strtotime( 
phpgw::get_var('repeat_type') ) );
-                                       $control->set_repeat_interval( 
strtotime( phpgw::get_var('repeat_interval') ) );
-                                       $control->set_enabled( true );
-                                                                       
-                                       $this->so->add($control);
-                               }
-                       }
-                       
-                       $control_item_array = 
$this->so_control_item->get_control_item_array();
-                       $control_group_array = 
$this->so_control_group->get_control_group_array();
-                       
-
-                       if($this->flash_msgs)
-                       {
-                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
-                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
-                       }
-
-                       foreach ($control_area_array as $control_area)
-                       {
-                               $control_area_options = array
-                               (
-                                       'id'    => $control_area->get_id(),
-                                       'name'  => $control_area->get_title()
-                                        
-                               );
-                       }
-
-                       foreach ($control_group_array as $control_group)
-                       {
-                               $control_group_options = array
-                               (
-                                       'id'    => $control_group->get_id(),
-                                       'name'  => 
$control_group->get_group_name()
-                                        
-                               );
-                       }
-
-                       $data = array
-                       (
-                               'value_id'                              => 
!empty($control) ? $control->get_id() : 0,
-                               'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                               'editable'                              => true,
-                               'control_item'                  => 
array('options' => $control_area_options),
-                               'control_group'                 => 
array('options' => $control_group_options),
-                       );
-
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Control_item');
-
-
-                       
$GLOBALS['phpgw']->richtext->replace_element('what_to_do');
-                       
$GLOBALS['phpgw']->richtext->replace_element('how_to_do');
-                       $GLOBALS['phpgw']->richtext->generate_script();
-
-
-                       self::add_javascript('controller', 'yahoo', 
'example_edit.js');
-                       self::render_template_xsl('example_edit', $data);
-               }
-
-
-               public function normal_tabs()
-               {
-                       
self::set_active_menu('controller::example::normal_tabs');
-
-                       $resource_id = 80;
-
-                       $add_document_link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uiexample.index') );
-                       $resource = array('id' => $resource_id, 
'add_document_link' => $add_document_link, 'permission' => array('write' => 
true ) );
-
-                       $tabs = array
-                       (
-                               'general'       => array('label' => 
lang('general'), 'link' => '#general'),
-                               'list'          => array('label' => 
lang('list'), 'link' => '#list'),
-                               'dates'         => array('label' => 
lang('dates'), 'link' => '#dates'),
-                       );
-
-                       phpgwapi_yui::tabview_setup('example_tabview');
-
-
-                       $data = array
-                       (
-                               'tabs'          => 
phpgwapi_yui::tabview_generate($tabs, 'general'),
-                               'resource'      => $resource,
-                               'date'          => 
$GLOBALS['phpgw']->yuical->add_listener('date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 time()))
-                       );
-                       self::add_javascript('controller', 'yahoo', 
'example_normal_tabs.js');
-                       self::render_template_xsl('example_normal_tabs', $data);
-               }
-                                       
-
-
-               public function separate_tabs()
-               {
-                       
self::set_active_menu('controller::example::separate_tabs');
-
-            $type =  phpgw::get_var('type', 'string', 'REQUEST', null);
-
-                       $tabs = array();
-                       $tabs[] = array(
-                               'label' => lang('Your preferences'),
-                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiexample.separate_tabs', 'type' => 'user'))
-                       );
-                       $tabs[] = array(
-                               'label' => lang('Default preferences'),
-                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiexample.separate_tabs', 'type' => 'default'))
-                       );
-                       $tabs[] = array(
-                               'label' => lang('Forced preferences'),
-                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiexample.separate_tabs', 'type' => 'forced'))
-                       );
-
-                       switch($type)
-                       {
-                               case 'default':
-                                       $selected = 1;
-                                       $resource_id = 81;
-                                       break;
-                               case 'forced':
-                                       $selected = 2;
-                                       $resource_id = 46;
-                                       break;
-                               case 'user':
-                               default:
-                                       $selected = 0;
-                                       $resource_id = 80;
-                       }
-
-                       $add_document_link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uiexample.index') );
-                       $resource = array('id' => $resource_id, 
'add_document_link' => $add_document_link, 'permission' => array('write' => 
true ) );
-
-                       $data = array
-                       (
-                               'tabs'  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected),
-                               'resource'      => $resource
-                       );
-                       self::add_javascript('controller', 'yahoo', 
'example_separate_tabs.js');
-                       self::render_template_xsl('example_separate_tabs', 
$data);
-               }
-                                       
-
-               public function delete()
-               {
-                       return 'deleted';
-               }
-
-               public function js_poll()
-               {
-                       if($poll = phpgw::get_var('poll'))
-                       {
-                               return $poll;
-                       }
-                       return 'hello world';
-               }
-
-               public function query()
-               {
-                       var_dump("Er i uicontrol");
-
-               }       
-       }

Copied: 
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php 
(from rev 8108, trunk/controller/inc/class.uilocation_check_list.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php  
                            (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/class.uilocation_check_list.inc.php  
    2011-11-15 07:51:11 UTC (rev 8109)
@@ -0,0 +1,320 @@
+<?php
+       phpgw::import_class('controller.uicommon');
+       phpgw::import_class('controller.socheck_list');
+       
+       include_class('controller', 'check_list', 'inc/model/');
+       include_class('controller', 'check_item', 'inc/model/');
+       include_class('controller', 'check_list_status_info', 'inc/helper/');
+               
+       class controller_uilocation_check_list extends controller_uicommon
+       {
+               private $so;
+               private $so_control;
+               private $so_control_group;
+               private $so_control_group_list;
+               private $so_control_item;
+               private $so_check_list;
+               private $so_check_item;
+                               
+               public $public_functions = array
+               (
+                       'index' =>      true,
+                       'view_check_lists_for_control'          =>      true,
+                       'save_check_list'                                       
=>      true,
+                       'view_check_list'                                       
=>      true,
+                       'edit_check_list'                                       
=>      true,
+                       'save_check_items'                                      
=>      true,
+                       'view_check_lists_for_location'         =>      true
+               );
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       
+                       $this->so = CreateObject('controller.socheck_list');
+                       $this->so_control = 
CreateObject('controller.socontrol');
+                       $this->so_control_group = 
CreateObject('controller.socontrol_group');
+                       $this->so_control_group_list = 
CreateObject('controller.socontrol_group_list');
+                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
+                       $this->so_check_list = 
CreateObject('controller.socheck_list');
+                       $this->so_check_item = 
CreateObject('controller.socheck_item');
+                       
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"controller::check_list";
+               }
+                       
+               public function view_check_lists_for_location()
+               {
+                       $control_id = phpgw::get_var('control_id');
+                       $control = $this->so_control->get_single($control_id);
+                       
+                       $view = "VIEW_YEAR";
+                       
+                       $location_code = "1101";
+                       
+                       // Gets an array of controls that contains check_lists 
for the specified location 
+                       $control_array = 
$this->so->get_check_lists_for_location( $location_code );
+                       
+                       $controls_calendar_array = $this->build_calendar_array( 
$control_array );
+                       
+                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               
+                       $data = array
+                       (
+                               'location_array'                  => 
$location_array,
+                               'controls_calendar_array' => 
$controls_calendar_array,
+                               'date_format'                     => 
$date_format
+                       );
+                       
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+                       
self::render_template_xsl('view_check_lists_for_location', $data);
+               }
+               
+               // Function receives array with control objects that each 
contain check_lists for a certain period
+               public function build_calendar_array( $control_array ){
+                                               
+                       $calendar_array = array();
+                                       
+                       foreach($control_array as $control){
+                               
+                               $start_date = $control->get_start_date();
+                               $end_date = $control->get_end_date();
+                               
+                               // Initialises twelve_months_array
+                               for($i=0;$i<12;$i++){
+                                       $calendar_array[$i] = null;
+                               }
+                               
+                               // Inserts check_list object on deadline month 
in twelve_months_array
+                               foreach($control->get_check_lists_array() as 
$check_list){
+                                       
+                                       $check_list_status_info = new 
check_list_status_info();
+                                       
$check_list_status_info->set_id($check_list->get_id());
+                                       
$check_list_status_info->set_status_text($check_list->get_status());
+                                       if($check_list->get_status() == 'Ikke 
utført'){
+                                               
$check_list_status_info->set_status(0);
+                                       }
+                                       
+                                       $check_list_status_info->set_deadline( 
date("d/m-Y", $check_list->get_deadline()) );
+                                       
+                                                                       
+                                       $calendar_array[ date("m", 
$check_list->get_deadline()) - 1 ] = $check_list_status_info->serialize();
+                               }
+                               
+                               $control_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $calendar_array);
+                       }
+                       
+                       return $control_calendar_array;
+               }
+                               
+               public function view_check_lists_for_control()
+               {
+                       $control_id = phpgw::get_var('id');
+                       $control = $this->so_control->get_single($control_id);
+                       
+                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+               
+                       $check_list_array = 
$this->so->get_check_lists_for_control( $control_id );      
+                       
+                       $data = array
+                       (
+                               'control_as_array'      => $control->toArray(),
+                               'check_list_array'      => $check_list_array,
+                               'date_format'           => $date_format
+                       );
+                       
+                       self::render_template_xsl('view_check_lists', $data);
+               }
+               
+               public function view_control_items_for_control()
+               {
+                       $control_id = phpgw::get_var('control_id');
+                       $control = $this->so_control->get_single($control_id);
+                                               
+                       $control_groups_array = 
$this->so_control_group_list->get_control_groups_by_control_id( $control_id );
+
+                       $saved_groups_with_items_array = array();
+                       
+                       foreach ($control_groups_array as $control_group)
+                       {       
+                               $control_group_id = $control_group->get_id();
+                               $saved_control_items = 
$this->so_control_item->get_control_items_by_control_id_and_group($control_id, 
$control_group_id);
+                               
+                               $saved_groups_with_items_array[] = 
array("control_group" => $control_group->toArray(), "control_items" => 
$saved_control_items);
+                       }       
+               
+                       $data = array
+                       (
+                               'control_as_array'                              
=> $control->toArray(),
+                               'saved_groups_with_items_array' => 
$saved_groups_with_items_array
+                       );
+                                                               
+                       self::render_template_xsl('view_check_list', $data);
+               }
+               
+               public function save_check_items(){
+                       $check_item_ids = phpgw::get_var('check_item_ids');
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       
+                       foreach($check_item_ids as $check_item_id){
+                               $status = phpgw::get_var('status_' . 
$check_item_id);
+                               $comment = phpgw::get_var('comment_' . 
$check_item_id);
+                               
+                               $check_item = 
$this->so_check_item->get_single($check_item_id);
+                               
+                               $check_item->set_status( $status );
+                               $check_item->set_comment( $comment );
+                               
+                               $this->so_check_item->store( $check_item );
+                       }
+                       
+                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list', 'check_list_id'=>$check_list_id));   
  
+               }
+               
+               public function save_check_list(){
+                       $control_id = phpgw::get_var('control_id');
+                       $control = $this->so_control->get_single($control_id);
+
+                       $start_date = $control->get_start_date();
+                       $end_date = $control->get_end_date();
+                       $repeat_type = $control->get_repeat_type();
+                       $repeat_interval = $control->get_repeat_interval();
+                       
+                       $status = true;
+                       $comment = "Kommentar for sjekkliste";
+                       $deadline = $start_date;
+                       
+                       // Saving check_list
+                       $new_check_list = new controller_check_list();
+                       $new_check_list->set_control_id( $control_id );
+                       $new_check_list->set_status( $status );
+                       $new_check_list->set_comment( $comment );
+                       $new_check_list->set_deadline( $deadline );
+                       
+                       $check_list_id = $this->so_check_list->store( 
$new_check_list );
+                       
+                       $control_items_list = 
$this->so_control_item->get_control_items_by_control_id($control_id);
+                       
+                       foreach($control_items_list as $control_item){
+                               
+                               $status = true;
+                               $comment = "Kommentar for sjekk item";
+                               
+                               // Saving check_items for a list
+                               $new_check_item = new controller_check_item();
+                               $new_check_item->set_check_list_id( 
$check_list_id );
+                               
+                               $new_check_item->set_control_item_id( 
$control_item->get_id() );
+                               $new_check_item->set_status( $status );
+                               $new_check_item->set_comment( $comment );
+
+                               $saved_check_item = 
$this->so_check_item->store( $new_check_item );
+                       }
+                       
+                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list_for_control', 
'control_id'=>$control_id));       
+               }
+               
+               public function make_check_list_for_control(){
+                       $control_id = phpgw::get_var('control_id');
+                       $control = $this->so_control->get_single($control_id);
+
+                       $start_date = $control->get_start_date();
+                       $end_date = $control->get_end_date();
+                       $repeat_type = $control->get_repeat_type();
+                       $repeat_interval = $control->get_repeat_interval();
+                       
+                       $status = true;
+                       $comment = "Kommentar for sjekkliste";
+                       $deadline = $start_date;
+                       
+                       // Saving check_list
+                       $new_check_list = new controller_check_list();
+                       $new_check_list->set_control_id( $control_id );
+                       $new_check_list->set_status( $status );
+                       $new_check_list->set_comment( $comment );
+                       $new_check_list->set_deadline( $deadline );
+                       
+                       $check_list_id = $this->so_check_list->store( 
$new_check_list );
+                       
+                       $control_items_list = 
$this->so_control_item->get_control_items_by_control_id($control_id);
+                       
+                       foreach($control_items_list as $control_item){
+                               
+                               $status = true;
+                               $comment = "Kommentar for sjekk item";
+                               
+                               // Saving check_items for a list
+                               $new_check_item = new controller_check_item();
+                               $new_check_item->set_check_list_id( 
$check_list_id );
+                               
+                               $new_check_item->set_control_item_id( 
$control_item->get_id() );
+                               $new_check_item->set_status( $status );
+                               $new_check_item->set_comment( $comment );
+
+                               $saved_check_item = 
$this->so_check_item->store( $new_check_item );
+                       }
+                       
+                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.view_check_list_for_control', 
'control_id'=>$control_id));       
+               }
+               
+               public function query()
+               {
+                       $params = array(
+                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
+                               'query' => phpgw::get_var('query'),
+                               'sort'  => phpgw::get_var('sort'),
+                               'dir'   => phpgw::get_var('dir'),
+                               'filters' => $filters
+                       );
+                       
+                       $search_for = phpgw::get_var('query');
+
+                       
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+                       {
+                               $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else {
+                               $user_rows_per_page = 10;
+                       }
+                       
+                       // YUI variables for paging and sorting
+                       $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_id';
+                       }
+                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       //Create an empty result set
+                       $records = array();
+                       
+                       //Retrieve a contract identifier and load corresponding 
contract
+/*                     $control_id = phpgw::get_var('control_id');
+                       if(isset($control_id))
+                       {
+                               $control = $this->so->get_single($control_id);
+                       }
+*/
+                       $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 $check_list_obj)
+                       {
+                               $results['results'][] = 
$check_list_obj->serialize();   
+                       }
+                       
+                       $results['total_records'] = $object_count;
+                       $results['start'] = $params['start'];
+                       $results['sort'] = $params['sort'];
+                       $results['dir'] = $params['dir'];
+
+                       array_walk($results["results"], array($this, 
"_add_links"), "controller.uicheck_list.view_check_lists_for_control");
+
+                       return $this->yui_results($results);
+               }
+       }

Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2011-11-15 07:51:11 UTC (rev 8109)
@@ -12,11 +12,12 @@
                
                public $public_functions = array
                (
-                       'index' =>      true,
-                       'query' =>      true,
-                       'edit'  =>      true,
-                       'view'  =>      true,
-                       'add'   =>      true
+                       'index'                         =>      true,
+                       'query'                         =>      true,
+                       'edit'                          =>      true,
+                       'view'                          =>      true,
+                       'add'                           =>      true,
+                       'get_procedures'        =>      true
                );
 
                public function __construct()
@@ -282,6 +283,20 @@
                        }
                }
                
+               // Returns check list info as JSON
+               public function get_procedures()
+               {
+                       $control_area_id = phpgw::get_var('control_area_id');
+                       
+                       $procedures_array = 
$this->so->get_procedures_by_control_area_id($control_area_id);
+                       
+                       if(count($procedures_array)>0)
+                               return json_encode( $procedures_array );
+                       else
+                               return null;
+               }
+               
+               
                /**
                * Public method. Forwards the user to edit mode.
                */

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2011-11-15 07:51:11 UTC (rev 8109)
@@ -12,7 +12,10 @@
                protected $deadline;
                protected $planned_date;
                protected $completed_date;
+               protected $location_code;
+               protected $equipment_id;
                protected $check_item_array = array();
+               protected $control;
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -81,6 +84,27 @@
                
                public function get_completed_date() { return 
$this->completed_date; }
                
+               public function set_location_code($location_code)
+               {
+                       $this->location_code = $location_code;
+               }
+               
+               public function get_location_code() { return 
$this->location_code; }
+               
+               public function set_equipment_id($equipment_id)
+               {
+                       $this->equipment_id = $equipment_id;
+               }
+               
+               public function get_equipment_id() { return 
$this->equipment_id; }
+               
+               public function set_control($control)
+               {
+                       $this->control = $control;
+               }
+               
+               public function get_control() { return $this->control; }
+               
                public function serialize()
                {
                        return array(

Modified: branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control.inc.php      
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/inc/model/class.control.inc.php      
2011-11-15 07:51:11 UTC (rev 8109)
@@ -24,6 +24,9 @@
                protected $control_area_id;
                protected $control_area_name;
 
+               protected $check_lists_array = array();
+               
+               
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
                 * the database the ID should be empty so the database can add 
one according to its logic.
@@ -70,13 +73,6 @@
                
                public function get_start_date() { return $this->start_date; }
                
-               public function set_repeat_day($repeat_day)
-               {
-                       $this->repeat_day = $repeat_day;
-               }
-               
-               public function get_repeat_day() { return $this->repeat_day; }
-               
                public function set_repeat_type($repeat_type)
                {
                        $this->repeat_type = $repeat_type;
@@ -168,6 +164,13 @@
                
                public function get_control_area_name() { return 
$this->control_area_name; }
                
+               public function set_check_lists_array($check_lists_array)
+               {
+                       $this->check_lists_array = $check_lists_array;
+               }
+               
+               public function get_check_lists_array() { return 
$this->check_lists_array; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 
@@ -190,6 +193,8 @@
                                $this->set_end_date(strtotime( 
phpgw::get_var('end_date_hidden','string') ));
                                
$this->set_procedure_id(phpgw::get_var('procedure_id','int'));
                                
$this->set_control_area_id(phpgw::get_var('control_area_id','int'));
+                               
$this->set_repeat_type(phpgw::get_var('repeat_type','int'));
+                               
$this->set_repeat_interval(phpgw::get_var('repeat_interval','int'));
                }
                
                public function serialize()
@@ -203,7 +208,10 @@
                                'procedure_id' => $this->get_procedure_id(),
                                'procedure_name' => $this->get_procedure_name(),
                                'control_area_id' => 
$this->get_control_area_id(),
-                               'control_area_name' => 
$this->get_control_area_name()
+                               'control_area_name' => 
$this->get_control_area_name(),
+                               'repeat_type' => $this->get_repeat_type(),
+                               'repeat_interval' => 
$this->get_repeat_interval(),
+                       
                                );
                }
        }

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2011-11-15 07:51:11 UTC (rev 8109)
@@ -1,5 +1,36 @@
 $(document).ready(function(){
-
+       
+       // Control.xsl when control area is selected procedures related to 
control area is fetched form db 
+       // and procedure select list is populated
+       $("#control_area_id option").click(function () {
+                var control_area_id = $(this).val();
+         var requestUrl = 
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
+         
+         var htmlString = "";
+         
+         $.ajax({
+                         type: 'POST',
+                         dataType: 'json',
+                         url: requestUrl + "&control_area_id=" + 
control_area_id,
+                         success: function(data) {
+                                 if( data != null){
+                                         var obj = jQuery.parseJSON(data);
+                                               
+                                         $.each(obj, function(i) {
+                                                 htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].title + "</option>";
+                                       });
+                                                                               
                          
+                                         $("#procedure_id").html( htmlString );
+                                       }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
prosedyrer</option>"
+                                         $("#procedure_id").html( htmlString 
);                          
+                               }
+                         }  
+                       });     
+    });
+       
        // Saves order of control items for a group
        $(".frm_save_order").submit(function(e){
                e.preventDefault();
@@ -33,4 +64,59 @@
                                }
                        });     
        });
-});
\ No newline at end of file
+       
+       // Fetches info about a check list when one hovers over an a tag
+       $("a.view_list").hover(function(){
+               var thisA = $(this);
+               var divWrp = $(this).parent();
+               var requestUrl = $(thisA).attr("href");
+               
+               $.ajax({
+                         type: 'POST',
+                         url: requestUrl,
+                         dataType: 'json',
+                 success: function(data) {
+                         var obj = jQuery.parseJSON(data);
+                         
+                         // Show info box with info about check list
+                         var infoBox = $(divWrp).find("#info_box");
+                         $(infoBox).show();
+                         $(infoBox).html("");
+                         
+                         if(obj.deadline == 0 ){
+                                 var deadline_string = "Ikke satt";
+                         }else{
+                                 var date  = new Date(obj.deadline * 1000);
+                                 var deadline_string = date.getDate() + "/" + 
(parseInt(date.getMonth()) + 1) + "-" + date.getFullYear();
+                         }
+                         
+                         var months = ['Januar', 'Februar', 'Mars', 'April', 
'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 
'Desember'];
+
+                         
+                         $(infoBox).html("<h5>Sjekkliste for " + 
months[date.getMonth()]);
+                         
+                         var htmlList = "<ul>" +
+                                                        
"<li><label>Frist</label><span> " + deadline_string + "</span></li>" +
+                                                        
"<li><label>Status</label><span> " + obj.status + "</span></li>" +
+                                                        
"<li><label>Kommentar</label><span>" + obj.comment + "</span></li>" +
+                                                        
"<li><label>Sjekkpunkter</label><li>";
+                         
+                         $.each(obj.check_item_array, function(i) {
+                                 htmlList +=   "<ul><li><label>" + 
(parseInt(i) + 1) + ": Tittel</label><span>" + 
obj.check_item_array[i].control_item.title + "</span></li>" + 
+                                                               
"<li><label>Status</label><span>" + obj.check_item_array[i].status + 
"</span></li>" + 
+                                                               
"<li><label>Kommentar</label><span>" + obj.check_item_array[i].comment + 
"</span></li></ul>";
+                               });
+                         
+                         htmlList += "</li></ul>"; 
+                         
+                         $(infoBox).append( htmlList );
+                 }
+                  });
+       },
+       function(){
+               // Hide info box when mouse not over status icon
+               var infoBox = $(this).parent().find("#info_box");
+               $(infoBox).hide();
+               
+       });
+});

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2011-11-15 
07:51:11 UTC (rev 8109)
@@ -2,6 +2,7 @@
 controller     common  no      Kontroll
 control_helptext       controller      no      Her kommer hjelpetekst for å 
opprette en kontroll
 Check_list     controller      no      Sjekkliste
+Check_list_location    controller      no      Sjekkliste for bygg
 Check_lists    controller      no      Sjekklister
 Choose_control_groups  controller      no      Velg kontrollgrupper
 Choose_control_items   controller      no      Velg kontrollpunkt

Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php  2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2011-11-15 
07:51:11 UTC (rev 8109)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.7';
+       $setup_info['controller']['version'] = '0.1.8';
        $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_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2011-11-15 07:51:11 UTC (rev 8109)
@@ -129,4 +129,22 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.7';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+       
+       /* Update Controller from v 0.1.7 to 0.1.8 */
+       
+       $test[] = '0.1.7';
+       function controller_upgrade0_1_7()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(), 
'status');
+               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item','status',array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => true,
+                       'default' => 0
+               ));
+                       
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.8';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
 ?>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_groups.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_groups.xsl    
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/templates/base/control_groups.xsl    
2011-11-15 07:51:11 UTC (rev 8109)
@@ -4,23 +4,28 @@
        <div id="control_groups">
        
                <h2><xsl:value-of select="control_area/title"/></h2>
+               
+               <form 
action="index.php?menuaction=controller.uicontrol.view_control_items" 
method="post">
+                       <xsl:variable name="control_area_id"><xsl:value-of 
select="control_area/id"/></xsl:variable>
+                       <input type="hidden" name="control_area_id" 
value="{$control_area_id}" />
                        
-               <form 
action="index.php?menuaction=controller.uicontrol.view_control_items" 
method="post">
-               <xsl:variable name="control_area_id"><xsl:value-of 
select="control_area/id"/></xsl:variable>
-               <input type="hidden" name="control_area_id" 
value="{$control_area_id}" />
-               
-               <xsl:variable name="control_id"><xsl:value-of 
select="control_id"/></xsl:variable>
-               <input type="hidden" name="control_id" value="{control_id}" />
-               
-               <ul class="itemlist">
-               <xsl:for-each select="//control_groups">
-                       <xsl:variable name="control_group_id"><xsl:value-of 
select="id"/></xsl:variable>
-               <li><input type="checkbox"  name="control_group_ids[]" 
value="{$control_group_id}" /><xsl:value-of select="group_name"/></li>
-               </xsl:for-each>
-               </ul>
-               <div>
-                       <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
-                       <input type="submit" name="save_control_groups" 
value="{$lang_save}" title = "{$lang_save}" />
+                       <xsl:variable name="control_id"><xsl:value-of 
select="control_id"/></xsl:variable>
+                       <input type="hidden" name="control_id" 
value="{control_id}" />
+                       
+                       <ul class="itemlist">
+                               <xsl:for-each select="//control_groups">
+                                       <xsl:variable 
name="control_group_id"><xsl:value-of select="id"/></xsl:variable>
+                               
+                                       <xsl:for-each 
select="chosen_control_groups">
+                                               <xsl:value-of select="."/>
+                                       </xsl:for-each>
+                               
+                               <li><input type="checkbox"  
name="control_group_ids[]" value="{$control_group_id}" /><xsl:value-of 
select="group_name"/></li>
+                               </xsl:for-each>
+                       </ul>
+                       <div>
+                               <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
+                               <input type="submit" name="save_control_groups" 
value="{$lang_save}" title = "{$lang_save}" />
                        </div>
                </form>                                 
        </div>

Deleted: branches/Version-1_0-branch/controller/templates/base/control_items.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_items.xsl     
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/templates/base/control_items.xsl     
2011-11-15 07:51:11 UTC (rev 8109)
@@ -1,43 +0,0 @@
-<xsl:template name="control_items" xmlns:php="http://php.net/xsl";>
-
-<div class="yui-content tab_content">
-       <div>
-                 
-          <!-- ===========================  CHOOSE CONTROL ITEMS  
=============================== -->
-          <h2>Velg dine kontrollpunkt</h2>
-          
-               <h4 class="expand_header"><div class="expand_all">Vis 
alle</div><div class="collapse_all">Skjul alle</div></h4>
-               <form id="frm_control_items" 
action="index.php?menuaction=controller.uicontrol.save_control_items" 
method="post">       
-                       <xsl:variable name="control_id"><xsl:value-of 
select="control_id"/></xsl:variable>
-                       <input type="hidden" name="control_id" 
value="{control_id}" />
-                       
-                       <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="itemlist expand_list">
-                               <li>
-                                       <h4><img 
src="controller/images/arrow_left.png" width="14"/><span><xsl:value-of 
select="control_group/group_name"/></span></h4>
-                                       <xsl:variable 
name="control_group_id"><xsl:value-of select="control_group/id"/></xsl:variable>
-                                       <ul>            
-                                                       <xsl:for-each 
select="group_control_items">
-                                                               <xsl:variable 
name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
-                                                               
-                                                       <li><xsl:number/>.  
<input type="checkbox"  id="ch_{$control_group_id}:{$control_item_id}" 
value="{$control_group_id}:{$control_item_id}" /><xsl:value-of 
select="title"/></li> 
-                                                       </xsl:for-each>
-                                               </ul>
-                                       </li>
-                               </ul>
-                               </xsl:for-each>
-                       </ul>
-                       
-                       <div>
-                               <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
-                               <input type="submit" name="save_control_items" 
value="{$lang_save}" title = "{$lang_save}" />
-                       </div>
-               </form>
-                                                               
-       </div>
-</div>
-</xsl:template>
\ No newline at end of file

Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css  
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2011-11-15 07:51:11 UTC (rev 8109)
@@ -818,8 +818,64 @@
 }
 #frm_save_check_items h1 {
     float: left;
-    margin: 5px 0;
+    margin: 5px;
 }
 ul.check_list {
        width: 925px;   
+}
+ul.calendar li{
+       clear:left;     
+}
+ul.calendar li.heading div {
+    font-weight: bold;
+}
+ul.calendar li div {
+    float: left;
+    text-align: center;
+    width: 50px;
+    padding: 3px;
+}
+
+ul.calendar li div.date {
+    width: 80px;
+}
+
+ul.calendar div.title{
+       width: 200px;   
+}
+
+#info_box {
+    background: none repeat scroll 0 0 #EDF5FF;
+    border: 1px solid #243356;
+    left: 40px;
+    padding: 10px;
+    position: absolute;
+    text-align: left;
+    top: 3px;
+    width: 350px;
+    z-index: 1;
+    font-size:12px;
+}
+
+#info_box label{
+       font-weight:bold;
+       margin-right:2px;
+       font-size:12px;
+       display: inline-block;
+       width: 70px;
+}
+
+#info_box ul li ul label{
+       display: inline;
+}
+
+#info_box ul li ul {
+    margin: 5px 0;
+    padding-left: 5px;
+}
+#info_box h5 {
+       font-size: 15px;
+    font-weight: bold;
+    padding: 0 0 8px;
+    text-align: center;
 }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/view_check_lists.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/view_check_lists.xsl  
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/controller/templates/base/view_check_lists.xsl  
2011-11-15 07:51:11 UTC (rev 8109)
@@ -18,8 +18,8 @@
                        <xsl:if test="control_as_array/end_date != ''">
                                <xsl:value-of select="php:function('date', 
$date_format, number(control_as_array/end_date))"/><br/>
                        </xsl:if>
-                       <label>Syklustype</label><xsl:value-of 
select="control_as_array/repeat_type"/><br/>
-                       <label>Syklusfrekvens</label><xsl:value-of 
select="control_as_array/repeat_interval"/><br/>
+                       <label>Frekvenstype</label><xsl:value-of 
select="control_as_array/repeat_type"/><br/>
+                       <label>Frekvens</label><xsl:value-of 
select="control_as_array/repeat_interval"/><br/>
                </fieldset>
                
                <h2>Sjekklister</h2>
@@ -78,5 +78,15 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </ul>
+                <a>
+                       <xsl:attribute name="href">
+                               
<xsl:text>index.php?menuaction=controller.uicheck_list.control_calendar_status_overview</xsl:text>
+                               <xsl:text>&amp;control_id=</xsl:text>
+                                       <xsl:value-of 
select="control_as_array/id"/>
+                       </xsl:attribute>
+                       <div style="margin-top:30px">
+                               Se kalenderoversikt for kontroll
+                       </div>
+               </a>
 </div>
 </xsl:template>
\ No newline at end of file

Copied: 
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
 (from rev 8108, 
trunk/controller/templates/base/view_check_lists_for_location.xsl)
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
                             (rev 0)
+++ 
branches/Version-1_0-branch/controller/templates/base/view_check_lists_for_location.xsl
     2011-11-15 07:51:11 UTC (rev 8109)
@@ -0,0 +1,81 @@
+<xsl:template match="data" name="view_check_lists" 
xmlns:php="http://php.net/xsl";>
+<xsl:variable name="date_format">d/m-Y</xsl:variable>
+
+<div id="main_content">
+                       
+               <h1>Kalenderoversikt</h1>
+               <fieldset class="check_list_details">
+                       Oversikt for <xsl:value-of 
select="location_array/loc1_name"/>
+               </fieldset>
+               
+               <h2>Sjekklister</h2>
+               
+               <ul class="calendar">
+                       <li class="heading">
+                               <div>Id</div><div 
class="title">Tittel</div><div class="date">Startdato</div><div 
class="date">Sluttdato</div>
+                               
<div>Jan</div><div>Feb</div><div>Mar</div><div>Apr</div><div>Mai</div><div>Jun</div>
+                               
<div>Jul</div><div>Aug</div><div>Sep</div><div>Okt</div><div>Nov</div><div>Des</div>
+                       </li>
+                       <xsl:choose>
+                               <xsl:when 
test="controls_calendar_array/child::node()">
+                                   <xsl:for-each 
select="controls_calendar_array">
+                                       <li>
+                                               <div>
+                                                       <xsl:value-of 
select="control/id"/>
+                                                       </div>
+                                                       <div class="title">
+                                                       <xsl:value-of 
select="control/title"/>
+                                                       </div>
+                                                       <div class="date">
+                                                       <xsl:value-of 
select="php:function('date', 'd/m-Y', number(control/start_date))"/>
+                                                       </div>
+                                                       <div class="date">
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="control/end_date != 0">
+                                                                               
<xsl:value-of select="php:function('date', 'd/m-Y', number(control/end_date))"/>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
Løpende
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </div>
+                                                       <xsl:for-each 
select="calendar_array">
+                                                       <div 
style="position:relative;">
+                                                       <div id="info_box" 
style="position:absolute;display:none;">
+                                                       </div>
+                                                       <xsl:choose>
+                                                                               
<xsl:when test="id">
+                                                                               
        <xsl:variable name="status"><xsl:value-of 
select="status"/></xsl:variable>
+                                                                               
        <xsl:choose>
+                                                                               
                <xsl:when test="status = 1">
+                                                                               
                        <img height="15" 
src="controller/images/status_icon_light_green.png" /> 
+                                                                               
                </xsl:when>
+                                                                               
                <xsl:otherwise>
+                                                                               
                 <a class="view_list">
+                                                                               
                        <xsl:attribute name="href">
+                                                                               
                                
<xsl:text>index.php?menuaction=controller.uicheck_list.get_check_list_info</xsl:text>
+                                                                               
                                <xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                                <xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="id"/>
+                                                                               
                        </xsl:attribute>
+                                                                               
                        <img height="15" 
src="controller/images/status_icon_red.png" />
+                                                                               
                </a>
+                                                                               
                </xsl:otherwise>
+                                                                               
        </xsl:choose>   
+                                                                               
</xsl:when>
+                                                                               
<xsl:otherwise>
+                                                                               
        <img height="15" src="controller/images/status_icon_yellow.png" />
+                                                                               
</xsl:otherwise>
+                                                                       
</xsl:choose>
+                                                               </div>
+                                                       </xsl:for-each>
+                                               </li>
+                                       </xsl:for-each>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       Ingen sjekklister for denne kontrollen
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </ul>
+</div>
+</xsl:template>
\ No newline at end of file

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2011-11-15 07:51:11 UTC (rev 8109)
@@ -147,7 +147,7 @@
 
                /**
                 * Add a group for custom fields/attributes
-                * 
+                *
                 * @param array $attrib the field data
                 *
                 * @return int the the new custom field db pk
@@ -217,7 +217,7 @@
                }
                /**
                 * Add a custom field/attribute
-                * 
+                *
                 * @param array $attrib the field data
                 * @param string $attrib_table where to append the attrib
                 * @param bool $doubled sometimes the attribute fits into a 
history-table as a double
@@ -243,12 +243,6 @@
                                $attrib_table = 
$GLOBALS['phpgw']->locations->get_attrib_table($appname, $location);
                        }
 
-                       // Need a table to operate on
-                       if ( !$attrib_table )
-                       {
-                               return -1;
-                       }
-
                        if(isset($attrib['get_list_function_input']) &&  
$attrib['get_list_function_input'])
                        {
                                $attrib['get_list_function_input'] = 
$this->_validate_function_input($attrib['get_list_function_input']);
@@ -381,6 +375,21 @@
 
                        $receipt['id'] = $values['id'];
 
+                       // if no table: assume eav-model
+                       if ( !$attrib_table )
+                       {
+                               if ( !$this->global_lock )
+                               {
+                                       if ( $this->_db->transaction_commit() )
+                                       {
+                                               return $values['id'];
+                                       }
+                               }
+
+                               return 0;
+                       }
+
+
                        if ( !$values['precision_'] > 0)
                        {
                                $precision = 
$this->_translate_datatype_precision($values['datatype']);
@@ -468,7 +477,7 @@
 
                /**
                 * Delete a custom field/attribute group
-                * 
+                *
                 * @param string $location within an application
                 * @param string $appname where to delete the attrib
                 * @param integer $group_id id of attrib to delete
@@ -509,7 +518,7 @@
                }
                /**
                 * Delete a custom field/attribute
-                * 
+                *
                 * @param string $location within an application
                 * @param string $appname where to delete the attrib
                 * @param integer $attrib_id id of attrib to delete
@@ -544,7 +553,7 @@
 
                        if(!$doubled) // else: wait for it - another one is 
coming
                        {
-                               $sql = "SELECT group_id FROM 
phpgw_cust_attribute " 
+                               $sql = "SELECT group_id FROM 
phpgw_cust_attribute "
                                        . " WHERE location_id = {$loc_id} AND 
id = {$attrib_id}";
                                $this->_db->query($sql, __LINE__, __FILE__);
                                $this->_db->next_record();
@@ -583,7 +592,7 @@
 
                /**
                 * Edit a group for custom fields
-                * 
+                *
                 * @param array  $group  the field data
                 *
                 * @return integer the database id of the group
@@ -616,7 +625,7 @@
                }
                /**
                 * Edit a custom field
-                * 
+                *
                 * @param array  $attrib       the field data
                 * @param string $attrib_table which table the attribute is 
part of
                 * @param bool $doubled sometimes the attribute fits into a 
history-table as a double
@@ -674,7 +683,7 @@
                                default: // all is good
                        }
 
-                       $sql = "SELECT column_name, datatype, precision_, 
group_id FROM phpgw_cust_attribute " 
+                       $sql = "SELECT column_name, datatype, precision_, 
group_id FROM phpgw_cust_attribute "
                                . " WHERE location_id  = {$location_id} AND id 
= {$attrib_id}";
                        $this->_db->query($sql, __LINE__, __FILE__);
                        if ( !$this->_db->next_record() )
@@ -688,8 +697,6 @@
                        $OldPrecision           = $this->_db->f('precision_');
                        $OldGroup                       = (int) 
$this->_db->f('group_id');                      
 
-                       $table_def = $this->get_table_def($attrib_table);       
-
                        $this->_db->transaction_begin();
 
                        if( !$doubled )
@@ -714,7 +721,7 @@
 
                                if($OldGroup != $attrib['group_id'])
                                {
-                                       $sql = "SELECT MAX(attrib_sort) AS 
max_sort FROM phpgw_cust_attribute " 
+                                       $sql = "SELECT MAX(attrib_sort) AS 
max_sort FROM phpgw_cust_attribute "
                                                . " WHERE location_id = 
{$location_id} AND group_id = {$attrib['group_id']}";
                                        
$this->_db->query($sql,__LINE__,__FILE__);
                                        $this->_db->next_record();
@@ -749,8 +756,13 @@
 
                        }
 
-                       $this->_oProc->m_aTables = $table_def;
+                       if($attrib_table)
+                       {
+                               $table_def = 
$this->get_table_def($attrib_table);       
+                               $this->_oProc->m_aTables = $table_def;
 
+                       }
+
                        if($OldColumnName !=$attrib['column_name'])
                        {
                                $value_set=array('column_name'  => 
$attrib['column_name']);
@@ -761,7 +773,10 @@
                                        $this->_db->query("UPDATE 
phpgw_cust_attribute set $value_set WHERE location_id = {$location_id} AND id=" 
. $attrib_id,__LINE__,__FILE__);
                                }
 
-                               $this->_oProc->RenameColumn($attrib_table, 
$OldColumnName, $attrib['column_name']);
+                               if($attrib_table)
+                               {
+                                       
$this->_oProc->RenameColumn($attrib_table, $OldColumnName, 
$attrib['column_name']);
+                               }
                        }
 
                        if (($OldDataType != $attrib['column_info']['type'])
@@ -818,7 +833,10 @@
                                }
 
                                $attrib['column_info']['type']  = 
$this->_translate_datatype_insert($attrib['column_info']['type']);
-                               
$this->_oProc->AlterColumn($attrib_table,$attrib['column_name'],$attrib['column_info']);
                        
+                               if($attrib_table)
+                               {
+                                       
$this->_oProc->AlterColumn($attrib_table,$attrib['column_name'],$attrib['column_info']);
+                               }
                        }
                        
                        if(isset($attrib['new_choice']) && 
$attrib['new_choice'] && !$doubled )
@@ -893,20 +911,20 @@
 
                /**
                 * Get a list of attributes
-                * 
+                *
                 * @param string $appname      the name of the application
                 * @param string $location     the name of the location
                 * @param integer $start
-                * @param string query         
-                * @param string $sort         
-                * @param string $order        
-                * @param bool   $allrows      
-                * @param bool   $inc_choices  
+                * @param string query
+                * @param string $sort
+                * @param string $order
+                * @param bool   $allrows
+                * @param bool   $inc_choices
                 * @param array $filtermethod
                 *
                 * @return array attributes at location
                 */
-               public function find($appname, $location, $start = 0, $query = 
'', $sort = 'ASC', 
+               public function find($appname, $location, $start = 0, $query = 
'', $sort = 'ASC',
                                $order = 'attrib_sort', $allrows = false, 
$inc_choices = false, $filter = array())
                {
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
@@ -1038,7 +1056,7 @@
                }
                /**
                 * Get a list of groups availlable for attributes within a 
location
-                * 
+                *
                 * @param string $appname      the name of the application
                 * @param string $location     the name of the location
                 * @param ?????? $start        ask sigurd
@@ -1049,7 +1067,7 @@
                 *
                 * @return ???? something
                 */
-               public function find_group($appname, $location, $start = 0, 
$query = '', $sort = 'ASC', 
+               public function find_group($appname, $location, $start = 0, 
$query = '', $sort = 'ASC',
                                $order = 'group_sort', $allrows = false)
                {
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
@@ -1163,7 +1181,7 @@
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
                        $id = (int) $id;
 
-                       $sql = "SELECT phpgw_cust_attribute.* FROM 
phpgw_cust_attribute " 
+                       $sql = "SELECT phpgw_cust_attribute.* FROM 
phpgw_cust_attribute "
                                . " WHERE location_id = {$location_id}"
                                        . " AND phpgw_cust_attribute.id=$id";
                        $this->_db->query($sql, __LINE__, __FILE__);
@@ -1273,7 +1291,7 @@
                 */
                public function get_table_def($table = '', $table_def = array())
                {
-                       if( !$GLOBALS['phpgw_setup']->oProc 
+                       if( !$GLOBALS['phpgw_setup']->oProc
                                || !is_object($GLOBALS['phpgw_setup']->oProc) )
                        {
                                $GLOBALS['phpgw_setup']->oProc =& $this->_oProc;
@@ -1362,7 +1380,7 @@
 
                /**
                 * Resort an attribute's position in relation to other 
attributes
-                * 
+                *
                 * @param int $id the attribute db pk
                 * @param string $resort the direction to move the field 
[up|down]
                 */
@@ -1383,13 +1401,13 @@
 
                        $this->_db->transaction_begin();
 
-                       $sql = "SELECT group_sort FROM 
phpgw_cust_attribute_group " 
+                       $sql = "SELECT group_sort FROM 
phpgw_cust_attribute_group "
                                . " WHERE location_id = {$location_id} AND id = 
{$id}";
                        $this->_db->query($sql, __LINE__, __FILE__);
                        $this->_db->next_record();
                        $attrib_sort    = $this->_db->f('group_sort');
 
-                       $sql = "SELECT MAX(group_sort) AS max_sort FROM 
phpgw_cust_attribute_group " 
+                       $sql = "SELECT MAX(group_sort) AS max_sort FROM 
phpgw_cust_attribute_group "
                                . " WHERE location_id = {$location_id}";
                        $this->_db->query($sql,__LINE__,__FILE__);
                        $this->_db->next_record();
@@ -1435,7 +1453,7 @@
 
                /**
                 * Resort an attribute's position in relation to other 
attributes
-                * 
+                *
                 * @param int $id the attribute db pk
                 * @param string $resort the direction to move the field 
[up|down]
                 */
@@ -1456,19 +1474,19 @@
 
                        $this->_db->transaction_begin();
 
-                       $sql = "SELECT group_id FROM phpgw_cust_attribute " 
+                       $sql = "SELECT group_id FROM phpgw_cust_attribute "
                                . " WHERE location_id = {$location_id} AND id = 
{$id}";
                        $this->_db->query($sql, __LINE__, __FILE__);
                        $this->_db->next_record();
                        $group_id       = (int) $this->_db->f('group_id');
 
-                       $sql = "SELECT attrib_sort FROM phpgw_cust_attribute " 
+                       $sql = "SELECT attrib_sort FROM phpgw_cust_attribute "
                                . " WHERE location_id = {$location_id} AND id = 
{$id} AND group_id = {$group_id}";
                        $this->_db->query($sql, __LINE__, __FILE__);
                        $this->_db->next_record();
                        $attrib_sort    = $this->_db->f('attrib_sort');
 
-                       $sql = "SELECT MAX(attrib_sort) AS max_sort FROM 
phpgw_cust_attribute " 
+                       $sql = "SELECT MAX(attrib_sort) AS max_sort FROM 
phpgw_cust_attribute "
                                . " WHERE location_id = {$location_id} AND 
group_id = {$group_id}";
                        $this->_db->query($sql,__LINE__,__FILE__);
                        $this->_db->next_record();
@@ -1539,7 +1557,7 @@
                        $location_id    = (int) $location_id;
                        $attrib_id              = (int) $attrib_id;
                        
-                       $sql = "SELECT * FROM phpgw_cust_choice " 
+                       $sql = "SELECT * FROM phpgw_cust_choice "
                                . " WHERE location_id = {$location_id}"
                                        . " AND attrib_id = {$attrib_id}"
                                . " ORDER BY choice_sort ASC, value";
@@ -1562,7 +1580,7 @@
 
                /**
                 * Finds the next ID for a record at a table
-                * 
+                *
                 * @param string $table tablename in question
                 * @param array  $key   conditions for finding the next id
                 *

Modified: branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -134,7 +134,7 @@
                                $sort           = 
isset($data['sort'])?$data['sort']:'DESC';
                                $order          = 
isset($data['order'])?$data['order']:'';
                                $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
-                               $entity_id      = 
isset($data['entity_id'])?$data['entity_id']:'';
+                               $entity_id      = isset($data['entity_id'])? 
(int)$data['entity_id']:0;
                                $type           = isset($data['type']) && 
$data['type'] ? $data['type'] : $this->type;
                                $required       = 
isset($data['required'])?$data['required']:'';
                        }
@@ -176,14 +176,16 @@
                        {
                                $id     = $this->db2->f('id');
                                $category = array
-                                       (
-                                               'id'            => $id,
-                                               'name'          => 
$this->db2->f('name'),
-                                               'prefix'        => 
$this->db2->f('prefix'),
-                                               'descr'         => 
$this->db2->f('descr'),
-                                               'level'         => 
$this->db2->f('level'),
-                                               'parent_id'     => 
$this->db2->f('parent_id')
-                                       );
+                               (
+                                       'entity_id'     => $entity_id,
+                                       'id'            => $id,
+                                       'name'          => 
$this->db2->f('name'),
+                                       'prefix'        => 
$this->db2->f('prefix'),
+                                       'descr'         => 
$this->db2->f('descr'),
+                                       'level'         => 
$this->db2->f('level'),
+                                       'parent_id'     => 
$this->db2->f('parent_id'),
+                                       'is_eav'        => 
$this->db2->f('is_eav'),
+                               );
 
                                if($required)
                                {
@@ -440,6 +442,7 @@
                                                'loc_link'                      
                => $this->db->f('loc_link'),
                                                'start_project'                 
        => $this->db->f('start_project'),
                                                'start_ticket'                  
        => $this->db->f('start_ticket'),
+                                               'is_eav'                        
                => $this->db->f('is_eav'),
                                                'jasperupload'                  
        => $this->db->f('jasperupload'),
                                                'parent_id'                     
                => $this->db->f('parent_id'),
                                                'level'                         
                => $this->db->f('level')
@@ -553,6 +556,7 @@
                                        $values['loc_link'],
                                        $values['start_project'],
                                        $values['start_ticket'],
+                                       $values['is_eav'],
                                        $values['jasperupload'],
                                        $values['parent_id'],
                                        $level
@@ -560,13 +564,35 @@
 
                        $values_insert  = 
$this->db->validate_insert($values_insert);
 
-                       $this->db->query("INSERT INTO {$table} 
(entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,jasperupload,parent_id,level
 ) "
+                       $this->db->query("INSERT INTO {$table} 
(entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,jasperupload,parent_id,level
 ) "
                                . "VALUES ($values_insert)",__LINE__,__FILE__);
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true, 
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}");
 
                        $receipt['id']= $values['id'];
 
+                       if($values['is_eav']) // if modelles as eav - we are 
good
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true);
+                               $values_insert = array
+                               (
+                                       'location_id'   => $location_id,
+                                       'name'                  => 
".{$this->type}.{$values['entity_id']}.{$values['id']}::{$values['name']}",
+                                       'description'   => $values['descr'],
+                                       'is_ifc'                => 0
+                               );
+
+                               $this->db->query('INSERT INTO fm_bim_type (' . 
implode(',',array_keys($values_insert)) . ') VALUES ('
+                                . 
$this->db->validate_insert(array_values($values_insert)) . 
')',__LINE__,__FILE__);
+
+                               $this->db->transaction_commit();                
        
+
+                               $receipt['message'][] = array('msg'     => 
lang('%1 has been saved as an eav-model',$values['name']));
+                               return $receipt;
+                       }
+                       
+                       
+                       // if not eav - we need a table to hold the attributes
+                       $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true, 
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}");
                        $this->init_process();
 
                        $fd = $this->get_default_column_def();
@@ -752,6 +778,7 @@
                                                'loc_link'                      
                => $entity['loc_link'],
                                                'start_project'                 
        => $entity['start_project'],
                                                'start_ticket'                  
        => $entity['start_ticket'],
+                                               'is_eav'                        
                => $entity['is_eav'],
                                                'jasperupload'                  
        => $entity['jasperupload'],
                                                'parent_id'                     
                => $entity['parent_id'],
                                                'level'                         
                => $level
@@ -924,10 +951,18 @@
                                }
                        }
 
-                       
$this->oProc->DropTable("fm_{$this->type}_{$entity_id}_{$id}");
-
                        $location_id = $GLOBALS['phpgw']->locations->get_id( 
$this->type_app[$this->type], ".{$this->type}.{$entity_id}.{$id}");
 
+                       $category = $this->read_single_category($entity_id, 
$id);
+                       if($category['is_eav'])
+                       {
+                               $this->db->query("DELETE FROM fm_bim_type WHERE 
location_id= {$location_id}",__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               
$this->oProc->DropTable("fm_{$this->type}_{$entity_id}_{$id}");
+                       }
+
                        $this->db->query("DELETE FROM fm_{$this->type}_category 
WHERE entity_id= {$entity_id} AND id= {$id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM phpgw_cust_attribute 
WHERE location_id = {$location_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM phpgw_locations WHERE 
location_id  = {$location_id}",__LINE__,__FILE__);

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2011-11-15 07:51:11 UTC (rev 8109)
@@ -839,10 +839,9 @@
                }
 
 
-               function add($values,$values_attribute,$entity_id,$cat_id)
+               public function 
add($values,$values_attribute,$entity_id,$cat_id)
                {
-                       $cols = array();
-                       $vals = array();
+                       $values_insert = array();
 
                        if(isset($values['street_name']) && 
$values['street_name'])
                        {
@@ -858,14 +857,12 @@
 
                        if(isset($address) && $address)
                        {
-                               $cols[] = 'address';
-                               $vals[] = $address;
+                               $values_insert['address'] = $address;
                        }
 
                        if (isset($values['location_code']) && 
$values['location_code'])
                        {
-                               $cols[] = 'location_code';
-                               $vals[] = $values['location_code'];             
        
+                               $values_insert['location_code'] = 
$values['location_code'];
                        }
 
                        if(isset($values['location']) && 
is_array($values['location']))
@@ -874,8 +871,7 @@
                                {
                                        if(isset($value) && $value)
                                        {
-                                               $cols[] = $input_name;
-                                               $vals[] = $value;
+                                               $values_insert[$input_name] = 
$value;
                                        }
                                }
                        }
@@ -886,13 +882,12 @@
                                {
                                        if(isset($value) && $value)
                                        {
-                                               $cols[] = $input_name;
-                                               $vals[] = $value;
+                                               $values_insert[$input_name] = 
$value;
                                        }
                                }
                        }
 
-                       if (isset($values_attribute) AND 
is_array($values_attribute))
+                       if (isset($values_attribute) && 
is_array($values_attribute))
                        {
                                foreach($values_attribute as $entry)
                                {
@@ -902,10 +897,8 @@
                                                {
                                                        $entry['value'] = 
$this->db->db_addslashes($entry['value']);
                                                }
+                                               $values_insert[$entry['name']] 
= $entry['value'];
 
-                                               $cols[] = $entry['name'];
-                                               $vals[] = $entry['value'];
-
                                                if($entry['history'] == 1)
                                                {
                                                        
$history_set[$entry['attrib_id']] = $entry['value'];
@@ -914,28 +907,38 @@
                                }
                        }
 
-                       if($cols)
+                       $admin_entity   = 
CreateObject('property.soadmin_entity');
+                       $admin_entity->type = $this->type;
+                       $category = 
$admin_entity->read_single_category($entity_id, $cat_id);
+
+                       $this->db->transaction_begin();
+
+                       if($category['is_eav'])
                        {
-                               $cols   = "," . implode(",", $cols);
-                               $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
+                               if(isset($values_insert['p_num']) && 
$values_insert['p_num'])
+                               {
+                                       $p_category = 
$admin_entity->read_single_category($values_insert['p_entity_id'], 
$values_insert['p_cat_id']);
+                                       $values_insert['p_id']                  
= (int) ltrim($values_insert['p_num'], $p_category['prefix']);
+                                       $values_insert['p_location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$values_insert['p_entity_id']}.{$values_insert['p_cat_id']}");
+                               }
+
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$entity_id}.{$cat_id}");
+                               $values['id'] = 
$this->_save_eav($values_insert, $location_id);
                        }
                        else
                        {
-                               $cols = '';
-                               $vals = '';
-                       }
+                               $table = 
"fm_{$this->type}_{$entity_id}_$cat_id";
+                               $values['id'] = 
$this->generate_id(array('entity_id'=>$entity_id,'cat_id'=>$cat_id));
+                               
$num=$this->generate_num($entity_id,$cat_id,$values['id']);
+                               $values_insert['id'] = $values['id'];
+                               $values_insert['num'] = $num;
+                               $values_insert['entry_date'] =  time();
+                               $values_insert['user_id'] = $this->account;
 
-                       $table = "fm_{$this->type}_{$entity_id}_$cat_id";
-                       $this->db->transaction_begin();
-                       $values['id'] = 
$this->generate_id(array('entity_id'=>$entity_id,'cat_id'=>$cat_id));
-                       
$num=$this->generate_num($entity_id,$cat_id,$values['id']);
+                               $this->db->query("INSERT INTO {$table} (" . 
implode(',',array_keys($values_insert)) . ') VALUES ('
+                                . 
$this->db->validate_insert(array_values($values_insert)) . 
')',__LINE__,__FILE__);
 
-                       $this->db->query("INSERT INTO $table 
(id,num,entry_date,user_id $cols) "
-                               . "VALUES ("
-                               . $values['id']. ",'"
-                               . $num . "',"
-                               . time() . ","
-                               . $this->account. " $vals)",__LINE__,__FILE__);
+                       }
 
                        if(isset($values['origin']) && 
is_array($values['origin']))
                        {
@@ -972,6 +975,52 @@
                        return $receipt;
                }
 
+               protected function _save_eav($data = array(),$location_id)
+               {
+                       $location_id = (int) $location_id;
+                       $this->db->query("SELECT id as type FROM fm_bim_type 
WHERE location_id = {$location_id}",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $type = $this->db->f('type');
+
+                       phpgw::import_class('phpgwapi.xmlhelper');
+                       $xmldata = phpgwapi_xmlhelper::toXML($data, 'PHPGW');
+                       $doc = new DOMDocument;
+                       $doc->preserveWhiteSpace = true;
+                       $doc->loadXML( $xmldata );
+                       $doc->formatOutput = true;
+                       $xml = $doc->saveXML();
+
+               //      _debug_array($xml);
+
+                       if (function_exists('com_create_guid') === true)
+                       {
+                               $guid = trim(com_create_guid(), '{}');
+                       }
+                       else
+                       {
+                               $guid = 
sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 
65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), 
mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
+                       }
+
+                       $values_insert = array
+                       (
+                               'type'                                  => 
$type,
+                               'guid'                                  => 
$guid,
+                               'xml_representation'    => 
$this->db->db_addslashes($xml),
+                               'model'                                 => 0,
+                               'p_location_id'                 => 
isset($data['p_location_id']) && $data['p_location_id'] ? 
$data['p_location_id'] : '',
+                               'p_id'                                  => 
isset($data['p_id']) && $data['p_id'] ? $data['p_id'] : '',
+                               'location_code'                 => 
$data['location_code'],//character varying(20),
+                               'address'                               => 
$data['address'],//character varying(150),
+                               'entry_date'                    => time(),
+                               'user_id'                               => 
$this->account
+                       );
+
+                       $this->db->query("INSERT INTO fm_bim_item (" . 
implode(',',array_keys($values_insert)) . ') VALUES ('
+                        . 
$this->db->validate_insert(array_values($values_insert)) . 
')',__LINE__,__FILE__);
+
+                       return 
$this->db->get_last_insert_id('fm_bim_item','id');
+               }
+
                function edit($values,$values_attribute,$entity_id,$cat_id)
                {
                        $receipt        = array();

Modified: branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php       
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php       
2011-11-15 07:51:11 UTC (rev 8109)
@@ -533,7 +533,6 @@
                        {
                                $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$entry['id']}");
                        }                       
-
                        $uicols['name'][0]      = 'location_id';
                        $uicols['descr'][0]     = 'location_id';
                        $uicols['name'][1]      = 'id';
@@ -546,6 +545,8 @@
                        $uicols['descr'][4]     = lang('Prefix');
                        $uicols['name'][5]      = 'entity_id';
                        $uicols['descr'][5]     = lang('id');
+                       $uicols['name'][6]      = 'is_eav';
+                       $uicols['descr'][6]     = lang('is_eav');
                        $j = 0;
                        $count_uicols_name = count($uicols['name']);
 
@@ -1176,6 +1177,7 @@
                                        'value_start_project'                   
        => $values['start_project'],
                                        'start_ticket'                          
                => true,
                                        'value_start_ticket'                    
        => $values['start_ticket'],
+                                       'value_is_eav'                          
                => $values['is_eav'],
                                        'jasperupload'                          
                => true,
                                        'category_list'                         
                => $category_list,
                                        'parent_list'                           
                => $parent_list

Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php    2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php    2011-11-15 
07:51:11 UTC (rev 8109)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.624';
+       $setup_info['property']['version']              = '0.9.17.625';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-11-15 07:51:11 UTC (rev 8109)
@@ -1608,6 +1608,7 @@
                                'loc_link' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'start_project' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'start_ticket' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'is_eav' => array('type' => 'int','precision' 
=> '2','nullable' => True),
                                'jasperupload' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'parent_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => True)

Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-11-15 07:51:11 UTC (rev 8109)
@@ -5457,6 +5457,26 @@
 
 
        /**
+       * Update property version from 0.9.17.624 to 0.9.17.625
+       * Add flag for eav modelling
+       */
+
+       $test[] = '0.9.17.624';
+       function property_upgrade0_9_17_624()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_entity_category','is_eav',array('type'
 => 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.625';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+
+       /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add more room for address at tickets
        * 

Modified: branches/Version-1_0-branch/property/templates/base/admin_entity.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/admin_entity.xsl        
2011-11-15 07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/property/templates/base/admin_entity.xsl        
2011-11-15 07:51:11 UTC (rev 8109)
@@ -681,6 +681,23 @@
                                                                        </input>
                                                                </td>
                                                        </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="php:function('lang', 'is eav')"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="checkbox" name="values[is_eav]" value="1">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'This category is modelled 
in the database as a xml adapted entity attribute value model')"/>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:if test="value_is_eav = '1'">
+                                                                               
        <xsl:attribute name="checked">
+                                                                               
                <xsl:text>checked</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</xsl:if>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
                                                </xsl:when>
                                        </xsl:choose>
 

Modified: branches/Version-1_0-branch/sms/bin/default/config_BR_log
===================================================================
--- branches/Version-1_0-branch/sms/bin/default/config_BR_log   2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/sms/bin/default/config_BR_log   2011-11-15 
07:51:11 UTC (rev 8109)
@@ -18,12 +18,13 @@
         * This file is for redirecting from log items to the subject of the 
log 
         */
 
-       $agreement = array(48089,48329);
-
+//     $agreement = array(48089,48329);
+       $agreement = array(86850);
        foreach ($agreement as $agreement_id)
        {
                $sql = "SELECT id from fm_s_agreement_detail WHERE agreement_id 
= $agreement_id AND location_code ilike '" . $param . "%'";
                $this->db->query($sql,__LINE__,__FILE__);
+               $this->db->next_record();
                if($this->db->f('id'))
                {
                        break;
@@ -39,5 +40,3 @@
                'menuaction' => 'property.uis_agreement.view',
                'id'            => $agreement_id
        );
-       
-?>

Modified: branches/Version-1_0-branch/sms/bin/default/config_ST_log
===================================================================
--- branches/Version-1_0-branch/sms/bin/default/config_ST_log   2011-11-15 
07:44:27 UTC (rev 8108)
+++ branches/Version-1_0-branch/sms/bin/default/config_ST_log   2011-11-15 
07:51:11 UTC (rev 8109)
@@ -18,8 +18,8 @@
         * This file is for redirecting from log items to the subject of the 
log 
         */
 
-       $agreement = array(48089,48329);
-
+//     $agreement = array(48089,48329);
+       $agreement = array(86850);
        foreach ($agreement as $agreement_id)
        {
                $sql = "SELECT id from fm_s_agreement_detail WHERE agreement_id 
= $agreement_id AND location_code ilike '" . $param . "%'";




reply via email to

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