Some fixes for the ongoing refactoring/removal of the old dispatcher code.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2077 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a4a94953c4
commit
6c79fc15a9
|
|
@ -22,9 +22,7 @@ import com.arsdigita.bebop.Page;
|
|||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.dispatcher.SimpleCache;
|
||||
import com.arsdigita.cms.ui.CMSApplicationPage;
|
||||
import com.arsdigita.cms.ui.CMSItemSearchPage;
|
||||
import com.arsdigita.cms.ui.CMSSearchResultRedirector;
|
||||
// Old version (dispatcher based) of CMSItemSearchPage
|
||||
import com.arsdigita.cms.ui.ItemSearchPage;
|
||||
import com.arsdigita.cms.ui.contentcenter.MainPage;
|
||||
import com.arsdigita.developersupport.DeveloperSupport;
|
||||
|
|
@ -37,21 +35,21 @@ import com.arsdigita.templating.PresentationManager;
|
|||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.ui.login.LoginHelper;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.web.*;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationFileResolver;
|
||||
import com.arsdigita.web.BaseApplicationServlet;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -98,11 +96,11 @@ public class ContentCenterServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
// DEPRECATED STUFF for servlet internally process pages, maybe required
|
||||
// for JSP extension.
|
||||
// for JSP extension.
|
||||
// m_trailingSlashList = new ArrayList();
|
||||
// requireTrailingSlash("");
|
||||
|
||||
// NEW STUFF here used to process the pages in this servlet
|
||||
// NEW STUFF here used to process the pages in this servlet
|
||||
// Addresses previously noted in WEB-INF/resources/content-center-map.xml
|
||||
// Obviously not required.
|
||||
addPage("/", new MainPage()); // index page at address ~/cc
|
||||
|
|
@ -113,11 +111,11 @@ public class ContentCenterServlet extends BaseApplicationServlet {
|
|||
addPage("/searchredirect", new CMSSearchResultRedirector());
|
||||
|
||||
|
||||
// STUFF to use for JSP extension, i.e. jsp's to try for URLs which are not
|
||||
// handled by the this servlet directly.
|
||||
// STUFF to use for JSP extension, i.e. jsp's to try for URLs which are not
|
||||
// handled by the this servlet directly.
|
||||
/** Set Template base path for JSP's */
|
||||
// ToDo: Make it configurable by an appropriate config registry entry!
|
||||
// m_templatePath = CMS.getConfig().getTemplateRoot();
|
||||
// m_templatePath = CMS.getConfig().getTemplateRoot();
|
||||
m_templatePath = "/templates/ccm-cms/content-center";
|
||||
Assert.exists(m_templatePath, String.class);
|
||||
Assert.isTrue(m_templatePath.startsWith("/"),
|
||||
|
|
@ -206,7 +204,7 @@ public class ContentCenterServlet extends BaseApplicationServlet {
|
|||
cmsPage.dispatch(sreq, sresp, ctx);
|
||||
} else {
|
||||
final CMSApplicationPage cmsAppPage = (CMSApplicationPage) page;
|
||||
cmsAppPage.init(sreq,sresp,app);
|
||||
cmsAppPage.init(sreq, sresp, app);
|
||||
// Serve the page.
|
||||
final Document doc = cmsAppPage.buildDocument(sreq, sresp);
|
||||
|
||||
|
|
@ -232,8 +230,7 @@ public class ContentCenterServlet extends BaseApplicationServlet {
|
|||
rd.forward(sreq, sresp);
|
||||
} else {
|
||||
// String requestUri = sreq.getRequestURI();
|
||||
sresp.sendError(404, sreq.getRequestURI() +
|
||||
" not found on this server.");
|
||||
sresp.sendError(404, sreq.getRequestURI() + " not found on this server.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ import org.apache.log4j.Logger;
|
|||
* - Refactor content item UI bebop ApplicationPage or PageFactory instead of
|
||||
* legacy infected sitenode / package dispatchers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Content Section's Application Servlet according CCM core web application
|
||||
* structure {@see com.arsdigita.web.Application} implements the content
|
||||
|
|
@ -101,15 +100,13 @@ import org.apache.log4j.Logger;
|
|||
* @author Sören Bernstein <sbernstein@quasiweb.de>
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
*/
|
||||
|
||||
public class ContentSectionServlet extends BaseApplicationServlet {
|
||||
|
||||
/** Creates a s_logging category with name = full name of class */
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(ContentSectionServlet.class);
|
||||
|
||||
/** Stringarray of file name patterns for index files. */
|
||||
private static final String[] WELCOME_FILES = new String[] {
|
||||
private static final String[] WELCOME_FILES = new String[]{
|
||||
"index.jsp", "index.html"
|
||||
};
|
||||
/** The context (in url) for previewing items */
|
||||
|
|
@ -124,23 +121,17 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
public static final String XML_SUFFIX = ".xml";
|
||||
public static final String XML_MODE = "xmlMode";
|
||||
public static final String MEDIA_TYPE = "templateContext";
|
||||
|
||||
private static final String CACHE_KEY_DELIMITER = "%";
|
||||
|
||||
|
||||
private ContentItemDispatcher m_disp = new ContentItemDispatcher();
|
||||
|
||||
public static Map s_itemResolverCache = Collections
|
||||
.synchronizedMap(new HashMap());
|
||||
/** cache the content items */
|
||||
private static Map s_itemURLCacheMap = null;
|
||||
private static boolean s_cacheItems = true;
|
||||
|
||||
// NEW STUFF here used to process the pages in this servlet
|
||||
/** URL (pathinfo) -> Page object mapping. Based on it (and the http
|
||||
* request url) the doService method selects a page to display */
|
||||
private final Map m_pages = new HashMap();
|
||||
|
||||
/** Path to directory containg ccm-cms template (jsp) files */
|
||||
private String m_templatePath;
|
||||
// Probably compatibility stuff, based on dispatcher
|
||||
|
|
@ -178,11 +169,10 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
if (resolverName == null) {
|
||||
m_resolver = Web.getConfig().getApplicationFileResolver();
|
||||
} else {
|
||||
m_resolver = (ApplicationFileResolver)Classes.newInstance(resolverName);
|
||||
m_resolver = (ApplicationFileResolver) Classes.newInstance(resolverName);
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Template path is " + m_templatePath +
|
||||
" with resolver " + m_resolver.getClass().getName());
|
||||
s_log.debug("Template path is " + m_templatePath + " with resolver " + m_resolver.getClass().getName());
|
||||
}
|
||||
|
||||
// NEW STUFF here used to process the pages in this servlet
|
||||
|
|
@ -200,7 +190,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
* {@see com.arsdigita.web.BaseApplicationServlet#doService
|
||||
* (HttpServletRequest, HttpServletResponse, Application)}
|
||||
*/
|
||||
protected void doService( HttpServletRequest sreq,
|
||||
protected void doService(HttpServletRequest sreq,
|
||||
HttpServletResponse sresp,
|
||||
Application app)
|
||||
throws ServletException, IOException {
|
||||
|
|
@ -223,13 +213,14 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
s_log.info("Resolving item URL " + url);
|
||||
}
|
||||
final ItemResolver itemResolver = getItemResolver(section);
|
||||
final ContentItem item = getItem(section, url, itemResolver);
|
||||
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////
|
||||
// Prepare NEW style servlet based bebpo page service
|
||||
// ////////////////////////////////////////////////////////////////////
|
||||
String pathInfo = sreq.getPathInfo();
|
||||
|
||||
final ContentItem item = getItem(section, pathInfo, itemResolver);
|
||||
|
||||
Assert.exists(pathInfo, "String pathInfo");
|
||||
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
|
||||
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
|
||||
|
|
@ -259,7 +250,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
cmsPage.dispatch(sreq, sresp, ctx);
|
||||
} else {
|
||||
final CMSApplicationPage cmsAppPage = (CMSApplicationPage) page;
|
||||
cmsAppPage.init(sreq,sresp,app);
|
||||
cmsAppPage.init(sreq, sresp, app);
|
||||
// Serve the page.
|
||||
final Document doc = cmsAppPage.buildDocument(sreq, sresp);
|
||||
|
||||
|
|
@ -281,6 +272,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
public void beforeCommit(TransactionContext txn) {
|
||||
Assert.fail("uncommittable transaction");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Kernel.getContext().getTransaction().setCommitRequested(false);
|
||||
|
|
@ -310,7 +302,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
s_log.debug("Got dispatcher " + rd);
|
||||
}
|
||||
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
||||
rd.forward(sreq,sresp);
|
||||
rd.forward(sreq, sresp);
|
||||
} else {
|
||||
// sresp.sendError(404, packageURL + " not found on this server.");
|
||||
String requestUri = sreq.getRequestURI(); // same as ctx.getRemainingURLPart()
|
||||
|
|
@ -319,7 +311,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
}
|
||||
} // END doService
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sreq
|
||||
|
|
@ -373,8 +364,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
Date endDate = cycle.getEndDate();
|
||||
|
||||
if (endDate != null) {
|
||||
int maxAge = (int) ((endDate.getTime() -
|
||||
System.currentTimeMillis()) / 1000l);
|
||||
int maxAge = (int) ((endDate.getTime() - System.currentTimeMillis()) / 1000l);
|
||||
if (maxAge < expires) {
|
||||
expires = maxAge;
|
||||
}
|
||||
|
|
@ -386,8 +376,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
// this page to be publically cached
|
||||
if (s_cacheItems && item.isLiveVersion()) {
|
||||
SecurityManager sm = new SecurityManager(section);
|
||||
if (sm.canAccess
|
||||
((User) null, SecurityManager.PUBLIC_PAGES, item)) {
|
||||
if (sm.canAccess((User) null, SecurityManager.PUBLIC_PAGES, item)) {
|
||||
DispatcherHelper.cacheForWorld(sresp, expires);
|
||||
} else {
|
||||
DispatcherHelper.cacheForUser(sresp, expires);
|
||||
|
|
@ -397,7 +386,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
//use ContentItemDispatcher
|
||||
m_disp.dispatch(sreq,sresp,ctx);
|
||||
m_disp.dispatch(sreq, sresp, ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -441,7 +430,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
String path = section.getPath();
|
||||
ItemResolver ir = (ItemResolver) s_itemResolverCache.get(path);
|
||||
|
||||
if ( ir == null ) {
|
||||
if (ir == null) {
|
||||
ir = section.getItemResolver();
|
||||
s_itemResolverCache.put(path, ir);
|
||||
}
|
||||
|
|
@ -467,7 +456,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
//first sanitize the url
|
||||
if (url.endsWith(XML_SUFFIX)) {
|
||||
request.setAttribute(XML_MODE, Boolean.TRUE);
|
||||
s_log.debug ("StraightXML Requested");
|
||||
s_log.debug("StraightXML Requested");
|
||||
url = "/" + url.substring(0, url.length() - XML_SUFFIX.length());
|
||||
} else {
|
||||
request.setAttribute(XML_MODE, Boolean.FALSE);
|
||||
|
|
@ -502,8 +491,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
|
||||
item = itemResolver.getItem(section, url, CMSDispatcher.PREVIEW);
|
||||
if (item != null) {
|
||||
hasPermission = sm.canAccess
|
||||
(request, SecurityManager.PREVIEW_PAGES, item);
|
||||
hasPermission = sm.canAccess(request, SecurityManager.PREVIEW_PAGES, item);
|
||||
}
|
||||
} else {
|
||||
if (s_log.isInfoEnabled()) {
|
||||
|
|
@ -513,8 +501,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
//check if this item is in the cache
|
||||
//we only cache live items
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Trying to get content item for URL " + url +
|
||||
" from cache");
|
||||
s_log.debug("Trying to get content item for URL " + url + " from cache");
|
||||
}
|
||||
|
||||
// Get the negotiated locale
|
||||
|
|
@ -525,9 +512,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
|
||||
if (item == null) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug
|
||||
("Did not find content item in cache, so trying " +
|
||||
"to retrieve and cache...");
|
||||
s_log.debug("Did not find content item in cache, so trying " + "to retrieve and cache...");
|
||||
}
|
||||
//item not cached, so retreive it and cache it
|
||||
item = itemResolver.getItem(section, url, ContentItem.LIVE);
|
||||
|
|
@ -537,8 +522,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
if (s_log.isDebugEnabled() && item != null) {
|
||||
s_log.debug
|
||||
("Sanity check: item.getPath() is " + item.getPath());
|
||||
s_log.debug("Sanity check: item.getPath() is " + item.getPath());
|
||||
}
|
||||
|
||||
if (item != null) {
|
||||
|
|
@ -551,7 +535,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
item);
|
||||
|
||||
if (hasPermission) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -577,8 +560,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasPermission &&
|
||||
!LocalRequestPassword.validLocalRequest(request)) {
|
||||
if (!hasPermission && !LocalRequestPassword.validLocalRequest(request)) {
|
||||
|
||||
// first, check if the user is logged-in
|
||||
// if he isn't, give him a chance to do so...
|
||||
|
|
@ -600,7 +582,6 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
// synchronize access to the item-url cache
|
||||
|
||||
private static synchronized void itemURLCachePut(ContentSection section,
|
||||
String sURL,
|
||||
String lang,
|
||||
|
|
@ -659,8 +640,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
return null;
|
||||
} else {
|
||||
try {
|
||||
return (ContentItem) DomainObjectFactory.newInstance
|
||||
(new OID(ContentItem.BASE_DATA_OBJECT_TYPE, itemID));
|
||||
return (ContentItem) DomainObjectFactory.newInstance(new OID(ContentItem.BASE_DATA_OBJECT_TYPE, itemID));
|
||||
} catch (DataObjectNotFoundException donfe) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -695,9 +675,9 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
|||
public static boolean checkAdminAccess(HttpServletRequest request,
|
||||
ContentSection section) {
|
||||
|
||||
User user ;
|
||||
User user;
|
||||
KernelContext kernelContext = Kernel.getContext();
|
||||
if ( kernelContext.getParty() instanceof User ) {
|
||||
if (kernelContext.getParty() instanceof User) {
|
||||
user = (User) kernelContext.getParty();
|
||||
} else {
|
||||
// Should not happen, at this stage the user has to be logged in.
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class CMSItemSearchPage extends CMSApplicationPage {
|
|||
addGlobalStateParam(new IntegerParameter("lastTab"));
|
||||
addGlobalStateParam(new BooleanParameter("disableCreatePane"));
|
||||
addGlobalStateParam(new BooleanParameter("editAfterCreate"));
|
||||
addGlobalStateParam(new StringParameter("queryField"));
|
||||
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(m_sectionId);
|
||||
|
||||
|
|
@ -136,6 +137,10 @@ public class CMSItemSearchPage extends CMSApplicationPage {
|
|||
m_create.setEditAfterCreate((Boolean) state.getValue(new BooleanParameter("editAfterCreate")));
|
||||
}
|
||||
|
||||
if (state.getValue(new StringParameter("queryField")) != null) {
|
||||
m_flatBrowse.addQueryField((String) state.getValue(new StringParameter("queryField")));
|
||||
}
|
||||
|
||||
// if (m_lastTab != m_tabbedPane.getSelectedIndex(state)) {
|
||||
// m_lastTab = m_tabbedPane.getSelectedIndex(state);
|
||||
// return;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ class ItemSearchCreateItemPane extends CMSContainer
|
|||
*/
|
||||
public ItemSearchCreateItemPane(final ItemSearchPage parent) {
|
||||
super();
|
||||
m_model = new ParameterSingleSelectionModel(new BigDecimalParameter(FOLDER_ID));
|
||||
m_folderSel = new FolderSelectionModel(m_model);
|
||||
m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
|
||||
init();
|
||||
|
|
@ -126,6 +127,7 @@ class ItemSearchCreateItemPane extends CMSContainer
|
|||
*/
|
||||
public ItemSearchCreateItemPane(final CMSItemSearchPage parent) {
|
||||
super();
|
||||
m_model = new ParameterSingleSelectionModel(new BigDecimalParameter(FOLDER_ID));
|
||||
m_folderSel = new FolderSelectionModel(m_model);
|
||||
m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
|
||||
init();
|
||||
|
|
@ -145,7 +147,7 @@ class ItemSearchCreateItemPane extends CMSContainer
|
|||
|
||||
// m_newItem = new SectionNewItemForm("newItem");
|
||||
|
||||
m_model = new ParameterSingleSelectionModel(new BigDecimalParameter(FOLDER_ID));
|
||||
//m_model = new ParameterSingleSelectionModel(new BigDecimalParameter(FOLDER_ID));
|
||||
// m_folderSel = new FolderSelectionModel(m_model);
|
||||
|
||||
this.setIdAttr("folder-new-item");
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ import com.arsdigita.persistence.Session;
|
|||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -54,6 +56,7 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
|||
private final Table resultsTable;
|
||||
private final Paginator paginator;
|
||||
private final StringParameter queryParam;
|
||||
private final List<String> queryFields = new ArrayList<String>();
|
||||
private final Submit submit;
|
||||
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstance();
|
||||
|
||||
|
|
@ -113,6 +116,10 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
|||
state.setValue(new StringParameter(ItemSearchPopup.QUERY), data.get(QUERY_PARAM));
|
||||
}
|
||||
|
||||
public void addQueryField(final String queryField) {
|
||||
queryFields.add(queryField);
|
||||
}
|
||||
|
||||
private class ResultsTable extends Table {
|
||||
|
||||
private static final String TABLE_COL_TITLE = "title";
|
||||
|
|
@ -181,15 +188,26 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
|||
final ContentType type = new ContentType(typeId);
|
||||
collection.set(state, session.retrieve(type.getClassName()));
|
||||
}
|
||||
((DataCollection)collection.get(state)).addFilter("version = 'draft'");
|
||||
((DataCollection)collection.get(state)).addFilter("section is not null");
|
||||
((DataCollection) collection.get(state)).addFilter("version = 'draft'");
|
||||
((DataCollection) collection.get(state)).addFilter("section is not null");
|
||||
|
||||
final String query = (String) state.getValue(queryParam);
|
||||
if ((query != null) && !query.isEmpty()) {
|
||||
((DataCollection) collection.get(state)).addFilter(String.format(
|
||||
"((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%')))",
|
||||
final StringBuffer buffer = new StringBuffer(String.format(
|
||||
"((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
||||
ContentItem.NAME, query,
|
||||
ContentPage.TITLE, query));
|
||||
for (String field : queryFields) {
|
||||
buffer.append(String.format(" or (lower(%s) like lower('%%%s%%'))", field, query));
|
||||
}
|
||||
buffer.append(')');
|
||||
|
||||
((DataCollection) collection.get(state)).addFilter(buffer.toString());
|
||||
|
||||
// ((DataCollection) collection.get(state)).addFilter(String.format(
|
||||
// "((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%')))",
|
||||
// ContentItem.NAME, query,
|
||||
// ContentPage.TITLE, query));
|
||||
}
|
||||
|
||||
((DataCollection) collection.get(state)).addOrder("title asc, name asc");
|
||||
|
|
@ -306,9 +324,11 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
|||
|
||||
return link;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected Submit getSubmit() {
|
||||
return submit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class ItemSearchPage extends CMSPage {
|
|||
addGlobalStateParam(new IntegerParameter("lastTab"));
|
||||
addGlobalStateParam(new BooleanParameter("disableCreatePane"));
|
||||
addGlobalStateParam(new BooleanParameter("editAfterCreate"));
|
||||
addGlobalStateParam(new StringParameter("queryField"));
|
||||
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(m_sectionId);
|
||||
|
||||
|
|
@ -136,6 +137,10 @@ public class ItemSearchPage extends CMSPage {
|
|||
m_create.setEditAfterCreate((Boolean) state.getValue(new BooleanParameter("editAfterCreate")));
|
||||
}
|
||||
|
||||
if (state.getValue(new StringParameter("queryField")) != null) {
|
||||
m_flatBrowse.addQueryField((String) state.getValue(new StringParameter("queryField")));
|
||||
}
|
||||
|
||||
// if (m_lastTab != m_tabbedPane.getSelectedIndex(state)) {
|
||||
// m_lastTab = m_tabbedPane.getSelectedIndex(state);
|
||||
// return;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public class ItemSearchWidget extends FormSection
|
|||
private String m_searchName;
|
||||
private String m_clearName;
|
||||
private Folder m_defaultCreationFolder;
|
||||
private String m_queryField;
|
||||
private ParameterModel m_model;
|
||||
private ParameterModel m_searchModel;
|
||||
private boolean disableCreatePane = false;
|
||||
|
|
@ -284,6 +285,10 @@ public class ItemSearchWidget extends FormSection
|
|||
params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString());
|
||||
}
|
||||
|
||||
if (m_queryField != null) {
|
||||
params.setParameter("queryField", m_queryField);
|
||||
}
|
||||
|
||||
String searchURL = ContentCenterServlet.getURLStubForClass(
|
||||
ItemSearchPage.class.getName());
|
||||
s_log.debug("Search URL stub is: " + searchURL);
|
||||
|
|
@ -507,6 +512,10 @@ public class ItemSearchWidget extends FormSection
|
|||
m_defaultCreationFolder = folder;
|
||||
}
|
||||
|
||||
public void setQueryField(final String queryField) {
|
||||
m_queryField = queryField;
|
||||
}
|
||||
|
||||
public void publishCreatedItem(final FormData data, final ContentItem item) {
|
||||
final String publishStr = data.getString(ItemSearchWidget.PUBLISH);
|
||||
final Boolean publish = Boolean.valueOf(publishStr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue