fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9964] Merge 9957:9963 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9964] Merge 9957:9963 from trunk
Date: Tue, 04 Sep 2012 09:31:04 +0000

Revision: 9964
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9964
Author:   sigurdne
Date:     2012-09-04 09:31:03 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
Merge 9957:9963 from trunk

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

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2012-09-04 07:05:05 UTC (rev 9963)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2012-09-04 09:31:03 UTC (rev 9964)
@@ -10,438 +10,426 @@
 class activitycalendar_uiactivities extends activitycalendar_uicommon
 {
     protected $so_org;
-       protected $so_group;
-       protected $so_contact;
-       protected $so_activity;
-       protected $so_arena;
+    protected $so_group;
+    protected $so_contact;
+    protected $so_activity;
+    protected $so_arena;
 
-       public $public_functions = array
-       (
-               'index'                 => true,
-               'index_json'            => true,
-               'query'                     => true,
-               'view'                      => true,
-               'add'                           => true,
-               'edit'                          => true,
-               'download'                      => true,
-               'send_mail'                     => true,
-               'get_organization_groups'       => true,
-                'create_groups'                 => true
-       );
-       
-       public function __construct()
-       {
-               parent::__construct();
-               $this->bo_org = CreateObject('booking.boorganization');
-               $this->bo_group = CreateObject('booking.bogroup');
-               $this->so_org = activitycalendar_soorganization::get_instance();
-               $this->so_group = activitycalendar_sogroup::get_instance();
-               $this->so_contact = 
activitycalendar_socontactperson::get_instance();
-               $this->so_activity = 
activitycalendar_soactivity::get_instance();
-               $this->so_arena = activitycalendar_soarena::get_instance();
-               self::set_active_menu('activitycalendar::activities');
-               $config = CreateObject('phpgwapi.config','activitycalendar');
-               $config->read();
-       }
-       
-       /**
-        * Public method. Forwards the user to edit mode.
-        */
-       public function add()
-       {
-               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.edit'));
-       }
-       
-       public function index()
-       {
-               //$message = phpgw::get_var('message');
-               $this->render('activity_list.php');
-               
-       }
-       
-/*     public function index_json()
-       {
-               $organizations = $this->bo_org->read();
-               //array_walk($organizations["results"], array($this, 
"_add_links"), "booking.uiorganization.show");
+    public $public_functions = array
+    (
+        'index'                     => true,
+        'index_json'                => true,
+        'query'                     => true,
+        'view'                      => true,
+        'add'                       => true,
+        'edit'                      => true,
+        'download'                  => true,
+        'send_mail'                 => true,
+        'get_organization_groups'   => true,
+        'create_groups'             => true
+    );
 
-               foreach($organizations["results"] as &$organization) {
-                       $contact = (isset($organization['contacts']) && 
isset($organization['contacts'][0])) ? $organization['contacts'][0] : null;
+    public function __construct()
+    {
+        parent::__construct();
+        $this->bo_org = CreateObject('booking.boorganization');
+        $this->bo_group = CreateObject('booking.bogroup');
+        $this->so_org = activitycalendar_soorganization::get_instance();
+        $this->so_group = activitycalendar_sogroup::get_instance();
+        $this->so_contact = activitycalendar_socontactperson::get_instance();
+        $this->so_activity = activitycalendar_soactivity::get_instance();
+        $this->so_arena = activitycalendar_soarena::get_instance();
+        self::set_active_menu('activitycalendar::activities');
+        $config        = CreateObject('phpgwapi.config','activitycalendar');
+        $config->read();
+    }
 
-                       if ($contact) {
-                               $organization += array(
-                                                       "primary_contact_name"  
=> ($contact["name"])  ? $contact["name"] : '',
-                                                       "primary_contact_phone" 
=> ($contact["phone"]) ? $contact["phone"] : '',
-                                                       "primary_contact_email" 
=> ($contact["email"]) ? $contact["email"] : '',
-                               );
-                       }
-               }
+    /**
+     * Public method. Forwards the user to edit mode.
+     */
+    public function add()
+    {
+        $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.edit'));
+    }
 
-               return $this->yui_results($organizations);
-       }*/
+    public function index()
+    {
+        //$message = phpgw::get_var('message');
+        $this->render('activity_list.php');
+
+    }
        
-       /**
-        * Displays info about one single billing job.
-        */
-       public function view()
-       {
-               $errorMsgs = array();
-               $infoMsgs = array();
+    /**
+     * Displays info about one single billing job.
+     */
+    public function view()
+    {
+        $errorMsgs = array();
+        $infoMsgs = array();
 
-               $activity = 
$this->so_activity->get_single((int)phpgw::get_var('id'));
-               $cancel_link = self::link(array('menuaction' => 
'activitycalendar.uiactivities.index'));
-               $saved_OK = phpgw::get_var('saved_ok');
-               if($saved_OK)
-               {
-                       $message = lang('activity_saved_form');
-               }
-               
-               if($activity == null) // Not found
-               {
-                       $errorMsgs[] = lang('Could not find specified 
activity.');
-               }
-               
-               if(isset($_POST['edit_activity'])) // The user has pressed the 
save button
-               {
-                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.edit','id' => 
phpgw::get_var('id')));
-               }
+        $activity = $this->so_activity->get_single((int)phpgw::get_var('id'));
+        $cancel_link = self::link(array('menuaction' => 
'activitycalendar.uiactivities.index'));
+        $saved_OK = phpgw::get_var('saved_ok');
+        if($saved_OK)
+        {
+                $message = lang('activity_saved_form');
+        }
 
-               $data = array
-               (
-                       'activity' => $activity,
-                       'cancel_link' => $cancel_link,
-                       'message' => $message,
-                       'errorMsgs' => $errorMsgs,
-                       'infoMsgs' => $infoMsgs
-               );
-               $this->render('activity.php', $data);
-       }
-       
-       public function edit()
-       {
-               $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('edit');
-               // Get the contract part id
-               $activity_id = (int)phpgw::get_var('id');
-               $cancel_link = self::link(array('menuaction' => 
'activitycalendar.uiactivities.index'));
-               $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();
-               // Retrieve the activity object or create a new one
-               if(isset($activity_id) && $activity_id > 0)
-               {       
-                       $activity = 
$this->so_activity->get_single($activity_id); 
-               }
-               else
-               {
-                       $activity = new activitycalendar_activity();
-               }
-               $new_group = $activity->get_new_group();
-               $g_id = phpgw::get_var('group_id');
-               $o_id = phpgw::get_var('organization_id');
-               if($new_group)
-               {
-                   $persons = 
$this->so_group->get_contacts_local($activity->get_group_id());
-                       $desc = 
$this->so_group->get_description_local($activity->get_group_id());
-               }
-               else if(isset($g_id) && $g_id > 0)
-               {
-                       $persons = $this->so_group->get_contacts($g_id);
-                       $desc = $this->so_group->get_description($g_id);
-               }
-               else if(isset($o_id) && $o_id > 0)
-               {
-                       $persons = $this->so_org->get_contacts($o_id);
-                       $desc = $this->so_org->get_description($o_id);
-               }
-               
-               if(strlen($desc) > 254)
-               {
-                       $desc = substr($desc,0,254);
-               }
-               $arenas = $this->so_arena->get(null, null, 'arena.arena_name', 
true, null, null, null);
-               if($activity->get_new_org())
-               {
-                       $org_name = 
$this->so_org->get_organization_name_local($activity->get_organization_id());
-               }
-               else
-               {
-                       $organizations = $this->so_org->get(null, null, 
'org.name', true, null, null, null);
-               }
-               if($new_group)
-               {
-                   $group_array = $this->so_group->get(null, null, null, null, 
null, null, array('group_id' => $activity->get_group_id(), 'new_groups' => 
'true'));
-                   //var_dump($group_array);
-               if(count($group_array) > 0){
-                       $keys = array_keys($group_array);
-                       $local_group = $group_array[$keys[0]];
-                       //$group_name = $local_group->get_name();
-               }  
-               }
-               else
-               {
-                   $groups = $this->so_group->get(null, null, null, null, 
null, null, null);
-               }
+        if($activity == null) // Not found
+        {
+                $errorMsgs[] = lang('Could not find specified activity.');
+        }
 
-               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(phpgw::get_var('organization_id'));
-                               
$activity->set_group_id(phpgw::get_var('group_id'));
-                               $internal_arena = 
phpgw::get_var('internal_arena_id');
-                               if(isset($internal_arena) && $internal_arena > 
0)
-                               {
-                                       $activity->set_arena(0);
-                                       
$activity->set_internal_arena($internal_arena);
-                               }
-                               else
-                               {
-                                       
$activity->set_arena(phpgw::get_var('arena_id'));
-                                       $activity->set_internal_arena(0);
-                               }
-                               $district_array = phpgw::get_var('district');
-                               $activity->set_district(implode(",", 
$district_array));
-                               $activity->set_office(phpgw::get_var('office'));
-                               $activity->set_state($new_state);
-                               
$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_contact_person_2_address(phpgw::get_var('contact_person_2_address'));
-                               
$activity->set_contact_person_2_zip(phpgw::get_var('contact_person_2_zip'));
-                               
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
-                               
-                               $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
-                                       {
-                                       if($new_group)
-                                   {
-                                       //transfer group to booking
-                                           $group_array = 
$this->so_group->get(null, null, null, null, null, null, array('group_id' => 
$activity->get_group_id(), 'new_groups' => 'true'));
-                                       if(count($group_array) > 0){
-                                           $keys = array_keys($group_array);
-                                               $group = $group_array[$keys[0]];
-                                       } 
-                                       
-                                           $group_info = array();
-                                           $group_info['name'] = 
$group->get_name(); //new
-                                           $group_info['organization_id'] = 
$activity->get_organization_id(); 
-                                           $group_info['description'] = 
$group->get_description();
-                                           
-                                           $contacts = 
$this->so_contact->get_local_contact_persons($group->get_id(), true);
-                                           $contact_1 = $contacts[0];
-    
-                                       $new_group_id = 
$this->so_group->transfer_group($group_info);
-                                           if($new_group_id)
-                                       {
-                                               //update activity with new org 
id
-                                               //add contact persons to booking
-                                               $contact1 = array();
-                                               $contact1['name'] = 
$contact_1->get_name();
-                                               $contact1['phone'] = 
$contact_1->get_phone();
-                                               $contact1['mail'] = 
$contact_1->get_email();
-                                               $contact1['group_id'] = 
$new_group_id;
-                                               
$this->so_activity->add_contact_person_group($contact1);
-                                               
-                                               $message = 
lang('messages_saved_form'); 
-                                               
-                                               //get organization_id for the 
group:
-                                               $group_org_id = 
$this->so_group->get_orgid_from_group($new_group_id);
-                                               
-                                               //get affected activities and 
update with new org id
-                                               $update_activities = 
$this->so_activity->get_activities_for_update($group->get_id(), true);
+        if(isset($_POST['edit_activity'])) // The user has pressed the save 
button
+        {
+                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.edit','id' => 
phpgw::get_var('id')));
+        }
 
-                                               foreach($update_activities as 
$act_id)
-                                               {
-                                                   $act = 
$this->so_activity->get_single($act_id);
-                                                       
$act->set_organization_id($group_org_id);
-                                                       
$act->set_group_id($new_group_id);
-                                                       
$act->set_new_org(false);
-                                                       
$act->set_new_group(false);
-                                                       
$this->so_activity->store($act);
-                                               }
-                                               
-                                               //set local group as stored
-                                               
$group->set_change_type('added');
-                                               $group->set_transferred(true);
-    
-                                               
$this->so_group->update_local($group);
-                                               $message = 
lang('messages_saved_form');
-                                               //var_dump($new_group_id);
-                                               $contact_persons = 
$this->so_contact->get_booking_contact_persons($new_group_id, true);
-                                               //var_dump(2);
-                                       $cp1 = $contact_persons[0];
-                                   }
-                                   }
-                                               $message = 
lang('messages_saved_form'); 
-                                       }
-                                       else
-                                       {
-                                               $error = 
lang('messages_form_error');
-                                       }
-                                        
-                                        $activity = 
$this->so_activity->get_single($activity_id);
-       
-                                       if($old_state != $new_state && 
($new_state == 3 || $new_state == 5))
-                                       {
-                                               $kontor = 
$this->so_activity->get_office_name($activity->get_office());
-                                               $subject = 
lang('mail_subject_update');
-                                               $body = lang('mail_body_state_' 
. $new_state, $activity->get_title(), $kontor);
-                                               
-                                               if($activity->get_group_id() && 
$activity->get_group_id() > 0)
-                                               {
-                                                       
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
-                                                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),$subject,$body);
-                                               }
-                                               else if 
($activity->get_organization_id() && $activity->get_organization_id() > 0)
-                                               {
-                                                       
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
-                                                       
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),$subject,$body);
-                                               }
-                                       }
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $activity->get_id(), 'saved_ok' 
=> 'yes'));
-                               }
-                               else
-                               {
-                                       if(!$target_ok)
-                                       {
-                                               $error .= "<br/>" . 
lang('target_not_selected');
-                                       }
-                                       if(!$district_ok)
-                                       {
-                                               $error .= "<br/>" . 
lang('district_not_selected');
-                                       }
-                                       return $this->render('activity.php', 
array
-                                               (
-                                                       'activity'      => 
$activity,
-                                                       'organizations' => 
$organizations,
-                                                       'org_name' => $org_name,
-                                                       'groups' => $groups,
-                                                   'local_group' => 
$local_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')
-                                               )       
-                                       );
-                               }
-                       }
-               }
-               $editable = true;
-               if($activity->get_new_org())
-               {
-                       $error = lang('org_not_transferred');
-                       $editable = false;
-               }
-               //var_dump($local_group);
+        $data = array
+        (
+            'activity' => $activity,
+            'cancel_link' => $cancel_link,
+            'message' => $message,
+            'errorMsgs' => $errorMsgs,
+            'infoMsgs' => $infoMsgs
+        );
+        $this->render('activity.php', $data);
+    }
 
-               return $this->render('activity.php', array
-                       (
-                               'activity'      => $activity,
-                               'organizations' => $organizations,
-                               'org_name' => $org_name,
-                               'groups' => $groups,
-                               'local_group' => $local_group,
-                               'arenas' => $arenas,
-                               'buildings' => $buildings,
-                               'categories' => $categories,
-                               'targets' => $targets,
-                               'districts' => $districts,
-                               'offices' => $offices,
-                               'editable' => $editable,
-                               'cancel_link' => $cancel_link,
-                               'message' => isset($message) ? $message : 
phpgw::get_var('message'),
-                               'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                       )       
-               );
-       }
-       
-       public function query()
-       {
-               
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
-               {
-                       $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-               }
-               else {
-                       $user_rows_per_page = 10;
-               }
-               // YUI variables for paging and sorting
-               $start_index    = phpgw::get_var('startIndex', 'int');
-               $num_of_objects = phpgw::get_var('results', 'int', 'GET', 
$user_rows_per_page);
-               $sort_field             = phpgw::get_var('sort');
-               $sort_ascending = phpgw::get_var('dir') == 'desc' ? false : 
true;
-               // Form variables
-               $search_for     = phpgw::get_var('query');
-               $search_type    = phpgw::get_var('search_option');
-               // Create an empty result set
-               $result_objects = array();
-               $result_count = 0;
-               //Retrieve the type of query and perform type specific logic
-               $query_type = phpgw::get_var('type');
-               
-               $exp_param      = phpgw::get_var('export');
-               $export = false;
-               if(isset($exp_param)){
-                       $export=true;
-                       $num_of_objects = null;
-               }
-               
-               $email_param = phpgw::get_var('email');
-               $email = false;
-               if(isset($email_param)){
-                       $email=true;
-               }
-               
-               $uid = $GLOBALS['phpgw_info']['user']['account_id'];
-               
-               switch($query_type)
-               {
-                       case 'new_activities':
-                               $filters = array('new_activities' => 'yes', 
'activity_state' => phpgw::get_var('activity_state'), 'activity_category' => 
phpgw::get_var('activity_category'), 'activity_district' => 
phpgw::get_var('activity_district'), 'user_id' => $uid, 'updated_date_hidden' 
=> phpgw::get_var('date_change_hidden'));
-                               $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;
-                       case 'all_activities':
-                       default:
-                               $filters = array('activity_state' => 
phpgw::get_var('activity_state'), 'activity_category' => 
phpgw::get_var('activity_category'), 'activity_district' => 
phpgw::get_var('activity_district'), 'user_id' => $uid, 'updated_date_hidden' 
=> phpgw::get_var('date_change_hidden'));
-                               $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;
-               }                                                               
                                                                                
                                            
-               
-               //Create an empty row set
-               $rows = array();
-               $mail_rows = array();
-               foreach($result_objects as $result) {
-//                     var_dump($result);
-                       if(isset($result))
-                       {
-                               // ... add a serialized result
+    public function edit()
+    {
+        $GLOBALS['phpgw_info']['flags']['app_header'] .= '::'.lang('edit');
+        // Get the contract part id
+        $activity_id = (int)phpgw::get_var('id');
+        $cancel_link = self::link(array('menuaction' => 
'activitycalendar.uiactivities.index'));
+        $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();
+        // Retrieve the activity object or create a new one
+        if(isset($activity_id) && $activity_id > 0)
+        {      
+            $activity = $this->so_activity->get_single($activity_id); 
+        }
+        else
+        {
+            $activity = new activitycalendar_activity();
+        }
+        $new_group = $activity->get_new_group();
+        $g_id = phpgw::get_var('group_id');
+        $o_id = phpgw::get_var('organization_id');
+        if($new_group)
+        {
+            $persons = 
$this->so_group->get_contacts_local($activity->get_group_id());
+            $desc = 
$this->so_group->get_description_local($activity->get_group_id());
+        }
+        else if(isset($g_id) && $g_id > 0)
+        {
+            $persons = $this->so_group->get_contacts($g_id);
+            $desc = $this->so_group->get_description($g_id);
+        }
+        else if(isset($o_id) && $o_id > 0)
+        {
+            $persons = $this->so_org->get_contacts($o_id);
+            $desc = $this->so_org->get_description($o_id);
+        }
+
+        if(strlen($desc) > 254)
+        {
+            $desc = substr($desc,0,254);
+        }
+        $arenas = $this->so_arena->get(null, null, 'arena.arena_name', true, 
null, null, null);
+        if($activity->get_new_org())
+        {
+            $org_name = 
$this->so_org->get_organization_name_local($activity->get_organization_id());
+        }
+        else
+        {
+            $organizations = $this->so_org->get(null, null, 'org.name', true, 
null, null, null);
+        }
+        if($new_group)
+        {
+            $group_array = $this->so_group->get(null, null, null, null, null, 
null, array('group_id' => $activity->get_group_id(), 'new_groups' => 'true'));
+            //var_dump($group_array);
+        if(count($group_array) > 0){
+            $keys = array_keys($group_array);
+            $local_group = $group_array[$keys[0]];
+            //$group_name = $local_group->get_name();
+        }  
+        }
+        else
+        {
+            $groups = $this->so_group->get(null, null, null, null, null, null, 
null);
+        }
+
+        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(phpgw::get_var('organization_id'));
+                $activity->set_group_id(phpgw::get_var('group_id'));
+                $internal_arena = phpgw::get_var('internal_arena_id');
+                if(isset($internal_arena) && $internal_arena > 0)
+                {
+                    $activity->set_arena(0);
+                    $activity->set_internal_arena($internal_arena);
+                }
+                else
+                {
+                    $activity->set_arena(phpgw::get_var('arena_id'));
+                    $activity->set_internal_arena(0);
+                }
+                $district_array = phpgw::get_var('district');
+                $activity->set_district(implode(",", $district_array));
+                $activity->set_office(phpgw::get_var('office'));
+                $activity->set_state($new_state);
+                $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_contact_person_2_address(phpgw::get_var('contact_person_2_address'));
+                
$activity->set_contact_person_2_zip(phpgw::get_var('contact_person_2_zip'));
+                
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+
+                $target_ok = false;
+                $district_ok = false;
+                                                               if($new_state 
!= 5)
+                                                               {
+                                                                       
$target_ok = true;
+                                                                       
$district_ok = true;
+                                                               }
+                                                               else
+                                                               {
+                                                                       
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
+                    {
+                        if($new_group)
+                        {
+                            //transfer group to booking
+                            $group_array = $this->so_group->get(null, null, 
null, null, null, null, array('group_id' => $activity->get_group_id(), 
'new_groups' => 'true'));
+                            if(count($group_array) > 0){
+                                $keys = array_keys($group_array);
+                                $group = $group_array[$keys[0]];
+                            } 
+
+                            $group_info = array();
+                            $group_info['name'] = $group->get_name(); //new
+                            $group_info['organization_id'] = 
$activity->get_organization_id(); 
+                            $group_info['description'] = 
$group->get_description();
+
+                            $contacts = 
$this->so_contact->get_local_contact_persons($group->get_id(), true);
+                            $contact_1 = $contacts[0];
+
+                            $new_group_id = 
$this->so_group->transfer_group($group_info);
+                            if($new_group_id)
+                            {
+                                //update activity with new org id
+                                //add contact persons to booking
+                                $contact1 = array();
+                                $contact1['name'] = $contact_1->get_name();
+                                $contact1['phone'] = $contact_1->get_phone();
+                                $contact1['mail'] = $contact_1->get_email();
+                                $contact1['group_id'] = $new_group_id;
+                                
$this->so_activity->add_contact_person_group($contact1);
+
+                                $message = lang('messages_saved_form');        
+
+                                //get organization_id for the group:
+                                $group_org_id = 
$this->so_group->get_orgid_from_group($new_group_id);
+
+                                //get affected activities and update with new 
org id
+                                $update_activities = 
$this->so_activity->get_activities_for_update($group->get_id(), true);
+
+                                foreach($update_activities as $act_id)
+                                {
+                                    $act = 
$this->so_activity->get_single($act_id);
+                                    $act->set_organization_id($group_org_id);
+                                    $act->set_group_id($new_group_id);
+                                    $act->set_new_org(false);
+                                    $act->set_new_group(false);
+                                    $this->so_activity->store($act);
+                                }
+
+                                //set local group as stored
+                                $group->set_change_type('added');
+                                $group->set_transferred(true);
+
+                                $this->so_group->update_local($group);
+                                $message = lang('messages_saved_form');
+                                //var_dump($new_group_id);
+                                $contact_persons = 
$this->so_contact->get_booking_contact_persons($new_group_id, true);
+                                //var_dump(2);
+                                $cp1 = $contact_persons[0];
+                            }
+                        }
+                        $message = lang('messages_saved_form');        
+                    }
+                    else
+                    {
+                        $error = lang('messages_form_error');
+                    }
+
+                    $activity = $this->so_activity->get_single($activity_id);
+
+                    if($old_state != $new_state && ($new_state == 3 || 
$new_state == 5))
+                    {
+                        $kontor = 
$this->so_activity->get_office_name($activity->get_office());
+                        $subject = lang('mail_subject_update');
+                        $body = lang('mail_body_state_' . $new_state, 
$activity->get_title(), $kontor);
+
+                        if($activity->get_group_id() && 
$activity->get_group_id() > 0)
+                        {
+                            
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
+                            
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),$subject,$body);
+                        }
+                        else if ($activity->get_organization_id() && 
$activity->get_organization_id() > 0)
+                        {
+                            
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
+                            
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),$subject,$body);
+                        }   
+                    }
+                    $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.view', 'id' => 
$activity->get_id(), 'saved_ok' => 'yes'));
+                }
+                else
+                {
+                    if(!$target_ok)
+                    {
+                        $error .= "<br/>" . lang('target_not_selected');
+                    }
+                    if(!$district_ok)
+                    {
+                        $error .= "<br/>" . lang('district_not_selected');
+                    }
+                    return $this->render('activity.php', array
+                            (
+                                'activity'     => $activity,
+                                'organizations' => $organizations,
+                                'org_name' => $org_name,
+                                'groups' => $groups,
+                                'local_group' => $local_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')
+                            )  
+                    );
+                }
+            }
+        }
+        $editable = true;
+        if($activity->get_new_org())
+        {
+            $error = lang('org_not_transferred');
+            $editable = false;
+        }
+        //var_dump($local_group);
+
+        return $this->render('activity.php', array
+                (
+                    'activity'         => $activity,
+                    'organizations' => $organizations,
+                    'org_name' => $org_name,
+                    'groups' => $groups,
+                    'local_group' => $local_group,
+                    'arenas' => $arenas,
+                    'buildings' => $buildings,
+                    'categories' => $categories,
+                    'targets' => $targets,
+                    'districts' => $districts,
+                    'offices' => $offices,
+                    'editable' => $editable,
+                    'cancel_link' => $cancel_link,
+                    'message' => isset($message) ? $message : 
phpgw::get_var('message'),
+                    'error' => isset($error) ? $error : phpgw::get_var('error')
+                )      
+        );
+    }
+
+    public function query()
+    {
+        
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+        {
+            $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+        }
+        else {
+            $user_rows_per_page = 10;
+        }
+        // YUI variables for paging and sorting
+        $start_index   = phpgw::get_var('startIndex', 'int');
+        $num_of_objects        = phpgw::get_var('results', 'int', 'GET', 
$user_rows_per_page);
+        $sort_field            = phpgw::get_var('sort');
+        $sort_ascending        = phpgw::get_var('dir') == 'desc' ? false : 
true;
+        // Form variables
+        $search_for    = phpgw::get_var('query');
+        $search_type   = phpgw::get_var('search_option');
+        // Create an empty result set
+        $result_objects = array();
+        $result_count = 0;
+        //Retrieve the type of query and perform type specific logic
+        $query_type = phpgw::get_var('type');
+
+        $exp_param     = phpgw::get_var('export');
+        $export = false;
+        if(isset($exp_param)){
+            $export=true;
+            $num_of_objects = null;
+        }
+
+        $email_param = phpgw::get_var('email');
+        $email = false;
+        if(isset($email_param)){
+            $email=true;
+        }
+
+        $uid = $GLOBALS['phpgw_info']['user']['account_id'];
+
+        switch($query_type)
+        {
+            case 'new_activities':
+                $filters = array('new_activities' => 'yes', 'activity_state' 
=> phpgw::get_var('activity_state'), 'activity_category' => 
phpgw::get_var('activity_category'), 'activity_district' => 
phpgw::get_var('activity_district'), 'user_id' => $uid, 'updated_date_hidden' 
=> phpgw::get_var('date_change_hidden'));
+                $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;
+            case 'all_activities':
+            default:
+                $filters = array('activity_state' => 
phpgw::get_var('activity_state'), 'activity_category' => 
phpgw::get_var('activity_category'), 'activity_district' => 
phpgw::get_var('activity_district'), 'user_id' => $uid, 'updated_date_hidden' 
=> phpgw::get_var('date_change_hidden'));
+                $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;
+        }                                                                      
                                                                                
                                     
+
+        //Create an empty row set
+        $rows = array();
+        $mail_rows = array();
+        foreach($result_objects as $result) {
+//          var_dump($result);
+            if(isset($result))
+            {
+                            // ... add a serialized result
                 if($export)
                 {
                     $rows[] = $result->serialize_for_export();
@@ -451,131 +439,131 @@
                     $rows[] = $result->serialize();
                 }
                 $mail_rows[] = $result;
-                       }
-               }
-               
-               // ... add result data
-               $result_data = array('results' => $rows, 'total_records' => 
$object_count);
-               
-               if(!$export && !$email){
-                       //Add action column to each row in result table
-                       array_walk($result_data['results'], array($this, 
'add_actions'), array($query_type));
-               }
-               if($email)
-               {
-                       //var_dump($mail_rows);
-                       $this->send_email_to_selection($mail_rows);     
-               }
-               else
-               {
-                       return $this->yui_results($result_data, 
'total_records', 'results');
-               }
-       }
-               
-       /**
-        * Add action links and labels for the context menu of the list items
-        *
-        * @param $value pointer to
-        * @param $key ?
-        * @param $params [composite_id, type of query, editable]
-        */
-       public function add_actions(&$value, $key, $params)
-       {
-               //Defining new columns
-               $value['ajax'] = array();
-               $value['actions'] = array();
-               $value['labels'] = array();
+            }
+        }
 
-               $query_type = $params[0];
-               
-               switch($query_type)
-               {
-                       case 'all_activities':
-                               $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $value['id'])));
-                               $value['labels'][] = lang('edit');
-                               $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $value['id'])));
-                               $value['labels'][] = lang('show');
-                               $value['ajax'][] = true;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.send_mail', 'activity_id' => 
$value['id'],'message_type' => 'update')));
-                               $value['labels'][] = lang('send_mail');
-                               break;
-                       
-                       case 'new_activities':
-                               $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $value['id'])));
-                               $value['labels'][] = lang('edit');
-                               $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $value['id'])));
-                               $value['labels'][] = lang('show');
-                               $value['ajax'][] = true;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.send_mail', 'activity_id' => 
$value['id'],'message_type' => 'update')));
-                               $value['labels'][] = lang('send_mail');
-                               break;
-               }
+        // ... add result data
+        $result_data = array('results' => $rows, 'total_records' => 
$object_count);
+
+        if(!$export && !$email){
+            //Add action column to each row in result table
+            array_walk($result_data['results'], array($this, 'add_actions'), 
array($query_type));
+        }
+        if($email)
+        {
+            //var_dump($mail_rows);
+            $this->send_email_to_selection($mail_rows);        
+        }
+        else
+        {
+            return $this->yui_results($result_data, 'total_records', 
'results');
+        }
     }
+
+    /**
+     * Add action links and labels for the context menu of the list items
+     *
+     * @param $value pointer to
+     * @param $key ?
+     * @param $params [composite_id, type of query, editable]
+     */
+    public function add_actions(&$value, $key, $params)
+    {
+        //Defining new columns
+        $value['ajax'] = array();
+        $value['actions'] = array();
+        $value['labels'] = array();
+
+        $query_type = $params[0];
+
+        switch($query_type)
+        {
+            case 'all_activities':
+                $value['ajax'][] = false;
+                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $value['id'])));
+                $value['labels'][] = lang('edit');
+                $value['ajax'][] = false;
+                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $value['id'])));
+                $value['labels'][] = lang('show');
+                $value['ajax'][] = true;
+                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.send_mail', 'activity_id' => 
$value['id'],'message_type' => 'update')));
+                $value['labels'][] = lang('send_mail');
+                break;
+
+            case 'new_activities':
+                $value['ajax'][] = false;
+                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $value['id'])));
+                $value['labels'][] = lang('edit');
+                $value['ajax'][] = false;
+                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $value['id'])));
+                $value['labels'][] = lang('show');
+                $value['ajax'][] = true;
+                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiactivities.send_mail', 'activity_id' => 
$value['id'],'message_type' => 'update')));
+                $value['labels'][] = lang('send_mail');
+                break;
+        }
+    }
     
     function send_email_to_selection($activities)
     {
         $c = createobject('phpgwapi.config','activitycalendarfrontend');
-               $c->read();
-               $config = $c->config_data;
-               
-               $mailBaseURL = $c->config_data['mailBaseURL'];
+        $c->read();
+        $config = $c->config_data;
+
+        $mailBaseURL = $c->config_data['mailBaseURL'];
        foreach($activities as $activity)
        {
-               //$activity = 
activitycalendar_soactivity::get_instance()->get_single($activity_id);
-               $subject = lang('mail_subject_update');
-               //$link_text = "<a 
href='http://www.bergen.kommune.no/aktivby/registreringsskjema/ny/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
-               //$link_text = "<a 
href='{$mailBaseURL}?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
-               $link_text = "<a 
href='http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
-                $office_name = 
activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
-                /*
-                $uid = $GLOBALS['phpgw_info']['user']['account_id'];
-               $user_office_id =  
activitycalendar_soactivity::get_instance()->get_office_from_user($uid);
-                $office_footer = 
activitycalendar_soactivity::get_instance()->get_office_description($user_office_id);
-                 */
-                $office_id = $activity->get_office();
-                if($office_id == 1)
-                    $office_id_new = 2;
-                else if($office_id == 2)
-                    $office_id_new = 1;
-                else
-                    $office_id_new = (int)$office_id;
-                $office_footer = 
activitycalendar_soactivity::get_instance()->get_office_description($office_id_new);
-               if($activity->get_state() == 2)
-               {
-                       $body = lang('mail_body_update_frontend', 
$activity->get_title(), $link_text, $office_footer, $office_name);
-               }
-               else
-               {
-                       $body = lang('mail_body_update', 
$activity->get_title(), $link_text, $office_footer, $office_name);
-               }
-               
-               //var_dump($subject);
-               //var_dump($body);
-               //var_dump($activity->get_organization_id() . " ; " . 
$activity->get_group_id());
-               
-               if($activity->get_group_id() && $activity->get_group_id() > 0)
-               {
-                       
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
+            //$activity = 
activitycalendar_soactivity::get_instance()->get_single($activity_id);
+            $subject = lang('mail_subject_update');
+            //$link_text = "<a 
href='http://www.bergen.kommune.no/aktivby/registreringsskjema/ny/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
+            //$link_text = "<a 
href='{$mailBaseURL}?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
+            $link_text = "<a 
href='http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
+            $office_name = 
activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
+            /*
+            $uid = $GLOBALS['phpgw_info']['user']['account_id'];
+            $user_office_id =  
activitycalendar_soactivity::get_instance()->get_office_from_user($uid);
+            $office_footer = 
activitycalendar_soactivity::get_instance()->get_office_description($user_office_id);
+             */
+            $office_id = $activity->get_office();
+            if($office_id == 1)
+                $office_id_new = 2;
+            else if($office_id == 2)
+                $office_id_new = 1;
+            else
+                $office_id_new = (int)$office_id;
+            $office_footer = 
activitycalendar_soactivity::get_instance()->get_office_description($office_id_new);
+            if($activity->get_state() == 2)
+            {
+                $body = lang('mail_body_update_frontend', 
$activity->get_title(), $link_text, $office_footer, $office_name);
+            }
+            else
+            {
+                $body = lang('mail_body_update', $activity->get_title(), 
$link_text, $office_footer, $office_name);
+            }
+
+            //var_dump($subject);
+            //var_dump($body);
+            //var_dump($activity->get_organization_id() . " ; " . 
$activity->get_group_id());
+
+            if($activity->get_group_id() && $activity->get_group_id() > 0)
+            {
+                
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
 /*                     if($activity->get_contact_person_2() && 
$activity->get_contact_person_2()->get_email())
-                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),
 $subject, $body);
-                       else*/ 
-                       if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
-                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),
 $subject, $body);
-               }
-               else if($activity->get_organization_id() && 
$activity->get_organization_id() > 0)
-               {
-                       
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
+                        
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),
 $subject, $body);
+                else*/ 
+                if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
+                    
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),
 $subject, $body);
+            }
+            else if($activity->get_organization_id() && 
$activity->get_organization_id() > 0)
+            {
+                
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
 /*                     if($activity->get_contact_person_2() && 
$activity->get_contact_person_2()->get_email())
-                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),
 $subject, $body);
-                       else*/ 
-                       if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
-                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),
 $subject, $body);
-               }
-           }
+                        
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),
 $subject, $body);
+                else*/ 
+                if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
+                    
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),
 $subject, $body);
+            }
+        }
        
        //$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.index', 'message' => 'E-post sendt'));
        
@@ -584,37 +572,37 @@
     public function send_mail()
     {
         $c = createobject('phpgwapi.config','activitycalendarfrontend');
-               $c->read();
-               $config = $c->config_data;
+        $c->read();
+        $config = $c->config_data;
                
-               $mailBaseURL = $c->config_data['mailBaseURL'];
+        $mailBaseURL = $c->config_data['mailBaseURL'];
        $activity_id = (int)phpgw::get_var('activity_id');
        $activity = 
activitycalendar_soactivity::get_instance()->get_single($activity_id);
        
        $message_type = phpgw::get_var('message_type');
        if($message_type)
        {
-               //$subject = lang('mail_subject_update', $avtivity->get_id() . 
'-' . $activity->get_title(), $activity->get_link());
-               $subject = lang('mail_subject_update');
-               //$link_text = 
"http://www.bergen.kommune.no/aktivby/registreringsskjema/ny/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
-               //$link_text = 
"{$mailBaseURL}?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
-               //$link_text = 
"http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
-               $link_text = "<a 
href='http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
-               $office_name = 
activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
-                $office_id = $activity->get_office();
-                if($office_id == 1)
-                    $office_id_new = 2;
-                else if($office_id == 2)
-                    $office_id_new = 1;
-                else
-                    $office_id_new = (int)$office_id;
-                $office_footer = 
activitycalendar_soactivity::get_instance()->get_office_description($office_id_new);
-               $body = lang('mail_body_update', $activity->get_title(), 
$link_text, $office_footer, $office_name);
+            //$subject = lang('mail_subject_update', $avtivity->get_id() . '-' 
. $activity->get_title(), $activity->get_link());
+            $subject = lang('mail_subject_update');
+            //$link_text = 
"http://www.bergen.kommune.no/aktivby/registreringsskjema/ny/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
+            //$link_text = 
"{$mailBaseURL}?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
+            //$link_text = 
"http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
+            $link_text = "<a 
href='http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger
 opplysninger for {$activity->get_title()}</a>";
+            $office_name = 
activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
+            $office_id = $activity->get_office();
+            if($office_id == 1)
+                $office_id_new = 2;
+            else if($office_id == 2)
+                $office_id_new = 1;
+            else
+                $office_id_new = (int)$office_id;
+            $office_footer = 
activitycalendar_soactivity::get_instance()->get_office_description($office_id_new);
+            $body = lang('mail_body_update', $activity->get_title(), 
$link_text, $office_footer, $office_name);
        }
        else
        {
-               $subject = "dette er en test";
-               $body = "testmelding fra Aktivitetsoversikt";
+            $subject = "dette er en test";
+            $body = "testmelding fra Aktivitetsoversikt";
        }
        
 //     var_dump($subject);
@@ -623,189 +611,190 @@
        
        if($activity->get_group_id() && $activity->get_group_id() > 0)
        {
-               //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_group_contact2($activity>get_group_id());
-               
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
+            //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_group_contact2($activity>get_group_id());
+            
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
 /*             if($activity->get_contact_person_2() && 
$activity->get_contact_person_2()->get_email())
-                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),
 $subject, $body);
-               else */
-               if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
-                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),
 $subject, $body);
+                    
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),
 $subject, $body);
+            else */
+            if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
+                
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),
 $subject, $body);
        }
        else if($activity->get_organization_id() && 
$activity->get_organization_id() > 0)
        {
-               //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_oup_contact2($activity>get_group_id());
-               
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
+            //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_oup_contact2($activity>get_group_id());
+            
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
 /*             if($activity->get_contact_person_2() && 
$activity->get_contact_person_2()->get_email())
-                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),
 $subject, $body);
-               else */
-               if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
-                       
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),
 $subject, $body);
+                            
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),
 $subject, $body);
+            else */
+            if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
+                
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),
 $subject, $body);
        }
        
        $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.index', 'message' => 'E-post sendt'));
        
     }
     
-       function send_mailnotification_to_organization($contact_person, 
$subject, $body)
-       {
-               
-               //var_dump($contact_person_id . ',' . $subject . ',' . $body);
-               if (!is_object($GLOBALS['phpgw']->send))
-               {
-                       $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
-               }
+    function send_mailnotification_to_organization($contact_person, $subject, 
$body)
+    {
 
-               $config = CreateObject('phpgwapi.config','booking');
-               $config->read();
-               $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
-               //$from = "address@hidden";
+        //var_dump($contact_person_id . ',' . $subject . ',' . $body);
+        if (!is_object($GLOBALS['phpgw']->send))
+        {
+            $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+        }
 
-               if (strlen(trim($body)) == 0) 
-               {
-                       return false;
-               }
-               
-               $mailtoAddress = 
activitycalendar_socontactperson::get_instance()->get_mailaddress_for_org_contact($contact_person->get_id());
-               //$mailtoAddress = "address@hidden";
-               
-               //var_dump($mailtoAddress);
-//var_dump($mailtoAddress.';'.$from.';'.$subject);
-               if (strlen($mailtoAddress) > 0) 
-               {
-                       try
-                       {
-                               //var_dump('inne i try');
+        $config        = CreateObject('phpgwapi.config','booking');
+        $config->read();
+        $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+        //$from = "address@hidden";
+
+        if (strlen(trim($body)) == 0) 
+        {
+            return false;
+        }
+
+        $mailtoAddress = 
activitycalendar_socontactperson::get_instance()->get_mailaddress_for_org_contact($contact_person->get_id());
+        //$mailtoAddress = "address@hidden";
+
+        //var_dump($mailtoAddress);
+        //var_dump($mailtoAddress.';'.$from.';'.$subject);
+        if (strlen($mailtoAddress) > 0) 
+        {
+            try
+            {
+                //var_dump('inne i try');
 //                             var_dump('inne i try - org;');
-                               $GLOBALS['phpgw']->send->msg('email', 
$mailtoAddress, $subject, $body, '', '', '', $from, '', 'html');
-                       }
-                       catch (phpmailerException $e)
-                       {
-                               if($e)
-                               {
-                                       $GLOBALS['phpgw']->log->error(array(
-                                               'text'  => 
'uiactivities::send_mailnotification_to_organization() : error when trying to 
execute %1. Error: %2',
-                                               'p1'    => 'send()',
-                                               'p2'    => $e->getMessage(),
-                                               'line'  => __LINE__,
-                                               'file'  => __FILE__
-                                       ));
-                               }
-                       }
-               }
-       }
+                $GLOBALS['phpgw']->send->msg('email', $mailtoAddress, 
$subject, $body, '', '', '', $from, '', 'html');
+            }
+            catch (phpmailerException $e)
+            {
+                if($e)
+                {
+                    $GLOBALS['phpgw']->log->error(array(
+                            'text'     => 
'uiactivities::send_mailnotification_to_organization() : error when trying to 
execute %1. Error: %2',
+                            'p1'       => 'send()',
+                            'p2'       => $e->getMessage(),
+                            'line'     => __LINE__,
+                            'file'     => __FILE__
+                    ));
+                }
+            }
+        }
+    }
     
-       function send_mailnotification_to_group($contact_person, $subject, 
$body)
-       {
-               if (!is_object($GLOBALS['phpgw']->send))
-               {
-                       $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
-               }
+    function send_mailnotification_to_group($contact_person, $subject, $body)
+    {
+        if (!is_object($GLOBALS['phpgw']->send))
+        {
+            $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+        }
 
-               $config = CreateObject('phpgwapi.config','booking');
-               $config->read();
-               $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
-               //$from = "address@hidden";
+        $config        = CreateObject('phpgwapi.config','booking');
+        $config->read();
+        $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+        //$from = "address@hidden";
 
-               if (strlen(trim($body)) == 0) 
-               {
-                       return false;
-               }
-               
-               $mailtoAddress = 
activitycalendar_socontactperson::get_instance()->get_mailaddress_for_group_contact($contact_person->get_id());
-               //$mailtoaddress = "address@hidden";
-//var_dump($mailtoAddress.';'.$from.';'.$subject);
-               if (strlen($mailtoAddress) > 0) 
-               {
-                       try
-                       {
-//                             var_dump('inne i try - group;');
-//                             $send->msg('email', $mailtoAddress, $subject, 
$body, '', '', '', $from, '', 'html');
-                               $GLOBALS['phpgw']->send->msg('email', 
$mailtoAddress, $subject, $body, '', '', '', $from, '', 'html');
-                       }
-                       catch (phpmailerException $e)
-                       {
-                               if($e)
-                               {
-                                       $GLOBALS['phpgw']->log->error(array(
-                                               'text'  => 
'uiactivities::send_mailnotification_to_group() : error when trying to execute 
%1. Error: %2',
-                                               'p1'    => 'send()',
-                                               'p2'    => $e->getMessage(),
-                                               'line'  => __LINE__,
-                                               'file'  => __FILE__
-                                       ));
-                               }
-                       }
-               }
-       }
+        if (strlen(trim($body)) == 0) 
+        {
+            return false;
+        }
+
+        $mailtoAddress = 
activitycalendar_socontactperson::get_instance()->get_mailaddress_for_group_contact($contact_person->get_id());
+        //$mailtoaddress = "address@hidden";
+        //var_dump($mailtoAddress.';'.$from.';'.$subject);
+        if (strlen($mailtoAddress) > 0) 
+        {
+            try
+            {
+//             var_dump('inne i try - group;');
+//             $send->msg('email', $mailtoAddress, $subject, $body, '', '', 
'', $from, '', 'html');
+                $GLOBALS['phpgw']->send->msg('email', $mailtoAddress, 
$subject, $body, '', '', '', $from, '', 'html');
+            }
+            catch (phpmailerException $e)
+            {
+                if($e)
+                {
+                    $GLOBALS['phpgw']->log->error(array(
+                            'text'     => 
'uiactivities::send_mailnotification_to_group() : error when trying to execute 
%1. Error: %2',
+                            'p1'       => 'send()',
+                            'p2'       => $e->getMessage(),
+                            'line'     => __LINE__,
+                            'file'     => __FILE__
+                    ));
+                }
+            }
+        }
+    }
        
-       public function get_organization_groups()
-       {
-               $GLOBALS['phpgw_info']['flags']['noheader'] = true; 
-               $GLOBALS['phpgw_info']['flags']['nofooter'] = true; 
-               $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
-               
-               $org_id = phpgw::get_var('orgid');
-               $group_id = phpgw::get_var('groupid');
-               $returnHTML = "<option value='0'>Ingen gruppe valgt</option>";
-               if($org_id)
-               {
-                       $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, array('org_id' => $org_id));
-                       foreach ($groups as $group) {
-                               if(isset($group))
-                               {
-                                       //$res_g = $group->serialize();
-                                       $selected = "";
-                                       if($group_id && $group_id > 0)
-                                       {
-                                               $gr_id = (int)$group_id; 
-                                               if($gr_id == 
(int)$group->get_id())
-                                               {
-                                                       $selected_group = " 
selected='selected'";
-                                               }
-                                                else
-                                                {
-                                                    $selected_group = "";
-                                                }
-                                       }
-                                       $group_html[] = "<option value='" . 
$group->get_id() . "'". $selected_group . ">" . $group->get_name() . 
"</option>";
-                               }
-                       }
-                   $html = implode(' ' , $group_html);
-                   $returnHTML = $returnHTML . ' ' . $html;
-               }
-               
-               
-               return $returnHTML;
-       }
-        
-        public function create_groups()
+    public function get_organization_groups()
+    {
+        $GLOBALS['phpgw_info']['flags']['noheader'] = true; 
+        $GLOBALS['phpgw_info']['flags']['nofooter'] = true; 
+        $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+        $org_id = phpgw::get_var('orgid');
+        $group_id = phpgw::get_var('groupid');
+        $returnHTML = "<option value='0'>Ingen gruppe valgt</option>";
+        if($org_id)
         {
-            $activities = $this->so_activity->get_activities_without_groups();
-            
-            foreach ($activities as $a)
+            $groups = activitycalendar_sogroup::get_instance()->get(null, 
null, null, null, null, null, array('org_id' => $org_id));
+            foreach ($groups as $group)
             {
-                $group_info = array();
-                $title_new = $a['title'];
-                    if(strlen($title_new) > 50)
-               {
-                       $title_new = substr($title_new,0,49);
-               }
-                $group_info['name'] = $title_new;
-                $group_info['organization_id'] =  $a['organization'];
-                $group_info['description'] = $a['description'];
-                
-                //add new group
-                $new_group_id = 
$this->so_group->add_new_group_from_activity($group_info);
-                var_dump("lagt til gruppen " . $group_info['name'] . " med id 
" . $new_group_id . "<br/>");
-                $this->so_activity->update_activity_group($a['id'], 
$new_group_id);
-                $cp = 
$this->so_contact->get_booking_contact_persons($a['organization']);
-                foreach ($cp as $c)
+                if(isset($group))
                 {
-                    $c->set_group_id($new_group_id);
-                    $contact_id = $this->so_contact->add_new_group_contact($c);
-                    var_dump("Lagt til kontaktperson " . $c->get_name() . " på 
gruppe " . $group_info['name'] . "<br/>");
-                    //_debug_array($c);
+                    //$res_g = $group->serialize();
+                    $selected = "";
+                    if($group_id && $group_id > 0)
+                    {
+                        $gr_id = (int)$group_id; 
+                        if($gr_id == (int)$group->get_id())
+                        {
+                            $selected_group = " selected='selected'";
+                        }
+                        else
+                        {
+                            $selected_group = "";
+                        }
+                    }
+                    $group_html[] = "<option value='" . $group->get_id() . 
"'". $selected_group . ">" . $group->get_name() . "</option>";
                 }
             }
+            $html = implode(' ' , $group_html);
+            $returnHTML = $returnHTML . ' ' . $html;
         }
+
+
+        return $returnHTML;
+    }
+        
+    public function create_groups()
+    {
+        $activities = $this->so_activity->get_activities_without_groups();
+
+        foreach ($activities as $a)
+        {
+            $group_info = array();
+            $title_new = $a['title'];
+            if(strlen($title_new) > 50)
+            {
+                $title_new = substr($title_new,0,49);
+            }
+            $group_info['name'] = $title_new;
+            $group_info['organization_id'] =  $a['organization'];
+            $group_info['description'] = $a['description'];
+
+            //add new group
+            $new_group_id = 
$this->so_group->add_new_group_from_activity($group_info);
+            var_dump("lagt til gruppen " . $group_info['name'] . " med id " . 
$new_group_id . "<br/>");
+            $this->so_activity->update_activity_group($a['id'], $new_group_id);
+            $cp = 
$this->so_contact->get_booking_contact_persons($a['organization']);
+            foreach ($cp as $c)
+            {
+                $c->set_group_id($new_group_id);
+                $contact_id = $this->so_contact->add_new_group_contact($c);
+                var_dump("Lagt til kontaktperson " . $c->get_name() . " på 
gruppe " . $group_info['name'] . "<br/>");
+                //_debug_array($c);
+            }
+        }
+    }
 }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/activitycalendar/templates/base/activity.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/templates/base/activity.php    
2012-09-04 07:05:05 UTC (rev 9963)
+++ branches/Version-1_0-branch/activitycalendar/templates/base/activity.php    
2012-09-04 09:31:03 UTC (rev 9964)
@@ -104,6 +104,10 @@
 
 function allOK()
 {
+       if(document.getElementById('state').value == 5)
+       {
+               return true;
+       }
        if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
        {
                alert("Tittel må fylles ut!");
@@ -132,6 +136,36 @@
                alert("Kategori må fylles ut!");
                return false;
        }
+       var malgrupper = document.getElementsByName('target[]');
+       var malgruppe_ok = false;
+       for(i=0;i<malgrupper.length;i++)
+       {
+               if(!malgruppe_ok)
+               {
+                       if(malgrupper[i].checked)
+                       {malgruppe_ok = true;}
+               }
+       }
+       if(!malgruppe_ok)
+       {
+               alert("Målgruppe må fylles ut!");
+               return false;
+       }
+       var distrikter = document.getElementsByName('district[]');
+               var distrikt_ok = false;
+               for(i=0;i<distrikter.length;i++)
+               {
+                       if(!distrikt_ok)
+                       {
+                               if(distrikter[i].checked)
+                               {distrikt_ok = true;}
+                       }
+               }
+               if(!distrikt_ok)
+               {
+                       alert("Bydel må fylles ut!");
+                       return false;
+               }
        if(document.getElementById('office').value == null || 
document.getElementById('office').value == 0)
        {
                alert("Hovedansvarlig kulturkontor må fylles ut!");
@@ -213,7 +247,7 @@
                                        {
                                                $selected_state = 
$activity->get_state();
                                        ?>
-                                               <select name="state">
+                                               <select name="state" id="state">
                                                        <option value="3" <?php 
echo ($selected_state == 3 ? 'selected="selected"' : "")?>><?php echo 
lang('published') ?></option>
                                                        <option value="5" <?php 
echo ($selected_state == 5 ? 'selected="selected"' : "")?>><?php echo 
lang('rejected') ?></option>
                                                        <option value="1" <?php 
echo ($selected_state == 1 ? 'selected="selected"' : "")?>><?php echo 
lang('new') ?></option>

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2012-09-04 07:05:05 UTC (rev 9963)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2012-09-04 09:31:03 UTC (rev 9964)
@@ -16,15 +16,15 @@
 
        private $so_organization;
        public $public_functions = array
-               (
-               'add' => true,
-               'edit' => true,
-               'view' => true,
-               'index' => true,
-               'get_organization_groups' => true,
-               'get_address_search' => true,
-               'edit_organization_values' => true,
-               'get_organization_activities' => true
+                       (
+                       'add' => true,
+                       'edit' => true,
+                       'view' => true,
+                       'index' => true,
+                       'get_organization_groups' => true,
+                       'get_address_search' => true,
+                       'edit_organization_values' => true,
+                       'get_organization_activities' => true
        );
 
        public function __construct() {
@@ -104,21 +104,21 @@
 
                                $this->render('activity_new.php', array
                                        (
-                                       'activity' => $activity,
-                                       'new_organization' => true,
-                                       'organization' => $organization,
-                                       'contact1' => $persons[0],
-                                       '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'),
-                                       'ajaxURL' => $ajaxUrl
-                                               )
+                                               'activity' => $activity,
+                                               'new_organization' => true,
+                                               'organization' => $organization,
+                                               'contact1' => $persons[0],
+                                               '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'),
+                                               'ajaxURL' => $ajaxUrl
+                                       )
                                );
                        } else {
                                $new_org = false;
@@ -135,22 +135,22 @@
                                $activity->set_contact_persons($pers);
 
                                $this->render('activity_new.php', array
-                                       (
-                                       'activity' => $activity,
-                                       'new_organization' => false,
-                                       'organization' => $organization,
-                                       'contact1' => $persons[0],
-                                       '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'),
-                                       'ajaxURL' => $ajaxUrl
-                                               )
+                                               (
+                                               'activity' => $activity,
+                                               'new_organization' => false,
+                                               'organization' => $organization,
+                                               'contact1' => $persons[0],
+                                               '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'),
+                                               'ajaxURL' => $ajaxUrl
+                                                               )
                                );
                        }
                } else if (isset($_POST['save_activity'])) {
@@ -304,21 +304,21 @@
                                $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
 
                                $this->render('activity.php', array
-                                       (
-                                       'activity' => $activity,
-                                       'organization' => $organization,
-                                       'group' => $group,
-                                       'contact1' => $persons[0],
-                                       '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'),
-                                       'ajaxURL' => $ajaxUrl
-                                               )
+                                               (
+                                               'activity' => $activity,
+                                               'organization' => $organization,
+                                               'group' => $group,
+                                               'contact1' => $persons[0],
+                                               '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'),
+                                               'ajaxURL' => $ajaxUrl
+                                                               )
                                );
                        } else {
                                if (!$target_ok) {
@@ -328,35 +328,35 @@
                                        $error .= "<br/>" . 
lang('district_not_selected');
                                }
                                return $this->render('activity_new.php', array
-                                                       (
-                                                       'activity' => $activity,
-                                                       'organizations' => 
$organizations,
-                                                       'organization' => 
$organization,
-                                                       'contact1' => 
$persons[0],
-                                                       'contact2' => 
$persons[1],
-                                                       'org_name' => $org_name,
-                                                       'new_org' => $new_org,
-                                                       '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'),
-                                                       'ajaxURL' => $ajaxUrl
-                                                               )
+                                                                               
(
+                                                                               
'activity' => $activity,
+                                                                               
'organizations' => $organizations,
+                                                                               
'organization' => $organization,
+                                                                               
'contact1' => $persons[0],
+                                                                               
'contact2' => $persons[1],
+                                                                               
'org_name' => $org_name,
+                                                                               
'new_org' => $new_org,
+                                                                               
'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'),
+                                                                               
'ajaxURL' => $ajaxUrl
+                                                                               
                )
                                );
                        }
                } else {
                        return $this->render('activity_new_step_1.php', array
-                                               (
-                                               'organizations' => 
$organizations,
-                                               'ajaxURL' => $ajaxUrl
-                                                       )
+                                                                       (
+                                                                       
'organizations' => $organizations,
+                                                                       
'ajaxURL' => $ajaxUrl
+                                                                               
        )
                        );
                }
        }
@@ -371,10 +371,10 @@
                }
 
                $data = array
-                       (
-                       'activity' => $activity,
-                       'errorMsgs' => $errorMsgs,
-                       'infoMsgs' => $infoMsgs
+                               (
+                               'activity' => $activity,
+                               'errorMsgs' => $errorMsgs,
+                               'infoMsgs' => $infoMsgs
                );
 
                $GLOBALS['phpgw_info']['flags']['noframework'] = true;
@@ -413,11 +413,11 @@
                        $this->send_email_to_selection(array($activity));
                        $message = lang('update_request_sent', 
$activity->get_title(), $org->get_name());
                        return $this->render('activity_edit_step_1.php', array
-                                               (
-                                               'activities' => $activities,
-                                               'message' => $message,
-                                               'ajaxURL' => $ajaxUrl
-                                                       )
+                                                                       (
+                                                                       
'activities' => $activities,
+                                                                       
'message' => $message,
+                                                                       
'ajaxURL' => $ajaxUrl
+                                                                               
        )
                        );
                        //}
                } else {
@@ -427,21 +427,21 @@
                                $activities = $this->so_activity->get(null, 
null, 'title', true, null, null, array('activity_state' => 3));
                                $organizations = 
$this->so_organization->get(null, null, 'org.name', true, null, null, 
array('edit_from_frontend' => 'yes'));
                                return 
$this->render('activity_edit_step_1.php', array
-                                                       (
-                                                       'activities' => 
$activities,
-                                                       'organizations' => 
$organizations,
-                                                       'ajaxURL' => $ajaxUrl
-                                                               )
+                                                                               
(
+                                                                               
'activities' => $activities,
+                                                                               
'organizations' => $organizations,
+                                                                               
'ajaxURL' => $ajaxUrl
+                                                                               
                )
                                );
                        }
                        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
-                                                       (
-                                                       'activities' => 
$activities,
-                                                       'ajaxURL' => $ajaxUrl
-                                                               )
+                                                                               
(
+                                                                               
'activities' => $activities,
+                                                                               
'ajaxURL' => $ajaxUrl
+                                                                               
                )
                                );
                        } else {
                                // Retrieve the activity object or create a new 
one
@@ -450,10 +450,10 @@
                                } else {
                                        $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,
-                                                               'ajaxURL' => 
$ajaxUrl
-                                                                       )
+                                                                               
        (
+                                                                               
        'activities' => $activities,
+                                                                               
        'ajaxURL' => $ajaxUrl
+                                                                               
                        )
                                        );
                                }
 
@@ -461,10 +461,10 @@
                                        //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,
-                                                               'ajaxURL' => 
$ajaxUrl
-                                                                       )
+                                                                               
        (
+                                                                               
        'activities' => $activities,
+                                                                               
        'ajaxURL' => $ajaxUrl
+                                                                               
                        )
                                        );
                                }
 
@@ -559,21 +559,21 @@
                                                        
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
                                                        
$this->render('activity.php', array
-                                                               (
-                                                               'activity' => 
$activity,
-                                                               'organization' 
=> $organization,
-                                                               'group' => 
$group,
-                                                               'contact1' => 
$persons_array_tmp[0],
-                                                               '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'),
-                                                               'ajaxURL' => 
$ajaxUrl
-                                                                       )
+                                                                       (
+                                                                       
'activity' => $activity,
+                                                                       
'organization' => $organization,
+                                                                       'group' 
=> $group,
+                                                                       
'contact1' => $persons_array_tmp[0],
+                                                                       
'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'),
+                                                                       
'ajaxURL' => $ajaxUrl
+                                                                               
        )
                                                        );
                                                } else {
                                                        if (!$target_ok) {
@@ -583,24 +583,24 @@
                                                                $error .= 
"<br/>" . lang('district_not_selected');
                                                        }
                                                        return 
$this->render('activity_edit.php', array
-                                                                               
(
-                                                                               
'activity' => $activity,
-                                                                               
'organization' => $organization,
-                                                                               
'contact1' => $persons_array[0],
-                                                                               
'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'),
-                                                                               
'ajaxURL' => $ajaxUrl
-                                                                               
        )
+                                                                               
                        (
+                                                                               
                        'activity' => $activity,
+                                                                               
                        'organization' => $organization,
+                                                                               
                        'contact1' => $persons_array[0],
+                                                                               
                        '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'),
+                                                                               
                        'ajaxURL' => $ajaxUrl
+                                                                               
                                        )
                                                        );
                                                }
                                        }
@@ -608,22 +608,22 @@
                                        
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
                                        $this->render('activity_edit.php', array
-                                               (
-                                               'activity' => $activity,
-                                               'organization' => $organization,
-                                               'group' => $group,
-                                               'contact1' => $persons_array[0],
-                                               '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'),
-                                               'ajaxURL' => $ajaxUrl
-                                                       )
+                                                       (
+                                                       'activity' => $activity,
+                                                       'organization' => 
$organization,
+                                                       'group' => $group,
+                                                       'contact1' => 
$persons_array[0],
+                                                       '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'),
+                                                       'ajaxURL' => $ajaxUrl
+                                                                       )
                                        );
                                } else if (isset($_POST['activity_ok'])) { // 
The user has pressed the save button
                                        if (isset($activity)) { // If an 
activity object is created
@@ -635,6 +635,27 @@
                                                
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
                                                $this->render('activity.php', 
array
+                                                               (
+                                                               'activity' => 
$activity,
+                                                               'organization' 
=> $organization,
+                                                               'group' => 
$group,
+                                                               'contact1' => 
$persons_array[0],
+                                                               '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'),
+                                                               'ajaxURL' => 
$ajaxUrl
+                                                                               
)
+                                               );
+                                       }
+                               } else {
+                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+                                       $this->render('activity.php', array
                                                        (
                                                        'activity' => $activity,
                                                        'organization' => 
$organization,
@@ -646,33 +667,12 @@
                                                        'targets' => $targets,
                                                        'districts' => 
$districts,
                                                        'offices' => $offices,
+                                                       'editable' => false,
+                                                       'change_request' => 
true,
                                                        'message' => 
isset($message) ? $message : phpgw::get_var('message'),
                                                        'error' => 
isset($error) ? $error : phpgw::get_var('error'),
                                                        'ajaxURL' => $ajaxUrl
-                                                               )
-                                               );
-                                       }
-                               } else {
-                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                                       $this->render('activity.php', array
-                                               (
-                                               'activity' => $activity,
-                                               'organization' => $organization,
-                                               'group' => $group,
-                                               'contact1' => $persons_array[0],
-                                               'arenas' => $arenas,
-                                               'buildings' => $buildings,
-                                               'categories' => $categories,
-                                               'targets' => $targets,
-                                               'districts' => $districts,
-                                               'offices' => $offices,
-                                               'editable' => false,
-                                               'change_request' => true,
-                                               'message' => isset($message) ? 
$message : phpgw::get_var('message'),
-                                               'error' => isset($error) ? 
$error : phpgw::get_var('error'),
-                                               'ajaxURL' => $ajaxUrl
-                                                       )
+                                                                       )
                                        );
                                }
                        }
@@ -731,9 +731,13 @@
                        if (isset($_POST['save_org'])) { //save updated 
organization info
                                $organization = 
$this->so_organization->get_single($org_id);
 
+                               $org_homepage = phpgw::get_var('homepage');
+                               if ($org_homepage == 'http://') {
+                                       $org_homepage = "";
+                               }
                                $org_info['name'] = phpgw::get_var('orgname');
                                $org_info['orgnr'] = phpgw::get_var('orgno');
-                               $org_info['homepage'] = 
phpgw::get_var('homepage');
+                               $org_info['homepage'] = $org_homepage;
                                $org_info['street'] = phpgw::get_var('address');
                                $org_info['streetnumber'] = 
phpgw::get_var('number');
                                $org_info['zip'] = phpgw::get_var('postzip');
@@ -755,10 +759,10 @@
                                $message = lang('change_request_ok', 
$org_info['name']);
 
                                $this->render('organization_reciept.php', array
-                                       (
-                                       'message' => isset($message) ? $message 
: phpgw::get_var('message'),
-                                       'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                                               )
+                                               (
+                                               'message' => isset($message) ? 
$message : phpgw::get_var('message'),
+                                               'error' => isset($error) ? 
$error : phpgw::get_var('error')
+                                                               )
                                );
                        } else {
                                $c = createobject('phpgwapi.config', 
'activitycalendarfrontend');
@@ -773,14 +777,14 @@
                                }
 
                                $this->render('organization_edit.php', array
-                                       (
-                                       'organization' => $organization,
-                                       'contact1' => $persons[0],
-                                       'editable' => true,
-                                       'message' => isset($message) ? $message 
: phpgw::get_var('message'),
-                                       'error' => isset($error) ? $error : 
phpgw::get_var('error'),
-                                       'ajaxURL' => $ajaxUrl
-                                               )
+                                               (
+                                               'organization' => $organization,
+                                               'contact1' => $persons[0],
+                                               'editable' => true,
+                                               'message' => isset($message) ? 
$message : phpgw::get_var('message'),
+                                               'error' => isset($error) ? 
$error : phpgw::get_var('error'),
+                                               'ajaxURL' => $ajaxUrl
+                                                               )
                                );
                        }
                }
@@ -819,10 +823,10 @@
                                $message = lang('change_request_ok', 
$group_info['name']);
 
                                $this->render('group_reciept.php', array
-                                       (
-                                       'message' => isset($message) ? $message 
: phpgw::get_var('message'),
-                                       'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                                               )
+                                               (
+                                               'message' => isset($message) ? 
$message : phpgw::get_var('message'),
+                                               'error' => isset($error) ? 
$error : phpgw::get_var('error')
+                                                               )
                                );
                        } else {
                                $group = $this->so_group->get_single($group_id);
@@ -832,14 +836,14 @@
                                }
 
                                $this->render('group_edit.php', array
-                                       (
-                                       'group' => $group,
-                                       'contact1' => $persons[0],
-                                       'contact2' => $persons[1],
-                                       'editable' => true,
-                                       'message' => isset($message) ? $message 
: phpgw::get_var('message'),
-                                       'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                                               )
+                                               (
+                                               'group' => $group,
+                                               'contact1' => $persons[0],
+                                               'contact2' => $persons[1],
+                                               'editable' => true,
+                                               'message' => isset($message) ? 
$message : phpgw::get_var('message'),
+                                               'error' => isset($error) ? 
$error : phpgw::get_var('error')
+                                                               )
                                );
                        }
                }

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
   2012-09-04 07:05:05 UTC (rev 9963)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/organization_edit.php
   2012-09-04 09:31:03 UTC (rev 9964)
@@ -142,7 +142,7 @@
                                        <DD><INPUT name="org_contact2_mail" 
id="org_contact2_mail" size="50" type="text" value="<?php echo isset($contact1) 
? $contact1->get_email() : '' ?>"></DD>
                                </DIV>
                                <div class="form-buttons">
-                                       <input type="submit" name="save_org" 
value="<?php echo lang('send_change_request') ?>"/>
+                                       <input type="submit" name="save_org" 
value="<?php echo lang('send_change_request') ?>" onclick="return isOK();"/>
                                </div>
                        </dl>
                </form>

Modified: branches/Version-1_0-branch/login.php
===================================================================
--- branches/Version-1_0-branch/login.php       2012-09-04 07:05:05 UTC (rev 
9963)
+++ branches/Version-1_0-branch/login.php       2012-09-04 09:31:03 UTC (rev 
9964)
@@ -1,32 +1,32 @@
 <?php
+
        /**
-       * phpGroupWare
-       *
-       * phpgroupware base
-       * @author Dan Kuykendall <address@hidden>
-       * @author Joseph Engo <address@hidden>
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package phpgroupware
-       * @version $Id$
-       */
-
-       if(isset($_REQUEST['skip_remote']) && $_REQUEST['skip_remote'])
+        * phpGroupWare
+        *
+        * phpgroupware base
+        * @author Dan Kuykendall <address@hidden>
+        * @author Joseph Engo <address@hidden>
+        * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package phpgroupware
+        * @version $Id$
+        */
+       if (isset($_REQUEST['skip_remote']) && $_REQUEST['skip_remote'])
        {
                $GLOBALS['phpgw_remote_user_fallback'] = 'sql';
        }
 
-       if(isset($_GET['logout']) && $_GET['logout']) // In case a user logged 
in via SSO - actively logs out
+       if (isset($_GET['logout']) && $_GET['logout']) // In case a user logged 
in via SSO - actively logs out
        {
-               $GLOBALS['phpgw_remote_user_fallback'] = 'sql'; 
-               $_REQUEST['skip_remote'] = true;
-       }        
-       $lightbox = isset($_REQUEST['lightbox']) && $_REQUEST['lightbox'] ? 
true : false;
+               $GLOBALS['phpgw_remote_user_fallback']   = 'sql';
+               $_REQUEST['skip_remote']                                 = true;
+       }
+       $lightbox                                                               
 = isset($_REQUEST['lightbox']) && $_REQUEST['lightbox'] ? true : false;
        require_once 'phpgwapi/inc/sso/include_login.inc.php';
 
-       $partial_url = 'login.php';
-       $phpgw_url_for_sso = 'phpgwapi/inc/sso/login_server.php';
-       if(isset($GLOBALS['phpgw_remote_user']) && 
!empty($GLOBALS['phpgw_remote_user']))
+       $partial_url             = 'login.php';
+       $phpgw_url_for_sso       = 'phpgwapi/inc/sso/login_server.php';
+       if (isset($GLOBALS['phpgw_remote_user']) && 
!empty($GLOBALS['phpgw_remote_user']))
        {
                $partial_url = 'phpgwapi/inc/sso/login_server.php';
        }
@@ -34,68 +34,68 @@
        /* Program starts here */
        $uilogin = new phpgw_uilogin($tmpl, 
$GLOBALS['phpgw_info']['server']['auth_type'] == 'remoteuser' && 
!isset($GLOBALS['phpgw_remote_user']));
 
-       if($GLOBALS['phpgw_info']['server']['auth_type'] == 'remoteuser' && 
isset($GLOBALS['phpgw_info']['server']['mapping']) && 
!empty($GLOBALS['phpgw_info']['server']['mapping']) && 
isset($_SERVER['REMOTE_USER']))
+       if ($GLOBALS['phpgw_info']['server']['auth_type'] == 'remoteuser' && 
isset($GLOBALS['phpgw_info']['server']['mapping']) && 
!empty($GLOBALS['phpgw_info']['server']['mapping']) && 
isset($_SERVER['REMOTE_USER']))
        {
                $login = 
$GLOBALS['phpgw']->mapping->get_mapping($_SERVER['REMOTE_USER']);
-               if($login == '') // mapping failed
+               if ($login == '') // mapping failed
                {
-                       
if(isset($GLOBALS['phpgw_info']['server']['auto_create_acct']) && 
$GLOBALS['phpgw_info']['server']['auto_create_acct'] == true)
+                       if 
(isset($GLOBALS['phpgw_info']['server']['auto_create_acct']) && 
$GLOBALS['phpgw_info']['server']['auto_create_acct'] == true)
                        {
                                // Redirection to create the new account :
                                
$GLOBALS['phpgw']->redirect_link('/phpgwapi/inc/sso/create_account.php');
                        }
-                       else if($GLOBALS['phpgw_info']['server']['mapping'] == 
'table' || $GLOBALS['phpgw_info']['server']['mapping'] == 'all')
+                       else if ($GLOBALS['phpgw_info']['server']['mapping'] == 
'table' || $GLOBALS['phpgw_info']['server']['mapping'] == 'all')
                        {
                                // Redirection to create a new mapping :
                                
$GLOBALS['phpgw']->redirect_link('/phpgwapi/inc/sso/create_mapping.php');
                        }
-                       else if(!(isset($_GET['cd']) && $_GET['cd'] !='0'))
+                       else if (!(isset($_GET['cd']) && $_GET['cd'] != '0'))
                        {
                                // An error occurs, bailed out
-                               $GLOBALS['phpgw']->redirect_link('/'. 
$partial_url, array('cd' => '20'));
+                               $GLOBALS['phpgw']->redirect_link('/' . 
$partial_url, array('cd' => '20'));
                        }
                }
-               $passwd = $login;
-               if(!(isset($_GET['cd']) && $_GET['cd'] !='0'))
+               $passwd  = $login;
+               if (!(isset($_GET['cd']) && $_GET['cd'] != '0'))
                {
                        $_POST['submitit'] = true;
                }
        }
        else
        {
-               $login = phpgw::get_var('login', 'string', 'POST');
+               $login   = phpgw::get_var('login', 'string', 'POST');
                // remove entities to stop mangling
-               $passwd = html_entity_decode(phpgw::get_var('passwd', 'string', 
'POST'));
+               $passwd  = html_entity_decode(phpgw::get_var('passwd', 
'string', 'POST'));
        }
        if ($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && 
isset($_SERVER['PHP_AUTH_USER']))
        {
-               $submit = true;
-               $login  = $_SERVER['PHP_AUTH_USER'];
-               $passwd = $_SERVER['PHP_AUTH_PW'];
+               $submit  = true;
+               $login   = $_SERVER['PHP_AUTH_USER'];
+               $passwd  = $_SERVER['PHP_AUTH_PW'];
        }
-       
+
        if ($GLOBALS['phpgw_info']['server']['auth_type'] == 'ntlm' && 
isset($_SERVER['REMOTE_USER']) && (!isset($_REQUEST['skip_remote']) || 
!$_REQUEST['skip_remote']))
        {
-               $login  = $_SERVER['REMOTE_USER'];
-               $passwd = '';
+               $login   = $_SERVER['REMOTE_USER'];
+               $passwd  = '';
 
                $GLOBALS['hook_values'] = array
                (
-                       'account_lid'   => $login
+                       'account_lid' => $login
                );
 
-               
$GLOBALS['phpgw']->hooks->process('auto_addaccount',array('frontend'));
+               $GLOBALS['phpgw']->hooks->process('auto_addaccount', 
array('frontend'));
 
-//------------------Start login ntlm
+       //------------------Start login ntlm
 
                $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, $passwd);
 
-               if (! isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid'])
+               if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
                {
-                       $cd_array=array();
-                       if($GLOBALS['phpgw']->session->cd_reason)
+                       $cd_array = array();
+                       if ($GLOBALS['phpgw']->session->cd_reason)
                        {
-                               $cd_array['cd'] = 
$GLOBALS['phpgw']->session->cd_reason;
+                               $cd_array['cd']                  = 
$GLOBALS['phpgw']->session->cd_reason;
                        }
                        $cd_array['skip_remote'] = true;
 
@@ -104,28 +104,28 @@
                }
 
                $forward = phpgw::get_var('phpgw_forward');
-               if($forward)
+               if ($forward)
                {
-                       $extra_vars['phpgw_forward'] =  $forward;
-                       foreach($_GET as $name => $value)
+                       $extra_vars['phpgw_forward'] = $forward;
+                       foreach ($_GET as $name => $value)
                        {
-                               if (ereg('phpgw_',$name))
+                               if (ereg('phpgw_', $name))
                                {
-                                       $name = urlencode($name);
-                                       $extra_vars[$name] = urlencode($value);
+                                       $name                            = 
urlencode($name);
+                                       $extra_vars[$name]       = 
urlencode($value);
                                }
                        }
                }
-               if ( 
!isset($GLOBALS['phpgw_info']['server']['disable_autoload_langfiles']) || 
!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles'] )
+               if 
(!isset($GLOBALS['phpgw_info']['server']['disable_autoload_langfiles']) || 
!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles'])
                {
-//                     $uilogin->check_langs();
+       //                      $uilogin->check_langs();
                }
                $extra_vars['cd'] = 'yes';
-               
+
                $GLOBALS['phpgw']->hooks->process('login');
                $GLOBALS['phpgw']->redirect_link('/home.php', $extra_vars);
 
-//----------------- End login ntlm
+       //----------------- End login ntlm
        }
 
        # Apache + mod_ssl style SSL certificate authentication
@@ -135,11 +135,11 @@
                # an X.509 subject looks like:
                # 
/CN=john.doe/OU=Department/O=Company/C=xx/address@hidden/L=City/
                # the username is deliberately lowercase, to ease LDAP 
integration
-               $sslattribs = explode('/',$_SERVER['SSL_CLIENT_S_DN']);
+               $sslattribs      = explode('/', $_SERVER['SSL_CLIENT_S_DN']);
                # skip the part in front of the first '/' (nothing)
-               while ($sslattrib = next($sslattribs))
+               while ($sslattrib        = next($sslattribs))
                {
-                       list($key,$val) = explode('=',$sslattrib);
+                       list($key, $val) = explode('=', $sslattrib);
                        $sslattributes[$key] = $val;
                }
 
@@ -149,10 +149,11 @@
 
                        # login will be set here if the user logged out and 
uses a different username with
                        # the same SSL-certificate.
-                       if 
(!isset($_POST['login'])&&isset($sslattributes['Email'])) {
-                               $login = $sslattributes['Email'];
+                       if (!isset($_POST['login']) && 
isset($sslattributes['Email']))
+                       {
+                               $login   = $sslattributes['Email'];
                                # not checked against the database, but 
delivered to authentication module
-                               $passwd = $_SERVER['SSL_CLIENT_S_DN'];
+                               $passwd  = $_SERVER['SSL_CLIENT_S_DN'];
                        }
                }
                unset($key);
@@ -160,98 +161,98 @@
                unset($sslattributes);
        }
 
-       if ( (isset($_POST['submitit']) || isset($_POST['submit_x']) || 
isset($_POST['submit_y']) ) )
+       if ((isset($_POST['submitit']) || isset($_POST['submit_x']) || 
isset($_POST['submit_y'])))
        {
-               if ( $_SERVER['REQUEST_METHOD'] != 'POST' &&
-                  !isset($_SERVER['PHP_AUTH_USER']) &&
-                  !isset($_SERVER['REMOTE_USER']) &&
-                  !isset($_SERVER['SSL_CLIENT_S_DN'])
-                 )
+               if ($_SERVER['REQUEST_METHOD'] != 'POST' &&
+                               !isset($_SERVER['PHP_AUTH_USER']) &&
+                               !isset($_SERVER['REMOTE_USER']) &&
+                               !isset($_SERVER['SSL_CLIENT_S_DN'])
+               )
                {
-                       $GLOBALS['phpgw']->redirect_link('/'.$partial_url, 
array('cd' => '5'));
+                       $GLOBALS['phpgw']->redirect_link('/' . $partial_url, 
array('cd' => '5'));
                }
 
                $logindomain = phpgw::get_var('logindomain', 'string', 'POST');
-               if ( strstr($login,'#') === false && $logindomain )
+               if (strstr($login, '#') === false && $logindomain)
                {
                        $login .= "#{$logindomain}";
                }
 
                $receipt = array();
-               if ( isset($GLOBALS['phpgw_info']['server']['usecookies'])
-                       && $GLOBALS['phpgw_info']['server']['usecookies'] )
+               if (isset($GLOBALS['phpgw_info']['server']['usecookies'])
+                               && 
$GLOBALS['phpgw_info']['server']['usecookies'])
                {
-                       if(isset($_COOKIE['domain']) && $_COOKIE['domain'] != 
$logindomain)
+                       if (isset($_COOKIE['domain']) && $_COOKIE['domain'] != 
$logindomain)
                        {
                                
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
                                
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
-//                             
$GLOBALS['phpgw']->redirect_link("/{$partial_url}", array('cd' =>22)); // 
already within a session
-//                             exit;
+       //                              
$GLOBALS['phpgw']->redirect_link("/{$partial_url}", array('cd' =>22)); // 
already within a session
+       //                              exit;
 
-                               $receipt[] = lang('Info: you have changed 
domain from "%1" to "%2"' ,$_COOKIE['domain'],$logindomain);
+                               $receipt[] = lang('Info: you have changed 
domain from "%1" to "%2"', $_COOKIE['domain'], $logindomain);
                        }
                }
 
                $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, $passwd);
 
-               if (! isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid'])
+               if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
                {
-                       $cd_array=array();
-                       if($GLOBALS['phpgw']->session->cd_reason)
+                       $cd_array = array();
+                       if ($GLOBALS['phpgw']->session->cd_reason)
                        {
-                               $cd_array['cd'] = 
$GLOBALS['phpgw']->session->cd_reason;
+                               $cd_array['cd']                  = 
$GLOBALS['phpgw']->session->cd_reason;
                        }
                        $cd_array['skip_remote'] = true;
-                       $cd_array['lightbox'] = $lightbox;
+                       $cd_array['lightbox']    = $lightbox;
                        $GLOBALS['phpgw']->redirect_link("/{$partial_url}", 
$cd_array);
                        exit;
                }
 
-               if($receipt)
+               if ($receipt)
                {
                        phpgwapi_cache::message_set($receipt, 'message');
                }
 
                $forward = phpgw::get_var('phpgw_forward');
-               if($forward)
+               if ($forward)
                {
-                       $extra_vars['phpgw_forward'] =  $forward;
-                       foreach($_GET as $name => $value)
+                       $extra_vars['phpgw_forward'] = $forward;
+                       foreach ($_GET as $name => $value)
                        {
-                               if (ereg('phpgw_',$name))
+                               if (ereg('phpgw_', $name))
                                {
                                        //$extra_vars[$name] = $value;
-                                       $name = urlencode($name);
-                                       $extra_vars[$name] = urlencode($value);
+                                       $name                            = 
urlencode($name);
+                                       $extra_vars[$name]       = 
urlencode($value);
                                }
                        }
                }
-               if ( 
!isset($GLOBALS['phpgw_info']['server']['disable_autoload_langfiles']) || 
!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles'] )
+               if 
(!isset($GLOBALS['phpgw_info']['server']['disable_autoload_langfiles']) || 
!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles'])
                {
-//                     $uilogin->check_langs();
+       //                      $uilogin->check_langs();
                }
                $extra_vars['cd'] = 'yes';
-               
+
                $GLOBALS['phpgw']->hooks->process('login');
 
-               if($lightbox)
+               if ($lightbox)
                {
                        $GLOBALS['phpgw']->redirect_link('/login.php', 
array('hide_lightbox' => true));
                }
                else
                {
-               $GLOBALS['phpgw']->redirect_link('/home.php', $extra_vars);
+                       $GLOBALS['phpgw']->redirect_link('/home.php', 
$extra_vars);
+               }
        }
-       }
 
        //Build vars :
        $variables = array();
-       $variables['lang_login'] = lang('login');
-       $variables['partial_url'] = $partial_url;
-       if(isset($GLOBALS['phpgw_info']['server']['half_remote_user']) && 
$GLOBALS['phpgw_info']['server']['half_remote_user'] == 'remoteuser')
+       $variables['lang_login']         = lang('login');
+       $variables['partial_url']        = $partial_url;
+       if (isset($GLOBALS['phpgw_info']['server']['half_remote_user']) && 
$GLOBALS['phpgw_info']['server']['half_remote_user'] == 'remoteuser')
        {
-               $variables['lang_additional_url'] = lang('use sso login');
-               $variables['additional_url'] = 
$GLOBALS['phpgw']->link('/'.$phpgw_url_for_sso);
+               $variables['lang_additional_url']        = lang('use sso 
login');
+               $variables['additional_url']             = 
$GLOBALS['phpgw']->link('/' . $phpgw_url_for_sso);
        }
 
        $uilogin->phpgw_display_login($variables);

Modified: branches/Version-1_0-branch/property/inc/class.XmlToArray.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.XmlToArray.inc.php   
2012-09-04 07:05:05 UTC (rev 9963)
+++ branches/Version-1_0-branch/property/inc/class.XmlToArray.inc.php   
2012-09-04 09:31:03 UTC (rev 9964)
@@ -1,82 +1,83 @@
 <?php
-       /**
-       * XmlToArray
-       * @author Rasmus Andersson address@hidden http://rasmusandersson.se/}
-       * @author Eric Rosebrock http://www.phpfreaks.com
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2002,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
-       * @package phpgwapi
-       * @subpackage xml
-       * @version $Id$
-       * @internal This class originated from: address@hidden AT: 
http://www.devdump.com/phpxml.php
-       */
 
        /**
-       * Parse XML to an array.
-       *
-       * Works about the same way as address@hidden XmlToArray} but returns a 
slightly more complex/detailed structure.
-       * Also, take a look at the ArrayToXml class - wich is the opposite to 
this class.
-       *
-       * Part of parse() and _getChildren() originates from kris[at]h3x.com, 
http://www.devdump.com/phpxml.php
-       *
-       * <b>Example</b><code>
-       *         require_once('XmlToArray2.php');
-       *         $xa = new XmlToArray2();
-       *         $a = $xa->parseFile('test.xml');
-       *         print_r( $a );</code>
-       *
-       * <b>Example</b><code>
-       *         require_once('XmlToArray2.php');
-       *         $xa = new XmlToArray2('utf-8');
-       *         $a = $xa->parse('<root><child 
name="test"><hello>Yes</hello><hello>'
-       *                                        .'Yes 
again</hello></child></root>');
-       *         print_r( $a );</code>
-       *
-       *
-       * <b>Changelog</b>
-       *       - v0.1 - Implemented Kris's methods into the predecessor class 
XmlToArray and cleaned up a bit.
-       *       - v0.2 - Added option for value-modifier callback function.
-       *                        Added automatic utf8 decoding.
-       *                        Whitespaces is now passed through core parser 
and handled explicitly.
-       *                        Added option for stripping off linebreaks.
-       *                        Added build-in error logging and reporting.
-       *                        Changed attribute and value keys to comform to 
generic standard. (@ and #)
-       *       - v0.3 - Added option to include or not include empty values 
(#) - default is not to include them.
-       *                        ie: <tag foo="bar" />, <tag /> or <tag></tag> 
But not: <tag> </tag>
-       *                        Changed setValueModifier() to accept 
array(object, function) type parameter or string.
-       *       - v0.4 - Improved error reporting and handling.
-       *       - v0.5 - Added the option to make all tags and attributes lower 
case or upper case.
-       *       - v0.6 - Added the option to skip attributes - and simplify the 
output (Sigurd Nes)
-       *
-       * <b>Known issues</b>
-       *       - None at the moment
-       *       - Please send bug reports to rasmus[at]flajm.se
-       *
-       *
-       * @version 0.6 / 2007-01-10
-       * @package phpgwapi
-       * @subpackage xml
-       */
+        * XmlToArray
+        * @author Rasmus Andersson address@hidden http://rasmusandersson.se/}
+        * @author Eric Rosebrock http://www.phpfreaks.com
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2002,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
+        * @package phpgwapi
+        * @subpackage xml
+        * @version $Id$
+        * @internal This class originated from: address@hidden AT: 
http://www.devdump.com/phpxml.php
+        */
 
+       /**
+        * Parse XML to an array.
+        *
+        * Works about the same way as address@hidden XmlToArray} but returns a 
slightly more complex/detailed structure.
+        * Also, take a look at the ArrayToXml class - wich is the opposite to 
this class.
+        *
+        * Part of parse() and _getChildren() originates from kris[at]h3x.com, 
http://www.devdump.com/phpxml.php
+        *
+        * <b>Example</b><code>
+        *        require_once('XmlToArray2.php');
+        *        $xa = new XmlToArray2();
+        *        $a = $xa->parseFile('test.xml');
+        *        print_r( $a );</code>
+        *
+        * <b>Example</b><code>
+        *        require_once('XmlToArray2.php');
+        *        $xa = new XmlToArray2('utf-8');
+        *        $a = $xa->parse('<root><child 
name="test"><hello>Yes</hello><hello>'
+        *                                       .'Yes 
again</hello></child></root>');
+        *        print_r( $a );</code>
+        *
+        *
+        * <b>Changelog</b>
+        *      - v0.1 - Implemented Kris's methods into the predecessor class 
XmlToArray and cleaned up a bit.
+        *      - v0.2 - Added option for value-modifier callback function.
+        *                       Added automatic utf8 decoding.
+        *                       Whitespaces is now passed through core parser 
and handled explicitly.
+        *                       Added option for stripping off linebreaks.
+        *                       Added build-in error logging and reporting.
+        *                       Changed attribute and value keys to comform to 
generic standard. (@ and #)
+        *      - v0.3 - Added option to include or not include empty values 
(#) - default is not to include them.
+        *                       ie: <tag foo="bar" />, <tag /> or <tag></tag> 
But not: <tag> </tag>
+        *                       Changed setValueModifier() to accept 
array(object, function) type parameter or string.
+        *      - v0.4 - Improved error reporting and handling.
+        *      - v0.5 - Added the option to make all tags and attributes lower 
case or upper case.
+        *      - v0.6 - Added the option to skip attributes - and simplify the 
output (Sigurd Nes)
+        *
+        * <b>Known issues</b>
+        *      - None at the moment
+        *      - Please send bug reports to rasmus[at]flajm.se
+        *
+        *
+        * @version 0.6 / 2007-01-10
+        * @package phpgwapi
+        * @subpackage xml
+        */
        class XmlToArray
        {
+
                /**
                 * @var string
                 * @access private
@@ -116,7 +117,6 @@
                 */
                var $_automaticUtf8Decoding = true;
 
-
                /**
                 * Contains the error trace
                 *
@@ -131,20 +131,18 @@
                 */
                var $_error_start_timer = 0.0;
 
-
                /**
                 * @var bool
                 * @access private
                 */
                var $_include_empty_values = false;
 
-               /** @access private*/
+               /** @access private */
                var $_lower_case_tags = false;
 
-
                /**
-               * @var bool
-               */
+                * @var bool
+                */
                var $get_attributes = false;
 
                /**
@@ -156,35 +154,35 @@
                 * @param   bool        $includeEmptyValues (optional) Defaults 
to no/false
                 * @return  object  XmlToArray instance
                 */
-               function XmlToArray ( $encoding = NULL, $stripLinebreaks = 
NULL, $includeRootElement = NULL,
-                                                          
$automaticUtf8Decoding = NULL, $includeEmptyValues = NULL )
+               function XmlToArray( $encoding = NULL, $stripLinebreaks = NULL,
+                                          $includeRootElement = NULL, 
$automaticUtf8Decoding = NULL,
+                                          $includeEmptyValues = NULL )
                {
-                       if( is_string($encoding) )
+                       if ( is_string( $encoding ) )
                        {
                                $this->setEncoding( $encoding );
                        }
-                       if( is_bool($stripLinebreaks) )
+                       if ( is_bool( $stripLinebreaks ) )
                        {
                                $this->setStripsLinebreaks( $stripLinebreaks );
                        }
-                       if( is_bool($includeRootElement) )
+                       if ( is_bool( $includeRootElement ) )
                        {
                                $this->setIncludesRoot( $includeRootElement );
                        }
-                       if( is_bool($automaticUtf8Decoding) )
+                       if ( is_bool( $automaticUtf8Decoding ) )
                        {
                                $this->setDecodesUTF8Automaticly( 
$automaticUtf8Decoding );
                        }
-                       if( is_bool($includeEmptyValues) )
+                       if ( is_bool( $includeEmptyValues ) )
                        {
                                $this->setIncludesEmptyValues( 
$includeEmptyValues );
                        }
 
-                       list($usec, $sec) = explode(" ", microtime());
-                       $this->_error_start_timer = (float)$usec + (float)$sec;
+                       list($usec, $sec) = explode( " ", microtime() );
+                       $this->_error_start_timer = (float) $usec + (float) 
$sec;
                }
 
-
                /**
                 * Supported encodings are "ISO-8859-1", which is also the 
default
                 * if no encoding is specified, "UTF-8" and "US-ASCII". Can 
take any encoding
@@ -192,117 +190,107 @@
                 *
                 * @param  string  $enc
                 */
-               function setEncoding ( $enc )
+               function setEncoding( $enc )
                {
-                       $enc = strtoupper($enc);
-                       if( $enc != 'ISO-8859-1' && $enc != 'UTF-8' && $enc != 
'US-ASCII' )
+                       $enc = strtoupper( $enc );
+                       if ( $enc != 'ISO-8859-1' && $enc != 'UTF-8' && $enc != 
'US-ASCII' )
                        {
-                               $this->_logError( 'setEncoding', 'Unsupported 
encoding specified. Using default/current.' );
+                               $this->_logError( 'setEncoding',
+                                         'Unsupported encoding specified. 
Using default/current.' );
                                return;
                        }
                        $this->_encoding = $enc;
                }
 
-
                /**
                 * @return string
                 */
-               function encoding ()
+               function encoding()
                {
                        return $this->_encoding;
                }
 
-
                /**
                 * @param bool $b
                 */
-               function setStripsLinebreaks ( $b )
+               function setStripsLinebreaks( $b )
                {
                        $this->_strip_linebreaks = $b;
                }
 
-
                /**
                 * @return bool
                 */
-               function stripsLinebreaks ()
+               function stripsLinebreaks()
                {
                        return $this->_strip_linebreaks;
                }
 
-
                /**
                 * @param int $i  CASE_LOWER or CASE_UPPER
                 */
-               function setTagCase ( $i )
+               function setTagCase( $i )
                {
                        $this->_lower_case_tags = ($i == CASE_LOWER);
                }
 
-
                /**
                 * Has the side effect to only include the first root element 
if set to false.
                 * This shouldn't be any problem, since well-formed xml only 
has one root element.
                 *
                 * @param bool $b
                 */
-               function setIncludesRoot ( $b )
+               function setIncludesRoot( $b )
                {
                        $this->_includesRoot = $b;
                }
 
-
                /**
                 * @return bool
                 */
-               function includesRoot ()
+               function includesRoot()
                {
                        return $this->_includesRoot;
                }
 
-
                /**
                 * Enable on or disable automatic utf8 decoding. Uses 
seems_utf8() to guess if the
                 * document contains any utf8 encoded chars. Decoding will only 
be done on values.
                 *
                 * @param bool $b
                 */
-               function setDecodesUTF8Automaticly ( $b )
+               function setDecodesUTF8Automaticly( $b )
                {
                        $this->_automaticUtf8Decoding = $b;
                }
 
-
                /**
                 * @return bool
                 */
-               function decodesUTF8Automaticly ()
+               function decodesUTF8Automaticly()
                {
                        return $this->_automaticUtf8Decoding;
                }
 
-
                /**
                 * Enable on or disable automatic utf8 decoding. Uses 
seems_utf8() to guess if the
                 * document contains any utf8 encoded chars. Decoding will only 
be done on values.
                 *
                 * @param bool $b
                 */
-               function setIncludesEmptyValues ( $b )
+               function setIncludesEmptyValues( $b )
                {
                        $this->_include_empty_values = $b;
                }
 
-
                /**
                 * @return bool
                 */
-               function includesEmptyValues ()
+               function includesEmptyValues()
                {
                        return $this->_include_empty_values;
                }
 
-
                /**
                 * Register a function wich will be called with one argument 
(string $value) for
                 * each value parsed. This way, you can manipulate the values 
in a quick way.
@@ -312,7 +300,7 @@
                 * <b>Example</b><code>
                 * function myValueModifier( $value )
                 * {
-                *      return strtoupper($value);
+                *      return strtoupper($value);
                 * }
                 * $xa = new XmlToArray2('utf-8');
                 * $xa->setValueModifier('myValueModifier');
@@ -321,165 +309,162 @@
                 * Must be set before calling any parse method.
                 *
                 * @param  string|array  $function_name  String, array($object, 
'function'), array('object_name', 'function')
-                *                                                              
           or array(&$object, 'function')
+                *                                                              
           or array(&$object, 'function')
                 * @return  bool  Success?
                 */
-               function setValueModifier ( $function )
+               function setValueModifier( $function )
                {
-                       if( is_string($function) )
+                       if ( is_string( $function ) )
                        {
-                               if( function_exists( $function ) )
+                               if ( function_exists( $function ) )
                                {
                                        $this->_valueModifier = $function;
                                        return true;
                                }
                                else
                                {
-                                       $this->_logError( 'setValueModifier', 
'Registered value modifier function can not be found.' );
+                                       $this->_logError( 'setValueModifier',
+                                          'Registered value modifier function 
can not be found.' );
                                        return false;
                                }
                        }
-                       else if( is_array($function) )
+                       else if ( is_array( $function ) )
                        {
                                $this->_valueModifier = $function;
                        }
                        else
                        {
-                               $this->_logError( 'setValueModifier', 
'Parameter of unsupported type. Should be string or array.' );
+                               $this->_logError( 'setValueModifier',
+                                         'Parameter of unsupported type. 
Should be string or array.' );
                                return false;
                        }
                        return true;
                }
 
-
                /**
                 * @return string
                 */
-               function valueModifier ()
+               function valueModifier()
                {
                        return $this->_valueModifier;
                }
 
-
                /**
                 * Parse a file and return the structure
                 *
                 * @param string $file
                 * @return array
                 */
-               function parseFile ( $file )
+               function parseFile( $file )
                {
-                       if (!file_exists($file))
+                       if ( !file_exists( $file ) )
                        {
-                               $this->_logError( 'parseFile', 'The file 
"'.$file.'" can not be found!' );
+                               $this->_logError( 'parseFile', 'The file "' . 
$file . '" can not be found!' );
                                return array();
                        }
                        return $this->parse( file_get_contents( $file ) );
                }
 
-
                /**
                 * @access private
                 */
                function _logError( $function, $msg )
                {
-                       list($usec, $sec) = explode(" ", microtime());
-                       $time = ((float)$usec + (float)$sec) - 
$this->_error_start_timer;
-                       $this->_error_trace[] = array( $function, $msg, $time );
+                       list($usec, $sec) = explode( " ", microtime() );
+                       $time                                    = ((float) 
$usec + (float) $sec) - $this->_error_start_timer;
+                       $this->_error_trace[]    = array($function, $msg, 
$time);
                }
 
-
                /**
                 * Get the current error traceback
                 *
                 * @return string|NULL  NULL is returned if no errors.
                 */
-               function errors ()
+               function errors()
                {
-                       if( count($this->_error_trace) == 0 ) return NULL;
-                       $s = '';
-                       $len = count($this->_error_trace) -1;
-                       for ($i=$len; $i>-1;$i--)
+                       if ( count( $this->_error_trace ) == 0 )
+                               return NULL;
+                       $s       = '';
+                       $len = count( $this->_error_trace ) - 1;
+                       for ( $i = $len; $i > -1; $i-- )
                        {
-                               $s .= 
'['.round($this->_error_trace[$i][2]*1000,2).' ms] 
<b>XmlToArray2->'.$this->_error_trace[$i][0].'()</b> 
'.$this->_error_trace[$i][1] . "<br/>";
+                               $s .= '[' . round( $this->_error_trace[$i][2] * 
1000, 2 ) . ' ms] <b>XmlToArray2->' . $this->_error_trace[$i][0] . '()</b> ' . 
$this->_error_trace[$i][1] . "<br/>";
                        }
                        return $s;
                }
 
-
                /**
                 * Calls a user-set value-modifier function if it exists.
                 * Also strips linebreaks if that option is turned on.
                 *
                 * @access private
                 */
-               function _onValue ( $value )
+               function _onValue( $value )
                {
-                       if( $this->_strip_linebreaks )
+                       if ( $this->_strip_linebreaks )
                        {
-                               $value = preg_replace('/[\r\n]+/', ' ', $value);
+                               $value = preg_replace( '/[\r\n]+/', ' ', $value 
);
                        }
-                       if( $this->_decodeUtf8 )
+                       if ( $this->_decodeUtf8 )
                        {
-                               $value = utf8_decode($value);
+                               $value = utf8_decode( $value );
                        }
-                       if( $this->_valueModifier != NULL )
+                       if ( $this->_valueModifier != NULL )
                        {
                                $value = @call_user_func( 
$this->_valueModifier, $value );
                        }
                        return $value;
                }
 
-
                /**
                 * Calls _onValue() on all attribute values
                 *
                 * @access private
                 */
-               function _onAttributes ( $attr )
+               function _onAttributes( $attr )
                {
-                       foreach( $attr as $k => $v )
+                       foreach ( $attr as $k => $v )
                        {
-                               $attr[$k] = $this->_onValue($v);
+                               $attr[$k] = $this->_onValue( $v );
                        }
                        return $attr;
                }
 
-
                /**
                 * Parse a string containing xml and return the structure
                 *
                 * @param string $data
                 * @return array
                 */
-               function parse ( $data )
+               function parse( $data )
                {
-                       $data = trim($data);
-                       $err = false;
+                       $data    = trim( $data );
+                       $err     = false;
 
-                       if( $data == '' )
+                       if ( $data == '' )
                        {
                                $this->_logError( 'parse', 'Empty data' );
                                return array();
                        }
 
-                       if( $this->_automaticUtf8Decoding )
+                       if ( $this->_automaticUtf8Decoding )
                        {
-                               if($this->_seems_utf8( $data ))
+                               if ( $this->_seems_utf8( $data ) )
                                {
                                        $this->_decodeUtf8 = true;
                                }
                        }
 
-                       $parser = xml_parser_create( $this->_encoding );
-                       xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 
0);
-                       xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 
0);
-                       xml_parse_into_struct( $parser, $data, $vals, $index ) 
or $err = true;
+                       $parser  = xml_parser_create( $this->_encoding );
+                       xml_parser_set_option( $parser, 
XML_OPTION_CASE_FOLDING, 0 );
+                       xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 
0 );
+                       xml_parse_into_struct( $parser, $data, $vals, $index ) 
or $err   = true;
 
-                       if( $err )
+                       if ( $err )
                        {
-                               $this->_logError( 'parse', 'XML parser failed: '
-                                       
.ucfirst(xml_error_string(xml_get_error_code($parser))) );
+                               $this->_logError( 'parse',
+                                         'XML parser failed: '
+                                       . ucfirst( xml_error_string( 
xml_get_error_code( $parser ) ) ) );
                                xml_parser_free( $parser );
                                return;
                        }
@@ -488,34 +473,34 @@
                        $tree = array();
                        $i = 0;
 
-                       $tagname = ( $this->_lower_case_tags ) ? 
strtolower($vals[$i]['tag']) : $vals[$i]['tag'];
-                       if (isset($vals[$i]['attributes']))
+                       $tagname = ( $this->_lower_case_tags ) ? strtolower( 
$vals[$i]['tag'] ) : $vals[$i]['tag'];
+                       if ( isset( $vals[$i]['attributes'] ) )
                        {
-                          if($this->get_attributes)
-                          {
-                                       $tree[$tagname][]['@'] = 
$vals[$i]['attributes'];
-                                       $index = count($tree[$tagname])-1;
-                                       $tree[$tagname][$index] =  
array_merge($tree[$tagname][$index], $this->_getChildren($vals, $i));
+                               if ( $this->get_attributes )
+                               {
+                                       $tree[$tagname][]['@']   = 
$vals[$i]['attributes'];
+                                       $index                                  
 = count( $tree[$tagname] ) - 1;
+                                       $tree[$tagname][$index]  = array_merge( 
$tree[$tagname][$index],
+                                                                               
         $this->_getChildren( $vals, $i ) );
                                }
                                else
                                {
-                                       $tree[$tagname][] = 
$this->_getChildren($vals, $i);
+                                       $tree[$tagname][] = 
$this->_getChildren( $vals, $i );
                                }
                        }
                        else
                        {
-                               $tree[$tagname][] = $this->_getChildren($vals, 
$i);
+                               $tree[$tagname][] = $this->_getChildren( $vals, 
$i );
                        }
 
                        if ( !$this->_includesRoot )
                        {
-                               $keys = array_keys($tree);
-                               $tree = $tree[$keys[0]][0];
+                               $keys    = array_keys( $tree );
+                               $tree    = $tree[$keys[0]][0];
                        }
                        return $tree;
                }
 
-
                /**
                 * @access private
                 * @return mixed
@@ -523,27 +508,27 @@
                function _getChildren( $vals, &$i )
                {
                        $children = array(); // Contains node data
-                       if (isset($vals[$i]['tag']))
+                       if ( isset( $vals[$i]['tag'] ) )
                        {
-                               if( isset($vals[$i]['value']) && 
trim($vals[$i]['value']) != '' )
+                               if ( isset( $vals[$i]['value'] ) && trim( 
$vals[$i]['value'] ) != '' )
                                {
                                        $children = $this->_onValue( 
$vals[$i]['value'] );
                                }
-                               while (++$i < count($vals))
+                               while ( ++$i < count( $vals ) )
                                {
-                                       switch ($vals[$i]['type'])
+                                       switch ( $vals[$i]['type'] )
                                        {
                                                case 'cdata':
-                                                       if 
(isset($children['#']))
+                                                       if ( isset( 
$children['#'] ) )
                                                        {
-                                                               if( 
trim($vals[$i]['value']) != '' )
+                                                               if ( trim( 
$vals[$i]['value'] ) != '' )
                                                                {
                                                                        
$children['#'] .= $vals[$i]['value'];
                                                                }
                                                        }
                                                        else
                                                        {
-                                                               if( 
trim($vals[$i]['value']) != '' )
+                                                               if ( trim( 
$vals[$i]['value'] ) != '' )
                                                                {
                                                                        
$children['#'] = $vals[$i]['value'];
                                                                }
@@ -551,19 +536,19 @@
                                                        break;
 
                                                case 'complete':
-                                                       $tagname = ( 
$this->_lower_case_tags ) ? strtolower($vals[$i]['tag']) : $vals[$i]['tag'];
-                                                       if 
(isset($vals[$i]['attributes']))
+                                                       $tagname = ( 
$this->_lower_case_tags ) ? strtolower( $vals[$i]['tag'] ) : $vals[$i]['tag'];
+                                                       if ( isset( 
$vals[$i]['attributes'] ) )
                                                        {
-                                                               
if($this->get_attributes)
-                                                               {
-                                                                       
$children[$tagname][]['@'] = $vals[$i]['attributes'];
-                                                                       $index 
= count($children[$tagname])-1;
+                                                               if ( 
$this->get_attributes )
+                                                               {
+                                                                       
$children[$tagname][]['@']       = $vals[$i]['attributes'];
+                                                                       $index  
                                         = count( $children[$tagname] ) - 1;
                                                                }
 
-                                                               if 
(isset($vals[$i]['value']))
+                                                               if ( isset( 
$vals[$i]['value'] ) )
                                                                {
-                                                                       
if($this->get_attributes)
-                                                                       {
+                                                                       if ( 
$this->get_attributes )
+                                                                       {
                                                                                
$children[$tagname][] = $this->_onValue( $vals[$i]['value'] );
                                                                        }
                                                                        else
@@ -571,18 +556,18 @@
                                                                                
$children[$tagname] = $this->_onValue( $vals[$i]['value'] );
                                                                        }
                                                                }
-                                                               else if( 
$this->_include_empty_values )
+                                                               else if ( 
$this->_include_empty_values )
                                                                {
-                                                                               
$children[$tagname] = '';
+                                                                       
$children[$tagname] = '';
                                                                }
                                                        }
                                                        else
                                                        {
-                                                               if 
(isset($vals[$i]['value']))
+                                                               if ( isset( 
$vals[$i]['value'] ) )
                                                                {
                                                                        
$children[$tagname] = $this->_onValue( $vals[$i]['value'] );
                                                                }
-                                                               else if( 
$this->_include_empty_values )
+                                                               else if ( 
$this->_include_empty_values )
                                                                {
                                                                        
$children[$tagname] = '';
                                                                }
@@ -590,52 +575,59 @@
                                                        break;
 
                                                case 'open':
-                                                       $tagname = ( 
$this->_lower_case_tags ) ? strtolower($vals[$i]['tag']) : $vals[$i]['tag'];
-                                                       if 
(isset($vals[$i]['attributes']))
+                                                       $tagname = ( 
$this->_lower_case_tags ) ? strtolower( $vals[$i]['tag'] ) : $vals[$i]['tag'];
+                                                       if ( isset( 
$vals[$i]['attributes'] ) )
                                                        {
-                                                               
if($this->get_attributes)
+                                                               if ( 
$this->get_attributes )
                                                                {
-                                                                       
$children[$tagname][]['@'] = $this->_onAttributes( $vals[$i]['attributes'] );
-                                                               //      $index 
= count($children[$tagname])-1;
-                                                                       $index 
= count($children[$vals[$i]['tag']])-1;
-                                                                       
$children[$tagname][$index] = array_merge( $children[$tagname][$index] , 
$this->_getChildren($vals, $i) );
+                                                                       
$children[$tagname][]['@']       = $this->_onAttributes( 
$vals[$i]['attributes'] );
+                                                                       //      
$index = count($children[$tagname])-1;
+                                                                       $index  
                                         = count( $children[$vals[$i]['tag']] ) 
- 1;
+                                                                       
$children[$tagname][$index]      = array_merge( $children[$tagname][$index],
+                                                                               
                         $this->_getChildren( $vals, $i ) );
                                                                }
                                                                else
                                                                {
-                                                                       
$children[$tagname][] = $this->_getChildren($vals, $i);
+                                                                       
$children[$tagname][] = $this->_getChildren( $vals, $i );
                                                                }
                                                        }
                                                        else
                                                        {
-                                                               
$children[$tagname][] = $this->_getChildren($vals, $i);
+                                                               
$children[$tagname][] = $this->_getChildren( $vals, $i );
                                                        }
                                                        break;
 
                                                case 'close':
-                                               return $children;
+                                                       return $children;
                                        }//switch
                                }//while
                        }
                }
 
-
                /**
                 * @access private
                 */
-               function _seems_utf8($Str)
+               function _seems_utf8( $Str )
                {
-                       for ($i=0; $i<strlen($Str); $i++)
+                       for ( $i = 0; $i < strlen( $Str ); $i++ )
                        {
-                               if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
-                               elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 
110bbbbb
-                               elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n=2; # 
1110bbbb
-                               elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n=3; # 
11110bbb
-                               elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n=4; # 
111110bb
-                               elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 
1111110b
-                               else return false; # Does not match any model
-                               for ($j=0; $j<$n; $j++) # n bytes matching 
10bbbbbb follow ?
+                               if ( ord( $Str[$i] ) < 0x80 )
+                                       continue;# 0bbbbbbb
+                               elseif ( (ord( $Str[$i] ) & 0xE0) == 0xC0 )
+                                       $n       = 1;# 110bbbbb
+                               elseif ( (ord( $Str[$i] ) & 0xF0) == 0xE0 )
+                                       $n       = 2;# 1110bbbb
+                               elseif ( (ord( $Str[$i] ) & 0xF8) == 0xF0 )
+                                       $n       = 3;# 11110bbb
+                               elseif ( (ord( $Str[$i] ) & 0xFC) == 0xF8 )
+                                       $n       = 4;# 111110bb
+                               elseif ( (ord( $Str[$i] ) & 0xFE) == 0xFC )
+                                       $n       = 5;# 1111110b
+                               else
+                                       return false;# Does not match any model
+                               for ( $j = 0; $j < $n; $j++ ) # n bytes 
matching 10bbbbbb follow ?
                                {
-                                       if ((++$i == strlen($Str)) || 
((ord($Str[$i]) & 0xC0) != 0x80))
+                                       if ( (++$i == strlen( $Str )) || ((ord( 
$Str[$i] ) & 0xC0) != 0x80) )
                                        {
                                                return false;
                                        }
@@ -643,4 +635,5 @@
                        }
                        return true;
                }
+
        }

Modified: branches/Version-1_0-branch/property/inc/class.boXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boXport.inc.php      
2012-09-04 07:05:05 UTC (rev 9963)
+++ branches/Version-1_0-branch/property/inc/class.boXport.inc.php      
2012-09-04 09:31:03 UTC (rev 9964)
@@ -1,315 +1,320 @@
 <?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 admin
-       * @version $Id$
-       */
+        * 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 admin
+        * @version $Id$
+        */
 
        /**
         * Description
         * @package property
         */
-
        class property_boXport
        {
+
                var $public_functions = array
-                       (
-                               'import' => true,
-                               'export' => true
-                       );
-
+               (
+                       'import' => true,
+                       'export' => true
+               );
                var $start;
                var $query;
                var $sort;
                var $order;
                var $filter;
                var $cat_id;
-
                var $use_session = false;
 
-               function property_boXport ($session=false)
+               function property_boXport( $session = false )
                {
 
-                       $GLOBALS['phpgw_info']['flags']['currentapp']   =       
'property';
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'property';
 
-                       $this->config           = 
CreateObject('phpgwapi.config','property');
+                       $this->config = CreateObject( 'phpgwapi.config', 
'property' );
 
-                       if($session)
+                       if ( $session )
                        {
                                $this->read_sessiondata();
                                $this->use_session = true;
                        }
 
-                       $start  = phpgw::get_var('start', 'int', 'REQUEST', 0);
-                       $query  = phpgw::get_var('query');
-                       $sort   = phpgw::get_var('sort');
-                       $order  = phpgw::get_var('order');
-                       $filter = phpgw::get_var('filter', 'int');
-                       $cat_id = phpgw::get_var('cat_id', 'int');
+                       $start   = phpgw::get_var( 'start', 'int', 'REQUEST', 0 
);
+                       $query   = phpgw::get_var( 'query' );
+                       $sort    = phpgw::get_var( 'sort' );
+                       $order   = phpgw::get_var( 'order' );
+                       $filter  = phpgw::get_var( 'filter', 'int' );
+                       $cat_id  = phpgw::get_var( 'cat_id', 'int' );
 
-                       if($start || $start == 0)
+                       if ( $start || $start == 0 )
                        {
                                $this->start = $start;
                        }
-                       if($query)
+                       if ( $query )
                        {
-                               $this->query  = $query;
+                               $this->query = $query;
                        }
-                       if($sort)
+                       if ( $sort )
                        {
-                               $this->sort   = $sort;
+                               $this->sort = $sort;
                        }
-                       if($order)
+                       if ( $order )
                        {
-                               $this->order  = $order;
+                               $this->order = $order;
                        }
-                       if($filter)
+                       if ( $filter )
                        {
-                               $this->filter = $filter;
+                               $this->filter    = $filter;
                        }
-                       $this->cat_id = $cat_id;
+                       $this->cat_id    = $cat_id;
                }
 
                function save_sessiondata()
                {
 
-                       if ($this->use_session)
+                       if ( $this->use_session )
                        {
-                               $data = array(
-                                       'start'  => $this->start,
-                                       'query'  => $this->query,
-                                       'sort'   => $this->sort,
-                                       'order'  => $this->order,
+                               $data = array
+                               (
+                                       'start'  => $this->start,
+                                       'query'  => $this->query,
+                                       'sort'   => $this->sort,
+                                       'order'  => $this->order,
                                        'filter' => $this->filter,
                                        'cat_id' => $this->cat_id
                                );
-                               if($this->debug) { echo '<br>Save:'; 
_debug_array($data); }
-                               
$GLOBALS['phpgw']->session->appsession('session_data','export',$data);
+                               if ( $this->debug )
+                               {
+                                       echo '<br>Save:';
+                                       _debug_array( $data );
+                               }
+                               $GLOBALS['phpgw']->session->appsession( 
'session_data', 'export', $data );
                        }
                }
 
                function read_sessiondata()
                {
-                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','export');
+                       $data = $GLOBALS['phpgw']->session->appsession( 
'session_data', 'export' );
 
-                       $this->start  = $data['start'];
-                       $this->query  = $data['query'];
-                       $this->sort   = $data['sort'];
-                       $this->order  = $data['order'];
-                       $this->filter = $data['filter'];
-                       $this->cat_id = $data['cat_id'];
+                       $this->start     = $data['start'];
+                       $this->query     = $data['query'];
+                       $this->sort              = $data['sort'];
+                       $this->order     = $data['order'];
+                       $this->filter    = $data['filter'];
+                       $this->cat_id    = $data['cat_id'];
                }
 
-               function select_import_conv($selected='')
+               function select_import_conv( $selected = '' )
                {
-                       $dir_handle = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}");
-                       $i=0; $myfilearray = array();
-                       while ($file = readdir($dir_handle))
+                       $dir_handle      = @opendir( PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}" );
+                       $i                       = 0;
+                       $myfilearray = array();
+                       while ( $file = readdir( $dir_handle ) )
                        {
-                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
+                               if ( (substr( $file, 0, 1 ) != '.') && is_file( 
PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
                                }
                        }
-                       closedir($dir_handle);
-                       sort($myfilearray);
+                       closedir( $dir_handle );
+                       sort( $myfilearray );
 
-                       for ($i=0;$i<count($myfilearray);$i++)
+                       for ( $i = 0; $i < count( $myfilearray ); $i++ )
                        {
-                               $fname = preg_replace('/_/',' 
',$myfilearray[$i]);
-                               $sel_file = '';
-                               if ($myfilearray[$i]==$selected)
+                               $fname           = preg_replace( '/_/', ' ', 
$myfilearray[$i] );
+                               $sel_file        = '';
+                               if ( $myfilearray[$i] == $selected )
                                {
                                        $sel_file = 'selected';
                                }
 
                                $conv_list[] = array
                                        (
-                                               'id'            => 
$myfilearray[$i],
-                                               'name'          => $fname,
-                                               'selected'      => $sel_file
-                                       );
+                                       'id'             => $myfilearray[$i],
+                                       'name'           => $fname,
+                                       'selected'       => $sel_file
+                               );
                        }
 
-                       for ($i=0;$i<count($conv_list);$i++)
+                       for ( $i = 0; $i < count( $conv_list ); $i++ )
                        {
-                               if ($conv_list[$i]['selected'] != 'selected')
+                               if ( $conv_list[$i]['selected'] != 'selected' )
                                {
-                                       unset($conv_list[$i]['selected']);
+                                       unset( $conv_list[$i]['selected'] );
                                }
                        }
 
                        return $conv_list;
-
                }
 
-               function select_export_conv($selected='')
+               function select_export_conv( $selected = '' )
                {
-                       $dir_handle = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}");
-                       $i=0; $myfilearray = array();
-                       while ($file = readdir($dir_handle))
+                       $dir_handle      = @opendir( PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}" );
+                       $i                       = 0;
+                       $myfilearray = array();
+                       while ( $file = readdir( $dir_handle ) )
                        {
-                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
+                               if ( (substr( $file, 0, 1 ) != '.') && is_file( 
PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
                                }
                        }
-                       closedir($dir_handle);
-                       sort($myfilearray);
+                       closedir( $dir_handle );
+                       sort( $myfilearray );
 
-                       for ($i=0;$i<count($myfilearray);$i++)
+                       for ( $i = 0; $i < count( $myfilearray ); $i++ )
                        {
-                               $fname = preg_replace('/_/',' 
',$myfilearray[$i]);
-                               $sel_file = '';
-                               if ($myfilearray[$i]==$selected)
+                               $fname           = preg_replace( '/_/', ' ', 
$myfilearray[$i] );
+                               $sel_file        = '';
+                               if ( $myfilearray[$i] == $selected )
                                {
                                        $sel_file = 'selected';
                                }
 
                                $conv_list[] = array
                                        (
-                                               'id'            => 
$myfilearray[$i],
-                                               'name'          => $fname,
-                                               'selected'      => $sel_file
-                                       );
+                                       'id'             => $myfilearray[$i],
+                                       'name'           => $fname,
+                                       'selected'       => $sel_file
+                               );
                        }
 
-                       for ($i=0;$i<count($conv_list);$i++)
+                       for ( $i = 0; $i < count( $conv_list ); $i++ )
                        {
-                               if ($conv_list[$i]['selected'] != 'selected')
+                               if ( $conv_list[$i]['selected'] != 'selected' )
                                {
-                                       unset($conv_list[$i]['selected']);
+                                       unset( $conv_list[$i]['selected'] );
                                }
                        }
 
                        return $conv_list;
-
                }
 
-               function select_rollback_file($selected='')
+               function select_rollback_file( $selected = '' )
                {
                        $this->config->read();
                        $file_catalog = 
$this->config->config_data['export_path'];
 
-                       $dir_handle = @opendir($file_catalog);
-                       $i=0; $myfilearray = '';
-                       while ($file = readdir($dir_handle))
+                       $dir_handle      = @opendir( $file_catalog );
+                       $i                       = 0;
+                       $myfilearray = '';
+                       while ( $file            = readdir( $dir_handle ) )
                        {
-                               if ((substr($file, 0, 1) != '.') && 
is_file("{$file_catalog}/{$file}") )
+                               if ( (substr( $file, 0, 1 ) != '.') && is_file( 
"{$file_catalog}/{$file}" ) )
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
                                }
                        }
-                       closedir($dir_handle);
-                       @sort($myfilearray);
+                       closedir( $dir_handle );
+                       @sort( $myfilearray );
 
-                       for ($i=0;$i<count($myfilearray);$i++)
+                       for ( $i = 0; $i < count( $myfilearray ); $i++ )
                        {
-                               $fname = preg_replace('/_/',' 
',$myfilearray[$i]);
-                               $sel_file = '';
-                               if ($myfilearray[$i]==$selected)
+                               $fname           = preg_replace( '/_/', ' ', 
$myfilearray[$i] );
+                               $sel_file        = '';
+                               if ( $myfilearray[$i] == $selected )
                                {
                                        $sel_file = 'selected';
                                }
 
                                $rollback_list[] = array
                                        (
-                                               'id'            => 
$myfilearray[$i],
-                                               'name'          => $fname,
-                                               'selected'      => $sel_file
-                                       );
+                                       'id'             => $myfilearray[$i],
+                                       'name'           => $fname,
+                                       'selected'       => $sel_file
+                               );
                        }
 
-                       for ($i=0;$i<count($rollback_list);$i++)
+                       for ( $i = 0; $i < count( $rollback_list ); $i++ )
                        {
-                               if ($rollback_list[$i]['selected'] != 
'selected')
+                               if ( $rollback_list[$i]['selected'] != 
'selected' )
                                {
-                                       unset($rollback_list[$i]['selected']);
+                                       unset( $rollback_list[$i]['selected'] );
                                }
                        }
 
                        return $rollback_list;
-
                }
 
-               function import($invoice_common,$download)
+               function import( $invoice_common, $download )
                {
                        include (PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$invoice_common['conv_type']}");
                        $invoice = new import_conv;
 
-                       $buffer = $invoice->import($invoice_common,$download);
-                       if ($download)
+                       $buffer = $invoice->import( $invoice_common, $download 
);
+                       if ( $download )
                        {
-                               $header = $invoice->header;
-                               $import = $invoice->import;
-                               $buffer= array(
-                                       'table'         => $buffer,
-                                       'header'        => $header,
-                                       'import'        => $import
+                               $header  = $invoice->header;
+                               $import  = $invoice->import;
+                               $buffer  = array(
+                                       'table'  => $buffer,
+                                       'header' => $header,
+                                       'import' => $import
                                );
                        }
                        return $buffer;
                }
 
-               function export($data)
+               function export( $data )
                {
-                       $conv_type = $data['conv_type'];
-                       $download = $data['download'];
-                       $pre_transfer = $data['pre_transfer'];
-                       $force_period_year = $data['force_period_year'];
+                       $conv_type                       = $data['conv_type'];
+                       $download                        = $data['download'];
+                       $pre_transfer            = $data['pre_transfer'];
+                       $force_period_year       = $data['force_period_year'];
 
                        include(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
                        $invoice = new export_conv;
 
-                       $buffer = 
$invoice->overfor($download,$pre_transfer,$force_period_year);
+                       $buffer = $invoice->overfor( $download, $pre_transfer, 
$force_period_year );
 
                        return $buffer;
                }
 
-               function 
rollback($conv_type,$role_back_date,$rollback_file,$rollback_voucher)
+               function rollback( $conv_type, $role_back_date, $rollback_file,
+                                        $rollback_voucher )
                {
                        include (PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
                        $invoice = new export_conv;
-                       $buffer = 
$invoice->RullTilbake($role_back_date,$rollback_file,$rollback_voucher);
+                       $buffer  = $invoice->RullTilbake( $role_back_date, 
$rollback_file,
+                                                                        
$rollback_voucher );
                        return $buffer;
-
                }
 
-               function export_cron($data)
+               function export_cron( $data )
                {
-                       if($data['enabled']==1)
+                       if ( $data['enabled'] == 1 )
                        {
-                               $receipt = $this->export($data);
-       //                      if(isset($data['manual']))
+                               $receipt = $this->export( $data );
+                               //                      
if(isset($data['manual']))
                                {
-                                       _debug_array($receipt);
+                                       _debug_array( $receipt );
                                }
                        }
                }
 
-       }
+       }
\ No newline at end of file

Modified: branches/Version-1_0-branch/property/inc/class.boadmin.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boadmin.inc.php      
2012-09-04 07:05:05 UTC (rev 9963)
+++ branches/Version-1_0-branch/property/inc/class.boadmin.inc.php      
2012-09-04 09:31:03 UTC (rev 9964)
@@ -1,38 +1,38 @@
 <?php
-       /**
-       * phpGroupWare - property: a Facilities Management System.
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software 
Foundation, Inc. http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
-       * @package property
-       * @subpackage admin
-       * @version $Id$
-       */
 
+       /**
+        * phpGroupWare - property: a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software 
Foundation, Inc. http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+        * @package property
+        * @subpackage admin
+        * @version $Id$
+        */
        /*
-          This program is free software: you can redistribute it and/or modify
-          it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 2 of the License, or
-          (at your option) any later version.
+         This program is free software: you can redistribute it and/or modify
+         it under the terms of the GNU General Public License as published by
+         the Free Software Foundation, either version 2 of the License, or
+         (at your option) any later version.
 
-          This program is distributed in the hope that it will be useful,
-          but WITHOUT ANY WARRANTY; without even the implied warranty of
-          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-          GNU General Public License for more details.
+         This program is distributed in the hope that it will be useful,
+         but WITHOUT ANY WARRANTY; without even the implied warranty of
+         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+         GNU General Public License for more details.
 
-          You should have received a copy of the GNU General Public License
-          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+         You should have received a copy of the GNU General Public License
+         along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
 
        /**
         * FIXME I need a proper description
         * @package property
         */
-
        class property_boadmin
        {
+
                var $start;
                var $query;
                var $filter;
@@ -42,14 +42,14 @@
                var $offset;
                var $acl_app;
 
-               function property_boadmin($session='')
+               function property_boadmin($session = '')
                {
                        //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->so                       = 
CreateObject('property.soadmin');
-                       $this->acl                      = & 
$GLOBALS['phpgw']->acl;
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->right            = array(1,2,4,8,16);
-                       $this->account_id       = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->so                = 
CreateObject('property.soadmin');
+                       $this->acl               = & $GLOBALS['phpgw']->acl;
+                       $this->bocommon  = CreateObject('property.bocommon');
+                       $this->right     = array(1, 2, 4, 8, 16);
+                       $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        if ($session)
                        {
@@ -57,122 +57,120 @@
                                $this->use_session = true;
                        }
 
-                       $start  = phpgw::get_var('start', 'int', 'REQUEST', 0);
-                       $query  = phpgw::get_var('query');
-                       $sort   = phpgw::get_var('sort');
-                       $order  = phpgw::get_var('order');
-                       $filter = phpgw::get_var('filter', 'int');
-                       $cat_id = phpgw::get_var('cat_id', 'string');
-                       $permission     = phpgw::get_var('permission');
-                       //              $location       = 
get_var('location',array('POST','GET')); // don't work for some reason...
-                       $module = phpgw::get_var('module');
-                       $granting_group = phpgw::get_var('granting_group', 
'int');
-                       $allrows        = phpgw::get_var('allrows', 'bool');
-                       $acl_app        = 'property'; 
//get_var('acl_app',array('POST','GET'));
+                       $start                   = phpgw::get_var('start', 
'int', 'REQUEST', 0);
+                       $query                   = phpgw::get_var('query');
+                       $sort                    = phpgw::get_var('sort');
+                       $order                   = phpgw::get_var('order');
+                       $filter                  = phpgw::get_var('filter', 
'int');
+                       $cat_id                  = phpgw::get_var('cat_id', 
'string');
+                       $permission              = phpgw::get_var('permission');
+       //              $location                = 
get_var('location',array('POST','GET')); // don't work for some reason...
+                       $module                  = phpgw::get_var('module');
+                       $granting_group  = phpgw::get_var('granting_group', 
'int');
+                       $allrows                 = phpgw::get_var('allrows', 
'bool');
+                       $acl_app                 = 'property'; 
//get_var('acl_app',array('POST','GET'));
 
                        if ($start)
                        {
-                               $this->start=$start;
+                               $this->start = $start;
                        }
                        else
                        {
-                               $this->start=0;
+                               $this->start = 0;
                        }
 

@@ Diff output truncated at 153600 characters. @@



reply via email to

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