package mircoders.localizer.basic;
import java.util.*;
+import java.io.*;
import freemarker.template.utility.*;
import mir.misc.*;
+import mir.entity.*;
+import mircoders.module.*;
+import mircoders.storage.*;
import mircoders.localizer.*;
import mircoders.global.*;
Map configMap = new HashMap();
- configMap.put("producerDocRoot", MirGlobal.getConfigProperty("Producer.DocRoot"));
+ configMap.put("producerDocRoot", "");//MirGlobal.getConfigProperty("Producer.DocRoot"));
configMap.put("storageRoot", MirGlobal.getConfigProperty("Producer.StorageRoot"));
configMap.put("productionHost", MirGlobal.getConfigProperty("Producer.ProductionHost"));
configMap.put("openAction", MirGlobal.getConfigProperty("Producer.OpenAction"));
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"));
aValueSet.put("config", configMap);
+
+ 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);
+ }
+
+ aValueSet.put("topics", topicList);
+ aValueSet.put("imclist", entityList);
+ aValueSet.put("parentlist", parentList);
};
+
+ public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure {
+ File file;
+ File dir;
+
+ try {
+ file = new File( anIdentifier );
+ dir = new File(file.getParent());
+ if (dir!=null && !dir.exists()){
+ dir.mkdirs();
+ }
+
+ return new PrintWriter(
+ new OutputStreamWriter(
+ new FileOutputStream(file), MirGlobal.getConfigProperty("Mir.DefaultEncoding")
+ )
+ );
+ }
+ catch (Throwable 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")
+ );
+ }
}