CODE
$(document).ready(function() {
var id = '#dialog';
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(2000);
//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
//if mask is clicked
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
var id = '#dialog';
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(2000);
//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
//if mask is clicked
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
i kodu dodanego do user_info_panel.php, który w całości wygląda tak:
CODE
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: user_info_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
if (iMEMBER) {
$msg_count = dbcount("(message_id)", DB_MESSAGES, "message_to='".$userdata['user_id']."' AND message_read='0' AND message_folder='0'");
echo "<div style='padding-left: 20px; padding-bottom: 20px;'><img src='".THEME."images/moje_konto.png' align='left'></div><br>";
echo "<table cellpadding='0' cellspacing='0' width='100%'><tr><td style='padding-left: 10px;'>";
echo "Witaj, ".$userdata['user_name']."!<br><br>";
echo THEME_BULLET." <a href='".BASEDIR."edit_profile.php' class='side'>".$locale['global_120']."</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."messages.php' class='side'>".$locale['global_121']."</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."members.php' class='side'>".$locale['global_122']."</a><br />\n";
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
echo THEME_BULLET." <a href='".ADMIN."index.php".$aidlink."' class='side'>".$locale['global_123']."</a><br />\n";
}
echo THEME_BULLET." <a href='".BASEDIR."index.php?logout=yes' class='side'>".$locale['global_124']."</a>\n";
if ($msg_count) {
echo "<div style='text-align:center;width:125px;margin-top:15px;'>\n";
echo "<strong><a href='".BASEDIR."messages.php' class='side'>".sprintf($locale['global_125'], $msg_count);
echo ($msg_count == 1 ? $locale['global_126'] : $locale['global_127'])."</a></strong>\n";
add_to_head("<link rel='stylesheet' href='".INCLUDES."pw.css' type='text/css' media='screen' /><script type='text/javascript' src='".INCLUDES."pw.js'></script>");
echo '<div id="boxes">
<div style="top: 199.5px; left: 551.5px; display: none;" id="dialog" class="window">';
echo "<br><strong><a href='".BASEDIR."messages.php'>Masz ".sprintf($locale['global_125'], $msg_count);
echo ($msg_count == 1 ? $locale['global_126'] : $locale['global_127'])."</a></strong><br><br><div style='font-size: 11px;'><a href='".BASEDIR."messages.php'>Zobacz</a> <a href='#' class='close'>Zamknij</a></div>";
echo '</div>
<div style="width: 1478px; height: 602px; display: none; opacity: 0.8;" id="mask"></div>';
echo "</div>\n";
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
$subm_count = dbcount("(submit_id)", DB_SUBMISSIONS);
if ($subm_count) {
echo "<div style='text-align:center;margin-top:15px;'>\n";
echo "<strong><a href='".ADMIN."submissions.php".$aidlink."' class='side'>".sprintf($locale['global_125'], $subm_count);
echo ($subm_count == 1 ? $locale['global_128'] : $locale['global_129'])."</a></strong>\n";
echo "</div>\n";
}
}
}
echo "</td><td>";
if ($userdata['user_avatar']) {
echo "<img src='".IMAGES."avatars/".$userdata['user_avatar']."' class='awatar'>";
} else {
echo "<img src='".IMAGES."noavatar100.png' class='awatar'>";
}
echo "</td></tr></table>";
} else {
echo "<div style='text-align:center'>\n";
echo "<form name='loginform' method='post' action='".FUSION_SELF."'>\n";
echo "<div style='padding-left: 20px; padding-bottom: 20px;'><img src='".THEME."images/panel_logowania.png' align='left'></div><br>";
echo "<table cellpadding='0' cellspacing='0' width='100%' align='center'><tr><td align='right'>";
echo "<input type='text' name='user_name' class='textbox_login' onblur=\"if(this.value=='')this.value='Login'\" onfocus=\"if(this.value=='Login')this.value=''\" value='Login' /><br />\n";
echo "<input type='password' name='user_pass' class='textbox_login' onblur=\"if(this.value=='')this.value='Login'\" onfocus=\"if(this.value=='Login')this.value=''\" value='Login' />\n";
echo "</td><td align='left' style='padding-left: 5px; padding-right: 5px;'>";
echo "<input type='submit' name='login' value='' class='zaloguj' />\n";
echo "</td></tr><tr><td colspan='2' style='font-size: 10px;'><br>";
echo $locale['global_106'];
echo "<br><br><a href='".BASEDIR."register.php'><img src='".THEME."images/rejestracja.png' border='0'></a>";
echo "</td></tr></table>";
echo "</form>\n";
echo "</div>";
}
?>
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: user_info_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
if (iMEMBER) {
$msg_count = dbcount("(message_id)", DB_MESSAGES, "message_to='".$userdata['user_id']."' AND message_read='0' AND message_folder='0'");
echo "<div style='padding-left: 20px; padding-bottom: 20px;'><img src='".THEME."images/moje_konto.png' align='left'></div><br>";
echo "<table cellpadding='0' cellspacing='0' width='100%'><tr><td style='padding-left: 10px;'>";
echo "Witaj, ".$userdata['user_name']."!<br><br>";
echo THEME_BULLET." <a href='".BASEDIR."edit_profile.php' class='side'>".$locale['global_120']."</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."messages.php' class='side'>".$locale['global_121']."</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."members.php' class='side'>".$locale['global_122']."</a><br />\n";
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
echo THEME_BULLET." <a href='".ADMIN."index.php".$aidlink."' class='side'>".$locale['global_123']."</a><br />\n";
}
echo THEME_BULLET." <a href='".BASEDIR."index.php?logout=yes' class='side'>".$locale['global_124']."</a>\n";
if ($msg_count) {
echo "<div style='text-align:center;width:125px;margin-top:15px;'>\n";
echo "<strong><a href='".BASEDIR."messages.php' class='side'>".sprintf($locale['global_125'], $msg_count);
echo ($msg_count == 1 ? $locale['global_126'] : $locale['global_127'])."</a></strong>\n";
add_to_head("<link rel='stylesheet' href='".INCLUDES."pw.css' type='text/css' media='screen' /><script type='text/javascript' src='".INCLUDES."pw.js'></script>");
echo '<div id="boxes">
<div style="top: 199.5px; left: 551.5px; display: none;" id="dialog" class="window">';
echo "<br><strong><a href='".BASEDIR."messages.php'>Masz ".sprintf($locale['global_125'], $msg_count);
echo ($msg_count == 1 ? $locale['global_126'] : $locale['global_127'])."</a></strong><br><br><div style='font-size: 11px;'><a href='".BASEDIR."messages.php'>Zobacz</a> <a href='#' class='close'>Zamknij</a></div>";
echo '</div>
<div style="width: 1478px; height: 602px; display: none; opacity: 0.8;" id="mask"></div>';
echo "</div>\n";
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
$subm_count = dbcount("(submit_id)", DB_SUBMISSIONS);
if ($subm_count) {
echo "<div style='text-align:center;margin-top:15px;'>\n";
echo "<strong><a href='".ADMIN."submissions.php".$aidlink."' class='side'>".sprintf($locale['global_125'], $subm_count);
echo ($subm_count == 1 ? $locale['global_128'] : $locale['global_129'])."</a></strong>\n";
echo "</div>\n";
}
}
}
echo "</td><td>";
if ($userdata['user_avatar']) {
echo "<img src='".IMAGES."avatars/".$userdata['user_avatar']."' class='awatar'>";
} else {
echo "<img src='".IMAGES."noavatar100.png' class='awatar'>";
}
echo "</td></tr></table>";
} else {
echo "<div style='text-align:center'>\n";
echo "<form name='loginform' method='post' action='".FUSION_SELF."'>\n";
echo "<div style='padding-left: 20px; padding-bottom: 20px;'><img src='".THEME."images/panel_logowania.png' align='left'></div><br>";
echo "<table cellpadding='0' cellspacing='0' width='100%' align='center'><tr><td align='right'>";
echo "<input type='text' name='user_name' class='textbox_login' onblur=\"if(this.value=='')this.value='Login'\" onfocus=\"if(this.value=='Login')this.value=''\" value='Login' /><br />\n";
echo "<input type='password' name='user_pass' class='textbox_login' onblur=\"if(this.value=='')this.value='Login'\" onfocus=\"if(this.value=='Login')this.value=''\" value='Login' />\n";
echo "</td><td align='left' style='padding-left: 5px; padding-right: 5px;'>";
echo "<input type='submit' name='login' value='' class='zaloguj' />\n";
echo "</td></tr><tr><td colspan='2' style='font-size: 10px;'><br>";
echo $locale['global_106'];
echo "<br><br><a href='".BASEDIR."register.php'><img src='".THEME."images/rejestracja.png' border='0'></a>";
echo "</td></tr></table>";
echo "</form>\n";
echo "</div>";
}
?>
Plik pw.css:
CODE
#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}
#boxes .window {
position:absolute;
left:0;
top:0;
width:440px;
height:200px;
display:none;
z-index:9999;
padding:20px;
}
#boxes #dialog {
width:220px;
height:70px;
padding:10px;
background-color:#ffffff;
-moz-box-shadow: inset 0 0 3px 3px #d8d8d8;
-webkit-box-shadow: inset 0 0 3px 3px#d8d8d8;
box-shadow: inset 0 0 3px 3px #d8d8d8;
border: 1px solid #c8c8c8;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}
#boxes .window {
position:absolute;
left:0;
top:0;
width:440px;
height:200px;
display:none;
z-index:9999;
padding:20px;
}
#boxes #dialog {
width:220px;
height:70px;
padding:10px;
background-color:#ffffff;
-moz-box-shadow: inset 0 0 3px 3px #d8d8d8;
-webkit-box-shadow: inset 0 0 3px 3px#d8d8d8;
box-shadow: inset 0 0 3px 3px #d8d8d8;
border: 1px solid #c8c8c8;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
Okno prezentuje się tak:
http://i44.tinypic.com/dvmuzn.jpg
Problem polega na tym, że odnośnik "Zobacz" przekierowuje do strony z wiadomościami, ale okno nie chce się zamknąć. Natomiast po kliknięciu samego "Zamknij", okienko rzeczywiście się zamyka, lecz w trakcie dalszego użytkowania strony (np. po kliknięciu na "Strona Główna") pojawia się za każdym razem. Ktoś wie jak sobie z tym poradzić?