updated interaction with CkanContentModeratorWidget
This commit is contained in:
parent
f13fa8eb34
commit
83831c8344
|
@ -17,6 +17,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="gcube-ckan-datacatalog-2.2.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
@ -36,6 +37,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
@ -55,6 +57,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
@ -74,6 +77,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
|
||||
|
||||
|
@ -85,6 +89,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module archiveName="catalogue-util-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-util-library/catalogue-util-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
|
@ -110,6 +115,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="gcube-ckan-datacatalog"/>
|
||||
|
||||
|
||||
|
@ -129,6 +135,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
@ -148,6 +155,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
@ -167,4 +175,5 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
|
@ -242,7 +242,7 @@ public class CkanEventHandlerManager {
|
|||
|
||||
@Override
|
||||
public void onClickedManageProduct(ClickedCMSManageProductButtonEvent showManageProductWidgetEvent) {
|
||||
final CkanContentModeratorWidget cms = new CkanContentModeratorWidget(ItemStatus.PENDING, DISPLAY_FIELD.values(), DISPLAY_FIELD.NAME);
|
||||
final CkanContentModeratorWidget cms = new CkanContentModeratorWidget(ItemStatus.PENDING, DISPLAY_FIELD.values(), DISPLAY_FIELD.NAME, null);
|
||||
final Modal modal = new ExtModal(true, true);
|
||||
modal.setTitle("Manage Items");
|
||||
modal.setWidth(1200);
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGro
|
|||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductResponse;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherServiceAsync;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorCheckConfig;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
|
@ -26,6 +27,7 @@ import com.google.gwt.json.client.JSONObject;
|
|||
import com.google.gwt.json.client.JSONParser;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
import com.google.gwt.json.client.JSONValue;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Cookies;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
@ -222,8 +224,44 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
}
|
||||
|
||||
final CkanContentModeratorCheckConfig checkConfig = new CkanContentModeratorCheckConfig();
|
||||
|
||||
final Command whenDone = new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
GWT.log("onConfigurationLoaded executed");
|
||||
boolean isContentModerationEnabled = false;
|
||||
boolean isModeratorRoleAssingned = false;
|
||||
|
||||
try {
|
||||
isContentModerationEnabled = checkConfig.isContentModerationEnabled();
|
||||
isModeratorRoleAssingned = checkConfig.isModeratorRoleAssigned();
|
||||
} catch (Exception e) {
|
||||
GWT.log("Command - Check configs error: "+e.getMessage());
|
||||
}
|
||||
|
||||
GWT.log("Moderation is enabled? " + isContentModerationEnabled);
|
||||
GWT.log("Moderator role is assigned? " + isModeratorRoleAssingned);
|
||||
|
||||
if (isContentModerationEnabled && isModeratorRoleAssingned) {
|
||||
GWT.log("The moderator role is assigned to user,and the moderation is enabled in the context");
|
||||
managementPanel.showManageCMSProductsButton(isContentModerationEnabled);
|
||||
managementPanel.enableManageCMSProductsButton(isContentModerationEnabled);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
checkConfig.checkConfigs(whenDone);
|
||||
} catch (Exception e) {
|
||||
GWT.log("Check configs error: "+e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Just check if it is enabled.. then we need to listen for dom events coming
|
||||
* (GRSF) Just check if it is enabled.. then we need to listen for dom events
|
||||
* coming
|
||||
*/
|
||||
GCubeCkanDataCatalog.service
|
||||
.isManageProductEnabled(new AsyncCallback<ManageProductResponse>() {
|
||||
|
@ -243,26 +281,6 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
GCubeCkanDataCatalog.service.checkModerationEnabled(reloadCatServiceConfig,
|
||||
new AsyncCallback<ManageProductResponse>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
managementPanel.showManageCMSProductsButton(
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ManageProductResponse moderationResponse) {
|
||||
reloadCatServiceConfig = false;
|
||||
//here the moderationProductResponse is not null.
|
||||
moderationProductResponse = moderationResponse;
|
||||
managementPanel.showManageCMSProductsButton(moderationProductResponse.isManageEnabled());
|
||||
managementPanel.enableManageCMSProductsButton(moderationProductResponse.isManageEnabled());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -292,7 +310,6 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
// listen for DOM messages
|
||||
listenForPostMessage();
|
||||
|
||||
|
||||
CkanToZenodoPublisherServiceAsync.Util.getInstance().checkZenodoEnvironment(new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
|
@ -509,7 +526,8 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
|
||||
managementPanel.enableManageGRSFProductButton(
|
||||
productId != null && !productId.isEmpty() && manageProductResponse.isManageEnabled());
|
||||
//managementPanel.enableManageCMSProductsButton(productId != null && !productId.isEmpty() && moderationProductResponse.isManageEnabled());
|
||||
// managementPanel.enableManageCMSProductsButton(productId != null &&
|
||||
// !productId.isEmpty() && moderationProductResponse.isManageEnabled());
|
||||
}
|
||||
} else {
|
||||
// The data hasn't been sent from your site!
|
||||
|
|
|
@ -333,10 +333,10 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
// String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
||||
//
|
||||
// CkanConnectorAccessPoint ckanAP = SessionUtil.getCkanAccessPoint(this.getThreadLocalRequest().getSession(), scopePerCurrentUrl);
|
||||
// logger.info("Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue());
|
||||
// LOG.info("Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue());
|
||||
//
|
||||
// String ckanConnectorLogut = getServletContext().getInitParameter(CKANCONNECTORLOGOUT);
|
||||
// logger.debug(CKANCONNECTORLOGOUT + " is: "+ckanConnectorLogut);
|
||||
// LOG.debug(CKANCONNECTORLOGOUT + " is: "+ckanConnectorLogut);
|
||||
//
|
||||
// CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint(ckanAP.getBaseUrl(), ckanConnectorLogut);
|
||||
// ckan.addGubeToken(ckanAP.getGcubeTokenValue());
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SessionUtil {
|
|||
public static final String CKAN_END_POINT = "CKAN_END_POINT";
|
||||
public static final String CKAN_ACCESS_POINT = "CKAN_ACCESS_POINT";
|
||||
public static final String GCUBE_REQUEST_URL = "gcube-request-url";
|
||||
//private static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
||||
//private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
|
||||
private static final Log logger = LogFactoryUtil.getLog(SessionUtil.class);
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.liferay.portal.kernel.log.LogFactoryUtil;
|
|||
*/
|
||||
public class UserUtil {
|
||||
|
||||
//private static Logger logger = LoggerFactory.getLogger(UserUtil.class);
|
||||
//private static Logger LOG = LoggerFactory.getLogger(UserUtil.class);
|
||||
private static final Log logger = LogFactoryUtil.getLog(UserUtil.class);
|
||||
|
||||
private static final String ADD_USER_TO_OTHER_ORG_KEY = "ADD_USER_TO_OTHER_ORG_KEY";
|
||||
|
|
Loading…
Reference in New Issue