Changeset 1738
- Timestamp:
- Jan 9, 2006, 12:12:47 PM (18 years ago)
- Location:
- trunk/www
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/include/scripts/table.js
r1716 r1738 153 153 { 154 154 Main.openPopup(getRoot()+'common/filter/configure.jsp?ID='+ID+'&table_id='+tableId+'&item_type='+itemType, 'ConfigureFilter', 500, 400); 155 } 156 157 this.submitToPopup = function(tableId, cmd, width, height) 158 { 159 var target = tableId+cmd; 160 Main.openPopup('', target, width, height); 161 var frm = document.forms[tableId]; 162 var oldCmd = frm.cmd.value; 163 frm.cmd.value = cmd; 164 frm.target = target; 165 frm.submit(); 166 frm.target = window.name; 167 frm.cmd.value = oldCmd; 155 168 } 156 169 -
trunk/www/include/styles/main.css
r1727 r1738 73 73 74 74 a { 75 color: #0000CC; 75 76 text-decoration: none; 76 77 } 77 78 78 79 a:hover { 80 text-decoration: underline; 81 } 82 83 .link { 84 color: #0000CC; 85 cursor: pointer; 86 } 87 88 .link:hover { 79 89 text-decoration: underline; 80 90 } -
trunk/www/views/reporters/edit_reporter.jsp
r1727 r1738 212 212 <td class="prompt">Type</td> 213 213 <td> 214 <select name="reportertype_id" <%=!readCurrentReporterType ? "disabled readonly class=\"disabled\"" : " class=\"required\""%>>214 <select name="reportertype_id" <%=!readCurrentReporterType ? "disabled readonly class=\"disabled\"" : ""%>> 215 215 <% 216 216 if (!readCurrentReporterType) … … 254 254 <a href="javascript:Main.zoom('Description', 'reporter', 'description')" title="Edit in larger window"><base:icon image="zoom.gif" /></a> 255 255 </td> 256 </tr>257 <tr>258 <td class="prompt">Last update</td>259 <td><%=Values.formatDate(reporter == null ? new Date() : reporter.getLastUpdate())%></td>260 256 </tr> 261 257 </table> -
trunk/www/views/reporters/index.jsp
r1730 r1738 74 74 if (cmd == null || "List".equals(cmd)) 75 75 { 76 // Display the list page without updatinging the current context 76 77 Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); 77 78 redirect = listPage; … … 79 80 else if ("UpdateContext".equals(cmd)) 80 81 { 82 // Display the list page after updating the current context from the request parameters 81 83 Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 82 84 redirect = listPage; … … 84 86 else if ("LoadContext".equals(cmd)) 85 87 { 88 // Display the list page after loading a saved context 86 89 int contextId = Values.getInt(request.getParameter("context")); 87 90 sc.loadContext(contextId); 88 91 redirect = listPage; 89 92 } 90 else if ("DeleteItems".equals(cmd)) 91 { 92 dc = sc.newDbControl(); 93 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 94 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 95 for (int reporterId : cc.getSelected()) 96 { 97 batcher.delete(reporterId); 98 } 99 batcher.close(); 100 dc.commit(); 101 redirect = listPage; 102 } 103 else if ("DeleteItem".equals(cmd)) 104 { 105 dc = sc.newDbControl(); 106 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 107 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 108 batcher.delete(cc.getId()); 109 batcher.close(); 110 dc.commit(); 111 redirect = listPage; 112 } 93 113 94 else if ("ViewItem".equals(cmd)) 114 95 { 96 // Display the view page for a single item 115 97 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 116 98 redirect = viewPage; … … 118 100 else if ("EditItem".equals(cmd)) 119 101 { 102 // Display the edit page for a single item (should be opened in a popup) 120 103 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 121 104 redirect = editPage; … … 123 106 else if ("NewItem".equals(cmd)) 124 107 { 108 // Display the edit page for a new item (should be opened in a popup) 125 109 if (!sc.hasPermission(Permission.CREATE, itemType)) 126 110 { … … 133 117 else if ("UpdateItem".equals(cmd)) 134 118 { 119 // Update the properties on an item (will close the popup) 135 120 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext); 136 121 dc = sc.newDbControl(); … … 158 143 reporter.setExtended(name, value); 159 144 } 160 161 145 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 162 146 if (reporter.getId() != 0) … … 174 158 cc.removeObject("item"); 175 159 } 176 else if ("Export".equals(cmd)) 177 { 160 else if ("DeleteItem".equals(cmd)) 161 { 162 // Delete a single item and then return to the list page 163 dc = sc.newDbControl(); 164 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 165 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 166 batcher.delete(cc.getId()); 167 batcher.close(); 168 dc.commit(); 169 redirect = listPage; 170 } 171 else if ("DeleteItems".equals(cmd)) 172 { 173 // Delete all selected items on the list page 174 dc = sc.newDbControl(); 175 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 176 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 177 for (int reporterId : cc.getSelected()) 178 { 179 batcher.delete(reporterId); 180 } 181 batcher.close(); 182 dc.commit(); 183 redirect = listPage; 184 } 185 else if ("ExportItems".equals(cmd)) 186 { 187 // Run an export plugin in a list context 178 188 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 179 189 final DataQuery<ReporterData> query = Reporter.getQuery(); 180 190 cc.configureQuery(query, true); 181 191 cc.setQuery(query); 182 forward = "../../common/export/configure.jsp"; 183 } 184 else if ("Import".equals(cmd)) 185 { 192 redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+reporters"; 193 } 194 else if ("ExportItem".equals(cmd)) 195 { 196 // Run an export plugin in single-item context 197 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 198 redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+reporter"; 199 } 200 else if ("ImportItems".equals(cmd)) 201 { 202 // Run an import plugin in a list context 186 203 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 187 204 final DataQuery<ReporterData> query = Reporter.getQuery(); … … 190 207 redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Import+reporters"; 191 208 } 192 else if ("RunPlugin".equals(cmd)) 193 { 209 else if ("ImportItem".equals(cmd)) 210 { 211 // Run an import plugin in single-item context 212 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 213 redirect = "../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Import+reporter"; 214 } 215 else if ("RunListPlugin".equals(cmd)) 216 { 217 // Run another plugin in a list context 194 218 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 195 219 final DataQuery<ReporterData> query = Reporter.getQuery(); 196 220 cc.configureQuery(query, true); 197 221 cc.setQuery(query); 198 redirect = "TODO"; 222 redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Run+plugin"; 223 } 224 else if ("RunPlugin".equals(cmd)) 225 { 226 // Run another plugin in single-item context 227 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 228 redirect = "../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Run+plugin"; 199 229 } 200 230 else -
trunk/www/views/reporters/list_reporters.jsp
r1730 r1738 83 83 cc.configureQuery(query, true); 84 84 85 Map<Plugin.MainType, Integer> plugin s= PluginDefinition.countPlugins(dc, guiContext);85 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); 86 86 final ItemQuery<ReporterType> typeQuery = ReporterType.getQuery(); 87 87 typeQuery.order(Orders.asc(Hql.property("name"))); … … 108 108 location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id='+itemId; 109 109 } 110 function itemOnClick(evt, itemId) 111 { 112 if (evt && (evt.altKey || evt.ctrlKey || evt.shiftKey)) 113 { 114 editItem(itemId); 115 } 116 else 117 { 118 viewItem(itemId); 119 } 120 } 110 121 function deleteItems() 111 122 { … … 145 156 Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); 146 157 } 147 function configureFilter() 148 { 149 Table.configureFilter('<%=ID%>', formId, '<%=itemType.name()%>'); 150 } 151 function configureExport() 152 { 153 Table.configureExport(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); 154 } 155 function configureImport() 156 { 157 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=Import', 'Import'+formId, 540, 460); 158 function runPlugin(cmd) 159 { 160 Table.submitToPopup(formId, cmd, 540, 460); 158 161 } 159 162 function returnSelected() … … 310 313 <tbl:button 311 314 image="import.gif" 312 onclick=" configureImport()"315 onclick="runPlugin('ImportItems')" 313 316 title="Import…" 314 317 tooltip="Import data" 315 visible="<%=plugin s.containsKey(Plugin.MainType.IMPORT)%>"318 visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" 316 319 /> 317 320 <tbl:button 318 321 image="export.gif" 319 onclick=" configureExport()"322 onclick="runPlugin('ExportItems')" 320 323 title="Export…" 321 tooltip="Export to XML or a tab-separated file"322 visible="<%=plugin s.containsKey(Plugin.MainType.EXPORT)%>"324 tooltip="Export data" 325 visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" 323 326 /> 324 327 <tbl:button 325 328 image="runplugin.gif" 326 onclick="runPlugin( )"329 onclick="runPlugin('RunListPlugin')" 327 330 title="Run plugin…" 328 331 tooltip="Run a plugin" 329 visible="<%=plugin s.containsKey(Plugin.MainType.OTHER)%>"332 visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" 330 333 /> 331 334 </tbl:toolbar> … … 406 409 visible="<%=mode.hasIcons()%>" 407 410 > </tbl:header> 408 <tbl:cell column="name">< a href="javascript:viewItem(<%=itemId%>)" title="Edit this reporter type"><%=name%></a></tbl:cell>411 <tbl:cell column="name"><div class="link" onclick="itemOnClick(event, <%=itemId%>)" title="View this reporter (use CTRL, ALT or SHIFT to edit)"><%=name%></div></tbl:cell> 409 412 <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell> 410 413 <tbl:cell column="symbol"><%=HTML.encodeTags(item.getSymbol())%></tbl:cell> -
trunk/www/views/reporters/view_reporter.jsp
r1727 r1738 42 42 import="net.sf.basedb.core.ItemResultIterator" 43 43 import="net.sf.basedb.core.PermissionDeniedException" 44 import="net.sf.basedb.core.PluginDefinition" 45 import="net.sf.basedb.core.plugin.GuiContext" 46 import="net.sf.basedb.core.plugin.Plugin" 44 47 import="net.sf.basedb.core.query.Orders" 45 48 import="net.sf.basedb.core.query.Hql" … … 48 51 import="net.sf.basedb.clients.web.util.Values" 49 52 import="java.util.Date" 53 import="java.util.Map" 50 54 %> 51 55 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 52 56 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> 53 57 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> 58 <%! 59 private static final Item itemType = Item.REPORTER; 60 private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); 61 %> 54 62 <% 55 final Item itemType = Item.REPORTER;56 63 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); 64 final String ID = sc.getId(); 57 65 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 58 66 final int itemId = cc.getId(); 59 final String ID = sc.getId();60 67 final float scale = Base.getScale(sc); 61 68 final DbControl dc = sc.newDbControl(); 62 69 try 63 70 { 71 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); 72 64 73 String title = null; 65 74 ReporterData reporter = Reporter.getById(dc, itemId); … … 94 103 } 95 104 } 105 function runPlugin(cmd) 106 { 107 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 540, 460); 108 } 96 109 </script> 97 110 </base:head> … … 118 131 title="Delete…" 119 132 tooltip="<%=deletePermission ? "Delete this reporter" : "You do not have permission to delete this reporter"%>" 133 /> 134 <tbl:button 135 image="import.gif" 136 onclick="runPlugin('ImportItem')" 137 title="Import…" 138 tooltip="Import data" 139 visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" 140 /> 141 <tbl:button 142 image="export.gif" 143 onclick="runPlugin('ExportItem')" 144 title="Export…" 145 tooltip="Export data" 146 visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" 147 /> 148 <tbl:button 149 image="runplugin.gif" 150 onclick="runPlugin('RunPlugin')" 151 title="Run plugin…" 152 tooltip="Run a plugin" 153 visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" 120 154 /> 121 155 </tbl:toolbar>
Note: See TracChangeset
for help on using the changeset viewer.