Wiki source code of AddTest
Last modified by Ilie Andriuta on 2023/07/06 11:30
Hide last authors
author | version | line-number | content |
---|---|---|---|
1.1 | 1 | {{velocity}} | |
2 | #if(("$!request.testName" != '') && ("$!request.spaceName" != '')) | ||
3 | #set($targetDocReference = $services.model.createDocumentReference($xcontext.getDatabase(), "${request.spaceName}", "${request.testName}")) | ||
4 | #set($parentDocReference = $services.model.createDocumentReference($xcontext.getDatabase(), "${request.spaceName}", 'WebHome')) | ||
5 | ## If the target space has no WebHome, we create one using the Template | ||
6 | #if (!$xwiki.exists($parentDocReference)) | ||
7 | #set($testSpaceWebHomeTemplateReference = $services.model.createDocumentReference($xcontext.getDatabase(), 'QA', 'TestSpaceWebHomeTemplate')) | ||
8 | #set($document = $xwiki.getDocument($parentDocReference)) | ||
9 | #set($discard = $document.setTitle(${request.spaceName})) | ||
10 | #set($discard = $document.setContent('{{include reference="QA.TestSpaceWebHomeTemplate"/}}')) | ||
11 | #set($discard = $document.setParent('QA.WebHome')) | ||
12 | #set($discard = $document.save()) | ||
13 | #end | ||
14 | $response.sendRedirect($xwiki.getURL($targetDocReference, 'edit', "editor=inline&template=QA.TestTemplate&title=$escapetool.url($request.testName)&parent=$escapetool.url($parentDocReference)")) | ||
15 | #end | ||
16 | |||
17 | {{html wiki="true"}} | ||
18 | #set($spaceName = '') | ||
19 | #if ("$!request.spaceName" != '' || $request.spaceName == '') | ||
20 | #set($spaceName = $request.spaceName) | ||
21 | #end | ||
22 | <form action="" class="xform third" id="addTestForm"> | ||
23 | ((( | ||
24 | ; <label for="testName">$services.localization.render('qaapp.AddTest.testName.label')</label> | ||
25 | : <input type="text" id="testName" name="testName"/> | ||
26 | ; <label for="spaceName">$services.localization.render('qaapp.AddTest.testSpace.label')</label> | ||
27 | : <input id="spaceName" class="suggestSpaces" type="text" value="${spaceName}" id="spaceName" name="spaceName" autocomplete="off"> | ||
28 | |||
29 | <div class="xform buttons"> | ||
30 | <span class="buttonwrapper"><input type="submit" value="$services.localization.render('qaapp.AddTest.button')" class="button"/></span> | ||
31 | </div> | ||
32 | ))) | ||
33 | </form> | ||
34 | {{/html}} | ||
35 | {{/velocity}} |