Revision: 1370
http://mrbs.svn.sourceforge.net/mrbs/?rev=1370&view=rev
Author: cimorrison
Date: 2010-07-14 10:08:54 +0000 (Wed, 14 Jul 2010)
Log Message:
-----------
Preserved the details of the last More Info request in provisional bookings to
avoid admins bombarding users with requests for more info. The details are
displayed as a title tooltip on the More Info button.
Modified Paths:
--------------
mrbs/trunk/tables.my.sql
mrbs/trunk/tables.pg.pre73.sql
mrbs/trunk/tables.pg.sql
mrbs/trunk/web/confirm_entry_handler.php
mrbs/trunk/web/dbsys.inc
mrbs/trunk/web/lang.en
mrbs/trunk/web/mrbs_sql.inc
mrbs/trunk/web/pending.php
mrbs/trunk/web/view_entry.php
Added Paths:
-----------
mrbs/trunk/web/upgrade/14/
mrbs/trunk/web/upgrade/14/mysql.sql
mrbs/trunk/web/upgrade/14/pgsql.sql
Modified: mrbs/trunk/tables.my.sql
===================================================================
--- mrbs/trunk/tables.my.sql 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/tables.my.sql 2010-07-14 10:08:54 UTC (rev 1370)
@@ -69,6 +69,9 @@
private TINYINT(1) NOT NULL DEFAULT 0,
status tinyint NOT NULL DEFAULT 1,
reminded int,
+ info_time int,
+ info_user varchar(80),
+ info_text text,
PRIMARY KEY (id),
KEY idxStartTime (start_time),
@@ -92,6 +95,9 @@
rep_num_weeks smallint NULL,
private TINYINT(1) NOT NULL DEFAULT 0,
reminded int,
+ info_time int,
+ info_user varchar(80),
+ info_text text,
PRIMARY KEY (id)
);
@@ -118,6 +124,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ( 'db_version', '13');
+ VALUES ( 'db_version', '14');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ( 'local_db_version', '1');
Modified: mrbs/trunk/tables.pg.pre73.sql
===================================================================
--- mrbs/trunk/tables.pg.pre73.sql 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/tables.pg.pre73.sql 2010-07-14 10:08:54 UTC (rev 1370)
@@ -68,7 +68,10 @@
description text,
private smallint DEFAULT 0 NOT NULL,
status smallint DEFAULT 1 NOT NULL,
- reminded int
+ reminded int,
+ info_time int,
+ info_user varchar(80),
+ info_text text
);
create index idxStartTime on mrbs_entry(start_time);
create index idxEndTime on mrbs_entry(end_time);
@@ -89,7 +92,10 @@
description text,
rep_num_weeks smallint DEFAULT NULL NULL,
private smallint DEFAULT 0 NOT NULL,
- reminded int
+ reminded int,
+ info_time int,
+ info_user varchar(80),
+ info_text text
);
CREATE TABLE mrbs_variables
@@ -110,6 +116,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '13');
+ VALUES ('db_version', '14');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/trunk/tables.pg.sql
===================================================================
--- mrbs/trunk/tables.pg.sql 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/tables.pg.sql 2010-07-14 10:08:54 UTC (rev 1370)
@@ -80,7 +80,10 @@
description text,
private smallint DEFAULT 0 NOT NULL,
status smallint DEFAULT 1 NOT NULL,
- reminded int
+ reminded int,
+ info_time int,
+ info_user varchar(80),
+ info_text text
);
create index idxStartTime on mrbs_entry(start_time);
create index idxEndTime on mrbs_entry(end_time);
@@ -101,7 +104,10 @@
description text,
rep_num_weeks smallint DEFAULT 0 NULL,
private smallint DEFAULT 0 NOT NULL,
- reminded int
+ reminded int,
+ info_time int,
+ info_user varchar(80),
+ info_text text
);
CREATE TABLE mrbs_variables
@@ -122,6 +128,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '13');
+ VALUES ('db_version', '14');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/trunk/web/confirm_entry_handler.php
===================================================================
--- mrbs/trunk/web/confirm_entry_handler.php 2010-07-01 15:35:47 UTC (rev
1369)
+++ mrbs/trunk/web/confirm_entry_handler.php 2010-07-14 10:08:54 UTC (rev
1370)
@@ -99,6 +99,8 @@
// update the last reminded time (the ball is back in the
// originator's court, so the clock gets reset)
mrbsUpdateLastReminded($id, $series);
+ // update the more info fields
+ mrbsUpdateMoreInfo($id, $series, $user, $note);
if ($need_to_send_mail)
{
$result = notifyAdminOnBooking(TRUE, $id, $series, $action);
Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/web/dbsys.inc 2010-07-14 10:08:54 UTC (rev 1370)
@@ -15,7 +15,7 @@
$tbl_variables = $db_tbl_prefix . "variables";
-$db_schema_version = 13;
+$db_schema_version = 14;
$local_db_schema_version = 1;
Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/web/lang.en 2010-07-14 10:08:54 UTC (rev 1370)
@@ -117,6 +117,10 @@
$vocab["reject_reason"] = "Please give a reason for your rejection of
this reservation request";
$vocab["send"] = "Send";
$vocab["accept_failed"] = "The reservation could not be confirmed.";
+$vocab["no_request_yet"] = "No request has been sent yet"; // Used for the
title tooltip on More Info button
+$vocab["last_request"] = "Last request sent at"; // Used for the
title tooltip on More Info button
+$vocab["by"] = "by"; // Used for the
title tooltip on More Info button
+$vocab["sent_at"] = "Sent at ";
// Used in edit_entry_handler.php
$vocab["error"] = "Error";
Modified: mrbs/trunk/web/mrbs_sql.inc
===================================================================
--- mrbs/trunk/web/mrbs_sql.inc 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/web/mrbs_sql.inc 2010-07-14 10:08:54 UTC (rev 1370)
@@ -618,7 +618,10 @@
// Update the time of last reminding.
// If the entry is part of a repeating series, then also increment
// the last reminder time in the repeat table and all the individual
-// entries.
+// entries. (Although strictly speaking the reminder time should apply
+// either to a series or an individual entry, we update everything to
+// prevent users bombarding admins with reminder emails)
+//
// Returns the number of tuples affected if OK (a number >= 0).
// Returns -1 on error; use sql_error to get the error message.
function mrbsUpdateLastReminded($id, $series)
@@ -651,6 +654,29 @@
return -1;
}
+// Update the entry/repeat tables with details about the last More Info
+// request (time, user, email text)
+//
+// If $series is TRUE then $id is the id of an entry in the repeat table
+// which is updated. Otherwise $id is the id of an entry in the
+// entry table, which is updated.
+//
+// Returns the number of tuples affected if OK (a number >= 0).
+// Returns -1 on error; use sql_error to get the error message.
+function mrbsUpdateMoreInfo($id, $series, $user, $note)
+{
+ global $tbl_entry, $tbl_repeat;
+
+ $table = ($series) ? $tbl_repeat : $tbl_entry;
+ $now = time();
+ $sql = "UPDATE $table SET";
+ $sql .= " info_time=$now";
+ $sql .= ", info_user='" . addslashes($user) . "'";
+ $sql .= ", info_text='" . addslashes($note) . "'";
+ $sql .= " WHERE id=$id";
+ return sql_command($sql);
+}
+
// mrbsConfirmEntry($id, $series)
//
// Confirm an entry with id $id. If series is set to TRUE
@@ -683,7 +709,7 @@
// Returns the results in an array with keys the same as the table
// field names. In the event of an error stops with a fatal error,
-// unless $silent is TRUe, when it returns FALSE.
+// unless $silent is TRUE, when it returns FALSE.
function mrbsGetBookingInfo($id, $series, $silent=FALSE)
{
global $tbl_entry, $tbl_repeat, $tbl_room, $tbl_area;
@@ -692,57 +718,38 @@
if ($series)
{
$sql = "
- SELECT $tbl_repeat.name,
- $tbl_repeat.description,
- $tbl_repeat.create_by,
- $tbl_room.room_name,
- $tbl_repeat.room_id,
- $tbl_area.area_name,
- $tbl_room.area_id,
- $tbl_repeat.type,
- $tbl_repeat.reminded,
- $tbl_repeat.private,
- $tbl_repeat.room_id,
- " . sql_syntax_timestamp_to_unix("$tbl_repeat.timestamp") . " AS
last_updated,
- ($tbl_repeat.end_time - $tbl_repeat.start_time) AS duration,
- $tbl_repeat.start_time,
- $tbl_repeat.end_time,
- $tbl_repeat.rep_type,
- $tbl_repeat.end_date,
- $tbl_repeat.rep_opt,
- $tbl_repeat.rep_num_weeks
+ SELECT T.name, T.description, T.create_by,
+ M.room_name, T.room_id, A.area_name, M.area_id,
+ T.type, T.reminded, T.private, T.room_id,
+ " . sql_syntax_timestamp_to_unix("T.timestamp") . " AS
last_updated,
+ (T.end_time - T.start_time) AS duration,
+ T.start_time, T.end_time,
+ T.rep_type, T.end_date, T.rep_opt, T.rep_num_weeks,
+ T.info_time AS repeat_info_time, T.info_user AS repeat_info_user,
T.info_text AS repeat_info_text
- FROM $tbl_repeat, $tbl_room, $tbl_area
- WHERE $tbl_repeat.room_id = $tbl_room.id
- AND $tbl_room.area_id = $tbl_area.id
- AND $tbl_repeat.id=$id
+ FROM $tbl_repeat T, $tbl_room M, $tbl_area A
+ WHERE T.room_id = M.id
+ AND M.area_id = A.id
+ AND T.id=$id
";
}
else
{
$sql = "
- SELECT $tbl_entry.name,
- $tbl_entry.description,
- $tbl_entry.create_by,
- $tbl_room.room_name,
- $tbl_entry.room_id,
- $tbl_room.area_id,
- $tbl_area.area_name,
- $tbl_entry.type,
- $tbl_entry.status,
- $tbl_entry.reminded,
- $tbl_entry.private,
- $tbl_entry.room_id,
- " . sql_syntax_timestamp_to_unix("$tbl_entry.timestamp") . " AS
last_updated,
- ($tbl_entry.end_time - $tbl_entry.start_time) AS duration,
- $tbl_entry.start_time,
- $tbl_entry.end_time,
- $tbl_entry.repeat_id
+ SELECT E.name, E.description, E.create_by,
+ M.room_name, E.room_id, A.area_name, M.area_id,
+ E.status,
+ E.type, E.reminded, E.private, E.room_id,
+ " . sql_syntax_timestamp_to_unix("E.timestamp") . " AS
last_updated,
+ (E.end_time - E.start_time) AS duration,
+ E.start_time, E.end_time,
+ E.repeat_id,
+ E.info_time AS entry_info_time, E.info_user AS entry_info_user,
E.info_text AS entry_info_text
- FROM $tbl_entry, $tbl_room, $tbl_area
- WHERE $tbl_entry.room_id = $tbl_room.id
- AND $tbl_room.area_id = $tbl_area.id
- AND $tbl_entry.id=$id
+ FROM $tbl_entry E, $tbl_room M, $tbl_area A
+ WHERE E.room_id = M.id
+ AND M.area_id = A.id
+ AND E.id=$id
";
}
@@ -796,6 +803,9 @@
LIMIT 1";
$row['status'] = (sql_query1($sql) > 0) ? STATUS_PROVISIONAL :
STATUS_CONFIRMED;
}
+ $row['entry_info_time'] = '';
+ $row['entry_info_user'] = '';
+ $row['entry_info_text'] = '';
}
else
{
@@ -803,10 +813,14 @@
if (empty($row['repeat_id']))
{
$row['rep_type'] = REP_NONE; // just as a precaution
+ $row['repeat_info_time'] = '';
+ $row['repeat_info_user'] = '';
+ $row['repeat_info_text'] = '';
}
else
{
- $res = sql_query("SELECT rep_type, end_date, rep_opt, rep_num_weeks
+ $res = sql_query("SELECT rep_type, end_date, rep_opt, rep_num_weeks,
+ info_time AS repeat_info_time, info_user AS
repeat_info_user, info_text AS repeat_info_text
FROM $tbl_repeat WHERE id=${row['repeat_id']} LIMIT
1");
if (!$res || (!$extra_row = sql_row_keyed($res, 0)))
{
@@ -823,6 +837,9 @@
$row['rep_enddate'] = $extra_row['end_date'];
$row['rep_opt'] = $extra_row['rep_opt'];
$row['rep_num_weeks'] = $extra_row['rep_num_weeks'];
+ $row['repeat_info_time'] = $extra_row['repeat_info_time'];
+ $row['repeat_info_user'] = $extra_row['repeat_info_user'];
+ $row['repeat_info_text'] = $extra_row['repeat_info_text'];
sql_free($res);
}
}
Modified: mrbs/trunk/web/pending.php
===================================================================
--- mrbs/trunk/web/pending.php 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/web/pending.php 2010-07-14 10:08:54 UTC (rev 1370)
@@ -41,11 +41,25 @@
echo "</div>\n";
echo "</form>\n";
// more info
+ $info_time = ($is_series) ? $row['repeat_info_time'] :
$row['entry_info_time'];
+ $info_user = ($is_series) ? $row['repeat_info_user'] :
$row['entry_info_user'];
+ if (empty($info_time))
+ {
+ $info_title = get_vocab("no_request_yet");
+ }
+ else
+ {
+ $info_title = get_vocab("last_request") . ' ' .
time_date_string($info_time);
+ if (!empty($info_user))
+ {
+ $info_title .= " " . get_vocab("by") . " $info_user";
+ }
+ }
echo "<form action=\"view_entry.php?$query_string\" method=\"post\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"more_info\">\n";
echo "<input type=\"hidden\" name=\"returl\" value=\"" .
htmlspecialchars($returl) . "\">\n";
- echo "<input type=\"submit\" value=\"" . get_vocab("more_info") . "\">\n";
+ echo "<input type=\"submit\" title=\"" . htmlspecialchars($info_title) .
"\" value=\"" . get_vocab("more_info") . "\">\n";
echo "</div>\n";
echo "</form>\n";
}
@@ -150,12 +164,15 @@
$sql = "SELECT E.id, E.name, E.room_id, E.start_time, E.create_by, " .
sql_syntax_timestamp_to_unix("E.timestamp") . " AS last_updated,
E.reminded, E.repeat_id,
- R.room_name, R.area_id, A.area_name
- FROM $tbl_room AS R, $tbl_area AS A, $tbl_entry AS E
- WHERE E.room_id = R.id
- AND R.area_id = A.id
- AND A.provisional_enabled>0
- AND status=" . STATUS_PROVISIONAL;
+ M.room_name, M.area_id, A.area_name,
+ E.info_time AS entry_info_time, E.info_user AS entry_info_user,
+ T.info_time AS repeat_info_time, T.info_user AS repeat_info_user
+ FROM $tbl_room AS M, $tbl_area AS A, $tbl_entry AS E
+ LEFT JOIN $tbl_repeat AS T ON E.repeat_id=T.id
+ WHERE E.room_id = M.id
+ AND M.area_id = A.id
+ AND A.provisional_enabled>0
+ AND status=" . STATUS_PROVISIONAL;
// Ordinary users can only see their own bookings
if (!$is_admin)
Added: mrbs/trunk/web/upgrade/14/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/14/mysql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/14/mysql.sql 2010-07-14 10:08:54 UTC (rev 1370)
@@ -0,0 +1,14 @@
+# $Id$
+
+# Add columns so that details about the last request for More Info on
+# provisional bookings can be recorded.
+
+ALTER TABLE %DB_TBL_PREFIX%entry
+ADD COLUMN info_time int,
+ADD COLUMN info_user varchar(80),
+ADD COLUMN info_text text;
+
+ALTER TABLE %DB_TBL_PREFIX%repeat
+ADD COLUMN info_time int,
+ADD COLUMN info_user varchar(80),
+ADD COLUMN info_text text;
Property changes on: mrbs/trunk/web/upgrade/14/mysql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/trunk/web/upgrade/14/pgsql.sql
===================================================================
--- mrbs/trunk/web/upgrade/14/pgsql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/14/pgsql.sql 2010-07-14 10:08:54 UTC (rev 1370)
@@ -0,0 +1,14 @@
+-- $Id$
+
+-- Add columns so that details about the last request for More Info on
+-- provisional bookings can be recorded.
+
+ALTER TABLE %DB_TBL_PREFIX%entry
+ADD COLUMN info_time int,
+ADD COLUMN info_user varchar(80),
+ADD COLUMN info_text text;
+
+ALTER TABLE %DB_TBL_PREFIX%repeat
+ADD COLUMN info_time int,
+ADD COLUMN info_user varchar(80),
+ADD COLUMN info_text text;
Property changes on: mrbs/trunk/web/upgrade/14/pgsql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: mrbs/trunk/web/view_entry.php
===================================================================
--- mrbs/trunk/web/view_entry.php 2010-07-01 15:35:47 UTC (rev 1369)
+++ mrbs/trunk/web/view_entry.php 2010-07-14 10:08:54 UTC (rev 1370)
@@ -5,7 +5,7 @@
require_once "mrbs_sql.inc";
// Generates a single button
-function generateButton($form_action, $id, $series, $action_type, $returl,
$submit_value)
+function generateButton($form_action, $id, $series, $action_type, $returl,
$submit_value, $title='')
{
global $room_id;
@@ -17,7 +17,7 @@
echo "<input type=\"hidden\" name=\"action\" value=\"$action_type\">\n";
echo "<input type=\"hidden\" name=\"room_id\" value=\"$room_id\">\n";
echo "<input type=\"hidden\" name=\"returl\" value=\"" .
htmlspecialchars($returl) . "\">\n";
- echo "<input type=\"submit\" value=\"$submit_value\">\n";
+ echo "<input type=\"submit\" title=\"" . htmlspecialchars($title) . "\"
value=\"$submit_value\">\n";
echo "</fieldset>\n";
echo "</form>\n";
}
@@ -26,15 +26,31 @@
function generateConfirmButtons($id, $series)
{
global $returl, $PHP_SELF;
+ global $entry_info_time, $entry_info_user, $repeat_info_time,
$repeat_info_user;
+ $info_time = ($series) ? $repeat_info_time : $entry_info_time;
+ $info_user = ($series) ? $repeat_info_user : $entry_info_user;
+
$this_page = basename($PHP_SELF);
+ if (empty($info_time))
+ {
+ $info_title = get_vocab("no_request_yet");
+ }
+ else
+ {
+ $info_title = get_vocab("last_request") . ' ' .
time_date_string($info_time);
+ if (!empty($info_user))
+ {
+ $info_title .= " " . get_vocab("by") . " $info_user";
+ }
+ }
echo "<tr>\n";
echo "<td>" . ($series ? get_vocab("series") : get_vocab("entry")) .
":</td>\n";
echo "<td>\n";
generateButton("confirm_entry_handler.php", $id, $series, "accept", $returl,
get_vocab("accept"));
generateButton($this_page, $id, $series, "reject", $returl,
get_vocab("reject"));
- generateButton($this_page, $id, $series, "more_info", $returl,
get_vocab("more_info"));
+ generateButton($this_page, $id, $series, "more_info", $returl,
get_vocab("more_info"), $info_title);
echo "</td>\n";
echo "</tr>\n";
}
@@ -63,7 +79,7 @@
}
}
-function generateTextArea($form_action, $id, $series, $action_type, $returl,
$submit_value, $caption)
+function generateTextArea($form_action, $id, $series, $action_type, $returl,
$submit_value, $caption, $value='')
{
echo "<tr><td id=\"caption\" colspan=\"2\">$caption:</td></tr>\n";
echo "<tr>\n";
@@ -71,7 +87,7 @@
echo "<form action=\"$form_action\" method=\"post\">\n";
echo "<fieldset>\n";
echo "<legend></legend>\n";
- echo "<textarea name=\"note\"></textarea>\n";
+ echo "<textarea name=\"note\">" . htmlspecialchars($value) . "</textarea>\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">\n";
echo "<input type=\"hidden\" name=\"series\" value=\"$series\">\n";
echo "<input type=\"hidden\" name=\"returl\" value=\"$returl\">\n";
@@ -156,6 +172,12 @@
$room_id = $row['room_id'];
$updated = time_date_string($row['last_updated']);
$last_reminded = (empty($row['reminded'])) ? $row['last_updated'] :
$row['reminded'];
+$entry_info_time = $row['entry_info_time'];
+$entry_info_user = $row['entry_info_user']; // HTML escaping is done later
+$entry_info_text = $row['entry_info_text']; // HTML escaping is done later
+$repeat_info_time = $row['repeat_info_time'];
+$repeat_info_user = $row['repeat_info_user']; // HTML escaping is done later
+$repeat_info_text = $row['repeat_info_text']; // HTML escaping is done later
// need to make DST correct in opposite direction to entry creation
// so that user see what he expects to see
$duration = $row['duration'] - cross_dst($row['start_time'],
@@ -320,10 +342,29 @@
// Sometime this difference in behaviour should be rationalised
// because it is very confusing!
$target_id = ($series) ? $repeat_id : $id;
+ $info_time = ($series) ? $repeat_info_time : $entry_info_time;
+ $info_user = ($series) ? $repeat_info_user : $entry_info_user;
+ $info_text = ($series) ? $repeat_info_text : $entry_info_text;
+
+ if (empty($info_time))
+ {
+ $value = '';
+ }
+ else
+ {
+ $value = get_vocab("sent_at") . time_date_string($info_time);
+ if (!empty($info_user))
+ {
+ $value .= "\n" . get_vocab("by") . " $info_user";
+ }
+ $value .= "\n----\n";
+ $value .= $info_text;
+ }
generateTextArea("confirm_entry_handler.php", $target_id, $series,
"more_info", $returl,
get_vocab("send"),
- get_vocab("request_more_info"));
+ get_vocab("request_more_info"),
+ $value);
}
// PHASE 1 - first time through this page
else
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits