Toggle navigation
Log-in
Home
Page Index
User Index
Application Index
Global
Wiki Index
App Within Minutes
Create Application
Wiki source code of
Create Application
Last modified by eaminov on 2016/12/16 00:06
Manage
Copy
Actions
Export
Print preview
View Source
Viewers
Siblings
Content
Comments
Attachments
History
Information
×
Export
Office Formats
Export as PDF
Other Formats
Export as HTML
Show line numbers
{{include reference="AppWithinMinutes.WizardStep"/}} {{template name="locationPicker_macros.vm" /}} {{velocity output="false"}} #macro(showStep) {{html wiki="true"}} #appWizardHeader('name') (% class="wizard-help" %) ((( **$services.localization.render('platform.appwithinminutes.wizardStepHelpTitle')** $services.localization.render('platform.appwithinminutes.wizardStepHelpDescription') (% class="steps vertical" %) #foreach($step in $awmSteps) * (% class="number" %)$mathtool.add($foreach.index, 1)(%%) (% class="name" %)$services.localization.render("appWithinMinutes.wizardStep.${step}.name")(%%) (% class="description" %)$services.localization.render("appWithinMinutes.wizardStep.${step}.description") #end ))) <form action="$doc.getURL()" method="post" class="xform wizard-body"> #locationPicker({ 'id': 'app', 'title': { 'label': 'platform.appwithinminutes.appNameLabel', 'hint': 'platform.appwithinminutes.appNameHint', 'name': 'appName' }, 'preview': { 'label': 'appWithinMinutes.createApp.location.label', 'hint': 'appWithinMinutes.createApp.location.hint' }, 'parent': { 'label': 'appWithinMinutes.createApp.parent.label', 'hint': 'appWithinMinutes.createApp.parent.hint', 'name': 'appParentReference', 'reference': $doc.documentReference.wikiReference, 'placeholder': 'appWithinMinutes.createApp.parent.placeholder' } }) <div class="appName-preview"></div> #appWizardFooter(1) </form> {{/html}} #end #macro (processStep) ## Check if the application already exists. #getAppReference #getAppDescriptor($appReference) #if ($appDescriptor) ## Edit an existing application. Use the configured class name. #set ($appClassRef = $appDescriptor.getObject($appDescriptorClassName).getValue('class')) ## The class reference is relative to the document holding the application descriptor. #set ($appClassRef = $services.model.resolveDocument($appClassRef, 'explicit', $appDescriptor.documentReference)) #else ## Create a new application. Use the default class name. #set ($appCodeRef = $services.model.createSpaceReference('Code', $appReference)) #set ($appClassRef = $services.model.createDocumentReference("$!{appReference.name}Class", $appCodeRef)) #end #set ($queryString = {'wizard': true}) #if (!$xwiki.exists($appClassRef)) #set ($appHomeRef = $services.model.resolveDocument('', 'default', $appReference)) #set ($discard = $queryString.putAll({ 'template': 'AppWithinMinutes.ClassTemplate', 'parent': $services.model.serialize($appHomeRef), 'title': "$appReference.name Class" })) #end $response.sendRedirect($xwiki.getURL($appClassRef, 'edit', $escapetool.url($queryString))) #end #macro (validateAppName) #getAppReference #if (!$appReference) (% class="xErrorMsg" %)$services.localization.render('platform.appwithinminutes.appNameEmptyError') #else #getAppDescriptor($appReference) #if ($appDescriptor) ## Edit an existing application. #set ($appDescriptorObj = $appDescriptor.getObject($appDescriptorClassName)) #set ($appClassRef = $appDescriptorObj.getValue('class')) ## The class reference is relative to the document holding the application descriptor. #set ($appClassRef = $services.model.resolveDocument($appClassRef, 'explicit', $appDescriptor.documentReference)) #else ## Create a new application. #set ($appCodeRef = $services.model.createSpaceReference('Code', $appReference)) #set ($appClassRef = $services.model.createDocumentReference("$!{appReference.name}Class", $appCodeRef)) #end ; $services.localization.render('platform.appwithinminutes.appNamePreviewHomePageUrlLabel') : {{{$!xwiki.getDocument($appReference).externalURL}}} ; $services.localization.render('platform.appwithinminutes.appNamePreviewCodeSpaceLabel') : {{html clean="false"}}#hierarchy($appClassRef.parent){{/html}} #set ($appHomeRef = $services.model.resolveDocument('', 'default', $appReference)) #if ($appDescriptor || $xwiki.exists($appHomeRef) || $xwiki.exists($appClassRef)) {{warning}}$services.localization.render('platform.appwithinminutes.appNameIsUsedWarning'){{/warning}} #end #end #end #macro (getAppReference) #if ($request.resolve == 'true') #set ($appReference = $services.model.resolveSpace($request.appName)) #elseif ("$!request.appName" != '') #set ($parentReference = $doc.documentReference.wikiReference) #if ("$!request.appParentReference" != '') #set ($parentReference = $services.model.resolveSpace($request.appParentReference)) #end #set ($appReference = $services.model.createSpaceReference($request.appName, $parentReference)) #else #set ($appReference = $NULL) #end #end #macro (getAppDescriptor $appReference) #set ($appDescriptorClassName = 'AppWithinMinutes.LiveTableClass') #set ($appDescriptorStatement = "from doc.object($appDescriptorClassName) as obj where doc.space = :space") #set ($localSpaceReference = $services.model.serialize($appReference, 'local')) #set ($appDescriptors = $services.query.xwql($appDescriptorStatement).bindValue('space', $localSpaceReference).execute()) #if ($appDescriptors.size() > 0) #set ($appDescriptor = $xwiki.getDocument($appDescriptors.get(0))) #end #end {{/velocity}} {{velocity}} #if ("$!request.appName" != '') #if ($xcontext.action == 'get') #validateAppName #else ## CSRF protection is not needed because this step only redirects to the next one passing data in the query string. #processStep #end #else #showStep #end #set ($displayDocExtra = false) {{/velocity}}
Applications
Blog
Dashboard
Help
More applications
Navigation