Update of 
/var/cvs/contributions/CMSContainer/cmsc/maintenance/src/webapp/editors/maintenance
In directory 
james.mmbase.org:/tmp/cvs-serv16541/cmsc/maintenance/src/webapp/editors/maintenance

Modified Files:
        create-relations-asset-channel.jsp 
Log Message:
CMSC-1192 - add SQL script to migrate all images/attachments/URLs to new 
assetstable - improved functionality


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/maintenance/src/webapp/editors/maintenance
See also: http://www.mmbase.org/jira/browse/CMSC-1192


Index: create-relations-asset-channel.jsp
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/maintenance/src/webapp/editors/maintenance/create-relations-asset-channel.jsp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- create-relations-asset-channel.jsp  30 Jan 2009 14:08:03 -0000      1.5
+++ create-relations-asset-channel.jsp  6 Feb 2009 15:03:06 -0000       1.6
@@ -11,27 +11,32 @@
 </head>
     <body>
        <h2>Create relations from assets to channels.</h2>
-<mm:cloud jspvar="cloud" loginpage="../editors/login.jsp" rank="administrator">
-<mm:log jspvar="log">
-Note:<ul>
-<li>If 'Relate to root channel' is chosen, the asset elements will be related 
to the channel node which is filled in the input text. If it's empty, the root 
of the repository will be used.</li>
-<li>If 'Self-determination' is chosen, the asset elements will be related to 
the channel node which relates to an article and the article relates to the 
asset.</li>
-
-</ul>
-<br/><br/>
-<form method="post">
+      <mm:cloud jspvar="cloud" loginpage="../editors/login.jsp" 
rank="administrator">
+      <mm:log jspvar="log">
+      <form method="post">
       <input type="hidden" name="action" value="add"/>
+         <strong>1) Choose how you want the relations to be made.</strong>
+         <ul>
+            <li>If 'Relate to root channel' is chosen, the asset elements will 
be related to the channel node which is filled in the input text. If it's 
empty, the root of the repository will be used.</li>
+            <li>If 'Self-determination' is chosen, the asset elements will be 
related to the channel node which relates to an article and the article relates 
to the asset.</li>
+         </ul>
    <select name="type">
       <option value="root">Relate to root channel</option>
       <option value="selfselect">Self-determination</option>
    </select><br/><br/>
+         <strong>2) If you have chosen 'Self-determination', you can select 
here how you want it to work. Otherwise skip this step.</strong><br/><br/>
+         <select name="selfselectLogic">
+            <option value="firstElem">Always relate to the first possible 
channel</option>
+            <option value="rootWhenUndetermined">Pick ROOT when more then one 
channel to choose from</option>
+         </select><br/><br/>
+         <strong>3) Choose your root channel. If you leave this field blank 
repository.root will be chosen.</strong><br/><br/>
    Parent channel Node Number:<input type="text" name="number"/><br/><br/>
       <input type="submit" name="action" value="Create"/>
-</form>
+      </form>
 
-<mm:import externid="action"/>
-<mm:import externid="number"/>
-<mm:present referid="action">
+   <mm:import externid="action"/>
+   <mm:import externid="number"/>   
+   <mm:present referid="action">
    <c:if test="${param.type == 'root'}">
    <mm:write referid="number" jspvar="number" vartype="Integer">
       <% if(number < 1) {
@@ -51,13 +56,37 @@
       </mm:write>
    </c:if>
    <c:if test="${param.type == 'selfselect'}">
+      <%-- firstElem --%>
+      <c:if test="${param.selfselectLogic== 'firstElem'}">
+
        <mm:write referid="number" jspvar="number" vartype="Integer">
       <%
-          new 
CreateRelationsForSecondaryContent(cloud,pageContext).execute(number,"selfselect");
+            if( !RepositoryUtil.isChannel(String.valueOf(number))) {
+                     new 
CreateRelationsForSecondaryContent(cloud,pageContext).execute(number,"selfselect","firstElem");
           out.println("Total Asset count : 
"+pageContext.getAttribute("totalCount")+"  added creationrel count : 
"+pageContext.getAttribute("addedRelationCount"));
+            }
+            else {
+                  out.println("The number should be a channel number!");
+               }
       %>
             </mm:write>
    </c:if>
+      
+      <%-- rootWhenUndetermined --%>
+      <c:if test="${param.selfselectLogic=='rootWhenUndetermined'}">
+         <mm:write referid="number" jspvar="number" vartype="Integer">
+         <%
+            if (!RepositoryUtil.isChannel(String.valueOf(number))) {
+               new 
CreateRelationsForSecondaryContent(cloud,pageContext).execute(number,"selfselect","rootWhenUndetermined");
+               out.println("Total Asset count : 
"+pageContext.getAttribute("totalCount")+"  added creationrel count : 
"+pageContext.getAttribute("addedRelationCount"));
+            }
+            else {
+               out.println("The number should be a channel number!");
+            }
+         %>
+      </mm:write>
+      </c:if>
+   </c:if>
 </mm:present>
 
 </mm:log>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to