Initial revision
[mir.git] / source / mircoders / producer / ProducerFeature.java
diff --git a/source/mircoders/producer/ProducerFeature.java b/source/mircoders/producer/ProducerFeature.java
new file mode 100755 (executable)
index 0000000..3df75f9
--- /dev/null
@@ -0,0 +1,60 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+public class ProducerFeature extends ProducerList {
+
+
+       public void setAdditional(String key, TemplateModel value) {
+               additional.put(key,value);
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException {
+               orderBy="date desc";
+               listTemplate = Configuration.getProperty("Producer.FeatureList.Template");
+               EntityList featureEntityList = featureModule.getByWhereClause("","title", -1);
+               SimpleList featureList = HTMLTemplateProcessor.makeSimpleList(featureEntityList);
+               boolean first=true;
+               whereClause="is_published!=true AND to_article_type=0 AND id IN (";
+               for(int i=0; i < featureEntityList.size(); i++){
+                       if(first==false) {
+                               whereClause += ",";
+                       }
+
+                       EntityTopics currentTopic = (EntityTopics)featureEntityList.elementAt(i);
+                       EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic);
+                       whereClause += currentTopic.getId();
+                       fileDesc = currentTopic.getValue("filename").trim();
+                       setAdditional("topic",HTMLTemplateProcessor.makeSimpleHash(currentTopic));
+
+                       first = false;
+               }
+               whereClause += ")";
+               handleIt(htmlout,user,force);
+       }
+
+       public static void main(String argv[]){
+               try {
+                       new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
+               } catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+}
\ No newline at end of file