1

Topic: New message indicators

I'm getting the hang of using punBB after using phpBB. I like the simplicity of punBB and that it runs on my lowly Pentium Pro 200mhz machine rather nicely.

I have looked at the feature requests and have done a search before asking this question but found nothing specific.

One thing I liked about phpBB was that the new message indicator would only clear when you visited the specific forum and viewed the new message. In punBB it is time based so if you spend too much time viewing a seperate thread or if you open up the board in a seperate Firefox tab and don't view it within the time alloted, the message indicators go away from the whole board. Also I tend to forget if I viewed that new thread and I end up re-opening up the specific forum again.

Can the new indicators hang around until you actually visit the thread and read it?

Re: New message indicators

Yes, it's possible, but the solution to the problem is quite ugly and very "unPunBBish". The solution is to keep track of all topics that a certain user has read. This can be done via the database or via cookies. The latter is the most common solution. You store a serialized array of topic IDs and timestamps in a cookie and check against that array to see if a topic has been read or not. The problem with cookies is that they won't help if people browse the forums from different computers and the fact that a cookie must not be larger than 4 KB according to some RFC. A few hundred topics and 4 KB is no problem to reach. That means you have to prune the array now and then.

The database solution is therefore preferable, but the downside with that is that you need to do more database interaction (which you always want to avoid).

The bottom line is that implementing is isn't difficult, it's just too damned ugly. We fight to keep PunBB simple and in that fight, some features have to be discarded :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: New message indicators

Rickard wrote:

The database solution is therefore preferable, but the downside with that is that you need to do more database interaction (which you always want to avoid).

The bottom line is that implementing is isn't difficult, it's just too damned ugly. We fight to keep PunBB simple and in that fight, some features have to be discarded smile

Well, let's leave it alone then, I like simplicity over features anyday. I'll just use the 'Show new posts since last visit' link, just have to retrain my brain.

Re: New message indicators

Yeah, that's what I do. I hit 'Show new posts since last visit' and then shift-click '[ New posts ]' one topic one at a time.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: New message indicators

Rickard wrote:

Yeah, that's what I do. I hit 'Show new posts since last visit' and then shift-click '[ New posts ]' one topic one at a time.

I use the middle mouse button (the wheel) in Firefox and open up tabs. Don't know what I'd do without my browser smile

Your punbb.org site seems very integrated with the forums. I've been studying the templates to get and idea of how to do it myself. Do you enter the items by hand?

Re: New message indicators

would you consider releasing you cms/portal for all to use? or could you let us know how you did it please? this is about one the most efficient and fastest sites i have ever been to.

~James
FluxBB - Less is more

Re: New message indicators

I use Movable Type for the news. No magic there. The "Recent discussions" on the front page can be done via extern.php or by directly querying the the database like I do. I include common.php from all pages to get access to $cur_user so that I can set the correct CSS. That's about it :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: New message indicators

You could make the new message thing optional in the next release and let the user deside if its to much mysql usages or not? Because I really love your forum. I only added the private message mod and the only thing that I miss is the new message system the way i like it to be database driven and accurate.

9 (edited by ShawnBrown 2004-12-09 15:07)

Re: New message indicators

This could be done on a session basis with JavaScript. It would be very similar to how it works now but with a slight change.

In version 1.1.5, the unread image is sent to the browser like this...
<img src="img/Oxygen_new.png" width="16" height="16" alt="">

But, when Pun prints these img tags, it could add the topic id as an attribute like this...
<img src="img/Oxygen_new.png" width="16" height="16" alt="" id="Topic5281">
(PunBB would have to add "Topic" or "Forum" because ID's can't start with numbers)

A JavaScript could then look for these, and note when a topic or all of the topics in a forum have been visited this session. If a topic was visited, the img with the matching id attribute could be set to theImgTag.style.display='none' with the JavaScript.

This would turn off the new-message images for the topics and forums as you read them. And when you close the browser, the browser would automatically clear the session cookie.

I know PunBB 1.2 is in feature freeze right now. So just consider this post to be purely academic for now.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

10

Re: New message indicators

PunBB 1.2 doesn't use graphics for new posts. There is a div which provides the new post indicator. If there are new posts it has class="inew" otherwise it is class="inormal". Could you adapt your idea just to switch the classes?

BTW: I think I came up with something similar many moons ago, I will try to find it.

EDIT:

Here it is, not the same as your idea but similar thought process at work.
http://punbb.org/forums/viewtopic.php?id=4338&p=1

11 (edited by ShawnBrown 2004-12-09 16:14)

Re: New message indicators

Paul wrote:

Could you adapt your idea just to switch the classes?

Yes, in this case PunBB would have to add an id attribute to the inew div tags. Then, the JavaScript would take a list of these tags and apply something like the following in a loop...
inewArray[i].className = 'inormal';

This would immediately switch the appearance in the browser--no extra tricks or additional page loads. The only change to PunBB's php files would be the addition of id attributes for each inew-div. The javascript call could be added to main.tpl.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New message indicators

I just took a look at 1.2's markup... It's technically possible to implement this entirely in JavaScript. PunBB doesn't have to add any additional id attributes.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New message indicators

that would be an amazing way of doing it

Re: New message indicators

Well, I'd sure be interested in seeing something like this in action. I'm no JavaScript wiz thought. Anyone up for a test?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

15 (edited by ShawnBrown 2004-12-09 18:23)

Re: New message indicators

I'd be interesting in working on this--it might be a week or so before I get to it (I'm pretty busy right now).

I've been looking at the 1.2 beta that Connor has up (http://66.98.138.31/~connorhd/pun1.2beta/index.php). PunBB doesn't have to add any extra id attributes because JavaScript can extract them from the href of the post links (<a href="post.php?tid=4">) on the viewtopic pages.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

16

Re: New message indicators

Viewtopic has changed since your version of the beta. the <a href> has gone with the id being put on the containing div for the post. The id now has a "p" in front of it for obvious reasons so post id's are now

<div id="p8" class="blockpost roweven">

That should make life easier I would have thought.

17 (edited by ShawnBrown 2004-12-09 19:25)

Re: New message indicators

Paul wrote:

That should make life easier...

Yes it does. Does anyone have this new version running where I can take a look at it?

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

18

Re: New message indicators

I don't think there is a copy on public view but that is the only change which is relevant to what you are doing.

Re: New message indicators

Paul wrote:

I don't think there is a copy on public view but that is the only change which is relevant to what you are doing.

I'd really need to see the full markup of the pages before I could make a working version of the script.

If an instance of this updated beta were public, just briefly, I could save static copies of the needed pages and work with them instead of a live forum. If someone is up for this, feel free to IM me--if not, I can wait.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New message indicators

I've been thinking about this a lot - It's almost a 'must have' feature for me. Personally I dont like the cookies / javascript, as they're client side. If you move to another computer / browser, all the new topic info is lost, not to mention browser compatability. I am looking into doing this on server side at the moment, although cant predict the knock on effects this might have on page loading times and the like. The method behind my madness, is to store what would be cookies, server side just as small text files. Obviously these could be dynamicly gziped to and forth as a user logs in, therefore saving some space. This way restores cross browser compatability, if the user moves to another computer it will be fine too. The only thing is, to reduce space further I'd like to have the *cookie* store topics that have not been read, as storing topics that have been read will just use a lot of space over time. Possibly build this index of new topics into the *cookie* at login.

Opinions / comments?

Re: New message indicators

Personally I dont like the cookies / javascript, as they're client side. If you move to another computer / browser, all the new topic info is lost

actually no, the mod ShawnBrown made mark topics read it can only mark them unread if your login times out while the session is still open in the browser (i think) e.g. if you went on the site clicked on one topic and closed the browser, then came back 30min later the topics you didn't read would be marked read

The only thing is, to reduce space further I'd like to have the *cookie* store topics that have not been read

so that would involve writing to every "cookie" when a post is made, say you have 2000 users, 10,000 posts and 500 of the users have never logged on since they first visited, your going to end up with massive load time for making a post and loads of huge files on the server

as storing topics that have been read will just use a lot of space over time.

the best way of doing this is probably setting some time limit, so that if you don't read a topic after a week or something it is marked read anyway

Re: New message indicators

The only thing is, to reduce space further I'd like to have the *cookie* store topics that have not been read

so that would involve writing to every "cookie" when a post is made, say you have 2000 users, 10,000 posts and 500 of the users have never logged on since they first visited, your going to end up with massive load time for making a post and loads of huge files on the server

No, I suggested that a central index is made of topics, in heindsight, this could just be taken from the database I guess. This index is written to the *cookie* when a user logs in. Obviously this needs a lot more thought, will post back in a few days with some solid specifications / initial implimentation.

Re: New message indicators

ahh well it will be interesting to see what you come up with wink oh also, what browsers don't support javascript?

Re: New message indicators

lynx. smile

Re: New message indicators

The thing I don't like about server side solutions to this problem is that it involves a lot of UPDATE's and INSERT's. You can usually get away with some extra SELECT's, but as soon as you start altering the contents of the database too often, all hell breaks loose.

"Programming is like sex: one mistake and you have to support it for the rest of your life."