Código reorganizado y optimizado

This commit is contained in:
Juan Ferrer Toribio 2016-10-16 16:16:08 +02:00
parent d863d19f4e
commit 1d65501db9
59 changed files with 323 additions and 314 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.355-deb8) stable; urgency=low hedera-web (1.356-deb8) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -12,7 +12,7 @@ Hedera.Queries = new Class
{ {
if (this._grid) if (this._grid)
{ {
this.$('grid-holder').removeChild (this._grid.getNode ()); this.$('grid-holder').removeChild (this._grid.node);
this._grid.unref (); this._grid.unref ();
this._grid = null; this._grid = null;
} }
@ -94,7 +94,7 @@ Hedera.Queries = new Class
} }
grid.model = model; grid.model = model;
gridHolder.appendChild (grid.getNode ()); gridHolder.appendChild (grid.node);
this._grid = grid; this._grid = grid;
} }

View File

@ -68,7 +68,7 @@ Hedera.Catalog = new Class
var className = 'list-view'; var className = 'list-view';
} }
var node = this.$('grid-view').getNode (); var node = this.$('grid-view').node;
node.className = className; node.className = className;
localStorage.setItem ('hederaView', this.view); localStorage.setItem ('hederaView', this.view);
} }
@ -270,7 +270,7 @@ Hedera.Catalog = new Class
this.onEraseClick (); this.onEraseClick ();
this.$('card').row = form.row; this.$('card').row = form.row;
this.$('card-item').value = form.get ('item_id'); 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) ,onAddLotClick: function (column, value, row, button)
@ -410,16 +410,16 @@ Vn.Filter = new Class
,initialize: function (props) ,initialize: function (props)
{ {
this.createElement ('div'); var node = this.createRoot ('div');
this.node.className = 'vn-filter'; node.className = 'vn-filter';
this._select = new Htk.Select (); this._select = new Htk.Select ();
this._select.on ('mousedown', this._onMouseDown, this); this._select.on ('mousedown', this._onMouseDown, this);
this._select.on ('changed', this._onChange, this); this._select.on ('changed', this._onChange, this);
this._select.on ('ready', this._onReady, 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.node.appendChild (this._ul);
this._batch = new Sql.Batch (); this._batch = new Sql.Batch ();
@ -488,10 +488,10 @@ Vn.Filter = new Class
if (value === null || value === undefined) if (value === null || value === undefined)
return; return;
var li = this._lastLi = document.createElement ('li'); var li = this._lastLi = this.createElement ('li');
this._ul.appendChild (li); this._ul.appendChild (li);
var button = document.createElement ('button'); var button = this.createElement ('button');
button.addEventListener ('click', button.addEventListener ('click',
this._onCloseClick.bind (this, li)); this._onCloseClick.bind (this, li));
li.appendChild (button); li.appendChild (button);
@ -502,7 +502,7 @@ Vn.Filter = new Class
}); });
button.appendChild (icon.node); button.appendChild (icon.node);
var text = this._label = document.createTextNode (''); var text = this._label = this.createTextNode ('');
li.appendChild (text); li.appendChild (text);
setTimeout (this._onTimeout.bind (this)); setTimeout (this._onTimeout.bind (this));

View File

@ -4,7 +4,7 @@ var Tpl = require ('./gui.xml');
module.exports = new Class module.exports = new Class
({ ({
Extends: Htk.Widget, Extends: Htk.Component,
Properties: Properties:
{ {
conn: conn:

View File

@ -47,26 +47,31 @@
.vn-login .login .vn-login .login
{ {
position: absolute; position: relative;
padding: 1em; height: 100%;
max-width: 16em; max-width: 15em;
top: 50%; margin: 0 auto;
left: 50%;
margin-top: -20em;
margin-left: -9em;
} }
@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; height: auto;
} }
.vn-login .login .vn-login form
{ {
position: relative; position: relative;
top: 0;
margin-top: 3.5em; margin-top: 3.5em;
padding: 1.5em 1em; top: 0;
} }
} }
.vn-login form > div .vn-login form > div

View File

@ -4,7 +4,7 @@ var Tpl = require ('./login.xml');
module.exports = new Class module.exports = new Class
({ ({
Extends: Htk.Widget, Extends: Htk.Component,
Properties: Properties:
{ {
conn: conn:

View File

@ -37,7 +37,7 @@ module.exports = new Class
,initialize: function () ,initialize: function ()
{ {
var node = this.createElement ('div'); var node = this.createRoot ('div');
node.className = 'htk-social-bar'; node.className = 'htk-social-bar';
} }
@ -61,12 +61,12 @@ module.exports = new Class
while (res.next ()) while (res.next ())
{ {
var a = document.createElement ('a'); var a = this.createElement ('a');
a.href = res.get ('link'); a.href = res.get ('link');
a.target = '_blank'; a.target = '_blank';
this._node.appendChild (a); this._node.appendChild (a);
var img = document.createElement ('img'); var img = this.createElement ('img');
img.src = 'image/social/'+ res.get ('icon'); img.src = 'image/social/'+ res.get ('icon');
img.alt = res.get ('title'); img.alt = res.get ('title');
img.title = res.get ('title'); img.title = res.get ('title');

View File

@ -23,7 +23,7 @@ module.exports = new Class
for (var i = 0; i < stepCount; i++) for (var i = 0; i < stepCount; i++)
{ {
var img = document.createElement ('img'); var img = this.createElement ('img');
img.src = 'image/step.svg'; img.src = 'image/step.svg';
img.addEventListener ('click', this.setStep.bind (this, i)); img.addEventListener ('click', this.setStep.bind (this, i));
steps.appendChild (img); steps.appendChild (img);
@ -41,22 +41,22 @@ module.exports = new Class
,_assistant: null ,_assistant: null
,_stepIndex: -1 ,_stepIndex: -1
,initialize: function (props) ,render: function ()
{ {
var bar = this.createElement ('div'); var bar = this.createRoot ('div');
bar.className = 'htk-assistant-bar'; bar.className = 'htk-assistant-bar';
var previousButton = document.createElement ('img'); var previousButton = this.createElement ('img');
previousButton.src = 'image/icon/light/go-previous.svg'; previousButton.src = 'image/icon/light/go-previous.svg';
previousButton.className = 'previous'; previousButton.className = 'previous';
previousButton.title = _('Previous'); previousButton.title = _('Previous');
previousButton.addEventListener ('click', this.movePrevious.bind (this)); previousButton.addEventListener ('click', this.movePrevious.bind (this));
bar.appendChild (previousButton); bar.appendChild (previousButton);
var steps = document.createElement ('div'); var steps = this.createElement ('div');
bar.appendChild (steps); bar.appendChild (steps);
var nextButton = document.createElement ('img'); var nextButton = this.createElement ('img');
nextButton.src = 'image/icon/light/go-next.svg'; nextButton.src = 'image/icon/light/go-next.svg';
nextButton.className = 'next'; nextButton.className = 'next';
nextButton.title = _('Next'); nextButton.title = _('Next');
@ -66,7 +66,6 @@ module.exports = new Class
this._steps = steps; this._steps = steps;
this._previousButton = previousButton; this._previousButton = previousButton;
this._nextButton = nextButton; this._nextButton = nextButton;
this.parent (props);
} }
,movePrevious: function () ,movePrevious: function ()

View File

@ -1,10 +1,13 @@
var NodeBuilder = require ('./node-builder');
/** /**
* Represents a grid column. This is an abstract class and should not be * Represents a grid column. This is an abstract class and should not be
* instantiated directly. * instantiated directly.
**/ **/
module.exports = new Class module.exports = new Class
({ ({
Extends: Vn.Object Extends: NodeBuilder
,Tag: 'htk-column' ,Tag: 'htk-column'
,Properties: ,Properties:
{ {
@ -65,16 +68,16 @@ module.exports = new Class
**/ **/
,initialize: function (props) ,initialize: function (props)
{ {
this.td = document.createElement ('td');
this.parent (props); this.parent (props);
this.td = this.createElement ('td');
} }
,renderHeader: function () ,renderHeader: function ()
{ {
var th = document.createElement ('th'); var th = this.createElement ('th');
if (this.title) if (this.title)
th.appendChild (document.createTextNode (this.title)); th.appendChild (this.createTextNode (this.title));
return th; return th;
} }

View File

@ -40,12 +40,12 @@ module.exports = new Class
{ {
var td = this.parent (tr); var td = this.parent (tr);
var button = document.createElement ('button'); var button = this.createElement ('button');
button.addEventListener ('click', button.addEventListener ('click',
this.buttonClicked.bind (this, this.value, tr, button)); this.buttonClicked.bind (this, this.value, tr, button));
td.appendChild (button); td.appendChild (button);
var img = document.createElement ('img'); var img = this.createElement ('img');
img.src = this.image; img.src = this.image;
button.appendChild (img); button.appendChild (img);

View File

@ -12,7 +12,7 @@ module.exports = new Class
,render: function (tr) ,render: function (tr)
{ {
var checkButton = document.createElement ('input'); var checkButton = this.createElement ('input');
checkButton.type = 'checkbox'; checkButton.type = 'checkbox';
checkButton.checked = this.value; checkButton.checked = this.value;

View File

@ -35,7 +35,7 @@ module.exports = new Class
var text = Vn.Date.strftime (this.value, this._format); var text = Vn.Date.strftime (this.value, this._format);
var td = this.parent (tr); var td = this.parent (tr);
td.appendChild (document.createTextNode (text)); td.appendChild (this.createTextNode (text));
return td; return td;
} }

View File

@ -52,10 +52,11 @@ module.exports = new Class
,fullDir: this.fullDir ,fullDir: this.fullDir
,value: this.value ,value: this.value
,conn: this.conn ,conn: this.conn
,doc: this.doc
}); });
var td = this.parent (tr); var td = this.parent (tr);
td.appendChild (image.getNode ()); td.appendChild (image.node);
return td; return td;
} }
}); });

View File

@ -25,9 +25,9 @@ module.exports = new Class
,render: function (tr) ,render: function (tr)
{ {
var link = document.createElement ('a'); var link = this.createElement ('a');
link.href = this.href; link.href = this.href;
link.appendChild (document.createTextNode (this.value)); link.appendChild (this.createTextNode (this.value));
if (this.target) if (this.target)
link.target = this.target; link.target = this.target;

View File

@ -18,7 +18,7 @@ module.exports = new Class
,initialize: function (props) ,initialize: function (props)
{ {
this._cssClass = 'cell-radio'; this._cssClass = 'cell-radio';
this.radioGroup = new Htk.RadioGroup (); this.radioGroup = new Htk.RadioGroup (this.doc);
this.parent (props); this.parent (props);
} }

View File

@ -46,7 +46,7 @@ module.exports = new Class
if (this.editable) if (this.editable)
{ {
var entry = document.createElement ('input'); var entry = this.createElement ('input');
entry.type = 'text'; entry.type = 'text';
entry.addEventListener ('change', this.inputChanged.bind (this, tr, entry)); entry.addEventListener ('change', this.inputChanged.bind (this, tr, entry));
td.appendChild (entry); td.appendChild (entry);
@ -59,7 +59,7 @@ module.exports = new Class
if (this.unit) if (this.unit)
valueString = valueString + this.unit; valueString = valueString + this.unit;
var text = document.createTextNode (valueString); var text = this.createTextNode (valueString);
td.appendChild (text); td.appendChild (text);
} }

View File

@ -38,14 +38,14 @@ module.exports = new Class
{ {
var value = this.value ? this.value : ''; var value = this.value ? this.value : '';
node = document.createElement ('input'); node = this.createElement ('input');
node.type = 'text'; node.type = 'text';
node.value = value; node.value = value;
node.addEventListener ('changed', node.addEventListener ('changed',
this.inputChanged.bind (this, tr, node)); this.inputChanged.bind (this, tr, node));
} }
else else
node = document.createTextNode ( node = this.createTextNode (
Vn.Value.format (this.value, this._format)); Vn.Value.format (this.value, this._format));
var td = this.parent (tr); var td = this.parent (tr);

49
js/htk/component.js Normal file
View File

@ -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 ();
}
});

View File

@ -12,7 +12,6 @@ module.exports = new Class
{ {
this.img.src = x; this.img.src = x;
} }
}, },
icon: icon:
{ {
@ -21,7 +20,6 @@ module.exports = new Class
{ {
this.img.src = 'image/icon/light/'+ x +'.svg'; this.img.src = 'image/icon/light/'+ x +'.svg';
} }
}, },
tip: tip:
{ {
@ -34,7 +32,7 @@ module.exports = new Class
this.img.title = _(x); this.img.title = _(x);
} }
this.render (); this.renderContent ();
} }
,get: function () ,get: function ()
{ {
@ -47,7 +45,7 @@ module.exports = new Class
,set: function (x) ,set: function (x)
{ {
this._showText = x; this._showText = x;
this.render (); this.renderContent ();
} }
,get: function () ,get: function ()
{ {
@ -58,27 +56,25 @@ module.exports = new Class
,_showText: false ,_showText: false
,initialize: function (props) ,render: function ()
{ {
this.createElement ('button'); var node = this.createRoot ('button');
this.node.className = 'htk-button'; node.className = 'htk-button';
this.node.addEventListener ('click', this.onClick.bind (this)); node.addEventListener ('click', this.onClick.bind (this));
this.img = document.createElement ('img'); this.img = this.createElement ('img');
this.node.appendChild (this.img); node.appendChild (this.img);
this.parent (props);
} }
,render: function () ,renderContent: function ()
{ {
if (this._textNode) if (this._textNode)
Vn.Node.remove (this._textNode); Vn.Node.remove (this._textNode);
if (this._showText && this.node.title) if (this._showText && this.node.title)
{ {
this._textNode = document.createElement ('span'); this._textNode = this.createElement ('span');
this._textNode.appendChild (document.createTextNode (this.node.title)); this._textNode.appendChild (this.createTextNode (this.node.title));
this.node.appendChild (this._textNode); this.node.appendChild (this._textNode);
} }
} }

View File

@ -24,80 +24,80 @@ module.exports = new Class
,year: null ,year: null
,month: null ,month: null
,initialize: function (props) ,render: function ()
{ {
var len = Vn.Date.WDays.length; var len = Vn.Date.WDays.length;
this.createElement ('div'); var node = this.createRoot ('div');
this.node.className = 'htk-calendar'; node.className = 'htk-calendar';
var table = document.createElement ('table'); var table = this.createElement ('table');
this.node.appendChild (table); this.node.appendChild (table);
var colgroup = document.createElement ('colgroup'); var colgroup = this.createElement ('colgroup');
table.appendChild (colgroup); table.appendChild (colgroup);
for (var i = 0; i < len; i++) 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); table.appendChild (thead);
var tr = document.createElement ('tr'); var tr = this.createElement ('tr');
thead.appendChild (tr); thead.appendChild (tr);
var th = document.createElement ('th'); var th = this.createElement ('th');
th.appendChild (document.createTextNode ('<')); th.appendChild (this.createTextNode ('<'));
th.className = 'button'; th.className = 'button';
th.addEventListener ('click', this.prevMonthClicked.bind (this)); th.addEventListener ('click', this.prevMonthClicked.bind (this));
tr.appendChild (th); tr.appendChild (th);
var th = document.createElement ('th'); var th = this.createElement ('th');
th.colSpan = 5; th.colSpan = 5;
tr.appendChild (th); tr.appendChild (th);
var monthNode = document.createElement ('span'); var monthNode = this.createElement ('span');
th.appendChild (monthNode); th.appendChild (monthNode);
var space = document.createTextNode (' '); var space = this.createTextNode (' ');
th.appendChild (space); th.appendChild (space);
var yearNode = document.createElement ('span'); var yearNode = this.createElement ('span');
th.appendChild (yearNode); th.appendChild (yearNode);
var th = document.createElement ('th'); var th = this.createElement ('th');
th.appendChild (document.createTextNode ('>')); th.appendChild (this.createTextNode ('>'));
th.className = 'button'; th.className = 'button';
th.addEventListener ('click', this.nextMonthClicked.bind (this)); th.addEventListener ('click', this.nextMonthClicked.bind (this));
tr.appendChild (th); tr.appendChild (th);
var tr = document.createElement ('tr'); var tr = this.createElement ('tr');
thead.appendChild (tr); thead.appendChild (tr);
for (var i = 1; i <= len; i++) for (var i = 1; i <= len; i++)
{ {
var th = document.createElement ('th'); var th = this.createElement ('th');
tr.appendChild (th); tr.appendChild (th);
var weekday = _(Vn.Date.AbrWDays [i%len]); 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); table.appendChild (tbody);
for (var i = 0; i < 6; i++) for (var i = 0; i < 6; i++)
{ {
var tr = document.createElement ('tr'); var tr = this.createElement ('tr');
tbody.appendChild (tr); tbody.appendChild (tr);
for (var j = 0; j < len; j++) 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)); td.addEventListener ('click', this.dayClicked.bind (this, td, i*len+j));
tr.appendChild (td); tr.appendChild (td);
var div = document.createElement ('div'); var div = this.createElement ('div');
td.appendChild (div); td.appendChild (div);
this.cells.push ({ this.cells.push ({
@ -111,7 +111,6 @@ module.exports = new Class
this.monthNode = monthNode; this.monthNode = monthNode;
this.yearNode = yearNode; this.yearNode = yearNode;
this.goToCurrentMonth (); this.goToCurrentMonth ();
this.parent (props);
} }
,getMonthDays: function () ,getMonthDays: function ()

View File

@ -4,13 +4,11 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-check' ,Tag: 'htk-check'
,initialize: function (props) ,render: function ()
{ {
this.createElement ('input'); var node = this.createRoot ('input');
this.node.type = 'checkbox'; node.type = 'checkbox';
this.node.addEventListener ('change', this.changed.bind (this)); node.addEventListener ('change', this.changed.bind (this));
this.parent (props);
} }
,changed: function () ,changed: function ()

View File

@ -10,16 +10,15 @@ module.exports = new Class
,calendar: null ,calendar: null
,ignoreCalendarChange: false ,ignoreCalendarChange: false
,initialize: function (props) ,render: function ()
{ {
this.createElement ('div'); var node = this.createRoot ('div');
this.node.className = 'htk-date-chooser'; node.className = 'htk-date-chooser';
this.label = document.createElement ('span'); this.label = this.createElement ('span');
this.node.appendChild (this.label); this.node.appendChild (this.label);
this.setEditable (this._editable); this.setEditable (this._editable);
this.parent (props);
} }
,putValue: function (value) ,putValue: function (value)
@ -48,7 +47,7 @@ module.exports = new Class
if (editable && !this.calendar) if (editable && !this.calendar)
{ {
this.button = document.createElement ('button'); this.button = this.createElement ('button');
this.button.className = 'input'; this.button.className = 'input';
this.button.title = _('ChangeDate'); this.button.title = _('ChangeDate');
this.button.addEventListener ('click', this._onClick.bind (this)); this.button.addEventListener ('click', this._onClick.bind (this));

View File

@ -4,13 +4,11 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-entry' ,Tag: 'htk-entry'
,initialize: function (props) ,render: function ()
{ {
this.createElement ('input'); var node = this.createRoot ('input');
this.node.type = 'text'; node.type = 'text';
this.node.addEventListener ('change', this._onChange.bind (this)); node.addEventListener ('change', this._onChange.bind (this));
this.parent (props);
} }
,_onChange: function (event) ,_onChange: function (event)

View File

@ -4,10 +4,9 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-html' ,Tag: 'htk-html'
,initialize: function (props) ,render: function ()
{ {
this.createElement ('div'); this.createRoot ('div');
this.parent (props);
} }
,putValue: function (value) ,putValue: function (value)

View File

@ -70,12 +70,12 @@ module.exports = new Class
,_error: false ,_error: false
,_editable: false ,_editable: false
,_createNode: function () ,render: function ()
{ {
var node = this.createElement ('div'); var node = this.createRoot ('div');
node.className = 'htk-image'; 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)); img.addEventListener ('error', this._onImageError.bind (this));
node.appendChild (img); node.appendChild (img);
@ -117,13 +117,13 @@ module.exports = new Class
if (this._editable) if (this._editable)
{ {
var button = document.createElement ('button'); var button = this.createElement ('button');
button.addEventListener ('click', this._onEditClick.bind (this)); button.addEventListener ('click', this._onEditClick.bind (this));
button.title = _('UpdateImage'); button.title = _('UpdateImage');
this.node.appendChild (button); this.node.appendChild (button);
var icon = new Htk.Icon ({icon: 'add-photo'}); var icon = new Htk.Icon ({icon: 'add-photo'});
button.appendChild (icon.getNode ()); button.appendChild (icon.node);
this.editButton = button; this.editButton = button;
} }

View File

@ -25,10 +25,9 @@ module.exports = new Class
,_format: null ,_format: null
,initialize: function (props) ,render: function ()
{ {
this.createElement ('label'); this.createRoot ('label');
this.parent (props);
} }
,putValue: function (value) ,putValue: function (value)

View File

@ -38,7 +38,7 @@ module.exports = new Class
,createButton: function (value) ,createButton: function (value)
{ {
var radio = Vn.Browser.createRadio (this.name); var radio = Vn.Browser.createRadio (this.name, this.doc);
radio.value = value; radio.value = value;
radio.checked = value == this.value; radio.checked = value == this.value;
radio.addEventListener ('change', this._onRadioChange.bind (this, value)); radio.addEventListener ('change', this._onRadioChange.bind (this, value));

View File

@ -34,14 +34,12 @@ module.exports = new Class
,_radioGroup: null ,_radioGroup: null
,initialize: function (props) ,render: function ()
{ {
var radio = Vn.Browser.createRadio (''); var radio = Vn.Browser.createRadio ('', this.doc);
radio.checked = false; radio.checked = false;
radio.addEventListener ('change', this._onChange.bind (this)); radio.addEventListener ('change', this._onChange.bind (this));
this._node = radio; this._node = radio;
this.parent (props);
} }
,_onChange: function () ,_onChange: function ()

View File

@ -4,9 +4,9 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-search-entry' ,Tag: 'htk-search-entry'
,initialize: function (props) ,render: function ()
{ {
var div = this.createElement ('div'); var div = this.createRoot ('div');
div.className = 'htk-search-entry'; div.className = 'htk-search-entry';
var icon = new Htk.Icon ({ var icon = new Htk.Icon ({
@ -15,7 +15,7 @@ module.exports = new Class
}); });
div.appendChild (icon.node); div.appendChild (icon.node);
var input = document.createElement ('input'); var input = this.createElement ('input');
input.className = 'entry'; input.className = 'entry';
input.type = 'text'; input.type = 'text';
input.placeholder = _('Search'); input.placeholder = _('Search');
@ -23,7 +23,6 @@ module.exports = new Class
div.appendChild (input); div.appendChild (input);
this._input = input; this._input = input;
this.parent (props);
} }
,_onChange: function (event) ,_onChange: function (event)

View File

@ -112,14 +112,12 @@ module.exports = new Class
,_notNull: true ,_notNull: true
,_webkitRefresh: false ,_webkitRefresh: false
,initialize: function (props) ,render: function ()
{ {
var button = this.createElement ('button'); var button = this.createRoot ('button');
button.type = 'button'; button.type = 'button';
button.className = 'htk-select input'; button.className = 'htk-select input';
button.addEventListener ('mousedown', this._onButtonMouseDown.bind (this)); button.addEventListener ('mousedown', this._onButtonMouseDown.bind (this));
this.parent (props);
} }
,on: function (id, callback, instance) ,on: function (id, callback, instance)
@ -154,13 +152,13 @@ module.exports = new Class
var model = this._model; var model = this._model;
var menu = document.createElement ('div'); var menu = this.createElement ('div');
menu.className = 'htk-select-menu'; menu.className = 'htk-select-menu';
var grid = new Htk.Grid ({showHeader: false}); 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)); gridNode.addEventListener ('click', this._onGridClicked.bind (this, grid));
var column = new ColumnText ({columnIndex: this.showColumnIndex}); var column = new ColumnText ({columnIndex: this.showColumnIndex});

View File

@ -4,16 +4,15 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-spin' ,Tag: 'htk-spin'
,initialize: function (props) ,render: function ()
{ {
var input = this.createElement ('input'); var input = this.createRoot ('input');
//setInputTypeNumber (input); //setInputTypeNumber (input);
this.node.type = 'number'; this.node.type = 'number';
input.addEventListener ('change', this._onChange.bind (this)); input.addEventListener ('change', this._onChange.bind (this));
this.unit = null; this.unit = null;
this.digits = 0; this.digits = 0;
this.parent (props);
} }
,_onChange: function () ,_onChange: function ()

View File

@ -7,10 +7,10 @@ module.exports = new Class
Extends: Entry Extends: Entry
,Tag: 'htk-table' ,Tag: 'htk-table'
,initialize: function (props) ,render: function ()
{ {
var tv = new Htk.TreeView (); var tv = new Htk.TreeView ();
this.node.appendChild (tv.getNode ()); this.node.appendChild (tv.node);
var renderer = new ColumnRadio (); var renderer = new ColumnRadio ();
tv.appendColumn (0, renderer, ''); tv.appendColumn (0, renderer, '');
@ -20,7 +20,6 @@ module.exports = new Class
this.treeview = tv; this.treeview = tv;
this.rbGroup = rbGroup; this.rbGroup = rbGroup;
this.parent (props);
} }
,setModel: function (model) ,setModel: function (model)

View File

@ -4,12 +4,10 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-textarea' ,Tag: 'htk-textarea'
,initialize: function (props) ,render: function ()
{ {
this.createElement ('textarea'); var node = this.createRoot ('textarea');
this.node.addEventListener ('change', this.changed.bind (this)); node.addEventListener ('change', this.changed.bind (this));
this.parent (props);
} }
,changed: function (event) ,changed: function (event)

View File

@ -25,14 +25,13 @@ module.exports = new Class
,_format: null ,_format: null
,initialize: function (props) ,render: function ()
{ {
this._node = document.createTextNode (''); this._node = this.createTextNode ('');
this.parent (props);
} }
,putValue: function (value) ,putValue: function (value)
{ {
this.node.nodeValue = Vn.Value.format (value, this._format); this._node.nodeValue = Vn.Value.format (value, this._format);
} }
}); });

View File

@ -71,21 +71,19 @@ module.exports = new Class
,sortWay: null ,sortWay: null
,_showHeader: true ,_showHeader: true
,initialize: function (props) ,render: function ()
{ {
this.table = this.createElement ('table'); var table = this.createRoot ('table');
this.table.className = 'htk-grid'; table.className = 'htk-grid';
var thead = document.createElement ('thead'); var thead = this.createElement ('thead');
this.table.appendChild (thead); table.appendChild (thead);
this.thead = document.createElement ('tr') this.thead = this.createElement ('tr')
thead.appendChild (this.thead); thead.appendChild (this.thead);
this.tbody = document.createElement ('tbody'); this.tbody = this.createElement ('tbody');
this.table.appendChild (this.tbody); table.appendChild (this.tbody);
this.parent (props);
} }
,appendChild: function (child) ,appendChild: function (child)
@ -151,7 +149,7 @@ module.exports = new Class
{ {
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
var tr = document.createElement ('tr'); var tr = this.createElement ('tr');
if (i % 2) if (i % 2)
tr.className = 'pair-row'; tr.className = 'pair-row';
@ -196,8 +194,8 @@ module.exports = new Class
return; return;
} }
this.table.removeChild (this.tbody); this._node.removeChild (this.tbody);
this.tbody = document.createElement ('tbody'); this.tbody = this.createElement ('tbody');
switch (this._model.status) switch (this._model.status)
{ {
@ -221,7 +219,7 @@ module.exports = new Class
break; break;
} }
this.table.appendChild (this.tbody); this._node.appendChild (this.tbody);
} }
,showNoRecordsFound: function (count) ,showNoRecordsFound: function (count)
@ -235,17 +233,17 @@ module.exports = new Class
if (this.columns.length == 0) if (this.columns.length == 0)
return; return;
var tr = document.createElement ('tr'); var tr = this.createElement ('tr');
this.tbody.appendChild (tr); this.tbody.appendChild (tr);
var td = document.createElement ('td'); var td = this.createElement ('td');
td.className = 'message'; td.className = 'message';
td.colSpan = this.columns.length; td.colSpan = this.columns.length;
tr.appendChild (td); tr.appendChild (td);
if (src) if (src)
{ {
var img = document.createElement ('img'); var img = this.createElement ('img');
img.alt = ''; img.alt = '';
img.src = 'image/icon/light/'+ src +'.svg'; img.src = 'image/icon/light/'+ src +'.svg';
td.appendChild (img); td.appendChild (img);
@ -254,10 +252,10 @@ module.exports = new Class
{ {
var spinner = new Htk.Spinner (); var spinner = new Htk.Spinner ();
spinner.start (); spinner.start ();
td.appendChild (spinner.getNode ()); td.appendChild (spinner.node);
} }
var message = document.createTextNode (message); var message = this.createTextNode (message);
td.appendChild (message); td.appendChild (message);
} }

View File

@ -3,7 +3,9 @@ require ('db/db');
require ('./style.css'); require ('./style.css');
Htk = module.exports = { Htk = module.exports = {
Widget : require ('./widget') NodeBuilder : require ('./node-builder')
,Widget : require ('./widget')
,Component : require ('./component')
,Popup : require ('./popup') ,Popup : require ('./popup')
,Toast : require ('./toast') ,Toast : require ('./toast')
,Repeater : require ('./repeater') ,Repeater : require ('./repeater')

View File

@ -13,7 +13,7 @@ module.exports = new Class
,set: function (x) ,set: function (x)
{ {
this._icon = x; this._icon = x;
this.render (); this._setIcon ();
} }
,get: function () ,get: function ()
{ {
@ -27,7 +27,7 @@ module.exports = new Class
,set: function (x) ,set: function (x)
{ {
this._theme = x; this._theme = x;
this.render (); this._setIcon ();
} }
,get: function () ,get: function ()
{ {
@ -50,13 +50,12 @@ module.exports = new Class
,_icon: null ,_icon: null
,initialize: function (props) ,render: function ()
{ {
this.createElement ('img'); this.createRoot ('img');
this.parent (props);
} }
,render: function () ,_setIcon: function ()
{ {
var theme = this._theme ? this._theme : 'light'; var theme = this._theme ? this._theme : 'light';
this.node.src = 'image/icon/'+ theme +'/'+ this._icon +'.svg'; this.node.src = 'image/icon/'+ theme +'/'+ this._icon +'.svg';

View File

@ -1,5 +1,5 @@
var Widget = require ('./widget'); var Component = require ('./component');
var Toast = require ('./toast'); var Toast = require ('./toast');
var Tpl = require ('./image-editor.xml'); var Tpl = require ('./image-editor.xml');
@ -9,7 +9,7 @@ var Tpl = require ('./image-editor.xml');
**/ **/
module.exports = new Class module.exports = new Class
({ ({
Extends: Widget Extends: Component
,Properties: ,Properties:
{ {
/** /**

26
js/htk/node-builder.js Normal file
View File

@ -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 () {}
});

View File

@ -19,7 +19,7 @@ module.exports = new Class
,set: function (x) ,set: function (x)
{ {
this._child = x; this._child = x;
this.setChildNode (x.getNode ()); this.setChildNode (x.node);
} }
,get: function () ,get: function ()
{ {
@ -66,16 +66,19 @@ module.exports = new Class
,initialize: function (props) ,initialize: function (props)
{ {
var div = this.createElement ('div');
div.className = 'htk-popup';
this._bgMouseDownHandler = this._bgMouseDown.bind (this); this._bgMouseDownHandler = this._bgMouseDown.bind (this);
this.parent (props); this.parent (props);
} }
,render: function ()
{
var div = this.createRoot ('div');
div.className = 'htk-popup';
}
,setChild: function (child) ,setChild: function (child)
{ {
this.setChildNode (child.getNode ()); this.setChildNode (child.node);
} }
,setChildNode: function (childNode) ,setChildNode: function (childNode)
@ -107,20 +110,20 @@ module.exports = new Class
if (this.isModal ()) if (this.isModal ())
{ {
var bg = this._bg = document.createElement ('div'); var bg = this._bg = this.createElement ('div');
bg.className = 'htk-background'; bg.className = 'htk-background';
bg.addEventListener ('mousedown', this._bgMouseDownHandler); bg.addEventListener ('mousedown', this._bgMouseDownHandler);
Vn.Node.addClass (this.node, 'modal'); Vn.Node.addClass (this.node, 'modal');
bg.appendChild (this.node); bg.appendChild (this.node);
document.body.appendChild (bg); this.doc.body.appendChild (bg);
setTimeout (this._onOpacityTimeout.bind (this), 0); setTimeout (this._onOpacityTimeout.bind (this), 0);
} }
else else
{ {
document.addEventListener ('mousedown', this._bgMouseDownHandler); this.doc.addEventListener ('mousedown', this._bgMouseDownHandler);
document.body.appendChild (this.node); this.doc.body.appendChild (this.node);
} }
this._isOpen = true; this._isOpen = true;
@ -208,7 +211,7 @@ module.exports = new Class
this._bg = null; this._bg = null;
} }
else else
document.removeEventListener ('mousedown', this._bgMouseDownHandler); this.doc.removeEventListener ('mousedown', this._bgMouseDownHandler);
Vn.Node.remove (this.node); Vn.Node.remove (this.node);
this._parent = null; this._parent = null;

View File

@ -75,15 +75,13 @@ module.exports = new Class
,_builder: null ,_builder: null
,_formId: 'form' ,_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'; this._container.className = 'htk-repeater';
div.appendChild (this._container); div.appendChild (this._container);
this.parent (props);
} }
,loadXml: function (builderResult, node) ,loadXml: function (builderResult, node)
@ -178,13 +176,13 @@ module.exports = new Class
,_showMessage: function (message, src) ,_showMessage: function (message, src)
{ {
var div = document.createElement ('div'); var div = this.createElement ('div');
div.className = 'message'; div.className = 'message';
this._container.appendChild (div); this._container.appendChild (div);
if (src) if (src)
{ {
var img = document.createElement ('img'); var img = this.createElement ('img');
img.alt = ''; img.alt = '';
img.src = 'image/icon/light/'+ src +'.svg'; img.src = 'image/icon/light/'+ src +'.svg';
div.appendChild (img); div.appendChild (img);
@ -193,10 +191,10 @@ module.exports = new Class
{ {
var spinner = new Htk.Spinner (); var spinner = new Htk.Spinner ();
spinner.start (); spinner.start ();
div.appendChild (spinner.getNode ()); div.appendChild (spinner.node);
} }
div.appendChild (document.createTextNode (message)); div.appendChild (this.createTextNode (message));
} }
,_onRowDelete: function (model, row) ,_onRowDelete: function (model, row)

View File

@ -8,34 +8,31 @@ module.exports = new Class
,_started: false ,_started: false
,initialize: function (props) ,render: function ()
{ {
var loader = this.createElement ('div'); var loader = this.createRoot ('div');
loader.className = 'htk-spinner'; loader.className = 'htk-spinner';
var spin = document.createElement ('div'); var spin = this.spin = this.createElement ('div');
loader.appendChild (spin); loader.appendChild (spin);
this.spin = spin;
this.parent (props);
} }
,start: function () ,start: function ()
{ {
if (!this._started) if (this._started)
{ return;
Vn.Node.addClass (this.spin, 'spinner'); Vn.Node.addClass (this.spin, 'spinner');
this._started = true; this._started = true;
} }
}
,stop: function () ,stop: function ()
{ {
if (this._started) if (!this._started)
{ return;
Vn.Node.removeClass (this.spin, 'spinner'); Vn.Node.removeClass (this.spin, 'spinner');
this._started = false; this._started = false;
} }
}
}); });

View File

@ -382,7 +382,7 @@ td.cell-image .htk-image
left: 50%; left: 50%;
top: 4em; top: 4em;
width: 21em; width: 21em;
margin-left: -11em; margin-left: -10.5em;
text-align: center; text-align: center;
overflow: auto; overflow: auto;
max-height: 40em; max-height: 40em;

View File

@ -1,17 +1,26 @@
var NodeBuilder = require ('./node-builder');
module.exports = new Class module.exports = new Class
({ ({
Extends: Vn.Object Extends: NodeBuilder
,Properties: ,Properties:
{ {
/**
* Main HTML node that represents the widget
**/
node: node:
{ {
type: Object type: Object
,get: function () ,get: function ()
{ {
this.renderBase ();
return this._node; return this._node;
} }
}, },
/**
* CSS classes to be appendend to the node classes.
**/
class: class:
{ {
type: String type: String
@ -27,77 +36,38 @@ module.exports = new Class
} }
} }
/** Main HTML node that represents the widget **/
,_node: null ,_node: null
,builder: null
,builderInit: function (path) ,initialize: function (props)
{ {
var builder = new Vn.Builder (); this.doc = document;
builder.signalData = this; this.renderBase ();
builder.loadXml (path); this.parent (props);
this.builderResultInit (builder);
} }
,builderInitString: function (xmlString) ,createRoot: function (tagName)
{ {
var builder = new Vn.Builder (); return this._node = this.createElement (tagName);
builder.signalData = this;
builder.loadFromString (xmlString);
this.builderResultInit (builder);
} }
,builderResultInit: function (builder) ,renderBase: function ()
{ {
var res = this.builder = builder.load (); if (this._node)
this._node = res.$('main'); return;
res.link ();
}
,createElement: function (tagName) this.render ();
{
this._node = document.createElement (tagName);
return this._node;
}
,getNode: function ()
{
if (!this._node)
{
this._createNode ();
this._refreshClass (); this._refreshClass ();
} }
return this._node;
}
,_createNode: function () {}
,_refreshClass: function () ,_refreshClass: function ()
{ {
if (this._node && this._cssClass) if (this._node && this._cssClass)
this._node.className = this._cssClass +' '+ this._node.className; this._node.className = this._cssClass +' '+ this._node.className;
} }
,$: function (id)
{
if (this.builder)
return this.builder.getById (id);
return null;
}
,remove: function () ,remove: function ()
{ {
Vn.Node.remove (this._node); Vn.Node.remove (this._node);
} }
,_destroy: function ()
{
if (this.builder)
this.builder.unref ();
this.parent ();
}
}); });

View File

@ -21,9 +21,9 @@ module.exports =
return window.innerWidth; return window.innerWidth;
}, },
createRadio: function (uid) createRadio: function (uid, doc)
{ {
var radio = document.createElement ('input'); var radio = doc.createElement ('input');
radio.type = 'radio'; radio.type = 'radio';
radio.name = uid; radio.name = uid;
return radio; return radio;

View File

@ -190,7 +190,7 @@ module.exports = new Class
this._contextMap = {}; this._contextMap = {};
this._links = []; this._links = [];
this._mainContext = null; this._mainContext = null;
this._document = dstDocument ? dstDocument : document; this._doc = dstDocument ? dstDocument : document;
} }
,_compileEnd: function (node) ,_compileEnd: function (node)
@ -279,7 +279,7 @@ module.exports = new Class
,textInstantiate: function (context) ,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) ,elementInstantiate: function (context)
{ {
return this._document.createElement (context.tagName); return this._doc.createElement (context.tagName);
} }
,elementLink: function (context, object, objects) ,elementLink: function (context, object, objects)
@ -502,7 +502,7 @@ module.exports = new Class
var child = objects[childs[i]]; var child = objects[childs[i]];
if (child instanceof Htk.Widget) if (child instanceof Htk.Widget)
child = child.getNode (); child = child.node;
if (child instanceof Node) if (child instanceof Node)
object.appendChild (child); object.appendChild (child);
} }

View File

@ -40,7 +40,7 @@ module.exports = new Class
**/ **/
,open: function (user, pass, remember, callback) ,open: function (user, pass, remember, callback)
{ {
if (user) if (user !== null && user !== undefined)
{ {
var params = { var params = {
'user': user 'user': user
@ -125,10 +125,7 @@ module.exports = new Class
,_onUserSupplant: function (callback, json, error) ,_onUserSupplant: function (callback, json, error)
{ {
if (json) if (json)
{
this.token = json; this.token = json;
this._isSupplant = true;
}
if (callback) if (callback)
callback (json != null); callback (json != null);
@ -139,7 +136,6 @@ module.exports = new Class
**/ **/
,supplantEnd: function () ,supplantEnd: function ()
{ {
this._isSupplant = false;
this.token = this.fetchToken (); this.token = this.fetchToken ();
} }

View File

@ -12,12 +12,10 @@ if ($result = $db->query ('SELECT name, content FROM metatag'))
$result->free (); $result->free ();
} }
if (_DEV_MODE) $url = _DEV_MODE ? 'http://localhost:8080' : '.';
{
$url = 'http://localhost:8080'; if (_DEV_MODE)
$this->includeJs ("$url/webpack-dev-server.js"); $this->includeJs ("$url/webpack-dev-server.js");
$this->includeJs ("$url/build/hedera-web.js");
} $this->includeJs ("$url/build/hedera-web.js");
else
$this->includeJs ('build/hedera-web.js');

View File

@ -4,9 +4,8 @@ require_once __DIR__.'/lib/method.php';
class Clean extends Edi\Method class Clean extends Edi\Method
{ {
function ediRun () function ediRun ($db)
{ {
$db = $this->getSysConn ();
$imap = $this->imap; $imap = $this->imap;
$cleanPeriod = $db->getValue ('SELECT clean_period FROM imap_config'); $cleanPeriod = $db->getValue ('SELECT clean_period FROM imap_config');

View File

@ -2,19 +2,16 @@
namespace Edi; namespace Edi;
require_once ('vn/lib/method.php');
abstract class Method extends \Vn\Lib\Method abstract class Method extends \Vn\Lib\Method
{ {
protected $imap; protected $imap;
protected $imapConf; protected $imapConf;
protected $mailbox; protected $mailbox;
abstract function ediRun (); abstract function ediRun ($db);
function run () function run ($db)
{ {
$db = $this->getSysConn ();
$db->selectDb ('edi'); $db->selectDb ('edi');
$imapConf = $db->getRow ( $imapConf = $db->getRow (
@ -33,7 +30,7 @@ abstract class Method extends \Vn\Lib\Method
if ($imap) if ($imap)
{ {
$this->ediRun (); $this->ediRun ($db);
imap_expunge ($imap); imap_expunge ($imap);
imap_close ($imap); imap_close ($imap);
} }

View File

@ -2,7 +2,7 @@
namespace Edi; namespace Edi;
require_once ('vn/lib/type.php'); use Vn\Lib\Type;
class Segment class Segment
{ {
@ -28,7 +28,7 @@ class Segment
return $tmp; return $tmp;
case TYPE_DOUBLE: case TYPE_DOUBLE:
case TYPE_INTEGER: case TYPE_INTEGER:
set_type ($v, $type); Type::set ($v, $type);
default: default:
return $v; return $v;
} }

View File

@ -5,9 +5,8 @@ require_once (__DIR__.'/lib/message.php');
class Load extends Edi\Method class Load extends Edi\Method
{ {
function ediRun () function ediRun ($db)
{ {
$db = $this->getSysConn ();
$this->ediSchema = Edi\Message::loadSchema ('CLOCKT'); $this->ediSchema = Edi\Message::loadSchema ('CLOCKT');
if (!$this->ediSchema) if (!$this->ediSchema)
@ -21,7 +20,7 @@ class Load extends Edi\Method
if ($inbox) if ($inbox)
{ {
foreach ($inbox as $msg) foreach ($inbox as $msg)
$this->loadMail ($msg); $this->loadMail ($db, $msg);
$inboxCount = count ($inbox); $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; $imap = $this->imap;
// Gets EKT messages from email // Gets EKT messages from email

View File

@ -1,12 +1,9 @@
<?php <?php
require_once ('vn/lib/method.php');
class Update extends Vn\Lib\Method class Update extends Vn\Lib\Method
{ {
function run () function run ($db)
{ {
$db = $this->getSysConn ();
$db->selectDb ('edi'); $db->selectDb ('edi');
//$db->options (MYSQLI_OPT_LOCAL_INFILE, TRUE); //$db->options (MYSQLI_OPT_LOCAL_INFILE, TRUE);

View File

@ -47,7 +47,7 @@ class HtmlService extends Service
if ($updateBrowser) if ($updateBrowser)
{ {
header ('Location: ?page=update-browser'); header ('Location: ?method=update-browser');
exit (0); exit (0);
} }
else else
@ -60,7 +60,7 @@ class HtmlService extends Service
&& $db->getValue ('SELECT test_domain FROM config')) && $db->getValue ('SELECT test_domain FROM config'))
{ {
$_SESSION['skipVersionMenu'] = TRUE; $_SESSION['skipVersionMenu'] = TRUE;
header ('Location: ?page=version-menu'); header ('Location: ?method=version-menu');
} }
// Setting the version // Setting the version
@ -82,7 +82,7 @@ class HtmlService extends Service
$this->printHeader (); $this->printHeader ();
$dir = $basePath; $dir = $basePath;
include ("./$basePath/html.php"); include ("./$basePath/ui.php");
} }
else else
header ('Location: ./'); header ('Location: ./');

View File

@ -89,7 +89,7 @@ abstract class Service
$agent = $_SERVER['HTTP_USER_AGENT']; $agent = $_SERVER['HTTP_USER_AGENT'];
$browser = get_browser ($agent, TRUE); $browser = get_browser ($agent, TRUE);
if (isset ($browser['crawler']) && $browser['crawler']) if (!empty ($browser['crawler']))
{ {
$_SESSION['skipVisit'] = TRUE; $_SESSION['skipVisit'] = TRUE;
return; return;
@ -192,14 +192,10 @@ abstract class Service
// Registering the user access // Registering the user access
if (isset ($_SESSION['access']) && $userChanged) if (isset ($_SESSION['access']) && $userChanged)
{
$db->query ( $db->query (
'CALL visitUserNew (#, #)', 'CALL visitUserNew (#, #)',
[$_SESSION['access'], session_id ()] [$_SESSION['access'], session_id ()]
); );
error_log ($db->render ('CALL visitUserNew (#, #)',
[$_SESSION['access'], session_id ()]));
}
} }
/** /**
@ -246,7 +242,7 @@ abstract class Service
'exp' => time () + $tokenLife 'exp' => time () + $tokenLife
]; ];
if (!empty ($recover)) if ($recover)
$payload['recover'] = 'TRUE'; $payload['recover'] = 'TRUE';
$key = $this->db->getValue ('SELECT jwtKey FROM config'); $key = $this->db->getValue ('SELECT jwtKey FROM config');