Skip to content

Commit

Permalink
LPS-30665 Apply to opensocial
Browse files Browse the repository at this point in the history
  • Loading branch information
shinnlok authored and brianchandotcom committed Oct 30, 2012
1 parent 4f99e7a commit 94bab8a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
Expand Up @@ -15,9 +15,14 @@
package com.liferay.opensocial.servlet;

import com.liferay.opensocial.model.Gadget;
import com.liferay.opensocial.service.ClpSerializer;
import com.liferay.opensocial.service.GadgetLocalServiceUtil;
import com.liferay.opensocial.shindig.util.ShindigUtil;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.messaging.DestinationNames;
import com.liferay.portal.kernel.messaging.HotDeployMessageListener;
import com.liferay.portal.kernel.messaging.MessageBusUtil;
import com.liferay.portal.kernel.messaging.MessageListener;
import com.liferay.portal.kernel.util.BasePortalLifecycle;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Company;
Expand Down Expand Up @@ -77,23 +82,38 @@ protected void checkExpando() throws Exception {

@Override
protected void doPortalDestroy() throws Exception {
MessageBusUtil.unregisterMessageListener(
DestinationNames.HOT_DEPLOY, _hotDeployMessageListener);

GadgetLocalServiceUtil.destroyGadgets();
}

@Override
protected void doPortalInit() throws Exception {
verifyGadgets();
_hotDeployMessageListener = new HotDeployMessageListener(
ClpSerializer.getServletContextName()) {

List<Company> companies = CompanyLocalServiceUtil.getCompanies();
@Override
protected void onDeploy() throws Exception {
verifyGadgets();

for (Company company : companies) {
PortletLocalServiceUtil.addPortletCategory(
company.getCompanyId(), _GADGETS_CATEGORY);
}
List<Company> companies =
CompanyLocalServiceUtil.getCompanies();

for (Company company : companies) {
PortletLocalServiceUtil.addPortletCategory(
company.getCompanyId(), _GADGETS_CATEGORY);
}

GadgetLocalServiceUtil.initGadgets();
GadgetLocalServiceUtil.initGadgets();

checkExpando();
checkExpando();
}

};

MessageBusUtil.registerMessageListener(
DestinationNames.HOT_DEPLOY, _hotDeployMessageListener);
}

protected void verifyGadgets() throws Exception {
Expand All @@ -113,4 +133,6 @@ protected void verifyGadgets() throws Exception {

private static final String _GADGETS_CATEGORY = "category.gadgets";

private MessageListener _hotDeployMessageListener;

}
4 changes: 2 additions & 2 deletions portlets/opensocial-portlet/docroot/editor/js/main.js
@@ -1,6 +1,6 @@
AUI.add(
'opensocial-editor',
function (A) {
function(A) {
var Lang = A.Lang;

var ABSOLUTE = 'absolute';
Expand Down Expand Up @@ -425,7 +425,7 @@ AUI.add(
var folderNode = lastSelected.get(PARENT_NODE);

folderNode.select();
}
}
}
else if (node && !node.isSelected()) {
var lastSelected = instance._treeViewEditor.get(LAST_SELECTED);
Expand Down
2 changes: 1 addition & 1 deletion portlets/opensocial-portlet/docroot/gadget/js/main.js
Expand Up @@ -70,7 +70,7 @@ AUI.add(
return 'ALL';
}
}
},
},
moduleId: {
valueFn: function() {
return Gadget._id++;
Expand Down

0 comments on commit 94bab8a

Please sign in to comment.