Revision: 2487
          https://sourceforge.net/p/mrbs/code/2487/
Author:   cimorrison
Date:     2012-10-11 08:52:21 +0000 (Thu, 11 Oct 2012)
Log Message:
-----------
Added some JavaScript so that only the repeat form details appropriate to the 
selected repeat type are shown

Modified Paths:
--------------
    mrbs/branches/improved_repeat_interface/web/css/mrbs.css.php
    mrbs/branches/improved_repeat_interface/web/edit_entry.php
    mrbs/branches/improved_repeat_interface/web/functions.inc
    mrbs/branches/improved_repeat_interface/web/js/edit_entry.js.php
    mrbs/branches/improved_repeat_interface/web/systemdefaults.inc.php

Modified: mrbs/branches/improved_repeat_interface/web/css/mrbs.css.php
===================================================================
--- mrbs/branches/improved_repeat_interface/web/css/mrbs.css.php        
2012-10-10 15:46:12 UTC (rev 2486)
+++ mrbs/branches/improved_repeat_interface/web/css/mrbs.css.php        
2012-10-11 08:52:21 UTC (rev 2487)
@@ -552,7 +552,11 @@
     text-align: right; padding-bottom: 0.8em; font-weight: bold;
 }
 
-.edit_entry     .form_general label {max-width: <?php echo 
$edit_entry_left_col_max_width ?>em}
+.edit_entry     .form_general label {
+    width: <?php echo $edit_entry_left_col_max_width ?>em;
+    max-width: <?php echo $edit_entry_left_col_max_width ?>em;
+}
+
 .import         .form_general label {max-width: <?php echo 
$import_left_col_max_width ?>em}
 .report         .form_general label {max-width: <?php echo 
$report_left_col_max_width ?>em}
 .search         .form_general label {max-width: <?php echo 
$search_left_col_max_width ?>em}
@@ -561,6 +565,15 @@
 #db_logon                 label {max-width: <?php echo 
$db_logon_left_col_max_width ?>em}
 
 .form_general .group      label {clear: none; width: auto; max-width: 100%; 
font-weight: normal; overflow: visible; text-align: left}
+.form_general #rep_type .group label {clear: left}
+div#rep_type {
+    width: auto;
+    border-right: 1px solid <?php echo $site_faq_entry_border_color ?>;
+    margin-right: 1em;
+    padding-right: 1em;
+}
+fieldset.rep_type_details {clear: none; padding-top: 0}
+.rep_type_details label {text-align: left}
 
 .form_general input {
     display: block; float: left; margin-left: <?php echo $general_gap ?>em; 

Modified: mrbs/branches/improved_repeat_interface/web/edit_entry.php
===================================================================
--- mrbs/branches/improved_repeat_interface/web/edit_entry.php  2012-10-10 
15:46:12 UTC (rev 2486)
+++ mrbs/branches/improved_repeat_interface/web/edit_entry.php  2012-10-11 
08:52:21 UTC (rev 2487)
@@ -1289,6 +1289,8 @@
     // fields are disabled and the repeat type is not a weekly repeat
     if (!$disabled || ($rep_type == REP_WEEKLY))
     {
+      echo "<fieldset class= \"rep_type_details js_none\" 
id=\"rep_weekly\">\n";
+      echo "<legend></legend>\n";
       // Repeat day
       echo "<div id=\"rep_day\">\n";
       $params = array('label'    => get_vocab("rep_rep_day") . ":",
@@ -1302,7 +1304,7 @@
         $wday = ($i + $weekstarts) % 7;
         // We need to ensure the index is a string to force the array to be 
associative
         $v = STRING_PREFIX . $wday;
-        $params['options'][$v] = day_name($wday);
+        $params['options'][$v] = day_name($wday, 
$strftime_format['dayname_edit']);
       }
       generate_checkbox_group($params);
       echo "</div>\n";
@@ -1318,6 +1320,7 @@
       generate_input($params);
     
       echo "</div>\n";
+      echo "</fieldset>\n";
     }
     
     // Repeat end date

Modified: mrbs/branches/improved_repeat_interface/web/functions.inc
===================================================================
--- mrbs/branches/improved_repeat_interface/web/functions.inc   2012-10-10 
15:46:12 UTC (rev 2486)
+++ mrbs/branches/improved_repeat_interface/web/functions.inc   2012-10-11 
08:52:21 UTC (rev 2487)
@@ -1260,12 +1260,16 @@
 }
 
 // Get the local day name based on language. Note 2000-01-02 is a Sunday.
-function day_name($daynumber)
+function day_name($daynumber, $format=NULL)
 {
   global $strftime_format;
   
-  return utf8_strftime($strftime_format['dayname'],
-                       mktime(0,0,0,1,2+$daynumber,2000));
+  if (!isset($format))
+  {
+    $format = $strftime_format['dayname'];
+  }
+  
+  return utf8_strftime($format, mktime(0,0,0,1,2+$daynumber,2000));
 }
 
 // Returns a list of repeat days as a string (eg "Thursday Friday")

Modified: mrbs/branches/improved_repeat_interface/web/js/edit_entry.js.php
===================================================================
--- mrbs/branches/improved_repeat_interface/web/js/edit_entry.js.php    
2012-10-10 15:46:12 UTC (rev 2486)
+++ mrbs/branches/improved_repeat_interface/web/js/edit_entry.js.php    
2012-10-11 08:52:21 UTC (rev 2487)
@@ -16,6 +16,24 @@
 $is_admin = (authGetUserLevel($user) >= $max_level);
 
 
+// Function to display the secondary repeat type fieldset appropriate
+// to the selected repeat type
+?>
+var changeRepTypeDetails = function changeRepTypeDetails()
+{
+  var repType = parseInt($('input[name="rep_type"]:checked').val(), 10);
+  $('.rep_type_details').hide();
+  switch (repType)
+  {
+    case <?php echo REP_WEEKLY ?>:
+      $('#rep_weekly').show();
+      break;
+    default:
+      break;
+  }
+}
+
+<?php
 // Check to see whether any time slots should be removed from the time
 // select on the grounds that they don't exist due to a transition into DST.
 // Don't do this if we're using periods, because it doesn't apply then
@@ -1255,4 +1273,6 @@
       checkTimeSlots($(this), areas[currentArea]);
     });
     
+  $('input[name="rep_type"]').change(changeRepTypeDetails);
+  changeRepTypeDetails();
 };

Modified: mrbs/branches/improved_repeat_interface/web/systemdefaults.inc.php
===================================================================
--- mrbs/branches/improved_repeat_interface/web/systemdefaults.inc.php  
2012-10-10 15:46:12 UTC (rev 2486)
+++ mrbs/branches/improved_repeat_interface/web/systemdefaults.inc.php  
2012-10-11 08:52:21 UTC (rev 2487)
@@ -306,7 +306,8 @@
 // Formats used for dates and times.   For formatting options
 // see http://php.net/manual/function.strftime.php
 $strftime_format['date']         = "%A %d %B %Y";  // Used in Day view
-$strftime_format['dayname']      = "%A";           // Used in Month view and 
edit_entry form
+$strftime_format['dayname']      = "%A";           // Used in Month view
+$strftime_format['dayname_edit'] = "%a";           // Used in edit_entry form
 $strftime_format['dayname_cal']  = "%a";           // Used in mini calendars
 $strftime_format['month_cal']    = "%B";           // Used in mini calendars
 $strftime_format['mon']          = "%b";           // Used in date selectors
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to