Changeset 2917
- Timestamp:
- Nov 15, 2006, 11:28:36 AM (16 years ago)
- Location:
- trunk/www/biomaterials
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/biomaterials/extracts/index.jsp
r2811 r2917 43 43 import="net.sf.basedb.util.RemovableUtil" 44 44 import="net.sf.basedb.util.ShareableUtil" 45 import="net.sf.basedb.util.OwnableUtil" 45 46 import="net.sf.basedb.clients.web.Base" 46 47 import="net.sf.basedb.clients.web.WebException" … … 272 273 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 273 274 } 275 else if ("TakeOwnershipOfItem".equals(cmd)) 276 { 277 // Take ownership a single item and then return to the view page 278 dc = sc.newDbControl(); 279 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 280 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 281 dc.commit(); 282 redirect = viewPage; 283 } 284 else if ("TakeOwnershipOfItems".equals(cmd)) 285 { 286 // Take ownership all selected items on the list page 287 dc = sc.newDbControl(); 288 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 289 int numTotal = cc.getSelected().size(); 290 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 291 dc.commit(); 292 if (numTotal != numOwned) 293 { 294 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 295 } 296 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 297 } 274 298 else if ("ExportItems".equals(cmd)) 275 299 { -
trunk/www/biomaterials/extracts/list_extracts.jsp
r2893 r2917 151 151 frm.submit(); 152 152 } 153 function takeOwnership() 154 { 155 var frm = document.forms[formId]; 156 if (Forms.numChecked(frm) == 0) 157 { 158 alert('Please select at least one item in the list'); 159 return; 160 } 161 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 162 { 163 frm.action = submitPage; 164 frm.cmd.value = 'TakeOwnershipOfItems'; 165 frm.submit(); 166 } 167 } 153 168 function shareItem(itemId) 154 169 { … … 378 393 title="Share…" 379 394 tooltip="Share the selected items" 395 /> 396 <tbl:button 397 image="take_ownership.png" 398 onclick="takeOwnership()" 399 title="Take ownership…" 400 tooltip="Take ownership of the selected items" 380 401 /> 381 402 <tbl:button -
trunk/www/biomaterials/extracts/view_extract.jsp
r2875 r2917 87 87 final boolean sharePermission = extract.hasPermission(Permission.SET_PERMISSION); 88 88 final boolean usePermission = extract.hasPermission(Permission.USE); 89 89 final boolean setOwnerPermission = extract.hasPermission(Permission.SET_OWNER); 90 final boolean isOwner = extract.isOwner(); 90 91 %> 91 92 … … 108 109 { 109 110 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 111 } 112 function takeOwnership() 113 { 114 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 115 { 116 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 117 } 110 118 } 111 119 function runPlugin(cmd) … … 175 183 title="Share…" 176 184 tooltip="<%=sharePermission ? "Share this extract to other user, groups and projects" : "You do not have permission to share this extract"%>" 185 /> 186 <tbl:button 187 disabled="<%=setOwnerPermission ? false : true%>" 188 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 189 onclick="takeOwnership()" 190 title="Take ownership…" 191 visible="<%=!isOwner%>" 192 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 177 193 /> 178 194 <tbl:button -
trunk/www/biomaterials/labeledextracts/index.jsp
r2811 r2917 44 44 import="net.sf.basedb.util.RemovableUtil" 45 45 import="net.sf.basedb.util.ShareableUtil" 46 import="net.sf.basedb.util.OwnableUtil" 46 47 import="net.sf.basedb.clients.web.Base" 47 48 import="net.sf.basedb.clients.web.WebException" … … 286 287 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 287 288 } 289 else if ("TakeOwnershipOfItem".equals(cmd)) 290 { 291 // Take ownership a single item and then return to the view page 292 dc = sc.newDbControl(); 293 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 294 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 295 dc.commit(); 296 redirect = viewPage; 297 } 298 else if ("TakeOwnershipOfItems".equals(cmd)) 299 { 300 // Take ownership all selected items on the list page 301 dc = sc.newDbControl(); 302 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 303 int numTotal = cc.getSelected().size(); 304 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 305 dc.commit(); 306 if (numTotal != numOwned) 307 { 308 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 309 } 310 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 311 } 288 312 else if ("ExportItems".equals(cmd)) 289 313 { -
trunk/www/biomaterials/labeledextracts/list_labeledextracts.jsp
r2893 r2917 147 147 frm.submit(); 148 148 } 149 function takeOwnership() 150 { 151 var frm = document.forms[formId]; 152 if (Forms.numChecked(frm) == 0) 153 { 154 alert('Please select at least one item in the list'); 155 return; 156 } 157 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 158 { 159 frm.action = submitPage; 160 frm.cmd.value = 'TakeOwnershipOfItems'; 161 frm.submit(); 162 } 163 } 149 164 function shareItem(itemId) 150 165 { … … 393 408 title="Share…" 394 409 tooltip="Share the selected items" 410 /> 411 <tbl:button 412 image="take_ownership.png" 413 onclick="takeOwnership()" 414 title="Take ownership…" 415 tooltip="Take ownership of the selected items" 395 416 /> 396 417 <tbl:button -
trunk/www/biomaterials/labeledextracts/view_labeledextract.jsp
r2875 r2917 85 85 final boolean sharePermission = extract.hasPermission(Permission.SET_PERMISSION); 86 86 final boolean usePermission = extract.hasPermission(Permission.USE); 87 87 final boolean setOwnerPermission = extract.hasPermission(Permission.SET_OWNER); 88 final boolean isOwner = extract.isOwner(); 88 89 %> 89 90 … … 106 107 { 107 108 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 109 } 110 function takeOwnership() 111 { 112 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 113 { 114 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 115 } 108 116 } 109 117 function runPlugin(cmd) … … 173 181 title="Share…" 174 182 tooltip="<%=sharePermission ? "Share this labeled extract to other user, groups and projects" : "You do not have permission to share this labeled extract"%>" 183 /> 184 <tbl:button 185 disabled="<%=setOwnerPermission ? false : true%>" 186 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 187 onclick="takeOwnership()" 188 title="Take ownership…" 189 visible="<%=!isOwner%>" 190 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 175 191 /> 176 192 <tbl:button -
trunk/www/biomaterials/labels/index.jsp
r2811 r2917 40 40 import="net.sf.basedb.util.RemovableUtil" 41 41 import="net.sf.basedb.util.ShareableUtil" 42 import="net.sf.basedb.util.OwnableUtil" 42 43 import="net.sf.basedb.clients.web.Base" 43 44 import="net.sf.basedb.clients.web.WebException" … … 210 211 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 211 212 } 213 else if ("TakeOwnershipOfItem".equals(cmd)) 214 { 215 // Take ownership a single item and then return to the view page 216 dc = sc.newDbControl(); 217 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 218 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 219 dc.commit(); 220 redirect = viewPage; 221 } 222 else if ("TakeOwnershipOfItems".equals(cmd)) 223 { 224 // Take ownership all selected items on the list page 225 dc = sc.newDbControl(); 226 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 227 int numTotal = cc.getSelected().size(); 228 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 229 dc.commit(); 230 if (numTotal != numOwned) 231 { 232 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 233 } 234 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 235 } 212 236 else if ("ExportItems".equals(cmd)) 213 237 { -
trunk/www/biomaterials/labels/list_labels.jsp
r2753 r2917 125 125 frm.submit(); 126 126 } 127 function takeOwnership() 128 { 129 var frm = document.forms[formId]; 130 if (Forms.numChecked(frm) == 0) 131 { 132 alert('Please select at least one item in the list'); 133 return; 134 } 135 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 136 { 137 frm.action = submitPage; 138 frm.cmd.value = 'TakeOwnershipOfItems'; 139 frm.submit(); 140 } 141 } 127 142 function shareItem(itemId) 128 143 { … … 246 261 title="Share…" 247 262 tooltip="Share the selected items" 263 /> 264 <tbl:button 265 image="take_ownership.png" 266 onclick="takeOwnership()" 267 title="Take ownership…" 268 tooltip="Take ownership of the selected items" 248 269 /> 249 270 <tbl:button -
trunk/www/biomaterials/labels/view_label.jsp
r2753 r2917 76 76 final boolean sharePermission = label.hasPermission(Permission.SET_PERMISSION); 77 77 final boolean usePermission = label.hasPermission(Permission.USE); 78 79 boolean readCurrentOwner = true; 80 User currentOwner = null; 81 try 82 { 83 currentOwner = label.getOwner(); 84 } 85 catch (PermissionDeniedException ex) 86 { 87 readCurrentOwner = false; 88 } 89 78 final boolean setOwnerPermission = label.hasPermission(Permission.SET_OWNER); 79 final boolean isOwner = label.isOwner(); 90 80 %> 91 92 81 <base:page title="<%=title%>"> 93 82 <base:head scripts="tabcontrol.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css"> … … 108 97 { 109 98 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 99 } 100 function takeOwnership() 101 { 102 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 103 { 104 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 105 } 110 106 } 111 107 function runPlugin(cmd) … … 159 155 title="Share…" 160 156 tooltip="<%=sharePermission ? "Share this label to other user, groups and projects" : "You do not have permission to share this label"%>" 157 /> 158 <tbl:button 159 disabled="<%=setOwnerPermission ? false : true%>" 160 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 161 onclick="takeOwnership()" 162 title="Take ownership…" 163 visible="<%=!isOwner%>" 164 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 161 165 /> 162 166 <tbl:button -
trunk/www/biomaterials/samples/index.jsp
r2811 r2917 43 43 import="net.sf.basedb.util.RemovableUtil" 44 44 import="net.sf.basedb.util.ShareableUtil" 45 import="net.sf.basedb.util.OwnableUtil" 45 46 import="net.sf.basedb.clients.web.Base" 46 47 import="net.sf.basedb.clients.web.WebException" … … 272 273 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 273 274 } 275 else if ("TakeOwnershipOfItem".equals(cmd)) 276 { 277 // Take ownership a single item and then return to the view page 278 dc = sc.newDbControl(); 279 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 280 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 281 dc.commit(); 282 redirect = viewPage; 283 } 284 else if ("TakeOwnershipOfItems".equals(cmd)) 285 { 286 // Take ownership all selected items on the list page 287 dc = sc.newDbControl(); 288 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 289 int numTotal = cc.getSelected().size(); 290 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 291 dc.commit(); 292 if (numTotal != numOwned) 293 { 294 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 295 } 296 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 297 } 274 298 else if ("ExportItems".equals(cmd)) 275 299 { -
trunk/www/biomaterials/samples/list_samples.jsp
r2893 r2917 152 152 frm.submit(); 153 153 } 154 function takeOwnership() 155 { 156 var frm = document.forms[formId]; 157 if (Forms.numChecked(frm) == 0) 158 { 159 alert('Please select at least one item in the list'); 160 return; 161 } 162 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 163 { 164 frm.action = submitPage; 165 frm.cmd.value = 'TakeOwnershipOfItems'; 166 frm.submit(); 167 } 168 } 154 169 function shareItem(itemId) 155 170 { … … 379 394 title="Share…" 380 395 tooltip="Share the selected items" 396 /> 397 <tbl:button 398 image="take_ownership.png" 399 onclick="takeOwnership()" 400 title="Take ownership…" 401 tooltip="Take ownership of the selected items" 381 402 /> 382 403 <tbl:button -
trunk/www/biomaterials/samples/view_sample.jsp
r2875 r2917 84 84 final boolean deletePermission = sample.hasPermission(Permission.DELETE); 85 85 final boolean sharePermission = sample.hasPermission(Permission.SET_PERMISSION); 86 86 final boolean setOwnerPermission = sample.hasPermission(Permission.SET_OWNER); 87 final boolean isOwner = sample.isOwner(); 87 88 %> 88 89 … … 109 110 { 110 111 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 112 } 113 function takeOwnership() 114 { 115 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 116 { 117 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 118 } 111 119 } 112 120 function runPlugin(cmd) … … 172 180 title="Share…" 173 181 tooltip="<%=sharePermission ? "Share this sample to other user, groups and projects" : "You do not have permission to share this sample"%>" 182 /> 183 <tbl:button 184 disabled="<%=setOwnerPermission ? false : true%>" 185 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 186 onclick="takeOwnership()" 187 title="Take ownership…" 188 visible="<%=!isOwner%>" 189 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 174 190 /> 175 191 <tbl:button
Note: See TracChangeset
for help on using the changeset viewer.