Update of
/var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources
In directory james.mmbase.org:/tmp/cvs-serv4889/webapp/editors/resources
Modified Files:
attachmentupload.jsp
Log Message:
CMSC-681 Asset Maintenance code refacted
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: attachmentupload.jsp
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentupload.jsp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- attachmentupload.jsp 24 Sep 2008 06:06:33 -0000 1.11
+++ attachmentupload.jsp 6 Jan 2009 07:59:42 -0000 1.12
@@ -1,17 +1,14 @@
<%...@page language="java" contentType="text/html;charset=utf-8"
-%><%...@include file="globals.jsp"
-%><%...@page import="com.finalist.util.http.BulkUploadUtil"
-%><mm:content type="text/html" encoding="UTF-8" expires="0">
+%><%...@include file="globals.jsp" %><%...@page
import="com.finalist.util.http.BulkUploadUtil"
+%><%...@page import="java.util.List"
+%> <mm:content type="text/html" encoding="UTF-8" expires="0">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html:html xhtml="true">
<cmscedit:head title="attachments.upload.title">
<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() {
@@ -19,91 +16,73 @@
document.getElementById("notbusy").style.visibility="hidden";
}
+
function showInfo(objectnumber) {
- openPopupWindow('attachmentinfo', '500', '500',
'attachmentinfo.jsp?objectnumber='+objectnumber);
+ openPopupWindow('attachmentinfo', '900', '500',
'attachmentinfo.jsp?objectnumber='+objectnumber);
}
+
+ function unpublish(parentchannel, objectnumber) {
+ var url = "../repository/AttachmentDeleteAction.do";
+ url += "?channelnumber=" + parentchannel;
+ url += "&objectnumber=" + objectnumber;
+ document.location.href = url;
+ }
+
+ var blockSelect = false;
</script>
</cmscedit:head>
<body>
-<mm:cloud jspvar="cloud" >
- <div class="tabs">
- <div class="tab">
+<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
+ <div class="editor" style="height:580px">
<div class="body">
- <div>
- <a
href="attachmentsearch.jsp?action=${param.uploadAction}"><fmt:message
key="attachments.title" /></a>
- </div>
- </div>
- </div>
- <div class="tab_active">
- <div class="body">
- <div>
- <a href="#"><fmt:message key="attachments.upload.title"
/></a>
- </div>
- </div>
- </div>
- </div>
-
- <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/AttachmentUploadAction.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="attachments.upload.explanation"
/></td>
</tr>
+ <c:if test="${param.exist=='1'}">
+ <tr>
+ <td style="color:red;"><fmt:message
key="asset.upload.existed" /></td>
+ </tr>
+ </c:if>
+ <c:if test="${param.exceed=='yes'}">
+ <tr>
+ <td style="color:red;"><fmt:message
key="asset.upload.exceed" /></td>
+ </tr>
+ </c:if>
+ <c:if test="${param.uploadedNodes=='0' && param.exist ==
'0'}">
<tr>
- <td><input type="file" name="zipfile"/></td>
+ <td style="color:red;"><fmt:message
key="attachment.upload.notattachment" /></td>
</tr>
+ </c:if>
<tr>
- <td><input type="button" name="uploadButton"
onclick="upload();"
- value="<fmt:message
key="attachments.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="attachments.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("attachments");
- 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="attachments.upload.error"/></p>
-<% } else if (numberOfUploadedNodes > 0) { %>
- <p id="notbusy"><fmt:message key="attachments.upload.result">
- <fmt:param value="<%= numberOfUploadedNodes %>"/>
- </fmt:message>
- </p>
- <table>
+<c:if test="${param.exist =='0' && param.uploadedNodes != 0}">
+<table>
<tr class="listheader">
<th></th>
<th nowrap="true"><fmt:message
key="attachmentsearch.titlecolumn" /></th>
<th><fmt:message key="attachmentsearch.filenamecolumn" /></th>
+ <th></th>
</tr>
<tbody class="hover">
<c:set var="useSwapStyle">true</c:set>
-
- <mm:listnodescontainer path="attachments" nodes="<%=
uploadedNodes %>">
+ <mm:listnodescontainer path="attachments" nodes="${param.uploadedNodes}">
<mm:listnodes>
<mm:field name="title" escape="js-single-quotes" jspvar="title">
@@ -115,11 +94,11 @@
<mm:import id="url">javascript:selectElement('<mm:field
name="number"/>', '<%=title%>', '<%=attachment%>');</mm:import>
</mm:attachment>
</mm:field>
- <tr <c:if test="${useSwapStyle}">class="swap"</c:if>
href="<mm:write referid="url"/>">
- <td>
- <%-- use uploadedNodes and numberOfUploadedNodes in
return url --%>
- <c:set
var="returnUrl">/editors/resources/attachmentupload.jsp?uploadedNodes=<%=uploadedNodes%>&numberOfUploadedNodes=<%=numberOfUploadedNodes%>&uploadAction=${param.uploadAction}</c:set>
+ <tr <c:if test="${useSwapStyle}">class="swap"</c:if>
href="<mm:write referid="url"/>">
+ <td >
+<%-- use uploadedNodes and numberOfUploadedNodes in return url --%>
+ <c:set
var="returnUrl">/editors/resources/attachmentupload.jsp?uploadedNodes=${param.uploadedNodes}&uploadAction=${param.uploadAction}</c:set>
<c:choose>
<c:when test="${param.uploadAction == 'select'}">
<a href="<mm:url page="SecondaryEditAction.do">
@@ -131,33 +110,42 @@
<c:otherwise>
<a href="<mm:url page="../WizardInitAction.do">
<mm:param
name="objectnumber"><mm:field name="number" /></mm:param>
- <mm:param name="returnurl"
value="${returnUrl}" />
+ <mm:param name="returnurl" value="${returnUrl }" />
</mm:url>">
</c:otherwise>
</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="attachmentsupload" />
- </mm:url>">
- <img src="../gfx/icons/delete.png" alt="<fmt:message
key="attachmentsearch.icon.delete" />" title="<fmt:message
key="attachmentsearch.icon.delete" />"/></a>
-
- <a href="javascript:showInfo(<mm:field name="number"
/>)">
- <img src="../gfx/icons/info.png"
title="<fmt:message key="images.upload.info"/>" alt="<fmt:message
key="images.upload.info"/>"/></a>
+ <img src="../gfx/icons/page_edit.png"
title="<fmt:message key="attachments.upload.edit"/>" alt="<fmt:message
key="attachments.upload.edit"/>"/>
+ </a>
+ <a href="javascript:showInfo(<mm:field name="number"
/>);" onclick="blockSelect = true;">
+ <img src="../gfx/icons/info.png"
title="<fmt:message key="attachments.upload.info"/>" alt="<fmt:message
key="attachments.upload.info"/>"/>
+ </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"
+ alt="<fmt:message key="asset.delete" />"/>
+ </a>
+ </td>
+ <td onMouseDown="objClick(this);">
+ <c:set var="assettype" ><mm:nodeinfo type="type"/></c:set>
+ <mm:field id="title" write="false" name="title"/>
+ <c:if test="${assettype == 'urls'}">
+ <c:set var="title" ><mm:field name="name"/></c:set>
+ </c:if>
+ <c:if test="${fn:length(title) > 50}">
+ <c:set var="title">${fn:substring(title,0,49)}...</c:set>
+ </c:if>
+ ${title}
</td>
- <td onMouseDown="objClick(this);"><mm:field
name="title"/></td>
- <td onMouseDown="objClick(this);"><mm:field
name="filename"/></td>
+ <td onMouseDown="objClick(this);">${title}</td>
+ <td onMouseDown="objClick(this);"></td>
</tr>
<c:set var="useSwapStyle">${!useSwapStyle}</c:set>
</mm:listnodes>
</mm:listnodescontainer>
-
</tbody>
- </table>
-<% } %>
-</div>
-</div>
+</table>
+</c:if>
+ </div>
+ </div>
</mm:cloud>
</body>
</html:html>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs