[Yanel-commits] rev 26383 - public/yanel/trunk/src/contributions/resources/timeline/src/java/edu/mit/simile/yanel/impl/resources/timeline

michi at wyona.com michi at wyona.com
Mon Jul 30 15:37:08 CEST 2007


Author: michi
Date: 2007-07-30 15:37:07 +0200 (Mon, 30 Jul 2007)
New Revision: 26383

Modified:
   public/yanel/trunk/src/contributions/resources/timeline/src/java/edu/mit/simile/yanel/impl/resources/timeline/TimelineResource.java
Log:
generate today's date dynamically and also add XML link

Modified: public/yanel/trunk/src/contributions/resources/timeline/src/java/edu/mit/simile/yanel/impl/resources/timeline/TimelineResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/timeline/src/java/edu/mit/simile/yanel/impl/resources/timeline/TimelineResource.java	2007-07-30 12:08:56 UTC (rev 26382)
+++ public/yanel/trunk/src/contributions/resources/timeline/src/java/edu/mit/simile/yanel/impl/resources/timeline/TimelineResource.java	2007-07-30 13:37:07 UTC (rev 26383)
@@ -82,6 +82,11 @@
      *
      */
     private StringBuffer getXHTML() throws Exception {
+        //java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMM dd yyyy hh:mm:ss z");
+        //String todaysDate = sdf.format(new java.util.Date());
+        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMM dd yyyy");
+        String todaysDate = sdf.format(new java.util.Date()) + " 00:00:00 GMT";
+
         StringBuffer sb = new StringBuffer();
         sb.append("<?xml version=\"1.0\"?>");
 
@@ -108,8 +113,7 @@
         sb.append("  var bandInfos = [");
         sb.append("    Timeline.createBandInfo({");
         sb.append("        eventSource:    eventSource,");
-        //sb.append("        date:           \"@TODAY@\",");
-        sb.append("        date:           \"Jul 27 2007 00:00:00 GMT\",");
+        sb.append("        date:           \"" + todaysDate + "\",");
         sb.append("        width:          \"70%\",");
         sb.append("        intervalUnit:   Timeline.DateTime.MONTH,");
         sb.append("        intervalPixels: 100");
@@ -120,8 +124,7 @@
         sb.append("        trackGap:       0.2,");
 
         sb.append("        eventSource:    eventSource,");
-        //sb.append("        date:           \"@TODAY@\",");
-        sb.append("        date:           \"Jul 27 2007 00:00:00 GMT\",");
+        sb.append("        date:           \"" + todaysDate + "\",");
         sb.append("        width:          \"30%\",");
         sb.append("        intervalUnit:   Timeline.DateTime.YEAR,"); 
         sb.append("        intervalPixels: 200");
@@ -134,10 +137,14 @@
         sb.append("  Timeline.loadXML(\"" + getResourceConfigProperty("href") + "\", function(xml, url) { eventSource.loadXML(xml, url); });");
         sb.append("}");
         sb.append("</script>");
+        sb.append("<title>" + getResourceConfigProperty("title") + "</title>");
         sb.append("</head>");
 
         sb.append("<body onload=\"onLoad();\" onresize=\"onResize();\">");
         sb.append("<h3>" + getResourceConfigProperty("title") + "</h3>");
+        sb.append("<p>Today's Date (server time): " + todaysDate + "</p>");
+        sb.append("<p>XML: <a href=\"" + getResourceConfigProperty("href") + "\">" + getResourceConfigProperty("href") + "</a></p>");
+
         sb.append("<div id=\"my-timeline\" style=\"height: 250px; border: 1px solid #aaa\"></div>");
         sb.append("</body>");
         sb.append("</html>");



More information about the Yanel-commits mailing list