forked from verdnatura/hedera-web
Código reorganizado y optimizado
This commit is contained in:
parent
d863d19f4e
commit
1d65501db9
|
@ -1,4 +1,4 @@
|
|||
hedera-web (1.355-deb8) stable; urgency=low
|
||||
hedera-web (1.356-deb8) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Hedera.Queries = new Class
|
|||
{
|
||||
if (this._grid)
|
||||
{
|
||||
this.$('grid-holder').removeChild (this._grid.getNode ());
|
||||
this.$('grid-holder').removeChild (this._grid.node);
|
||||
this._grid.unref ();
|
||||
this._grid = null;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ Hedera.Queries = new Class
|
|||
}
|
||||
|
||||
grid.model = model;
|
||||
gridHolder.appendChild (grid.getNode ());
|
||||
gridHolder.appendChild (grid.node);
|
||||
this._grid = grid;
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ Hedera.Catalog = new Class
|
|||
var className = 'list-view';
|
||||
}
|
||||
|
||||
var node = this.$('grid-view').getNode ();
|
||||
var node = this.$('grid-view').node;
|
||||
node.className = className;
|
||||
localStorage.setItem ('hederaView', this.view);
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ Hedera.Catalog = new Class
|
|||
this.onEraseClick ();
|
||||
this.$('card').row = form.row;
|
||||
this.$('card-item').value = form.get ('item_id');
|
||||
this.$('card-popup').show (button.getNode ());
|
||||
this.$('card-popup').show (button.node);
|
||||
}
|
||||
|
||||
,onAddLotClick: function (column, value, row, button)
|
||||
|
@ -410,16 +410,16 @@ Vn.Filter = new Class
|
|||
|
||||
,initialize: function (props)
|
||||
{
|
||||
this.createElement ('div');
|
||||
this.node.className = 'vn-filter';
|
||||
var node = this.createRoot ('div');
|
||||
node.className = 'vn-filter';
|
||||
|
||||
this._select = new Htk.Select ();
|
||||
this._select.on ('mousedown', this._onMouseDown, this);
|
||||
this._select.on ('changed', this._onChange, this);
|
||||
this._select.on ('ready', this._onReady, this);
|
||||
this.node.appendChild (this._select.getNode ());
|
||||
this.node.appendChild (this._select.node);
|
||||
|
||||
this._ul = document.createElement ('ul');
|
||||
this._ul = this.createElement ('ul');
|
||||
this.node.appendChild (this._ul);
|
||||
|
||||
this._batch = new Sql.Batch ();
|
||||
|
@ -488,10 +488,10 @@ Vn.Filter = new Class
|
|||
if (value === null || value === undefined)
|
||||
return;
|
||||
|
||||
var li = this._lastLi = document.createElement ('li');
|
||||
var li = this._lastLi = this.createElement ('li');
|
||||
this._ul.appendChild (li);
|
||||
|
||||
var button = document.createElement ('button');
|
||||
var button = this.createElement ('button');
|
||||
button.addEventListener ('click',
|
||||
this._onCloseClick.bind (this, li));
|
||||
li.appendChild (button);
|
||||
|
@ -502,7 +502,7 @@ Vn.Filter = new Class
|
|||
});
|
||||
button.appendChild (icon.node);
|
||||
|
||||
var text = this._label = document.createTextNode ('');
|
||||
var text = this._label = this.createTextNode ('');
|
||||
li.appendChild (text);
|
||||
|
||||
setTimeout (this._onTimeout.bind (this));
|
||||
|
|
|
@ -4,7 +4,7 @@ var Tpl = require ('./gui.xml');
|
|||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Htk.Widget,
|
||||
Extends: Htk.Component,
|
||||
Properties:
|
||||
{
|
||||
conn:
|
||||
|
|
|
@ -47,26 +47,31 @@
|
|||
|
||||
.vn-login .login
|
||||
{
|
||||
position: absolute;
|
||||
padding: 1em;
|
||||
max-width: 16em;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -20em;
|
||||
margin-left: -9em;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
max-width: 15em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
@media (max-height: 630px)
|
||||
.vn-login form
|
||||
{
|
||||
.vn-login
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -20em;
|
||||
width: 100%;
|
||||
padding: 1em 0;
|
||||
}
|
||||
@media (max-height: 650px)
|
||||
{
|
||||
.vn-login,
|
||||
.vn-login .login
|
||||
{
|
||||
height: auto;
|
||||
}
|
||||
.vn-login .login
|
||||
.vn-login form
|
||||
{
|
||||
position: relative;
|
||||
top: 0;
|
||||
margin-top: 3.5em;
|
||||
padding: 1.5em 1em;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
.vn-login form > div
|
||||
|
|
|
@ -4,7 +4,7 @@ var Tpl = require ('./login.xml');
|
|||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Htk.Widget,
|
||||
Extends: Htk.Component,
|
||||
Properties:
|
||||
{
|
||||
conn:
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = new Class
|
|||
|
||||
,initialize: function ()
|
||||
{
|
||||
var node = this.createElement ('div');
|
||||
var node = this.createRoot ('div');
|
||||
node.className = 'htk-social-bar';
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ module.exports = new Class
|
|||
|
||||
while (res.next ())
|
||||
{
|
||||
var a = document.createElement ('a');
|
||||
var a = this.createElement ('a');
|
||||
a.href = res.get ('link');
|
||||
a.target = '_blank';
|
||||
this._node.appendChild (a);
|
||||
|
||||
var img = document.createElement ('img');
|
||||
var img = this.createElement ('img');
|
||||
img.src = 'image/social/'+ res.get ('icon');
|
||||
img.alt = res.get ('title');
|
||||
img.title = res.get ('title');
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = new Class
|
|||
|
||||
for (var i = 0; i < stepCount; i++)
|
||||
{
|
||||
var img = document.createElement ('img');
|
||||
var img = this.createElement ('img');
|
||||
img.src = 'image/step.svg';
|
||||
img.addEventListener ('click', this.setStep.bind (this, i));
|
||||
steps.appendChild (img);
|
||||
|
@ -41,22 +41,22 @@ module.exports = new Class
|
|||
,_assistant: null
|
||||
,_stepIndex: -1
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var bar = this.createElement ('div');
|
||||
var bar = this.createRoot ('div');
|
||||
bar.className = 'htk-assistant-bar';
|
||||
|
||||
var previousButton = document.createElement ('img');
|
||||
var previousButton = this.createElement ('img');
|
||||
previousButton.src = 'image/icon/light/go-previous.svg';
|
||||
previousButton.className = 'previous';
|
||||
previousButton.title = _('Previous');
|
||||
previousButton.addEventListener ('click', this.movePrevious.bind (this));
|
||||
bar.appendChild (previousButton);
|
||||
|
||||
var steps = document.createElement ('div');
|
||||
var steps = this.createElement ('div');
|
||||
bar.appendChild (steps);
|
||||
|
||||
var nextButton = document.createElement ('img');
|
||||
var nextButton = this.createElement ('img');
|
||||
nextButton.src = 'image/icon/light/go-next.svg';
|
||||
nextButton.className = 'next';
|
||||
nextButton.title = _('Next');
|
||||
|
@ -66,7 +66,6 @@ module.exports = new Class
|
|||
this._steps = steps;
|
||||
this._previousButton = previousButton;
|
||||
this._nextButton = nextButton;
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,movePrevious: function ()
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
|
||||
var NodeBuilder = require ('./node-builder');
|
||||
|
||||
/**
|
||||
* Represents a grid column. This is an abstract class and should not be
|
||||
* instantiated directly.
|
||||
**/
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Vn.Object
|
||||
Extends: NodeBuilder
|
||||
,Tag: 'htk-column'
|
||||
,Properties:
|
||||
{
|
||||
|
@ -65,16 +68,16 @@ module.exports = new Class
|
|||
**/
|
||||
,initialize: function (props)
|
||||
{
|
||||
this.td = document.createElement ('td');
|
||||
this.parent (props);
|
||||
this.td = this.createElement ('td');
|
||||
}
|
||||
|
||||
,renderHeader: function ()
|
||||
{
|
||||
var th = document.createElement ('th');
|
||||
var th = this.createElement ('th');
|
||||
|
||||
if (this.title)
|
||||
th.appendChild (document.createTextNode (this.title));
|
||||
th.appendChild (this.createTextNode (this.title));
|
||||
|
||||
return th;
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ module.exports = new Class
|
|||
{
|
||||
var td = this.parent (tr);
|
||||
|
||||
var button = document.createElement ('button');
|
||||
var button = this.createElement ('button');
|
||||
button.addEventListener ('click',
|
||||
this.buttonClicked.bind (this, this.value, tr, button));
|
||||
td.appendChild (button);
|
||||
|
||||
var img = document.createElement ('img');
|
||||
var img = this.createElement ('img');
|
||||
img.src = this.image;
|
||||
button.appendChild (img);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = new Class
|
|||
|
||||
,render: function (tr)
|
||||
{
|
||||
var checkButton = document.createElement ('input');
|
||||
var checkButton = this.createElement ('input');
|
||||
checkButton.type = 'checkbox';
|
||||
checkButton.checked = this.value;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = new Class
|
|||
var text = Vn.Date.strftime (this.value, this._format);
|
||||
|
||||
var td = this.parent (tr);
|
||||
td.appendChild (document.createTextNode (text));
|
||||
td.appendChild (this.createTextNode (text));
|
||||
|
||||
return td;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,12 @@ module.exports = new Class
|
|||
,subdir: this.subdir
|
||||
,fullDir: this.fullDir
|
||||
,value: this.value
|
||||
,conn: this.conn
|
||||
,conn: this.conn
|
||||
,doc: this.doc
|
||||
});
|
||||
|
||||
var td = this.parent (tr);
|
||||
td.appendChild (image.getNode ());
|
||||
td.appendChild (image.node);
|
||||
return td;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,9 +25,9 @@ module.exports = new Class
|
|||
|
||||
,render: function (tr)
|
||||
{
|
||||
var link = document.createElement ('a');
|
||||
var link = this.createElement ('a');
|
||||
link.href = this.href;
|
||||
link.appendChild (document.createTextNode (this.value));
|
||||
link.appendChild (this.createTextNode (this.value));
|
||||
|
||||
if (this.target)
|
||||
link.target = this.target;
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = new Class
|
|||
,initialize: function (props)
|
||||
{
|
||||
this._cssClass = 'cell-radio';
|
||||
this.radioGroup = new Htk.RadioGroup ();
|
||||
this.radioGroup = new Htk.RadioGroup (this.doc);
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = new Class
|
|||
|
||||
if (this.editable)
|
||||
{
|
||||
var entry = document.createElement ('input');
|
||||
var entry = this.createElement ('input');
|
||||
entry.type = 'text';
|
||||
entry.addEventListener ('change', this.inputChanged.bind (this, tr, entry));
|
||||
td.appendChild (entry);
|
||||
|
@ -59,7 +59,7 @@ module.exports = new Class
|
|||
if (this.unit)
|
||||
valueString = valueString + this.unit;
|
||||
|
||||
var text = document.createTextNode (valueString);
|
||||
var text = this.createTextNode (valueString);
|
||||
td.appendChild (text);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ module.exports = new Class
|
|||
{
|
||||
var value = this.value ? this.value : '';
|
||||
|
||||
node = document.createElement ('input');
|
||||
node = this.createElement ('input');
|
||||
node.type = 'text';
|
||||
node.value = value;
|
||||
node.addEventListener ('changed',
|
||||
this.inputChanged.bind (this, tr, node));
|
||||
}
|
||||
else
|
||||
node = document.createTextNode (
|
||||
node = this.createTextNode (
|
||||
Vn.Value.format (this.value, this._format));
|
||||
|
||||
var td = this.parent (tr);
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
var Widget = require ('./widget');
|
||||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Widget
|
||||
|
||||
,builder: null
|
||||
|
||||
,builderInit: function (path)
|
||||
{
|
||||
var builder = new Vn.Builder ();
|
||||
builder.signalData = this;
|
||||
builder.loadXml (path, this.doc);
|
||||
this.builderResultInit (builder);
|
||||
}
|
||||
|
||||
,builderInitString: function (xmlString)
|
||||
{
|
||||
var builder = new Vn.Builder ();
|
||||
builder.signalData = this;
|
||||
builder.loadFromString (xmlString, this.doc);
|
||||
this.builderResultInit (builder);
|
||||
}
|
||||
|
||||
,builderResultInit: function (builder)
|
||||
{
|
||||
var res = this.builder = builder.load ();
|
||||
this._node = res.$('main');
|
||||
res.link ();
|
||||
}
|
||||
|
||||
,$: function (id)
|
||||
{
|
||||
if (this.builder)
|
||||
return this.builder.getById (id);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
,_destroy: function ()
|
||||
{
|
||||
if (this.builder)
|
||||
this.builder.unref ();
|
||||
|
||||
this.parent ();
|
||||
}
|
||||
});
|
||||
|
|
@ -12,7 +12,6 @@ module.exports = new Class
|
|||
{
|
||||
this.img.src = x;
|
||||
}
|
||||
|
||||
},
|
||||
icon:
|
||||
{
|
||||
|
@ -21,7 +20,6 @@ module.exports = new Class
|
|||
{
|
||||
this.img.src = 'image/icon/light/'+ x +'.svg';
|
||||
}
|
||||
|
||||
},
|
||||
tip:
|
||||
{
|
||||
|
@ -34,7 +32,7 @@ module.exports = new Class
|
|||
this.img.title = _(x);
|
||||
}
|
||||
|
||||
this.render ();
|
||||
this.renderContent ();
|
||||
}
|
||||
,get: function ()
|
||||
{
|
||||
|
@ -47,7 +45,7 @@ module.exports = new Class
|
|||
,set: function (x)
|
||||
{
|
||||
this._showText = x;
|
||||
this.render ();
|
||||
this.renderContent ();
|
||||
}
|
||||
,get: function ()
|
||||
{
|
||||
|
@ -58,27 +56,25 @@ module.exports = new Class
|
|||
|
||||
,_showText: false
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('button');
|
||||
this.node.className = 'htk-button';
|
||||
this.node.addEventListener ('click', this.onClick.bind (this));
|
||||
var node = this.createRoot ('button');
|
||||
node.className = 'htk-button';
|
||||
node.addEventListener ('click', this.onClick.bind (this));
|
||||
|
||||
this.img = document.createElement ('img');
|
||||
this.node.appendChild (this.img);
|
||||
|
||||
this.parent (props);
|
||||
this.img = this.createElement ('img');
|
||||
node.appendChild (this.img);
|
||||
}
|
||||
|
||||
,render: function ()
|
||||
,renderContent: function ()
|
||||
{
|
||||
if (this._textNode)
|
||||
Vn.Node.remove (this._textNode);
|
||||
|
||||
if (this._showText && this.node.title)
|
||||
{
|
||||
this._textNode = document.createElement ('span');
|
||||
this._textNode.appendChild (document.createTextNode (this.node.title));
|
||||
this._textNode = this.createElement ('span');
|
||||
this._textNode.appendChild (this.createTextNode (this.node.title));
|
||||
this.node.appendChild (this._textNode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,80 +24,80 @@ module.exports = new Class
|
|||
,year: null
|
||||
,month: null
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var len = Vn.Date.WDays.length;
|
||||
|
||||
this.createElement ('div');
|
||||
this.node.className = 'htk-calendar';
|
||||
var node = this.createRoot ('div');
|
||||
node.className = 'htk-calendar';
|
||||
|
||||
var table = document.createElement ('table');
|
||||
var table = this.createElement ('table');
|
||||
this.node.appendChild (table);
|
||||
|
||||
var colgroup = document.createElement ('colgroup');
|
||||
var colgroup = this.createElement ('colgroup');
|
||||
table.appendChild (colgroup);
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
colgroup.appendChild (document.createElement ('col'));
|
||||
colgroup.appendChild (this.createElement ('col'));
|
||||
|
||||
var thead = document.createElement ('thead');
|
||||
var thead = this.createElement ('thead');
|
||||
table.appendChild (thead);
|
||||
|
||||
var tr = document.createElement ('tr');
|
||||
var tr = this.createElement ('tr');
|
||||
thead.appendChild (tr);
|
||||
|
||||
var th = document.createElement ('th');
|
||||
th.appendChild (document.createTextNode ('<'));
|
||||
var th = this.createElement ('th');
|
||||
th.appendChild (this.createTextNode ('<'));
|
||||
th.className = 'button';
|
||||
th.addEventListener ('click', this.prevMonthClicked.bind (this));
|
||||
tr.appendChild (th);
|
||||
|
||||
var th = document.createElement ('th');
|
||||
var th = this.createElement ('th');
|
||||
th.colSpan = 5;
|
||||
tr.appendChild (th);
|
||||
|
||||
var monthNode = document.createElement ('span');
|
||||
var monthNode = this.createElement ('span');
|
||||
th.appendChild (monthNode);
|
||||
|
||||
var space = document.createTextNode (' ');
|
||||
var space = this.createTextNode (' ');
|
||||
th.appendChild (space);
|
||||
|
||||
var yearNode = document.createElement ('span');
|
||||
var yearNode = this.createElement ('span');
|
||||
th.appendChild (yearNode);
|
||||
|
||||
var th = document.createElement ('th');
|
||||
th.appendChild (document.createTextNode ('>'));
|
||||
var th = this.createElement ('th');
|
||||
th.appendChild (this.createTextNode ('>'));
|
||||
th.className = 'button';
|
||||
th.addEventListener ('click', this.nextMonthClicked.bind (this));
|
||||
tr.appendChild (th);
|
||||
|
||||
var tr = document.createElement ('tr');
|
||||
var tr = this.createElement ('tr');
|
||||
thead.appendChild (tr);
|
||||
|
||||
for (var i = 1; i <= len; i++)
|
||||
{
|
||||
var th = document.createElement ('th');
|
||||
var th = this.createElement ('th');
|
||||
tr.appendChild (th);
|
||||
|
||||
var weekday = _(Vn.Date.AbrWDays [i%len]);
|
||||
th.appendChild (document.createTextNode (weekday));
|
||||
th.appendChild (this.createTextNode (weekday));
|
||||
}
|
||||
|
||||
var tbody = document.createElement ('tbody');
|
||||
var tbody = this.createElement ('tbody');
|
||||
table.appendChild (tbody);
|
||||
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
var tr = document.createElement ('tr');
|
||||
var tr = this.createElement ('tr');
|
||||
tbody.appendChild (tr);
|
||||
|
||||
for (var j = 0; j < len; j++)
|
||||
{
|
||||
var td = document.createElement ('td');
|
||||
var td = this.createElement ('td');
|
||||
td.addEventListener ('click', this.dayClicked.bind (this, td, i*len+j));
|
||||
tr.appendChild (td);
|
||||
|
||||
var div = document.createElement ('div');
|
||||
var div = this.createElement ('div');
|
||||
td.appendChild (div);
|
||||
|
||||
this.cells.push ({
|
||||
|
@ -111,7 +111,6 @@ module.exports = new Class
|
|||
this.monthNode = monthNode;
|
||||
this.yearNode = yearNode;
|
||||
this.goToCurrentMonth ();
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,getMonthDays: function ()
|
||||
|
|
|
@ -4,13 +4,11 @@ module.exports = new Class
|
|||
Extends: Htk.Field
|
||||
,Tag: 'htk-check'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('input');
|
||||
this.node.type = 'checkbox';
|
||||
this.node.addEventListener ('change', this.changed.bind (this));
|
||||
|
||||
this.parent (props);
|
||||
var node = this.createRoot ('input');
|
||||
node.type = 'checkbox';
|
||||
node.addEventListener ('change', this.changed.bind (this));
|
||||
}
|
||||
|
||||
,changed: function ()
|
||||
|
|
|
@ -10,16 +10,15 @@ module.exports = new Class
|
|||
,calendar: null
|
||||
,ignoreCalendarChange: false
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('div');
|
||||
this.node.className = 'htk-date-chooser';
|
||||
var node = this.createRoot ('div');
|
||||
node.className = 'htk-date-chooser';
|
||||
|
||||
this.label = document.createElement ('span');
|
||||
this.label = this.createElement ('span');
|
||||
this.node.appendChild (this.label);
|
||||
|
||||
this.setEditable (this._editable);
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,putValue: function (value)
|
||||
|
@ -48,7 +47,7 @@ module.exports = new Class
|
|||
|
||||
if (editable && !this.calendar)
|
||||
{
|
||||
this.button = document.createElement ('button');
|
||||
this.button = this.createElement ('button');
|
||||
this.button.className = 'input';
|
||||
this.button.title = _('ChangeDate');
|
||||
this.button.addEventListener ('click', this._onClick.bind (this));
|
||||
|
|
|
@ -4,13 +4,11 @@ module.exports = new Class
|
|||
Extends: Htk.Field
|
||||
,Tag: 'htk-entry'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('input');
|
||||
this.node.type = 'text';
|
||||
this.node.addEventListener ('change', this._onChange.bind (this));
|
||||
|
||||
this.parent (props);
|
||||
var node = this.createRoot ('input');
|
||||
node.type = 'text';
|
||||
node.addEventListener ('change', this._onChange.bind (this));
|
||||
}
|
||||
|
||||
,_onChange: function (event)
|
||||
|
|
|
@ -4,10 +4,9 @@ module.exports = new Class
|
|||
Extends: Htk.Field
|
||||
,Tag: 'htk-html'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('div');
|
||||
this.parent (props);
|
||||
this.createRoot ('div');
|
||||
}
|
||||
|
||||
,putValue: function (value)
|
||||
|
|
|
@ -70,12 +70,12 @@ module.exports = new Class
|
|||
,_error: false
|
||||
,_editable: false
|
||||
|
||||
,_createNode: function ()
|
||||
,render: function ()
|
||||
{
|
||||
var node = this.createElement ('div');
|
||||
var node = this.createRoot ('div');
|
||||
node.className = 'htk-image';
|
||||
|
||||
var img = this.img = document.createElement ('img');
|
||||
var img = this.img = this.createElement ('img');
|
||||
img.addEventListener ('error', this._onImageError.bind (this));
|
||||
node.appendChild (img);
|
||||
|
||||
|
@ -117,13 +117,13 @@ module.exports = new Class
|
|||
|
||||
if (this._editable)
|
||||
{
|
||||
var button = document.createElement ('button');
|
||||
var button = this.createElement ('button');
|
||||
button.addEventListener ('click', this._onEditClick.bind (this));
|
||||
button.title = _('UpdateImage');
|
||||
this.node.appendChild (button);
|
||||
|
||||
var icon = new Htk.Icon ({icon: 'add-photo'});
|
||||
button.appendChild (icon.getNode ());
|
||||
button.appendChild (icon.node);
|
||||
|
||||
this.editButton = button;
|
||||
}
|
||||
|
|
|
@ -25,10 +25,9 @@ module.exports = new Class
|
|||
|
||||
,_format: null
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('label');
|
||||
this.parent (props);
|
||||
this.createRoot ('label');
|
||||
}
|
||||
|
||||
,putValue: function (value)
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = new Class
|
|||
|
||||
,createButton: function (value)
|
||||
{
|
||||
var radio = Vn.Browser.createRadio (this.name);
|
||||
var radio = Vn.Browser.createRadio (this.name, this.doc);
|
||||
radio.value = value;
|
||||
radio.checked = value == this.value;
|
||||
radio.addEventListener ('change', this._onRadioChange.bind (this, value));
|
||||
|
|
|
@ -34,14 +34,12 @@ module.exports = new Class
|
|||
|
||||
,_radioGroup: null
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var radio = Vn.Browser.createRadio ('');
|
||||
var radio = Vn.Browser.createRadio ('', this.doc);
|
||||
radio.checked = false;
|
||||
radio.addEventListener ('change', this._onChange.bind (this));
|
||||
this._node = radio;
|
||||
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,_onChange: function ()
|
||||
|
|
|
@ -4,9 +4,9 @@ module.exports = new Class
|
|||
Extends: Htk.Field
|
||||
,Tag: 'htk-search-entry'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var div = this.createElement ('div');
|
||||
var div = this.createRoot ('div');
|
||||
div.className = 'htk-search-entry';
|
||||
|
||||
var icon = new Htk.Icon ({
|
||||
|
@ -15,7 +15,7 @@ module.exports = new Class
|
|||
});
|
||||
div.appendChild (icon.node);
|
||||
|
||||
var input = document.createElement ('input');
|
||||
var input = this.createElement ('input');
|
||||
input.className = 'entry';
|
||||
input.type = 'text';
|
||||
input.placeholder = _('Search');
|
||||
|
@ -23,7 +23,6 @@ module.exports = new Class
|
|||
div.appendChild (input);
|
||||
|
||||
this._input = input;
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,_onChange: function (event)
|
||||
|
|
|
@ -112,14 +112,12 @@ module.exports = new Class
|
|||
,_notNull: true
|
||||
,_webkitRefresh: false
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var button = this.createElement ('button');
|
||||
var button = this.createRoot ('button');
|
||||
button.type = 'button';
|
||||
button.className = 'htk-select input';
|
||||
button.addEventListener ('mousedown', this._onButtonMouseDown.bind (this));
|
||||
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,on: function (id, callback, instance)
|
||||
|
@ -154,13 +152,13 @@ module.exports = new Class
|
|||
|
||||
var model = this._model;
|
||||
|
||||
var menu = document.createElement ('div');
|
||||
var menu = this.createElement ('div');
|
||||
menu.className = 'htk-select-menu';
|
||||
|
||||
var grid = new Htk.Grid ({showHeader: false});
|
||||
menu.appendChild (grid.getNode ());
|
||||
menu.appendChild (grid.node);
|
||||
|
||||
var gridNode = grid.getNode ();
|
||||
var gridNode = grid.node;
|
||||
gridNode.addEventListener ('click', this._onGridClicked.bind (this, grid));
|
||||
|
||||
var column = new ColumnText ({columnIndex: this.showColumnIndex});
|
||||
|
|
|
@ -4,16 +4,15 @@ module.exports = new Class
|
|||
Extends: Htk.Field
|
||||
,Tag: 'htk-spin'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var input = this.createElement ('input');
|
||||
var input = this.createRoot ('input');
|
||||
//setInputTypeNumber (input);
|
||||
this.node.type = 'number';
|
||||
input.addEventListener ('change', this._onChange.bind (this));
|
||||
|
||||
this.unit = null;
|
||||
this.digits = 0;
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,_onChange: function ()
|
||||
|
|
|
@ -7,10 +7,10 @@ module.exports = new Class
|
|||
Extends: Entry
|
||||
,Tag: 'htk-table'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var tv = new Htk.TreeView ();
|
||||
this.node.appendChild (tv.getNode ());
|
||||
this.node.appendChild (tv.node);
|
||||
|
||||
var renderer = new ColumnRadio ();
|
||||
tv.appendColumn (0, renderer, '');
|
||||
|
@ -20,7 +20,6 @@ module.exports = new Class
|
|||
|
||||
this.treeview = tv;
|
||||
this.rbGroup = rbGroup;
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,setModel: function (model)
|
||||
|
|
|
@ -4,12 +4,10 @@ module.exports = new Class
|
|||
Extends: Htk.Field
|
||||
,Tag: 'htk-textarea'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('textarea');
|
||||
this.node.addEventListener ('change', this.changed.bind (this));
|
||||
|
||||
this.parent (props);
|
||||
var node = this.createRoot ('textarea');
|
||||
node.addEventListener ('change', this.changed.bind (this));
|
||||
}
|
||||
|
||||
,changed: function (event)
|
||||
|
|
|
@ -25,14 +25,13 @@ module.exports = new Class
|
|||
|
||||
,_format: null
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this._node = document.createTextNode ('');
|
||||
this.parent (props);
|
||||
this._node = this.createTextNode ('');
|
||||
}
|
||||
|
||||
,putValue: function (value)
|
||||
{
|
||||
this.node.nodeValue = Vn.Value.format (value, this._format);
|
||||
this._node.nodeValue = Vn.Value.format (value, this._format);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -71,21 +71,19 @@ module.exports = new Class
|
|||
,sortWay: null
|
||||
,_showHeader: true
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.table = this.createElement ('table');
|
||||
this.table.className = 'htk-grid';
|
||||
var table = this.createRoot ('table');
|
||||
table.className = 'htk-grid';
|
||||
|
||||
var thead = document.createElement ('thead');
|
||||
this.table.appendChild (thead);
|
||||
var thead = this.createElement ('thead');
|
||||
table.appendChild (thead);
|
||||
|
||||
this.thead = document.createElement ('tr')
|
||||
this.thead = this.createElement ('tr')
|
||||
thead.appendChild (this.thead);
|
||||
|
||||
this.tbody = document.createElement ('tbody');
|
||||
this.table.appendChild (this.tbody);
|
||||
|
||||
this.parent (props);
|
||||
this.tbody = this.createElement ('tbody');
|
||||
table.appendChild (this.tbody);
|
||||
}
|
||||
|
||||
,appendChild: function (child)
|
||||
|
@ -151,7 +149,7 @@ module.exports = new Class
|
|||
{
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var tr = document.createElement ('tr');
|
||||
var tr = this.createElement ('tr');
|
||||
|
||||
if (i % 2)
|
||||
tr.className = 'pair-row';
|
||||
|
@ -196,8 +194,8 @@ module.exports = new Class
|
|||
return;
|
||||
}
|
||||
|
||||
this.table.removeChild (this.tbody);
|
||||
this.tbody = document.createElement ('tbody');
|
||||
this._node.removeChild (this.tbody);
|
||||
this.tbody = this.createElement ('tbody');
|
||||
|
||||
switch (this._model.status)
|
||||
{
|
||||
|
@ -221,7 +219,7 @@ module.exports = new Class
|
|||
break;
|
||||
}
|
||||
|
||||
this.table.appendChild (this.tbody);
|
||||
this._node.appendChild (this.tbody);
|
||||
}
|
||||
|
||||
,showNoRecordsFound: function (count)
|
||||
|
@ -235,17 +233,17 @@ module.exports = new Class
|
|||
if (this.columns.length == 0)
|
||||
return;
|
||||
|
||||
var tr = document.createElement ('tr');
|
||||
var tr = this.createElement ('tr');
|
||||
this.tbody.appendChild (tr);
|
||||
|
||||
var td = document.createElement ('td');
|
||||
var td = this.createElement ('td');
|
||||
td.className = 'message';
|
||||
td.colSpan = this.columns.length;
|
||||
tr.appendChild (td);
|
||||
|
||||
if (src)
|
||||
{
|
||||
var img = document.createElement ('img');
|
||||
var img = this.createElement ('img');
|
||||
img.alt = '';
|
||||
img.src = 'image/icon/light/'+ src +'.svg';
|
||||
td.appendChild (img);
|
||||
|
@ -254,10 +252,10 @@ module.exports = new Class
|
|||
{
|
||||
var spinner = new Htk.Spinner ();
|
||||
spinner.start ();
|
||||
td.appendChild (spinner.getNode ());
|
||||
td.appendChild (spinner.node);
|
||||
}
|
||||
|
||||
var message = document.createTextNode (message);
|
||||
var message = this.createTextNode (message);
|
||||
td.appendChild (message);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@ require ('db/db');
|
|||
require ('./style.css');
|
||||
|
||||
Htk = module.exports = {
|
||||
Widget : require ('./widget')
|
||||
NodeBuilder : require ('./node-builder')
|
||||
,Widget : require ('./widget')
|
||||
,Component : require ('./component')
|
||||
,Popup : require ('./popup')
|
||||
,Toast : require ('./toast')
|
||||
,Repeater : require ('./repeater')
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = new Class
|
|||
,set: function (x)
|
||||
{
|
||||
this._icon = x;
|
||||
this.render ();
|
||||
this._setIcon ();
|
||||
}
|
||||
,get: function ()
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ module.exports = new Class
|
|||
,set: function (x)
|
||||
{
|
||||
this._theme = x;
|
||||
this.render ();
|
||||
this._setIcon ();
|
||||
}
|
||||
,get: function ()
|
||||
{
|
||||
|
@ -50,13 +50,12 @@ module.exports = new Class
|
|||
|
||||
,_icon: null
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
this.createElement ('img');
|
||||
this.parent (props);
|
||||
this.createRoot ('img');
|
||||
}
|
||||
|
||||
,render: function ()
|
||||
,_setIcon: function ()
|
||||
{
|
||||
var theme = this._theme ? this._theme : 'light';
|
||||
this.node.src = 'image/icon/'+ theme +'/'+ this._icon +'.svg';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
var Widget = require ('./widget');
|
||||
var Component = require ('./component');
|
||||
var Toast = require ('./toast');
|
||||
var Tpl = require ('./image-editor.xml');
|
||||
|
||||
|
@ -9,7 +9,7 @@ var Tpl = require ('./image-editor.xml');
|
|||
**/
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Widget
|
||||
Extends: Component
|
||||
,Properties:
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Vn.Object
|
||||
|
||||
,doc: null
|
||||
|
||||
,initialize: function (props)
|
||||
{
|
||||
this.doc = document;
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,createElement: function (tagName)
|
||||
{
|
||||
return document.createElement (tagName);
|
||||
}
|
||||
|
||||
,createTextNode: function (text)
|
||||
{
|
||||
return document.createTextNode (text);
|
||||
}
|
||||
|
||||
,render: function () {}
|
||||
});
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = new Class
|
|||
,set: function (x)
|
||||
{
|
||||
this._child = x;
|
||||
this.setChildNode (x.getNode ());
|
||||
this.setChildNode (x.node);
|
||||
}
|
||||
,get: function ()
|
||||
{
|
||||
|
@ -66,16 +66,19 @@ module.exports = new Class
|
|||
|
||||
,initialize: function (props)
|
||||
{
|
||||
var div = this.createElement ('div');
|
||||
div.className = 'htk-popup';
|
||||
|
||||
this._bgMouseDownHandler = this._bgMouseDown.bind (this);
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,render: function ()
|
||||
{
|
||||
var div = this.createRoot ('div');
|
||||
div.className = 'htk-popup';
|
||||
}
|
||||
|
||||
,setChild: function (child)
|
||||
{
|
||||
this.setChildNode (child.getNode ());
|
||||
this.setChildNode (child.node);
|
||||
}
|
||||
|
||||
,setChildNode: function (childNode)
|
||||
|
@ -107,20 +110,20 @@ module.exports = new Class
|
|||
|
||||
if (this.isModal ())
|
||||
{
|
||||
var bg = this._bg = document.createElement ('div');
|
||||
var bg = this._bg = this.createElement ('div');
|
||||
bg.className = 'htk-background';
|
||||
bg.addEventListener ('mousedown', this._bgMouseDownHandler);
|
||||
|
||||
Vn.Node.addClass (this.node, 'modal');
|
||||
bg.appendChild (this.node);
|
||||
|
||||
document.body.appendChild (bg);
|
||||
this.doc.body.appendChild (bg);
|
||||
setTimeout (this._onOpacityTimeout.bind (this), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
document.addEventListener ('mousedown', this._bgMouseDownHandler);
|
||||
document.body.appendChild (this.node);
|
||||
this.doc.addEventListener ('mousedown', this._bgMouseDownHandler);
|
||||
this.doc.body.appendChild (this.node);
|
||||
}
|
||||
|
||||
this._isOpen = true;
|
||||
|
@ -208,7 +211,7 @@ module.exports = new Class
|
|||
this._bg = null;
|
||||
}
|
||||
else
|
||||
document.removeEventListener ('mousedown', this._bgMouseDownHandler);
|
||||
this.doc.removeEventListener ('mousedown', this._bgMouseDownHandler);
|
||||
|
||||
Vn.Node.remove (this.node);
|
||||
this._parent = null;
|
||||
|
|
|
@ -75,15 +75,13 @@ module.exports = new Class
|
|||
,_builder: null
|
||||
,_formId: 'form'
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var div = this.createElement ('div');
|
||||
var div = this.createRoot ('div');
|
||||
|
||||
this._container = document.createElement ('div');
|
||||
this._container = this.createElement ('div');
|
||||
this._container.className = 'htk-repeater';
|
||||
div.appendChild (this._container);
|
||||
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,loadXml: function (builderResult, node)
|
||||
|
@ -178,13 +176,13 @@ module.exports = new Class
|
|||
|
||||
,_showMessage: function (message, src)
|
||||
{
|
||||
var div = document.createElement ('div');
|
||||
var div = this.createElement ('div');
|
||||
div.className = 'message';
|
||||
this._container.appendChild (div);
|
||||
|
||||
if (src)
|
||||
{
|
||||
var img = document.createElement ('img');
|
||||
var img = this.createElement ('img');
|
||||
img.alt = '';
|
||||
img.src = 'image/icon/light/'+ src +'.svg';
|
||||
div.appendChild (img);
|
||||
|
@ -193,10 +191,10 @@ module.exports = new Class
|
|||
{
|
||||
var spinner = new Htk.Spinner ();
|
||||
spinner.start ();
|
||||
div.appendChild (spinner.getNode ());
|
||||
div.appendChild (spinner.node);
|
||||
}
|
||||
|
||||
div.appendChild (document.createTextNode (message));
|
||||
div.appendChild (this.createTextNode (message));
|
||||
}
|
||||
|
||||
,_onRowDelete: function (model, row)
|
||||
|
|
|
@ -8,34 +8,31 @@ module.exports = new Class
|
|||
|
||||
,_started: false
|
||||
|
||||
,initialize: function (props)
|
||||
,render: function ()
|
||||
{
|
||||
var loader = this.createElement ('div');
|
||||
var loader = this.createRoot ('div');
|
||||
loader.className = 'htk-spinner';
|
||||
|
||||
var spin = document.createElement ('div');
|
||||
var spin = this.spin = this.createElement ('div');
|
||||
loader.appendChild (spin);
|
||||
|
||||
this.spin = spin;
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,start: function ()
|
||||
{
|
||||
if (!this._started)
|
||||
{
|
||||
Vn.Node.addClass (this.spin, 'spinner');
|
||||
this._started = true;
|
||||
}
|
||||
if (this._started)
|
||||
return;
|
||||
|
||||
Vn.Node.addClass (this.spin, 'spinner');
|
||||
this._started = true;
|
||||
}
|
||||
|
||||
,stop: function ()
|
||||
{
|
||||
if (this._started)
|
||||
{
|
||||
Vn.Node.removeClass (this.spin, 'spinner');
|
||||
this._started = false;
|
||||
}
|
||||
if (!this._started)
|
||||
return;
|
||||
|
||||
Vn.Node.removeClass (this.spin, 'spinner');
|
||||
this._started = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ td.cell-image .htk-image
|
|||
left: 50%;
|
||||
top: 4em;
|
||||
width: 21em;
|
||||
margin-left: -11em;
|
||||
margin-left: -10.5em;
|
||||
text-align: center;
|
||||
overflow: auto;
|
||||
max-height: 40em;
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
|
||||
var NodeBuilder = require ('./node-builder');
|
||||
|
||||
module.exports = new Class
|
||||
({
|
||||
Extends: Vn.Object
|
||||
Extends: NodeBuilder
|
||||
,Properties:
|
||||
{
|
||||
/**
|
||||
* Main HTML node that represents the widget
|
||||
**/
|
||||
node:
|
||||
{
|
||||
type: Object
|
||||
,get: function ()
|
||||
{
|
||||
this.renderBase ();
|
||||
return this._node;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* CSS classes to be appendend to the node classes.
|
||||
**/
|
||||
class:
|
||||
{
|
||||
type: String
|
||||
|
@ -27,77 +36,38 @@ module.exports = new Class
|
|||
}
|
||||
}
|
||||
|
||||
/** Main HTML node that represents the widget **/
|
||||
,_node: null
|
||||
,builder: null
|
||||
|
||||
,builderInit: function (path)
|
||||
,initialize: function (props)
|
||||
{
|
||||
var builder = new Vn.Builder ();
|
||||
builder.signalData = this;
|
||||
builder.loadXml (path);
|
||||
this.builderResultInit (builder);
|
||||
this.doc = document;
|
||||
this.renderBase ();
|
||||
this.parent (props);
|
||||
}
|
||||
|
||||
,builderInitString: function (xmlString)
|
||||
,createRoot: function (tagName)
|
||||
{
|
||||
var builder = new Vn.Builder ();
|
||||
builder.signalData = this;
|
||||
builder.loadFromString (xmlString);
|
||||
this.builderResultInit (builder);
|
||||
return this._node = this.createElement (tagName);
|
||||
}
|
||||
|
||||
,builderResultInit: function (builder)
|
||||
,renderBase: function ()
|
||||
{
|
||||
var res = this.builder = builder.load ();
|
||||
this._node = res.$('main');
|
||||
res.link ();
|
||||
}
|
||||
|
||||
,createElement: function (tagName)
|
||||
{
|
||||
this._node = document.createElement (tagName);
|
||||
return this._node;
|
||||
}
|
||||
if (this._node)
|
||||
return;
|
||||
|
||||
,getNode: function ()
|
||||
{
|
||||
if (!this._node)
|
||||
{
|
||||
this._createNode ();
|
||||
this._refreshClass ();
|
||||
}
|
||||
|
||||
return this._node;
|
||||
this.render ();
|
||||
this._refreshClass ();
|
||||
}
|
||||
|
||||
,_createNode: function () {}
|
||||
|
||||
,_refreshClass: function ()
|
||||
{
|
||||
if (this._node && this._cssClass)
|
||||
this._node.className = this._cssClass +' '+ this._node.className;
|
||||
}
|
||||
|
||||
,$: function (id)
|
||||
{
|
||||
if (this.builder)
|
||||
return this.builder.getById (id);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
,remove: function ()
|
||||
{
|
||||
Vn.Node.remove (this._node);
|
||||
}
|
||||
|
||||
,_destroy: function ()
|
||||
{
|
||||
if (this.builder)
|
||||
this.builder.unref ();
|
||||
|
||||
this.parent ();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ module.exports =
|
|||
return window.innerWidth;
|
||||
},
|
||||
|
||||
createRadio: function (uid)
|
||||
createRadio: function (uid, doc)
|
||||
{
|
||||
var radio = document.createElement ('input');
|
||||
var radio = doc.createElement ('input');
|
||||
radio.type = 'radio';
|
||||
radio.name = uid;
|
||||
return radio;
|
||||
|
|
|
@ -190,7 +190,7 @@ module.exports = new Class
|
|||
this._contextMap = {};
|
||||
this._links = [];
|
||||
this._mainContext = null;
|
||||
this._document = dstDocument ? dstDocument : document;
|
||||
this._doc = dstDocument ? dstDocument : document;
|
||||
}
|
||||
|
||||
,_compileEnd: function (node)
|
||||
|
@ -279,7 +279,7 @@ module.exports = new Class
|
|||
|
||||
,textInstantiate: function (context)
|
||||
{
|
||||
return this._document.createTextNode (context.text);
|
||||
return this._doc.createTextNode (context.text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -487,7 +487,7 @@ module.exports = new Class
|
|||
|
||||
,elementInstantiate: function (context)
|
||||
{
|
||||
return this._document.createElement (context.tagName);
|
||||
return this._doc.createElement (context.tagName);
|
||||
}
|
||||
|
||||
,elementLink: function (context, object, objects)
|
||||
|
@ -502,7 +502,7 @@ module.exports = new Class
|
|||
var child = objects[childs[i]];
|
||||
|
||||
if (child instanceof Htk.Widget)
|
||||
child = child.getNode ();
|
||||
child = child.node;
|
||||
if (child instanceof Node)
|
||||
object.appendChild (child);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = new Class
|
|||
**/
|
||||
,open: function (user, pass, remember, callback)
|
||||
{
|
||||
if (user)
|
||||
if (user !== null && user !== undefined)
|
||||
{
|
||||
var params = {
|
||||
'user': user
|
||||
|
@ -125,10 +125,7 @@ module.exports = new Class
|
|||
,_onUserSupplant: function (callback, json, error)
|
||||
{
|
||||
if (json)
|
||||
{
|
||||
this.token = json;
|
||||
this._isSupplant = true;
|
||||
}
|
||||
|
||||
if (callback)
|
||||
callback (json != null);
|
||||
|
@ -139,7 +136,6 @@ module.exports = new Class
|
|||
**/
|
||||
,supplantEnd: function ()
|
||||
{
|
||||
this._isSupplant = false;
|
||||
this.token = this.fetchToken ();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,10 @@ if ($result = $db->query ('SELECT name, content FROM metatag'))
|
|||
$result->free ();
|
||||
}
|
||||
|
||||
if (_DEV_MODE)
|
||||
{
|
||||
$url = 'http://localhost:8080';
|
||||
$this->includeJs ("$url/webpack-dev-server.js");
|
||||
$this->includeJs ("$url/build/hedera-web.js");
|
||||
}
|
||||
else
|
||||
$this->includeJs ('build/hedera-web.js');
|
||||
$url = _DEV_MODE ? 'http://localhost:8080' : '.';
|
||||
|
||||
if (_DEV_MODE)
|
||||
$this->includeJs ("$url/webpack-dev-server.js");
|
||||
|
||||
$this->includeJs ("$url/build/hedera-web.js");
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@ require_once __DIR__.'/lib/method.php';
|
|||
|
||||
class Clean extends Edi\Method
|
||||
{
|
||||
function ediRun ()
|
||||
function ediRun ($db)
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$imap = $this->imap;
|
||||
|
||||
$cleanPeriod = $db->getValue ('SELECT clean_period FROM imap_config');
|
||||
|
|
|
@ -2,19 +2,16 @@
|
|||
|
||||
namespace Edi;
|
||||
|
||||
require_once ('vn/lib/method.php');
|
||||
|
||||
abstract class Method extends \Vn\Lib\Method
|
||||
{
|
||||
protected $imap;
|
||||
protected $imapConf;
|
||||
protected $mailbox;
|
||||
|
||||
abstract function ediRun ();
|
||||
abstract function ediRun ($db);
|
||||
|
||||
function run ()
|
||||
function run ($db)
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$db->selectDb ('edi');
|
||||
|
||||
$imapConf = $db->getRow (
|
||||
|
@ -33,7 +30,7 @@ abstract class Method extends \Vn\Lib\Method
|
|||
|
||||
if ($imap)
|
||||
{
|
||||
$this->ediRun ();
|
||||
$this->ediRun ($db);
|
||||
imap_expunge ($imap);
|
||||
imap_close ($imap);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Edi;
|
||||
|
||||
require_once ('vn/lib/type.php');
|
||||
use Vn\Lib\Type;
|
||||
|
||||
class Segment
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ class Segment
|
|||
return $tmp;
|
||||
case TYPE_DOUBLE:
|
||||
case TYPE_INTEGER:
|
||||
set_type ($v, $type);
|
||||
Type::set ($v, $type);
|
||||
default:
|
||||
return $v;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,8 @@ require_once (__DIR__.'/lib/message.php');
|
|||
|
||||
class Load extends Edi\Method
|
||||
{
|
||||
function ediRun ()
|
||||
function ediRun ($db)
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$this->ediSchema = Edi\Message::loadSchema ('CLOCKT');
|
||||
|
||||
if (!$this->ediSchema)
|
||||
|
@ -21,7 +20,7 @@ class Load extends Edi\Method
|
|||
if ($inbox)
|
||||
{
|
||||
foreach ($inbox as $msg)
|
||||
$this->loadMail ($msg);
|
||||
$this->loadMail ($db, $msg);
|
||||
|
||||
$inboxCount = count ($inbox);
|
||||
|
||||
|
@ -30,9 +29,8 @@ class Load extends Edi\Method
|
|||
}
|
||||
}
|
||||
|
||||
function loadMail ($msg)
|
||||
function loadMail ($db, $msg)
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$imap = $this->imap;
|
||||
|
||||
// Gets EKT messages from email
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
|
||||
require_once ('vn/lib/method.php');
|
||||
|
||||
class Update extends Vn\Lib\Method
|
||||
{
|
||||
function run ()
|
||||
function run ($db)
|
||||
{
|
||||
$db = $this->getSysConn ();
|
||||
$db->selectDb ('edi');
|
||||
//$db->options (MYSQLI_OPT_LOCAL_INFILE, TRUE);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class HtmlService extends Service
|
|||
|
||||
if ($updateBrowser)
|
||||
{
|
||||
header ('Location: ?page=update-browser');
|
||||
header ('Location: ?method=update-browser');
|
||||
exit (0);
|
||||
}
|
||||
else
|
||||
|
@ -60,7 +60,7 @@ class HtmlService extends Service
|
|||
&& $db->getValue ('SELECT test_domain FROM config'))
|
||||
{
|
||||
$_SESSION['skipVersionMenu'] = TRUE;
|
||||
header ('Location: ?page=version-menu');
|
||||
header ('Location: ?method=version-menu');
|
||||
}
|
||||
|
||||
// Setting the version
|
||||
|
@ -82,7 +82,7 @@ class HtmlService extends Service
|
|||
|
||||
$this->printHeader ();
|
||||
$dir = $basePath;
|
||||
include ("./$basePath/html.php");
|
||||
include ("./$basePath/ui.php");
|
||||
}
|
||||
else
|
||||
header ('Location: ./');
|
||||
|
|
|
@ -89,7 +89,7 @@ abstract class Service
|
|||
$agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$browser = get_browser ($agent, TRUE);
|
||||
|
||||
if (isset ($browser['crawler']) && $browser['crawler'])
|
||||
if (!empty ($browser['crawler']))
|
||||
{
|
||||
$_SESSION['skipVisit'] = TRUE;
|
||||
return;
|
||||
|
@ -192,14 +192,10 @@ abstract class Service
|
|||
// Registering the user access
|
||||
|
||||
if (isset ($_SESSION['access']) && $userChanged)
|
||||
{
|
||||
$db->query (
|
||||
'CALL visitUserNew (#, #)',
|
||||
[$_SESSION['access'], session_id ()]
|
||||
);
|
||||
error_log ($db->render ('CALL visitUserNew (#, #)',
|
||||
[$_SESSION['access'], session_id ()]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,7 +242,7 @@ abstract class Service
|
|||
'exp' => time () + $tokenLife
|
||||
];
|
||||
|
||||
if (!empty ($recover))
|
||||
if ($recover)
|
||||
$payload['recover'] = 'TRUE';
|
||||
|
||||
$key = $this->db->getValue ('SELECT jwtKey FROM config');
|
||||
|
|
Loading…
Reference in New Issue