2016-02-11 16:16:42 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var cl = global.botanLoader;
|
|
|
|
var Dragonfly = global.Dragonfly;
|
|
|
|
|
|
|
|
var HttpRequest = cl.load( "botanss.net.HttpRequest" );
|
2016-06-16 07:25:05 +00:00
|
|
|
var ustr = cl.load( "botansx.utils.string" );
|
2016-02-11 16:16:42 +00:00
|
|
|
|
|
|
|
class Notis
|
|
|
|
{
|
|
|
|
constructor( query )
|
|
|
|
{
|
|
|
|
this.__valid = false;
|
|
|
|
this.__error = null;
|
2016-02-14 14:15:38 +00:00
|
|
|
this.Retry = 0;
|
2016-02-11 16:16:42 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if( !query.id )
|
|
|
|
{
|
|
|
|
throw new Error( "ID is not specified" );
|
|
|
|
}
|
|
|
|
|
|
|
|
this.id = query.id;
|
|
|
|
|
|
|
|
if( query.xml )
|
|
|
|
{
|
|
|
|
this.Xml = query.xml;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.Xml = Notis.ToastText02
|
|
|
|
.replace( "{TITLE}", ustr.encodeHtml( query.title ) )
|
|
|
|
.replace( "{MESG}", ustr.encodeHtml( query.message ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
this.__valid = true;
|
|
|
|
}
|
|
|
|
catch( ex )
|
|
|
|
{
|
|
|
|
Dragonfly.Error( ex );
|
|
|
|
this.__error = ex.message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
get Valid() { return this.__valid; }
|
|
|
|
get Error() { return this.__error; }
|
|
|
|
|
|
|
|
static get ToastText02()
|
|
|
|
{
|
|
|
|
return `
|
|
|
|
<toast>
|
|
|
|
<visual>
|
|
|
|
<binding template="ToastText02">
|
|
|
|
<text id="1">{TITLE}</text>
|
|
|
|
<text id="2">{MESG}</text>
|
|
|
|
</binding>
|
|
|
|
</visual>
|
|
|
|
</toast>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Notis;
|