Changes for page Create Application

Last modified by Ludovic Dubost on 2024/07/22 15:51

From version 1.1
edited by Ludovic Dubost
on 2014/03/30 19:43
Change comment: Imported from XAR
To version 4.1
edited by Ludovic Dubost
on 2015/09/01 11:46
Change comment: Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui-7.1]

Summary

Details

Page properties
Content
... ... @@ -1,4 +1,4 @@
1 -{{include document="AppWithinMinutes.WizardStep"/}}
1 +{{include reference="AppWithinMinutes.WizardStep"/}}
2 2  
3 3  {{velocity output="false"}}
4 4  #macro(showStep)
... ... @@ -13,7 +13,7 @@
13 13   (% class="description" %)$services.localization.render("platform.appwithinminutes.wizardStep${index}Description")
14 14   #end
15 15   )))
16 - <form action="" method="post" class="xform wizard-body">
16 + <form action="$doc.getURL()" method="post" class="xform wizard-body">
17 17   ; <label for="appName">$services.localization.render('platform.appwithinminutes.appNameLabel')</label>
18 18   (% class="xHint" %)$services.localization.render('platform.appwithinminutes.appNameHint')
19 19   : <input type="text" id="appName" name="appName" />
... ... @@ -33,7 +33,8 @@
33 33  
34 34  #macro(processStep)
35 35   ## Check if the application already exists.
36 - #getAppDescriptor($request.appName)
36 + #set($appName = $request.appName)
37 + #getAppDescriptor($appName)
37 37   #if($appDescriptor)
38 38   ## Edit an existing application. Use the configured class name.
39 39   #set($classStringRef = $appDescriptor.getObject($appDescriptorClassName).getProperty('class').value)
... ... @@ -41,12 +41,15 @@
41 41   #set($classRef = $services.model.resolveDocument($classStringRef, 'explicit', $appDescriptor.documentReference))
42 42   #else
43 43   ## Create a new application. Use the default class name.
44 - #set($classRef = $services.model.createDocumentReference($doc.wiki, $request.appName, "#toXMLName($request.appName)Class"))
45 + #set($className = "#toXMLName($appName)")
46 + #set($classRef = $services.model.createDocumentReference($doc.wiki, "${className}Code", "${className}Class"))
45 45   #end
46 46   #set($queryString = 'wizard=true')
47 47   #if(!$xwiki.exists($classRef))
48 - #set($classTitle = "$request.appName Class")
49 - #set($queryString = "$queryString&editor=inline&template=AppWithinMinutes.ClassTemplate&parent=WebHome&title=$escapetool.url($classTitle)")
50 + #set($classTitle = "$appName Class")
51 + #set($appHomeRef = $services.model.createDocumentReference($doc.wiki, $appName, 'WebHome'))
52 + #set($classParent = $services.model.serialize($appHomeRef))
53 + #set($queryString = "$queryString&editor=inline&template=AppWithinMinutes.ClassTemplate&parent=$escapetool.url($classParent)&title=$escapetool.url($classTitle)&AppWithinMinutes.MetadataClass_0_dataSpaceName=$escapetool.url($appName)")
50 50   #end
51 51   $response.sendRedirect($xwiki.getURL($classRef, 'edit', $queryString))
52 52  #end
... ... @@ -66,13 +66,15 @@
66 66   (% class="xErrorMsg" %)$services.localization.render('platform.appwithinminutes.appNameInvalidClassNameError')
67 67   #end
68 68   #set($appHomeRef = $services.model.createDocumentReference($doc.wiki, $appName, 'WebHome'))
69 - #set($appClassRef = $services.model.createDocumentReference($doc.wiki, $appName, "$!{className}Class"))
73 + #set($appClassRef = $services.model.createDocumentReference($doc.wiki, "$!{className}Code", "$!{className}Class"))
70 70   #end
71 71   #set($appHomeURL = $stringtool.removeEnd($xwiki.getDocument($appHomeRef).getExternalURL(), 'WebHome'))
72 72   ; $services.localization.render('platform.appwithinminutes.appNamePreviewHomePageUrlLabel')
73 73   : {{{$!appHomeURL}}}
74 74   ; $services.localization.render('platform.appwithinminutes.appNamePreviewDataSpaceLabel')
75 - : {{{$doc.wiki}}} » {{{$appName}}}
79 + : {{{$appHomeRef.wikiReference.name}}} » {{{$appHomeRef.lastSpaceReference.name}}}
80 + ; $services.localization.render('platform.appwithinminutes.appNamePreviewCodeSpaceLabel')
81 + : {{{$appClassRef.wikiReference.name}}} » {{{$appClassRef.lastSpaceReference.name}}}
76 76   ; $services.localization.render('platform.appwithinminutes.appNamePreviewClassReferenceLabel')
77 77   : {{{$appClassRef.wikiReference.name}}} » {{{$appClassRef.lastSpaceReference.name}}} » {{{$appClassRef.name}}}
78 78   #if($appDescriptor || $xwiki.exists($appHomeRef) || $xwiki.exists($appClassRef))
... ... @@ -93,4 +93,5 @@
93 93  #else
94 94   #showStep()
95 95  #end
102 +#set($docextras=[])
96 96  {{/velocity}}