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
Show line numbers
{{velocity}} #macro (printException $exception) #if($exception.message) {{error}}$exception.message{{/error}} #else {{error}}$exception.class{{/error}} #end #end ## #set ($workspaceName = $request.workspaceName) #set ($workspaceId = $request.workspaceId) #set ($confirm = $request.confirm) ## #if ("$!workspaceId" == '' || "$!workspaceName" == '') {{error}}[workspaceId] and [workspaceName] parameters are not specified.{{/error}} #else ## FIXME: add plugin dependency checks. ## #set ($WorkspaceManager = $services.workspace) ## #set ($workspace = $WorkspaceManager.getWorkspace($workspaceId)) ## #if (!$workspace) #if (!$WorkspaceManager.lastException) {{error}}The workspace '$workspaceId' does not exist.{{/error}} #else #printException($WorkspaceManager.lastException) #end #else #set ($currentUser = "${xcontext.mainWikiName}:${xcontext.user}") #set ($workspaceUrl = $workspace.wikiDescriptor.homePageUrl) ## #if (!$WorkspaceManager.canDeleteWorkspace($currentUser, $workspaceId)) {{error}}The user #if($xcontext.user != 'XWiki.XWikiGuest')[[$currentUser]]#{else}$xcontext.user#end is not allowed to delete the workspace [[$workspaceName>>$workspaceUrl]].{{/error}} #else #if ("$!confirm" != 1) #set ($browseDocumentReference = $services.model.createDocumentReference($xcontext.mainWikiName, 'WorkspaceManager', 'WebHome')) #set ($backUrl = $xwiki.getURL($browseDocumentReference)) #set ($confirmUrl = $doc.getURL('view', "$!request.queryString&confirm=1")) {{box}} Are you sure you want to delete the workspace [[$workspaceName>>$workspaceUrl]]? ((({{html}} <span class="buttonwrapper"><a class="button" href="$confirmUrl">Yes</a> <a class="button" href="$backUrl">No</a></span> {{/html}}))) {{/box}} #else #set ($temp = $WorkspaceManager.deleteWorkspace($workspaceId)) #if ($WorkspaceManager.lastException) #printException($WorkspaceManager.lastException) #else {{success}}The user [[$currentUser]] successfully deleted the workspace ${workspaceName}.{{/success}} #end #end #end #end #end {{/velocity}}