Liferay – JavaScript – Create Custom Portlet ActionURL

var actionURL;
AUI().use("liferay-portlet-url", function (a) {
  actionURL = Liferay.PortletURL.createActionURL();
  actionURL.setParameter("struts_action", "/migration/fusion")
  actionURL.setParameter("action", "redirectURL");
  actionURL.setParameter("redirectURL", "http://google.com");
  actionURL.setPortletMode("view");
  actionURL.setWindowState("exclusive");
  actionURL.setPortletId("fusion_WAR_fusionplugin");
});

Liferay – SQL – Select FileEntries tagged with tag A but not tagged with tag B

SELECT UNIQUE /*csv*/ *
FROM
  ( SELECT fileentryid,
           title
   FROM dlfileentry
   WHERE fileentryid IN
       ( SELECT classpk
        FROM assetentry
        WHERE entryid IN
            ( SELECT A.entryid
             FROM assetentries_assettags A
             WHERE A.tagid = '165314' ) ))
WHERE fileentryid NOT IN
    (SELECT fileentryid
     FROM dlfileentry
     WHERE fileentryid IN
         ( SELECT classpk
          FROM assetentry
          WHERE entryid IN
              ( SELECT A.entryid
               FROM assetentries_assettags A
               WHERE A.tagid = '873015' )));

Liferay – SQL – Select JournalArticles tagged with tag A but not tagged with tag B

This is not an optimized SQL script but it gets job done.

SELECT UNIQUE /*csv*/ *
FROM
  ( SELECT articleid,
           urltitle,
           resourceprimkey
   FROM journalarticle
   WHERE resourceprimkey IN
       ( SELECT classpk
        FROM assetentry
        WHERE entryid IN
            ( SELECT A.entryid
             FROM assetentries_assettags A
             WHERE A.tagid = '165314' ) ))
WHERE resourceprimkey NOT IN
    (SELECT resourceprimkey
     FROM journalarticle
     WHERE resourceprimkey IN
         ( SELECT classpk
          FROM assetentry
          WHERE entryid IN
              ( SELECT A.entryid
               FROM assetentries_assettags A
               WHERE A.tagid = '872319' )));

Liferay – JavaScript example to retrieve UserGroups

This JavaScript returns an array of user roles (different from Liferay Roles) depends on the UserGroups the user is in.

/*
 * Object fusionUI.getUserRoles(callback) returns user role. The getUserRoles function will pass the user
 * roles in an array to the callback function.
 *
 * Usage: fusionUI.getUserRoles(callback);
 * Example:
 *
 * function testCallback(comboItems) {
 *   for (var i in comboItems) {
 *     console.log(i + "=" + comboItems[i]);
 *   }
 * }
 *
 * fusionUI.getUserRoles(testCallback);
 *
 */
var fusionUI = {
  agents: ['AGTUserGroup', 'HOUserGroup'],
  admins: ['BOAUserGroup', 'ROAUserGroup', 'TOAUserGroup', 'RDUserGroup', 'HOAUserGroup'],
  mangrs: ['SVPUserGroup', 'TVPUserGroup', 'BSMUserGroup', 'USMUserGroup', 'USVUserGroup', 'UFTUserGroup'],

  getUserRoles: function (callback) {

    Liferay.Service(
      '/usergroup/get-user-user-groups', {
      userId: themeDisplay.getUserId()
    }, function (obj) {
      var comboItems = [];
      for (var i in obj) {
        if ($.inArray(obj[i].name, fusionUI.agents) > -1) {
          comboItems.push("Agents");
        } else if ($.inArray(obj[i].name, fusionUI.mangrs) > -1) {
          comboItems.push("Managers");
        } else if ($.inArray(obj[i].name, fusionUI.admins) > -1) {
          comboItems.push("Administrators");
        }
      }

      callback(comboItems);
    });
  }
};

function testCallback(comboItems) {
  for (var i in comboItems) {
    console.log(i + "=" + comboItems[i]);
  }
}

fusionUI.getUserRoles(testCallback);

Liferay – debug Web Content

Jar file = portal-impl.jar

Package = com.liferay.portlet.journal.action

if there were a problem to view the web content, find that web content in Control Panel -> Web Content and click on “Actions” button and select “View” action. The source file for view action is com.liferay.portlet.journal.action.ViewArticleContentAction.java.

How to upgrade ASUS Transformer TF300T ICS to Jelly Bean

1. Power off your tablet
2. Download the latest TF300T firmware (XX_epaduser_10_4_2_*_UpdateLauncher.zip) from Asus site based on your SKU location (eg. ww, US, etc): http://support.asus.com/Download.asp…300T&p=20&s=16
3. Right click and extract the downloaded .ZIP file (XX_epaduser_10_4_2_*_UpdateLauncher.zip)
4. Rename the extracted .ZIP to EP201_768_SDUPDATE.zip and copy it to a blank MicroSD card
5. Insert the MicroSD card in your tablet
6. Boot your tablet into Recovery by pressing and holding Volume Down AND Power for 5 seconds
7. A message will inform you that you have 5 seconds to enter Recovery; press Volume Up before the 5 seconds expire
8. At this point the device will go in recovery and should start updating your firmware

Information is from http://forum.xda-developers.com/showthread.php?t=1873635

 

A simple Location Based Grails Application tutorial with Google Maps API v3

This is an old tutorial I made in the past. Still useful. I will write a Liferay portlet based on this.

http://portal.sliderocket.com/AEAAQ/LocationBasedApp

Follow

Get every new post delivered to your Inbox.