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
Hide line numbers
1: Updates the wiki document of a workspace by using values from the request. 2: 3: 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. 4: 5: The 'xredirect' parameter is also accepted, currently used in the administration section of a workspace. 6: 7: {{velocity}} 8: #set ($workspaceId = $request.workspaceId) 9: #set ($WorkspaceManager = $services.workspace) 10: ## 11: ## TODO: use a dependency check macro. 12: ## 13: #if ("$!workspaceId" == '') 14: {{error}}Parameter 'workspaceId' was not specified.{{/error}} 15: #else 16: #set ($workspace = $WorkspaceManager.getWorkspace($workspaceId)) 17: #if (!$workspace) 18: #if (!$WorkspaceManager.lastException) 19: {{error}}The workspace '$workspaceId' does not exist.{{/error}} 20: #elseif("${WorkspaceManager.lastException.message}" != '') 21: {{error}}$WorkspaceManager.lastException.message{{/error}} 22: #else 23: {{error}}$WorkspaceManager.lastException.class{{/error}} 24: #end 25: #else 26: #set($wikiDocument = $workspace.wikiDocument) 27: #set($temp = $wikiDocument.updateObjectFromRequest("${xcontext.mainWikiName}:XWiki.XWikiServerClass")) 28: #set($temp = $wikiDocument.updateObjectFromRequest("${xcontext.mainWikiName}:WorkspaceManager.WorkspaceClass")) 29: #set($temp = $WorkspaceManager.editWorkspace($workspaceId, $wikiDocument.firstWikiAlias)) 30: #end 31: #if($request.xredirect) 32: $response.sendRedirect($request.xredirect) 33: #end 34: #end 35: {{/velocity}}