Last modified by Alex Cotiuga on 2026/07/27 06:09

Hide last authors
Alex Cotiuga 13.108 1 {{velocity wiki="false"}}
2 #if ($xcontext.action == 'get')
Alex Cotiuga 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.')
Alex Cotiuga 13.189 5
Alex Cotiuga 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',
Alex Cotiuga 18.6 15 'users',
16 'sourcePage'
Alex Cotiuga 16.57 17 ])
18
Alex Cotiuga 16.12 19 #set ($name = '')
20 #set ($email = '')
Alex Cotiuga 16.51 21 #set ($scope = '')
Alex Cotiuga 16.26 22 #set ($contactWebsite = '')
Alex Cotiuga 16.45 23 #set ($startedAtRaw = '')
Alex Cotiuga 13.168 24
Alex Cotiuga 16.57 25 ## Extract only the values we need for validation.
Alex Cotiuga 13.150 26 #foreach ($parameterName in $request.parameterNames)
Alex Cotiuga 16.36 27 #set ($propertyParts = $parameterName.split('_0_'))
Alex Cotiuga 16.38 28 #if ($propertyParts.size() > 1)
Alex Cotiuga 16.57 29 #set ($propertyName = $propertyParts[1])
30 #set ($propertyValue = $stringtool.trim($request.get($parameterName)))
31
Alex Cotiuga 16.36 32 #if ($propertyName == 'name')
Alex Cotiuga 16.57 33 #set ($name = $propertyValue)
Alex Cotiuga 16.36 34 #elseif ($propertyName == 'email')
Alex Cotiuga 16.57 35 #set ($email = $propertyValue)
Alex Cotiuga 16.51 36 #elseif ($propertyName == 'scope')
Alex Cotiuga 16.57 37 #set ($scope = $propertyValue)
Alex Cotiuga 16.36 38 #elseif ($propertyName == 'contactWebsite')
Alex Cotiuga 16.57 39 #set ($contactWebsite = $propertyValue)
Alex Cotiuga 16.42 40 #elseif ($propertyName == 'contactStartedAt')
Alex Cotiuga 16.57 41 #set ($startedAtRaw = $propertyValue)
Alex Cotiuga 16.36 42 #end
Alex Cotiuga 16.12 43 #end
Alex Cotiuga 13.150 44 #end
Alex Cotiuga 13.170 45
Alex Cotiuga 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
Alex Cotiuga 16.46 58 #set ($startedAt = $numbertool.toNumber($startedAtRaw))
Alex Cotiuga 16.57 59 #if ("$!startedAt" == '')
60 #set ($spamScore = $spamScore + 2)
61 #else
62 #set ($now = $datetool.systemDate.time)
63 #set ($elapsed = $now - $startedAt)
Alex Cotiuga 16.46 64
Alex Cotiuga 16.57 65 ## Reject very fast submissions.
66 #if ($elapsed > 0 && $elapsed < 10000)
67 #set ($spamScore = $spamScore + 3)
68 #end
Alex Cotiuga 16.46 69 #end
Alex Cotiuga 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" == '')
Alex Cotiuga 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.')
Alex Cotiuga 16.51 110 #elseif ("$!scope" == '' || $scope.length() < 30)
111 #set ($message = 'Please add a short description of your XWiki project, question or issue.')
Alex Cotiuga 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.')
Alex Cotiuga 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))
Alex Cotiuga 16.57 120 #set ($contactRequestObj = $contactRequestDoc.getObject($className, true))
Alex Cotiuga 15.26 121
Alex Cotiuga 16.57 122 ## Save only known ContactRequest fields.
Alex Cotiuga 16.12 123 #foreach ($parameterName in $request.parameterNames)
Alex Cotiuga 18.14 124 #if ($parameterName == 'sourcePage')
Alex Cotiuga 18.22 125 #set ($discard = $contactRequestObj.set($parameterName, $stringtool.trim($request.get($parameterName))))
Alex Cotiuga 18.14 126 #end
Alex Cotiuga 16.57 127 #set ($propertyParts = $parameterName.split('_0_'))
128 #if ($propertyParts.size() > 1)
129 #set ($propertyName = $propertyParts[1])
130
131 #if ($allowedProperties.contains($propertyName))
Alex Cotiuga 18.14 132 #set ($discard = $contactRequestObj.set($propertyName, $stringtool.trim($request.get($parameterName))))
Alex Cotiuga 16.57 133 #end
Alex Cotiuga 16.54 134 #end
Alex Cotiuga 16.12 135 #end
Alex Cotiuga 13.108 136
Alex Cotiuga 16.12 137 #set ($discard = $contactRequestDoc.saveAsAuthor())
Alex Cotiuga 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 ($notificationSubject = 'New Agnease contact request')
143 #set ($notificationBody = "
144 Name:
Alex Cotiuga 18.28 145 $!contactRequestObj.getValue('name')
Alex Cotiuga 18.26 146
147 Email:
Alex Cotiuga 18.28 148 $!contactRequestObj.getValue('email')
Alex Cotiuga 18.26 149
150 Source page:
Alex Cotiuga 18.28 151 $!contactRequestObj.getValue('sourcePage')
Alex Cotiuga 18.26 152
153 Already uses XWiki:
Alex Cotiuga 18.27 154 $!contactRequestObj.get('alreadyUseXWiki')
Alex Cotiuga 18.26 155
156 Hosting:
Alex Cotiuga 18.27 157 $!contactRequestObj.get('hosting')
Alex Cotiuga 18.26 158
159 Custom development:
Alex Cotiuga 18.27 160 $!contactRequestObj.get('customDevelopment')
Alex Cotiuga 18.26 161
162 Timeline:
Alex Cotiuga 18.27 163 $!contactRequestObj.get('timeline')
Alex Cotiuga 18.26 164
165 Users:
Alex Cotiuga 18.27 166 $!contactRequestObj.get('users')
Alex Cotiuga 18.26 167
168 Message:
Alex Cotiuga 18.28 169 $!contactRequestObj.getValue('scope')
Alex Cotiuga 18.26 170
171 Internal request page:
Alex Cotiuga 18.29 172 $contactRequestDoc.getExternalURL()
Alex Cotiuga 18.26 173 ")
174
175 #set ($message = $services.mail.sender.createMessage($notificationRecipient, $notificationSubject))
176 #set ($discard = $message.setType('Agnease Contact Request'))
177 #set ($discard = $message.addPart('text/plain', $notificationBody))
178 #set ($mailResult = $services.mail.sender.sendAsynchronously([$message], 'database'))
179 #end
Alex Cotiuga 16.12 180 #set ($statusCode = 200)
181 #set ($message = 'Your request was successfully sent.')
182 #end
Alex Cotiuga 13.108 183
Alex Cotiuga 16.12 184 #if ("$!contactException" != '')
185 #set ($statusCode = 400)
186 #set ($message = 'The request could not be sent. Please try again or contact Agnease by email.')
187 #end
188 #end
189
Alex Cotiuga 13.108 190 #set ($discard = $response.setStatus($statusCode))
Alex Cotiuga 13.151 191 #jsonResponse({'message': $message})
Alex Cotiuga 13.108 192 #end
193 {{/velocity}}
194
Alex Cotiuga 2.6 195 {{velocity}}
Alex Cotiuga 13.3 196 #set ($discard = $xwiki.ssx.use('contact.WebHome'))
Alex Cotiuga 14.5 197 #set ($xobject = $doc.getObject('Agnease.Code.ContactRequest.ContactRequestClass'))
Alex Cotiuga 15.26 198 #set ($totalRequests = $services.query.xwql('from doc.object(Agnease.Code.ContactRequest.ContactRequestClass) contact').execute())
Alex Cotiuga 15.34 199 #set ($xclass = $xobject.xWikiClass)
200 #set ($editing = true)
201 = Tell Us More About Your Project =
202 You do not need to have a full specification. A short description is enough to start the conversation.
Alex Cotiuga 16.8 203 {{html clean="false"}}
Alex Cotiuga 18.31 204 <p>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.</p>
205 <p>Looking for a starting point first? <a href="$xwiki.getURL('pricing.WebHome')">View XWiki service packages and starting prices</a>.</p>
Alex Cotiuga 15.34 206 <div class="row">
207 <div class="xform col-md-7">
Alex Cotiuga 15.37 208 #if ($totalRequests.size() > 50)
Alex Cotiuga 15.34 209 ## As a measure to avoid high load on website.
Alex Cotiuga 15.35 210 Tell us more about your project at <a href="mailto:alex@agnease.com">alex@agnease.com</a>
Alex Cotiuga 15.34 211 #else
Alex Cotiuga 18.7 212 #set ($hiddenProperties = ['sourcePage'])
Alex Cotiuga 15.30 213 <form id="contactForm">
214 <dl>
215 #foreach ($property in $xclass.properties)
Alex Cotiuga 18.25 216 #if (!$hiddenProperties.contains($property.name))
217 #if ($property.name == 'hosting')
218 <hr>
219 <h3>Optional project details</h3>
220 <p>These details help us understand the scope and suggest practical next steps.</p>
221 #end
222 <dt #if (!$editing && $hasEdit)
223 class="editableProperty"
224 #set ($xobjectPropertyReference = $xobject.getPropertyReference($property.name))
225 data-property="$escapetool.xml($services.model.serialize($xobjectPropertyReference))"
226 data-property-type="object"#end>
227 ## This must match the id generated by the $doc.display() method below.
228 #set ($propertyId = "${xclass.name}_${xobject.number}_$property.name")
229 <label#if ($editing) for="$escapetool.xml($propertyId)"#end>
230 $escapetool.xml($property.translatedPrettyName)
231 </label>
232 ## Support for specifying a translation key as hint in the property definition.
233 <span class="xHint">$!escapetool.xml($services.localization.render($property.hint))</span>
234 </dt>
235 <dd>$doc.display($property.name, 'edit').replace('{{html clean="false" wiki="false"}}', '').replace("{{/html}}", '')</dd>
Alex Cotiuga 18.7 236 #end
Alex Cotiuga 13.47 237 #end
Alex Cotiuga 15.30 238 #if (!$xclass.properties || $xclass.properties.size() == 0)
239 ## Keep the empty definition term in order to have valid HTML.
240 <dt></dt>
Alex Cotiuga 18.9 241 <dd>$escapetool.xml($services.localization.render('xclass.defaultObjectSheet.noProperties'))</dd>
Alex Cotiuga 15.30 242 #end
243 </dl>
Alex Cotiuga 16.6 244 <p class="xHint">* Your information will only be used to respond to this request.</p>
Alex Cotiuga 16.16 245 ## Hidden fields to catch requests filled by bots.
246 <div class="contact-hp-wrapper" aria-hidden="true">
Alex Cotiuga 16.31 247 <label for="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite">Website</label>
Alex Cotiuga 16.16 248 <input
Alex Cotiuga 16.58 249 id="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite"
Alex Cotiuga 16.16 250 type="text"
Alex Cotiuga 16.31 251 name="Agnease.Code.ContactRequest.ContactRequestClass_0_contactWebsite"
Alex Cotiuga 16.16 252 autocomplete="off"
253 tabindex="-1"
254 />
255 </div>
Alex Cotiuga 16.49 256 <input type="hidden" name="Agnease.Code.ContactRequest.ContactRequestClass_0_contactStartedAt" value="$datetool.systemDate.time" />
Alex Cotiuga 18.24 257 <input type="hidden" name="sourcePage" />
Alex Cotiuga 15.30 258 <input id="contactSubmit" type="submit" class="btn btn-primary" value="Send my request">
259 </form>
Alex Cotiuga 15.34 260 #end
261 {{/html}}
262 {{html clean="false" wiki="true"}}
263 <div class="reviewNotifications">
264 <div class="hidden reviewNotificationSuccess">
Alex Cotiuga 13.104 265
Alex Cotiuga 15.34 266 {{success}}reviewNotification{{/success}}
Alex Cotiuga 13.104 267
Alex Cotiuga 15.34 268 </div>
269 <div class="hidden reviewNotificationError">
Alex Cotiuga 13.104 270
Alex Cotiuga 15.34 271 {{error}}reviewNotification{{/error}}
Alex Cotiuga 13.104 272
Alex Cotiuga 13.107 273 </div>
Alex Cotiuga 13.104 274 </div>
Alex Cotiuga 15.34 275 {{/html}}
276 {{html clean="false"}}
277 </div>
Alex Cotiuga 17.2 278 <div class="col-md-5 contact-side-panel">
279 <div class="split-copy contact-help-panel">
280 <h2>
281 <i class="fa fa-check-circle" aria-hidden="true"></i>
282 How Agnease can help
283 </h2>
284
Alex Cotiuga 15.34 285 <ul>
286 <li>XWiki upgrades and long-term maintenance</li>
287 <li>Knowledge bases, intranets, SOP and documentation workflows</li>
288 <li>Custom XWiki applications and integrations</li>
289 <li>LDAP, SSO, OIDC, SAML, and MFA setup</li>
290 <li>Migrations from SharePoint, Confluence, MediaWiki, or file-based documentation</li>
291 <li>Security-aware reviews and platform stabilization</li>
292 </ul>
Alex Cotiuga 12.21 293 </div>
Alex Cotiuga 17.2 294
295 <ol class="process-list contact-process-list">
296 <li>
297 <strong>Your request is reviewed</strong>
298 The project description is checked to understand the context and initial scope.
299 </li>
300 <li>
301 <strong>You receive a reply</strong>
302 Agnease replies with clarifying questions or suggested next steps.
303 </li>
304 <li>
305 <strong>A short call can be scheduled</strong>
306 If useful, we discuss scope, timeline and estimated effort together.
307 </li>
308 </ol>
Alex Cotiuga 12.14 309 </div>
Alex Cotiuga 15.34 310 </div>
311 {{/html}}
Alex Cotiuga 2.6 312 {{/velocity}}