NIHVIVO-1965 Better message for authenticated users with access to the site admin when accessing the site with little or no content. Also refactored BrowseController so that it doesn't attempt to override template and provide it's own message if no content is found.
This commit is contained in:
parent
2e9cd79352
commit
20ab4cc157
4 changed files with 45 additions and 38 deletions
|
@ -50,7 +50,7 @@ public class BrowseController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle(String siteName, VitroRequest vreq) {
|
protected String getTitle(String siteName, VitroRequest vreq) {
|
||||||
return "Index to " + siteName + " Contents";
|
return "Index of Contents";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,29 +60,24 @@ public class BrowseController extends FreemarkerHttpServlet {
|
||||||
String message = null;
|
String message = null;
|
||||||
String templateName = TEMPLATE_DEFAULT;
|
String templateName = TEMPLATE_DEFAULT;
|
||||||
|
|
||||||
if( vreq.getParameter("clearcache") != null ) //mainly for debugging
|
if ( vreq.getParameter("clearcache") != null ) //mainly for debugging
|
||||||
clearGroupCache();
|
clearGroupCache();
|
||||||
|
|
||||||
int portalId = vreq.getPortalId();
|
int portalId = vreq.getPortalId();
|
||||||
|
|
||||||
List<VClassGroup> groups = null;
|
List<VClassGroup> groups = null;
|
||||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||||
if( vcgc == null ){
|
if ( vcgc == null ) {
|
||||||
log.error("Could not get VClassGroupCache");
|
log.error("Could not get VClassGroupCache");
|
||||||
message = "The system is not configured correctly. Please check your logs for error messages.";
|
message = "The system is not configured correctly. Please check your logs for error messages.";
|
||||||
}else{
|
} else {
|
||||||
groups =vcgc.getGroups( vreq.getPortalId());
|
groups =vcgc.getGroups( vreq.getPortalId());
|
||||||
if (groups == null || groups.isEmpty()) {
|
|
||||||
message = "There are not yet any items in the system.";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
|
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
|
||||||
for (VClassGroup group : groups) {
|
for (VClassGroup group : groups) {
|
||||||
vcgroups.add(new VClassGroupTemplateModel(group));
|
vcgroups.add(new VClassGroupTemplateModel(group));
|
||||||
}
|
}
|
||||||
body.put("classGroups", vcgroups);
|
body.put("classGroups", vcgroups);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
body.put("message", message);
|
body.put("message", message);
|
||||||
|
|
|
@ -90,7 +90,11 @@ ${stylesheets.add("/css/browseClassGroups.css")}
|
||||||
<#-- <#include "classgroups-checkForData.ftl"> -->
|
<#-- <#include "classgroups-checkForData.ftl"> -->
|
||||||
<h3>There is currently no content in the system</h3>
|
<h3>There is currently no content in the system</h3>
|
||||||
|
|
||||||
<#if !user.loggedIn>
|
<#if user.loggedIn>
|
||||||
|
<#if user.hasSiteAdminAccess>
|
||||||
|
<p>You can <a href="${urls.siteAdmin}" title="Manage content">add content and manage this site</a> from the Site Administration page.</p>
|
||||||
|
</#if>
|
||||||
|
<#else>
|
||||||
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
|
@ -17,7 +17,11 @@
|
||||||
<#assign noDataNotification>
|
<#assign noDataNotification>
|
||||||
<h3>There is currently no content in the system</h3>
|
<h3>There is currently no content in the system</h3>
|
||||||
|
|
||||||
<#if !user.loggedIn>
|
<#if user.loggedIn>
|
||||||
|
<#if user.hasSiteAdminAccess>
|
||||||
|
<p>You can <a href="${urls.siteAdmin}" title="Manage content">add content and manage this site</a> from the Site Administration page.</p>
|
||||||
|
</#if>
|
||||||
|
<#else>
|
||||||
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
||||||
</#if>
|
</#if>
|
||||||
</#assign>
|
</#assign>
|
|
@ -19,7 +19,11 @@
|
||||||
|
|
||||||
<#assign noDataNotification>
|
<#assign noDataNotification>
|
||||||
<h3>There is currently no ${page.title} content in the system</h3>
|
<h3>There is currently no ${page.title} content in the system</h3>
|
||||||
<#if !user.loggedIn>
|
<#if user.loggedIn>
|
||||||
|
<#if user.hasSiteAdminAccess>
|
||||||
|
<p>You can <a href="${urls.siteAdmin}" title="Manage content">add content and manage this site</a> from the Site Administration page.</p>
|
||||||
|
</#if>
|
||||||
|
<#else>
|
||||||
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue