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

Modified Files:
        imageupload.jsp 
Log Message:
CMSC-681 Asset Maintenance


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


Index: imageupload.jsp
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imageupload.jsp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- imageupload.jsp     28 Nov 2008 09:30:26 -0000      1.11
+++ imageupload.jsp     9 Dec 2008 06:15:27 -0000       1.12
@@ -8,10 +8,7 @@
   <script src="../repository/search.js" type="text/javascript"></script>
   <script type="text/javascript">
     function upload() {
-        var f=document.forms[0];
-        f.submit();
         setTimeout('sayWait();',0);
-
     }
 
     function sayWait() {
@@ -24,6 +21,16 @@
       openPopupWindow('imageinfo', '900', '500', 
'imageinfo.jsp?objectnumber='+objectnumber);
     }
           
+   function unpublish(parentchannel, objectnumber) {
+       var url = "AssetDeleteAction.do";
+       url += "?channelnumber=" + parentchannel;
+       url += "&action=unlink";
+       url += "&returnurl=" + escape(document.location + 
"&refreshchannel=true");
+       url += "&objectnumber=" + objectnumber;
+
+       document.location.href = url;
+   }
+   
     var blockSelect = false;
   </script>
 </cmscedit:head>
@@ -31,55 +38,34 @@
 <mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
       <div class="editor" style="height:500px">
           <div class="body">
-              <form action="" enctype="multipart/form-data" method="post">
-                <input type="hidden" name="uploadAction" 
value="${param.uploadAction}"/>
+              <html:form action="/editors/repository/ImageUploadAction.do" 
enctype="multipart/form-data" method="post">
+                  <input type="hidden" id="parentchannel" name="parentchannel" 
value="${param.channelid}"/>
                     <table border="0">
                        <tr>
-                          <td><fmt:message key="images.upload.explanation" 
/></td>
+                     <td><fmt:message key="asset.upload.explanation" /></td>
                        </tr>
+                  <c:if test="${param.exist=='1'}">
                        <tr>
-                          <td><input type="file" name="zipfile"/></td>
+                        <td style="color:red;"><fmt:message 
key="asset.upload.existed" /></td>
                        </tr>
+                  </c:if>
                        <tr>
-                          <td><input type="button" name="uploadButton" 
onclick="upload();" 
-                                   value="<fmt:message 
key="images.upload.submit" />"/></td>
+                     <td><html:file property="file" /></td>
+                  </tr>
+                  <tr>
+                     <td><html:submit property="uploadButton" 
onclick="upload();">
+                     <fmt:message key='assets.upload.submit' 
/></html:submit></td>
                        </tr>
                     </table>
-             </form>
+               </html:form>
           </div>
           <div class="ruler_green"><div><fmt:message 
key="images.upload.results" /></div></div>
+
           <div class="body">
             <div id="busy">
                 <fmt:message key="uploading.message.wait"/><br />
             </div>
-<%
-    // retrieve list op node id's from either the recent upload
-    // or from the request url to enable a return url
-    // TODO move this to a struts action there are some issue with HttpUpload
-    // in combination with struts which have to be investigated first
-    String uploadedNodes = "";
-    int numberOfUploadedNodes = -1;
-    if ("post".equalsIgnoreCase(request.getMethod())) {
-        NodeManager manager = cloud.getNodeManager("images");
-        List<Integer> nodes = BulkUploadUtil.uploadAndStore(manager, request);
-        uploadedNodes = BulkUploadUtil.convertToCommaSeparated(nodes);
-        numberOfUploadedNodes = nodes.size();
-    } else {
-        if (request.getParameter("uploadedNodes") != null) {
-            uploadedNodes = request.getParameter("uploadedNodes");
-        }
-        if (request.getParameter("numberOfUploadedNodes") != null) {
-            numberOfUploadedNodes = 
Integer.parseInt(request.getParameter("numberOfUploadedNodes"));
-        }
-    }
-%>
-<% if (numberOfUploadedNodes == 0) { %>
-    <p><fmt:message key="images.upload.error"/></p>
-<% } else if (numberOfUploadedNodes > 0) { %>
-    <p id="notbusy"><fmt:message key="images.upload.result">
-           <fmt:param value="<%= numberOfUploadedNodes %>"/>
-       </fmt:message>
-    </p>
+<c:if test="${param.exist =='0'}">
          <table>
             <tr class="listheader">
                <th></th>
@@ -90,8 +76,7 @@
             </tr>
             <tbody class="hover">
                 <c:set var="useSwapStyle">true</c:set>
-
-                <mm:listnodescontainer path="images" nodes="<%= uploadedNodes 
%>">
+                <mm:listnodescontainer path="images" 
nodes="${param.uploadedNodes}">
                     <mm:listnodes>
 
                <mm:field name="description" escape="js-single-quotes" 
jspvar="description">
@@ -107,7 +92,7 @@
                     <tr <c:if test="${useSwapStyle}">class="swap"</c:if> 
href="<mm:write referid="url"/>">
                        <td onclick="if(!blockSelect) {objClick(this);} 
blockSelect=false;">
                         <%-- use uploadedNodes and numberOfUploadedNodes in 
return url --%>
-                        <c:set 
var="returnUrl">/editors/resources/imageupload.jsp?uploadedNodes=<%=uploadedNodes%>&numberOfUploadedNodes=<%=numberOfUploadedNodes%>&uploadAction=${param.uploadAction}</c:set>
+                        <c:set 
var="returnUrl">/editors/resources/imageupload.jsp?uploadedNodes=${param.uploadedNodes}&uploadAction=${param.uploadAction}</c:set>
                    <c:choose>
                       <c:when test="${param.uploadAction == 'select'}">
                               <a href="<mm:url page="SecondaryEditAction.do">
@@ -125,11 +110,10 @@
                        </c:choose>
                                  <img src="../gfx/icons/page_edit.png" 
title="<fmt:message key="images.upload.edit"/>" alt="<fmt:message 
key="images.upload.edit"/>"/></a>
                      
-                                 <a href="<mm:url 
page="DeleteSecondaryContentAction.do" >
-                                                        <mm:param 
name="objectnumber"><mm:field name="number" /></mm:param>
-                                                        <mm:param 
name="object_type" value="imagesupload" />
-                                                     </mm:url>">
-                                 <img src="../gfx/icons/delete.png" 
alt="<fmt:message key="imagesearch.icon.delete" />" title="<fmt:message 
key="imagesearch.icon.delete" />"/></a>
+                        <a 
href="javascript:unpublish('${param.channelid}','${param.uploadedNodes}');"
+       title="<fmt:message key="asset.delete" />"><img 
src="../gfx/icons/delete.png" width="16" height="16"
+                                                         title="<fmt:message 
key="asset.delete" />"
+                                                         alt="<fmt:message 
key="asset.delete" />"/></a>
 
                         <a href="javascript:showInfo(<mm:field name="number" 
/>);" onclick="blockSelect = true;">
                               <img src="../gfx/icons/info.png" 
title="<fmt:message key="images.upload.info"/>" alt="<fmt:message 
key="images.upload.info"/>"/></a>
@@ -142,11 +126,9 @@
                     <c:set var="useSwapStyle">${!useSwapStyle}</c:set>
                     </mm:listnodes>
                 </mm:listnodescontainer>
-
             </tbody>
          </table>
-<% } %>
-
+</c:if>
          </div>
       </div>
 </mm:cloud>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to