Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.20.00 - All Issues
Author Message
pe5pvb
New Member
New Member



Joined: Oct 16, 2007
Posts: 19

PostPosted: Wed Feb 13, 2008 4:35 am Reply with quote

I added an extra feature to the Block-User_info.php. It will show a popup when you have a new message. Please don't forget to update your language file when adding this.

How to install:

1. Open Block-User_info.php and add these lines at the end of the settings. (before "You should not need to modify anything below this line")

Code:
$pm_notify_dropin           = TRUE; //Notify users of private message by using a javascript drop box

$pm_dropin_once              = FALSE; //If set to true, users will only be notified of private messages once per visit
$dropin_bgcolor              = '#EEEEEE'; //Set background color of drop box
$dropin_bordercolor      = '#4C44BA'; //Set border color of drop box


2. Find "$content .= '<img src="images/blocks/email-y.gif"" and add this code before this line:

Code:
////////////////Drop box for new Private Message added by Murdock/////////

  if ($pm_notify_dropin && $newpms > 0)
  {
    $content .= '
    <script type="text/javascript" language="JavaScript1.2">
   
    // Drop-in content box- By Dynamic Drive
    // For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    // This credit MUST stay intact for use
   
    var ie=document.all
    var dom=document.getElementById
    var ns4=document.layers
    var calunits=document.layers? "" : "px"
   
    var bouncelimit=32 //(must be divisible by 8)
    var direction="up"
   
    function initbox(){
    if (!dom&&!ie&&!ns4)
    return
    crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
    scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
    crossobj.top=scroll_top-250+calunits
    crossobj.visibility=(dom||ie)? "visible" : "show"
    dropstart=setInterval("dropin()",50)
    }
   
    function dropin(){
    scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
    if (parseInt(crossobj.top)<100+scroll_top)
    crossobj.top=parseInt(crossobj.top)+40+calunits
    else{
    clearInterval(dropstart)
    bouncestart=setInterval("bouncein()",50)
    }
    }
   
    function bouncein(){
    crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
    if (bouncelimit<0)
    bouncelimit+=8
    bouncelimit=bouncelimit*-1
    if (bouncelimit==0){
    clearInterval(bouncestart)
    }
    }
   
    function dismissbox(){
    if (window.bouncestart) clearInterval(bouncestart)
    crossobj.visibility="hidden"
    }
   
    function truebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
   
   
    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = ""
    if (bad_tag.length > 0) {
    offset = bad_tag.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = bad_tag.indexOf(";", offset)
    if (end == -1)
    end = bad_tag.length;
    returnvalue=unescape(bad_tag.substring(offset, end))
    }
    }
    return returnvalue;
    }
   
    function dropornot(){';
  if ($pm_dropin_once)
  {
    $content .= '
    if (get_cookie("droppedin")==""){
    window.onload=initbox
    bad_tag="droppedin=yes"
    }';
  }
  else
  {
    $content .= '
    window.onload=initbox
   
    ';
  }
  $content .= '
    }
    dropornot()
    </script>
    ';
    $content .= '
    <div id="dropin" style="position:absolute;visibility:hidden;left:300px;top:100px;width:300px;height:50px;background-color:'.$dropin_bgcolor.';border: 1px solid '.$dropin_bordercolor.'">
   
    <div align="right"><a href="#" onClick="dismissbox();return false">['._CLOSE.'] </a></div>
    <br />';
    if ($newpms == 1) {
    $content .= '<a href=messages.html onClick="dismissbox();">'._YOUHAVE.' <strong>'. $newpms .'</strong> '._NEWMESSAGE.'.</a></div>';
  } else {
     $content .= '<a href=messages.html onClick="dismissbox();">'._YOUHAVE.' <strong>'. $newpms .'</strong> '._NEWMESSAGES.'.</a></div>';
  }
  }
////////////////End code for Drop box/////////


You can change some settings if you like in the setup. Good luck with it. This code was taken from the Info_box block and changed a little to work in the Ravennuke User Info block.
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Wed Feb 13, 2008 5:00 am Reply with quote

Thanks! Maybe there is a way to make this configurable...

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Wed Feb 13, 2008 7:32 am Reply with quote

Personally, I've never liked the BBtoNuke integration how the pop-up doesn't work outside of BBtoNuke. IMO, it really should be made a part of mainfile or header just like the site message is... but, that is just me...

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
kguske







PostPosted: Wed Feb 13, 2008 11:08 am Reply with quote

It might also be used to have a different approach for notifying an admin that content is pending, instead of showing it in a hard-coded admin block...
 
pe5pvb







PostPosted: Wed Feb 13, 2008 1:06 pm Reply with quote

For sure. It's very easy to modify it for that use.
 
rasterman
New Member
New Member



Joined: Oct 28, 2007
Posts: 5
Location: Luton UK

PostPosted: Sat Mar 08, 2008 12:01 pm Reply with quote

Can someone please tell me what I need to add to what language file thx.
 
View user's profile Send private message Visit poster's website
montego







PostPosted: Fri Jul 11, 2008 6:31 am Reply with quote

rasterman, it would be under root/languages. Unless the blocks load their own language files (which I have only seen one of mine do that <wink>), any defines would have to go into these "core" language files.
 
rickleigh
Worker
Worker



Joined: Jan 06, 2009
Posts: 183

PostPosted: Mon Oct 26, 2009 12:26 pm Reply with quote

Is there anyway to get this to work outside the block? Like using a Java Script in the head of the site some how?

_________________
Thanks,
Rick Leigh 
View user's profile Send private message
kguske







PostPosted: Tue Oct 27, 2009 3:40 am Reply with quote

I was thinking of adding a notification icon to nukeNAV for this and other notifications like pending content.
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Tue Oct 27, 2009 11:19 am Reply with quote

I think gotcha at nukecoder.com used this in his RN compatible User Info block some time back.
Here's the link to the original Dynamic Drive script
http://www.dynamicdrive.com/dynamicindex17/amazondrop.htm
 
View user's profile Send private message Send e-mail
rickleigh







PostPosted: Tue Oct 27, 2009 11:55 am Reply with quote

Guardian2003 wrote:
I think gotcha at nukecoder.com used this in his RN compatible User Info block some time back.
Here's the link to the original Dynamic Drive script
http://www.dynamicdrive.com/dynamicindex17/amazondrop.htm


Thats what I'm looking for but I don't know how to embed the code needed to make it drop when a new PM is in my inbox.

I hate feeling like a dumb ()()s and not being able to learn fast enough. Evil or Very Mad
 
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Tue Oct 27, 2009 12:26 pm Reply with quote

I use the nukecoder User Info block on my site and the only thing needed is activate the block. When a pm is received, the popup notifies you. You have some config options inside the block for the popup settings.

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
Guardian2003







PostPosted: Tue Oct 27, 2009 12:29 pm Reply with quote

http://www.nukecoder.com/shop_item-7.html
 
rickleigh







PostPosted: Tue Oct 27, 2009 12:56 pm Reply with quote

I already have that block, but was trying to get away from using it. Tring to go for a different style for my site: http://www.yourhobbycommuntiy.com and wanted to somehow strip this feature from that block and have it work in a Java Scripted on my site. But, I don't understand the code enough to do it.
 
montego







PostPosted: Sat Oct 31, 2009 8:21 am Reply with quote

rickleigh, you might want to try the "For Hire" forum... maybe someone will be willing to do this for a small amount.
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sat Oct 31, 2009 2:14 pm Reply with quote

Create /includes/addons/head-pm_popup.php
Code:


<?php

global $db, $dropin_bgcolor, $dropin_bordercolor, $new_pms, $prefix, $user, $userinfo;

// notify users of private message by using a javascript drop box
$pm_notify_dropin = true;
// if set to true, users will only be notified of private messages once per visit
$pm_dropin_once = false;
// set the colors for the dropin box
$dropin_bgcolor = '#EEEEEE';
$dropin_bordercolor = '#4C44BA';

if (is_user($user)) {
   // check new pms
   $sql = 'SELECT `privmsgs_to_userid` FROM `' . $prefix . '_bbprivmsgs` WHERE `privmsgs_to_userid`="' . $userinfo['user_id'] . '" AND (privmsgs_type = "5" OR privmsgs_type = "1")';
   if ( !($result = $db->sql_query($sql)) ) {
      // error
      die('error checking new pms');
   }
   $new_pms = $db->sql_numrows($result);
   $db->sql_freeresult($result);
} else {
   $new_pms = 0;
}

if ($pm_notify_dropin && $new_pms > 0) {
   $inlineJS = '<script type="text/javascript" language="JavaScript1.2">

            // Drop-in content box- By Dynamic Drive
            // For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
            // This credit MUST stay intact for use

            var ie=document.all
            var dom=document.getElementById
            var ns4=document.layers
            var calunits=document.layers? "" : "px"

            var bouncelimit=32 //(must be divisible by 8)
            var direction="up"

            function initbox(){
               if (!dom&&!ie&&!ns4)
               return
               crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
               scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
               crossobj.top=scroll_top-250+calunits
               crossobj.visibility=(dom||ie)? "visible" : "show"
               dropstart=setInterval("dropin()",50)
            }

            function dropin(){
               scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
               if (parseInt(crossobj.top)<100+scroll_top) {
                  crossobj.top=parseInt(crossobj.top)+40+calunits
               } else {
                  clearInterval(dropstart)
                  bouncestart=setInterval("bouncein()",50)
               }
            }

            function bouncein(){
               crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
               if (bouncelimit<0)
                  bouncelimit+=8
               bouncelimit=bouncelimit*-1
               if (bouncelimit==0){
                  clearInterval(bouncestart)
               }
            }

            function dismissbox(){
               if (window.bouncestart) clearInterval(bouncestart)
               crossobj.visibility="hidden"
               }

            function truebody(){
               return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
            }

            function get_cookie(Name) {
               var search = Name + "="
               var returnvalue = ""
               if (bad_tag.length > 0) {
                  offset = bad_tag.indexOf(search)
                  if (offset != -1) {
                     offset += search.length
                     end = bad_tag.indexOf(";", offset)
                     if (end == -1)
                        end = bad_tag.length;
                     returnvalue=unescape(bad_tag.substring(offset, end))
                  }
               }
               return returnvalue;
            }

            function dropornot(){';
   if ($pm_dropin_once) {
      $inlineJS .= 'if (get_cookie("droppedin")==""){
                  window.onload=initbox
                  bad_tag="droppedin=yes"
               }';
   } else {
      $inlineJS .= 'window.onload=initbox';
   }
   $inlineJS .= '}
            dropornot()
            </script>';

addJSToHead($inlineJS, 'inline');

}

?>


Create /includes/custom_files/custom_footer.php
Code:


<?php

global $new_pms, $dropin_bgcolor, $dropin_bordercolor;

echo '<div id="dropin" style="position:absolute;visibility:hidden;left:400px;top:100px;width:300px;height:100px;background-color:' . $dropin_bgcolor . ';border: 1px solid ' . $dropin_bordercolor . '">'
   . '<div align="right"><a href="#" onclick="dismissbox();return false">[Close Box] </a></div>'
   . '<br />'
   . '<a href="modules.php?name=Private_Messages" onclick="dismissbox();">You have <strong>' . $new_pms . '</strong> new Private Messages.</a>'
   . '</div>';
?>

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.20.00 - All Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©