Changes for page Import-Test-App-01
Last modified by Ophion Admin on 2026/10/06 14:27
To version 7.1
edited by Ophion Admin
on 2026/10/06 14:27
on 2026/10/06 14:27
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,4 +1,59 @@ 1 1 {{velocity}} 2 +#set ($appSpace = 'Import-Test-App-01') 3 +#set ($templateRef = 'Import-Test-App-01.Code.Import-Test-App-01Template') 4 +## Allowed values for the first part of the page name 5 +#set ($prefixes = ['variable-1', 'variable-2', 'variable-3']) 6 +#set ($errorMsg = '') 7 +#if ("$!request.createEntry" == '1') 8 + #set ($prefix = "$!request.prefix") 9 + #set ($suffix = "$!request.suffix") 10 + #if (!$prefixes.contains($prefix)) 11 + #set ($errorMsg = 'Invalid prefix.') 12 + #elseif (!$suffix.matches('[a-z0-9_-]+')) 13 + #set ($errorMsg = 'Only lowercase letters, digits, hyphen and underscore are allowed.') 14 + #else 15 + #set ($baseName = "${prefix}-${suffix}") 16 + #set ($name = $baseName) 17 + #set ($ref = $services.model.createDocumentReference('', [$appSpace, $name], 'WebHome')) 18 + ## Append a running number until the page name is free: name-1, name-2, ... 19 + #foreach ($i in [1..999]) 20 + #if (!$xwiki.exists($ref)) 21 + #break 22 + #end 23 + #set ($name = "${baseName}-${i}") 24 + #set ($ref = $services.model.createDocumentReference('', [$appSpace, $name], 'WebHome')) 25 + #end 26 + #if ($xwiki.exists($ref)) 27 + #set ($errorMsg = "No free page name found for '${baseName}'.") 28 + #else 29 + #set ($qs = $escapetool.url({'template': $templateRef, 'parent': "${appSpace}.WebHome", 'title': $name})) 30 + $response.sendRedirect($xwiki.getURL($ref, 'edit', $qs)) 31 + #end 32 + #end 33 +#end 34 +#if ($errorMsg != '') 35 + {{error}}$errorMsg{{/error}} 36 +#end 37 +{{html clean="false"}} 38 +<style> 39 + /* Hide the default AWM "Add new entry" button */ 40 + ul.actions a.action.add, a.action.add { display: none !important; } 41 +</style> 42 +<form action="$doc.getURL()" method="get" class="form-inline"> 43 + <input type="hidden" name="createEntry" value="1"/> 44 + <select name="prefix" class="form-control"> 45 + #foreach ($p in $prefixes) 46 + <option value="$p">$p</option> 47 + #end 48 + </select> 49 + - 50 + <input type="text" name="suffix" class="form-control" required="required" 51 + pattern="[a-z0-9_-]+" title="Lowercase letters, digits, - and _ only"/> 52 + <input type="submit" class="btn btn-primary" value="Create entry"/> 53 +</form> 54 +{{/html}} 55 +{{/velocity}} 56 +{{velocity}} 2 2 #set ($columnsProperties = { 3 3 'doc.title': {"link":"view"}, 4 4 'doc.location': {"html":true},
- XWiki.UIExtensionClass[0]
-
- Extension ID
-
... ... @@ -1,0 +1,1 @@ 1 +platform.panels.Import-Test-App-01Application - Extension Parameters
-
... ... @@ -1,0 +1,3 @@ 1 +label=Import-Test-App-01 2 +target=Import-Test-App-01.WebHome 3 +icon=icon:application