Revision: 2502
          https://sourceforge.net/p/mrbs/code/2502/
Author:   cimorrison
Date:     2012-10-15 16:21:29 +0000 (Mon, 15 Oct 2012)
Log Message:
-----------
Made iCalendar mail notifications work with new monthly repeats

Modified Paths:
--------------
    mrbs/branches/improved_repeat_interface/web/functions_ical.inc
    mrbs/branches/improved_repeat_interface/web/internalconfig.inc.php
    mrbs/branches/improved_repeat_interface/web/lang/lang.de
    mrbs/branches/improved_repeat_interface/web/lang/lang.en
    mrbs/branches/improved_repeat_interface/web/lang/lang.ja

Modified: mrbs/branches/improved_repeat_interface/web/functions_ical.inc
===================================================================
--- mrbs/branches/improved_repeat_interface/web/functions_ical.inc      
2012-10-15 15:40:33 UTC (rev 2501)
+++ mrbs/branches/improved_repeat_interface/web/functions_ical.inc      
2012-10-15 16:21:29 UTC (rev 2502)
@@ -421,14 +421,13 @@
       $result['rep_opt'] = get_rep_opt($byday_days);
       break;
     case 'MONTHLY':
+      $result['rep_type'] = REP_MONTHLY;
       if (!isset($rules['BYDAY']))
       {
-        $result['rep_type'] = REP_MONTHLY;
         $result['month_absolute'] = $rules['BYMONTHDAY'];
       }
       else
       {
-        $result['rep_type'] = REP_MONTHLY_SAMEDAY;
         $byday_days = explode(',', $rules['BYDAY']);
         if (count($byday_days) > 1)
         {
@@ -447,19 +446,13 @@
             $result['rep_type'] = REP_WEEKLY;
             $result['rep_opt'] = get_rep_opt(array($day));
           }
+          elseif (($nth == '5') || ($nth == '-5'))
+          {
+            $errors[] = get_vocab("BYDAY_equals_5") . " $nth$day";
+          }
           else
           {
-            if ((int) $nth < 0)
-            {
-              $errors[] = get_vocab("negative_BYDAY") . " $nth$day";
-            }
-            elseif ($nth == '5')
-            {
-              $errors[] = get_vocab("BYDAY_equals_5") . " $nth$day";
-            }
-            // otherwise we're OK and we don't need to do anything more 
because we know
-            // we've only got one day and the REP_MONTHLY_SAMEDAY repeat type 
will work
-            // out the day from the start date
+            $result['relative'] = $byday_day;
           }
         }
       }
@@ -744,9 +737,11 @@
     case REP_NONE:
       return $rule;
       break;
+      
     case REP_DAILY:
       $rule .= "FREQ=DAILY";
       break;
+      
     case REP_WEEKLY:
       $rule .= "FREQ=WEEKLY";
       // Interval for WEEKLY (Interval defaults to 1)
@@ -769,26 +764,23 @@
         $rule .= ";BYDAY=$dow_list";
       }
       break;
-    case REP_MONTHLY_SAMEDAY:
+      
+    case REP_MONTHLY:
       $rule .= "FREQ=MONTHLY";
-      $dow = date('w', $data['start_time']);  // day of the week
-      $dom = date('j', $data['start_time']);  // day of the month
-      // Work out the week of the month.    If this is the fifth week of the 
month
-      // then make it -1 (last week of the month in RFC 5545 terms)
-      $wom = intval($dom/7) + 1;
-      if ($wom > 4)
+      if (isset($data['month_absolute']))
       {
-        $wom = -1;
+        $rule .= ";BYMONTHDAY=" . $data['month_absolute'];
       }
-      $wom = sprintf('%+d', $wom);
-      $rule .= ";BYDAY=";
-      $rule .= $wom;
-      $rule .= $RFC_5545_days[$dow];
+      elseif (isset($data['month_relative']))
+      {
+        $rule .= ";BYDAY=" . $data['month_relative'];
+      }
+      else
+      {
+        trigger_error("Unknown monthly repeat type, E_USER_NOTICE");
+      }
       break;
-    case REP_MONTHLY:
-      $rule .= "FREQ=MONTHLY";
-      $rule .= ";BYMONTHDAY=" . $data['month_absolute'];
-      break;
+      
     case REP_YEARLY:
       $rule .= "FREQ=YEARLY";
       break;

Modified: mrbs/branches/improved_repeat_interface/web/internalconfig.inc.php
===================================================================
--- mrbs/branches/improved_repeat_interface/web/internalconfig.inc.php  
2012-10-15 15:40:33 UTC (rev 2501)
+++ mrbs/branches/improved_repeat_interface/web/internalconfig.inc.php  
2012-10-15 16:21:29 UTC (rev 2502)
@@ -184,7 +184,6 @@
 define('REP_WEEKLY',          2);
 define('REP_MONTHLY',         3);
 define('REP_YEARLY',          4);
-define('REP_MONTHLY_SAMEDAY', 5);
 
 define('REP_MONTH_ABSOLUTE', 0);
 define('REP_MONTH_RELATIVE', 1);

Modified: mrbs/branches/improved_repeat_interface/web/lang/lang.de
===================================================================
--- mrbs/branches/improved_repeat_interface/web/lang/lang.de    2012-10-15 
15:40:33 UTC (rev 2501)
+++ mrbs/branches/improved_repeat_interface/web/lang/lang.de    2012-10-15 
16:21:29 UTC (rev 2502)
@@ -442,7 +442,6 @@
 $vocab["no_LOCATION"]               = "Das VEVENT behinhaltet keine LOCATION 
Eigenschaft";
 $vocab["invalid_RRULE"]             = "Fehlerhafte RRULE: FREQ Bereich fehlt";
 $vocab["more_than_one_BYDAY"]       = "MRBS unterstützt keine mehrfachen BYDAY 
Werte, wenn FREQ=";
-$vocab["negative_BYDAY"]            = "MRBS unterstützt keine negativen BYDAY 
Werte";
 $vocab["BYDAY_equals_5"]            = "MRBS unterstützt keinen BYDAY Wert von 
5";
 $vocab["unsupported_FREQ"]          = "MRBS unterstützt kein FREQ=";
 $vocab["unsupported_INTERVAL"]      = "MRBS unterstützt kein INTERVAL>1 wenn 
FREQ=";

Modified: mrbs/branches/improved_repeat_interface/web/lang/lang.en
===================================================================
--- mrbs/branches/improved_repeat_interface/web/lang/lang.en    2012-10-15 
15:40:33 UTC (rev 2501)
+++ mrbs/branches/improved_repeat_interface/web/lang/lang.en    2012-10-15 
16:21:29 UTC (rev 2502)
@@ -478,7 +478,6 @@
 $vocab["no_LOCATION"]                 = "The VEVENT did not include a LOCATION 
property";
 $vocab["invalid_RRULE"]               = "Invalid RRULE: missing FREQ part";
 $vocab["more_than_one_BYDAY"]         = "MRBS does not support more than one 
BYDAY value when FREQ=";
-$vocab["negative_BYDAY"]              = "MRBS does not support negative BYDAY 
values";
 $vocab["BYDAY_equals_5"]              = "MRBS does not support a BYDAY value 
of 5";
 $vocab["unsupported_FREQ"]            = "MRBS does not support FREQ=";
 $vocab["unsupported_INTERVAL"]        = "MRBS does not support INTERVAL>1 with 
FREQ=";

Modified: mrbs/branches/improved_repeat_interface/web/lang/lang.ja
===================================================================
--- mrbs/branches/improved_repeat_interface/web/lang/lang.ja    2012-10-15 
15:40:33 UTC (rev 2501)
+++ mrbs/branches/improved_repeat_interface/web/lang/lang.ja    2012-10-15 
16:21:29 UTC (rev 2502)
@@ -466,7 +466,6 @@
 $vocab["no_LOCATION"]                 = "VEVENTがLOCATION属性を含んでいませんでした";
 $vocab["invalid_RRULE"]               = "RRULEが不正: FREQパートが見当たりません";
 $vocab["more_than_one_BYDAY"]         = "MRBS does not support more than one 
BYDAY value when FREQ=";
-$vocab["negative_BYDAY"]              = "MRBSは負の値のBYDAYをサポートしていません";
 $vocab["BYDAY_equals_5"]              = "MRBS値が5のBYDAYをサポートしていません";
 $vocab["unsupported_FREQ"]            = "MRBS does not support FREQ=";
 $vocab["unsupported_INTERVAL"]        = "MRBS does not support INTERVAL>1 with 
FREQ=";
------------------------------------------------------------------------------
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