botanjs/src/Astro/Blog/Layout/Login.js
raw ยท 2009 bytes
(function(){
var ns = __namespace( "Astro.Blog.Layout.Login" );
/** @type {System.utils.IKey} */
var IKey = __import( "System.utils.IKey" );
/** @type {Components.MessageBox} */
var MessageBox = __import( "Components.MessageBox" );
/** @type {Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Astro.Bootstrap} */
var Bootstrap = __import( "Astro.Bootstrap" );
/** @type {Astro.Blog.Config} */
var config = __import( "Astro.Blog.Config" );
// __import( "Dandelion.CSSReset" ); CSS_RESERVATION
// __import( "Dandelion.CSSAnimations" ); CSS_RESERVATION
/** @type {_AstConf_.Login} */
var conf = config.get( "Login" );
var sHeat = conf.sHeat || "";
var formAction = conf.formAct || "./";
var field_username = new IKey( "name", "username" );
var field_password = new IKey( "name", "password" );
var init = function ()
{
var form = Dand.wrapne('form'
, [
// Basic login and password fields
, Dand.wrapc("flsf", "Name:")
, Dand.wrapna('input', [ field_username, new IKey("type", "text") ] )
, Dand.wrapc("flsf", "Password:")
, Dand.wrapna('input', [ field_password, new IKey("type", "password") ] )
, Dand.wrapc('msg', Dand.wrap('sub', null, sHeat.toLowerCase(), sHeat))
]
, [
// Form attributes
new IKey('action', formAction)
, new IKey('method', 'POST')
]
)
;
var mbox = new MessageBox( "Blog.Astro", form, "Login", false, submitForm.bind( form ) ).show();
// Handle enter button
mbox.onkeyup = function( _e )
{
if ( submitForm.bind( form )( _e.which == 13 ) )
{
document.body.removeChild( this );
}
};
};
var submitForm = function (bool) {
if ( bool )
{
if ( this[ field_username.keyValue ].value != ""
&& this[ field_password.keyValue ] != "" )
{
this.submit();
return true;
}
}
return false;
};
Bootstrap.regInit( init );
})();