give high priority to path if it is already set when the user lands on the catalogue
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@159006 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
29a6b281b2
commit
533f73b836
|
@ -83,5 +83,5 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Check if the management panels but publish/share link must be removed
|
* Check if the management panels but publish/share link must be removed
|
||||||
*/
|
*/
|
||||||
boolean isViewPerVREEnabled();
|
String isViewPerVREEnabled();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,5 +85,5 @@ public interface GcubeCkanDataCatalogServiceAsync {
|
||||||
*/
|
*/
|
||||||
void isManageProductEnabled(AsyncCallback<Boolean> callback);
|
void isManageProductEnabled(AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
void isViewPerVREEnabled(AsyncCallback<Boolean> callback);
|
void isViewPerVREEnabled(AsyncCallback<String> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,14 +151,17 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
});
|
});
|
||||||
|
|
||||||
// check if management buttons need to be removed
|
// check if management buttons need to be removed
|
||||||
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<Boolean>() {
|
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(String result) {
|
||||||
|
|
||||||
if(result){
|
if(result != null && !result.isEmpty()){
|
||||||
// hide all management buttons
|
// hide all management buttons
|
||||||
managementPanel.removeGenericManagementButtons();
|
managementPanel.removeGenericManagementButtons();
|
||||||
|
|
||||||
|
// set real relative path
|
||||||
|
ckanAccessPoint.addPathInfo(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -166,7 +169,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
// ?
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,8 +2,6 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server;
|
||||||
|
|
||||||
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -93,13 +91,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pathInfoParameter == null || pathInfoParameter.isEmpty()){
|
if(pathInfoParameter == null || pathInfoParameter.isEmpty()){
|
||||||
boolean viewEnabled = isViewPerVREEnabled();
|
pathInfoParameter = isViewPerVREEnabled();
|
||||||
if(viewEnabled){
|
|
||||||
GroupManager gm = new LiferayGroupManager();
|
|
||||||
String groupName = gm.getGroup(gm.getGroupIdFromInfrastructureScope(scopePerCurrentUrl)).getGroupName().toLowerCase();
|
|
||||||
pathInfoParameter = "/organization_vre/" + groupName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CkanConnectorAccessPoint ckAP = getCkanConnectorAccessPoint(pathInfoParameter, queryStringParameters, scopePerCurrentUrl);
|
CkanConnectorAccessPoint ckAP = getCkanConnectorAccessPoint(pathInfoParameter, queryStringParameters, scopePerCurrentUrl);
|
||||||
|
@ -556,20 +548,23 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isViewPerVREEnabled(){
|
public String isViewPerVREEnabled(){
|
||||||
|
|
||||||
boolean enabled = false;
|
String toReturn = null;
|
||||||
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
|
boolean enabled = false;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
GroupManager gm = new LiferayGroupManager();
|
GroupManager gm = new LiferayGroupManager();
|
||||||
enabled = (boolean) gm.readCustomAttr(gm.getGroupIdFromInfrastructureScope(scopePerCurrentUrl), VIEW_PER_ORGANIZATION_LIFERAY_CUSTOM_FIELD);
|
enabled = (boolean) gm.readCustomAttr(gm.getGroupIdFromInfrastructureScope(scopePerCurrentUrl), VIEW_PER_ORGANIZATION_LIFERAY_CUSTOM_FIELD);
|
||||||
logger.debug("Read value for " + VIEW_PER_ORGANIZATION_LIFERAY_CUSTOM_FIELD + " is " + enabled);
|
if(enabled){
|
||||||
|
String groupName = gm.getGroup(gm.getGroupIdFromInfrastructureScope(scopePerCurrentUrl)).getGroupName().toLowerCase();
|
||||||
|
toReturn = "/organization_vre/" + groupName;
|
||||||
|
}
|
||||||
|
logger.debug("Read value for " + VIEW_PER_ORGANIZATION_LIFERAY_CUSTOM_FIELD + " is " + enabled + " and path is " + toReturn);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("Failed to parse custom field value", e);
|
logger.error("Failed to parse custom field value", e);
|
||||||
}
|
}
|
||||||
return enabled;
|
return toReturn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue