Skip to content

Instantly share code, notes, and snippets.

@rotty3000
rotty3000 / portal_normal.ftl
Created October 12, 2011 16:57
adding javascript files from your theme
...
<head>
<title>${the_title} - ${company_name}</title>
${theme.include(top_head_include)}
<#--
-- <@liferay.js /> is a macro that should produce the correct output, timestamped to match that of the theme
-- Note main.js is already included automatically
-->
@rotty3000
rotty3000 / freemarker.ftl
Created October 12, 2011 14:12
setting look and feel settings on a non-instancable portlet embedded in the theme
<#assign locPortletId = "82" />
<#assign PortletPreferencesFactoryUtil = staticUtil["com.liferay.portlet.PortletPreferencesFactoryUtil"] />
<#assign portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, locPortletId) />
<#if portletSetup.getValue("portletSetupShowBorders", "") != "false" >
<#assign temp = portletSetup.setValue("portletSetupShowBorders", "false") />
<#assign temp = portletSetup.store() />
</#if>
@rotty3000
rotty3000 / PortletAction.java
Created September 26, 2011 15:56
fix success message disabling
@@ -22,6 +22,7 @@ import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.util.ContentTypes;
+import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.JavaConstants;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
@@ -168,6 +169,20 @@ public class PortletAction extends Action {
protected void addSuccessMessage(
@rotty3000
rotty3000 / FileUploadSample.java
Created September 17, 2011 19:31
simple sample client for fileupload to dl, requires commons-httpclient and it's dependencies.
import java.io.File;
import java.io.IOException;
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.cookie.CookiePolicy;
@rotty3000
rotty3000 / example.java
Created September 13, 2011 16:34
simple dialog with encoded (safe) content from a bean
<button id="createNew">Create a new Dialog</button>
<aui:script use="aui-base">
var myFunction = function(options) {
var dialog = new A.Dialog(
A.merge(options, {
bodyContent: options.content,
title: 'New Dialog',
xy: [150, 150],
modal: true