Revision: 1433
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1433&view=rev
Author:   cimorrison
Date:     2010-09-01 14:42:32 +0000 (Wed, 01 Sep 2010)

Log Message:
-----------
Implemented new style provisional bookings, which are now known as "tentative" 
bookings.  A booking can now have three, independent, statuses:

- Privacy status (public or private)
- Approval status (approved or awaiting approval)
- Confirmation status (confirmed or tentative)

Modified Paths:
--------------
    mrbs/branches/provisional_bookings_new_style/web/edit_entry.php
    mrbs/branches/provisional_bookings_new_style/web/edit_entry_handler.php
    mrbs/branches/provisional_bookings_new_style/web/functions.inc
    mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc
    mrbs/branches/provisional_bookings_new_style/web/internalconfig.inc.php
    mrbs/branches/provisional_bookings_new_style/web/lang.en
    mrbs/branches/provisional_bookings_new_style/web/month.php
    mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php
    mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php
    mrbs/branches/provisional_bookings_new_style/web/view_entry.php

Modified: mrbs/branches/provisional_bookings_new_style/web/edit_entry.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/edit_entry.php     
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/edit_entry.php     
2010-09-01 14:42:32 UTC (rev 1433)
@@ -153,6 +153,7 @@
         
       case 'status':
         $private = $row['status'] & STATUS_PRIVATE;
+        $confirmed = !($row['status'] & STATUS_TENTATIVE);
         break;
       
       case 'repeat_id':
@@ -300,6 +301,7 @@
   $rep_end_year  = $year;
   $rep_day       = array(0, 0, 0, 0, 0, 0, 0);
   $private       = $private_default;
+  $confirmed     = $confirmed_default;
   // now initialise the custom fields
   foreach ($fields as $field)
   {
@@ -806,8 +808,7 @@
       </div>
     </div>
     <div id="div_type">
-      <label for="type"><?php echo get_vocab("type")?>:</label>
-     <div class="group">    
+      <label for="type"><?php echo get_vocab("type")?>:</label>  
       <select id="type" name="type">
         <?php
         for ($c = "A"; $c <= "Z"; $c++)
@@ -819,27 +820,48 @@
         }
         ?>
       </select>
-      <?php 
-      if ($private_enabled) 
-      { ?>
-        <div id="div_private">
-          <input id="private" class="checkbox" name="private" type="checkbox" 
value="yes"<?php 
-          if($private) 
-          {
-            echo " checked=\"checked\"";
-          }
-          if($private_mandatory) 
-          {
-            echo " disabled=\"true\"";
-          }
-          ?>>
-          <label for="private"><?php echo get_vocab("private") ?></label>
-        </div><?php 
-      } ?>
-     </div>
     </div>
     
     <?php
+    // Status
+    if ($private_enabled || $confirmation_enabled) 
+    { 
+      echo "<div id=\"div_status\">\n";
+      echo "<label>" . get_vocab("status") . ":</label>\n";
+      echo "<div class=\"group\">\n";
+      
+      // Privacy status
+      if ($private_enabled)
+      {    
+        echo "<input id=\"private\" class=\"checkbox\" name=\"private\" 
type=\"checkbox\" value=\"yes\"";
+        if ($private) 
+        {
+          echo " checked=\"checked\"";
+        }
+        if ($private_mandatory) 
+        {
+          echo " disabled=\"true\"";
+        }
+        echo ">\n";
+        echo "<label for=\"private\">" . get_vocab("private") . "</label>\n";
+      }
+      
+      // Confirmation status
+      if ($confirmation_enabled)
+      {
+        echo "<input id=\"confirmed\" class=\"checkbox\" name=\"confirmed\" 
type=\"checkbox\" value=\"yes\"";
+        if ($confirmed) 
+        {
+          echo " checked=\"checked\"";
+        }
+        echo ">\n";
+        echo "<label for=\"confirmed\">" . get_vocab("confirmed") . 
"</label>\n";
+      }
+
+      echo "</div>\n";
+      echo "</div>\n";
+    }
+
     
     // CUSTOM FIELDS
 

Modified: 
mrbs/branches/provisional_bookings_new_style/web/edit_entry_handler.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/edit_entry_handler.php     
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/edit_entry_handler.php     
2010-09-01 14:42:32 UTC (rev 1433)
@@ -29,6 +29,7 @@
 $rep_day = get_form_var('rep_day', 'array'); // array of bools
 $rep_num_weeks = get_form_var('rep_num_weeks', 'int');
 $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');
@@ -483,6 +484,7 @@
   { 
     // Set the various bits in the status field as appropriate
     $status = 0;
+    // Privacy status
     if ($isprivate)
     {
       $status |= STATUS_PRIVATE;  // Set the private bit
@@ -496,6 +498,11 @@
     {
       $status |= STATUS_AWAITING_APPROVAL;
     }
+    // Confirmation status
+    if ($confirmation_enabled && !$confirmed)
+    {
+      $status |= STATUS_TENTATIVE;
+    }
 
     
     if ($edit_type == "series")

Modified: mrbs/branches/provisional_bookings_new_style/web/functions.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/functions.inc      
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/functions.inc      
2010-09-01 14:42:32 UTC (rev 1433)
@@ -1262,7 +1262,7 @@
   global $main_cell_height, $main_table_cell_border_width;
   global $area, $year, $month, $timetohighlight;
   global $javascript_cursor, $enable_periods, $times_along_top;
-  global $approval_enabled;
+  global $approval_enabled, $confirmation_enabled;
   
   // if the time slot has got multiple bookings, then draw a mini-table
   if(isset($cell[1]["id"]))
@@ -1307,13 +1307,17 @@
       $descr      = htmlspecialchars($cell[$n]["data"]);
       $long_descr = htmlspecialchars($cell[$n]["long_descr"]);
       $class = $color;
+      if ($status & STATUS_PRIVATE)
+      {
+        $class .= " private";
+      }
       if ($approval_enabled && ($status & STATUS_AWAITING_APPROVAL))
       {
         $class .= " awaiting_approval";
       }
-      if ($status & STATUS_PRIVATE)
+      if ($confirmation_enabled && ($status & STATUS_TENTATIVE))
       {
-        $class .= " private";
+        $class .= " tentative";
       }
       echo "<tr>\n";
       echo "<td class=\"$class\"" .
@@ -1352,14 +1356,18 @@
       $descr      = htmlspecialchars($cell[$n]["start_time"] . " " . 
$cell[$n]["data"]);
       $long_descr = htmlspecialchars($cell[$n]["long_descr"]);
       $class = $color;
+      if ($status & STATUS_PRIVATE)
+      {
+        $class .= " private";
+      }
       if ($approval_enabled && ($status & STATUS_AWAITING_APPROVAL))
       {
         $class .= " awaiting_approval";
+      }
+      if ($confirmation_enabled && ($status & STATUS_TENTATIVE))
+      {
+        $class .= " tentative";
       }    
-      if ($status & STATUS_PRIVATE)
-      {
-        $class .= " private";
-      }
       echo "<tr>\n";
       echo "<td class=\"$class\"" .
            (($n==0) ? " style=\"border-top-width: 0\"" : "") .   // no border 
for first row
@@ -1403,14 +1411,18 @@
     if (isset($id))
     {
       $c = $color;
+      if ($status & STATUS_PRIVATE)
+      {
+        $c .= " private";
+      }
       if ($approval_enabled && ($status & STATUS_AWAITING_APPROVAL))
       {
         $c .= " awaiting_approval";
+      }
+      if ($confirmation_enabled && ($status & STATUS_TENTATIVE))
+      {
+        $c .= " tentative";
       } 
-      if ($status & STATUS_PRIVATE)
-      {
-        $c .= " private";
-      }
     }
     else
     {

Modified: mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc 
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc 
2010-09-01 14:42:32 UTC (rev 1433)
@@ -287,7 +287,7 @@
   global $rep_enddate, $typel, $type, $status, $create_by, $rep_type, 
$enable_periods;
   global $rep_opt, $rep_num_weeks, $custom_fields, $standard_fields;
   global $mail_previous, $auth, $note;
-  global $mail_settings, $weekstarts, $approval_enabled;
+  global $mail_settings, $weekstarts, $approval_enabled, $confirmation_enabled;
   global $tbl_entry;
   
   $recipients = array();
@@ -440,13 +440,22 @@
                             
convertToMailCharset($mail_previous['description']),
                             $new_entry) . "\n";
                             
+    if  ($confirmation_enabled)
+    {                        
+      // Confirmation status:
+      $body .= get_mail_vocab("confirmation_status") . ": ";
+      $old_status = ($mail_previous['status'] & STATUS_TENTATIVE) ? 
get_mail_vocab("tentative_booking") : get_mail_vocab("confirmed_booking");
+      $new_status = ($status & STATUS_TENTATIVE) ? 
get_mail_vocab("tentative_booking") : get_mail_vocab("confirmed_booking");
+      $body .= compareEntries($new_status, $old_status, $new_entry) . "\n";
+    }
+                            
     if  ($approval_enabled)
     {                        
       // Approval status:
-      $body .= get_mail_vocab("status") . ": ";
-      $old_approval_status = ($mail_previous['status'] & 
STATUS_AWAITING_APPROVAL) ? get_mail_vocab("awaiting_approval") : 
get_mail_vocab("approved");
-      $new_approval_status = ($status & STATUS_AWAITING_APPROVAL) ? 
get_mail_vocab("awaiting_approval") : get_mail_vocab("approved");
-      $body .= compareEntries($new_approval_status, $old_approval_status, 
$new_entry) . "\n";
+      $body .= get_mail_vocab("approval_status") . ": ";
+      $old_status = ($mail_previous['status'] & STATUS_AWAITING_APPROVAL) ? 
get_mail_vocab("awaiting_approval") : get_mail_vocab("approved");
+      $new_status = ($status & STATUS_AWAITING_APPROVAL) ? 
get_mail_vocab("awaiting_approval") : get_mail_vocab("approved");
+      $body .= compareEntries($new_status, $old_status, $new_entry) . "\n";
     }
                                
     // Room:

Modified: 
mrbs/branches/provisional_bookings_new_style/web/internalconfig.inc.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/internalconfig.inc.php     
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/internalconfig.inc.php     
2010-09-01 14:42:32 UTC (rev 1433)
@@ -34,6 +34,7 @@
 
 define('STATUS_PRIVATE',           0x01);
 define('STATUS_AWAITING_APPROVAL', 0x02);
+define('STATUS_TENTATIVE',         0x04);
 
 
  /*************************************************

Modified: mrbs/branches/provisional_bookings_new_style/web/lang.en
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/lang.en    2010-09-01 
13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/lang.en    2010-09-01 
14:42:32 UTC (rev 1433)
@@ -91,38 +91,43 @@
 $vocab["valid_time_of_day"]  = "valid time of day.";
 $vocab["brief_description"]  = "Brief Description.";
 $vocab["useful_n-weekly_value"] = "useful n-weekly value.";
+$vocab["status"]             = "Status";
 $vocab["private"]            = "Private";
 $vocab["unavailable"]        = "Private";
+$vocab["confirmed"]          = "Confirmed";
 
 // Used in view_entry.php
-$vocab["description"]        = "Description";
-$vocab["room"]               = "Room";
-$vocab["createdby"]          = "Created By";
-$vocab["lastupdate"]         = "Last Updated";
-$vocab["deleteentry"]        = "Delete Entry";
-$vocab["deleteseries"]       = "Delete Series";
-$vocab["confirmdel"]         = "Are you sure\\nyou want to\\ndelete this 
entry?\\n\\n";
-$vocab["returnprev"]         = "Return to previous page";
-$vocab["invalid_entry_id"]   = "Invalid entry id.";
-$vocab["invalid_series_id"]  = "Invalid series id.";
-$vocab["status"]             = "Status";
-$vocab["approved"]           = "Approved booking";
-$vocab["awaiting_approval"]  = "Awaiting approval";
-$vocab["approve"]            = "Approve";
-$vocab["reject"]             = "Reject";
-$vocab["more_info"]          = "More Info";
-$vocab["remind_admin"]       = "Remind Admin";
-$vocab["series"]             = "Series";
-$vocab["request_more_info"]  = "Please list the extra information you require";
-$vocab["reject_reason"]      = "Please give a reason for your rejection of 
this reservation request";
-$vocab["send"]               = "Send";
-$vocab["approve_failed"]     = "The reservation could not be approved.";
-$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 ";
-$vocab["yes"]                = "Yes";
-$vocab["no"]                 = "No";
+$vocab["description"]         = "Description";
+$vocab["room"]                = "Room";
+$vocab["createdby"]           = "Created By";
+$vocab["lastupdate"]          = "Last Updated";
+$vocab["deleteentry"]         = "Delete Entry";
+$vocab["deleteseries"]        = "Delete Series";
+$vocab["confirmdel"]          = "Are you sure\\nyou want to\\ndelete this 
entry?\\n\\n";
+$vocab["returnprev"]          = "Return to previous page";
+$vocab["invalid_entry_id"]    = "Invalid entry id.";
+$vocab["invalid_series_id"]   = "Invalid series id.";
+$vocab["confirmation_status"] = "Confirmation status";
+$vocab["tentative_booking"]   = "Tentative booking";
+$vocab["confirmed_booking"]   = "Confirmed booking";
+$vocab["approval_status"]     = "Approval status";
+$vocab["approved"]            = "Approved booking";
+$vocab["awaiting_approval"]   = "Awaiting approval";
+$vocab["approve"]             = "Approve";
+$vocab["reject"]              = "Reject";
+$vocab["more_info"]           = "More Info";
+$vocab["remind_admin"]        = "Remind Admin";
+$vocab["series"]              = "Series";
+$vocab["request_more_info"]   = "Please list the extra information you 
require";
+$vocab["reject_reason"]       = "Please give a reason for your rejection of 
this reservation request";
+$vocab["send"]                = "Send";
+$vocab["approve_failed"]      = "The reservation could not be approved.";
+$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 ";
+$vocab["yes"]                 = "Yes";
+$vocab["no"]                  = "No";
 
 // Used in edit_entry_handler.php
 $vocab["error"]              = "Error";

Modified: mrbs/branches/provisional_bookings_new_style/web/month.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/month.php  2010-09-01 
13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/month.php  2010-09-01 
14:42:32 UTC (rev 1433)
@@ -535,15 +535,19 @@
       {
         // give the enclosing div the appropriate width: full width if both,
         // otherwise half-width (but use 49.9% to avoid rounding problems in 
some browsers)
-        $class = $d[$cday]["color"][$i];
+        $class = $d[$cday]["color"][$i]; 
+        if ($d[$cday]["status"][$i] & STATUS_PRIVATE)
+        {
+          $class .= " private";
+        }
         if ($approval_enabled && ($d[$cday]["status"][$i] & 
STATUS_AWAITING_APPROVAL))
         {
           $class .= " awaiting_approval";
-        }   
-        if ($d[$cday]["status"][$i] & STATUS_PRIVATE)
+        }
+        if ($confirmation_enabled && ($d[$cday]["status"][$i] & 
STATUS_TENTATIVE))
         {
-          $class .= " private";
-        }
+          $class .= " tentative";
+        }  
         echo "<div class=\"" . $class . "\"" .
           " style=\"width: " . (($monthly_view_entries_details == "both") ? 
'100%' : '49.9%') . "\">\n";
         $booking_link = "view_entry.php?id=" . $d[$cday]["id"][$i] . 
"&amp;day=$cday&amp;month=$month&amp;year=$year";

Modified: mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php       
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php       
2010-09-01 14:42:32 UTC (rev 1433)
@@ -431,10 +431,13 @@
 
 /* booking approval status */
 .awaiting_approval {opacity: 0.6}
-.awaiting_approval a {font-weight: normal}
 .awaiting_approval a:before {content: "? "}
 
+/* booking confirmation status */
+.tentative {opacity: 0.6}
+.tentative a {font-weight: normal}
 
+
 /* ------------ DEL.PHP -----------------------------*/
 div#del_room_confirm {padding-bottom: 3em}
 #del_room_confirm p {text-align: center; font-size: large; font-weight: bold}
@@ -589,7 +592,6 @@
 .form_general div#ad {float: left}
 .form_general #ad label {clear: none; text-align: left; font-weight: normal}
 .form_general input#all_day {width: auto; margin-left: 1.0em; margin-right: 
0.5em}
-.form_general input#private {width: auto; margin-left: 3.0em; margin-right: 
0.5em}
 .form_general #div_rooms select, .form_general #div_typematch select {float: 
left; margin-right: 2.0em}
 fieldset#rep_info {border-top: 1px solid <?php echo 
$site_faq_entry_border_color ?>; padding-top: 0.7em}
 .form_general input#rep_num_weeks {width: 2.0em}

Modified: 
mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php     
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php     
2010-09-01 14:42:32 UTC (rev 1433)
@@ -451,7 +451,7 @@
 // to admins when bookings are still awaiting approval.
 $reminders_enabled = TRUE;
 
-// SETTINGS FOR APPROVING SETTINGS - GLOBAL
+// SETTINGS FOR APPROVING BOOKINGS - GLOBAL
 
 // These settings are system-wide and control the behaviour in all areas.
 
@@ -462,6 +462,18 @@
 // Days of the week that are working days (Sunday = 0, etc.)
 $working_days = array(1,2,3,4,5);  // Mon-Fri
 
+// SETTINGS FOR BOOKING CONFIRMATION
+
+// Allows bookings to be marked as "tentative", ie not yet 100% certain,
+// and confirmed later.   Useful if you want to reserve a slot but at the same
+// time let other people know that there's a possibility it may not be needed.
+$confirmation_enabled = TRUE;
+
+// The default confirmation status for new bookings.  (TRUE: confirmed, FALSE: 
tentative)
+// Only used if $confirmation_enabled is TRUE.   If $confirmation_enabled is 
+// FALSE, then all new bookings are confirmed automatically.
+$confirmed_default = TRUE;
+
 /***********************************************
  * Authentication settings - read AUTHENTICATION
  ***********************************************/

Modified: mrbs/branches/provisional_bookings_new_style/web/view_entry.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/view_entry.php     
2010-09-01 13:36:10 UTC (rev 1432)
+++ mrbs/branches/provisional_bookings_new_style/web/view_entry.php     
2010-09-01 14:42:32 UTC (rev 1433)
@@ -438,10 +438,17 @@
     ?>
   </tr>
   <?php
+  if ($confirmation_enabled)
+  {
+    echo "<tr>\n";
+    echo "<td>" . get_vocab("confirmation_status") . ":</td>\n";
+    echo "<td>" . (($status & STATUS_TENTATIVE) ? 
get_vocab("tentative_booking") : get_vocab("confirmed_booking")) . "</td>\n";
+    echo "</tr>\n";
+  }
   if ($approval_enabled)
   {
     echo "<tr>\n";
-    echo "<td>" . get_vocab("status") . ":</td>\n";
+    echo "<td>" . get_vocab("approval_status") . ":</td>\n";
     echo "<td>" . (($status & STATUS_AWAITING_APPROVAL) ? 
get_vocab("awaiting_approval") : get_vocab("approved")) . "</td>\n";
     echo "</tr>\n";
   }


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

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to