• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Posting programmatically

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I want to have a job running in my system that automatically posts new topics into JForum, based on certain events.

It doesn't appear that JForum was really designed for headless operation. I was wondering if anyone out there has done tis before, and if so, how. Was it just JDBC? Is there something more fancy I should try. Any pointers would be greatly appreciated.

Thanks in advance,
Joe
[originally posted on jforum.net by Mojo]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, we don't have a public API for this, although this is being fixed on the CVS.

The easier way for you would be to send an HTTP request to the actions - that would ensure that all required data, like HttpRequest, Database connection and JForumExecutionContext are correctly set.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see how the http works but what if we want to first check and see if a post exists?

For example my site has information about zoning. I want users to discuss these zoning cases. The first time the link would say:

"Create a new discussion"

If there are postings I want to say:

"xx messages -- click to read"

How do I programatically determine if a post exists?

Mark
[originally posted on jforum.net by conquest]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
��?��?�?����������,����?��?

[originally posted on jforum.net by adam]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm .. right don't understand that reply

Certainly this is a common request. I assume I have to use some freemarker templating stuff. So add a few new .htm pages and use them as includes in my jsp?

Update:

Ok so I've been digging through the templates. The first thing I want to do is start a new post. So I see I can have this url to do that:

http://www.mysite.com/fcforums/jforum.page?module=posts&action=insert&forum_id=19&subject=zoning

Now what I want to do is pass the subject in the url as above. Does this require changing the following:

config/urlPattern.properties
src/net/jforum/view/forum/PostAction.java


[originally posted on jforum.net by conquest]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't have to change anything. Just pass all parameters. For example:



Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
edit: Ok I'm switching gears a bit. After some thought over night, what I really would like to do is post a message automatically and then (important piece) get the id of that new posting so I can store it in my database.

What's the easiest way to accomplish this?



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Well I'm talking about pre-populating the form, so changing from post to get won't change this.

Sorry not sure I was clear in the previous post
[originally posted on jforum.net by conquest]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried that passing subject ... But the subject field is not populated in the new topic page.


Rafael Steil wrote:You don't have to change anything. Just pass all parameters. For example:



Rafael


[originally posted on jforum.net by conquest]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I suggest then is to edit post_form.htm and change the <form> to use GET instead of post. Then grab the query string and try using it!

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make a change in the insertSave() method of the PostAction.java class, to add the id to some place (the request / session/) where you can get from.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this is an old thread, but I wanted to find out if the API was still under development to expose this functionality. For the OP, I am doing something similar, in posting foreign-data into one of my forums programmatically. The algorithm I used was as follows:

1) create a topic, and save it
2) create a post and save it
3) associate this post id as the first post in the topic, then update the topic
4) use the TopicRepository to update the topic cache
5) assumably, you would update the forum cache through the ForumRepository, but I'm having trouble doing this correctly atm
[originally posted on jforum.net by uniq]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the best approach so far, in fact.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic