Changeset 2918
- Timestamp:
- Nov 15, 2006, 12:21:13 PM (16 years ago)
- Location:
- trunk/www
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/filemanager/directories/index.jsp
r2811 r2918 39 39 import="net.sf.basedb.util.RemovableUtil" 40 40 import="net.sf.basedb.util.ShareableUtil" 41 import="net.sf.basedb.util.OwnableUtil" 41 42 import="net.sf.basedb.clients.web.Base" 42 43 import="net.sf.basedb.clients.web.WebException" … … 115 116 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 116 117 } 118 else if ("TakeOwnershipOfItem".equals(cmd)) 119 { 120 // Take ownership a single item and then return to the view page 121 dc = sc.newDbControl(); 122 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 123 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 124 dc.commit(); 125 redirect = viewPage; 126 } 117 127 else if ("UpdateItem".equals(cmd)) 118 128 { -
trunk/www/filemanager/files/index.jsp
r2811 r2918 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" … … 258 259 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 259 260 } 261 else if ("TakeOwnershipOfItem".equals(cmd)) 262 { 263 // Take ownership a single item and then return to the view page 264 dc = sc.newDbControl(); 265 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 266 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 267 dc.commit(); 268 redirect = viewPage; 269 } 270 else if ("TakeOwnershipOfItems".equals(cmd)) 271 { 272 // Take ownership all selected items on the list page 273 dc = sc.newDbControl(); 274 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 275 // Files 276 int numTotal = cc.getSelected().size(); 277 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 278 279 // Directories 280 numTotal += dirContext.getSelected().size(); 281 numOwned += OwnableUtil.setOwner(dc, Item.DIRECTORY, dirContext.getSelected(), null); 282 dc.commit(); 283 if (numTotal != numOwned) 284 { 285 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 286 } 287 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 288 } 260 289 else if ("ExportItems".equals(cmd)) 261 290 { -
trunk/www/filemanager/files/list_files.jsp
r2753 r2918 196 196 frm.submit(); 197 197 } 198 function takeOwnership() 199 { 200 var frm = document.forms[formId]; 201 if (Forms.numChecked(frm) == 0) 202 { 203 alert('Please select at least one item in the list'); 204 return; 205 } 206 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 207 { 208 frm.action = submitPage; 209 frm.cmd.value = 'TakeOwnershipOfItems'; 210 frm.submit(); 211 } 212 } 198 213 function shareDirectory(itemId) 199 214 { … … 503 518 tooltip="Share the selected items" 504 519 visible="<%=mode.hasToolbar()%>" 520 /> 521 <tbl:button 522 image="take_ownership.png" 523 onclick="takeOwnership()" 524 title="Take ownership…" 525 tooltip="Take ownership of the selected items" 505 526 /> 506 527 <tbl:button -
trunk/www/filemanager/files/view_file.jsp
r2753 r2918 74 74 final boolean deletePermission = file.hasPermission(Permission.DELETE); 75 75 final boolean sharePermission = file.hasPermission(Permission.SET_PERMISSION); 76 final boolean setOwnerPermission = file.hasPermission(Permission.SET_OWNER); 77 final boolean isOwner = file.isOwner(); 76 78 %> 77 78 79 <base:page type="popup" title="<%=title%>"> 79 80 <base:head styles="toolbar.css"> … … 94 95 { 95 96 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 97 } 98 function takeOwnership() 99 { 100 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 101 { 102 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 103 } 96 104 } 97 105 function runPlugin(cmd) … … 137 145 title="Share…" 138 146 tooltip="<%=sharePermission ? "Share this file to other user, groups and projects" : "You do not have permission to share this file"%>" 147 /> 148 <tbl:button 149 disabled="<%=setOwnerPermission ? false : true%>" 150 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 151 onclick="takeOwnership()" 152 title="Take ownership…" 153 visible="<%=!isOwner%>" 154 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 139 155 /> 140 156 <tbl:button -
trunk/www/my_base/projects/index.jsp
r2811 r2918 41 41 import="net.sf.basedb.core.ItemAlreadyExistsException" 42 42 import="net.sf.basedb.util.RemovableUtil" 43 import="net.sf.basedb.util.OwnableUtil" 43 44 import="net.sf.basedb.clients.web.Base" 44 45 import="net.sf.basedb.clients.web.PermissionUtil" … … 215 216 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 216 217 } 218 else if ("TakeOwnershipOfItem".equals(cmd)) 219 { 220 // Take ownership a single item and then return to the view page 221 dc = sc.newDbControl(); 222 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 223 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 224 dc.commit(); 225 redirect = viewPage; 226 } 227 else if ("TakeOwnershipOfItems".equals(cmd)) 228 { 229 // Take ownership all selected items on the list page 230 dc = sc.newDbControl(); 231 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 232 int numTotal = cc.getSelected().size(); 233 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 234 dc.commit(); 235 if (numTotal != numOwned) 236 { 237 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 238 } 239 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 240 } 217 241 else if ("ExportItems".equals(cmd)) 218 242 { -
trunk/www/my_base/projects/list_projects.jsp
r2753 r2918 128 128 frm.submit(); 129 129 } 130 function takeOwnership() 131 { 132 var frm = document.forms[formId]; 133 if (Forms.numChecked(frm) == 0) 134 { 135 alert('Please select at least one item in the list'); 136 return; 137 } 138 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 139 { 140 frm.action = submitPage; 141 frm.cmd.value = 'TakeOwnershipOfItems'; 142 frm.submit(); 143 } 144 } 130 145 function configureColumns() 131 146 { … … 240 255 title="Restore" 241 256 tooltip="Restore the selected (deleted) items" 257 /> 258 <tbl:button 259 image="take_ownership.png" 260 onclick="takeOwnership()" 261 title="Take ownership…" 262 tooltip="Take ownership of the selected items" 263 visible="<%=sc.hasPermission(Permission.SET_OWNER, Item.PROJECT)%>" 242 264 /> 243 265 <tbl:button -
trunk/www/my_base/projects/view_project.jsp
r2753 r2918 78 78 final boolean writePermission = project.hasPermission(Permission.WRITE); 79 79 final boolean deletePermission = project.hasPermission(Permission.DELETE); 80 final boolean setOwnerPermission = project.hasPermission(Permission.SET_OWNER); 81 final boolean isOwner = project.isOwner(); 80 82 %> 81 83 … … 94 96 { 95 97 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 98 } 99 function takeOwnership() 100 { 101 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 102 { 103 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 104 } 96 105 } 97 106 function runPlugin(cmd) … … 154 163 visible="<%=project.isRemoved()%>" 155 164 tooltip="<%=writePermission ? "Restore this project" : "You do not have permission to restore this project"%>" 165 /> 166 <tbl:button 167 disabled="<%=setOwnerPermission ? false : true%>" 168 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 169 onclick="takeOwnership()" 170 title="Take ownership…" 171 visible="<%=!isOwner%>" 172 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 156 173 /> 157 174 <tbl:button -
trunk/www/views/experiments/index.jsp
r2811 r2918 46 46 import="net.sf.basedb.util.RemovableUtil" 47 47 import="net.sf.basedb.util.ShareableUtil" 48 import="net.sf.basedb.util.OwnableUtil" 48 49 import="net.sf.basedb.clients.web.Base" 49 50 import="net.sf.basedb.clients.web.WebException" … … 268 269 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 269 270 } 271 else if ("TakeOwnershipOfItem".equals(cmd)) 272 { 273 // Take ownership a single item and then return to the view page 274 dc = sc.newDbControl(); 275 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 276 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 277 dc.commit(); 278 redirect = viewPage; 279 } 280 else if ("TakeOwnershipOfItems".equals(cmd)) 281 { 282 // Take ownership all selected items on the list page 283 dc = sc.newDbControl(); 284 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 285 int numTotal = cc.getSelected().size(); 286 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 287 dc.commit(); 288 if (numTotal != numOwned) 289 { 290 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 291 } 292 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 293 } 270 294 else if ("ExportItems".equals(cmd)) 271 295 { -
trunk/www/views/experiments/list_experiments.jsp
r2753 r2918 130 130 frm.submit(); 131 131 } 132 function takeOwnership() 133 { 134 var frm = document.forms[formId]; 135 if (Forms.numChecked(frm) == 0) 136 { 137 alert('Please select at least one item in the list'); 138 return; 139 } 140 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 141 { 142 frm.action = submitPage; 143 frm.cmd.value = 'TakeOwnershipOfItems'; 144 frm.submit(); 145 } 146 } 132 147 function shareItem(itemId) 133 148 { … … 367 382 title="Share…" 368 383 tooltip="Share the selected items" 384 /> 385 <tbl:button 386 image="take_ownership.png" 387 onclick="takeOwnership()" 388 title="Take ownership…" 389 tooltip="Take ownership of the selected items" 369 390 /> 370 391 <tbl:button -
trunk/www/views/experiments/view_experiment.jsp
r2893 r2918 80 80 final boolean deletePermission = experiment.hasPermission(Permission.DELETE); 81 81 final boolean sharePermission = experiment.hasPermission(Permission.SET_PERMISSION); 82 final boolean setOwnerPermission = experiment.hasPermission(Permission.SET_OWNER); 83 final boolean isOwner = experiment.isOwner(); 82 84 %> 83 85 … … 100 102 { 101 103 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 104 } 105 function takeOwnership() 106 { 107 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 108 { 109 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 110 } 102 111 } 103 112 function runPlugin(cmd) … … 167 176 title="Share…" 168 177 tooltip="<%=sharePermission ? "Share this experiment to other user, groups and projects" : "You do not have permission to share this experiment"%>" 178 /> 179 <tbl:button 180 disabled="<%=setOwnerPermission ? false : true%>" 181 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 182 onclick="takeOwnership()" 183 title="Take ownership…" 184 visible="<%=!isOwner%>" 185 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 169 186 /> 170 187 <tbl:button -
trunk/www/views/formulas/index.jsp
r2811 r2918 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" … … 232 233 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 233 234 } 235 else if ("TakeOwnershipOfItem".equals(cmd)) 236 { 237 // Take ownership a single item and then return to the view page 238 dc = sc.newDbControl(); 239 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 240 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 241 dc.commit(); 242 redirect = viewPage; 243 } 244 else if ("TakeOwnershipOfItems".equals(cmd)) 245 { 246 // Take ownership all selected items on the list page 247 dc = sc.newDbControl(); 248 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 249 int numTotal = cc.getSelected().size(); 250 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 251 dc.commit(); 252 if (numTotal != numOwned) 253 { 254 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 255 } 256 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 257 } 234 258 else if ("ExportItems".equals(cmd)) 235 259 { -
trunk/www/views/formulas/list_formulas.jsp
r2753 r2918 143 143 frm.submit(); 144 144 } 145 function takeOwnership() 146 { 147 var frm = document.forms[formId]; 148 if (Forms.numChecked(frm) == 0) 149 { 150 alert('Please select at least one item in the list'); 151 return; 152 } 153 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 154 { 155 frm.action = submitPage; 156 frm.cmd.value = 'TakeOwnershipOfItems'; 157 frm.submit(); 158 } 159 } 145 160 function shareItem(itemId) 146 161 { … … 353 368 title="Share…" 354 369 tooltip="Share the selected items" 370 /> 371 <tbl:button 372 image="take_ownership.png" 373 onclick="takeOwnership()" 374 title="Take ownership…" 375 tooltip="Take ownership of the selected items" 355 376 /> 356 377 <tbl:button -
trunk/www/views/formulas/view_formula.jsp
r2733 r2918 75 75 final boolean deletePermission = formula.hasPermission(Permission.DELETE); 76 76 final boolean sharePermission = formula.hasPermission(Permission.SET_PERMISSION); 77 final boolean setOwnerPermission = formula.hasPermission(Permission.SET_OWNER); 78 final boolean isOwner = formula.isOwner(); 77 79 %> 78 80 … … 95 97 { 96 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 } 97 106 } 98 107 function runPlugin(cmd) … … 142 151 title="Share…" 143 152 tooltip="<%=sharePermission ? "Share this formula to other user, groups and projects" : "You do not have permission to share this formula"%>" 153 /> 154 <tbl:button 155 disabled="<%=setOwnerPermission ? false : true%>" 156 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 157 onclick="takeOwnership()" 158 title="Take ownership…" 159 visible="<%=!isOwner%>" 160 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 144 161 /> 145 162 <tbl:button -
trunk/www/views/hybridizations/index.jsp
r2811 r2918 45 45 import="net.sf.basedb.util.RemovableUtil" 46 46 import="net.sf.basedb.util.ShareableUtil" 47 import="net.sf.basedb.util.OwnableUtil" 47 48 import="net.sf.basedb.clients.web.Base" 48 49 import="net.sf.basedb.clients.web.WebException" … … 264 265 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 265 266 } 267 else if ("TakeOwnershipOfItem".equals(cmd)) 268 { 269 // Take ownership a single item and then return to the view page 270 dc = sc.newDbControl(); 271 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 272 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 273 dc.commit(); 274 redirect = viewPage; 275 } 276 else if ("TakeOwnershipOfItems".equals(cmd)) 277 { 278 // Take ownership all selected items on the list page 279 dc = sc.newDbControl(); 280 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 281 int numTotal = cc.getSelected().size(); 282 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 283 dc.commit(); 284 if (numTotal != numOwned) 285 { 286 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 287 } 288 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 289 } 266 290 else if ("ExportItems".equals(cmd)) 267 291 { -
trunk/www/views/hybridizations/list_hybridizations.jsp
r2893 r2918 155 155 frm.submit(); 156 156 } 157 function takeOwnership() 158 { 159 var frm = document.forms[formId]; 160 if (Forms.numChecked(frm) == 0) 161 { 162 alert('Please select at least one item in the list'); 163 return; 164 } 165 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 166 { 167 frm.action = submitPage; 168 frm.cmd.value = 'TakeOwnershipOfItems'; 169 frm.submit(); 170 } 171 } 157 172 function shareItem(itemId) 158 173 { … … 365 380 title="Share…" 366 381 tooltip="Share the selected items" 382 /> 383 <tbl:button 384 image="take_ownership.png" 385 onclick="takeOwnership()" 386 title="Take ownership…" 387 tooltip="Take ownership of the selected items" 367 388 /> 368 389 <tbl:button -
trunk/www/views/hybridizations/view_hybridization.jsp
r2875 r2918 89 89 final boolean deletePermission = hyb.hasPermission(Permission.DELETE); 90 90 final boolean sharePermission = hyb.hasPermission(Permission.SET_PERMISSION); 91 91 final boolean setOwnerPermission = hyb.hasPermission(Permission.SET_OWNER); 92 final boolean isOwner = hyb.isOwner(); 92 93 %> 93 94 … … 110 111 { 111 112 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 113 } 114 function takeOwnership() 115 { 116 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 117 { 118 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 119 } 112 120 } 113 121 function runPlugin(cmd) … … 162 170 title="Share…" 163 171 tooltip="<%=sharePermission ? "Share this hybridization to other user, groups and projects" : "You do not have permission to share this hybridization"%>" 172 /> 173 <tbl:button 174 disabled="<%=setOwnerPermission ? false : true%>" 175 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 176 onclick="takeOwnership()" 177 title="Take ownership…" 178 visible="<%=!isOwner%>" 179 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 164 180 /> 165 181 <tbl:button -
trunk/www/views/jobs/index.jsp
r2811 r2918 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" … … 158 159 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 159 160 } 161 else if ("TakeOwnershipOfItem".equals(cmd)) 162 { 163 // Take ownership a single item and then return to the view page 164 dc = sc.newDbControl(); 165 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 166 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 167 dc.commit(); 168 redirect = viewPage; 169 } 170 else if ("TakeOwnershipOfItems".equals(cmd)) 171 { 172 // Take ownership all selected items on the list page 173 dc = sc.newDbControl(); 174 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 175 int numTotal = cc.getSelected().size(); 176 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 177 dc.commit(); 178 if (numTotal != numOwned) 179 { 180 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 181 } 182 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 183 } 160 184 else if ("ExportItems".equals(cmd)) 161 185 { -
trunk/www/views/jobs/list_jobs.jsp
r2753 r2918 141 141 frm.submit(); 142 142 } 143 function takeOwnership() 144 { 145 var frm = document.forms[formId]; 146 if (Forms.numChecked(frm) == 0) 147 { 148 alert('Please select at least one item in the list'); 149 return; 150 } 151 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 152 { 153 frm.action = submitPage; 154 frm.cmd.value = 'TakeOwnershipOfItems'; 155 frm.submit(); 156 } 157 } 143 158 function configureColumns() 144 159 { … … 358 373 title="Restore" 359 374 tooltip="Restore the selected (deleted) items" 375 /> 376 <tbl:button 377 image="take_ownership.png" 378 onclick="takeOwnership()" 379 title="Take ownership…" 380 tooltip="Take ownership of the selected items" 381 visible="<%=sc.hasPermission(Permission.SET_OWNER, Item.JOB)%>" 360 382 /> 361 383 <tbl:button -
trunk/www/views/rawbioassays/index.jsp
r2811 r2918 59 59 import="net.sf.basedb.util.RemovableUtil" 60 60 import="net.sf.basedb.util.ShareableUtil" 61 import="net.sf.basedb.util.OwnableUtil" 61 62 import="net.sf.basedb.clients.web.Base" 62 63 import="net.sf.basedb.clients.web.WebException" … … 279 280 cc.setObject("MultiPermissions", permissions); 280 281 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 282 } 283 else if ("TakeOwnershipOfItem".equals(cmd)) 284 { 285 // Take ownership a single item and then return to the view page 286 dc = sc.newDbControl(); 287 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 288 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 289 dc.commit(); 290 redirect = viewPage; 291 } 292 else if ("TakeOwnershipOfItems".equals(cmd)) 293 { 294 // Take ownership all selected items on the list page 295 dc = sc.newDbControl(); 296 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 297 int numTotal = cc.getSelected().size(); 298 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 299 dc.commit(); 300 if (numTotal != numOwned) 301 { 302 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 303 } 304 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 281 305 } 282 306 else if ("ExportItems".equals(cmd)) -
trunk/www/views/rawbioassays/list_rawbioassays.jsp
r2893 r2918 150 150 frm.submit(); 151 151 } 152 function takeOwnership() 153 { 154 var frm = document.forms[formId]; 155 if (Forms.numChecked(frm) == 0) 156 { 157 alert('Please select at least one item in the list'); 158 return; 159 } 160 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 161 { 162 frm.action = submitPage; 163 frm.cmd.value = 'TakeOwnershipOfItems'; 164 frm.submit(); 165 } 166 } 152 167 function shareItem(itemId) 153 168 { … … 396 411 title="Share…" 397 412 tooltip="Share the selected items" 413 /> 414 <tbl:button 415 image="take_ownership.png" 416 onclick="takeOwnership()" 417 title="Take ownership…" 418 tooltip="Take ownership of the selected items" 398 419 /> 399 420 <tbl:button -
trunk/www/views/rawbioassays/view_rawbioassay.jsp
r2875 r2918 94 94 final boolean deletePermission = rawBioAssay.hasPermission(Permission.DELETE); 95 95 final boolean sharePermission = rawBioAssay.hasPermission(Permission.SET_PERMISSION); 96 final boolean setOwnerPermission = rawBioAssay.hasPermission(Permission.SET_OWNER); 97 final boolean isOwner = rawBioAssay.isOwner(); 96 98 %> 97 99 … … 114 116 { 115 117 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 118 } 119 function takeOwnership() 120 { 121 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 122 { 123 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 124 } 116 125 } 117 126 function runPlugin(cmd) … … 181 190 title="Share…" 182 191 tooltip="<%=sharePermission ? "Share this raw bioassay to other user, groups and projects" : "You do not have permission to share this raw bioassay"%>" 192 /> 193 <tbl:button 194 disabled="<%=setOwnerPermission ? false : true%>" 195 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 196 onclick="takeOwnership()" 197 title="Take ownership…" 198 visible="<%=!isOwner%>" 199 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 183 200 /> 184 201 <tbl:button -
trunk/www/views/reporterlists/index.jsp
r2811 r2918 47 47 import="net.sf.basedb.util.RemovableUtil" 48 48 import="net.sf.basedb.util.ShareableUtil" 49 import="net.sf.basedb.util.OwnableUtil" 49 50 import="net.sf.basedb.clients.web.Base" 50 51 import="net.sf.basedb.clients.web.WebException" … … 249 250 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 250 251 } 252 else if ("TakeOwnershipOfItem".equals(cmd)) 253 { 254 // Take ownership a single item and then return to the view page 255 dc = sc.newDbControl(); 256 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 257 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 258 dc.commit(); 259 redirect = viewPage; 260 } 261 else if ("TakeOwnershipOfItems".equals(cmd)) 262 { 263 // Take ownership all selected items on the list page 264 dc = sc.newDbControl(); 265 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 266 int numTotal = cc.getSelected().size(); 267 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 268 dc.commit(); 269 if (numTotal != numOwned) 270 { 271 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 272 } 273 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 274 } 251 275 else if ("ExportItems".equals(cmd)) 252 276 { -
trunk/www/views/reporterlists/list_reporterlists.jsp
r2753 r2918 124 124 frm.submit(); 125 125 } 126 function takeOwnership() 127 { 128 var frm = document.forms[formId]; 129 if (Forms.numChecked(frm) == 0) 130 { 131 alert('Please select at least one item in the list'); 132 return; 133 } 134 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 135 { 136 frm.action = submitPage; 137 frm.cmd.value = 'TakeOwnershipOfItems'; 138 frm.submit(); 139 } 140 } 126 141 function shareItem(itemId) 127 142 { … … 263 278 title="Share…" 264 279 tooltip="Share the selected items" 280 /> 281 <tbl:button 282 image="take_ownership.png" 283 onclick="takeOwnership()" 284 title="Take ownership…" 285 tooltip="Take ownership of the selected items" 265 286 /> 266 287 <tbl:button -
trunk/www/views/reporterlists/view_reporterlist.jsp
r2753 r2918 71 71 final boolean deletePermission = reporterList.hasPermission(Permission.DELETE); 72 72 final boolean sharePermission = reporterList.hasPermission(Permission.SET_PERMISSION); 73 final boolean setOwnerPermission = reporterList.hasPermission(Permission.SET_OWNER); 74 final boolean isOwner = reporterList.isOwner(); 73 75 %> 74 75 76 <base:page title="<%=title%>"> 76 77 <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css"> … … 91 92 { 92 93 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 94 } 95 function takeOwnership() 96 { 97 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 98 { 99 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 100 } 93 101 } 94 102 function runPlugin(cmd) … … 155 163 /> 156 164 <tbl:button 165 disabled="<%=setOwnerPermission ? false : true%>" 166 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 167 onclick="takeOwnership()" 168 title="Take ownership…" 169 visible="<%=!isOwner%>" 170 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 171 /> 172 <tbl:button 157 173 image="import.gif" 158 174 onclick="runPlugin('ImportItem')" -
trunk/www/views/scans/index.jsp
r2811 r2918 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" … … 237 238 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 238 239 } 240 else if ("TakeOwnershipOfItem".equals(cmd)) 241 { 242 // Take ownership a single item and then return to the view page 243 dc = sc.newDbControl(); 244 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 245 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 246 dc.commit(); 247 redirect = viewPage; 248 } 249 else if ("TakeOwnershipOfItems".equals(cmd)) 250 { 251 // Take ownership all selected items on the list page 252 dc = sc.newDbControl(); 253 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 254 int numTotal = cc.getSelected().size(); 255 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 256 dc.commit(); 257 if (numTotal != numOwned) 258 { 259 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 260 } 261 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 262 } 239 263 else if ("ExportItems".equals(cmd)) 240 264 { -
trunk/www/views/scans/list_scans.jsp
r2893 r2918 144 144 frm.submit(); 145 145 } 146 function takeOwnership() 147 { 148 var frm = document.forms[formId]; 149 if (Forms.numChecked(frm) == 0) 150 { 151 alert('Please select at least one item in the list'); 152 return; 153 } 154 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 155 { 156 frm.action = submitPage; 157 frm.cmd.value = 'TakeOwnershipOfItems'; 158 frm.submit(); 159 } 160 } 146 161 function shareItem(itemId) 147 162 { … … 329 344 title="Share…" 330 345 tooltip="Share the selected items" 346 /> 347 <tbl:button 348 image="take_ownership.png" 349 onclick="takeOwnership()" 350 title="Take ownership…" 351 tooltip="Take ownership of the selected items" 331 352 /> 332 353 <tbl:button -
trunk/www/views/scans/view_scan.jsp
r2875 r2918 85 85 final boolean deletePermission = scan.hasPermission(Permission.DELETE); 86 86 final boolean sharePermission = scan.hasPermission(Permission.SET_PERMISSION); 87 final boolean setOwnerPermission = scan.hasPermission(Permission.SET_OWNER); 88 final boolean isOwner = scan.isOwner(); 87 89 %> 88 90 … … 105 107 { 106 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 } 107 116 } 108 117 function runPlugin(cmd) … … 172 181 title="Share…" 173 182 tooltip="<%=sharePermission ? "Share this scan to other user, groups and projects" : "You do not have permission to share this scan"%>" 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"%>" 174 191 /> 175 192 <tbl:button
Note: See TracChangeset
for help on using the changeset viewer.