Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: edi67 on April 07, 2004, 10:53:22 AM

Title: New messages flashing mail
Post by: edi67 on April 07, 2004, 10:53:22 AM
will be very useful have one little window for advise you that have one PM in your email box of forum

[edit] changed topic title [/edit]
Title: Re: window advise for PM
Post by: klumy on April 07, 2004, 01:34:33 PM
you mean a popup window.

yeah this would be cool
YabbSE already supported such a feature,
Title: Re: window advise for PM
Post by: [Unknown] on April 07, 2004, 01:45:02 PM
Quote from: klumy on April 07, 2004, 01:34:33 PM
YabbSE already supported such a feature,

If you mean supported as in had, you are wrong.  If you mean supported as in could do, so can SMF.

-[Unknown]
Title: Re: window advise for PM
Post by: edi67 on April 07, 2004, 04:35:47 PM
great ADMIN this will be very nice addon one popup window that advise you for PM and clicking u will able to see your PM in another window
Title: Re: window advise for PM
Post by: dschwab9 on April 07, 2004, 11:40:11 PM
I did this on mine:


<?php
// Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
                             echo 
'
<a href="' 
$scripturl '?action=im"><img src="' $settings['images_url'] . '/newim.gif" border="0" />(' $context['user']['unread_messages'] . ')</a> ' $context['menu_separator'] . '';
?>




It puts a little flashing mail icon in the menu when they have new messages.
Title: Re: window advise for PM
Post by: edi67 on April 08, 2004, 04:47:44 AM
where this u code must be write?
Title: Re: window advise for PM
Post by: tmlfever on August 27, 2004, 02:37:38 PM
Can someone answer this please.

I would be interested in knowing also.
Title: Re: window advise for PM
Post by: dschwab9 on August 27, 2004, 06:27:33 PM
Index.template.php

Find:

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;



Add after:

// Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
      echo '
<a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newim.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ' . $context['menu_separator'] . '';


change newim.gif to whatever the name of the image is (mine is a flashing envelope)

Menu ends up looking like this.  Number in () is the number of new messages:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fbbs.off-road.com%2Fubbthreads%2Fimages%2Fnewpm.gif&hash=500b6682f26a567ebbf4776b6cb78b670fabd33b) (4) | Home | Help | Search | Admin | Profile | Calendar |
Title: Re: window advise for PM
Post by: Elijah Bliss on August 27, 2004, 07:56:22 PM
Quote from: dschwab9 on August 27, 2004, 06:27:33 PM
Index.template.php

Find:

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
        global $context, $settings, $options, $scripturl, $txt;



Add after:

  // Show Flashy icon if user has new messages and it not a guest
   if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
                      echo '
                              (' . $context['user']['unread_messages'] . ') ' . $context['menu_separator'] . '';


change newim.gif to whatever the name of the image is (mine is a flashing envelope)

Menu ends up looking like this.  Number in () is the number of new messages:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fbbs.off-road.com%2Fubbthreads%2Fimages%2Fnewpm.gif&hash=500b6682f26a567ebbf4776b6cb78b670fabd33b) (4) | Home | Help | Search | Admin | Profile | Calendar |

Looks cool! I'll try it out tonight!
Title: Re: window advise for PM
Post by: tmlfever on August 28, 2004, 12:03:58 AM


Thank you that was Brilliant!!

Can I ask another question please?

My forum is www.tmlforum.net You can log on with the user name, test and pasword also, test

How do I get it to show in the middle where the mail info is now.
Title: Re: window advise for PM
Post by: Metho on August 28, 2004, 12:10:27 AM
In index.template.php FIND: // Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo ', ', $txt[152], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[153] : $txt[471], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
echo '.';


That's where it displays the Hey, username, you have X messages, x are new. I think that's where you wanted it, yes?

- Methonis
Title: Re: window advise for PM
Post by: tmlfever on August 28, 2004, 12:14:17 AM
Yes, that is exactly where I would like to have it, Once I find the code above what do I do?

Thank you for your time on this.
Title: Re: window advise for PM
Post by: Metho on August 28, 2004, 12:56:33 AM
AFTER that code ADD: // Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
      echo '
<a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newim.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ' . $context['menu_separator'] . '';


Where is says newim.gif, change it to whatever image you want displayed and make sure it's uploaded to Themes/yourtheme/images

- Methonis
Title: Re: window advise for PM
Post by: dschwab9 on August 28, 2004, 01:02:18 AM
If you're putting it up there, you don't want the menu separator in it.  Probably something like this:


// Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
      echo '
<a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newim.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ';
Title: Re: window advise for PM
Post by: Metho on August 28, 2004, 01:03:16 AM
Err, yeah, forgot to clip that part out. :D

- Methonis
Title: Re: window advise for PM
Post by: tmlfever on August 28, 2004, 01:21:43 AM
Metho, I copied dschwab9  code and it looked fine with your code or his they both worked.

Should I know what this menu separator is?

Thanks a million guys.
Title: Re: window advise for PM
Post by: Metho on August 28, 2004, 01:26:48 AM
He just had the original code put a | character between it because he'd had his on his menu. Not a big deal. :)

- Methonis
Title: Re: window advise for PM
Post by: tmlfever on August 28, 2004, 01:30:46 AM
Thank You so much it looks GREAT :D
Title: Re: window advise for PM
Post by: dschwab9 on August 28, 2004, 07:03:54 AM
If the | is not actually showing, then it is probably causing "Undefined index" errors or something.  Not sure if that variable is defined at that point or not.  Basically, if they both look the same, and you are happy with the way it looks, use my code.
Title: Re: New messages flashing mail
Post by: johnm on November 20, 2004, 09:42:25 PM
as the line above in index.template.php all ready displays new messages there no need to display the (n) of new messages again

if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
echo '<a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newpm.gif" border="0" /></a> ';
Title: Re: New messages flashing mail
Post by: EG on November 29, 2004, 06:39:43 PM
being the total simpleton that i am at times, and also a scaredy cat, afraid to break what works...

I would like the flashy gif to appear at the top of the screen,
Quoteyou have 66 messages, 1 are new.

so that the flashy gif appears before the 1

Ive worked out what line to put it on... but obviously it flashes all the time, because IM unsure where exactly to put the ['unread_messages'] code bit... without messing up the other code :(
Title: Re: New messages flashing mail
Post by: EG on November 29, 2004, 06:51:54 PM
ok Im a total der brain!

just re read this topic more carefully...

excuse me  :-[
Title: Re: New messages flashing mail
Post by: Cypher7 on November 29, 2004, 06:56:50 PM
Quote from: EG on November 29, 2004, 06:51:54 PM
ok Im a total der brain!

just re read this topic more carefully...

excuse me  :-[

And I was just fishing out the code for ya and all... ;)

I have the same on my board, works well...
Title: Re: New messages flashing mail
Post by: EG on November 29, 2004, 07:00:29 PM
aww thanks for that!

I just didnt read it through properly!  typical ::)

yeah, the members were complaining that they didnt notice when they got a new IM as easily now... the little flashing envelope works wonders ;)
Title: Re: New messages flashing mail
Post by: Cypher7 on November 29, 2004, 07:06:00 PM
Quote from: EG on November 29, 2004, 07:00:29 PM
the little flashing envelope works wonders ;)

I second that!!
Title: Re: New messages flashing mail
Post by: cleavers1066 on December 07, 2004, 08:19:02 AM
Thanks for this very helpful, and certainly a million miles better than a pop-up.
Title: Re: New messages flashing mail
Post by: mytreo on January 28, 2005, 07:18:23 AM
Quote from: cleavers1066 on December 07, 2004, 08:19:02 AM
Thanks for this very helpful, and certainly a million miles better than a pop-up.

Totally agree. The flashing mail icon should be standard in SMF (and it would be nice to see it on this forum too!)
Title: Re: New messages flashing mail
Post by: Little Wolf on February 07, 2005, 02:07:20 PM
This is a great tip! but...where is the newim.gif?
Title: Re: New messages flashing mail
Post by: Cypher7 on February 07, 2005, 02:22:34 PM
Quote from: Little Wolf on February 07, 2005, 02:07:20 PM
This is a great tip! but...where is the newim.gif?

Just use this one!?!...

http://bbs.off-road.com/ubbthreads/images/newpm.gif   (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fbbs.off-road.com%2Fubbthreads%2Fimages%2Fnewpm.gif&hash=500b6682f26a567ebbf4776b6cb78b670fabd33b)

just change the name to newim.gif when you download it...
Title: Re: New messages flashing mail
Post by: Little Wolf on February 07, 2005, 06:10:20 PM
oh! ok thanks.. that was a stupid question to ask.  :-[
Title: Re: New messages flashing mail
Post by: Cypher7 on February 07, 2005, 06:40:49 PM
Quote from: Little Wolf on February 07, 2005, 06:10:20 PM
oh! ok thanks.. that was a stupid question to ask.  :-[

Better to ask a stupid question... then to fix a stupid mistake ;)
Title: Re: New messages flashing mail
Post by: nokonium on February 08, 2005, 02:09:01 AM
If you want a bit more animation

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.nokonium.plus.com%2Fbits%2Fnewim.gif&hash=0ee278627c0789102ea9e96c1f1ee60de04a2901)

Right click and save image
Title: Re: New messages flashing mail
Post by: Zaha on February 11, 2005, 10:35:30 AM
I feel like a total idiot, but whenever I try to stick in the second version of the code (the one that shows in the user info box), I get a template parse error.

What am I doing wrong?

Edit: Nevermind, it's fixed now... think I may have put an extra line before it.

Just a question - if it normally says:

"Hey, Zaha, you have 1 message, 1 are new."

How would I get it to say:

"Hey, Zaha, you have (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.icestormcity.com%2Fzahaqiel%2Fnewim.gif&hash=cc832514bb52148a502981442fb32ffb5908ccf5) 1 message, 1 are new."
Title: Re: New messages flashing mail
Post by: ansonwolfe on April 04, 2005, 12:10:38 AM
Just the thing I'm looking for. Thank you guys!   :)
Title: Re: New messages flashing mail
Post by: xenovanis on April 19, 2005, 04:13:51 PM
One more question, to put the image in line with the buttons I added style="margin: 2px in the code, but the number of messages isn't aligning. Is it possible to move this 2 points higher (like the image below)?
Title: Re: New messages flashing mail
Post by: [Unknown] on April 19, 2005, 05:13:38 PM
You may need to put align="top" on all the button img tags.

-[Unknown]
Title: Re: New messages flashing mail
Post by: xenovanis on April 20, 2005, 04:54:11 AM
Thanks, I'll give it a try.
Title: Re: New messages flashing mail
Post by: nameless on April 27, 2005, 07:24:59 PM
This is a great mod. I love it. So easy to implement. :D
Title: Re: New messages flashing mail
Post by: trenchteam on June 21, 2005, 09:32:00 PM
Awesome Mod!  Working Great!
Title: Re: New messages flashing mail
Post by: Red on June 26, 2005, 03:34:53 AM
Quote from: Cypher7 on November 29, 2004, 06:56:50 PM

And I was just fishing out the code for ya and all... ;)

I have the same on my board, works well...

could you put up that code.. so the image is in front of the "1 New Message"?
Title: Re: window advise for PM
Post by: copfirearms on February 24, 2006, 03:38:44 PM
Quote from: dschwab9 on August 27, 2004, 06:27:33 PM
Index.template.php

Find:

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;




Add after:

// Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
      echo '
<a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newim.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ' . $context['menu_separator'] . '';


change newim.gif to whatever the name of the image is (mine is a flashing envelope)

Menu ends up looking like this.  Number in () is the number of new messages:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fbbs.off-road.com%2Fubbthreads%2Fimages%2Fnewpm.gif&hash=500b6682f26a567ebbf4776b6cb78b670fabd33b) (4) | Home | Help | Search | Admin | Profile | Calendar |

Ok, I inserted  your code, heres what it looks like...

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg515.imageshack.us%2Fimg515%2F2249%2Fimage11wm.gif&hash=1ee3c066958c82503d5974836149cd4f8c98b9c1) (http://imageshack.us)

Any way to move the flashing icon to the center??
Or move it from where it's at?

If I could make it look like this, it woulld be great...
Thanks

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg502.imageshack.us%2Fimg502%2F65%2Fimage27tg.gif&hash=add7d89938e6ba8fecdc360313dd22ef214528b3) (http://imageshack.us)
Title: Re: New messages flashing mail
Post by: blazin6543 on August 06, 2006, 04:00:49 PM
i have a bit of a problem with this coding...... it works great when i have unread messages.....but if i dont have any unread messages i keep getting the login field in place of the spot that shows i have unread messages........ whats going on?
Title: Re: New messages flashing mail
Post by: Alan S on August 18, 2006, 07:13:30 PM
I modifyed the code a bit and put it into Mod form , more details + the mod package can be seen here

[mod deleted]
Title: Re: New messages flashing mail
Post by: snork13 on August 19, 2006, 09:59:38 AM
Quote from: Alan S on August 18, 2006, 07:13:30 PM
I modifyed the code a bit and put it into Mod form , more details + the mod package can be seen here

http://mods.simplemachines.org/index.php?mod=426

I had beaten you to it awhile ago ;D

http://mods.simplemachines.org/index.php?mod=260 (http://mods.simplemachines.org/index.php?mod=260)

-Snork13
Title: Re: New messages flashing mail
Post by: Alan S on August 19, 2006, 10:06:42 AM
lol oh well at least i got a small bit of experience with the way mods work
Title: Re: New messages flashing mail
Post by: David79 on August 23, 2006, 09:51:34 AM
I love the idea of a pop up window just like YabbSE already has
I was wondering if there is anyway to add sound like YabbSE allowed? When a new message came in. I remember having a sound directory. when I used the Yabb before....That is a feature I would love to have again
Title: Re: New messages flashing mail
Post by: choloman05 on September 03, 2006, 05:04:09 PM
 This is a mod done by bigguy.
Title: Re: New messages flashing mail
Post by: choloman05 on September 03, 2006, 05:13:48 PM
 And can anyone help me out with this mod on the Dilber MC theme? thanks.
Title: Re: New messages flashing mail
Post by: RebelRose on September 09, 2006, 12:19:53 AM
Quote from: choloman05 on September 03, 2006, 05:13:48 PM
And can anyone help me out with this mod on the Dilber MC theme? thanks.

If you are having too many problem with Dilber theme then you should go to the DilberMc thread and ask Harzem for help. He is usually good at helping.
Title: Re: New messages flashing mail
Post by: wmiles on September 11, 2006, 04:07:50 PM
Hi

If bloc is around could you tell me how to integrate this into the Nexus5 template as when i try to do it the top header seems to go out of alignment, think its just a table issue but i cant sort it.

Seems to put the Flashy above the menu instead of in line with it
Title: Re: New messages flashing mail
Post by: wmiles on September 11, 2006, 04:14:58 PM
whoops just noticed this should be on TP site
Title: Re: New messages flashing mail
Post by: choloman05 on September 11, 2006, 08:00:45 PM
Quote from: RebelRose on September 09, 2006, 12:19:53 AM
Quote from: choloman05 on September 03, 2006, 05:13:48 PM
And can anyone help me out with this mod on the Dilber MC theme? thanks.

If you are having too many problem with Dilber theme then you should go to the DilberMc thread and ask Harzem for help. He is usually good at helping.

  Been trying that and no help so far. I think he might read just the latest page of that thread.
Title: Re: New messages flashing mail
Post by: BiGBLiZZ on September 20, 2006, 12:42:31 AM
Did this, works great!  I have it on the Helios theme and in 2 spots (above nav menu and in Forum Stats section)

However, I noticed that it works perfect for the first unread message, however, once you check PMs and then get another new one the newim.gif doesn't show up, although the (1) still does.

Any ideas?
Title: Re: New messages flashing mail
Post by: sattninja on December 24, 2009, 11:26:50 PM
hello i installed thid manually and looks great my only ? is there a way to move where the image is here is a screen shot of mine i wolud like to move it aboive the messages button

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg695.imageshack.us%2Fimg695%2F7051%2Fcapturexf.jpg&hash=2f4f5b69d265f6995affc4fddba3524c8c5b87a4)
Title: Re: New messages flashing mail
Post by: bangkokcanuck on April 26, 2010, 11:40:03 AM
Quote from: snork13 on August 19, 2006, 09:59:38 AM
Quote from: Alan S on August 18, 2006, 07:13:30 PM
I modifyed the code a bit and put it into Mod form , more details + the mod package can be seen here

http://mods.simplemachines.org/index.php?mod=426

I had beaten you to it awhile ago ;D

http://mods.simplemachines.org/index.php?mod=260 (http://mods.simplemachines.org/index.php?mod=260)

-Snork13

Just curious if there will be a MOD for this email flashy thingy for RC3?

I tried the mod listed above and got the error that it was not compatible with my version... TIA
Title: Re: New messages flashing mail
Post by: snork13 on April 27, 2010, 03:57:46 PM
Quote from: bangkokcanuck on April 26, 2010, 11:40:03 AM
Quote from: snork13 on August 19, 2006, 09:59:38 AM
Quote from: Alan S on August 18, 2006, 07:13:30 PM
I modifyed the code a bit and put it into Mod form , more details + the mod package can be seen here

http://mods.simplemachines.org/index.php?mod=426

I had beaten you to it awhile ago ;D

http://mods.simplemachines.org/index.php?mod=260 (http://mods.simplemachines.org/index.php?mod=260)

-Snork13

Just curious if there will be a MOD for this email flashy thingy for RC3?

I tried the mod listed above and got the error that it was not compatible with my version... TIA

run the install in emulation mode from the package manager
Title: Re: New messages flashing mail
Post by: Shole on May 10, 2010, 11:28:59 AM
There is that mode that you can use its the same as on the old facebook a black box apeares in the right upper corner if you got a pm or some1 replied on your post!
Title: Re: New messages flashing mail
Post by: balti27 on May 27, 2010, 04:18:12 AM
emulation mode ?
Title: Re: New messages flashing mail
Post by: knightofdoom on June 10, 2010, 06:06:43 AM
any packages available??
Title: Re: New messages flashing mail
Post by: jasonnjon on June 10, 2010, 06:34:24 AM
i think the pop up option is default .. its there in vbulletin also
Title: Re: New messages flashing mail
Post by: thenoss on September 25, 2010, 11:09:11 PM
I'll bump this instead of creating a new thread...

I'm using SMF 1.1.11 and having troubles trying to do something like this on a custom theme...

Anyone know how I can go about doing this? =S
Title: Re: New messages flashing mail
Post by: xenovanis on September 26, 2010, 08:03:14 AM
Quote from: thenoss on September 25, 2010, 11:09:11 PM
I'll bump this instead of creating a new thread...

I'm using SMF 1.1.11 and having troubles trying to do something like this on a custom theme...

Anyone know how I can go about doing this? =S

Depends on the custom theme. What problems are you experiencing?
Title: Re: New messages flashing mail
Post by: Maxine22 on November 14, 2010, 02:28:01 AM
I am using the Ziyah Zemin theme. Anyone know how I can get this working as it doesn't have PM notifcation  :-[
Title: Re: New messages flashing mail
Post by: xenovanis on November 14, 2010, 08:57:38 AM
Quote from: Maxine22 on November 14, 2010, 02:28:01 AM
I am using the Ziyah Zemin theme. Anyone know how I can get this working as it doesn't have PM notifcation  :-[

That's odd, isn't it. You'd want to know if you have new messages.

Well, this is how you could implement it. In the file index.template.php of this theme, look for

echo '
<strong>', $txt['hello_member_ndt'], ' ', $context['user']['name'] , '</strong><br />
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> <br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';


replace that part with

echo '
<strong>', $txt['hello_member_ndt'], ' ', $context['user']['name'] , '</strong>';
// Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
echo '
<a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newim.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ' . $context['menu_separator'] . '<br />
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> <br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';


Which will make it look like this
Hello username (1) {image here}
Title: Re: New messages flashing mail
Post by: Maxine22 on November 14, 2010, 12:27:59 PM
QuoteThat's odd, isn't it. You'd want to know if you have new messages.

Absolutely. The only way to know a PM is in the inbox is via email which isn't any help if the user doesn't access it on a regular basis.

Okay the code works but when you have read the PM, the notification disappears along with 'show last posts' and 'replies to posts' options......

Any suggestions?

Thanks
Title: Re: New messages flashing mail
Post by: xenovanis on November 17, 2010, 06:05:15 AM
Sorry about that. Try this instead

   echo '
            <strong>', $txt['hello_member_ndt'], ' ', $context['user']['name'] , '</strong>';
            // Show Flashy icon if user has new messages and it not a guest
            if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
            echo '
            <a href="' . $scripturl . '?action=pm"><img src="' . $settings['images_url'] . '/newim.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ' . $context['menu_separator'] . '<br />';
            echo '
            <a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> <br />
            <a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';
Title: Re: New messages flashing mail
Post by: praveebook on December 03, 2010, 05:05:06 AM
If you are having too many problem with Dilber theme then you should go to the DilberMc thread and ask many problem u could confused.


------------------------------------------------------------------------------