fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8151] Merge 8132:8150 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8151] Merge 8132:8150 from trunk
Date: Mon, 21 Nov 2011 13:11:35 +0000

Revision: 8151
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8151
Author:   sigurdne
Date:     2011-11-21 13:11:35 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
Merge 8132:8150 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
    
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/activitycalendarfrontend/templates/base/activity_edit.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
    
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
    branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
    branches/Version-1_0-branch/booking/setup/phpgw_no.lang
    
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
    branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl
    branches/Version-1_0-branch/bookingfrontend/inc/class.uievent.inc.php
    branches/Version-1_0-branch/bookingfrontend/templates/base/event_info.xsl
    branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.menu.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

Added Paths:
-----------
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit_step_1.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_step_1.php
    branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php

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


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

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-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2011-11-21 13:11:35 UTC (rev 8151)
@@ -146,7 +146,7 @@
                }
                if(isset($filters['new_activities']))
                {
-                       $filter_clauses = "activity.state=1";
+                       $filter_clauses[] = "activity.state=1 OR 
activity.state=2";
                }
                if(isset($filters['activity_state']) && 
$filters['activity_state'] != 'all'){
                        $activity_state = 
$this->marshal($filters['activity_state'],'int');

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php  
    2011-11-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php  
    2011-11-21 13:11:35 UTC (rev 8151)
@@ -107,6 +107,16 @@
                                
                        }
                }
+               if(isset($filters['organization_id']))
+               {
+                       $org_id = 
$this->marshal($filters['organization_id'],'int');
+                       if(isset($org_id) && $org_id > 0)
+                       {
+                               $filter_clauses[] = 
"organization_contact.organization_id = {$org_id}";
+                               $table = "bb_organization_contact 
organization_contact";
+                               
+                       }
+               }
                else if(isset($filters['group_id']))
                {
                        $group_id = $this->marshal($filters['group_id'],'int');
@@ -136,7 +146,7 @@
 
                $condition =  join(' AND ', $clauses);
 
-               if($table == "bb_organization_contact")
+               if($table == "bb_organization_contact organization_contact")
                {
                        if($return_count) // We should only return a count
                        {
@@ -329,6 +339,37 @@
                return $result;
        }
        
+       function get_booking_contact_persons($id, $group=false)
+       {
+               $result = array();
+       if(isset($id)){
+               $columns[] = 'group_contact.id';
+                               $columns[] = 'group_contact.name';
+                               $columns[] = 'group_contact.phone';
+                               $columns[] = 'group_contact.email';
+                               $columns[] = 'group_contact.group_id';
+               if($group)
+               {
+                       $q1="SELECT id, group_id, name, phone, email FROM 
bb_group_contact WHERE group_id='{$id}'";
+               }
+               else
+               {
+                       $q1="SELECT id, organization_id, name, phone, email, 
ssn FROM bb_organization_contact WHERE organization_id='{$id}'";
+               }
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person($this->db->f('id'), 'int');
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $result[] = $contact_person;
+                       }
+       }
+               return $result;
+       }
+       
        function update_local_contact_person($contact)
        {
                $id = $contact['id'];

Modified: branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php      
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php      
2011-11-21 13:11:35 UTC (rev 8151)
@@ -239,6 +239,27 @@
                return $contacts;
        }
        
+       function get_contacts_as_objects($group_id)
+       {
+               $contacts = array();
+       if(isset($group_id)){
+               $q1="SELECT * FROM bb_group_contact WHERE group_id={$group_id}";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;
+                       }
+                       //$result = $contacts;
+       }
+               
+               return $contacts;
+       }
+       
        function get_contacts_local($group_id)
        {
                $contacts = array();
@@ -254,6 +275,27 @@
                return $contacts;
        }
        
+       function get_contacts_local_as_objects($group_id)
+       {
+               $contacts = array();
+       if(isset($group_id)){
+               $q1="SELECT * FROM activity_contact_person WHERE 
group_id='{$group_id}'";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;
+                       }
+                       //$result = $contacts;
+       }
+               
+               return $contacts;
+       }
+       
        function get_description($group_id)
        {
        if(isset($group_id)){
@@ -343,5 +385,39 @@
                        return 0;
                }
        }
+       
+       function get_group_local($g_id)
+       {
+               $columns[] = 'activity_group.id';
+               $columns[] = 'activity_group.name';
+               $columns[] = 'activity_group.description';
+               $columns[] = 'activity_group.organization_id';
+               $columns[] = 'activity_group.change_type';
+               $columns[] = 'activity_group.transferred';
+               
+               $dir = $ascending ? 'ASC' : 'DESC';
+               $order = "ORDER BY activity_group.id $dir";
+               
+               $cols = implode(',',$columns);
+               $table = "activity_group";
+               
+               $sql = "SELECT {$cols} FROM {$table} WHERE 
activity_group.id={$g_id}";
+               $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       $group = new activitycalendar_group((int) $group_id);
+
+                       $group->set_name($this->unmarshal($this->db->f('name'), 
'string'));
+                       
$group->set_organization_id($this->unmarshal($this->db->f('organization_id'), 
'int'));
+                       
$group->set_shortname($this->unmarshal($this->db->f('shortname'), 'string'));
+                       
$group->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$group->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'), 
'int'));
+                       
$group->set_change_type($this->unmarshal($this->db->f('change_type'), 
'string'));
+                       
$group->set_transferred($this->unmarshal($this->db->f('transferred'), 'bool'));
+                       
+                       return $group;
+               }
+               
+       }
 }
 ?>

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2011-11-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2011-11-21 13:11:35 UTC (rev 8151)
@@ -3,6 +3,7 @@
 phpgw::import_class('activitycalendar.socommon');
 
 include_class('activitycalendar', 'organization', 'inc/model/');
+include_class('activitycalendar', 'contact_person', 'inc/model/');
 
 class activitycalendar_soorganization extends activitycalendar_socommon
 {
@@ -85,6 +86,7 @@
 
                $filter_clauses = array();
                $filter_clauses[] = "show_in_portal=1";
+               $filter_clauses[] = "NOT org.name=''";
                
                $use_local_org = false;
                
@@ -243,12 +245,32 @@
                return $contacts;
        }
        
+       function get_contacts_as_objects($organization_id)
+       {
+               $contacts = array();
+       if(isset($organization_id)){
+               $q1="SELECT * FROM bb_organization_contact WHERE 
organization_id={$organization_id}";
+               //var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;                  
}
+       }
+               return $contacts;
+       }
+       
+       
        function get_contacts_local($organization_id)
        {
                $contacts = array();
        if(isset($organization_id)){
                $q1="SELECT id FROM activity_contact_person WHERE 
organization_id='{$organization_id}'";
-               var_dump($q1);
+               //var_dump($q1);
                        $this->db->query($q1, __LINE__, __FILE__);
                        while($this->db->next_record()){
                                $cont_id = $this->db->f('id');
@@ -259,6 +281,26 @@
                return $contacts;
        }
        
+       function get_contacts_local_as_objects($organization_id)
+       {
+               $contacts = array();
+       if(isset($organization_id)){
+               $q1="SELECT * FROM activity_contact_person WHERE 
organization_id='{$organization_id}'";
+               //var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;
+                       }
+       }
+               return $contacts;
+       }
+       
        function get_description($organization_id)
        {
        if(isset($organization_id)){
@@ -512,6 +554,31 @@
                }
        }
        
+       function get_organization_local($org_id)
+       {
+               $sql = "SELECT * FROM activity_organization WHERE id={$org_id}";
+               //var_dump($sql);
+               $this->db->query($sql, __LINE__, __FILE__);
+               while($this->db->next_record())
+               {
+                       $organization = new activitycalendar_organization((int) 
$this->db->f('id'));
+       
+                       
$organization->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                       
$organization->set_organization_number($this->unmarshal($this->db->f('organization_number'),
 'int'));
+                       
$organization->set_address($this->unmarshal($this->db->f('address'), 'string'));
+                       
$organization->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                       
$organization->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                       
$organization->set_homepage($this->unmarshal($this->db->f('homepage'), 
'string'));
+                       
$organization->set_district($this->unmarshal($this->db->f('district'), 
'string'));
+                       
$organization->set_description($this->unmarshal($this->db->f('description'), 
'string'));
+                       
$organization->set_change_type($this->unmarshal($this->db->f('change_type'), 
'string'));
+                       
$organization->set_transferred($this->unmarshal($this->db->f('transferred'), 
'bool'));
+                       
$organization->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'),
 'int'));
+                       
+                       return $organization;
+               }
+       }
+       
        function update($organization)
        {
                return false;

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-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-11-21 13:11:35 UTC (rev 8151)
@@ -325,7 +325,7 @@
                switch($query_type)
                {
                        case 'new_activities':
-                               $filters = array('activity_state' => 1, 
'activity_district' => phpgw::get_var('activity_district'), 'user_id' => $uid);
+                               $filters = array('new_activities' => 'yes', 
'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;

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-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-11-21 13:11:35 UTC (rev 8151)
@@ -380,7 +380,7 @@
                                $org = $org_array[$keys[0]];
                        }
                        
-                       var_dump($org);
+                       //var_dump($org);
                        
                        $data = array
                        (

Modified: branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-11-21 13:11:35 UTC (rev 8151)
@@ -423,4 +423,4 @@
 time_helptext  activitycalendar        no      Oppgi tidspunkt for 
aktiviteten, f.eks. onsdag kl. 20-21
 office_helptext        activitycalendar        no      Oppgi kontor som 
saksbehandler aktiviteten
 contact_info   activitycalendar        no      Kontaktinformasjon for 
kulturkontoret
-contact_info_helptext  activitycalendar        no      Hentes fra 
booking/organisasjonsregister ved lagring.
+contact_info_helptext  activitycalendar        no      Hentes fra 
booking/organisasjonsregister ved lagring.
\ No newline at end of file

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-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-11-21 13:11:35 UTC (rev 8151)
@@ -3,6 +3,8 @@
        phpgw::import_class('activitycalendar.soactivity');
        phpgw::import_class('activitycalendar.sogroup');
        phpgw::import_class('activitycalendar.soarena');
+       phpgw::import_class('activitycalendar.soorganization');
+       phpgw::import_class('activitycalendar.socontactperson');
        
        include_class('activitycalendar', 'activity', 'inc/model/');
        include_class('activitycalendar', 'group', 'inc/model/');
@@ -10,6 +12,12 @@
 
        class activitycalendarfrontend_uiactivity extends 
activitycalendar_uiactivities
        {
+               private $so_activity;
+               private $so_arena;
+               private $so_organization;
+               private $so_group;
+               private $so_contact;
+               
                public $public_functions = array
                (
                        'add'                   =>      true,
@@ -20,56 +28,101 @@
                        'get_address_search'    => true
                );
                
+               public function __construct()
+               {
+                       parent::__construct();
+                       $this->so_activity = 
activitycalendar_soactivity::get_instance();
+                       $this->so_arena = 
activitycalendar_soarena::get_instance();
+                       $this->so_organization = 
activitycalendar_soorganization::get_instance();
+                       $this->so_group = 
activitycalendar_sogroup::get_instance();
+                       $this->so_contact = 
activitycalendar_socontactperson::get_instance();
+               }
+               
                /**
-                * Public method. Forwards the user to edit mode.
+                * Public method. Add new activity.
                 */
                public function add()
                {
                        
//$GLOBALS['phpgw']->redirect_link('/activitycalendarfrontend/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.edit', 'action' => 
'new_activity'));
                        $GLOBALS['phpgw']->js->validate_file( 'json', 'json', 
'phpgwapi' );
 
-                       $so_activity = 
activitycalendar_soactivity::get_instance();
-                       $so_arena = activitycalendar_soarena::get_instance();
-
-                       $categories = $so_activity->get_categories();
-                       $targets = $so_activity->get_targets();
-                       $offices = $so_activity->select_district_list();
-                       $districts = $so_activity->get_districts();
-                       $buildings = $so_arena->get_buildings();
-                       $arenas = $so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
-                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, 'org.name', 
true, null, null, null);
-                       $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
+                       $categories = $this->so_activity->get_categories();
+                       $targets = $this->so_activity->get_targets();
+                       $offices = $this->so_activity->select_district_list();
+                       $districts = $this->so_activity->get_districts();
+                       $buildings = $this->so_arena->get_buildings();
+                       $arenas = $this->so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
+                       $organizations = $this->so_organization->get(null, 
null, 'org.name', true, null, null, null);
                        
+                       $activity = new activitycalendar_activity();
+                       
                        $g_id = phpgw::get_var('group_id');
                        $o_id = phpgw::get_var('organization_id');
                        
-                       $activity = new activitycalendar_activity();
-                       //... set all parameters
-                       $activity->set_title(phpgw::get_var('title'));
-                       $activity->set_organization_id($o_id);
-                       $activity->set_group_id($g_id);
-                       $activity->set_arena(phpgw::get_var('arena_id'));
-                       
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
-                       $district_array = phpgw::get_var('district');
-                       $activity->set_district(implode(",", $district_array));
-                       $activity->set_office(phpgw::get_var('office'));
-                       $activity->set_state(1);
-                       $activity->set_category(phpgw::get_var('category'));
-                       $target_array = phpgw::get_var('target');
-                       $activity->set_target(implode(",", $target_array));
-                       $activity->set_description($desc);
-                       $activity->set_time(phpgw::get_var('time'));
-                       $activity->set_contact_persons($persons);
-                       
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
-                       $activity->set_frontend(true);
-                       
-                       if(isset($g_id) && is_numeric($g_id) && $g_id > 0)
+                       if(isset($_POST['step_1'])) //activity shall be 
registred on a new organization
                        {
-                               $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
-                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
+                               if($o_id == "new_org")
+                               {
+                                       $new_org = true;
+                                       $this->render('activity_new.php', array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'new_organization' => 
true,
+                                                       'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
+                                                       'categories' => 
$categories,
+                                                       'targets' => $targets,
+                                                       'districts' => 
$districts,
+                                                       'offices' => $offices,
+                                                       'editable' => true,
+                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                               )
+                                       );
+                               }
+                               else
+                               {
+                                       $new_org = false;
+                                       $organization = 
$this->so_organization->get_single($o_id);
+                                       $person_arr = 
$this->so_contact->get(null, null, null, null, null, null, 
array('organization_id' => $o_id));
+                                       foreach($person_arr as $p)
+                                       {
+                                               //var_dump($p);
+                                               $persons[] = $p;
+                                       }
+                                       
+                                       $groups = $this->so_group->get(null, 
null, null, null, null, null, array('org_id' => $o_id));
+                                       
+                                       $activity->set_organization_id($o_id);
+                                       
$activity->set_description($organization->get_description());
+                                       $activity->set_contact_persons($pers);
+                                       
+                                       $this->render('activity_new.php', array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'new_organization' => 
false,
+                                                       'organization' => 
$organization,
+                                                       'contact1' => 
$persons[0],
+                                                       'contact2' => 
$persons[1],
+                                                       'groups' => $groups,
+                                                       'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
+                                                       'categories' => 
$categories,
+                                                       'targets' => $targets,
+                                                       'districts' => 
$districts,
+                                                       'offices' => $offices,
+                                                       'editable' => true,
+                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                               )
+                                       );
+                               }
                        }
-                       else if(isset($o_id))
+                       else if(isset($_POST['save_activity']))
                        {
+                               //$persons = 
$this->so_organization->get_contacts($o_id);                               
+                               //$organization = 
$this->so_organization->get_single($o_id);
+                               
                                if($o_id == "new_org")
                                {
                                        $activity->set_new_org(true);
@@ -84,83 +137,38 @@
                                        //$org_info['zip'] = 
phpgw::get_var('postaddress');
                                        $org_info['district'] = 
phpgw::get_var('org_district'); 
                                        $org_info['status'] = "new";
-                                       $o_id = 
$so_activity->add_organization_local($org_info);
+                                       $o_id = 
$this->so_activity->add_organization_local($org_info);
                                        
                                        //add contact persons
                                        $contact1 = array();
-                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
+                                       $contact1['name'] = 
phpgw::get_var('org_contact1_name');
+                                       $contact1['phone'] = 
phpgw::get_var('org_contact1_phone');
+                                       $contact1['mail'] = 
phpgw::get_var('org_contact1_email');
                                        $contact1['org_id'] = $o_id;
                                        $contact1['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact1);
+                                       
$this->so_activity->add_contact_person_local($contact1);
                                        
                                        $contact2 = array();
-                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
+                                       $contact2['name'] = 
phpgw::get_var('org_contact2_name');
+                                       $contact2['phone'] = 
phpgw::get_var('org_contact2_phone');
+                                       $contact2['mail'] = 
phpgw::get_var('org_contact2_email');
                                        $contact2['org_id'] = $o_id;
                                        $contact2['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact2);
+                                       
$this->so_activity->add_contact_person_local($contact2);
                                        
-                                       $persons = 
activitycalendar_soorganization::get_instance()->get_contacts_local($o_id);
+                                       //$persons = 
$this->so_organization->get_contacts_local_as_objects($o_id);
+                                       //var_dump($persons);
+                                       $person_arr = 
$this->so_contact->get_local_contact_persons($o_id);
+                                       foreach($person_arr as $p)
+                                       {
+                                               //var_dump($p);
+                                               $persons[] = $p;
+                                       }
+                                       $person_ids = 
$this->so_organization->get_contacts_local($o_id);
                                        $desc = 
phpgw::get_var('org_description');
-
+                                       $organization = 
$this->so_organization->get_organization_local($o_id);
+                                       //var_dump($organization);
                                }
-                               else if($o_id == "change_org")
-                               {
-                                       $change_org_id = 
phpgw::get_var('change_organization_id');
-                                       $organization = 
activitycalendar_soorganization::get_instance()->get_single($change_org_id);
-                               
-                                       $org_info['name'] = 
$organization->get_name();
-                                       $org_info['orgnr'] = 
$organization->get_organization_number();
-                                       $org_info['homepage'] = 
$organization->get_homepage();
-                                       $org_info['phone'] = 
$organization->get_phone();
-                                       $org_info['email'] = 
$organization->get_email();
-                                       $org_info['description'] = 
$organization->get_description();
-                                       $org_info['street'] = 
$organization->get_address();
-                                       $org_info['district'] = 
$organization->get_district(); 
-                                       $org_info['status'] = "change";
-                                       $o_id = 
$so_activity->add_organization_local($org_info);
-                                       
-                                       //add contact persons
-                                       $contact1 = array();
-                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                       $contact1['org_id'] = $o_id;
-                                       $contact1['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact1);
-                                       
-                                       $contact2 = array();
-                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                       $contact2['org_id'] = $o_id;
-                                       $contact2['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact2);
-                                       
-                                       $message = lang('change_request_ok', 
$organization->get_name());
-                                       
-                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                                       $this->render('activity_new.php', array
-                                               (
-                                                       'activity'      => 
$activity,
-                                                       'organizations' => 
$organizations,
-                                                       'groups' => $groups,
-                                                       'arenas' => $arenas,
-                                                       'buildings' => 
$buildings,
-                                                       'categories' => 
$categories,
-                                                       'targets' => $targets,
-                                                       'districts' => 
$districts,
-                                                       'offices' => $offices,
-                                                       'editable' => true,
-                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
-                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
-                                               )
-                       );
-                               }
                                else if(is_numeric($o_id) && $o_id > 0)
                                {
                                        if(isset($g_id) && $g_id == "new_group")
@@ -169,119 +177,139 @@
                                                $group_info['organization_id'] 
= $o_id;
                                                $group_info['description'] = 
phpgw::get_var('group_description');
                                                $group_info['status'] = "new";
-                                               $g_id = 
$so_activity->add_group_local($group_info);
+                                               $g_id = 
$this->so_activity->add_group_local($group_info);
                                                
                                                //add contact persons
                                                $contact1 = array();
-                                               $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                               $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                               $contact1['mail'] = 
phpgw::get_var('contact1_email');
+                                               $contact1['name'] = 
phpgw::get_var('group_contact1_name');
+                                               $contact1['phone'] = 
phpgw::get_var('group_contact1_phone');
+                                               $contact1['mail'] = 
phpgw::get_var('group_contact1_email');
                                                $contact1['org_id'] = 0;
                                                $contact1['group_id'] = $g_id;
-                                               
$so_activity->add_contact_person_local($contact1);
+                                               
$this->so_activity->add_contact_person_local($contact1);
                                                
                                                $contact2 = array();
-                                               $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                               $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                               $contact2['mail'] = 
phpgw::get_var('contact2_email');
+                                               $contact2['name'] = 
phpgw::get_var('group_contact2_name');
+                                               $contact2['phone'] = 
phpgw::get_var('group_contact2_phone');
+                                               $contact2['mail'] = 
phpgw::get_var('group_contact2_email');
                                                $contact2['org_id'] = 0;
                                                $contact2['group_id'] = $g_id;
-                                               
$so_activity->add_contact_person_local($contact2);
+                                               
$this->so_activity->add_contact_person_local($contact2);
                                                
-                                               $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts_local($g_id);
+                                               //$persons = 
$this->so_group->get_contacts_local_as_objects($g_id);
+                                               $person_arr = 
$this->so_contact->get_local_contact_persons($g_id, true);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       //var_dump($p);
+                                                       $persons[] = $p;
+                                               }
                                                $desc = 
phpgw::get_var('group_description');
+                                               $group = 
$this->so_group>get_group_local($g_id);
+                                               $person_ids = 
$this->so_group->get_contacts_local($g_id);
                                        }
-                                       else
+                                       else if(isset($g_id) && 
is_numeric($g_id) && $g_id > 0)
                                        {
-                                               $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
-                                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
+                                               $person_ids = 
$this->so_group->get_contacts($g_id);
+                                               $person_arr = 
$this->so_contact->get_local_contact_persons($g_id, true);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       //var_dump($p);
+                                                       $persons[] = $p;
+                                               }
+                                               $desc = 
$this->so_group->get_description($g_id);
+                                               $organization = 
$this->so_organization->get_single($o_id);
+                                               $group = 
$this->so_group->get_single($g_id);
                                        }
+                                       else if(isset($o_id) && 
is_numeric($o_id) && $o_id > 0)
+                                       {
+                                               $person_ids = 
$this->so_organization->get_contacts($o_id);
+                                               $person_arr = 
$this->so_contact->get_local_contact_persons($o_id);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       //var_dump($p);
+                                                       $persons[] = $p;
+                                               }
+                                               $desc = 
$this->so_organization->get_description($o_id);
+                                               $organization = 
$this->so_organization->get_single($o_id);
+                                       }
                                }
-                       }
-                       
-                       if(isset($_POST['save_activity'])) // The user has 
pressed the save button
-                       {
-                               if(isset($activity)) // If an activity object 
is created
+                               
+                               //... set all parameters
+                               $activity->set_title(phpgw::get_var('title'));
+                               $activity->set_organization_id($o_id);
+                               $activity->set_group_id($g_id);
+                               
$activity->set_arena(phpgw::get_var('arena_id'));
+                               
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
+                               $district_array = phpgw::get_var('district');
+                               $activity->set_district(implode(",", 
$district_array));
+                               $activity->set_office(phpgw::get_var('office'));
+                               $activity->set_state(1);
+                               
$activity->set_category(phpgw::get_var('category'));
+                               $target_array = phpgw::get_var('target');
+                               $activity->set_target(implode(",", 
$target_array));
+                               $activity->set_description($desc);
+                               $activity->set_time(phpgw::get_var('time'));
+                               $activity->set_contact_persons($person_ids);
+                               
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+                               $activity->set_frontend(true);
+                               
+                               $target_ok = false;
+                               $district_ok = false;
+                               if($activity->get_target() && 
$activity->get_target() != '')
                                {
-                                       $target_ok = false;
-                                       $district_ok = false;
-                                       if($activity->get_target() && 
$activity->get_target() != '')
+                                       $target_ok = true;
+                               }
+                               if($activity->get_district() && 
$activity->get_district() != '')
+                               {
+                                       $district_ok = true;
+                               }
+                               
+                               if($target_ok && $district_ok)
+                               {
+                                       
if($this->so_activity->store($activity)) // ... and then try to store the object
                                        {
-                                               $target_ok = true;
+                                               $message = 
lang('messages_saved_form'); 
                                        }
-                                       if($activity->get_district() && 
$activity->get_district() != '')
+                                       else
                                        {
-                                               $district_ok = true;
+                                               $error = 
lang('messages_form_error');
                                        }
-                                       
-                                       if($target_ok && $district_ok)
-                                       {
-                                               
-                                               
if($so_activity->store($activity)) // ... and then try to store the object
-                                               {
-                                                       $message = 
lang('messages_saved_form'); 
-                                               }
-                                               else
-                                               {
-                                                       $error = 
lang('messages_form_error');
-                                               }
 
-                                               
$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')
-                                                                       )
-                                               );
+                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+                                       $this->render('activity.php', array
+                                                               (
+                                                                       
'activity'      => $activity,
+                                                                       
'organization' => $organization,
+                                                                       'group' 
=> $group,
+                                                                       
'contact1' => $persons[0],
+                                                                       
'contact2' => $persons[1],
+                                                                       
'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');
                                        }
-                                       else
+                                       if(!$district_ok)
                                        {
-                                               if(!$target_ok)
-                                               {
-                                                       $error .= "<br/>" . 
lang('target_not_selected');
-                                               }
-                                               if(!$district_ok)
-                                               {
-                                                       $error .= "<br/>" . 
lang('district_not_selected');
-                                               }
-                                               return 
$this->render('activity_new.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')
-                                                       )       
-                                               );
+                                               $error .= "<br/>" . 
lang('district_not_selected');
                                        }
-                               }
-                       }
-                       
-                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                       $this->render('activity_new.php', array
+                                       return 
$this->render('activity_new.php', array
                                                (
                                                        'activity'      => 
$activity,
                                                        'organizations' => 
$organizations,
+                                                       'org_name' => $org_name,
                                                        'groups' => $groups,
                                                        'arenas' => $arenas,
                                                        'buildings' => 
$buildings,
@@ -290,10 +318,21 @@
                                                        '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')
-                                               )
-                       );
+                                               )       
+                                       );
+                               }
+                       }
+                       else
+                       {
+                               return $this->render('activity_new_step_1.php', 
array
+                                               (
+                                                       'organizations' => 
$organizations
+                                               )       
+                                       );
+                       }
                }
                
                function view()
@@ -324,333 +363,231 @@
                        $GLOBALS['phpgw']->js->validate_file( 'json', 'json', 
'phpgwapi' );
 
                        $id = intval(phpgw::get_var('id', 'GET'));
-                       $action = phpgw::get_var('action', 'GET');
 
-                       $so_activity = 
activitycalendar_soactivity::get_instance();
-                       $so_arena = activitycalendar_soarena::get_instance();
-
-                       $categories = $so_activity->get_categories();
-                       $targets = $so_activity->get_targets();
-                       $offices = $so_activity->select_district_list();
-                       $districts = $so_activity->get_districts();
-                       $buildings = $so_arena->get_buildings();
-                       $arenas = $so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
-                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, 'org.name', 
true, null, null, null);
-                       $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
+                       $categories = $this->so_activity->get_categories();
+                       $targets = $this->so_activity->get_targets();
+                       $offices = $this->so_activity->select_district_list();
+                       $districts = $this->so_activity->get_districts();
+                       $buildings = $this->so_arena->get_buildings();
+                       $arenas = $this->so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
                        
-                       // Retrieve the activity object or create a new one
-                       if(isset($id) && $id > 0)
-                       {       
-                               $activity = $so_activity->get_single($id); 
-                       }
-                       else
+                       if(isset($_POST['step_1'])) //change_request
                        {
-                               $activity = new activitycalendar_activity();
-                       }
-                       
-                       if($activity->get_secret() != phpgw::get_var('secret', 
'GET'))
-                       {
-                               if($action != 'new_activity')
+                               $activity_id = phpgw::get_var('activity_id');
+                               $activity = 
$this->so_activity->get_single($activity_id);
+                               
+                               //store update-request
+                               $activity->set_state(2);
+                               if($this->so_activity->store($activity))
                                {
-                                       $this->redirect(array('menuaction' => 
'bookingfrontend.uisearch.index'));
+                                       $message = lang('update_request_sent', 
$activity->get_title());
+                                       return 
$this->render('activity_edit_step_1.php', array
+                                               (
+                                                       'activities' => 
$activities,
+                                                       'message' => $message
+                                               )       
+                                       );
                                }
                        }
-                       
-                       $g_id = phpgw::get_var('group_id');
-                       $o_id = phpgw::get_var('organization_id');
-                       if(isset($g_id) && is_numeric($g_id) && $g_id > 0)
+                       else
                        {
-                               /*if($g_id == "new_group")
+                               $secret_param = phpgw::get_var('secret', 'GET');
+                               if(!isset($id) || $id == '')
                                {
-                                       //add new group to internal 
activitycalendar group register
+                                       //select activity to edit
+                                       $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
+                                       return 
$this->render('activity_edit_step_1.php', array
+                                               (
+                                                       'activities' => 
$activities
+                                               )       
+                                       );
                                }
-                               else*/ 
-                               //if(is_numeric($g_id) && $g_id > 0)
-                               //{
-                                       $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
-                                       $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
-                               //}
-                       }
-                       else if(isset($o_id))
-                       {
-                               if($o_id == "new_org")
-                               {
-                                       $activity->set_new_org(true);
-                                       //add new organization to internal 
activitycalendar organization register
-                                       $org_info['name'] = 
phpgw::get_var('orgname');
-                                       $org_info['orgnr'] = 
phpgw::get_var('orgno');
-                                       $org_info['homepage'] = 
phpgw::get_var('homepage');
-                                       $org_info['phone'] = 
phpgw::get_var('phone');
-                                       $org_info['email'] = 
phpgw::get_var('email');
-                                       $org_info['description'] = 
phpgw::get_var('org_description');
-                                       $org_info['street'] = 
phpgw::get_var('address') . ' ' . phpgw::get_var('number') . ', ' . 
phpgw::get_var('postaddress');
-                                       //$org_info['zip'] = 
phpgw::get_var('postaddress');
-                                       $org_info['district'] = 
phpgw::get_var('org_district'); 
-                                       $org_info['status'] = "new";
-                                       $o_id = 
$so_activity->add_organization_local($org_info);
-                                       
-                                       //add contact persons
-                                       $contact1 = array();
-                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                       $contact1['org_id'] = $o_id;
-                                       $contact1['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact1);
-                                       
-                                       $contact2 = array();
-                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                       $contact2['org_id'] = $o_id;
-                                       $contact2['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact2);
-                                       
-                                       $persons = 
activitycalendar_soorganization::get_instance()->get_contacts_local($o_id);
-                                       $desc = 
phpgw::get_var('org_description');
-
-                               }
-                               else if($o_id == "change_org")
-                               {
-                                       $change_org_id = 
phpgw::get_var('change_organization_id');
-                                       $organization = 
activitycalendar_soorganization::get_instance()->get_single($change_org_id);
-                               
-                                       $org_info['name'] = 
$organization->get_name();
-                                       $org_info['orgnr'] = 
$organization->get_organization_number();
-                                       $org_info['homepage'] = 
$organization->get_homepage();
-                                       $org_info['phone'] = 
$organization->get_phone();
-                                       $org_info['email'] = 
$organization->get_email();
-                                       $org_info['description'] = 
$organization->get_description();
-                                       $org_info['street'] = 
$organization->get_address();
-                                       $org_info['district'] = 
$organization->get_district(); 
-                                       $org_info['status'] = "change";
-                                       $o_id = 
$so_activity->add_organization_local($org_info);
-                                       
-                                       //add contact persons
-                                       $contact1 = array();
-                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                       $contact1['org_id'] = $o_id;
-                                       $contact1['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact1);
-                                       
-                                       $contact2 = array();
-                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                       $contact2['org_id'] = $o_id;
-                                       $contact2['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact2);
-                                       
-                                       $message = lang('change_request_ok', 
$organization->get_name());
-                                       
-                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                                       $this->render('activity.php', array
+                               if(!isset($secret_param) || $secret_param == 
''){
+                                       //select activity to edit
+                                       $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
+                                       return 
$this->render('activity_edit_step_1.php', array
                                                (
-                                                       'activity'      => 
$activity,
-                                                       'organizations' => 
$organizations,
-                                                       'groups' => $groups,
-                                                       'arenas' => $arenas,
-                                                       'buildings' => 
$buildings,
-                                                       'categories' => 
$categories,
-                                                       'targets' => $targets,
-                                                       'districts' => 
$districts,
-                                                       'offices' => $offices,
-                                                       'editable' => true,
-                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
-                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
-                                               )
-                       );
+                                                       'activities' => 
$activities
+                                               )       
+                                       );
                                }
-                               else if(is_numeric($o_id) && $o_id > 0)
+                               else
                                {
-                                       if(isset($g_id) && $g_id == "new_group")
-                                       {
-                                               $group_info['name'] = 
phpgw::get_var('groupname');
-                                               $group_info['organization_id'] 
= $o_id;
-                                               $group_info['description'] = 
phpgw::get_var('group_description');
-                                               $group_info['status'] = "new";
-                                               $g_id = 
$so_activity->add_group_local($group_info);
-                                               
-                                               //add contact persons
-                                               $contact1 = array();
-                                               $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                               $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                               $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                               $contact1['org_id'] = 0;
-                                               $contact1['group_id'] = $g_id;
-                                               
$so_activity->add_contact_person_local($contact1);
-                                               
-                                               $contact2 = array();
-                                               $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                               $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                               $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                               $contact2['org_id'] = 0;
-                                               $contact2['group_id'] = $g_id;
-                                               
$so_activity->add_contact_person_local($contact2);
-                                               
-                                               $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts_local($g_id);
-                                               $desc = 
phpgw::get_var('group_description');
+                                       // Retrieve the activity object or 
create a new one
+                                       if(isset($id) && $id > 0)
+                                       {       
+                                               $activity = 
$this->so_activity->get_single($id); 
                                        }
                                        else
                                        {
-                                               $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
-                                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
+                                               $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
+                                               return 
$this->render('activity_edit_step_1.php', array
+                                                       (
+                                                               'activities' => 
$activities
+                                                       )       
+                                               );
                                        }
-                               }
-                       }
-                       
-                       if(isset($_POST['save_activity'])) // The user has 
pressed the save button
-                       {
-                               if(isset($activity)) // If an activity object 
is created
-                               {
-
-                                       $old_state = $activity->get_state();
-                                       $new_state = phpgw::get_var('state');
-                                       // ... set all parameters
-                                       
$activity->set_title(phpgw::get_var('title'));
-                                       $activity->set_organization_id($o_id);
-                                       $activity->set_group_id($g_id);
-                                       
$activity->set_arena(phpgw::get_var('arena_id'));
-                                       
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
-                                       $district_array = 
phpgw::get_var('district');
-                                       $activity->set_district(implode(",", 
$district_array));
-                                       
$activity->set_office(phpgw::get_var('office'));
-                                       if($action == 'new_activity')
+                                       
+                                       if($activity->get_secret() != 
phpgw::get_var('secret', 'GET'))
                                        {
-                                               $activity->set_state(1);
-                                               $new_state=1;
+                                               //select activity to edit
+                                               $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
+                                               return 
$this->render('activity_edit_step_1.php', array
+                                                       (
+                                                               'activities' => 
$activities
+                                                       )       
+                                               );
                                        }
-                                       else
+                                       
+                                       if($activity->get_group_id())
                                        {
-                                               
$activity->set_state($new_state);
+                                               $person_arr = 
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       $persons[] = $p;
+                                               }
+                                               $desc = 
$this->so_group->get_description($activity->get_group_id());
+                                               $group = 
$this->so_group->get_single($activity->get_group_id());
+                                               $person_ids = 
$this->so_group->get_contacts($activity->get_group_id());
                                        }
-                                       
$activity->set_category(phpgw::get_var('category'));
-                                       $target_array = 
phpgw::get_var('target');
-                                       $activity->set_target(implode(",", 
$target_array));
-                                       $activity->set_description($desc);
-                                       
$activity->set_time(phpgw::get_var('time'));
-                                       
$activity->set_contact_persons($persons);
-                                       
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
-                                       $activity->set_frontend(true);
-
-                                       $target_ok = false;
-                                       $district_ok = false;
-                                       if($activity->get_target() && 
$activity->get_target() != '')
+                                       else 
if($activity->get_organization_id())
                                        {
-                                               $target_ok = true;
+                                               $person_arr = 
$this->so_contact->get_booking_contact_persons($activity->get_organization_id());
+                                               foreach($person_arr as $p)
+                                               {
+                                                       $persons_array[] = $p;
+                                               }
+                                               $desc = 
$this->so_organization->get_description($activity->get_organization_id());
+                                               $person_ids = 
$this->so_organization->get_contacts($activity->get_organization_id());
                                        }
-                                       if($activity->get_district() && 
$activity->get_district() != '')
-                                       {
-                                               $district_ok = true;
-                                       }
+                                       $organization = 
$this->so_organization->get_single($activity->get_organization_id());
                                        
-                                       if($target_ok && $district_ok)
+                                       if(isset($_POST['save_activity'])) // 
The user has pressed the save button
                                        {
-                                               
-                                               
if($so_activity->store($activity)) // ... and then try to store the object
+                                               if(isset($activity)) // If an 
activity object is created
                                                {
-                                                       $message = 
lang('messages_saved_form'); 
-                                               }
-                                               else
-                                               {
-                                                       $error = 
lang('messages_form_error');
-                                               }
+                                                       $old_state = 
$activity->get_state();
+                                                       $new_state = 
phpgw::get_var('state');
+                                                       // ... set all 
parameters
+                                                       
$activity->set_title(phpgw::get_var('title'));
+                                                       
$activity->set_arena(phpgw::get_var('arena_id'));
+                                                       
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
+                                                       $district_array = 
phpgw::get_var('district');
+                                                       
$activity->set_district(implode(",", $district_array));
+                                                       
$activity->set_office(phpgw::get_var('office'));
+                                                       $activity->set_state(2);
+                                                       
$activity->set_category(phpgw::get_var('category'));
+                                                       $target_array = 
phpgw::get_var('target');
+                                                       
$activity->set_target(implode(",", $target_array));
+                                                       
$activity->set_description($desc);
+                                                       
$activity->set_time(phpgw::get_var('time'));
+                                                       
$activity->set_contact_persons($persons);
+                                                       
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+                                                       
$activity->set_frontend(true);
                
-                                               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);
+                                                       $target_ok = false;
+                                                       $district_ok = false;
+                                                       
if($activity->get_target() && $activity->get_target() != '')
+                                                       {
+                                                               $target_ok = 
true;
+                                                       }
+                                                       
if($activity->get_district() && $activity->get_district() != '')
+                                                       {
+                                                               $district_ok = 
true;
+                                                       }
                                                        
-                                                       if(isset($g_id) && 
$g_id > 0)
+                                                       if($target_ok && 
$district_ok)
                                                        {
-                                                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                                               
+                                                               
if($this->so_activity->store($activity)) // ... and then try to store the object
+                                                               {
+                                                                       
$message = lang('messages_saved_form'); 
+                                                               }
+                                                               else
+                                                               {
+                                                                       $error 
= lang('messages_form_error');
+                                                               }
+                               
+                                                               
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       
+                                                               
$this->render('activity.php', array
+                                                                               
        (
+                                                                               
                'activity'      => $activity,
+                                                                               
                'organization' => $organization,
+                                                                               
                'group' => $group,
+                                                                               
                '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 (isset($o_id) 
&& $o_id > 0)
+                                                       else
                                                        {
-                                                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                                               if(!$target_ok)
+                                                               {
+                                                                       $error 
.= "<br/>" . lang('target_not_selected');
+                                                               }
+                                                               
if(!$district_ok)
+                                                               {
+                                                                       $error 
.= "<br/>" . lang('district_not_selected');
+                                                               }
+                                                               return 
$this->render('activity_edit.php', array
+                                                                       (
+                                                                               
'activity'      => $activity,
+                                                                               
'organization' => $organization,
+                                                                               
'org_name' => $org_name,
+                                                                               
'group' => $group,
+                                                                               
'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')
+                                                                       )       
+                                                               );
                                                        }
                                                }
+                                       }
+                                       else
+                                       {
                                                
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-       
-                                               $this->render('activity.php', 
array
+                       
+                                               
$this->render('activity_edit.php', array
                                                                        (
                                                                                
'activity'      => $activity,
-                                                                               
'organizations' => $organizations,
-                                                                               
'groups' => $groups,
+                                                                               
'organization' => $organization,
+                                                                               
'group' => $group,
                                                                                
'arenas' => $arenas,
                                                                                
'buildings' => $buildings,
                                                                                
'categories' => $categories,
                                                                                
'targets' => $targets,
                                                                                
'districts' => $districts,
                                                                                
'offices' => $offices,
+                                                                               
'editable' => true,
                                                                                
'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_edit.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')
-                                                       )       
-                                               );
-                                       }
                                }
                        }
-                       
-                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                       $this->render('activity_edit.php', array
-                                               (
-                                                       'activity'      => 
$activity,
-                                                       'organizations' => 
$organizations,
-                                                       'groups' => $groups,
-                                                       'arenas' => $arenas,
-                                                       'buildings' => 
$buildings,
-                                                       'categories' => 
$categories,
-                                                       'targets' => $targets,
-                                                       'districts' => 
$districts,
-                                                       'offices' => $offices,
-                                                       'editable' => true,
-                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
-                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
-                                               )
-                       );
                }
                
                function index()
                {
                        $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.add'));
-                       //var_dump("inni index");
                }
                
-               public function get_organization_groups()
+               function get_organization_groups()
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true; 
                        $GLOBALS['phpgw_info']['flags']['nofooter'] = true; 
@@ -691,7 +628,7 @@
                /**
                 * Public method.
                 */
-               public function get_address_search()
+               function get_address_search()
                {
                        $search_string = phpgw::get_var('search');
                        //var_dump($search_string);

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2011-11-21 13:11:35 UTC (rev 8151)
@@ -1,6 +1,6 @@
 activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
 Activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
-office activitycalendarfrontend        no      Kontor
+office activitycalendarfrontend        no      Hovedansvarlig kulturkontor
 arena  activitycalendarfrontend        no      Arena
 description    activitycalendarfrontend        no      Beskrivelse
 date_start     activitycalendarfrontend        no      Startdato
@@ -49,18 +49,42 @@
 rejected       activitycalendarfrontend        no      Avvist
 activity       activitycalendarfrontend        no      Aktivitet
 organization   activitycalendarfrontend        no      Organisasjon
-group  activitycalendarfrontend        no      Gruppe
+group  activitycalendarfrontend        no      Gruppe/Lag
 district       activitycalendarfrontend        no      Bydel
 title  activitycalendarfrontend        no      Tittel
 activity_helptext      activitycalendarfrontend        no      Før ny 
aktivitet kan registreres må du sjekke at organisasjon/gruppe finnes og er 
oppdatert, og at arena finnes og er oppdatert.
 building       activitycalendarfrontend        no      Kommunale bygg
 title_helptext activitycalendarfrontend        no      Skriv inn tittel på 
aktiviteten slik du vil den skal vises i kommuneportalen
-org_helptext   activitycalendarfrontend        no      Velg organisasjon 
aktiviteten skal knyttes til. <br/>Dersom din organisasjon ikke finnes, velg 
"Ny organisasjon" og fyll ut feltene som vises under. <br/> For å sende inn 
forespørsel om å endre en organisasjon, velg "Endre organisasjon" og velg den 
aktuelle organisasjonen fra listen som vises. <br/>Deretter klikker du på 
"Lagre" for å sende inn endringsønsket. 
-group_helptext activitycalendarfrontend        no      Velg gruppe/lag 
aktiviteten skal knyttes til. <br/>Dersom gruppen/laget ikke finnes, velg "Ny 
gruppe" og fyll ut feltene som vises under.
 int_arena_helptext     activitycalendarfrontend        no      Dersom 
aktiviteten skal finne sted i et kommunalt bygg velges dette fra listen her.
 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
 target_not_selected    activitycalendarfrontend        no      Målgruppe må 
velges!
-district_not_selected  activitycalendarfrontend        no      Distrikt må 
velges!
\ No newline at end of file
+district_not_selected  activitycalendarfrontend        no      Distrikt må 
velges!
+org_helptext   activitycalendarfrontend        no      Velg organisasjon 
aktiviteten skal knyttes til i nedtrekksmenyen, du kan søke ved å skrive inn 
navnet.<br/>Dersom din organisasjon ikke finnes, velg "Ny organisasjon" og fyll 
ut feltene som vises under. 
+group_helptext activitycalendarfrontend        no      Om aktiviteten skal 
knyttes til en spesiell gruppe/lag velger du det her.<br/>Dersom gruppen/laget 
ikke finnes, velg "Ny gruppe" og fyll ut feltene som vises under. Du trenger 
ikke velge en gruppe.
+criteria_label activitycalendarfrontend        no      Valgkriterier/søkeord i 
portalen
+criteria_helptext      activitycalendarfrontend        no      Feltene må 
fylles ut for at aktiviteten skal komme frem i søk i portalen, koder for 
kategori og målgruppe hentes fra booking. 
+what   activitycalendarfrontend        no      HVA
+where_when     activitycalendarfrontend        no      HVOR/NÅR
+who    activitycalendarfrontend        no      HVEM
+arena_helptext activitycalendarfrontend        no      Oppgi arena ved å velge 
kommunalt bygg eller eksterne bygg.
+external_arena activitycalendarfrontend        no      Eksterne bygg
+category_helptext      activitycalendarfrontend        no      Velg kategori
+target_helptext        activitycalendarfrontend        no      Velg 
målgruppe(r)
+district_helptext      activitycalendarfrontend        no      Velg bydel(er) 
hvor aktiviteten foregår
+adaptation_helptext    activitycalendarfrontend        no      Kryss av om 
aktiviteten er spesielt tilpasset
+time_helptext  activitycalendarfrontend        no      Oppgi tidspunkt for 
aktiviteten, f.eks. onsdag kl. 20-21
+office_helptext        activitycalendarfrontend        no      Oppgi kontor 
som saksbehandler aktiviteten
+contact_info   activitycalendarfrontend        no      Kontaktinformasjon for 
kulturkontoret
+contact_info_helptext  activitycalendarfrontend        no      Hentes fra 
booking/organisasjonsregister ved lagring.
+store_org_group        activitycalendarfrontend        no      Lagre 
organisasjon/gruppe
+save_activity  activitycalendarfrontend        no      Send
+org_helptext_step1     activitycalendarfrontend        no      Velg 
organisasjon aktiviteten skal knyttes til i nedtrekksmenyen, du kan søke ved å 
skrive inn navnet.<br/>Dersom din organisasjon ikke finnes, velg "Ny 
organisasjon"<br/>Klikk deretter på "Neste" for å registrere aktivitet.
+next   activitycalendarfrontend        no      Neste
+new_activity   activitycalendarfrontend        no      Ny aktivitet
+update_request_sent    activitycalendarfrontend        no      
Oppdateringsforespørsel er sendt for aktiviteten "%1"
+edit_activity  activitycalendarfrontend        no      Endre aktivitet
+activity_edit_helptext activitycalendarfrontend        no      Velg 
aktiviteten du ønsker å endre fra listen under.
+send_change_request    activitycalendarfrontend        no      Send inn 
endringsønske
\ 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-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-11-21 13:11:35 UTC (rev 8151)
@@ -22,6 +22,7 @@
                <form action="#" method="post">
                        <input type="hidden" name="id" value="<?php 
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; }  ?>"/>
                        <dl class="proplist-col" style="width: 60%">
+                               <h2><?php echo lang('what')?></h2>
                                <dt>
                                        <label for="title"><?php echo 
lang('title') ?></label>
                                </dt>
@@ -29,26 +30,61 @@
                                        <?php echo $activity->get_title();?>
                                </dd>
                                <dt>
-                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
+                                       <label for="description"><?php echo 
lang('description') ?></label>
                                </dt>
                                <dd>
+                                       <?php echo 
$activity->get_description(); ?>
+                               </dd>
+                               
+                               <dt>
+                                       <label for="category"><?php echo 
lang('category') ?></label>
+                               </dt>
+                               <dd>
                                        <?php
-                                       if($activity->get_organization_id()){
-                                               echo 
activitycalendar_soorganization::get_instance()->get_organization_name($activity->get_organization_id());
-                                       }
+                                               if($activity->get_category()){
+                                                       echo 
$act_so->get_category_name($activity->get_category());
+                                               }
                                        ?>
                                </dd>
                                <dt>
-                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
+                                       <label for="target"><?php echo 
lang('target') ?></label>
                                </dt>
                                <dd>
-                                       <?php 
-                                       if($activity->get_group_id()){
-                                               echo 
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
+                                       <?php
+                                               if($activity->get_target()){
+                                                       $current_target_ids = 
$activity->get_target();
+                                                       
$current_target_id_array=explode(",", $current_target_ids);
+                                                       
foreach($current_target_id_array as $curr_target)
+                                                       {
+                                                               echo 
$act_so->get_target_name($curr_target).'<br/>';
+                                                       }
+                                               }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <label for="district"><?php echo 
lang('district') ?></label>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if($activity->get_district()){
+                                               $current_district_ids = 
$activity->get_district();
+                                               
$current_district_id_array=explode(",", $current_district_ids);
+                                               
foreach($current_district_id_array as $curr_district)
+                                               {
+                                                       echo 
$act_so->get_district_name($curr_district).'<br/>';
+                                               }
                                        }
                                        ?>
                                </dd>
                                <dt>
+                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
+                               </dt>
+                               <dd>
+                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation"<?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?> 
disabled="disabled" />
+                               </dd>
+                               <hr />
+                               <h2><?php echo lang('where_when')?></h2>
+                               <dt>
                                        <?php 
if($activity->get_internal_arena()) { ?>
                                        <label for="arena"><?php echo 
lang('building') ?></label>
                                        <?php }?>
@@ -72,34 +108,13 @@
                                                }
                                        ?>
                                </dd>
-                       </dl>
-                       <dl class="proplist-col">
                                <dt>
-                                       <label for="category"><?php echo 
lang('category') ?></label>
+                                       <label for="time"><?php echo 
lang('time') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                               if($activity->get_category()){
-                                                       echo 
$act_so->get_category_name($activity->get_category());
-                                               }
-                                       ?>
+                                       <?php echo $activity->get_time();?>
                                </dd>
                                <dt>
-                                       <label for="target"><?php echo 
lang('target') ?></label>
-                               </dt>
-                               <dd>
-                                       <?php
-                                               if($activity->get_target()){
-                                                       $current_target_ids = 
$activity->get_target();
-                                                       
$current_target_id_array=explode(",", $current_target_ids);
-                                                       
foreach($current_target_id_array as $curr_target)
-                                                       {
-                                                               echo 
$act_so->get_target_name($curr_target).'<br/>';
-                                                       }
-                                               }
-                                       ?>
-                               </dd>
-                               <dt>
                                        <label for="office"><?php echo 
lang('office') ?></label>
                                </dt>
                                <dd>
@@ -109,49 +124,36 @@
                                                }
                                        ?>
                                </dd>
+                               <hr />
+                               <h2><?php echo lang('who')?></h2>
                                <dt>
-                                       <label for="district"><?php echo 
lang('district') ?></label>
+                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       if($activity->get_district()){
-                                               $current_district_ids = 
$activity->get_district();
-                                               
$current_district_id_array=explode(",", $current_district_ids);
-                                               
foreach($current_district_id_array as $curr_district)
-                                               {
-                                                       echo 
$act_so->get_district_name($curr_district).'<br/>';
-                                               }
-                                       }
-                                       ?>
+                                       <?php echo $organization->get_name();?>
                                </dd>
                                <dt>
-                                       <label for="description"><?php echo 
lang('description') ?></label>
+                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
                                </dt>
                                <dd>
-                                       <?php echo 
$activity->get_description(); ?>
+                                       <?php 
+                                       if($activity->get_group_id()){
+                                               echo $group->get_name();
+                                       }
+                                       ?>
                                </dd>
                                <dt>
-                                       <label for="time"><?php echo 
lang('time') ?></label>
-                               </dt>
-                               <dd>
-                                       <?php echo $activity->get_time();?>
-                               </dd>
-                               <dt>
                                        <?php 
if($activity->get_contact_person_1()) { ?>
                                        <label for="contact_person_1"><?php 
echo lang('contact_person_1') ?></label>
                                        <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                               if($activity->get_group_id())
-                                               {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_1());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_1());
-                                               }
-                                       ?>
+                                       <label for="contact1_name">Navn</label>
+                                       <?php echo 
isset($contact1)?$contact1->get_name():''?><br/>
+                                       <label 
for="contact1_phone">Telefon</label>
+                                       <?php echo 
isset($contact1)?$contact1->get_phone():''?><br/>
+                                       <label 
for="contact1_mail">E-post</label>
+                                       <?php echo 
isset($contact1)?$contact1->get_email():''?><br/>
                                </dd>
                                <dt>
                                        <?php 
if($activity->get_contact_person_2()) { ?>
@@ -159,23 +161,14 @@
                                        <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                               if($activity->get_group_id())
-                                               {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_2());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_2());
-                                               }
-                                       ?>
+                                       <label for="contact2_name">Navn</label>
+                                       <?php echo 
isset($contact2)?$contact2->get_name():''?><br/>
+                                       <label 
for="contact2_phone">Telefon</label>
+                                       <?php echo 
isset($contact2)?$contact2->get_phone():''?><br/>
+                                       <label 
for="contact2_mail">E-post</label>
+                                       <?php echo 
isset($contact2)?$contact2->get_email():''?><br/>
                                </dd>
-                           <dt>
-                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
-                               </dt>
-                               <dd>
-                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation"<?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?> 
disabled="disabled" />
-                               </dd>
+                           
                        </dl>
                        <div class="form-buttons">
                                <?php

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
       2011-11-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit.php
       2011-11-21 13:11:35 UTC (rev 8151)
@@ -125,11 +125,6 @@
                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)
@@ -175,472 +170,179 @@
                <h1><?php echo lang('activity') ?></h1>
                <form action="#" method="post">
                        <input type="hidden" name="id" value="<?php 
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; }  ?>"/>
-                       <dl class="proplist-col" style="width: 60%">
+                       <dl class="proplist-col" style="width: 200%">
+                               <h2><?php echo lang('what')?></h2>
                                <dt>
-                                       <?php if($activity->get_title() || 
$editable) { ?>
                                        <label for="title"><?php echo 
lang('title') ?></label>
-                                       <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                       ?>
-                                               <?php echo 
lang('title_helptext')?><br/>
-                                               <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               echo $activity->get_title();
-                                       }
-                                       ?>
+                                       <?php echo lang('title_helptext')?><br/>
+                                       <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
                                </dd>
                                <dt>
-                                       <?php 
if($activity->get_organization_id() || $editable) { ?>
-                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
-                                       <?php } ?>
+                                       <label for="category"><?php echo 
lang('category') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_organization_id = 
$activity->get_organization_id();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('org_helptext')?><br/>
-                                               <select name="organization_id" 
id="organization_id" onchange="javascript:get_available_groups();">
-                                                       <option value="">Ingen 
organisasjon valgt</option>
-                                                       <option 
value="new_org">Ny organisasjon</option>
-                                                       <option 
value="change_org">Endre organisasjon</option>
-                                                       <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
+                                       $current_category_id = 
$activity->get_category();
                                        ?>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               
if($activity->get_organization_id()){
-                                                       echo 
activitycalendar_soorganization::get_instance()->get_organization_name($activity->get_organization_id());
-                                               }
-                                       }
-                                       ?>
-                               </dd>
-                               <div id="new_org" style="display: none;">
-                                       <hr/>
-                                       <div id="change_org_fields" 
style="display: none;">
-                                               <select 
name="change_organization_id" id="change_organization_id" >
-                                                       <option value="">Ingen 
organisasjon valgt</option>
-                                                       <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                       </div>
-                                       <div id="new_org_fields" 
style="display: none;">
-                                               <label 
for="orgname">Organisasjonsnavn</label>
-                                               <input type="text" 
name="orgname"/><br/>
-                                               <label 
for="orgno">Organisasjonsnummer</label>
-                                               <input type="text" 
name="orgno"/><br/>
-                                               <label 
for="district">Bydel</label>
-                                                       <select 
name="org_district">
-                                                               <option 
value="0">Ingen bydel valgt</option>
-                                               <?php 
-                                               foreach($districts as $d)
+                                       <select name="category" id="category">
+                                               <option value="0">Ingen 
kategori valgt</option>
+                                               <?php
+                                               foreach($categories as 
$category)
                                                {
+                                                       echo "<option 
".($current_category_id == $category->get_id() ? 'selected="selected"' : "")." 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
+                                               }
                                                ?>
-                                                       <option value="<?php 
echo $d['part_of_town_id']?>"><?php echo $d['name']?></option>
-                                               <?php
-                                               }?>
-                                                       </select><br/>
-                                               <label 
for="homepage">Hjemmeside</label>
-                                               <input type="text" 
name="homepage"/><br/>
-                                               <label 
for="email">E-post</label>
-                                               <input type="text" 
name="email"/><br/>
-                                               <label 
for="phone">Telefon</label>
-                                               <input type="text" 
name="phone"/><br/>
-                                               <label for="street">Gate</label>
-                                               <input type="text" 
name="address_txt" id="address_txt" onkeyup="javascript:get_address_search()"/>
-                                               <div 
id="address_container"></div><br/>
-                                               <label 
for="number">Nummer</label>
-                                               <input type="text" 
name="number"/><br/>
-                                               <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>
-                                       </div>
-                                       <hr/>
-                                       <b>Kontaktperson 1</b><br/>
-                                       <label for="contact1_name">Navn</label>
-                                       <input type="text" 
name="contact1_name"/><br/>
-                                       <label 
for="contact1_phone">Telefon</label>
-                                       <input type="text" 
name="contact1_phone"/><br/>
-                                       <label 
for="contact1_mail">E-post</label>
-                                       <input type="text" 
name="contact1_mail"/><br/>
-                                       <b>Kontaktperson 2</b><br/>
-                                       <label for="contact2_name">Navn</label>
-                                       <input type="text" 
name="contact2_name"/><br/>
-                                       <label 
for="contact2_phone">Telefon</label>
-                                       <input type="text" 
name="contact2_phone"/><br/>
-                                       <label 
for="contact2_mail">E-post</label>
-                                       <input type="text" 
name="contact2_mail"/><br/>
-                                       <label 
for="contact2_address">Adresse</label>
-                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
-                                       <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 og Sted</label>
-                                       <input type="text" 
name="contact2_postaddress"/>
-                                       <hr/>
-                               </div>
+                                       </select>
+                               </dd>
                                <dt>
-                                       <?php if($activity->get_group_id() || 
$editable) { ?>
-                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
-                                       <?php } ?>
+                                       <label for="target"><?php echo 
lang('target') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_group_id = 
$activity->get_group_id();
-                                       if ($editable)
+                                       $current_target_ids = 
$activity->get_target();
+                                       $current_target_id_array=explode(",", 
$current_target_ids);
+                                       foreach($targets as $t)
                                        {
-                                               ?>
-                                               <?php echo 
lang('group_helptext')?><br/>
-                                               <div id="group_select">
-                                                       <select name="group_id" 
id="group_id">
-                                                               <option 
value="0">Ingen gruppe valgt</option>
-                                                       </select>
-                                               </div>
-                                               <?php
                                        ?>
+                                               <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/>
                                        <?php
                                        }
-                                       else
-                                       {
-                                               if($activity->get_group_id()){
-                                                       echo 
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
-                                               }
-                                       }
                                        ?>
                                </dd>
-                               <div id="new_group" style="display: none;">
-                                       <hr/>
-                                       <div id="new_group_fields" 
style="display: none;">
-                                               <label 
for="groupname">Gruppenavn</label>
-                                               <input type="text" 
name="groupname"/><br/>
-                                               <label 
for="group_description">Beskrivelse</label>
-                                               <textarea rows="10" cols="100" 
name="group_description"></textarea>
-                                       </div>
-                                       <hr/>
-                                       <b>Kontaktperson 1</b><br/>
-                                       <label for="contact1_name">Navn</label>
-                                       <input type="text" 
name="contact1_name"/><br/>
-                                       <label 
for="contact1_phone">Telefon</label>
-                                       <input type="text" 
name="contact1_phone"/><br/>
-                                       <label 
for="contact1_mail">E-post</label>
-                                       <input type="text" 
name="contact1_mail"/><br/>
-                                       <b>Kontaktperson 2</b><br/>
-                                       <label for="contact2_name">Navn</label>
-                                       <input type="text" 
name="contact2_name"/><br/>
-                                       <label 
for="contact2_phone">Telefon</label>
-                                       <input type="text" 
name="contact2_phone"/><br/>
-                                       <label 
for="contact2_mail">E-post</label>
-                                       <input type="text" 
name="contact2_mail"/><br/>
-                                       <label 
for="contact2_address">Adresse</label>
-                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
-                                       <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>
-                                       <input type="text" 
name="contact2_postaddress"/>
-                                       <hr/>
-                               </div>
                                <dt>
-                                       <?php 
if($activity->get_internal_arena() || $editable) { ?>
-                                       <label for="arena"><?php echo 
lang('building') ?></label>
-                                       <?php  } ?>
+                                       <label for="district"><?php echo 
lang('district') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_internal_arena_id = 
$activity->get_internal_arena();
-                                       if ($editable)
+                                       $current_district_ids = 
$activity->get_district();
+                                       $current_district_id_array=explode(",", 
$current_district_ids);
+                                       foreach($districts as $d)
                                        {
-                                               ?>
-                                               <?php echo 
lang('int_arena_helptext')?><br/>
-                                               <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)
-                                                       {
-                                                               echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_arena()){
-                                                       echo 
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
-                                               }
-                                       }
                                        ?>
-                               </dd>
-                               <dt>
-                                       <?php if($activity->get_arena() || 
$editable) { ?>
-                                       <label for="arena"><?php echo 
lang('arena') ?></label>
-                                       <?php  } ?>
-                               </dt>
-                               <dd>
+                                               <input name="district[]" 
type="checkbox" value="<?php echo $d['part_of_town_id']?>" <?php echo 
(in_array($d['part_of_town_id'], $current_district_id_array) ? 'checked' : 
"")?>/><?php echo $d['name']?><br/>
                                        <?php
-                                       $current_arena_id = 
$activity->get_arena();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('arena_helptext')?><br/>
-                                               <select name="arena_id" 
id="arena_id" style="width: 60%">
-                                                       <option value="0">Ingen 
arena valgt</option>
-                                                       <?php
-                                                       foreach($arenas as 
$arena)
-                                                       {
-                                                               echo "<option 
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")." 
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
                                        }
-                                       else
-                                       {
-                                               if($activity->get_arena()){
-                                                       echo 
activitycalendar_soarena::get_instance()->get_arena_name($activity->get_arena());
-                                               }
-                                       }
                                        ?>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_state() || 
$editable) { ?>
-                                       <label for="state"><?php echo 
lang('state') ?></label>
-                                       <?php  } ?>
+                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                               $selected_state = 
$activity->get_state();
-                                       ?>
-                                               <select name="state">
-                                                       <option value="1" <?php 
echo ($selected_state == 1 ? 'selected="selected"' : "")?>><?php echo 
lang('new') ?></option>
-                                                       <option value="2" <?php 
echo ($selected_state == 2 ? 'selected="selected"' : "")?>><?php echo 
lang('change') ?></option>
-                                               </select>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_state() && 
$activity->get_state() > 0){
-                                                       echo 
lang('state_'.$activity->get_state());
-                                               }
-                                       }
-                                       ?>
+                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation" />
                                </dd>
-                       </dl>
-                       <dl class="proplist-col">
+                               <hr />
+                               <h2><?php echo lang('where_when')?></h2>
                                <dt>
-                                       <?php if($activity->get_category() || 
$editable) { ?>
-                                       <label for="category"><?php echo 
lang('category') ?></label>
-                                       <?php  } ?>
+                                       <label for="arena"><?php echo 
lang('arena') ?></label>
+                                       <br/><?php echo lang('arena_helptext')?>
                                </dt>
+                               <dt>
+                                       <label for="internal_arena_id"><?php 
echo lang('building') ?></label>
+                               </dt>
                                <dd>
                                        <?php
-                                       $current_category_id = 
$activity->get_category();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <select name="category" 
id="category">
-                                                       <option value="0">Ingen 
kategori valgt</option>
-                                                       <?php
-                                                       foreach($categories as 
$category)
-                                                       {
-                                                               echo "<option 
".($current_category_id == $category->get_id() ? 'selected="selected"' : "")." 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
+                                       $current_internal_arena_id = 
$activity->get_internal_arena();
+                                       ?>
+                                       <select name="internal_arena_id" 
id="internal_arena_id" onchange="javascript: check_internal();">
+                                               <option value="0">Ingen 
kommunale bygg valgt</option>
                                                <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_category()){
-                                                       echo 
$act_so->get_category_name($activity->get_category());
+                                               foreach($buildings as 
$building_id => $building_name)
+                                               {
+                                                       echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
                                                }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_target() || 
$editable) { ?>
-                                       <label for="target"><?php echo 
lang('target') ?></label>
-                                       <?php  } ?>
+                                       <label for="arena_id"><?php echo 
lang('external_arena') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_target_ids = 
$activity->get_target();
-                                       $current_target_id_array=explode(",", 
$current_target_ids);
-                                       //echo 
$current_target_id_array[0]."*".$current_target_id_array[1];
-                                       if ($editable)
-                                       {
-                                               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/>
+                                       $current_arena_id = 
$activity->get_arena();
+                                       ?>
+                                       <select name="arena_id" id="arena_id" 
onchange="javascript: check_external();">
+                                               <option value="0">Ingen arena 
valgt</option>
                                                <?php
+                                               foreach($arenas as $arena)
+                                               {
+                                                       echo "<option 
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")." 
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
                                                }
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_target()){
-                                                       $current_target_ids = 
$activity->get_target();
-                                                       
$current_target_id_array=explode(",", $current_target_ids);
-                                                       
foreach($current_target_id_array as $curr_target)
-                                                       {
-                                                               echo 
$act_so->get_target_name($curr_target).'<br/>';
-                                                       }
-                                               }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_office() || 
$editable) { ?>
-                                       <label for="office"><?php echo 
lang('office') ?></label>
-                                       <?php  } ?>
+                                       <label for="time"><?php echo 
lang('time') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                               $selected_office = 
$activity->get_office();
-                                       ?>
-                                               <select name="office" 
id="office">
-                                                       <option value="0">Ingen 
kontor valgt</option>
-                                                       <?php
-                                                       foreach($offices as 
$office)
-                                                       {
-                                                               echo "<option 
".($selected_office == $office['id'] ? 'selected="selected"' : "")." 
value=\"{$office['id']}\">".$office['name']."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_office()){
-                                                       echo 
$act_so->get_office_name($activity->get_office());
-                                               }
-                                       }
-                                       ?>
+                                       <input type="text" name="time" 
id="time" value="<?php echo $activity->get_time() ?>" />
                                </dd>
                                <dt>
-                                       <?php if($activity->get_district() || 
$editable) { ?>
-                                       <label for="district"><?php echo 
lang('district') ?></label>
-                                       <?php  } ?>
+                                       <label for="office"><?php echo 
lang('office') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_district_ids = 
$activity->get_district();
-                                       $current_district_id_array=explode(",", 
$current_district_ids);
-                                       //echo 
$current_target_id_array[0]."*".$current_target_id_array[1];
-                                       if ($editable)
-                                       {
-                                               foreach($districts as $d)
-                                               {
-                                               ?>
-                                                       <input 
name="district[]" type="checkbox" value="<?php echo $d['part_of_town_id']?>" 
<?php echo (in_array($d['part_of_town_id'], $current_district_id_array) ? 
'checked' : "")?>/><?php echo $d['name']?><br/>
+                                       $selected_office = 
$activity->get_office();
+                                       ?>
+                                       <select name="office" id="office">
+                                               <option value="0">Ingen kontor 
valgt</option>
                                                <?php
+                                               foreach($offices as $office)
+                                               {
+                                                       echo "<option 
".($selected_office == $office['id'] ? 'selected="selected"' : "")." 
value=\"{$office['id']}\">".$office['name']."</option>";
                                                }
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_district()){
-                                                       $current_district_ids = 
$activity->get_district();
-                                                       
$current_district_id_array=explode(",", $current_district_ids);
-                                                       
foreach($current_district_id_array as $curr_district)
-                                                       {
-                                                               echo 
$act_so->get_district_name($curr_district).'<br/>';
-                                                       }
-                                               }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
+                               <hr />
+                               <h2><?php echo lang('who')?></h2>
                                <dt>
-                                       <?php if($activity->get_description()) 
{ ?>
-                                       <label for="description"><?php echo 
lang('description') ?></label>
-                                       <?php  } ?>
+                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
                                </dt>
-                               <dd>
-                                       <?php echo 
$activity->get_description(); ?>
-                               </dd>
+                               <input type="hidden" name="organization_id" 
id="organization_id" value="<?php echo $organization->get_id()?>" />
+                               <dd><label 
for="orgname">Organisasjonsnavn</label>:
+                               <?php echo $organization->get_name()?></dd>
+                               <dd><label 
for="orgno">Organisasjonsnummer</label>:
+                               <?php echo 
$organization->get_organization_number()?></dd>
+                               <dd><label for="homepage">Hjemmeside</label>:
+                               <?php echo $organization->get_homepage()?></dd>
+                               <dd><label for="email">E-post</label>:
+                               <?php echo $organization->get_email()?></dd>
+                               <dd><label for="phone">Telefon</label>:
+                               <?php echo $organization->get_phone()?></dd>
+                               <dd><label for="street">Adresse</label>:
+                               <?php echo $organization->get_address()?></dd>
+                               <dd><label 
for="org_description">Beskrivelse</label>:<br/>
+                               <textarea rows="10" cols="100" 
name="org_description" size="254"><?php echo 
$organization->get_description()?></textarea></dd>
                                <dt>
-                                       <?php if($activity->get_time() || 
$editable) { ?>
-                                       <label for="time"><?php echo 
lang('time') ?></label>
-                                       <?php  } ?>
+                                       <?php if($activity->get_group_id() || 
$editable) { ?>
+                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
+                                       <?php } ?>
                                </dt>
                                <dd>
                                        <?php
-                                       if ($editable)
-                                       {
+                                               if($activity->get_group_id()){
+                                                       echo $group->get_name();
+                                               }
                                        ?>
-                                               <input type="text" name="time" 
id="time" value="<?php echo $activity->get_time() ?>" />
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               echo $activity->get_time();
-                                       }
-                                       ?>
                                </dd>
                                <dt>
-                                       <?php 
if($activity->get_contact_person_1() || $editable) { ?>
+                                       <?php 
if($activity->get_contact_person_1()) { ?>
                                        <label for="contact_person_1"><?php 
echo lang('contact_person_1') ?></label>
                                        <?php  } ?>
                                </dt>
-                               <dd>
-                                       <?php
-                                               if($activity->get_group_id())
-                                               {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_1());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_1());
-                                               }
-                                       ?>
-                               </dd>
+                               <dd><label 
for="contact1_name">Navn</label>:<?php echo 
isset($contact1)?$contact1->get_name():''?></dd>
+                               <dd><label 
for="contact1_phone">Telefon</label>:<?php echo 
isset($contact1)?$contact1->get_phone():''?></dd>
+                               <dd><label 
for="contact1_mail">E-post</label>:<?php echo 
isset($contact1)?$contact1->get_email():''?></dd>
                                <dt>
-                                       <?php 
if($activity->get_contact_person_2() || $editable) { ?>
+                                       <?php 
if($activity->get_contact_person_2()) { ?>
                                        <label for="contact_person_2"><?php 
echo lang('contact_person_2') ?></label>
                                        <?php  } ?>
                                </dt>
-                               <dd>
-                                       <?php
-                                               if($activity->get_group_id())
-                                               {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_2());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_2());
-                                               }
-                                       ?>
-                               </dd>
-                           <dt>
-                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
-                               </dt>
-                               <dd>
-                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation"<?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?> <?php echo 
!$editable ? ' disabled="disabled"' : '' ?>/>
-                               </dd>
+                               <dd><label 
for="contact2_name">Navn</label>:<?php echo 
isset($contact2)?$contact2->get_name():''?></dd>
+                               <dd><label 
for="contact2_phone">Telefon</label>:<?php echo 
isset($contact2)?$contact2->get_phone():''?></dd>
+                               <dd><label 
for="contact2_mail">E-post</label>:<?php echo 
isset($contact2)?$contact2->get_email():''?></dd>
                        </dl>
                        <div class="form-buttons">
                                <?php

Copied: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit_step_1.php
 (from rev 8150, 
trunk/activitycalendarfrontend/templates/base/activity_edit_step_1.php)
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit_step_1.php
                                (rev 0)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_edit_step_1.php
        2011-11-21 13:11:35 UTC (rev 8151)
@@ -0,0 +1,47 @@
+<?php ?>
+<script type="text/javascript">
+function isOK()
+{
+       if(document.getElementById('activity_id').value == null || 
document.getElementById('activity_id').value == '')
+       {
+               alert("Du må velge en aktivitet som skal endres!");
+               return false;
+       }
+       else
+       {
+               return true;
+       }
+}
+</script>
+<div class="yui-content" style="width: 100%;">
+       <h1><?php echo lang('edit_activity');?></h1>
+       <form action="#" method="post">
+               <dl class="proplist-col" style="width: 200%">
+                       <dt>
+                               <?php echo 
lang('activity_edit_helptext');?><br/><br/>
+                       </dt>
+                       <dd>
+                       <?php if($message){?>
+                       <?php echo $message;?>
+                       <?php }else{?>
+                               <select name="activity_id" id="activity_id">
+                                       <option value="">Ingen aktivitet 
valgt</option>
+                                       <?php
+                                       foreach($activities as $activity)
+                                       {
+                                               echo "<option 
value=\"{$activity->get_id()}\">".$activity->get_title()."</option>";
+                                       }
+                                       ?>
+                               </select>
+                               <br/><br/>
+                       <?php }?>
+                       </dd>
+                       <?php if(!$message){?>
+                       <div class="form-buttons">
+                               <input type="submit" name="step_1" value="<?php 
echo lang('send_change_request') ?>" onclick="return isOK();"/>
+                       </div>
+                       <?php }?>
+               </dl>
+               
+       </form>
+</div>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
        2011-11-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
        2011-11-21 13:11:35 UTC (rev 8151)
@@ -7,69 +7,15 @@
 
 <script type="text/javascript">
 
-function get_available_groups()
-{
-       var org_id = document.getElementById('organization_id').value;
-       var div_select = document.getElementById('group_select');
-
-<?php if($activity->get_group_id()){?>
-       url = 
"index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&amp;phpgw_return_as=json&amp;orgid="
 + org_id + "&amp;groupid=" + <?php echo $activity->get_group_id();?>;
-<?php }else{?>
-       url = 
"index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&amp;phpgw_return_as=json&amp;orgid="
 + org_id;
-<?php }?>
-
-       if(org_id != null && org_id == 'new_org')
-       {
-               //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
-       {
-               document.getElementById('new_org').style.display = "none";
-               document.getElementById('new_org_fields').style.display = 
"none";
-               document.getElementById('change_org_fields').style.display = 
"none";
-               var divcontent_start = "<select name=\"group_id\" 
id=\"group_id\" onchange=\"javascript:checkNewGroup()\">";
-               var divcontent_end = "</select>";
-               
-               var callback = {
-                       success: function(response){
-                                               div_select.innerHTML = 
divcontent_start + JSON.parse(response.responseText) + divcontent_end; 
-                                       },
-                       failure: function(o) {
-                                                alert("AJAX doesn't work"); 
//FAILURE
-                                        }
-               }
-               var trans = YAHOO.util.Connect.asyncRequest('GET', url, 
callback, null);
-       }
-}
-
-YAHOO.util.Event.onDOMReady(function()
-{
-       get_available_groups();
-});
-
 function checkNewGroup()
 {
        var group_selected = document.getElementById('group_id').value;
        if(group_selected == 'new_group')
        {
-               document.getElementById('new_group').style.display = "block";
                document.getElementById('new_group_fields').style.display = 
"block";
        }
        else
        {
-               document.getElementById('new_group').style.display = "none";
                document.getElementById('new_group_fields').style.display = 
"none";
        }
 }
@@ -118,6 +64,34 @@
        
 }
 
+function check_internal()
+{
+       if(document.getElementById('internal_arena_id').value != null && 
document.getElementById('internal_arena_id').value > 0)
+       {
+               //disable external arena drop-down
+               document.getElementById('arena_id').disabled="disabled";
+       }
+       else
+       {
+               //enable external arena drop-down
+               document.getElementById('arena_id').disabled="";
+       }
+}
+
+function check_external()
+{
+       if(document.getElementById('arena_id').value != null && 
document.getElementById('arena_id').value > 0)
+       {
+               //disable internal arena drop-down
+               
document.getElementById('internal_arena_id').disabled="disabled";
+       }
+       else
+       {
+               //enable internal arena drop-down
+               document.getElementById('internal_arena_id').disabled="";
+       }
+}
+
 function allOK()
 {
        if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
@@ -125,11 +99,6 @@
                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)
@@ -172,483 +141,284 @@
        </div>
        <?php }?>
        </div>
-               <h1><?php echo lang('activity') ?></h1>
+               <h1><?php echo lang('new_activity') ?></h1>
                <form action="#" method="post">
                        <input type="hidden" name="id" value="<?php 
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; }  ?>"/>
-                       <dl class="proplist-col" style="width: 60%">
+                       <dl class="proplist-col" style="width: 200%">
+                               <h2><?php echo lang('what')?></h2>
                                <dt>
-                                       <?php if($activity->get_title() || 
$editable) { ?>
                                        <label for="title"><?php echo 
lang('title') ?></label>
-                                       <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                       ?>
-                                               <?php echo 
lang('title_helptext')?><br/>
-                                               <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               echo $activity->get_title();
-                                       }
-                                       ?>
+                                       <?php echo lang('title_helptext')?><br/>
+                                       <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
                                </dd>
                                <dt>
-                                       <?php 
if($activity->get_organization_id() || $editable) { ?>
-                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
-                                       <?php } ?>
+                                       <label for="category"><?php echo 
lang('category') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_organization_id = 
$activity->get_organization_id();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('org_helptext')?><br/>
-                                               <select name="organization_id" 
id="organization_id" onchange="javascript:get_available_groups();">
-                                                       <option value="">Ingen 
organisasjon valgt</option>
-                                                       <option 
value="new_org">Ny organisasjon</option>
-                                                       <option 
value="change_org">Endre organisasjon</option>
-                                                       <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
+                                       $current_category_id = 
$activity->get_category();
                                        ?>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               
if($activity->get_organization_id()){
-                                                       echo 
activitycalendar_soorganization::get_instance()->get_organization_name($activity->get_organization_id());
-                                               }
-                                       }
-                                       ?>
-                               </dd>
-                               <div id="new_org" style="display: none;">
-                                       <hr/>
-                                       <div id="change_org_fields" 
style="display: none;">
-                                               <select 
name="change_organization_id" id="change_organization_id" >
-                                                       <option value="">Ingen 
organisasjon valgt</option>
-                                                       <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                       </div>
-                                       <div id="new_org_fields" 
style="display: none;">
-                                               <label 
for="orgname">Organisasjonsnavn</label>
-                                               <input type="text" 
name="orgname"/><br/>
-                                               <label 
for="orgno">Organisasjonsnummer</label>
-                                               <input type="text" 
name="orgno"/><br/>
-                                               <label 
for="district">Bydel</label>
-                                                       <select 
name="org_district">
-                                                               <option 
value="0">Ingen bydel valgt</option>
-                                               <?php 
-                                               foreach($districts as $d)
-                                               {
-                                               ?>
-                                                       <option value="<?php 
echo $d['part_of_town_id']?>"><?php echo $d['name']?></option>
+                                       <select name="category" id="category">
+                                               <option value="0">Ingen 
kategori valgt</option>
                                                <?php
-                                               }?>
-                                                       </select><br/>
-                                               <label 
for="homepage">Hjemmeside</label>
-                                               <input type="text" 
name="homepage"/><br/>
-                                               <label 
for="email">E-post</label>
-                                               <input type="text" 
name="email"/><br/>
-                                               <label 
for="phone">Telefon</label>
-                                               <input type="text" 
name="phone"/><br/>
-                                               <label for="street">Gate</label>
-                                               <input type="text" 
name="address_txt" id="address_txt" onkeyup="javascript:get_address_search()"/>
-                                               <div 
id="address_container"></div><br/>
-                                               <label 
for="number">Nummer</label>
-                                               <input type="text" 
name="number"/><br/>
-                                               <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>
-                                       </div>
-                                       <hr/>
-                                       <b>Kontaktperson 1</b><br/>
-                                       <label for="contact1_name">Navn</label>
-                                       <input type="text" 
name="contact1_name"/><br/>
-                                       <label 
for="contact1_phone">Telefon</label>
-                                       <input type="text" 
name="contact1_phone"/><br/>
-                                       <label 
for="contact1_mail">E-post</label>
-                                       <input type="text" 
name="contact1_mail"/><br/>
-                                       <b>Kontaktperson 2</b><br/>
-                                       <label for="contact2_name">Navn</label>
-                                       <input type="text" 
name="contact2_name"/><br/>
-                                       <label 
for="contact2_phone">Telefon</label>
-                                       <input type="text" 
name="contact2_phone"/><br/>
-                                       <label 
for="contact2_mail">E-post</label>
-                                       <input type="text" 
name="contact2_mail"/><br/>
-                                       <label 
for="contact2_address">Adresse</label>
-                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
-                                       <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 og Sted</label>
-                                       <input type="text" 
name="contact2_postaddress"/>
-                                       <hr/>
-                               </div>
-                               <dt>
-                                       <?php if($activity->get_group_id() || 
$editable) { ?>
-                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
-                                       <?php } ?>
-                               </dt>
-                               <dd>
-                                       <?php
-                                       $current_group_id = 
$activity->get_group_id();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('group_helptext')?><br/>
-                                               <div id="group_select">
-                                                       <select name="group_id" 
id="group_id">
-                                                               <option 
value="0">Ingen gruppe valgt</option>
-                                                       </select>
-                                               </div>
-                                               <?php
-                                       ?>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_group_id()){
-                                                       echo 
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
+                                               foreach($categories as 
$category)
+                                               {
+                                                       echo "<option 
".($current_category_id == $category->get_id() ? 'selected="selected"' : "")." 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
                                                }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
-                               <div id="new_group" style="display: none;">
-                                       <hr/>
-                                       <div id="new_group_fields" 
style="display: none;">
-                                               <label 
for="groupname">Gruppenavn</label>
-                                               <input type="text" 
name="groupname"/><br/>
-                                               <label 
for="group_description">Beskrivelse</label>
-                                               <textarea rows="10" cols="100" 
name="group_description"></textarea>
-                                       </div>
-                                       <hr/>
-                                       <b>Kontaktperson 1</b><br/>
-                                       <label for="contact1_name">Navn</label>
-                                       <input type="text" 
name="contact1_name"/><br/>
-                                       <label 
for="contact1_phone">Telefon</label>
-                                       <input type="text" 
name="contact1_phone"/><br/>
-                                       <label 
for="contact1_mail">E-post</label>
-                                       <input type="text" 
name="contact1_mail"/><br/>
-                                       <b>Kontaktperson 2</b><br/>
-                                       <label for="contact2_name">Navn</label>
-                                       <input type="text" 
name="contact2_name"/><br/>
-                                       <label 
for="contact2_phone">Telefon</label>
-                                       <input type="text" 
name="contact2_phone"/><br/>
-                                       <label 
for="contact2_mail">E-post</label>
-                                       <input type="text" 
name="contact2_mail"/><br/>
-                                       <label 
for="contact2_address">Adresse</label>
-                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
-                                       <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>
-                                       <input type="text" 
name="contact2_postaddress"/>
-                                       <hr/>
-                               </div>
                                <dt>
-                                       <?php 
if($activity->get_internal_arena() || $editable) { ?>
-                                       <label for="arena"><?php echo 
lang('building') ?></label>
-                                       <?php  } ?>
+                                       <label for="target"><?php echo 
lang('target') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_internal_arena_id = 
$activity->get_internal_arena();
-                                       if ($editable)
+                                       $current_target_ids = 
$activity->get_target();
+                                       $current_target_id_array=explode(",", 
$current_target_ids);
+                                       foreach($targets as $t)
                                        {
-                                               ?>
-                                               <?php echo 
lang('int_arena_helptext')?><br/>
-                                               <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)
-                                                       {
-                                                               echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_arena()){
-                                                       echo 
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
-                                               }
-                                       }
                                        ?>
-                               </dd>
-                               <dt>
-                                       <?php if($activity->get_arena() || 
$editable) { ?>
-                                       <label for="arena"><?php echo 
lang('arena') ?></label>
-                                       <?php  } ?>
-                               </dt>
-                               <dd>
+                                               <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/>
                                        <?php
-                                       $current_arena_id = 
$activity->get_arena();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('arena_helptext')?><br/>
-                                               <select name="arena_id" 
id="arena_id" style="width: 60%">
-                                                       <option value="0">Ingen 
arena valgt</option>
-                                                       <?php
-                                                       foreach($arenas as 
$arena)
-                                                       {
-                                                               echo "<option 
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")." 
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
                                        }
-                                       else
-                                       {
-                                               if($activity->get_arena()){
-                                                       echo 
activitycalendar_soarena::get_instance()->get_arena_name($activity->get_arena());
-                                               }
-                                       }
                                        ?>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_state() || 
$editable) { ?>
-                                       <label for="state"><?php echo 
lang('state') ?></label>
-                                       <?php  } ?>
+                                       <label for="district"><?php echo 
lang('district') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       if ($editable)
+                                       $current_district_ids = 
$activity->get_district();
+                                       $current_district_id_array=explode(",", 
$current_district_ids);
+                                       foreach($districts as $d)
                                        {
-                                               $selected_state = 
$activity->get_state();
                                        ?>
-                                               <select name="state">
-                                                       <option value="1" <?php 
echo ($selected_state == 1 ? 'selected="selected"' : "")?>><?php echo 
lang('new') ?></option>
-                                                       <option value="2" <?php 
echo ($selected_state == 2 ? 'selected="selected"' : "")?>><?php echo 
lang('change') ?></option>
-                                               </select>
+                                               <input name="district[]" 
type="checkbox" value="<?php echo $d['part_of_town_id']?>" <?php echo 
(in_array($d['part_of_town_id'], $current_district_id_array) ? 'checked' : 
"")?>/><?php echo $d['name']?><br/>
                                        <?php
                                        }
-                                       else
-                                       {
-                                               if($activity->get_state() && 
$activity->get_state() > 0){
-                                                       echo 
lang('state_'.$activity->get_state());
-                                               }
-                                       }
                                        ?>
                                </dd>
-                       </dl>
-                       <dl class="proplist-col">
                                <dt>
-                                       <?php if($activity->get_category() || 
$editable) { ?>
-                                       <label for="category"><?php echo 
lang('category') ?></label>
-                                       <?php  } ?>
+                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       $current_category_id = 
$activity->get_category();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <select name="category" 
id="category">
-                                                       <option value="0">Ingen 
kategori valgt</option>
-                                                       <?php
-                                                       foreach($categories as 
$category)
-                                                       {
-                                                               echo "<option 
".($current_category_id == $category->get_id() ? 'selected="selected"' : "")." 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_category()){
-                                                       echo 
$act_so->get_category_name($activity->get_category());
-                                               }
-                                       }
-                                       ?>
+                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation" />
                                </dd>
+                               <hr />
+                               <h2><?php echo lang('where_when')?></h2>
                                <dt>
-                                       <?php if($activity->get_target() || 
$editable) { ?>
-                                       <label for="target"><?php echo 
lang('target') ?></label>
-                                       <?php  } ?>
+                                       <label for="arena"><?php echo 
lang('arena') ?></label>
+                                       <br/><?php echo lang('arena_helptext')?>
                                </dt>
-                               <dd>
-                                       <?php
-                                       $current_target_ids = 
$activity->get_target();
-                                       $current_target_id_array=explode(",", 
$current_target_ids);
-                                       //echo 
$current_target_id_array[0]."*".$current_target_id_array[1];
-                                       if ($editable)
-                                       {
-                                               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/>
-                                               <?php
-                                               }
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_target()){
-                                                       $current_target_ids = 
$activity->get_target();
-                                                       
$current_target_id_array=explode(",", $current_target_ids);
-                                                       
foreach($current_target_id_array as $curr_target)
-                                                       {
-                                                               echo 
$act_so->get_target_name($curr_target).'<br/>';
-                                                       }
-                                               }
-                                       }
-                                       ?>
-                               </dd>
                                <dt>
-                                       <?php if($activity->get_office() || 
$editable) { ?>
-                                       <label for="office"><?php echo 
lang('office') ?></label>
-                                       <?php  } ?>
+                                       <label for="internal_arena_id"><?php 
echo lang('building') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       if ($editable)
-                                       {
-                                               $selected_office = 
$activity->get_office();
+                                       $current_internal_arena_id = 
$activity->get_internal_arena();
                                        ?>
-                                               <select name="office" 
id="office">
-                                                       <option value="0">Ingen 
kontor valgt</option>
-                                                       <?php
-                                                       foreach($offices as 
$office)
-                                                       {
-                                                               echo "<option 
".($selected_office == $office['id'] ? 'selected="selected"' : "")." 
value=\"{$office['id']}\">".$office['name']."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_office()){
-                                                       echo 
$act_so->get_office_name($activity->get_office());
+                                       <select name="internal_arena_id" 
id="internal_arena_id" onchange="javascript: check_internal();">
+                                               <option value="0">Ingen 
kommunale bygg valgt</option>
+                                               <?php
+                                               foreach($buildings as 
$building_id => $building_name)
+                                               {
+                                                       echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
                                                }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_district() || 
$editable) { ?>
-                                       <label for="district"><?php echo 
lang('district') ?></label>
-                                       <?php  } ?>
+                                       <label for="arena_id"><?php echo 
lang('external_arena') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_district_ids = 
$activity->get_district();
-                                       $current_district_id_array=explode(",", 
$current_district_ids);
-                                       //echo 
$current_target_id_array[0]."*".$current_target_id_array[1];
-                                       if ($editable)
-                                       {
-                                               foreach($districts as $d)
-                                               {
-                                               ?>
-                                                       <input 
name="district[]" type="checkbox" value="<?php echo $d['part_of_town_id']?>" 
<?php echo (in_array($d['part_of_town_id'], $current_district_id_array) ? 
'checked' : "")?>/><?php echo $d['name']?><br/>
+                                       $current_arena_id = 
$activity->get_arena();
+                                       ?>
+                                       <select name="arena_id" id="arena_id" 
onchange="javascript: check_external();">
+                                               <option value="0">Ingen arena 
valgt</option>
                                                <?php
+                                               foreach($arenas as $arena)
+                                               {
+                                                       echo "<option 
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")." 
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
                                                }
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_district()){
-                                                       $current_district_ids = 
$activity->get_district();
-                                                       
$current_district_id_array=explode(",", $current_district_ids);
-                                                       
foreach($current_district_id_array as $curr_district)
-                                                       {
-                                                               echo 
$act_so->get_district_name($curr_district).'<br/>';
-                                                       }
-                                               }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_description()) 
{ ?>
-                                       <label for="description"><?php echo 
lang('description') ?></label>
-                                       <?php  } ?>
-                               </dt>
-                               <dd>
-                                       <?php echo 
$activity->get_description(); ?>
-                               </dd>
-                               <dt>
-                                       <?php if($activity->get_time() || 
$editable) { ?>
                                        <label for="time"><?php echo 
lang('time') ?></label>
-                                       <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                       ?>
-                                               <input type="text" name="time" 
id="time" value="<?php echo $activity->get_time() ?>" />
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               echo $activity->get_time();
-                                       }
-                                       ?>
+                                       <input type="text" name="time" 
id="time" value="<?php echo $activity->get_time() ?>" />
                                </dd>
                                <dt>
-                                       <?php 
if($activity->get_contact_person_1() || $editable) { ?>
-                                       <label for="contact_person_1"><?php 
echo lang('contact_person_1') ?></label>
-                                       <?php  } ?>
+                                       <label for="office"><?php echo 
lang('office') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                               if($activity->get_group_id())
+                                       $selected_office = 
$activity->get_office();
+                                       ?>
+                                       <select name="office" id="office">
+                                               <option value="0">Ingen kontor 
valgt</option>
+                                               <?php
+                                               foreach($offices as $office)
                                                {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_1());
+                                                       echo "<option 
".($selected_office == $office['id'] ? 'selected="selected"' : "")." 
value=\"{$office['id']}\">".$office['name']."</option>";
                                                }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_1());
-                                               }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
+                               <hr />
+                               <h2><?php echo lang('who')?></h2>
                                <dt>
-                                       <?php 
if($activity->get_contact_person_2() || $editable) { ?>
-                                       <label for="contact_person_2"><?php 
echo lang('contact_person_2') ?></label>
-                                       <?php  } ?>
+                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
                                </dt>
-                               <dd>
-                                       <?php
-                                               if($activity->get_group_id())
+                                       <?php if($new_organization){?>
+                                       <input type="hidden" 
name="organization_id" id="organization_id" value="new_org" />
+                                       <div id="new_org_fields">
+                                               <dt><label 
for="orgname">Organisasjonsnavn</label></dt>
+                                               <dd><input type="text" 
name="orgname"/></dd>
+                                               <dt><label 
for="orgno">Organisasjonsnummer</label></dt>
+                                               <dd><input type="text" 
name="orgno"/></dd>
+                                               <dt><label 
for="district">Bydel</label></dt>
+                                               <dd><select name="org_district">
+                                                               <option 
value="0">Ingen bydel valgt</option>
+                                               <?php 
+                                               foreach($districts as $d)
                                                {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_2());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_2());
-                                               }
-                                       ?>
-                               </dd>
-                           <dt>
-                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
+                                               ?>
+                                                       <option value="<?php 
echo $d['part_of_town_id']?>"><?php echo $d['name']?></option>
+                                               <?php
+                                               }?>
+                                               </select></dd>
+                                               <dt><label 
for="homepage">Hjemmeside</label></dt>
+                                               <dd><input type="text" 
name="homepage"/></dd>
+                                               <dt><label 
for="email">E-post</label></dt>
+                                               <dd><input type="text" 
name="email"/></dd>
+                                               <dt><label 
for="phone">Telefon</label></dt>
+                                               <dd><input type="text" 
name="phone"/></dd>
+                                               <dt><label 
for="street">Gate</label></dt>
+                                               <dd><input type="text" 
name="address_txt" id="address_txt" onkeyup="javascript:get_address_search()"/>
+                                               <div 
id="address_container"></div>
+                                               <label 
for="number">Nummer</label>
+                                               <input type="text" 
name="number"/><br/>
+                                               <label 
for="postaddress">Postnummer og Sted</label>
+                                               <input type="text" 
name="postaddress"/></dd>
+                                               <dt><label 
for="org_description">Beskrivelse</label></dt>
+                                               <dd><textarea rows="10" 
cols="100" name="org_description"></textarea></dd>
+                                       </div>
+                                       <hr/>
+                                       <b>Kontaktperson 1</b><br/>
+                                       <dt><label 
for="contact1_name">Navn</label>
+                                       <input type="text" 
name="org_contact1_name"/><br/>
+                                       <dt><label 
for="contact1_phone">Telefon</label>
+                                       <input type="text" 
name="org_contact1_phone"/><br/>
+                                       <dt><label 
for="contact1_mail">E-post</label>
+                                       <input type="text" 
name="org_contact1_mail"/><br/>
+                                       <b>Kontaktperson 2</b><br/>
+                                       <dt><label 
for="contact2_name">Navn</label>
+                                       <input type="text" 
name="org_contact2_name"/><br/>
+                                       <dt><label 
for="contact2_phone">Telefon</label>
+                                       <input type="text" 
name="org_contact2_phone"/><br/>
+                                       <dt><label 
for="contact2_mail">E-post</label>
+                                       <input type="text" 
name="org_contact2_mail"/><br/>
+                                       <dt><label 
for="contact2_address">Adresse</label>
+                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
+                                       <div 
id="contact2_address_container"></div><br/>
+                                       <label 
for="contact2_number">Nummer</label>
+                                       <input type="text" 
name="org_contact2_number"/><br/>
+                                       <dt><label 
for="contact2_postaddress">Postnummer og Sted</label>
+                                       <input type="text" 
name="org_contact2_postaddress"/>
+                                       <hr/>
+                                       <?php }else{?>
+                                               <input type="hidden" 
name="organization_id" id="organization_id" value="<?php echo 
$organization->get_id()?>" />
+                                               <dt><label 
for="orgname">Organisasjonsnavn</label></dt>
+                                               <dd><?php echo 
$organization->get_name()?></dd>
+                                               <dt><label 
for="orgno">Organisasjonsnummer</label></dt>
+                                               <dd><?php echo 
$organization->get_organization_number()?></dd>
+                                               <dt><label 
for="homepage">Hjemmeside</label></dt>
+                                               <dd><?php echo 
$organization->get_homepage()?></dd>
+                                               <dt><label 
for="email">E-post</label></dt>
+                                               <dd><?php echo 
$organization->get_email()?></dd>
+                                               <dt><label 
for="phone">Telefon</label></dt>
+                                               <dd><?php echo 
$organization->get_phone()?></dd>
+                                               <dt><label 
for="street">Adresse</label></dt>
+                                               <dd><?php echo 
$organization->get_address()?></dd>
+                                               <dt><label 
for="org_description">Beskrivelse</label></dt>
+                                               <dd><?php echo 
$organization->get_description()?></dd>
+                                       <hr/>
+                                       <dt>Kontaktperson 1</dt>
+                                       <dt><label 
for="contact1_name">Navn</label></dt>
+                                       <dd><?php echo 
isset($contact1)?$contact1->get_name():''?></dd>
+                                       <dt><label 
for="contact1_phone">Telefon</label></dt>
+                                       <dd><?php echo 
isset($contact1)?$contact1->get_phone():''?></dd>
+                                       <dt><label 
for="contact1_mail">E-post</label></dt>
+                                       <dd><?php echo 
isset($contact1)?$contact1->get_email():''?></dd>
+                                       <dt>Kontaktperson 2</dt>
+                                       <dt><label 
for="contact2_name">Navn</label></dt>
+                                       <dd><?php echo 
isset($contact2)?$contact2->get_name():''?></dd>
+                                       <dt><label 
for="contact2_phone">Telefon</label></dt>
+                                       <dd><?php echo 
isset($contact2)?$contact2->get_phone():''?></dd>
+                                       <dt><label 
for="contact2_mail">E-post</label></dt>
+                                       <dd><?php echo 
isset($contact2)?$contact2->get_email():''?></dd>
+                                       <dt><label 
for="contact2_address">Adresse</label></dt>
+                                       <dd><input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
+                                       <div 
id="contact2_address_container"></div><br/>
+                                       <label 
for="contact2_number">Nummer</label>
+                                       <input type="text" 
name="org_contact2_number"/><br/>
+                                       <label 
for="contact2_postaddress">Postnummer og Sted</label>
+                                       <input type="text" 
name="org_contact2_postaddress"/></dd>
+                                       <hr/>
+                                       <?php }?>
+                               <?php if(!$new_organization){?>
+                               <dt>
+                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
                                </dt>
                                <dd>
-                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation"<?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?> <?php echo 
!$editable ? ' disabled="disabled"' : '' ?>/>
+                                       <?php echo lang('group_helptext')?><br/>
+                                       <select name="group_id" id="group_id" 
onchange="javascript:checkNewGroup()">
+                                               <option value="0">Ingen gruppe 
valgt</option>
+                                               <option value='new_group'>Ny 
gruppe</option>
+                                       <?php foreach($groups as $group){?>
+                                               <option value="<?php echo 
$group->get_id()?>"><?php echo $group->get_name()?></option>
+                                       <?php }?>
+                                       </select>
                                </dd>
+                               <div id="new_group_fields" style="display: 
none;">
+                                       <dt><label 
for="groupname">Gruppenavn</label></dt>
+                                       <dd><input type="text" 
name="groupname"/><br/></dd>
+                                       <dt><label 
for="group_description">Beskrivelse</label></dt>
+                                       <dd><textarea rows="10" cols="100" 
name="group_description"></textarea></dd>
+                               <hr/>
+                               <dt>Kontaktperson 1</dt>
+                               <dt><label for="contact1_name">Navn</label></dt>
+                               <dd><input type="text" 
name="group_contact1_name" value="<?php echo 
isset($contact1)?$contact1->get_name():''?>"/></dd>
+                               <dt><label 
for="contact1_phone">Telefon</label></dt>
+                               <dd><input type="text" 
name="group_contact1_phone" value="<?php echo 
isset($contact1)?$contact1->get_phone():''?>"/></dd>
+                               <dt><label 
for="contact1_mail">E-post</label></dt>
+                               <dd><input type="text" 
name="group_contact1_mail" value="<?php echo 
isset($contact1)?$contact1->get_email():''?>"/></dd>
+                               <dt>Kontaktperson 2</dt>
+                               <dt><label for="contact2_name">Navn</label></dt>
+                               <dd><input type="text" 
name="group_contact2_name" value="<?php echo 
isset($contact2)?$contact2->get_name():''?>"/></dd>
+                               <dt><label 
for="contact2_phone">Telefon</label></dt>
+                               <dd><input type="text" 
name="group_contact2_phone" value="<?php echo 
isset($contact2)?$contact2->get_phone():''?>"/></dd>
+                               <dt><label 
for="contact2_mail">E-post</label></dt>
+                               <dd><input type="text" 
name="group_contact2_mail" value="<?php echo 
isset($contact2)?$contact2->get_email():''?>"/></dd>
+                               <dt><label 
for="contact2_address">Adresse</label></dt>
+                               <dd><input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()" />
+                               <div id="contact2_address_container"></div><br/>
+                               <label for="contact2_number">Nummer</label>
+                               <input type="text" 
name="group_contact2_number"/><br/>
+                               <label for="contact2_postaddress">Postnummer og 
Sted</label>
+                               <input type="text" 
name="group_contact2_postaddress"/></dd>
+                               <hr/>
+                               </div>
+                               <?php }?>
+                               <div class="form-buttons">
+                                       <input type="submit" 
name="save_activity" value="<?php echo lang('save_activity') ?>" 
onclick="return allOK();"/>
+                               </div>
                        </dl>
-                       <div class="form-buttons">
-                               <?php
-                                       if ($editable) {
-                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '" onclick="return allOK();"/>';
-                                       }
-                               ?>
-                       </div>
                        
                </form>
                

Copied: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_step_1.php
 (from rev 8150, 
trunk/activitycalendarfrontend/templates/base/activity_new_step_1.php)
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_step_1.php
                         (rev 0)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new_step_1.php
 2011-11-21 13:11:35 UTC (rev 8151)
@@ -0,0 +1,42 @@
+<?php ?>
+ <script type="text/javascript">
+function isOK()
+{
+       if(document.getElementById('organization_id').value == null || 
document.getElementById('organization_id').value == '')
+       {
+               alert("Du må velge om aktiviteten skal knyttes mot en 
eksisterende\norganisasjon, eller om det skal registreres en ny organisasjon!");
+               return false;
+       }
+       else
+       {
+               return true;
+       }
+}
+</script>
+<div class="yui-content" style="width: 100%;">
+       <h1><?php echo lang('new_activity') ?></h1>
+       <form action="#" method="post">
+               <dl class="proplist-col" style="width: 200%">
+                       <dt>
+                               <?php echo 
lang('org_helptext_step1')?><br/><br/>
+                       </dt>
+                       <dd>
+                               <select name="organization_id" 
id="organization_id">
+                                       <option value="">Ingen organisasjon 
valgt</option>
+                                       <option value="new_org">Ny 
organisasjon</option>
+                                       <?php
+                                       foreach($organizations as $organization)
+                                       {
+                                               echo "<option 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
+                                       }
+                                       ?>
+                               </select>
+                               <br/><br/>
+                       </dd>
+                       <div class="form-buttons">
+                               <input type="submit" name="step_1" value="<?php 
echo lang('next') ?>" onclick="return isOK();"/>
+                       </div>
+               </dl>
+               
+       </form>
+</div>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
===================================================================
--- 
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
        2011-11-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
        2011-11-21 13:11:35 UTC (rev 8151)
@@ -98,14 +98,6 @@
                 * Normalizes data on entity.
                 */
                public function initialize_entity(&$entity) {
-                       ob_start();
-                       $myFile = "/tmp/debug2.txt";
-                       $fh = fopen($myFile, 'w') or die("can't open file");
-                       echo '<pre>';print_r($entity);
-                       $op = ob_get_contents();
-                       fwrite($fh, $op);
-                       fclose($fh);
-                       ob_end_clean();
                if (isset($entity['__initialized__']) && 
$entity['__initialized__'] === true) { return $entity; }
                        
                        $entity['__initialized__'] = true;
@@ -262,13 +254,23 @@
                }
                
                public function select_external($reservation) {
-                       return $reservation['customer_type'] == 
booking_socompleted_reservation::CUSTOMER_TYPE_EXTERNAL;
+
+            if ($config->config_data['output_files'] == 'single')
+                       {
+                               return true;
+                       } else {
+                               return $reservation['customer_type'] == 
booking_socompleted_reservation::CUSTOMER_TYPE_EXTERNAL;
+                       }
                }
                
                public function select_internal($reservation) {
-                       return $reservation['customer_type'] == 
booking_socompleted_reservation::CUSTOMER_TYPE_INTERNAL;
+            if ($config->config_data['output_files'] == 'single')
+                       {
+                               return false;
+                       } else {
+                               return $reservation['customer_type'] == 
booking_socompleted_reservation::CUSTOMER_TYPE_INTERNAL;
+                       }
                }
-               
                /**
                 * @return array with three elements where index 0: total_rows, 
index 1: total_cost, index 2: formatted data
                 */
@@ -286,7 +288,7 @@
                                                $export_format,
                                                
count(array_filter($external_reservations, array($this, 'not_free'))),
                                                
$this->calculate_total_cost($external_reservations),
-                                               
$this->format_agresso($external_reservations, $account_codes, 
$number_generator,'external')
+                                               
$this->format_agresso($external_reservations, $account_codes, $number_generator)
                                        );
                                }
                        }
@@ -307,7 +309,7 @@
             elseif ($config->config_data['internal_format'] == 'AGGRESSO')
             {
                        $export_format = 'agresso';
-            } 
+                       } 
                        
                        if (is_array($reservations)) {
                                if (count($internal_reservations = 
array_filter($reservations, array($this, 'select_internal'))) > 0) {
@@ -330,7 +332,7 @@
                                                $export_format,
                                                
count(array_filter($internal_reservations, array($this, 'not_free'))),
                                                
$this->calculate_total_cost($internal_reservations),
-                                               
$this->format_agresso($internal_reservations, $account_codes, 
$number_generator,'internal')
+                                               
$this->format_agresso($internal_reservations, $account_codes, $number_generator)
                                                );
                         }
                                }
@@ -588,7 +590,7 @@
                        }
                }
                
-               public function format_agresso(array &$reservations, array 
$account_codes, $sequential_number_generator,$type) {
+               public function format_agresso(array &$reservations, array 
$account_codes, $sequential_number_generator) {
                        //$orders = array();
                        $export_info = array();
                        $output = array();
@@ -639,7 +641,7 @@
                                if ($this->get_cost_value($reservation['cost']) 
<= 0) {
                                        continue; //Don't export costless rows
                                }
-                               
+                               $type = $reservation['customer_type'];
                                $order_id = 
$sequential_number_generator->increment()->get_current();
                                $export_info[] = 
$this->create_export_item_info($reservation, $order_id);
                                

Modified: branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soevent.inc.php       
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/booking/inc/class.soevent.inc.php       
2011-11-21 13:11:35 UTC (rev 8151)
@@ -266,6 +266,22 @@
                        return $this->db->f('name', false);
                }
 
+               function get_org($orgnumber)
+               {
+                       $sql = "SELECT id,name FROM bb_organization WHERE 
customer_organization_number='".$orgnumber."'";
+
+                       $this->db->limit_query($sql,0, __LINE__, __FILE__, 1);
+                       if($this->db->next_record())
+                       {
+                               $results = array('id' => $this->db->f('id', 
false),
+                                                        'name' => 
$this->db->f('name', false));
+                       } else {
+                               return array();
+                       }
+
+                       return $results;
+               }
+
                function get_buildings()
                {
             $results = array();

Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2011-11-21 
12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2011-11-21 
13:11:35 UTC (rev 8151)
@@ -535,4 +535,5 @@
 Booking system settings        booking no      Bookingmodul systeminnstillinger
 Frontend users can delete bookings and allocations     booking no      Brukere 
av frontend kan slette bookinger og tildelinger direkte
 All that borrow premises from Bergen Kommune must verify that they have read 
the terms and conditions, this is usually fire regulations and house rules.     
  booking no      Alle som leier lokaler hos Bergen kommune må bekrefte at de 
har lest betingelsene, dette gjelder som regel brannforskrifter og husreglement.
-
+Delete information     booking no      Hvis du kun skal slette tildeling på 
valgt dato, velg Slett-knappen nederst og tiden blir vist som ledig i 
kalenderen, og kan tildeles andre klubber/org. 
+Delete information2    booking no      Skal du slette flere kan du velge Ut 
sesong eller Slett til og velg en dato, du kan også velge intervall (f.eks. 
annen hver uke).

Modified: 
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
===================================================================
--- 
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl   
    2011-11-21 12:50:13 UTC (rev 8150)
+++ 
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl   
    2011-11-21 13:11:35 UTC (rev 8151)
@@ -100,6 +100,23 @@
                           </option>
                        </select>
                        </dd>
+            <dt><label for="field_output_files"><xsl:value-of 
select="php:function('lang', 'File output')"/></label></dt>
+                       <dd>
+                               <select id="field_output_files" 
name="output_files">
+                    <option value="seperated">
+                        <xsl:if test="config_data/output_files='seperated'">
+                            <xsl:attribute 
name="selected">checked</xsl:attribute>
+                        </xsl:if>
+                        Records splited between two files internal and 
external.
+                    </option>
+                    <option value="single">
+                        <xsl:if test="config_data/output_files='single'">
+                            <xsl:attribute 
name="selected">checked</xsl:attribute>
+                        </xsl:if>
+                        All records in the external file.
+                          </option>
+                       </select>
+                       </dd>
         </dl>
                <div class="form-buttons">
                        <input type="submit">

Modified: 
branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl    
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl    
2011-11-21 13:11:35 UTC (rev 8151)
@@ -6,7 +6,10 @@
        </dl>
     <xsl:call-template name="msgbox"/>
        <xsl:call-template name="yui_booking_i18n"/>
-
+       <dl class="form">
+       <dd><xsl:value-of select="php:function('lang', 'Delete 
Information')"/></dd>
+       <dd><xsl:value-of select="php:function('lang', 'Delete 
Information2')"/></dd>
+       </dl>
     <form action="" method="POST">
                <input type="hidden" name="application_id" 
value="{allocation/application_id}"/>
         <input id="field_org_id" name="organization_id" type="hidden" 
value="{allocation/organization_id}" />

Modified: branches/Version-1_0-branch/bookingfrontend/inc/class.uievent.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/inc/class.uievent.inc.php       
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/bookingfrontend/inc/class.uievent.inc.php       
2011-11-21 13:11:35 UTC (rev 8151)
@@ -23,6 +23,15 @@
                {
                        $event = 
$this->bo->read_single(intval(phpgw::get_var('id', 'GET')));
                        $resources = 
$this->resource_bo->so->read(array('filters'=>array('id'=>$event['resources']), 
'sort'=>'name'));
+                       if ($event['customer_organization_number'] != '')
+                       {
+                               $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);              
+                               if ($orginfo != array()) { 
+                                       $orginfo['link'] = 
self::link(array('menuaction' => 'bookingfrontend.uiorganization.show', 'id' => 
$orginfo['id']));
+                               }
+                       } else {
+                               $orginfo = array();
+                       }
                        $event['resources'] = $resources['results'];
                        $res_names = array();
                        foreach($event['resources'] as $res)
@@ -32,7 +41,7 @@
                        $event['resource_info'] = join(', ', $res_names);
                        $event['building_link'] = self::link(array('menuaction' 
=> 'bookingfrontend.uibuilding.show', 'id' => 
$event['resources'][0]['building_id']));
                        $event['when'] = pretty_timestamp($event['from_']).' - 
'.pretty_timestamp($event['to_']);
-                       self::render_template('event_info', 
array('event'=>$event));
+                       self::render_template('event_info', 
array('event'=>$event,'orginfo' => $orginfo));
                        $GLOBALS['phpgw']->xslttpl->set_output('wml'); // Evil 
hack to disable page chrome
                }
 

Modified: 
branches/Version-1_0-branch/bookingfrontend/templates/base/event_info.xsl
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/templates/base/event_info.xsl   
2011-11-21 12:50:13 UTC (rev 8150)
+++ branches/Version-1_0-branch/bookingfrontend/templates/base/event_info.xsl   
2011-11-21 13:11:35 UTC (rev 8151)
@@ -17,6 +17,9 @@
                <dt><xsl:value-of select="php:function('lang', 'Who')"/></dt>
                <xsl:if test="event/is_public=1">
                        <dd>
+                       <xsl:if test="orginfo">
+                               <a href="{orginfo/link}"><xsl:value-of 
select="orginfo/name"/></a>:
+                       </xsl:if>
                                <xsl:value-of select="event/contact_name"/>
                        </dd>
                </xsl:if>
@@ -26,4 +29,4 @@
                        </dd>
                </xsl:if>
        </dl>
-</xsl:template>
\ No newline at end of file
+</xsl:template>

Copied: 
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php 
(from rev 8150, trunk/controller/inc/uicheck_list_for_location.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php    
                            (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/uicheck_list_for_location.inc.php    
    2011-11-21 13:11:35 UTC (rev 8151)
@@ -0,0 +1,983 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage location
+       * @version $Id: class.uilocation.inc.php 7895 2011-10-19 06:58:43Z 
sigurdne $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+       phpgw::import_class('phpgwapi.yui');
+
+       class controller_uicheck_list_for_location extends controller_uicommon
+       {
+               var $grants;
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $currentapp;
+               var $type_id;
+               var $location_code;
+
+               var $public_functions = array
+                       (
+                               'index'                                 => true,
+                       );
+
+               function __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::location';
+                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.bolocation',true);
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->soadmin_location         = 
CreateObject('property.soadmin_location');
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
+
+                       $this->type_id                          = 
$this->bo->type_id;
+
+                       $this->acl_location                     = 
$this->bo->acl_location;
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
+
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->filter                           = 
$this->bo->filter;
+                       $this->cat_id                           = 
$this->bo->cat_id;
+                       $this->part_of_town_id          = 
$this->bo->part_of_town_id;
+                       $this->district_id                      = 
$this->bo->district_id;
+                       $this->status                           = 
$this->bo->status;
+                       $this->allrows                          = 
$this->bo->allrows;
+                       $this->lookup                           = 
$this->bo->lookup;
+                       $this->location_code            = 
$this->bo->location_code;
+               }       
+       
+               function index()
+               {
+
+                       $type_id        = $this->type_id;
+                       // $lookup use for pop-up
+                       $lookup         = $this->lookup;
+                       // $lookup_name use in pop-up option "project"
+                       $lookup_name    = phpgw::get_var('lookup_name');
+                       // use in option menu TENANT
+                       $lookup_tenant  = phpgw::get_var('lookup_tenant', 
'bool');
+                       $block_query    = phpgw::get_var('block_query', 'bool');
+                       $dry_run=false;
+
+                       if(!$type_id)
+                       {
+                               $type_id = 1;
+                       }
+                       if($lookup)
+                       {
+                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+                       }
+
+                       if ( $type_id && !$lookup_tenant )
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
+                       }
+
+                       if (!$this->acl_read)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+                       $second_display = phpgw::get_var('second_display', 
'bool');
+                       $default_district       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+
+                       if ($default_district && !$second_display && 
!$this->district_id)
+                       {
+                               $this->bo->district_id  = $default_district;
+                               $this->district_id              = 
$default_district;
+                       }
+
+                       $datatable = array();
+                       $values_combo_box = array();
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+                       $custom_config  = 
CreateObject('admin.soconfig',$location_id);
+                       $_config = isset($custom_config->config_data) && 
$custom_config->config_data ? $custom_config->config_data : array();
+
+                       $_integration_set = array();
+                       foreach ($_config as $_config_section => 
$_config_section_data)
+                       {
+                               $integrationurl = '';
+                               if(isset($_config_section_data['url']) && 
!isset($_config_section_data['tab']))
+                               {
+                                       
if(isset($_config_section_data['auth_hash_name']) && 
$_config_section_data['auth_hash_name'] && 
isset($_config_section_data['auth_url']) && $_config_section_data['auth_url'])
+                                       {
+                                               //get session key from remote 
system
+
+                                               $arguments = 
array($_config_section_data['auth_hash_name'] => 
$_config_section_data['auth_hash_value']);
+                                               $query = 
http_build_query($arguments);
+                                               $auth_url = 
$_config_section_data['auth_url'];
+                                               $request = 
"{$auth_url}?{$query}";
+
+                                               $aContext = array
+                                                       (
+                                                               'http' => array
+                                                               (
+                                                                       
'request_fulluri' => true,
+                                                               ),
+                                                       );
+
+                                               
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
+                                               {
+                                                       
$aContext['http']['proxy'] = 
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
+                                               }
+
+                                               $cxContext = 
stream_context_create($aContext);
+                                               $response = 
trim(file_get_contents($request, False, $cxContext));
+                                       }
+
+
+                                       $_config_section_data['url']            
= htmlspecialchars_decode($_config_section_data['url']);
+                                       $_config_section_data['parametres']= 
htmlspecialchars_decode($_config_section_data['parametres']);
+                                       $integration_name = 
isset($_config_section_data['name']) && $_config_section_data['name'] ? 
$_config_section_data['name'] : lang('integration');
+
+                                       
parse_str($_config_section_data['parametres'], $output);
+
+                                       foreach ($output as $_dummy => 
$_substitute)
+                                       {
+                                               $_keys[] = $_substitute;
+                                               $__substitute = 
trim($_substitute, '_');
+                                               $_values[] = 
$this->$__substitute;
+                                       }
+                                       unset($output);
+
+                                       $_sep = '?';
+                                       if 
(stripos($_config_section_data['url'],'?'))
+                                       {
+                                               $_sep = '&';
+                                       }
+                                       $_param = str_replace($_keys, $_values, 
$_config_section_data['parametres']);
+
+                                       $integrationurl = 
"{$_config_section_data['url']}{$_sep}{$_param}";
+                                       $integrationurl .= 
"&{$_config_section_data['auth_key_name']}={$response}";
+
+                                       $_config_section_data['location_data']= 
htmlspecialchars_decode($_config_section_data['location_data']);
+
+                                       $parameters_integration = array();
+                                       
if($_config_section_data['location_data'])
+                                       {
+                                               
parse_str($_config_section_data['location_data'], $output);
+
+                                               foreach ($output as $_name => 
$_substitute)
+                                               {
+                                                       if($_substitute == 
'__loc1__') // This one is a link...
+                                                       {
+                                                               $_substitute = 
'__location_code__';
+                                                       }
+
+                                                       
$parameters_integration['parameter'][] = array
+                                                       (
+                                                               'name'          
=> $_name,
+                                                               'source'        
=> trim($_substitute, '_'),
+                                                       );
+                                               }
+                                       }
+                                       
+                                       $_integration_set[] = array
+                                       (
+                                               'name'                  => 
$integration_name,
+                                               'parameters'    => 
$parameters_integration,
+                                               'url'                   => 
$integrationurl
+                                       );
+                               }
+                       }
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               if(!$lookup)
+                               {
+                                       $datatable['menu']                      
        = $this->bocommon->get_menu();
+                               }
+
+                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uilocation.index',
+                                               'type_id'                       
=> $type_id,
+                                               'query'                         
=> $this->query,
+                                               'district_id'           => 
$this->district_id,
+                                               'part_of_town_id'       => 
$this->part_of_town_id,
+                                               'lookup'                        
=> $lookup,
+                                               'lookup_tenant'         => 
$lookup_tenant,
+                                               'lookup_name'           => 
$lookup_name,
+                                               'cat_id'                        
=> $this->cat_id,
+                                               'status'                        
=> $this->status,
+                                               'location_code'                 
=> $this->location_code
+                                       ));
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilocation.index',"
+                                       ."type_id:'{$type_id}',"
+                                       ."query:'{$this->query}',"
+                                       ."district_id: '{$this->district_id}',"
+                                       
."part_of_town_id:'{$this->part_of_town_id}',"
+                                       ."lookup:'{$lookup}',"
+                                       ."second_display:1,"
+                                       ."lookup_tenant:'{$lookup_tenant}',"
+                                       ."lookup_name:'{$lookup_name}',"
+                                       ."cat_id:'{$this->cat_id}',"
+                                       ."status:'{$this->status}',"
+                                       
."location_code:'{$this->location_code}',"
+                                       ."block_query:'{$block_query}'";
+
+                               // $values_combo_box  se usar� para escribir en 
el HTML, usando el XSLT
+                               $values_combo_box[0]  = 
$this->bocommon->select_category_list(array
+                                       ('format'=>'filter',
+                                       'selected' => $this->cat_id,
+                                       'type' =>'location',
+                                       'type_id' =>$type_id,
+                                       'order'=>'descr')
+                               );
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $values_combo_box[2] =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no part of town'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                               {
+                                       $values_combo_box[3] = 
$this->bo->get_owner_list('filter', $this->filter);
+                               }
+                               else
+                               {
+                                       $values_combo_box[3] = 
$this->bo->get_owner_type_list('filter', $this->filter);
+                               }
+                               $default_value = array 
('id'=>'','name'=>lang('show all'));
+                               array_unshift 
($values_combo_box[3],$default_value);
+
+                               $datatable['actions']['form'] = array
+                                       (
+                                               array
+                                               (
+                                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array
+                                                       (
+                                                               'menuaction'    
        => 'property.uilocation.index',
+                                                               'type_id'       
                => $type_id,
+                                                               'district_id'   
    => $this->district_id,
+                                                               
'part_of_town_id'   => $this->part_of_town_id,
+                                                               'lookup'        
        => $lookup,
+                                                               'lookup_tenant' 
    => $lookup_tenant,
+                                                               'lookup_name'   
    => $lookup_name,
+                                                               'cat_id'        
        => $this->cat_id,
+                                                       )
+                                               ),
+                                               'fields'        => array
+                                               (
+                                                       'field' => array
+                                                       (
+                                                               array
+                                                               ( //boton       
CATEGORY
+                                                                       'id' => 
'btn_cat_id',
+                                                                       'name' 
=> 'cat_id',
+                                                                       'value' 
=> lang('Category'),
+                                                                       'type' 
=> 'button',
+                                                                       'style' 
=> 'filter',
+                                                                       
'tab_index' => 1
+                                                               ),
+                                                               array
+                                                               ( //boton       
DISTINT
+                                                                       'id' => 
'btn_district_id',
+                                                                       'name' 
=> 'district_id',
+                                                                       'value' 
=> lang('District'),
+                                                                       'type' 
=> 'button',
+                                                                       'style' 
=> 'filter',
+                                                                       
'tab_index' => 2
+                                                               ),
+                                                               array
+                                                               ( //boton       
PART OF TOWN
+                                                                       'id' => 
'btn_part_of_town_id',
+                                                                       'name' 
=> 'part_of_town_id',
+                                                                       'value' 
=> lang('Part of Town'),
+                                                                       'type' 
=> 'button',
+                                                                       'style' 
=> 'filter',
+                                                                       
'tab_index' => 3
+                                                               ),
+                                                               array
+                                                               ( //boton       
FILTER
+                                                                       'id' => 
'btn_owner_id',
+                                                                       'name' 
=> 'owner_id',
+                                                                       'value' 
=> lang('Filter'),
+                                                                       'type' 
=> 'button',
+                                                                       'style' 
=> 'filter',
+                                                                       
'tab_index' => 4
+                                                               ),
+                                                               //for link 
"columns", next to Export button
+                                                               array
+                                                               (
+                                                                       'type' 
=> 'link',
+                                                                       'id' => 
'btn_columns',
+                                                                       'url' 
=> "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                       array
+                                                                       (
+                                                                               
'menuaction' => 'property.uilocation.columns',
+                                                                               
'type_id'  => $type_id,
+                                                                               
'lookup'  => $this->lookup
+                                                                       
))."','','width=300,height=600,scrollbars=1')",
+                                                                       'value' 
=> lang('columns'),
+                                                                       
'tab_index' => 9
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_export',
+                                                                       'value' 
=> lang('download'),
+                                                                       
'tab_index' => 8
+                                                               ),
+                                                               array
+                                                               ( //hidden 
type_id
+                                                                       'type'  
=> 'hidden',
+                                                                       'id'    
=> 'type_id',
+                                                                       'value' 
=> $type_id
+                                                               )
+                                                       ),
+                                                       'hidden_value' => array
+                                                       (
+                                                               array
+                                                               ( //div values  
combo_box_0
+                                                                       'id' => 
'values_combo_box_0',
+                                                                       'value' 
=> $this->bocommon->select2String($values_combo_box[0]) //i.e.  
id,value/id,vale/
+                                                               ),
+                                                               array
+                                                               ( //div values  
combo_box_1
+                                                                       'id' => 
'values_combo_box_1',
+                                                                       'value' 
=> $this->bocommon->select2String($values_combo_box[1])
+                                                               ),
+                                                               array
+                                                               ( //div values  
combo_box_2
+                                                                       'id' => 
'values_combo_box_2',
+                                                                       'value' 
=> $this->bocommon->select2String($values_combo_box[2])
+                                                               ),
+                                                               array
+                                                               ( //div values  
combo_box_3
+                                                                       'id' => 
'values_combo_box_3',
+                                                                       'value' 
=> $this->bocommon->select2String($values_combo_box[3])
+                                                               )
+                                                       )
+                                               )
+                                       )
+                               );
+
+                               $button_def[] = "oNormalButton_0";
+                               $button_def[] = "oNormalButton_1";
+                               $button_def[] = "oNormalButton_2";
+                               $code_inner[] = "{order:0, 
name:'btn_search',funct:'onSearchClick'}";
+                               $code_inner[] = "{order:1, name:'btn_new',      
funct:'onNewClick'}";
+                               $code_inner[] = "{order:2, 
name:'btn_export',funct:'onDownloadClick'}";
+                               $_js_functions = '';
+
+                               foreach ($_integration_set as $i => 
$_integration)
+                               {       
+
+                                       $button_def[] = 'oNormalButton_' . ($i 
+ 3); 
+                                       $code_inner[] = "{order:" . ($i + 3)  
.", name:'btn_integration_{$i}',funct:'onIntegrationClick_{$i}'}";
+
+                                       
$datatable['actions']['form'][0]['fields']['field'][] =  array
+                                       (
+                                               'type'  => 'button',
+                                               'id'    => 
"btn_integration_{$i}",
+                                               'value' => 
$_integration['name'],
+                                               'tab_index' => 10 + $i
+                                       );
+
+                                       $_js_functions .= <<<JS
+                                               this.onIntegrationClick_{$i} = 
function()
+                                               {
+                                                       
window.open(values_ds.integrationurl_{$i},'window');
+                                               }
+JS;
+                               }
+
+                               $code = 'var ' . implode(',', $button_def)  . 
";\n";
+                               $code .= 'var normalButtons = [' . "\n" . 
implode(",\n",$code_inner) . "\n];";
+                               $code .= $_js_functions;
+
+                               $GLOBALS['phpgw']->js->add_code('', $code);
+
+                               if(!$block_query)
+                               {       
+                                       
$datatable['actions']['form'][0]['fields']['field'][] =  array
+                                               (
+                                                       'id' => 'btn_search',
+                                                       'name' => 'search',
+                                                       'value'    => 
lang('search'),
+                                                       'type' => 'button',
+                                                       'tab_index' => 6
+                                               );
+
+                                       
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                       'name'     => 'query',
+                                                       'id'     => 'txt_query',
+                                                       'value'    => 
$this->query,//'',//$query,
+                                                       'type' => 'text',
+                                                       'size'    => 28,
+                                                       'onkeypress' => 'return 
pulsar(event)',
+                                                       'tab_index' => 5
+                                               );
+                               }
+
+                               if(!$lookup)
+                               {
+                                       
$datatable['actions']['form'][0]['fields']['field'][] =  array
+                                               (
+                                                       'type'  => 'button',
+                                                       'id'    => 'btn_new',
+                                                       'value' => lang('add'),
+                                                       'tab_index' => 7
+                                               );
+                               }
+
+                               $dry_run=true;
+
+                       }
+
+                       $location_list = array();
+                       //cramirez: $dry_run avoid to load all data the first 
time
+                       $location_list = 
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
 =>$dry_run));
+
+                       $uicols = $this->bo->uicols;
+
+                       $content = array();
+                       $j=0;
+                       if (isset($location_list) && is_array($location_list))
+                       {
+                               foreach($location_list as $location)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       
if(isset($location['query_location'][$uicols['name'][$i]]))
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
lang('search');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$location[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                             
= $location['query_location'][$uicols['name'][$i]];
+                                                       }
+                                                       else
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$location[$uicols['name'][$i]];
+                                                               
//$datatable['rows']['row'][$j]['column'][$i]['value']                  = $i;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['lookup']                   = 
$lookup;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $location[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']            = lang('link');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$location[$uicols['name'][$i]];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';

@@ Diff output truncated at 153600 characters. @@



reply via email to

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