Added partial support for Tab paging and Filter by Organisation and Category
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@158308 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
59d6b2996d
commit
f923e4cd90
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/join-vre-3.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/join-vre-3.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/join-vre-3.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/join-vre-3.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -39,5 +39,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/join-vre-3.4.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/join-vre-3.5.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>join-vre</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>3.4.0-SNAPSHOT</version>
|
||||
<version>3.5.0-SNAPSHOT</version>
|
||||
<name>gCube Join VRE Portlet</name>
|
||||
<description>Display the available VRE to Join</description>
|
||||
<scm>
|
||||
|
|
|
@ -17,8 +17,20 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
@RemoteServiceRelativePath("JoinService")
|
||||
public interface JoinService extends RemoteService {
|
||||
|
||||
Boolean isTabbedPanel();
|
||||
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> getVREs();
|
||||
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> getPortalSitesMappedToVRE(String tabName);
|
||||
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> getVREsByOrganisation(String organisationName);
|
||||
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> getVREsByCategory(String categoryName);
|
||||
|
||||
ArrayList<String> getAllOrganisations();
|
||||
|
||||
ArrayList<String> getAllCategories();
|
||||
|
||||
String joinVRE(Long vreId);
|
||||
|
||||
VRE getSelectedVRE(Long vreId);
|
||||
|
|
|
@ -31,4 +31,17 @@ public interface JoinServiceAsync {
|
|||
void readInvite(String inviteId, long siteId, AsyncCallback<UserInfo> callback);
|
||||
|
||||
void getTermsOfUse(long siteId, AsyncCallback<String> callback);
|
||||
|
||||
void isTabbedPanel(AsyncCallback<Boolean> callback);
|
||||
|
||||
void getPortalSitesMappedToVRE(String tabName, AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>> callback);
|
||||
|
||||
void getVREsByOrganisation(String organisationName,
|
||||
AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>> callback);
|
||||
|
||||
void getAllOrganisations(AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
void getAllCategories(AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
void getVREsByCategory(String categoryName, AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>> callback);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
package org.gcube.portlets.user.joinvre.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.gcube.portlets.user.joinvre.client.responsive.ResponsivePanel;
|
||||
import org.gcube.portlets.user.joinvre.client.ui.LoadingPanel;
|
||||
import org.gcube.portlets.user.joinvre.shared.VRE;
|
||||
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.DropdownTab;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.Window.Location;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
/**
|
||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||
|
@ -19,8 +29,20 @@ import com.google.gwt.user.client.ui.RootPanel;
|
|||
public class JoinVRE implements EntryPoint {
|
||||
Logger logger = Logger.getLogger(JoinVRE.class.getName());
|
||||
public static final String GET_OID_PARAMETER = "siteId";
|
||||
public static final String ORGANISATIONS_LABEL = "Organisations";
|
||||
public static final String CATEGORIES_LABEL = "Categories";
|
||||
|
||||
private final JoinServiceAsync joinService = GWT.create(JoinService.class);
|
||||
|
||||
private VerticalPanel mainPanel = new VerticalPanel();
|
||||
|
||||
private TabPanel mainTabPanel = new TabPanel(Tabs.ABOVE);
|
||||
private Tab productsPane = new Tab();
|
||||
private Tab portfolioPane = new Tab();
|
||||
|
||||
private boolean portfolioLoaded = false;
|
||||
|
||||
|
||||
public void onModuleLoad() {
|
||||
checkIsReferral();
|
||||
}
|
||||
|
@ -79,10 +101,88 @@ public class JoinVRE implements EntryPoint {
|
|||
}
|
||||
}
|
||||
private ResponsivePanel displayVREs() {
|
||||
ResponsivePanel toReturn = new ResponsivePanel();
|
||||
RootPanel.get("JoinVRE-Container").add(toReturn);
|
||||
return toReturn;
|
||||
final ResponsivePanel toReturn = new ResponsivePanel();
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.add(toReturn);
|
||||
joinService.isTabbedPanel(new AsyncCallback<Boolean>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if (result) {
|
||||
GWT.log("TabbedPanel");
|
||||
showTabs(toReturn);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
RootPanel.get("JoinVRE-Container").add(mainPanel);
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
|
||||
private void showTabs(ResponsivePanel rp) {
|
||||
|
||||
productsPane.setHeading("Products");
|
||||
productsPane.add(rp);
|
||||
productsPane.setActive(true);
|
||||
|
||||
portfolioPane.setHeading("Portfolio");
|
||||
portfolioPane.add(new LoadingPanel());
|
||||
|
||||
mainTabPanel.add(productsPane);
|
||||
mainTabPanel.add(portfolioPane);
|
||||
|
||||
mainTabPanel.selectTab(0);
|
||||
mainPanel.clear();
|
||||
mainPanel.add(mainTabPanel);
|
||||
|
||||
addCategoriesTab(mainTabPanel);
|
||||
|
||||
portfolioPane.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (!portfolioLoaded) {
|
||||
final ResponsivePanel rpPort = new ResponsivePanel("Portfolio");
|
||||
portfolioPane.clear();
|
||||
portfolioPane.add(rpPort);
|
||||
portfolioLoaded = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addCategoriesTab(final TabPanel mainTabPanel) {
|
||||
joinService.getAllCategories(new AsyncCallback<ArrayList<String>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(ArrayList<String> result) {
|
||||
if (result.size() > 0) {
|
||||
final DropdownTab dropdownCategoriesTab = new DropdownTab(CATEGORIES_LABEL);
|
||||
for (String catName : result) {
|
||||
final String categoryName = catName;
|
||||
|
||||
final Tab tab2Add = new Tab();
|
||||
tab2Add.setHeading(categoryName);
|
||||
dropdownCategoriesTab.add(tab2Add);
|
||||
|
||||
tab2Add.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
tab2Add.clear();
|
||||
tab2Add.add(new ResponsivePanel(new VRECategory(1L, categoryName, "")));
|
||||
}
|
||||
});
|
||||
}
|
||||
mainTabPanel.add(dropdownCategoriesTab);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* check if it has to show just one feed
|
||||
* @return
|
||||
|
|
|
@ -24,7 +24,6 @@ public class ResponsivePanel extends Composite {
|
|||
|
||||
private final JoinServiceAsync joinService = GWT.create(JoinService.class);
|
||||
public static final String loading = GWT.getModuleBaseURL() + "../images/vre-loader.gif";
|
||||
|
||||
private Row mainPanel = new Row();
|
||||
private ArrayList<VreThumbnail> myThumbnails = new ArrayList<VreThumbnail>();
|
||||
public ResponsivePanel() {
|
||||
|
@ -32,6 +31,47 @@ public class ResponsivePanel extends Composite {
|
|||
joinService.getVREs(new AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>>() {
|
||||
@Override
|
||||
public void onSuccess(LinkedHashMap<VRECategory, ArrayList<VRE>> categories) {
|
||||
populatePanel(categories);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
showError("Sorry, looks like something is broken with the server connection");
|
||||
}
|
||||
});
|
||||
initWidget(mainPanel);
|
||||
}
|
||||
|
||||
public ResponsivePanel(String tabName) {
|
||||
GWT.log("ResponsivePanel()");
|
||||
joinService.getPortalSitesMappedToVRE(tabName, new AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>>() {
|
||||
@Override
|
||||
public void onSuccess(LinkedHashMap<VRECategory, ArrayList<VRE>> categories) {
|
||||
populatePanel(categories);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
showError("Sorry, looks like something is broken with the server connection");
|
||||
}
|
||||
});
|
||||
initWidget(mainPanel);
|
||||
}
|
||||
|
||||
public ResponsivePanel(VRECategory category) {
|
||||
GWT.log("ResponsivePanel()");
|
||||
joinService.getVREsByCategory(category.getName(), new AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>>() {
|
||||
@Override
|
||||
public void onSuccess(LinkedHashMap<VRECategory, ArrayList<VRE>> categories) {
|
||||
populatePanel(categories);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
showError("Sorry, looks like something is broken with the server connection");
|
||||
}
|
||||
});
|
||||
initWidget(mainPanel);
|
||||
}
|
||||
|
||||
private void populatePanel(LinkedHashMap<VRECategory, ArrayList<VRE>> categories) {
|
||||
mainPanel.clear();
|
||||
if (categories == null || categories.isEmpty()) {
|
||||
showError("Ops, something went wrong");
|
||||
|
@ -45,22 +85,14 @@ public class ResponsivePanel extends Composite {
|
|||
header.setSubtext("");
|
||||
else
|
||||
header.setSubtext(cat.getDescription());
|
||||
if (categories.get(cat).size() > 0) {
|
||||
mainPanel.add(header);
|
||||
mainPanel.add(getVREThumbnails(categories, cat));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
showError("Sorry, looks like something is broken with the server connection");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
initWidget(mainPanel);
|
||||
}
|
||||
|
||||
private Thumbnails getVREThumbnails(LinkedHashMap<VRECategory, ArrayList<VRE>> categories, VRECategory category) {
|
||||
ArrayList<VRE> vres = categories.get(category);
|
||||
|
@ -105,6 +137,7 @@ public class ResponsivePanel extends Composite {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.gcube.portlets.user.joinvre.client.ui;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class LoadingPanel extends Composite {
|
||||
|
||||
private static LoadingPanelUiBinder uiBinder = GWT.create(LoadingPanelUiBinder.class);
|
||||
|
||||
interface LoadingPanelUiBinder extends UiBinder<Widget, LoadingPanel> {
|
||||
}
|
||||
|
||||
public LoadingPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.center {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel styleName="{style.center}" >
|
||||
<b:Paragraph>Loading, just a moment ...</b:Paragraph>
|
||||
<b:Icon type="ROTATE_RIGHT" size="TWO_TIMES" spin="true" />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -60,6 +60,17 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
private static Log _log = LogFactoryUtil.getLog(JoinServiceImpl.class);
|
||||
private static DatabookStore store;
|
||||
public static final String PREFIX_PUBLIC_URL = "/web";
|
||||
//tell whether the
|
||||
public static final String TABBED_LAYOUT_ATTRIBUTE = "TabbedLayout";
|
||||
public static final String TAB_NAMES_ATTRIBUTE = "TabName";
|
||||
|
||||
public static final String ALLVRES_SESSION_ATTRIBUTE = "ALLVRES_SESSION";
|
||||
|
||||
private static GroupManager groupsManager;
|
||||
|
||||
public void init() {
|
||||
groupsManager = new LiferayGroupManager();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return true if you're running into the portal, false if in development
|
||||
|
@ -110,7 +121,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
|
||||
TermsOfUse tou = new TermsOfUseImpl();
|
||||
try {
|
||||
long groupId = new LiferayGroupManager().getGroup(siteId).getGroupId();
|
||||
long groupId = groupsManager.getGroup(siteId).getGroupId();
|
||||
ToU terms = tou.getToUGroup(groupId);
|
||||
return terms.getContent();
|
||||
}
|
||||
|
@ -123,28 +134,172 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
return null;
|
||||
}
|
||||
}
|
||||
public Boolean isTabbedPanel() {
|
||||
if (isWithinPortal()) {
|
||||
_log.info("check if isTabbedPanel ");
|
||||
Object tabbedLayoutObj = null;
|
||||
try {
|
||||
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
||||
tabbedLayoutObj = groupsManager.readCustomAttr(currentSiteGroupId, TABBED_LAYOUT_ATTRIBUTE);
|
||||
|
||||
getTabNames();
|
||||
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
Boolean isTabbedLayout = false;
|
||||
if (tabbedLayoutObj != null) {
|
||||
isTabbedLayout = (Boolean) tabbedLayoutObj;
|
||||
}
|
||||
return isTabbedLayout;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param session the Asl Session
|
||||
* @param withinPortal true when is on Liferay portal
|
||||
* @return the users belonging to the current organization (scope)
|
||||
* @return the list containing the names of the Tabs to show in the correct order.
|
||||
* @throws Exception
|
||||
*/
|
||||
private List<String> getTabNames() throws Exception {
|
||||
List<String> toReturn = new ArrayList<String>();
|
||||
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
||||
Group site = GroupLocalServiceUtil.getGroup(currentSiteGroupId);
|
||||
String[] values = (String[]) site.getExpandoBridge().getAttributeDefault(TAB_NAMES_ATTRIBUTE);
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
toReturn.add(values[i]);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
//first method called to get VREs and their categories
|
||||
@Override
|
||||
public LinkedHashMap<VRECategory, ArrayList<VRE>> getVREs() {
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> toReturn = new LinkedHashMap<VRECategory, ArrayList<VRE>>();
|
||||
|
||||
try {
|
||||
if (isWithinPortal()) {
|
||||
toReturn = getPortalSitesMappedToVRE();
|
||||
if (isTabbedPanel()) {
|
||||
String firstTabName = getTabNames().get(0);
|
||||
_log.debug("\n\n ****isTabbedLayout isTabbedLayout, first TabName= "+firstTabName);
|
||||
return getPortalSitesMappedToVRE(firstTabName);
|
||||
} else {
|
||||
toReturn = getFakePortalVREs(); }
|
||||
toReturn = getPortalSitesMappedToVRE();
|
||||
setVREsInSession(toReturn);
|
||||
}
|
||||
} else {
|
||||
toReturn = getFakePortalVREs();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_log.error("Error getting VREs", e);
|
||||
}
|
||||
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tabName
|
||||
* @return the list of VREs given a tabName
|
||||
*/
|
||||
@Override
|
||||
public LinkedHashMap<VRECategory, ArrayList<VRE>> getPortalSitesMappedToVRE(String tabName) {
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> tabVREs = new LinkedHashMap<VRECategory, ArrayList<VRE>>();
|
||||
try {
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> allVREs = getPortalSitesMappedToVRE();
|
||||
setVREsInSession(allVREs);
|
||||
|
||||
for (VRECategory cat : allVREs.keySet()) {
|
||||
ArrayList<VRE> toAdd = new ArrayList<VRE>();
|
||||
tabVREs.put(cat, toAdd);
|
||||
for (VRE vre : allVREs.get(cat)) {
|
||||
String[] vreTabNames = (String[]) groupsManager.readCustomAttr(vre.getId(), TAB_NAMES_ATTRIBUTE);
|
||||
String vreTabName = vreTabNames[0];
|
||||
if (tabName.equals(vreTabName)) {
|
||||
toAdd.add(vre);
|
||||
_log.debug("Added " + vre.getName() + " as it belongs to " + vreTabName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
_log.error("Error getting VREs", e);
|
||||
}
|
||||
return tabVREs;
|
||||
}
|
||||
/**
|
||||
* @param organisationName
|
||||
* @return the list of VREs given a organisation Name
|
||||
*/
|
||||
@Override
|
||||
public LinkedHashMap<VRECategory, ArrayList<VRE>> getVREsByOrganisation(String organisationName) {
|
||||
|
||||
//TODO:
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> toReturn = new LinkedHashMap<VRECategory, ArrayList<VRE>>();
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param categoryName
|
||||
* @return the list of VREs given a category Name
|
||||
*/
|
||||
@Override
|
||||
public LinkedHashMap<VRECategory, ArrayList<VRE>> getVREsByCategory(String categoryName) {
|
||||
_log.debug("getVREsByCategory: " + categoryName);
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> toReturn = new LinkedHashMap<VRECategory, ArrayList<VRE>>();
|
||||
try {
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> temp = null;
|
||||
if (getVREsFromSession() == null) {
|
||||
temp = getPortalSitesMappedToVRE();
|
||||
setVREsInSession(temp);
|
||||
_log.debug("getVREsByCategory looking in session not successful, asking to DB ... " + categoryName);
|
||||
} else {
|
||||
temp = getVREsFromSession();
|
||||
_log.debug("getVREsByCategory looking in session " + categoryName);
|
||||
}
|
||||
for (VRECategory cat : temp.keySet()) {
|
||||
if (cat.getName().equals(categoryName)) {
|
||||
toReturn.put(cat, temp.get(cat));
|
||||
_log.debug("getVREsByCategory foudn match, returning " + cat.getName());
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getAllOrganisations() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getAllCategories() {
|
||||
ArrayList<String> toReturn = new ArrayList<>();
|
||||
if (isWithinPortal()) {
|
||||
try {
|
||||
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
||||
List<VirtualGroup> currentSiteVGroups = groupsManager.getVirtualGroups(currentSiteGroupId);
|
||||
|
||||
for (VirtualGroup vg : currentSiteVGroups) {
|
||||
toReturn.add(vg.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> fakes = getFakePortalVREs();
|
||||
for (VRECategory cat : fakes.keySet()) {
|
||||
toReturn.add(cat.getName());
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the Virtual groups with their VREs in the order estabilished in the LR Control Panel
|
||||
|
@ -152,11 +307,10 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
* @throws PortalException
|
||||
*/
|
||||
public LinkedHashMap<VRECategory, ArrayList<VRE>> getPortalSitesMappedToVRE() throws Exception {
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
LinkedHashMap<VRECategory, ArrayList<VRE>> toReturn = new LinkedHashMap<VRECategory, ArrayList<VRE>>();
|
||||
|
||||
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
||||
List<VirtualGroup> currentSiteVGroups = gm.getVirtualGroups(currentSiteGroupId);
|
||||
List<VirtualGroup> currentSiteVGroups = groupsManager.getVirtualGroups(currentSiteGroupId);
|
||||
|
||||
for (VirtualGroup vg : currentSiteVGroups) {
|
||||
ArrayList<VRE> toCreate = new ArrayList<VRE>();
|
||||
|
@ -164,7 +318,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
toReturn.put(cat, toCreate);
|
||||
}
|
||||
|
||||
GCubeGroup rootGroupVO = gm.getRootVO();
|
||||
GCubeGroup rootGroupVO = groupsManager.getRootVO();
|
||||
|
||||
try {
|
||||
_log.debug("root: " + rootGroupVO.getGroupName() );
|
||||
|
@ -177,7 +331,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
List<GCubeGroup> currUserGroups = new ArrayList<GCubeGroup>();
|
||||
GCubeUser currUser = pContext.getCurrentUser(getThreadLocalRequest());
|
||||
if (currUser != null) {
|
||||
currUserGroups = gm.listGroupsByUser(currUser.getUserId());
|
||||
currUserGroups = groupsManager.listGroupsByUser(currUser.getUserId());
|
||||
}
|
||||
|
||||
//for each root sub organizations (VO)
|
||||
|
@ -188,11 +342,11 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
String vreDescription = vreSite.getDescription();
|
||||
|
||||
long logoId = vreSite.getLogoId();
|
||||
String vreLogoURL = gm.getGroupLogoURL(logoId);
|
||||
String groupName = gm.getInfrastructureScope(vreSite.getGroupId());
|
||||
String vreLogoURL = groupsManager.getGroupLogoURL(logoId);
|
||||
String groupName = groupsManager.getInfrastructureScope(vreSite.getGroupId());
|
||||
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreSite.getFriendlyURL();
|
||||
|
||||
List<VirtualGroup> vreGroups = gm.getVirtualGroups(vreID);
|
||||
List<VirtualGroup> vreGroups = groupsManager.getVirtualGroups(vreID);
|
||||
for (VirtualGroup vreGroup : vreGroups) {
|
||||
for (VRECategory vre : toReturn.keySet()) {
|
||||
if (vre.getName().compareTo(vreGroup.getName())==0) {
|
||||
|
@ -284,6 +438,9 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
vres.add(new VRE(1, "devVRE7", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
|
||||
vres.add(new VRE(2, "devmod76", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING));
|
||||
toReturn.put(devsecCategory, vres);
|
||||
|
||||
setVREsInSession(toReturn);
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
@ -491,4 +648,16 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private LinkedHashMap<VRECategory, ArrayList<VRE>> getVREsFromSession() {
|
||||
if (getThreadLocalRequest().getSession().getAttribute(ALLVRES_SESSION_ATTRIBUTE) == null)
|
||||
return null;
|
||||
else
|
||||
return (LinkedHashMap<VRECategory, ArrayList<VRE>>) getThreadLocalRequest().getSession().getAttribute(ALLVRES_SESSION_ATTRIBUTE);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setVREsInSession(LinkedHashMap<VRECategory, ArrayList<VRE>> allVREs) {
|
||||
getThreadLocalRequest().getSession().setAttribute(ALLVRES_SESSION_ATTRIBUTE, allVREs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='explore'>
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<inherits name="com.google.gwt.logging.Logging" />
|
||||
|
||||
<inherits name='com.google.gwt.activity.Activity' />
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
<set-property name="user.agent" value="gecko1_8" />
|
||||
|
||||
<!-- only build for Chrome -->
|
||||
<set-property name="user.agent" value="safari" />
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.user.joinvre.client.JoinVRE' />
|
||||
|
||||
<set-property name="gwt.logging.enabled" value="TRUE" />
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
|
|
@ -2,6 +2,15 @@ body {
|
|||
border: 5px solid white;
|
||||
}
|
||||
|
||||
ul.dropdown-menu > li {
|
||||
font-size: 1.1em !important;
|
||||
}
|
||||
|
||||
.nav-tabs > li > a {
|
||||
font-size: 2em !important;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 800px) {
|
||||
.aui .row-fluid .span3 {
|
||||
width: 19% !important;
|
||||
|
|
Loading…
Reference in New Issue