General Actions:
Log-in
Wiki:
L3D's Wiki
▼
:
Document Index
»
Space:
XWiki
▼
:
Document Index
»
Page:
OfficeImporterResults
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to your wiki
»
XWiki Space
»
Office Importer
»
Office Importer Results
Wiki source code of
Office Importer Results
Last modified by
Administrator
on 2011/03/02 17:34
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity}} 2: #if($isguest) 3: #error($msg.get("xe.officeimporter.notallowed")) 4: #else 5: ######################### 6: ## Validate Input File ## 7: ######################### 8: #set($goBack = "[[$msg.get('xe.officeimporter.results.goback')>>XWiki.OfficeImporter]]") 9: #set($fileUpload=$xwiki.fileupload) 10: #set($fileName=$fileUpload.getFileName("filePath")) 11: #if(! $fileName) 12: {{error}}$msg.get("xe.officeimporter.results.missingfile", [$goBack]){{/error}} 13: #else 14: #set($void=$fileUpload.loadFileList()) 15: #set($officeFileStream=$fileUpload.fileItems.get(0).inputStream) 16: #end 17: ########################### 18: ## Validate Target Space ## 19: ########################### 20: #if(! $request.targetSpace) 21: {{error}}$msg.get("xe.officeimporter.results.missingspace", [$goBack]){{/error}} 22: #else 23: #set($targetSpace=$request.targetSpace.replaceAll("[:/]", "-")) 24: #end 25: ########################## 26: ## Validate Target Page ## 27: ########################## 28: #if(! $request.targetPage) 29: {{error}}$msg.get("xe.officeimporter.results.missingpage", [$goBack]){{/error}} 30: #else 31: #set($targetPage=$request.targetPage.replaceAll("[.:/]", "-")) 32: #end 33: ########################## 34: ## Append Configuration ## 35: ########################## 36: #set($appendContent=false) 37: #if($request.appendContent) 38: #set($appendContent=true) 39: #end 40: ############################# 41: ## Filtering Configuration ## 42: ############################# 43: #set($filterStyles=false) 44: #if($request.filterStyles) 45: #set($filterStyles=true) 46: #end 47: ############################# 48: ## Splitting Configuration ## 49: ############################# 50: #set($splitDocument=false) 51: #if($request.splitDocument) 52: #set($splitDocument=true) 53: #set($headingLevels=$request.getParameterValues("headingLevelsToSplit")) 54: #end 55: ############ 56: ## Import ## 57: ############ 58: #if($fileName && $targetSpace && $targetPage) 59: #set($targetDocumentName="${targetSpace}.${targetPage}") 60: #set($targetDocument=$xwiki.getDocument($targetDocumentName)) 61: #set($resultDocumentLink="[[**$msg.get('xe.officeimporter.results.result')**>>$targetDocument.getExternalURL('view')]]") 62: #set($xdomOfficeDoc=$officeimporter.officeToXDOM($officeFileStream, $fileName, $targetDocumentName, $filterStyles)) 63: #if($xdomOfficeDoc) 64: #if(! $splitDocument) 65: #set($result=$officeimporter.save($xdomOfficeDoc, $targetDocumentName, "xwiki/2.0", null, null, $appendContent)) 66: #if($result) 67: {{info}}$msg.get("xe.officeimporter.results.success", [$resultDocumentLink, $goBack]){{/info}} 68: #else 69: {{error}}$officeimporter.errorMessage{{/error}} 70: #end 71: #else 72: #set($docsMap=$officeimporter.split($xdomOfficeDoc, $headingLevels, $request.childPagesNamingMethod, $targetDocumentName)) 73: #if($docsMap) 74: #foreach($targetDescriptor in $docsMap.keySet()) 75: #set($splitXdomOfficeDoc=$docsMap.get($targetDescriptor)) 76: #set($target=$targetDescriptor.documentReferenceAsString) 77: #set($parent=$targetDescriptor.parentReferenceAsString) 78: #set($result=$officeimporter.save($splitXdomOfficeDoc, $target, "xwiki/2.0", $parent, null, $appendContent)) 79: #if(! $result) 80: {{warning}}$officeimporter.errorMessage{{/warning}} 81: #end 82: #end 83: {{info}}$msg.get("xe.officeimporter.results.success", [$resultDocumentLink, $goBack]){{/info}} 84: #else 85: {{error}}$officeimporter.errorMessage{{/error}} 86: #end 87: #end 88: #else 89: {{error}}$officeimporter.errorMessage{{/error}} 90: #end 91: #end 92: #end 93: {{/velocity}}
Quick Links
L3D Calendar
Wiki Dashboard
Document Index
Blog
Sandbox