Which version of Roller do you want to do this with? There are a couple of ways you can do this: you can write a servlet or a Struts action to handle posting of an entry from external app. Either way, you can use static factory methods in RollerRequest and RollerContext to obtain references to those objects. Use RollerFactory.getRoller() to get at Roller object which is the main entry point into business logic tier. SInce Roller 2.0 there is RollerConfig object. You can call RollerConfig.getProperty("uploads.dir") to get the path where images are stored.

Look in org.roller.xmlrpc for example on creating entry from request params. Look in UploadFileFormAction and/or FileManagerImpl for example of how file uploads are handled. Roller uses commons- fileupload library to parse multipart form data which is what you should use as well.

Hope this helps,

Max


On Mar 29, 2006, at 1:01 AM, Bill Tribley wrote:

* Retrieve context variables so I can place the uploaded images or files in a subdirectory by blog

I assume that document.weblogEntryFormEx.getCategory() will return the category of the blog being edited. * Parse multipart mime and save attached files (I wish...). Does Roller have a feature by which non-html parts of a multipart editor output can be saved to the upload directory and the body saved normally? Or, do I need to write a script that will accept the content, parse it out, pass the html part to document.weblogEntryFormEx.text.value and decode/save the non-html parts to the upload directory? * Does the /resources context include the blog category (~tomcat_user/roller_data/uploads/sandbox for the "sandbox" blog) , or is it the "top-level" resources directory ~tomcat_user/ roller_data/uploads ? The BlogJet client had a fully qualified url when posting a local image to the rollertech blog: http:// blogs.tribley.us/roller/resources/rollertech/BlogJet_account.jpg

What is a little painful about this is that BlogJet has a local upload feature, just like the Sferyx editor. BlogJet uses the blogger api to seamlessly upload the message and put the files in an upload directory. All the urls are properly rewritten. I am looking for some similar way to use this editor. If I have to call the blogger api (don't know if I can from the jsp page that handles the editor...) it will mean parsing out the multipart mime, restating it in xml and sending it to the api, which seems a bit backward.

If I crack this one I will post it, others may need a slick editor.

Thanks in advance for any help,
Bill

Current jsp to fire up the editor:
[EMAIL PROTECTED] dir[/usr/local/roller/weblog]
$ cat sferyx_applet.jsp

<%-- This page is designed to be included in edit-weblog.jsp --%>
<%@ page import="org.roller.presentation.weblog.formbeans.WeblogEntryFormEx" %>
<%@ include file="/taglibs.jsp" %>

<script type="text/javascript">
<!--
function postWeblogEntry(publish)
{
document.weblogEntryFormEx.text.value = document.Sferyx.getContent();
    if (publish)
        document.weblogEntryFormEx.publishEntry.value = "true";
    document.weblogEntryFormEx.submit();
}
-->
</script>

<html:hidden property="text" />

<%-- Use the Sferyx applet --%>
<APPLET CODEBASE="../editor/" CODE="sferyx.administration.editors.HTMLEditor" ARCHIVE="HTMLEditorAppletPro.jar" NAME="Sferyx" WIDTH="800" HEIGHT="600">

<!-- Load text into applet by using the form bean -->
<PARAM NAME="initialContent"
    VALUE="<HTML><HEAD></HEAD><BODY><bean:write
        name="weblogEntryFormEx" property="text" /></BODY></HTML>">
<PARAM NAME ="supressLocalFileDialog" VALUE="true">
<PARAM NAME = "uploadContentAsMultipartFormData" VALUE="false">
<PARAM NAME = "uploadedObjectsTranslationPath" VALUE="'/resources'">
</APPLET>


<br />


Reply via email to