Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fixes for 2.1.5 Root_B2_1_5_LocaleExt

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If anyone else is using the JForum2.1.5 from CVS from the tag Root_B2_1_5_LocaleExt these might help you out, some things I found and have fixed. Of course these worked for me, but might need changing tweeking to work on your own system.

- On adding forums and categories, the new additions do not appear until Jforum is re-deployed. To fix this in both /src/net/jforum/view/admin/CategoryAction and ForumAction the list() method was changed from

this.context.put("categories", DataAccessDriver.getInstance().newCategoryDAO().selectAll());



to

List l = DataAccessDriver.getInstance().newCategoryDAO().selectAll();
this.context.put("categories", l);





- In order to wrap our website's JSP framework around Jforum to integrate it into the site (embed the forums) I created a filter that evaluates the Jforum stuff and saves it, based on an example of how to modify output using a filter. The the JPSs can be included in the correct order around the Jforum output to correctly build the page. Just google CharArrayWrapper, as it is used in a number of Filter examples.

<filter>
<filter-name>entry</filter-name>
<filter-class>net.jforum.Entry</filter-class>
</filter>

<filter-mapping>
<filter-name>entry</filter-name>
<url-pattern>*.page</url-pattern>
</filter-mapping>



PrintWriter out = response.getWriter();
CharArrayWrapper wrapper = new CharArrayWrapper((HttpServletResponse)response);

chain.doFilter(request, wrapper);
String responseString = wrapper.toString();

RequestDispatcher rd1 = request.getRequestDispatcher("/JSP1.jsp");
rd1.include(request, wrapper);

out.write(responseString);
out.close();

RequestDispatcher rd2 = request.getRequestDispatcher("/JSP2.jsp");
rd2.include(request, wrapper);



But to get that to work, the /src/net/jforum/JForum.java gets an outputstream rather than the writer that we have overwritten in CharArrayWrapper. So to fix this we just modify Jforum.java to getWriter instead of getOutputStream (which it turns into a writer immedietly anyways). So change

out = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), encoding));



to

out = new BufferedWriter(response.getWriter());





- To display attachment images rather than have them always open up the saveas window change the following in /src/net/jforum/view/forum/PostAction in downloadAttach()

if(am.isPhysicalDownloadMode(a.getInfo().getExtension().getExtensionGroupId()))



to

if( a.getInfo().getMimetype().equals("image/jpeg") || a.getInfo().getMimetype().equals("image/gif") ){
this.response.setContentType(a.getInfo().getMimetype());
}
else if(am.isPhysicalDownloadMode(a.getInfo().getExtension().getExtensionGroupId()))



and

this.response.setHeader("Content-Disposition", "attachment; filename=\"" + ViewCommon.toUtf8String(a.getInfo().getRealFilename()) + "\";");



to

if(! (a.getInfo().getMimetype().equals("image/jpeg") || a.getInfo().getMimetype().equals("image/gif")) ){
this.response.setHeader("Content-Disposition", "attachment; filename=\"" + ViewCommon.toUtf8String(a.getInfo().getRealFilename()) + "\";");
}





- Also the bookmark js script does not work in that version as the reference to the /templates/default/js/utils.js has been removed from post_show.htm. just add <#include "js/utils.js"/> to post_show.htm at the top

Thomas
[originally posted on jforum.net by Anonymous]
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic