Skip to content

Instantly share code, notes, and snippets.

View rotty3000's full-sized avatar

Raymond Augé rotty3000

View GitHub Profile
@rotty3000
rotty3000 / resource.html
Created September 28, 2011 19:30
embed a portlet via js
#set ($articleService = $portal.getClass().forName('com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil'))
#set ($article = $articleService.getArticle($getterUtil.getLong($groupId), $reserved-article-id.data))
$le-content.data
<div id="${request.portlet-namespace}discussion">
<script type="text/javascript">
AUI().use('liferay-portlet-url', 'aui-resize-iframe', function(A) {
var portletURL = Liferay.PortletURL.createRenderURL();
@rotty3000
rotty3000 / embedded-discussion-widget.vm
Created October 4, 2011 14:34
template to include the discussion widget in an article
#set ($articleService = $portal.getClass().forName('com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil'))
#set ($article = $articleService.getArticle($getterUtil.getLong($groupId), $reserved-article-id.data))
$le-content.data
<div id="${request.portlet-namespace}discussion">
<script type="text/javascript">
AUI().use('liferay-portlet-url', 'aui-resize-iframe', function(A) {
var portletURL = Liferay.PortletURL.createRenderURL();
@rotty3000
rotty3000 / ratingsentries.java
Created October 4, 2011 19:32
get all RatingsEntry by user and asset type
long classNameId = PortalUtil.getClassNameId(className);
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RatingsEntry.class, PortalClassLoaderUtil.getClassLoader());
dynamicQuery.add(RestrictionsFactoryUtil.eq("userId", userId));
dynamicQuery.add(RestrictionsFactoryUtil.eq("classNameId", classNameId));
List<RatingsEntry> ratings = (List<RatingsEntry>)RatingsEntryLocalServiceUtil.dynamicQuery(dynamicQuery);
@rotty3000
rotty3000 / portal_normal.vm
Created October 4, 2011 22:14
embed navigation tag directly without portlet
## Embedded navigation tag
#set ($navigationTag = $portal.class.forName("com.liferay.taglib.ui.NavigationTag").newInstance())
#set ($V = $navigationTag.setPageContext($pageContext))
#set ($V = $navigationTag.setBulletStyle("main"))
#set ($V = $navigationTag.setDisplayStyle("[custom]"))
#set ($V = $navigationTag.setHeaderType("root-layout"))
#set ($V = $navigationTag.setIncludedLayouts("all"))
#set ($V = $navigationTag.setNestedChildren(1))
#set ($V = $navigationTag.setRootLayoutLevel(1))
#set ($V = $navigationTag.setRootLayoutType("absolute"))
@rotty3000
rotty3000 / localization-hook.patch
Created October 5, 2011 22:41
a localization hook
commit 2d8dfb68d4678d0e8009c36c2cf887ce1c788245
Author: Raymond Auge <raymond.auge@liferay.com>
Date: Wed Oct 5 18:41:05 2011 -0400
localization-hook
diff --git a/hooks/localizations-hook/build.xml b/hooks/localizations-hook/build.xml
new file mode 100644
index 0000000..6167bd2
--- /dev/null
@rotty3000
rotty3000 / dynamicQuery_way.java
Created October 12, 2011 13:36
list open and accessible sites
/**
* Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@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 / 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 / portlet_url.php
Created October 14, 2011 16:46
create a PortletURL in PHP
<?php
/*
* You need the fix from:
* http://issues.liferay.com/browse/LPS-22161
* (git 8f7c48746f9282e6037112220f9232786747d896)
*/
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.util.PortletKeys;
import com.liferay.portlet.PortletURLFactoryUtil;
@rotty3000
rotty3000 / gist:1291842
Created October 17, 2011 02:59
Creating a fragment bundle that adds exposes more classes from the outer env
http://blog.meschberger.ch/2008/10/osgi-bundles-require-classes-from.html
How can an OSGi Framework be extended ?
A framework can be extended in two ways: Either by extending the list of packages available in the framework itself by ammending the System Bundle export list or by adding classes to the framework boot class loader.
To extend the framework the bundle must have the Fragment-Host manifest header set to either the actual bundle symbolic name of the system bundle as defined by the framework vendor. Alternatively the alias of the system bundle name, which is system.bundle may be used. I prefer the latter case because it would not create vendor lock-in on the Extension Bundle.
The type of extension is indicated by the extension directive of the Fragment-Host manifest header. The directive may take either of the following values: