General Actions:
Log-in
Register
Wiki:
Main wiki
▼
:
Document Index
»
Space:
AppWithinMinutes
▼
:
Document Index
»
Page:
CreateApplication
Search
default
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Main wiki
»
App Within Minutes
»
Create Application
Wiki source code of
Create Application
Last modified by
Administrator
on 2012/03/21 17:41
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{include document="AppWithinMinutes.WizardStep"/}} 2: 3: {{velocity output="false"}} 4: #macro(showStep) 5: {{html wiki="true"}} 6: #appWizardHeader(1) 7: (% class="wizard-help" %) 8: ((( 9: **$msg.get('platform.appwithinminutes.wizardStepHelpTitle')** $msg.get('platform.appwithinminutes.wizardStepHelpDescription') 10: (% class="steps" %) 11: #foreach($index in [1, 2, 3]) 12: * (% class="number" %)$index(%%) (% class="name" %)$msg.get("platform.appwithinminutes.wizardStep${index}Name")(%%) 13: (% class="description" %)$msg.get("platform.appwithinminutes.wizardStep${index}Description") 14: #end 15: ))) 16: <form action="" method="post" class="xform wizard-body"> 17: (% class="hidden" %) 18: ((( 19: <input type="hidden" name="form_token" value="$services.csrf.getToken()"/> 20: ))) 21: ; <label for="appName">$msg.get('platform.appwithinminutes.appNameLabel')</label> 22: (% class="xHint" %)$msg.get('platform.appwithinminutes.appNameHint') 23: : <input type="text" id="appName" name="appName" /> 24: #appWizardFooter(1) 25: </form> 26: {{/html}} 27: #end 28: 29: #macro(processStep) 30: #set($classRef = $services.model.createDocumentReference($doc.wiki, $request.appName, "#toXMLName($request.appName)Class")) 31: #set($queryString = 'wizard=true') 32: #if(!$xwiki.exists($classRef)) 33: #set($classTitle = "$request.appName Class") 34: #set($queryString = "$queryString&editor=inline&template=AppWithinMinutes.ClassTemplate&parent=WebHome&title=$escapetool.url($classTitle)") 35: #end 36: $response.sendRedirect($xwiki.getURL($classRef, 'edit', $queryString)) 37: #end 38: 39: #macro(validateAppName $appName) 40: #set($className = "#toXMLName($appName)") 41: #if($className == '') 42: (% class="xErrorMsg" %)$msg.get('platform.appwithinminutes.appNameInvalidClassNameError') 43: #end 44: #set($appHomeRef = $services.model.createDocumentReference($doc.wiki, $appName, 'WebHome')) 45: #set($appHomeURL = $xwiki.getDocument($appHomeRef).getExternalURL()) 46: ; $msg.get('platform.appwithinminutes.appNamePreviewHomePageUrlLabel') 47: : {{{$!appHomeURL.substring(0, $mathtool.sub($appHomeURL.length(), 7))}}} 48: ; $msg.get('platform.appwithinminutes.appNamePreviewDataSpaceLabel') 49: : {{{$doc.wiki}}} » {{{$appName}}} 50: ; $msg.get('platform.appwithinminutes.appNamePreviewClassReferenceLabel') 51: : {{{$doc.wiki}}} » {{{$appName}}} » {{{$!{className}Class}}} 52: #set($appClassRef = $services.model.createDocumentReference($doc.wiki, $appName, "$!{className}Class")) 53: #if($xwiki.exists($appHomeRef) || $xwiki.exists($appClassRef)) 54: 55: {{warning}}$msg.get('platform.appwithinminutes.appNameIsUsedWarning'){{/warning}} 56: #end 57: #end 58: {{/velocity}} 59: 60: {{velocity}} 61: #if("$!request.appName" != '') 62: #if($context.action == 'get') 63: #validateAppName($request.appName) 64: #elseif($services.csrf.isTokenValid($request.form_token)) 65: #processStep() 66: #else 67: $response.sendRedirect($services.csrf.getResubmissionURL()); 68: #end 69: #else 70: #showStep() 71: #end 72: {{/velocity}}