Wiki source code of Get in Touch About Your XWiki Project
Version 18.23 by Alex Cotiuga on 2026/07/09 20:39
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()) |
| 138 | #set ($statusCode = 200) | ||
| 139 | #set ($message = 'Your request was successfully sent.') | ||
| 140 | #end | ||
| |
13.108 | 141 | |
| |
16.12 | 142 | #if ("$!contactException" != '') |
| 143 | #set ($statusCode = 400) | ||
| 144 | #set ($message = 'The request could not be sent. Please try again or contact Agnease by email.') | ||
| 145 | #end | ||
| 146 | #end | ||
| 147 | |||
| |
13.108 | 148 | #set ($discard = $response.setStatus($statusCode)) |
| |
13.151 | 149 | #jsonResponse({'message': $message}) |
| |
13.108 | 150 | #end |
| 151 | {{/velocity}} | ||
| 152 | |||
| |
2.6 | 153 | {{velocity}} |
| |
13.3 | 154 | #set ($discard = $xwiki.ssx.use('contact.WebHome')) |
| |
14.5 | 155 | #set ($xobject = $doc.getObject('Agnease.Code.ContactRequest.ContactRequestClass')) |
| |
15.26 | 156 | #set ($totalRequests = $services.query.xwql('from doc.object(Agnease.Code.ContactRequest.ContactRequestClass) contact').execute()) |
| |
15.34 | 157 | #set ($xclass = $xobject.xWikiClass) |
| 158 | #set ($editing = true) | ||
| 159 | = Tell Us More About Your Project = | ||
| 160 | You do not need to have a full specification. A short description is enough to start the conversation. | ||
| |
16.8 | 161 | {{html clean="false"}} |
| |
16.11 | 162 | 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 | 163 | <div class="row"> |
| 164 | <div class="xform col-md-7"> | ||
| |
15.37 | 165 | #if ($totalRequests.size() > 50) |
| |
15.34 | 166 | ## As a measure to avoid high load on website. |
| |
15.35 | 167 | Tell us more about your project at <a href="mailto:alex@agnease.com">alex@agnease.com</a> |
| |
15.34 | 168 | #else |
| |
18.7 | 169 | #set ($hiddenProperties = ['sourcePage']) |
| |
15.30 | 170 | <form id="contactForm"> |
| 171 | <dl> | ||
| 172 | #foreach ($property in $xclass.properties) | ||
| |
18.8 | 173 | #set ($hiddenPropertiesCSS = '') |
| |
18.7 | 174 | #if ($hiddenProperties.contains($property.name)) |
| |
18.8 | 175 | #set ($hiddenPropertiesCSS = 'class="hidden"') |
| |
18.7 | 176 | #end |
| |
15.30 | 177 | #if ($property.name == 'hosting') |
| 178 | <hr> | ||
| 179 | <h3>Optional project details</h3> | ||
| 180 | <p>These details help us understand the scope and suggest practical next steps.</p> | ||
| 181 | #end | ||
| |
18.8 | 182 | <dt $hiddenPropertiesCSS #if (!$editing && $hasEdit) |
| |
18.7 | 183 | class="editableProperty" |
| 184 | #set ($xobjectPropertyReference = $xobject.getPropertyReference($property.name)) | ||
| 185 | data-property="$escapetool.xml($services.model.serialize($xobjectPropertyReference))" | ||
| 186 | data-property-type="object"#end> | ||
| 187 | ## This must match the id generated by the $doc.display() method below. | ||
| 188 | #set ($propertyId = "${xclass.name}_${xobject.number}_$property.name") | ||
| 189 | <label#if ($editing) for="$escapetool.xml($propertyId)"#end> | ||
| 190 | $escapetool.xml($property.translatedPrettyName) | ||
| 191 | </label> | ||
| 192 | ## Support for specifying a translation key as hint in the property definition. | ||
| 193 | <span class="xHint">$!escapetool.xml($services.localization.render($property.hint))</span> | ||
| 194 | </dt> | ||
| |
18.9 | 195 | <dd $hiddenPropertiesCSS>$doc.display($property.name, 'edit').replace('{{html clean="false" wiki="false"}}', '').replace("{{/html}}", '')</dd> |
| |
13.47 | 196 | #end |
| |
15.30 | 197 | #if (!$xclass.properties || $xclass.properties.size() == 0) |
| 198 | ## Keep the empty definition term in order to have valid HTML. | ||
| 199 | <dt></dt> | ||
| |
18.9 | 200 | <dd>$escapetool.xml($services.localization.render('xclass.defaultObjectSheet.noProperties'))</dd> |
| |
15.30 | 201 | #end |
| 202 | </dl> | ||
| |
16.6 | 203 | <p class="xHint">* Your information will only be used to respond to this request.</p> |
| |
16.16 | 204 | ## Hidden fields to catch requests filled by bots. |
| 205 | <div class="contact-hp-wrapper" aria-hidden="true"> | ||
| |
16.31 | 206 | <label for="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite">Website</label> |
| |
16.16 | 207 | <input |
| |
16.58 | 208 | id="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite" |
| |
16.16 | 209 | type="text" |
| |
16.31 | 210 | name="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite" |
| |
16.16 | 211 | autocomplete="off" |
| 212 | tabindex="-1" | ||
| 213 | /> | ||
| 214 | </div> | ||
| |
16.49 | 215 | <input type="hidden" name="Agnease.Code.ContactRequest.ContactRequestClass_0_contactStartedAt" value="$datetool.systemDate.time" /> |
| |
18.23 | 216 | <input type="hidden" name="sourcePage" value="" /> |
| |
15.30 | 217 | <input id="contactSubmit" type="submit" class="btn btn-primary" value="Send my request"> |
| 218 | </form> | ||
| |
15.34 | 219 | #end |
| 220 | {{/html}} | ||
| 221 | {{html clean="false" wiki="true"}} | ||
| 222 | <div class="reviewNotifications"> | ||
| 223 | <div class="hidden reviewNotificationSuccess"> | ||
| |
13.104 | 224 | |
| |
15.34 | 225 | {{success}}reviewNotification{{/success}} |
| |
13.104 | 226 | |
| |
15.34 | 227 | </div> |
| 228 | <div class="hidden reviewNotificationError"> | ||
| |
13.104 | 229 | |
| |
15.34 | 230 | {{error}}reviewNotification{{/error}} |
| |
13.104 | 231 | |
| |
13.107 | 232 | </div> |
| |
13.104 | 233 | </div> |
| |
15.34 | 234 | {{/html}} |
| 235 | {{html clean="false"}} | ||
| 236 | </div> | ||
| |
17.2 | 237 | <div class="col-md-5 contact-side-panel"> |
| 238 | <div class="split-copy contact-help-panel"> | ||
| 239 | <h2> | ||
| 240 | <i class="fa fa-check-circle" aria-hidden="true"></i> | ||
| 241 | How Agnease can help | ||
| 242 | </h2> | ||
| 243 | |||
| |
15.34 | 244 | <ul> |
| 245 | <li>XWiki upgrades and long-term maintenance</li> | ||
| 246 | <li>Knowledge bases, intranets, SOP and documentation workflows</li> | ||
| 247 | <li>Custom XWiki applications and integrations</li> | ||
| 248 | <li>LDAP, SSO, OIDC, SAML, and MFA setup</li> | ||
| 249 | <li>Migrations from SharePoint, Confluence, MediaWiki, or file-based documentation</li> | ||
| 250 | <li>Security-aware reviews and platform stabilization</li> | ||
| 251 | </ul> | ||
| |
12.21 | 252 | </div> |
| |
17.2 | 253 | |
| 254 | <ol class="process-list contact-process-list"> | ||
| 255 | <li> | ||
| 256 | <strong>Your request is reviewed</strong> | ||
| 257 | The project description is checked to understand the context and initial scope. | ||
| 258 | </li> | ||
| 259 | <li> | ||
| 260 | <strong>You receive a reply</strong> | ||
| 261 | Agnease replies with clarifying questions or suggested next steps. | ||
| 262 | </li> | ||
| 263 | <li> | ||
| 264 | <strong>A short call can be scheduled</strong> | ||
| 265 | If useful, we discuss scope, timeline and estimated effort together. | ||
| 266 | </li> | ||
| 267 | </ol> | ||
| |
12.14 | 268 | </div> |
| |
15.34 | 269 | </div> |
| 270 | {{/html}} | ||
| |
2.6 | 271 | {{/velocity}} |