Changeset 7760
- Timestamp:
- Nov 27, 2019, 2:37:26 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/fileviewer/FileViewerUtil.java
r7759 r7760 24 24 private final FileViewerContext fileContext; 25 25 private final ExtensionsInvoker<ButtonAction> fileActions; 26 private String prefix = "["; 27 private String suffix = "]"; 26 28 27 29 public FileViewerUtil(JspContext jspContext, FileViewerContext fileContext) … … 50 52 51 53 /** 54 Sets a prefix and suffix string to use before and after the list of actions. 55 The default is "[" and "]". 56 */ 57 public void setPrefixAndSuffix(String prefix, String suffix) 58 { 59 this.prefix = prefix; 60 this.suffix = suffix; 61 } 62 63 /** 52 64 Rended the extensions with the current file context information. 53 65 */ … … 68 80 if (result != null && result.length() > 0) 69 81 { 70 jspContext.getOut().write("<span class=\"file-actions\"> [" + result + "]</span>");82 jspContext.getOut().write("<span class=\"file-actions\">" + prefix + result + suffix + "</span>"); 71 83 } 72 84 } -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/fileviewer/ViewAndDownloadActionFactory.java
r7758 r7760 3 3 import net.sf.basedb.clients.web.extensions.AbstractJspActionFactory; 4 4 import net.sf.basedb.clients.web.extensions.JspContext; 5 import net.sf.basedb.clients.web.extensions.fileviewer.FileViewerContext.Type; 5 6 import net.sf.basedb.clients.web.extensions.toolbar.ButtonAction; 6 7 import net.sf.basedb.clients.web.extensions.toolbar.ButtonBean; … … 34 35 if (l == Location.OFFLINE) 35 36 { 36 ButtonBean offline = new ButtonBean(); 37 offline.setVisible(true); 38 offline.setIcon(jspContext.getRoot()+"/images/offline.png"); 39 offline.setTitle("This file is offline"); 40 actions = new ButtonAction[] { offline }; 37 if (fctx.getType() == Type.FILE) 38 { 39 // Here we add an "Upload" action 40 ButtonBean upload = new ButtonBean(); 41 upload.setVisible(true); 42 upload.setClazz("link auto-init"); 43 upload.setIcon(jspContext.getRoot()+"/images/upload.png"); 44 upload.setTitle("Upload this file again"); 45 upload.setDynamicAttribute("data-file-id", f.getId()); 46 upload.setDynamicAttribute("data-auto-init", "upload-file"); 47 actions = new ButtonAction[] { upload }; 48 } 49 else 50 { 51 ButtonBean offline = new ButtonBean(); 52 offline.setVisible(true); 53 offline.setIcon(jspContext.getRoot()+"/images/offline.png"); 54 offline.setTitle("This file is offline"); 55 actions = new ButtonAction[] { offline }; 56 } 41 57 } 42 58 else if (l.isDownloadable()) -
trunk/www/common/datafiles/list_files.jsp
r7757 r7760 229 229 <base:page type="include"> 230 230 <base:body> 231 <ext:scripts context="<%=jspContext%>" />231 <ext:scripts context="<%=jspContext%>" /> 232 232 <base:section 233 233 id="datafiles" -
trunk/www/filemanager/files/list_files.jsp
r7703 r7760 72 72 import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" 73 73 import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" 74 import="net.sf.basedb.clients.web.extensions.fileviewer.FileViewerUtil" 75 import="net.sf.basedb.clients.web.extensions.fileviewer.FileViewerContext" 74 76 import="net.sf.basedb.util.extensions.ExtensionsInvoker" 75 77 import="java.util.Iterator" … … 253 255 ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext); 254 256 ExtensionsInvoker<ListColumnAction<File,?>> columnsInvoker = ListColumnUtil.useExtensions(jspContext); 257 FileViewerContext fileContext = FileViewerContext.file(); 258 FileViewerUtil fileViewer = new FileViewerUtil(jspContext, fileContext); 259 fileViewer.setPrefixAndSuffix("", ""); 255 260 %> 256 261 <base:page title="<%=title==null ? "Files" : title%>" type="iframe" id="list-page"> … … 837 842 { 838 843 File item = files.next(); 844 fileContext.setCurrentFile(item); 839 845 int itemId = item.getId(); 840 846 Location location = item.getLocation(); … … 976 982 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 977 983 <tbl:cell column="lastUpdate" value="<%=item.getLastUpdate()%>" /> 978 <tbl:cell column="actions"> 979 <% 980 if (location.isDownloadable()) 981 { 982 %> 983 <base:icon 984 subclass="link auto-init" 985 data-auto-init="view-file" 986 data-file-id="<%=itemId %>" 987 image="view.png" 988 tooltip="<%="View the contents of this file (" + fileSize + ")"%>" /> 989 <base:icon 990 subclass="link auto-init" 991 data-auto-init="download-file" 992 data-file-id="<%=itemId%>" 993 image="download.png" 994 tooltip="<%="Download the contents of this file (" + fileSize + ")"%>" /> 995 <% 996 } 997 else if (location == Location.OFFLINE) 998 { 999 %> 1000 <base:icon 1001 subclass="link auto-init" 1002 data-auto-init="upload-file" 1003 data-file-id="<%=itemId%>" 1004 image="upload.png" tooltip="Upload this file again" 1005 /> 1006 <% 1007 } 1008 %> 1009 </tbl:cell> 984 <tbl:cell column="actions"><%fileViewer.render();%></tbl:cell> 1010 985 <tbl:cell column="permissions"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> 1011 986 <tbl:cell column="sharedTo"> -
trunk/www/filemanager/files/view_file.jsp
r7604 r7760 54 54 import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 55 55 import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" 56 import="net.sf.basedb.clients.web.extensions.fileviewer.FileViewerUtil" 57 import="net.sf.basedb.clients.web.extensions.fileviewer.FileViewerContext" 56 58 import="net.sf.basedb.util.extensions.ExtensionsInvoker" 57 59 import="java.util.Collections" … … 103 105 JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, file); 104 106 ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext); 107 FileViewerContext fileContext = FileViewerContext.file(); 108 fileContext.setCurrentFile(file); 109 FileViewerUtil fileViewer = new FileViewerUtil(jspContext, fileContext); 105 110 %> 106 111 <base:page type="iframe" title="<%=title%>" id="view-page"> … … 254 259 <tr> 255 260 <th>Location</th> 256 <td><%=location%> 261 <td><%=location%> 257 262 <% 258 if (location.isDownloadable()) 263 fileViewer.render(); 264 if (location == Location.PRIMARY && file.hasPermission(Permission.WRITE) && !file.isWriteProtected()) 259 265 { 260 %> 261 [<base:icon 262 subclass="link auto-init" 263 data-auto-init="view-file" 264 data-file-id="<%=itemId%>" 265 image="view.png" 266 tooltip="<%="View the contents of this file (" + bytes + ")"%>" /> 267 <base:icon 268 subclass="link auto-init" 269 data-auto-init="download-file" 270 data-file-id="<%=itemId%>" 271 image="download.png" 272 tooltip="<%="Download the contents of this file (" + bytes + ")"%>" /> 273 <% 274 if (location == Location.PRIMARY && file.hasPermission(Permission.WRITE) && !file.isWriteProtected()) 275 { 276 %> 277 | <span class="link" 278 id="moveOffline" 279 data-file-id="<%=itemId %>" 280 data-location="OFFLINE" 281 >move offline</span> 282 | <span class="link auto-init" 283 data-auto-init="upload-file" 284 data-file-id="<%=itemId%>">replace</span> 285 <% 286 } 287 %> 288 ] 289 <% 290 } 291 else if (location == Location.OFFLINE) 292 { 293 %> 294 [<base:icon 295 subclass="link auto-init" 266 %> [<span class="link" 267 id="moveOffline" 268 data-file-id="<%=itemId %>" 269 data-location="OFFLINE" 270 >move offline</span> 271 | <span class="link auto-init" 296 272 data-auto-init="upload-file" 297 data-file-id="<%=itemId%>" 298 image="upload.png" tooltip="Upload this file again" />] 273 data-file-id="<%=itemId%>">replace</span>] 299 274 <% 300 275 }
Note: See TracChangeset
for help on using the changeset viewer.