Changeset 6308
- Timestamp:
- Aug 20, 2013, 2:54:18 PM (9 years ago)
- Location:
- trunk/www
- Files:
-
- 9 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/filemanager/directories/edit_directory.jsp
r6217 r6308 80 80 { 81 81 directory = Directory.getById(dc, itemId); 82 directory.checkPermission(Permission.WRITE); 82 83 parent = directory.getParent(); 83 84 autoCompress = directory.getAutoCompress(); … … 86 87 title = "Edit directory -- " + HTML.encodeTags(directory.getName()); 87 88 } 88 if (directory != null && !directory.hasPermission(Permission.WRITE))89 {90 throw new PermissionDeniedException(Permission.WRITE, itemType.toString());91 }92 93 94 89 95 90 JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), directory); 96 91 ExtensionsInvoker invoker = EditUtil.useEditExtensions(jspContext); 97 92 %> 98 <base:page type="popup" title="<%=title%>" >99 <base:head scripts="tabcontrol .js" styles="tabcontrol.css">93 <base:page type="popup" title="<%=title%>" id="edit-page"> 94 <base:head scripts="tabcontrol-2.js,~directories.js" styles="tabcontrol.css"> 100 95 <ext:scripts context="<%=jspContext%>" /> 101 96 <ext:stylesheets context="<%=jspContext%>" /> 102 <script>103 // Validate the "Directory" tab104 function validateDirectory()105 {106 var frm = document.forms['directory'];107 if (Main.trimString(frm.name.value) == '')108 {109 Forms.showNotification(frm.name, 'You must enter a name');110 return false;111 }112 return true;113 }114 // Submit the form115 function saveSettings()116 {117 var frm = document.forms['directory'];118 if (TabControl.validateActiveTab('settings'))119 {120 frm.submit();121 }122 }123 124 function init()125 {126 <%127 if (directory == null)128 {129 %>130 var frm = document.forms['directory'];131 frm.name.focus();132 frm.name.select();133 <%134 }135 %>136 }137 </script>138 97 </base:head> 139 <base:body onload="init()">98 <base:body> 140 99 <h1><%=title%> <base:help tabcontrol="settings" /></h1> 141 100 … … 148 107 position="bottom" remember="<%=directory != null%>" 149 108 extensions="<%=invoker%>"> 150 <t:tab id="info" title="Directory" validate="validateDirectory()"helpid="directory.edit">109 <t:tab id="info" title="Directory" helpid="directory.edit"> 151 110 <table class="fullform input100"> 152 111 <tr> … … 156 115 <tr> 157 116 <th>Name</th> 158 <td><input class="text required" type="text" name="name" 117 <td><input class="text required auto-init" 118 data-auto-init="<%=directory == null ? "focus-select" : "focus" %>" 119 type="text" name="name" 159 120 value="<%=HTML.encodeTags(directory == null ? Values.getString(cc.getPropertyValue("name"), "New directory") : directory.getName())%>" 160 121 maxlength="<%=Directory.MAX_NAME_LENGTH%>"></td> … … 210 171 211 172 <base:buttongroup subclass="dialogbuttons"> 212 <base:button onclick="saveSettings()" title="Save" />213 <base:button onclick="window.close()" title="Cancel" />173 <base:button id="btnSave" title="Save" /> 174 <base:button id="close" title="Cancel" /> 214 175 </base:buttongroup> 215 176 </base:body> -
trunk/www/filemanager/directories/list_directories.jsp
r6268 r6308 248 248 { 249 249 var frm = document.forms['directory']; 250 top.window.opener.<%=callback%>(frm.directory_id.value, frm.path.value); 250 var callback = '<%=callback%>'; 251 var notifyTarget = window.opener.document.getElementById(callback); 252 var callbackMethod = window.opener[callback]; 253 254 if (notifyTarget) 255 { 256 // Send event to the target in the opener window 257 Events.sendCustomEvent(notifyTarget, 'base-selected', {'id': frm.directory_id.value, 'name': frm.path.value, 'itemType': 'DIRECTORY'}); 258 } 259 else if (callbackMethod) 260 { 261 // Call the callback method in the opener window 262 callbackMethod.call(null, frm.directory_id.value, frm.path.value); 263 } 251 264 top.window.close(); 252 265 } -
trunk/www/filemanager/files/download_file.jsp
r6136 r6308 60 60 try 61 61 { 62 63 62 File file = File.getById(dc, itemId); 64 63 String path = file.getPath().toString(); … … 73 72 String downloadUrl = root + "filemanager/files/download/-"+ID+"-"+HTML.urlEncode(path); 74 73 %> 75 76 74 <base:page type="popup" title="<%=title%>"> 77 <base:head> 78 <script> 79 function downloadFile() 80 { 81 location.href = '<%=downloadUrl%>'; 82 } 83 </script> 84 </base:head> 85 <base:body onload="downloadFile()"> 75 <base:head scripts="~download_file.js" /> 76 <base:body> 86 77 <h1><%=title%></h1> 78 79 <div id="page-data" class="datacontainer" 80 data-download-url="<%=downloadUrl %>"></div> 81 87 82 <div class="content"> 88 83 … … 124 119 </form> 125 120 126 127 121 <base:buttongroup subclass="dialogbuttons"> 128 <base:button onclick="window.close()" title="Close" />122 <base:button id="close" title="Close" /> 129 123 </base:buttongroup> 130 124 -
trunk/www/filemanager/files/edit_file.jsp
r6217 r6308 128 128 subtypesQuery.include(Include.ALL); 129 129 130 131 132 130 JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), file); 133 131 ExtensionsInvoker invoker = EditUtil.useEditExtensions(jspContext); 134 132 %> 135 <base:page type="popup" title="<%=title%>" >136 <base:head scripts="tabcontrol .js" styles="tabcontrol.css">133 <base:page type="popup" title="<%=title%>" id="edit-page"> 134 <base:head scripts="tabcontrol-2.js,~files.js" styles="tabcontrol.css"> 137 135 <ext:scripts context="<%=jspContext%>" /> 138 136 <ext:stylesheets context="<%=jspContext%>" /> 139 <script>140 // Validate the "File" tab141 function validateFile()142 {143 var frm = document.forms['file'];144 if (Main.trimString(frm.name.value) == '')145 {146 Forms.showNotification(frm.name, 'You must enter a name');147 return false;148 }149 if (frm.url && Main.trimString(frm.url.value) == '')150 {151 Forms.showNotification(frm.url, 'You must enter a URL');152 return false;153 }154 return true;155 }156 157 // Submit the form158 function saveSettings()159 {160 var frm = document.forms['file'];161 if (TabControl.validateActiveTab('settings'))162 {163 frm.submit();164 }165 }166 var lastAutoChange = '';167 function urlOnChange()168 {169 var frm = document.forms['file'];170 var url = frm.url.value;171 if (url && (lastAutoChange == frm.name.value))172 {173 var end = url.lastIndexOf('/');174 if (end >= 0) url = url.substring(end+1);175 frm.name.value = url;176 lastAutoChange = url;177 }178 }179 function fileServerOnClick()180 {181 var frm = document.forms['file'];182 var url = '../fileservers/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setFileServerCallback';183 if (frm.server_id.length > 1)184 {185 var id = Math.abs(parseInt(frm.server_id[1].value));186 url += '&item_id='+id;187 }188 Main.openPopup(url, 'SelectFileServer', 1050, 700);189 }190 function setFileServerCallback(id, name)191 {192 var frm = document.forms['file'];193 var list = frm.server_id;194 if (list.length < 2 || list[1].value == '0') // >195 {196 Forms.addListOption(list, 1, new Option());197 }198 list[1].value = id;199 list[1].text = name;200 list.selectedIndex = 1;201 }202 function init()203 {204 <%205 if (file == null)206 {207 %>208 var frm = document.forms['file'];209 var defaultActive = frm.url ? frm.url : frm.name;210 defaultActive.focus();211 defaultActive.select();212 <%213 }214 %>215 }216 function mimeTypeOnClick()217 {218 var frm = document.forms['file'];219 var url = '../../admin/mimetypes/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setMimeTypeCallback';220 Main.openPopup(url, 'SelectMimeType', 1050, 700);221 }222 function setMimeTypeCallback(id, name)223 {224 var frm = document.forms['file'];225 frm.mime_type.value = name;226 }227 </script>228 137 </base:head> 229 <base:body onload="init()">138 <base:body> 230 139 <h1><%=title%> <base:help tabcontrol="settings" /></h1> 231 140 … … 234 143 <input type="hidden" name="directory_id" value="<%=directory.getId()%>"> 235 144 236 237 145 <t:tabcontrol id="settings" 238 146 subclass="content dialogtabcontrol" 239 147 position="bottom" remember="<%=file != null%>" 240 148 extensions="<%=invoker%>"> 241 <t:tab id="info" title="<%=isURL ? "URL" : "File" %>" validate="validateFile()"helpid="file.edit">149 <t:tab id="info" title="<%=isURL ? "URL" : "File" %>" helpid="file.edit"> 242 150 <table class="fullform input100"> 243 151 <tr> … … 251 159 <tr class="double"> 252 160 <th>URL</th> 253 <td><input class="text required" type="text" name="url" 161 <td><input class="text required auto-init" 162 data-auto-init="<%=file == null ? "focus-select" : "focus" %>" 163 type="text" name="url" id="url" 254 164 value="<%=HTML.encodeTags(file == null ? Values.getString(cc.getPropertyValue("url")) : file.getUrl())%>" 255 size="40" maxlength="<%=File.MAX_URL_LENGTH%>" 256 onkeyup="urlOnChange()" onchange="urlOnChange()"><br> 165 size="40" maxlength="<%=File.MAX_URL_LENGTH%>"><br> 257 166 <span title="Issues a HEAD request to the given URL in order to find size, MIME type, etc."> 258 167 <input type="checkbox" name="loadMetadata" id="loadMetadata" value="1" <%=file == null ? "checked" : "" %> … … 272 181 recent="<%=recentFileServers%>" 273 182 newitem="<%=file == null%>" 274 onselect="fileServerOnClick()"275 183 /> 276 184 </td> … … 282 190 <tr> 283 191 <th>Name</th> 284 <td><input class="text required" type="text" name="name" 192 <td><input class="text required <%=!isURL ? "auto-init" : ""%> 193 data-auto-init="<%=file == null ? "focus-select" : "focus" %>" 194 type="text" name="name" 285 195 value="<%=HTML.encodeTags(file == null ? Values.getString(cc.getPropertyValue("name")) : file.getName())%>" 286 196 size="40" maxlength="<%=File.MAX_NAME_LENGTH%>"></td> … … 335 245 value="<%=HTML.encodeTags(file == null ? Values.getString(cc.getPropertyValue("mimeType")) : file.getMimeType())%>" 336 246 maxlength="<%=File.MAX_MIMETYPE_LENGTH%>"></td> 337 <td><base:button onclick="mimeTypeOnClick()" title="Select…"/></td>247 <td><base:button id="selectMimeType" title="Select…"/></td> 338 248 </tr> 339 249 </table> … … 397 307 398 308 <base:buttongroup subclass="dialogbuttons"> 399 <base:button onclick="saveSettings()" title="Save" />400 <base:button onclick="window.close()" title="Cancel" />309 <base:button id="btnSave" title="Save" /> 310 <base:button id="close" title="Cancel" /> 401 311 </base:buttongroup> 402 312 -
trunk/www/filemanager/files/edit_file_data.jsp
r6199 r6308 69 69 %> 70 70 <base:page type="popup" title="<%=title%>"> 71 <base:head styles="toolbar.css"> 72 <script> 73 var isModified = false; 74 var originalText; 75 function init() 76 { 77 downloadFile(); 78 } 79 function downloadFile() 80 { 81 var url = 'download/-<%=ID%>-<%=HTML.javaScriptEncode(path)%>?'+(new Date().getTime()); 82 var request = Ajax.getXmlHttpRequest(); 83 request.open("GET", url, true); 84 Ajax.setReadyStateHandler(request, onFileLoaded); 85 request.send(null); 86 } 87 function onFileLoaded(request) 88 { 89 var frm = document.forms['file']; 90 frm.filedata.value = request.responseText; 91 originalText = frm.filedata.value; 92 setModified(false); 93 updateLineNumbers(); 94 } 95 function saveFile(closeIfSuccess) 96 { 97 if (!isModified) return; 98 var frm = document.forms['file']; 99 var url = 'ajax.jsp?ID=<%=ID%>&cmd=StoreFile&item_id=<%=itemId%>'; 100 url += '&size='+frm.filedata.value.length; 101 var request = Ajax.getXmlHttpRequest(); 102 request.closeIfSuccess = closeIfSuccess; 103 request.open("POST", url, true); 104 Ajax.setReadyStateHandler(request, onFileStored); 105 request.send(frm.filedata.value); 106 } 107 function onFileStored(request) 108 { 109 var response = JSON.parse(request.responseText); 110 if (response.status != 'ok') 111 { 112 Forms.showNotification('btnSave', response.message); 113 return; 114 } 115 setModified(false); 116 if (request.closeIfSuccess) 117 { 118 closeWindow(true, response.message); 119 } 120 } 121 function closeFile(autoSave) 122 { 123 if (isModified) 124 { 125 if (autoSave || confirm('The file has been modified. Save changes?')) 126 { 127 saveFile(true); 128 return; 129 } 130 } 131 closeWindow(false); 132 } 133 function closeWindow(refreshParent, message) 134 { 135 if (refreshParent) 136 { 137 var url = getRoot() + 'common/close_popup.jsp?refresh_opener=1'; 138 if (message) url += '&message='+encodeURIComponent(message); 139 location.href = url; 140 } 141 else 142 { 143 window.close(); 144 } 145 } 146 147 function detectChanges() 148 { 149 if (!isModified) 150 { 151 var frm = document.forms['file']; 152 if (frm.filedata.value != originalText) setModified(true); 153 } 154 } 155 function setModified(modified) 156 { 157 isModified = modified; 158 } 159 function detectTab(event) 160 { 161 var key = Main.getEventKeyCode(event); 162 if (key == 9) 163 { 164 var frm = document.forms['file']; 165 replaceSelection(frm.filedata, '\t'); 166 return false; 167 } 168 return true; 169 } 170 171 function updateLineNumbers() 172 { 173 var frm = document.forms['file']; 174 var totalScroll = frm.filedata.scrollHeight; 175 var topScroll = frm.filedata.scrollTop; 176 var textHeight = frm.filedata.offsetHeight; 177 var topLine = 1; 178 var scrollRemain = 0; 179 if (totalScroll > textHeight || topScroll > 0) 180 { 181 var numLines = frm.filedata.value.split('\n').length; 182 var scrollPerLine = totalScroll / numLines; 183 topLine = 1 + Math.floor(topScroll / scrollPerLine); 184 scrollRemain = topScroll - scrollPerLine * (topLine - 1); 185 } 186 var lineNumberHTML = ''; 187 for (var i = topLine; i < topLine + 100; i++) 188 { 189 lineNumberHTML += i + '<br>'; 190 } 191 var lineNumberElem = document.getElementById('linenumbers'); 192 lineNumberElem.innerHTML = lineNumberHTML; 193 lineNumberElem.scrollTop = scrollRemain; 194 } 195 196 /* 197 Replace the selected text with the given text. Code based on 198 Trac: http://projects.edgewall.com/trac/ 199 */ 200 function replaceSelection(field, text) 201 { 202 field.focus(); 203 var start, end, sel, scrollPos; 204 if (typeof(document["selection"]) != "undefined") 205 { 206 sel = document.selection.createRange().text; 207 } 208 else if (typeof(field["setSelectionRange"]) != "undefined") 209 { 210 start = field.selectionStart; 211 end = field.selectionEnd; 212 scrollPos = field.scrollTop; 213 sel = field.value.substring(start, end); 214 } 215 if (sel.match(/ $/)) 216 { 217 // exclude ending space char, if any 218 sel = sel.substring(0, sel.length - 1); 219 } 220 if (typeof(document["selection"]) != "undefined") 221 { 222 var range = document.selection.createRange().text = text; 223 } 224 else if (typeof(field["setSelectionRange"]) != "undefined") 225 { 226 field.value = field.value.substring(0, start) + text + 227 field.value.substring(end); 228 field.setSelectionRange(start + text.length, start + text.length); 229 field.scrollTop = scrollPos; 230 } 231 } 232 </script> 71 <base:head styles="toolbar.css" scripts="~edit_file_data.js"> 233 72 <style> 234 73 #linenumbers … … 268 107 </style> 269 108 </base:head> 270 <base:body onload="init()"> 271 <h1><%=title%> <base:help helpid="file.edit.data" /></h1> 109 <base:body> 110 <h1><%=title%> <span id="modified"></span> <base:help helpid="file.edit.data" /></h1> 111 112 <div id="page-data" class="datacontainer" 113 data-path="<%=HTML.encodeTags(path) %>" 114 data-file-id="<%=itemId %>" 115 ></div> 272 116 273 117 <form action="index.jsp?ID=<%=ID%>" method="post" name="file"> … … 278 122 <div id="filecontainer"> 279 123 <textarea id="filedata" name="filedata" 280 wrap="off" 281 onkeydown="return detectTab(event);" 282 onkeyup="detectChanges()" 283 onscroll="updateLineNumbers()" 284 style="overflow: auto;" 124 wrap="off" style="overflow: auto;" 285 125 >Loading file; please wait...</textarea> 286 126 </div> … … 289 129 290 130 <base:buttongroup subclass="dialogbuttons"> 291 <base:button id="btnSave" onclick="closeFile(true)"title="Save" />292 <base:button onclick="closeFile(false)" title="Close" />131 <base:button id="btnSave" title="Save" /> 132 <base:button id="close" title="Close" /> 293 133 </base:buttongroup> 294 134 </base:body> -
trunk/www/filemanager/files/edit_multiple_file.jsp
r6217 r6308 75 75 fileTypeQuery.order(Orders.asc(Hql.property("name"))); 76 76 fileTypeQuery.setCacheResult(true); 77 78 79 80 77 %> 81 78 <base:page type="popup" title="<%=title%>"> 82 <base:head scripts="tabcontrol.js" styles="tabcontrol.css"> 83 <script> 84 // Validate the "File" tab 85 function validateFile() 86 { 87 var frm = document.forms['file']; 88 89 return true; 90 } 91 92 // Submit the form 93 function saveSettings() 94 { 95 var frm = document.forms['file']; 96 if (TabControl.validateActiveTab('settings')) 97 { 98 frm.submit(); 99 } 100 } 101 102 function keepMimeTypeOnClick() 103 { 104 var frm = document.forms['file']; 105 frm.mimeType.disabled = frm.keepMimeType.checked; 106 if (!frm.mimeType.disabled) frm.mimeType.focus(); 107 } 108 109 function mimeTypeOnClick() 110 { 111 var frm = document.forms['file']; 112 var url = '../../admin/mimetypes/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setMimeTypeCallback'; 113 Main.openPopup(url, 'SelectMimeType', 1050, 700); 114 } 115 function setMimeTypeCallback(id, name) 116 { 117 var frm = document.forms['file']; 118 frm.mimeType.value = name; 119 frm.mimeType.disabled = false; 120 frm.keepMimeType.checked = false; 121 } 122 </script> 123 </base:head> 79 <base:head scripts="tabcontrol-2.js,~edit_multiple_file.js" styles="tabcontrol.css" /> 124 80 <base:body> 125 81 <h1><%=title%> <base:help tabcontrol="settings" /></h1> … … 131 87 subclass="content dialogtabcontrol" 132 88 position="bottom"> 133 <t:tab id="info" title="Properties" validate="validateFile()"helpid="file.edit">89 <t:tab id="info" title="Properties" helpid="file.edit"> 134 90 <table class="fullform input100"> 135 91 <tr> … … 162 118 <th>MIME type</th> 163 119 <td> 164 <input type="checkbox" name="keepMimeType" id="keepMimeType" value="1" checked165 onclick="keepMimeTypeOnClick()"><label for="keepMimeType">No change</label><br>120 <input type="checkbox" name="keepMimeType" 121 id="keepMimeType" value="1" checked><label for="keepMimeType">No change</label><br> 166 122 <table style="width: 100%;"> 167 123 <tr> 168 124 <td style="width: 98%;"><input class="text" type="text" name="mimeType" disabled 169 125 value="" maxlength="<%=File.MAX_MIMETYPE_LENGTH%>"></td> 170 <td><base:button onclick="mimeTypeOnClick()" title="Select…"/></td>126 <td><base:button id="selectMimeType" title="Select…"/></td> 171 127 </tr> 172 128 </table> … … 203 159 204 160 <base:buttongroup subclass="dialogbuttons"> 205 <base:button onclick="saveSettings()" title="Save" />206 <base:button onclick="window.close()" title="Cancel" />161 <base:button id="btnSave" title="Save" /> 162 <base:button id="close" title="Cancel" /> 207 163 </base:buttongroup> 208 164 </base:body> -
trunk/www/filemanager/files/index.jsp
r6192 r6308 170 170 // Display the upload page for an existing item (should be opened in a popup) 171 171 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subcontext, pageContext, defaultContext); 172 redirect = "../upload/index.jsp?ID="+ID+"& directory_id="+directoryId+"&file_id=" +itemId;172 redirect = "../upload/index.jsp?ID="+ID+"&file_id=" +itemId; 173 173 } 174 174 else if ("UpdateItem".equals(cmd)) … … 395 395 listInvoker.render(new ListColumnExportRenderer(cc)); 396 396 dc.close(); 397 redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=LIST&title=Export+ raw+bioassays";397 redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=LIST&title=Export+files"; 398 398 } 399 399 else if ("ExportItem".equals(cmd)) … … 401 401 // Run an export plugin in single-item context 402 402 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subcontext, pageContext, defaultContext); 403 redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=ITEM&title=Export+ raw+bioassay";403 redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=ITEM&title=Export+file"; 404 404 } 405 405 else if ("ImportItems".equals(cmd)) … … 412 412 dc.close(); 413 413 cc.setQuery(query); 414 redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=LIST&title=Import+ raw+bioassays";414 redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=LIST&title=Import+files"; 415 415 } 416 416 else if ("ImportItem".equals(cmd)) … … 418 418 // Run an import plugin in single-item context 419 419 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subcontext, pageContext, defaultContext); 420 redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=ITEM&title=Import+ raw+bioassay";420 redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&subcontext="+subcontext+"&context_type=ITEM&title=Import+file"; 421 421 } 422 422 else if ("RunListPlugin".equals(cmd)) … … 442 442 int numMoved = 0; 443 443 int numTotal = cc.getSelected().size(); 444 int moveTo = Values.getInt(request.getParameter("move"), -1); 445 if (moveTo != -1) 446 { 447 dc = sc.newDbControl(); 448 for (Integer id : cc.getSelected()) 444 Location moveTo = Location.valueOf(request.getParameter("move")); 445 446 dc = sc.newDbControl(); 447 for (Integer id : cc.getSelected()) 448 { 449 File f = File.getById(dc, id); 450 Location current = f.getLocation(); 451 try 449 452 { 450 File f = File.getById(dc, id); 451 Location current = f.getLocation(); 452 try 453 if (moveTo == Location.OFFLINE && current != Location.OFFLINE) 453 454 { 454 if (moveTo == 0 && current != Location.OFFLINE) 455 { 456 // 0 = move offline 457 f.setLocation(Location.OFFLINE); 458 f.setAction(File.Action.NOTHING); 459 numMoved++; 460 } 461 else if (moveTo == 1) 462 { 463 // 1 = move to primary 464 f.setAction(current == Location.PRIMARY ? File.Action.NOTHING : File.Action.MOVE_TO_PRIMARY); 465 numMoved++; 466 } 467 else if (moveTo == 2) 468 { 469 // 2 = move to secondary 470 f.setAction(current == Location.SECONDARY ? File.Action.NOTHING : File.Action.MOVE_TO_SECONDARY); 471 numMoved++; 472 } 455 // 0 = move offline 456 f.setLocation(Location.OFFLINE); 457 f.setAction(File.Action.NOTHING); 458 numMoved++; 473 459 } 474 catch (PermissionDeniedException ex) 475 {} 460 else if (moveTo == Location.PRIMARY) 461 { 462 // 1 = move to primary 463 f.setAction(current == Location.PRIMARY ? File.Action.NOTHING : File.Action.MOVE_TO_PRIMARY); 464 numMoved++; 465 } 466 else if (moveTo == Location.SECONDARY) 467 { 468 // 2 = move to secondary 469 f.setAction(current == Location.SECONDARY ? File.Action.NOTHING : File.Action.MOVE_TO_SECONDARY); 470 numMoved++; 471 } 476 472 } 473 catch (PermissionDeniedException ex) 474 {} 477 475 dc.commit(); 478 476 } … … 486 484 { 487 485 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subcontext, pageContext, defaultContext); 488 int moveTo = Values.getInt(request.getParameter("move"), -1); 489 if (moveTo != -1) 490 { 491 dc = sc.newDbControl(); 492 File f = File.getById(dc, cc.getId()); 493 Location current = f.getLocation(); 494 if (moveTo == 0 && current != Location.OFFLINE) 495 { 496 // 0 = move offline 497 f.setLocation(Location.OFFLINE); 498 f.setAction(File.Action.NOTHING); 499 } 500 else if (moveTo == 1) 501 { 502 // 1 = move to primary 503 f.setAction(current == Location.PRIMARY ? File.Action.NOTHING : File.Action.MOVE_TO_PRIMARY); 504 } 505 else if (moveTo == 2) 506 { 507 // 2 = move to secondary 508 f.setAction(current == Location.SECONDARY ? File.Action.NOTHING : File.Action.MOVE_TO_SECONDARY); 509 } 510 dc.commit(); 511 } 486 Location moveTo = Location.valueOf(request.getParameter("move")); 487 488 dc = sc.newDbControl(); 489 File f = File.getById(dc, cc.getId()); 490 Location current = f.getLocation(); 491 if (moveTo == Location.OFFLINE && current != Location.OFFLINE) 492 { 493 // 0 = move offline 494 f.setLocation(Location.OFFLINE); 495 f.setAction(File.Action.NOTHING); 496 } 497 else if (moveTo == Location.PRIMARY) 498 { 499 // 1 = move to primary 500 f.setAction(current == Location.PRIMARY ? File.Action.NOTHING : File.Action.MOVE_TO_PRIMARY); 501 } 502 else if (moveTo == Location.SECONDARY) 503 { 504 // 2 = move to secondary 505 f.setAction(current == Location.SECONDARY ? File.Action.NOTHING : File.Action.MOVE_TO_SECONDARY); 506 } 507 dc.commit(); 512 508 redirect = viewPage; 513 509 } … … 572 568 // Download the file contents of a file 573 569 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subcontext, pageContext, defaultContext); 574 forward = root + "filemanager/files/download_file.jsp?ID="+ID;570 forward = "download_file.jsp?ID="+ID; 575 571 } 576 572 else if ("CompressItem".equals(cmd)) -
trunk/www/filemanager/files/list_files.jsp
r6268 r6308 100 100 { 101 101 final Directory current = isSearch ? null : Directory.getById(dc, directoryId); 102 final String currentPath = current == null ? null : HTML.encodeTags(current.getPath().toString()); 102 103 final boolean createFilePermission = isSearch ? false : sc.hasPermission(Permission.CREATE, itemType) && current.hasPermission(Permission.USE); 103 104 final boolean createDirectoryPermission = isSearch ? false : sc.hasPermission(Permission.CREATE, Item.DIRECTORY) && current.hasPermission(Permission.USE); … … 240 241 ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext); 241 242 %> 242 <base:page title="<%=title==null ? "Files" : title%>" type="iframe" >243 <base:head scripts="table.js,menu.js,dragdrop.js " styles="table.css,toolbar.css,menu.css">243 <base:page title="<%=title==null ? "Files" : title%>" type="iframe" id="list-page"> 244 <base:head scripts="table.js,menu.js,dragdrop.js,~files.js" styles="table.css,toolbar.css,menu.css"> 244 245 <ext:scripts context="<%=jspContext%>" /> 245 246 <ext:stylesheets context="<%=jspContext%>" /> 246 <script>247 var submitPage = 'index.jsp';248 var formId = 'files';249 function editFile(fileId)250 {251 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', fileId, true, '&directory_id=<%=directoryId%>');252 }253 function uploadFile(fileId)254 {255 var cmd = fileId ? 'UploadFile' : 'UploadNewFile';256 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&directory_id=<%=directoryId%>&item_id='+fileId, 'UploadFile', 600, 400);257 }258 function viewFile(fileId)259 {260 location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id='+fileId;261 }262 function fileOnClick(evt, fileId)263 {264 Table.itemOnClick(formId, evt, fileId, '<%=mode.getName()%>', viewFile, editFile, returnSelected);265 }266 267 function editDirectory(directoryId)268 {269 Main.viewOrEditItem('<%=ID%>', 'DIRECTORY', directoryId, true);270 }271 function directoryOnClick(evt, directoryId)272 {273 editDirectory(directoryId);274 }275 function newDirectory()276 {277 Main.viewOrEditItem('<%=ID%>', 'DIRECTORY', 0, true, '&parent_id=<%=directoryId%>');278 }279 function editSelectedFiles()280 {281 var frm = document.forms[formId];282 if (Forms.numChecked(frm, /^\d+$/) == 0)283 {284 Forms.showNotification('check.uncheck', 'Please select at least one file in the list', null, 'pointer-left');285 return;286 }287 Table.submitToPopup(formId, 'EditMultiple', 600, 400);288 }289 function deleteItems()290 {291 var frm = document.forms[formId];292 if (Forms.numChecked(frm) == 0)293 {294 Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');295 return;296 }297 frm.action = submitPage;298 frm.cmd.value = 'DeleteItems';299 frm.submit();300 }301 function restoreItems()302 {303 var frm = document.forms[formId];304 if (Forms.numChecked(frm) == 0)305 {306 Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');307 return;308 }309 frm.action = submitPage;310 frm.cmd.value = 'RestoreItems';311 frm.submit();312 }313 function deleteFilePermanently(itemId)314 {315 Main.deleteItemPermanently('<%=ID%>', true, 'FILE', itemId);316 }317 function deleteDirectoryPermanently(itemId)318 {319 Main.deleteItemPermanently('<%=ID%>', true, 'DIRECTORY', itemId);320 }321 function setOwner()322 {323 Table.setOwnerOfItems(formId);324 }325 function shareDirectory(itemId)326 {327 Main.openPopup('../directories/index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareDirectory', 600, 400);328 }329 function shareFile(itemId)330 {331 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareFile', 600, 400);332 }333 function shareItems()334 {335 Table.shareItems(formId);336 }337 function configureColumns()338 {339 Table.configureColumns(formId);340 }341 function runPlugin(cmd)342 {343 Table.submitToPopup(formId, cmd, 750, 500);344 }345 function returnSelected(element)346 {347 var frm = document.forms[formId];348 updateSelected(element);349 if (element.type == 'radio')350 {351 window.top.returnSelected();352 window.top.close();353 }354 }355 function updateSelected(element)356 {357 if (element.type == 'radio')358 {359 window.top.setSelected(element.value, element.title);360 }361 else if (element.type == 'checkbox')362 {363 if (element.checked)364 {365 window.top.addSelected(element.value, element.title);366 }367 else368 {369 window.top.removeSelected(element.value);370 }371 }372 }373 374 375 function moveToDirectory(directoryId, path)376 {377 var frm = document.forms[formId]378 numChecked = Forms.numChecked(frm);379 if (!directoryId)380 {381 if (numChecked == 0)382 {383 Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');384 return;385 }386 Main.openPopup('../directories/index.jsp?ID=<%=ID%>&mode=selectonedirectory&title=Move+to&directory_id=<%=directoryId%>&callback=moveToDirectory', 'SelectDirectory', 500, 500);387 }388 else if (numChecked > 0)389 {390 Forms.createHidden(frm, 'newdirectory_id', directoryId);391 frm.action = submitPage;392 frm.cmd.value = 'MoveToDirectory';393 frm.submit();394 }395 }396 function moveTo(location)397 {398 var frm = document.forms[formId];399 if (Forms.numChecked(frm) == 0)400 {401 Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');402 return;403 }404 if (location == <%=Location.OFFLINE.getValue()%>)405 {406 var msg = "This action will remove the file data of the selected file(s) from the server.\n";407 msg += "If you need the data again you have to re-upload the file(s).\n\n";408 msg += "Continue?";409 if (!confirm(msg)) return;410 }411 Forms.createHidden(frm, 'move', location);412 frm.action = submitPage;413 frm.cmd.value = 'MoveItems';414 frm.submit();415 }416 function selectDirectory(subDirId)417 {418 parent.frames.directories.synchronizeTo(subDirId, <%=directoryId%>);419 }420 function updateSearchResults()421 {422 <%423 if (isSearch)424 {425 %>426 parent.frames.directories.updateSearchResults(<%=numFiles%>, <%=numDirectories%>);427 <%428 }429 %>430 }431 </script>432 247 </base:head> 433 248 434 <base:body onload="updateSearchResults()">249 <base:body> 435 250 <m:menu 436 id="move "251 id="moveFiles" 437 252 style="display: none;"> 438 439 253 <m:menuitem 254 id="mnuMoveToDirectory" 440 255 title="To another directory…" 441 onclick="moveToDirectory()"442 256 tooltip="Move the selected files and directories to another directory" 443 257 /> 444 258 <m:menuseparator /> 445 259 <m:menuitem 260 id="mnuMoveOffline" 261 data-location="OFFLINE" 446 262 title="Offline…" 447 onclick="moveTo(0)"448 263 tooltip="Remove the selected files from the server (immedately)" 449 264 /> … … 453 268 %> 454 269 <m:menuitem 270 id="mnuMoveToPrimary" 271 data-location="PRIMARY" 455 272 title="To primary location" 456 onclick="moveTo(1)"457 273 tooltip="Enqueue the selected files to be moved back to primary storage" 458 274 /> 459 275 <m:menuitem 276 id="mnuMoveToSecondary" 277 data-location="SECONDARY" 460 278 title="To secondary location" 461 onclick="moveTo(2)"462 279 tooltip="Enqueue the selected files to be moved to secondary storage" 463 280 /> … … 468 285 </m:menu> 469 286 <div id="main" class="absolutefull auto-init" data-auto-init="drag-support"> 287 <div id="page-data" class="datacontainer" 288 data-is-search="<%=isSearch ? 1 : 0 %>" 289 data-files-found="<%=numFiles %>" 290 data-directories-found="<%=numDirectories %>" 291 data-current-path="<%=currentPath == null ? "" : currentPath %>" 292 ></div> 293 470 294 <tbl:table 471 295 id="files" … … 712 536 <tbl:toolbar subclass="bottomborder"> 713 537 <tbl:button 538 id="btnNewDirectory" 539 data-item-type="DIRECTORY" 540 data-extra-url="<%="&parent_id="+directoryId%>" 714 541 disabled="<%=!createDirectoryPermission%>" 715 542 image="directory_new.png" 716 onclick="newDirectory()"717 543 title="New directory…" 718 544 visible="<%=!isSearch%>" … … 720 546 /> 721 547 <tbl:button 548 id="btnUpload" 722 549 disabled="<%=!createFilePermission%>" 723 550 image="upload.png" 724 onclick="uploadFile(0)"725 551 title="Upload file…" 726 552 visible="<%=!isSearch%>" … … 728 554 /> 729 555 <tbl:button 556 id="btnNewURL" 730 557 disabled="<%=!createFilePermission%>" 731 558 image="url_new.png" 732 onclick="editFile(0)"733 559 title="New URL…" 734 560 visible="<%=!isSearch%>" … … 736 562 /> 737 563 <tbl:button 564 id="btnEditMultipleFiles" 738 565 image="edit.png" 739 onclick="editSelectedFiles()"740 566 title="Edit…" 741 567 tooltip="Edit the selected files" 742 568 /> 743 569 <tbl:button 570 id="btnMoveFiles" 571 subclass="auto-init" 572 data-auto-init="menu-anchor" 573 data-menu-id="moveFiles" 744 574 image="move.png" 745 onclick="Menu.toggleTopMenu('move', event.clientX, event.clientY); event.cancelBubble = true;"746 575 title="Move…" 747 576 tooltip="Move the selected items" … … 749 578 /> 750 579 <tbl:button 580 id="btnDeleteItems" 751 581 image="delete.png" 752 onclick="deleteItems()"753 582 title="Delete" 754 583 tooltip="Delete the selected items" … … 756 585 /> 757 586 <tbl:button 587 id="btnRestoreItems" 758 588 image="restore.png" 759 onclick="restoreItems()"760 589 title="Restore" 761 590 tooltip="Restore the selected (deleted) items" … … 763 592 /> 764 593 <tbl:button 594 id="btnShareItems" 765 595 image="share.png" 766 onclick="shareItems()"767 596 title="Share…" 768 597 tooltip="Share the selected items" … … 770 599 /> 771 600 <tbl:button 601 id="btnSetOwner" 772 602 image="take_ownership.png" 773 onclick="setOwner()"774 603 title="Set owner…" 775 604 tooltip="Change owner of the selected items" 776 605 /> 777 606 <tbl:button 607 id="btnColumns" 778 608 image="columns.png" 779 onclick="configureColumns()"780 609 title="Columns…" 781 610 tooltip="Show, hide and re-order columns" … … 783 612 /> 784 613 <tbl:button 614 id="btnImport" 615 data-plugin-type="IMPORT" 785 616 image="import.png" 786 onclick="runPlugin('ImportItems')"787 617 title="Import…" 788 618 tooltip="Import data" … … 790 620 /> 791 621 <tbl:button 622 id="btnExport" 623 data-plugin-type="EXPORT" 792 624 image="export.png" 793 onclick="runPlugin('ExportItems')"794 625 title="Export…" 795 626 tooltip="Export data" … … 797 628 /> 798 629 <tbl:button 630 id="btnRunPlugin" 631 data-plugin-type="OTHER" 799 632 image="runplugin.png" 800 onclick="runPlugin('RunListPlugin')"801 633 title="Run plugin…" 802 634 tooltip="Run a plugin" … … 808 640 <tbl:panel visible="<%=!isSearch%>"> 809 641 <tbl:presetselector /> 810 <%=current .getPath().toString()%>642 <%=currentPath%> 811 643 </tbl:panel> 812 644 <tbl:panel visible="<%=isSearch%>"> … … 870 702 Directory item = directories.next(); 871 703 int itemId = item.getId(); 872 String openSharePopup = "shareDirectory("+itemId+")";873 String deletePermanently = "deleteDirectoryPermanently("+itemId+")";874 704 boolean deletePermission = item.hasPermission(Permission.DELETE); 875 705 boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); … … 885 715 catch (Throwable t) 886 716 {} 717 String tooltip = mode.isSelectionMode() ? 718 "Select this item" : "Edit this item"; 887 719 %> 888 720 <tbl:row> … … 890 722 clazz="index" 891 723 ><base:icon 724 subclass="link auto-init" 725 data-auto-init="open-directory" 726 data-directory-id="<%=itemId %>" 892 727 image="<%=icon%>" 893 728 tooltip="<%=tagPath%>" 894 onclick="<%="selectDirectory(" + itemId + ")"%>"895 729 /></tbl:header> 896 730 <tbl:header … … 915 749 id="<%="delete."+itemId %>" 916 750 subclass="<%=deletePermission ? "table-delete-item" : null %>" 751 data-item-type="DIRECTORY" 917 752 data-item-id="<%=itemId%>" 753 data-notify="reloadOnNotify" 918 754 tooltip="This item has been scheduled for deletion" 919 755 visible="<%=item.isRemoved()%>" … … 922 758 id="<%="share."+itemId %>" 923 759 subclass="<%=sharePermission ? "table-share-item" : null %>" 760 data-item-type="DIRECTORY" 924 761 data-item-id="<%=itemId%>" 925 762 tooltip="This item is shared to other users, groups and/or projects" 926 763 visible="<%=item.isShared()%>" 927 764 /> </tbl:header> 928 <tbl:cell column="name"><div class="link" onclick="directoryOnClick(event, <%=itemId%>)" title="Edit this directory"><%=name%></div></tbl:cell> 765 <tbl:cell column="name"><div 766 class="link auto-init" 767 data-auto-init="directory-item" 768 data-item-type="DIRECTORY" 769 data-item-id="<%=itemId%>" 770 data-force-edit="1" 771 data-path="<%=tagPath %>" 772 title="<%=tooltip%>"><%=name%></div></tbl:cell> 929 773 <tbl:cell column="path" style="white-space: nowrap;"> 930 774 <% … … 932 776 { 933 777 %> 934 <div class="link" onclick="selectDirectory(<%=parent.getId()%>)" title="Open this directory"><%=tagPath.substring(0, tagPath.length() - name.length())%></div> 778 <div class="link auto-init" 779 data-auto-init="open-directory" 780 data-directory-id="<%=parent.getId() %>" 781 title="Open this directory"><%=tagPath.substring(0, tagPath.length() - name.length())%></div> 935 782 <% 936 783 } … … 990 837 int itemId = item.getId(); 991 838 Location location = item.getLocation(); 992 String openSharePopup = "shareFile("+itemId+")";993 String deletePermanently = "deleteFilePermanently("+itemId+")";994 839 boolean deletePermission = item.hasPermission(Permission.DELETE); 995 840 boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); … … 1031 876 visible="<%=mode.hasCheck()%>" 1032 877 ><input 878 class="auto-init" 879 data-auto-init="file-check" 1033 880 type="checkbox" 1034 881 name="<%=itemId%>" … … 1036 883 title="<%=tagPath%>" 1037 884 <%=cc.getSelected().contains(itemId) ? "checked" : ""%> 1038 onclick="updateSelected(this)"1039 885 ></tbl:header> 1040 886 <tbl:header … … 1042 888 visible="<%=mode.hasRadio()%>" 1043 889 ><input 890 class="auto-init" 891 data-auto-init="file-check" 1044 892 type="radio" 1045 893 name="item_id" … … 1047 895 title="<%=tagPath%>" 1048 896 <%=selectedItemId == itemId ? "checked" : ""%> 1049 onclick="updateSelected(this)"1050 897 ></tbl:header> 1051 898 <tbl:header … … 1057 904 subclass="<%=deletePermission ? "table-delete-item" : null %>" 1058 905 data-item-id="<%=itemId%>" 906 data-notify="reloadOnNotify" 1059 907 tooltip="This item has been scheduled for deletion" 1060 908 visible="<%=item.isRemoved()%>" … … 1067 915 visible="<%=item.isShared()%>" 1068 916 /> </tbl:header> 1069 <tbl:cell column="name"><div class="link" 1070 onclick="fileOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" 917 <tbl:cell column="name"><div 918 class="link auto-init" 919 data-auto-init="file-item" 920 data-item-id="<%=itemId%>" 921 data-path="<%=tagPath %>" 922 data-no-edit="<%=writePermission ? 0 : 1 %>" 923 tabindex="0" 1071 924 title="<%=tooltip%>"><%=name%></div></tbl:cell> 1072 925 <tbl:cell column="path" style="white-space: nowrap;"> … … 1075 928 { 1076 929 %> 1077 <div class="link" onclick="selectDirectory(<%=parent.getId()%>)" title="Open this directory"><%=tagPath.substring(0, tagPath.length() - name.length())%></div> 930 <div class="link auto-init" 931 data-auto-init="open-directory" 932 data-directory-id="<%=parent.getId() %>" 933 title="Open this directory"><%=tagPath.substring(0, tagPath.length() - name.length())%></div> 1078 934 <% 1079 935 } … … 1124 980 { 1125 981 %> 1126 <a href="javascript:Main.viewFile('<%=ID%>', <%=itemId%>)"><base:icon image="view.png" tooltip="<%="View the contents of this file (" + fileSize + ")"%>" /></a> 1127 <a href="javascript:Main.downloadFile('<%=ID%>', <%=itemId%>)"><base:icon image="download.png" tooltip="<%="Download the contents of this file (" + fileSize + ")"%>" /></a> 982 <base:icon 983 subclass="link auto-init" 984 data-auto-init="view-file" 985 data-file-id="<%=itemId %>" 986 image="view.png" 987 tooltip="<%="View the contents of this file (" + fileSize + ")"%>" /> 988 <base:icon 989 subclass="link auto-init" 990 data-auto-init="download-file" 991 data-file-id="<%=itemId%>" 992 image="download.png" 993 tooltip="<%="Download the contents of this file (" + fileSize + ")"%>" /> 1128 994 <% 1129 995 } … … 1131 997 { 1132 998 %> 1133 <a href="javascript:uploadFile(<%=itemId%>)"><base:icon image="upload.png" tooltip="Upload this file again" /></a> 999 <base:icon 1000 subclass="link auto-init" 1001 data-auto-init="upload-file" 1002 data-file-id="<%=itemId%>" 1003 image="upload.png" tooltip="Upload this file again" 1004 /> 1134 1005 <% 1135 1006 } … … 1182 1053 </tbl:table> 1183 1054 </div> 1055 <div id="reloadOnNotify"></div> 1184 1056 </base:body> 1185 1057 </base:page> -
trunk/www/filemanager/files/view_file.jsp
r6268 r6308 103 103 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 104 104 %> 105 <base:page type="iframe" title="<%=title%>" >106 <base:head scripts="table.js,tabcontrol .js,dragdrop.js" styles="table.css,toolbar.css,headertabcontrol.css">105 <base:page type="iframe" title="<%=title%>" id="view-page"> 106 <base:head scripts="table.js,tabcontrol-2.js,dragdrop.js,~files.js" styles="table.css,toolbar.css,headertabcontrol.css"> 107 107 <ext:scripts context="<%=jspContext%>" /> 108 108 <ext:stylesheets context="<%=jspContext%>" /> 109 <script>110 function editItem()111 {112 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);113 }114 function shareItem()115 {116 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareFile', 600, 400);117 }118 function deleteItem()119 {120 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');121 }122 function restoreItem()123 {124 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');125 }126 function deleteItemPermanently()127 {128 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');129 }130 function itemDeleted()131 {132 location.replace(getRoot() + 'filemanager/files/index.jsp?ID=<%=ID%>');133 }134 function showUsingItems()135 {136 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);137 }138 function setOwner()139 {140 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);141 }142 function runPlugin(cmd)143 {144 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);145 }146 function uploadFile()147 {148 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=UploadFile&item_id=<%=itemId%>', 'UploadFile', 600, 400);149 }150 function moveOffline()151 {152 var msg = "This action will remove the file data of the selected file from the server.\n";153 msg += "If you need the data again you have to re-upload the file.\n\n";154 msg += "Continue?";155 if (!confirm(msg)) return;156 location.href = "index.jsp?ID=<%=ID%>&cmd=MoveItem&move=0&item_id=<%=itemId%>";157 }158 function compress()159 {160 Main.openPopup('../../common/progress_reporter.jsp?ID=<%=ID%>&progress=compress&title=Compressing file', 'CompressFile', 300, 200);161 location.replace('index.jsp?ID=<%=ID%>&cmd=CompressItem&item_id=<%=itemId%>');162 }163 function decompress()164 {165 Main.openPopup('../../common/progress_reporter.jsp?ID=<%=ID%>&progress=decompress&title=Decompressing file', 'UncompressFile', 300, 200);166 location.replace('index.jsp?ID=<%=ID%>&cmd=DecompressItem&item_id=<%=itemId%>');167 }168 function editFileData()169 {170 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=EditFileData&item_id=<%=itemId%>', 'EditFileData', 800, 600);171 }172 </script>173 109 </base:head> 174 110 <base:body> 175 111 <div class="absolutefull auto-init" data-auto-init="drag-support"> 112 113 <div id="page-data" data-item-id="<%=itemId%>"></div> 176 114 177 115 <t:tabcontrol … … 190 128 /> 191 129 <base:icon 130 id="btnDeletePermanently" 192 131 image="deleted.png" 193 onclick="deleteItemPermanently()"194 132 tooltip="This item has been flagged for deletion. Click to delete it now." 195 133 enabled="<%=deletePermanentlyPermission %>" 196 134 visible="<%=isRemoved%>" 197 135 /> 198 <base:icon image="used.png" 199 onclick="showUsingItems()" 136 <base:icon 137 id="btnUsingItems" 138 image="used.png" 200 139 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 201 140 visible="<%=isRemoved && isUsed%>" /> … … 204 143 <tbl:toolbar subclass="bottomborder"> 205 144 <tbl:button 145 id="btnEdit" 206 146 disabled="<%=!writePermission%>" 207 147 image="edit.png" 208 onclick="editItem()"209 148 title="Edit…" 210 149 tooltip="<%=writePermission ? "Edit this file" : "You do not have permission to edit this file"%>" 211 150 /> 212 151 <tbl:button 152 id="btnEditFileData" 213 153 visible="<%=editable%>" 214 154 image="file_edit.png" 215 onclick="editFileData()"216 155 title="Edit file…" 217 156 tooltip="Edit the contents of this file" 218 157 /> 219 158 <tbl:button 159 id="btnDelete" 220 160 disabled="<%=!deletePermission%>" 221 161 image="delete.png" 222 onclick="deleteItem()"223 162 title="Delete" 224 163 visible="<%=!file.isRemoved()%>" … … 226 165 /> 227 166 <tbl:button 167 id="btnRestore" 228 168 disabled="<%=!writePermission%>" 229 169 image="restore.png" 230 onclick="restoreItem()"231 170 title="Restore" 232 171 visible="<%=file.isRemoved()%>" … … 234 173 /> 235 174 <tbl:button 175 id="btnShare" 236 176 disabled="<%=!sharePermission%>" 237 177 image="share.png" 238 onclick="shareItem()"239 178 title="Share…" 240 179 tooltip="<%=sharePermission ? "Share this file to other user, groups and projects" : "You do not have permission to share this file"%>" 241 180 /> 242 181 <tbl:button 182 id="btnSetOwner" 243 183 disabled="<%=!setOwnerPermission%>" 244 184 image="take_ownership.png" 245 onclick="setOwner()"246 185 title="Set owner…" 247 186 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 248 187 /> 249 188 <tbl:button 189 id="btnCompress" 250 190 disabled="<%=!writePermission%>" 251 191 image="compress.png" 252 onclick="compress()"253 192 title="Compress…" 254 193 visible="<%=!file.isCompressed() && location == Location.PRIMARY%>" … … 256 195 /> 257 196 <tbl:button 197 id="btnDecompress" 258 198 disabled="<%=!writePermission%>" 259 199 image="decompress.png" 260 onclick="decompress()"261 200 title="Decompress…" 262 201 visible="<%=file.isCompressed() && location == Location.PRIMARY%>" … … 264 203 /> 265 204 <tbl:button 205 id="btnImport" 266 206 image="import.png" 267 onclick="runPlugin('ImportItem')"207 data-plugin-type="IMPORT" 268 208 title="Import…" 269 209 tooltip="Import data" … … 271 211 /> 272 212 <tbl:button 273 image="export.png" 274 onclick="runPlugin('ExportItem')" 213 id="btnExport" 214 image="export.png" 215 data-plugin-type="EXPORT" 275 216 title="Export…" 276 217 tooltip="Export data" … … 278 219 /> 279 220 <tbl:button 280 image="runplugin.png" 281 onclick="runPlugin('RunPlugin')" 221 id="btnRunPlugin" 222 image="runplugin.png" 223 data-plugin-type="OTHER" 282 224 title="Run plugin…" 283 225 tooltip="Run a plugin" … … 288 230 <tbl:button 289 231 image="help.png" 290 onclick="<%="Main.openHelp('" + ID +"', 'file.view.properties')"%>" 232 subclass="auto-init" 233 data-auto-init="help" 234 data-help-id="file.view.properties" 291 235 title="Help…" 292 236 tooltip="Get help about this page" … … 331 275 { 332 276 %> 333 [<a href="javascript:Main.viewFile('<%=ID%>', <%=itemId%>)"><base:icon image="view.png" tooltip="<%="View the contents of this file (" + bytes + ")"%>" /></a> 334 <a href="javascript:Main.downloadFile('<%=ID%>', <%=itemId%>)"><base:icon image="download.png" tooltip="<%="Download the contents of this file (" + bytes + ")"%>" /></a> 277 [<base:icon 278 subclass="link auto-init" 279 data-auto-init="view-file" 280 data-file-id="<%=itemId%>" 281 image="view.png" 282 tooltip="<%="View the contents of this file (" + bytes + ")"%>" /> 283 <base:icon 284 subclass="link auto-init" 285 data-auto-init="download-file" 286 data-file-id="<%=itemId%>" 287 image="download.png" 288 tooltip="<%="Download the contents of this file (" + bytes + ")"%>" /> 335 289 <% 336 290 if (location == Location.PRIMARY && file.hasPermission(Permission.WRITE) && !file.isWriteProtected()) 337 291 { 338 292 %> 339 | <a href="javascript:moveOffline()">move offline</a> 293 | <span class="link" 294 id="moveOffline" 295 data-file-id="<%=itemId %>" 296 data-location="OFFLINE" 297 >move offline</span> 340 298 <% 341 299 if (action == File.Action.MOVE_TO_SECONDARY) … … 352 310 } 353 311 %> 354 | <a href="javascript:uploadFile()">replace</a> 312 | <span class="link auto-init" 313 data-auto-init="upload-file" 314 data-file-id="<%=itemId%>">replace</span> 355 315 <% 356 316 } … … 362 322 { 363 323 %> 364 [<a href="javascript:moveOffline()">move offline</a> 324 [<span class="link" 325 id="moveOffline" 326 data-file-id="<%=itemId %>" 327 data-location="OFFLINE" 328 >move offline</span> 365 329 <% 366 330 if (action == File.Action.MOVE_TO_PRIMARY) … … 383 347 { 384 348 %> 385 [<a href="javascript:uploadFile()"><base:icon image="upload.png" tooltip="Upload this file again" /></a>] 349 [<base:icon 350 subclass="link auto-init" 351 data-auto-init="upload-file" 352 data-file-id="<%=itemId%>" 353 image="upload.png" tooltip="Upload this file again" />] 386 354 <% 387 355 } … … 464 432 <t:tab id="history" title="Change history" 465 433 tooltip="Displays a log of all modifications made to this item" 466 visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>" 467 activate="History.loadOnce()"> 434 visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>"> 468 435 <jsp:include page="../../common/history/frameset.jsp"> 469 436 <jsp:param name="item_type" value="<%=itemType.name()%>" /> -
trunk/www/filemanager/fileservers/edit_fileserver.jsp
r6217 r6308 68 68 title = "Edit file server -- " + HTML.encodeTags(server.getName()); 69 69 } 70 71 72 70 73 71 JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), server); 74 72 ExtensionsInvoker invoker = EditUtil.useEditExtensions(jspContext); 75 73 List<ConnectionManagerFactory> cmFactories = ConnectionManagerUtil.getFactories(); 76 74 %> 77 <base:page type="popup" title="<%=title%>" >78 <base:head scripts="tabcontrol .js" styles="tabcontrol.css">75 <base:page type="popup" title="<%=title%>" id="edit-page"> 76 <base:head scripts="tabcontrol-2.js,~fileservers.js" styles="tabcontrol.css"> 79 77 <ext:scripts context="<%=jspContext%>" /> 80 78 <ext:stylesheets context="<%=jspContext%>" /> 81 <script>82 // Validate the "File server" tab83 function validateFileServer()84 {85 var frm = document.forms['server'];86 if (Main.trimString(frm.name.value) == '')87 {88 Forms.showNotification(frm.name, 'You must enter a name');89 return false;90 }91 return true;92 }93 94 function validateCertificates()95 {96 return true;97 }98 99 // Submit the form100 function saveSettings()101 {102 var frm = document.forms['server'];103 if (TabControl.validateActiveTab('settings'))104 {105 frm.submit();106 }107 }108 109 function init()110 {111 <%112 if (server == null)113 {114 %>115 var frm = document.forms['server'];116 frm.name.focus();117 frm.name.select();118 <%119 }120 %>121 connectionManagerOnChange();122 }123 124 var currentCMF;125 function connectionManagerOnChange()126 {127 var frm = document.forms['server'];128 if (currentCMF) Main.hide(currentCMF);129 130 var cmfId = frm.connectionManager[frm.connectionManager.selectedIndex].value;131 if (!cmfId) cmfId = 'auto';132 currentCMF = 'cmf.' + cmfId + '.description';133 Main.show(currentCMF);134 }135 136 137 function removeServerCertificateOnClick()138 {139 var frm = document.forms['server'];140 if (frm.remove_server_certificate.checked)141 {142 frm.server_certificate.value = '';143 frm.server_certificate.disabled = true;144 }145 else146 {147 frm.server_certificate.disabled = false;148 }149 }150 function removeClientCertificateOnClick()151 {152 var frm = document.forms['server'];153 if (frm.remove_client_certificate.checked)154 {155 frm.client_certificate.value = '';156 frm.client_certificate.disabled = true;157 frm.client_certificate_password.disabled = true;158 }159 else160 {161 frm.client_certificate.disabled = false;162 frm.client_certificate_password.disabled = false;163 }164 }165 </script>166 79 </base:head> 167 <base:body onload="init()">80 <base:body> 168 81 <h1><%=title%> <base:help tabcontrol="settings"/></h1> 169 82 … … 174 87 position="bottom" remember="<%=server != null%>" 175 88 extensions="<%=invoker%>"> 176 <t:tab id="info" title="File server" validate="validateFileServer()"helpid="fileserver.edit">89 <t:tab id="info" title="File server" helpid="fileserver.edit"> 177 90 <table class="fullform input100"> 178 91 <tr> 179 92 <th>Name</th> 180 <td><input class="text required" type="text" name="name" 93 <td><input class="text required auto-init" 94 data-auto-init="<%=server == null ? "focus-select" : "focus" %>" 95 type="text" name="name" 181 96 value="<%=HTML.encodeTags(server == null ? Values.getString(cc.getPropertyValue("name"), "New file server") : server.getName())%>" 182 97 maxlength="<%=FileServer.MAX_NAME_LENGTH%>"></td> … … 186 101 <th>Connection manager</th> 187 102 <td> 188 <select name="connectionManager" onchange="connectionManagerOnChange()">103 <select name="connectionManager" id="connectionManager"> 189 104 <option value="">- auto - 190 105 <% … … 200 115 %> 201 116 </select> 202 203 117 </td> 204 118 <td></td> … … 259 173 </table> 260 174 </t:tab> 261 <t:tab id="serverCertificate" title="Certificates" validate="validateCertificates()"175 <t:tab id="serverCertificate" title="Certificates" 262 176 helpid="fileserver.edit"> 263 177 … … 268 182 <input class="text" type="file" name="server_certificate" size="40"><br> 269 183 <input type="checkbox" name="remove_server_certificate" id="removeServerCertificate" value="1" 270 onclick="removeServerCertificateOnClick()"><label for="removeServerCertificate">Remove existing server certificate</label><br><br> 184 ><label for="removeServerCertificate">Remove existing server certificate</label> 185 186 <div class="messagecontainer help"> 187 A <b>server certificate</b> may be needed to access files with https on servers that 188 use self-signed certificates. You may select a file containing the server's X.509 certificate 189 in either binary or base64-encoded DER format. 190 </div> 271 191 </td> 272 192 </tr> … … 283 203 </td> 284 204 </tr> 285 <tr >205 <tr class="dynamic"> 286 206 <th class="subprompt"></th> 287 207 <td> 288 208 <input type="checkbox" name="remove_client_certificate" id="removeClientCertificate" value="1" 289 onclick="removeClientCertificateOnClick()"><label for="removeClientCertificate">Remove existing client certificate</label> 290 </td> 291 </tr> 292 293 <tr class="dynamic"> 294 <th></th> 295 <td> 296 <div class="helpmessage"> 297 A <b>server certificate</b> may be needed to access files with https on servers that 298 use self-signed certificates. You may select a file containing the server's X.509 certificate 299 in either binary or base64-encoded DER format. 300 <p> 301 A <b>client certificate</b> may be needed to access files with https on servers 302 that require client authentication using certificates. You should select a file 303 containing your key in PKCS #12 format. If the file is password-protected you must 304 enter the password as well. 305 </div> 209 ><label for="removeClientCertificate">Remove existing client certificate</label> 210 211 <div class="messagecontainer help"> 212 A <b>client certificate</b> may be needed to access files with https on servers 213 that require client authentication using certificates. You should select a file 214 containing your key in PKCS #12 format. If the file is password-protected you must 215 enter the password as well. 216 </div> 217 306 218 </td> 307 219 </tr> … … 318 230 319 231 <base:buttongroup subclass="dialogbuttons"> 320 <base:button onclick="saveSettings()" title="Save" />>321 <base:button onclick="window.close()" title="Cancel" />232 <base:button id="btnSave" title="Save" />> 233 <base:button id="close" title="Cancel" /> 322 234 </base:buttongroup> 323 235 </base:body> -
trunk/www/filemanager/fileservers/list_fileservers.jsp
r6221 r6308 95 95 ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext); 96 96 %> 97 <base:page title="<%=title==null ? "File servers" : title%>" type="<%=mode.getPageType()%>" >98 <base:head scripts="table.js " styles="table.css,toolbar.css">97 <base:page title="<%=title==null ? "File servers" : title%>" type="<%=mode.getPageType()%>" id="list-page"> 98 <base:head scripts="table.js,~fileservers.js" styles="table.css,toolbar.css"> 99 99 <ext:scripts context="<%=jspContext%>" /> 100 100 <ext:stylesheets context="<%=jspContext%>" /> 101 <script>102 var submitPage = 'index.jsp';103 var formId = 'servers';104 function newItem()105 {106 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);107 }108 function editItem(itemId)109 {110 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);111 }112 function viewItem(itemId)113 {114 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);115 }116 function itemOnClick(evt, itemId)117 {118 Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);119 }120 function deleteItems()121 {122 var frm = document.forms[formId];123 if (Forms.numChecked(frm) == 0)124 {125 Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');126 return;127 }128 frm.action = submitPage;129 frm.cmd.value = 'DeleteItems';130 frm.submit();131 }132 function restoreItems()133 {134 var frm = document.forms[formId];135 if (Forms.numChecked(frm) == 0)136 {137 Forms.showNotification('check.uncheck', 'Please select at least one item in the list', null, 'pointer-left');138 return;139 }140 frm.action = submitPage;141 frm.cmd.value = 'RestoreItems';142 frm.submit();143 }144 function setOwner()145 {146 Table.setOwnerOfItems(formId);147 }148 function shareItems()149 {150 Table.shareItems(formId);151 }152 function configureColumns()153 {154 Table.configureColumns(formId);155 }156 function runPlugin(cmd)157 {158 Table.submitToPopup(formId, cmd, 750, 500);159 }160 function returnSelected()161 {162 Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);163 window.close();164 }165 </script>166 101 </base:head> 167 102 … … 284 219 > 285 220 <tbl:button 221 id="btnNewItem" 286 222 disabled="<%=!createPermission%>" 287 223 image="new.png" 288 onclick="newItem()"289 224 title="New…" 290 225 tooltip="<%=createPermission ? "Create new file server" : "You do not have permission to create file servers"%>" 291 226 /> 292 227 <tbl:button 228 id="btnDeleteItems" 293 229 image="delete.png" 294 onclick="deleteItems()"295 230 title="Delete" 296 231 tooltip="Delete the selected items" 297 232 /> 298 233 <tbl:button 234 id="btnRestoreItems" 299 235 image="restore.png" 300 onclick="restoreItems()"301 236 title="Restore" 302 237 tooltip="Restore the selected (deleted) items" 303 238 /> 304 239 <tbl:button 240 id="btnShareItems" 305 241 image="share.png" 306 onclick="shareItems()"307 242 title="Share…" 308 243 tooltip="Share the selected items" 309 244 /> 310 245 <tbl:button 246 id="btnSetOwner" 311 247 image="take_ownership.png" 312 onclick="setOwner()"313 248 title="Set owner…" 314 249 tooltip="Change owner of the selected items" 315 250 /> 316 251 <tbl:button 252 id="btnColumns" 317 253 image="columns.png" 318 onclick="configureColumns()"319 254 title="Columns…" 320 255 tooltip="Show, hide and re-order columns" 321 256 /> 322 257 <tbl:button 258 id="btnImport" 259 data-plugin-type="IMPORT" 323 260 image="import.png" 324 onclick="runPlugin('ImportItems')"325 261 title="Import…" 326 262 tooltip="Import data" … … 328 264 /> 329 265 <tbl:button 266 id="btnExport" 267 data-plugin-type="EXPORT" 330 268 image="export.png" 331 onclick="runPlugin('ExportItems')"332 269 title="Export…" 333 270 tooltip="Export data" … … 335 272 /> 336 273 <tbl:button 274 id="btnRunPlugin" 275 data-plugin-type="OTHER" 337 276 image="runplugin.png" 338 onclick="runPlugin('RunListPlugin')"339 277 title="Run plugin…" 340 278 tooltip="Run a plugin" … … 456 394 visible="<%=item.isShared()%>" 457 395 /> </tbl:header> 458 <tbl:cell column="name"><div class="link" 459 onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" 396 <tbl:cell column="name"><div 397 class="link table-item" 398 data-item-id="<%=itemId%>" 399 data-no-edit="<%=writePermission ? 0 : 1 %>" 400 tabindex="0" 460 401 title="<%=tooltip%>"><%=name%></div></tbl:cell> 461 402 <tbl:cell column="id"><%=item.getId()%></tbl:cell> … … 514 455 515 456 <base:buttongroup subclass="dialogbuttons"> 516 <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />517 <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />518 <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />457 <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> 458 <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> 459 <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> 519 460 </base:buttongroup> 520 461 -
trunk/www/filemanager/fileservers/view_fileserver.jsp
r6137 r6308 125 125 ConnectionManagerFactory cmf = ConnectionManagerUtil.getFactory(server.getConnectionManagerFactoryId()); 126 126 %> 127 <base:page title="<%=title%>" >128 <base:head scripts="table.js,tabcontrol .js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">127 <base:page title="<%=title%>" id="view-page"> 128 <base:head scripts="table.js,tabcontrol-2.js,~fileservers.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> 129 129 <ext:scripts context="<%=jspContext%>" /> 130 130 <ext:stylesheets context="<%=jspContext%>" /> 131 <script>132 function editItem()133 {134 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);135 }136 function shareItem()137 {138 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareFileServer', 600, 400);139 }140 function deleteItem()141 {142 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');143 }144 function restoreItem()145 {146 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');147 }148 function deleteItemPermanently()149 {150 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');151 }152 function itemDeleted()153 {154 Main.listItems('<%=ID%>', '<%=itemType.name()%>');155 }156 function showUsingItems()157 {158 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);159 }160 function setOwner()161 {162 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);163 }164 function runPlugin(cmd)165 {166 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);167 }168 </script>169 131 </base:head> 170 132 <base:body> … … 173 135 /><p:pathelement title="<%=HTML.encodeTags(server.getName())%>" 174 136 /></p:path> 137 <div id="page-data" data-item-id="<%=itemId%>"></div> 175 138 176 139 <t:tabcontrol … … 189 152 /> 190 153 <base:icon 154 id="btnDeletePermanently" 191 155 image="deleted.png" 192 onclick="deleteItemPermanently()"193 156 tooltip="This item has been flagged for deletion. Click to delete it now." 194 157 enabled="<%=deletePermanentlyPermission %>" 195 158 visible="<%=isRemoved%>" 196 159 /> 197 <base:icon image="used.png" 198 onclick="showUsingItems()" 160 <base:icon 161 id="btnUsingItems" 162 image="used.png" 199 163 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 200 164 visible="<%=isRemoved && isUsed%>" /> … … 203 167 <tbl:toolbar subclass="bottomborder"> 204 168 <tbl:button 169 id="btnEdit" 205 170 disabled="<%=!writePermission%>" 206 171 image="edit.png" 207 onclick="editItem()"208 172 title="Edit…" 209 173 tooltip="<%=writePermission ? "Edit this file server" : "You do not have permission to edit this file server"%>" 210 174 /> 211 175 <tbl:button 176 id="btnDelete" 212 177 disabled="<%=!deletePermission%>" 213 178 image="delete.png" 214 onclick="deleteItem()"215 179 title="Delete" 216 180 visible="<%=!server.isRemoved()%>" … … 218 182 /> 219 183 <tbl:button 184 id="btnRestore" 220 185 disabled="<%=!writePermission%>" 221 186 image="restore.png" 222 onclick="restoreItem()"223 187 title="Restore" 224 188 visible="<%=server.isRemoved()%>" … … 226 190 /> 227 191 <tbl:button 192 id="btnShare" 228 193 disabled="<%=!sharePermission%>" 229 194 image="share.png" 230 onclick="shareItem()"231 195 title="Share…" 232 196 tooltip="<%=sharePermission ? "Share this file server to other user, groups and projects" : "You do not have permission to share this file server"%>" 233 197 /> 234 198 <tbl:button 199 id="btnSetOwner" 235 200 disabled="<%=!setOwnerPermission%>" 236 201 image="take_ownership.png" 237 onclick="setOwner()"238 202 title="Set owner…" 239 203 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 240 204 /> 241 205 <tbl:button 206 id="btnImport" 242 207 image="import.png" 243 onclick="runPlugin('ImportItem')"208 data-plugin-type="IMPORT" 244 209 title="Import…" 245 210 tooltip="Import data" … … 247 212 /> 248 213 <tbl:button 249 image="export.png" 250 onclick="runPlugin('ExportItem')" 214 id="btnExport" 215 image="export.png" 216 data-plugin-type="EXPORT" 251 217 title="Export…" 252 218 tooltip="Export data" … … 254 220 /> 255 221 <tbl:button 256 image="runplugin.png" 257 onclick="runPlugin('RunPlugin')" 222 id="btnRunPlugin" 223 image="runplugin.png" 224 data-plugin-type="OTHER" 258 225 title="Run plugin…" 259 226 tooltip="Run a plugin" … … 264 231 <tbl:button 265 232 image="help.png" 266 onclick="<%="Main.openHelp('" + ID +"', 'fileserver.view.properties')"%>" 233 subclass="auto-init" 234 data-auto-init="help" 235 data-help-id="fileserver.view.properties" 267 236 title="Help…" 268 237 tooltip="Get help about this page" -
trunk/www/filemanager/index.jsp
r6192 r6308 93 93 redirect = "files/index.jsp?ID="+ID+"&cmd=EditItem&item_id="+request.getParameter("item_id"); 94 94 } 95 else if ("ShareItem".equals(cmd)) 96 { 97 redirect = "files2/index.jsp?ID="+ID+"&cmd=ShareItem&item_id="+request.getParameter("item_id"); 98 } 95 99 else if ("ViewFile".equals(cmd)) 96 100 { -
trunk/www/filemanager/manager.jsp
r6137 r6308 39 39 %> 40 40 <base:page title="Files and directories"> 41 <base:head ></base:head>41 <base:head /> 42 42 <base:body> 43 43 <h1>Files and directories</h1> -
trunk/www/filemanager/save_as.jsp
r6137 r6308 41 41 %> 42 42 <base:page title="Save as" type="popup"> 43 <base:head > 44 <script> 45 var defaultFileName = '<%=HTML.javaScriptEncode(fileName)%>'; 46 47 function setSelected(fileId, path) 48 { 49 var frm = document.forms['file']; 50 if (!fileId) 51 { 52 if (defaultFileName) 53 { 54 if (path.substring(path.length-1) != '/') path += '/'; 55 path += defaultFileName; 56 } 57 } 58 else 59 { 60 var i = path.lastIndexOf('/'); 61 if (i >= 0) defaultFileName = path.substring(i+1); 62 } 63 frm.file_id.value = fileId; 64 frm.path.value = path; 65 } 66 67 function returnSelected() 68 { 69 var frm = document.forms['file']; 70 if (frm.path.value) 71 { 72 window.opener.<%=callback%>(frm.path.value); 73 } 74 window.close(); 75 } 76 </script> 77 </base:head> 43 <base:head scripts="~save_as.js" /> 78 44 <base:body> 79 45 <h1>Save as</h1> 46 <div id="page-data" class="datacontainer" 47 data-default-filename="<%=HTML.javaScriptEncode(fileName)%>" 48 data-callback="<%=callback%>" 49 ></div> 80 50 <form name="file"> 81 51 <input type="hidden" name="file_id" value=""> … … 98 68 99 69 <base:buttongroup subclass="dialogbuttons"> 100 <base:button onclick="returnSelected();" title="Ok" />101 <base:button onclick="window.top.close();" title="Cancel" />70 <base:button id="btnOk" title="Ok" /> 71 <base:button id="close" title="Cancel" /> 102 72 </base:buttongroup> 103 73 -
trunk/www/filemanager/select_file.jsp
r6256 r6308 39 39 %> 40 40 <base:page title="<%=requestTitle == null ? title : requestTitle%>" type="popup"> 41 <base:head > 42 <script> 43 var selected = new Array(); 44 function setSelected(fileId, path) 45 { 46 selected[0] = {'id': fileId, 'path': path}; 47 updatePath(); 48 } 49 function addSelected(fileId, path) 50 { 51 if (getSelectedFileIndex(fileId) == -1) 52 { 53 selected[selected.length] = {'id': fileId, 'path': path}; 54 } 55 updatePath(); 56 } 57 function removeSelected(fileId) 58 { 59 var index = getSelectedFileIndex(fileId); 60 if (index >= 0) selected.splice(index, 1); 61 updatePath(); 62 } 63 64 function getSelectedFileIndex(fileId) 65 { 66 for (var i = 0; i < selected.length; i++) 67 { 68 if (selected[i].id == fileId) return i; 69 } 70 return -1; 71 } 72 73 function updatePath() 74 { 75 var path = ''; 76 for (var i = 0; i < selected.length; i++) 77 { 78 if (path != '') path += ', '; 79 path += selected[i].path; 80 } 81 document.getElementById('files').innerHTML = path; 82 83 } 84 function returnSelected() 85 { 86 var callback = '<%=callback%>'; 87 var notifyTarget = window.opener.document.getElementById(callback); 88 var callbackMethod = window.opener[callback]; 89 90 for (var i = 0; i < selected.length; i++) 91 { 92 if (notifyTarget) 93 { 94 // Send event to the target in the opener window 95 Events.sendCustomEvent(notifyTarget, 'base-selected', {'id': selected[i].id, 'name': selected[i].path}); 96 } 97 else if (callbackMethod) 98 { 99 // Call the callback method in the opener window 100 callbackMethod.call(null, selected[i].id, selected[i].path); 101 } 102 } 103 window.close(); 104 } 105 </script> 106 </base:head> 41 <base:head scripts="~select_file.js" /> 42 107 43 <base:body> 108 44 <h1><%=requestTitle == null ? title : requestTitle%></h1> 109 45 <div class="content bottomborder"> 46 <div id="page-data" class="datacontainer" 47 data-callback="<%=callback %>" 48 ></div> 49 110 50 <div id="f1" class="absolutefull" style="bottom: 5em;"><iframe 111 51 name="manager" id="idManager" src="frameset.jsp?ID=<%=ID%>&mode=<%=mode.getName()%>" … … 123 63 124 64 <base:buttongroup subclass="dialogbuttons"> 125 <base:button onclick="returnSelected();" title="Ok" />126 <base:button onclick="window.top.close();" title="Cancel" />65 <base:button id="btnOk" title="Ok" /> 66 <base:button id="close" title="Cancel" /> 127 67 </base:buttongroup> 128 68 </base:body> -
trunk/www/filemanager/upload/index.jsp
r6217 r6308 59 59 import="java.util.HashSet" 60 60 import="java.nio.charset.Charset" 61 import="org.json.simple.JSONObject" 62 import="org.json.simple.JSONArray" 61 63 %> 62 64 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 124 126 } 125 127 126 127 128 // Query to retrieve file types 128 129 final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); 129 130 subtypesQuery.include(Include.ALL); 130 131 131 // Query to retreive FileUnpacker plugins 132 final ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(null, "net.sf.basedb.util.zip.FileUnpacker"); 133 pluginQuery.order(Orders.asc(Hql.property("name"))); 134 pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); 135 List<PluginDefinition> plugins = pluginQuery.list(dc); 136 137 138 132 JSONArray jsonZipFormats = new JSONArray(); 133 if (file == null) 134 { 135 // Query to retreive FileUnpacker plugins (used for new uploads only) 136 final ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(null, "net.sf.basedb.util.zip.FileUnpacker"); 137 pluginQuery.order(Orders.asc(Hql.property("name"))); 138 pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); 139 List<PluginDefinition> plugins = pluginQuery.list(dc); 140 141 for (PluginDefinition plugin : plugins) 142 { 143 FileUnpacker unpacker = plugin.newInstance(FileUnpacker.class, sc, null, null); 144 JSONObject jsonZipFormat = new JSONObject(); 145 jsonZipFormat.put("id", plugin.getId()); 146 jsonZipFormat.put("name", unpacker.getFormatName()); 147 JSONArray jsonExtensions = new JSONArray(); 148 jsonExtensions.addAll(unpacker.getExtensions()); 149 jsonZipFormat.put("extensions", jsonExtensions); 150 jsonZipFormats.add(jsonZipFormat); 151 } 152 } 139 153 %> 140 <base:page type="popup" title="<%=title%>" >141 <base:head scripts=" tabcontrol.js" styles="tabcontrol.css,progressbar.css">154 <base:page type="popup" title="<%=title%>" id="select-file"> 155 <base:head scripts="~upload.js" styles="progressbar.css"> 142 156 <script> 143 // Validate the "File" tab144 function validateFile()145 {146 var frm = document.forms['file'];147 if (Main.trimString(frm.the_file.value) == '')148 {149 Forms.showNotification(frm.the_file, 'You must select a file to upload');150 return false;151 }152 return true;153 }154 155 // Submit the form156 function doUpload()157 {158 var frm = document.forms['file'];159 if (TabControl.validateActiveTab('settings'))160 {161 // Copy form values so they are sent BEFORE the file162 frm.check_md5.value = frm.temp_check_md5 && frm.temp_check_md5.checked ? "1" : "0";163 frm.write_protected.value = frm.temp_write_protected.checked ? "1" : "0";164 <%165 if (file == null)166 {167 %>168 frm.replace_existing.value = frm.temp_replace_existing.checked ? "1" : "0";169 <%170 }171 %>172 frm.compressed.value = frm.temp_compressed && frm.temp_compressed[frm.temp_compressed.selectedIndex].value;173 if (frm.temp_zip_format)174 {175 frm.zip_format.value = frm.temp_zip_format[frm.temp_zip_format.selectedIndex].value;176 frm.zip_unpack.value = frm.temp_zip_unpack.checked ? "1" : "0";177 frm.zip_overwrite.value = frm.temp_zip_overwrite.checked ? "1" : "0";178 frm.zip_keep.value = frm.temp_zip_keep.checked ? "1" : "0";179 }180 frm.characterSet.value = frm.temp_charset[frm.temp_charset.selectedIndex].value;181 frm.subtype_id.value = frm.temp_subtype_id[frm.temp_subtype_id.selectedIndex].value;182 frm.description.value = frm.temp_description.value;183 frm.submit();184 Main.hide('selectForm');185 Main.show('progressForm');186 sendProgressUpdateRequest();187 }188 }189 190 function sendProgressUpdateRequest()191 {192 var request = Ajax.getXmlHttpRequest();193 var url = 'ajax.jsp?ID=<%=ID%>&cmd=GetProgress&'+Math.random();194 request.open("GET", url, true);195 Ajax.setReadyStateHandler(request, progressUpdateCallback);196 request.send(null);197 }198 199 function progressUpdateCallback(request)200 {201 var progress = JSON.parse(request.responseText);202 if (progress && progress.status == 'ok' && progress.file)203 {204 var filename = progress.file;205 var transferredBytes = progress.transferredBytes;206 var totalBytes = progress.totalBytes;207 var timeInSeconds = progress.timeInSeconds;208 var message = progress.message;209 displayProgress(filename, transferredBytes, totalBytes, timeInSeconds, message);210 }211 setTimeout('sendProgressUpdateRequest()', 1500);212 }213 214 function abortUpload()215 {216 if (confirm('Are you sure you want to abort the upload? It cannot be resumed.'))217 {218 var request = Ajax.getXmlHttpRequest();219 var url = 'ajax.jsp?ID=<%=ID%>&cmd=Abort&'+Math.random();220 request.open("GET", url, true);221 request.send(null);222 }223 }224 225 function fileOnChange()226 {227 var frm = document.forms['file'];228 var filename = frm.the_file.value;229 var isZip = false;230 var zipIndex = 0;231 var longestMatch = 0;232 233 for (var i = 0; i < allZipFormats.length; i++)234 {235 var zf = allZipFormats[i];236 var matchLength = zf.matchesExtension(filename);237 if (matchLength > longestMatch)238 {239 isZip = true;240 zipIndex = zf.index;241 longestMatch = matchLength;242 }243 }244 245 if (frm.temp_zip_format)246 {247 frm['temp_zip_format'].disabled = !isZip;248 frm['temp_zip_format'].selectedIndex = zipIndex;249 frm['temp_zip_unpack'].disabled = !isZip;250 frm['temp_zip_overwrite'].disabled = !isZip || !frm['temp_zip_unpack'].checked;251 frm['temp_zip_keep'].disabled = !isZip || !frm['temp_zip_unpack'].checked;252 frm['temp_compressed'].disabled = isZip;253 if (isZip)254 {255 // Select '-auto-' if present, otherwise 'no'256 Forms.selectListOption(frm['temp_compressed'], '0');257 Forms.selectListOption(frm['temp_compressed'], '');258 }259 }260 }261 function unpackZipOnClick()262 {263 var frm = document.forms['file'];264 var checked = frm['temp_zip_unpack'].checked;265 if (!checked) frm['temp_zip_keep'].checked = true;266 frm['temp_zip_overwrite'].disabled = !checked;267 frm['temp_zip_keep'].disabled = !checked;268 }269 270 function initZipFormats()271 {272 var frm = document.forms['file'];273 var zipFormat = frm.temp_zip_format;274 if (zipFormat)275 {276 <%277 for (PluginDefinition plugin : plugins)278 {279 FileUnpacker unpacker = plugin.newInstance(FileUnpacker.class, sc, null, null);280 %>281 var extensions = [ '<%=Values.getString(unpacker.getExtensions(), "','", true)%>' ];282 var zf = new ZipFormat(zipFormat.length, <%=plugin.getId()%>, '<%=HTML.javaScriptEncode(unpacker.getFormatName())%>', extensions);283 zipFormat[zipFormat.length] = new Option(zf.toString(), zf.id);284 <%285 }286 %>287 }288 }289 290 function displayProgress(fileName, transferredBytes, totalBytes, transferTime, message)291 {292 // File name293 document.getElementById('fileName').innerHTML = 'Uploading ' + fileName + '...';294 295 // Percent done296 var percentDone = totalBytes == 0 ? 0 : Math.round(100 * transferredBytes / totalBytes);297 document.getElementById('percentText').innerHTML = percentDone+'%';298 var doneElement = document.getElementById('percentDone');299 doneElement.style.width = percentDone+'%';300 var remainElement = document.getElementById('percentRemain');301 remainElement.style.width = (100-percentDone)+'%';302 if (percentDone == 100) Main.hide('percentRemain');303 304 // Bytes305 document.getElementById('transferredBytes').innerHTML = Numbers.formatBytes(transferredBytes);306 document.getElementById('totalBytes').innerHTML = Numbers.formatBytes(totalBytes);307 308 // Times and rate309 document.getElementById('transferTime').innerHTML = Numbers.formatSeconds(transferTime);310 var transferRate = transferTime == 0 ? 0 : transferredBytes / transferTime;311 document.getElementById('transferRate').innerHTML = '(' + Numbers.formatBytes(transferRate) + '/s)';312 if (transferRate > 0)313 {314 var remainTime = parseInt((totalBytes-transferredBytes) / transferRate);315 document.getElementById('remainTime').innerHTML = Numbers.formatSeconds(remainTime) + ' (estimated)';316 }317 318 // Message319 if (message)320 {321 document.getElementById('message').innerHTML = message.replace(/(.*):(.*)/, '<b>$1:</b> $2');322 }323 }324 325 var allZipFormats = new Array();326 function ZipFormat(index, id, name, extensions)327 {328 this.index = index;329 this.id = id;330 this.name = name;331 this.extensions = extensions;332 333 allZipFormats[allZipFormats.length] = this;334 335 this.matchesExtension = function(filename)336 {337 var longestMatch = 0;338 for (var i = 0; i < this.extensions.length; i++)339 {340 var ext = '.' + this.extensions[i];341 var index = filename.lastIndexOf(ext);342 if (index > 0 && (index + ext.length == filename.length))343 {344 if (ext.length > longestMatch)345 {346 longestMatch = ext.length;347 }348 }349 }350 return longestMatch;351 }352 353 this.toString = function()354 {355 var s = this.name + " [";356 for (var i = 0; i < this.extensions.length; i++)357 {358 if (i > 0) s += ', ';359 s += '*.' + this.extensions[i];360 }361 s += ']';362 return s;363 }364 }365 366 157 // Callback that shows the upload-frame in case of an error 367 158 function exceptionHandlerCallback(windowName) … … 375 166 </script> 376 167 </base:head> 377 <base:body onload="initZipFormats()">168 <base:body> 378 169 <div id="selectForm" class="absolutefull"> 379 <h1><%=title%> <base:help tabcontrol="settings" /></h1> 170 <h1><%=title%> <base:help helpid="file.upload"/></h1> 171 172 <div id="page-data" class="datacontainer" 173 data-zip-formats="<%=HTML.encodeTags(jsonZipFormats.toJSONString()) %>" 174 ></div> 380 175 381 176 <form action="Upload?ID=<%=ID%>&directory_id=<%=directory.getId()%>" … … 394 189 <input type="hidden" name="characterSet" value=""> 395 190 396 <t:tabcontrol id="settings" 397 subclass="content dialogtabcontrol" 398 position="bottom" remember="false"> 399 <t:tab id="info" title="File" validate="validateFile()" helpid="file.upload"> 400 <table class="fullform input100"> 191 <div class="content"> 192 <table class="fullform input100 bottomborder"> 401 193 <tr> 402 194 <th>Directory</th> … … 406 198 <th>File</th> 407 199 <td> 408 <input class="text required" type="file" name="the_file" size="40" 409 onchange="fileOnChange()"> 200 <input class="text required" type="file" name="the_file" id="the_file" size="40"> 410 201 </td> 411 202 <td></td> … … 533 324 <td> 534 325 <select name="temp_zip_format" disabled> 535 <option>536 326 </select><br> 537 327 538 328 <input type="checkbox" name="temp_zip_unpack" id="tempZipUnpack" disabled 539 onclick="unpackZipOnClick()"><label for="tempZipUnpack">Unpack file</label><br>329 ><label for="tempZipUnpack">Unpack file</label><br> 540 330 <input type="checkbox" name="temp_zip_overwrite" id="tempZipOverwrite" disabled 541 331 ><label for="tempZipOverwrite">Overwrite existing files</label><br> … … 559 349 </tr> 560 350 </table> 561 </t:tab> 562 </t:tabcontrol> 351 </div> 563 352 </form> 564 353 565 <div class="legend" >354 <div class="legend" style="height: 1.75rem;"> 566 355 <base:icon image="required.png" />= required information 567 356 </div> 568 357 569 358 <base:buttongroup subclass="dialogbuttons"> 570 <base:button i mage="upload.png" onclick="doUpload()" title="Upload" />571 <base:button onclick="top.window.close()" title="Cancel" />359 <base:button id="btnUpload" image="upload.png" title="Upload" /> 360 <base:button id="close" title="Cancel" /> 572 361 </base:buttongroup> 573 362 </div> … … 581 370 <td style="width: 2em;"></td> 582 371 <td style=""> 583 <table id="bar" style="width: 100%;">372 <table class="bar" style="width: 100%;"> 584 373 <tr> 585 <td style="width: 0%;" id="percentDone"> </td>586 <td style="width: 100%;" id="percentRemain"> </td>374 <td style="width: 0%;" class="percentDone" id="percentDone"> </td> 375 <td style="width: 100%;" class="percentRemain" id="percentRemain"> </td> 587 376 </tr> 588 377 </table> 589 378 </td> 590 <td style="width: 3em;" id="percentText">0%</td>379 <td style="width: 3em;" class="percentText" id="percentText">0%</td> 591 380 <td style="width: 2em;"></td> 592 381 </tr> … … 602 391 </tr> 603 392 </table> 604 </td></tr></table> 393 </td> 394 </tr> 395 </table> 605 396 </div> 606 397 607 398 <base:buttongroup subclass="dialogbuttons"> 608 <base:button i mage="cancel.png" onclick="abortUpload()" title="Abort..." />399 <base:button id="btnAbort" image="cancel.png" title="Abort..." /> 609 400 </base:buttongroup> 610 401 </div> -
trunk/www/filemanager/upload/upload_results.jsp
r6136 r6308 27 27 import="net.sf.basedb.clients.web.util.HTML" 28 28 %> 29 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 29 30 <% 30 31 final String message = request.getParameter("message"); 31 32 %> 32 <html> 33 <head> 34 <script> 35 function showMessage() 36 { 37 window.top.location = '../../common/close_popup.jsp?refresh_opener=1&message=<%=HTML.urlEncode(message)%>'; 38 } 39 </script> 40 </head> 41 <body onload="showMessage();"> 42 </body> 43 </html> 33 <base:page type="iframe" title="Uploading..." id="upload-results"> 34 <base:head scripts="~upload.js" /> 35 <base:body> 36 <div id="page-data" 37 data-message="<%=HTML.encodeTags(message)%>" 38 ></div> 39 </base:body> 40 </base:page> 44 41 -
trunk/www/include/scripts/main-2.js
r6307 r6308 150 150 { 151 151 window.top.close(); 152 } 153 154 /** 155 Reload the current window. 156 */ 157 app.reloadWindow = function() 158 { 159 window.location.reload(); 152 160 } 153 161 … … 1398 1406 Event handler for clicking on item links. The item type and id should be stored 1399 1407 as data-item-type and data-item-id attributes on the target element. If data-no-edit 1400 is set to 1 the edit dialog is disabled. This event handler is automatically attached 1408 is set to 1 the edit dialog is disabled. If data-force-edit is set the edit 1409 dialog is alwasy used. This event handler is automatically attached 1401 1410 to auto-init elements with data-auto-init='item-link'. 1402 1411 */ … … 1407 1416 var itemId = Data.int(element, 'item-id'); 1408 1417 var noEdit = Data.int(element, 'no-edit', 0); 1418 var forceEdit = Data.int(element, 'force-edit', 0); 1409 1419 var extraUrl = Data.get(element, 'extra-url'); 1410 1420 var specialKey = event.altKey || event.ctrlKey || event.shiftKey; 1411 if (noEdit || !specialKey) 1412 { 1413 Main.viewOrEditItem(App.getSessionId(), itemType, itemId, false, extraUrl); 1414 } 1415 else 1416 { 1417 Main.viewOrEditItem(App.getSessionId(), itemType, itemId, true, extraUrl); 1418 } 1421 1422 var editDialog = forceEdit || (specialKey && !noEdit); 1423 1424 Main.viewOrEditItem(App.getSessionId(), itemType, itemId, editDialog, extraUrl); 1419 1425 } 1420 1426 … … 1464 1470 url += '?ID='+App.getSessionId(); 1465 1471 url += '&cmd=DownloadFile&item_id='+fileId; 1466 Main.openPopup(url, 'DownloadFile', 450, 300);1472 Dialogs.openPopup(url, 'DownloadFile', 450, 300); 1467 1473 } 1468 1474 -
trunk/www/include/scripts/main.js
r6294 r6308 508 508 this.controllers['EXTRAVALUETYPE'] = { url:'admin/extravaluetypes/index.jsp', width:600, height:400 }; 509 509 this.controllers['FEATURE'] = { url:'lims/arraydesigns/features/index.jsp', width:750, height:500, popup:true, edit:false, noAnyToAny:true }; 510 this.controllers['FILE'] = { url:'filemanager/index.jsp', width:600, height:400 };510 this.controllers['FILE'] = { url:'filemanager/index.jsp', iframe:true, width:600, height:400 }; 511 511 this.controllers['FILESERVER'] = { url:'filemanager/fileservers/index.jsp', width:600, height:400 }; 512 512 this.controllers['FORMULA'] = { url:'views/formulas/index.jsp', width:750, height:500 }; … … 596 596 { 597 597 var theWindow = window; 598 var i = 0; 599 while (theWindow.name != 'main' && i < 10) 600 { 601 theWindow = theWindow.parent; 602 i++; 598 if (!controller.iframe) 599 { 600 var i = 0; 601 while (theWindow.name != 'main' && i < 10) 602 { 603 theWindow = theWindow.parent; 604 i++; 605 } 603 606 } 604 607 Main.safeSetLocation(url, theWindow); -
trunk/www/include/scripts/table.js
r6291 r6308 281 281 var tableId = Data.get(target, 'table-id'); 282 282 var itemId = Data.int(target, 'item-id'); 283 283 284 var frm = document.forms[tableId]; 284 285 var mode = frm.mode ? frm.mode.value : 'default'; 285 286 286 if (mode == 'selectone') 287 287 { … … 639 639 640 640 // Should we use 'callback method' or 'event notification'? 641 var callback = frm.callback.value; 642 var notifyTarget = window.opener.document.getElementById(callback); 643 var callbackMethod = window.opener[callback]; 641 var callback = frm.callback ? frm.callback.value : null; 642 var notifyTarget = callback ? window.top.opener.document.getElementById(callback) : null; 643 var callbackMethod = callback ? window.top.opener[callback] : null; 644 645 if (!notifyTarget && !callbackMethod) 646 { 647 notifyTarget = tableDiv; 648 } 644 649 645 650 var numSelected = 0; … … 666 671 { 667 672 // Check boxes allow multiple selections 668 for (var i=0; i < frm.elements.length; i++) // >673 for (var i=0; i < frm.elements.length; i++) 669 674 { 670 675 var element = frm.elements[i];
Note: See TracChangeset
for help on using the changeset viewer.