1 package mircoders.localizer.basic;
5 import freemarker.template.utility.*;
9 import mircoders.module.*;
10 import mircoders.storage.*;
11 import mircoders.localizer.*;
12 import mircoders.global.*;
14 public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer {
15 protected static Logfile logger = Logfile.getInstance( MirGlobal.getConfigProperty("Home") + "/" + MirGlobal.getConfigProperty("Mir.Localizer.Logfile"));
17 public void initializeGenerationValueSet(Map aValueSet) {
18 // ML: these config settings will be included more beautifully as soon as the new config system is in place
20 Map configMap = new HashMap();
21 Map utilityMap = new HashMap();
23 configMap.put("producerDocRoot", MirGlobal.getConfigProperty("Producer.DocRoot"));
24 configMap.put("storageRoot", MirGlobal.getConfigProperty("Producer.StorageRoot"));
25 configMap.put("productionHost", MirGlobal.getConfigProperty("Producer.ProductionHost"));
26 configMap.put("openAction", MirGlobal.getConfigProperty("Producer.OpenAction"));
27 configMap.put("docRoot", MirGlobal.getConfigProperty("RootUri"));
28 configMap.put("actionRoot", MirGlobal.getConfigProperty("RootUri")+"/servlet/Mir");
29 configMap.put("now", new DateToMapAdapter((new GregorianCalendar()).getTime()));
30 configMap.put("videoHost", MirGlobal.getConfigProperty("Producer.Video.Host"));
31 configMap.put("audioHost", MirGlobal.getConfigProperty("Producer.Audio.Host"));
32 configMap.put("imageHost", MirGlobal.getConfigProperty("Producer.Image.Host"));
33 configMap.put("imagePath", MirGlobal.getConfigProperty("Producer.Image.Path"));
34 configMap.put("mirVersion", MirGlobal.getConfigProperty("Mir.Version"));
35 configMap.put("defEncoding", MirGlobal.getConfigProperty("Mir.DefaultEncoding"));
37 utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
38 utilityMap.put("encodeHTML", new GeneratorHTMLFunctions.encodeHTMLGeneratorFunction());
39 utilityMap.put("encodeURI", new GeneratorHTMLFunctions.encodeURIGeneratorFunction());
41 aValueSet.put("config", configMap);
42 aValueSet.put("utility", utilityMap);
44 EntityList topicList=null;
45 EntityList entityList=null;
46 EntityList parentList=null;
47 EntityList languageList=null;
50 ModuleLinksImcs linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
51 ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
52 ModuleLanguage languageModule = new ModuleLanguage(DatabaseLanguage.getInstance());
54 topicList = topicsModule.getTopicsList();
55 entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
56 parentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
57 languageList = languageModule.getByWhereClause("", "id", -1);
60 logger.printError("initializeGenerationValueSet: Exception "+t.getMessage());
63 aValueSet.put("topics", topicList);
64 aValueSet.put("imclist", entityList);
65 aValueSet.put("parentlist", parentList);
67 Map articleTypeMap = new HashMap();
68 articleTypeMap.put("openposting", "0");
69 articleTypeMap.put("newswire", "1");
70 articleTypeMap.put("feature", "2");
71 articleTypeMap.put("topicspecial", "3");
72 articleTypeMap.put("startspecial", "4");
73 aValueSet.put("articletype", articleTypeMap);
76 public String filterText(String aText) {
77 return StringUtil.createHTML(
78 StringUtil.deleteForbiddenTags(aText),
79 MirGlobal.getConfigProperty("Producer.ImageRoot"),
80 MirGlobal.getConfigProperty("Producer.MailLinkName"),
81 MirGlobal.getConfigProperty("Producer.ExtLinkName"),
82 MirGlobal.getConfigProperty("Producer.IntLinkName")