Changes for page Get in Touch About Your XWiki Project
Last modified by Alex Cotiuga on 2026/07/27 06:09
From version 18.12
edited by Alex Cotiuga
on 2026/07/09 20:06
on 2026/07/09 20:06
Change comment:
There is no comment for this version
To version 18.20
edited by Alex Cotiuga
on 2026/07/09 20:32
on 2026/07/09 20:32
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,17 @@ 121 121 122 122 ## Save only known ContactRequest fields. 123 123 #foreach ($parameterName in $request.parameterNames) 125 + $parameterName 126 + #if ($parameterName == 'sourcePage') 127 + #set ($sourcePage = $stringtool.trim($request.get($parameterName))) 128 + #set ($discard = $contactRequestObj.set('Agnease.Code.ContactRequest.ContactRequestClass_0_sourcePage', $stringtool.trim($request.get($parameterName)))) 129 + #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))) 135 + #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,32 @@ 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 + .replace(/\//g, '.'); 24 + 25 + if (sourcePage) { 26 + sourcePageField.val(sourcePage); 27 + } 28 + } catch (e) { 29 + // Ignore invalid referrer values. 30 + } 31 + }); 32 +}); - name
-
... ... @@ -1,0 +1,1 @@ 1 +document referrer catcher - use
-
... ... @@ -1,0 +1,1 @@ 1 +currentPage