Skip to content

Instantly share code, notes, and snippets.

View cfalzone's full-sized avatar

Christopher Falzone cfalzone

  • Aquent
  • Erie County, PA
View GitHub Profile
<portlet>
<portlet-name>EXT_AQUENT_TOOLS</portlet-name>
<display-name>Aquent Tools</display-name>
<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
<init-param>
<name>view-action</name>
<value>/ext/aquent/tools</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<action path="/ext/aquenttools/view" type="com.aquent.portlets.tools.ViewAquentTools">
<forward name="com.aquent.tools" path="com.aquent.tools" />
</action>
<definition name="com.aquent.tools" extends="portal">
<put name="content" value="/plugins/com.aquent/toolsportlet/view.jsp" />
</definition>
<%@ page import="com.dotmarketing.util.Config" %>
<%@ include file="/html/common/init.jsp" %>
<%@ taglib uri="/WEB-INF/tld/dotmarketing.tld" prefix="dot" %>
<portlet:defineObjects />
<%@ include file="/html/common/messages_inc.jsp" %>
<div id="main">
Test
</div>
package com.aquent.portlets.tools;
import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
@cfalzone
cfalzone / account-create.vtl
Created September 10, 2013 20:43
DotCMS Account Creation VTL
#set($session = $request.getSession())
#set($createAccountForm = $request.getAttibute("createAccountForm"))
<div class="errorMessage">
#parse('static/messages.html')
#parse('/static/messages.html')
</div>
@cfalzone
cfalzone / gist:6587462
Created September 16, 2013 22:29
Solution to pulling dotCMS's /JSONContent with Apache Commons HttpClient
String stVarName = "UXThursdayEvents";
String url = "http://aquent.com/JSONContent?type=json&limit=1000&offset=0&q=";
try {
url = url + URLEncoder.encode("+structureName:"+stVarName+" +live:true +deleted:false", "UTF-8");
} catch (Exception e) {
failed.put(stVarName, "Unable to encode the url to fetch the data: "+e.getMessage());
throw new Exception();
}
Logger.info(this, "The url we are fetching: "+url);
@cfalzone
cfalzone / gist:6595248
Last active December 23, 2015 06:39
Creating a contentlet in 2.5 from json
JSONObject data = new JSONObject(dataString);
JSONArray contentlets = data.getJSONArray("contentlets");
for(int i = 0; i<contentlets.length(); i++) {
JSONObject con = contentlets.getJSONObject(i);
Contentlet contentlet=new Contentlet();
contentlet.setStructureInode(stInode);
contentlet.setHost(stHost.getIdentifier());
long languageId = con.getLong("languageId");
@cfalzone
cfalzone / TemplatePages.jsp
Created October 1, 2013 14:50
Some beta code to show which pages are using which templates in dotCMS. Very slow and using a not-so-great ui
<%@page import="java.util.HashMap"%>
<%@page import="com.dotmarketing.portlets.htmlpages.business.HTMLPageAPI"%>
<%@page import="com.dotmarketing.portlets.htmlpages.model.HTMLPage"%>
<%@page import="com.dotmarketing.portlets.templates.business.TemplateAPI"%>
<%@page import="com.dotmarketing.portlets.templates.model.Template"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="com.dotmarketing.business.APILocator"%>
<%@page import="com.dotmarketing.beans.Host"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
@cfalzone
cfalzone / gist:6978280
Created October 14, 2013 16:24
dotCMS json tool for putting data into js
#set($myList = $contents.getEmptyList())
#foreach($i in [1..10])
#set($tMap = $contents.getEmptyMap())
#set($_dummy = $tMap.put("somekey", $i))
#set($_dummy = $tMap.put("otherkey", "othervalue"))
#set($_dummy = $myList.add($tMap))
#end
<p>List = $myList</p>
#set($myMap = $contents.getEmptyMap())
#set($_dummy = $myMap.put("items",$myList))