General Actions:
Log-in
Register
Wiki:
Main wiki
▼
:
Document Index
»
Space:
WorkspaceManager
▼
:
Document Index
»
Page:
DeleteWorkspaceCode
Search
en
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Main wiki
»
Browse Workspaces
»
Delete Workspace
Wiki source code of
Delete Workspace
Last modified by
Administrator
on 2012/03/21 17:40
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity}} 2: #macro (printException $exception) 3: #if($exception.message) 4: {{error}}$exception.message{{/error}} 5: #else 6: {{error}}$exception.class{{/error}} 7: #end 8: #end 9: ## 10: #set ($workspaceName = $request.workspaceName) 11: #set ($workspaceId = $request.workspaceId) 12: #set ($confirm = $request.confirm) 13: ## 14: #if ("$!workspaceId" == '' || "$!workspaceName" == '') 15: {{error}}[workspaceId] and [workspaceName] parameters are not specified.{{/error}} 16: #else 17: ## FIXME: add plugin dependency checks. 18: ## 19: #set ($WorkspaceManager = $services.workspace) 20: ## 21: #set ($workspace = $WorkspaceManager.getWorkspace($workspaceId)) 22: ## 23: #if (!$workspace) 24: #if (!$WorkspaceManager.lastException) 25: {{error}}The workspace '$workspaceId' does not exist.{{/error}} 26: #else 27: #printException($WorkspaceManager.lastException) 28: #end 29: #else 30: #set ($currentUser = "${xcontext.mainWikiName}:${xcontext.user}") 31: #set ($workspaceUrl = $workspace.wikiDescriptor.homePageUrl) 32: ## 33: #if (!$WorkspaceManager.canDeleteWorkspace($currentUser, $workspaceId)) 34: {{error}}The user #if($xcontext.user != 'XWiki.XWikiGuest')[[$currentUser]]#{else}$xcontext.user#end is not allowed to delete the workspace [[$workspaceName>>$workspaceUrl]].{{/error}} 35: #else 36: #if ("$!confirm" != 1) 37: #set ($browseDocumentReference = $services.model.createDocumentReference($xcontext.mainWikiName, 'WorkspaceManager', 'WebHome')) 38: #set ($backUrl = $xwiki.getURL($browseDocumentReference)) 39: #set ($confirmUrl = $doc.getURL('view', "$!request.queryString&confirm=1")) 40: {{box}} 41: Are you sure you want to delete the workspace [[$workspaceName>>$workspaceUrl]]? 42: ((({{html}} 43: <span class="buttonwrapper"><a class="button" href="$confirmUrl">Yes</a> <a class="button" href="$backUrl">No</a></span> 44: {{/html}}))) 45: {{/box}} 46: #else 47: #set ($temp = $WorkspaceManager.deleteWorkspace($workspaceId)) 48: #if ($WorkspaceManager.lastException) 49: #printException($WorkspaceManager.lastException) 50: #else 51: {{success}}The user [[$currentUser]] successfully deleted the workspace ${workspaceName}.{{/success}} 52: #end 53: #end 54: #end 55: #end 56: #end 57: {{/velocity}}