fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8135]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8135]
Date: Sun, 20 Nov 2011 21:45:20 +0000

Revision: 8135
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8135
Author:   erikhl
Date:     2011-11-20 21:45:19 +0000 (Sun, 20 Nov 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.socontactperson.inc.php
    trunk/activitycalendar/inc/class.soorganization.inc.php
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
    trunk/activitycalendarfrontend/setup/phpgw_no.lang
    trunk/activitycalendarfrontend/templates/base/activity_new.php

Modified: trunk/activitycalendar/inc/class.socontactperson.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.socontactperson.inc.php    2011-11-20 
21:02:53 UTC (rev 8134)
+++ trunk/activitycalendar/inc/class.socontactperson.inc.php    2011-11-20 
21:45:19 UTC (rev 8135)
@@ -107,6 +107,16 @@
                                
                        }
                }
+               if(isset($filters['organization_id']))
+               {
+                       $org_id = 
$this->marshal($filters['organization_id'],'int');
+                       if(isset($org_id) && $org_id > 0)
+                       {
+                               $filter_clauses[] = 
"organization_contact.organization_id = {$org_id}";
+                               $table = "bb_organization_contact 
organization_contact";
+                               
+                       }
+               }
                else if(isset($filters['group_id']))
                {
                        $group_id = $this->marshal($filters['group_id'],'int');
@@ -136,7 +146,7 @@
 
                $condition =  join(' AND ', $clauses);
 
-               if($table == "bb_organization_contact")
+               if($table == "bb_organization_contact organization_contact")
                {
                        if($return_count) // We should only return a count
                        {

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2011-11-20 
21:02:53 UTC (rev 8134)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2011-11-20 
21:45:19 UTC (rev 8135)
@@ -3,6 +3,7 @@
 phpgw::import_class('activitycalendar.socommon');
 
 include_class('activitycalendar', 'organization', 'inc/model/');
+include_class('activitycalendar', 'contact_person', 'inc/model/');
 
 class activitycalendar_soorganization extends activitycalendar_socommon
 {
@@ -85,6 +86,7 @@
 
                $filter_clauses = array();
                $filter_clauses[] = "show_in_portal=1";
+               $filter_clauses[] = "NOT org.name=''";
                
                $use_local_org = false;
                
@@ -243,6 +245,26 @@
                return $contacts;
        }
        
+       function get_contacts_as_objects($organization_id)
+       {
+               $contacts = array();
+       if(isset($organization_id)){
+               $q1="SELECT * FROM bb_organization_contact WHERE 
organization_id={$organization_id}";
+               //var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;                  
}
+       }
+               return $contacts;
+       }
+       
+       
        function get_contacts_local($organization_id)
        {
                $contacts = array();

Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-11-20 
21:02:53 UTC (rev 8134)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-11-20 
21:45:19 UTC (rev 8135)
@@ -3,6 +3,8 @@
        phpgw::import_class('activitycalendar.soactivity');
        phpgw::import_class('activitycalendar.sogroup');
        phpgw::import_class('activitycalendar.soarena');
+       phpgw::import_class('activitycalendar.soorganization');
+       phpgw::import_class('activitycalendar.socontactperson');
        
        include_class('activitycalendar', 'activity', 'inc/model/');
        include_class('activitycalendar', 'group', 'inc/model/');
@@ -10,6 +12,12 @@
 
        class activitycalendarfrontend_uiactivity extends 
activitycalendar_uiactivities
        {
+               private $so_activity;
+               private $so_arena;
+               private $so_organization;
+               private $so_group;
+               private $so_contact;
+               
                public $public_functions = array
                (
                        'add'                   =>      true,
@@ -20,56 +28,101 @@
                        'get_address_search'    => true
                );
                
+               public function __construct()
+               {
+                       parent::__construct();
+                       $this->so_activity = 
activitycalendar_soactivity::get_instance();
+                       $this->so_arena = 
activitycalendar_soarena::get_instance();
+                       $this->so_organization = 
activitycalendar_soorganization::get_instance();
+                       $this->so_group = 
activitycalendar_sogroup::get_instance();
+                       $this->so_contact = 
activitycalendar_socontactperson::get_instance();
+               }
+               
                /**
-                * Public method. Forwards the user to edit mode.
+                * Public method. Add new activity.
                 */
                public function add()
                {
                        
//$GLOBALS['phpgw']->redirect_link('/activitycalendarfrontend/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.edit', 'action' => 
'new_activity'));
                        $GLOBALS['phpgw']->js->validate_file( 'json', 'json', 
'phpgwapi' );
 
-                       $so_activity = 
activitycalendar_soactivity::get_instance();
-                       $so_arena = activitycalendar_soarena::get_instance();
-
-                       $categories = $so_activity->get_categories();
-                       $targets = $so_activity->get_targets();
-                       $offices = $so_activity->select_district_list();
-                       $districts = $so_activity->get_districts();
-                       $buildings = $so_arena->get_buildings();
-                       $arenas = $so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
-                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, 'org.name', 
true, null, null, null);
-                       $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
+                       $categories = $this->so_activity->get_categories();
+                       $targets = $this->so_activity->get_targets();
+                       $offices = $this->so_activity->select_district_list();
+                       $districts = $this->so_activity->get_districts();
+                       $buildings = $this->so_arena->get_buildings();
+                       $arenas = $this->so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
+                       $organizations = $this->so_organization->get(null, 
null, 'org.name', true, null, null, null);
                        
+                       $activity = new activitycalendar_activity();
+                       
                        $g_id = phpgw::get_var('group_id');
                        $o_id = phpgw::get_var('organization_id');
                        
-                       $activity = new activitycalendar_activity();
-                       //... set all parameters
-                       $activity->set_title(phpgw::get_var('title'));
-                       $activity->set_organization_id($o_id);
-                       $activity->set_group_id($g_id);
-                       $activity->set_arena(phpgw::get_var('arena_id'));
-                       
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
-                       $district_array = phpgw::get_var('district');
-                       $activity->set_district(implode(",", $district_array));
-                       $activity->set_office(phpgw::get_var('office'));
-                       $activity->set_state(1);
-                       $activity->set_category(phpgw::get_var('category'));
-                       $target_array = phpgw::get_var('target');
-                       $activity->set_target(implode(",", $target_array));
-                       $activity->set_description($desc);
-                       $activity->set_time(phpgw::get_var('time'));
-                       $activity->set_contact_persons($persons);
-                       
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
-                       $activity->set_frontend(true);
-                       
-                       if(isset($g_id) && is_numeric($g_id) && $g_id > 0)
+                       if(isset($_POST['step_1'])) //activity shall be 
registred on a new organization
                        {
-                               $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
-                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
+                               if($o_id == "new_org")
+                               {
+                                       $new_org = true;
+                                       $this->render('activity_new.php', array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'new_organization' => 
true,
+                                                       'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
+                                                       'categories' => 
$categories,
+                                                       'targets' => $targets,
+                                                       'districts' => 
$districts,
+                                                       'offices' => $offices,
+                                                       'editable' => true,
+                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                               )
+                                       );
+                               }
+                               else
+                               {
+                                       $new_org = false;
+                                       $organization = 
$this->so_organization->get_single($o_id);
+                                       $person_arr = 
$this->so_contact->get(null, null, null, null, null, null, 
array('organization_id' => $o_id));
+                                       foreach($person_arr as $p)
+                                       {
+                                               //var_dump($p);
+                                               $persons[] = $p;
+                                       }
+                                       
+                                       $groups = $this->so_group->get(null, 
null, null, null, null, null, array('org_id' => $o_id));
+                                       
+                                       $activity->set_organization_id($o_id);
+                                       
$activity->set_description($organization->get_description());
+                                       $activity->set_contact_persons($pers);
+                                       
+                                       $this->render('activity_new.php', array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'new_organization' => 
false,
+                                                       'organization' => 
$organization,
+                                                       'contact1' => 
$persons[0],
+                                                       'contact2' => 
$persons[1],
+                                                       'groups' => $groups,
+                                                       'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
+                                                       'categories' => 
$categories,
+                                                       'targets' => $targets,
+                                                       'districts' => 
$districts,
+                                                       'offices' => $offices,
+                                                       'editable' => true,
+                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                               )
+                                       );
+                               }
                        }
-                       else if(isset($o_id))
+                       else if(isset($_POST['save_activity']))
                        {
+                               $persons = 
$this->so_organization->get_contacts($o_id);                         
+                               $organization = 
$this->so_organization->get_single($o_id);
+                               
                                if($o_id == "new_org")
                                {
                                        $activity->set_new_org(true);
@@ -84,7 +137,7 @@
                                        //$org_info['zip'] = 
phpgw::get_var('postaddress');
                                        $org_info['district'] = 
phpgw::get_var('org_district'); 
                                        $org_info['status'] = "new";
-                                       $o_id = 
$so_activity->add_organization_local($org_info);
+                                       $o_id = 
$this->so_activity->add_organization_local($org_info);
                                        
                                        //add contact persons
                                        $contact1 = array();
@@ -93,7 +146,7 @@
                                        $contact1['mail'] = 
phpgw::get_var('contact1_email');
                                        $contact1['org_id'] = $o_id;
                                        $contact1['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact1);
+                                       
$this->so_activity->add_contact_person_local($contact1);
                                        
                                        $contact2 = array();
                                        $contact2['name'] = 
phpgw::get_var('contact2_name');
@@ -101,66 +154,11 @@
                                        $contact2['mail'] = 
phpgw::get_var('contact2_email');
                                        $contact2['org_id'] = $o_id;
                                        $contact2['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact2);
+                                       
$this->so_activity->add_contact_person_local($contact2);
                                        
-                                       $persons = 
activitycalendar_soorganization::get_instance()->get_contacts_local($o_id);
+                                       $persons = 
$this->so_organization->get_contacts_local($o_id);
                                        $desc = 
phpgw::get_var('org_description');
-
                                }
-                               else if($o_id == "change_org")
-                               {
-                                       $change_org_id = 
phpgw::get_var('change_organization_id');
-                                       $organization = 
activitycalendar_soorganization::get_instance()->get_single($change_org_id);
-                               
-                                       $org_info['name'] = 
$organization->get_name();
-                                       $org_info['orgnr'] = 
$organization->get_organization_number();
-                                       $org_info['homepage'] = 
$organization->get_homepage();
-                                       $org_info['phone'] = 
$organization->get_phone();
-                                       $org_info['email'] = 
$organization->get_email();
-                                       $org_info['description'] = 
$organization->get_description();
-                                       $org_info['street'] = 
$organization->get_address();
-                                       $org_info['district'] = 
$organization->get_district(); 
-                                       $org_info['status'] = "change";
-                                       $o_id = 
$so_activity->add_organization_local($org_info);
-                                       
-                                       //add contact persons
-                                       $contact1 = array();
-                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                       $contact1['org_id'] = $o_id;
-                                       $contact1['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact1);
-                                       
-                                       $contact2 = array();
-                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                       $contact2['org_id'] = $o_id;
-                                       $contact2['group_id'] = 0;
-                                       
$so_activity->add_contact_person_local($contact2);
-                                       
-                                       $message = lang('change_request_ok', 
$organization->get_name());
-                                       
-                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                                       $this->render('activity_new.php', array
-                                               (
-                                                       'activity'      => 
$activity,
-                                                       'organizations' => 
$organizations,
-                                                       'groups' => $groups,
-                                                       'arenas' => $arenas,
-                                                       'buildings' => 
$buildings,
-                                                       'categories' => 
$categories,
-                                                       'targets' => $targets,
-                                                       'districts' => 
$districts,
-                                                       'offices' => $offices,
-                                                       'editable' => true,
-                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
-                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
-                                               )
-                       );
-                               }
                                else if(is_numeric($o_id) && $o_id > 0)
                                {
                                        if(isset($g_id) && $g_id == "new_group")
@@ -169,7 +167,7 @@
                                                $group_info['organization_id'] 
= $o_id;
                                                $group_info['description'] = 
phpgw::get_var('group_description');
                                                $group_info['status'] = "new";
-                                               $g_id = 
$so_activity->add_group_local($group_info);
+                                               $g_id = 
$this->so_activity->add_group_local($group_info);
                                                
                                                //add contact persons
                                                $contact1 = array();
@@ -178,7 +176,7 @@
                                                $contact1['mail'] = 
phpgw::get_var('contact1_email');
                                                $contact1['org_id'] = 0;
                                                $contact1['group_id'] = $g_id;
-                                               
$so_activity->add_contact_person_local($contact1);
+                                               
$this->so_activity->add_contact_person_local($contact1);
                                                
                                                $contact2 = array();
                                                $contact2['name'] = 
phpgw::get_var('contact2_name');
@@ -186,102 +184,110 @@
                                                $contact2['mail'] = 
phpgw::get_var('contact2_email');
                                                $contact2['org_id'] = 0;
                                                $contact2['group_id'] = $g_id;
-                                               
$so_activity->add_contact_person_local($contact2);
+                                               
$this->so_activity->add_contact_person_local($contact2);
                                                
-                                               $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts_local($g_id);
+                                               $activity_persons = 
$this->so_group->get_contacts_local($g_id);
                                                $desc = 
phpgw::get_var('group_description');
                                        }
-                                       else
+                                       else if(isset($g_id) && 
is_numeric($g_id) && $g_id > 0)
                                        {
-                                               $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
-                                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
+                                               $persons = 
$this->so_group->get_contacts($g_id);
+                                               $desc = 
$this->so_group->get_description($g_id);
                                        }
+                                       else if(isset($o_id) && 
is_numeric($o_id) && $o_id > 0)
+                                       {
+                                               $persons = 
$this->so_organization->get_contacts($o_id);
+                                               $desc = 
$this->so_organization->get_description($o_id);
+                                       }
                                }
-                       }
-                       
-                       if(isset($_POST['save_activity'])) // The user has 
pressed the save button
-                       {
-                               if(isset($activity)) // If an activity object 
is created
+                               else
                                {
-                                       $target_ok = false;
-                                       $district_ok = false;
-                                       if($activity->get_target() && 
$activity->get_target() != '')
+                                       if(isset($g_id) && is_numeric($g_id) && 
$g_id > 0)
                                        {
-                                               $target_ok = true;
+                                               $persons = 
$this->so_group->get_contacts($g_id);
+                                               $desc = 
$this->so_group->get_description($g_id);
                                        }
-                                       if($activity->get_district() && 
$activity->get_district() != '')
+                                       else if(isset($o_id) && 
is_numeric($o_id) && $o_id > 0)
                                        {
-                                               $district_ok = true;
+                                               $persons = 
$this->so_organization->get_contacts($o_id);
+                                               $desc = 
$this->so_organization->get_description($o_id);
                                        }
-                                       
-                                       if($target_ok && $district_ok)
+                               }
+                               
+                               //... set all parameters
+                               $activity->set_title(phpgw::get_var('title'));
+                               $activity->set_organization_id($o_id);
+                               $activity->set_group_id($g_id);
+                               
$activity->set_arena(phpgw::get_var('arena_id'));
+                               
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
+                               $district_array = phpgw::get_var('district');
+                               $activity->set_district(implode(",", 
$district_array));
+                               $activity->set_office(phpgw::get_var('office'));
+                               $activity->set_state(1);
+                               
$activity->set_category(phpgw::get_var('category'));
+                               $target_array = phpgw::get_var('target');
+                               $activity->set_target(implode(",", 
$target_array));
+                               $activity->set_description($desc);
+                               $activity->set_time(phpgw::get_var('time'));
+                               $activity->set_contact_persons($persons);
+                               
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+                               $activity->set_frontend(true);
+                               
+                               $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($so_activity->store($activity)) // ... and then try to store the object
-                                               {
-                                                       $message = 
lang('messages_saved_form'); 
-                                               }
-                                               else
-                                               {
-                                                       $error = 
lang('messages_form_error');
-                                               }
-
-                                               
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-       
-                                               $this->render('activity.php', 
array
-                                                                       (
-                                                                               
'activity'      => $activity,
-                                                                               
'organizations' => $organizations,
-                                                                               
'groups' => $groups,
-                                                                               
'arenas' => $arenas,
-                                                                               
'buildings' => $buildings,
-                                                                               
'categories' => $categories,
-                                                                               
'targets' => $targets,
-                                                                               
'districts' => $districts,
-                                                                               
'offices' => $offices,
-                                                                               
'message' => isset($message) ? $message : phpgw::get_var('message'),
-                                                                               
'error' => isset($error) ? $error : phpgw::get_var('error')
-                                                                       )
-                                               );
+                                               $message = 
lang('messages_saved_form'); 
                                        }
                                        else
                                        {
-                                               if(!$target_ok)
-                                               {
-                                                       $error .= "<br/>" . 
lang('target_not_selected');
-                                               }
-                                               if(!$district_ok)
-                                               {
-                                                       $error .= "<br/>" . 
lang('district_not_selected');
-                                               }
-                                               return 
$this->render('activity_new.php', array
-                                                       (
-                                                               'activity'      
=> $activity,
-                                                               'organizations' 
=> $organizations,
-                                                               'org_name' => 
$org_name,
-                                                               'groups' => 
$groups,
-                                                               'arenas' => 
$arenas,
-                                                               'buildings' => 
$buildings,
-                                                               'categories' => 
$categories,
-                                                               'targets' => 
$targets,
-                                                               'districts' => 
$districts,
-                                                               'offices' => 
$offices,
-                                                               'editable' => 
true,
-                                                               'cancel_link' 
=> $cancel_link,
-                                                               'message' => 
isset($message) ? $message : phpgw::get_var('message'),
-                                                               'error' => 
isset($error) ? $error : phpgw::get_var('error')
-                                                       )       
-                                               );
+                                               $error = 
lang('messages_form_error');
                                        }
-                               }
-                       }
-                       
-                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
-                       $this->render('activity_new.php', array
+                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+                                       $this->render('activity.php', array
+                                                               (
+                                                                       
'activity'      => $activity,
+                                                                       
'organizations' => $organizations,
+                                                                       
'groups' => $groups,
+                                                                       
'arenas' => $arenas,
+                                                                       
'buildings' => $buildings,
+                                                                       
'categories' => $categories,
+                                                                       
'targets' => $targets,
+                                                                       
'districts' => $districts,
+                                                                       
'offices' => $offices,
+                                                                       
'message' => isset($message) ? $message : phpgw::get_var('message'),
+                                                                       'error' 
=> isset($error) ? $error : phpgw::get_var('error')
+                                                               )
+                                       );
+                               }
+                               else
+                               {
+                                       if(!$target_ok)
+                                       {
+                                               $error .= "<br/>" . 
lang('target_not_selected');
+                                       }
+                                       if(!$district_ok)
+                                       {
+                                               $error .= "<br/>" . 
lang('district_not_selected');
+                                       }
+                                       return 
$this->render('activity_new.php', array
                                                (
                                                        'activity'      => 
$activity,
                                                        'organizations' => 
$organizations,
+                                                       'org_name' => $org_name,
                                                        'groups' => $groups,
                                                        'arenas' => $arenas,
                                                        'buildings' => 
$buildings,
@@ -290,10 +296,21 @@
                                                        'districts' => 
$districts,
                                                        'offices' => $offices,
                                                        'editable' => true,
+                                                       'cancel_link' => 
$cancel_link,
                                                        'message' => 
isset($message) ? $message : phpgw::get_var('message'),
                                                        'error' => 
isset($error) ? $error : phpgw::get_var('error')
-                                               )
-                       );
+                                               )       
+                                       );
+                               }
+                       }
+                       else
+                       {
+                               return $this->render('activity_new_step_1.php', 
array
+                                               (
+                                                       'organizations' => 
$organizations
+                                               )       
+                                       );
+                       }
                }
                
                function view()
@@ -324,7 +341,6 @@
                        $GLOBALS['phpgw']->js->validate_file( 'json', 'json', 
'phpgwapi' );
 
                        $id = intval(phpgw::get_var('id', 'GET'));
-                       $action = phpgw::get_var('action', 'GET');
 
                        $so_activity = 
activitycalendar_soactivity::get_instance();
                        $so_arena = activitycalendar_soarena::get_instance();
@@ -345,31 +361,20 @@
                        }
                        else
                        {
-                               $activity = new activitycalendar_activity();
+                               $this->redirect(array('menuaction' => 
'bookingfrontend.uisearch.index'));
                        }
                        
                        if($activity->get_secret() != phpgw::get_var('secret', 
'GET'))
                        {
-                               if($action != 'new_activity')
-                               {
-                                       $this->redirect(array('menuaction' => 
'bookingfrontend.uisearch.index'));
-                               }
+                               $this->redirect(array('menuaction' => 
'bookingfrontend.uisearch.index'));
                        }
                        
                        $g_id = phpgw::get_var('group_id');
                        $o_id = phpgw::get_var('organization_id');
                        if(isset($g_id) && is_numeric($g_id) && $g_id > 0)
                        {
-                               /*if($g_id == "new_group")
-                               {
-                                       //add new group to internal 
activitycalendar group register
-                               }
-                               else*/ 
-                               //if(is_numeric($g_id) && $g_id > 0)
-                               //{
-                                       $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
-                                       $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
-                               //}
+                               $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
+                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
                        }
                        else if(isset($o_id))
                        {
@@ -447,7 +452,7 @@
                                        
                                        
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
-                                       $this->render('activity.php', array
+                                       $this->render('activity_edit.php', array
                                                (
                                                        'activity'      => 
$activity,
                                                        'organizations' => 
$organizations,
@@ -518,15 +523,7 @@
                                        $district_array = 
phpgw::get_var('district');
                                        $activity->set_district(implode(",", 
$district_array));
                                        
$activity->set_office(phpgw::get_var('office'));
-                                       if($action == 'new_activity')
-                                       {
-                                               $activity->set_state(1);
-                                               $new_state=1;
-                                       }
-                                       else
-                                       {
-                                               
$activity->set_state($new_state);
-                                       }
+                                       $activity->set_state(2);
                                        
$activity->set_category(phpgw::get_var('category'));
                                        $target_array = 
phpgw::get_var('target');
                                        $activity->set_target(implode(",", 
$target_array));
@@ -559,21 +556,6 @@
                                                        $error = 
lang('messages_form_error');
                                                }
                
-                                               if($new_state == 3 || 
$new_state == 4 || $new_state == 5 )
-                                               {
-                                                       $kontor = 
$so_activity->get_office_name($activity->get_office());
-                                                       $subject = "Melding fra 
AktivBy";
-                                                       $body = 
lang('mail_body_state_' . $new_state, $kontor);
-                                                       
-                                                       if(isset($g_id) && 
$g_id > 0)
-                                                       {
-                                                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
-                                                       }
-                                                       else if (isset($o_id) 
&& $o_id > 0)
-                                                       {
-                                                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
-                                                       }
-                                               }
                                                
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
        
                                                $this->render('activity.php', 
array
@@ -647,7 +629,6 @@
                function index()
                {
                        $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.add'));
-                       //var_dump("inni index");
                }
                
                public function get_organization_groups()

Modified: trunk/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendarfrontend/setup/phpgw_no.lang  2011-11-20 21:02:53 UTC 
(rev 8134)
+++ trunk/activitycalendarfrontend/setup/phpgw_no.lang  2011-11-20 21:45:19 UTC 
(rev 8135)
@@ -1,6 +1,6 @@
 activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
 Activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
-office activitycalendarfrontend        no      Kontor
+office activitycalendarfrontend        no      Hovedansvarlig kulturkontor
 arena  activitycalendarfrontend        no      Arena
 description    activitycalendarfrontend        no      Beskrivelse
 date_start     activitycalendarfrontend        no      Startdato
@@ -49,18 +49,38 @@
 rejected       activitycalendarfrontend        no      Avvist
 activity       activitycalendarfrontend        no      Aktivitet
 organization   activitycalendarfrontend        no      Organisasjon
-group  activitycalendarfrontend        no      Gruppe
+group  activitycalendarfrontend        no      Gruppe/Lag
 district       activitycalendarfrontend        no      Bydel
 title  activitycalendarfrontend        no      Tittel
 activity_helptext      activitycalendarfrontend        no      Før ny 
aktivitet kan registreres må du sjekke at organisasjon/gruppe finnes og er 
oppdatert, og at arena finnes og er oppdatert.
 building       activitycalendarfrontend        no      Kommunale bygg
 title_helptext activitycalendarfrontend        no      Skriv inn tittel på 
aktiviteten slik du vil den skal vises i kommuneportalen
-org_helptext   activitycalendarfrontend        no      Velg organisasjon 
aktiviteten skal knyttes til. <br/>Dersom din organisasjon ikke finnes, velg 
"Ny organisasjon" og fyll ut feltene som vises under. <br/> For å sende inn 
forespørsel om å endre en organisasjon, velg "Endre organisasjon" og velg den 
aktuelle organisasjonen fra listen som vises. <br/>Deretter klikker du på 
"Lagre" for å sende inn endringsønsket. 
-group_helptext activitycalendarfrontend        no      Velg gruppe/lag 
aktiviteten skal knyttes til. <br/>Dersom gruppen/laget ikke finnes, velg "Ny 
gruppe" og fyll ut feltene som vises under.
 int_arena_helptext     activitycalendarfrontend        no      Dersom 
aktiviteten skal finne sted i et kommunalt bygg velges dette fra listen her.
 arena_helptext activitycalendarfrontend        no      Dersom aktiviteten skal 
finne sted på en ikke-kommunal arena, velges dette her.<br/>Dersom aktiviteten 
finner sted på flere arenaer, velg hovedarena her.
 messages_saved_form    activitycalendarfrontend        no      Aktiviteten ble 
lagret
 messages_form_error    activitycalendarfrontend        no      Det oppstod et 
problem under lagring
 change_request_ok      activitycalendarfrontend        no      Endringsønske 
for organisasjon er sendt inn for organisasjon %1
 target_not_selected    activitycalendarfrontend        no      Målgruppe må 
velges!
-district_not_selected  activitycalendarfrontend        no      Distrikt må 
velges!
\ No newline at end of file
+district_not_selected  activitycalendarfrontend        no      Distrikt må 
velges!
+org_helptext   activitycalendarfrontend        no      Velg organisasjon 
aktiviteten skal knyttes til i nedtrekksmenyen, du kan søke ved å skrive inn 
navnet.<br/>Dersom din organisasjon ikke finnes, velg "Ny organisasjon" og fyll 
ut feltene som vises under. 
+group_helptext activitycalendarfrontend        no      Om aktiviteten skal 
knyttes til en spesiell gruppe/lag velger du det her.<br/>Dersom gruppen/laget 
ikke finnes, velg "Ny gruppe" og fyll ut feltene som vises under. Du trenger 
ikke velge en gruppe.
+criteria_label activitycalendarfrontend        no      Valgkriterier/søkeord i 
portalen
+criteria_helptext      activitycalendarfrontend        no      Feltene må 
fylles ut for at aktiviteten skal komme frem i søk i portalen, koder for 
kategori og målgruppe hentes fra booking. 
+what   activitycalendarfrontend        no      HVA
+where_when     activitycalendarfrontend        no      HVOR/NÅR
+who    activitycalendarfrontend        no      HVEM
+arena_helptext activitycalendarfrontend        no      Oppgi arena ved å velge 
kommunalt bygg eller eksterne bygg.
+external_arena activitycalendarfrontend        no      Eksterne bygg
+category_helptext      activitycalendarfrontend        no      Velg kategori
+target_helptext        activitycalendarfrontend        no      Velg 
målgruppe(r)
+district_helptext      activitycalendarfrontend        no      Velg bydel(er) 
hvor aktiviteten foregår
+adaptation_helptext    activitycalendarfrontend        no      Kryss av om 
aktiviteten er spesielt tilpasset
+time_helptext  activitycalendarfrontend        no      Oppgi tidspunkt for 
aktiviteten, f.eks. onsdag kl. 20-21
+office_helptext        activitycalendarfrontend        no      Oppgi kontor 
som saksbehandler aktiviteten
+contact_info   activitycalendarfrontend        no      Kontaktinformasjon for 
kulturkontoret
+contact_info_helptext  activitycalendarfrontend        no      Hentes fra 
booking/organisasjonsregister ved lagring.
+store_org_group        activitycalendarfrontend        no      Lagre 
organisasjon/gruppe
+save_activity  activitycalendarfrontend        no      Send
+org_helptext_step1     activitycalendarfrontend        no      Velg 
organisasjon aktiviteten skal knyttes til i nedtrekksmenyen, du kan søke ved å 
skrive inn navnet.<br/>Dersom din organisasjon ikke finnes, velg "Ny 
organisasjon"<br/>Klikk deretter på "Neste" for å registrere aktivitet.
+next   activitycalendarfrontend        no      Neste
+new_activity   activitycalendarfrontend        no      Ny aktivitet
\ No newline at end of file

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




reply via email to

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