* ServletModuleContent -
* deliver html for the article admin form.
*
- * @version $Id: ServletModuleContent.java,v 1.24 2002/11/30 19:45:56 zapata Exp $
+ * @version $Id: ServletModuleContent.java,v 1.30 2002/12/28 03:14:42 mh Exp $
* @author rk, mir-coders
*
*/
public class ServletModuleContent extends ServletModule
{
-
static ModuleTopics themenModule;
static ModuleSchwerpunkt schwerpunktModule;
static ModuleImages imageModule;
logger = new LoggerWrapper("ServletModule.Content");
try {
templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate");
-//templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Content.ConfirmTemplate");
+
mainModule = new ModuleContent(DatabaseContent.getInstance());
themenModule = new ModuleTopics(DatabaseTopics.getInstance());
schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
String orderParam = req.getParameter("order");
theList = ((ModuleContent)mainModule).getContentByField(fieldParam, fieldValueParam, orderParam, 0, user);
- returnArticleList(req, res, "lower("+ fieldParam + ") like lower('%" + StringUtil.quote(fieldValueParam) + "%')", orderParam, 0);
+ returnArticleList(req, res, "lower("+ fieldParam + ") like lower('%" + JDBCStringRoutines.escapeStringLiteral(fieldValueParam) + "%')", orderParam, 0);
} catch (ModuleException e) {
throw new ServletModuleException(e.toString());
}
public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
String idParam = req.getParameter("id");
- if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+ if (idParam == null) throw new ServletModuleException("Invalid call: id not supplied ");
_showObject(idParam, req, res);
}
HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());
String[] topic_id = req.getParameterValues("to_topic");
String content_id = req.getParameter("id");
-// withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
+
if(user != null) withValues.put("user_id", user.getId());
withValues.put("is_produced", "0");
if (!withValues.containsKey("is_published"))
if (!withValues.containsKey("is_html"))
withValues.put("is_html","0");
-// ML: this is not multi-language friendly and this can be done in a template
-// if (withValues.get("creator").toString().equals(""))
-// withValues.put("creator","Anonym");
-
-//theLog.printDebugInfo("updating. ");
String id = mainModule.set(withValues);
DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),topic_id);
-//theLog.printDebugInfo("update done. ");
+
String whereParam = req.getParameter("where");
String orderParam = req.getParameter("order");
+
if ((whereParam!=null && !whereParam.equals("")) || (orderParam!=null && !orderParam.equals(""))){
- //theLog.printDebugInfo("update to list");
list(req,res);
}
else
SimpleHash extraInfo = new SimpleHash();
try {
TemplateModelRoot entContent;
+
if (id != null) {
entContent = (TemplateModelRoot)mainModule.getById(id);
- } else {
+ }
+ else {
SimpleHash withValues = new SimpleHash();
withValues.put("new", "1");
withValues.put("is_published", "0");
}
extraInfo.put("themenPopupData", themenModule.getTopicsAsSimpleList());
- try {
- extraInfo.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
- }
- catch (Exception e) {
- logger.error("articletype could not be fetched.");
- }
- try {
- extraInfo.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
- }
- catch (Exception e) {
- logger.error("language-popup could not be fetched.");
- }
-
- extraInfo.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
+ extraInfo.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
+ extraInfo.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
// code to be able to return to the list:
String offsetParam, whereParam, orderParam;
// old one...
EntityAdapterModel model;
- int nrArticlesPerPage = 30;
+ int nrArticlesPerPage = 20;
int count;
try {
Object contentList =
new CachingRewindableIterator(
- new EntityIteratorAdapter( aWhereClause, anOrderByClause, 20,
+ new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrArticlesPerPage,
MirGlobal.localizer().dataModel().adapterModel(), "content", nrArticlesPerPage, anOffset)
);
responseData.put("nexturl" ,
"module=Content&do=list&where=" + HTMLRoutines.encodeURL(aWhereClause) +
"&order=" + HTMLRoutines.encodeURL(anOrderByClause) +
- "&offset=" + anOffset + nrArticlesPerPage);
+ "&offset=" + (anOffset + nrArticlesPerPage));
}
if (anOffset>0) {
responseData.put("prevurl" ,