Update of /var/cvs/contributions/didactor2/src/shoutbox/blocks
In directory james.mmbase.org:/tmp/cvs-serv15364/blocks

Modified Files:
        index.jspx menu.jspx 
Added Files:
        submenu.jspx 
Log Message:



See also: 
http://cvs.mmbase.org/viewcvs/contributions/didactor2/src/shoutbox/blocks


submenu.jspx is new



Index: index.jspx
===================================================================
RCS file: /var/cvs/contributions/didactor2/src/shoutbox/blocks/index.jspx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- index.jspx  30 Oct 2008 09:08:25 -0000      1.11
+++ index.jspx  21 Nov 2008 14:10:32 -0000      1.12
@@ -1,5 +1,7 @@
 <?xml version="1.0"?>
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page";
+<jsp:root
+    xmlns:c="http://java.sun.com/jsp/jstl/core";
+    xmlns:jsp="http://java.sun.com/JSP/Page";
           xmlns:fmt="http://java.sun.com/jsp/jstl/fmt";
           xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0";
           xmlns:mm-sr="http://www.mmbase.org/tags/mm/searchrelate";
@@ -13,9 +15,10 @@
        </mm:node>
 
        <div class="learnenvironment" style="background-image: ${empty 
background ? '' : background}">
-               <div class="mm_c c_shoutbox b_index 
${requestScope['org.mmbase.componentClassName']}" 
id="${requestScope['org.mmbase.componentId']}">
+               <div class="mm_c c_shoutbox b_index 
${requestScope['org.mmbase.componentClassName']}"
+         id="${requestScope['org.mmbase.componentId']}">
 
-      <mm:import externid="reference"  />
+      <mm:import id="reference" externid="_reference"  />
       <mm:cloud method="asis">
         <mm:param name="org.mmbase.shoutbox.reference" value="${reference}" />
 
@@ -24,17 +27,20 @@
         <script type="text/javascript">
           $(document).ready(function() {
           $("#mm_reference_search").hide();
-          $("#mm_reference").change(function() {
-          document.location.href = "<mm:url page="." 
/>?source=${source}&amp;amp;reference=" + this.value;
+            $("#mm_reference,#self").change(function() {
+              this.form.submit();
           return false;
           });
           });
         </script>
 
 
-        <mm:node number="${source}"> <!-- source may be empty, in which case 
it will be the current node, as provided by the framework. -->
+        <mm:node number="${source}">
+          <!-- source may be empty, in which case it will be the current node, 
as provided by the framework. -->
+
 
           <mm:hasnodemanager name="properties">
+            <!-- The properties builder is used to store the 'last check' time 
of this page -->
             <mm:import id="key">shouts.last_check</mm:import>
             <mm:functioncontainer nodemanager="properties">
               <mm:param name="node" referid="_node" />
@@ -55,11 +61,29 @@
             </fmt:message>
           </h2>
 
-          <mm:fieldlist nodetype="shouts" fields="reference">
+          <form>
+            <c:if test="${! empty source}">
+              <input type="hidden" name="source" value="${source}" />
+            </c:if>
+
+            <mm:fieldlist nodetype="shouts"
+                          fields="reference" jspvar="field">
+              <mm:fieldinfo type="guiname" />
+              <jsp:text> </jsp:text>
             <mm:fieldinfo type="searchinput" />
           </mm:fieldlist>
+            <mm:import externid="self">not</mm:import> <!-- hmm -->
 
-          <mm-sr:relatednodes type="shouts"
+            <select name="self" id="self">
+              <mm:option value=""     compare="${self}">--</mm:option>
+              <mm:option value="only" compare="${self}">Only from 
myself</mm:option>
+              <mm:option value="not"  compare="${self}">Not from myself 
</mm:option>
+            </select>
+          </form>
+
+          <div class="${self}">
+            <mm-sr:relatednodes
+                type="shouts"
                               role="posrel"
                               item="/mmbase/components/shoutbox/item.jspx" 
orderby="posrel.pos" direction="down"
                               createposition="top">
@@ -67,8 +91,17 @@
               <mm:isnotempty referid="reference">
                 <mm:constraint field="reference" value="${reference}" />
               </mm:isnotempty>
+                <c:choose>
+                  <c:when test="${self eq 'only'}">
+                    <mm:constraint field="from" 
value="${requestScope['org.mmbase.currentuser'].number}" />
+                  </c:when>
+                  <c:when test="${self eq 'not'}">
+                    <mm:constraint field="from" 
value="${requestScope['org.mmbase.currentuser'].number}" inverse="true" />
+                  </c:when>
+                </c:choose>
             </jsp:attribute>
           </mm-sr:relatednodes>
+          </div>
         </mm:node>
       </mm:cloud>
                </div>


Index: menu.jspx
===================================================================
RCS file: /var/cvs/contributions/didactor2/src/shoutbox/blocks/menu.jspx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- menu.jspx   30 Oct 2008 16:51:48 -0000      1.5
+++ menu.jspx   21 Nov 2008 14:10:32 -0000      1.6
@@ -4,24 +4,16 @@
     xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0";
     version="2.0">
 
-  <mm:cloud jspvar="cloud" method="asis">
-    <jsp:scriptlet>
-      // TODO, there should be an easier way to get the current user.
-      // Didactor of course provides requestScope.user, but we want these jsps 
to be didactor independent.
-
-      org.mmbase.framework.Framework fw = 
org.mmbase.framework.Framework.getInstance();
-      org.mmbase.util.functions.Parameters params = fw.createParameters();
-      params.setIfDefined(org.mmbase.util.functions.Parameter.CLOUD, cloud);
-      pageContext.setAttribute("currentuser", fw.getUserNode(params));
-    </jsp:scriptlet>
-  </mm:cloud>
-  <div class="menuSeperator"><jsp:text> </jsp:text></div>
+
   <div class="menuItem">
+
     <mm:link>
       <mm:frameworkparam name="block" value="index" />
       <mm:frameworkparam name="component" value="shoutbox" />
-      <a href="${_}" class="menubar">
+      <a href="${_}" class="menubar  ${param.name eq 'shoutbox' ? 'active' : 
''}">
+
         <fmt:message key="menu" />
+
         <mm:hasnodemanager name="properties">
           <mm:functioncontainer  nodemanager="properties">
             <mm:param name="node" value="${_node}" />
@@ -30,10 +22,11 @@
           </mm:functioncontainer>
           <mm:relatednodescontainer type="shouts">
             <mm:constraint field="time" operator="GT" value="${lastcheck}" />
-            <mm:constraint field="from" operator="NE" 
value="${currentuser.number}" />
+            <mm:constraint field="from" operator="NE" 
value="${requestScope['org.mmbase.currentuser'].number}" />
             <jsp:text> (<mm:size />)</jsp:text>
           </mm:relatednodescontainer>
         </mm:hasnodemanager>
+
       </a>
     </mm:link>
   </div>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to