Changes for page Get in Touch About Your XWiki Project
Last modified by Alex Cotiuga on 2026/07/27 06:09
From version 18.13
edited by Alex Cotiuga
on 2026/07/09 20:07
on 2026/07/09 20:07
Change comment:
There is no comment for this version
To version 18.17
edited by Alex Cotiuga
on 2026/07/09 20:28
on 2026/07/09 20:28
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (0 modified, 1 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -21,6 +21,7 @@ 21 21 #set ($scope = '') 22 22 #set ($contactWebsite = '') 23 23 #set ($startedAtRaw = '') 24 + #set ($sourcePage = '') 24 24 25 25 ## Extract only the values we need for validation. 26 26 #foreach ($parameterName in $request.parameterNames) ... ... @@ -121,12 +121,16 @@ 121 121 122 122 ## Save only known ContactRequest fields. 123 123 #foreach ($parameterName in $request.parameterNames) 125 + #if ($parameterName == 'sourcePage') 126 + #set ($sourcePage = $stringtool.trim($request.get($parameterName))) 127 + #set ($discard = $contactRequestObj.set('Agnease.Code.ContactRequest.ContactRequestClass_0_sourcePage', $stringtool.trim($request.get($parameterName)))) 128 + #end 124 124 #set ($propertyParts = $parameterName.split('_0_')) 125 125 #if ($propertyParts.size() > 1) 126 126 #set ($propertyName = $propertyParts[1]) 127 127 128 128 #if ($allowedProperties.contains($propertyName)) 129 - #set ($discard = $contactRequestObj.set($propertyName, $request.get($parameterName))) 134 + #set ($discard = $contactRequestObj.set($propertyName, $stringtool.trim($request.get($parameterName)))) 130 130 #end 131 131 #end 132 132 #end
- XWiki.JavaScriptExtension[1]
-
- cache
-
... ... @@ -1,0 +1,1 @@ 1 +long - code
-
... ... @@ -1,0 +1,31 @@ 1 +require(['jquery'], function ($) { 2 + $(function () { 3 + var sourcePageField = $('input[name="sourcePage"]'); 4 + 5 + if (!sourcePageField.length || sourcePageField.val()) { 6 + return; 7 + } 8 + 9 + if (!document.referrer) { 10 + return; 11 + } 12 + 13 + try { 14 + var referrerUrl = new URL(document.referrer); 15 + 16 + if (referrerUrl.origin !== window.location.origin) { 17 + return; 18 + } 19 + 20 + var sourcePage = referrerUrl.pathname 21 + .replace(/^\/bin\//, '') 22 + .replace(/\/$/, ''); 23 + 24 + if (sourcePage) { 25 + sourcePageField.val(sourcePage); 26 + } 27 + } catch (e) { 28 + // Ignore invalid referrer values. 29 + } 30 + }); 31 +}); - name
-
... ... @@ -1,0 +1,1 @@ 1 +document referrer catcher - use
-
... ... @@ -1,0 +1,1 @@ 1 +currentPage