Changeset 6261
- Timestamp:
- Mar 27, 2013, 1:25:00 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/tab/TabControl.java
r6260 r6261 367 367 tabs = new StringBuilder(); 368 368 content = new StringBuilder(); 369 initialTab = null; 369 370 370 371 if (!noTabs) -
trunk/www/biomaterials/bioplateeventtypes/bioplateeventtypes.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'BIOPLATEEVENTTYPE', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 49 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 50 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 42 51 } 43 52 else if (pageId == 'list-page') -
trunk/www/biomaterials/bioplateeventtypes/view_eventtype.jsp
r6136 r6261 69 69 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 70 70 final int itemId = cc.getId(); 71 final String tab = Values.getStringOrNull(request.getParameter("tab")); 71 72 final float scale = Base.getScale(sc); 72 73 final DbControl dc = sc.newDbControl(); … … 88 89 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 89 90 %> 90 <base:page title="<%=title%>" >91 <base:head scripts="table.js,tabcontrol .js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">91 <base:page title="<%=title%>" id="view-page"> 92 <base:head scripts="table.js,tabcontrol-2.js,~bioplateeventtypes.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> 92 93 <ext:scripts context="<%=jspContext%>" /> 93 94 <ext:stylesheets context="<%=jspContext%>" /> 94 <script>95 function editItem()96 {97 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);98 }99 function deleteItem()100 {101 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');102 }103 function restoreItem()104 {105 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');106 }107 function deleteItemPermanently()108 {109 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');110 }111 function itemDeleted()112 {113 Main.listItems('<%=ID%>', '<%=itemType.name()%>');114 }115 function showUsingItems()116 {117 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);118 }119 function runPlugin(cmd)120 {121 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);122 }123 </script>124 95 </base:head> 125 96 <base:body> … … 128 99 /><p:pathelement title="<%=HTML.encodeTags(eventType.getName())%>" 129 100 /></p:path> 101 <div id="page-data" data-item-id="<%=itemId%>"></div> 130 102 131 103 <t:tabcontrol 132 104 id="main" 133 105 subclass="content mastertabcontrol" 134 active=" properties">106 active="<%=tab%>"> 135 107 <t:tab id="properties" title="Properties"> 136 108 <div> … … 139 111 <th class="itemstatus"> 140 112 <base:icon 113 id="btnDeletePermanently" 141 114 image="deleted.png" 142 onclick="deleteItemPermanently()"143 115 tooltip="This item has been flagged for deletion. Click to delete it now." 144 116 enabled="<%=deletePermanentlyPermission %>" 145 117 visible="<%=isRemoved%>" 146 118 /> 147 <base:icon image="used.png" 148 onclick="showUsingItems()" 119 <base:icon 120 id="btnUsingItems" 121 image="used.png" 149 122 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 150 123 visible="<%=isRemoved && isUsed%>" /> … … 154 127 155 128 <tbl:button 129 id="btnEdit" 156 130 disabled="<%=!writePermission%>" 157 131 image="edit.png" 158 onclick="editItem()"159 132 title="Edit…" 160 133 tooltip="<%=writePermission ? "Edit this bioplate event type" : "You do not have permission to edit this bioplate event type"%>" 161 134 /> 162 135 <tbl:button 136 id="btnDelete" 163 137 disabled="<%=!deletePermission%>" 164 138 image="delete.png" 165 onclick="deleteItem()"166 139 title="Delete" 167 140 visible="<%=!eventType.isRemoved()%>" … … 169 142 /> 170 143 <tbl:button 144 id="btnRestore" 171 145 disabled="<%=!writePermission%>" 172 146 image="restore.png" 173 onclick="restoreItem()"174 147 title="Restore" 175 148 visible="<%=eventType.isRemoved()%>" … … 177 150 /> 178 151 <tbl:button 152 id="btnImport" 179 153 image="import.png" 180 onclick="runPlugin('ImportItem')"154 data-plugin-type="IMPORT" 181 155 title="Import…" 182 156 tooltip="Import data" … … 184 158 /> 185 159 <tbl:button 186 image="export.png" 187 onclick="runPlugin('ExportItem')" 160 id="btnExport" 161 image="export.png" 162 data-plugin-type="EXPORT" 188 163 title="Export…" 189 164 tooltip="Export data" … … 191 166 /> 192 167 <tbl:button 193 image="runplugin.png" 194 onclick="runPlugin('RunPlugin')" 168 id="btnRunPlugin" 169 image="runplugin.png" 170 data-plugin-type="OTHER" 195 171 title="Run plugin…" 196 172 tooltip="Run a plugin" … … 201 177 <tbl:button 202 178 image="help.png" 203 onclick="<%="Main.openHelp('" + ID +"', 'bioplateeventtype.view.properties')"%>" 179 subclass="auto-init" 180 data-auto-init="help" 181 data-help-id="bioplateeventtype.view.properties" 204 182 title="Help…" 205 183 tooltip="Get help about this page" -
trunk/www/biomaterials/bioplates/bioplates.js
r6260 r6261 26 26 { 27 27 var bioplates = {}; 28 var wellInfoCache = []; 28 29 29 30 /** … … 39 40 else if (pageId == 'view-page') 40 41 { 41 // TODO 42 var itemId = Data.get('page-data', 'item-id'); 43 var attributes = {'item-type': 'BIOPLATE', 'item-id': itemId}; 44 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 45 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 46 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 47 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 48 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 49 Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); 50 Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); 51 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 52 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 53 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 54 55 Buttons.addClickHandler('btnMoveBioMaterial', bioplates.moveBioMaterial); 56 Buttons.addClickHandler('btnCreateChildBioPlate', bioplates.createChildBioPlate); 57 58 TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce); 59 TabControl.addTabActivateListener('main.overview', Overview.loadOnce); 60 TabControl.addTabActivateListener('main.history', History.loadOnce); 61 TabControl.addTabActivateListener('main.events', bioplates.viewEvents); 62 TabControl.addTabActivateListener('main.wells', bioplates.viewWells); 63 64 Events.addEventHandler('bioplate', 'mouseleave', bioplates.hideWellInfo); 42 65 } 43 66 else if (pageId == 'list-page') … … 60 83 } 61 84 85 // Add event handlers to the 'well' icons 86 bioplates.initElements = function(element, autoInit) 87 { 88 if (autoInit == 'well') 89 { 90 if (Data.int(element, 'allow-edit')) 91 { 92 Events.addEventHandler(element, 'click', bioplates.editWell); 93 } 94 if (Data.int(element, 'show-info')) 95 { 96 Events.addEventHandler(element, 'mouseover', bioplates.showWellInfo); 97 } 98 else 99 { 100 Events.addEventHandler(element, 'mouseover', bioplates.hideWellInfo); 101 } 102 } 103 } 104 105 106 bioplates.viewWells = function() 107 { 108 var bioplateId = Data.get('page-data', 'item-id'); 109 var url = 'wells/index.jsp?ID='+App.getSessionId(); 110 url += '&bioplate_id='+bioplateId; 111 location.replace(url); 112 } 113 114 bioplates.viewEvents = function() 115 { 116 var bioplateId = Data.get('page-data', 'item-id'); 117 var url = 'events/index.jsp?ID='+App.getSessionId(); 118 url += '&bioplate_id='+bioplateId; 119 location.replace(url); 120 } 121 122 bioplates.moveBioMaterial = function() 123 { 124 var bioplateId = Data.get('page-data', 'item-id'); 125 var url = 'index.jsp?ID='+App.getSessionId(); 126 url += '&cmd=MoveBioMaterial'; 127 url += '&item_id='+bioplateId; 128 Dialogs.openPopup(url, 'MoveBioMaterial', 900, 600); 129 } 130 131 bioplates.createChildBioPlate = function() 132 { 133 var bioplateId = Data.get('page-data', 'item-id'); 134 var url = 'index.jsp?ID='+App.getSessionId(); 135 url += '&cmd=CreateChildBioPlate'; 136 url += '&item_id='+bioplateId; 137 Dialogs.openPopup(url, 'CreateChildBioPlate', 900, 600); 138 } 139 140 bioplates.editWell = function(event) 141 { 142 var well = event.currentTarget; 143 var wellId = Data.get(well, 'item-id'); 144 Main.viewOrEditItem(App.getSessionId(), 'BIOWELL', wellId, true); 145 } 146 147 bioplates.showWellInfo = function(event) 148 { 149 var well = event.currentTarget; 150 var wellId = Data.get(well, 'item-id'); 151 var coordinate = Data.get(well, 'coordinate'); 152 153 // Display the 'wellInfo' postit note 154 var wellInfo = Doc.element('wellInfo'); 155 var wellTd = Doc.element('well.' + wellId); 156 var contentPos = Main.getElementPosition(Doc.element('main.content')); 157 var pos = Main.getElementPosition(wellTd); 158 wellInfo.style.left = (pos.left + pos.width - 5 - contentPos.left) + 'px'; 159 wellInfo.style.top = (pos.top + 10-contentPos.top) + 'px'; 160 Main.show('wellInfo'); 161 162 // Get the well information 163 var info = wellInfoCache['well.'+wellId]; 164 if (!info) 165 { 166 // Use Ajax to load the information 167 wellInfo.innerHTML = '[' + coordinate + '] loading, please wait...'; 168 info = bioplates.loadWellInfo(wellId); 169 } 170 var html; 171 var bioMaterial = info.bioMaterial; 172 if (bioMaterial) 173 { 174 if (bioMaterial.denied) 175 { 176 html = 'Denied'; 177 } 178 else 179 { 180 var id = bioMaterial.id; 181 var type = bioMaterial.type; 182 var subtype = bioMaterial.subtype; 183 html = Main.linkItem(App.getSessionId(), type, id, bioMaterial.editable, bioMaterial.name); 184 html += ': <b>' + type + '</b>'; 185 if (subtype) html += ' <span class="itemsubtype">[' + subtype.name + ']</span>'; 186 html += '<br>'+bioMaterial.description; 187 } 188 } 189 else 190 { 191 html = 'Empty'; 192 } 193 wellInfo.innerHTML = html; 194 } 195 196 bioplates.hideWellInfo = function() 197 { 198 Main.hide('wellInfo'); 199 } 200 201 bioplates.loadWellInfo = function(wellId) 202 { 203 var request = Ajax.getXmlHttpRequest(); 204 var url = 'wells/ajax.jsp?ID='+App.getSessionId(); 205 url += '&cmd=WellInfo&encodeStrings=1&item_id=' + wellId; 206 request.open("GET", url, false); 207 208 // NOTE! 'false' causes code to wait for the response. aka. 'Synchronous AJAX' or SJAX. 209 request.send(null); 210 var response = JSON.parse(request.responseText); 211 if (response.status != 'ok') 212 { 213 alert(response.message); 214 return false; 215 } 216 217 wellInfoCache['well.'+wellId] = response; 218 return response; 219 } 220 62 221 return bioplates; 63 222 }(); 64 223 224 Doc.addElementInitializer(BioPlates.initElements); 65 225 Doc.onLoad(BioPlates.initPage); -
trunk/www/biomaterials/bioplates/events/events.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'BIOPLATEEVENT', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); 49 Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); 50 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 51 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 52 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 42 53 } 43 54 else if (pageId == 'list-page') -
trunk/www/biomaterials/bioplates/events/view_event.jsp
r6210 r6261 77 77 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 78 78 final int itemId = cc.getId(); 79 final String tab = Values.getStringOrNull(request.getParameter("tab")); 79 80 final float scale = Base.getScale(sc); 80 81 final DbControl dc = sc.newDbControl(); … … 123 124 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 124 125 %> 125 <base:page title="<%=title%>" >126 <base:head scripts="table.js,tabcontrol .js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">126 <base:page title="<%=title%>" id="view-page"> 127 <base:head scripts="table.js,tabcontrol-2.js,~events.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> 127 128 <ext:scripts context="<%=jspContext%>" /> 128 129 <ext:stylesheets context="<%=jspContext%>" /> … … 187 188 } 188 189 %> 190 <div id="page-data" data-item-id="<%=itemId%>"></div> 191 189 192 <t:tabcontrol id="main" 190 193 subclass="content mastertabcontrol" 191 active=" properties">194 active="<%=tab %>"> 192 195 <t:tab id="properties" title="Properties"> 193 196 <div> … … 201 204 /> 202 205 <base:icon 206 id="btnDeletePermanently" 207 data-extra-url="<%="&bioplate_id=" + bioPlateId%>" 203 208 image="deleted.png" 204 onclick="deleteItemPermanently()"205 209 tooltip="This item has been flagged for deletion. Click to delete it now." 206 210 enabled="<%=deletePermanentlyPermission %>" 207 211 visible="<%=isRemoved%>" 208 212 /> 209 <base:icon image="used.png" 213 <base:icon 214 id="btnUsingItems" 215 image="used.png" 210 216 onclick="showUsingItems()" 211 217 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" … … 215 221 <tbl:toolbar subclass="bottomborder"> 216 222 <tbl:button 223 id="btnEdit" 217 224 disabled="<%=!writePermission%>" 218 225 image="edit.png" 219 onclick="editItem()"220 226 title="Edit…" 221 227 tooltip="<%=writePermission ? "Edit this event" : "You do not have permission to edit this event"%>" 222 228 /> 223 229 <tbl:button 230 id="btnDelete" 231 data-extra-url="<%="&bioplate_id=" + bioPlateId%>" 224 232 disabled="<%=!deletePermission%>" 225 233 image="delete.png" 226 onclick="deleteItem()"227 234 title="Delete" 228 235 visible="<%=!event.isRemoved()%>" … … 230 237 /> 231 238 <tbl:button 239 id="btnRestore" 240 data-extra-url="<%="&bioplate_id=" + bioPlateId%>" 232 241 disabled="<%=!writePermission%>" 233 242 image="restore.png" 234 onclick="restoreItem()"235 243 title="Restore" 236 244 visible="<%=event.isRemoved()%>" … … 238 246 /> 239 247 <tbl:button 248 id="btnShare" 240 249 disabled="<%=!sharePermission%>" 241 250 image="share.png" 242 onclick="shareItem()"243 251 title="Share…" 244 252 tooltip="<%=sharePermission ? "Share this event to other user, groups and projects" : "You do not have permission to share this event"%>" 245 253 /> 246 254 <tbl:button 255 id="btnSetOwner" 247 256 disabled="<%=!setOwnerPermission%>" 248 257 image="take_ownership.png" 249 onclick="setOwner()"250 258 title="Set owner…" 251 259 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 252 260 /> 253 261 <tbl:button 262 id="btnImport" 254 263 image="import.png" 255 onclick="runPlugin('ImportItem')"264 data-plugin-type="IMPORT" 256 265 title="Import…" 257 266 tooltip="Import data" … … 259 268 /> 260 269 <tbl:button 261 image="export.png" 262 onclick="runPlugin('ExportItem')" 270 id="btnExport" 271 image="export.png" 272 data-plugin-type="EXPORT" 263 273 title="Export…" 264 274 tooltip="Export data" … … 266 276 /> 267 277 <tbl:button 268 image="runplugin.png" 269 onclick="runPlugin('RunPlugin')" 278 id="btnRunPlugin" 279 image="runplugin.png" 280 data-plugin-type="OTHER" 270 281 title="Run plugin…" 271 282 tooltip="Run a plugin" -
trunk/www/biomaterials/bioplates/view_bioplate.jsp
r6255 r6261 83 83 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 84 84 final int itemId = cc.getId(); 85 final String tab = Values.getString (request.getParameter("tab"), "properties");85 final String tab = Values.getStringOrNull(request.getParameter("tab")); 86 86 final float scale = Base.getScale(sc); 87 87 final DbControl dc = sc.newDbControl(); … … 107 107 Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); 108 108 %> 109 <base:page title="<%=title%>" >110 <base:head scripts="tabcontrol .js,table.js"109 <base:page title="<%=title%>" id="view-page"> 110 <base:head scripts="tabcontrol-2.js,table.js,~bioplates.js" 111 111 styles="toolbar.css,table.css,headertabcontrol.css,path.css,plate.css"> 112 112 <ext:scripts context="<%=jspContext%>" /> 113 113 <ext:stylesheets context="<%=jspContext%>" /> 114 <script>115 function editItem()116 {117 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);118 }119 function shareItem()120 {121 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'SharePlate', 600, 400);122 }123 function deleteItem()124 {125 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');126 }127 function restoreItem()128 {129 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');130 }131 function deleteItemPermanently()132 {133 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');134 }135 function itemDeleted()136 {137 Main.listItems('<%=ID%>', '<%=itemType.name()%>');138 }139 function showUsingItems()140 {141 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);142 }143 function setOwner()144 {145 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);146 }147 function runPlugin(cmd)148 {149 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);150 }151 function viewWells()152 {153 location.href = 'wells/index.jsp?ID=<%=ID%>&bioplate_id=<%=itemId%>';154 }155 function viewEvents()156 {157 location.href = 'events/index.jsp?ID=<%=ID%>&bioplate_id=<%=itemId%>';158 }159 function switchTab(tabControlId, tabId)160 {161 if (tabId == 'wells')162 {163 viewWells();164 }165 else if (tabId == 'events')166 {167 viewEvents();168 }169 else170 {171 TabControl.setActiveTab(tabControlId, tabId);172 }173 }174 function editWell(wellId)175 {176 Main.viewOrEditItem('<%=ID%>', 'BIOWELL', wellId, true);177 }178 function showWellInfo(evt, coordinate, wellId)179 {180 // Display the 'wellInfo' postit note181 var wellInfo = document.getElementById('wellInfo');182 var wellTd = document.getElementById('well.' + wellId);183 var pos = Main.getElementPosition(wellTd);184 wellInfo.style.left = (pos.left + pos.width - 5) + 'px';185 wellInfo.style.top = (pos.top + 10) + 'px';186 Main.show('wellInfo');187 188 // Get the well information189 var info = wellInfoCache['well.'+wellId];190 if (!info)191 {192 // Use Ajax to load the information193 wellInfo.innerHTML = '[' + coordinate + '] loading, please wait...';194 info = loadWellInfo(wellId);195 }196 var html;197 var bioMaterial = info.bioMaterial;198 if (bioMaterial)199 {200 if (bioMaterial.denied)201 {202 html = 'Denied';203 }204 else205 {206 var id = bioMaterial.id;207 var type = bioMaterial.type;208 var subtype = bioMaterial.subtype;209 html = Main.linkItem('<%=ID%>', type, id, bioMaterial.editable, bioMaterial.name);210 html += ': <b>' + type + '</b>';211 if (subtype) html += ' <span class="itemsubtype">[' + subtype.name + ']</span>';212 html += '<br>'+bioMaterial.description;213 }214 }215 else216 {217 html = 'Empty';218 }219 wellInfo.innerHTML = html;220 }221 function hideWellInfo()222 {223 Main.hide('wellInfo');224 }225 var wellInfoCache = new Array();226 function loadWellInfo(wellId)227 {228 var request = Ajax.getXmlHttpRequest();229 var url = 'wells/ajax.jsp?ID=<%=ID%>&cmd=WellInfo&encodeStrings=1&item_id=' + wellId;230 request.open("GET", url, false);231 // NOTE! 'false' causes code to wait for the response. aka. 'Synchronous AJAX' or SJAX.232 request.send(null);233 var response = JSON.parse(request.responseText);234 if (response.status != 'ok')235 {236 alert(response.message);237 return false;238 }239 240 wellInfoCache['well.'+wellId] = response;241 return response;242 }243 function viewOrEditWellItem(event, itemType, itemId, editable)244 {245 //Main.viewOrEditItem('<%=ID%>', itemType, itemId, editable);246 Main.itemOnClick(event, '<%=ID%>', itemType, itemId, editable);247 }248 function moveBioMaterial()249 {250 Main.openPopup('index.jsp?ID=<%=ID%>&item_id=<%=itemId%>&cmd=MoveBioMaterial', 'MoveBioMaterial', 900, 600);251 }252 function createChildBioPlate()253 {254 Main.openPopup('index.jsp?ID=<%=ID%>&item_id=<%=itemId%>&cmd=CreateChildBioPlate', 'CreateChildBioPlate', 900, 600);255 }256 </script>257 114 </base:head> 258 115 <base:body> … … 260 117 title="Bioplates" href="<%="index.jsp?ID="+ID%>" /><p:pathelement 261 118 title="<%=HTML.encodeTags(bioplate.getName())%>" /></p:path> 119 <div id="page-data" data-item-id="<%=itemId%>"></div> 262 120 263 121 <t:tabcontrol id="main" 264 122 subclass="content mastertabcontrol" 265 active="<%=tab%>" switch="switchTab" remember="false">123 active="<%=tab%>"> 266 124 <t:tab id="properties" title="Properties"> 267 125 <div> … … 275 133 /> 276 134 <base:icon 135 id="btnDeletePermanently" 277 136 image="deleted.png" 278 onclick="deleteItemPermanently()"279 137 tooltip="This item has been flagged for deletion. Click to delete it now." 280 138 enabled="<%=deletePermanentlyPermission %>" 281 139 visible="<%=isRemoved%>" 282 140 /> 283 <base:icon image="used.png" 284 onclick="showUsingItems()" 141 <base:icon 142 id="btnUsingItems" 143 image="used.png" 285 144 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 286 145 visible="<%=isRemoved && isUsed%>" /> … … 289 148 <tbl:toolbar subclass="bottomborder"> 290 149 <tbl:button 150 id="btnEdit" 291 151 disabled="<%=!writePermission%>" 292 152 image="edit.png" 293 onclick="editItem()"294 153 title="Edit…" 295 154 tooltip="<%=writePermission ? "Edit this bioplate" : "You do not have permission to edit this bioplate"%>" 296 155 /> 297 156 <tbl:button 157 id="btnDelete" 298 158 disabled="<%=!deletePermission%>" 299 159 image="delete.png" 300 onclick="deleteItem()"301 160 title="Delete" 302 161 visible="<%=!bioplate.isRemoved()%>" … … 304 163 /> 305 164 <tbl:button 165 id="btnRestore" 306 166 disabled="<%=!writePermission%>" 307 167 image="restore.png" 308 onclick="restoreItem()"309 168 title="Restore" 310 169 visible="<%=bioplate.isRemoved()%>" … … 312 171 /> 313 172 <tbl:button 173 id="btnShare" 314 174 disabled="<%=!sharePermission%>" 315 175 image="share.png" 316 onclick="shareItem()"317 176 title="Share…" 318 177 tooltip="<%=sharePermission ? "Share this bioplate to other user, groups and projects" : "You do not have permission to share this bioplate"%>" 319 178 /> 320 179 <tbl:button 180 id="btnSetOwner" 321 181 disabled="<%=!setOwnerPermission%>" 322 182 image="take_ownership.png" 323 onclick="setOwner()"324 183 title="Set owner…" 325 184 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 326 185 /> 327 186 <tbl:button 187 id="btnMoveBioMaterial" 328 188 image="move_to_plate.png" 329 onclick="moveBioMaterial()"330 189 title="Move biomaterial…" 331 190 tooltip="Move biomaterial on this plate to another plate" 332 191 /> 333 192 <tbl:button 193 id="btnCreateChildBioPlate" 334 194 image="add.png" 335 onclick="createChildBioPlate()"336 195 title="<%="Create child bioplate" + (bioMaterialType == Item.EXTRACT ? "/bioassay" : "") +"…"%>" 337 196 tooltip="Create one or more child biomaterial plates" … … 339 198 /> 340 199 <tbl:button 200 id="btnImport" 341 201 image="import.png" 342 onclick="runPlugin('ImportItem')"202 data-plugin-type="IMPORT" 343 203 title="Import…" 344 204 tooltip="Import data" … … 346 206 /> 347 207 <tbl:button 348 image="export.png" 349 onclick="runPlugin('ExportItem')" 208 id="btnExport" 209 image="export.png" 210 data-plugin-type="EXPORT" 350 211 title="Export…" 351 212 tooltip="Export data" … … 353 214 /> 354 215 <tbl:button 355 image="runplugin.png" 356 onclick="runPlugin('RunPlugin')" 216 id="btnRunPlugin" 217 image="runplugin.png" 218 data-plugin-type="OTHER" 357 219 title="Run plugin…" 358 220 tooltip="Run a plugin" … … 363 225 <tbl:button 364 226 image="help.png" 365 onclick="<%="Main.openHelp('" + ID +"', 'plate.view.properties')"%>" 227 subclass="auto-init" 228 data-auto-init="help" 229 data-help-id="plate.view.properties" 366 230 title="Help…" 367 231 tooltip="Get help about this page" … … 433 297 </table> 434 298 </td> 435 <td style="width: 50%; padding: 1em;" onmouseout="hideWellInfo();"> 436 <table class="plate" onmouseout="event.cancelBubble=true"> 299 <td style="width: 50%; padding: 1em;" id="bioplate"> 300 <div class="postit" id="wellInfo" style="display:none; width: 20em; min-height: 3em;"></div> 301 <table class="plate"> 437 302 <% 438 303 int columns = geometry.getColumns(); … … 469 334 470 335 boolean deniedBioMaterial = false; 336 boolean allowEdit = false; 337 boolean showInfo = false; 471 338 472 String cls = "well ";339 String cls = "well auto-init"; 473 340 String tooltip = ""; 474 String onClick = null;475 String onMouseOver = "hideWellInfo()";476 477 341 if (isEmpty) 478 342 { … … 482 346 // The used is allowed to add biomaterial to the empty well 483 347 cls += " editable"; 484 onClick = "editWell(" + well.getId() + ")";348 allowEdit = true; 485 349 tooltip = "Add biomaterial to this well"; 486 350 } … … 489 353 // The well has been used and it is not allowed to add biomaterial 490 354 cls += " wasused"; 491 onMouseOver = "showWellInfo(event, '" + row + (c+1) + "', " + well.getId() + ")";355 showInfo = true; 492 356 tooltip = "This well has already been used"; 493 357 } … … 505 369 { 506 370 MeasuredBioMaterial bioMaterial = well.getBioMaterial(); 507 onMouseOver = "showWellInfo(event, '" + row + (c+1) + "', " + well.getId() + ")";371 showInfo = true; 508 372 if (usePermission && canClearBioMaterial && bioMaterial.hasPermission(Permission.WRITE)) 509 373 { 510 374 // The user is allowed to replace/remove the biomaterial in the well 511 375 cls += " editable"; 512 onClick = "editWell(" + well.getId() + ")";376 allowEdit = true; 513 377 if (canAddBioMaterial) 514 378 { … … 535 399 } 536 400 %> 537 <td class="<%=cls%>" id="well.<%=well.getId()%>" 538 <%=onClick != null ? "onclick=\"" + onClick + "\"" : ""%> 539 <%=onMouseOver != null ? "onmouseover=\"" + onMouseOver + "\"" : ""%> 401 <td class="<%=cls%>" 402 id="well.<%=well.getId()%>" 403 data-auto-init="well" 404 data-allow-edit="<%=allowEdit ? 1 : 0 %>" 405 data-show-info="<%=showInfo ? 1 : 0 %>" 406 data-item-id="<%=well.getId()%>" 407 data-coordinate="<%=well.getCoordinate()%>" 540 408 title="<%=tooltip%>"></td> 541 409 <% … … 567 435 568 436 <t:tab id="annotations" title="Annotations" 569 tooltip="View annotation values" clazz="white" 570 activate="AnnotationsList.loadOnce()"> 437 tooltip="View annotation values" clazz="white"> 571 438 <jsp:include page="../../common/annotations/list_frameset.jsp"> 572 439 <jsp:param name="item_type" value="<%=itemType.name()%>" /> … … 579 446 <t:tab id="events" title="Plate events" /> 580 447 <t:tab id="overview" title="Overview" 581 tooltip="Display a tree overview of related items" 582 activate="Overview.loadOnce()"> 448 tooltip="Display a tree overview of related items"> 583 449 <jsp:include page="../../common/overview/overview.jsp"> 584 450 <jsp:param name="item_type" value="<%=itemType.name()%>" /> … … 589 455 <t:tab id="history" title="Change history" 590 456 tooltip="Displays a log of all modifications made to this item" 591 visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>" 592 activate="History.loadOnce()"> 457 visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>"> 593 458 <jsp:include page="../../common/history/frameset.jsp"> 594 459 <jsp:param name="item_type" value="<%=itemType.name()%>" /> … … 599 464 </t:tabcontrol> 600 465 601 <div class="postit" id="wellInfo" style="display:none; width: 20em; min-height: 3em;" onmouseout="event.cancelBubble=true"></div>602 466 </base:body> 603 467 </base:page> -
trunk/www/biomaterials/bioplatetypes/bioplatetypes.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'BIOPLATETYPE', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 49 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 50 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 42 51 } 43 52 else if (pageId == 'list-page') -
trunk/www/biomaterials/bioplatetypes/view_platetype.jsp
r6136 r6261 70 70 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 71 71 final int itemId = cc.getId(); 72 final String tab = Values.getStringOrNull(request.getParameter("tab")); 72 73 final float scale = Base.getScale(sc); 73 74 final DbControl dc = sc.newDbControl(); … … 89 90 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 90 91 %> 91 <base:page title="<%=title%>" >92 <base:head scripts="table.js,tabcontrol .js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">92 <base:page title="<%=title%>" id="view-page"> 93 <base:head scripts="table.js,tabcontrol-2.js,~bioplatetypes.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> 93 94 <ext:scripts context="<%=jspContext%>" /> 94 95 <ext:stylesheets context="<%=jspContext%>" /> 95 <script>96 function editItem()97 {98 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);99 }100 function deleteItem()101 {102 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');103 }104 function restoreItem()105 {106 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');107 }108 function deleteItemPermanently()109 {110 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');111 }112 function itemDeleted()113 {114 Main.listItems('<%=ID%>', '<%=itemType.name()%>');115 }116 function showUsingItems()117 {118 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);119 }120 function runPlugin(cmd)121 {122 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);123 }124 </script>125 96 </base:head> 126 97 <base:body> … … 128 99 /><p:pathelement title="<%=HTML.encodeTags(plateType.getName())%>" 129 100 /></p:path> 101 <div id="page-data" data-item-id="<%=itemId%>"></div> 130 102 131 103 <t:tabcontrol 132 104 id="main" 133 105 subclass="content mastertabcontrol" 134 active=" properties">106 active="<%=tab%>"> 135 107 <t:tab id="properties" title="Properties"> 136 108 <div> … … 139 111 <th class="itemstatus"> 140 112 <base:icon 113 id="btnDeletePermanently" 141 114 image="deleted.png" 142 onclick="deleteItemPermanently()"143 115 tooltip="This item has been flagged for deletion. Click to delete it now." 144 116 enabled="<%=deletePermanentlyPermission %>" 145 117 visible="<%=isRemoved%>" 146 118 /> 147 <base:icon image="used.png" 148 onclick="showUsingItems()" 119 <base:icon 120 id="btnUsingItems" 121 image="used.png" 149 122 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 150 123 visible="<%=isRemoved && isUsed%>" /> … … 153 126 <tbl:toolbar subclass="bottomborder"> 154 127 <tbl:button 128 id="btnEdit" 155 129 disabled="<%=!writePermission%>" 156 130 image="edit.png" 157 onclick="editItem()"158 131 title="Edit…" 159 132 tooltip="<%=writePermission ? "Edit this bioplate type" : "You do not have permission to edit this bioplate type"%>" 160 133 /> 161 134 <tbl:button 135 id="btnDelete" 162 136 disabled="<%=!deletePermission%>" 163 137 image="delete.png" 164 onclick="deleteItem()"165 138 title="Delete" 166 139 visible="<%=!plateType.isRemoved()%>" … … 168 141 /> 169 142 <tbl:button 143 id="btnRestore" 170 144 disabled="<%=!writePermission%>" 171 145 image="restore.png" 172 onclick="restoreItem()"173 146 title="Restore" 174 147 visible="<%=plateType.isRemoved()%>" … … 176 149 /> 177 150 <tbl:button 151 id="btnImport" 178 152 image="import.png" 179 onclick="runPlugin('ImportItem')"153 data-plugin-type="IMPORT" 180 154 title="Import…" 181 155 tooltip="Import data" … … 183 157 /> 184 158 <tbl:button 185 image="export.png" 186 onclick="runPlugin('ExportItem')" 159 id="btnExport" 160 image="export.png" 161 data-plugin-type="EXPORT" 187 162 title="Export…" 188 163 tooltip="Export data" … … 190 165 /> 191 166 <tbl:button 192 image="runplugin.png" 193 onclick="runPlugin('RunPlugin')" 167 id="btnRunPlugin" 168 image="runplugin.png" 169 data-plugin-type="OTHER" 194 170 title="Run plugin…" 195 171 tooltip="Run a plugin" … … 200 176 <tbl:button 201 177 image="help.png" 202 onclick="<%="Main.openHelp('" + ID +"', 'bioplatetype.view.properties')"%>" 178 subclass="auto-init" 179 data-auto-init="help" 180 data-help-id="bioplatetype.view.properties" 203 181 title="Help…" 204 182 tooltip="Get help about this page" -
trunk/www/biomaterials/biosources/view_biosource.jsp
r6255 r6261 82 82 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 83 83 final int itemId = cc.getId(); 84 final String tab = Values.getString (request.getParameter("tab"), "properties");84 final String tab = Values.getStringOrNull(request.getParameter("tab")); 85 85 final float scale = Base.getScale(sc); 86 86 final DbControl dc = sc.newDbControl(); -
trunk/www/biomaterials/events/events.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'BIOMATERIALEVENT', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItemPermanently, attributes); 45 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 46 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 47 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 42 48 } 43 49 else if (pageId == 'list-page') -
trunk/www/biomaterials/events/view_event.jsp
r6216 r6261 81 81 final int itemId = cc.getId(); 82 82 final Item bioMaterialType = Item.valueOf(request.getParameter("biomaterial_type")); 83 final String tab = Values.getStringOrNull(request.getParameter("tab")); 83 84 final int bioMaterialId = Values.getInt(request.getParameter("biomaterial_id")); 84 85 final float scale = Base.getScale(sc); … … 128 129 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 129 130 %> 130 <base:page title="<%=title%>" >131 <base:head scripts="table.js,tabcontrol .js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">131 <base:page title="<%=title%>" id="view-page"> 132 <base:head scripts="table.js,tabcontrol-2.js,~events.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> 132 133 <ext:scripts context="<%=jspContext%>" /> 133 134 <ext:stylesheets context="<%=jspContext%>" /> … … 156 157 href="<%="index.jsp?ID="+ID+"&biomaterial_id="+bioMaterialId+"&biomaterial_type="+bioMaterialType.name()%>" 157 158 /><p:pathelement title="Event" /></p:path> 159 <div id="page-data" data-item-id="<%=itemId%>"></div> 158 160 159 161 <t:tabcontrol id="main" 160 162 subclass="content mastertabcontrol" 161 active=" properties">163 active="<%=tab%>"> 162 164 <t:tab id="properties" title="Properties"> 163 165 <div> … … 168 170 <tbl:toolbar subclass="bottomborder"> 169 171 <tbl:button 172 id="btnEdit" 170 173 disabled="<%=!writePermission%>" 174 data-extra-url="<%="&biomaterial_type="+bioMaterialType.name()+"&biomaterial_id="+bioMaterialId%>" 171 175 image="edit.png" 172 onclick="editItem()"173 176 title="Edit…" 174 177 tooltip="<%=writePermission ? "Edit this event" : "You do not have permission to edit this event"%>" 175 178 /> 176 179 <tbl:button 180 id="btnDelete" 181 data-confirm="1" 182 data-extra-url="<%="&biomaterial_type="+bioMaterialType.name()+"&biomaterial_id="+bioMaterialId%>" 177 183 disabled="<%=!deletePermission%>" 178 184 image="delete.png" 179 onclick="deleteItem()"180 185 title="Delete" 181 186 tooltip="<%=deletePermission ? "Delete this event" : "You do not have permission to event this event"%>" 182 187 /> 183 188 <tbl:button 189 id="btnImport" 184 190 image="import.png" 185 onclick="runPlugin('ImportItem')"191 data-plugin-type="IMPORT" 186 192 title="Import…" 187 193 tooltip="Import data" … … 189 195 /> 190 196 <tbl:button 191 image="export.png" 192 onclick="runPlugin('ExportItem')" 197 id="btnExport" 198 image="export.png" 199 data-plugin-type="EXPORT" 193 200 title="Export…" 194 201 tooltip="Export data" … … 196 203 /> 197 204 <tbl:button 198 image="runplugin.png" 199 onclick="runPlugin('RunPlugin')" 205 id="btnRunPlugin" 206 image="runplugin.png" 207 data-plugin-type="OTHER" 200 208 title="Run plugin…" 201 209 tooltip="Run a plugin" -
trunk/www/biomaterials/extracts/extracts.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'EXTRACT', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); 49 Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); 50 Buttons.addClickHandler('btnNewExtract', extracts.newExtract, attributes); 51 Buttons.addClickHandler('btnNewPhysicalBioAssay', extracts.newPhysicalBioAssay, attributes); 52 Buttons.addClickHandler('btnNewRawBioAssay', extracts.newRawBioAssay, attributes); 53 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 54 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 55 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 56 57 TabControl.addTabActivateListener('main.events', extracts.viewEvents); 58 TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce); 59 TabControl.addTabActivateListener('main.overview', Overview.loadOnce); 60 TabControl.addTabActivateListener('main.history', History.loadOnce); 42 61 } 43 62 else if (pageId == 'list-page') … … 57 76 Buttons.addClickHandler('btnPlaceOnPlate', extracts.placeOnPlateOnClick); 58 77 Buttons.addClickHandler('btnNewPooledItem', extracts.newPooledItemOnClick); 59 Buttons.addClickHandler('btnNewPhysicalBioAssay', extracts.newPhysicalBioAssay OnClick);78 Buttons.addClickHandler('btnNewPhysicalBioAssay', extracts.newPhysicalBioAssayFromTable); 60 79 61 80 Buttons.addClickHandler('close', App.closeWindow); … … 78 97 79 98 /* 80 Create a new sample with the current sampleas the parent99 Create a new extract with the current extract as the parent 81 100 */ 82 101 extracts.newExtract = function(event) … … 87 106 88 107 /* 89 Create a new extract with the current sampleas the parent108 Create a new raw bioassay with the current extract as the parent 90 109 */ 91 110 extracts.newRawBioAssay = function(event) … … 93 112 var extractId = Data.int(event.currentTarget, 'item-id'); 94 113 Main.viewOrEditItem(App.getSessionId(), 'RAWBIOASSAY', 0, true, '&extract_id='+extractId); 114 } 115 116 /* 117 Create a new physical bioassay with the current extract as the parent 118 */ 119 extracts.newPhysicalBioAssay = function(event) 120 { 121 var extractId = Data.int(event.currentTarget, 'item-id'); 122 Main.viewOrEditItem(App.getSessionId(), 'PHYSICALBIOASSAY', 0, true, '&extract_id='+extractId); 95 123 } 96 124 … … 117 145 } 118 146 119 extracts.newPhysicalBioAssay OnClick= function()147 extracts.newPhysicalBioAssayFromTable = function() 120 148 { 121 149 if (!Table.checkIfSelected('extracts')) … … 125 153 Table.submitToPopup('extracts', 'NewPhysicalBioAssay', 750, 500); 126 154 } 155 156 extracts.viewEvents = function() 157 { 158 var extractId = Data.get('page-data', 'item-id'); 159 var url = '../events/index.jsp?ID='+App.getSessionId(); 160 url += '&cmd=List&biomaterial_id='+extractId; 161 url += '&biomaterial_type=EXTRACT'; 162 location.replace(url); 163 } 127 164 128 165 return extracts; -
trunk/www/biomaterials/extracts/view_extract.jsp
r6255 r6261 94 94 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 95 95 final int itemId = cc.getId(); 96 final String tab = Values.getString (request.getParameter("tab"), "properties");96 final String tab = Values.getStringOrNull(request.getParameter("tab")); 97 97 final float scale = Base.getScale(sc); 98 98 final DbControl dc = sc.newDbControl(); … … 121 121 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 122 122 %> 123 <base:page title="<%=title%>" >124 <base:head scripts="table.js,tabcontrol .js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">123 <base:page title="<%=title%>" id="view-page"> 124 <base:head scripts="table.js,tabcontrol-2.js,~extracts.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> 125 125 <ext:scripts context="<%=jspContext%>" /> 126 126 <ext:stylesheets context="<%=jspContext%>" /> 127 <script>128 function editItem()129 {130 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);131 }132 function newExtract()133 {134 Main.viewOrEditItem('<%=ID%>', 'EXTRACT', 0, true, '&extract_id=<%=itemId%>');135 }136 function shareItem()137 {138 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareExtract', 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 function viewEvents()169 {170 location.href = '../events/index.jsp?ID=<%=ID%>&cmd=List&biomaterial_id=<%=itemId%>&biomaterial_type=<%=itemType.name()%>';171 }172 function switchTab(tabControlId, tabId)173 {174 if (TabControl.isActive(tabControlId, tabId)) return;175 if (tabId == 'events')176 {177 viewEvents();178 }179 else180 {181 TabControl.setActiveTab(tabControlId, tabId);182 }183 }184 function newPhysicalBioAssay()185 {186 Main.viewOrEditItem('<%=ID%>', 'PHYSICALBIOASSAY', 0, true, '&extract_id='+<%=itemId%>);187 }188 function newRawBioAssay()189 {190 Main.viewOrEditItem('<%=ID%>', 'RAWBIOASSAY', 0, true, '&extract_id='+<%=itemId%>);191 }192 </script>193 127 </base:head> 194 128 <base:body> … … 196 130 title="Extracts" href="<%="index.jsp?ID="+ID%>" /><p:pathelement 197 131 title="<%=HTML.encodeTags(extract.getName())%>" /></p:path> 132 <div id="page-data" data-item-id="<%=itemId%>"></div> 198 133 199 <t:tabcontrol id="main" subclass="content mastertabcontrol" active="<%=tab%>" switch="switchTab" remember="false">134 <t:tabcontrol id="main" subclass="content mastertabcontrol" active="<%=tab%>"> 200 135 <t:tab id="properties" title="Properties"> 201 136 <div> … … 209 144 /> 210 145 <base:icon 146 id="btnDeletePermanently" 211 147 image="deleted.png" 212 onclick="deleteItemPermanently()"213 148 tooltip="This item has been flagged for deletion. Click to delete it now." 214 149 enabled="<%=deletePermanentlyPermission %>" 215 150 visible="<%=isRemoved%>" 216 151 /> 217 <base:icon image="used.png" 218 onclick="showUsingItems()" 152 <base:icon 153 id="btnUsingItems" 154 image="used.png" 219 155 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 220 156 visible="<%=isRemoved && isUsed%>" /> … … 223 159 <tbl:toolbar subclass="bottomborder"> 224 160 <tbl:button 161 id="btnEdit" 225 162 disabled="<%=!writePermission%>" 226 163 image="edit.png" 227 onclick="editItem()"228 164 title="Edit…" 229 165 tooltip="<%=writePermission ? "Edit this extract" : "You do not have permission to edit this extract"%>" 230 166 /> 231 167 <tbl:button 168 id="btnDelete" 232 169 disabled="<%=!deletePermission%>" 233 170 image="delete.png" 234 onclick="deleteItem()"235 171 title="Delete" 236 172 visible="<%=!extract.isRemoved()%>" … … 238 174 /> 239 175 <tbl:button 176 id="btnRestore" 240 177 disabled="<%=!writePermission%>" 241 178 image="restore.png" 242 onclick="restoreItem()"243 179 title="Restore" 244 180 visible="<%=extract.isRemoved()%>" … … 246 182 /> 247 183 <tbl:button 184 id="btnShare" 248 185 disabled="<%=!sharePermission%>" 249 186 image="share.png" 250 onclick="shareItem()"251 187 title="Share…" 252 188 tooltip="<%=sharePermission ? "Share this extract to other user, groups and projects" : "You do not have permission to share this extract"%>" 253 189 /> 254 190 <tbl:button 191 id="btnSetOwner" 255 192 disabled="<%=!setOwnerPermission%>" 256 193 image="take_ownership.png" 257 onclick="setOwner()"258 194 title="Set owner…" 259 195 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 260 196 /> 261 197 <tbl:button 198 id="btnNewExtract" 262 199 image="add.png" 263 onclick="newExtract()"264 200 title="New child extract…" 265 201 tooltip="Create a new child extract from this extract" … … 267 203 /> 268 204 <tbl:button 205 id="btnNewPhysicalBioAssay" 269 206 image="add.png" 270 onclick="newPhysicalBioAssay()"271 207 title="New physical bioassay…" 272 208 tooltip="Create a new physical bioassay from this extract" … … 274 210 /> 275 211 <tbl:button 212 id="btnNewRawBioAssay" 276 213 image="add.png" 277 onclick="newRawBioAssay()"278 214 title="New raw bioassay…" 279 215 tooltip="Create a new raw bioassay from this extract" … … 281 217 /> 282 218 <tbl:button 219 id="btnImport" 283 220 image="import.png" 284 onclick="runPlugin('ImportItem')"221 data-plugin-type="IMPORT" 285 222 title="Import…" 286 223 tooltip="Import data" … … 288 225 /> 289 226 <tbl:button 290 image="export.png" 291 onclick="runPlugin('ExportItem')" 227 id="btnExport" 228 image="export.png" 229 data-plugin-type="EXPORT" 292 230 title="Export…" 293 231 tooltip="Export data" … … 295 233 /> 296 234 <tbl:button 297 image="runplugin.png" 298 onclick="runPlugin('RunPlugin')" 235 id="btnRunPlugin" 236 image="runplugin.png" 237 data-plugin-type="OTHER" 299 238 title="Run plugin…" 300 239 tooltip="Run a plugin" … … 305 244 <tbl:button 306 245 image="help.png" 307 onclick="<%="Main.openHelp('" + ID +"', 'extract.view.properties')"%>" 246 subclass="auto-init" 247 data-auto-init="help" 248 data-help-id="extract.view.properties" 308 249 title="Help…" 309 250 tooltip="Get help about this page" … … 610 551 611 552 <t:tab id="annotations" title="Annotations & parameters" 612 tooltip="View annotation values and protocol parameters" clazz="white" 613 activate="AnnotationsList.loadOnce()"> 553 tooltip="View annotation values and protocol parameters" clazz="white"> 614 554 <jsp:include page="../../common/annotations/list_frameset.jsp"> 615 555 <jsp:param name="item_type" value="<%=itemType.name()%>" /> … … 622 562 623 563 <t:tab id="overview" title="Overview" 624 tooltip="Display a tree overview of related items" 625 activate="Overview.loadOnce()"> 564 tooltip="Display a tree overview of related items"> 626 565 <jsp:include page="../../common/overview/overview.jsp"> 627 566 <jsp:param name="item_type" value="<%=itemType.name()%>" /> … … 632 571 <t:tab id="history" title="Change history" 633 572 tooltip="Displays a log of all modifications made to this item" 634 visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>" 635 activate="History.loadOnce()"> 573 visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>"> 636 574 <jsp:include page="../../common/history/frameset.jsp"> 637 575 <jsp:param name="item_type" value="<%=itemType.name()%>" /> -
trunk/www/biomaterials/lists/lists.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'BIOMATERIALLIST', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); 49 Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); 50 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 51 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 52 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 53 Buttons.addClickHandler('btnPlaceOnPlate', biomateriallists.placeOnPlateOnClick); 54 Buttons.addClickHandler('btnMergeUnion', biomateriallists.mergeOnClick); 55 Buttons.addClickHandler('btnMergeIntersection', biomateriallists.mergeOnClick); 56 Buttons.addClickHandler('btnMergeComplement', biomateriallists.mergeOnClick); 57 58 TabControl.addTabActivateListener('main.overview', Overview.loadOnce); 59 TabControl.addTabActivateListener('main.members', biomateriallists.viewMembers); 42 60 } 43 61 else if (pageId == 'list-page') … … 60 78 } 61 79 80 biomateriallists.viewMembers = function() 81 { 82 var listId = Data.get('page-data', 'item-id'); 83 var url = 'members/index.jsp?ID='+App.getSessionId(); 84 url += '&cmd=List&list_id='+listId; 85 location.replace(url); 86 } 87 88 biomateriallists.placeOnPlateOnClick = function() 89 { 90 var listId = Data.get('page-data', 'item-id'); 91 var url = 'members/index.jsp?ID='+App.getSessionId(); 92 url += '&cmd=PlaceOnPlate&list_id='+listId; 93 Dialogs.openPopup(url, 'PlaceOnPlate', 900, 600); 94 } 95 96 biomateriallists.mergeOnClick = function(event) 97 { 98 var target = event.currentTarget; 99 var mergeType = Data.get(target, 'merge-type'); 100 var listId = Data.get('page-data', 'item-id'); 101 102 var url = 'merge.jsp?ID='+App.getSessionId(); 103 url += '&item_id='+listId; 104 url += '&mergeType='+mergeType; 105 106 Dialogs.openPopup(url, 'Merge', 600, 400); 107 } 108 109 62 110 return biomateriallists; 63 111 }(); -
trunk/www/biomaterials/lists/view_list.jsp
r6242 r6261 71 71 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 72 72 final int itemId = cc.getId(); 73 final String tab = Values.getString (request.getParameter("tab"), "properties");73 final String tab = Values.getStringOrNull(request.getParameter("tab")); 74 74 final float scale = Base.getScale(sc); 75 75 final DbControl dc = sc.newDbControl(); … … 93 93 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 94 94 %> 95 <base:page title="<%=title%>" >96 <base:head scripts="table.js,tabcontrol .js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">95 <base:page title="<%=title%>" id="view-page"> 96 <base:head scripts="table.js,tabcontrol-2.js,~lists.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> 97 97 <ext:scripts context="<%=jspContext%>" /> 98 98 <ext:stylesheets context="<%=jspContext%>" /> 99 <script>100 function editItem()101 {102 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);103 }104 function shareItem()105 {106 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareBioMaterialList', 600, 400);107 }108 function deleteItem()109 {110 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');111 }112 function restoreItem()113 {114 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');115 }116 function deleteItemPermanently()117 {118 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');119 }120 function itemDeleted()121 {122 Main.listItems('<%=ID%>', '<%=itemType.name()%>');123 }124 function showUsingItems()125 {126 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);127 }128 function setOwner()129 {130 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);131 }132 function runPlugin(cmd)133 {134 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);135 }136 function viewMembers()137 {138 location.href = 'members/index.jsp?ID=<%=ID%>&cmd=List&list_id=<%=itemId%>';139 }140 function switchTab(tabControlId, tabId)141 {142 if (TabControl.isActive(tabControlId, tabId)) return;143 if (tabId == 'members')144 {145 viewMembers();146 }147 else148 {149 TabControl.setActiveTab(tabControlId, tabId);150 }151 }152 function merge(mergeType)153 {154 Main.openPopup('merge.jsp?ID=<%=ID%>&item_id=<%=itemId%>&mergeType='+mergeType, 'Union', 600, 400);155 }156 function placeOnPlate()157 {158 Main.openPopup('members/index.jsp?ID=<%=ID%>&list_id=<%=itemId%>&cmd=PlaceOnPlate', 'PlaceOnPlate', 900, 600);159 }160 </script>161 99 </base:head> 162 100 <base:body> … … 165 103 /><p:pathelement title="<%=HTML.encodeTags(list.getName())%>" 166 104 /></p:path> 105 <div id="page-data" data-item-id="<%=itemId%>"></div> 167 106 168 107 <t:tabcontrol 169 108 id="main" 170 109 subclass="content mastertabcontrol" 171 active="<%=tab%>" switch="switchTab" remember="false">110 active="<%=tab%>"> 172 111 <t:tab id="properties" title="Properties"> 173 112 <div> … … 181 120 /> 182 121 <base:icon 122 id="btnDeletePermanently" 183 123 image="deleted.png" 184 onclick="deleteItemPermanently()"185 124 tooltip="This item has been flagged for deletion. Click to delete it now." 186 125 enabled="<%=deletePermanentlyPermission %>" 187 126 visible="<%=isRemoved%>" 188 127 /> 189 <base:icon image="used.png" 190 onclick="showUsingItems()" 128 <base:icon 129 id="btnUsingItems" 130 image="used.png" 191 131 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 192 132 visible="<%=isRemoved && isUsed%>" /> … … 195 135 <tbl:toolbar subclass="bottomborder"> 196 136 <tbl:button 137 id="btnEdit" 197 138 disabled="<%=!writePermission%>" 198 139 image="edit.png" 199 onclick="editItem()"200 140 title="Edit…" 201 141 tooltip="<%=writePermission ? "Edit this list" : "You do not have permission to edit this list"%>" 202 142 /> 203 143 <tbl:button 144 id="btnDelete" 204 145 disabled="<%=!deletePermission%>" 205 146 image="delete.png" 206 onclick="deleteItem()"207 147 title="Delete" 208 148 visible="<%=!list.isRemoved()%>" … … 210 150 /> 211 151 <tbl:button 152 id="btnRestore" 212 153 disabled="<%=!writePermission%>" 213 154 image="restore.png" 214 onclick="restoreItem()"215 155 title="Restore" 216 156 visible="<%=list.isRemoved()%>" … … 218 158 /> 219 159 <tbl:button 160 id="btnShare" 220 161 disabled="<%=!sharePermission%>" 221 162 image="share.png" 222 onclick="shareItem()"223 163 title="Share…" 224 164 tooltip="<%=sharePermission ? "Share this list to other user, groups and projects" : "You do not have permission to share this list"%>" 225 165 /> 226 166 <tbl:button 167 id="btnSetOwner" 227 168 disabled="<%=!setOwnerPermission%>" 228 169 image="take_ownership.png" 229 onclick="setOwner()"230 170 title="Set owner…" 231 171 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 232 172 /> 233 173 <tbl:button 174 id="btnPlaceOnPlate" 234 175 image="place_on_plate.png" 235 onclick="placeOnPlate()"236 176 title="Place on plate…" 237 177 tooltip="Place the biomaterial in this list on a bioplate" … … 239 179 /> 240 180 <tbl:button 181 id="btnMergeUnion" 182 data-merge-type="union" 241 183 visible="<%=writePermission%>" 242 184 image="set_operations/union_small.png" 243 onclick="merge('union')"244 185 title="Union…" 245 186 tooltip="Add items from other lists to this list" 246 187 /> 247 188 <tbl:button 189 id="btnMergeIntersection" 190 data-merge-type="intersection" 248 191 visible="<%=writePermission%>" 249 192 image="set_operations/intersection_small.png" 250 onclick="merge('intersection')"251 193 title="Intersection…" 252 194 tooltip="Keep only items that are present in other lists" 253 195 /> 254 196 <tbl:button 197 id="btnMergeComplement" 198 data-merge-type="complement" 255 199 visible="<%=writePermission%>" 256 200 image="set_operations/complement_small.png" 257 onclick="merge('complement')"258 201 title="Complement…" 259 202 tooltip="Remove items found in other lists from this list" 260 203 /> 261 204 <tbl:button 205 id="btnImport" 262 206 image="import.png" 263 onclick="runPlugin('ImportItem')"207 data-plugin-type="IMPORT" 264 208 title="Import…" 265 209 tooltip="Import data" … … 267 211 /> 268 212 <tbl:button 269 image="export.png" 270 onclick="runPlugin('ExportItem')" 213 id="btnExport" 214 image="export.png" 215 data-plugin-type="EXPORT" 271 216 title="Export…" 272 217 tooltip="Export data" … … 274 219 /> 275 220 <tbl:button 276 image="runplugin.png" 277 onclick="runPlugin('RunPlugin')" 221 id="btnRunPlugin" 222 image="runplugin.png" 223 data-plugin-type="OTHER" 278 224 title="Run plugin…" 279 225 tooltip="Run a plugin" … … 284 230 <tbl:button 285 231 image="help.png" 286 onclick="<%="Main.openHelp('" + ID +"', 'biomateriallist.view.properties')"%>" 232 subclass="auto-init" 233 data-auto-init="help" 234 data-help-id="biomateriallist.view.properties" 287 235 title="Help…" 288 236 tooltip="Get help about this page" … … 337 285 <t:tab id="members" title="Members" /> 338 286 <t:tab id="overview" title="Overview" 339 tooltip="Display a tree overview of related items" 340 activate="Overview.loadOnce()"> 287 tooltip="Display a tree overview of related items"> 341 288 <jsp:include page="../../common/overview/overview.jsp"> 342 289 <jsp:param name="item_type" value="<%=itemType.name()%>" /> -
trunk/www/biomaterials/samples/samples.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'SAMPLE', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); 49 Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); 50 Buttons.addClickHandler('btnNewSample', samples.newSample, attributes); 51 Buttons.addClickHandler('btnNewExtract', samples.newExtract, attributes); 52 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 53 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 54 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 55 56 TabControl.addTabActivateListener('main.events', samples.viewEvents); 57 TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce); 58 TabControl.addTabActivateListener('main.overview', Overview.loadOnce); 59 TabControl.addTabActivateListener('main.history', History.loadOnce); 42 60 } 43 61 else if (pageId == 'list-page') … … 115 133 Table.submitToPopup('samples', 'NewPooledItem', 750, 500); 116 134 } 117 135 136 samples.viewEvents = function() 137 { 138 var sampleId = Data.get('page-data', 'item-id'); 139 var url = '../events/index.jsp?ID='+App.getSessionId(); 140 url += '&cmd=List&biomaterial_id='+sampleId; 141 url += '&biomaterial_type=SAMPLE'; 142 location.replace(url); 143 } 144 145 118 146 return samples; 119 147 }(); -
trunk/www/biomaterials/tags/tags.js
r6260 r6261 39 39 else if (pageId == 'view-page') 40 40 { 41 // TODO 41 var itemId = Data.get('page-data', 'item-id'); 42 var attributes = {'item-type': 'TAG', 'item-id': itemId}; 43 Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); 44 Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); 45 Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); 46 Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); 47 Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); 48 Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); 49 Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); 50 Buttons.addClickHandler('btnNewSample', biosources.newSample, attributes); 51 Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); 52 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 53 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 42 54 } 43 55 else if (pageId == 'list-page') -
trunk/www/biomaterials/tags/view_tag.jsp
r6136 r6261 75 75 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); 76 76 final int itemId = cc.getId(); 77 final String tab = Values.getStringOrNull(request.getParameter("tab")); 77 78 final float scale = Base.getScale(sc); 78 79 final DbControl dc = sc.newDbControl(); … … 97 98 ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); 98 99 %> 99 <base:page title="<%=title%>" >100 <base:head scripts="table.js,tabcontrol .js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">100 <base:page title="<%=title%>" id="view-page"> 101 <base:head scripts="table.js,tabcontrol-2.js,~tags.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> 101 102 <ext:scripts context="<%=jspContext%>" /> 102 103 <ext:stylesheets context="<%=jspContext%>" /> 103 <script>104 function editItem()105 {106 Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);107 }108 function shareItem()109 {110 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareTag', 600, 400);111 }112 function deleteItem()113 {114 location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');115 }116 function restoreItem()117 {118 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');119 }120 function deleteItemPermanently()121 {122 Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');123 }124 function itemDeleted()125 {126 Main.listItems('<%=ID%>', '<%=itemType.name()%>');127 }128 function showUsingItems()129 {130 Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);131 }132 function setOwner()133 {134 Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);135 }136 function runPlugin(cmd)137 {138 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);139 }140 </script>141 104 </base:head> 142 105 <base:body> … … 144 107 title="Tags" href="<%="index.jsp?ID="+ID%>" /><p:pathelement 145 108 title="<%=HTML.encodeTags(tag.getName())%>" /></p:path> 109 <div id="page-data" data-item-id="<%=itemId%>"></div> 146 110 147 111 <t:tabcontrol 148 112 id="main" 149 113 subclass="content mastertabcontrol" 150 active=" properties">114 active="<%=tab%>"> 151 115 <t:tab id="properties" title="Properties"> 152 116 <div> … … 160 124 /> 161 125 <base:icon 126 id="btnDeletePermanently" 162 127 image="deleted.png" 163 onclick="deleteItemPermanently()"164 128 tooltip="This item has been flagged for deletion. Click to delete it now." 165 129 enabled="<%=deletePermanentlyPermission %>" 166 130 visible="<%=isRemoved%>" 167 131 /> 168 <base:icon image="used.png" 169 onclick="showUsingItems()" 132 <base:icon 133 id="btnUsingItems" 134 image="used.png" 170 135 tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" 171 136 visible="<%=isRemoved && isUsed%>" /> … … 174 139 <tbl:toolbar subclass="bottomborder"> 175 140 <tbl:button 141 id="btnEdit" 176 142 disabled="<%=!writePermission%>" 177 143 image="edit.png" 178 onclick="editItem()"179 144 title="Edit…" 180 145 tooltip="<%=writePermission ? "Edit this tag" : "You do not have permission to edit this tag"%>" 181 146 /> 182 147 <tbl:button 148 id="btnDelete" 183 149 disabled="<%=!deletePermission%>" 184 150 image="delete.png" 185 onclick="deleteItem()"186 151 title="Delete" 187 152 visible="<%=!tag.isRemoved()%>" … … 189 154 /> 190 155 <tbl:button 156 id="btnRestore" 191 157 disabled="<%=!writePermission%>" 192 158 image="restore.png" 193 onclick="restoreItem()"194 159 title="Restore" 195 160 visible="<%=tag.isRemoved()%>" … … 197 162 /> 198 163 <tbl:button 164 id="btnShare" 199 165 disabled="<%=!sharePermission%>" 200 166 image="share.png" 201 onclick="shareItem()"202 167 title="Share…" 203 168 tooltip="<%=sharePermission ? "Share this tag to other user, groups and projects" : "You do not have permission to share this tag"%>" 204 169 /> 205 170 <tbl:button 171 id="btnSetOwner" 206 172 disabled="<%=!setOwnerPermission%>" 207 173 image="take_ownership.png" 208 onclick="setOwner()"209 174 title="Set owner…" 210 175 tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" 211 176 /> 212 177 <tbl:button 178 id="btnImport" 213 179 image="import.png" 214 onclick="runPlugin('ImportItem')"180 data-plugin-type="IMPORT" 215 181 title="Import…" 216 182 tooltip="Import data" … … 218 184 /> 219 185 <tbl:button 220 image="export.png" 221 onclick="runPlugin('ExportItem')" 186 id="btnExport" 187 image="export.png" 188 data-plugin-type="EXPORT" 222 189 title="Export…" 223 190 tooltip="Export data" … … 225 192 /> 226 193 <tbl:button 227 image="runplugin.png" 228 onclick="runPlugin('RunPlugin')" 194 id="btnRunPlugin" 195 image="runplugin.png" 196 data-plugin-type="OTHER" 229 197 title="Run plugin…" 230 198 tooltip="Run a plugin" … … 235 203 <tbl:button 236 204 image="help.png" 237 onclick="<%="Main.openHelp('" + ID +"', 'tag.view.properties')"%>" 205 subclass="auto-init" 206 data-auto-init="help" 207 data-help-id="tag.view.properties" 238 208 title="Help…" 239 209 tooltip="Get help about this page" -
trunk/www/include/scripts/main-2.js
r6260 r6261 730 730 var itemType = Data.get(target, 'item-type'); 731 731 var itemId = Data.int(target, 'item-id'); 732 Items.deleteItem(itemType, itemId); 732 var extraUrl = Data.get(target, 'extra-url'); 733 Items.deleteItem(itemType, itemId, extraUrl); 733 734 } 734 735 … … 759 760 var itemType = Data.get(target, 'item-type'); 760 761 var itemId = Data.int(target, 'item-id'); 761 Items.restoreItem(itemType, itemId); 762 var extraUrl = Data.get(target, 'extra-url'); 763 Items.restoreItem(itemType, itemId, extraUrl); 762 764 } 763 765 … … 789 791 var itemType = Data.get(target, 'item-type'); 790 792 var itemId = Data.int(target, 'item-id'); 791 Items.deleteItemPermanently(itemType, itemId, true); 793 var extraUrl = Data.get(target, 'extra-url'); 794 Items.deleteItemPermanently(itemType, itemId, true, extraUrl); 792 795 } 793 796 … … 1271 1274 The current page is automatically reloaded. 1272 1275 */ 1273 items.deleteItem = function(itemType, itemId, extraUrl)1276 items.deleteItem = function(itemType, itemId, ask, extraUrl) 1274 1277 { 1275 1278 internal.itemCommand('DeleteItem', itemType, itemId, extraUrl); … … 1289 1292 The current page is automatically changed to the list page. 1290 1293 */ 1291 items.deleteItemPermanently = function(itemType, itemId, ask )1294 items.deleteItemPermanently = function(itemType, itemId, ask, extraUrl) 1292 1295 { 1293 1296 if (ask) … … 1303 1306 function() 1304 1307 { 1305 Items.list(itemType );1308 Items.list(itemType, extraUrl); 1306 1309 } 1307 1310 ); -
trunk/www/include/scripts/tabcontrol-2.js
r6260 r6261 118 118 tabControl.activeContent = content; 119 119 } 120 120 121 Data.setPageValue('last-tab.'+tabControl.id, tab.id); 122 121 123 var evt = document.createEvent('Event'); 122 124 evt.initEvent('base-activate', false, true); 123 125 tab.dispatchEvent(evt); 124 126 125 Data.setPageValue('last-tab.'+tabControl.id, tab.id);126 127 return true; 127 128 }
Note: See TracChangeset
for help on using the changeset viewer.