Author: michiel
Date: 2010-04-22 15:07:54 +0200 (Thu, 22 Apr 2010)
New Revision: 42009

Modified:
   
mmbase/branches/MMBase-1_9/applications/taglib/src/main/resources/META-INF/tags/mm/u/relation.tagx
Log:
MMB-1953

Modified: 
mmbase/branches/MMBase-1_9/applications/taglib/src/main/resources/META-INF/tags/mm/u/relation.tagx
===================================================================
--- 
mmbase/branches/MMBase-1_9/applications/taglib/src/main/resources/META-INF/tags/mm/u/relation.tagx
  2010-04-22 10:22:51 UTC (rev 42008)
+++ 
mmbase/branches/MMBase-1_9/applications/taglib/src/main/resources/META-INF/tags/mm/u/relation.tagx
  2010-04-22 13:07:54 UTC (rev 42009)
@@ -9,7 +9,11 @@
   <jsp:directive.attribute name="from" type="java.lang.String"  />
   <jsp:directive.attribute name="role" type="java.lang.String"  />
   <jsp:directive.attribute name="searchdir" type="java.lang.String"  />
-  <jsp:directive.attribute name="notfound" type="java.lang.String"   />
+  <jsp:directive.attribute
+      name="notfound"
+      type="java.lang.String"
+      description="like the 'notfound' attribute of a normal node tag. But 
with the following remarks. If empty, it behaves as 'skip'. It can also take 
the value 'create', in which the relation will be create if it does not yet 
exist."
+      />
 
   <mm:node number="${from}" emptynumberiscurrentnode="true">
 
@@ -19,9 +23,20 @@
       <mm:listrelations>
         <mm:node id="thenode" />
       </mm:listrelations>
-      <mm:node id="idnode" number="${empty thenode ? -1 : thenode}" 
notfound="${empty notfound ? 'skip' : notfound}" >
-        <jsp:doBody />
-      </mm:node>
+      <c:choose>
+        <c:when test="${empty thenode and notfound eq 'create'}">
+          <mm:node number="${to}" id="toNode" />
+          <mm:createrelation source="_node" destination="toNode" 
role="${role}" id="newRelation" />
+          <mm:node referid="newRelation">
+            <jsp:doBody />
+          </mm:node>
+        </c:when>
+        <c:otherwise>
+          <mm:node id="idnode" number="${empty thenode ? -1 : thenode}" 
notfound="${empty notfound ? 'skip' : notfound}" >
+            <jsp:doBody />
+          </mm:node>
+        </c:otherwise>
+      </c:choose>
     </mm:listrelationscontainer>
   </mm:node>
 </jsp:root>

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

Reply via email to