Wiki source code of Get in Touch About Your XWiki Project
Version 18.21 by Alex Cotiuga on 2026/07/09 20:32
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
13.108 | 1 | {{velocity wiki="false"}} |
| 2 | #if ($xcontext.action == 'get') | ||
| |
16.12 | 3 | #set ($statusCode = 400) |
| 4 | #set ($message = 'The request could not be sent. Please try again or contact Agnease by email at alex@agnease.com.') | ||
| |
13.189 | 5 | |
| |
16.57 | 6 | #set ($className = 'Agnease.Code.ContactRequest.ContactRequestClass') |
| 7 | #set ($allowedProperties = [ | ||
| 8 | 'scope', | ||
| 9 | 'alreadyUseXWiki', | ||
| 10 | 'name', | ||
| 11 | 'email', | ||
| 12 | 'hosting', | ||
| 13 | 'customDevelopment', | ||
| 14 | 'timeline', | ||
| |
18.6 | 15 | 'users', |
| 16 | 'sourcePage' | ||
| |
16.57 | 17 | ]) |
| 18 | |||
| |
16.12 | 19 | #set ($name = '') |
| 20 | #set ($email = '') | ||
| |
16.51 | 21 | #set ($scope = '') |
| |
16.26 | 22 | #set ($contactWebsite = '') |
| |
16.45 | 23 | #set ($startedAtRaw = '') |
| |
18.14 | 24 | #set ($sourcePage = '') |
| |
13.168 | 25 | |
| |
16.57 | 26 | ## Extract only the values we need for validation. |
| |
13.150 | 27 | #foreach ($parameterName in $request.parameterNames) |
| |
16.36 | 28 | #set ($propertyParts = $parameterName.split('_0_')) |
| |
16.38 | 29 | #if ($propertyParts.size() > 1) |
| |
16.57 | 30 | #set ($propertyName = $propertyParts[1]) |
| 31 | #set ($propertyValue = $stringtool.trim($request.get($parameterName))) | ||
| 32 | |||
| |
16.36 | 33 | #if ($propertyName == 'name') |
| |
16.57 | 34 | #set ($name = $propertyValue) |
| |
16.36 | 35 | #elseif ($propertyName == 'email') |
| |
16.57 | 36 | #set ($email = $propertyValue) |
| |
16.51 | 37 | #elseif ($propertyName == 'scope') |
| |
16.57 | 38 | #set ($scope = $propertyValue) |
| |
16.36 | 39 | #elseif ($propertyName == 'contactWebsite') |
| |
16.57 | 40 | #set ($contactWebsite = $propertyValue) |
| |
16.42 | 41 | #elseif ($propertyName == 'contactStartedAt') |
| |
16.57 | 42 | #set ($startedAtRaw = $propertyValue) |
| |
16.36 | 43 | #end |
| |
16.12 | 44 | #end |
| |
13.150 | 45 | #end |
| |
13.170 | 46 | |
| |
16.57 | 47 | #set ($spamScore = 0) |
| 48 | |||
| 49 | ## Honeypot: real users should never fill this field. | ||
| 50 | #if ("$!contactWebsite" != '') | ||
| 51 | #set ($spamScore = $spamScore + 5) | ||
| 52 | #end | ||
| 53 | |||
| 54 | ## Submission timing check. | ||
| 55 | #if ("$!startedAtRaw" == '') | ||
| 56 | ## The field is expected from the real form, so missing it is suspicious. | ||
| 57 | #set ($spamScore = $spamScore + 2) | ||
| 58 | #else | ||
| |
16.46 | 59 | #set ($startedAt = $numbertool.toNumber($startedAtRaw)) |
| |
16.57 | 60 | #if ("$!startedAt" == '') |
| 61 | #set ($spamScore = $spamScore + 2) | ||
| 62 | #else | ||
| 63 | #set ($now = $datetool.systemDate.time) | ||
| 64 | #set ($elapsed = $now - $startedAt) | ||
| |
16.46 | 65 | |
| |
16.57 | 66 | ## Reject very fast submissions. |
| 67 | #if ($elapsed > 0 && $elapsed < 10000) | ||
| 68 | #set ($spamScore = $spamScore + 3) | ||
| 69 | #end | ||
| |
16.46 | 70 | #end |
| |
16.57 | 71 | #end |
| 72 | |||
| 73 | ## Random-looking name: long single token. | ||
| 74 | #if ($name.length() >= 16 && !$name.contains(' ')) | ||
| 75 | #set ($spamScore = $spamScore + 2) | ||
| 76 | #end | ||
| 77 | |||
| 78 | ## Random-looking project description: long single token. | ||
| 79 | #if ($scope.length() >= 12 && !$scope.contains(' ')) | ||
| 80 | #set ($spamScore = $spamScore + 2) | ||
| 81 | #end | ||
| 82 | |||
| 83 | ## Suspicious email local part with many dots and tiny fragments. | ||
| 84 | #set ($emailParts = $email.split('@')) | ||
| 85 | #if ($emailParts.size() == 2) | ||
| 86 | #set ($localPart = $emailParts[0]) | ||
| 87 | #set ($localFragments = $localPart.split('\.')) | ||
| 88 | #set ($dotCount = $localFragments.size() - 1) | ||
| 89 | #set ($oneCharFragments = 0) | ||
| 90 | |||
| 91 | #foreach ($fragment in $localFragments) | ||
| 92 | #if ($fragment.length() == 1) | ||
| 93 | #set ($oneCharFragments = $oneCharFragments + 1) | ||
| 94 | #end | ||
| 95 | #end | ||
| 96 | |||
| 97 | #if ($dotCount >= 4 && $oneCharFragments >= 3) | ||
| 98 | #set ($spamScore = $spamScore + 2) | ||
| 99 | #end | ||
| 100 | #else | ||
| 101 | #set ($spamScore = $spamScore + 2) | ||
| 102 | #end | ||
| 103 | |||
| 104 | ## Human-facing validation. | ||
| 105 | #if ("$!name" == '' && "$!email" == '') | ||
| |
16.12 | 106 | #set ($message = 'Please enter your name and email.') |
| 107 | #elseif ("$!name" == '') | ||
| 108 | #set ($message = 'Please enter your name.') | ||
| 109 | #elseif ("$!email" == '') | ||
| 110 | #set ($message = 'Please enter your email address.') | ||
| |
16.51 | 111 | #elseif ("$!scope" == '' || $scope.length() < 30) |
| 112 | #set ($message = 'Please add a short description of your XWiki project, question or issue.') | ||
| |
16.57 | 113 | #elseif ($spamScore >= 3) |
| 114 | #set ($message = 'The request could not be sent. Please add a clearer description of your XWiki request or contact Agnease by email.') | ||
| |
16.12 | 115 | #else |
| 116 | #try('contactException') | ||
| 117 | #set ($now = $datetool.get('yyyyMMddHHmm')) | ||
| 118 | #set ($random = $mathtool.random(100000, 999999)) | ||
| 119 | #set ($uniqueName = "ContactRequest-${now}-${random}") | ||
| 120 | #set ($contactRequestDoc = $xwiki.getDocumentAsAuthor('ContactRequests.' + $uniqueName)) | ||
| |
16.57 | 121 | #set ($contactRequestObj = $contactRequestDoc.getObject($className, true)) |
| |
15.26 | 122 | |
| |
16.57 | 123 | ## Save only known ContactRequest fields. |
| |
16.12 | 124 | #foreach ($parameterName in $request.parameterNames) |
| |
18.21 | 125 | $parameterName - $stringtool.trim($request.get($parameterName)) |
| |
18.14 | 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 | ||
| |
16.57 | 130 | #set ($propertyParts = $parameterName.split('_0_')) |
| 131 | #if ($propertyParts.size() > 1) | ||
| 132 | #set ($propertyName = $propertyParts[1]) | ||
| 133 | |||
| 134 | #if ($allowedProperties.contains($propertyName)) | ||
| |
18.14 | 135 | #set ($discard = $contactRequestObj.set($propertyName, $stringtool.trim($request.get($parameterName)))) |
| |
16.57 | 136 | #end |
| |
16.54 | 137 | #end |
| |
16.12 | 138 | #end |
| |
13.108 | 139 | |
| |
16.12 | 140 | #set ($discard = $contactRequestDoc.saveAsAuthor()) |
| 141 | #set ($statusCode = 200) | ||
| 142 | #set ($message = 'Your request was successfully sent.') | ||
| 143 | #end | ||
| |
13.108 | 144 | |
| |
16.12 | 145 | #if ("$!contactException" != '') |
| 146 | #set ($statusCode = 400) | ||
| 147 | #set ($message = 'The request could not be sent. Please try again or contact Agnease by email.') | ||
| 148 | #end | ||
| 149 | #end | ||
| 150 | |||
| |
13.108 | 151 | #set ($discard = $response.setStatus($statusCode)) |
| |
13.151 | 152 | #jsonResponse({'message': $message}) |
| |
13.108 | 153 | #end |
| 154 | {{/velocity}} | ||
| 155 | |||
| |
2.6 | 156 | {{velocity}} |
| |
13.3 | 157 | #set ($discard = $xwiki.ssx.use('contact.WebHome')) |
| |
14.5 | 158 | #set ($xobject = $doc.getObject('Agnease.Code.ContactRequest.ContactRequestClass')) |
| |
15.26 | 159 | #set ($totalRequests = $services.query.xwql('from doc.object(Agnease.Code.ContactRequest.ContactRequestClass) contact').execute()) |
| |
15.34 | 160 | #set ($xclass = $xobject.xWikiClass) |
| 161 | #set ($editing = true) | ||
| 162 | = Tell Us More About Your Project = | ||
| 163 | You do not need to have a full specification. A short description is enough to start the conversation. | ||
| |
16.8 | 164 | {{html clean="false"}} |
| |
16.11 | 165 | You can also <a href="https://calendly.com/alex-agnease/30min?back=1&month=2026-06" target="_blank">book a free XWiki review call</a> to discuss your current setup. |
| |
15.34 | 166 | <div class="row"> |
| 167 | <div class="xform col-md-7"> | ||
| |
15.37 | 168 | #if ($totalRequests.size() > 50) |
| |
15.34 | 169 | ## As a measure to avoid high load on website. |
| |
15.35 | 170 | Tell us more about your project at <a href="mailto:alex@agnease.com">alex@agnease.com</a> |
| |
15.34 | 171 | #else |
| |
18.7 | 172 | #set ($hiddenProperties = ['sourcePage']) |
| |
15.30 | 173 | <form id="contactForm"> |
| 174 | <dl> | ||
| 175 | #foreach ($property in $xclass.properties) | ||
| |
18.8 | 176 | #set ($hiddenPropertiesCSS = '') |
| |
18.7 | 177 | #if ($hiddenProperties.contains($property.name)) |
| |
18.8 | 178 | #set ($hiddenPropertiesCSS = 'class="hidden"') |
| |
18.7 | 179 | #end |
| |
15.30 | 180 | #if ($property.name == 'hosting') |
| 181 | <hr> | ||
| 182 | <h3>Optional project details</h3> | ||
| 183 | <p>These details help us understand the scope and suggest practical next steps.</p> | ||
| 184 | #end | ||
| |
18.8 | 185 | <dt $hiddenPropertiesCSS #if (!$editing && $hasEdit) |
| |
18.7 | 186 | class="editableProperty" |
| 187 | #set ($xobjectPropertyReference = $xobject.getPropertyReference($property.name)) | ||
| 188 | data-property="$escapetool.xml($services.model.serialize($xobjectPropertyReference))" | ||
| 189 | data-property-type="object"#end> | ||
| 190 | ## This must match the id generated by the $doc.display() method below. | ||
| 191 | #set ($propertyId = "${xclass.name}_${xobject.number}_$property.name") | ||
| 192 | <label#if ($editing) for="$escapetool.xml($propertyId)"#end> | ||
| 193 | $escapetool.xml($property.translatedPrettyName) | ||
| 194 | </label> | ||
| 195 | ## Support for specifying a translation key as hint in the property definition. | ||
| 196 | <span class="xHint">$!escapetool.xml($services.localization.render($property.hint))</span> | ||
| 197 | </dt> | ||
| |
18.9 | 198 | <dd $hiddenPropertiesCSS>$doc.display($property.name, 'edit').replace('{{html clean="false" wiki="false"}}', '').replace("{{/html}}", '')</dd> |
| |
13.47 | 199 | #end |
| |
15.30 | 200 | #if (!$xclass.properties || $xclass.properties.size() == 0) |
| 201 | ## Keep the empty definition term in order to have valid HTML. | ||
| 202 | <dt></dt> | ||
| |
18.9 | 203 | <dd>$escapetool.xml($services.localization.render('xclass.defaultObjectSheet.noProperties'))</dd> |
| |
15.30 | 204 | #end |
| 205 | </dl> | ||
| |
16.6 | 206 | <p class="xHint">* Your information will only be used to respond to this request.</p> |
| |
16.16 | 207 | ## Hidden fields to catch requests filled by bots. |
| 208 | <div class="contact-hp-wrapper" aria-hidden="true"> | ||
| |
16.31 | 209 | <label for="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite">Website</label> |
| |
16.16 | 210 | <input |
| |
16.58 | 211 | id="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite" |
| |
16.16 | 212 | type="text" |
| |
16.31 | 213 | name="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite" |
| |
16.16 | 214 | autocomplete="off" |
| 215 | tabindex="-1" | ||
| 216 | /> | ||
| 217 | </div> | ||
| |
16.49 | 218 | <input type="hidden" name="Agnease.Code.ContactRequest.ContactRequestClass_0_contactStartedAt" value="$datetool.systemDate.time" /> |
| |
18.11 | 219 | <input type="hidden" name="sourcePage" value="$!{request.sourcePage}" /> |
| |
15.30 | 220 | <input id="contactSubmit" type="submit" class="btn btn-primary" value="Send my request"> |
| 221 | </form> | ||
| |
15.34 | 222 | #end |
| 223 | {{/html}} | ||
| 224 | {{html clean="false" wiki="true"}} | ||
| 225 | <div class="reviewNotifications"> | ||
| 226 | <div class="hidden reviewNotificationSuccess"> | ||
| |
13.104 | 227 | |
| |
15.34 | 228 | {{success}}reviewNotification{{/success}} |
| |
13.104 | 229 | |
| |
15.34 | 230 | </div> |
| 231 | <div class="hidden reviewNotificationError"> | ||
| |
13.104 | 232 | |
| |
15.34 | 233 | {{error}}reviewNotification{{/error}} |
| |
13.104 | 234 | |
| |
13.107 | 235 | </div> |
| |
13.104 | 236 | </div> |
| |
15.34 | 237 | {{/html}} |
| 238 | {{html clean="false"}} | ||
| 239 | </div> | ||
| |
17.2 | 240 | <div class="col-md-5 contact-side-panel"> |
| 241 | <div class="split-copy contact-help-panel"> | ||
| 242 | <h2> | ||
| 243 | <i class="fa fa-check-circle" aria-hidden="true"></i> | ||
| 244 | How Agnease can help | ||
| 245 | </h2> | ||
| 246 | |||
| |
15.34 | 247 | <ul> |
| 248 | <li>XWiki upgrades and long-term maintenance</li> | ||
| 249 | <li>Knowledge bases, intranets, SOP and documentation workflows</li> | ||
| 250 | <li>Custom XWiki applications and integrations</li> | ||
| 251 | <li>LDAP, SSO, OIDC, SAML, and MFA setup</li> | ||
| 252 | <li>Migrations from SharePoint, Confluence, MediaWiki, or file-based documentation</li> | ||
| 253 | <li>Security-aware reviews and platform stabilization</li> | ||
| 254 | </ul> | ||
| |
12.21 | 255 | </div> |
| |
17.2 | 256 | |
| 257 | <ol class="process-list contact-process-list"> | ||
| 258 | <li> | ||
| 259 | <strong>Your request is reviewed</strong> | ||
| 260 | The project description is checked to understand the context and initial scope. | ||
| 261 | </li> | ||
| 262 | <li> | ||
| 263 | <strong>You receive a reply</strong> | ||
| 264 | Agnease replies with clarifying questions or suggested next steps. | ||
| 265 | </li> | ||
| 266 | <li> | ||
| 267 | <strong>A short call can be scheduled</strong> | ||
| 268 | If useful, we discuss scope, timeline and estimated effort together. | ||
| 269 | </li> | ||
| 270 | </ol> | ||
| |
12.14 | 271 | </div> |
| |
15.34 | 272 | </div> |
| 273 | {{/html}} | ||
| |
2.6 | 274 | {{/velocity}} |