- // delivering html
- if (theList == null || theList.getCount() == 0 || theList.getCount()>1) {
- SimpleHash modelRoot = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(theList);
- modelRoot.put("articletypeHash", DatabaseArticleType.getInstance().getHashData());
-
- EntityContent currentContent;
- EntityList upMediaEntityList;
- EntityList imageEntityList;
- EntityList currentMediaList;
- Entity mediaType;
- EntityMedia uploadedMedia;
- SimpleList opList;
- String imageRoot = MirConfig.getProp("Producer.ImageRoot");
-
- SimpleHash contentHash;
- Class mediaHandlerClass=null;
- MirMedia mediaHandler=null;
- String mediaHandlerName=null;
- Database mediaStorage=null;
- String tinyIcon;
- String iconAlt;
-
- opList = HTMLTemplateProcessor.makeSimpleList(theList);
-
- for (int i=0; i < theList.size();i++) {
- currentContent = (EntityContent)theList.elementAt(i);
- //fetching/setting the images
- upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
- tinyIcon = null;
- iconAlt = null;
- mediaHandler = null;
- mediaHandlerName = null;
- for (int n=0; n < upMediaEntityList.size();n++) {
- uploadedMedia = (EntityMedia)upMediaEntityList.elementAt(n);
- mediaType = uploadedMedia.getMediaType();
-
- //must of had a non-existant to_media_type entry..
- //let's save our ass.
- if (mediaType != null) {
- /*
- * grrr. why doesn't getId return an int! if It
- * did I could just compare the value of getId and
- * pick the biggest one. or is there
- * another way around this that I am missing?
- * can we make getIdasInt() or can we just have
- * another getId() that returns an Int and the VM
- * will handle it transparantly? -mh
- */
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- } catch (Exception e) {
- theLog.printError("ProducerStartpage:problem in reflection: "+mediaHandlerName);
- }
-
- //the "best" media type to show
- if (mediaHandler.isVideo()) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
- iconAlt = "Video";
- break;
- } else if (mediaHandler.isAudio()) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio");
- iconAlt = "Audio";
- } else if (tinyIcon == null && !mediaHandler.isImage()) {
- tinyIcon = mediaHandler.getTinyIcon();
- iconAlt = mediaHandler.getIconAlt();
- }
- }
- }
- //it only has image(s)
- if (tinyIcon == null) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyImage");
- iconAlt = "Image";
- }