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

Modified Files:
        attachmentsearch.jsp attachmentupload.jsp 
Removed Files:
        attachmentform.jsp 
Log Message:
CMSC-1208 Can delete attachements in channel with insuficient rights


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


Index: attachmentsearch.jsp
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- attachmentsearch.jsp        6 Jan 2009 05:01:20 -0000       1.22
+++ attachmentsearch.jsp        9 Jan 2009 03:32:26 -0000       1.23
@@ -3,118 +3,197 @@
 %><%...@page import="com.finalist.cmsc.repository.AssetElementUtil,
                  com.finalist.cmsc.repository.RepositoryUtil,
                  java.util.ArrayList"
-%><%...@page import="java.util.Iterator,
-   com.finalist.cmsc.mmbase.PropertiesUtil"
+%><%@ page import="com.finalist.cmsc.security.UserRole"
+%><%@ page import="com.finalist.cmsc.security.SecurityUtil"
 %><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.title">
-   <script src="../repository/search.js" type="text/javascript"></script>
-   <script src="../repository/content.js" type="text/javascript"></script>
+
+<mm:import externid="action">search</mm:import><%-- either: search, link, of 
select --%>
+<mm:import externid="mode" id="mode">basic</mm:import>
+<mm:import externid="returnurl"/>
+<mm:import externid="parentchannel" jspvar="parentchannel"/>
+<mm:import externid="assettypes" jspvar="assettypes"><%= 
AssetElementUtil.ASSETELEMENT %></mm:import>
+<mm:import externid="results" jspvar="nodeList" vartype="List" />
+<mm:import externid="offset" jspvar="offset" vartype="Integer">0</mm:import>
+<mm:import externid="resultCount" jspvar="resultCount" 
vartype="Integer">0</mm:import>
+
+<cmscedit:head title="search.title">
+      <link rel="stylesheet" href="<cmsc:staticurl 
page='../css/thumbnail.css'/>" type="text/css">
+      <script src="../repository/asset.js" language="JavaScript" 
type="text/javascript"></script>
+      <script src="search.js" type="text/javascript"></script>
    <script type="text/javascript">
-      function selectElement(element, title, src) {
-         if(window.top.opener != undefined) {
-            window.top.opener.selectElement(element, title, src);
-            window.top.close();
+               function showEditItems(id){
+                  document.getElementById('asset-info-'+id).style.display = 
'block';
+                  document.getElementById('asset-info-'+id).style.zIndex = 
2001;
          }
+               function hideEditItems(id){
+                  document.getElementById('asset-info-'+id).style.display = 
'none';
+                  document.getElementById('asset-info-'+id).style.zIndex = 
2000;
+               }
+               function changeMode(offset){
+                   if(offset==null){offset=0;}
+                   var assetsMode = document.getElementsByTagName("option");3
+                   for(i = 0; i < assetsMode.length; i++){
+                      if(assetsMode[i].selected & assetsMode[i].id=="a_list"){
+                          document.forms[0].searchShow.value = 'list';
+                          document.forms[0].submit();
+                          //document.location.href = 
'AssetSearchAction.do?type=asset&direction=down&searchShow=list&offset='+offset;
+                      }else if(assetsMode[i].selected & 
assetsMode[i].id=="a_thumbnail"){
+                          document.forms[0].searchShow.value = 'thumbnail';
+                          document.forms[0].submit();
+                         //document.location.href = 
'AssetSearchAction.do?type=asset&direction=down&searchShow=thumbnail&offset='+offset;
       }
-      
-      function showInfo(objectnumber) {
-         openPopupWindow('attachmentinfo', '500', '500', 
'attachmentinfo.jsp?objectnumber='+objectnumber);
         }
-      function confirmDelete(){
-         var checkboxs = document.getElementsByTagName("input");
-         var num = 0;
-         for (i = 0; i < checkboxs.length; i++) {
-           if (checkboxs[i].type == 'checkbox' && 
checkboxs[i].name.indexOf('chk_') == 0 && checkboxs[i].checked) {
-             num++;
-           }
-         }
-         if(num > 0){
-           del = confirm("<fmt:message key="secondaryedit.mass.sure"/> "+num+" 
<fmt:message key="secondaryedit.mass.elements"/> ?");
-           if(del){
-             document.forms['imageform'].submit();
            }
-         }else{
-             alert("<fmt:message key="secondaryedit.mass.atleast.delete"/> ");
+               function selectElement(element, title, src) {
+                   if(window.top.opener != undefined) {
+                      window.top.opener.selectElement(element, title, src);
+                      window.top.close();
          }
         }
    </script>
+    <c:if test="${not empty requestScope.refreshChannels}">
+        <script>
+        refreshFrame('channels');
+        </script>
+    </c:if>
 </cmscedit:head>
 <body>
-   <mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
-   <mm:import externid="action">search</mm:import><%-- either: search of 
select --%>
+<mm:import id="assetsearchinit"><c:url 
value='/editors/repository/AssetSearchInitAction.do'/></mm:import>
 
+<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
+<c:if test="${empty strict}">
       <div class="tabs">
+    <!-- active TAB -->
          <div class="tab_active">
             <div class="body">
                <div>
-                  <a href="#"><fmt:message key="attachments.title" /></a>
+            <a href="#"><fmt:message key="asset.search.title" /></a>
                </div>
             </div>
          </div>
          <div class="tab">
             <div class="body">
                <div>
-                  <a 
href="attachmentupload.jsp?uploadAction=${action}&channelid=${channelid}"><fmt:message
 key="attachments.upload.title" /></a>
-               </div>
+               <a 
href="../resources/attachmentupload.jsp?uploadAction=${action}&parentchannel=${parentchannel}&insertAsset=insertAsset"
 ><fmt:message key="asset.upload.title" /></a>
             </div>
          </div>
       </div>
-      <div class="editor" style="height:500px">
+</c:if>
+</div>
+   <div class="editor">
+   <br />
          <div class="body">
-            <mm:import id="searchinit"><c:url 
value='/editors/resources/AttachmentInitAction.do'/></mm:import>
-            <html:form action="/editors/resources/AttachmentAction" 
method="post">
+         <html:form 
action="/editors/repository/InsertAssetSearchAction?insertAsset=insertAsset" 
method="post">
                <html:hidden property="action" value="${action}"/>
+            <html:hidden property="mode"/>
+            <html:hidden property="search" value="true"/>
                <html:hidden property="offset"/>
                <html:hidden property="order"/>
+            <html:hidden property="searchShow" value="${searchShow}"/>
+            <html:hidden property="insertAsset" value="${insertAsset}"/>
                <html:hidden property="direction"/>
-               <mm:import id="contenttypes" 
jspvar="contenttypes">attachments</mm:import>
-               <%...@include file="attachmentform.jsp" %>
+            <input type="hidden" name="deleteAssetRequest"/>
+            <c:if test="${not empty strict}">
+               <input type="hidden" name="assettypes" value="${strict}"/>
+               <input type="hidden" name="strict" value="${strict}"/>
+            </c:if>
+            <mm:present referid="returnurl"><input type="hidden" 
name="returnurl" value="<mm:write referid="returnurl"/>"/></mm:present>
+            <table>
+               <tr>
+                  <td style="width:105px"><fmt:message key="searchform.title" 
/></td>
+                  <td colspan="5"><html:text property="title" 
style="width:200px"/></td>
+               </tr>
+               <tr>
+                     <td></td>
+                     <td>
+                        <input type="submit" class="button" 
name="submitButton" onclick="setOffset(0);" value="<fmt:message 
key="searchform.submit" />"/>
+                     </td>
+               </tr>
+            </table>
             </html:form>
          </div>
+   </div>
 
-         <div class="ruler_green"><div><fmt:message key="attachments.results" 
/></div></div>
+   <div class="editor" style="height:500px">
+   <div class="ruler_green"><div><fmt:message key="searchform.results" 
/></div></div>
 
          <div class="body">
-            <mm:import externid="results" jspvar="nodeList" vartype="List" />
-            <mm:import externid="resultCount" jspvar="resultCount" 
vartype="Integer">0</mm:import>
-            <mm:import externid="offset" jspvar="offset" 
vartype="Integer">0</mm:import>
-            <c:if test="${resultCount > 0}">
+   <div style="padding-left:11px">
+      <select name="assesMode" 
onchange="javascript:changeMode(${param.offset})">
+         <c:if test="${empty searchShow || searchShow eq 'list'}">
+            <option id="a_list" selected="selected">list</option>
+            <option id = "a_thumbnail" >thumbnail</option>
+         </c:if>
+         <c:if test="${searchShow eq 'thumbnail'}">
+            <option id="a_list">list</option>
+            <option id = "a_thumbnail" selected="selected" >thumbnail</option>
+         </c:if>
+      </select>
+   </div>
+
+<!-- we check to see if we have workflow, this is done by looking if the 
editors for the workflow are on the HD -->
+<c:set var="hasWorkflow" value="false"/>
+<mm:haspage page="/editors/workflow">
+   <c:set var="hasWorkflow" value="true"/>
+</mm:haspage>
+
+   <%-- Now print if no results --%>
+   <mm:isempty referid="results">
+      <fmt:message key="searchform.searchpages.nonefound" />
+   </mm:isempty>
+
+   <%-- Now print the results --%>
+   <mm:node number="<%= RepositoryUtil.ALIAS_TRASH %>">
+      <mm:field id="trashnumber" name="number" write="false"/>
+   </mm:node>
+
+<c:if test="${searchShow eq 'list'}">
+   <mm:list referid="results">
+      <mm:first>
                <%...@include file="../repository/searchpages.jsp" %>
-               <form 
action="SecondaryContentMassDeleteAction.do?object_type=attachments" 
method="post" name="attachform">
-                  <table>
-                     <tr>
+            <mm:hasrank minvalue="siteadmin">
                         <c:if test="${fn:length(results) >1}">
-                           <th><input type="submit" 
onclick="confirmDelete();return false;" value="<fmt:message 
key="secondaryedit.mass.delete"/>"/></th>
+               <div align="left">
+                  <input type="submit" class="button" name="massdelete" 
+                        
onclick="javascript:deleteAsset('massdelete','<fmt:message 
key="recyclebin.massremoveconfirm"/>')"
+                        value="<fmt:message key="asset.delete.massdelete" />"/>
+               </div>
                         </c:if>
-                     </tr>
-                     <tr class="listheader">
+            </mm:hasrank>
+         <form action="" name="linkForm" method="post">
+            <table>
+            <thead>
+               <tr>
                         <th>
+                     <mm:present referid="returnurl"><input type="hidden" 
name="returnurl" value="<mm:write referid="returnurl"/>"/></mm:present>
                            <c:if test="${fn:length(results) >1}">
-                              <input type="checkbox"  name="selectall"  
onclick="selectAll(this.checked, 'attachform', 'chk_');" value="on"/>
+                        <input type="checkbox" 
onclick="selectAll(this.checked, 'linkForm', 'chk_');" value="on" 
name="selectall" />
                            </c:if>
                         </th>
-                        <th nowrap="true"><a 
href="javascript:orderBy('title')" class="headerlink" ><fmt:message 
key="attachmentsearch.titlecolumn" /></a></th>
-                        <th nowrap="true"><a 
href="javascript:orderBy('filename')" class="headerlink" ><fmt:message 
key="attachmentsearch.filenamecolumn" /></a></th>
-                        <th nowrap="true"><fmt:message 
key="locate.creationchannelcolumn" /></th>
-                        <th nowrap="true"><a 
href="javascript:orderBy('size')"><fmt:message 
key="attachmentsearch.filesizecolumn" /></a></th>
-                        <th nowrap="true"><a 
href="javascript:orderBy('mimetype')" class="headerlink" ><fmt:message 
key="attachmentsearch.mimetypecolumn" /></a></th>
+                  <th><a href="javascript:orderBy('otype')" class="headerlink" 
><fmt:message key="locate.typecolumn" /></a></th>
+                  <th><a href="javascript:orderBy('title')" class="headerlink" 
><fmt:message key="locate.titlecolumn" /></a></th>
+                  <th><fmt:message key="locate.creationchannelcolumn" /></th>
+                  <th><a href="javascript:orderBy('creator')" 
class="headerlink" ><fmt:message key="locate.authorcolumn" /></th>
+                  <th><a href="javascript:orderBy('lastmodifieddate')" 
class="headerlink" ><fmt:message key="locate.lastmodifiedcolumn" /></th>
+                  <th><a href="javascript:orderBy('number')" 
class="headerlink" ><fmt:message key="locate.numbercolumn" /></th>
                      </tr>
+            </thead>
+
                      <tbody class="hover">
-                     <mm:node number="<%= RepositoryUtil.ALIAS_TRASH %>">
-                        <mm:field id="trashnumber" name="number" 
write="false"/>
-                     </mm:node>
+      </mm:first>
+
+   <mm:field name="${assettypes}.number" id="number" write="false">
+      <mm:node number="${number}">
                         <c:set var="useSwapStyle">true</c:set>
-                        <mm:listnodes referid="results">
-                        <mm:field name="number" jspvar="channelNumber" 
write="false"/>
-                        <cmsc:rights nodeNumber="${channelNumber}" 
var="rights"/>
                         <mm:relatednodes role="creationrel" 
type="contentchannel">
                            <c:set var="creationRelNumber"><mm:field 
name="number" id="creationnumber"/></c:set>
                            <mm:compare referid="trashnumber" 
referid2="creationnumber">
                               <c:set var="channelName"><fmt:message 
key="search.trash" /></c:set>
                               <c:set var="channelIcon" 
value="/editors/gfx/icons/trashbin.png"/>
                               <c:set var="channelIconMessage"><fmt:message 
key="search.trash" /></c:set>
+                <c:set var="channelUrl" value="../recyclebin/assettrash.jsp"/>
                            </mm:compare>
                            <mm:field name="number" jspvar="channelNumber" 
write="false"/>
                            <cmsc:rights nodeNumber="${channelNumber}" 
var="rights"/>
@@ -122,71 +201,157 @@
                               <mm:field name="name" jspvar="channelName" 
write="false"/>
                               <c:set var="channelIcon" 
value="/editors/gfx/icons/type/contentchannel_${rights}.png"/>
                               <c:set var="channelIconMessage"><fmt:bundle 
basename="cmsc-security"><fmt:message key="role.${rights}" 
/></fmt:bundle></c:set>
+                <c:set var="channelUrl" 
value="Asset.do?type=asset&parentchannel=${channelNumber}&direction=down"/>
                            </mm:compare>
                         </mm:relatednodes>
-                           <mm:import 
id="url">javascript:selectElement('<mm:field name="number"/>', '<mm:field 
name="title" escape="js-single-quotes"/>','<mm:attachment 
escape="js-single-quotes"/>');</mm:import>
-                           <tr <c:if 
test="${useSwapStyle}">class="swap"</c:if> href="<mm:write referid="url"/>">
-                              <td style="white-space:nowrap;">
-                                 <c:if test="${(rights == 'writer' || rights 
== 'chiefeditor' || rights == 'editor' || rights == 'webmaster') && 
fn:length(results) >1}">
-                                    <input type="checkbox"  
name="chk_<mm:field name="number" />" value="<mm:field name="number" />" 
onClick="document.forms['attachform'].elements.selectall.checked=false;"/>
-                                 </c:if>
-                                 <c:if test="${action != 'select'}">
-                                    <a href="<mm:url 
page="../WizardInitAction.do">
-                                       <mm:param name="objectnumber"><mm:field 
name="number" /></mm:param>
-                                       <mm:param name="returnurl" 
value='<%="../editors/resources/AttachmentAction.do" + 
request.getAttribute("geturl")%>' />
-                                       </mm:url>"><img 
src="../gfx/icons/page_edit.png" alt="<fmt:message 
key="attachmentsearch.icon.edit" />" title="<fmt:message 
key="attachmentsearch.icon.edit" />"/></a>
-                                    <a href="javascript:showInfo(<mm:field 
name="number" />)"><img src="../gfx/icons/info.png" alt="<fmt:message 
key="attachmentsearch.icon.info" />" title="<fmt:message 
key="attachmentsearch.icon.info" />" /></a>
-                                    <mm:hasrank minvalue="administrator">
-                                       <a href="<mm:url 
page="DeleteSecondaryContentAction.do" >
-                                          <mm:param name="object_type" 
value="attachments"/>
-                                          <mm:param 
name="objectnumber"><mm:field name="number" /></mm:param>
-                                          <mm:param name="returnurl" 
value='<%="/editors/resources/AttachmentAction.do" + 
request.getAttribute("geturl")%>' />
-                                       </mm:url>"><img 
src="../gfx/icons/delete.png" alt="<fmt:message 
key="attachmentsearch.icon.delete" />" title="<fmt:message 
key="attachmentsearch.icon.delete" />"/></a>
-                                    </mm:hasrank>
+<c:set var="assettype" ><mm:nodeinfo type="type"/></c:set>
+<c:if test="${assettype == 'attachments'}">
+         <mm:import id="url">
+            javascript:selectElement('<mm:field name="number"/>', '<mm:field 
name="title" escape="js-single-quotes"/>',
+                                       '<mm:attachment 
escape="js-single-quotes"/>');
+         </mm:import>
+</c:if>
+         <tr <mm:even inverse="true">class="swap"</mm:even> href="<mm:write 
referid="url"/>">
+            <td style="white-space: nowrap;">
+                  <c:if test="${creationRelNumber == trashnumber && rights == 
'webmaster' && fn:length(results) >1}">
+                      <input type="checkbox" value="permanentDelete:<mm:field 
name="number" />" name="chk_<mm:field name="number" />" 
onClick="document.forms['linkForm'].elements.selectall.checked=false;"/>
                                  </c:if>
+                  <c:if test="${creationRelNumber != trashnumber && (rights == 
'writer' || rights == 'chiefeditor' || rights == 'editor' || rights == 
'webmaster') && fn:length(results) >1}">
+                    <input type="checkbox" value="moveToRecyclebin:<mm:field 
name="number" />" name="chk_<mm:field name="number" />" 
onClick="document.forms['linkForm'].elements.selectall.checked=false;"/>
+                  </c:if>
+               <%@ include file="../repository/searchIconsBar.jspf" %>
                               </td>
-                              <td onMouseDown="objClick(this);"><mm:field 
name="title"/></td>
-                              <td onMouseDown="objClick(this);"><mm:field 
name="filename"/></td>
                               <td style="white-space: nowrap;" 
onMouseDown="objClick(this);">
-                                 <img src="<cmsc:staticurl 
page="${channelIcon}"/>" align="top" alt="${channelIconMessage}" />
-                                    ${channelName}</a>
+               <mm:nodeinfo type="guitype"/>
                               </td>
-                              <td onMouseDown="objClick(this);">
-                                 <mm:field name="size" jspvar="filesize" 
write="false"/>
-                                 <c:choose>
-                                    <c:when test="${filesize lt 2048}">
-                                       <fmt:formatNumber value="${filesize}" 
pattern=""/> byte 
-                                    </c:when>
-                                    <c:when test="${filesize ge 2048 && 
filesize le(2*1024*1024)}">
-                                       <fmt:formatNumber value="${filesize div 
1024}" pattern=".0"/> K 
-                                    </c:when>
-                                    <c:otherwise>
-                                       <fmt:formatNumber value="${filesize div 
(1024 * 1024)}" pattern=".0"/> M 
-                                    </c:otherwise>
-                                 </c:choose>
+            <td style="white-space: nowrap;" 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="mimetype"/></td>
-                           </tr>
-                           <c:set var="useSwapStyle">${!useSwapStyle}</c:set>
+            <td style="white-space: nowrap;" onMouseDown="objClick(this);">
+                <img src="<cmsc:staticurl page="${channelIcon}"/>" align="top" 
alt="${channelIconMessage}" />
+                  <mm:compare referid="action" value="search">
+                     <a href="${channelUrl}">${channelName}</a>
+                  </mm:compare>
+                  <mm:compare referid="action" value="search" inverse="true">
+                     ${channelName}
+                  </mm:compare>
+            </td>
+            <td style="white-space: nowrap;" 
onMouseDown="objClick(this);"><mm:field name="creator" /></td>
+            <td style="white-space: nowrap;" 
onMouseDown="objClick(this);"><mm:field 
name="lastmodifieddate"><cmsc:dateformat displaytime="true" /></mm:field></td>
+            <td  style="white-space: nowrap;" 
onMouseDown="objClick(this);"><mm:field name="number"/></td>
+            <c:if test="${hasWorkflow}">
+               <td width="10" onMouseDown="objClick(this);">
+                  <c:set var="status" value="waiting"/>
+                  <mm:relatednodes type="workflowitem" 
constraints="type='asset'">
+                     <c:set var="status"><mm:field name="status"/></c:set>
+                  </mm:relatednodes>
+                  <c:if test="${status == 'waiting'}">
+                     <mm:listnodes type="remotenodes" 
constraints="sourcenumber=${number}">
+                        <c:set var="status" value="onlive"/>
                         </mm:listnodes>
-                     </tbody>
-                     <tr>
-                        <c:if test="${fn:length(results) >1}">
-                           <th><input type="submit" 
onclick="confirmDelete();return false;" value="<fmt:message 
key="secondaryedit.mass.delete"/>"/></th>
+                  </c:if>
+                     <img src="../gfx/icons/status_${status}.png"
+                        alt="<fmt:message key="asset.status" />: <fmt:message 
key="asset.status.${status}" />"
+                        title="<fmt:message key="asset.status" />: 
<fmt:message key="asset.status.${status}" />"/>
+               </td>
                         </c:if>
                      </tr>
+      </mm:node>
+   </mm:field>
+   <mm:last>
+   </tbody>
                   </table>
                </form>
+   <mm:hasrank minvalue="siteadmin">
+      <c:if test="${fn:length(results) >1}">
+      <div align="left">
+         <input type="submit" class="button" name="massdelete" 
+               onclick="javascript:deleteAsset('massdelete','<fmt:message 
key="recyclebin.massremoveconfirm"/>')"
+               value="<fmt:message key="asset.delete.massdelete" />"/>
+      </div>
             </c:if>
-            <c:if test="${resultCount == 0 && param.title != null}">
-               <fmt:message key="attachmentsearch.noresult" />
-            </c:if>
-            <c:if test="${resultCount > 0}">
+   </mm:hasrank>
+         <%...@include file="../repository/searchpages.jsp" %>
+   </mm:last>
+   </mm:list>
+</c:if>
+
+<c:if test="${searchShow eq 'thumbnail'}">
+   <mm:list referid="results">
+      <mm:first>
                <%...@include file="../repository/searchpages.jsp" %>
+      </mm:first>
+
+   <mm:field name="${assettypes}.number" id="number" write="false">
+      <mm:node number="${number}">
+
+         <mm:relatednodes role="creationrel" type="contentchannel">
+            <c:set var="creationRelNumber"><mm:field name="number" 
id="creationnumber"/></c:set>
+            <mm:field name="number" jspvar="channelNumber" write="false"/>
+            <cmsc:rights nodeNumber="${channelNumber}" var="rights"/>
+         </mm:relatednodes>
+
+         <div class="thumbnail_show" 
onMouseOut="javascript:hideEditItems(<mm:field name='number'/>)" 
onMouseOver="showEditItems(<mm:field name='number'/>)">
+            <div class="thumbnail_operation">
+               <div class="asset-info" id="asset-info-<mm:field 
name='number'/>" style="display: none; position: relative; border: 1px solid 
#eaedff" >
+               <%@ include file="../repository/searchIconsBar.jspf" %>
+               </div>
+            </div>
+            <div class="thumbnail_body" >
+               <div class="thumbnail_img" onMouseOver="this.style.background = 
'yellow';" onMouseOut="this.style.background = 'white';">
+                   <a href="javascript:showInfo('<mm:nodeinfo type="type"/>', 
'<mm:field name="number" />')">
+                     <c:set var="typedef" ><mm:nodeinfo type="type"/></c:set>
+                     <c:if test="${typedef eq 'images'}">
+                        <img src="<mm:image template="s(120x100)"/>" alt=""/>
+                     </c:if> 
+                     <c:if test="${typedef eq 'attachments'}">
+                        <c:set var="filename"><mm:field 
name="filename"/></c:set>
+                        <c:set var="subfix">${fn:substringAfter(filename, 
'.')}</c:set>
+                        <mm:haspage page="../gfx/${subfix}${'.gif'}" 
inverse="false">
+                           <img src="../gfx/${subfix}${'.gif'}" alt=""/>
+                        </mm:haspage> 
+                        <mm:haspage page="../gfx/${subfix}${'.gif'}" 
inverse="true">
+                           <img src="../gfx/otherAttach.gif" alt=""/>
+                        </mm:haspage>
+                     </c:if>
+                     <c:if test="${typedef eq 'urls'}">
+                        <img src="../gfx/url.gif" alt=""/>
+                     </c:if>
+                  </a>
+               </div>
+               <div class="thumnail_info">
+                  <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) > 15}">
+                                 <c:set 
var="title">${fn:substring(title,0,14)}...</c:set>
+                              </c:if>${title}
+                              <c:if test="${ assettype == 'images'}">
+                              <br/><mm:field name="itype" />
+                              </c:if>
+               </div>
+            </div>
          </div>
+      </mm:node>
+   </mm:field>
+   </mm:list>
+   <div style="clear:both;"></div>
+         <%...@include file="../repository/searchpages.jsp" %>
+</c:if>
+</div>
       </div>
-   </mm:cloud>
-</body>
+</mm:cloud>
+
+   </body>
 </html:html>
 </mm:content>
\ No newline at end of file


Index: attachmentupload.jsp
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentupload.jsp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- attachmentupload.jsp        6 Jan 2009 07:59:42 -0000       1.12
+++ attachmentupload.jsp        9 Jan 2009 03:32:26 -0000       1.13
@@ -1,10 +1,14 @@
 <%...@page language="java" contentType="text/html;charset=utf-8"
 %><%...@include file="globals.jsp" %><%...@page 
import="com.finalist.util.http.BulkUploadUtil"
+%><%@ page import="com.finalist.cmsc.repository.RepositoryUtil"
+%><%@ page import="com.finalist.cmsc.security.*"
 %><%...@page import="java.util.List"
 %> <mm:content type="text/html" encoding="UTF-8" expires="0">
+<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
 <!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">
+         <mm:import externid="parentchannel" jspvar="parentchannel" 
vartype="Integer" from="parameters" >${sessionScope.creation}</mm:import>
+<cmscedit:head title="asset.upload.title">
   <script src="../repository/search.js" type="text/javascript"></script>
   <script type="text/javascript">
     function upload() {
@@ -16,57 +20,29 @@
         document.getElementById("notbusy").style.visibility="hidden";
     }
 
-
-   function showInfo(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;
+   function showInfo(assetType, objectnumber) {
+             var infoURL;
+             infoURL = '../resources/';
+             infoURL += 
assetType.toLowerCase().substring(0,assetType.length-1);
+             infoURL += 'info.jsp?objectnumber=';
+             infoURL += objectnumber;
+             openPopupWindow(assetType.toLowerCase()+'info', '900', '500', 
infoURL);
    }
 
     var blockSelect = false;
   </script>
 </cmscedit:head>
 <body>
-<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
       <div class="editor" style="height:580px">
           <div class="body">
-              <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 style="color:red;"><fmt:message 
key="attachment.upload.notattachment" /></td>
-                     </tr>
-                  </c:if>
-                  <tr>
-                     <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>
-               </html:form>
+<mm:node number="${parentchannel}" jspvar="parentchannelnode">
+               <% UserRole role = RepositoryUtil.getRole(cloud, 
parentchannelnode, false); %>
+               <% if (role != null && SecurityUtil.isWriter(role)) { %>
+               <%@ include file="../repository/assetupload.jsp" %>
+               <%} %>
+</mm:node>
           </div>
-          <div class="ruler_green"><div><fmt:message 
key="attachments.upload.results" /></div></div>
+          <div class="ruler_green"><div><fmt:message 
key="assets.upload.results" /></div></div>
 
           <div class="body">
             <div id="busy">
@@ -82,7 +58,7 @@
    </tr>
    <tbody class="hover">
       <c:set var="useSwapStyle">true</c:set>
-      <mm:listnodescontainer path="attachments" nodes="${param.uploadedNodes}">
+      <mm:listnodescontainer path="assetelement" 
nodes="${param.uploadedNodes}">
          <mm:listnodes>
 
                <mm:field name="title" escape="js-single-quotes" jspvar="title">
@@ -98,7 +74,7 @@
             <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:set 
var="returnUrl">/editors/resources/attachmentupload.jsp?uploadedNodes=${param.uploadedNodes}&uploadAction=${param.uploadAction}&insertAsset=insertAsset</c:set>
                   <c:choose>
                      <c:when test="${param.uploadAction == 'select'}">
                         <a href="<mm:url page="SecondaryEditAction.do">
@@ -114,13 +90,18 @@
                            </mm:url>">
                      </c:otherwise>
                   </c:choose>
-                           <img src="../gfx/icons/page_edit.png" 
title="<fmt:message key="attachments.upload.edit"/>" alt="<fmt:message 
key="attachments.upload.edit"/>"/>
+                           <img src="../gfx/icons/page_edit.png" 
title="<fmt:message key="assets.upload.edit"/>" alt="<fmt:message 
key="assets.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"/>"/>
+                        <c:set 
var="returnUrl">/editors/resources/attachmentupload.jsp?uploadAction=select&insertAsset=insertAsset&parentchannel=${param.parentchannel}</c:set>
+                        <a href="javascript:showInfo('<mm:nodeinfo 
type="type"/>',<mm:field name="number" />);" onclick="blockSelect = true;">
+                           <img src="../gfx/icons/info.png" 
title="<fmt:message key="assets.upload.info"/>" alt="<fmt:message 
key="assets.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"
+                        <a href="<mm:url 
page="../repository/AssetDeleteAction.do">
+                           <mm:param name="channelnumber" 
value="${param.parentchannel}"/>
+                           <mm:param name="objectnumber" 
value="${param.uploadedNodes}" />
+                           <mm:param name="returnurl" value="${returnUrl}"/>
+                           </mm:url>" onclick="blockSelect = true">
+                              <img src="../gfx/icons/delete.png" width="16" 
height="16"
                            alt="<fmt:message key="asset.delete" />"/>
                         </a>
                </td>
@@ -146,7 +127,7 @@
 </c:if>
          </div>
       </div>
-</mm:cloud>
 </body>
 </html:html>
+</mm:cloud>
 </mm:content>
\ No newline at end of file


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

Reply via email to