CCM NG/ccm-cms: JSPs used by the admin UI.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4369 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-10-10 15:17:46 +00:00
parent b6b62e4378
commit 91c33e8e69
4 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.cms.ui.ImageSelectPage"/>
<jsp:directive.page import="org.librecms.ContentSectionServlet"/>
<jsp:directive.page import="org.librecms.ContentSection"/>
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
<jsp:directive.page import="com.arsdigita.dispatcher.*"/>
<jsp:directive.page import="java.util.Date"/>
<jsp:declaration>
private ImageSelectPage imageSelectPage = new ImageSelectPage();
</jsp:declaration>
<jsp:scriptlet>
// Restore the wrapped request
HttpServletRequest myRequest = DispatcherHelper.getRequest();
DispatcherHelper.cacheDisable(response);
ContentSection section = ContentSectionServlet.getContentSection(myRequest);
if (! ContentSectionServlet.checkAdminAccess(myRequest, section)) {
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
}
RequestContext context = DispatcherHelper.getRequestContext(myRequest);
imageSelectPage.init();
imageSelectPage.dispatch(myRequest, response, context);
</jsp:scriptlet>
</jsp:root>

View File

@ -0,0 +1,37 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.cms.ui.ContentSectionPage"/>
<jsp:directive.page import="org.librecms.ContentSection"/>
<jsp:directive.page import="org.librecms.ContentSectionServlet"/>
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
<jsp:directive.page import="com.arsdigita.dispatcher.*"/>
<jsp:directive.page import="com.arsdigita.web.LoginSignal"/>
<jsp:directive.page import="com.arsdigita.web.Web"/>
<jsp:directive.page import="java.util.Date"/>
<jsp:declaration>
private ContentSectionPage sectionPage = new ContentSectionPage();
// private HttpServletRequest myRequest = DispatcherHelper.getRequest();
</jsp:declaration>
<jsp:scriptlet>
// Restore the wrapped request
HttpServletRequest myRequest = DispatcherHelper.getRequest();
DispatcherHelper.cacheDisable(response);
ContentSection section = ContentSectionServlet.getContentSection(myRequest);
if (Web.getWebContext().getUser() == null) {
throw new LoginSignal(myRequest);
} else if (! ContentSectionServlet.checkAdminAccess(myRequest, section)) {
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
}
RequestContext context = DispatcherHelper.getRequestContext(myRequest);
sectionPage.init();
sectionPage.dispatch(myRequest, response, context);
</jsp:scriptlet>
</jsp:root>

View File

@ -0,0 +1,68 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.bebop.Page"/>
<jsp:directive.page import="com.arsdigita.cms.ui.ContentItemPage"/>
<jsp:directive.page import="org.librecms.ContentSectionServlet"/>
<jsp:directive.page import="org.librecms.ContentSection"/>
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
<jsp:directive.page import="com.arsdigita.dispatcher.*"/>
<jsp:directive.page import="com.arsdigita.web.LoginSignal"/>
<jsp:directive.page import="com.arsdigita.web.Web"/>
<jsp:directive.page import="org.apache.log4j.Logger"/>
<jsp:directive.page import="java.util.Date"/>
<jsp:declaration>
private static final Logger s_log =
Logger.getLogger("content-section.www.admin.item.jsp");
private ContentItemPage itemPage = null;
private Date timestamp = new Date(0);
</jsp:declaration>
<jsp:scriptlet>
s_log.debug("entered item.jsp's service method");
// Restore the wrapped request
HttpServletRequest myRequest = DispatcherHelper.getRequest();
DispatcherHelper.cacheDisable(response);
// ?? just doubles the initial line
// request = DispatcherHelper.getRequest();
ContentSection section = ContentSectionServlet.getContentSection(myRequest);
if (Web.getWebContext().getUser() == null) {
throw new LoginSignal(myRequest);
} else if (! ContentSectionServlet.checkAdminAccess(myRequest, section)) {
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
}
// page needs to be refreshed when content types or authoring kits
// in the section change
synchronized(this) {
if (Utilities.getLastSectionRefresh(section).after(timestamp)) {
s_log.debug("refreshing itemPage");
s_log.debug("Creating new ContentItemPage instance...");
itemPage = new ContentItemPage();
s_log.debug("Calling init on new instance...");
itemPage.init();
s_log.debug("Creating time stamp...");
timestamp = new Date();
}
}
s_log.debug("Starting dispatch process...");
RequestContext context = DispatcherHelper.getRequestContext(myRequest);
if(itemPage == null) {
s_log.warn("WARNING: itemPage is NULL");
}
else {
s_log.info("ALL OK: itemPage is not null");
}
itemPage.dispatch(myRequest, response, context);
s_log.debug("exited item.jsp's service method");
</jsp:scriptlet>
</jsp:root>

View File

@ -0,0 +1,32 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.cms.ui.ItemSearchPage"/>
<jsp:directive.page import="org.librecms.ContentSectionServlet"/>
<jsp:directive.page import="org.librecms.ContentSection"/>
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
<jsp:directive.page import="com.arsdigita.dispatcher.*"/>
<jsp:directive.page import="java.util.Date"/>
<jsp:declaration>
private ItemSearchPage sectionPage = new ItemSearchPage();
</jsp:declaration>
<jsp:scriptlet>
// Restore the wrapped request
HttpServletRequest myRequest = DispatcherHelper.getRequest();
DispatcherHelper.cacheDisable(response);
ContentSection section = ContentSectionServlet.getContentSection(myRequest);
if (! ContentSectionServlet.checkAdminAccess(myRequest, section)) {
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
}
RequestContext context = DispatcherHelper.getRequestContext(myRequest);
sectionPage.init();
sectionPage.dispatch(myRequest, response, context);
</jsp:scriptlet>
</jsp:root>