General Actions:
Log-in
Register
Wiki:
Main wiki
▼
:
Document Index
»
Space:
WorkspaceManager
▼
:
Document Index
»
Page:
UpdateWorkspaceCode
Search
en
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Main wiki
»
Browse Workspaces
»
UpdateWorkspaceCode
Wiki source code of
UpdateWorkspaceCode
Last modified by
Administrator
on 2012/03/21 17:40
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Show line numbers
Updates the wiki document of a workspace by using values from the request. The 'workspaceId' parameter is used to identify the wiki document and the request values update the objects of classes [[XWiki.XWikiServerClass]] and [[WorkspaceManager.WorkspaceClass]], objects which are already stored in the wiki document. The 'xredirect' parameter is also accepted, currently used in the administration section of a workspace. {{velocity}} #set ($workspaceId = $request.workspaceId) #set ($WorkspaceManager = $services.workspace) ## ## TODO: use a dependency check macro. ## #if ("$!workspaceId" == '') {{error}}Parameter 'workspaceId' was not specified.{{/error}} #else #set ($workspace = $WorkspaceManager.getWorkspace($workspaceId)) #if (!$workspace) #if (!$WorkspaceManager.lastException) {{error}}The workspace '$workspaceId' does not exist.{{/error}} #elseif("${WorkspaceManager.lastException.message}" != '') {{error}}$WorkspaceManager.lastException.message{{/error}} #else {{error}}$WorkspaceManager.lastException.class{{/error}} #end #else #set($wikiDocument = $workspace.wikiDocument) #set($temp = $wikiDocument.updateObjectFromRequest("${xcontext.mainWikiName}:XWiki.XWikiServerClass")) #set($temp = $wikiDocument.updateObjectFromRequest("${xcontext.mainWikiName}:WorkspaceManager.WorkspaceClass")) #set($temp = $WorkspaceManager.editWorkspace($workspaceId, $wikiDocument.firstWikiAlias)) #end #if($request.xredirect) $response.sendRedirect($request.xredirect) #end #end {{/velocity}}