moved the cookie setter before iframe's url is set
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@142216 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5947db3dd8
commit
a775694e67
|
@ -95,112 +95,105 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(CkanConnectorAccessPoint ckan) {
|
public void onSuccess(CkanConnectorAccessPoint ckan) {
|
||||||
|
|
||||||
|
if(ckan.isOutsideFromPortal()){
|
||||||
|
|
||||||
|
// the portlet is outside the portal and no user is logged
|
||||||
|
// in show only home and statistics
|
||||||
|
managementPanel.doNotShowUserRelatedInfo();
|
||||||
|
|
||||||
|
// set the cookie to hide the banner (expires 3 hours later)
|
||||||
|
Date now = new Date();
|
||||||
|
now.setHours(now.getHours() + 3);
|
||||||
|
Cookies.setCookie("ckan_hide_header", "true", now, ".d4science.org", "/", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the iframe url
|
||||||
ckanAccessPoint = ckan;
|
ckanAccessPoint = ckan;
|
||||||
instanceCkanFrame(ckan.buildURI());
|
instanceCkanFrame(ckan.buildURI());
|
||||||
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
|
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
|
||||||
|
|
||||||
// now perform the other requests
|
if(!ckan.isOutsideFromPortal()){
|
||||||
GCubeCkanDataCatalog.service.outsidePortal(new AsyncCallback<Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
|
|
||||||
if (result) {
|
// MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
|
||||||
// the portlet is outside the portal and no user is logged
|
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<RolesCkanGroupOrOrg>() {
|
||||||
// in show only home and statistics
|
|
||||||
managementPanel.doNotShowUserRelatedInfo();
|
|
||||||
|
|
||||||
// set the cookie to hide the banner
|
@Override
|
||||||
Date now = new Date();
|
public void onFailure(Throwable caught) {
|
||||||
now.setHours(now.getHours() + 3);
|
showEditInsertButtons(false);
|
||||||
Cookies.setCookie("ckan_hide_header", "true", now, ".d4science.org", "/", false);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
// MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
|
@Override
|
||||||
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<RolesCkanGroupOrOrg>() {
|
public void onSuccess(RolesCkanGroupOrOrg result) {
|
||||||
|
switch (result) {
|
||||||
@Override
|
case ADMIN:
|
||||||
public void onFailure(Throwable caught) {
|
showEditInsertButtons(true);
|
||||||
showEditInsertButtons(false);
|
break;
|
||||||
}
|
case EDITOR:
|
||||||
|
showEditInsertButtons(true);
|
||||||
@Override
|
break;
|
||||||
public void onSuccess(RolesCkanGroupOrOrg result) {
|
case MEMBER:
|
||||||
switch (result) {
|
showEditInsertButtons(false);
|
||||||
case ADMIN:
|
break;
|
||||||
showEditInsertButtons(true);
|
default:
|
||||||
break;
|
showEditInsertButtons(false);
|
||||||
case EDITOR:
|
break;
|
||||||
showEditInsertButtons(true);
|
}
|
||||||
break;
|
|
||||||
case MEMBER:
|
|
||||||
showEditInsertButtons(false);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
showEditInsertButtons(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// retrieve organizations
|
|
||||||
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<BeanUserInOrgGroupRole> result) {
|
|
||||||
ckanOrganizationsPanel.setOrganizations(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
// an error message will be displayed
|
|
||||||
ckanOrganizationsPanel.setOrganizations(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// retrieve groups
|
|
||||||
GCubeCkanDataCatalog.service.getCkanGroupsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<BeanUserInOrgGroupRole> result) {
|
|
||||||
ckanGroupsPanel.setGroups(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
ckanGroupsPanel.setGroups(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Just check if it is enabled.. then we need to listen for dom events coming
|
|
||||||
*/
|
|
||||||
GCubeCkanDataCatalog.service.isManageProductEnabled(new AsyncCallback<Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
isManageProductToShow = result;
|
|
||||||
managementPanel.showManageProductButton(isManageProductToShow);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
isManageProductToShow = false;
|
|
||||||
managementPanel.showManageProductButton(isManageProductToShow);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// retrieve organizations
|
||||||
|
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BeanUserInOrgGroupRole> result) {
|
||||||
|
ckanOrganizationsPanel.setOrganizations(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// an error message will be displayed
|
||||||
|
ckanOrganizationsPanel.setOrganizations(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// retrieve groups
|
||||||
|
GCubeCkanDataCatalog.service.getCkanGroupsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BeanUserInOrgGroupRole> result) {
|
||||||
|
ckanGroupsPanel.setGroups(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
ckanGroupsPanel.setGroups(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just check if it is enabled.. then we need to listen for dom events coming
|
||||||
|
*/
|
||||||
|
GCubeCkanDataCatalog.service.isManageProductEnabled(new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
isManageProductToShow = result;
|
||||||
|
managementPanel.showManageProductButton(isManageProductToShow);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
isManageProductToShow = false;
|
||||||
|
managementPanel.showManageProductButton(isManageProductToShow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
managementPanel.doNotShowUserRelatedInfo();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue