Some bug fixes in news, adminmessages, section, and polls mo
danvu Mar 16, 2004 9:11 PMBelow are some suggestions of mine to fix problems that I found:
1.News Module:
.Comment.postCommentForm(): //add this check to avoid NullPointerEx when an anonynymous access the news index page
if(allowableHTML != null){
Set entries = allowableHTML.entrySet();
for (Iterator iterator = entries.iterator();iterator.hasNext();)
{
Map.Entry entry = (Map.Entry) iterator.next();
if (((Integer) entry.getValue()).intValue() > 0)
{
page.print(" <" + entry.getKey() + >");
}
}
}//added
.Formater.comment(): //add this change to avoid NullPointerEx when click Post Comment button
change
int commentMax = api.currentUser().getCommentMax();
to
int commentMax = 1024;
if(api.currentUser() != null) //add to avoid NullPointerEx
commentMax = api.currentUser().getCommentMax();
.Topic.index()://add closeTable()
....
else
{
page.openTable();
...
page.print("\n");
page.closeTable(); //add this line
}
2.Section Module: since the path to load images in section doesn't work, modify to load images from html module as Julien suggested
.displayEditSection():
change
page.print("<img src=\"images/sections/" + section.getImage() + "\" border=\"0\" alt=\"\">");
to
page.print("<img src=\"" + section.getImage() + "\" border=\"0\" alt=\"\">");
.userlistsections():
change
page.print("<img src=\"images/" + getName().toLowerCase() + "/" + image + "\" border=\"0\" Alt=\"" + section.getName() + "\">");
to
page.print("<img src=\"" + image + "\" border=\"0\" Alt=\"" + section.getName() + "\">");
.listarticles():
change
page.print("<img src=\"images/" + getName().toLowerCase() + "/" + sectionImage + "\" border=\"0\" alt=\"\">");
to
page.print("<img src=\"" + sectionImage + "\" border=\"0\" alt=\"\">");
3.AdminMessages Module:
.AdminMessagesModule.main(): correct the wrong values of message view
page.print("<option value=\"1\" > \">");
page.print("<option value=\"2\" > \">");
page.print("<option value=\"3\" > \">");
page.print("<option value=\"4\" > \">");
to
page.print("<option value=\"0\" > \">");
page.print("<option value=\"1\" > \">");
page.print("<option value=\"2\" > \">");
page.print("<option value=\"3\" > \">");
4.Polls Module: this fix allows the deployed poll block to be edited and moved around in the block control module. Current version throws error when trying to move or edit the poll block
.PollBlock.preRegister():
Change
pollId = new Integer(name.getKeyProperty("id"));
to
String blockName = name.getKeyProperty("name");
String idStr = blockName.substring(blockName.indexOf('_')+1);
pollId = new Integer(idStr);
.PollsModule.getPollObjectName(Object pollId)
change
return ObjectNameFactory.create("nukes.blocks:name=poll,id=" + pollId);
to
return ObjectNameFactory.create("nukes.blocks:name=poll_" + pollId);
I hope this can give the authors of above modules some ideas to make them better.