Changeset 2921
- Timestamp:
- Nov 15, 2006, 2:22:44 PM (16 years ago)
- Location:
- trunk/www/admin
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/admin/annotationtypecategories/index.jsp
r2811 r2921 42 42 import="net.sf.basedb.util.RemovableUtil" 43 43 import="net.sf.basedb.util.ShareableUtil" 44 import="net.sf.basedb.util.OwnableUtil" 44 45 import="net.sf.basedb.clients.web.Base" 45 46 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/admin/annotationtypecategories/list_categories.jsp
r2753 r2921 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 shareItems() 147 162 { … … 262 277 title="Share…" 263 278 tooltip="Share the selected items" 279 /> 280 <tbl:button 281 image="take_ownership.png" 282 onclick="takeOwnership()" 283 title="Take ownership…" 284 tooltip="Take ownership of the selected items" 264 285 /> 265 286 <tbl:button -
trunk/www/admin/annotationtypecategories/view_category.jsp
r2753 r2921 73 73 final boolean deletePermission = annotationTypeCategory.hasPermission(Permission.DELETE); 74 74 final boolean sharePermission = annotationTypeCategory.hasPermission(Permission.SET_PERMISSION); 75 final boolean setOwnerPermission = annotationTypeCategory.hasPermission(Permission.SET_OWNER); 76 final boolean isOwner = annotationTypeCategory.isOwner(); 75 77 %> 76 77 78 <base:page title="<%=title%>"> 78 79 <base:head scripts="tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> … … 93 94 { 94 95 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 96 } 97 function takeOwnership() 98 { 99 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 100 { 101 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 102 } 95 103 } 96 104 function runPlugin(cmd) … … 141 149 title="Share…" 142 150 tooltip="<%=sharePermission ? "Share this annotation type category to other user, groups and projects" : "You do not have permission to share this annotation type"%>" 151 /> 152 <tbl:button 153 disabled="<%=setOwnerPermission ? false : true%>" 154 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 155 onclick="takeOwnership()" 156 title="Take ownership…" 157 visible="<%=!isOwner%>" 158 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 143 159 /> 144 160 <tbl:button -
trunk/www/admin/annotationtypes/index.jsp
r2875 r2921 42 42 import="net.sf.basedb.util.RemovableUtil" 43 43 import="net.sf.basedb.util.ShareableUtil" 44 import="net.sf.basedb.util.OwnableUtil" 44 45 import="net.sf.basedb.clients.web.Base" 45 46 import="net.sf.basedb.clients.web.WebException" … … 325 326 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 326 327 } 328 else if ("TakeOwnershipOfItem".equals(cmd)) 329 { 330 // Take ownership a single item and then return to the view page 331 dc = sc.newDbControl(); 332 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 333 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 334 dc.commit(); 335 redirect = viewPage; 336 } 337 else if ("TakeOwnershipOfItems".equals(cmd)) 338 { 339 // Take ownership all selected items on the list page 340 dc = sc.newDbControl(); 341 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 342 int numTotal = cc.getSelected().size(); 343 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 344 dc.commit(); 345 if (numTotal != numOwned) 346 { 347 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 348 } 349 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 350 } 327 351 else if ("ExportItems".equals(cmd)) 328 352 { -
trunk/www/admin/annotationtypes/list_annotationtypes.jsp
r2875 r2921 170 170 frm.submit(); 171 171 } 172 function takeOwnership() 173 { 174 var frm = document.forms[formId]; 175 if (Forms.numChecked(frm) == 0) 176 { 177 alert('Please select at least one item in the list'); 178 return; 179 } 180 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 181 { 182 frm.action = submitPage; 183 frm.cmd.value = 'TakeOwnershipOfItems'; 184 frm.submit(); 185 } 186 } 172 187 function shareItem(itemId) 173 188 { … … 356 371 title="Share…" 357 372 tooltip="Share the selected items" 373 /> 374 <tbl:button 375 image="take_ownership.png" 376 onclick="takeOwnership()" 377 title="Take ownership…" 378 tooltip="Take ownership of the selected items" 358 379 /> 359 380 <tbl:button -
trunk/www/admin/annotationtypes/view_annotationtype.jsp
r2875 r2921 75 75 final boolean deletePermission = annotationType.hasPermission(Permission.DELETE); 76 76 final boolean sharePermission = annotationType.hasPermission(Permission.SET_PERMISSION); 77 final boolean setOwnerPermission = annotationType.hasPermission(Permission.SET_OWNER); 78 final boolean isOwner = annotationType.isOwner(); 77 79 %> 78 79 80 <base:page title="<%=title%>"> 80 81 <base:head scripts="tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> … … 95 96 { 96 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 } 97 105 } 98 106 function runPlugin(cmd) … … 143 151 title="Share…" 144 152 tooltip="<%=sharePermission ? "Share this annotation type to other user, groups and projects" : "You do not have permission to share this annotation type"%>" 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"%>" 145 161 /> 146 162 <tbl:button -
trunk/www/admin/clients/index.jsp
r2811 r2921 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" … … 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/admin/clients/list_clients.jsp
r2753 r2921 127 127 frm.submit(); 128 128 } 129 function takeOwnership() 130 { 131 var frm = document.forms[formId]; 132 if (Forms.numChecked(frm) == 0) 133 { 134 alert('Please select at least one item in the list'); 135 return; 136 } 137 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 138 { 139 frm.action = submitPage; 140 frm.cmd.value = 'TakeOwnershipOfItems'; 141 frm.submit(); 142 } 143 } 129 144 function shareItem(itemId) 130 145 { … … 253 268 title="Share…" 254 269 tooltip="Share the selected items" 270 /> 271 <tbl:button 272 image="take_ownership.png" 273 onclick="takeOwnership()" 274 title="Take ownership…" 275 tooltip="Take ownership of the selected items" 255 276 /> 256 277 <tbl:button -
trunk/www/admin/clients/view_client.jsp
r2753 r2921 69 69 final boolean deletePermission = client.hasPermission(Permission.DELETE); 70 70 final boolean sharePermission = client.hasPermission(Permission.SET_PERMISSION); 71 final boolean setOwnerPermission = client.hasPermission(Permission.SET_OWNER); 72 final boolean isOwner = client.isOwner(); 71 73 %> 72 73 74 <base:page title="<%=title%>"> 74 75 <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css"> … … 89 90 { 90 91 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 92 } 93 function takeOwnership() 94 { 95 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 96 { 97 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 98 } 91 99 } 92 100 function runPlugin(cmd) … … 154 162 /> 155 163 <tbl:button 164 disabled="<%=setOwnerPermission ? false : true%>" 165 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 166 onclick="takeOwnership()" 167 title="Take ownership…" 168 visible="<%=!isOwner%>" 169 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 170 /> 171 <tbl:button 156 172 image="import.gif" 157 173 onclick="runPlugin('ImportItem')" -
trunk/www/admin/hardware/index.jsp
r2811 r2921 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" … … 219 220 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 220 221 } 222 else if ("TakeOwnershipOfItem".equals(cmd)) 223 { 224 // Take ownership a single item and then return to the view page 225 dc = sc.newDbControl(); 226 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 227 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 228 dc.commit(); 229 redirect = viewPage; 230 } 231 else if ("TakeOwnershipOfItems".equals(cmd)) 232 { 233 // Take ownership all selected items on the list page 234 dc = sc.newDbControl(); 235 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 236 int numTotal = cc.getSelected().size(); 237 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 238 dc.commit(); 239 if (numTotal != numOwned) 240 { 241 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 242 } 243 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 244 } 221 245 else if ("ExportItems".equals(cmd)) 222 246 { -
trunk/www/admin/hardware/list_hardware.jsp
r2753 r2921 132 132 frm.submit(); 133 133 } 134 function takeOwnership() 135 { 136 var frm = document.forms[formId]; 137 if (Forms.numChecked(frm) == 0) 138 { 139 alert('Please select at least one item in the list'); 140 return; 141 } 142 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 143 { 144 frm.action = submitPage; 145 frm.cmd.value = 'TakeOwnershipOfItems'; 146 frm.submit(); 147 } 148 } 134 149 function shareItem(itemId) 135 150 { … … 277 292 title="Share…" 278 293 tooltip="Share the selected items" 294 /> 295 <tbl:button 296 image="take_ownership.png" 297 onclick="takeOwnership()" 298 title="Take ownership…" 299 tooltip="Take ownership of the selected items" 279 300 /> 280 301 <tbl:button -
trunk/www/admin/hardware/view_hardware.jsp
r2753 r2921 70 70 final boolean deletePermission = hardware.hasPermission(Permission.DELETE); 71 71 final boolean sharePermission = hardware.hasPermission(Permission.SET_PERMISSION); 72 final boolean setOwnerPermission = hardware.hasPermission(Permission.SET_OWNER); 73 final boolean isOwner = hardware.isOwner(); 72 74 %> 73 74 75 <base:page title="<%=title%>"> 75 76 <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css"> … … 90 91 { 91 92 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 93 } 94 function takeOwnership() 95 { 96 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 97 { 98 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 99 } 92 100 } 93 101 function runPlugin(cmd) … … 138 146 title="Share…" 139 147 tooltip="<%=sharePermission ? "Share this hardware to other user, groups and projects" : "You do not have permission to share this hardware"%>" 148 /> 149 <tbl:button 150 disabled="<%=setOwnerPermission ? false : true%>" 151 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 152 onclick="takeOwnership()" 153 title="Take ownership…" 154 visible="<%=!isOwner%>" 155 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 140 156 /> 141 157 <tbl:button -
trunk/www/admin/jobagents/index.jsp
r2811 r2921 41 41 import="net.sf.basedb.util.RemovableUtil" 42 42 import="net.sf.basedb.util.ShareableUtil" 43 import="net.sf.basedb.util.OwnableUtil" 43 44 import="net.sf.basedb.util.jobagent.JobAgentConnection" 44 45 import="net.sf.basedb.clients.web.Base" … … 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/admin/jobagents/list_agents.jsp
r2753 r2921 137 137 frm.submit(); 138 138 } 139 function takeOwnership() 140 { 141 var frm = document.forms[formId]; 142 if (Forms.numChecked(frm) == 0) 143 { 144 alert('Please select at least one item in the list'); 145 return; 146 } 147 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 148 { 149 frm.action = submitPage; 150 frm.cmd.value = 'TakeOwnershipOfItems'; 151 frm.submit(); 152 } 153 } 139 154 function shareItem(itemId) 140 155 { … … 309 324 title="Share…" 310 325 tooltip="Share the selected items" 326 /> 327 <tbl:button 328 image="take_ownership.png" 329 onclick="takeOwnership()" 330 title="Take ownership…" 331 tooltip="Take ownership of the selected items" 311 332 /> 312 333 <tbl:button -
trunk/www/admin/jobagents/view_agent.jsp
r2753 r2921 81 81 final boolean deletePermission = agent.hasPermission(Permission.DELETE); 82 82 final boolean sharePermission = agent.hasPermission(Permission.SET_PERMISSION); 83 final boolean setOwnerPermission = agent.hasPermission(Permission.SET_OWNER); 84 final boolean isOwner = agent.isOwner(); 83 85 %> 84 85 86 <base:page title="<%=title%>"> 86 87 <base:head scripts="tabcontrol.js,table.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css,progressbar.css"> … … 101 102 { 102 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 } 103 111 } 104 112 function configurePlugin(pluginId) … … 153 161 title="Share…" 154 162 tooltip="<%=sharePermission ? "Share this job agent to other user, groups and projects" : "You do not have permission to share this job agent"%>" 163 /> 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"%>" 155 171 /> 156 172 <tbl:button -
trunk/www/admin/pluginconfigurations/index.jsp
r2811 r2921 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.util.JarClassLoader" 43 44 import="net.sf.basedb.clients.web.Base" … … 241 242 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 242 243 } 244 else if ("TakeOwnershipOfItem".equals(cmd)) 245 { 246 // Take ownership a single item and then return to the view page 247 dc = sc.newDbControl(); 248 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 249 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 250 dc.commit(); 251 redirect = viewPage; 252 } 253 else if ("TakeOwnershipOfItems".equals(cmd)) 254 { 255 // Take ownership all selected items on the list page 256 dc = sc.newDbControl(); 257 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 258 int numTotal = cc.getSelected().size(); 259 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 260 dc.commit(); 261 if (numTotal != numOwned) 262 { 263 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 264 } 265 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 266 } 243 267 else if ("ExportItems".equals(cmd)) 244 268 { -
trunk/www/admin/pluginconfigurations/list_configurations.jsp
r2753 r2921 167 167 frm.submit(); 168 168 } 169 function takeOwnership() 170 { 171 var frm = document.forms[formId]; 172 if (Forms.numChecked(frm) == 0) 173 { 174 alert('Please select at least one item in the list'); 175 return; 176 } 177 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 178 { 179 frm.action = submitPage; 180 frm.cmd.value = 'TakeOwnershipOfItems'; 181 frm.submit(); 182 } 183 } 169 184 function shareItem(itemId) 170 185 { … … 321 336 title="Share…" 322 337 tooltip="Share the selected items" 338 /> 339 <tbl:button 340 image="take_ownership.png" 341 onclick="takeOwnership()" 342 title="Take ownership…" 343 tooltip="Take ownership of the selected items" 323 344 /> 324 345 <tbl:button -
trunk/www/admin/pluginconfigurations/view_configuration.jsp
r2753 r2921 84 84 final boolean deletePermission = configuration.hasPermission(Permission.DELETE); 85 85 final boolean sharePermission = configuration.hasPermission(Permission.SET_PERMISSION); 86 final boolean setOwnerPermission = configuration.hasPermission(Permission.SET_OWNER); 87 final boolean isOwner = configuration.isOwner(); 86 88 87 89 final Set<GuiContext> contexts = new TreeSet<GuiContext>(new ToStringComparator<GuiContext>(false)); … … 124 126 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 125 127 } 128 function takeOwnership() 129 { 130 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 131 { 132 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 133 } 134 } 126 135 function runPlugin(cmd) 127 136 { … … 181 190 title="Share…" 182 191 tooltip="<%=sharePermission ? "Share this plugin configuration to other user, groups and projects" : "You do not have permission to share this plugin configuration"%>" 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/admin/plugindefinitions/index.jsp
r2854 r2921 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.util.JarClassLoader" 47 48 import="net.sf.basedb.clients.web.Base" … … 273 274 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 274 275 } 276 else if ("TakeOwnershipOfItem".equals(cmd)) 277 { 278 // Take ownership a single item and then return to the view page 279 dc = sc.newDbControl(); 280 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 281 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 282 dc.commit(); 283 redirect = viewPage; 284 } 285 else if ("TakeOwnershipOfItems".equals(cmd)) 286 { 287 // Take ownership all selected items on the list page 288 dc = sc.newDbControl(); 289 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 290 int numTotal = cc.getSelected().size(); 291 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 292 dc.commit(); 293 if (numTotal != numOwned) 294 { 295 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 296 } 297 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 298 } 275 299 else if ("ExportItems".equals(cmd)) 276 300 { -
trunk/www/admin/plugindefinitions/list_plugins.jsp
r2854 r2921 158 158 frm.submit(); 159 159 } 160 function takeOwnership() 161 { 162 var frm = document.forms[formId]; 163 if (Forms.numChecked(frm) == 0) 164 { 165 alert('Please select at least one item in the list'); 166 return; 167 } 168 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 169 { 170 frm.action = submitPage; 171 frm.cmd.value = 'TakeOwnershipOfItems'; 172 frm.submit(); 173 } 174 } 160 175 function unloadItems() 161 176 { … … 445 460 title="Share…" 446 461 tooltip="Share the selected items" 462 /> 463 <tbl:button 464 image="take_ownership.png" 465 onclick="takeOwnership()" 466 title="Take ownership…" 467 tooltip="Take ownership of the selected items" 447 468 /> 448 469 <tbl:button -
trunk/www/admin/plugindefinitions/view_plugin.jsp
r2916 r2921 103 103 final boolean deletePermission = plugin.hasPermission(Permission.DELETE); 104 104 final boolean sharePermission = plugin.hasPermission(Permission.SET_PERMISSION); 105 final boolean setOwnerPermission = plugin.hasPermission(Permission.SET_OWNER); 106 final boolean isOwner = plugin.isOwner(); 105 107 %> 106 107 108 <base:page title="<%=title%>"> 108 109 <base:head scripts="tabcontrol.js,table.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css"> … … 123 124 { 124 125 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 126 } 127 function takeOwnership() 128 { 129 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 130 { 131 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 132 } 125 133 } 126 134 function runPlugin(cmd) … … 186 194 title="Share…" 187 195 tooltip="<%=sharePermission ? "Share this plugin to other user, groups and projects" : "You do not have permission to share this plugin"%>" 196 /> 197 <tbl:button 198 disabled="<%=setOwnerPermission ? false : true%>" 199 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 200 onclick="takeOwnership()" 201 title="Take ownership…" 202 visible="<%=!isOwner%>" 203 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 188 204 /> 189 205 <tbl:button -
trunk/www/admin/protocols/index.jsp
r2875 r2921 42 42 import="net.sf.basedb.util.RemovableUtil" 43 43 import="net.sf.basedb.util.ShareableUtil" 44 import="net.sf.basedb.util.OwnableUtil" 44 45 import="net.sf.basedb.clients.web.Base" 45 46 import="net.sf.basedb.clients.web.WebException" … … 241 242 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 242 243 } 244 else if ("TakeOwnershipOfItem".equals(cmd)) 245 { 246 // Take ownership a single item and then return to the view page 247 dc = sc.newDbControl(); 248 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 249 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 250 dc.commit(); 251 redirect = viewPage; 252 } 253 else if ("TakeOwnershipOfItems".equals(cmd)) 254 { 255 // Take ownership all selected items on the list page 256 dc = sc.newDbControl(); 257 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 258 int numTotal = cc.getSelected().size(); 259 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 260 dc.commit(); 261 if (numTotal != numOwned) 262 { 263 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 264 } 265 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 266 } 243 267 else if ("ExportItems".equals(cmd)) 244 268 { -
trunk/www/admin/protocols/list_protocol.jsp
r2753 r2921 132 132 frm.submit(); 133 133 } 134 function takeOwnership() 135 { 136 var frm = document.forms[formId]; 137 if (Forms.numChecked(frm) == 0) 138 { 139 alert('Please select at least one item in the list'); 140 return; 141 } 142 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 143 { 144 frm.action = submitPage; 145 frm.cmd.value = 'TakeOwnershipOfItems'; 146 frm.submit(); 147 } 148 } 134 149 function shareItem(itemId) 135 150 { … … 277 292 title="Share…" 278 293 tooltip="Share the selected items" 294 /> 295 <tbl:button 296 image="take_ownership.png" 297 onclick="takeOwnership()" 298 title="Take ownership…" 299 tooltip="Take ownership of the selected items" 279 300 /> 280 301 <tbl:button -
trunk/www/admin/protocols/view_protocol.jsp
r2875 r2921 77 77 final boolean deletePermission = protocol.hasPermission(Permission.DELETE); 78 78 final boolean sharePermission = protocol.hasPermission(Permission.SET_PERMISSION); 79 final boolean setOwnerPermission = protocol.hasPermission(Permission.SET_OWNER); 80 final boolean isOwner = protocol.isOwner(); 79 81 %> 80 81 82 <base:page title="<%=title%>"> 82 83 <base:head scripts="tabcontrol.js,table.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css"> … … 97 98 { 98 99 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 100 } 101 function takeOwnership() 102 { 103 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 104 { 105 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 106 } 99 107 } 100 108 function runPlugin(cmd) … … 145 153 title="Share…" 146 154 tooltip="<%=sharePermission ? "Share this protocol to other user, groups and projects" : "You do not have permission to share this protocol"%>" 155 /> 156 <tbl:button 157 disabled="<%=setOwnerPermission ? false : true%>" 158 image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>" 159 onclick="takeOwnership()" 160 title="Take ownership…" 161 visible="<%=!isOwner%>" 162 tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>" 147 163 /> 148 164 <tbl:button -
trunk/www/admin/software/index.jsp
r2811 r2921 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" … … 219 220 redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name(); 220 221 } 222 else if ("TakeOwnershipOfItem".equals(cmd)) 223 { 224 // Take ownership a single item and then return to the view page 225 dc = sc.newDbControl(); 226 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 227 OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null); 228 dc.commit(); 229 redirect = viewPage; 230 } 231 else if ("TakeOwnershipOfItems".equals(cmd)) 232 { 233 // Take ownership all selected items on the list page 234 dc = sc.newDbControl(); 235 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 236 int numTotal = cc.getSelected().size(); 237 int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null); 238 dc.commit(); 239 if (numTotal != numOwned) 240 { 241 message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission"; 242 } 243 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 244 } 221 245 else if ("ExportItems".equals(cmd)) 222 246 { -
trunk/www/admin/software/list_software.jsp
r2776 r2921 132 132 frm.submit(); 133 133 } 134 function takeOwnership() 135 { 136 var frm = document.forms[formId]; 137 if (Forms.numChecked(frm) == 0) 138 { 139 alert('Please select at least one item in the list'); 140 return; 141 } 142 if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.')) 143 { 144 frm.action = submitPage; 145 frm.cmd.value = 'TakeOwnershipOfItems'; 146 frm.submit(); 147 } 148 } 134 149 function shareItem(itemId) 135 150 { … … 277 292 title="Share…" 278 293 tooltip="Share the selected items" 294 /> 295 <tbl:button 296 image="take_ownership.png" 297 onclick="takeOwnership()" 298 title="Take ownership…" 299 tooltip="Take ownership of the selected items" 279 300 /> 280 301 <tbl:button -
trunk/www/admin/software/view_software.jsp
r2753 r2921 70 70 final boolean deletePermission = software.hasPermission(Permission.DELETE); 71 71 final boolean sharePermission = software.hasPermission(Permission.SET_PERMISSION); 72 final boolean setOwnerPermission = software.hasPermission(Permission.SET_OWNER); 73 final boolean isOwner = software.isOwner(); 72 74 %> 73 74 75 <base:page title="<%=title%>"> 75 76 <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css"> … … 90 91 { 91 92 location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); 93 } 94 function takeOwnership() 95 { 96 if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.')) 97 { 98 location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>'); 99 } 92 100 } 93 101 function runPlugin(cmd) … … 137 145 title="Share…" 138 146 tooltip="<%=sharePermission ? "Share this software to other user, groups and projects" : "You do not have permission to share this software"%>" 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
Note: See TracChangeset
for help on using the changeset viewer.