try {
//media to content
EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ SimpleList contentList = (SimpleList)mergeData.get("contentlist");
+ SimpleHash contentHash = (SimpleHash)contentList.get(k);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
SimpleList mediaListAudio = new SimpleList();
SimpleList mediaListImages = new SimpleList();
SimpleList mediaListVideo = new SimpleList();
} //end if is_published
} //end if media_type != null
} //end for
- SimpleList contentList = (SimpleList)mergeData.get("contentlist");
- SimpleHash contentHash = (SimpleHash)contentList.get(k);
+
+
contentHash.put("to_media_audio", mediaListAudio);
contentHash.put("to_media_images", mediaListImages);
contentHash.put("to_media_video", mediaListVideo);
contentHash.put("to_media_other", mediaListOther);
} //end if currentMediaList != null
+
+ //content to html
+ if(((SimpleScalar)contentHash.get("is_html")).getAsString().equals("0") ){
+ SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
+ String temp = tempScalar.getAsString();
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.createHTML(temp);
+ temp = StringUtil.decodeHTMLinTags(temp);
+ contentHash.put("description",temp);
+ }
+ } else {
+ SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
+ String temp = tempScalar.getAsString();
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.decodeHTMLinTags(temp);
+ contentHash.put("description",temp);
+ }
+ }
- //content to html
- if(currentContent.getValue("is_html").equals("0")){
- String temp = (String)currentContent.getValue("description");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.createHTML(temp);
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContent.setValueForProperty("description",temp);
- }
- } else {
- String temp = (String)currentContent.getValue("description");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContent.setValueForProperty("description",temp);
- }
- }
} catch (Exception e) {
logHTML(htmlout, "Producer.List id " +currentContent.getId()+ " seems corrupt, skipping it :: "+e.toString());
theLog.printError("Producer.List id " +currentContent.getId()+ " seems corrupt, skipping it :: "+e.toString());
SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList);
for (int i=0; i < entityList.size();i++) {
currentContent = (EntityContent)entityList.elementAt(i);
- try {
+ try {
//fetching/setting the images
upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
try {
//media to content
currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ contentHash = (SimpleHash)startItemList.get(k);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
SimpleList mediaListAudio = new SimpleList();
SimpleList mediaListImages = new SimpleList();
SimpleList mediaListVideo = new SimpleList();
} //end if is_published
} //end if media_type != null
} //end for
- contentHash = (SimpleHash)startItemList.get(k);
contentHash.put("to_media_audio", mediaListAudio);
contentHash.put("to_media_images", mediaListImages);
contentHash.put("to_media_video", mediaListVideo);
contentHash.put("to_media_other", mediaListOther);
} //end if currentMediaList != null
- } catch (Exception e) {
+ //convert to html
+ if ( ((SimpleScalar)contentHash.get("is_html")).getAsString().equals("0") ) {
+ SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
+ String temp = StringUtil.createHTML(tempScalar.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName);
+ temp = StringUtil.decodeHTMLinTags(temp);
+ contentHash.put("description",temp);
+ }
+
+ } catch (Exception e) {
logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
}
try {
//media to content
currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ contentHash = (SimpleHash)featureList.get(k);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
SimpleList mediaListAudio = new SimpleList();
SimpleList mediaListImages = new SimpleList();
SimpleList mediaListVideo = new SimpleList();
} //end if is_published
} //end if media_type != null
} //end for
- contentHash = (SimpleHash)featureList.get(k);
contentHash.put("to_media_audio", mediaListAudio);
contentHash.put("to_media_images", mediaListImages);
contentHash.put("to_media_video", mediaListVideo);
contentHash.put("to_media_other", mediaListOther);
} //end if currentMediaList != null
- } catch (Exception e) {
+
+ //convert to html
+ if ( ((SimpleScalar)contentHash.get("is_html")).getAsString().equals("0") ) {
+ SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
+ String temp = StringUtil.createHTML(tempScalar.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName);
+ temp = StringUtil.decodeHTMLinTags(temp);
+ contentHash.put("description",temp);
+ }
+
+ } catch (Exception e) {
logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
}
EntityContent currentContent;
if(entityList != null && entityList.size()==1){
currentContent = (EntityContent)entityList.elementAt(0);
- try {
+ try {
SimpleHash specialHash = HTMLTemplateProcessor.makeSimpleHash(currentContent);
currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
specialHash.put("to_media_video", mediaListVideo);
specialHash.put("to_media_other", mediaListOther);
} //end if currentMediaList != null
+ //convert to html
+ if ( ((SimpleScalar)specialHash.get("is_html")).getAsString().equals("0") ) {
+ SimpleScalar temp = (SimpleScalar)specialHash.get("description");
+ specialHash.put("description",StringUtil.createHTML(temp.getAsString()));
+ }
setAdditional("special",specialHash);
} catch (Exception e) {
theLog.printError("ProducerTopics: problem with start special: "+currentContent.getId()+" "+e.toString());
{
SimpleHash mergeData = new SimpleHash();
boolean setMedia=false;
+ boolean setTopic = false;
try {
WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
theLog.printDebugInfo("id: "+cid);
//insert was not successfull
if(cid==null){
- //How do we know that it was not succesful cause of a
+ //How do we know that it was not succesful cause of a
//dupe, what if it failed cause of "No space left on device"?
//Or is there something I am missing? Wouldn't it be better
//to have an explicit dupe check and then insert? I have no
}
String[] to_topicsArr = mp.getParameterValues("to_topic");
- if (to_topicsArr != null && to_topicsArr.length > 0) {
+
+ if (to_topicsArr != null && to_topicsArr.length > 0) {
try{
DatabaseContentToTopics.getInstance().setTopics(cid,to_topicsArr);
- theLog.printError("setting content_x_topic success");
+ setTopic = true;
+ theLog.printError("setting content_x_topic success");
} catch (Exception e) {
theLog.printError("setting content_x_topic failed");
contentModule.deleteById(cid);
//if the client browser sent us unknown (text/plain is default)
//or if we got application/octet-stream, it's possible that
//the browser is in error, better check against the file extension
- if (contentType.equals("text/plain") ||
+ if (contentType.equals("text/plain") ||
contentType.equals("application/octet-stream")) {
- /**
+ /**
* This is just a temporary way to get the content-type via
* the .extension , we could maybe use a magic method, by looking
* at the header (first few bytes) of the file. (like the file(1)
* command).
- * The Oreilly method relies on the content-type that the client
+ * The Oreilly method relies on the content-type that the client
* browser sends and that sometimes is application-octet stream with
* broken/mis-configured browsers.
- *
- * The map file should be Mir/content-types.properties, it's the
- * default Sun Java file with some additional entries that it did
- * not have. So if you support a new media type you have to make
+ *
+ * The map file should be Mir/content-types.properties, it's the
+ * default Sun Java file with some additional entries that it did
+ * not have. So if you support a new media type you have to make
* sure that it is in this file -mh
*/
contentType = FileUtil.guessContentTypeFromName(fileName);
theLog.printError("CONTENT TYPE IS: "+contentType);
- if (contentType.equals("text/plain") ||
+ if (contentType.equals("text/plain") ||
contentType.equals("application/octet-stream")) {
throw new ServletModuleUserException("One or more files of unrecognized types");
}
//the where clause to find the media_type entry
//from the content-type.
- //we use the media type entry to lookup the
+ //we use the media type entry to lookup the
//media Handler/Storage classes
String wc = " mime_type='"+contentType+"'";
//if direct op producing startpage
if (directOp.equals("yes")) new ProducerStartPage().handle(null,null);
+ //produce the topicPages if set
+ //should be more intelligent
+ if(setTopic==true) new ProducerTopics().handle(null,null);
+
// sync the server
//should be configureable
int exitValue = Helper.rsync();