fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11947] bkbooking: stavanger added edit /delete event


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [11947] bkbooking: stavanger added edit /delete event in frontend
Date: Tue, 06 May 2014 08:28:07 +0000

Revision: 11947
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11947
Author:   kjell
Date:     2014-05-06 08:28:06 +0000 (Tue, 06 May 2014)
Log Message:
-----------
bkbooking: stavanger added edit /delete event in frontend

Modified Paths:
--------------
    branches/stavangerkommune/booking/inc/class.boapplication.inc.php
    branches/stavangerkommune/booking/inc/class.boevent.inc.php
    branches/stavangerkommune/booking/inc/class.soapplication.inc.php
    branches/stavangerkommune/booking/inc/class.soevent.inc.php
    branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
    branches/stavangerkommune/booking/inc/class.uievent.inc.php
    branches/stavangerkommune/booking/setup/phpgw_no.lang
    branches/stavangerkommune/booking/setup/setup.inc.php
    branches/stavangerkommune/booking/setup/tables_current.inc.php
    branches/stavangerkommune/booking/setup/tables_update.inc.php
    branches/stavangerkommune/booking/templates/base/event_mail_settings.xsl
    branches/stavangerkommune/booking/templates/base/settings.xsl
    branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php
    branches/stavangerkommune/bookingfrontend/setup/phpgw_no.lang
    branches/stavangerkommune/bookingfrontend/setup/setup.inc.php
    branches/stavangerkommune/bookingfrontend/templates/stavanger/event_info.xsl

Added Paths:
-----------
    branches/stavangerkommune/booking/inc/class.sopermission_event.inc.php
    
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_delete.xsl
    branches/stavangerkommune/bookingfrontend/templates/stavanger/event_edit.xsl

Modified: branches/stavangerkommune/booking/inc/class.boapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.boapplication.inc.php   
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/inc/class.boapplication.inc.php   
2014-05-06 08:28:06 UTC (rev 11947)
@@ -64,12 +64,13 @@
                                }
 
                                $buildingemail = 
$this->get_tilsyn_email($application['building_name']);
-                               if ($buildingemail['email1'] != '') {
+                               if ($buildingemail['email1'] != '' || 
$buildingemail['email2'] != '' || $buildingemail['email3'] != '') {
                                        $resourcename = 
implode(",",$this->get_resource_name($application['resources']));
                                        $bsubject = "Aktivby: En søknad om 
leie/lån av ".$resourcename." på ".$application['building_name']." er godkjent";
                                        $bbody = 
"<p>".$application['contact_name']." sin søknad  om leie/lån av 
".$resourcename." på ".$application['building_name']."</p>"; 
                                        $bbody .= "<p>Den ".$adates."er 
Godkjent</p>";
-                               
+                    $bbody .= "<p><b>Ekstra informasjon fra søker:</b><br 
/>".$application['equipment']."</p>";
+
                                        foreach ($buildingemail as $bemail)
                                        {
                                                try

Modified: branches/stavangerkommune/booking/inc/class.boevent.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.boevent.inc.php 2014-05-05 
12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/inc/class.boevent.inc.php 2014-05-06 
08:28:06 UTC (rev 11947)
@@ -1,19 +1,229 @@
 <?php
-       phpgw::import_class('booking.bocommon');
-       
-       class booking_boevent extends booking_bocommon
-       {
-               function __construct()
-               {
-                       parent::__construct();
-                       $this->so = CreateObject('booking.soevent');
-               }
-               
-               public function complete_expired(&$events) {
-                       $this->so->complete_expired($events);
-               }
-               
-               public function find_expired() {
-                       return $this->so->find_expired();
-               }
+phpgw::import_class('booking.bocommon_authorized');
+
+class booking_boevent extends booking_bocommon_authorized
+{
+    const ROLE_ADMIN = 'organization_admin';
+
+    function __construct()
+    {
+        parent::__construct();
+        $this->so = CreateObject('booking.soevent');
+    }
+    /**
+     * @see booking_bocommon_authorized
+     */
+    protected function get_subject_roles($for_object = null, 
$initial_roles=array())
+    {
+        if ($this->current_app() == 'bookingfrontend') {
+            $bouser = CreateObject('bookingfrontend.bouser');
+
+            if (is_array($for_object) && 
$for_object['customer_organization_number']) {
+                $org = 
$this->so->get_org($for_object['customer_organization_number']);
+                $for_object['customer_organization_id'] = $org['id'];
+                $for_object['customer_organization_name'] = $org['name'];
+            }
+
+            $org_id = is_array($for_object) ? 
$for_object['customer_organization_id'] : (!is_null($for_object) ? $for_object 
: null);
+
+            if ($bouser->is_organization_admin($org_id)) {
+                $initial_roles[] = array('role' => self::ROLE_ADMIN);
+            }
+        }
+        return parent::get_subject_roles($for_object, $initial_roles);
+    }
+
+    /**
+     * @see bocommon_authorized
+     */
+    protected function get_object_role_permissions(array $forObject, 
$defaultPermissions)
+    {
+        if ($this->current_app() == 'booking') {
+            $defaultPermissions[booking_sopermission::ROLE_DEFAULT] = array
+            (
+                'read'                 => true,
+                'delete'       => true,
+                'write'        => true,
+                'create'       => true,
+            );
+        }
+
+        if ($this->current_app() == 'bookingfrontend') {
+            $defaultPermissions[self::ROLE_ADMIN] = array
+            (
+                'write' => 
array_fill_keys(array('active','description','from_','to_','contact_name','contact_email',
+                                                 
'contact_phone','activity_name','audience','agegroups','is_public'), true),
+            );
+        }
+
+        return $defaultPermissions;
+    }
+
+    /**
+     * @see bocommon_authorized
+     */
+    protected function get_collection_role_permissions($defaultPermissions)
+    {
+        if ($this->current_app() == 'booking')
+        {
+            $defaultPermissions[booking_sopermission::ROLE_DEFAULT]['create'] 
= true;
+            $defaultPermissions[booking_sopermission::ROLE_DEFAULT]['write'] = 
true;
+        }
+
+        return $defaultPermissions;
+    }
+
+    public function get_permissions(array $entity)
+    {
+        return parent::get_permissions($entity);
+    }
+
+    public function complete_expired(&$events) {
+           $this->so->complete_expired($events);
        }
+
+       public function find_expired() {
+           return $this->so->find_expired();
+       }
+
+    /**
+     * @ Send message about cancelation/modification on event to users of 
building.
+     */
+    function send_notification($type, $event, $mailadresses, $orgdate = null)
+    {
+        if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server']))
+            return;
+        $send = CreateObject('phpgwapi.send');
+
+        $config        = CreateObject('phpgwapi.config','booking');
+        $config->read();
+
+        $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+        $external_site_address = 
isset($config->config_data['external_site_address']) && 
$config->config_data['external_site_address'] ? 
$config->config_data['external_site_address'] : 
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+//        $link = 
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+//        $link .= 
$event['building_id'].'&building_name='.urlencode($event['building_name']).'&from_[]=';
+//        $link .= 
urlencode($event['from_']).'&to_[]='.urlencode($event['to_']).'&resource='.implode(",",$event['resources']);
+
+
+        $link = 
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uibuilding.schedule&id=';
+        $link .= $event['building_id'].'&date='.substr($event['from_'], 0, 10);
+        $body = "";
+        $subject = "";
+        if (!$type) {
+            $subject .= $config->config_data['event_canceled_mail_subject'];
+            $body .= "<p>".$config->config_data['event_canceled_mail'];
+        } else {
+            $subject .= $config->config_data['event_edited_mail_subject'];
+            $body .= "<p>".$config->config_data['event_edited_mail'];
+        }
+
+        if ($_POST['org_from'] < $event['from_'] && $_POST['org_to'] == 
$event['to_']) {
+            $event['from_'] = $_POST['org_from'];
+            $event['to_'] = $event['from_'];
+            $freetime = pretty_timestamp($event['from_']).' til 
'.pretty_timestamp($event['to_']);
+        }
+        elseif ($_POST['org_from'] == $event['from_'] && $_POST['org_to'] > 
$event['to_']) {
+            $event['from_'] = $event['to_'];
+            $event['to_'] = $_POST['org_to'];
+            $freetime = pretty_timestamp($event['from_']).' til 
'.pretty_timestamp($event['to_']);
+        }
+        elseif ($_POST['org_from'] < $event['from_'] && $_POST['org_to'] > 
$event['to_']) {
+            $freetime = pretty_timestamp($_POST['org_from']).' til 
'.pretty_timestamp($event['from_'])." og \n";
+            $freetime .= pretty_timestamp($event['to_']).' til 
'.pretty_timestamp($_POST['org_to']);
+        }
+
+        $body .= '</p><p>'.$event['customer_organization_name'].' har 
avbestilt tid i '.$event['building_name'].':<br />';
+        $body .= implode(", 
",$this->so->get_resources(implode(",",$event['resources']))).' den '.$freetime;
+        $body .= ' - <a href="'.$link.'">'.lang('Check calendar').'</a></p>';
+        $body .= 
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+        echo "<pre>\n";
+        print_r($mailadresses);
+        echo "\n";
+        print_r($from);
+        echo "\n";
+        print_r($subject);
+        echo "\n";
+        print_r($body);
+        echo "\n";
+        print_r($event);
+        exit;
+        foreach ($mailadresses as $adr)
+        {
+            try
+            {
+                $send->msg('email', $adr, $subject, $body, '', '', '', $from, 
'', 'html');
+            }
+            catch (phpmailerException $e)
+            {
+                // TODO: Inform user if something goes wrong
+            }
+        }
+    }
+
+    /**
+     * @ Send message about cancelation/modification on event to admins of 
building.
+     */
+    function send_admin_notification($type, $event, $message = null, $orgdate 
= null)
+    {
+        if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server']))
+            return;
+        $send = CreateObject('phpgwapi.send');
+
+        $config        = CreateObject('phpgwapi.config','booking');
+        $config->read();
+
+        $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+        $external_site_address = 
isset($config->config_data['external_site_address']) && 
$config->config_data['external_site_address'] ? 
$config->config_data['external_site_address'] : 
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+        if (!$type) {
+            $subject = $config->config_data['event_canceled_mail_subject'];
+        } else {
+            $subject = $config->config_data['event_edited_mail_subject'];
+        }
+
+        $body = '<b>Beksjed fra 
'.$event['customer_organization_name'].'</b><br />'.$message.'<br /><br/>';
+        $body .= '<b>Kontaktperson:</b> '.$event['contact_name'].'<br />';
+        $body .= '<b>Epost:</b> '.$event['contact_email'].'<br />';
+        $body .= '<b>Telefon:</b> '.$event['contact_phone'].'<br /><br />';
+        $body .= '<br /><b>Epost som er sendt til brukere av Hallen:</b><br 
/>';
+
+        $mailadresses = $config->config_data['emails'];
+        $mailadresses = explode("\n",$mailadresses);
+
+//        $link = 
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+//        $link .= 
$event['building_id'].'&building_name='.urlencode($event['building_name']).'&from_[]=';
+//        $link .= 
urlencode($event['from_']).'&to_[]='.urlencode($event['to_']).'&resource='.implode(",",$event['resources']);
+        $link = 
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uibuilding.schedule&id=';
+        $link .= $event['building_id'].'&date='.substr($event['from_'], 0, 10);
+
+        $body .= "<p>".$config->config_data['event_canceled_mail'];
+        $body .= '</p><p>'.$event['customer_organization_name'].' har 
avbestilt tid i '.$event['building_name'].':<br />';
+        $body .= implode(", 
",$this->so->get_resources(implode(",",$event['resources']))).' den 
'.pretty_timestamp($event['from_']);
+        $body .=' til '.pretty_timestamp($event['to_']);
+        $body .= ' - <a href="'.$link.'">'.lang('Apply for time').'</a></p>';
+        $body .= 
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+        echo "admin: ";
+        print_r($subject);
+        print_r($body);
+        print_r($_POST);
+        print_r($event);
+        exit;
+        foreach ($mailadresses as $adr)
+        {
+            try
+            {
+                $send->msg('email', $adr, $subject, $body, '', '', '', $from, 
'', 'html');
+            }
+            catch (phpmailerException $e)
+            {
+                // TODO: Inform user if something goes wrong
+            }
+        }
+    }
+
+}

Modified: branches/stavangerkommune/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soapplication.inc.php   
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/inc/class.soapplication.inc.php   
2014-05-06 08:28:06 UTC (rev 11947)
@@ -159,14 +159,15 @@
 
                function get_tilsyn_email($id)
                {
-                       $sql = "SELECT tilsyn_email, tilsyn_email2 FROM 
bb_building where id=(select id from bb_building where name = '$id' AND active 
= 1)";
+                       $sql = "SELECT tilsyn_email, tilsyn_email2, email FROM 
bb_building where id=(select id from bb_building where name = '$id' AND active 
= 1)";
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
                        if(!$this->db->next_record())
                        {
                                return False;
                        }
                        return array('email1' => $this->db->f('tilsyn_email', 
false),
-                                                'email2' => 
$this->db->f('tilsyn_email2', false));
+                                                'email2' => 
$this->db->f('tilsyn_email2', false),
+                         'email3' => $this->db->f('email', false));
 
                }
 

Modified: branches/stavangerkommune/booking/inc/class.soevent.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soevent.inc.php 2014-05-05 
12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/inc/class.soevent.inc.php 2014-05-06 
08:28:06 UTC (rev 11947)
@@ -13,7 +13,8 @@
                                        'activity_id'   => array('type' => 
'int', 'required' => true),
                                        'application_id'        => array('type' 
=> 'int', 'required' => false),
                                        'description' => array('type' => 
'string', 'required'=> true, 'query' => true),
-                                       'building_name' => array('type' => 
'string', 'required'=> true, 'query' => true),
+                    'building_id'      => array('type' => 'int', 'required' => 
true),
+                               'building_name' => array('type' => 'string', 
'required'=> true, 'query' => true),
                                        'from_'         => array('type' => 
'string', 'required'=> true),
                                        'to_'           => array('type' => 
'string', 'required'=> true),
                                        'cost'          => array('type' => 
'decimal', 'required' => true),
@@ -359,5 +360,16 @@
                        return $results;
 
         }
+        function get_resources($ids)
+        {
 
+            $results = array();
+            $this->db->query("select name from bb_resource where id in 
($ids)", __LINE__, __FILE__);
+            while ($this->db->next_record())
+            {
+                $results[] = $this->db->f('name', false);
+            }
+            return $results;
+        }
+
        }

Added: branches/stavangerkommune/booking/inc/class.sopermission_event.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.sopermission_event.inc.php      
                        (rev 0)
+++ branches/stavangerkommune/booking/inc/class.sopermission_event.inc.php      
2014-05-06 08:28:06 UTC (rev 11947)
@@ -0,0 +1,13 @@
+<?php
+phpgw::import_class('booking.sopermission');
+
+class booking_sopermission_event extends booking_sopermission
+{
+    /**
+     * @see booking_sopermission
+     */
+    protected function build_object_relations()
+    {
+        return array();
+    }
+}

Modified: branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiapplication.inc.php   
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/inc/class.uiapplication.inc.php   
2014-05-06 08:28:06 UTC (rev 11947)
@@ -505,7 +505,9 @@
                        }
                        else 
                        {
-                       array_set_default($application, 'resources', 
array(get_var('resource', int, 'GET')));
+                $resources = explode(",",phpgw::get_var('resource', 'GET'));
+                array_set_default($application, 'resources', $resources);
+
                        }
                        array_set_default($application, 'building_id', 
phpgw::get_var('building_id', 'GET'));
 

Modified: branches/stavangerkommune/booking/inc/class.uievent.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uievent.inc.php 2014-05-05 
12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/inc/class.uievent.inc.php 2014-05-06 
08:28:06 UTC (rev 11947)
@@ -521,7 +521,7 @@
                                $customer['customer_ssn'] = 
$event['customer_ssn'];
                                $customer['customer_organization_number'] = 
$event['customer_organization_number'];
                                $customer['customer_internal'] = 
$event['customer_internal'];
-                       }       
+                       }
                        list($event, $errors) = 
$this->extract_and_validate($event);
 
                        if($_SERVER['REQUEST_METHOD'] == 'POST')

Modified: branches/stavangerkommune/booking/setup/phpgw_no.lang
===================================================================
--- branches/stavangerkommune/booking/setup/phpgw_no.lang       2014-05-05 
12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/setup/phpgw_no.lang       2014-05-06 
08:28:06 UTC (rev 11947)
@@ -639,8 +639,16 @@
 Mail for booking canceled      booking no      Booking avbestilt e-post tekst
 Allocation Canceled Subject    booking no      Tildeling avbestilt e-post emne
 Mail for allocation canceled   booking no      Tildeling avbestilt e-post tekst
-Frontend users can delete bookings     booking no      Frontend bruker kan 
slette bookinger
+Frontend users can delete bookings/events      booking no      Frontend bruker 
kan slette bookinger/arrangementer
+Events is deleted from database        booking no      Arrangementer slettes 
fra databasen
 Frontend users can delete allocations  booking no      Frontend bruker kan 
slette tildelinger
 Activate extra kalendar field on building      booking no      Aktiver ekstra 
kalender felt på bygg
 Ids that should be included in the calendar    booking no      Id som skal 
brukes i ekstra kalender
-Extra information for the event        booking no      Ekstra informasjon på 
arrangement
\ No newline at end of file
+Extra information for the event        booking no      Ekstra informasjon på 
arrangement
+Event Edited Subject   booking no      E-Post emne når Arrangement Redigeres
+Mail for event edited  booking no      E-Post når når Arrangement Redigeres
+Email warnings booking no      E-Post Varsel
+Cancelation Email Adresses     booking no      E-Post adresser som får varsel 
ved avbestilling(1 adresse pr. linje)
+file configuration     common  no      Fil konfigurasjon
+file attributes        common  no      Fil attributer
+file categories        common  no      Fil kategorier
\ No newline at end of file

Modified: branches/stavangerkommune/booking/setup/setup.inc.php
===================================================================
--- branches/stavangerkommune/booking/setup/setup.inc.php       2014-05-05 
12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/setup/setup.inc.php       2014-05-06 
08:28:06 UTC (rev 11947)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.16';
+       $setup_info['booking']['version'] = '0.2.17';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';

Modified: branches/stavangerkommune/booking/setup/tables_current.inc.php
===================================================================
--- branches/stavangerkommune/booking/setup/tables_current.inc.php      
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/setup/tables_current.inc.php      
2014-05-06 08:28:06 UTC (rev 11947)
@@ -532,7 +532,8 @@
                                'from_' => array('type' => 
'timestamp','nullable' => False),
                                'to_' => array('type' => 'timestamp','nullable' 
=> False),
                                'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
-                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                'building_id' => array('type' => 'int', 'precision' => 
4,'nullable' => True),
+                'building_name' => array('type' => 'varchar', 'precision' => 
50,'nullable' => False),
                                'contact_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'contact_email' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'contact_phone' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),

Modified: branches/stavangerkommune/booking/setup/tables_update.inc.php
===================================================================
--- branches/stavangerkommune/booking/setup/tables_update.inc.php       
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/setup/tables_update.inc.php       
2014-05-06 08:28:06 UTC (rev 11947)
@@ -2779,3 +2779,17 @@
         return $GLOBALS['setup_info']['booking']['currentver'];
     }
 }
+
+
+$test[] = '0.2.16';
+function booking_upgrade0_2_16()
+{
+    $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+    $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE bb_event ADD 
COLUMN building_id int DEFAULT NULL");
+    $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE bb_event SET 
building_id = br2.building_id FROM bb_resource br2 WHERE EXISTS (SELECT 1 FROM 
bb_event be, bb_event_resource ber, bb_resource br WHERE be.id = ber.event_id 
AND ber.resource_id = br.id AND br2.id = br.id AND bb_event.id=be.id )");
+    if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+    {
+        $GLOBALS['setup_info']['booking']['currentver'] = '0.2.17';
+        return $GLOBALS['setup_info']['booking']['currentver'];
+    }
+}
\ No newline at end of file

Modified: 
branches/stavangerkommune/booking/templates/base/event_mail_settings.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/event_mail_settings.xsl    
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/templates/base/event_mail_settings.xsl    
2014-05-06 08:28:06 UTC (rev 11947)
@@ -57,6 +57,18 @@
                        <dd class="yui-skin-sam">
                                <textarea id="field_event_canceled_mail" 
class="full-width settings" name="event_canceled_mail" 
type="text"><xsl:value-of select="config_data/event_canceled_mail"/></textarea>
                        </dd>
+
+            <dt><label for="field_event_edited_mail_subject"><xsl:value-of 
select="php:function('lang', 'Event Edited Subject')"/></label></dt>
+            <dd>
+                <input id="field_event_edited_mail_subject" 
name="event_edited_mail_subject" type="text" size="50">
+                    <xsl:attribute name="value"><xsl:value-of 
select="config_data/event_edited_mail_subject"/></xsl:attribute>
+                </input>
+            </dd>
+
+            <dt><label for="field_event_edited_mail"><xsl:value-of 
select="php:function('lang', 'Mail for event edited')"/></label></dt>
+            <dd class="yui-skin-sam">
+                <textarea id="field_event_edited_mail" class="full-width 
settings" name="event_edited_mail" type="text"><xsl:value-of 
select="config_data/event_edited_mail"/></textarea>
+            </dd>
             </dl>
                <div class="clr"/>
             <dl class="form">

Modified: branches/stavangerkommune/booking/templates/base/settings.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/settings.xsl       
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/booking/templates/base/settings.xsl       
2014-05-06 08:28:06 UTC (rev 11947)
@@ -11,7 +11,7 @@
     <form action="" method="POST">
 
        <dl class="form">
-            <dt><label for="field_user_can_delete_bookings"><xsl:value-of 
select="php:function('lang', 'Frontend users can delete 
bookings')"/></label></dt>
+            <dt><label for="field_user_can_delete_bookings"><xsl:value-of 
select="php:function('lang', 'Frontend users can delete 
bookings/events')"/></label></dt>
                        <dd>
                                <select id="field_user_can_delete_bookings" 
name="config_data[user_can_delete_bookings]">
                     <option value="no">
@@ -28,6 +28,23 @@
                           </option>
                        </select>
                        </dd>
+           <dd><xsl:value-of select="php:function('lang', 'Events is deleted 
from database')"/></dd>
+           <dd>
+               <select id="field_user_can_delete_events" 
name="config_data[user_can_delete_events]">
+                   <option value="no">
+                       <xsl:if test="config_data/user_can_delete_events='no'">
+                           <xsl:attribute 
name="selected">checked</xsl:attribute>
+                       </xsl:if>
+                       <xsl:value-of select="php:function('lang', 'No')" />
+                   </option>
+                   <option value="yes">
+                       <xsl:if test="config_data/user_can_delete_events='yes'">
+                           <xsl:attribute 
name="selected">checked</xsl:attribute>
+                       </xsl:if>
+                       <xsl:value-of select="php:function('lang', 'Yes')" />
+                   </option>
+               </select>
+           </dd>
             <dt><label for="field_user_can_delete_allocations"><xsl:value-of 
select="php:function('lang', 'Frontend users can delete 
allocations')"/></label></dt>
                        <dd>
                                <select id="field_user_can_delete_allocations" 
name="config_data[user_can_delete_allocations]">

Modified: branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php 
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php 
2014-05-06 08:28:06 UTC (rev 11947)
@@ -1,3 +1,4 @@
+
 <?php
        phpgw::import_class('booking.uievent');
 
@@ -7,6 +8,8 @@
                (
                        'info'                          =>      true,
                        'report_numbers'        =>      true,
+            'cancel'                   =>      true,
+            'edit'                 =>  true,
                );
 
                public function __construct()
@@ -14,38 +17,264 @@
                        parent::__construct();
                        $this->resource_bo = CreateObject('booking.boresource');
                        $this->building_bo = CreateObject('booking.bobuilding');
-                       $this->group_bo = CreateObject('booking.bogroup');
-                       $this->allocation_bo = 
CreateObject('booking.boallocation');
-                       $this->season_bo = CreateObject('booking.boseason');
-               }
+            $this->organization_bo = CreateObject('booking.boorganization');
+            $this->booking_bo = CreateObject('booking.bobooking');
+        }
                
-               public function info()
-               {
-                       $event = 
$this->bo->read_single(intval(phpgw::get_var('id', 'GET')));
-                       $resources = 
$this->resource_bo->so->read(array('filters'=>array('id'=>$event['resources']), 
'sort'=>'name'));
-                       if ($event['customer_organization_number'] != '')
-                       {
-                               $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);              
-                               if ($orginfo != array()) { 
-                                       $orginfo['link'] = 
self::link(array('menuaction' => 'bookingfrontend.uiorganization.show', 'id' => 
$orginfo['id']));
-                               }
-                       } else {
-                               $orginfo = array();
-                       }
-                       $event['resources'] = $resources['results'];
-                       $res_names = array();
-                       foreach($event['resources'] as $res)
-                       {
-                               $res_names[] = $res['name'];
-                       }
-                       $event['resource_info'] = join(', ', $res_names);
-                       $event['building_link'] = self::link(array('menuaction' 
=> 'bookingfrontend.uibuilding.show', 'id' => 
$event['resources'][0]['building_id']));
-                       $event['when'] = pretty_timestamp($event['from_']).' - 
'.pretty_timestamp($event['to_']);
-                       self::render_template('event_info', 
array('event'=>$event,'orginfo' => $orginfo));
-                       $GLOBALS['phpgw']->xslttpl->set_output('wml'); // Evil 
hack to disable page chrome
-               }
+        public function edit()
+        {
+            $id = intval(phpgw::get_var('id', 'GET'));
+            $event = $this->bo->read_single($id);
+            $building_info = $this->bo->so->get_building_info($id);
+            $event['building_id'] = $building_info['id'];
+            $event['building_name'] = $building_info['name'];
+            $bouser = CreateObject('bookingfrontend.bouser');
+            $config    = CreateObject('phpgwapi.config','booking');
+            $config->read();
 
-               public function report_numbers()
+            $external_site_address = 
isset($config->config_data['external_site_address']) && 
$config->config_data['external_site_address'] ? 
$config->config_data['external_site_address'] : 
$GLOBALS['phpgw_info']['server']['webserver_url'];
+            $link = 
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uibuilding.schedule&id='.$event['building_id']."&date=".substr($event['from_'],0,-9);
+            $errors = array();
+            $customer = array();
+
+            if ($event['customer_identifier_type'])
+            {
+                $customer['customer_identifier_type'] = 
$event['customer_identifier_type'];
+                $customer['customer_ssn'] = $event['customer_ssn'];
+                $customer['customer_organization_number'] = 
$event['customer_organization_number'];
+                $customer['customer_internal'] = $event['customer_internal'];
+                $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);
+                $customer['customer_organization_id'] = $orginfo['id'];
+                $customer['customer_organization_name'] = $orginfo['name'];
+            } else {
+                $customer['customer_organization_name'] = 
$event['customer_organization_name'];
+                $customer['customer_organization_id'] = 
$event['customer_organization_id'];
+                $organization = 
$this->organization_bo->read_single($event['customer_organization_id']);
+                $customer['customer_identifier_type'] = 'organization_number';
+                $customer['customer_ssn'] = $organization['customer_internal'];
+                $customer['customer_organization_number'] = 
$organization['organization_number'];
+                $customer['customer_internal'] = 
$organization['customer_internal'];
+
+            }
+            $mailadresses = 
$this->building_users($event['building_id'],$event['organization_id']);
+
+            
if(!$bouser->is_organization_admin($customer['customer_organization_id'])) {
+                $date = substr($event['from_'], 0, 10);
+                $this->redirect(array('menuaction' => 
'bookingfrontend.uibuilding.schedule', 'id'=> $event['building_id'], 'date' => 
$date));
+            }
+
+            $currres = $event['resources'];
+
+            list($event, $errors) = $this->extract_and_validate($event);
+
+            if ($event['customer_organization_number']) {
+                $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);
+                $event['customer_organization_id'] = $orginfo['id'];
+                $event['customer_organization_name'] = $orginfo['name'];
+            }
+
+            $orgdate = array();
+            foreach ($event['dates'] as $odate) {
+                if(substr($odate['from_'],0,10) == 
substr($event['from_'],0,10)) {
+                    $orgdate['from'] = $odate['from_'];
+                    $orgdate['to'] = $odate['to_'];
+                }
+            }
+
+            if($_SERVER['REQUEST_METHOD'] == 'POST')
+            {
+                $event['from_'] = 
substr($_POST['org_from'],0,11).$_POST['from_'].":00";
+                $event['to_'] = 
substr($_POST['org_to'],0,11).$_POST['to_'].":00";
+                array_set_default($_POST, 'resources', array());
+
+                if ($event['from_'] < $_POST['org_from'] || $event['to_'] > 
$_POST['org_to']) {
+                    $errors['out_of_range'] = lang("You can't extend the 
event, for that contact administrator");
+                }
+
+                if (sizeof($currres) != sizeof($_POST['resources'])) {
+                    $errors['resource_number'] = lang("You can't change 
resources to the event, for that contact administrator");
+                }
+
+                if(!$errors['event'] and !$errors['resource_number'] and 
!$errors['organization_number'] and !$errors['invoice_data']  && 
!$errors['contact_name'] && !$errors['out_of_range'])
+                {
+                    if ($event['from_'] > $orgdate['from'] || $event['to_'] < 
$orgdate['to']) {
+                        $this->bo->send_notification(true, $event, 
$mailadresses, $orgdate);
+                    }
+                    $message = '';
+                    $this->bo->send_admin_notification(true, $event, $message, 
$orgdate);
+                    exit;
+                    $this->bo->update($event);
+                    $date = substr($event['from_'], 0, 10);
+                    $this->redirect(array('menuaction' => 
'bookingfrontend.uibuilding.schedule', 'id'=> $event['building_id'], 'date' => 
$date));
+                }
+            }
+
+            $this->flash_form_errors($errors);
+            if ($customer['customer_identifier_type'])
+            {
+                $event['customer_identifier_type'] = 
$customer['customer_identifier_type'];
+                $event['customer_ssn'] = $customer['customer_ssn'];
+                $event['customer_organization_number'] = 
$customer['customer_organization_number'];
+                $event['customer_internal'] = $customer['customer_internal'];
+            }
+
+            $date = substr($event['from_'], 0, 10);
+            self::add_javascript('booking', 'booking', 'event.js');
+            $event['resources_json'] = json_encode(array_map('intval', 
$event['resources']));
+            $event['cancel_link'] = self::link(array('menuaction' => 
'bookingfrontend.uibuilding.schedule', 'id'=> $event['building_id'], 'date' => 
$date));
+            $activities = $this->activity_bo->fetch_activities();
+            $activities = $activities['results'];
+            $comments = $this->bo->so->get_ordered_comments($id);
+            $agegroups = $this->agegroup_bo->fetch_age_groups();
+            $agegroups = $agegroups['results'];
+            $audience = $this->audience_bo->fetch_target_audience();
+            $audience = $audience['results'];
+            $this->install_customer_identifier_ui($event);
+            $this->add_template_helpers();
+
+            self::render_template('event_edit', array('event' => $event, 
'activities' => $activities, 'agegroups' => $agegroups, 'audience' => 
$audience, 'comments' => $comments));
+        }
+
+        public function cancel()
+        {
+            $config    = CreateObject('phpgwapi.config','booking');
+            $config->read();
+
+
+            $event = $this->bo->read_single(intval(phpgw::get_var('id', 
'GET')));
+            $bouser = CreateObject('bookingfrontend.bouser');
+            $errors = array();
+
+            date_default_timezone_set("Europe/Oslo");
+            $currdate = new DateTime(phpgw::get_var('date'));
+            $cdate = $currdate->format('Y-m-d H:m:s');
+            if ($config->config_data['user_can_delete_events'] != 'yes')
+            {
+                $can_delete_events = 0;
+
+            } else {
+                $can_delete_events = 1;
+            }
+            if ($event['customer_organization_number']) {
+                $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);
+                $event['customer_organization_id'] = $orginfo['id'];
+                $event['customer_organization_name'] = $orginfo['name'];
+            }
+
+            $mailadresses = 
$this->building_users($event['building_id'],$event['organization_id']);
+            if($_SERVER['REQUEST_METHOD'] == 'POST')
+            {
+                if($cdate > $event['to_']) {
+                    
if($bouser->is_organization_admin($event['customer_organization_id'])) {
+                        $this->bo->send_notification(false, $event, 
$mailadresses);
+                        $this->bo->send_admin_notification(false, $event, 
$_POST['message']);
+                        exit;
+                        if ($can_delete_events) {
+                            $this->bo->so->delete_event($event['id']);
+                        } else {
+                            $event['active'] = 0;
+                            $this->bo->update($event);
+                        }
+                        $date = substr($event['from_'], 0, 10);
+                        $this->redirect(array('menuaction' => 
'bookingfrontend.uibuilding.schedule', 'id' =>$event['building_id'], 'date' => 
$date));
+
+                    } else {
+                        $errors['not_admin'] = lang("You can't cancel events");
+                    }
+                } else {
+                    $errors['started'] = lang("You can't cancel event that has 
started, for help contacts site admin");
+                }
+            }
+            $this->flash_form_errors($errors);
+            $date = substr($event['from_'], 0, 10);
+            self::add_javascript('booking', 'booking', 'event.js');
+            $event['resources_json'] = json_encode(array_map('intval', 
$event['resources']));
+            $event['cancel_link'] = self::link(array('menuaction' => 
'bookingfrontend.uibuilding.schedule', 'id'=> $event['building_id'], 'date' => 
$date));
+            $activities = $this->activity_bo->fetch_activities();
+            $activities = $activities['results'];
+            $this->install_customer_identifier_ui($event);
+            $this->add_template_helpers();
+
+            self::render_template('event_delete', array('event' => $event, 
'activities' => $activities, 'can_delete_events' => $can_delete_events));
+        }
+
+        public function building_users($building_id) {
+            $contacts = array();
+            $organizations = 
$this->organization_bo->find_building_users($building_id);
+            foreach($organizations['results'] as $key => $org)
+            {
+                if ($org['email'] != '' && strstr($org['email'], '@')) {
+                    if (!in_array($org['email'], $contacts)) {
+                        $contacts[] = $org['email'];
+                    }
+                }
+                if ($org['contacts'][0]['email'] != '' && 
strstr($org['contacts'][0]['email'], '@')) {
+                    if (!in_array($org['contacts'][0]['email'], $contacts)) {
+                        $contacts[] = $org['contacts'][0]['email'];
+                    }
+                }
+                if ($org['contacts'][1]['email'] != '' && 
strstr($org['contacts'][1]['email'], '@')) {
+                    if (!in_array($org['contacts'][1]['email'], $contacts)) {
+                        $contacts[] = $org['contacts'][1]['email'];
+                    }
+                }
+                $grp_con = 
$this->booking_bo->so->get_group_contacts_of_organization($org['id']);
+                foreach ($grp_con as $grp) {
+                    if (!in_array($grp['email'], $contacts) && 
strstr($grp['email'], '@')) {
+                        $contacts[] = $grp['email'];
+                    }
+                }
+            }
+            return $contacts;
+        }
+
+        public function info()
+        {
+            $config    = CreateObject('phpgwapi.config','booking');
+            $config->read();
+            if ($config->config_data['user_can_delete_bookings'] != 'yes')
+            {
+                $user_can_delete_bookings = 0;
+
+            } else {
+                $user_can_delete_bookings = 1;
+            }
+            $event = $this->bo->read_single(intval(phpgw::get_var('id', 
'GET')));
+            unset($event['comments']);
+            $resources = 
$this->resource_bo->so->read(array('filters'=>array('id'=>$event['resources']), 
'sort'=>'name'));
+            if ($event['customer_organization_number'] != '')
+            {
+                $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);
+                if ($orginfo != array()) {
+                    $event['customer_organization_id'] = $orginfo['id'];
+                    $event['customer_organization_name'] = $orginfo['name'];
+                    $orginfo['link'] = self::link(array('menuaction' => 
'bookingfrontend.uiorganization.show', 'id' => $orginfo['id']));
+                }
+            } else {
+                $orginfo = array();
+            }
+
+            $event['resources'] = $resources['results'];
+            $res_names = array();
+            foreach($event['resources'] as $res)
+            {
+                $res_names[] = $res['name'];
+            }
+            $event['resource_info'] = join(', ', $res_names);
+            $event['building_link'] = self::link(array('menuaction' => 
'bookingfrontend.uibuilding.show', 'id' => 
$event['resources'][0]['building_id']));
+            $event['when'] = pretty_timestamp($event['from_']).' - 
'.pretty_timestamp($event['to_']);
+            $bouser = CreateObject('bookingfrontend.bouser');
+            
if($bouser->is_organization_admin($event['customer_organization_id']))
+            {
+                $event['edit_link'] = self::link(array('menuaction' => 
'bookingfrontend.uievent.edit', 'id' => $event['id']));
+                $event['cancel_link'] = self::link(array('menuaction' => 
'bookingfrontend.uievent.cancel', 'id' => $event['id']));
+            }
+
+            self::render_template('event_info', 
array('event'=>$event,'orginfo' => $orginfo, 'user_can_delete_bookings' => 
$user_can_delete_bookings));
+            $GLOBALS['phpgw']->xslttpl->set_output('wml'); // Evil hack to 
disable page chrome
+        }
+
+        public function report_numbers()
                {
                        $step = 1;
                        $id = intval(phpgw::get_var('id', 'GET'));

Modified: branches/stavangerkommune/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- branches/stavangerkommune/bookingfrontend/setup/phpgw_no.lang       
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/bookingfrontend/setup/phpgw_no.lang       
2014-05-06 08:28:06 UTC (rev 11947)
@@ -367,3 +367,8 @@
 Public schedule        bookingfrontend no      Publikumsbading
 Apply for time bookingfrontend no      Søk om tid
 Could not delete allocation due to a booking still use it      bookingfrontend 
no      Kunne ikke slette tildeling på grunn av at en booking forsatt bruker den
+Event Delete Information       bookingfrontend no      Fjerning av arrangement 
er permanent.
+Event Delete Information2      bookingfrontend no      Arrangement blir satt 
inaktivt.
+Edit Events    bookingfrontend no      Rediger arrangement
+Delete Event   bookingfrontend no      Slett arrangement
+Check calendar bookingfrontend no      Sjekk kalender
\ No newline at end of file

Modified: branches/stavangerkommune/bookingfrontend/setup/setup.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/setup/setup.inc.php       
2014-05-05 12:19:26 UTC (rev 11946)
+++ branches/stavangerkommune/bookingfrontend/setup/setup.inc.php       
2014-05-06 08:28:06 UTC (rev 11947)
@@ -21,7 +21,7 @@
 
        $setup_info['bookingfrontend']['depends'][] = array(
                'appname' => 'booking',
-               'versions' => 
Array('0.2.06','0.2.07','0.2.08','0.2.09','0.2.10', 
'0.2.11','0.2.12','0.2.13','0.2.14','0.2.15','0.2.16')
+               'versions' => 
Array('0.2.06','0.2.07','0.2.08','0.2.09','0.2.10', 
'0.2.11','0.2.12','0.2.13','0.2.14','0.2.15','0.2.16','0.2.17')
        );
 
        $setup_info['bookingfrontend']['depends'][] = array(

Added: 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_delete.xsl
===================================================================
--- 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_delete.xsl  
                            (rev 0)
+++ 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_delete.xsl  
    2014-05-06 08:28:06 UTC (rev 11947)
@@ -0,0 +1,101 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <div id="content">
+
+        <dl class="form">
+            <dt class="heading"><xsl:value-of select="php:function('lang', 
'Delete Event')"/></dt>
+        </dl>
+        <xsl:call-template name="msgbox"/>
+        <xsl:call-template name="yui_booking_i18n"/>
+        <dl class="form">
+            <xsl:if test="can_delete_events=1">
+                <dd><xsl:value-of select="php:function('lang', 'Event Delete 
Information')"/></dd>
+            </xsl:if>
+            <xsl:if test="can_delete_events=0">
+                <dd><xsl:value-of select="php:function('lang', 'Event Delete 
Information2')"/></dd>
+            </xsl:if>
+
+        </dl>
+        <div class="clr"/>
+        <form action="" method="POST">
+            <dl class="form-col">
+                <dt><label for="field_building"><xsl:value-of 
select="php:function('lang', 'Building')" /></label></dt>
+                <dd>
+                    <div>
+                        <xsl:value-of select="event/building_name"/>
+                    </div>
+                </dd>
+                <dt><label for="field_building"><xsl:value-of 
select="php:function('lang', 'Description')" /></label></dt>
+                <dd>
+                    <div>
+                        <xsl:value-of select="event/description"/>
+                    </div>
+                </dd>
+                <dt><label for="field_activity"><xsl:value-of 
select="php:function('lang', 'Activity')" /></label></dt>
+                <dd>
+                    <div>
+                        <xsl:for-each select="activities">
+                            <xsl:if test="../event/activity_id = id">
+                                <xsl:value-of select="name"/>
+                            </xsl:if>
+                        </xsl:for-each>
+                    </div>
+                </dd>
+                <dt><label for="field_from"><xsl:value-of 
select="php:function('lang', 'From')" /></label></dt>
+                <dd>
+                    <div>
+                        <xsl:value-of select="event/from_"/>
+                    </div>
+                </dd>
+                <dt><label for="field_to"><xsl:value-of 
select="php:function('lang', 'To')"/></label></dt>
+                <dd>
+                    <div>
+                        <xsl:value-of select="event/to_"/>
+                    </div>
+                </dd>
+            </dl>
+            <div style='clear:left; padding:0; margin:0'/>
+
+            <dl class="form-col">
+                <dt><label for="field_message"><xsl:value-of 
select="php:function('lang', 'Message')" /></label></dt>
+                <dd class="yui-skin-sam">
+                    <textarea id="field-message" name="message" 
type="text"><xsl:value-of select="system_message/message"/></textarea>
+                </dd>
+            </dl>
+            <div class="form-buttons">
+                <input type="submit">
+                    <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Delete')"/></xsl:attribute>
+                </input>
+                <a class="cancel">
+                    <xsl:attribute name="href"><xsl:value-of 
select="event/cancel_link"/></xsl:attribute>
+                    <xsl:value-of select="php:function('lang', 'Cancel')"/>
+                </a>
+            </div>
+        </form>
+    </div>
+    <script type="text/javascript">
+        YAHOO.event.initialSelection = <xsl:value-of 
select="booking/resources_json"/>;
+        var lang = <xsl:value-of select="php:function('js_lang', 'Resource 
Type')"/>;
+        <![CDATA[
+        var descEdit = new YAHOO.widget.SimpleEditor('field-message', {
+            height: '150px',
+            width: '522px',
+            dompath: true,
+            animate: true,
+           handleSubmit: true,
+            toolbar: {
+                titlebar: '',
+                buttons: [
+                   { group: 'textstyle', label: ' ',
+                        buttons: [
+                            { type: 'push', label: 'Bold', value: 'bold' },
+                            { type: 'separator' },
+                            { type: 'push', label: 'HTML Link CTRL + SHIFT + 
L', value: 'createlink'}
+                        ]
+                    }
+                ]
+            }
+        });
+        descEdit.render();
+        ]]>
+    </script>
+</xsl:template>

Added: 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_edit.xsl
===================================================================
--- 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_edit.xsl    
                            (rev 0)
+++ 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_edit.xsl    
    2014-05-06 08:28:06 UTC (rev 11947)
@@ -0,0 +1,191 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <div id="content">
+        <ul class="pathway">
+            <li><xsl:value-of select="php:function('lang', 'Edit Events')" 
/></li>
+            <li>#<xsl:value-of select="event/id"/></li>
+        </ul>
+        <xsl:call-template name="msgbox"/>
+        <xsl:call-template name="yui_booking_i18n"/>
+
+        <form action="" method="POST">
+            <dl class="form">
+                <dt class="heading"><xsl:value-of select="php:function('lang', 
'Why')" /></dt>
+                <dt><label for="field_activity"><xsl:value-of 
select="php:function('lang', 'Activity')" /></label></dt>
+                <dd>
+                    <select name="activity_id" id="field_activity">
+                        <option value=""><xsl:value-of 
select="php:function('lang', '-- select an activity --')" /></option>
+                        <xsl:for-each select="activities">
+                            <option>
+                                <xsl:if test="../event/activity_id = id">
+                                    <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                </xsl:if>
+                                <xsl:attribute name="value"><xsl:value-of 
select="id"/></xsl:attribute>
+                                <xsl:value-of select="name"/>
+                            </option>
+                        </xsl:for-each>
+                    </select>
+                </dd>
+                <div class="clr"/>
+                <dt><label for="field_public"><xsl:value-of 
select="php:function('lang', 'Event type')"/></label></dt>
+                <dd>
+                    <select id="field_public" name="is_public">
+                        <option value="1">
+                            <xsl:if test="event/is_public=1">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'Public 
event')"/>
+                        </option>
+                        <option value="0">
+                            <xsl:if test="event/is_public=0">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Private event')"/>
+                        </option>
+                    </select>
+                </dd>
+
+                <div class="clr"/>
+
+                <dt><label for="field_description"><xsl:value-of 
select="php:function('lang', 'Description')" /></label></dt>
+                <dd>
+                    <textarea id="field_description" class="full-width" 
name="description"><xsl:value-of select="event/description"/></textarea>
+                </dd>
+            </dl>
+
+            <div class="clr"/>
+            <dl class="form-col">
+                <dt class="heading"><xsl:value-of select="php:function('lang', 
'Where')" /></dt>
+                <dt><label for="field_building"><xsl:value-of 
select="php:function('lang', 'Building')" /></label></dt>
+                <dd>
+                    <div class="autocomplete">
+                        <input id="field_building_id" name="building_id" 
type="hidden">
+                            <xsl:attribute name="value"><xsl:value-of 
select="event/building_id"/></xsl:attribute>
+                        </input>
+                        <input id="field_building_name" name="building_name" 
type="text">
+                            <xsl:attribute name="value"><xsl:value-of 
select="event/building_name"/></xsl:attribute>
+                        </input>
+                        <div id="building_container"/>
+                    </div>
+                </dd>
+                <dt><label for="field_resources"><xsl:value-of 
select="php:function('lang', 'Resources')" /></label></dt>
+                <dd>
+                    <div id="resources_container"><xsl:value-of 
select="php:function('lang', 'Select a building first')" /></div>
+                </dd>
+            </dl>
+            <dl class="form-col">
+                <dt class="heading"><xsl:value-of select="php:function('lang', 
'When')" /></dt>
+                <dt><label for="field_from"><xsl:value-of 
select="php:function('lang', 'From')" /></label></dt>
+                <dd>
+                    <xsl:value-of select="event/from_"/>
+                    <input name="org_from" type="hidden"><xsl:attribute 
name="value"><xsl:value-of select="event/from_"/></xsl:attribute></input>
+                    <div class="time-picker">
+                        <input id="field_from" name="from_" type="text">
+                            <xsl:attribute name="value"><xsl:value-of 
select="event/from_"/></xsl:attribute>
+                        </input>
+                    </div>
+                </dd>
+                <dt><label for="field_to"><xsl:value-of 
select="php:function('lang', 'To')" /></label></dt>
+                <dd>
+
+                    <xsl:value-of select="event/to_"/>
+                    <input name="org_to" type="hidden"><xsl:attribute 
name="value"><xsl:value-of select="event/to_"/></xsl:attribute></input>
+                    <div class="time-picker">
+                        <input id="field_to" name="to_" type="text">
+                            <xsl:attribute name="value"><xsl:value-of 
select="event/to_"/></xsl:attribute>
+                        </input>
+                    </div>
+                </dd>
+            </dl>
+            <dl class="form-col">
+                <dt class="heading"><xsl:value-of select="php:function('lang', 
'Who')" /></dt>
+                <dt><label><xsl:value-of select="php:function('lang', 'Target 
audience')" /></label></dt>
+                <dd>
+                    <ul>
+                        <xsl:for-each select="audience">
+                            <li>
+                                <input type="checkbox" name="audience[]">
+                                    <xsl:attribute name="value"><xsl:value-of 
select="id"/></xsl:attribute>
+                                    <xsl:if test="../event/audience=id">
+                                        <xsl:attribute 
name="checked">checked</xsl:attribute>
+                                    </xsl:if>
+                                </input>
+                                <label><xsl:value-of select="name"/></label>
+                            </li>
+                        </xsl:for-each>
+                    </ul>
+                </dd>
+                <dt><label for="field_from"><xsl:value-of 
select="php:function('lang', 'Number of participants')" /></label></dt>
+                <dd>
+                    <table id="agegroup">
+                        <tr><th/><th><xsl:value-of 
select="php:function('lang', 'Male')" /></th>
+                            <th><xsl:value-of select="php:function('lang', 
'Female')" /></th></tr>
+                        <xsl:for-each select="agegroups">
+                            <xsl:variable name="id"><xsl:value-of 
select="id"/></xsl:variable>
+                            <tr>
+                                <th><xsl:value-of select="name"/></th>
+                                <td>
+                                    <input type="text">
+                                        <xsl:attribute 
name="name">male[<xsl:value-of select="id"/>]</xsl:attribute>
+                                        <xsl:attribute 
name="value"><xsl:value-of select="../event/agegroups/male[../agegroup_id = 
$id]"/></xsl:attribute>
+                                    </input>
+                                </td>
+                                <td>
+                                    <input type="text">
+                                        <xsl:attribute 
name="name">female[<xsl:value-of select="id"/>]</xsl:attribute>
+                                        <xsl:attribute 
name="value"><xsl:value-of select="../event/agegroups/female[../agegroup_id = 
$id]"/></xsl:attribute>
+                                    </input>
+                                </td>
+                            </tr>
+                        </xsl:for-each>
+                    </table>
+                </dd>
+            </dl>
+            <div class="clr"/>
+            <dl class="form-col">
+                <dt class="heading"><xsl:value-of select="php:function('lang', 
'Contact information')" /></dt>
+                <dt><label for="field_contact_name"><xsl:value-of 
select="php:function('lang', 'Name')" /></label></dt>
+                <dd>
+                    <input id="field_contact_name" name="contact_name" 
type="text">
+                        <xsl:attribute name="value"><xsl:value-of 
select="event/contact_name"/></xsl:attribute>
+                    </input>
+                </dd>
+                <dt><label for="field_contact_email"><xsl:value-of 
select="php:function('lang', 'Email')" /></label></dt>
+                <dd>
+                    <input id="field_contact_mail" name="contact_email" 
type="text">
+                        <xsl:attribute name="value"><xsl:value-of 
select="event/contact_email"/></xsl:attribute>
+                    </input>
+                </dd>
+                <dt><label for="field_contact_phone"><xsl:value-of 
select="php:function('lang', 'Phone')" /></label></dt>
+                <dd>
+                    <input id="field_contact_phone" name="contact_phone" 
type="text">
+                        <xsl:attribute name="value"><xsl:value-of 
select="event/contact_phone"/></xsl:attribute>
+                    </input>
+                </dd>
+                <dt><label for="field_cost"><xsl:value-of 
select="php:function('lang', 'Cost')" /></label></dt>
+                <dd>
+                    <input id="field_cost" name="cost" type="text" 
readonly="readonly">
+                        <xsl:attribute name="value"><xsl:value-of 
select="event/cost"/></xsl:attribute>
+                    </input>
+                </dd>
+            </dl>
+            <dl class="form-col">
+                <dt class="heading"><xsl:value-of select="php:function('lang', 
'Invoice information')" /></dt>
+                <xsl:copy-of select="phpgw:booking_customer_identifier(event, 
'')"/>
+            </dl>
+            <div class="clr"/>
+            <div class="form-buttons">
+                <input type="submit">
+                    <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Save')"/></xsl:attribute>
+                </input>
+                <a class="cancel">
+                    <xsl:attribute name="href"><xsl:value-of 
select="event/cancel_link"/></xsl:attribute>
+                    <xsl:value-of select="php:function('lang', 'Cancel')" />
+                </a>
+            </div>
+        </form>
+    </div>
+    <script type="text/javascript">
+        YAHOO.booking.initialSelection = <xsl:value-of 
select="event/resources_json"/>;
+        var lang = <xsl:value-of select="php:function('js_lang', 'Resource 
Type')"/>;
+    </script>
+</xsl:template>

Modified: 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_info.xsl
===================================================================
--- 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_info.xsl    
    2014-05-05 12:19:26 UTC (rev 11946)
+++ 
branches/stavangerkommune/bookingfrontend/templates/stavanger/event_info.xsl    
    2014-05-06 08:28:06 UTC (rev 11947)
@@ -34,5 +34,17 @@
                                <xsl:value-of select="php:function('lang', 
'Private event')"/>
                        </dd>
                </xsl:if>
+        <xsl:if test="event/edit_link">
+            <div class="actions">
+                <button 
onclick="location.href='{event/edit_link}'"><xsl:value-of 
select="php:function('lang', 'Edit event')"/></button>
+                <xsl:if test="user_can_delete_bookings != 1">
+                    <button 
onclick="location.href='{event/cancel_link}'"><xsl:value-of 
select="php:function('lang', 'Cancel event')"/></button>
+                </xsl:if>
+                <xsl:if test="user_can_delete_bookings != 0">
+                    <button 
onclick="location.href='{event/cancel_link}'"><xsl:value-of 
select="php:function('lang', 'Delete event')"/></button>
+                </xsl:if>
+            </div>
+        </xsl:if>
+
        </dl>
 </xsl:template>




reply via email to

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