Skip to content

Instantly share code, notes, and snippets.

@UberNick
UberNick / gist:f6d4985f33dcde1f0928
Created Jun 25, 2014
Adobe LiveCycle Component build.xml modifications
View gist:f6d4985f33dcde1f0928
<target name="package.dsc" description="Foo.jar" depends="compile">
<jar destfile="${deploy.dir}/Foo.jar">
<zipfileset dir="${classes.dir}" includes="**/*.class"/>
<zipfileset dir="${src.dir}" includes="**/*.xml,**/*.java"/>
<fileset dir="." includes="icons/**"/>
<fileset dir="." includes="lib/*.jar" excludes="lib/internal/adobe-livecycle-client.jar"/>
<!-- Include just one file explicitly -->
<zipfileset dir="${adobe.thirdparty.dir}" includes="axis.jar" />
View ajax_1.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page import="java.util.Iterator"%>
<%@page session="false" %>
<%
String offsetString = (String)request.getParameter("offset");
String limitString = (String)request.getParameter("limit");
if (null == offsetString) {
offsetString = "0";
}
View bestsellerloader_5.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<sling:include path="<%= componentContext.getResource().getPath() + ".ajax.html" %>" />
<button id="loadMoreButton" style="width:100%; height:35px">Load More</button>
<script type="text/javascript">
(function($){
View bestsellerloader_4.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<!-- sling:include path="<%= componentContext.getResource().getPath() + ".ajax.html" %>" -->
<script type="text/javascript">
(function($){
var Bestsellerloader = {
queryUrl : "",
View bestsellerloader_3.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<script type="text/javascript">
(function(){
$.get("<%= componentContext.getResource().getPath() + ".ajax.html" %>", function(data){
$(".bestsellerloader").append(data);
});
})();
</script>
View bestsellerloader_2.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page import="java.lang.Iterable"%>
<%@page session="false" %>
<%
String bestsellerPath = "/content/geometrixx/en/products/bestsellers/jcr:content/par/";
Iterable<Resource> bestsellers = resourceResolver.getResource(bestsellerPath).getChildren();
int index = 0;
for (Resource bestseller : bestsellers) {
if (index % 2 == 0){
%>
View bestsellerloader_1.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page import="java.lang.Iterable"%>
<%@page session="false" %>
<%
String bestsellerPath = "/content/geometrixx/en/products/bestsellers/jcr:content/par/";
Iterable<Resource> bestsellers = resourceResolver.getResource(bestsellerPath).getChildren();
for (Resource bestseller : bestsellers) {
%>
<sling:include path="<%= bestseller.getPath() %>" />
<%
View bestsellerloader.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<sling:include path="<%= componentContext.getResource().getPath() + ".ajax.html" %>" />
<button id="loadMoreButton" style="width:100%; height:35px">Load More</button>
<script type="text/javascript">
(function($){
View posts.jsp
String defaultPostName = "";
//Below is logic to default posts based on page selectors.
//e.g. posts.{post-name.}.html
String selectorPath = currentPage.adaptTo(Resource.class).getResourceMetadata().getResolutionPathInfo();
String selectors[] = selectorPath.split("\\.");
if (selectors.length > 2) {
defaultPostName = selectors[1];
}
View multifieldTestComponent.jsp
<%@include file="/libs/foundation/global.jsp"%>
Multifield Test Component<br/>
<%
// String[] images = properties.get("images", String[].class); // default is null
String[] images = properties.get("images", new String[0]); // default is empty array
for (int i = 0; i < images.length; i++) {
%>
<img src="<%= images[i] %>"></img><br/>