...

View Full Version : Showing a dojo dialog



cheechm
05-06-2007, 09:04 PM
Hi,
I am having a problem showing a dojo dialog, when using a PHP navigation system.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Protected Area</title>

<script type="text/javascript">
var dlg0;
function init(e) {
dlg0 = dojo.widget.byId("dialog0");
var btn = document.getElementById("hider0");
dlg0.setCloseControl(btn);

}
dojo.addOnLoad(init);

</script>
<script type="text/javascript">
var dlg0;
function init(e) {
dlg0 = dojo.widget.byId("dialog0");
var btn = document.getElementById("hider0");
dlg0.setCloseControl(btn);

}
dojo.addOnLoad(init);

</script>

<script type="text/javascript"> djConfig = { isDebug: false }; </script>
<script type="text/javascript" src="../dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.widget.Dialog");
dojo.require("dojo.widget.Button");
</script>



</head>

<?
include("../admin/protected/include/session.php");
?>


<?
/* User is not logged in */
if(!$session->logged_in){ ?>

<body onload="javascript:dojo.widget.byId('dialog0').show();">


<script type="text/javascript">
var dlg0;
function init(e) {
dlg0 = dojo.widget.byId("dialog0");
var btn = document.getElementById("hider0");
dlg0.setCloseControl(btn);

}
dojo.addOnLoad(init);

</script>


<style type="text/css">
body { font-family : sans-serif; }
.dojoDialog {
background : #ffffff;
border : 1.5px solid #990000;
-moz-border-radius : 5px;
padding : 4px;
< margin-bottom : 0;
}

/* group multiple buttons in a row */
.box {
display: block;
text-align: center;
}
.box .dojoButton {
float: left;
margin-right: 10px;
}
.dojoButton .dojoButtonContents {
font-size: medium;
}
input
{
color: #000000;
background: #ffffff;
border: 1px solid #999
}


input:focus, textarea:focus {
background: #eeeee0;
color: #000;
}



submit {
border: 1px solid #999;
padding: 2px 1em;
background: #555;
color: #fff;
font-size: 100%;
width: auto;
}

.sansb, .sansa small b, .sansa b small, small.sansa b, small b.sansa {
font-family: "Myriad Web", Verdana, Helvetica, Arial, sans-serif
}

.formbutton{
cursor:pointer;
border:outset 1px #ccc;
background:#999;
color:#666;
font-weight:bold;
padding: 1px 2px;
background:url(http://www.dynamicdrive.com/cssexamples/media/formbg.gif) repeat-x left top;
}

</style>
<br>
<br>

<div dojoType="dialog" id="dialog0" bgColor="black" bgOpacity="0.5" toggle="fade" toggleDuration="250">
<table>
<tr><td>

<?
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){

echo "<h1>Logged In</h1>";
echo "<script type=\"text/javascript\">";
echo "document.write('<a id=\"hider0\" href=\"#\">[X]</a>');";
echo "</script>";






}

else{
?>

<big><p class=".sansab">Login</big>
<?
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="../admin/protected/process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" class="formbutton" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="../admin/protected/forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
</table>
</form>
</p>
<?
}
?>




</td></tr>
</table>


</div>

</body>


<?
}
/* User is logged in */
else{
?>
<body>
<script language="javascript"><!--
location.replace("../admin/control.php")
//-->
</script>
</body>

<?
}
?>
</html>

When this is loaded seperatley, the dojo dialog works in Firefox and Internet Explorer, yet when loaded using this PHP code:

<?php
$id = $_GET['id'];
switch($id) { default: include('home.php');
break; case "1": include('you1.php');
break; case "2": include('video.php');
break; case "3": include('test.php');
}
?>
in Internet Explorer it doesn't actually load the dojo dialog. Due to this being a school website, all the browsing is done in Internet Explorer (the only browser).

Try it out here:

Loaded on it own (http://layton.byethost7.com/test/test.php)
Loaded using the PHP script. (http://layton.byethost7.com/test/index.php?id=3)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum