Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/handlers/utils/RolesUtils.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/handlers/utils/RolesUtils.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/handlers/utils/RolesUtils.java	(revision 60517)
@@ -20,7 +20,7 @@
     }
 
     public String getEmail() {
-        return authorizationService.getAaiId();
+        return authorizationService.getEmail();
     }
 
     public String getAaiId() {
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/PageHelpContentDAO.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/PageHelpContentDAO.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/PageHelpContentDAO.java	(revision 60517)
@@ -19,6 +19,7 @@
     List<PageHelpContent> findByPlacementAndIsPriorToOrderByOrderAsc(String position, boolean isPriorTo);
     List<PageHelpContent> findByIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(boolean isActive, boolean isPriorTo);
     List<PageHelpContent> findByPortalOrderByPlacementAscOrderAsc(String portalId);
+    List<PageHelpContent> findByPortalAndPageOrderByPlacementAscOrderAsc(String portalId, String page);
     List<PageHelpContent> findByPlacementOrderByOrderAsc(String postion);
     List<PageHelpContent> findByIsActiveOrderByPlacementAscOrderAsc(boolean isActive);
     List<PageHelpContent> findByIsPriorToOrderByPlacementAscOrderAsc(boolean isPriorTo);
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/DivHelpContentDAO.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/DivHelpContentDAO.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/DivHelpContentDAO.java	(revision 60517)
@@ -14,6 +14,7 @@
     List<DivHelpContent> findByPortalAndIsActive(String portalId, boolean isActive);
     List<DivHelpContent> findByDivIdAndIsActive(String divId, boolean isActive);
     List<DivHelpContent> findByPortalAndDivIdAndIsActive(String portalId, String divId, boolean isActive);
+    List<DivHelpContent> findByPortalAndPage(String portalId, String page);
 
     DivHelpContent findById(String Id);
 
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBDivHelpContentDAO.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBDivHelpContentDAO.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBDivHelpContentDAO.java	(revision 60517)
@@ -17,6 +17,7 @@
     List<DivHelpContent> findByPortalAndIsActive(String portalId, boolean isActive);
     List<DivHelpContent> findByDivIdAndIsActive(String divId, boolean isActive);
     List<DivHelpContent> findByPortalAndDivIdAndIsActive(String portalId, String divId, boolean isActive);
+    List<DivHelpContent> findByPortalAndPage(String portalId, String page);
 
     DivHelpContent findById(String Id);
 
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBPageHelpContentDAO.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBPageHelpContentDAO.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/dao/MongoDBDAOs/MongoDBPageHelpContentDAO.java	(revision 60517)
@@ -21,6 +21,7 @@
     List<PageHelpContent> findByPlacementAndIsActiveOrderByOrderAsc(String position, boolean isActive);
     List<PageHelpContent> findByPlacementAndIsPriorToOrderByOrderAsc(String position, boolean isPriorTo);
     List<PageHelpContent> findByIsActiveAndIsPriorToOrderByPlacementAscOrderAsc(boolean isActive, boolean isPriorTo);
+    List<PageHelpContent> findByPortalAndPageOrderByPlacementAscOrderAsc(String portalId, String page);
     List<PageHelpContent> findByPortalOrderByPlacementAscOrderAsc(String portalId);
     List<PageHelpContent> findByPlacementOrderByOrderAsc(String postion);
     List<PageHelpContent> findByIsActiveOrderByPlacementAscOrderAsc(boolean isActive);
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/PageHelpContentService.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/PageHelpContentService.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/PageHelpContentService.java	(revision 60517)
@@ -89,6 +89,30 @@
         return pageHelpContentResponses;
     }
 
+    public List<PageHelpContent> getPageHelpContentsBasic(String pid, String portalType, String pageId) {
+        List<PageHelpContent> pageHelpContents = null;
+
+        Portal _portal = null;
+        String portalId = null;
+        if(pid != null) {
+            _portal = portalService.getPortal(pid);
+            portalService.checkPortalInfo(pid, portalType, _portal, pid, "pid");
+            if(_portal != null) {
+                portalId = _portal.getId();
+            }
+        }
+
+        if(pid != null && pageId != null) {
+            pageHelpContents = pageHelpContentDAO.findByPortalAndPageOrderByPlacementAscOrderAsc(portalId, pageId);
+        } else if(pid != null) {
+            pageHelpContents = pageHelpContentDAO.findByPortalOrderByPlacementAscOrderAsc(portalId);
+        } else {
+            pageHelpContents = pageHelpContentDAO.findAllByOrderByPlacementAscOrderAsc();
+        }
+
+        return pageHelpContents;
+    }
+
     public void deleteAllPageHelpContents() {
         pageHelpContentDAO.deleteAll();
     }
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/DivHelpContentService.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/DivHelpContentService.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/services/DivHelpContentService.java	(revision 60517)
@@ -90,6 +90,31 @@
         return divHelpContentResponses;
     }
 
+
+    public List<DivHelpContent> getDivHelpContentsBasic(String pid, String portalType, String pageId) {
+        List<DivHelpContent> divHelpContents = null;
+
+        Portal _portal = null;
+        String portalId = null;
+        if(pid != null) {
+            _portal = portalService.getPortal(pid);
+            portalService.checkPortalInfo(pid, portalType, _portal, pid, "pid");
+            if(_portal != null) {
+                portalId = _portal.getId();
+            }
+        }
+
+        if(pid != null && pageId != null) {
+            divHelpContents = divHelpContentDAO.findByPortalAndPage(portalId, pageId);
+        } else if(pid != null) {
+            divHelpContents = divHelpContentDAO.findByPortal(portalId);
+        } else {
+            divHelpContents = divHelpContentDAO.findAll();
+        }
+
+        return divHelpContents;
+    }
+
     public DivHelpContent getDivHelpContent(String id) {
         return divHelpContentDAO.findById(id);
     }
Index: modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/AdminPortalRelationsController.java
===================================================================
--- modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/AdminPortalRelationsController.java	(revision 60516)
+++ modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/AdminPortalRelationsController.java	(revision 60517)
@@ -4,6 +4,7 @@
 import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
 import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
 import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
+import eu.dnetlib.uoaadmintoolslibrary.responses.SingleValueWrapperResponse;
 import eu.dnetlib.uoaadmintoolslibrary.services.*;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -10,7 +11,9 @@
 import org.springframework.web.bind.annotation.*;
 import org.springframework.security.access.prepost.PreAuthorize;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 @RestController
@@ -67,6 +70,8 @@
 //        return portalService.getDivHelpContentsByPosition(pid, page, active);
 //    }
 
+    // not used by portals
+    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
     @RequestMapping(value = "/{pid}/divhelpcontent", method = RequestMethod.GET)
     public List<DivHelpContentResponse> getDivHelpContents(@PathVariable PortalType portalType,
                                                            @PathVariable(value = "pid") String pid) {
@@ -73,20 +78,44 @@
         return divHelpContentService.getDivHelpContents(pid, null, null, null);
     }
 
-    @RequestMapping(value = "/{pid}/divhelpcontent/{id}", method = RequestMethod.GET)
-    public DivHelpContent getDivHelpContent(@PathVariable PortalType portalType,
-                                            @PathVariable(value = "pid") String pid,
-                                            @PathVariable(value = "id") String id) {
-        DivHelpContent divHelpContent = divHelpContentService.getDivHelpContent(id);
-        if(divHelpContent == null) {
-            throw new ContentNotFoundException("DivHelpContent with id: "+id+" not found");
-        }
+//    @RequestMapping(value = "/{pid}/divhelpcontent/{id}", method = RequestMethod.GET)
+//    public DivHelpContent getDivHelpContent(@PathVariable PortalType portalType,
+//                                            @PathVariable(value = "pid") String pid,
+//                                            @PathVariable(value = "id") String id) {
+//        DivHelpContent divHelpContent = divHelpContentService.getDivHelpContent(id);
+//        if(divHelpContent == null) {
+//            throw new ContentNotFoundException("DivHelpContent with id: "+id+" not found");
+//        }
+//
+//        Portal portal = portalService.getPortalById(divHelpContent.getPortal());
+//        portalService.checkPortalInfo(pid, portalType.name(), portal, divHelpContent.getPortal(), "id");
+//        return divHelpContent;
+//    }
 
-        Portal portal = portalService.getPortalById(divHelpContent.getPortal());
-        portalService.checkPortalInfo(pid, portalType.name(), portal, divHelpContent.getPortal(), "id");
-        return divHelpContent;
+    @RequestMapping(value = "/{pid}/{pageId}/divhelpcontent", method = RequestMethod.GET)
+    public List<DivHelpContent> getDivHelpContentsByPageId(@PathVariable PortalType portalType,
+                                                             @PathVariable(value = "pid") String pid,
+                                                             @PathVariable(value =  "pageId") String pageId) {
+        return divHelpContentService.getDivHelpContentsBasic(pid, portalType.name(), pageId);
     }
 
+    @RequestMapping(value = "/{pid}/divhelpcontent/page/count", method = RequestMethod.GET)
+    public Map<String, Integer> countDivHelpContentsForPages(@PathVariable PortalType portalType,
+                                                              @PathVariable(value = "pid") String pid) {
+        Map<String, Integer> mapCount = new HashMap<String, Integer>();
+
+        List<Page> pages = pageService.getAllPages(pid, null, null);
+        for(Page page : pages){
+            List<DivHelpContent> divHelpContents = divHelpContentService.getDivHelpContentsBasic(pid, portalType.name(), page.getId());
+            if (divHelpContents == null) {
+                mapCount.put(page.getId(), 0);
+            } else {
+                mapCount.put(page.getId(), divHelpContents.size());
+            }
+        }
+        return mapCount;
+    }
+
     @PreAuthorize("hasAnyAuthority(" +
             "@AuthorizationService.PORTAL_ADMIN, " +
             "@AuthorizationService.curator(#portalType), @AuthorizationService.manager(#portalType, #pid))")
@@ -240,6 +269,8 @@
 //        return portalService.getPageHelpContentsByPosition(pid, page, active);
 //    }
 
+    // not used by portals
+    @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
     @RequestMapping(value = "/{pid}/pagehelpcontent", method = RequestMethod.GET)
     public List<PageHelpContentResponse> getPageHelpContents(@PathVariable PortalType portalType,
                                                              @PathVariable(value = "pid") String pid) {
@@ -246,20 +277,46 @@
         return pageHelpContentService.getPageHelpContents(pid, null, null, null, null, null);
     }
 
-    @RequestMapping(value = "/{pid}/pagehelpcontent/{id}", method = RequestMethod.GET)
-    public PageHelpContent getPageHelpContent(@PathVariable PortalType portalType,
-                                              @PathVariable(value = "pid") String pid,
-                                              @PathVariable(value = "id") String id) {
-        PageHelpContent pageHelpContent = pageHelpContentService.getPageHelpContent(id);
-        if(pageHelpContent == null) {
-            throw new ContentNotFoundException("PageHelpContent with id: "+id+" not found");
+    // used
+    @RequestMapping(value = "/{pid}/{pageId}/pagehelpcontent", method = RequestMethod.GET)
+    public List<PageHelpContent> getPageHelpContentsByPageId(@PathVariable PortalType portalType,
+                                                             @PathVariable(value = "pid") String pid,
+                                                             @PathVariable(value =  "pageId") String pageId) {
+        return pageHelpContentService.getPageHelpContentsBasic(pid, portalType.name(), pageId);
+    }
+
+    // used
+    @RequestMapping(value = "/{pid}/pagehelpcontent/page/count", method = RequestMethod.GET)
+    public Map<String, Integer> countPageHelpContentsForPages(@PathVariable PortalType portalType,
+                                                              @PathVariable(value = "pid") String pid) {
+        Map<String, Integer> mapCount = new HashMap<String, Integer>();
+
+        List<Page> pages = pageService.getAllPages(pid, null, null);
+        for(Page page : pages){
+            List<PageHelpContent> pageHelpContents = pageHelpContentService.getPageHelpContentsBasic(pid, portalType.name(), page.getId());
+            if (pageHelpContents == null) {
+                mapCount.put(page.getId(), 0);
+            } else {
+                mapCount.put(page.getId(), pageHelpContents.size());
+            }
         }
-
-        Portal portal = portalService.getPortalById(pageHelpContent.getPortal());
-        portalService.checkPortalInfo(pid, portalType.name(), portal, pageHelpContent.getPortal(), "id");
-        return pageHelpContent;
+        return mapCount;
     }
 
+//    @RequestMapping(value = "/{pid}/pagehelpcontent/{id}", method = RequestMethod.GET)
+//    public PageHelpContent getPageHelpContent(@PathVariable PortalType portalType,
+//                                              @PathVariable(value = "pid") String pid,
+//                                              @PathVariable(value = "id") String id) {
+//        PageHelpContent pageHelpContent = pageHelpContentService.getPageHelpContent(id);
+//        if(pageHelpContent == null) {
+//            throw new ContentNotFoundException("PageHelpContent with id: "+id+" not found");
+//        }
+//
+//        Portal portal = portalService.getPortalById(pageHelpContent.getPortal());
+//        portalService.checkPortalInfo(pid, portalType.name(), portal, pageHelpContent.getPortal(), "id");
+//        return pageHelpContent;
+//    }
+
     @PreAuthorize("hasAnyAuthority(" +
             "@AuthorizationService.PORTAL_ADMIN, " +
             "@AuthorizationService.curator(#portalType), @AuthorizationService.manager(#portalType, #pid))")
