[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7901] bkbooking: delete booking / allocation directl
From: |
Kjell Arne Espedal |
Subject: |
[Fmsystem-commits] [7901] bkbooking: delete booking / allocation directly from frontend |
Date: |
Thu, 20 Oct 2011 08:06:34 +0000 |
Revision: 7901
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7901
Author: kjell
Date: 2011-10-20 08:06:34 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
bkbooking: delete booking / allocation directly from frontend
Modified Paths:
--------------
trunk/booking/inc/class.menu.inc.php
trunk/booking/inc/class.soallocation.inc.php
trunk/booking/inc/class.sobooking.inc.php
trunk/booking/inc/class.uiallocation.inc.php
trunk/booking/setup/phpgw_no.lang
trunk/bookingfrontend/inc/class.uiallocation.inc.php
trunk/bookingfrontend/inc/class.uibooking.inc.php
trunk/bookingfrontend/setup/phpgw_no.lang
trunk/bookingfrontend/templates/base/allocation_cancel.xsl
Added Paths:
-----------
trunk/booking/inc/class.uisettings.inc.php
trunk/booking/templates/base/settings.xsl
trunk/bookingfrontend/templates/base/allocation_delete.xsl
trunk/bookingfrontend/templates/base/allocation_delete_preview.xsl
trunk/bookingfrontend/templates/base/booking_delete.xsl
trunk/bookingfrontend/templates/base/booking_delete_preview.xsl
Modified: trunk/booking/inc/class.menu.inc.php
===================================================================
--- trunk/booking/inc/class.menu.inc.php 2011-10-19 13:30:32 UTC (rev
7900)
+++ trunk/booking/inc/class.menu.inc.php 2011-10-20 08:06:34 UTC (rev
7901)
@@ -331,6 +331,11 @@
'text' => lang('Asynchronous
Tasks'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'booking.uiasync_settings.index', 'appname' => 'booking') )
),
+ 'settings' => array
+ (
+ 'text' => lang('Settings'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'booking.uisettings.index', 'appname' => 'booking') )
+ ),
);
}
Modified: trunk/booking/inc/class.soallocation.inc.php
===================================================================
--- trunk/booking/inc/class.soallocation.inc.php 2011-10-19 13:30:32 UTC
(rev 7900)
+++ trunk/booking/inc/class.soallocation.inc.php 2011-10-20 08:06:34 UTC
(rev 7901)
@@ -147,6 +147,16 @@
}
}
+ function get_resource($id)
+ {
+ $this->db->limit_query("SELECT name FROM bb_resource
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('name', false);
+ }
+
function get_building($id)
{
$this->db->limit_query("SELECT name FROM bb_building
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
Modified: trunk/booking/inc/class.sobooking.inc.php
===================================================================
--- trunk/booking/inc/class.sobooking.inc.php 2011-10-19 13:30:32 UTC (rev
7900)
+++ trunk/booking/inc/class.sobooking.inc.php 2011-10-20 08:06:34 UTC (rev
7901)
@@ -333,6 +333,7 @@
return $results;
}
+
public function get_booking_id($booking)
{
$table_name = $this->table_name;
@@ -433,6 +434,26 @@
}
}
+ function get_organization($id)
+ {
+ $this->db->limit_query("SELECT name FROM
bb_organization where id=(select organization_id from bb_group where
id=($id))", 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('name', false);
+ }
+
+ function get_resource($id)
+ {
+ $this->db->limit_query("SELECT name FROM bb_resource
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('name', false);
+ }
+
function get_building($id)
{
$this->db->limit_query("SELECT name FROM bb_building
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php 2011-10-19 13:30:32 UTC
(rev 7900)
+++ trunk/booking/inc/class.uiallocation.inc.php 2011-10-20 08:06:34 UTC
(rev 7901)
@@ -395,6 +395,7 @@
public function delete()
{
+
$id = intval(phpgw::get_var('allocation_id', 'GET'));
$outseason = phpgw::get_var('outseason', 'GET');
$recurring = phpgw::get_var('recurring', 'GET');
@@ -408,7 +409,6 @@
$invalid_dates = array();
$valid_dates = array();
-
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$from_date = $_POST['from_'];
@@ -416,7 +416,6 @@
if ($_POST['recurring'] != 'on' &&
$_POST['outseason'] != 'on' )
{
- //echo
"<pre>single:";print_r($step);echo"\n";print_r($from_date);echo"\n";print_r($allocation);exit;
$err = $this->bo->so->check_for_booking($id);
if ($err)
{
Added: trunk/booking/inc/class.uisettings.inc.php
===================================================================
--- trunk/booking/inc/class.uisettings.inc.php (rev 0)
+++ trunk/booking/inc/class.uisettings.inc.php 2011-10-20 08:06:34 UTC (rev
7901)
@@ -0,0 +1,40 @@
+<?php
+ phpgw::import_class('booking.uicommon');
+
+ class booking_uisettings extends booking_uicommon
+ {
+ public $public_functions = array
+ (
+ 'index' => true,
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+ self::set_active_menu('admin::booking::settings');
+ }
+
+ public function index()
+ {
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ if($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+ foreach($_POST as $dim => $value)
+ {
+ if (strlen(trim($value)) > 0)
+ {
+ $config->value($dim,
trim($value));
+ }
+ else
+ {
+
unset($config->config_data[$dim]);
+ }
+ }
+ $config->save_repository();
+ }
+
+ self::render_template('settings', array('config_data'
=>$config->config_data));
+ }
+ }
Modified: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang 2011-10-19 13:30:32 UTC (rev 7900)
+++ trunk/booking/setup/phpgw_no.lang 2011-10-20 08:06:34 UTC (rev 7901)
@@ -1,3 +1,5 @@
+booking common no Booking
+bookingfrontend common no Bookingfrontend
current activities booking no Aktiviteter
-- select an activity -- booking no Velg en aktivitet
-- select a building -- booking no Velg en bygning
@@ -520,3 +522,15 @@
Upload manual booking no Last opp dokumentasjon
Are you sure you want to delete? booking no Er du sikker på at
søknad skal avvises?
Event id booking no Arrangement id
+Allocations deleted on booking no Tildelinger slettet på
+Allocation deleted on booking no Tildeling slettet på
+Booking and allocations deleted on booking no Booking og tildeling er
slettet på
+Booking deleted on booking no Booking slettet på
+Bookings and allocations deleted on booking no Bookinger og
tildelinger er slettet på
+Bookings deleted on booking no Bookinger slettet på
+Cancelation of booking and allocation from booking no Avbestilling av
booking og tildeling fra
+Cancelation of booking from booking no Avbestilling av booking fra
+Cancelation of bookings and allocations from booking no Avbestilling av
bookinger og tildelinger fra
+Cancelation of bookings from booking no Avbestilling av bookinger fra
+Booking system settings booking no Bookingmodul systeminnstillinger
+Frontend users can delete bookings and allocations booking no Brukere
av frontend kan slettet bookinger og tildelinger direkte
Added: trunk/booking/templates/base/settings.xsl
===================================================================
--- trunk/booking/templates/base/settings.xsl (rev 0)
+++ trunk/booking/templates/base/settings.xsl 2011-10-20 08:06:34 UTC (rev
7901)
@@ -0,0 +1,39 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+ <div id="content">
+
+ <xsl:call-template name="msgbox"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+
+ <dl class="form">
+ <dt class="heading"><xsl:value-of select="php:function('lang',
'Booking system settings')"/></dt>
+ </dl>
+
+ <form action="" method="POST">
+
+ <dl class="form-col">
+ <dt><label for="field_user_can_delete"><xsl:value-of
select="php:function('lang', 'Frontend users can delete bookings and
allocations')"/></label></dt>
+ <dd>
+ <select id="field_user_can_delete"
name="user_can_delete">
+ <option value="no">
+ <xsl:if test="config_data/user_can_delete='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='yes'">
+ <xsl:attribute
name="selected">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="php:function('lang', 'Yes')" />
+ </option>
+ </select>
+ </dd>
+ </dl>
+ <div class="form-buttons">
+ <input type="submit">
+ <xsl:attribute name="value"><xsl:value-of
select="php:function('lang', 'Save')"/></xsl:attribute>
+ </input>
+ </div>
+ </form>
+ </div>
+</xsl:template>
Modified: trunk/bookingfrontend/inc/class.uiallocation.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uiallocation.inc.php 2011-10-19
13:30:32 UTC (rev 7900)
+++ trunk/bookingfrontend/inc/class.uiallocation.inc.php 2011-10-20
08:06:34 UTC (rev 7901)
@@ -19,46 +19,221 @@
}
public function cancel()
{
- $allocation =
$this->bo->read_single(intval(phpgw::get_var('allocation_id', 'GET')));
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
- $errors = array();
- if($_SERVER['REQUEST_METHOD'] == 'POST')
- {
+ if ($config->config_data['user_can_delete'] != 'yes') {
+
+ $allocation =
$this->bo->read_single(intval(phpgw::get_var('allocation_id', 'GET')));
+
+ $errors = array();
+ if($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
- $from = $_POST['from_'];
- $to = $_POST['to_'];
- $organization_id = $_POST['organization_id'];
- $outseason = $_POST['outseason'];
- $recurring = $_POST['recurring'];
- $repeat_until = $_POST['repeat_until'];
- $field_interval = $_POST['field_interval'];
+ $from = $_POST['from_'];
+ $to = $_POST['to_'];
+ $organization_id = $_POST['organization_id'];
+ $outseason = $_POST['outseason'];
+ $recurring = $_POST['recurring'];
+ $repeat_until = $_POST['repeat_until'];
+ $field_interval = $_POST['field_interval'];
- date_default_timezone_set("Europe/Oslo");
- $date = new DateTime(phpgw::get_var('date'));
- $system_message = array();
- $system_message['building_id'] =
intval($allocation['building_id']);
- $system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
- $system_message['created'] =
$date->format('Y-m-d H:m');
- $system_message = array_merge($system_message,
extract_values($_POST, array('message')));
- $system_message['type'] = 'cancelation';
- $system_message['status'] = 'NEW';
- $system_message['name'] = ' ';
- $system_message['phone'] = ' ';
- $system_message['email'] = ' ';
- $system_message['title'] = lang('Cancelation of
allocation from')." ".$allocation['organization_name'];
- $link = self::link(array('menuaction' =>
'booking.uiallocation.delete','allocation_id' => $allocation['id'], 'outseason'
=> $outseason, 'recurring' => $recurring, 'repeat_until' => $repeat_until,
'field_interval' => $field_interval));
- $link = mb_strcut($link,16,strlen($link));
- $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel allocation use this link')."
- <a href='".$link."'>".lang('Delete')."</a>";
+
date_default_timezone_set("Europe/Oslo");
+ $date = new
DateTime(phpgw::get_var('date'));
+ $system_message = array();
+ $system_message['building_id'] =
intval($allocation['building_id']);
+ $system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
+ $system_message['created'] =
$date->format('Y-m-d H:m');
+ $system_message =
array_merge($system_message, extract_values($_POST, array('message')));
+ $system_message['type'] = 'cancelation';
+ $system_message['status'] = 'NEW';
+ $system_message['name'] = ' ';
+ $system_message['phone'] = ' ';
+ $system_message['email'] = ' ';
+ $system_message['title'] =
lang('Cancelation of allocation from')." ".$allocation['organization_name'];
+ $link = self::link(array('menuaction' =>
'booking.uiallocation.delete','allocation_id' => $allocation['id'], 'outseason'
=> $outseason, 'recurring' => $recurring, 'repeat_until' => $repeat_until,
'field_interval' => $field_interval));
+ $link = mb_strcut($link,16,strlen($link));
+ $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel allocation use this link')."
- <a href='".$link."'>".lang('Delete')."</a>";
- $receipt =
$this->system_message_bo->add($system_message);
- $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id' => $system_message['building_id']));
+ $receipt =
$this->system_message_bo->add($system_message);
+ $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id' => $system_message['building_id']));
- }
- $this->flash_form_errors($errors);
- $allocation['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibuilding.schedule', 'id' =>
$allocation['building_id']));
+ }
- $this->use_yui_editor();
- self::render_template('allocation_cancel',
array('allocation'=>$allocation));
+ $this->flash_form_errors($errors);
+ $allocation['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibuilding.schedule', 'id' =>
$allocation['building_id']));
+
+ $this->use_yui_editor();
+ self::render_template('allocation_cancel',
array('allocation'=>$allocation));
+
+ } else {
+
+ $id = intval(phpgw::get_var('allocation_id',
'GET'));
+ $outseason = phpgw::get_var('outseason', 'GET');
+ $recurring = phpgw::get_var('recurring', 'GET');
+ $repeat_until = phpgw::get_var('repeat_until',
'GET');
+ $field_interval =
intval(phpgw::get_var('field_interval', 'GET'));
+ $allocation = $this->bo->read_single($id);
+ $season =
$this->season_bo->read_single($allocation['season_id']);
+ $step = phpgw::get_var('step', 'str', 'POST');
+ if (! isset($step)) $step = 1;
+ $errors = array();
+ $invalid_dates = array();
+ $valid_dates = array();
+
+ if($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+ $from_date = $_POST['from_'];
+ $to_date = $_POST['to_'];
+
+ if ($_POST['recurring'] != 'on' &&
$_POST['outseason'] != 'on' )
+ {
+ $err = $this->bo->so->check_for_booking($id);
+ if ($err)
+ {
+ $errors['booking'] = lang('Could not delete
allocation due to a booking still use it');
+ }
+ else
+ {
+ $res_names = '';
+
date_default_timezone_set("Europe/Oslo");
+ $date = new
DateTime(phpgw::get_var('date'));
+ $system_message =
array();
+
$system_message['building_id'] = intval($allocation['building_id']);
+
$system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
+
$system_message['created'] = $date->format('Y-m-d H:m');
+ $system_message =
array_merge($system_message, extract_values($_POST, array('message')));
+ $system_message['type'] = 'cancelation';
+
$system_message['status'] = 'NEW';
+ $system_message['name']
= ' ';
+
$system_message['phone'] = ' ';
+
$system_message['email'] = ' ';
+
$system_message['title'] = lang('Cancelation of allocation from')."
".$allocation['organization_name'];
+ foreach
($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->bo->so->get_resource($res)." ";
+ }
+ $info_deleted =
lang("Allocation deleted on")." ".$system_message['building_name'].":<br
/>".$res_names." - ".pretty_timestamp($allocation['from_'])." -
".pretty_timestamp($allocation['to_']);
+ $system_message['message'] =
$system_message['message']."<br />".$info_deleted;
+ $receipt =
$this->system_message_bo->add($system_message);
+
+ $err = $this->bo->so->delete_allocation($id);
+ $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id'=>$allocation['building_id']));
+ }
+ }
+ else
+ {
+ $step++;
+ if ($_POST['recurring'] ==
'on') {
+ $repeat_until =
strtotime($_POST['repeat_until'])+60*60*24;
+ }
+ else
+ {
+ $repeat_until =
strtotime($season['to_'])+60*60*24;
+ $_POST['repeat_until']
= $season['to_'];
+ }
+
+ $max_dato =
strtotime($_POST['to_']); // highest date from input
+ $interval =
$_POST['field_interval']*60*60*24*7; // weeks in seconds
+ $i = 0;
+ // calculating valid and
invalid dates from the first booking's to-date to the repeat_until date is
reached
+ // the form from step 1 should
validate and if we encounter any errors they are caused by double bookings.
+
+ while
(($max_dato+($interval*$i)) <= $repeat_until)
+ {
+ $fromdate = date('Y-m-d
H:i', strtotime($_POST['from_']) + ($interval*$i));
+ $todate = date('Y-m-d
H:i', strtotime($_POST['to_']) + ($interval*$i));
+ $allocation['from_'] =
$fromdate;
+ $allocation['to_'] =
$todate;
+
+ $id =
$this->bo->so->get_allocation_id($allocation);
+ if ($id)
+ {
+ $err =
$this->bo->so->check_for_booking($id);
+ }
+ else
+ {
+ $err = true;
+ }
+
+ if ($err)
+ {
+
$invalid_dates[$i]['from_'] = $fromdate;
+
$invalid_dates[$i]['to_'] = $todate;
+ }
+ else
+ {
+
$valid_dates[$i]['from_'] = $fromdate;
+
$valid_dates[$i]['to_'] = $todate;
+ if ($step == 3)
+ {
+
+ $stat =
$this->bo->so->delete_allocation($id);
+ }
+ }
+ $i++;
+ }
+ if ($step == 3)
+ {
+ $res_names = '';
+
date_default_timezone_set("Europe/Oslo");
+ $date = new
DateTime(phpgw::get_var('date'));
+ $system_message =
array();
+
$system_message['building_id'] = intval($allocation['building_id']);
+
$system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
+
$system_message['created'] = $date->format('Y-m-d H:m');
+ $system_message =
array_merge($system_message, extract_values($_POST, array('message')));
+ $system_message['type'] = 'cancelation';
+
$system_message['status'] = 'NEW';
+ $system_message['name']
= ' ';
+
$system_message['phone'] = ' ';
+
$system_message['email'] = ' ';
+
$system_message['title'] = lang('Cancelation of allocation from')."
".$allocation['organization_name'];
+ foreach
($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->bo->so->get_resource($res)." ";
+ }
+ $info_deleted =
lang("Allocations deleted on ").$system_message['building_name'].":<br />";
+ foreach ($valid_dates
as $valid_date) {
+ $info_deleted =
$info_deleted."<br />".$res_names." -
".pretty_timestamp($valid_date['from_'])." -
".pretty_timestamp($valid_date['to_']);
+ }
+ $system_message['message'] =
$system_message['message']."<br />".$info_deleted;
+ $receipt =
$this->system_message_bo->add($system_message);
+
+
$this->redirect(array('menuaction' => 'bookingfrontend.uibuilding.schedule',
'id'=>$allocation['building_id']));
+ }
+ }
+ }
+ $this->flash_form_errors($errors);
+ self::add_javascript('booking', 'booking',
'allocation.js');
+ $allocation['resources_json'] =
json_encode(array_map('intval', $allocation['resources']));
+ $allocation['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uiallocation.show', 'id' =>
$allocation['id']));
+ $allocation['application_link'] =
self::link(array('menuaction' => 'bookingfrontend.uiapplication.show', 'id' =>
$allocation['application_id']));
+
+ if ($step < 2)
+ {
+ self::render_template('allocation_delete',
array('allocation' => $allocation,
+ 'recurring' => $recurring,
+ 'outseason' => $outseason,
+ 'interval' => $field_interval,
+ 'repeat_until' => $repeat_until,
+ ));
+ }
+ elseif ($step == 2)
+ {
+
self::render_template('allocation_delete_preview', array('allocation' =>
$allocation,
+ 'step' => $step,
+ 'recurring' =>
$_POST['recurring'],
+ 'outseason' =>
$_POST['outseason'],
+ 'interval' =>
$_POST['field_interval'],
+ 'repeat_until' =>
$_POST['repeat_until'],
+ 'from_date' => $from_date,
+ 'to_date' => $to_date,
+ 'message' => $_POST['message'],
+ 'valid_dates' => $valid_dates,
+ 'invalid_dates' =>
$invalid_dates
+ ));
+ }
+
+ }
}
public function info()
Modified: trunk/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uibooking.inc.php 2011-10-19 13:30:32 UTC
(rev 7900)
+++ trunk/bookingfrontend/inc/class.uibooking.inc.php 2011-10-20 08:06:34 UTC
(rev 7901)
@@ -564,47 +564,259 @@
public function cancel()
{
- $booking = $this->bo->read_single(intval(phpgw::get_var('id',
'GET')));
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
- $errors = array();
- if($_SERVER['REQUEST_METHOD'] == 'POST')
- {
-
- $from = $_POST['from_'];
- $to = $_POST['to_'];
- $organization_id = $_POST['organization_id'];
- $outseason = $_POST['outseason'];
- $recurring = $_POST['recurring'];
- $repeat_until = $_POST['repeat_until'];
- $field_interval = $_POST['field_interval'];
- $delete_allocation = $_POST['delete_allocation'];
+ if ($config->config_data['user_can_delete'] != 'yes') {
- date_default_timezone_set("Europe/Oslo");
- $date = new DateTime(phpgw::get_var('date'));
- $system_message = array();
- $system_message['building_id'] =
intval($booking['building_id']);
- $system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
- $system_message['created'] =
$date->format('Y-m-d H:m');
- $system_message = array_merge($system_message,
extract_values($_POST, array('message')));
- $system_message['type'] = 'cancelation';
- $system_message['status'] = 'NEW';
- $system_message['name'] = ' ';
- $system_message['phone'] = ' ';
- $system_message['email'] = ' ';
- $system_message['title'] = lang('Cancelation of
booking from')." ".$booking['group_name'];
+ $booking =
$this->bo->read_single(intval(phpgw::get_var('id', 'GET')));
+
+ $errors = array();
+ if($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+
+ $from = $_POST['from_'];
+ $to = $_POST['to_'];
+ $organization_id = $_POST['organization_id'];
+ $outseason = $_POST['outseason'];
+ $recurring = $_POST['recurring'];
+ $repeat_until = $_POST['repeat_until'];
+ $field_interval = $_POST['field_interval'];
+ $delete_allocation = $_POST['delete_allocation'];
+
+
date_default_timezone_set("Europe/Oslo");
+ $date = new
DateTime(phpgw::get_var('date'));
+ $system_message = array();
+ $system_message['building_id'] =
intval($booking['building_id']);
+ $system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
+ $system_message['created'] =
$date->format('Y-m-d H:m');
+ $system_message =
array_merge($system_message, extract_values($_POST, array('message')));
+ $system_message['type'] = 'cancelation';
+ $system_message['status'] = 'NEW';
+ $system_message['name'] = ' ';
+ $system_message['phone'] = ' ';
+ $system_message['email'] = ' ';
+ $system_message['title'] =
lang('Cancelation of booking from')." ".$booking['group_name'];
- $link = self::link(array('menuaction' =>
'booking.uibooking.delete','id' => $booking['id'], 'outseason' => $outseason,
'recurring' => $recurring, 'repeat_until' => $repeat_until, 'field_interval' =>
$field_interval, 'delete_allocation' => $delete_allocation));
- $link = mb_strcut($link,16,strlen($link));
- $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel booking use this link')." -
<a href='".$link."'>".lang('Delete')."</a>";
- $receipt =
$this->system_message_bo->add($system_message);
- $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id' => $system_message['building_id']));
+ $link = self::link(array('menuaction' =>
'booking.uibooking.delete','id' => $booking['id'], 'outseason' => $outseason,
'recurring' => $recurring, 'repeat_until' => $repeat_until, 'field_interval' =>
$field_interval, 'delete_allocation' => $delete_allocation));
+ $link = mb_strcut($link,16,strlen($link));
+ $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel booking use this link')." -
<a href='".$link."'>".lang('Delete')."</a>";
+ $receipt =
$this->system_message_bo->add($system_message);
+ $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id' => $system_message['building_id']));
- }
- $this->flash_form_errors($errors);
- $allocation['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibuilding.schedule', 'id' =>
$allocation['building_id']));
+ }
+ $this->flash_form_errors($errors);
+ $allocation['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibuilding.schedule', 'id' =>
$allocation['building_id']));
+
+ $this->use_yui_editor();
+ self::render_template('booking_cancel',
array('booking'=>$booking));
- $this->use_yui_editor();
- self::render_template('booking_cancel',
array('booking'=>$booking));
+ } else {
+
+ $id = intval(phpgw::get_var('id', 'GET'));
+ $outseason = phpgw::get_var('outseason', 'GET');
+ $recurring = phpgw::get_var('recurring', 'GET');
+ $repeat_untild = phpgw::get_var('repeat_until',
'GET');
+ $field_interval =
intval(phpgw::get_var('field_interval', 'GET'));
+ $delete_allocation =
phpgw::get_var('delete_allocation', 'GET');
+ $booking = $this->bo->read_single($id);
+ $allocation =
$this->allocation_bo->read_single($booking['allocation_id']);
+ $season =
$this->season_bo->read_single($booking['season_id']);
+ $step = phpgw::get_var('step', 'str', 'POST');
+ if (! isset($step)) $step = 1;
+ $errors = array();
+ $invalid_dates = array();
+ $valid_dates = array();
+ $allocation_delete = array();
+ $allocation_keep = array();
+
+ if($_SERVER['REQUEST_METHOD'] == 'POST')
+ {
+ $from_date = $_POST['from_'];
+ $to_date = $_POST['to_'];
+ $info_deleted = '';
+ $inf_del = '';
+
+ if ($_POST['recurring'] != 'on' &&
$_POST['outseason'] != 'on' )
+ {
+
+ if ($_POST['delete_allocation'] != 'on') {
+
+ $inf_del = "Booking";
+
$this->bo->so->delete_booking($id);
+ }
+ else
+ {
+ $allocation_id = $booking['allocation_id'];
+
+ $this->bo->so->delete_booking($id);
+ $err =
$this->allocation_bo->so->check_for_booking($allocation_id);
+ if ($err)
+ {
+ $inf_del = "Booking";
+ $errors['booking'] = lang('Could not delete
allocation due to a booking still use it');
+ }
+ else
+ {
+ $inf_del = "Booking and allocation";
+ $err =
$this->allocation_bo->so->delete_allocation($allocation_id);
+ }
+ }
+
+ $res_names = '';
+
date_default_timezone_set("Europe/Oslo");
+ $date = new
DateTime(phpgw::get_var('date'));
+ $system_message = array();
+ $system_message['building_id']
= intval($booking['building_id']);
+
$system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
+ $system_message['created'] =
$date->format('Y-m-d H:m');
+ $system_message =
array_merge($system_message, extract_values($_POST, array('message')));
+ $system_message['type'] = 'cancelation';
+ $system_message['status'] =
'NEW';
+ $system_message['name'] = ' ';
+ $system_message['phone'] = ' ';
+ $system_message['email'] = ' ';
+ $system_message['title'] =
lang("Cancelation of ".$inf_del." from")."
".$this->bo->so->get_organization($booking['group_id'])." -
".$booking['group_name'];
+ foreach ($booking['resources']
as $res) {
+ $res_names =
$res_names.$this->bo->so->get_resource($res)." ";
+ }
+ $info_deleted = lang($inf_del."
deleted on")." ".$system_message['building_name'].":<br />".$res_names." -
".pretty_timestamp($booking['from_'])." - ".pretty_timestamp($booking['to_']);
+
+ $system_message['message'] =
$system_message['message']."<br />".$info_deleted;
+ $receipt =
$this->system_message_bo->add($system_message);
+
+ $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id'=>$booking['building_id']));
+ }
+ else
+ {
+ $step++;
+ if ($_POST['recurring'] ==
'on') {
+ $repeat_until =
strtotime($_POST['repeat_until'])+60*60*24;
+ }
+ else
+ {
+ $repeat_until =
strtotime($season['to_'])+60*60*24;
+ $_POST['repeat_until']
= $season['to_'];
+ }
+
+ $max_dato =
strtotime($_POST['to_']); // highest date from input
+ $interval =
$_POST['field_interval']*60*60*24*7; // weeks in seconds
+ $i = 0;
+ // calculating valid and
invalid dates from the first booking's to-date to the repeat_until date is
reached
+ // the form from step 1 should
validate and if we encounter any errors they are caused by double bookings.
+
+ while
(($max_dato+($interval*$i)) <= $repeat_until)
+ {
+ $fromdate = date('Y-m-d
H:i', strtotime($_POST['from_']) + ($interval*$i));
+ $todate = date('Y-m-d
H:i', strtotime($_POST['to_']) + ($interval*$i));
+ $booking['from_'] =
$fromdate;
+ $booking['to_'] =
$todate;
+ $info_deleted = '';
+ $inf_del = '';
+
+ $id = $this->bo->so->get_booking_id($booking);
+ if($id) {
+ $aid = $this->bo->so->check_allocation($id);
+ } else {
+ $aid =
$this->bo->so->check_for_booking($booking);
+ }
+
+ if ($id)
+ {
+
$valid_dates[$i]['from_'] = $fromdate;
+
$valid_dates[$i]['to_'] = $todate;
+ if ($step == 3)
+ {
+ $inf_del = "Bookings";
+ $stat =
$this->bo->so->delete_booking($id);
+ }
+ }
+ if ($_POST['delete_allocation'] == 'on')
{
+ if (!$aid)
+ {
+
$allocation_keep[$i]['from_'] = $fromdate;
+
$allocation_keep[$i]['to_'] = $todate;
+ }
+ else
+ {
+
$allocation_delete[$i]['from_'] = $fromdate;
+
$allocation_delete[$i]['to_'] = $todate;
+ if ($step == 3)
+ {
+ $inf_del = "Bookings and
allocations";
+ $stat =
$this->bo->so->delete_allocation($aid);
+ }
+ }
+ }
+ $i++;
+ }
+ if ($step == 3)
+ {
+ $res_names = '';
+
date_default_timezone_set("Europe/Oslo");
+ $date = new
DateTime(phpgw::get_var('date'));
+ $system_message =
array();
+
$system_message['building_id'] = intval($booking['building_id']);
+
$system_message['building_name'] =
$this->bo->so->get_building($system_message['building_id']);
+
$system_message['created'] = $date->format('Y-m-d H:m');
+ $system_message =
array_merge($system_message, extract_values($_POST, array('message')));
+ $system_message['type'] = 'cancelation';
+
$system_message['status'] = 'NEW';
+ $system_message['name']
= ' ';
+
$system_message['phone'] = ' ';
+
$system_message['email'] = ' ';
+
$system_message['title'] = lang("Cancelation of ".$inf_del." from")."
".$this->bo->so->get_organization($booking['group_id'])." -
".$booking['group_name'];
+ foreach
($booking['resources'] as $res) {
+ $res_names =
$res_names.$this->bo->so->get_resource($res)." ";
+ }
+ $info_deleted =
lang($inf_del." deleted on")." ".$system_message['building_name'].":<br />";
+ foreach ($valid_dates
as $valid_date) {
+ $info_deleted =
$info_deleted."<br />".$res_names." -
".pretty_timestamp($valid_date['from_'])." -
".pretty_timestamp($valid_date['to_']);
+ }
+ $system_message['message'] =
$system_message['message']."<br />".$info_deleted;
+ $receipt =
$this->system_message_bo->add($system_message);
+
$this->redirect(array('menuaction' => 'bookingfrontend.uibuilding.schedule',
'id'=>$allocation['building_id']));
+ }
+ }
+ }
+
+ $this->flash_form_errors($errors);
+ self::add_javascript('booking', 'booking',
'booking.js');
+ $booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
+ $booking['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibooking.show', 'id' =>
$booking['id']));
+ $booking['booking_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibooking.show', 'id' =>
$booking['id']));
+
+ if ($step < 2)
+ {
+ self::render_template('booking_delete',
array('booking' => $booking,
+ 'recurring' => $recurring,
+ 'outseason' => $outseason,
+ 'interval' => $field_interval,
+ 'repeat_until' => $repeat_until,
+ 'delete_allocation' => $delete_allocation,
+ ));
+ }
+ elseif ($step == 2)
+ {
+
self::render_template('booking_delete_preview', array('booking' => $booking,
+ 'step' => $step,
+ 'recurring' =>
$_POST['recurring'],
+ 'outseason' =>
$_POST['outseason'],
+ 'interval' =>
$_POST['field_interval'],
+ 'repeat_until' =>
$_POST['repeat_until'],
+ 'from_date' => $from_date,
+ 'to_date' => $to_date,
+ 'delete_allocation' => $_POST['delete_allocation'],
+ 'allocation_keep' =>
$allocation_keep,
+ 'allocation_delete' =>
$allocation_delete,
+ 'message' => $_POST['message'],
+ 'valid_dates' => $valid_dates,
+ 'invalid_dates' =>
$invalid_dates
+ ));
+ }
+
+
+ }
}
public function info()
Modified: trunk/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/bookingfrontend/setup/phpgw_no.lang 2011-10-19 13:30:32 UTC (rev
7900)
+++ trunk/bookingfrontend/setup/phpgw_no.lang 2011-10-20 08:06:34 UTC (rev
7901)
@@ -336,3 +336,14 @@
To cancel allocation use this link bookingfrontend no For å slette
tildelingen bruk lenken
manual common no Veiledning lag og organisasjoner
Cancel allocation bookingfrontend no Avbestill tildelinger
+Allocations deleted on bookingfrontend no Tildelinger slettet på
+Allocation deleted on bookingfrontend no Tildeling slettet på
+Booking and allocations deleted on bookingfrontend no Booking og
tildeling er slettet på
+Booking deleted on bookingfrontend no Booking slettet på
+Bookings and allocations deleted on bookingfrontend no Bookinger og
tildelinger er slettet på
+Bookings deleted on bookingfrontend no Bookinger slettet på
+Cancelation of booking and allocation from bookingfrontend no
Avbestilling av booking og tildeling fra
+Cancelation of booking from bookingfrontend no Avbestilling av booking
fra
+Cancelation of bookings and allocations from bookingfrontend no
Avbestilling av bookinger og tildelinger fra
+Cancelation of bookings from bookingfrontend no Avbestilling av
bookinger fra
+Layout bookingfrontend no Frontend design
Modified: trunk/bookingfrontend/templates/base/allocation_cancel.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/allocation_cancel.xsl 2011-10-19
13:30:32 UTC (rev 7900)
+++ trunk/bookingfrontend/templates/base/allocation_cancel.xsl 2011-10-20
08:06:34 UTC (rev 7901)
@@ -105,13 +105,13 @@
</dd>
</dl>
- <div style='clear:left; padding:0; margin:0'/>
+ <div style='clear:both; 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>
+ <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="message"/></textarea>
+ </dd>
</dl>
<div class="form-buttons">
Added: trunk/bookingfrontend/templates/base/allocation_delete.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/allocation_delete.xsl
(rev 0)
+++ trunk/bookingfrontend/templates/base/allocation_delete.xsl 2011-10-20
08:06:34 UTC (rev 7901)
@@ -0,0 +1,155 @@
+<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
allocation')"/></dt>
+ </dl>
+ <xsl:call-template name="msgbox"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+
+ <form action="" method="POST">
+ <input type="hidden" name="application_id"
value="{allocation/application_id}"/>
+ <input id="field_org_id" name="organization_id" type="hidden"
value="{allocation/organization_id}" />
+ <input id="field_building_id" name="building_id" type="hidden"
value="{allocation/building_id}" />
+ <input id="field_from" name="from_" type="hidden"
value="{allocation/from_}" />
+ <input id="field_to" name="to_" type="hidden" value="{allocation/to_}"
/>
+
+ <dl class="form-col">
+
+ <dt><label for="field_building"><xsl:value-of
select="php:function('lang', 'Building')" /></label></dt>
+ <dd>
+ <div class="autocomplete">
+ <xsl:value-of select="allocation/building_name"/>
+ </div>
+ </dd>
+
+
+ <dt><label for="field_from"><xsl:value-of
select="php:function('lang', 'From')" /></label></dt>
+ <dd>
+ <div>
+ <xsl:value-of select="allocation/from_"/>
+ </div>
+ </dd>
+ <dd>
+ <div> </div>
+ </dd>
+ <dt><label for="field_repeat_until"><xsl:value-of
select="php:function('lang', 'Recurring allocation deletion')" /></label></dt>
+ <dd>
+ <label>
+ <input type="checkbox" name="outseason"
id="outseason">
+ <xsl:if test="outseason='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Out season')" />
+ </label>
+ </dd>
+ <dd>
+ <label>
+ <input type="checkbox" name="recurring"
id="recurring">
+ <xsl:if test="recurring='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Delete until')" />
+ </label>
+ </dd>
+ <dd class="date-picker">
+ <input id="field_repeat_until"
name="repeat_until" type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="repeat_until"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><xsl:value-of select="php:function('lang',
'Interval')" /></dt>
+ <dd>
+ <xsl:value-of select="../field_interval" />
+ <select id="field_interval"
name="field_interval">
+ <option value="1">
+ <xsl:if test="interval=1">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '1 week')" />
+ </option>
+ <option value="2">
+ <xsl:if test="interval=2">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '2 weeks')" />
+ </option>
+ <option value="3">
+ <xsl:if test="interval=3">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '3 weeks')" />
+ </option>
+ <option value="4">
+ <xsl:if test="interval=4">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '4 weeks')" />
+ </option>
+ </select>
+ </dd>
+ </dl>
+ <dl class="form-col">
+ <dt><label for="field_org"><xsl:value-of
select="php:function('lang', 'Organization')" /></label></dt>
+ <dd>
+ <div class="autocomplete">
+ <xsl:value-of select="allocation/organization_name"/>
+ </div>
+ </dd>
+ <dt><label for="field_to"><xsl:value-of
select="php:function('lang', 'To')" /></label></dt>
+ <dd>
+ <div>
+ <xsl:value-of select="allocation/to_"/>
+ </div>
+ </dd>
+ </dl>
+
+ <div style='clear:both; 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="allocation/cancel_link"/></xsl:attribute>
+ <xsl:value-of select="php:function('lang', 'Cancel')" />
+ </a>
+ </div>
+ </form>
+ </div>
+ <script type="text/javascript">
+ YAHOO.booking.season_id = '<xsl:value-of
select="allocation/season_id"/>';
+ YAHOO.booking.initialSelection = <xsl:value-of
select="allocation/resources_json"/>;
+ var lang = <xsl:value-of select="php:function('js_lang',
'Resource Type')"/>;
+ <![CDATA[
+ var descEdit = new YAHOO.widget.SimpleEditor('field-message', {
+ height: '300px',
+ 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: trunk/bookingfrontend/templates/base/allocation_delete_preview.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/allocation_delete_preview.xsl
(rev 0)
+++ trunk/bookingfrontend/templates/base/allocation_delete_preview.xsl
2011-10-20 08:06:34 UTC (rev 7901)
@@ -0,0 +1,73 @@
+<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
Allocations')"/></dt>
+ </dl>
+ <xsl:call-template name="msgbox"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+
+ <!-- <xsl:call-template name="xmlsource"/> -->
+
+ <form action="" method="POST">
+ <input type="hidden" name="allocation_id"
value="{allocation/id}"/>
+ <input type="hidden" name="organization_name"
value="{allocation/organization_name}"/>
+ <input type="hidden" name="organization_id"
value="{allocation/organization_id}"/>
+ <input type="hidden" name="building_name"
value="{allocation/building_name}"/>
+ <input type="hidden" name="building_id"
value="{allocation/building_id}"/>
+ <input type="hidden" name="from_" value="{from_date}"/>
+ <input type="hidden" name="to_" value="{to_date}"/>
+ <input type="hidden" name="building_id"
value="{allocation/building_id}"/>
+ <input type="hidden" name="cost"
value="{allocation/cost}"/>
+ <input type="hidden" name="season_id"
value="{allocation/season_id}"/>
+ <input type="hidden" name="field_building_id"
value="{allocation/building_id}"/>
+ <input type="hidden" name="step" value="{step}" />
+ <input type="hidden" name="repeat_until"
value="{repeat_until}" />
+ <input type="hidden" name="field_interval"
value="{interval}" />
+ <input type="hidden" name="outseason"
value="{outseason}" />
+ <input type="hidden" name="recurring"
value="{recurring}" />
+ <input type="hidden" name="message" value="{message}" />
+ <xsl:for-each select="allocation/resources">
+ <input type="hidden" name="resources[]"
value="{.}" />
+ </xsl:for-each>
+
+ <h4><xsl:value-of select="php:function('lang',
'Allocations that will be deleted')" /></h4>
+ <div class="allocation-list">
+ <xsl:for-each select="valid_dates">
+ <li>
+ <xsl:value-of select="from_"/>
- <xsl:value-of select="to_"/>
+ </li>
+ </xsl:for-each>
+ </div>
+
+ <h4><xsl:value-of select="php:function('lang',
'Allocations with existing bookings (%1)', count(result/invalid[from_]))"
/></h4>
+ <div class="allocation-list">
+ <xsl:for-each select="invalid_dates">
+ <li>
+ <xsl:value-of select="from_"/>
- <xsl:value-of select="to_"/>
+ </li>
+ </xsl:for-each>
+ </div>
+ <div class="form-buttons">
+ <input type="submit" name="create">
+ <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="allocation/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="allocation/resources_json"/>;
+ </script>
+</xsl:template>
+<xsl:template name="xmlsource">
+ NODE <xsl:value-of select="name()"/>
+ ATTR { <xsl:for-each select="attribute::*"><xsl:value-of
select="name()"/>=<xsl:value-of select="."/> </xsl:for-each> }
+ CHILDREN: { <xsl:for-each select="*"><xsl:call-template
name="xmlsource"/></xsl:for-each> }
+ TEXT <xsl:value-of select="text()"/>
+ <br/>
+</xsl:template>
Added: trunk/bookingfrontend/templates/base/booking_delete.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/booking_delete.xsl
(rev 0)
+++ trunk/bookingfrontend/templates/base/booking_delete.xsl 2011-10-20
08:06:34 UTC (rev 7901)
@@ -0,0 +1,162 @@
+<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
Booking')"/></dt>
+ </dl>
+ <xsl:call-template name="msgbox"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+
+ <form action="" method="POST">
+ <input type="hidden" name="application_id"
value="{booking/application_id}"/>
+ <input type="hidden" name="group_id" value="{booking/group_id}" />
+ <input type="hidden" name="building_id" value="{booking/building_id}"
/>
+ <input type="hidden" name="season_id" value="{booking/season_id}" />
+ <input type="hidden" name="from_" value="{booking/from_}" />
+ <input type="hidden" name="to_" value="{booking/to_}" />
+
+ <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="booking/building_name"/>
+ </div>
+ </dd>
+ <dt><label for="field_from"><xsl:value-of
select="php:function('lang', 'From')" /></label></dt>
+ <dd>
+ <div>
+ <xsl:value-of select="booking/from_"/>
+ </div>
+ </dd>
+ <dt><label for="field_to"><xsl:value-of
select="php:function('lang', 'To')"/></label></dt>
+ <dd>
+ <div>
+ <xsl:value-of select="booking/to_"/>
+ </div>
+ </dd>
+ <dt><label for="field_repeat_until"><xsl:value-of
select="php:function('lang', 'Recurring allocation deletion')" /></label></dt>
+ <dd>
+ <label>
+ <input type="checkbox" name="outseason"
id="outseason">
+ <xsl:if test="outseason='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Out season')" />
+ </label>
+ </dd>
+ <dd>
+ <label>
+ <input type="checkbox" name="recurring"
id="recurring">
+ <xsl:if test="recurring='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Delete until')" />
+ </label>
+ </dd>
+ <dd class="date-picker">
+ <input id="field_repeat_until"
name="repeat_until" type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="repeat_until"/></xsl:attribute>
+ </input>
+ </dd>
+ <dt><xsl:value-of select="php:function('lang',
'Interval')" /></dt>
+ <dd>
+ <xsl:value-of select="../field_interval" />
+ <select id="field_interval"
name="field_interval">
+ <option value="1">
+ <xsl:if test="interval=1">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '1 week')" />
+ </option>
+ <option value="2">
+ <xsl:if test="interval=2">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '2 weeks')" />
+ </option>
+ <option value="3">
+ <xsl:if test="interval=3">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '3 weeks')" />
+ </option>
+ <option value="4">
+ <xsl:if test="interval=4">
+ <xsl:attribute
name="selected">selected</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', '4 weeks')" />
+ </option>
+ </select>
+ </dd>
+ </dl>
+ <dl class="form-col">
+ <dt><label for="field_group"><xsl:value-of
select="php:function('lang', 'Group')"/></label></dt>
+ <dd>
+ <xsl:value-of select="booking/group_name"/>
+ </dd>
+ <dt><label for="field_season"><xsl:value-of
select="php:function('lang', 'Season')"/></label></dt>
+ <dd>
+ <xsl:value-of select="booking/season_name"/>
+ </dd>
+ <dt><label for="field_repeat_until"><xsl:value-of
select="php:function('lang', 'Delete allocation also')" /></label></dt>
+ <dd>
+ <label>
+ <input type="checkbox"
name="delete_allocation" id="delete_allocation">
+ <xsl:if
test="delete_allocation='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Delete allocations')" />
+ </label>
+ </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="booking/cancel_link"/></xsl:attribute>
+ <xsl:value-of select="php:function('lang', 'Cancel')"/>
+ </a>
+ </div>
+ </form>
+ </div>
+ <script type="text/javascript">
+ YAHOO.booking.season_id = '<xsl:value-of select="booking/season_id"/>';
+ YAHOO.booking.group_id = '<xsl:value-of select="booking/group_id"/>';
+ YAHOO.booking.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: trunk/bookingfrontend/templates/base/booking_delete_preview.xsl
===================================================================
--- trunk/bookingfrontend/templates/base/booking_delete_preview.xsl
(rev 0)
+++ trunk/bookingfrontend/templates/base/booking_delete_preview.xsl
2011-10-20 08:06:34 UTC (rev 7901)
@@ -0,0 +1,104 @@
+<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
Booking')"/></dt>
+ </dl>
+ <xsl:call-template name="msgbox"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+
+ <!-- <xsl:call-template name="xmlsource"/> -->
+
+ <form action="" method="POST">
+ <input type="hidden" name="booking_id"
value="{booking/id}"/>
+ <input type="hidden" name="season_id"
value="{booking/season_id}"/>
+ <input type="hidden" name="building_id"
value="{booking/building_id}"/>
+ <input type="hidden" name="building_name"
value="{booking/building_name}"/>
+ <input type="hidden" name="organization_id"
value="{booking/organization_id}"/>
+ <input type="hidden" name="organization_name"
value="{booking/organization_name}"/>
+ <input type="hidden" name="allocation_id"
value="{booking/allocation_id}"/>
+ <input type="hidden" name="noallocation"
value="{noallocation}" />
+ <input type="hidden" name="delete_allocation"
value="{delete_allocation}" />
+ <input type="hidden" name="step" value="{step}" />
+ <input type="hidden" name="from_" value="{from_date}" />
+ <input type="hidden" name="to_" value="{to_date}" />
+ <input type="hidden" name="cost" value="{booking/cost}"
/>
+ <input type="hidden" name="repeat_until"
value="{repeat_until}" />
+ <input type="hidden" name="field_interval"
value="{interval}" />
+ <input type="hidden" name="recurring"
value="{recurring}" />
+ <input type="hidden" name="outseason"
value="{outseason}" />
+ <input type="hidden" name="message" value="{message}" />
+ <input type="hidden" name="activity_id"
value="{booking/activity_id}" />
+ <input type="hidden" name="group_id"
value="{booking/group_id}" />
+ <xsl:for-each select="booking/audience">
+ <input type="hidden" name="audience[]"
value="{.}" />
+ </xsl:for-each>
+ <xsl:for-each select="booking/resources">
+ <input type="hidden" name="resources[]"
value="{.}" />
+ </xsl:for-each>
+ <xsl:for-each select="booking/agegroups">
+ <xsl:variable name="id"><xsl:value-of
select="id"/></xsl:variable>
+ <input type="hidden">
+ <xsl:attribute
name="name">male[<xsl:value-of select="agegroup_id"/>]</xsl:attribute>
+ <xsl:attribute
name="value"><xsl:value-of select="male"/></xsl:attribute>
+ </input>
+ <input type="hidden">
+ <xsl:attribute
name="name">female[<xsl:value-of select="agegroup_id"/>]</xsl:attribute>
+ <xsl:attribute
name="value"><xsl:value-of select="female"/></xsl:attribute>
+ </input>
+ </xsl:for-each>
+
+
+ <h4><xsl:value-of select="php:function('lang',
'Bookings to be deleted')" /></h4>
+ <div class="allocation-list">
+ <xsl:for-each select="valid_dates">
+ <li>
+ <xsl:value-of select="from_"/>
- <xsl:value-of select="to_"/>
+ </li>
+ </xsl:for-each>
+ </div>
+ <xsl:if test="delete_allocation='on'">
+ <h4><xsl:value-of select="php:function('lang',
'Allocations that is going to be deleted')" /></h4>
+ <div class="allocation-list">
+ <xsl:for-each select="allocation_delete">
+ <li>
+ <xsl:value-of select="from_"/>
- <xsl:value-of select="to_"/>
+ </li>
+ </xsl:for-each>
+ </div>
+
+ <h4><xsl:value-of select="php:function('lang',
'Allocations with still existing bookings (%1)',
count(allocation_keep[from_]))" /></h4>
+ <div class="allocation-list">
+ <xsl:for-each select="allocation_keep">
+ <li>
+ <xsl:value-of select="from_"/>
- <xsl:value-of select="to_"/>
+ </li>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+ <div class="form-buttons">
+ <input type="submit" name="delete">
+ <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="season/wtemplate_link"/></xsl:attribute>
+ <xsl:value-of select="php:function('lang', 'Cancel')" />
+ </a>
+ </div>
+ </form>
+
+ </div>
+ <script type="text/javascript">
+ YAHOO.booking.season_id = '<xsl:value-of select="booking/season_id"/>';
+ YAHOO.booking.group_id = '<xsl:value-of select="booking/group_id"/>';
+ YAHOO.booking.initialSelection = <xsl:value-of
select="booking/resources_json"/>;
+ var lang = <xsl:value-of select="php:function('js_lang',
'Resource Type')"/>;
+ </script>
+</xsl:template>
+<xsl:template name="xmlsource">
+ NODE <xsl:value-of select="name()"/>
+ ATTR { <xsl:for-each select="attribute::*"><xsl:value-of
select="name()"/>=<xsl:value-of select="."/> </xsl:for-each> }
+ CHILDREN: { <xsl:for-each select="*"><xsl:call-template
name="xmlsource"/></xsl:for-each> }
+ TEXT <xsl:value-of select="text()"/>
+ <br/>
+</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7901] bkbooking: delete booking / allocation directly from frontend,
Kjell Arne Espedal <=