community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r794034 - in /websites/production/community: ./ content/calendars/conferences.html
Date Mon, 08 Aug 2011 21:55:41 GMT
Author: nick
Date: Mon Aug  8 21:55:40 2011
New Revision: 794034

Log:
Add an events listing, to go with the existing calendar view

Modified:
    websites/production/community/   (props changed)
    websites/production/community/content/calendars/conferences.html

Propchange: websites/production/community/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug  8 21:55:40 2011
@@ -1,2 +1,2 @@
 /websites/staging/comdev/trunk:779592-779702
-/websites/staging/community/trunk:779703-791691
+/websites/staging/community/trunk:779703-794033

Modified: websites/production/community/content/calendars/conferences.html
==============================================================================
--- websites/production/community/content/calendars/conferences.html (original)
+++ websites/production/community/content/calendars/conferences.html Mon Aug  8 21:55:40 2011
@@ -103,10 +103,80 @@
                          <DIV class="wiki-content">
                           <p>This Calendar is maintained by the <a href="http://www.apache.org/foundation/conferences.html">Apache
Conferences Committee</a> (ConCom). It's used to list official Apache events, and 
 those events which have been approved to use Apache Marks under the <a href="http://www.apache.org/foundation/marks/events.html">Third
Party Event Branding Policy</a>.</p>
+<h2>Upcoming events</h2>
+
+<ul id="events">
+ <li><i>List loading</i></li>
+</ul>
+
 <iframe src="https://www.google.com/calendar/embed?src=nerseigospses068jd57bk5ar8%40group.calendar.google.com&ctz=America/New_York"
 style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
 
 <p>This Calendar is also available as an <a href="https://www.google.com/calendar/ical/nerseigospses068jd57bk5ar8%40group.calendar.google.com/public/basic.ics">iCal
feed</a></p>
+<script type="text/javascript">
+function handleContents(li, text) {
+   if(text == undefined || text.length == 0) {
+      return;
+   }
+   parts = text.split("\n");
+   for(var i=0; i<parts.length; i++) {
+      li.appendChild(document.createElement("br"));
+      li.appendChild(document.createTextNode(parts[i]));
+   }
+}
+
+var dateRegExp = new RegExp("^(\\d{4})-(\\d{2})-(\\d{2})$");
+function handleDates(li, when) {
+   var from = when['startTime'];
+   var to = when['endTime'];
+   if(from.match(dateRegExp) && to.match(dateRegExp)) {
+      var fp = from.split(dateRegExp);
+      var tp = to.split(dateRegExp);
+      var fromDate = new Date(fp[1],fp[2]-1,fp[3]);
+      var toDate = new Date(tp[1],tp[2]-1,tp[3]);
+      var realToDate = new Date(toDate.getTime() - 24*60*60*1000);
+
+var text;
+      if(fromDate.getTime() == realToDate.getTime()) {
+         // Single day
+         text = from;
+      } else {
+         // Really multi day
+         text = from + " to " + realToDate.getFullYear() + "-" + 
+                (realToDate.getMonth()+1) + "-"  + realToDate.getDate();
+      }
+      li.appendChild(document.createTextNode(" - " + text))
+   } else {
+      li.appendChild(document.createTextNode(" - " + from))
+   }
+}
+
+function render(data) {
+   var ev = document.getElementById("events");
+   if(ev.hasChildNodes()) {
+      while(ev.childNodes.length >= 1) {
+         ev.removeChild(ev.firstChild);       
+      } 
+   }
+
+var feed = data.feed;
+   for(var i=0; i<feed.entry.length; i++) {
+      var entry = feed.entry[i];
+      var title = entry.title.$t;
+      var text = entry.content.$t;
+      var when = entry['gd$when'][0];
+
+var li = document.createElement("li");
+      var li_b = document.createElement("b");
+      li_b.appendChild(document.createTextNode(title));
+      li.appendChild(li_b);
+      handleDates(li, when);
+      handleContents(li, text);
+      ev.appendChild(li);
+   }
+}
+</script>
+<script src="http://www.google.com/calendar/feeds/nerseigospses068jd57bk5ar8@group.calendar.google.com/public/full?alt=json-in-script&callback=render&orderby=starttime&max-results=30&singleevents=true&sortorder=ascending&futureevents=true"></script>
                          </DIV>
                      </DIV>
                   </DIV>



Mime
View raw message