-/*
- * 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")
- );
- }
-}
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two. You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries. If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so. If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.localizer.basic;\r
+\r
+import java.util.GregorianCalendar;\r
+import java.util.HashMap;\r
+import java.util.Iterator;\r
+import java.util.Map;\r
+\r
+import mir.config.MirPropertiesConfiguration;\r
+import mir.entity.adapter.EntityAdapter;\r
+import mir.entity.adapter.EntityIteratorAdapter;\r
+import mir.log.LoggerWrapper;\r
+import mir.misc.StringUtil;\r
+import mir.util.DateToMapAdapter;\r
+import mir.util.GeneratorHTMLFunctions;\r
+import mir.util.GeneratorIntegerFunctions;\r
+import mir.util.GeneratorListFunctions;\r
+import mir.util.GeneratorStringFunctions;\r
+import mircoders.global.MirGlobal;\r
+import mircoders.localizer.MirProducerAssistantLocalizer;\r
+\r
+public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer {\r
+ protected LoggerWrapper logger;\r
+\r
+ public void initializeGenerationValueSet(Map aValueSet) {\r
+ try {\r
+ Iterator i;\r
+\r
+ Map configMap = new HashMap();\r
+ Map utilityMap = new HashMap();\r
+\r
+ logger = new LoggerWrapper("Localizer.ProducerAssistant");\r
+\r
+// obsolete:\r
+ configMap.put("producerDocRoot", MirGlobal.config().getString("Producer.DocRoot"));\r
+ configMap.put("storageRoot", MirGlobal.config().getString("Producer.StorageRoot"));\r
+ configMap.put("productionHost", MirGlobal.config().getString("Producer.ProductionHost"));\r
+ configMap.put("openAction", MirGlobal.config().getString("Producer.OpenAction"));\r
+ configMap.put("docRoot", MirGlobal.config().getString("RootUri"));\r
+ configMap.put("actionRoot", MirGlobal.config().getString("RootUri") + "/servlet/Mir");\r
+ configMap.put("now", new DateToMapAdapter( (new GregorianCalendar()).getTime()));\r
+ configMap.put("videoHost", MirGlobal.config().getString("Producer.Video.Host"));\r
+ configMap.put("audioHost", MirGlobal.config().getString("Producer.Audio.Host"));\r
+ configMap.put("imageHost", MirGlobal.config().getString("Producer.Image.Host"));\r
+ configMap.put("imagePath", MirGlobal.config().getString("Producer.Image.Path"));\r
+ configMap.put("mirVersion", MirGlobal.config().getString("Mir.Version"));\r
+ configMap.put("defEncoding", MirGlobal.config().getString("Mir.DefaultEncoding"));\r
+\r
+// "new":\r
+ configMap.putAll(MirPropertiesConfiguration.instance().allSettings());\r
+\r
+ utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace());\r
+ utilityMap.put("encodeHTML", new GeneratorHTMLFunctions.encodeHTMLGeneratorFunction());\r
+ utilityMap.put("encodeXML", new GeneratorHTMLFunctions.encodeXMLGeneratorFunction());\r
+ utilityMap.put("encodeURI", new GeneratorHTMLFunctions.encodeURIGeneratorFunction());\r
+ utilityMap.put("subString", new GeneratorStringFunctions.subStringFunction());\r
+ utilityMap.put("subList", new GeneratorListFunctions.subListFunction());\r
+ utilityMap.put("isOdd", new GeneratorIntegerFunctions.isOddFunction());\r
+ utilityMap.put("increment", new GeneratorIntegerFunctions.incrementFunction());\r
+\r
+ aValueSet.put("config", configMap);\r
+ aValueSet.put("utility", utilityMap);\r
+\r
+ aValueSet.put("languages",\r
+ new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "language"));\r
+\r
+ aValueSet.put("topics",\r
+ new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
+\r
+ Map articleTypeMap = new HashMap();\r
+ articleTypeMap.put("openposting", "0");\r
+ articleTypeMap.put("newswire", "1");\r
+ articleTypeMap.put("feature", "2");\r
+ articleTypeMap.put("topicspecial", "3");\r
+ articleTypeMap.put("startspecial", "4");\r
+\r
+ i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "articleType");\r
+ while (i.hasNext()) {\r
+ EntityAdapter articleType = (EntityAdapter) i.next();\r
+\r
+ articleTypeMap.put(articleType.get("name"), articleType.get("id"));\r
+ }\r
+ aValueSet.put("articletype", articleTypeMap);\r
+\r
+ Map commentStatusMap = new HashMap();\r
+ i = new EntityIteratorAdapter("", "", 20, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus");\r
+ while (i.hasNext()) {\r
+ EntityAdapter commentStatus = (EntityAdapter) i.next();\r
+\r
+ commentStatusMap.put(commentStatus.get("name"), commentStatus.get("id"));\r
+ }\r
+ aValueSet.put("commentstatus", commentStatusMap);\r
+ }\r
+ catch (Throwable t) {\r
+ logger.error("initializeGenerationValueSet: Exception while collecting comment statuses" + t.getMessage());\r
+ throw new RuntimeException(t.getMessage());\r
+ }\r
+\r
+ };\r
+\r
+ public String filterText(String aText) {\r
+ return StringUtil.createHTML(\r
+ StringUtil.deleteForbiddenTags(aText),\r
+ MirGlobal.config().getString("Producer.ImageRoot"),\r
+ MirGlobal.config().getString("Producer.MailLinkName"),\r
+ MirGlobal.config().getString("Producer.ExtLinkName"),\r
+ MirGlobal.config().getString("Producer.IntLinkName")\r
+ );\r
+ }\r
+}\r
</if>
</td>
<td colspan="2" align="right" valign="top">
- ${lang("content.published")} <a href="${config.docRoot}/help/content.html"><img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>:
+ ${lang("content.published")}
<input type="checkbox" name="is_published" value="1"<if article.is_published!="0" && article.is_published!=""> checked</if>>
<if new=="1">
<input type="submit" name="save" value="${lang("insert")}">
<tr>
<td align="right" valign="top" class="editfieldname">
- ${lang("content.topic")}
- <a href="${config.docRoot}/help/content.html"><img src=" ${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>
- <a href="${config.docRoot}/help/content.html">
- <img src="${config.docRoot}/img/help.gif" border="0" align="middle"></a>
+ ${lang("content.articletype")} /
+ ${lang("content.language")}:
</td>
<td colspan="4">
- <table border=0 cellpadding="0" cellspacing="0">
- <tr>
- <td>
<select name="to_article_type">
<list articletypes as a>
<option value="${a.id}" <if (a.id == article.to_article_type)>selected</if>>${lang("articletypes."+a.name)}</option>
</list>
</select>
- </td>
- <td rowspan="2">
- <select name="to_topic" size="5" multiple>
- <list topics as t>
- <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
- </list>
- </select>
- </td>
- </tr>
- <tr>
- <td>
<select name="to_language">
<list languages as l>
<option value="${l.id}" <if (l.id == article.to_language)>selected</if>>${l.name}</option>
</list>
</select>
- <td>
- </tr>
- </table>
+ </td>
+ </tr>
+ <tr>
+ <td align="right" valign="top" class="editfieldname">
+ ${lang("content.topic")}:
+ </td>
+ <td colspan="4">
+ <if config["Mir.Localizer.Admin.TopicListFlavor"]!="0">
+ <table border=0 cellpadding="0" cellspacing="0">
+ <tr>
+ <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
+ <list topics as t>
+ <if col=="0">
+ </tr><tr>
+ <assign col=config["Mir.Localizer.Admin.TopicListColumns"]>
+ </if>
+ <td>
+ <input type="checkbox" name="to_topic" value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>checked</if></list>>${t.title}
+ </td>
+ <assign col=utility.increment(col, "-1")>
+ </list>
+
+ <if col!="0">
+ <td colspan="${col}">
+
+ </td>
+ </if>
+ </tr>
+ </table>
+ <else>
+ <select name="to_topic" size="5" multiple>
+ <list topics as t>
+ <option value="${t.id}" <list article.to_topics as to><if (t.id == to["id"])>selected</if></list>>${t.title}</option>
+ </list>
+ </select>
+ </if>
</td>
</tr>
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.subtitle")}: <br>
- <a href="${config.docRoot}/help/content.html#title">
- <img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>
</td>
<td colspan="4">
<input type="text" size="20" name="subtitle" value="${utility.encodeHTML(article.subtitle)}">
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.location")}:
- <a href="${config.docRoot}/help/content.html"><img src="${config.docRoot}/img/help.gif" border="0" align="middle"></a>
</td>
<td colspan="4" >
<input type="text" size="40" name="source" value="${utility.encodeHTML(article.source)}">
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.creator")}:
- <a href="${config.docRoot}/help/content.html">
- <img src="${config.docRoot}/img/help.gif" border="0" align="middle"></a>
</td>
<td colspan="4">
<input type="text" size="40" name="creator" value="${utility.encodeHTML(article.creator)}"><br>
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.creator.email")}/${lang("content.creator.url")}:
- <a href="${config.docRoot}/help/content.html">
- <img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>
</td>
<td colspan="4" >
<input type="text" size="20" name="creator_email" value="${utility.encodeHTML(article.creator_email)}">
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.creator.address")}/${lang("content.creator.telephone")}:
- <a href="${config.docRoot}/help/content.html">
- <img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>
</td>
<td colspan="4" >
<input type="text" size="20" name="creator_address" value="${utility.encodeHTML(article.creator_address)}">
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.abstract")}:
- <a href="${config.docRoot}/help/content.html">
- <img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>
</td>
<td colspan="4">
<textarea cols="70" rows="15" name="description" wrap=virtual>${utility.encodeHTML(article.description)}</textarea>
<tr>
<td align="right" valign="top" class="editfieldname">
${lang("content.content")}:
- <a href="${config.docRoot}/help/content.html"> <img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle"></a>
<br>
${lang("content.html")}
<input type="checkbox" name="is_html" value="1"<if article.is_html=="1"> checked</if>>
- <a href="${config.docRoot}/help/content.html">
- <img src="${config.docRoot}/img/help.gif" border="0" align="absmiddle">
- </a>
</td>
<td colspan="4">
<textarea cols="70" rows="20" name="content_data" wrap=virtual>${article.content_data}</textarea>