Revision: 1502
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1502&view=rev
Author:   cimorrison
Date:     2010-10-15 09:57:31 +0000 (Fri, 15 Oct 2010)

Log Message:
-----------
Merged in latest changes from the trunk

Modified Paths:
--------------
    mrbs/branches/provisional_bookings_new_style/web/edit_area_room.php
    mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc
    mrbs/branches/provisional_bookings_new_style/web/lang.en
    mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php

Property Changed:
----------------
    mrbs/branches/provisional_bookings_new_style/
    mrbs/branches/provisional_bookings_new_style/web/upgrade/5/pgsql.sql


Property changes on: mrbs/branches/provisional_bookings_new_style
___________________________________________________________________
Modified: svn:mergeinfo
   - /mrbs/branches/custom_entry_fields:1374-1396
/mrbs/branches/datepicker:1409-1416
/mrbs/branches/improve_css_2008_06:804-872
/mrbs/branches/provisional_bookings:1242-1280
/mrbs/trunk:1407-1499
   + /mrbs/branches/custom_entry_fields:1374-1396
/mrbs/branches/datepicker:1409-1416
/mrbs/branches/improve_css_2008_06:804-872
/mrbs/branches/provisional_bookings:1242-1280
/mrbs/trunk:1407-1501

Modified: mrbs/branches/provisional_bookings_new_style/web/edit_area_room.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/edit_area_room.php 
2010-10-15 09:44:32 UTC (rev 1501)
+++ mrbs/branches/provisional_bookings_new_style/web/edit_area_room.php 
2010-10-15 09:57:31 UTC (rev 1502)
@@ -154,11 +154,17 @@
       exit();
     }
   }
+  
+  require_once "functions_mail.inc";
 
   // PHASE 2 (ROOM) - UPDATE THE DATABASE
   // ------------------------------------
   if (isset($change_room) && !empty($room))
   {
+    // clean up the address list replacing newlines by commas and removing 
duplicates
+    $room_admin_email = clean_address_list($room_admin_email);
+    // put a space after each comma so that the list displays better
+    $room_admin_email = str_replace(',', ', ', $room_admin_email);
     // validate the email addresses
     $valid_email = validate_email_list($room_admin_email);
   
@@ -269,6 +275,10 @@
 
   if (isset($change_area) && !empty($area))
   { 
+    // clean up the address list replacing newlines by commas and removing 
duplicates
+    $area_admin_email = clean_address_list($area_admin_email);
+    // put a space after each comma so that the list displays better
+    $area_admin_email = str_replace(',', ', ', $area_admin_email);
     // validate email addresses
     $valid_email = validate_email_list($area_admin_email);
   
@@ -506,15 +516,15 @@
               echo "<input type=\"text\" id=\"capacity\" name=\"capacity\" 
value=\"" . $row["capacity"] . "\"$disabled>\n";
               break;
             case 'room_admin_email':
-              echo "<label for=\"room_admin_email\">" . 
get_vocab("room_admin_email") . ":</label>\n";
-              echo "<input type=\"text\" id=\"room_admin_email\" 
name=\"room_admin_email\" maxlength=\"75\" value=\"" . 
htmlspecialchars($row["room_admin_email"]) . "\"$disabled>\n";
+              echo "<label for=\"room_admin_email\" title=\"" . 
get_vocab("email_list_note") . "\">" . get_vocab("room_admin_email") . 
":</label>\n";
+              echo "<textarea id=\"room_admin_email\" 
name=\"room_admin_email\" rows=\"4\" cols=\"40\"$disabled>" . 
htmlspecialchars($row["room_admin_email"]) . "</textarea>\n";
               break;
             case 'custom_html':
               if ($is_admin)
               {
                 // Only show the raw HTML to admins.  Non-admins will see the 
rendered HTML
                 echo "<label for=\"room_custom_html\" title=\"" . 
get_vocab("custom_html_note") . "\">" . get_vocab("custom_html") . 
":</label>\n";
-                echo "<textarea id=\"room_custom_html\" class=\"custom_html\" 
name=\"custom_html\" rows=\"4\" cols=\"40\"$disabled>\n";
+                echo "<textarea id=\"room_custom_html\" name=\"custom_html\" 
rows=\"4\" cols=\"40\"$disabled>\n";
                 echo htmlspecialchars($row['custom_html']);
                 echo "</textarea>\n";
               }
@@ -645,15 +655,17 @@
         </div>
     
         <div>
-        <label for="area_admin_email"><?php echo get_vocab("area_admin_email") 
?>:</label>
-        <input type="text" id="area_admin_email" name="area_admin_email" 
maxlength="75" value="<?php echo htmlspecialchars($row["area_admin_email"]); 
?>">
+        <?php
+        echo "<label for=\"area_admin_email\" title=\"" . 
get_vocab("email_list_note") . "\">" . get_vocab("area_admin_email") . 
":</label>\n";
+        ?>
+        <textarea id="area_admin_email" name="area_admin_email" rows="4" 
cols="40"><?php echo htmlspecialchars($row["area_admin_email"]); ?></textarea>
         </div>
       
         <?php
         // The custom HTML
         echo "<div>\n";
         echo "<label for=\"area_custom_html\" title=\"" . 
get_vocab("custom_html_note") . "\">" . get_vocab("custom_html") . 
":</label>\n";
-        echo "<textarea id=\"area_custom_html\" class=\"custom_html\" 
name=\"custom_html\" rows=\"4\" cols=\"40\">\n";
+        echo "<textarea id=\"area_custom_html\" name=\"custom_html\" 
rows=\"4\" cols=\"40\">\n";
         echo htmlspecialchars($row['custom_html']);
         echo "</textarea>\n";
         echo "</div>\n";

Modified: mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc 
2010-10-15 09:44:32 UTC (rev 1501)
+++ mrbs/branches/provisional_bookings_new_style/web/functions_mail.inc 
2010-10-15 09:57:31 UTC (rev 1502)
@@ -165,15 +165,33 @@
   // some of the elements of the original array may themselves have
   // been comma separated strings
   $array = explode(',', $string);
-  // remove any leading and trailing whitespace
-  array_walk($array, 'trim');
+  // remove any leading and trailing whitespace and any empty strings
+  $trimmed_array = array();
+  for ($i=0; $i < count($array); $i++)
+  {
+    $array[$i] = trim($array[$i]);
+    if ($array[$i] != '')
+    {
+      $trimmed_array[] = $array[$i];
+    }
+  }
   // remove duplicates
-  $array = array_unique($array);
+  $trimmed_array = array_unique($trimmed_array);
   // re-assemble the string
-  $string = implode(',', $array);
+  $string = implode(',', $trimmed_array);
   return $string;
 }
 
+// Take a string of email addresses separated by commas or newlines
+// and return a comma separated list with duplicates removed.
+function clean_address_list($string)
+{
+  $string = str_replace(array("\r\n", "\n", "\r"), ',', $string);
+  $array = explode(',', $string);
+  $string = get_address_list($array);
+  return $string;
+}
+
 // get the email address of a user
 // returns an empty string in the event of an error
 function get_email_address($user)

Modified: mrbs/branches/provisional_bookings_new_style/web/lang.en
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/lang.en    2010-10-15 
09:44:32 UTC (rev 1501)
+++ mrbs/branches/provisional_bookings_new_style/web/lang.en    2010-10-15 
09:57:31 UTC (rev 1502)
@@ -352,6 +352,7 @@
 $vocab["max_book_ahead"]          = "Advance booking - maximum";
 $vocab["custom_html"]             = "Custom HTML";
 $vocab["custom_html_note"]        = "This field can be used for displaying 
your own HTML, for example an embedded Google map";
+$vocab["email_list_note"]         = "Enter a list of email addresses separated 
by commas or newlines";
                      
 
 // Used in edit_users.php

Modified: mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php       
2010-10-15 09:44:32 UTC (rev 1501)
+++ mrbs/branches/provisional_bookings_new_style/web/mrbs.css.php       
2010-10-15 09:57:31 UTC (rev 1502)
@@ -458,7 +458,7 @@
 .edit_area_room .form_general fieldset fieldset {padding-top: 0.5em; 
padding-bottom: 0.5em}
 .edit_area_room .form_general fieldset fieldset legend {font-size: small; 
font-style: italic; font-weight: normal}
 span#private_display_caution {display: block; margin-top: 1em; font-style: 
italic; font-weight: normal}
-.edit_area_room textarea.custom_html {height: 6em; width: 25em}
+.edit_area_room .form_general textarea {height: 6em; width: 25em}
 .edit_area_room div#custom_html {margin-top: 8px}
 
 


Property changes on: 
mrbs/branches/provisional_bookings_new_style/web/upgrade/5/pgsql.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /mrbs/branches/custom_entry_fields/web/upgrade/5/pgsql.sql:1374-1396
/mrbs/branches/datepicker/web/upgrade/5/pgsql.sql:1409-1416
/mrbs/branches/provisional_bookings/web/upgrade/5/pgsql.sql:1242-1280
/mrbs/trunk/web/upgrade/5/pgsql.sql:1407-1499
   + /mrbs/branches/custom_entry_fields/web/upgrade/5/pgsql.sql:1374-1396
/mrbs/branches/datepicker/web/upgrade/5/pgsql.sql:1409-1416
/mrbs/branches/provisional_bookings/web/upgrade/5/pgsql.sql:1242-1280
/mrbs/trunk/web/upgrade/5/pgsql.sql:1407-1501


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

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to