Changes for page Download Version

Last modified by Simon Urli on 2023/10/10

<
From version < 6.3 >
edited by Vincent Massol
on 2016/05/27
To version < 7.1 >
edited by Vincent Massol
on 2016/05/30
>
Change comment: Imported from XAR

Summary

Details

Page properties
Content
... ... @@ -8,27 +8,24 @@
8 8  #set ($downloadURL = $request.downloadURL)
9 9  #set ($projectVersion = $request.projectVersion)
10 10  #set ($userEmail = $request.userEmail)
11 -## If email is in the request then send the user's email by mail and redirect to the download
12 -#if ("$!userEmail" != '')
13 - ## Send the mail asynchronously
14 - #set ($message = $services.mailsender.createMessage("[email protected]", "New user registration"))
15 - #set ($discard = $message.addPart("text/plain", "$userEmail"))
16 - #set ($discard = $services.mailsender.sendAsynchronously([$message], 'database'))
17 - ## Perform the redirect
18 - #if ("$!downloadURL" != '')
19 - #set ($discard = $response.sendRedirect($downloadURL))
20 - #else
21 - ## Redirect to the Download home
22 - $set ($discard = $response.sendRedirect($xwiki.getURL('Download.WebHome')))
23 - #end
24 -#else
25 25  {{html}}
26 26  <div class="row">
27 27   <div class="col-xs-12">
28 28   #if ("$!downloadURL" != '' && "$!projectVersion" != '')
15 + $xwiki.jsx.use("Download.DownloadForm", {'downloadURL' : $escapetool.xml($request.downloadURL)})
29 29   <div class="download-container border-green subscribe-area">
30 30   <h3 class="subscribe">Join the Community!</h3>
31 - <form action="" class="xform">
18 + <script src="//app-lon03.marketo.com/js/forms2/js/forms2.min.js"></script>
19 + <form id="mktoForm_1319" class="marketoForm" style="display: none;"></form>
20 + <script>
21 + MktoForms2.loadForm("//app-lon03.marketo.com", "158-SNK-721", 1319, function(form){
22 + form.onSuccess(function(values, followUpUrl){
23 + // Prevent the Marketo Form from reloading the page
24 + return false;
25 + });
26 + });
27 + </script>
28 + <form id="emailForm" action="" class="xform">
32 32   <input type="hidden" name="downloadURL" value="$downloadURL"/>
33 33   <input type="hidden" name="projectVersion" value="$projectVersion"/>
34 34   <dl>
... ... @@ -38,13 +38,12 @@
38 38   </dt>
39 39   <dd>
40 40   <input type="email" placeholder="Email" autocomplete="off" name="userEmail" id="userEmail" tabindex="1" autofocus/>
41 - #if ($userEmail)<span class="xErrorMsg">Please enter a valid email address</span>#end
38 + #if ($userEmail && $userEmail.length() == 0)<span class="xErrorMsg">Please enter a valid email address</span>#end
42 42   </dd>
43 43   </dl>
44 44   <div class="buttons">
45 - <input type="submit" value="Download" class="btn btn-success" tabindex="2">
46 - <a class="btn btn-link btn-xs" href="$escapetool.xml($downloadURL)" tabindex="3" >Skip this form</a>
47 - </span>
42 + <input type="submit" value="Download" class="btn btn-success" tabindex="2">
43 + <a class="btn btn-link btn-xs" href="$escapetool.xml($downloadURL)" tabindex="3" >Skip this form</a>
48 48   </div>
49 49   </form>
50 50   </div>
... ... @@ -52,7 +52,6 @@
52 52   </div>
53 53  </div>
54 54  {{/html}}
55 -#end
56 56  {{/velocity}}
57 57  
58 58  {{html clean='false'}}
XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +forbid
Code
... ... @@ -1,0 +1,19 @@
1 +require(['jquery'], function ($) {
2 + $('#emailForm').on('submit', function () {
3 + var xwikiForm = $(this);
4 + var userEmail = $.trim($("#userEmail", xwikiForm).val());
5 + if (userEmail != '') {
6 + var marketoForm = $(".marketoForm");
7 + if (marketoForm.length > 0) {
8 + marketoForm = marketoForm[0];
9 + $("input[name='Email']", marketoForm).val($("#userEmail", xwikiForm).val());
10 + $(".mktoButton", marketoForm).click();
11 + }
12 + location.href = "$request.downloadURL";
13 + return false;
14 + } else {
15 + return true;
16 + }
17 + });
18 +});
19 +
Parse content
... ... @@ -1,0 +1,1 @@
1 +Yes
Use this extension
... ... @@ -1,0 +1,1 @@
1 +currentPage

Get Connected