View Full Version : Using dojo to create floating window
cheechm
04-13-2007, 09:29 PM
Hi,
I was wondering how you would create something like this:IMEEM (http://meems.imeem.com/h-gUzfVT/music/szmg7ey9/harmonious_blacksmith_with_variations_iv_and_v/). (The popup window you get with Login/Signup) I want to recreate the exact same effect. I do have a login system (based on php*), I just don't know how to get this window up.
Thanks for reading my post, and if you need more info, just ask.
*Could you include PHP tags which check if the user is logged in or not before opening the window? If this is not possible, is there a way of making a "login" system (for 2 or 3 users) from Javascript, which can be used.
cheechm
04-14-2007, 04:02 AM
I have found some code (with some help from google ). Now I just need a bit more help please!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<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>
<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 : 1px solid #999;
-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;
}
</style>
<a href="javascript:dlg0.show()">Click</a>
<br>
<br>
<div dojoType="dialog" id="dialog0" bgColor="black" bgOpacity="0.5" toggle="fade" toggleDuration="250">
<iframe src='/admin/protected/main.php' frameborder='0' width='300px' height='290px' marginwidth='0' marginheight='0'></iframe>
</div>
That works. (You can test it athttp://www.layton.byethost7.com/test.html)
Few things I need to sort out which are easy but...
The only other things I need help on are how to automatically open the window if the user is not logged in (PHP login system. PHP code would be (not logged in)
<?php
/* User is not logged in */
if(!$session->logged_in){
?>
<body>Javascript for open Dojo dialog could be used
</body>
And then once they log in, how to automatically shut the window. (Use more PHP?
<?php
}
/* User is logged in */
else{
?>
<body>Close Dojo dialog
</body>
Thanks
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.