Author: michiel
Date: 2010-06-08 18:19:55 +0200 (Tue, 08 Jun 2010)
New Revision: 42472

Modified:
   
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/axis.tagx
   
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/items.tagx
   
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/monthsOverview.tagx
Log:
several details

Modified: 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/axis.tagx
===================================================================
--- 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/axis.tagx
  2010-06-08 15:48:04 UTC (rev 42471)
+++ 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/axis.tagx
  2010-06-08 16:19:55 UTC (rev 42472)
@@ -23,6 +23,7 @@
   <jsp:directive.variable  name-given="monthname" />
   <jsp:directive.variable  name-given="formonthname" />
   <jsp:directive.variable  name-given="whichmonth" />
+  <jsp:directive.variable  name-given="timezoneoffset" />
 
   <jsp:scriptlet xmlns:jsp="http://java.sun.com/JSP/Page";>
 
@@ -50,6 +51,7 @@
           cal.set(Calendar.MONTH, month - 1);
           cal.set(Calendar.WEEK_OF_MONTH, index);
           cal.set(Calendar.DAY_OF_WEEK, dayofweek);
+          jspContext.setAttribute("timezoneoffset", 
cal.getTimeZone().getOffset(cal.getTime().getTime()));
       </jsp:scriptlet>
       <mm:context>
         <mm:import id="whichmonth"><jsp:expression>cal.get(Calendar.MONTH) == 
month - 1 ? "same" : "other"</jsp:expression></mm:import>
@@ -85,6 +87,7 @@
           cal.set(Calendar.MONTH, month - 1);
           cal.set(Calendar.WEEK_OF_MONTH, week);
           cal.set(Calendar.DAY_OF_WEEK, indexOffset + index);
+          jspContext.setAttribute("timezoneoffset", 
cal.getTimeZone().getOffset(cal.getTime().getTime()));
       </jsp:scriptlet>
       <mm:context>
         <mm:import id="time"><jsp:expression>cal.getTime().getTime() / 
1000</jsp:expression></mm:import>

Modified: 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/items.tagx
===================================================================
--- 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/items.tagx
 2010-06-08 15:48:04 UTC (rev 42471)
+++ 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/items.tagx
 2010-06-08 16:19:55 UTC (rev 42472)
@@ -5,14 +5,22 @@
     version="2.0"
     >
   <jsp:directive.tag import="java.util.*"
-                     description="Lists all calendar_items between two dates"
+                     description="Lists in an ul all calendar_items belonging 
to a certain day. The day can be provided by mm-cal:monthsOverview"
                      />
-  <jsp:directive.attribute name="day"     type="java.util.Date" 
required="true" />
+  <jsp:directive.attribute name="day"     type="java.util.Date" 
required="true" description="This may typically be provided by 
mm-cal:monthsOverview" />
   <jsp:directive.attribute name="dayend"  type="java.util.Date" />
   <jsp:directive.attribute name="stop"  description="if true, then the entry 
will also be shown if the start time is on a previous day, but the stop time is 
on this day or later" />
   <jsp:directive.attribute name="newItem" fragment="true"  />
+  <jsp:directive.attribute name="empty" fragment="true"  />
 
+  <jsp:directive.attribute name="role" type="java.lang.String" description="If 
this is not empty, related nodes will be used, in stead of all nodes"  />
 
+  <jsp:directive.attribute name="mode" type="java.lang.String" 
description="Defaults to 'ul', can also be 'spans' or 'empty'"  />
+  <jsp:directive.attribute name="max" type="java.lang.Integer" 
description="max number of items listed"  />
+  <jsp:directive.attribute name="type"  type="org.mmbase.bridge.Node"
+                           description="Limit calendar item to certain types"  
/>
+
+
   <jsp:scriptlet>
     if (dayend == null) {
 
@@ -25,18 +33,52 @@
   </jsp:scriptlet>
   <mm:import id="dayend"><jsp:expression>dayend.getTime() / 
1000</jsp:expression></mm:import>
   <mm:cloud method="asis">
+    <c:choose>
+      <c:when test="${empty role}">
+        <mm:relatednodescontainer type="calendar_items" role="${role}" 
id="container" />
+      </c:when>
+      <c:otherwise>
+        <mm:listnodescontainer type="calendar_items" id="container" />
+      </c:otherwise>
+    </c:choose>
 
-    <mm:listnodescontainer type="calendar_items">
+    <mm:listnodescontainer referid="container">
       <mm:typeconstraint name="calendar_items" descendants="false" />
       <mm:sortorder field="start" />
       <mm:constraint field="${empty stop ? 'start' : 'stop'}" 
operator="GREATER" value="${day}" />
       <mm:constraint field="start" operator="LESS" value="${dayend}" />
+      <c:if test="${! empty max}">
+        <mm:maxnumber value="${max}" />
+      </c:if>
+      <mm:size>
+        <mm:compare value="0">
+          <jsp:invoke fragment="empty" />
+        </mm:compare>
+      </mm:size>
       <mm:listnodes>
-        <mm:first>&lt;ul&gt;</mm:first>
-        <li class="ct${_node.type}">
-          <jsp:doBody />
-        </li>
-        <mm:last>&lt;/ul&gt;</mm:last>
+        <c:choose>
+          <c:when test="${mode eq 'empty'}">
+          </c:when>
+          <c:when test="${mode eq 'spans'}">
+          </c:when>
+          <c:when test="${empty mode or mode eq 'ul'}">
+            <mm:first>&lt;ul&gt;</mm:first>
+            <jsp:text>&lt;li class="ct${_node.type}"&gt;</jsp:text>
+          </c:when>
+          <c:otherwise>UNKNOWN mode ${mode}</c:otherwise>
+        </c:choose>
+        <jsp:doBody />
+        <c:choose>
+          <c:when test="${mode eq 'empty'}">
+          </c:when>
+          <c:when test="${mode eq 'spans'}">
+            <jsp:text>&lt;/span&gt;</jsp:text>
+          </c:when>
+          <c:when test="${empty mode or mode eq 'ul'}">
+            <jsp:text>&lt;/li&gt;</jsp:text>
+            <mm:last>&lt;/ul&gt;</mm:last>
+          </c:when>
+        </c:choose>
       </mm:listnodes>
     </mm:listnodescontainer>
     <jsp:invoke fragment="newItem" />

Modified: 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/monthsOverview.tagx
===================================================================
--- 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/monthsOverview.tagx
        2010-06-08 15:48:04 UTC (rev 42471)
+++ 
mmbase/trunk/contributions/calendar/src/main/resources/META-INF/tags/mm/calendar/monthsOverview.tagx
        2010-06-08 16:19:55 UTC (rev 42472)
@@ -6,9 +6,9 @@
     version="2.0" >
   <!--
      This can be useful during development
-     xmlns:mm-cal="urn:jsptagdir:/WEB-INF/tags/mm/calendar"
 
 
+
   -->
   <jsp:directive.tag import="java.util.*" />
 
@@ -29,9 +29,11 @@
   <jsp:directive.attribute name="prev"    fragment="true"  />
   <jsp:directive.attribute name="next"    fragment="true"  />
 
-  <jsp:directive.variable  name-given="day" />
-  <jsp:directive.variable  name-given="dayend" />
-  <jsp:directive.variable  name-given="noon" />
+  <jsp:directive.variable  name-given="day"         description="The day of 
the body. As a java.util.Date object" />
+  <jsp:directive.variable  name-given="dayend"      description="The end of 
the day of the body. As a java.util.Date object" />
+  <jsp:directive.variable  name-given="noon"        description="Noon of the 
day of the body. As a java.util.Date object" />
+  <jsp:directive.variable  name-given="timezoneoffset"  description="The time 
zone offset on the day of the body. In milliseconds." />
+  <jsp:directive.variable  name-given="day_since_epoch" description="The day 
of the body, as day number since the start of the epoch." />
 
   <mm:import id="o" externid="offset">${empty offset ? '-1' : 
offset}</mm:import>
   <jsp:scriptlet>
@@ -163,7 +165,8 @@
                         </c:if>
                         <th class="weeknr year"><mm:time referid="day" 
format="w"/></th>
                       </jsp:attribute>
-                      <td class="${dayofweek} ${monthname} 
${whichmonth}_month">
+                      <mm:import id="day_since_epoch" vartype="integer" 
reset="true">${(day.time + timezoneoffset)/(1000*60*60*24)}</mm:import>
+                      <td class="${dayofweek} ${monthname} ${whichmonth}_month 
day_${day_since_epoch}">
                         <jsp:doBody />
                       </td>
                     </mm-cal:axis>

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to