Skip to content

Instantly share code, notes, and snippets.

Tejas Kanani tejaskanani

View GitHub Profile
@rotty3000
rotty3000 / example.java
Created Sep 13, 2011
simple dialog with encoded (safe) content from a bean
View example.java
<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
@rotty3000
rotty3000 / PortletAction.java
Created Sep 26, 2011
fix success message disabling
View PortletAction.java
@@ -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 Sep 17, 2011
simple sample client for fileupload to dl, requires commons-httpclient and it's dependencies.
View FileUploadSample.java
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 / freemarker.ftl
Created Oct 12, 2011
setting look and feel settings on a non-instancable portlet embedded in the theme
View freemarker.ftl
<#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 / portal_normal.ftl
Created Oct 12, 2011
adding javascript files from your theme
View portal_normal.ftl
...
<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
-->
You can’t perform that action at this time.