Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
My users have once again asked for the ability to either have a sound play or a window pop up when they receive a private message.

This free Invision Board software (which you can see at www.moviejustice.com ) does this.

When I sign on there, if I've got a private message... as small new window pops up and says "You have X new private messages... click here to read".

I myself am on the fence if I want this handled any differently.... I personally wouldn't mind a sound... although I don't know if that's possible from a browser.

Pop ups could get annoying... especially since I get nine billion Private Messages.

Anyone else ever wish for enhancements to this?

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
As far as I know sounds are not supported in the browsers with the exception of imbedding windows media player (IE), RealPlayer (NS,IE,Mozilla?), Flash(NS,IE,Mozilla?) or perhaps a java applet that can load a sound playable by the applet in .au format. I could be wrong on some of this as it's not something I have looked into ver deeply. I do believe that such a use would be bulky, to say the least.

You could change the PM flasher that is used in the send_header function to open a popup window instead. This would be a simple task.

In your ubbt.inc.php file replace this:

if (($Privates) && (!$bypass)) {
$privateslink = "<a href="{$config['phpurl']}/viewmessages.php?Cat=$Cat&box=received" target="_top"><img src= "{$config['images']}/newpm.gif" border="0" alt="{$ubbt_lang['WEL_PRIV2']} $Privates {$ubbt_lang['WEL_PRIV3']}" /></a>";
}


with this:


if (($Privates) && (!$bypass)) {
$privateslink = "<script language="javascript" type="text/javascript">
window.open('{$config['phpurl']}/viewmessages.php?Cat=$Cat&box=recieved','shoutboxpal','width=200,height=200,top=100,left=150,screenX=1,screenY=1,scrollbars=yes,resizable=yes');
</script>";
}



I haven't tested this but it should give you an idea of what to do.


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Wow.

Thanks Dave.

Yes, that was the start I needed.

I'm working with this so that the flasher and the popup come up.
I've also customized a popup document.

When I get this all set, I'll post.

OK - I've got a Basic HTML question I'm sure.......

So I have the a popup (as you illustrate) come up.... it says "You have x new messages, click Here to view messages".

How do I have it when you click the link in that little window.... open in the threads window that the popup came from???

(As always, Dave you're a genius)

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
In the popup window use a link, something like this:

<a href="javascript: void(0)" onclick="window.opener.location='{$config['phpurl']}/viewmessages.php?Cat=$Cat&box=recieved'">View Messages</a>


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thanks Dave!

Got this tweaked out very nicely.

Will post soon!!!!

T h a n k    Y o u !

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Now...

with this one I might be pushing my luck....

but is there a javascript thing to close that little popup window.

For example, when threads has no messages... can I have it kill the popup (which might still be open saying 'you have 1 new message').

Oh Dave the wizzard.... ?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
It was a long time since I did any real work with javascript but from what I remember it isn't possible to close windows opened by other pages through javascript. I can be wrong though.

But it is possible to load a new html page in the popup window which in turn closes the window. All you need to do is set TARGET="shoutboxpal" and call a page which has <body onload="window.close()"> in it.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
This link:

<a href="javascript:window.close()">Close Window</a>

Will close the window.

Also, you could have the popup window close automaticly after they click to view their messages:

<a href="javascript: void(0)" onclick="window.opener.location='{$config['phpurl']}/viewmessages.php?Cat=$Cat&box=recieved';window.close();">">View Messages</a>





Just a question, are you displaying the popup even when they have no messages? That would be annoying, lol.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thanks guys.

I will give that a go.

[]Just a question, are you displaying the popup even when they have no messages? That would be annoying, lol. [/]

No... I left $privateslink alone in ubbt.inc.php and created $privatespopup and added that into the menubar right after privates link. That opens the window only if there are private messages.

I could make it close when you click to view the messages... but then you get to the message screen (and if there's more than one message - it will pop up again... it functions just like the flasher - each page load it checks.).

So I thought I'd try to make it have the value to close the window if there was no flasher. That way if they left it open it wouldn't be outdated.

ie if the old thing is still sitting there saying you have 1 new message... and then they get a new message... it looks no different and is not effective.

I think I've taken your tidbits a long way.

I *guess* it would be possible to have that popup play a sound file.
Might play with that. I think I'd want to make that (maybe even the popup) a user option in their profile.

Will see how my users react. But each time we talk new features they talk about how sometimes they don't realize that they have new PMs etc and want a popup or something.

The few that I have sent PMs to this morning LOVE it.

Me too... I've found if I leave "who's online" open in the background... the PM popup box will come to the front. Thus "instant notification".

Thanks!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Well....

I guess now I understand what Gardener.
The script on one page can't close another window? Right?

In other words... in threads I'm trying to call this:

$privatespopup = "<script language="javascript" type="text/javascript"> window.close('messagepopup');</script>";

To close my popup window named 'messagepopup'.... but it closes the current (threads) window instead.

I guess I would need to make my little message popup window query to see if there are private messages.... and close if there are none.

Unless I'm missing something with my javascript.

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
No, Gardener is right. This is do to the "sandbox" protection that keeps javascript from affecting other windows it was not related to in opening.

Also, I forgot that I should mention that WebTV may have problems with the popups in that they may be forced to the popup window and then to their messages and then back to browsing. Actually, the popup may not open at all for WebTV.


Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
The page that opened the popup can close it as well, but not other pages.

Just change the opening script to this:
newwin = window.open(....

After that, you can close the popup later on the same page by doing this:
newwin.close();

But that won't help you much...

Making the popup page reload and query for messages sounds like the best way to go.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
[]No, Gardener is right. This is do to the "sandbox" protection that keeps javascript from affecting other windows it was not related to in opening.
[/]
So does that mean that there might be a way since Javascript opened this popup, that it can also close it?

Otherwise I'll make the popup page a little script that refreshes every once in a while and checks for Private Messages...and closes itself if there are none.

Thanks.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Only the page (parent) can access the popup (child) via javascript.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
[]

The page that opened the popup can close it as well, but not other pages.

Just change the opening script to this:
newwin = window.open(....

After that, you can close the popup later on the same page by doing this:
newwin.close();

But that won't help you much...

[/]

Ah, OK.
Yeah.. the threads page reloads to different pages. I'll try this.. but it's technically not the same page... I'm calling it from ubbt.inc.php and opening it in the navbar template.

Will try this... but otherwise I'll make a script.

Thanks guys.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
You could change the flashing envelope gif to a flash file that has a sound playing. That would be pretty easy to do.

Last edited by Aglavalin; 11/01/2002 2:55 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Woooo Hooooo!!!

I've got this daddy working perfectly!!!!

It pops up when there are messages... refreshes every minute... and when there are no messages it closes the window. So even if it's in the background... it goes away when there are no more new messages!!!



Thanks guys!

Will write up all I did, and zip it (as I've got a new file) and post for all who are interested.


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Got all my instructions written up.... made it all pretty... language file and who's online savvy.

Posted here.

Enjoy!

Thanks again guys.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Nettomo
Nettomo
Germany, Bremen
Posts: 417
Joined: November 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)