From 337613e7dc23b871c25a86e1606bff44f0e3cf8f Mon Sep 17 00:00:00 2001 From: zapata Date: Sun, 16 Mar 2003 00:11:09 +0000 Subject: [PATCH] - topiclist now optionally with checkboxes on article edit form - topiclist now with configurable ordering - a more generic back button on some places --- bundles/admin_en.properties | 6 +- etc/config.properties-dist | 10 + source/default.properties | 10 + .../basic/MirBasicProducerAssistantLocalizer.java | 312 +++++++++------------ source/mircoders/servlet/ServletHelper.java | 2 + source/mircoders/servlet/ServletModuleContent.java | 8 +- templates/admin/abuse.log.template | 4 +- templates/admin/content.template | 76 ++--- templates/admin/head.template | 15 +- 9 files changed, 226 insertions(+), 217 deletions(-) diff --git a/bundles/admin_en.properties b/bundles/admin_en.properties index dd455082..6f26febc 100755 --- a/bundles/admin_en.properties +++ b/bundles/admin_en.properties @@ -1,6 +1,6 @@ ########## admin ########## # language: english -# $Id: admin_en.properties,v 1.39 2003/03/15 15:35:56 zapata Exp $ +# $Id: admin_en.properties,v 1.40 2003/03/16 00:11:09 zapata Exp $ languagename=English @@ -134,7 +134,9 @@ confirm.really_delete=Do you really want to delete this entry? # content content.htmltitle=Article content.owner=Owner -content.topic=Topic +content.language=Language +content.articletype=Article type +content.topic=Topics content.title=Long title content.subtitle=Sub title / context title content.location=Location diff --git a/etc/config.properties-dist b/etc/config.properties-dist index 27084f6a..4403526a 100755 --- a/etc/config.properties-dist +++ b/etc/config.properties-dist @@ -83,6 +83,16 @@ Mir.Localizer.OpenPosting.GeneratorLibrary= default=freemarker(etc/open/) # 0 = links, 1 = checkboxes, 2 = a listbox Mir.Localizer.Admin.ListOperationsFlavor=1 +# How should the topics be presented on the article edit page? +# 0 = in a multiselect list box, 1 = checkboxes +Mir.Localizer.Admin.TopicListFlavor=1 + +# For the checkboxes flavour, how many columns should there be? +Mir.Localizer.Admin.TopicListColumns=3 + +# In which order should the topic appear? +Mir.Localizer.Admin.TopicListOrder=title + # Which producers need to be called after an article (resp. a comment) is posted Mir.Localizer.OpenPosting.ContentProducers= media.new;articles.changed;startpage.generate;synchronization.run Mir.Localizer.OpenPosting.CommentProducers= articles.changed;synchronization.run diff --git a/source/default.properties b/source/default.properties index d89e0552..03a3af9e 100755 --- a/source/default.properties +++ b/source/default.properties @@ -89,6 +89,16 @@ Mir.Localizer.OpenPosting.GeneratorLibrary= default=freemarker(etc/open/) # 0 = links, 1 = checkboxes, 2 = a listbox Mir.Localizer.Admin.ListOperationsFlavor=1 +# How should the topics be presented on the article edit page? +# 0 = in a multiselect list box, 1 = checkboxes +Mir.Localizer.Admin.TopicListFlavor=1 + +# For the checkboxes flavour, how many columns should there be? +Mir.Localizer.Admin.TopicListColumns=3 + +# In which order should the topic appear? +Mir.Localizer.Admin.TopicListOrder=title + # Which producers need to be called after an article (resp. a comment) is posted Mir.Localizer.OpenPosting.ContentProducers= media.new;articles.changed;startpage.generate;synchronization.run Mir.Localizer.OpenPosting.CommentProducers= articles.changed;synchronization.run diff --git a/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java b/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java index 58b193fb..6c9720fb 100755 --- a/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java @@ -1,172 +1,140 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Mir is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.localizer.basic; - -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import mir.config.MirPropertiesConfiguration; -import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; -import mir.entity.EntityList; -import mir.entity.adapter.EntityAdapter; -import mir.entity.adapter.EntityIteratorAdapter; -import mir.log.LoggerWrapper; -import mir.misc.StringUtil; -import mir.util.DateToMapAdapter; -import mir.util.GeneratorHTMLFunctions; -import mir.util.GeneratorIntegerFunctions; -import mir.util.GeneratorListFunctions; -import mir.util.GeneratorStringFunctions; -import mircoders.global.MirGlobal; -import mircoders.localizer.MirProducerAssistantLocalizer; -import mircoders.module.ModuleLanguage; -import mircoders.module.ModuleTopics; -import mircoders.storage.DatabaseLanguage; -import mircoders.storage.DatabaseTopics; - -public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer { - protected LoggerWrapper logger; - - public void initializeGenerationValueSet(Map aValueSet) { - Iterator i; - - Map configMap = new HashMap(); - Map utilityMap = new HashMap(); - - logger = new LoggerWrapper("Localizer.ProducerAssistant"); - -// obsolete: - configMap.put("producerDocRoot", MirGlobal.config().getString("Producer.DocRoot")); - configMap.put("storageRoot", MirGlobal.config().getString("Producer.StorageRoot")); - configMap.put("productionHost", MirGlobal.config().getString("Producer.ProductionHost")); - configMap.put("openAction", MirGlobal.config().getString("Producer.OpenAction")); - configMap.put("docRoot", MirGlobal.config().getString("RootUri")); - configMap.put("actionRoot", MirGlobal.config().getString("RootUri")+"/servlet/Mir"); - configMap.put("now", new DateToMapAdapter((new GregorianCalendar()).getTime())); - configMap.put("videoHost", MirGlobal.config().getString("Producer.Video.Host")); - configMap.put("audioHost", MirGlobal.config().getString("Producer.Audio.Host")); - configMap.put("imageHost", MirGlobal.config().getString("Producer.Image.Host")); - configMap.put("imagePath", MirGlobal.config().getString("Producer.Image.Path")); - configMap.put("mirVersion", MirGlobal.config().getString("Mir.Version")); - configMap.put("defEncoding", MirGlobal.config().getString("Mir.DefaultEncoding")); - -// "new": - try { - configMap.putAll( MirPropertiesConfiguration.instance().allSettings() ); - } - catch (PropertiesConfigExc e) { - throw new RuntimeException("Can't get configuration: " + e.getMessage()); - } - - utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() ); - utilityMap.put("encodeHTML", new GeneratorHTMLFunctions.encodeHTMLGeneratorFunction()); - utilityMap.put("encodeXML", new GeneratorHTMLFunctions.encodeXMLGeneratorFunction()); - utilityMap.put("encodeURI", new GeneratorHTMLFunctions.encodeURIGeneratorFunction()); - utilityMap.put("subString", new GeneratorStringFunctions.subStringFunction()); - utilityMap.put("subList", new GeneratorListFunctions.subListFunction()); - utilityMap.put("isOdd", new GeneratorIntegerFunctions.isOddFunction()); - utilityMap.put("increment", new GeneratorIntegerFunctions.incrementFunction()); - - - aValueSet.put("config", configMap); - aValueSet.put("utility", utilityMap); - - - EntityList topicList=null; - EntityList entityList=null; - EntityList languageList=null; - - try { - ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance()); - ModuleLanguage languageModule = new ModuleLanguage(DatabaseLanguage.getInstance()); - - topicList = topicsModule.getTopicsList(); - languageList = languageModule.getByWhereClause("", "id", -1); - - } - catch (Throwable t) { - logger.error("initializeGenerationValueSet: Exception "+t.getMessage()); - } - - aValueSet.put("topics", topicList); - aValueSet.put("imclist", entityList); - - Map articleTypeMap = new HashMap(); - articleTypeMap.put("openposting", "0"); - articleTypeMap.put("newswire", "1"); - articleTypeMap.put("feature", "2"); - articleTypeMap.put("topicspecial", "3"); - articleTypeMap.put("startspecial", "4"); - - try { - i = new EntityIteratorAdapter( "", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "articleType" ); - - while (i.hasNext()) { - EntityAdapter articleType = (EntityAdapter) i.next(); - - articleTypeMap.put(articleType.get("name"), articleType.get("id")); - } - } - catch (Throwable t) { - logger.error("initializeGenerationValueSet: Exception while collecting article types "+t.getMessage()); - } - aValueSet.put("articletype", articleTypeMap); - - Map commentStatusMap = new HashMap(); - try { - i = new EntityIteratorAdapter( "", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus" ); - - while (i.hasNext()) { - EntityAdapter commentStatus = (EntityAdapter) i.next(); - - commentStatusMap.put(commentStatus.get("name"), commentStatus.get("id")); - } - } - catch (Throwable t) { - logger.error("initializeGenerationValueSet: Exception while collecting comment statuses"+t.getMessage()); - } - aValueSet.put("commentstatus", commentStatusMap); - - }; - - public String filterText(String aText) { - return StringUtil.createHTML( - StringUtil.deleteForbiddenTags(aText), - MirGlobal.config().getString("Producer.ImageRoot"), - MirGlobal.config().getString("Producer.MailLinkName"), - MirGlobal.config().getString("Producer.ExtLinkName"), - MirGlobal.config().getString("Producer.IntLinkName") - ); - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with the com.oreilly.servlet library, any library + * licensed under the Apache Software License, The Sun (tm) Java Advanced + * Imaging library (JAI), The Sun JIMI library (or with modified versions of + * the above that use the same license as the above), and distribute linked + * combinations including the two. You must obey the GNU General Public + * License in all respects for all of the code used other than the above + * mentioned libraries. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If you do + * not wish to do so, delete this exception statement from your version. + */ + +package mircoders.localizer.basic; + +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import mir.config.MirPropertiesConfiguration; +import mir.entity.adapter.EntityAdapter; +import mir.entity.adapter.EntityIteratorAdapter; +import mir.log.LoggerWrapper; +import mir.misc.StringUtil; +import mir.util.DateToMapAdapter; +import mir.util.GeneratorHTMLFunctions; +import mir.util.GeneratorIntegerFunctions; +import mir.util.GeneratorListFunctions; +import mir.util.GeneratorStringFunctions; +import mircoders.global.MirGlobal; +import mircoders.localizer.MirProducerAssistantLocalizer; + +public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer { + protected LoggerWrapper logger; + + public void initializeGenerationValueSet(Map aValueSet) { + try { + Iterator i; + + Map configMap = new HashMap(); + Map utilityMap = new HashMap(); + + logger = new LoggerWrapper("Localizer.ProducerAssistant"); + +// obsolete: + configMap.put("producerDocRoot", MirGlobal.config().getString("Producer.DocRoot")); + configMap.put("storageRoot", MirGlobal.config().getString("Producer.StorageRoot")); + configMap.put("productionHost", MirGlobal.config().getString("Producer.ProductionHost")); + configMap.put("openAction", MirGlobal.config().getString("Producer.OpenAction")); + configMap.put("docRoot", MirGlobal.config().getString("RootUri")); + configMap.put("actionRoot", MirGlobal.config().getString("RootUri") + "/servlet/Mir"); + configMap.put("now", new DateToMapAdapter( (new GregorianCalendar()).getTime())); + configMap.put("videoHost", MirGlobal.config().getString("Producer.Video.Host")); + configMap.put("audioHost", MirGlobal.config().getString("Producer.Audio.Host")); + configMap.put("imageHost", MirGlobal.config().getString("Producer.Image.Host")); + configMap.put("imagePath", MirGlobal.config().getString("Producer.Image.Path")); + configMap.put("mirVersion", MirGlobal.config().getString("Mir.Version")); + configMap.put("defEncoding", MirGlobal.config().getString("Mir.DefaultEncoding")); + +// "new": + configMap.putAll(MirPropertiesConfiguration.instance().allSettings()); + + utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace()); + utilityMap.put("encodeHTML", new GeneratorHTMLFunctions.encodeHTMLGeneratorFunction()); + utilityMap.put("encodeXML", new GeneratorHTMLFunctions.encodeXMLGeneratorFunction()); + utilityMap.put("encodeURI", new GeneratorHTMLFunctions.encodeURIGeneratorFunction()); + utilityMap.put("subString", new GeneratorStringFunctions.subStringFunction()); + utilityMap.put("subList", new GeneratorListFunctions.subListFunction()); + utilityMap.put("isOdd", new GeneratorIntegerFunctions.isOddFunction()); + utilityMap.put("increment", new GeneratorIntegerFunctions.incrementFunction()); + + aValueSet.put("config", configMap); + aValueSet.put("utility", utilityMap); + + aValueSet.put("languages", + new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "language")); + + aValueSet.put("topics", + new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "topic")); + + Map articleTypeMap = new HashMap(); + articleTypeMap.put("openposting", "0"); + articleTypeMap.put("newswire", "1"); + articleTypeMap.put("feature", "2"); + articleTypeMap.put("topicspecial", "3"); + articleTypeMap.put("startspecial", "4"); + + i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "articleType"); + while (i.hasNext()) { + EntityAdapter articleType = (EntityAdapter) i.next(); + + articleTypeMap.put(articleType.get("name"), articleType.get("id")); + } + aValueSet.put("articletype", articleTypeMap); + + Map commentStatusMap = new HashMap(); + i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus"); + while (i.hasNext()) { + EntityAdapter commentStatus = (EntityAdapter) i.next(); + + commentStatusMap.put(commentStatus.get("name"), commentStatus.get("id")); + } + aValueSet.put("commentstatus", commentStatusMap); + } + catch (Throwable t) { + logger.error("initializeGenerationValueSet: Exception while collecting comment statuses" + t.getMessage()); + throw new RuntimeException(t.getMessage()); + } + + }; + + public String filterText(String aText) { + return StringUtil.createHTML( + StringUtil.deleteForbiddenTags(aText), + MirGlobal.config().getString("Producer.ImageRoot"), + MirGlobal.config().getString("Producer.MailLinkName"), + MirGlobal.config().getString("Producer.ExtLinkName"), + MirGlobal.config().getString("Producer.IntLinkName") + ); + } +} diff --git a/source/mircoders/servlet/ServletHelper.java b/source/mircoders/servlet/ServletHelper.java index c07d68ba..12d71a9a 100755 --- a/source/mircoders/servlet/ServletHelper.java +++ b/source/mircoders/servlet/ServletHelper.java @@ -27,6 +27,8 @@ public class ServletHelper { MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result); + result.put("returnurl", null); + Object languages = new CachingRewindableIterator( new EntityIteratorAdapter( "", "id", 30, diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java index 7f4dccf1..5de570fb 100755 --- a/source/mircoders/servlet/ServletModuleContent.java +++ b/source/mircoders/servlet/ServletModuleContent.java @@ -71,7 +71,7 @@ import freemarker.template.SimpleHash; * ServletModuleContent - * deliver html for the article admin form. * - * @version $Id: ServletModuleContent.java,v 1.44 2003/03/15 15:35:57 zapata Exp $ + * @version $Id: ServletModuleContent.java,v 1.45 2003/03/16 00:11:09 zapata Exp $ * @author rk, mir-coders * */ @@ -372,6 +372,12 @@ public class ServletModuleContent extends ServletModule } responseData.put("article", article); + responseData.put("topics", + new EntityIteratorAdapter("", configuration.getString("Mir.Localizer.Admin.TopicListOrder"), + 20, MirGlobal.localizer().dataModel().adapterModel(), "topic")); + + + responseData.put("returnurl", requestParser.getParameter("returnurl")); responseData.put("thisurl", urlBuilder.getQuery()); diff --git a/templates/admin/abuse.log.template b/templates/admin/abuse.log.template index a0cc9b8c..cfe1ecd8 100755 --- a/templates/admin/abuse.log.template +++ b/templates/admin/abuse.log.template @@ -25,9 +25,9 @@ ${l.ip} - Article + Article - Comment + Comment ${l.browser} diff --git a/templates/admin/content.template b/templates/admin/content.template index 7921f699..ad16fc45 100755 --- a/templates/admin/content.template +++ b/templates/admin/content.template @@ -29,7 +29,7 @@ - ${lang("content.published")} : + ${lang("content.published")} checked> @@ -71,39 +71,56 @@ - ${lang("content.topic")}  - - - + ${lang("content.articletype")} / + ${lang("content.language")}: - - - - - - - -
- - -
- -
+ + + + + ${lang("content.topic")}: + + + + + + + + + + + + + + + + + + + +
+ checked>${t.title} + +   +
+ + +
@@ -117,8 +134,6 @@ ${lang("content.subtitle")}: 
- - @@ -128,7 +143,6 @@ ${lang("content.location")}: - @@ -137,8 +151,6 @@ ${lang("content.creator")}: - -
@@ -148,8 +160,6 @@ ${lang("content.creator.email")}/${lang("content.creator.url")}: - - @@ -159,8 +169,6 @@ ${lang("content.creator.address")}/${lang("content.creator.telephone")}: - - @@ -170,8 +178,6 @@ ${lang("content.abstract")}: - - @@ -181,13 +187,9 @@ ${lang("content.content")}: -
${lang("content.html")} checked
>  - - - diff --git a/templates/admin/head.template b/templates/admin/head.template index 37fb6c00..b482efc8 100755 --- a/templates/admin/head.template +++ b/templates/admin/head.template @@ -1,13 +1,22 @@ - - + + + + + + - +
+   ${config["Mir.Name"]}
+
+${lang("back")} + ${lang("head.start")} | ${lang("head.logout")} | ${lang("head.help")} | ${lang("head.search")}

+
-- 2.11.0