[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7247] Merge 7245:7246 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7247] Merge 7245:7246 from trunk |
Date: |
Tue, 03 May 2011 09:21:49 +0000 |
Revision: 7247
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7247
Author: sigurdne
Date: 2011-05-03 09:21:49 +0000 (Tue, 03 May 2011)
Log Message:
-----------
Merge 7245:7246 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/booking/inc/class.menu.inc.php
branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
branches/Version-1_0-branch/booking/inc/class.sosystem_message.inc.php
branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
branches/Version-1_0-branch/booking/inc/class.uidashboard.inc.php
branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php
branches/Version-1_0-branch/booking/setup/phpgw_no.lang
branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl
branches/Version-1_0-branch/booking/templates/base/booking.xsl
branches/Version-1_0-branch/booking/templates/base/booking_info.xsl
branches/Version-1_0-branch/bookingfrontend/inc/class.uiallocation.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_info.xsl
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_info.xsl
Added Paths:
-----------
branches/Version-1_0-branch/booking/templates/base/booking_delete.xsl
branches/Version-1_0-branch/booking/templates/base/booking_delete_preview.xsl
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_cancel.xsl
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_cancel.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246
Modified: branches/Version-1_0-branch/booking/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.menu.inc.php 2011-05-03
08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.menu.inc.php 2011-05-03
09:21:49 UTC (rev 7247)
@@ -27,6 +27,12 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'booking.uidashboard.index') ),
'image' => array('property',
'location'),
),
+ 'messages' => array
+ (
+ 'text' => lang('Messages'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'booking.uisystem_message.index') ),
+ 'image' =>
array('property', 'location'),
+ ),
// 'applications' => array
// (
// 'text' => lang('Applications'),
Modified: branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -332,7 +332,117 @@
}
return $results;
}
-
+
+ public function get_booking_id($booking)
+ {
+ $table_name = $this->table_name;
+ $db = $this->db;
+
+ $from = "'".$booking['from_']."'";
+ $to = "'".$booking['to_']."'";
+ $gid = $booking['group_id'];
+ $season_id = $booking['season_id'];
+ $resources = implode(",", $booking['resources']);
+
+ $sql = "SELECT bb.id,bbr.resource_id FROM bb_booking
bb,bb_booking_resource bbr WHERE bb.from_ = ($from) AND bb.to_ = ($to) AND
bb.group_id = ($gid) AND bb.season_id = ($season_id) AND bb.id = bbr.booking_id
AND EXISTS (SELECT 1 FROM bb_booking_resource bbr2 WHERE bbr2.resource_id IN
($resources) AND bbr2.resource_id = bbr.resource_id)";
+
+ $this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('id', false);
+ }
+
+ public function check_allocation($id)
+ {
+ $table_name = $this->table_name;
+ $db = $this->db;
+
+ $sql = "SELECT allocation_id as aid FROM bb_booking WHERE
allocation_id = ( SELECT allocation_id FROM bb_booking WHERE id = ($id) ) GROUP
BY allocation_id HAVING count(id) < 2";
+
+ $this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('aid', false);
+ }
+ function check_for_booking($booking)
+ {
+ $from = "'".$booking['from_']."'";
+ $to = "'".$booking['to_']."'";
+ $gid = $booking['group_id'];
+ $season_id = $booking['season_id'];
+ $resources = implode(",", $booking['resources']);
+
+ $sql = "SELECT id FROM bb_allocation ba2 WHERE
ba2.from_ = ($from) AND ba2.to_ = ($to) AND ba2.organization_id = (SELECT
organization_id FROM bb_group WHERE id = ($gid)) AND ba2.season_id =
($season_id) AND EXISTS ( SELECT 1 FROM bb_allocation a,bb_allocation_resource
b WHERE a.id = b.allocation_id AND b.resource_id IN ($resources)) AND NOT
EXISTS (SELECT 1 FROM bb_booking bb WHERE ba2.id = bb.allocation_id)";
+
+ $this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('id', false);
+
+ }
+
+ public function delete_booking($id)
+ {
+ $db = $this->db;
+ $table_name = $this->table_name.'_resource';
+ $sql = "DELETE FROM $table_name WHERE booking_id =
($id)";
+ $db->query($sql, __LINE__, __FILE__);
+ $table_name = $this->table_name.'_targetaudience';
+ $sql = "DELETE FROM $table_name WHERE booking_id =
($id)";
+ $db->query($sql, __LINE__, __FILE__);
+ $table_name = $this->table_name.'_agegroup';
+ $sql = "DELETE FROM $table_name WHERE booking_id =
($id)";
+ $db->query($sql, __LINE__, __FILE__);
+ $table_name = $this->table_name;
+ $sql = "DELETE FROM $table_name WHERE id = ($id)";
+ $db->query($sql, __LINE__, __FILE__);
+ }
+
+ public function delete_allocation($id)
+ {
+ $db = $this->db;
+ $sql = "DELETE FROM bb_allocation_resource WHERE
allocation_id = ($id)";
+ $db->query($sql, __LINE__, __FILE__);
+ $sql = "DELETE FROM bb_allocation WHERE id = ($id)";
+ $db->query($sql, __LINE__, __FILE__);
+ }
+
+ public function got_no_allocation($booking) {
+ $table_name = $this->table_name;
+ $db = $this->db;
+
+ $from = "'".$booking['from_']."'";
+ $to = "'".$booking['to_']."'";
+ $org_id = $booking['organization_id'];
+ $season_id = $booking['season_id'];
+ $resources = implode(",", $booking['resources']);
+
+ $sql = "SELECT id FROM bb_allocation ba2 WHERE
ba2.from_ = ($from) AND ba2.to_ = ($to) AND ba2.organization_id = ($org_id) AND
ba2.season_id = ($season_id) AND EXISTS ( SELECT 1 FROM bb_allocation
a,bb_allocation_resource b WHERE a.id = b.allocation_id AND b.resource_id IN
($resources))";
+ $this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
+ if(!$this->db->next_record())
+ {
+ return True;
+ } else {
+ return False;
+ }
+ }
+
+ function get_building($id)
+ {
+ $this->db->limit_query("SELECT name FROM bb_building
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('name', false);
+ }
+
public function find_expired() {
$table_name = $this->table_name;
$db = $this->db;
Modified: branches/Version-1_0-branch/booking/inc/class.sosystem_message.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.sosystem_message.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.sosystem_message.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -32,7 +32,20 @@
}
return $this->db->f('name', false);
}
-
+
}
+ class booking_sosystem_message_association extends booking_socommon
+ {
+ function __construct()
+ {
+ parent::__construct('bb_system_message_association',
+ array(
+ 'id'
=> array('type' => 'int'),
+ 'building_id' => array('type'
=> 'int'),
+ 'type' => array('type' => 'string',
'required' => true),
+ 'status' => array('type' =>
'string', 'required' => true),
+ ));
+ }
+ }
Modified: branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -378,6 +378,10 @@
public function delete()
{
$id = intval(phpgw::get_var('allocation_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'));
$allocation = $this->bo->read_single($id);
$season =
$this->season_bo->read_single($allocation['season_id']);
$step = phpgw::get_var('step', 'str', 'POST');
@@ -460,7 +464,12 @@
if ($step < 2)
{
- self::render_template('allocation_delete',
array('allocation' => $allocation));
+ self::render_template('allocation_delete',
array('allocation' => $allocation,
+ 'recurring' => $recurring,
+ 'outseason' => $outseason,
+ 'interval' => $field_interval,
+ 'repeat_until' => $repeat_until,
+ ));
}
elseif ($step == 2)
{
Modified: branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -10,6 +10,7 @@
'add' => true,
'show' => true,
'edit' => true,
+ 'delete' => true,
'info' => true,
'building_schedule' => true,
'resource_schedule' => true,
@@ -255,8 +256,7 @@
{
$errors['booking'] = lang('This booking
is not connected to a season');
}
-
- if (!$errors['booking'] &&
!$errors['season_boundary'])
+ if (!$errors['activity_id'] &&
!$errors['booking'] && !$errors['season_boundary'])
{
$step++;
}
@@ -321,7 +321,8 @@
$valid_dates[$i]['to_']
= $todate;
if ($step == 3)
{
- if( isset($noallocation)) {
+ $gotnoallocation =
$this->bo->so->got_no_allocation($booking);
+ if( isset($noallocation) || $gotnoallocation) {
$allocation['resources'] =
$booking['resources'];
$allocation['cost'] = $booking['cost'];
$allocation['building_id'] =
$booking['building_id'];
@@ -338,6 +339,7 @@
$booking['secret'] = $this->generate_secret();
$receipt =
$this->bo->add($booking);
$booking['allocation_id'] = '';
+
$this->allocation_bo->so->update_id_string();
} else {
$booking['secret'] = $this->generate_secret();
$receipt =
$this->bo->add($booking);
@@ -477,12 +479,150 @@
$activities = $activities['results'];
self::render_template('booking_edit', array('booking'
=> $booking, 'activities' => $activities, 'agegroups' => $agegroups, 'audience'
=> $audience));
}
+
+ public function delete()
+ {
+ $id = intval(phpgw::get_var('id', '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_'];
+
+ if ($_POST['recurring'] != 'on' &&
$_POST['outseason'] != 'on' )
+ {
+ if ($_POST['allocation_delete'] != 'on') {
+ $this->bo->so->delete_booking($id);
+ $this->redirect(array('menuaction' =>
'booking.uimassbooking.schedule', 'id'=>$booking['building_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)
+ {
+ $errors['booking'] = lang('Could not delete
allocation due to a booking still use it');
+ }
+ else
+ {
+ $err =
$this->allocation_bo->so->delete_allocation($allocation_id);
+ $this->redirect(array('menuaction' =>
'booking.uimassbooking.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;
+
+ $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)
+ {
+ $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)
+ {
+ $stat =
$this->bo->so->delete_allocation($aid);
+ }
+ }
+ }
+ $i++;
+ }
+ if ($step == 3)
+ {
+
$this->redirect(array('menuaction' => 'booking.uimassbooking.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'
=> 'booking.uibooking.show', 'id' => $booking['id']));
+ $booking['booking_link'] =
self::link(array('menuaction' => 'booking.uibooking.show', 'id' =>
$booking['id']));
+
+ if ($step < 2)
+ {
+ self::render_template('booking_delete', array('booking'
=> $booking
+ ));
+ }
+ 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,
+ 'valid_dates' => $valid_dates,
+ 'invalid_dates' => $invalid_dates
+ ));
+ }
+ }
public function show()
{
$booking = $this->bo->read_single(phpgw::get_var('id',
'GET'));
$booking['bookings_link'] =
self::link(array('menuaction' => 'booking.uibooking.index'));
$booking['edit_link'] = self::link(array('menuaction'
=> 'booking.uibooking.edit', 'id' => $booking['id']));
+ $booking['delete_link'] = self::link(array('menuaction'
=> 'booking.uibooking.delete', 'id' => $booking['id']));
$resource_ids = '';
foreach($booking['resources'] as $res)
{
@@ -507,7 +647,7 @@
$booking['building_link'] =
self::link(array('menuaction' => 'booking.uibuilding.show', 'id' =>
$booking['resources'][0]['building_id']));
$booking['org_link'] = self::link(array('menuaction' =>
'booking.uiorganization.show', 'id' => $booking['group']['organization_id']));
$booking['group_link'] = self::link(array('menuaction'
=> 'booking.uigroup.show', 'id' => $booking['group']['id']));
-
+ $booking['delete_link'] = self::link(array('menuaction'
=> 'booking.uibooking.delete', 'id' => $booking['id']));
$booking['edit_link'] = self::link(array('menuaction'
=> 'booking.uibooking.edit', 'id' => $booking['id']));
$booking['when'] =
pretty_timestamp($booking['from_']).' - '.pretty_timestamp($booking['to_']);
Modified: branches/Version-1_0-branch/booking/inc/class.uidashboard.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uidashboard.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.uidashboard.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -98,24 +98,6 @@
)
)
),
-# array('type' =>
'filter',
-# 'name' =>
'type',
-# 'text' => lang('Type').':',
-# 'list' => array(
-# array(
-# 'id' => 'not',
-# 'name' => lang('Not selected')
-# ),
-# array(
-# 'id' => 'application',
-# 'name' => lang('Application')
-# ),
-# array(
-# 'id' => 'message',
-# 'name' => lang('Message')
-# ),
-# )
-# ),
array('type' =>
'autocomplete',
'name' =>
'building',
'ui' =>
'building',
@@ -136,8 +118,8 @@
),
array(
'type' =>
'link',
- 'value' =>
$this->show_all_dashboard_messages() ? lang('Show only messages assigned to
me') : lang('Show all messages'),
- 'href' =>
self::link(array('menuaction' =>
$this->url_prefix.'.toggle_show_all_dashboard_messages'))
+ 'value' =>
lang('Show messages'),
+ 'href' =>
self::link(array('menuaction' => 'booking.uisystem_message.index'))
),
)
),
@@ -223,19 +205,19 @@
}
array_walk($applications["results"], array($this,
"_add_links"), "booking.uiapplication.show");
- $messages =
$this->system_message_bo->read_message_data($this->show_all_dashboard_messages()
? null : $this->current_account_id());
+# $messages =
$this->system_message_bo->read_message_data($this->show_all_dashboard_messages()
? null : $this->current_account_id());
- if ($this->show_all_dashboard_messages() ||
$this->show_all_dashboard_applications())
- {
- if ($this->show_all_dashboard_messages()) {
- $applications['results'] = $messages;
- }
- } else {
- foreach($messages as $message)
- {
- $applications['results'][] = $message;
- }
- }
+# if ($this->show_all_dashboard_messages() ||
$this->show_all_dashboard_applications())
+# {
+# if ($this->show_all_dashboard_messages()) {
+# $applications['results'] = $messages;
+# }
+# } else {
+# foreach($messages as $message)
+# {
+# $applications['results'][] = $message;
+# }
+# }
return $this->yui_results($applications);
}
Modified: branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -8,25 +8,45 @@
'index' => true,
'show' => true,
'edit' => true,
+ 'toggle_show_all_dashboard_messages' => true,
'toggle_show_inactive' => true,
);
+ const SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY =
"show_all_dashboard_messages";
+
protected $module;
public function __construct()
{
parent::__construct();
$this->bo = CreateObject('booking.bosystem_message');
- self::set_active_menu('booking::system_message');
+ $this->allocation_bo =
CreateObject('booking.boallocation');
+ self::set_active_menu('booking::messages');
+ $this->url_prefix = 'booking.uisystem_message';
+ $this->module = 'booking';
+ }
- $this->module = "booking";
+ public function toggle_show_all_dashboard_messages()
+ {
+ if($this->show_all_dashboard_messages())
+ {
+
unset($_SESSION[self::SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY]);
+ } else {
+
$_SESSION[self::SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY] = true;
+ }
+ $this->redirect(array('menuaction' =>
$this->url_prefix.'.index'));
}
-
+ public function show_all_dashboard_messages() {
+ return
array_key_exists(self::SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY, $_SESSION);
+ }
+
public function index()
{
if(phpgw::get_var('phpgw_return_as') == 'json') {
return $this->index_json();
}
+
+ $GLOBALS['phpgw_info']['apps']['manual']['section'] =
'booking_manual';
self::add_javascript('booking', 'booking',
'datatable.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
@@ -34,13 +54,48 @@
'form' => array(
'toolbar' => array(
'item' => array(
- array(
- 'type' =>
'link',
- 'hidden' =>
true,
- 'value' =>
lang('New message'),
- 'href' =>
self::link(array('menuaction' => 'booking.uisystem_message.edit'))
+# array('type' =>
'filter',
+# 'name' =>
'status',
+# 'text' => lang('Status').':',
+# 'list' => array(
+# array(
+# 'id' => 'not',
+# 'name' => lang('Not selected')
+# ),
+# array(
+# 'id' => 'NEW',
+# 'name' => lang('NEW')
+# ),
+# array(
+# 'id' => 'CLOSED',
+# 'name' => lang('CLOSED')
+# )
+# )
+# ),
+# array('type' =>
'filter',
+# 'name' =>
'type',
+# 'text' => lang('Type').':',
+# 'list' => array(
+# array(
+# 'id' => 'not',
+# 'name' => lang('Not selected')
+# ),
+# array(
+# 'id' => 'message',
+# 'name' => lang('Message')
+# ),
+# array(
+# 'id' => 'cancelation',
+# 'name' => lang('Cancelation')
+# ),
+# )
+# ),
+ array('type' =>
'autocomplete',
+ 'name' =>
'building',
+ 'ui' =>
'building',
+ 'text' =>
lang('Building').':',
),
- array('type' => 'text',
+ array('type' => 'text',
'name' =>
'query'
),
array(
@@ -50,9 +105,14 @@
),
array(
'type' =>
'link',
- 'value' =>
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
- 'href' =>
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
+ 'value' =>
lang('Show applications') ,
+ 'href' =>
self::link(array('menuaction' => 'booking.uidashboard.index'))
),
+ array(
+ 'type' =>
'link',
+ 'value' =>
$this->show_all_dashboard_messages() ? lang('Show only messages assigned to
me') : lang('Show all messages'),
+ 'href' =>
self::link(array('menuaction' =>
$this->url_prefix.'.toggle_show_all_dashboard_messages'))
+ ),
)
),
),
@@ -60,27 +120,43 @@
'source' =>
self::link(array('menuaction' => 'booking.uisystem_message.index',
'phpgw_return_as' => 'json')),
'field' => array(
array(
- 'key' => 'title',
- 'label' =>
lang('Title'),
+ 'key' => 'id',
+ 'label' => lang('ID'),
'formatter' =>
'YAHOO.booking.formatLink'
),
array(
+ 'key' => 'status',
+ 'label' =>
lang('Status')
+ ),
+ array(
+ 'key' => 'type',
+ 'label' => lang('Type')
+ ),
+ array(
'key' => 'created',
'label' =>
lang('Created')
),
array(
- 'key' => 'building_id',
- 'label' =>
lang('Building')
+ 'key' => 'modified',
+ 'label' => lang('Last
modified')
),
array(
- 'key' => 'type',
- 'label' => lang('Type')
+ 'key' => 'what',
+ 'label' => lang('What')
),
array(
- 'key' => 'status',
- 'label' =>
lang('Status')
+ 'key' =>
'activity_name',
+ 'label' =>
lang('Activity')
),
array(
+ 'key' => 'contact_name',
+ 'label' =>
lang('Contact')
+ ),
+ array(
+ 'key' =>
'case_officer_name',
+ 'label' => lang('Case
Officer')
+ ),
+ array(
'key' => 'link',
'hidden' => true
)
@@ -92,6 +168,8 @@
public function index_json()
{
+ $this->db = $GLOBALS['phpgw']->db;
+
if (
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
!$this->bo->has_role(booking_sopermission::ROLE_MANAGER) )
{
@@ -118,7 +196,12 @@
$system_message['type'] =
lang($system_message['type']);
$system_message['status'] =
lang($system_message['status']);
}
- array_walk($system_messages["results"], array($this,
"_add_links"), $this->module.".uisystem_message.show");
+ array_walk($system_messages['results'], array($this,
'_add_links'), $this->module.'.uisystem_message.show');
+
+ $messages =
$this->bo->read_message_data($this->show_all_dashboard_messages() ? null :
$this->current_account_id());
+
+ $system_messages['results'] = $messages;
+
$results = $this->yui_results($system_messages);
return $results;
@@ -183,7 +266,7 @@
$system_message =
$this->bo->read_single(phpgw::get_var('id', 'GET'));
$system_message['system_messages_link'] =
self::link(array('menuaction' => $this->module . '.uisystem_message.index'));
$system_message['system_message_link'] =
self::link(array('menuaction' => $this->module . '.uisystem_message.show', 'id'
=> $system_message['system_message_id']));
- $system_message['back_link'] =
self::link(array('menuaction' => $this->module . '.uidashboard.index'));
+ $system_message['back_link'] =
self::link(array('menuaction' => $this->module . '.uisystem_message.index'));
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2011-05-03
08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2011-05-03
09:21:49 UTC (rev 7247)
@@ -495,7 +495,19 @@
Recurring allocation deletion booking no Slettings intervall
Delete allocation booking no Slett tildeling
Delete allocations booking no Slett tildelinger
+Delete booking booking no Slett booking
+Delete bookings booking no Slett bookinger
Allocations that will be deleted booking no Tildelinger som vil bli
slettet
Allocations with existing bookings (%1) booking no Tildeinger med
eksisterende bookinger (%1)
-office booking no Kontor
-office user booking no Bruker koplet til kontor
+Delete allocation also booking no Slett underliggende tildelinger
+Bookings to be deleted booking no Booking for sletting
+Allocations that is going to be deleted booking no Tildelinger for
sletting
+Allocations with still existing bookings (%1) booking no Tildelinger som
ikke blir slettet på grunn av eksisterende bookinger (%1)
+Messages booking no Beskjeder
+cancelation booking no Avbestilling
+Cancelation of allocation from booking no Avbestilling av tildeling fra
+Cancelation of booking from booking no Avbestilling av booking fra
+To cancel booking use this link booking no For å slette bookingen
bruk lenken
+To cancel allocation use this link booking no For å slette
tildelingen bruk lenken
+Show applications booking no Vis søknader
+Show messages booking no Vis beskjeder
Modified: branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -17,12 +17,10 @@
<xsl:if test="allocation/add_link">
<div class="actions">
<button
onclick="location.href='{allocation/add_link}'"><xsl:value-of
select="php:function('lang', 'Create new booking')"/></button>
+ <xsl:if test="allocation/delete_link">
+ <button
onclick="location.href='{allocation/delete_link}'"><xsl:value-of
select="php:function('lang', 'Delete allocation')"/></button>
+ </xsl:if>
</div>
</xsl:if>
- <xsl:if test="allocation/delete_link">
- <div class="actions">
- <button
onclick="location.href='{allocation/delete_link}'"><xsl:value-of
select="php:function('lang', 'Delete allocation')"/></button>
- </div>
- </xsl:if>
</xsl:template>
Modified: branches/Version-1_0-branch/booking/templates/base/booking.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/booking.xsl
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/templates/base/booking.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -32,6 +32,10 @@
<button>
<xsl:attribute
name="onclick">window.location.href="<xsl:value-of
select="booking/edit_link"/>"</xsl:attribute>
<xsl:value-of select="php:function('lang', 'Edit')"
/>
+ </button>
+ <button>
+ <xsl:attribute
name="onclick">window.location.href="<xsl:value-of
select="booking/delete_link"/>"</xsl:attribute>
+ <xsl:value-of select="php:function('lang', 'Delete
booking')" />
</button>
</xsl:if>
</div>
Copied: branches/Version-1_0-branch/booking/templates/base/booking_delete.xsl
(from rev 7246, trunk/booking/templates/base/booking_delete.xsl)
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/booking_delete.xsl
(rev 0)
+++ branches/Version-1_0-branch/booking/templates/base/booking_delete.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -0,0 +1,132 @@
+<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 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')"/>;
+ </script>
+</xsl:template>
Copied:
branches/Version-1_0-branch/booking/templates/base/booking_delete_preview.xsl
(from rev 7246, trunk/booking/templates/base/booking_delete_preview.xsl)
===================================================================
---
branches/Version-1_0-branch/booking/templates/base/booking_delete_preview.xsl
(rev 0)
+++
branches/Version-1_0-branch/booking/templates/base/booking_delete_preview.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -0,0 +1,102 @@
+<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="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="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>
Modified: branches/Version-1_0-branch/booking/templates/base/booking_info.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/booking_info.xsl
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/booking/templates/base/booking_info.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -20,6 +20,7 @@
<xsl:if test="booking/edit_link">
<div class="actions">
<button
onclick="location.href='{booking/edit_link}'"><xsl:value-of
select="php:function('lang', 'Edit booking')"/></button>
+ <button
onclick="location.href='{booking/delete_link}'"><xsl:value-of
select="php:function('lang', 'Delete booking')"/></button>
</div>
</xsl:if>
</xsl:template>
Modified:
branches/Version-1_0-branch/bookingfrontend/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/inc/class.uiallocation.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/bookingfrontend/inc/class.uiallocation.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -6,6 +6,7 @@
public $public_functions = array
(
'info' => true,
+ 'cancel' => true,
);
public function __construct()
@@ -14,8 +15,51 @@
$this->org_bo = CreateObject('booking.boorganization');
$this->resource_bo = CreateObject('booking.boresource');
$this->building_bo = CreateObject('booking.bobuilding');
+ $this->system_message_bo =
CreateObject('booking.bosystem_message');
}
-
+ public function cancel()
+ {
+ $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'];
+
+ 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'];
+
+ $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel allocation use this link')."
- <a href='".self::link(array('menuaction' =>
'booking.uiallocation.delete','allocation_id' => $allocation['id'], 'outseason'
=> $outseason, 'recurring' => $recurring, 'repeat_until' => $repeat_until,
'field_interval' => $field_interval))."'>".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->use_yui_editor();
+ self::render_template('allocation_cancel',
array('allocation'=>$allocation));
+ }
+
public function info()
{
$allocation =
$this->bo->read_single(intval(phpgw::get_var('id', 'GET')));
@@ -31,8 +75,10 @@
$allocation['building_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibuilding.show', 'id' =>
$allocation['resources'][0]['building_id']));
$allocation['org_link'] = self::link(array('menuaction'
=> 'bookingfrontend.uiorganization.show', 'id' =>
$allocation['organization_id']));
$bouser = CreateObject('bookingfrontend.bouser');
-
if($bouser->is_organization_admin($allocation['organization_id']))
+
if($bouser->is_organization_admin($allocation['organization_id'])) {
$allocation['add_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibooking.add',
'allocation_id'=>$allocation['id'], 'from_'=>$allocation['from_'],
'to_'=>$allocation['to_'], 'resource'=>$allocation['resource']));
+ $allocation['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uiallocation.cancel',
'allocation_id'=>$allocation['id'], 'from_'=>$allocation['from_'],
'to_'=>$allocation['to_'], 'resource'=>$allocation['resource']));
+ }
$allocation['when'] =
pretty_timestamp($allocation['from_']).' -
'.pretty_timestamp($allocation['to_']);
self::render_template('allocation_info',
array('allocation'=>$allocation));
$GLOBALS['phpgw']->xslttpl->set_output('wml'); // Evil
hack to disable page chrome
Modified:
branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
2011-05-03 09:21:49 UTC (rev 7247)
@@ -13,6 +13,7 @@
'edit' => true,
'report_numbers' => true,
'massupdate' => true,
+ 'cancel' => true,
);
public function __construct()
@@ -23,6 +24,7 @@
$this->allocation_bo =
CreateObject('booking.boallocation');
$this->season_bo = CreateObject('booking.boseason');
$this->building_bo = CreateObject('booking.bobuilding');
+ $this->system_message_bo =
CreateObject('booking.bosystem_message');
}
private function item_link(&$item, $key)
@@ -560,6 +562,50 @@
);
}
+ public function cancel()
+ {
+ $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'];
+
+ $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel booking use this link')." -
<a href='".self::link(array('menuaction' => 'booking.uibooking.delete','id' =>
$boooking['id'], 'outseason' => $outseason, 'recurring' => $recurring,
'repeat_until' => $repeat_until, 'field_interval' => $field_interval,
'delete_allocation' => $delete_allocation))."'>".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->use_yui_editor();
+ self::render_template('booking_cancel',
array('booking'=>$booking));
+ }
+
public function info()
{
$booking =
$this->bo->read_single(intval(phpgw::get_var('id', 'GET')));
@@ -578,8 +624,10 @@
$bouser = CreateObject('bookingfrontend.bouser');
if($bouser->is_group_admin($booking['group_id']))
+ {
$booking['edit_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibooking.edit', 'id' =>
$booking['id']));
-
+ $booking['cancel_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibooking.cancel', 'id' =>
$booking['id']));
+ }
$booking['when'] =
pretty_timestamp($booking['from_']).' - '.pretty_timestamp($booking['to_']);
self::render_template('booking_info',
array('booking'=>$booking));
$GLOBALS['phpgw']->xslttpl->set_output('wml'); // Evil
hack to disable page chrome
Modified: branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
2011-05-03 09:21:49 UTC (rev 7247)
@@ -324,3 +324,5 @@
Agegroups kan not be larger than 9999 peoples bookingfrontend no
Estimert antall deltakere kan ikke være større en 9999 personer
Contact information name is to long. max 50 characters bookingfrontend no
Navn i kontakt informasjon er for langt. Maks 50 tegn
Unable to fill report bookingfrontend no Greide ikke å fylle ut rapport
+Cancel booking bookingfrontend no Avbestill booking
+Cancel allocation bookingfrontend no Avbestill tildeling
Copied:
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_cancel.xsl
(from rev 7246, trunk/bookingfrontend/templates/base/allocation_cancel.xsl)
===================================================================
---
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_cancel.xsl
(rev 0)
+++
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_cancel.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -0,0 +1,153 @@
+<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', 'Cancel
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: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', 'Cancel allocation')"/></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"/>';
+ <![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>
Modified:
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_info.xsl
===================================================================
---
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_info.xsl
2011-05-03 08:58:45 UTC (rev 7246)
+++
branches/Version-1_0-branch/bookingfrontend/templates/base/allocation_info.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -17,6 +17,7 @@
<xsl:if test="allocation/add_link">
<div class="actions">
<button
onclick="location.href='{allocation/add_link}'"><xsl:value-of
select="php:function('lang', 'Create new booking')"/></button>
+ <button
onclick="location.href='{allocation/cancel_link}'"><xsl:value-of
select="php:function('lang', 'Cancel allocation')"/></button>
</div>
</xsl:if>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
Copied:
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_cancel.xsl
(from rev 7246, trunk/bookingfrontend/templates/base/booking_cancel.xsl)
===================================================================
---
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_cancel.xsl
(rev 0)
+++
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_cancel.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -0,0 +1,161 @@
+<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', 'Cancel
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', 'Cancel booking')"/></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"/>';
+ <![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>
Modified:
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_info.xsl
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/templates/base/booking_info.xsl
2011-05-03 08:58:45 UTC (rev 7246)
+++ branches/Version-1_0-branch/bookingfrontend/templates/base/booking_info.xsl
2011-05-03 09:21:49 UTC (rev 7247)
@@ -20,6 +20,7 @@
<xsl:if test="booking/edit_link">
<div class="actions">
<button
onclick="location.href='{booking/edit_link}'"><xsl:value-of
select="php:function('lang', 'Edit booking')"/></button>
+ <button
onclick="location.href='{booking/cancel_link}'"><xsl:value-of
select="php:function('lang', 'Cancel booking')"/></button>
</div>
</xsl:if>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7247] Merge 7245:7246 from trunk,
Sigurd Nes <=