Wiki source code of $services.localization.render('platform.appwithinminutes.appNamePageTitle')
Version 9.1 by Vincent Massol on 2014/10/21
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
9.1 | 1 | {{include reference="AppWithinMinutes.WizardStep"/}} |
![]() |
1.1 | 2 | |
3 | {{velocity output="false"}} | ||
4 | #macro(showStep) | ||
5 | {{html wiki="true"}} | ||
6 | #appWizardHeader(1) | ||
7 | (% class="wizard-help" %) | ||
8 | ((( | ||
![]() |
7.1 | 9 | **$services.localization.render('platform.appwithinminutes.wizardStepHelpTitle')** $services.localization.render('platform.appwithinminutes.wizardStepHelpDescription') |
![]() |
5.1 | 10 | (% class="steps vertical" %) |
![]() |
1.1 | 11 | #foreach($index in [1, 2, 3]) |
![]() |
7.1 | 12 | * (% class="number" %)$index(%%) (% class="name" %)$services.localization.render("platform.appwithinminutes.wizardStep${index}Name")(%%) |
13 | (% class="description" %)$services.localization.render("platform.appwithinminutes.wizardStep${index}Description") | ||
![]() |
1.1 | 14 | #end |
15 | ))) | ||
16 | <form action="" method="post" class="xform wizard-body"> | ||
![]() |
7.1 | 17 | ; <label for="appName">$services.localization.render('platform.appwithinminutes.appNameLabel')</label> |
18 | (% class="xHint" %)$services.localization.render('platform.appwithinminutes.appNameHint') | ||
![]() |
1.1 | 19 | : <input type="text" id="appName" name="appName" /> |
20 | #appWizardFooter(1) | ||
21 | </form> | ||
22 | {{/html}} | ||
23 | #end | ||
24 | |||
![]() |
5.1 | 25 | #macro(getAppDescriptor $appName) |
26 | #set($appDescriptorClassName = 'AppWithinMinutes.LiveTableClass') | ||
27 | #set($appDescriptorStatement = "from doc.object($appDescriptorClassName) as obj where doc.space = :space") | ||
28 | #set($appDescriptors = $services.query.xwql($appDescriptorStatement).bindValue('space', $appName).execute()) | ||
29 | #if($appDescriptors.size() > 0) | ||
30 | #set($appDescriptor = $xwiki.getDocument($appDescriptors.get(0))) | ||
31 | #end | ||
32 | #end | ||
33 | |||
![]() |
1.1 | 34 | #macro(processStep) |
![]() |
5.1 | 35 | ## Check if the application already exists. |
36 | #getAppDescriptor($request.appName) | ||
37 | #if($appDescriptor) | ||
38 | ## Edit an existing application. Use the configured class name. | ||
39 | #set($classStringRef = $appDescriptor.getObject($appDescriptorClassName).getProperty('class').value) | ||
40 | ## The class string reference is relative to the document holding the application descriptor. | ||
41 | #set($classRef = $services.model.resolveDocument($classStringRef, 'explicit', $appDescriptor.documentReference)) | ||
42 | #else | ||
43 | ## Create a new application. Use the default class name. | ||
![]() |
9.1 | 44 | #set($classRef = $services.model.createDocumentReference($doc.wiki, "${request.appName}Code", "#toXMLName($request.appName)Class")) |
![]() |
5.1 | 45 | #end |
![]() |
1.1 | 46 | #set($queryString = 'wizard=true') |
47 | #if(!$xwiki.exists($classRef)) | ||
48 | #set($classTitle = "$request.appName Class") | ||
![]() |
9.1 | 49 | #set($queryString = "$queryString&editor=inline&template=AppWithinMinutes.ClassTemplate&parent=${request.appName}.WebHome&title=$escapetool.url($classTitle)") |
![]() |
1.1 | 50 | #end |
51 | $response.sendRedirect($xwiki.getURL($classRef, 'edit', $queryString)) | ||
52 | #end | ||
53 | |||
54 | #macro(validateAppName $appName) | ||
![]() |
5.1 | 55 | #getAppDescriptor("$!appName") |
56 | #if($appDescriptor) | ||
57 | ## Edit an existing application. | ||
58 | #set($appHomeRef = $appDescriptor.documentReference) | ||
59 | #set($classStringRef = $appDescriptor.getObject($appDescriptorClassName).getProperty('class').value) | ||
60 | ## The class string reference is relative to the document holding the application descriptor. | ||
61 | #set($appClassRef = $services.model.resolveDocument($classStringRef, 'explicit', $appDescriptor.documentReference)) | ||
62 | #else | ||
63 | ## Create a new application. | ||
64 | #set($className = "#toXMLName($appName)") | ||
65 | #if($className == '') | ||
![]() |
7.1 | 66 | (% class="xErrorMsg" %)$services.localization.render('platform.appwithinminutes.appNameInvalidClassNameError') |
![]() |
5.1 | 67 | #end |
68 | #set($appHomeRef = $services.model.createDocumentReference($doc.wiki, $appName, 'WebHome')) | ||
![]() |
9.1 | 69 | #set($appClassRef = $services.model.createDocumentReference($doc.wiki, "$!{appName}Code", "$!{className}Class")) |
![]() |
1.1 | 70 | #end |
![]() |
6.1 | 71 | #set($appHomeURL = $stringtool.removeEnd($xwiki.getDocument($appHomeRef).getExternalURL(), 'WebHome')) |
![]() |
7.1 | 72 | ; $services.localization.render('platform.appwithinminutes.appNamePreviewHomePageUrlLabel') |
![]() |
5.1 | 73 | : {{{$!appHomeURL}}} |
![]() |
7.1 | 74 | ; $services.localization.render('platform.appwithinminutes.appNamePreviewDataSpaceLabel') |
![]() |
1.1 | 75 | : {{{$doc.wiki}}} » {{{$appName}}} |
![]() |
9.1 | 76 | ; $services.localization.render('platform.appwithinminutes.appNamePreviewCodeSpaceLabel') |
77 | : {{{$doc.wiki}}} » {{{${appName}Code}}} | ||
![]() |
7.1 | 78 | ; $services.localization.render('platform.appwithinminutes.appNamePreviewClassReferenceLabel') |
![]() |
5.1 | 79 | : {{{$appClassRef.wikiReference.name}}} » {{{$appClassRef.lastSpaceReference.name}}} » {{{$appClassRef.name}}} |
80 | #if($appDescriptor || $xwiki.exists($appHomeRef) || $xwiki.exists($appClassRef)) | ||
![]() |
1.1 | 81 | |
![]() |
7.1 | 82 | {{warning}}$services.localization.render('platform.appwithinminutes.appNameIsUsedWarning'){{/warning}} |
![]() |
1.1 | 83 | #end |
84 | #end | ||
85 | {{/velocity}} | ||
86 | |||
87 | {{velocity}} | ||
88 | #if("$!request.appName" != '') | ||
![]() |
8.1 | 89 | #if($xcontext.action == 'get') |
![]() |
1.1 | 90 | #validateAppName($request.appName) |
![]() |
5.1 | 91 | #else |
92 | ## CSRF protection is not needed because this step only redirects to the next one passing data in the query string. | ||
![]() |
1.1 | 93 | #processStep() |
94 | #end | ||
95 | #else | ||
96 | #showStep() | ||
97 | #end | ||
98 | {{/velocity}} |