Update of 
/var/cvs/contributions/didactor2/src/education/templates/education/wizards/modes
In directory james.mmbase.org:/tmp/cvs-serv21091/modes

Modified Files:
        educations.jsp whichimage.jsp 
Log Message:
converted yet another file to jspx, added some comments about what still should 
happen


See also: 
http://cvs.mmbase.org/viewcvs/contributions/didactor2/src/education/templates/education/wizards/modes


Index: educations.jsp
===================================================================
RCS file: 
/var/cvs/contributions/didactor2/src/education/templates/education/wizards/modes/educations.jsp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- educations.jsp      28 Jan 2008 16:44:03 -0000      1.16
+++ educations.jsp      28 Jan 2008 17:24:56 -0000      1.17
@@ -1,26 +1,29 @@
-<[EMAIL PROTECTED] contentType="application/xml;charset=UTF-8"
-%><[EMAIL PROTECTED] uri="http://www.mmbase.org/mmbase-taglib-2.0"; prefix="mm"
-%><[EMAIL PROTECTED] uri="http://www.didactor.nl/ditaglib_1.0"; prefix="di"
-%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions";
-%><jsp:directive.page 
import="java.util.*,nl.didactor.component.education.utils.*" />
-<div class="educations">
-<jsp:scriptlet>
-  String imageName = "";
-  String sAltText = "";
-</jsp:scriptlet>
-<mm:content type="application/xml" expires="${param.expires}">
-<mm:cloud rank="basic user" jspvar="cloud">
-  <jsp:directive.include file="/shared/setImports.jsp" />
+<jsp:root version="2.0"
+          xmlns:jsp="http://java.sun.com/JSP/Page";
+          xmlns:fn="http://java.sun.com/jsp/jstl/functions";
+          xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0";
+          xmlns:di="http://www.didactor.nl/ditaglib_1.0";>
+  <jsp:output omit-xml-declaration="yes" />
+  <!--
+      TODO: This Jsp is much to complicated.
+      - Too long
+      - Too much component specific code
+      - Too much javascript (should perhaps use event handlers)
+  -->
+  <div class="educations">
+    <mm:import id="imageName"></mm:import> <!-- horrible idea -->
+    <mm:import id="sAltText"></mm:import>
+    <mm:content type="application/xml" expires="${param.expires}">
+      <mm:cloud rank="basic user">
   <jsp:directive.include file="../mode.include.jsp" />
-  <jsp:directive.include file="/education/wizards/roles_defs.jsp" />
+
    <!--
        Educations come from here
    -->
-   <mm:import id="editcontextname" reset="true">opleidingen</mm:import>
-   <jsp:directive.include file="/education/wizards/roles_chk.jsp" />
-   <mm:islessthan inverse="true" referid="rights" referid2="RIGHTS_RW">
-      <a href='javascript:clickNode("node_0")'>
-        <img src='gfx/tree_pluslast.gif' width="16" border='0' align='center' 
valign='middle' id='img_node_0'/></a>
+        <di:has editcontext="opleidingen">
+          <a href="javascript:clickNode('node_0')">
+            <img src='gfx/tree_pluslast.gif' width="16" border='0' 
align='center' valign='middle' id='img_node_0'/>
+          </a>
         <img src='gfx/menu_root.gif' border='0' align='center' 
valign='middle'/>
         <span style='width:100px; white-space: nowrap'>
           <mm:link referid="listjsp${forbidtemplate}">
@@ -34,7 +37,7 @@
             </a>
           </mm:link>
         </span>
-      <br />
+          <br /><!-- br's are silly -->
       <div id='node_0' style='display: none'>
         <mm:node number="$user" jspvar="node">
           <mm:hasrank value="administrator">
@@ -49,7 +52,7 @@
         <table border="0" cellpadding="0" cellspacing="0">
           <tr>
             <td><img src="gfx/tree_spacer.gif" width="16px" height="16px" 
border="0" align="center" valign="middle"/></td>
-            <%// We have to detect the last element %>
+                <!-- We have to detect the last element -->
             <mm:isgreaterthan referid="number_of_educations" value="0">
               <td><img src="gfx/tree_vertline-leaf.gif" border="0" 
align="middle"/></td>
             </mm:isgreaterthan>
@@ -77,74 +80,115 @@
 
 
         <mm:isgreaterthan referid="number_of_educations" value="0">
-          <%// -------------------------------------------- The Education 
starts from here -------------------------------------------- %>
+              <!-- The Education starts from here -->
           <mm:node number="${educationId}">
-            <[EMAIL PROTECTED] file="whichimage.jsp"%>
+                <jsp:directive.include file="whichimage.jsp" />
             <table border="0" cellpadding="0" cellspacing="0">
               <tr>
                 <td><img src="gfx/tree_spacer.gif" width="16px" height="16px" 
border="0" align="center" valign="middle"/></td>
                 <td>
-                  <a href='javascript:clickNode("education_0")'><img 
src="gfx/tree_pluslast.gif" border="0" align="center" valign="middle" 
id="img_education_0"/></a>
+                      <a href="javascript:clickNode('education_0')">
+                        <img src="gfx/tree_pluslast.gif" border="0" 
align="center" valign="middle" id="img_education_0"/>
+                      </a>
                 </td>
                 <td><img src="gfx/folder_closed.gif" border="0" align="middle" 
id="img2_education_0"/></td>
                 <td>
                   <nobr>
-                    <a href="<mm:write 
referid="wizardjsp"/>&amp;wizard=config/education/educations&amp;objectnumber=<mm:field
 name="number" />&amp;path=" title="<di:translate key="education.editeducation" 
/>" target="text"><mm:field name="name" /></a>
-                    <mm:import id="eduname" jspvar="eduname"><mm:field 
name="name" /></mm:import>
-                         <% session.setAttribute("eduname",eduname); %>
+                        <mm:link referid="wizardjsp" referids="[EMAIL 
PROTECTED]">
+                          <mm:param 
name="wizard">config/education/educations</mm:param>
+                          <mm:param name="title"><di:translate 
key="education.editeducation" /></mm:param>
+                          <a href="${_}" target="text"><mm:field name="name" 
/></a>
+                        </mm:link>
+                        <mm:field id="eduname" write="false" name="name" />
+                        <mm:write session="eduname" referid="eduname" />
+
+                        <!--
+                            follows horrible code specific for some components
+                            probably broken, btw.
+                        -->
                          <mm:present referid="pdfurl">
-                           <a href="<mm:write 
referid="pdfurl"/>&amp;number=<mm:field name="number"/>" target="text"><img 
src='gfx/icpdf.gif' border='0' title='(PDF)' alt='(PDF)'/></a>
+                          <mm:link page="${pdfurl}" referids="[EMAIL 
PROTECTED]">
+                            <a href="${_}" target="text"><img 
src='gfx/icpdf.gif' border='0' title='(PDF)' alt='(PDF)'/></a>
+                          </mm:link>
                          </mm:present>
-                         <mm:node number="component.metadata" notfound="skip">
-                           <a href="metaedit.jsp?number=${educationId}" 
target="text"><img id="img_${educationId}" src="<%= imageName %>" border="0" 
title="<%= sAltText %>" alt="<%= sAltText %>" /></a>
-                         </mm:node>
-                         <mm:node number="component.drm" notfound="skip">
-                           <a target="text" href="<mm:write 
referid="wizardjsp"/>&amp;wizard=educationslicense&amp;objectnumber=${educationId}"
 title="Bewerk licentie" style="font-size: 1em; text-decoration: none">??</a>
-                         </mm:node>
-                         <mm:node number="component.versioning" 
notfound="skip">
+                        <mm:hasnode number="component.metadata">
+                          <a href="metaedit.jsp?number=${educationId}" 
target="text">
+                            <img id="img_${educationId}" src="${imageName}"
+                                 border="0" title="${sAltText}" 
alt="${sAltText}" /></a>
+                        </mm:hasnode>
+                        <mm:hasnode number="component.drm">
+                          <mm:link referid="wizardjsp" referids="[EMAIL 
PROTECTED]">
+                            <mm:param name="wizard">educationlicense</mm:param>
+                            <!-- Todo: DUTCH -->
+                            <a target="text" href="${_}"
+                               title="Bewerk licentie" style="font-size: 1em; 
text-decoration: none">??</a>
+                          </mm:link>
+                        </mm:hasnode>
+                        <mm:hasnode number="component.versioning">
                            <a href="versioning.jsp?nodeid=${educationId}" 
target="text"><img src="gfx/versions.gif" border="0" /></a>
-                         </mm:node>
+                        </mm:hasnode>
                        </nobr>
                      </td>
                   </tr>
                </table>
 
-               <% // We have to count all learnblocks %>
+                <!--  We have to count all learnblocks.
+                     MM:I can see that. But why?
+                -->
                <mm:relatednodescontainer role="posrel" type="learnobjects" 
searchdirs="destination">
                   <mm:size id="number_of_learnblocks" write="false"/>
                </mm:relatednodescontainer>
 
 
                <div id="education_0" style='display: none'>
-                  <%-- Registration --%>
-                  <mm:node number="component.register" notfound="skipbody">
+                  <!-- Registration -->
+                  <mm:hasnode number="component.register">
                   <table border="0" cellpadding="0" cellspacing="0">
                      <tr>
                         <td><img src="gfx/tree_spacer.gif" width="32px" 
height="16px" border="0" align="center" valign="middle"/></td>
                         <td><img src='gfx/tree_vertline-leaf.gif' border='0' 
align='center' valign='middle' id='img_node_0_1_2'/></td>
                         <td><img src='gfx/new_education.gif' width="16" 
border='0' align='middle' /></td>
-                        <td><nobr> <a href="<mm:treefile write="true" 
page="/register/wizards/register.jsp" referids="$referids" 
objectlist="$includePath"><mm:param 
name="educationid">${educationId}</mm:param></mm:treefile>" 
title="<di:translate key="register.registrations" />" 
target="text"><di:translate key="register.registrations" /></a></nobr></td>
+                        <mm:treefile write="false" 
page="/register/wizards/register.jsp"
+                                     referids="$referids,educationId"
+                                     objectlist="$includePath">
+                          <td>
+                            <nobr>
+                              <a href="${_}" 
title="${di:translate('register.registrations')}"
+                                 target="text"><di:translate 
key="register.registrations" /></a>
+                            </nobr>
+                          </td>
+                        </mm:treefile>
                      </tr>
                   </table>
-                  </mm:node>
 
-                  <%-- I think it is hackery --%>
-                  <mm:node number="component.portal" notfound="skipbody">
+
+                    <!-- I think it is hackery -->
+                    <mm:hasnode number="component.portal">
                   <table border="0" cellpadding="0" cellspacing="0">
                      <tr>
                         <td><img src="gfx/tree_spacer.gif" width="32px" 
height="16px" border="0" align="center" valign="middle"/></td>
                         <td><img src='gfx/tree_vertline-leaf.gif' border='0' 
align='center' valign='middle' id='img_node_0_1_2'/></td>
                         <td><img src='gfx/new_education.gif' width="16" 
border='0' align='middle' /></td>
-                        <td><nobr> <a href="<mm:treefile write="true" 
page="/portal/wizards/index.jspx" referids="language,$referids" 
objectlist="$includePath"><mm:param 
name="educationid">${educationId}</mm:param></mm:treefile>" 
title="<di:translate key="portal.portal" />" target="text"><di:translate 
key="portal.portal" /></a></nobr></td>
+                          <mm:treefile write="false" 
page="/portal/wizards/index.jspx"
+                                       
referids="language,educationId,$referids" objectlist="$includePath">
+
+                            <td>
+                              <nobr>
+                                <a href="${_}"
+                                   title="${di:translate('portal.portal')}"
+                                   target="text"><di:translate 
key="portal.portal" /></a>
+                              </nobr>
+                            </td>
+                          </mm:treefile>
                      </tr>
                   </table>
-                  </mm:node>
+                    </mm:hasnode>
 
                   <mm:relatednodes path="posrel,learnblocks" element="posrel" 
orderby="posrel.pos" directions="down" max="1">
                     <mm:field name="pos" id="maxpos" write="false" />
                   </mm:relatednodes>
 
-                  <%// create new learnblock item %>
+                    <!-- create new learnblock item -->
                   <table border="0" cellpadding="0" cellspacing="0">
                     <tr>
                       <td><img src="gfx/tree_spacer.gif" width="32px" 
height="16px" border="0" align="center" valign="middle"/></td>
@@ -170,16 +214,12 @@
                   </table>
 
 
-                  <% //All learnblocks for current education %>
-                  <%
-                     int iLearnblockCounter = 0;
-                  %>
-
+                    <!-- All learnblocks for current education -->
                   <mm:relatednodes role="posrel" orderby="posrel.pos"
                                    directions="up"
                                    searchdir="destination" type="learnobjects">
-
-                    <[EMAIL PROTECTED] file="whichimage.jsp"%>
+                      <mm:index id="learnblockcounter" write="false" />
+                      <jsp:directive.include file="whichimage.jsp" />
                     <mm:nodeinfo type="type" id="this_node_type">
                       <mm:import id="mark_error" reset="true"></mm:import>
                       <mm:compare referid="this_node_type" value="tests">
@@ -187,6 +227,7 @@
                           <mm:isgreaterthan value="0">
                             <mm:countrelations type="questions">
                               <mm:islessthan value="$questionamount">
+                                  <!-- TODO DUTCH -->
                                 <mm:import id="mark_error" reset="true">Er 
zijn minder vragen ingevoerd dan er gesteld moeten worden.</mm:import>
                               </mm:islessthan>
                             </mm:countrelations>
@@ -195,11 +236,13 @@
                           <mm:field name="requiredscore" id="requiredscore">
                             <mm:countrelations type="questions">
                               <mm:islessthan value="$requiredscore">
+                                  <!-- TODO DUTCH -->
                                 <mm:import id="mark_error" reset="true">Er 
zijn minder vragen ingevoerd dan er goed beantwoord moeten worden.</mm:import>
                               </mm:islessthan>
                             </mm:countrelations>
                             <mm:isgreaterthan referid="questionamount" 
value="0">
                               <mm:islessthan referid="questionamount" 
value="$requiredscore">
+                                  <!-- TODO DUTCH -->
                                 <mm:import id="mark_error" reset="true">Er 
worden minder vragen gesteld dan er goed beantwoord moeten worden.</mm:import>
                               </mm:islessthan>
                             </mm:isgreaterthan>
@@ -210,36 +253,59 @@
                       <table border="0" cellpadding="0" cellspacing="0">
                         <tr>
                           <td><img src="gfx/tree_spacer.gif" width="32px" 
height="16px" border="0" align="center" valign="middle"/></td>
-                          <td><mm:last inverse="true"><a 
href='javascript:clickNode("node_0_0_<%= iLearnblockCounter %>")'><img 
src="gfx/tree_plus.gif" border="0" align="center" valign="middle" 
id="img_node_0_0_<%= iLearnblockCounter %>"/></a></mm:last><mm:last><a 
href='javascript:clickNode("node_0_0_<%= iLearnblockCounter %>")'><img 
src="gfx/tree_pluslast.gif" border="0" align="center" valign="middle" 
id="img_node_0_0_<%= iLearnblockCounter %>"/></a></mm:last></td>
-                          <td><img src="gfx/folder_closed.gif" border="0" 
align="middle" id='img2_node_0_0_<%= iLearnblockCounter %>'/></td>
+                            <td>
+                              <!-- horrible code duplication, just for, as i 
can see it correctly _one_ word -->
+                              <mm:last inverse="true">
+                                <a 
href="javascript:clickNode('node_0_0_${learnblockcounter}')">
+                                <img src="gfx/tree_plus.gif" border="0" 
align="center" valign="middle" id="img_node_0_0_${learnblockcounter}"/></a>
+                              </mm:last>
+                              <mm:last>
+                                <a 
href="javascript:clickNode('node_0_0_${learnblockcounter}')">
+                                <img src="gfx/tree_pluslast.gif" border="0" 
align="center" valign="middle" id="img_node_0_0_${learnblockcounter}"/></a>
+                              </mm:last>
+                            </td>
+                            <td>
+                              <img src="gfx/folder_closed.gif" border="0" 
align="middle" id='img2_node_0_0_${learnblockcounter}'/>
+                            </td>
                           <td>
                             <nobr>
-                              <mm:import id="dummyname" jspvar="dummyName" 
vartype="String" reset="true"><mm:nodeinfo type="guitype"/></mm:import>
-                              <a href="<mm:write 
referid="wizardjsp"/>&amp;wizard=config/<mm:nodeinfo type="type" 
/>/<mm:nodeinfo type="type" />&amp;objectnumber=<mm:field name="number" />" 
title="<di:translate key="education.editexisting" /> <%= 
dummyName.toLowerCase() %>" target="text"><mm:field name="name" /></a>
+                                <mm:import id="guitype" ><mm:nodeinfo 
type="guitype" escape="lowercase" /></mm:import>
+                                <mm:link referid="wizardjsp" referids="[EMAIL 
PROTECTED]">
+                                  <mm:param name="wizard">config/<mm:nodeinfo 
type="type"/>/<mm:nodeinfo type="type" /></mm:param>
+                                  <a href="${_}" 
title="${di:translate('education.editexisting')} ${guitype}" target="text">
+                                    <mm:field name="name" />
+                                  </a>
+                                </mm:link>
                               <mm:present referid="pdfurl">
-                                <mm:compare referid="this_node_type" 
value="pages">
-                                  <a href="<mm:write referid="pdfurl" 
/>&amp;number=<mm:field name="number"/>" target="text"><img src='gfx/icpdf.gif' 
border='0' title='(PDF)' alt='(PDF)'/></a>
-                                </mm:compare>
-                                <mm:compare referid="this_node_type" 
value="learnblocks">
-                                  <a href="<mm:write 
referid="pdfurl"/>&amp;number=<mm:field name="number"/>" target="text"><img 
src='gfx/icpdf.gif' border='0' title='(PDF)' alt='(PDF)'/></a>
+                                  <mm:compare referid="this_node_type" 
valueset="pages,learnblocks">
+                                    <mm:link page="${pdfurl}" referids="[EMAIL 
PROTECTED]">
+                                      <a href="${_}" target="text"><img 
src='gfx/icpdf.gif' border='0' title='(PDF)' alt='(PDF)'/></a>
+                                    </mm:link>
                                 </mm:compare>
                               </mm:present>
-                              <mm:field name="number" id="node_number" 
write="false" />
-                              <mm:node number="component.metadata" 
notfound="skip">
-                                <a href="metaedit.jsp?number=<mm:write 
referid="node_number" />" target="text"><img id="img_${_node}" src="<%= 
imageName %>" border="0" title="<%= sAltText %>" alt="<%= sAltText %>" /></a>
-                              </mm:node>
-                              <mm:node number="component.versioning" 
notfound="skip">
-                                <a href="versioning.jsp?nodeid=<mm:write 
referid="node_number" />" target="text"><img src="gfx/versions.gif" border="0" 
/></a>
-                              </mm:node>
-                              <mm:remove referid="node_number" />
+                                <mm:hasnode number="component.metadata">
+                                  <mm:link page="metaedit.jsp" 
referids="[EMAIL PROTECTED]">
+                                    <a href="${_}" target="text">
+                                      <img id="img_${_node}" 
src="${imageName}" border="0" title="${sAltText}"
+                                           alt="${sAltText}" />
+                                    </a>
+                                  </mm:link>
+                                </mm:hasnode>
+
+                                <mm:hasnode number="component.versioning">
+                                  <mm:link page="versioning.jsp" 
referids="[EMAIL PROTECTED]">
+                                    <a href="${_}" target="text"><img 
src="gfx/versions.gif" border="0" /></a>
+                                  </mm:link>
+                                </mm:hasnode>
                             </nobr>
                           </td>
                         </tr>
                       </table>
                     </mm:nodeinfo>
 
-                    <div id="node_0_0_<%= iLearnblockCounter %>" 
style="display:none">
-                    <mm:treeinclude write="true" 
page="/education/wizards/learnobject.jsp" objectlist="$includePath" 
referids="wizardjsp">
+                      <div id="node_0_0_${learnblockcounter}" 
style="display:none">
+                        <mm:treeinclude write="true" 
page="/education/wizards/learnobject.jsp" objectlist="$includePath"
+                                        referids="wizardjsp">
                       <mm:param name="startnode"><mm:field name="number" 
/></mm:param>
                       <mm:param name="depth">10</mm:param>
                       <mm:last>
@@ -250,15 +316,14 @@
                       </mm:last>
                     </mm:treeinclude>
                   </div>
-                  <%
-                  iLearnblockCounter++;
-                  %>
                 </mm:relatednodes>
+                  </mm:hasnode>
               </div>
             </mm:node>
          </mm:isgreaterthan>
       </div>
-   </mm:islessthan>
-</mm:cloud>
-</mm:content>
-</div>
+        </di:has>
+      </mm:cloud>
+    </mm:content>
+  </div>
+</jsp:root>


Index: whichimage.jsp
===================================================================
RCS file: 
/var/cvs/contributions/didactor2/src/education/templates/education/wizards/modes/whichimage.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- whichimage.jsp      1 Nov 2006 10:10:38 -0000       1.1
+++ whichimage.jsp      28 Jan 2008 17:24:56 -0000      1.2
@@ -1 +1 @@
-<%-- default empty file, will be overwritten if metadata is installed --%>
+<!-- default empty file, will be overwritten if metadata is installed -->
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to