import mircoders.global.*;
public class MirBasicProducerToolLocalizer implements MirProducerToolLocalizer {
+ protected static Logfile logger = Logfile.getInstance( MirGlobal.getConfigProperty("Home") + "/" + MirGlobal.getConfigProperty("Mir.Localizer.Logfile"));
public void initializeGenerationValueSet(Map aValueSet) {
// ML: these config settings will be included more beautifully as soon as the new config system is in place
Map configMap = new HashMap();
+ Map utilityMap = new HashMap();
configMap.put("producerDocRoot", MirGlobal.getConfigProperty("Producer.DocRoot"));
configMap.put("storageRoot", MirGlobal.getConfigProperty("Producer.StorageRoot"));
configMap.put("imageHost", MirGlobal.getConfigProperty("Producer.Image.Host"));
configMap.put("imagePath", MirGlobal.getConfigProperty("Producer.Image.Path"));
configMap.put("mirVersion", MirGlobal.getConfigProperty("Mir.Version"));
- configMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
configMap.put("defEncoding", MirGlobal.getConfigProperty("Mir.DefaultEncoding"));
+ utilityMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
+
aValueSet.put("config", configMap);
+ aValueSet.put("utility", utilityMap);
EntityList topicList=null;
EntityList entityList=null;
EntityList parentList=null;
+ EntityList languageList=null;
try {
ModuleLinksImcs linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
+ ModuleLanguage languageModule = new ModuleLanguage(DatabaseLanguage.getInstance());
topicList = topicsModule.getTopicsList();
entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
parentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
-
+ languageList = languageModule.getByWhereClause("", "id", -1);
}
catch (Throwable t) {
- System.out.println("initializeGenerationValueSet: Exception "+t.getMessage());
- t.printStackTrace(System.out);
+ logger.printError("initializeGenerationValueSet: Exception "+t.getMessage());
}
aValueSet.put("topics", topicList);
aValueSet.put("imclist", entityList);
aValueSet.put("parentlist", parentList);
+
+ Map articleTypeMap = new HashMap();
+ articleTypeMap.put("openposting", "0");
+ articleTypeMap.put("newswire", "1");
+ articleTypeMap.put("feature", "2");
+ articleTypeMap.put("topicspecial", "3");
+ articleTypeMap.put("startspecial", "4");
+ aValueSet.put("articletype", articleTypeMap);
};
- public PrintWriter openWriter(String anIdentifier) throws MirLocalizerException {
+ public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure {
File file;
File dir;
);
}
catch (Throwable t) {
- throw new MirLocalizerException(t);
+ throw new MirLocalizerFailure("Failure while opening a PrintWriter",t);
}
};
public void closeWriter(PrintWriter aWriter) {
aWriter.close();
};
+
+ public String filterText(String aText) {
+ return StringUtil.createHTML(
+ StringUtil.deleteForbiddenTags(aText),
+ MirGlobal.getConfigProperty("Producer.ImageRoot"),
+ MirGlobal.getConfigProperty("Producer.MailLinkName"),
+ MirGlobal.getConfigProperty("Producer.ExtLinkName"),
+ MirGlobal.getConfigProperty("Producer.IntLinkName")
+ );
+ }
}