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