You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2017/01/14 14:16:03 UTC

incubator-ponymail git commit: indicate which months are outside the archive span for a list

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 2398a770f -> 6fdd71f2a


indicate which months are outside the archive span for a list

This fixes #340

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/6fdd71f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/6fdd71f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/6fdd71f2

Branch: refs/heads/master
Commit: 6fdd71f2aa9f9ded0f3f01b29c5ca47e66d36bac
Parents: 2398a77
Author: Sebb <se...@apache.org>
Authored: Sat Jan 14 14:15:50 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Sat Jan 14 14:15:50 2017 +0000

----------------------------------------------------------------------
 CHANGELOG.md                        |  1 +
 site/js/dev/ponymail_pagebuilder.js | 26 +++++++++++++++++++++-----
 site/js/ponymail.js                 | 26 +++++++++++++++++++++-----
 3 files changed, 43 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/6fdd71f2/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23465cf..327bb15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -121,6 +121,7 @@
 - code should delete scroll id after use (#336)
 - ll.py - Make --count work with --pretty; show private message counts
 - DRY: move leapYear and end of month calculations to utils
+- indicate which months are outside the archive span for a list (#340)
 
 ## CHANGES in 0.9b:
 

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/6fdd71f2/site/js/dev/ponymail_pagebuilder.js
----------------------------------------------------------------------
diff --git a/site/js/dev/ponymail_pagebuilder.js b/site/js/dev/ponymail_pagebuilder.js
index 3a7e347..b3fa9f8 100644
--- a/site/js/dev/ponymail_pagebuilder.js
+++ b/site/js/dev/ponymail_pagebuilder.js
@@ -32,7 +32,11 @@ function toggleCalendar(year) {
 
 
 // buildCalendar: build the calendar
-function buildCalendar(firstYear, lastYear) {
+function buildCalendar(json) {
+    var firstYear = json.firstYear
+    var lastYear  = json.lastYear
+    var firstMonth0 = json.firstMonth - 1 // 0-based
+    var lastMonth0 = json.lastMonth - 1 // 0-based
     
     // Build the main calendar (desktop version)
     var dp = document.getElementById('datepicker')
@@ -55,7 +59,13 @@ function buildCalendar(firstYear, lastYear) {
         var em = (new Date().getFullYear() == year) ? new Date().getMonth() : 11;
         for (var y = em; y >= 0; y--) {
             var url = "list.html?" + xlist + ":" + (year+"-"+(y+1))
-            cale += "<a href='" + url + "' onclick='return false;'><label id='calmonth_" + (year+"-"+(y+1)) + "' style='width: 80px; float: left;cursor: pointer;' class='label label-default label-hover' onclick='toggleEmail(" + year + ", " + (y + 1) + ");' >" + months[y] + "</label></a><br/>"
+            var pfx = ''
+            var sfx = ''
+            if ((year == firstYear && y < firstMonth0) || (year == lastYear && y > lastMonth0)) {
+                pfx = '<i>'
+                sfx = '</i>'
+            }
+            cale += "<a href='" + url + "' onclick='return false;'><label id='calmonth_" + (year+"-"+(y+1)) + "' style='width: 80px; float: left;cursor: pointer;' class='label label-default label-hover' onclick='toggleEmail(" + year + ", " + (y + 1) + ");' >" + pfx + months[y] + sfx + "</label></a><br/>"
         }
         cale += "</div>"
         dp.innerHTML += cale
@@ -77,7 +87,13 @@ function buildCalendar(firstYear, lastYear) {
             var em = (new Date().getFullYear() == year) ? new Date().getMonth() : 11;
             for (var y = em; y >= 0; y--) {
                 var m = document.createElement('OPTION');
-                m.textContent = months[y] + ", " + year
+            var pfx = ''
+            var sfx = ''
+            if ((year == firstYear && y < firstMonth0) || (year == lastYear && y > lastMonth0)) {
+                pfx = '('
+                sfx = ')'
+            }
+                m.textContent = pfx + months[y] + ", " + year + sfx
                 m.value = year + '-' + (y+1)
                 ye.appendChild(m)
             }
@@ -113,10 +129,10 @@ function checkCalendar(json) {
     if (json.list && !list_year[json.list]) {
         xlist = (json.list && json.list.search(/\*/) == -1) ? json.list : xlist
         list_year[json.list] = json.firstYear
-        buildCalendar(json.firstYear, json.lastYear)
+        buildCalendar(json)
     }
     if (xlist != json.list || current_cal_min != json.firstYear) {
-        buildCalendar(json.firstYear, json.lastYear)
+        buildCalendar(json)
         xlist = (json.list && json.list.search(/\*/) == -1) ? json.list : xlist
         current_cal_min = json.firstYear
     }

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/6fdd71f2/site/js/ponymail.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail.js b/site/js/ponymail.js
index aae2ac5..9bd26e7 100644
--- a/site/js/ponymail.js
+++ b/site/js/ponymail.js
@@ -3649,7 +3649,11 @@ function toggleCalendar(year) {
 
 
 // buildCalendar: build the calendar
-function buildCalendar(firstYear, lastYear) {
+function buildCalendar(json) {
+    var firstYear = json.firstYear
+    var lastYear  = json.lastYear
+    var firstMonth0 = json.firstMonth - 1 // 0-based
+    var lastMonth0 = json.lastMonth - 1 // 0-based
     
     // Build the main calendar (desktop version)
     var dp = document.getElementById('datepicker')
@@ -3672,7 +3676,13 @@ function buildCalendar(firstYear, lastYear) {
         var em = (new Date().getFullYear() == year) ? new Date().getMonth() : 11;
         for (var y = em; y >= 0; y--) {
             var url = "list.html?" + xlist + ":" + (year+"-"+(y+1))
-            cale += "<a href='" + url + "' onclick='return false;'><label id='calmonth_" + (year+"-"+(y+1)) + "' style='width: 80px; float: left;cursor: pointer;' class='label label-default label-hover' onclick='toggleEmail(" + year + ", " + (y + 1) + ");' >" + months[y] + "</label></a><br/>"
+            var pfx = ''
+            var sfx = ''
+            if ((year == firstYear && y < firstMonth0) || (year == lastYear && y > lastMonth0)) {
+                pfx = '<i>'
+                sfx = '</i>'
+            }
+            cale += "<a href='" + url + "' onclick='return false;'><label id='calmonth_" + (year+"-"+(y+1)) + "' style='width: 80px; float: left;cursor: pointer;' class='label label-default label-hover' onclick='toggleEmail(" + year + ", " + (y + 1) + ");' >" + pfx + months[y] + sfx + "</label></a><br/>"
         }
         cale += "</div>"
         dp.innerHTML += cale
@@ -3694,7 +3704,13 @@ function buildCalendar(firstYear, lastYear) {
             var em = (new Date().getFullYear() == year) ? new Date().getMonth() : 11;
             for (var y = em; y >= 0; y--) {
                 var m = document.createElement('OPTION');
-                m.textContent = months[y] + ", " + year
+            var pfx = ''
+            var sfx = ''
+            if ((year == firstYear && y < firstMonth0) || (year == lastYear && y > lastMonth0)) {
+                pfx = '('
+                sfx = ')'
+            }
+                m.textContent = pfx + months[y] + ", " + year + sfx
                 m.value = year + '-' + (y+1)
                 ye.appendChild(m)
             }
@@ -3730,10 +3746,10 @@ function checkCalendar(json) {
     if (json.list && !list_year[json.list]) {
         xlist = (json.list && json.list.search(/\*/) == -1) ? json.list : xlist
         list_year[json.list] = json.firstYear
-        buildCalendar(json.firstYear, json.lastYear)
+        buildCalendar(json)
     }
     if (xlist != json.list || current_cal_min != json.firstYear) {
-        buildCalendar(json.firstYear, json.lastYear)
+        buildCalendar(json)
         xlist = (json.list && json.list.search(/\*/) == -1) ? json.list : xlist
         current_cal_min = json.firstYear
     }