Revision: 1488
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1488&view=rev
Author:   cimorrison
Date:     2010-10-06 15:20:47 +0000 (Wed, 06 Oct 2010)

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

Modified Paths:
--------------
    mrbs/branches/provisional_bookings_new_style/web/edit_entry.php
    mrbs/branches/provisional_bookings_new_style/web/functions.inc
    mrbs/branches/provisional_bookings_new_style/web/month.php
    mrbs/branches/provisional_bookings_new_style/web/mrbs_sql.inc
    mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php
    mrbs/branches/provisional_bookings_new_style/web/view_entry.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-1485
   + /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-1487

Modified: mrbs/branches/provisional_bookings_new_style/web/edit_entry.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/edit_entry.php     
2010-10-06 14:59:45 UTC (rev 1487)
+++ mrbs/branches/provisional_bookings_new_style/web/edit_entry.php     
2010-10-06 15:20:47 UTC (rev 1488)
@@ -129,6 +129,21 @@
   $area = get_area($row['room_id']);
   get_area_settings($area);
   
+  $private = $row['status'] & STATUS_PRIVATE;
+  if ($private_mandatory) 
+  {
+    $private = $private_default;
+  }
+  // Need to clear some data if entry is private and user
+  // does not have permission to edit/view details
+  if (isset($copy) && ($create_by != $row['create_by'])) 
+  {
+    // Entry being copied by different user
+    // If they don't have rights to view details, clear them
+    $privatewriteable = getWritable($row['create_by'], $user, $row['room_id']);
+    $keep_private = (is_private_event($private) && !$privatewriteable);
+  }
+  
   foreach ($row as $column => $value)
   {
     switch ($column)
@@ -147,11 +162,12 @@
       case 'type':
       case 'room_id':
       case 'entry_type':
-        $$column = $row[$column];
+        $$column = ($keep_private && $is_private_field["entry.$column"]) ? '' 
: $row[$column];
         break;
         
       case 'status':
-        $private = $row['status'] & STATUS_PRIVATE;
+        // No need to do the privacy status as we've already done that.
+        // Just do the confirmation status
         $confirmed = !($row['status'] & STATUS_TENTATIVE);
         break;
       
@@ -178,28 +194,11 @@
         break;
         
       default:
-        $custom_fields[$column] = $row[$column];
+        $custom_fields[$column] = ($keep_private && 
$is_private_field["entry.$column"]) ? '' : $row[$column];
         break;
     }
   }
   
-  if ($private_mandatory) 
-  {
-    $private = $private_default;
-  }
-  // Need to clear some data if entry is private and user
-  // does not have permission to edit/view details
-  if (isset($copy) && ($create_by != $row['create_by'])) 
-  {
-    // Entry being copied by different user
-    // If they don't have rights to view details, clear them
-    $privatewriteable = getWritable($row['create_by'], $user, $room_id);
-    if (is_private_event($private) && !$privatewriteable) 
-    {
-        $name = '';
-        $description = '' ;
-    }
-  }
 
   if($entry_type >= 1)
   {

Modified: mrbs/branches/provisional_bookings_new_style/web/functions.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/functions.inc      
2010-10-06 14:59:45 UTC (rev 1487)
+++ mrbs/branches/provisional_bookings_new_style/web/functions.inc      
2010-10-06 15:20:47 UTC (rev 1488)
@@ -1156,14 +1156,21 @@
   // start or end at a recognized time still appear.
   
   global $resolution;
+  global $is_private_field;
   
   $user = getUserName();
   if (is_private_event($row['status'] & STATUS_PRIVATE) &&
          !getWritable($row['entry_create_by'], $user, $row['room_id']))
   {
     $row['status'] |= STATUS_PRIVATE;   // Set the private bit
-    $row['name']= "[".get_vocab('unavailable')."]";
-    $row['entry_description']= "[".get_vocab('unavailable')."]";
+    if ($is_private_field['entry.name'])
+    {
+      $row['name']= "[".get_vocab('unavailable')."]";
+    }
+    if ($is_private_field['entry.description'])
+    {
+      $row['entry_description']= "[".get_vocab('unavailable')."]";
+    }
   }
   else
   {

Modified: mrbs/branches/provisional_bookings_new_style/web/month.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/month.php  2010-10-06 
14:59:45 UTC (rev 1487)
+++ mrbs/branches/provisional_bookings_new_style/web/month.php  2010-10-06 
15:20:47 UTC (rev 1488)
@@ -307,7 +307,7 @@
         $private = FALSE;
       }
 
-      if ($private) 
+      if ($private & $is_private_field['entry.name']) 
       {
         $d[$day_num]["status"][] = $row['status'] | STATUS_PRIVATE;  // Set 
the private bit
         $d[$day_num]["shortdescrip"][] = '['.get_vocab('unavailable').']';

Modified: mrbs/branches/provisional_bookings_new_style/web/mrbs_sql.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/mrbs_sql.inc       
2010-10-06 14:59:45 UTC (rev 1487)
+++ mrbs/branches/provisional_bookings_new_style/web/mrbs_sql.inc       
2010-10-06 15:20:47 UTC (rev 1488)
@@ -71,8 +71,8 @@
       $startstr = utf8_strftime('%A %d %B %Y %H:%M:%S',
                                 $row['start_time']);
     }
-    
-    if (is_private_event($row['status'] & STATUS_PRIVATE) &&
+
+    if (is_private_event($row['status'] & STATUS_PRIVATE) && 
$is_private_field['entry.name'] &&
          !getWritable($row['create_by'], $user, $room_id))
     {
        $row['name'] = get_vocab("private");

Modified: 
mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php     
2010-10-06 14:59:45 UTC (rev 1487)
+++ mrbs/branches/provisional_bookings_new_style/web/systemdefaults.inc.php     
2010-10-06 15:20:47 UTC (rev 1488)
@@ -444,7 +444,17 @@
            // Overrides $private_default and $private_mandatory
            // Consider your users' expectations of privacy before
            // changing to "public" or from "private" to "none"
-    
+
+// Choose which fields should be private by setting 
+// $is_private_field['tablename.columnname'] = TRUE
+// At the moment only fields in the entry table can be marked as private,
+// including custom fields, but with the exception of the following fields:
+// start_time, end_time, entry_type, repeat_id, room_id, timestamp, type, 
status,
+// reminded, info_time, info_user, info_text.
+$is_private_field['entry.name'] = TRUE;
+$is_private_field['entry.description'] = TRUE;
+$is_private_field['entry.create_by'] = TRUE;
+
                   
 // SETTINGS FOR APPROVING BOOKINGS - PER-AREA
 


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-1485
   + /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-1487

Modified: mrbs/branches/provisional_bookings_new_style/web/view_entry.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/view_entry.php     
2010-10-06 14:59:45 UTC (rev 1487)
+++ mrbs/branches/provisional_bookings_new_style/web/view_entry.php     
2010-10-06 15:20:47 UTC (rev 1488)
@@ -159,6 +159,17 @@
 
 $row = mrbsGetBookingInfo($id, $series);
 
+// Get the area settings for the entry's area.   In particular we want
+// to know how to display private/public bookings in this area.
+get_area_settings($row['area_id']);
+
+// Work out whether this event should be kept private
+$private = $row['status'] & STATUS_PRIVATE;
+$writeable = getWritable($row['create_by'], $user, $row['room_id']);
+$keep_private = (is_private_event($private) && !$writeable);
+$private_text = "[" . get_vocab("private") . "]";
+
+
 $custom_fields = array();
 foreach ($row as $column => $value)
 {
@@ -190,7 +201,7 @@
     case 'repeat_info_time':
     case 'repeat_info_user':
     case 'repeat_info_text':
-      $$column = $row[$column];
+      $$column = ($keep_private && $is_private_field["entry.$column"]) ? 
$private_text : $row[$column];
       break;
       
     case 'status':
@@ -203,7 +214,7 @@
       break;
 
     default:
-      $custom_fields[$column] = $row[$column];
+      $custom_fields[$column] = ($keep_private && 
$is_private_field["entry.$column"]) ? $private_text : $row[$column];
       break;
   }
 }
@@ -215,25 +226,9 @@
 // so that user see what he expects to see
 $duration      = $row['duration'] - cross_dst($row['start_time'],
                                               $row['end_time']);
-$writeable     = getWritable($row['create_by'], $user, $room_id);
 
 
-// Get the area settings for the entry's area.   In particular we want
-// to know how to display private/public bookings in this area.
-get_area_settings($row['area_id']);
 
-if (is_private_event($private) && !$writeable) 
-{
-  $name = "[".get_vocab('private')."]";
-  $description = $name;
-  $create_by = $name;
-  $keep_private = TRUE;
-}
-else
-{
-  $keep_private = FALSE;
-}
-
 if ($enable_periods)
 {
   list($start_period, $start_date) =  period_date_string($row['start_time']);
@@ -335,11 +330,11 @@
 // Now that we know all the data we start drawing it
 
 
-echo "<h3" . (($keep_private) ? " class=\"private\"" : "") . ">\n";
+echo "<h3" . (($keep_private && $is_private_field['entry.name']) ? " 
class=\"private\"" : "") . ">\n";
 echo htmlspecialchars($name);
 if (is_private_event($private) && $writeable) 
 {
-  echo ' ('.get_vocab('private').')';
+  echo ' ('.get_vocab("private").')';
 }
 echo "</h3>\n";
 
@@ -434,7 +429,7 @@
   <tr>
     <td><?php echo get_vocab("description") ?>:</td>
     <?php
-    echo "<td" . (($keep_private) ? " class=\"private\"" : "") . ">" . 
mrbs_nl2br(htmlspecialchars($description)) . "</td>\n";
+    echo "<td" . (($keep_private & $is_private_field['entry.description']) ? " 
class=\"private\"" : "") . ">" . mrbs_nl2br(htmlspecialchars($description)) . 
"</td>\n";
     ?>
   </tr>
   <?php
@@ -476,7 +471,7 @@
   <tr>
     <td><?php echo get_vocab("createdby") ?>:</td>
     <?php
-    echo "<td" . (($keep_private) ? " class=\"private\"" : "") . ">" . 
htmlspecialchars($create_by) . "</td>\n";
+    echo "<td" . (($keep_private && $is_private_field['entry.create_by']) ? " 
class=\"private\"" : "") . ">" . htmlspecialchars($create_by) . "</td>\n";
     ?>
   </tr>
   <tr>
@@ -498,14 +493,21 @@
       if (($field['nature'] == 'boolean') || 
           (($field['nature'] == 'integer') && isset($field['length']) && 
($field['length'] <= 2)) )
       {
-        $shown_value = empty($custom_fields[$key]) ? get_vocab("no") : 
get_vocab("yes");
+        if ($keep_private && $is_private_field["entry.$key"])
+        {
+          $shown_value = $custom_fields[$key];  // Will have been set 
previously
+        }
+        else
+        {
+          $shown_value = empty($custom_fields[$key]) ? get_vocab("no") : 
get_vocab("yes");
+        }
       }
       // Otherwise output a string
       else
       {
         $shown_value = (isset($custom_fields[$key])) ? 
mrbs_nl2br(htmlspecialchars($custom_fields[$key])): "&nbsp;"; 
       }
-      echo "<td>$shown_value</td>\n";
+      echo "<td" . (($keep_private && $is_private_field["entry.$key"]) ? " 
class=\"private\"" : "") . ">$shown_value</td>\n";
       echo "</tr>\n";
     }
   }


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

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to