Revision: 1909
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1909&view=rev
Author:   cimorrison
Date:     2011-08-31 08:59:18 +0000 (Wed, 31 Aug 2011)
Log Message:
-----------
Added a "Skip and book" button to the page listing conflicting entries if you 
try and make a repeat booking where some of the entries have conflicts.

Modified Paths:
--------------
    mrbs/trunk/web/edit_entry_handler.php
    mrbs/trunk/web/lang.en
    mrbs/trunk/web/mrbs.css.php

Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php       2011-08-30 10:23:54 UTC (rev 
1908)
+++ mrbs/trunk/web/edit_entry_handler.php       2011-08-31 08:59:18 UTC (rev 
1909)
@@ -6,47 +6,51 @@
 require_once "functions_ical.inc";
 
 // Get non-standard form variables
-$create_by = get_form_var('create_by', 'string');
-$name = get_form_var('name', 'string');
-$rep_type = get_form_var('rep_type', 'int');
-$description = get_form_var('description', 'string');
-$start_seconds = get_form_var('start_seconds', 'int');
-$end_seconds = get_form_var('end_seconds', 'int');
-$all_day = get_form_var('all_day', 'string'); // bool, actually
-$type = get_form_var('type', 'string');
-$rooms = get_form_var('rooms', 'array');
-$original_room_id = get_form_var('original_room_id', 'int');
-$ical_uid = get_form_var('ical_uid', 'string');
-$ical_sequence = get_form_var('ical_sequence', 'int');
-$ical_recur_id = get_form_var('ical_recur_id', 'string');
-$returl = get_form_var('returl', 'string');
-$rep_id = get_form_var('rep_id', 'int');
-$edit_type = get_form_var('edit_type', 'string');
-$id = get_form_var('id', 'int');
-$rep_end_day = get_form_var('rep_end_day', 'int');
-$rep_end_month = get_form_var('rep_end_month', 'int');
-$rep_end_year = get_form_var('rep_end_year', 'int');
-$rep_id = get_form_var('rep_id', 'int');
-$rep_day = get_form_var('rep_day', 'array'); // array of bools
-$rep_num_weeks = get_form_var('rep_num_weeks', 'int');
-$skip = get_form_var('skip', 'string');  // bool, actually
-$private = get_form_var('private', 'string'); // bool, actually
-$confirmed = get_form_var('confirmed', 'string');
-// Get the start day/month/year and make them the current day/month/year
-$day = get_form_var('start_day', 'int');
-$month = get_form_var('start_month', 'int');
-$year = get_form_var('start_year', 'int');
-// Get the end day/month/year
-$end_day = get_form_var('end_day', 'int');
-$end_month = get_form_var('end_month', 'int');
-$end_year = get_form_var('end_year', 'int');
+$formvars = array('create_by'         => 'string',
+                  'name'              => 'string',
+                  'rep_type'          => 'int',
+                  'description'       => 'string',
+                  'start_seconds'     => 'int',
+                  'end_seconds'       => 'int',
+                  'all_day'           => 'string',  // bool, actually
+                  'type'              => 'string',
+                  'rooms'             => 'array',
+                  'original_room_id'  => 'int',
+                  'ical_uid'          => 'string',
+                  'ical_sequence'     => 'int',
+                  'ical_recur_id'     => 'string',
+                  'returl'            => 'string',
+                  'rep_id'            => 'int',
+                  'edit_type'         => 'string',
+                  'id'                => 'int',
+                  'rep_end_day'       => 'int',
+                  'rep_end_month'     => 'int',
+                  'rep_end_year'      => 'int',
+                  'rep_id'            => 'int',
+                  'rep_day'           => 'array',   // array of bools
+                  'rep_num_weeks'     => 'int',
+                  'skip'              => 'string',  // bool, actually
+                  'private'           => 'string',  // bool, actually
+                  'confirmed'         => 'string',
+                  'start_day'         => 'int',
+                  'start_month'       => 'int',
+                  'start_year'        => 'int',
+                  'end_day'           => 'int',
+                  'end_month'         => 'int',
+                  'end_year'          => 'int');
+                  
+foreach($formvars as $var => $var_type)
+{
+  $$var = get_form_var($var, $var_type);
+}
+              
 
+// Get custom form variables
+$custom_fields = array();
+
 // Get the information about the fields in the entry table
 $fields = sql_field_info($tbl_entry);
-
-// Get custom form variables
-$custom_fields = array();
-                    
+          
 foreach($fields as $field)
 {
   if (!in_array($field['name'], $standard_fields['entry']))
@@ -73,6 +77,19 @@
   }
 }
 
+// Get the start day/month/year and make them the current day/month/year
+$day = $start_day;
+$month = $start_month;
+$year = $start_year;
+
+// The id must be either an integer or NULL, so that subsequent code that 
tests whether
+// isset($id) works.  (I suppose one could use !empty instead, but there's 
always the
+// possibility that sites have allowed 0 in their auto-increment/serial 
columns.)
+if (isset($id) && ($id == ''))
+{
+  unset($id);
+}
+
 // Truncate the name field to the maximum length as a precaution.
 // Although the MAXLENGTH attribute is used in the <input> tag, this can
 // sometimes be ignored by the browser, for example by Firefox when 
@@ -186,6 +203,7 @@
   exit;
 }
 
+
 // Check that the user has permission to create/edit an entry for this room.
 // Get the id of the room that we are creating/editing
 if (isset($id))
@@ -726,9 +744,58 @@
   }
 }
 
-echo "<p>\n";
-echo "<a href=\"" . htmlspecialchars($returl) . "\">" . get_vocab("returncal") 
. "</a>\n";
-echo "</p>\n";
+echo "<div id=\"submit_buttons\">\n";
 
+// Back button
+echo "<form method=\"post\" action=\"" . htmlspecialchars($returl) . "\">\n";
+echo "<fieldset><legend></legend>\n";
+echo "<input type=\"submit\" value=\"" . get_vocab("back") . "\">\n";
+echo "</fieldset>\n";
+echo "</form>\n";
+
+
+// Skip and Book button (to book the entries that don't conflict)
+// Only show this button if there were no policies broken
+if (empty($rules_broken))
+{
+  echo "<form method=\"post\" action=\"" . 
htmlspecialchars(basename($PHP_SELF)) . "\">\n";
+  echo "<fieldset><legend></legend>\n";
+  // Put the booking data in as hidden inputs
+  $skip = 1;  // Force a skip next time round
+  // First the ordinary fields
+  foreach ($formvars as $var => $var_type)
+  {
+    if ($var_type == 'array')
+    {
+      foreach ($$var as $value)
+      {
+        echo "<input type=\"hidden\" name=\"${var}[]\" value=\"" . 
htmlspecialchars($value) . "\">\n";
+      }
+    }
+    else
+    {
+      echo "<input type=\"hidden\" name=\"$var\" value=\"" . 
htmlspecialchars($$var) . "\">\n";
+    }
+  }
+  // Then the custom fields
+  foreach($fields as $field)
+  {
+    if (array_key_exists($field['name'], $custom_fields))
+    {
+      echo "<input type=\"hidden\"" .
+                  "name=\"" . VAR_PREFIX . $field['name'] . "\"" .
+                  "value=\"" . 
htmlspecialchars($custom_fields[$field['name']]) . "\">\n";
+    }
+  }
+  // Submit button
+  echo "<input type=\"submit\"" .
+              "value=\"" . get_vocab("skip_and_book") . "\"" .
+              "title=\"" . get_vocab("skip_and_book_note") . "\">\n";
+  echo "</fieldset>\n";
+  echo "</form>\n";
+}
+
+echo "</div>\n";
+
 require_once "trailer.inc";
 ?>

Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en      2011-08-30 10:23:54 UTC (rev 1908)
+++ mrbs/trunk/web/lang.en      2011-08-31 08:59:18 UTC (rev 1909)
@@ -175,6 +175,8 @@
 $vocab["min_time_before"]         = "The minimum interval between now and the 
start of a booking is";
 $vocab["max_time_before"]         = "The maximum interval between now and the 
start of a booking is";
 $vocab["max_booking_duration"]    = "The maximum duration of a booking is";
+$vocab["skip_and_book"]           = "Skip and book";
+$vocab["skip_and_book_note"]      = "Carry on with the booking, skipping past 
the conflicting entries";
 
 // Used in pending.php
 $vocab["pending"]            = "Bookings awaiting approval";
@@ -413,5 +415,5 @@
 
 // General
 $vocab["fatal_db_error"]     = "Fatal error: unfortunately the database is not 
available at the moment.";
-
+$vocab["back"]               = "Back";
 ?>

Modified: mrbs/trunk/web/mrbs.css.php
===================================================================
--- mrbs/trunk/web/mrbs.css.php 2011-08-30 10:23:54 UTC (rev 1908)
+++ mrbs/trunk/web/mrbs.css.php 2011-08-31 08:59:18 UTC (rev 1909)
@@ -614,8 +614,13 @@
 .edit_area_room span.error {display: block; width: 100%; margin-bottom: 0.5em}
 
 .form_general label.secondary {font-weight: normal; width: auto}
-    
 
+
+/* ------------ EDIT_ENTRY_HANDLER.PHP ------------------*/
+.edit_entry_handler div#submit_buttons {float: left}
+.edit_entry_handler #submit_buttons form {float: left; margin: 1em 2em 1em 0}
+
+
 /* ------------ EDIT_USERS.PHP ------------------*/
 <?php
 $edit_users_label_height     = '2.0';    // em

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to