Also notice how i have to tag some formating onto the onload since it doesn't want to work before then. I am sure I can make it all work by putting more stuff in onload, but surely there's a more elegant way that it's supposed to be done?
Course that problem wouldn't be a problem for me if i found a nice way to resize the window in question and remove all the toolbars and whatnot (as in the last function on the bottom) Or a way to close the main window automaticly heh.. which firefox refuses to do, at least.. (But that' a different story)
Seb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<Script type="text/javascript"
src="../html/inc/dynapi3x/src/dynapi.js"></script>
<Script type="text/javascript">
dynapi.library.setPath('../html/inc/dynapi3x/src/');
dynapi.library.include('dynapi.library');
dynapi.library.include('dynapi.api');
dynapi.library.include('TemplateManager');
dynapi.library.include('HTMLTextBox');
dynapi.library.include('Button');
dynapi.library.include('dynapi.functions.Color');
dynapi.library.include('dynapi.gui.BorderManager');
</script>
<script type="text/javascript" src="inc/login.js"></script>
<Script type="text/javascript">
var LoginError = ""; DrawLogin();
dynapi.onLoad(OnLoader);
</script>
</head>
<body>
<script type="text/javascript">
dynapi.document.insertAllChildren();
</script>
</body>
</html>
Contents of login.js
function DrawLogin() { //docwidth = DynAPI.document.getWidth(); //docheight = DynAPI.document.getHeight();
// make a nice box thingy...
// MainLoginLayer = new DynLayer(null, ((docwidth/2)-400),
((docheight/2)-300), 800, 600, 'white');
MainLoginLayer = new DynLayer(null, 0, 0, 800, 600, 'white');
MainLoginLayer.setAnchor({centerV:0, centerH:0}); DynAPI.document.addChild(MainLoginLayer);
MainLoginLayer.setInnerBorder(1,'black');
MakeHeader(MainLoginLayer);
LoginIntroLayer = new DynLayer(null, 200, 215, 400, 100, 'transparent');
LoginIntroLayer.setHTML("Welcome to the Intranet. Please enter your
credentials to access this site.");
MainLoginLayer.addChild(LoginIntroLayer);// seems like a funky way of making a form, but this seems to be the
'manageable' method so..
formtemplate = new Template('<form action="" name="p1loginfrm"
method="POST" >User Name: [EMAIL PROTECTED]<br> Password:
[EMAIL PROTECTED]</form>',270,275,260,100,'transparent');
username = new HTMLTextBox(null,'', 15, 15, false,'',"username");
password = new HTMLTextBox(null,'', 15, 15,true,'',"password");
formtemplate.addChild(username ,'fld');
formtemplate.addChild(password ,'fld1');
MainLoginLayer.addChild(formtemplate);
LoginButton = new Button('Enter',370,350,60,30);
MainLoginLayer.addChild(LoginButton);
el = {
onclick : function(e) {
document.forms['p1loginfrm'].submit();
}
}
LoginButton.addEventListener(el);
LoginOutroLayer = new DynLayer(null, 200, 400, 400, 100, 'transparent');
LoginOutroLayer.setHTML("Be advised, all access and activity will be
logged.");
MainLoginLayer.addChild(LoginOutroLayer);
if(LoginError != "")
{
ErrorLayer = new DynLayer(null, 200, 475, 400, 50, 'transparent');
ErrorLayer.setHTML(LoginError);
MainLoginLayer.addChild(ErrorLayer);
ErrorLayer.setInnerBorder(3,'red', 'double');
}
}
function MakeHeader(ParentLayer) {
docwidth = ParentLayer.getWidth();
docheight = ParentLayer.getHeight(); BannerLayer = new DynLayer(null, (docwidth - 588), 0, 588, 80, 'white');
BannerLayer.setHTML("<img src='images/top_service.jpg' border=0>");
ParentLayer.addChild(BannerLayer); LogoLayer = new DynLayer(null, -15, -20, 182, 80, 'white');
LogoLayer.setHTML("<img src='images/logo.gif' border=0>");
ParentLayer.addChild(LogoLayer); LogoLabelLayer = new DynLayer(null, 15, 56, 182, 20, '');
LogoLabelLayer.setHTML("<b>Operations Intranet</b>");
ParentLayer.addChild(LogoLabelLayer);}
// Fix for the .css needing to be done on or after onload
function OnLoader()
{
LoginIntroLayer.css.font = '12pts/18pts Courier';
LoginIntroLayer.css.textAlign = 'center';
formtemplate.css.textAlign = 'right';
LoginOutroLayer.css.font = '12pts/18pts Courier';
LoginOutroLayer.css.textAlign = 'center';
if(LoginError != "")
{
ErrorLayer.css.font = 'bold 12pts/18pts Courier';
ErrorLayer.css.textDecorationBlink = 1;
ErrorLayer.css.textAlign = 'center';
}
}function OpenMain()
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('main.phtml', '" + id + "',
'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=8
00,height=600,left = 400,top = 300');");
eval("if (page" + id+".opener == null) page" + id+".opener = self;");}
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help
