Hi all peoples 🙂
Well i need help with a javascript.
When users recive a new PM, they get a popup.
<script type="text/javascript">
function opennewpm(){
var pmwin=dhtmlwindow.open("NewPM", "iframe", "modal.php?do=newpm", "New Private Message", "width=200px,height=110px,resize=1,scrolling=1,center=1", "recal")
pmwin.onclose=function(){ //Run custom code when window is being closed (return false to cancel action):
return window.confirm("Close window?")
}
}
That function will open this in a new .php page (modal.php, just a bit code from modal.php. The code conserning, new pm popup.):
else if ($do=="newpm")
{
print("<table class=\"lista\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">");
print("<tr>");
print("<td class=header align=center>New PM!</td>");
print("</tr><tr><td class=lista align=center>Hi $CURUSER[username], you have one or more unreaded PMs in your inbox. See status bellow!</td></tr><tr>");
$resmail=mysql_query("SELECT COUNT(*) FROM messages WHERE readed='no' AND receiver=$CURUSER[uid] AND delbyreceiver='no'");
if ($resmail && mysql_num_rows($resmail)>0)
{
$mail=mysql_fetch_row($resmail);
if ($mail[0]>0) {
if (substr($_SERVER['PHP_SELF'], -10)!="usercp.php")
print("<td class=lista align=center><form id=\"PM\"><a href=usercp.php?uid=".$CURUSER["uid"]."&do=pm&action=list onClick=\"parent.pmwin.hide()\">".MAILBOX."</a> (<font color=\"#FF0000\"><b>$mail[0]</b></font>)</form></td>\n");
}
}
print("</tr>");
print("</table>");
}
What i need help with here. Is when they click on MAILBOX. They get redirected to usercp.php?uid=".$CURUSER["uid"]."&do=pm&action=list. Now when they click MAILBOX the parent window doesn't close and MAILBOX opens in the same "small" window. That popup should close and in main window they will get redirected. I know that i need to add something in the first function i posted. But don't know what.
Hope you understand what i mean. As im bad at javascript im really glad that if someone could help me 😃
Some handy links:
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm
Cheerzzzz