fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8099]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8099]
Date: Mon, 14 Nov 2011 08:28:03 +0000

Revision: 8099
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8099
Author:   erikhl
Date:     2011-11-14 08:28:02 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.uiactivities.inc.php
    trunk/activitycalendar/setup/phpgw_no.lang
    trunk/activitycalendar/templates/base/activity.php
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
    trunk/activitycalendarfrontend/setup/phpgw_no.lang
    trunk/activitycalendarfrontend/templates/base/activity.php

Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-11-14 
08:04:28 UTC (rev 8098)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-11-14 
08:28:02 UTC (rev 8099)
@@ -193,31 +193,74 @@
                                
$activity->set_contact_person_2_zip(phpgw::get_var('contact_person_2_zip'));
                                
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
                                
-                               if($so_activity->store($activity)) // ... and 
then try to store the object
+                               $target_ok = false;
+                               $district_ok = false;
+                               if($activity->get_target() && 
$activity->get_target() != '')
                                {
-                                       $message = lang('messages_saved_form'); 
+                                       $target_ok = true;
                                }
-                               else
+                               if($activity->get_district() && 
$activity->get_district() != '')
                                {
-                                       $error = lang('messages_form_error');
+                                       $district_ok = true;
                                }
-
-                               if($new_state == 3 || $new_state == 5 )
+                               
+                               if($target_ok && $district_ok)
                                {
-                                       $kontor = 
$so_activity->get_office_name($activity->get_office());
-                                       $subject = "Melding fra AktivBy";
-                                       $body = lang('mail_body_state_' . 
$new_state, $kontor);
-                                       
-                                       if(isset($g_id) && $g_id > 0)
+                                       if($so_activity->store($activity)) // 
... and then try to store the object
                                        {
-                                               
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                               $message = 
lang('messages_saved_form'); 
                                        }
-                                       else if (isset($o_id) && $o_id > 0)
+                                       else
                                        {
-                                               
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                               $error = 
lang('messages_form_error');
                                        }
+       
+                                       if($new_state == 3 || $new_state == 5 )
+                                       {
+                                               $kontor = 
$so_activity->get_office_name($activity->get_office());
+                                               $subject = "Melding fra 
AktivBy";
+                                               $body = lang('mail_body_state_' 
. $new_state, $kontor);
+                                               
+                                               if(isset($g_id) && $g_id > 0)
+                                               {
+                                                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),$subject,$body);
+                                               }
+                                               else if (isset($o_id) && $o_id 
> 0)
+                                               {
+                                                       
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),$subject,$body);
+                                               }
+                                       }
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.view', 'id' => $activity->get_id(), 'saved_ok' 
=> 'yes'));
                                }
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.view', 'id' => 
$activity->get_id(), 'saved_ok' => 'yes'));
+                               else
+                               {
+                                       if(!$target_ok)
+                                       {
+                                               $error .= "<br/>" . 
lang('target_not_selected');
+                                       }
+                                       if(!$district_ok)
+                                       {
+                                               $error .= "<br/>" . 
lang('district_not_selected');
+                                       }
+                                       return $this->render('activity.php', 
array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'organizations' => 
$organizations,
+                                                       'org_name' => $org_name,
+                                                       'groups' => $groups,
+                                                       'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
+                                                       'categories' => 
$categories,
+                                                       'targets' => $targets,
+                                                       'districts' => 
$districts,
+                                                       'offices' => $offices,
+                                                       'editable' => true,
+                                                       'cancel_link' => 
$cancel_link,
+                                                       'message' => 
isset($message) ? $message : phpgw::get_var('message'),
+                                                       'error' => 
isset($error) ? $error : phpgw::get_var('error')
+                                               )       
+                                       );
+                               }
                        }
                }
 

Modified: trunk/activitycalendar/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendar/setup/phpgw_no.lang  2011-11-14 08:04:28 UTC (rev 
8098)
+++ trunk/activitycalendar/setup/phpgw_no.lang  2011-11-14 08:28:02 UTC (rev 
8099)
@@ -402,4 +402,6 @@
 published      activitycalendar        no      Publisert
 contactperson_not_set  activitycalendar        no      Kontaktpersoner hentes 
fra valgt organisasjon/gruppe ved lagring.
 description_not_set    activitycalendar        no      Beskrivelse hentes fra 
valgt organisasjon/gruppe ved lagring (Max 255 tegn).
-back_to_list   activitycalendar        no      Tilbake til oversikt
\ No newline at end of file
+back_to_list   activitycalendar        no      Tilbake til oversikt
+target_not_selected    activitycalendar        no      Målgruppe må velges!
+district_not_selected  activitycalendar        no      Distrikt må velges!
\ No newline at end of file

Modified: trunk/activitycalendar/templates/base/activity.php
===================================================================
--- trunk/activitycalendar/templates/base/activity.php  2011-11-14 08:04:28 UTC 
(rev 8098)
+++ trunk/activitycalendar/templates/base/activity.php  2011-11-14 08:28:02 UTC 
(rev 8099)
@@ -70,7 +70,7 @@
        }
        if(document.getElementById('office').value == null || 
document.getElementById('office').value == 0)
        {
-               alert("Hocedansvarlig kulturkontor må fylles ut!");
+               alert("Hovedansvarlig kulturkontor må fylles ut!");
                return false;
        }
        else
@@ -78,6 +78,7 @@
 }
 </script>
 <?php echo activitycalendar_uicommon::get_page_message($message) ?>
+<?php echo activitycalendar_uicommon::get_page_error($error) ?>
 <div class="yui-content">
        <div id="details">
                <h1><img src="<?php echo ACTIVITYCALENDAR_IMAGE_PATH 
?>images/32x32/custom/contact.png" /><?php echo lang('activity') ?></h1>

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

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

Modified: trunk/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity.php  2011-11-14 
08:04:28 UTC (rev 8098)
+++ trunk/activitycalendarfrontend/templates/base/activity.php  2011-11-14 
08:28:02 UTC (rev 8099)
@@ -114,6 +114,45 @@
        
 }
 
+function allOK()
+{
+       if(document.getElementById('title').value == null || 
document.getElementById('title').value == '')
+       {
+               alert("Tittel må fylles ut!");
+               return false;
+       } 
+       if(document.getElementById('organization_id').value == null || 
document.getElementById('organization_id').value == '')
+       {
+               alert("Organisasjon må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('internal_arena_id').value == null || 
document.getElementById('internal_arena_id').value == 0)
+       {
+               if(document.getElementById('arena_id').value == null || 
document.getElementById('arena_id').value == 0)
+               {
+                       alert("Arena må fylles ut!");
+                       return false;
+               }
+       }
+       if(document.getElementById('time').value == null || 
document.getElementById('time').value == '')
+       {
+               alert("Tid må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('category').value == null || 
document.getElementById('category').value == 0)
+       {
+               alert("Kategori må fylles ut!");
+               return false;
+       }
+       if(document.getElementById('office').value == null || 
document.getElementById('office').value == 0)
+       {
+               alert("Hovedansvarlig kulturkontor må fylles ut!");
+               return false;
+       }
+       else
+               return true;
+}
+
 </script>
 
 <div class="yui-content" style="width: 100%;">
@@ -330,7 +369,7 @@
                                        {
                                                ?>
                                                <?php echo 
lang('int_arena_helptext')?><br/>
-                                               <select 
name="internal_arena_id">
+                                               <select 
name="internal_arena_id" id="internal_arena_id">
                                                        <option value="0">Ingen 
kommunale bygg valgt</option>
                                                        <?php
                                                        foreach($buildings as 
$building_id => $building_name)
@@ -361,7 +400,7 @@
                                        {
                                                ?>
                                                <?php echo 
lang('arena_helptext')?><br/>
-                                               <select name="arena_id" 
style="width: 60%">
+                                               <select name="arena_id" 
id="arena_id" style="width: 60%">
                                                        <option value="0">Ingen 
arena valgt</option>
                                                        <?php
                                                        foreach($arenas as 
$arena)
@@ -418,7 +457,7 @@
                                        if ($editable)
                                        {
                                                ?>
-                                               <select name="category">
+                                               <select name="category" 
id="category">
                                                        <option value="0">Ingen 
kategori valgt</option>
                                                        <?php
                                                        foreach($categories as 
$category)
@@ -480,7 +519,7 @@
                                        {
                                                $selected_office = 
$activity->get_office();
                                        ?>
-                                               <select name="office">
+                                               <select name="office" 
id="office">
                                                        <option value="0">Ingen 
kontor valgt</option>
                                                        <?php
                                                        foreach($offices as 
$office)
@@ -602,7 +641,7 @@
                        <div class="form-buttons">
                                <?php
                                        if ($editable) {
-                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '"/>';
+                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '" onclick="return allOK();"/>';
                                        }
                                ?>
                        </div>




reply via email to

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