NIHVIVO-1370 Display home tab content on vivo-basic home page (and any other theme that still uses tabs)

This commit is contained in:
rjy7 2011-02-03 20:59:12 +00:00
parent 304a1c7b1e
commit 4508106ba1
2 changed files with 15 additions and 4 deletions

View file

@ -55,13 +55,13 @@ public class TabController extends VitroHttpServlet {
if (leadingTab.getTabId()==portal.getRootTabId()) { if (leadingTab.getTabId()==portal.getRootTabId()) {
request.setAttribute("homePageRequested", "true"); request.setAttribute("homePageRequested", "true");
request.setAttribute("title", portal.getAppName()); request.setAttribute("title", portal.getAppName());
// This will break Datastar, but this may be gone by the time Datastar integrates new Vitro code
RequestDispatcher rd = request.getRequestDispatcher("/home"); RequestDispatcher rd = request.getRequestDispatcher("/home");
rd.forward(request, response); rd.forward(request, response);
return; return;
} }
else else {
request.setAttribute("title",leadingTab.getTitle()); request.setAttribute("title",leadingTab.getTitle());
}
String body = leadingTab.getBody(); String body = leadingTab.getBody();
if( body != null && body.startsWith("JSPBody:") ) if( body != null && body.startsWith("JSPBody:") )

View file

@ -9,6 +9,8 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
@ -44,11 +46,20 @@ public class HomePageController extends FreemarkerHttpServlet {
if(pageData != null) if(pageData != null)
body.putAll(pageData); body.putAll(pageData);
} }
// Get the home tab content for themes that display deprecated tabs
body.put("homeTabContent", getHomeTabContent(vreq));
// Add home page data to body here
return new TemplateResponseValues(BODY_TEMPLATE, body); return new TemplateResponseValues(BODY_TEMPLATE, body);
} }
// Get the home tab content for themes that display deprecated tabs
private String getHomeTabContent(VitroRequest vreq) {
Portal portal = vreq.getPortal();
int tabId = portal.getRootTabId();
Tab tab = vreq.getWebappDaoFactory().getTabDao().getTab(tabId,0,vreq.getAppBean());
return tab.getBody();
}
@Override @Override
protected String getTitle(String siteName, VitroRequest vreq) { protected String getTitle(String siteName, VitroRequest vreq) {