Skip to content

Instantly share code, notes, and snippets.

@floriancourgey
Created March 8, 2019 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floriancourgey/55100117f93fa47d47578f7d02fe0c64 to your computer and use it in GitHub Desktop.
Save floriancourgey/55100117f93fa47d47578f7d02fe0c64 to your computer and use it in GitHub Desktop.
AC7 multi pages webApp based on ctx.vars.pageCount
<webApp accessControl="1" appState="0" appType="0" background="nms:backgrounds/survey.png"
builtIn="0" cmsAccount-id="0" created="2019-03-08 17:18:15.727Z" createdBy-id="1052"
defaultDictionary-id="1039" defaultLanguage="en" defaultOrigin-id="0" deliveryMapping-id="3587"
designLanguage="en" endDate="" entitySchema="nms:webApp" folder-id="5530"
folderProcess-id="0" hasHtmlPage="1" id="16392" idCounter="0" internalName="APP4"
isModel="0" label="Keep pageCount" lastModified="2019-03-08 17:18:15.727Z"
library="nms:webAppLogRcp" modelName="newLandingPage" modifiedBy-id="1052"
nature="landingPage" operation-id="0" operator-id="0" optOutBannerMode="0"
originUrlOverride="true" publicationDate="" rendering-id="3582" schema="nms:recipient"
startDate="" startPath="/" state="0" timezone="_inherit_" translationStatus="0"
useAEM="false" uuid="A8FC2669-1BCB-4321-B46A-42CA532C86A4" xtkschema="nms:webApp">
<properties labelPosition="left" navigationMode="button" renderingEngine="1" windowTitle="Enter the title of the window here"/>
<errorPage label="Error" name="errorPage">
<endPage>
<source><![CDATA[<table style="color: red;">
<tr>
<td style="vertical-align: middle; padding-left: 0.5em;"><img src="/xtk/img/error.png"/></td>
<td style="vertical-align: middle; padding: 1em;">
<p><%= $(line1) %></p>
<p><%= $(line2) %></p>
</td>
</tr>
</table>]]></source>
<strings>
<string id="line2" value="If this problem persists, please contact your Adobe Campaign administrator."/>
<string id="line1" value="An error occurred."/>
</strings>
</endPage>
</errorPage>
<closedFormLog>This form is currently closed.</closedFormLog>
<activities>
<htmlPage binding="true" img="nms:activities/survey.png" label="home page" mask="0"
name="htmlPage" type="htmlPage" x="528" y="56">
<transitions>
<next enabled="true" label="next" name="next" target="script" x="0" y="0"/>
</transitions>
<content>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
&lt;title&gt;Starter Template · Bootstrap&lt;/title&gt;
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"&gt;
&lt;/head&gt;
&lt;body style="" class=""&gt;
&lt;main class="container mt-5 pt-3"&gt;&lt;form name="page" id="page-form" method="post"&gt;
&lt;h1&gt;Page 1&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;pageCount: &lt;%= ctx.vars.pageCount %&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick="document.controller.submit('next', '_self', 'next');" href="#"&gt;Next&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/form&gt;&lt;/main&gt;
&lt;script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</content>
</htmlPage>
<test img="xtk:activities/condition.png" label="pageCount?" mask="0" name="test"
x="288" y="184">
<transitions>
<condition enabled="true" help="(pageCount less than or equal to 1)" label="pageCount &lt;= 1"
name="condition2" target="htmlPage">
<condition id="2771189765" leftExpr="[vars/pageCount]" operator="&lt;="
rightExpr="1"/>
</condition>
<default enabled="true" label="pageCount &gt;= 4" name="default" target="htmlPage22"
x="0" y="0"/>
<condition enabled="true" help="(pageCount equal to 2)" label="pageCount = 2"
name="transition1" target="htmlPage2" x="0" y="0">
<condition id="2757099523" leftExpr="[vars/pageCount]" operator="=" rightExpr="2"/>
</condition>
<condition enabled="true" help="(pageCount equal to 3)" label="pageCount = 3"
name="condition" target="htmlPage222" x="0" y="0">
<condition id="2758737924" leftExpr="[vars/pageCount]" operator="=" rightExpr="3"/>
</condition>
</transitions>
</test>
<htmlPage binding="true" img="nms:activities/survey.png" label="Page 2" mask="0"
name="htmlPage2" type="htmlPage" x="528" y="136">
<transitions>
<next enabled="true" label="Next" name="next" target="script"/>
</transitions>
<content>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
&lt;title&gt;Starter Template · Bootstrap&lt;/title&gt;
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"&gt;
&lt;/head&gt;
&lt;body style="" class=""&gt;
&lt;main class="container mt-5 pt-3"&gt;&lt;form name="page" id="page-form" method="post"&gt;
&lt;h1&gt;Page 2&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;pageCount: &lt;%= ctx.vars.pageCount %&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick="document.controller.submit('next', '_self', 'next');" href="#"&gt;Next&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/form&gt;&lt;/main&gt;
&lt;script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</content>
</htmlPage>
<start img="xtk:activities/start.png" label="Start" mask="0" name="start" x="24"
y="160">
<transitions>
<next enabled="true" name="next" target="script"/>
</transitions>
</start>
<htmlPage binding="true" img="nms:activities/survey.png" label="Final page" mask="0"
name="htmlPage22" type="htmlPage" x="528" y="272">
<transitions>
<next enabled="true" label="Next" name="next" target="script2"/>
</transitions>
<content>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
&lt;title&gt;Starter Template · Bootstrap&lt;/title&gt;
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"&gt;
&lt;/head&gt;
&lt;body style="" class=""&gt;
&lt;main class="container mt-5 pt-3"&gt;&lt;form name="page" id="page-form" method="post"&gt;
&lt;h1&gt;Final page&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;pageCount: &lt;%= ctx.vars.pageCount %&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick="document.controller.submit('next', '_self', 'next');" href="#"&gt;Reset and go back to home page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/form&gt;&lt;/main&gt;
&lt;script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</content>
</htmlPage>
<htmlPage binding="true" img="nms:activities/survey.png" label="Page 3" mask="0"
name="htmlPage222" type="htmlPage" x="535" y="203">
<transitions>
<next enabled="true" label="Next" name="next" target="script"/>
</transitions>
<content>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
&lt;title&gt;Starter Template · Bootstrap&lt;/title&gt;
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"&gt;
&lt;/head&gt;
&lt;body style="" class=""&gt;
&lt;main class="container mt-5 pt-3"&gt;&lt;form name="page" id="page-form" method="post"&gt;
&lt;h1&gt;Page 3&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;pageCount: &lt;%= ctx.vars.pageCount %&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick="document.controller.submit('next', '_self', 'next');" href="#"&gt;Next&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/form&gt;&lt;/main&gt;
&lt;script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</content>
</htmlPage>
<script img="xtk:activities/script.png" label="Increment pageCount" mask="0"
name="script" x="177" y="166">
<transitions>
<next enabled="true" name="next" target="test"/>
</transitions>
<code><![CDATA[ctx.vars.pageCount++;]]></code>
</script>
<script img="xtk:activities/script.png" label="pageCount = 0" mask="0" name="script2"
x="679" y="278">
<transitions>
<next enabled="true" name="next" target="script" x="0" y="0"/>
</transitions>
<code><![CDATA[ctx.vars.pageCount = 0;]]></code>
</script>
</activities>
<desc><![CDATA[]]></desc>
<facet advanced="0"/>
<rendering _cs="Standard form" created="2019-02-27 20:21:43.652Z" createdBy-id="0"
displayNavigation="0" folder-id="1026" id="3582" internalName="defaultFormRendering"
label="Standard form" lastModified="2019-02-27 20:21:43.649Z" modifiedBy-id="0"
navigationLabel="" pageBorder="0" preview="/nms/img/survey/theme/preview/defaultRendering.png"
type="0">
<header hideIfDashboard="true" id="1" position="3">
<font strikethrough="default" style="normal" underline="default"/>
<left>
<text><![CDATA[$(PAGETITLE)]]></text>
</left>
<right>
<text><![CDATA[<% if(serverForm.activities[String(ctx.activityHistory.activity[0].@name)].type != "end") { %> $(PAGE) / $(PAGES) <% }%>]]></text>
</right>
<border>
<left style="default"/>
<top style="default"/>
<right style="default"/>
<bottom style="default"/>
</border>
</header>
<header hideIfDashboard="true" id="2" position="3">
<font strikethrough="default" style="normal" underline="default"/>
<right>
<text><![CDATA[$(LOGO)]]></text>
</right>
<border>
<left style="default"/>
<top style="default"/>
<right style="default"/>
<bottom style="default"/>
</border>
</header>
<logo height="30" position="1" src="xtk:report/neologo118x30.png" width="195"/>
<layout errors="1" footer="2" footertext="2" header="2"/>
<format css="/nl/webForms/defaultWebApp.css" defaultFontSize="8" name="web">
<cssOverloading><![CDATA[/* Enter here anything loaded over the CSS */]]></cssOverloading>
</format>
<folder _cs="Form rendering"/>
</rendering>
<folder _cs="Web applications"/>
<deliveryMapping _cs="Recipients (nms:recipient)" id="3587"/>
<defaultDictionary _cs="User dictionary"/>
<variables>
<variable default="0" label="pageCount" type="short" xpath="pageCount"/>
</variables>
</webApp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment