refs #3971 Function keyword removed

This commit is contained in:
Juan Ferrer 2022-11-16 02:46:44 +01:00
parent 0510149fd8
commit 0c7476a37c
128 changed files with 1075 additions and 1075 deletions

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
activate: function() { activate() {
this.$.userModel.setInfo('c', 'myClient', 'hedera'); this.$.userModel.setInfo('c', 'myClient', 'hedera');
this.$.userModel.setInfo('u', 'myUser', 'account'); this.$.userModel.setInfo('u', 'myUser', 'account');
@ -12,7 +12,7 @@ export default new Class({
this.onPassChangeClick(); this.onPassChangeClick();
} }
,onPassChangeClick: function() { ,onPassChangeClick() {
this.$.oldPassword.value = ''; this.$.oldPassword.value = '';
this.$.newPassword.value = ''; this.$.newPassword.value = '';
this.$.repeatPassword.value = ''; this.$.repeatPassword.value = '';
@ -27,7 +27,7 @@ export default new Class({
this.$.oldPassword.focus(); this.$.oldPassword.focus();
} }
,onPassModifyClick: function() { ,onPassModifyClick() {
try { try {
var oldPassword = this.$.oldPassword.value; var oldPassword = this.$.oldPassword.value;
var newPassword = this.$.newPassword.value; var newPassword = this.$.newPassword.value;
@ -58,7 +58,7 @@ export default new Class({
} }
} }
,_onPassChange: function(json, error) { ,_onPassChange(json, error) {
if (!error) { if (!error) {
this.$.changePassword.hide(); this.$.changePassword.hide();
this.hash.unset('verificationToken'); this.hash.unset('verificationToken');
@ -74,7 +74,7 @@ export default new Class({
} }
} }
,onPassInfoClick: function() { ,onPassInfoClick() {
this.$.passwordInfo.show(); this.$.passwordInfo.show();
} }
}); });

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
activate: function() { activate() {
this.$.items.setInfo('i', 'item', 'vn', ['id']); this.$.items.setInfo('i', 'item', 'vn', ['id']);
} }
}); });

View File

@ -17,11 +17,11 @@ export default new Class({
,uploadQueue: [] ,uploadQueue: []
,isUploading: false ,isUploading: false
,activate: function() { ,activate() {
this.$.schema.value = 'catalog'; this.$.schema.value = 'catalog';
} }
,addFiles: function(files) { ,addFiles(files) {
if (!files) if (!files)
return; return;
@ -29,7 +29,7 @@ export default new Class({
this.addFile(files[i]); this.addFile(files[i]);
} }
,addFile: function(file) { ,addFile(file) {
var doc = document; var doc = document;
var li = doc.createElement('div'); var li = doc.createElement('div');
@ -77,7 +77,7 @@ export default new Class({
this.setImageStatus(fileData, Status.NONE, 'add', _('Pending upload')); this.setImageStatus(fileData, Status.NONE, 'add', _('Pending upload'));
} }
,onUploadClick: function() { ,onUploadClick() {
var filesData = this.filesData; var filesData = this.filesData;
var count = 0; var count = 0;
@ -99,7 +99,7 @@ export default new Class({
this.uploadNextFile(); this.uploadNextFile();
} }
,uploadNextFile: function() { ,uploadNextFile() {
if (this.isUploading) if (this.isUploading)
return; return;
@ -119,7 +119,7 @@ export default new Class({
this.onFileUpload.bind(this, fileData)); this.onFileUpload.bind(this, fileData));
} }
,onFileUpload: function(fileData, data, error) { ,onFileUpload(fileData, data, error) {
this.isUploading = false; this.isUploading = false;
if (data) { if (data) {
@ -143,7 +143,7 @@ export default new Class({
this.uploadNextFile(); this.uploadNextFile();
} }
,setImageStatus: function(fileData, status, icon, title) { ,setImageStatus(fileData, status, icon, title) {
fileData.status = status; fileData.status = status;
var statusNode = fileData.statusNode; var statusNode = fileData.statusNode;
@ -154,7 +154,7 @@ export default new Class({
statusNode.title = title ? title : ''; statusNode.title = title ? title : '';
} }
,onFileRemove: function(fileData) { ,onFileRemove(fileData) {
this.$.fileList.removeChild(fileData.li); this.$.fileList.removeChild(fileData.li);
for (var i = 0; i < this.filesData.length; i++) for (var i = 0; i < this.filesData.length; i++)
@ -164,37 +164,37 @@ export default new Class({
} }
} }
,onClearClick: function() { ,onClearClick() {
this.filesData = []; this.filesData = [];
Vn.Node.removeChilds(this.$.fileList); Vn.Node.removeChilds(this.$.fileList);
} }
,onDropzoneClick: function() { ,onDropzoneClick() {
this.$.file.click(); this.$.file.click();
} }
,onFileChange: function() { ,onFileChange() {
this.addFiles(this.$.file.files); this.addFiles(this.$.file.files);
} }
,onDragEnter: function() { ,onDragEnter() {
this.$.dropzone.classList.add('dragover'); this.$.dropzone.classList.add('dragover');
} }
,onDragLeave: function() { ,onDragLeave() {
this.$.dropzone.classList.remove('dragover'); this.$.dropzone.classList.remove('dragover');
} }
,onDragOver: function(event) { ,onDragOver(event) {
event.preventDefault(); event.preventDefault();
} }
,onDragEnd: function(event) { ,onDragEnd(event) {
this.$.dropzone.classList.remove('dragover'); this.$.dropzone.classList.remove('dragover');
event.dataTransfer.clearData(); event.dataTransfer.clearData();
} }
,onDrop: function(event) { ,onDrop(event) {
event.preventDefault(); event.preventDefault();
this.addFiles(event.dataTransfer.files); this.addFiles(event.dataTransfer.files);
} }

View File

@ -4,11 +4,11 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml') Template: require('./ui.xml')
,activate: function() { ,activate() {
this.$.resultIndex.value = 0; this.$.resultIndex.value = 0;
} }
,clean: function() { ,clean() {
if (this._grid) { if (this._grid) {
this.$.gridHolder.removeChild(this._grid.node); this.$.gridHolder.removeChild(this._grid.node);
this._grid.unref(); this._grid.unref();
@ -16,7 +16,7 @@ export default new Class({
} }
} }
,onExecuteClick: function() { ,onExecuteClick() {
this.clean(); this.clean();
var model = new Db.Model({ var model = new Db.Model({
@ -28,11 +28,11 @@ export default new Class({
model.on('status-changed', this.onModelChange, this); model.on('status-changed', this.onModelChange, this);
} }
,onCleanClick: function() { ,onCleanClick() {
this.clean(); this.clean();
} }
,onModelChange: function(model, status) { ,onModelChange(model, status) {
if (status !== Db.Model.Status.LOADING) { if (status !== Db.Model.Status.LOADING) {
model.disconnect('status-changed', this.onModelChange, this); model.disconnect('status-changed', this.onModelChange, this);
model.unref(); model.unref();

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml') Template: require('./ui.xml')
,rendererFunc: function(scope, form) { ,rendererFunc(scope, form) {
var isEnabled = form.$.active var isEnabled = form.$.active
scope.$.disabled.style.display = isEnabled ? scope.$.disabled.style.display = isEnabled ?
'none' : 'block'; 'none' : 'block';
@ -12,12 +12,12 @@ export default new Class({
'block' : 'none'; 'block' : 'none';
} }
,onChangeUserClick: function(userName) { ,onChangeUserClick(userName) {
this.gui.supplantUser(userName, this.gui.supplantUser(userName,
this.onUserSupplant.bind(this)); this.onUserSupplant.bind(this));
} }
,onUserSupplant: function() { ,onUserSupplant() {
this.hash.setAll({form: 'ecomerce/orders'}); this.hash.setAll({form: 'ecomerce/orders'});
} }
}); });

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml') Template: require('./ui.xml')
,activate: function() { ,activate() {
if (!this.hash.$.to) if (!this.hash.$.to)
this.hash.assign({ this.hash.assign({
from: new Date(), from: new Date(),

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
onShowClick: function(column, agencyId) { onShowClick(column, agencyId) {
this.hash.setAll({ this.hash.setAll({
form: 'agencies/provinces', form: 'agencies/provinces',
agency: agencyId agency: agencyId

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml') Template: require('./ui.xml')
,activate: function() { ,activate() {
var self = this; var self = this;
this.$.contactForm.onsubmit = function() { this.$.contactForm.onsubmit = function() {
self._onSubmit(); return false; self._onSubmit(); return false;
@ -13,7 +13,7 @@ export default new Class({
this.refreshCaptcha(); this.refreshCaptcha();
} }
,refreshCaptcha: function() { ,refreshCaptcha() {
params = { params = {
srv: 'rest:misc/captcha', srv: 'rest:misc/captcha',
stamp: new Date().getTime() stamp: new Date().getTime()
@ -21,12 +21,12 @@ export default new Class({
this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params); this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params);
} }
,_onSubmit: function() { ,_onSubmit() {
this.conn.sendForm(this.$.contactForm, this.conn.sendForm(this.$.contactForm,
this._onResponse.bind(this)); this._onResponse.bind(this));
} }
,_onResponse: function(json) { ,_onResponse(json) {
var form = this.$.contactForm; var form = this.$.contactForm;
if (json) { if (json) {

View File

@ -8,7 +8,7 @@ export default new Class({
,locations: null ,locations: null
,activate: function() { ,activate() {
this.gui.loaderPush(); this.gui.loaderPush();
var sql = 'SELECT lat, lng, title, address, postcode, city, province, phone, language FROM location'; var sql = 'SELECT lat, lng, title, address, postcode, city, province, phone, language FROM location';
@ -25,18 +25,18 @@ export default new Class({
this.gmapsLoaded(); this.gmapsLoaded();
} }
,onLocationsDone: function(resultSet) { ,onLocationsDone(resultSet) {
this.locations = resultSet.fetchData(); this.locations = resultSet.fetchData();
this.allLoaded(); this.allLoaded();
} }
,gmapsLoaded: function() { ,gmapsLoaded() {
this.gui.loaderPop(); this.gui.loaderPop();
gmapsIsLoaded = true; gmapsIsLoaded = true;
this.allLoaded(); this.allLoaded();
} }
,allLoaded: function() { ,allLoaded() {
if (!this.locations || !gmapsIsLoaded) if (!this.locations || !gmapsIsLoaded)
return; return;
@ -53,7 +53,7 @@ export default new Class({
this.createMarker(location, gmap); this.createMarker(location, gmap);
} }
,createMarker: function(location, gmap) { ,createMarker(location, gmap) {
var div = document.createElement('div'); var div = document.createElement('div');
div.className = 'marker'; div.className = 'marker';
@ -100,7 +100,7 @@ export default new Class({
this.openInfoWindow(infoWindow, gmap, marker); this.openInfoWindow(infoWindow, gmap, marker);
} }
,openInfoWindow: function(infoWindow, gmap, marker) { ,openInfoWindow(infoWindow, gmap, marker) {
if (this.openedWindow) if (this.openedWindow)
this.openedWindow.close(); this.openedWindow.close();

View File

@ -5,7 +5,7 @@ export default new Class({
,_menuShown: false ,_menuShown: false
,open: function() { ,open() {
this.close(); this.close();
this.isOpen = true; this.isOpen = true;
@ -18,12 +18,12 @@ export default new Class({
} }
} }
,onBasketCheck: function(isOk) { ,onBasketCheck(isOk) {
if (isOk) if (isOk)
this.loadUi(); this.loadUi();
} }
,activate: function() { ,activate() {
document.body.appendChild(this.$.rightPanel); document.body.appendChild(this.$.rightPanel);
this.$.items.setInfo('i', 'item', 'vn', ['id']); this.$.items.setInfo('i', 'item', 'vn', ['id']);
@ -35,7 +35,7 @@ export default new Class({
this.onFilterChange(); this.onFilterChange();
} }
,deactivate: function() { ,deactivate() {
this.hideMenu(); this.hideMenu();
this.gui.$.topBar.style.backgroundColor = ''; this.gui.$.topBar.style.backgroundColor = '';
Vn.Node.remove(this.$.rightPanel); Vn.Node.remove(this.$.rightPanel);
@ -81,7 +81,7 @@ export default new Class({
return lot; return lot;
} }
,onFilterChange: function() { ,onFilterChange() {
const $ = this.$; const $ = this.$;
const params = $.params.$; const params = $.params.$;
@ -110,7 +110,7 @@ export default new Class({
if (lot) this.hideMenu(); if (lot) this.hideMenu();
} }
,refreshTitle: function() { ,refreshTitle() {
const hash = this.hash.$; const hash = this.hash.$;
const types = this.$.types; const types = this.$.types;
const realms = this.$.realms; const realms = this.$.realms;
@ -143,7 +143,7 @@ export default new Class({
Vn.Node.setText(this.$.subtitle, subtitle); Vn.Node.setText(this.$.subtitle, subtitle);
} }
,setView: function(view) { ,setView(view) {
if (view === Hedera.Catalog.View.GRID) { if (view === Hedera.Catalog.View.GRID) {
this.$.viewButton.setProperties({ this.$.viewButton.setProperties({
icon: 'view_list', icon: 'view_list',
@ -165,19 +165,19 @@ export default new Class({
localStorage.setItem('hederaView', this.view); localStorage.setItem('hederaView', this.view);
} }
,onSwitchViewClick: function() { ,onSwitchViewClick() {
this.setView(this.view === Hedera.Catalog.View.LIST ? this.setView(this.view === Hedera.Catalog.View.LIST ?
Hedera.Catalog.View.GRID : Hedera.Catalog.View.LIST); Hedera.Catalog.View.GRID : Hedera.Catalog.View.LIST);
} }
,onItemsChange: function(model, status) { ,onItemsChange(model, status) {
if (status !== Db.Model.Status.CLEAN) if (status !== Db.Model.Status.CLEAN)
this.$.order.style.display = 'block'; this.$.order.style.display = 'block';
else else
this.$.order.style.display = 'none'; this.$.order.style.display = 'none';
} }
,onOrderChange: function(e) { ,onOrderChange(e) {
var value = e.target.value; var value = e.target.value;
var sortField = value.substr(2); var sortField = value.substr(2);
var sortWay = value.charAt(0) === 'A' ? var sortWay = value.charAt(0) === 'A' ?
@ -189,7 +189,7 @@ export default new Class({
this.hideMenu(); this.hideMenu();
} }
,realmRenderer: function(builder, form) { ,realmRenderer(builder, form) {
var link = builder.$.link; var link = builder.$.link;
link.href = this.hash.make({ link.href = this.hash.make({
form: this.hash.$.form, form: this.hash.$.form,
@ -197,11 +197,11 @@ export default new Class({
}); });
} }
,onRightPanelClick: function(event) { ,onRightPanelClick(event) {
event.stopPropagation(); event.stopPropagation();
} }
,onShowMenuClick: function(event) { ,onShowMenuClick(event) {
this._menuShown = true; this._menuShown = true;
event.stopPropagation(); event.stopPropagation();
this.gui.showBackground(); this.gui.showBackground();
@ -210,7 +210,7 @@ export default new Class({
document.addEventListener('click', this.hideMenuCallback); document.addEventListener('click', this.hideMenuCallback);
} }
,hideMenu: function() { ,hideMenu() {
if (!this._menuShown) if (!this._menuShown)
return; return;
@ -220,7 +220,7 @@ export default new Class({
this.hideMenuCallback = null; this.hideMenuCallback = null;
} }
,isGuest: function() { ,isGuest() {
if (localStorage.getItem('hederaGuest')) { if (localStorage.getItem('hederaGuest')) {
Htk.Toast.showError(_('YouMustBeLoggedIn')); Htk.Toast.showError(_('YouMustBeLoggedIn'));
return true; return true;
@ -229,21 +229,21 @@ export default new Class({
return false; return false;
} }
,onBasketClick: function() { ,onBasketClick() {
if (this.isGuest()) if (this.isGuest())
return; return;
this.hash.setAll({form: 'ecomerce/basket'}); this.hash.setAll({form: 'ecomerce/basket'});
} }
,onConfigureClick: function() { ,onConfigureClick() {
if (this.isGuest()) if (this.isGuest())
return; return;
this.hash.setAll({form: 'ecomerce/checkout'}); this.hash.setAll({form: 'ecomerce/checkout'});
} }
,onAddItemClick: function(event, form) { ,onAddItemClick(event, form) {
if (event.defaultPrevented) return; if (event.defaultPrevented) return;
event.preventDefault(); event.preventDefault();
if (this.isGuest()) return; if (this.isGuest()) return;
@ -254,7 +254,7 @@ export default new Class({
this.$.cardPopup.show(event.currentTarget); this.$.cardPopup.show(event.currentTarget);
} }
,onAddLotClick: function(column, value, row) { ,onAddLotClick(column, value, row) {
var model = this.$.itemLots; var model = this.$.itemLots;
var grouping = model.get(row, 'grouping'); var grouping = model.get(row, 'grouping');
var warehouse = model.get(row, 'warehouseFk'); var warehouse = model.get(row, 'warehouseFk');
@ -277,7 +277,7 @@ export default new Class({
Htk.Toast.showError(_('NoMoreAmountAvailable')); Htk.Toast.showError(_('NoMoreAmountAvailable'));
} }
,onConfirmClick: function() { ,onConfirmClick() {
var sql = ''; var sql = '';
var query = new Sql.String({query: 'CALL myBasket_addItem(#warehouse, #item, #amount);'}); var query = new Sql.String({query: 'CALL myBasket_addItem(#warehouse, #item, #amount);'});
var amountSum = 0; var amountSum = 0;
@ -305,18 +305,18 @@ export default new Class({
this.$.cardPopup.hide(); this.$.cardPopup.hide();
} }
,onEraseClick: function() { ,onEraseClick() {
this.$.amount.value = 0; this.$.amount.value = 0;
this.items = {}; this.items = {};
} }
,onPopupClose: function() { ,onPopupClose() {
this.onEraseClick(); this.onEraseClick();
this.$.$card.row = -1; this.$.$card.row = -1;
this.$.cardLot.value = undefined; this.$.cardLot.value = undefined;
} }
,onCardLoad: function() { ,onCardLoad() {
this.$.cardPopup.reset(); this.$.cardPopup.reset();
} }
}); });

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
activate: function() { activate() {
this.autoStepLocked = true; this.autoStepLocked = true;
this.$.assistant.stepsIndex = this.agencySteps; this.$.assistant.stepsIndex = this.agencySteps;
@ -12,7 +12,7 @@ export default new Class({
this.today.setHours(0, 0, 0, 0); this.today.setHours(0, 0, 0, 0);
}, },
onValuesReady: function() { onValuesReady() {
const orderForm = this.$.orderForm; const orderForm = this.$.orderForm;
const defaultsForm = this.$.defaults; const defaultsForm = this.$.defaults;
@ -52,11 +52,11 @@ export default new Class({
this.autoStepLocked = false; this.autoStepLocked = false;
}, },
disableButtons: function(disable) { disableButtons(disable) {
this.$.assistantBar.disabled = disable; this.$.assistantBar.disabled = disable;
}, },
onConfirmClick: function() { onConfirmClick() {
this.disableButtons(true); this.disableButtons(true);
const query = 'CALL myBasket_configure(#date, #method, #agency, #address)'; const query = 'CALL myBasket_configure(#date, #method, #agency, #address)';
@ -64,7 +64,7 @@ export default new Class({
this.onBasketConfigured.bind(this), this.$.lot.$); this.onBasketConfigured.bind(this), this.$.lot.$);
}, },
onBasketConfigured: function(resultSet) { onBasketConfigured(resultSet) {
this.disableButtons(false); this.disableButtons(false);
if (!resultSet.fetchResult()) if (!resultSet.fetchResult())
@ -78,7 +78,7 @@ export default new Class({
this.hash.setAll({form: 'ecomerce/catalog'}); this.hash.setAll({form: 'ecomerce/catalog'});
}, },
onCancelClick: function() { onCancelClick() {
if (this.$.orderForm.numRows > 0) if (this.$.orderForm.numRows > 0)
window.history.back(); window.history.back();
else else
@ -88,77 +88,77 @@ export default new Class({
agencySteps: ['method', 'date', 'address', 'agency', 'confirm-delivery'], agencySteps: ['method', 'date', 'address', 'agency', 'confirm-delivery'],
pickupSteps: ['method', 'date', 'address', 'pickup', 'confirm-pickup'], pickupSteps: ['method', 'date', 'address', 'pickup', 'confirm-pickup'],
isDelivery: function() { isDelivery() {
return this.$.rgMethod.value != 'PICKUP'; return this.$.rgMethod.value != 'PICKUP';
}, },
onMethodChange: function() { onMethodChange() {
this.$.assistant.stepsIndex = this.isDelivery() ? this.$.assistant.stepsIndex = this.isDelivery() ?
this.agencySteps : this.pickupSteps; this.agencySteps : this.pickupSteps;
this.onFieldChange(); this.onFieldChange();
}, },
methodValidate: function() { methodValidate() {
if (!this.$.rgMethod.isSelected()) if (!this.$.rgMethod.isSelected())
throw new Error(_('Please select an option')); throw new Error(_('Please select an option'));
}, },
dateShow: function() { dateShow() {
Vn.Node.setText(this.$.dateQuestion, this.isDelivery() ? Vn.Node.setText(this.$.dateQuestion, this.isDelivery() ?
_('OrderDateDeliveryQuestion'): _('OrderDateDeliveryQuestion'):
_('OrderDatePickupQuestion')); _('OrderDatePickupQuestion'));
this.$.calendar.goToSelectedMonth(); this.$.calendar.goToSelectedMonth();
}, },
dateValidate: function() { dateValidate() {
if (!this.$.calendar.value) if (!this.$.calendar.value)
throw new Error(_('Please select a date')); throw new Error(_('Please select a date'));
}, },
addressShow: function() { addressShow() {
Vn.Node.setText(this.$.addressQuestion, this.isDelivery() ? Vn.Node.setText(this.$.addressQuestion, this.isDelivery() ?
_('AddressQuestion'): _('AddressQuestion'):
_('AddressQuestionPickup')); _('AddressQuestionPickup'));
}, },
addressValidate: function() { addressValidate() {
if (this.$.addressForm.row == -1) if (this.$.addressForm.row == -1)
throw new Error(_('Please select an address')); throw new Error(_('Please select an address'));
}, },
agencyShow: function() { agencyShow() {
this.$.agencies.refresh(); this.$.agencies.refresh();
}, },
agencyValidate: function() { agencyValidate() {
if (this.$.agencyCombo.row == -1 && this.isDelivery()) if (this.$.agencyCombo.row == -1 && this.isDelivery())
throw new Error(_('Please select an agency')); throw new Error(_('Please select an agency'));
}, },
pickupShow: function() { pickupShow() {
this.$.warehouses.refresh(); this.$.warehouses.refresh();
}, },
pickupValidate: function() { pickupValidate() {
if (this.$.warehouseCombo.row == -1) if (this.$.warehouseCombo.row == -1)
throw new Error(_('Please select a store')); throw new Error(_('Please select a store'));
}, },
onFieldChange: function() { onFieldChange() {
if (!this.autoStepLocked) if (!this.autoStepLocked)
this.$.assistant.moveNext(); this.$.assistant.moveNext();
}, },
goNextStep: function() { goNextStep() {
this.$.assistant.moveNext(); this.$.assistant.moveNext();
}, },
onAddressClick: function(addressId) { onAddressClick(addressId) {
this.$.lot.set('address', addressId); this.$.lot.set('address', addressId);
this.goNextStep(); this.goNextStep();
}, },
onAddressChange: function() { onAddressChange() {
if (this.selectedNode) if (this.selectedNode)
Vn.Node.removeClass(this.selectedNode, 'selected'); Vn.Node.removeClass(this.selectedNode, 'selected');
@ -174,7 +174,7 @@ export default new Class({
this.$.addressForm.row = row; this.$.addressForm.row = row;
}, },
onAgenciesReady: function(model) { onAgenciesReady(model) {
if (!model.ready) return; if (!model.ready) return;
if (model.numRows > 0) { if (model.numRows > 0) {
@ -204,12 +204,12 @@ export default new Class({
Htk.Toast.showError(_('NoAgeciesAvailableForDate')); Htk.Toast.showError(_('NoAgeciesAvailableForDate'));
}, },
onWarehousesReady: function(model) { onWarehousesReady(model) {
if (model.ready && model.numRows == 0) if (model.ready && model.numRows == 0)
Htk.Toast.showError(_('NoWarehousesAvailableForDate')); Htk.Toast.showError(_('NoWarehousesAvailableForDate'));
}, },
calendarRestrict: function(date) { calendarRestrict(date) {
return date.getTime() >= this.today.getTime(); return date.getTime() >= this.today.getTime();
} }
}); });

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
open: function() { open() {
this.close(); this.close();
this.isOpen = true; this.isOpen = true;
@ -12,12 +12,12 @@ export default new Class({
this.onBasketCheck.bind(this)); this.onBasketCheck.bind(this));
}, },
onBasketCheck: function(isOk) { onBasketCheck(isOk) {
if (isOk) if (isOk)
this.loadUi(); this.loadUi();
}, },
onOrderReady: function(form) { onOrderReady(form) {
if (form.row < 0) if (form.row < 0)
return; return;
@ -84,7 +84,7 @@ export default new Class({
this.$.payMethod.value = selectedMethod; this.$.payMethod.value = selectedMethod;
}, },
onPayMethodChange: function(payMethod) { onPayMethodChange(payMethod) {
var id = this.displayedInfo; var id = this.displayedInfo;
if (id) if (id)
@ -113,28 +113,28 @@ export default new Class({
Vn.Node.addClass(this.$[id], 'selected'); Vn.Node.addClass(this.$[id], 'selected');
}, },
disableButtons: function(disable) { disableButtons(disable) {
this.$.modify.disabled = disable; this.$.modify.disabled = disable;
this.$.confirm.disabled = disable; this.$.confirm.disabled = disable;
}, },
onModifyClick: function() { onModifyClick() {
window.history.back(); window.history.back();
}, },
onConfirmClick: function() { onConfirmClick() {
this.disableButtons(true); this.disableButtons(true);
this.$.confirmQuery.execute(); this.$.confirmQuery.execute();
}, },
onConfirm: function(query, resultSet) { onConfirm(query, resultSet) {
this.disableButtons(false); this.disableButtons(false);
if (resultSet.fetchResult()) if (resultSet.fetchResult())
this.$.successDialog.show(); this.$.successDialog.show();
}, },
onDialogResponse: function() { onDialogResponse() {
if (this.$.payMethod.value === 'CARD') { if (this.$.payMethod.value === 'CARD') {
if (this.$.payAmount.value === 'EXCEEDED') if (this.$.payAmount.value === 'EXCEEDED')
var payAmount = this.$.excessAmount.value; var payAmount = this.$.excessAmount.value;

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
donwloadRenderer: function(column, invoice) { donwloadRenderer(column, invoice) {
var invoiceId = invoice.$.id; var invoiceId = invoice.$.id;
if (invoice.$.hasPdf && invoiceId) { if (invoice.$.hasPdf && invoiceId) {

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
activate: function() { activate() {
this.tpv = new Hedera.Tpv({ this.tpv = new Hedera.Tpv({
conn: this.conn, conn: this.conn,
hash: this.hash hash: this.hash
@ -12,16 +12,16 @@ export default new Class({
this.tpv.check(this._onTpvCheck.bind(this)); this.tpv.check(this._onTpvCheck.bind(this));
}, },
_onTpvCheck: function(tpv, tpvOrder, tpvStatus) { _onTpvCheck(tpv, tpvOrder, tpvStatus) {
if (tpvStatus === 'ko') if (tpvStatus === 'ko')
this.$.errorDialog.show(); this.$.errorDialog.show();
}, },
onBasketClick: function() { onBasketClick() {
this.hash.setAll({form: 'ecomerce/basket'}); this.hash.setAll({form: 'ecomerce/basket'});
}, },
repeaterFunc: function(res, form) { repeaterFunc(res, form) {
res.$.link.href = this.hash.make({ res.$.link.href = this.hash.make({
form: 'ecomerce/ticket', form: 'ecomerce/ticket',
ticket: form.$.id ticket: form.$.id
@ -30,14 +30,14 @@ export default new Class({
// TPV // TPV
balanceConditionalFunc: function(field, value) { balanceConditionalFunc(field, value) {
if (value >= 0) if (value >= 0)
Vn.Node.removeClass(this.$.balance, 'negative'); Vn.Node.removeClass(this.$.balance, 'negative');
else else
Vn.Node.addClass(this.$.balance, 'negative'); Vn.Node.addClass(this.$.balance, 'negative');
}, },
onPayButtonClick: function() { onPayButtonClick() {
var amount = -this.$.debt.value; var amount = -this.$.debt.value;
amount = amount <= 0 ? null : amount; amount = amount <= 0 ? null : amount;
@ -54,7 +54,7 @@ export default new Class({
} }
}, },
onDialogResponse: function(dialog, response) { onDialogResponse(dialog, response) {
if (response == Htk.Dialog.Button.RETRY) if (response == Htk.Dialog.Button.RETRY)
this.tpv.retryPay(); this.tpv.retryPay();
} }

View File

@ -4,7 +4,7 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml'), Template: require('./ui.xml'),
onTicketChange: function(ticket) { onTicketChange(ticket) {
if (!ticket.value) if (!ticket.value)
return; return;
@ -12,7 +12,7 @@ export default new Class({
this.conn.execQuery('CALL myTicket_logAccess(#ticket)', null, params); this.conn.execQuery('CALL myTicket_logAccess(#ticket)', null, params);
}, },
onPrintClick: function() { onPrintClick() {
let params = Vn.Url.makeUri({ let params = Vn.Url.makeUri({
access_token: this.conn.token, access_token: this.conn.token,
recipientId: this.gui.user.id, recipientId: this.gui.user.id,
@ -21,25 +21,25 @@ export default new Class({
window.open(`/api/Tickets/${this.hash.$.ticket}/delivery-note-pdf?${params}`); window.open(`/api/Tickets/${this.hash.$.ticket}/delivery-note-pdf?${params}`);
}, },
repeaterFunc: function(scope, form) { repeaterFunc(scope, form) {
scope.$.discount.style.display = form.$.discount ? 'inline' : 'none'; scope.$.discount.style.display = form.$.discount ? 'inline' : 'none';
}, },
discountSubtotal: function(line) { discountSubtotal(line) {
return line.quantity * line.price; return line.quantity * line.price;
}, },
subtotal: function(line) { subtotal(line) {
var discount = line.discount; var discount = line.discount;
return this.discountSubtotal(line) * ((100 - discount) / 100); return this.discountSubtotal(line) * ((100 - discount) / 100);
}, },
onServicesChanged: function(model) { onServicesChanged(model) {
this.$.services.node.style.display = this.$.services.node.style.display =
model.numRows > 0 ? 'block' : 'none'; model.numRows > 0 ? 'block' : 'none';
}, },
onPackagesChanged: function(model) { onPackagesChanged(model) {
this.$.packages.node.style.display = this.$.packages.node.style.display =
model.numRows > 0 ? 'block' : 'none'; model.numRows > 0 ? 'block' : 'none';
}, },

View File

@ -7,7 +7,7 @@ export default new Class({
,editor: null ,editor: null
,activate: function() { ,activate() {
this.$.model.mode = Db.Model.Mode.ON_DEMAND; this.$.model.mode = Db.Model.Mode.ON_DEMAND;
this.$.model.setDefault('userFk', 'news', this.$.model.setDefault('userFk', 'news',
new Sql.Function({schema: 'account', name: 'myUser_getId'})); new Sql.Function({schema: 'account', name: 'myUser_getId'}));
@ -32,17 +32,17 @@ export default new Class({
}); });
}, },
deactivate: function() { deactivate() {
this.editor.destroy(); this.editor.destroy();
}, },
_onEditorInit: function(editor) { _onEditorInit(editor) {
this.editor = editor; this.editor = editor;
editor.getDoc().body.style.fontSize = '1em'; editor.getDoc().body.style.fontSize = '1em';
this.setEditorText(); this.setEditorText();
}, },
setEditorText: function() { setEditorText() {
if (!this.editor) if (!this.editor)
return; return;
@ -50,26 +50,26 @@ export default new Class({
this.editor.setContent(row ? row.text : ''); this.editor.setContent(row ? row.text : '');
}, },
onStatusChange: function() { onStatusChange() {
if (!this.hash.$.new) if (!this.hash.$.new)
this.$.iter.insertRow(); this.$.iter.insertRow();
}, },
onOperationsDone: function() { onOperationsDone() {
Htk.Toast.showMessage(_('NewChangedSuccessfully')); Htk.Toast.showMessage(_('NewChangedSuccessfully'));
this.onReturnClick(); this.onReturnClick();
}, },
onBodyChange: function() { onBodyChange() {
this.setEditorText(); this.setEditorText();
}, },
onAcceptClick: function() { onAcceptClick() {
this.$.iter.set('text', this.editor.getContent()); this.$.iter.set('text', this.editor.getContent());
this.$.iter.performOperations(); this.$.iter.performOperations();
}, },
onReturnClick: function() { onReturnClick() {
this.hash.setAll({form: 'news/news'}); this.hash.setAll({form: 'news/news'});
} }
}); });

View File

@ -4,27 +4,27 @@ export default new Class({
Extends: Hedera.Form, Extends: Hedera.Form,
Template: require('./ui.xml') Template: require('./ui.xml')
,activate: function() { ,activate() {
this.$.newsModel.setInfo('n', 'news', 'hedera', ['id'], 'id'); this.$.newsModel.setInfo('n', 'news', 'hedera', ['id'], 'id');
} }
,editNew: function(newId) { ,editNew(newId) {
this.hash.setAll({ this.hash.setAll({
form: 'news/new', form: 'news/new',
new: newId new: newId
}); });
} }
,onEditClick: function(newId) { ,onEditClick(newId) {
this.editNew(newId); this.editNew(newId);
} }
,onDeleteClick: function(form) { ,onDeleteClick(form) {
if (confirm(_('ReallyDelete'))) if (confirm(_('ReallyDelete')))
form.deleteRow(); form.deleteRow();
} }
,onAddClick: function() { ,onAddClick() {
this.editNew(0); this.editNew(0);
} }
}); });

View File

@ -2,14 +2,14 @@
export default new Class({ export default new Class({
Extends: Hedera.Form Extends: Hedera.Form
,activate: function() { ,activate() {
this.$.lot.assign({ this.$.lot.assign({
warehouse: 7, warehouse: 7,
realm: null realm: null
}); });
} }
,onPreviewClick: function() { ,onPreviewClick() {
this.$.lot.set('rate', this.$.rate.value); this.$.lot.set('rate', this.$.rate.value);
this.gui.openReport('items-report', this.$.lot); this.gui.openReport('items-report', this.$.lot);
} }

View File

@ -2,18 +2,18 @@
export default new Class({ export default new Class({
Extends: Hedera.Form Extends: Hedera.Form
,activate: function() { ,activate() {
this.$.lot.assign({ this.$.lot.assign({
date: new Date(), date: new Date(),
useIds: false useIds: false
}); });
} }
,onConfigChange: function() { ,onConfigChange() {
this.$.lot.assignLot(this.$.config); this.$.lot.assignLot(this.$.config);
} }
,onPreviewClick: function() { ,onPreviewClick() {
this.gui.openReport('shelves-report', this.$.lot); this.gui.openReport('shelves-report', this.$.lot);
} }
}); });

View File

@ -41,7 +41,7 @@ Connection.implement({
* @param {String} sql The SQL statement * @param {String} sql The SQL statement
* @param {Function} callback The function to call when operation is done * @param {Function} callback The function to call when operation is done
*/ */
,execSql: function(sql, callback) { ,execSql(sql, callback) {
this.send('core/query', {'sql': sql}, this.send('core/query', {'sql': sql},
this._onExec.bind(this, callback)); this._onExec.bind(this, callback));
} }
@ -53,7 +53,7 @@ Connection.implement({
* @param {Function} callback The function to call when operation is done * @param {Function} callback The function to call when operation is done
* @param {Object} params The query params * @param {Object} params The query params
*/ */
,execStmt: function(stmt, callback, params) { ,execStmt(stmt, callback, params) {
this.execSql(stmt.render(params), callback); this.execSql(stmt.render(params), callback);
} }
@ -64,21 +64,21 @@ Connection.implement({
* @param {Function} callback The function to call when operation is done * @param {Function} callback The function to call when operation is done
* @param {Object} params The query params * @param {Object} params The query params
*/ */
,execQuery: function(query, callback, params) { ,execQuery(query, callback, params) {
this.execStmt(new Sql.String({query: query}), callback, params); this.execStmt(new Sql.String({query: query}), callback, params);
} }
/* /*
* Parses a value to date. * Parses a value to date.
*/ */
,valueToDate: function(value) { ,valueToDate(value) {
return fixTz(new Date(value)); return fixTz(new Date(value));
} }
/* /*
* Called when a query is executed. * Called when a query is executed.
*/ */
,_onExec: function(callback, json, error) { ,_onExec(callback, json, error) {
const results = []; const results = [];
if (json) if (json)

View File

@ -11,10 +11,10 @@ module.exports = new Class({
*/ */
conn: { conn: {
type: Connection type: Connection
,set: function(x) { ,set(x) {
this.model.conn = x; this.model.conn = x;
} }
,get: function() { ,get() {
return this.model.conn; return this.model.conn;
} }
}, },
@ -23,10 +23,10 @@ module.exports = new Class({
*/ */
query: { query: {
type: String type: String
,set: function(x) { ,set(x) {
this.model.query = x; this.model.query = x;
} }
,get: function() { ,get() {
return this.model.query; return this.model.query;
} }
}, },
@ -35,10 +35,10 @@ module.exports = new Class({
*/ */
stmt: { stmt: {
type: Sql.Stmt type: Sql.Stmt
,set: function(x) { ,set(x) {
this.model.stmt = x; this.model.stmt = x;
} }
,get: function() { ,get() {
return this.model.stmt; return this.model.stmt;
} }
}, },
@ -47,31 +47,31 @@ module.exports = new Class({
*/ */
lot: { lot: {
type: Vn.Lot type: Vn.Lot
,set: function(x) { ,set(x) {
this.model.lot = x; this.model.lot = x;
} }
,get: function() { ,get() {
return this.model.lot; return this.model.lot;
} }
} }
} }
,initialize: function(props) { ,initialize(props) {
this.model = new Model(); this.model = new Model();
Vn.Form.prototype.initialize.call(this, props); Vn.Form.prototype.initialize.call(this, props);
} }
,appendChild: function(child) { ,appendChild(child) {
if (child.nodeType === Node.TEXT_NODE) if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent; this.query = child.textContent;
} }
,refresh: function() { ,refresh() {
if (this._model) if (this._model)
this._model.refresh(); this._model.refresh();
} }
,performOperations: function() { ,performOperations() {
if (this._model) if (this._model)
this._model.performOperations(); this._model.performOperations();
} }
@ -82,7 +82,7 @@ module.exports = new Class({
* @param {string} columnName The column name * @param {string} columnName The column name
* @return {integer} The column index or -1 if column not exists * @return {integer} The column index or -1 if column not exists
*/ */
,getColumnIndex: function(columnName) { ,getColumnIndex(columnName) {
return this._model ? return this._model ?
this._model.getColumnIndex(columnName) : -1; this._model.getColumnIndex(columnName) : -1;
} }
@ -93,7 +93,7 @@ module.exports = new Class({
* @param {string} columnName The column index * @param {string} columnName The column index
* @return {Object} The value * @return {Object} The value
*/ */
,getByIndex: function(column) { ,getByIndex(column) {
return this._model.getByIndex(this._row, column); return this._model.getByIndex(this._row, column);
} }
@ -103,7 +103,7 @@ module.exports = new Class({
* @param {string} columnName The column index * @param {string} columnName The column index
* @param {Object} value The new value * @param {Object} value The new value
*/ */
,setByIndex: function(column, value) { ,setByIndex(column, value) {
return this._model.setByIndex(this._row, column, value); return this._model.setByIndex(this._row, column, value);
} }
}); });

View File

@ -12,13 +12,13 @@ module.exports = new Class({
*/ */
model: { model: {
type: Model type: Model
,set: function(x) { ,set(x) {
this.link({_model: x}, { this.link({_model: x}, {
'status-changed': this.onModelChange 'status-changed': this.onModelChange
,'row-updated': this.onRowUpdate ,'row-updated': this.onRowUpdate
}); });
} }
,get: function() { ,get() {
return this._model; return this._model;
} }
}, },
@ -27,7 +27,7 @@ module.exports = new Class({
*/ */
row: { row: {
type: Number type: Number
,set: function(x) { ,set(x) {
if (!this._model || this._model.numRows <= x || x < -1) if (!this._model || this._model.numRows <= x || x < -1)
x = -1; x = -1;
if (x == this._row) if (x == this._row)
@ -36,7 +36,7 @@ module.exports = new Class({
this._row = x; this._row = x;
this.iterChanged(); this.iterChanged();
} }
,get: function() { ,get() {
return this._row; return this._row;
} }
}, },
@ -45,7 +45,7 @@ module.exports = new Class({
*/ */
numRows: { numRows: {
type: Number type: Number
,get: function() { ,get() {
if (this._model) if (this._model)
return this._model.numRows; return this._model.numRows;
@ -57,7 +57,7 @@ module.exports = new Class({
*/ */
ready: { ready: {
type: Boolean type: Boolean
,get: function() { ,get() {
return this._ready; return this._ready;
} }
}, },
@ -66,7 +66,7 @@ module.exports = new Class({
*/ */
$: { $: {
type: Object type: Object
,get: function() { ,get() {
return this._model && this._model.getObject(this._row); return this._model && this._model.getObject(this._row);
} }
} }
@ -77,7 +77,7 @@ module.exports = new Class({
,_row: -1 ,_row: -1
,_ready: false ,_ready: false
,onModelChange: function() { ,onModelChange() {
var ready = this._model && this._model.ready; var ready = this._model && this._model.ready;
if (ready != this._ready) { if (ready != this._ready) {
@ -97,7 +97,7 @@ module.exports = new Class({
} }
} }
,onRowUpdate: function(model, row) { ,onRowUpdate(model, row) {
if (row == this._row) if (row == this._row)
this.iterChanged(); this.iterChanged();
} }

View File

@ -38,7 +38,7 @@ module.exports = new Class({
,_model: null ,_model: null
,_row: -1 ,_row: -1
,refresh: function() { ,refresh() {
if (this._model) if (this._model)
this._model.refresh(); this._model.refresh();
} }
@ -46,7 +46,7 @@ module.exports = new Class({
/** /**
* Emits the 'change' signal on the form. * Emits the 'change' signal on the form.
*/ */
,iterChanged: function() { ,iterChanged() {
this.emit('change'); this.emit('change');
} }
@ -56,19 +56,19 @@ module.exports = new Class({
* @param {String} columnName The column name * @param {String} columnName The column name
* @return {integer} The column index or -1 if column not exists * @return {integer} The column index or -1 if column not exists
*/ */
,getColumnIndex: function(columnName) { ,getColumnIndex(columnName) {
if (this._model) if (this._model)
return this._model.getColumnIndex(columnName); return this._model.getColumnIndex(columnName);
return -1; return -1;
} }
,insertRow: function() { ,insertRow() {
if (this._model) if (this._model)
this.row = this._model.insertRow(); this.row = this._model.insertRow();
} }
,performOperations: function() { ,performOperations() {
if (this._model) if (this._model)
this._model.performOperations(); this._model.performOperations();
} }
@ -76,7 +76,7 @@ module.exports = new Class({
/** /**
* Removes the current row. * Removes the current row.
*/ */
,deleteRow: function() { ,deleteRow() {
if (this._row >= 0) if (this._row >= 0)
this._model.deleteRow(this._row); this._model.deleteRow(this._row);
} }
@ -86,7 +86,7 @@ module.exports = new Class({
* *
* @return {Object} The row * @return {Object} The row
*/ */
,getObject: function() { ,getObject() {
return this._model.getObject(this._row); return this._model.getObject(this._row);
} }
@ -95,7 +95,7 @@ module.exports = new Class({
* *
* @param {String} columnName The column name * @param {String} columnName The column name
*/ */
,get: function(columnName) { ,get(columnName) {
if (!this._model) return undefined; if (!this._model) return undefined;
return this._model.get(this._row, columnName); return this._model.get(this._row, columnName);
} }
@ -106,7 +106,7 @@ module.exports = new Class({
* @param {String} columnName The column name * @param {String} columnName The column name
* @param {Object} value The new value * @param {Object} value The new value
*/ */
,set: function(columnName, value) { ,set(columnName, value) {
return this._model.set(this._row, columnName, value); return this._model.set(this._row, columnName, value);
} }
@ -116,7 +116,7 @@ module.exports = new Class({
* @param {String} columnName The column index * @param {String} columnName The column index
* @return {Object} The value * @return {Object} The value
*/ */
,getByIndex: function(column) { ,getByIndex(column) {
return this._model.getByIndex(this._row, column); return this._model.getByIndex(this._row, column);
} }
@ -126,7 +126,7 @@ module.exports = new Class({
* @param {String} columnName The column index * @param {String} columnName The column index
* @param {Object} value The new value * @param {Object} value The new value
*/ */
,setByIndex: function(column, value) { ,setByIndex(column, value) {
return this._model.setByIndex(this._row, column, value); return this._model.setByIndex(this._row, column, value);
} }
}); });

View File

@ -52,11 +52,11 @@ Model.implement({
*/ */
conn: { conn: {
type: Connection type: Connection
,set: function(x) { ,set(x) {
this._conn = x; this._conn = x;
this._autoLoad(); this._autoLoad();
} }
,get: function() { ,get() {
return this._conn; return this._conn;
} }
}, },
@ -65,10 +65,10 @@ Model.implement({
*/ */
resultIndex: { resultIndex: {
type: Number type: Number
,set: function(x) { ,set(x) {
this._resultIndex = x; this._resultIndex = x;
} }
,get: function() { ,get() {
return this._resultIndex; return this._resultIndex;
} }
}, },
@ -77,11 +77,11 @@ Model.implement({
*/ */
lot: { lot: {
type: Vn.LotIface type: Vn.LotIface
,set: function(x) { ,set(x) {
this.link({_lot: x}, {'change': this._onLotChange}); this.link({_lot: x}, {'change': this._onLotChange});
this._onLotChange(); this._onLotChange();
} }
,get: function() { ,get() {
return this._lot; return this._lot;
} }
}, },
@ -90,11 +90,11 @@ Model.implement({
*/ */
stmt: { stmt: {
type: Sql.Stmt type: Sql.Stmt
,set: function(x) { ,set(x) {
this._stmt = x; this._stmt = x;
this._autoLoad(); this._autoLoad();
} }
,get: function() { ,get() {
return this._stmt; return this._stmt;
} }
}, },
@ -103,10 +103,10 @@ Model.implement({
*/ */
query: { query: {
type: String type: String
,set: function(x) { ,set(x) {
this.stmt = new Sql.String({query: x}); this.stmt = new Sql.String({query: x});
} }
,get: function() { ,get() {
if (this._stmt) if (this._stmt)
return this._stmt.render(null); return this._stmt.render(null);
else else
@ -118,12 +118,12 @@ Model.implement({
*/ */
mainTable: { mainTable: {
type: String type: String
,set: function(x) { ,set(x) {
this._mainTable = null; this._mainTable = null;
this._requestedMainTable = x; this._requestedMainTable = x;
this._refreshMainTable(); this._refreshMainTable();
} }
,get: function() { ,get() {
return this._mainTable; return this._mainTable;
} }
}, },
@ -132,12 +132,12 @@ Model.implement({
*/ */
updatable: { updatable: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._updatable = false; this._updatable = false;
this._requestedUpdatable = x; this._requestedUpdatable = x;
this._refreshUpdatable(); this._refreshUpdatable();
} }
,get: function() { ,get() {
return this._updatable; return this._updatable;
} }
}, },
@ -146,7 +146,7 @@ Model.implement({
*/ */
numRows: { numRows: {
type: Number type: Number
,get: function() { ,get() {
if (this.data) if (this.data)
return this.data.length; return this.data.length;
@ -158,7 +158,7 @@ Model.implement({
*/ */
status: { status: {
type: Number type: Number
,get: function() { ,get() {
return this._status; return this._status;
} }
}, },
@ -167,7 +167,7 @@ Model.implement({
*/ */
ready: { ready: {
type: Boolean type: Boolean
,get: function() { ,get() {
return this._status == Status.READY; return this._status == Status.READY;
} }
}, },
@ -213,18 +213,18 @@ Model.implement({
,_defaults: [] ,_defaults: []
,_requestedMainTable: null ,_requestedMainTable: null
,initialize: function(props) { ,initialize(props) {
Vn.Object.prototype.initialize.call(this, props); Vn.Object.prototype.initialize.call(this, props);
this._cleanData(); this._cleanData();
this._setStatus(Status.CLEAN); this._setStatus(Status.CLEAN);
} }
,appendChild: function(child) { ,appendChild(child) {
if (child.nodeType === Node.TEXT_NODE) if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent; this.query = child.textContent;
} }
,loadXml: function(builder, node) { ,loadXml(builder, node) {
Vn.Object.prototype.loadXml.call(this, builder, node); Vn.Object.prototype.loadXml.call(this, builder, node);
var query = node.firstChild.nodeValue; var query = node.firstChild.nodeValue;
@ -251,7 +251,7 @@ Model.implement({
return holders; return holders;
} }
,_getHolderValues: function() { ,_getHolderValues() {
let holders = this._getHolders(this._stmt); let holders = this._getHolders(this._stmt);
if (!holders) return null; if (!holders) return null;
@ -264,7 +264,7 @@ Model.implement({
return params; return params;
} }
,_getHolderParams: function() { ,_getHolderParams() {
let holders = this._getHolders(this._stmt); let holders = this._getHolders(this._stmt);
if (!holders) return null; if (!holders) return null;
@ -276,7 +276,7 @@ Model.implement({
return params; return params;
} }
,_onLotChange: function() { ,_onLotChange() {
const params = this._getHolderValues(); const params = this._getHolderValues();
this._paramsChanged = !Vn.Value.equals(params, this._lastParams); this._paramsChanged = !Vn.Value.equals(params, this._lastParams);
@ -284,14 +284,14 @@ Model.implement({
this.lazyRefresh(); this.lazyRefresh();
} }
,_autoLoad: function() { ,_autoLoad() {
if (this.autoLoad) if (this.autoLoad)
this.refresh(); this.refresh();
else else
this.clean(); this.clean();
} }
,_isReady: function(params) { ,_isReady(params) {
if (!this._stmt || !this._conn) if (!this._stmt || !this._conn)
return false; return false;
@ -302,7 +302,7 @@ Model.implement({
return true; return true;
} }
,lazyRefresh: function() { ,lazyRefresh() {
if (this._paramsChanged) if (this._paramsChanged)
this.refresh(); this.refresh();
} }
@ -310,7 +310,7 @@ Model.implement({
/** /**
* Refresh the model data reexecuting the query on the database. * Refresh the model data reexecuting the query on the database.
*/ */
,refresh: function() { ,refresh() {
const params = this._getHolderParams(); const params = this._getHolderParams();
if (this._isReady(params)) { if (this._isReady(params)) {
@ -323,12 +323,12 @@ Model.implement({
this.clean(); this.clean();
} }
,clean: function() { ,clean() {
this._cleanData(); this._cleanData();
this._setStatus(Status.CLEAN); this._setStatus(Status.CLEAN);
} }
,_selectDone: function(resultSet) { ,_selectDone(resultSet) {
var result; var result;
var dataResult; var dataResult;
@ -371,7 +371,7 @@ Model.implement({
this._setStatus(Status.READY); this._setStatus(Status.READY);
} }
,_refreshRowIndexes: function(start) { ,_refreshRowIndexes(start) {
for (var i = start; i < this.data.length; i++) for (var i = start; i < this.data.length; i++)
this.data[i].index = i; this.data[i].index = i;
@ -383,7 +383,7 @@ Model.implement({
} }
} }
,_cleanData: function() { ,_cleanData() {
this.data = null; this.data = null;
this.tables = null; this.tables = null;
this.columns = null; this.columns = null;
@ -393,7 +393,7 @@ Model.implement({
this._resetOperations(); this._resetOperations();
} }
,_refreshUpdatable: function() { ,_refreshUpdatable() {
var oldValue = this._updatable; var oldValue = this._updatable;
this._updatable = this._mainTable !== null && this._requestedUpdatable; this._updatable = this._mainTable !== null && this._requestedUpdatable;
@ -401,7 +401,7 @@ Model.implement({
this.emit('updatable-changed'); this.emit('updatable-changed');
} }
,_refreshMainTable: function() { ,_refreshMainTable() {
var newMainTable = null; var newMainTable = null;
var tables = this.tables; var tables = this.tables;
@ -425,7 +425,7 @@ Model.implement({
* @param {String} table The destination table name * @param {String} table The destination table name
* @param {Sql.Expr} srcColumn The default value expression * @param {Sql.Expr} srcColumn The default value expression
*/ */
,setDefault: function(field, table, expr) { ,setDefault(field, table, expr) {
this._defaults.push({field, table, expr}); this._defaults.push({field, table, expr});
} }
@ -436,7 +436,7 @@ Model.implement({
* @param {String} table The destination table name * @param {String} table The destination table name
* @param {Object} value The default value * @param {Object} value The default value
*/ */
,setDefaultFromValue: function(field, table, value) { ,setDefaultFromValue(field, table, value) {
this._defaults.push({field, table, value}); this._defaults.push({field, table, value});
} }
@ -448,7 +448,7 @@ Model.implement({
* @param {String} table The destination table name * @param {String} table The destination table name
* @param {String} srcColumn The source column * @param {String} srcColumn The source column
*/ */
,setDefaultFromColumn: function(field, table, srcColumn) { ,setDefaultFromColumn(field, table, srcColumn) {
this._defaults.push({field, table, srcColumn}); this._defaults.push({field, table, srcColumn});
} }
@ -458,7 +458,7 @@ Model.implement({
* @param {integer} column The column index * @param {integer} column The column index
* @return {Boolean} %true if column exists, %false otherwise * @return {Boolean} %true if column exists, %false otherwise
*/ */
,checkColExists: function(column) { ,checkColExists(column) {
return this.columns return this.columns
&& column >= 0 && column >= 0
&& column < this.columns.length; && column < this.columns.length;
@ -470,7 +470,7 @@ Model.implement({
* @param {string} columnName The column name * @param {string} columnName The column name
* @return {Boolean} %true if column exists, %false otherwise * @return {Boolean} %true if column exists, %false otherwise
*/ */
,checkColName: function(columnName) { ,checkColName(columnName) {
return this.columnMap return this.columnMap
&& this.columnMap[columnName] != null; && this.columnMap[columnName] != null;
} }
@ -481,13 +481,13 @@ Model.implement({
* @param {integer} rowIndex The row index * @param {integer} rowIndex The row index
* @return {Boolean} %true if row exists, %false otherwise * @return {Boolean} %true if row exists, %false otherwise
*/ */
,checkRowExists: function(rowIndex) { ,checkRowExists(rowIndex) {
return this.data return this.data
&& rowIndex >= 0 && rowIndex >= 0
&& rowIndex < this.data.length; && rowIndex < this.data.length;
} }
,_checkTableUpdatable: function(tableIndex) { ,_checkTableUpdatable(tableIndex) {
var tableUpdatable = tableIndex !== null var tableUpdatable = tableIndex !== null
&& this.tables[tableIndex].pks.length > 0; && this.tables[tableIndex].pks.length > 0;
@ -508,7 +508,7 @@ Model.implement({
* @param {string} columnName The column name * @param {string} columnName The column name
* @return {number} The column index or -1 if column not exists * @return {number} The column index or -1 if column not exists
*/ */
,getColumnIndex: function(columnName) { ,getColumnIndex(columnName) {
if (this.checkColName(columnName)) if (this.checkColName(columnName))
return this.columnMap[columnName].index; return this.columnMap[columnName].index;
@ -521,7 +521,7 @@ Model.implement({
* @param {number} columnIndex The column name * @param {number} columnIndex The column name
* @return {string} The column index or -1 if column not exists * @return {string} The column index or -1 if column not exists
*/ */
,getColumnName: function(columnIndex) { ,getColumnName(columnIndex) {
if (this.checkColExists(columnIndex)) if (this.checkColExists(columnIndex))
return this.columns[columnIndex].name; return this.columns[columnIndex].name;
@ -534,7 +534,7 @@ Model.implement({
* @param {number} rowIndex The row index * @param {number} rowIndex The row index
* @return {Object} The row * @return {Object} The row
*/ */
,getObject: function(rowIndex) { ,getObject(rowIndex) {
if (!this.checkRowExists(rowIndex)) if (!this.checkRowExists(rowIndex))
return undefined; return undefined;
@ -548,7 +548,7 @@ Model.implement({
* @param {string} columnName The column name * @param {string} columnName The column name
* @return {mixed} The value * @return {mixed} The value
*/ */
,get: function(rowIndex, columnName) { ,get(rowIndex, columnName) {
if (this.checkRowExists(rowIndex)) if (this.checkRowExists(rowIndex))
return this.data[rowIndex][columnName]; return this.data[rowIndex][columnName];
} }
@ -560,7 +560,7 @@ Model.implement({
* @param {string} columnName The column name * @param {string} columnName The column name
* @param {mixed} value The new value * @param {mixed} value The new value
*/ */
,set: function(rowIndex, columnName, value) { ,set(rowIndex, columnName, value) {
if (!this.checkRowExists(rowIndex) if (!this.checkRowExists(rowIndex)
&& !this.checkColName(columnName)) && !this.checkColName(columnName))
return; return;
@ -615,7 +615,7 @@ Model.implement({
* @param {number} columnIndex The column index * @param {number} columnIndex The column index
* @return {mixed} The value * @return {mixed} The value
*/ */
,getByIndex: function(rowIndex, columnIndex) { ,getByIndex(rowIndex, columnIndex) {
var columnName = this.getColumnName(columnIndex); var columnName = this.getColumnName(columnIndex);
if (columnName) if (columnName)
@ -631,7 +631,7 @@ Model.implement({
* @param {number} columnIndex The column index * @param {number} columnIndex The column index
* @param {mixed} value The new value * @param {mixed} value The new value
*/ */
,setByIndex: function(rowIndex, columnIndex, value) { ,setByIndex(rowIndex, columnIndex, value) {
var columnName = this.getColumnName(columnIndex); var columnName = this.getColumnName(columnIndex);
if (columnName) if (columnName)
@ -645,7 +645,7 @@ Model.implement({
* *
* @param {number} rowIndex The row index * @param {number} rowIndex The row index
*/ */
,deleteRow: function(rowIndex) { ,deleteRow(rowIndex) {
if (!this.checkRowExists(rowIndex) if (!this.checkRowExists(rowIndex)
|| !this._checkTableUpdatable(this._mainTable)) || !this._checkTableUpdatable(this._mainTable))
return; return;
@ -689,7 +689,7 @@ Model.implement({
* *
* @return The index of the inserted row * @return The index of the inserted row
*/ */
,insertRow: function() { ,insertRow() {
if (!this._checkTableUpdatable(this._mainTable)) if (!this._checkTableUpdatable(this._mainTable))
return -1; return -1;
@ -716,7 +716,7 @@ Model.implement({
/** /**
* Performs all model changes on the database. * Performs all model changes on the database.
*/ */
,performOperations: function() { ,performOperations() {
var ops = this._operations; var ops = this._operations;
if (ops.length === 0) { if (ops.length === 0) {
@ -769,7 +769,7 @@ Model.implement({
this._resetOperations(); this._resetOperations();
} }
,_createDmlQuery: function(op, tableIndex) { ,_createDmlQuery(op, tableIndex) {
var where = this._createWhere(tableIndex, op, false); var where = this._createWhere(tableIndex, op, false);
if (!where) if (!where)
@ -827,7 +827,7 @@ Model.implement({
return multiStmt; return multiStmt;
} }
,_onOperationsDone: function(ops, resultSet) { ,_onOperationsDone(ops, resultSet) {
var error = resultSet.getError(); var error = resultSet.getError();
if (error) { if (error) {
@ -895,7 +895,7 @@ Model.implement({
/** /**
* Undoes all unsaved changes made to the model. * Undoes all unsaved changes made to the model.
*/ */
,reverseOperations: function() { ,reverseOperations() {
for (var i = 0; i < this._operations.length; i++) { for (var i = 0; i < this._operations.length; i++) {
var op = this._operations[i]; var op = this._operations[i];
var row = op.row; var row = op.row;
@ -925,7 +925,7 @@ Model.implement({
this._refreshRowIndexes(0); this._refreshRowIndexes(0);
} }
,_resetOperations: function() { ,_resetOperations() {
this._operations = []; this._operations = [];
this._operationsMap = {}; this._operationsMap = {};
} }
@ -933,7 +933,7 @@ Model.implement({
/* /*
* Function used to sort the model ascending. * Function used to sort the model ascending.
*/ */
,sortFunctionAsc: function(column, a, b) { ,sortFunctionAsc(column, a, b) {
if (a[column] < b[column]) if (a[column] < b[column])
return -1; return -1;
else if (a[column] > b[column]) else if (a[column] > b[column])
@ -945,7 +945,7 @@ Model.implement({
/* /*
* Function used to sort the model descending. * Function used to sort the model descending.
*/ */
,sortFunctionDesc: function(column, a, b) { ,sortFunctionDesc(column, a, b) {
if (a[column] > b[column]) if (a[column] > b[column])
return -1; return -1;
else if (a[column] < b[column]) else if (a[column] < b[column])
@ -960,7 +960,7 @@ Model.implement({
* @param {integer} columnName The column name * @param {integer} columnName The column name
* @param {SortWay} way The sort way * @param {SortWay} way The sort way
*/ */
,sortByName: function(columnName, way) { ,sortByName(columnName, way) {
this._requestedSortIndex = -1; this._requestedSortIndex = -1;
this._requestedSortName = columnName; this._requestedSortName = columnName;
@ -974,7 +974,7 @@ Model.implement({
* @param {integer} column The column index * @param {integer} column The column index
* @param {SortWay} way The sort way * @param {SortWay} way The sort way
*/ */
,sort: function(column, way) { ,sort(column, way) {
this._requestedSortIndex = column; this._requestedSortIndex = column;
this._requestedSortName = null; this._requestedSortName = null;
@ -984,13 +984,13 @@ Model.implement({
this._sort(columnName, way); this._sort(columnName, way);
} }
,_sort: function(column, way) { ,_sort(column, way) {
this._setStatus(Status.LOADING); this._setStatus(Status.LOADING);
this._realSort(column, way); this._realSort(column, way);
this._setStatus(Status.READY); this._setStatus(Status.READY);
} }
,_realSort: function(column, way) { ,_realSort(column, way) {
if (column !== this._sortColumn) { if (column !== this._sortColumn) {
if (way === SortWay.DESC) if (way === SortWay.DESC)
var sortFunction = this.sortFunctionDesc; var sortFunction = this.sortFunctionDesc;
@ -1016,14 +1016,14 @@ Model.implement({
* *
* @param {String} column The column name * @param {String} column The column name
*/ */
,indexColumn: function(column) { ,indexColumn(column) {
this._requestedIndexes[column] = true; this._requestedIndexes[column] = true;
if (this._status === Status.READY) if (this._status === Status.READY)
this._buildIndex(column); this._buildIndex(column);
} }
,_buildIndex: function(columnName) { ,_buildIndex(columnName) {
if (this.checkColName(columnName)) { if (this.checkColName(columnName)) {
var index = {}; var index = {};
var data = this.data; var data = this.data;
@ -1054,7 +1054,7 @@ Model.implement({
* @param {Object} value The value to search * @param {Object} value The value to search
* @return {integer} The column index * @return {integer} The column index
*/ */
,search: function(columnName, value) { ,search(columnName, value) {
if (!this.checkColName(columnName)) if (!this.checkColName(columnName))
return -1; return -1;
@ -1116,18 +1116,18 @@ Model.implement({
* @param {Object} value The value to search * @param {Object} value The value to search
* @return {integer} The column index * @return {integer} The column index
*/ */
,searchByIndex: function(columnIndex, value) { ,searchByIndex(columnIndex, value) {
var columnName = this.getColumnName(columnIndex); var columnName = this.getColumnName(columnIndex);
return this.search(columnName, value); return this.search(columnName, value);
} }
,_setStatus: function(status) { ,_setStatus(status) {
this._status = status; this._status = status;
this.emit('status-changed', status); this.emit('status-changed', status);
this.emit('status-changed-after', status); this.emit('status-changed-after', status);
} }
,_createTarget: function(tableIndex) { ,_createTarget(tableIndex) {
var table = this.tables[tableIndex]; var table = this.tables[tableIndex];
return new Sql.Table({ return new Sql.Table({
@ -1136,7 +1136,7 @@ Model.implement({
}); });
} }
,_createWhere: function(tableIndex, op, useOldValues) { ,_createWhere(tableIndex, op, useOldValues) {
const where = new Sql.Operation({type: Sql.Operation.Type.AND}); const where = new Sql.Operation({type: Sql.Operation.Type.AND});
const pks = this.tables[tableIndex].pks; const pks = this.tables[tableIndex].pks;
@ -1169,7 +1169,7 @@ Model.implement({
return where; return where;
} }
,_createOperation: function(rowIndex) { ,_createOperation(rowIndex) {
var op = this._operationsMap[rowIndex]; var op = this._operationsMap[rowIndex];
if (!op) { if (!op) {
@ -1199,7 +1199,7 @@ Model.implement({
* @param {Array} pks Array with the names of primary keys * @param {Array} pks Array with the names of primary keys
* @param {String} ai The autoincrement column name * @param {String} ai The autoincrement column name
*/ */
,setInfo: function(table, orgname, schema, pks, ai) { ,setInfo(table, orgname, schema, pks, ai) {
if (!this.tableInfo) if (!this.tableInfo)
this.tableInfo = {}; this.tableInfo = {};
@ -1213,7 +1213,7 @@ Model.implement({
this._repairColumns(); this._repairColumns();
} }
,_repairColumns: function() { ,_repairColumns() {
// Repairs wrong table info // Repairs wrong table info
if (this.tableInfo && this.tables) if (this.tableInfo && this.tables)

View File

@ -10,11 +10,11 @@ module.exports = new Class({
*/ */
conn: { conn: {
type: Connection type: Connection
,set: function(x) { ,set(x) {
this._conn = x; this._conn = x;
this.onChange(); this.onChange();
} }
,get: function() { ,get() {
return this._conn; return this._conn;
} }
}, },
@ -23,11 +23,11 @@ module.exports = new Class({
*/ */
query: { query: {
type: String type: String
,set: function(x) { ,set(x) {
this._stmt = new Sql.String({query: x}); this._stmt = new Sql.String({query: x});
this.onChange(); this.onChange();
} }
,get: function() { ,get() {
return this._stmt.render(null); return this._stmt.render(null);
} }
}, },
@ -36,11 +36,11 @@ module.exports = new Class({
*/ */
stmt: { stmt: {
type: Sql.Stmt type: Sql.Stmt
,set: function(x) { ,set(x) {
this._stmt = x; this._stmt = x;
this.onChange(); this.onChange();
} }
,get: function() { ,get() {
return this._stmt; return this._stmt;
} }
}, },
@ -49,11 +49,11 @@ module.exports = new Class({
*/ */
lot: { lot: {
type: Vn.LotIface type: Vn.LotIface
,set: function(x) { ,set(x) {
this.link({_lot: x}, {'change': this.onChange}); this.link({_lot: x}, {'change': this.onChange});
this.onChange(); this.onChange();
} }
,get: function() { ,get() {
return this._lot; return this._lot;
} }
}, },
@ -66,12 +66,12 @@ module.exports = new Class({
} }
} }
,appendChild: function(child) { ,appendChild(child) {
if (child.nodeType === Node.TEXT_NODE) if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent; this.query = child.textContent;
} }
,loadXml: function(builder, node) { ,loadXml(builder, node) {
Vn.Object.prototype.loadXml.call(this, builder, node); Vn.Object.prototype.loadXml.call(this, builder, node);
var query = node.firstChild.nodeValue; var query = node.firstChild.nodeValue;
@ -80,16 +80,16 @@ module.exports = new Class({
this.query = query; this.query = query;
} }
,execute: function() { ,execute() {
this._conn.execStmt(this._stmt, this._conn.execStmt(this._stmt,
this.onQueryDone.bind(this), this._lot); this.onQueryDone.bind(this), this._lot);
} }
,onQueryDone: function(resultSet) { ,onQueryDone(resultSet) {
this.emit('ready', resultSet); this.emit('ready', resultSet);
} }
,onChange: function() { ,onChange() {
if (this.autoLoad && this._conn && this._stmt && this._lot) if (this.autoLoad && this._conn && this._stmt && this._lot)
this.execute(); this.execute();
} }

View File

@ -11,7 +11,7 @@ module.exports = new Class({
/** /**
* Initilizes the resultset object. * Initilizes the resultset object.
*/ */
,initialize: function(results, error) { ,initialize(results, error) {
this.results = results; this.results = results;
this.error = error; this.error = error;
} }
@ -21,11 +21,11 @@ module.exports = new Class({
* *
* @return {Db.Err} the error or null if no errors hapened * @return {Db.Err} the error or null if no errors hapened
*/ */
,getError: function() { ,getError() {
return this.error; return this.error;
} }
,fetch: function() { ,fetch() {
if (this.error) if (this.error)
throw this.error; throw this.error;
@ -41,7 +41,7 @@ module.exports = new Class({
* *
* @return {Db.Result} the result or %null if error or there are no more results * @return {Db.Result} the result or %null if error or there are no more results
*/ */
,fetchResult: function() { ,fetchResult() {
var result = this.fetch(); var result = this.fetch();
if (result !== null) { if (result !== null) {
@ -59,7 +59,7 @@ module.exports = new Class({
* *
* @return {Array} the row if success, %null otherwise * @return {Array} the row if success, %null otherwise
*/ */
,fetchObject: function() { ,fetchObject() {
var result = this.fetch(); var result = this.fetch();
if (result !== null if (result !== null
@ -75,7 +75,7 @@ module.exports = new Class({
* *
* @return {Array} the data * @return {Array} the data
*/ */
,fetchData: function() { ,fetchData() {
var result = this.fetch(); var result = this.fetch();
if (result !== null if (result !== null
@ -90,7 +90,7 @@ module.exports = new Class({
* *
* @return {Object} the value if success, %null otherwise * @return {Object} the value if success, %null otherwise
*/ */
,fetchValue: function() { ,fetchValue() {
var row = this.fetchRow(); var row = this.fetchRow();
if (row instanceof Array && row.length > 0) if (row instanceof Array && row.length > 0)
@ -104,7 +104,7 @@ module.exports = new Class({
* *
* @return {Array} the row if success, %null otherwise * @return {Array} the row if success, %null otherwise
*/ */
,fetchRow: function() { ,fetchRow() {
var result = this.fetch(); var result = this.fetch();
if (result !== null if (result !== null

View File

@ -5,7 +5,7 @@ module.exports = new Class({
/** /**
* Initilizes the result object. * Initilizes the result object.
*/ */
initialize: function(result) { initialize(result) {
this.data = result.data; this.data = result.data;
this.tables = result.tables; this.tables = result.tables;
this.columns = result.columns; this.columns = result.columns;
@ -29,7 +29,7 @@ module.exports = new Class({
* @param {String} columnName The column name * @param {String} columnName The column name
* @return {Object} The cell value * @return {Object} The cell value
*/ */
,get: function(columnName) { ,get(columnName) {
return this.data[this.row][columnName]; return this.data[this.row][columnName];
} }
@ -38,21 +38,21 @@ module.exports = new Class({
* *
* @return {Object} The cell value * @return {Object} The cell value
*/ */
,getObject: function() { ,getObject() {
return this.data[this.row]; return this.data[this.row];
} }
/** /**
* Resets the result iterator. * Resets the result iterator.
*/ */
,reset: function() { ,reset() {
this.row = -1; this.row = -1;
} }
/** /**
* Moves the internal iterator to the next row. * Moves the internal iterator to the next row.
*/ */
,next: function() { ,next() {
this.row++; this.row++;
if (this.row >= this.data.length) if (this.row >= this.data.length)

View File

@ -14,10 +14,10 @@ module.exports = new Class({
*/ */
model: { model: {
type: Model type: Model
,set: function(x) { ,set(x) {
this._model = x; this._model = x;
} }
,get: function() { ,get() {
return this._model; return this._model;
} }
}, },
@ -26,10 +26,10 @@ module.exports = new Class({
*/ */
row: { row: {
type: Number type: Number
,set: function(x) { ,set(x) {
this._row = x; this._row = x;
} }
,get: function() { ,get() {
return this._row; return this._row;
} }
}, },
@ -38,7 +38,7 @@ module.exports = new Class({
*/ */
numRows: { numRows: {
type: Number type: Number
,get: function() { ,get() {
if (this._model) if (this._model)
return this._model.numRows; return this._model.numRows;
@ -50,7 +50,7 @@ module.exports = new Class({
*/ */
ready: { ready: {
type: Boolean type: Boolean
,get: function() { ,get() {
if (this._model) if (this._model)
return this._model.ready; return this._model.ready;
@ -62,7 +62,7 @@ module.exports = new Class({
*/ */
$: { $: {
type: Object type: Object
,get: function() { ,get() {
return this._model.getObject(this._row); return this._model.getObject(this._row);
} }
} }

View File

@ -7,13 +7,13 @@ module.exports = new Class({
Properties: { Properties: {
conn: { conn: {
type: Db.Connection type: Db.Connection
,get: function() { ,get() {
return this._conn; return this._conn;
} }
} }
} }
,initialize: function() { ,initialize() {
window.onerror = this._onWindowError.bind(this); window.onerror = this._onWindowError.bind(this);
window.onunload = this._onWindowUnload.bind(this); window.onunload = this._onWindowUnload.bind(this);
this._hash = new Vn.Hash({window: window}); this._hash = new Vn.Hash({window: window});
@ -24,7 +24,7 @@ module.exports = new Class({
this.initAutoLogin(); this.initAutoLogin();
} }
,run: function() { ,run() {
if (this.tryAutoLogin()) if (this.tryAutoLogin())
return; return;
@ -36,7 +36,7 @@ module.exports = new Class({
login.show(); login.show();
} }
,_onLogin: function() { ,_onLogin() {
this._freeLogin(); this._freeLogin();
if (this._gui) if (this._gui)
@ -50,24 +50,24 @@ module.exports = new Class({
gui.show(); gui.show();
} }
,_onLogout: function() { ,_onLogout() {
this.clearAutoLogin(); this.clearAutoLogin();
this._freeGui(); this._freeGui();
this.run(); this.run();
} }
,_onWindowUnload: function() { ,_onWindowUnload() {
this.unref(); this.unref();
} }
,_onWindowError: function(message, file, line) { ,_onWindowError(message, file, line) {
var error = new Error(message); var error = new Error(message);
error.fileName = file; error.fileName = file;
error.lineNumber = line; error.lineNumber = line;
this._notifyError(error); this._notifyError(error);
} }
,_onConnError: function(conn, error) { ,_onConnError(conn, error) {
if (error instanceof Vn.JsonException) { if (error instanceof Vn.JsonException) {
if (error.message) if (error.message)
Htk.Toast.showError(error.message); Htk.Toast.showError(error.message);
@ -109,12 +109,12 @@ module.exports = new Class({
} }
} }
,_logout: function() { ,_logout() {
if (this._gui) if (this._gui)
this._gui.logout(); this._gui.logout();
} }
,_newVersion: function() { ,_newVersion() {
if (this.ignoreVersion) if (this.ignoreVersion)
return; return;
@ -129,11 +129,11 @@ module.exports = new Class({
dialog.open(); dialog.open();
} }
,_onNewVersionResponse: function() { ,_onNewVersionResponse() {
location.reload(); location.reload();
} }
,_notifyError: function(error) { ,_notifyError(error) {
Htk.Toast.showError(_('Something went wrong')); Htk.Toast.showError(_('Something went wrong'));
var params = { var params = {
@ -147,7 +147,7 @@ module.exports = new Class({
this._conn.send('core/log', params); this._conn.send('core/log', params);
} }
,_freeLogin: function() { ,_freeLogin() {
if (this._login) { if (this._login) {
this._login.disconnectByInstance(this); this._login.disconnectByInstance(this);
this._login.hide(); this._login.hide();
@ -156,7 +156,7 @@ module.exports = new Class({
} }
} }
,_freeGui: function() { ,_freeGui() {
if (this._gui) { if (this._gui) {
this._gui.disconnectByInstance(this); this._gui.disconnectByInstance(this);
this._gui.hide(); this._gui.hide();
@ -165,7 +165,7 @@ module.exports = new Class({
} }
} }
,_destroy: function() { ,_destroy() {
this._freeLogin(); this._freeLogin();
this._freeGui(); this._freeGui();
this.deinitAutoLogin(); this.deinitAutoLogin();
@ -177,7 +177,7 @@ module.exports = new Class({
,_firstLogin: true ,_firstLogin: true
,initAutoLogin: function() { ,initAutoLogin() {
var isGuest = new Vn.Param({ var isGuest = new Vn.Param({
lot: this._hash, lot: this._hash,
type: Boolean, type: Boolean,
@ -193,22 +193,22 @@ module.exports = new Class({
this.link({_token: token}, {'changed': this._onTokenChange}); this.link({_token: token}, {'changed': this._onTokenChange});
} }
,_onGuestChange: function() { ,_onGuestChange() {
if (this._isGuest.value) if (this._isGuest.value)
setTimeout(this.tryAutoLogin.bind(this)); setTimeout(this.tryAutoLogin.bind(this));
} }
,_onTokenChange: function() { ,_onTokenChange() {
if (this._token.value) if (this._token.value)
setTimeout(this.tryAutoLogin.bind(this)); setTimeout(this.tryAutoLogin.bind(this));
} }
,deinitAutoLogin: function() { ,deinitAutoLogin() {
this._isGuest.unref(); this._isGuest.unref();
this._token.unref(); this._token.unref();
} }
,autoLogin: function() { ,autoLogin() {
var guest = localStorage.getItem('hederaGuest'); var guest = localStorage.getItem('hederaGuest');
if (this._isGuest.value || guest) { if (this._isGuest.value || guest) {
@ -227,7 +227,7 @@ module.exports = new Class({
return false; return false;
} }
,tryAutoLogin: function() { ,tryAutoLogin() {
var ok = this.autoLogin(); var ok = this.autoLogin();
this._firstLogin = false; this._firstLogin = false;
@ -241,7 +241,7 @@ module.exports = new Class({
return true; return true;
} }
,clearAutoLogin: function() { ,clearAutoLogin() {
localStorage.removeItem('hederaGuest'); localStorage.removeItem('hederaGuest');
} }
}); });

View File

@ -1,12 +1,12 @@
module.exports = { module.exports = {
check: function(conn, hash, callback) { check(conn, hash, callback) {
this.hash = hash; this.hash = hash;
conn.execQuery('CALL myBasket_check', conn.execQuery('CALL myBasket_check',
this._onBasketCheck.bind(this, callback)); this._onBasketCheck.bind(this, callback));
}, },
_onBasketCheck: function(callback, resultSet) { _onBasketCheck(callback, resultSet) {
var status = resultSet.fetchValue(); var status = resultSet.fetchValue();
if (!status) if (!status)

View File

@ -5,13 +5,13 @@ module.exports = new Class({
,isOpen: false ,isOpen: false
,uiLoaded: false ,uiLoaded: false
,initialize: function(gui) { ,initialize(gui) {
this.gui = gui; this.gui = gui;
this.conn = gui.conn; this.conn = gui.conn;
this.hash = gui.hash; this.hash = gui.hash;
} }
,loadUi: function() { ,loadUi() {
if (!this.isOpen) if (!this.isOpen)
return; return;
@ -53,7 +53,7 @@ module.exports = new Class({
this.uiLoaded = true; this.uiLoaded = true;
} }
,unloadUi: function() { ,unloadUi() {
if (!this.uiLoaded) if (!this.uiLoaded)
return; return;
@ -74,7 +74,7 @@ module.exports = new Class({
/** /**
* Called when the form is opened. * Called when the form is opened.
*/ */
,open: function() { ,open() {
this.close(); this.close();
this.isOpen = true; this.isOpen = true;
this.loadUi(); this.loadUi();
@ -83,7 +83,7 @@ module.exports = new Class({
/** /**
* Called when the form is closed. * Called when the form is closed.
*/ */
,close: function() { ,close() {
if (!this.isOpen) if (!this.isOpen)
return; return;
@ -94,14 +94,14 @@ module.exports = new Class({
/** /**
* Called when the form is activated. * Called when the form is activated.
*/ */
,activate: function() {} ,activate() {}
/** /**
* Called when the form is deactivated. * Called when the form is deactivated.
*/ */
,deactivate: function() {} ,deactivate() {}
,_destroy: function() { ,_destroy() {
this.close(); this.close();
Vn.Object.prototype._destroy.call(this); Vn.Object.prototype._destroy.call(this);
} }

View File

@ -9,10 +9,10 @@ module.exports = new Class({
Properties: { Properties: {
conn: { conn: {
type: Db.Connection type: Db.Connection
,set: function(x) { ,set(x) {
this.link({_conn: x}, {'loading-changed': this._onConnLoadChange }); this.link({_conn: x}, {'loading-changed': this._onConnLoadChange });
} }
,get: function() { ,get() {
return this._conn; return this._conn;
} }
} }
@ -29,7 +29,7 @@ module.exports = new Class({
,_scrollTimeout: null ,_scrollTimeout: null
,_navbarVisible: true ,_navbarVisible: true
,initialize: function(props) { ,initialize(props) {
this.loadTemplateFromString(Tpl); this.loadTemplateFromString(Tpl);
this.loadingCount = 0; this.loadingCount = 0;
@ -51,7 +51,7 @@ module.exports = new Class({
this.loadMenu(); this.loadMenu();
} }
,show: function() { ,show() {
if (this._shown) if (this._shown)
return; return;
@ -78,7 +78,7 @@ module.exports = new Class({
this.supplantInit(); this.supplantInit();
} }
,hide: function() { ,hide() {
if (!this._shown) if (!this._shown)
return; return;
@ -94,26 +94,26 @@ module.exports = new Class({
Vn.Node.remove(this.node); Vn.Node.remove(this.node);
} }
,logout: function() { ,logout() {
this.onLogoutClick(); this.onLogoutClick();
} }
,onLogoutClick: function() { ,onLogoutClick() {
this._conn.close(this._onConnClose.bind(this)); this._conn.close(this._onConnClose.bind(this));
} }
,_onConnClose: function() { ,_onConnClose() {
this.emit('logout'); this.emit('logout');
} }
,_onConnLoadChange: function(conn, isLoading) { ,_onConnLoadChange(conn, isLoading) {
if (isLoading) if (isLoading)
this.loaderPush(); this.loaderPush();
else else
this.loaderPop(); this.loaderPop();
} }
,onMainQueryDone: function(resultSet) { ,onMainQueryDone(resultSet) {
// Retrieving the user name // Retrieving the user name
this.user = resultSet.fetchObject(); this.user = resultSet.fetchObject();
@ -165,12 +165,12 @@ module.exports = new Class({
this._onFormChange(); this._onFormChange();
} }
,loadMenu: function() { ,loadMenu() {
var sql = 'SELECT * FROM myMenu'; var sql = 'SELECT * FROM myMenu';
this._conn.execQuery(sql, this._onMenuLoad.bind(this)); this._conn.execQuery(sql, this._onMenuLoad.bind(this));
} }
,_onMenuLoad: function(resultSet) { ,_onMenuLoad(resultSet) {
// Retrieving menu sections // Retrieving menu sections
var res = resultSet.fetchData(); var res = resultSet.fetchData();
@ -192,7 +192,7 @@ module.exports = new Class({
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Menu //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Menu
,createMenu: function(res, sectionMap, parent, ul) { ,createMenu(res, sectionMap, parent, ul) {
var sections = sectionMap[parent]; var sections = sectionMap[parent];
if (!sections) return; if (!sections) return;
@ -232,7 +232,7 @@ module.exports = new Class({
} }
} }
,_onLiMouseHover: function(submenu, parent) { ,_onLiMouseHover(submenu, parent) {
if (this.menuShown) if (this.menuShown)
return; return;
@ -245,11 +245,11 @@ module.exports = new Class({
submenu.style.top = rect.top +'px'; submenu.style.top = rect.top +'px';
} }
,_onLiMouseOut: function() { ,_onLiMouseOut() {
this.timeout = setTimeout(this.hideSubmenu.bind(this), 160); this.timeout = setTimeout(this.hideSubmenu.bind(this), 160);
} }
,hideSubmenu: function() { ,hideSubmenu() {
var submenu = this.activeSubmenu; var submenu = this.activeSubmenu;
if (submenu) { if (submenu) {
@ -267,7 +267,7 @@ module.exports = new Class({
this.showMenu(); this.showMenu();
} }
,showMenu: function() { ,showMenu() {
this.showBackground(); this.showBackground();
Vn.Node.addClass(this.$.leftPanel, 'show'); Vn.Node.addClass(this.$.leftPanel, 'show');
this.menuShown = true; this.menuShown = true;
@ -276,7 +276,7 @@ module.exports = new Class({
this.doc.addEventListener('click', this.hideMenuCallback); this.doc.addEventListener('click', this.hideMenuCallback);
} }
,hideMenu: function() { ,hideMenu() {
if (!this.menuShown) if (!this.menuShown)
return; return;
@ -290,13 +290,13 @@ module.exports = new Class({
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Navigation bar //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Navigation bar
,_onScroll: function() { ,_onScroll() {
if (this._scrollTimeout === null) if (this._scrollTimeout === null)
this._scrollTimeout = setTimeout( this._scrollTimeout = setTimeout(
this._scrollTimeoutFunc.bind(this), 150); this._scrollTimeoutFunc.bind(this), 150);
} }
,_scrollTimeoutFunc: function() { ,_scrollTimeoutFunc() {
if (!this._shown) if (!this._shown)
return; return;
@ -321,24 +321,24 @@ module.exports = new Class({
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Background //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Background
,showBackground: function() { ,showBackground() {
Vn.Node.addClass(this.$.background, 'show'); Vn.Node.addClass(this.$.background, 'show');
} }
,hideBackground: function() { ,hideBackground() {
Vn.Node.removeClass(this.$.background, 'show'); Vn.Node.removeClass(this.$.background, 'show');
} }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Spinner //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Spinner
,loaderPush: function() { ,loaderPush() {
this.loadingCount++; this.loadingCount++;
if (this.loadingCount == 1) if (this.loadingCount == 1)
this.$.loader.start(); this.$.loader.start();
} }
,loaderPop: function() { ,loaderPop() {
if (this.loadingCount == 0) if (this.loadingCount == 0)
return; return;
@ -392,7 +392,7 @@ module.exports = new Class({
return fn ? fn() : null; return fn ? fn() : null;
} }
,setForm: function(form) { ,setForm(form) {
const holder = this.$.formHolder; const holder = this.$.formHolder;
Vn.Node.removeChilds(holder); Vn.Node.removeChilds(holder);
@ -403,7 +403,7 @@ module.exports = new Class({
} }
} }
,_onSetFormTimeout: function() { ,_onSetFormTimeout() {
const holder = this.$.formHolder; const holder = this.$.formHolder;
holder.classList.remove('move-start'); holder.classList.remove('move-start');
holder.classList.add('move-end'); holder.classList.add('move-end');
@ -413,21 +413,21 @@ module.exports = new Class({
); );
} }
,setTitle: function(title) { ,setTitle(title) {
Vn.Node.removeChilds(this.$.title); Vn.Node.removeChilds(this.$.title);
if (title) if (title)
this.$.title.appendChild(title); this.$.title.appendChild(title);
} }
,setActions: function(actions) { ,setActions(actions) {
Vn.Node.removeChilds(this.$.actionBar); Vn.Node.removeChilds(this.$.actionBar);
if (actions) if (actions)
this.$.actionBar.appendChild(actions); this.$.actionBar.appendChild(actions);
} }
,closeForm: function() { ,closeForm() {
if (this.activeForm) { if (this.activeForm) {
Vn.Node.removeClass(this.$.formHolder, 'show'); Vn.Node.removeClass(this.$.formHolder, 'show');
this.activeForm.close(); this.activeForm.close();
@ -448,14 +448,14 @@ module.exports = new Class({
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Reports //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Reports
,openReport: function(reportName, lot) { ,openReport(reportName, lot) {
this.loaderPush(); this.loaderPush();
var module = new Module('reports', reportName); var module = new Module('reports', reportName);
module.addCallback(this._onReportLoad.bind(this, lot)); module.addCallback(this._onReportLoad.bind(this, lot));
} }
,_onReportLoad: function(lot, module) { ,_onReportLoad(lot, module) {
this.loaderPop(); this.loaderPop();
if (module.error) { if (module.error) {
@ -469,19 +469,19 @@ module.exports = new Class({
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant
,supplantInit: function() { ,supplantInit() {
var user = sessionStorage.getItem('supplantUser'); var user = sessionStorage.getItem('supplantUser');
if (user != null) if (user != null)
this.supplantUser(user); this.supplantUser(user);
} }
,supplantUser: function(user, callback) { ,supplantUser(user, callback) {
this._conn.supplantUser(user, this._conn.supplantUser(user,
this._onUserSupplant.bind(this, callback, user)); this._onUserSupplant.bind(this, callback, user));
} }
,_onUserSupplant: function(callback, user, supplantOk, err) { ,_onUserSupplant(callback, user, supplantOk, err) {
if (err) throw err; if (err) throw err;
sessionStorage.setItem('supplantUser', user); sessionStorage.setItem('supplantUser', user);
@ -494,13 +494,13 @@ module.exports = new Class({
callback(); callback();
} }
,_onSupplantName: function(resultSet) { ,_onSupplantName(resultSet) {
var userName = resultSet.fetchValue(); var userName = resultSet.fetchValue();
Vn.Node.setText(this.$.supplanted, userName); Vn.Node.setText(this.$.supplanted, userName);
this.$.supplant.classList.toggle('show', true); this.$.supplant.classList.toggle('show', true);
} }
,onSupplantExitClick: function() { ,onSupplantExitClick() {
this.$.supplant.classList.toggle('show', false); this.$.supplant.classList.toggle('show', false);
this._conn.supplantEnd(); this._conn.supplantEnd();
sessionStorage.removeItem('supplantUser', sessionStorage.removeItem('supplantUser',
@ -511,7 +511,7 @@ module.exports = new Class({
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Destroy //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Destroy
,_destroy: function() { ,_destroy() {
this.hide(); this.hide();
Vn.Component.prototype.initialize.call(this); Vn.Component.prototype.initialize.call(this);
} }

View File

@ -8,16 +8,16 @@ module.exports = new Class({
conn: conn:
{ {
type: Db.Connection type: Db.Connection
,set: function(x) { ,set(x) {
this.link({_conn: x}, {'loading-changed': this._onConnLoadChange}); this.link({_conn: x}, {'loading-changed': this._onConnLoadChange});
} }
,get: function() { ,get() {
return this._conn; return this._conn;
} }
} }
} }
,initialize: function(props) { ,initialize(props) {
Vn.Component.prototype.initialize.call(this, props); Vn.Component.prototype.initialize.call(this, props);
this.loadTemplateFromString(Tpl); this.loadTemplateFromString(Tpl);
@ -30,14 +30,14 @@ module.exports = new Class({
}; };
} }
,_onConnLoadChange: function(conn, isLoading) { ,_onConnLoadChange(conn, isLoading) {
if (isLoading) if (isLoading)
this.$.spinner.start(); this.$.spinner.start();
else else
this.$.spinner.stop(); this.$.spinner.stop();
} }
,show: function() { ,show() {
document.body.appendChild(this.node); document.body.appendChild(this.node);
var lastUser = localStorage.getItem('hederaLastUser'); var lastUser = localStorage.getItem('hederaLastUser');
@ -48,7 +48,7 @@ module.exports = new Class({
this._focusUserInput(); this._focusUserInput();
} }
,_onSubmit: function() { ,_onSubmit() {
this._conn.open( this._conn.open(
this.$.user.value, this.$.user.value,
this.$.pass.value, this.$.pass.value,
@ -58,7 +58,7 @@ module.exports = new Class({
this._disableUi(true); this._disableUi(true);
} }
,_onConnOpen: function(conn, success, error) { ,_onConnOpen(conn, success, error) {
this.$.pass.value = ''; this.$.pass.value = '';
this._disableUi(false); this._disableUi(false);
@ -75,23 +75,23 @@ module.exports = new Class({
} }
} }
,hide: function() { ,hide() {
Vn.Node.remove(this.node); Vn.Node.remove(this.node);
} }
,_focusUserInput: function() { ,_focusUserInput() {
var userEntry = this.$.user; var userEntry = this.$.user;
userEntry.focus(); userEntry.focus();
userEntry.select(); userEntry.select();
} }
,_disableUi: function(disabled) { ,_disableUi(disabled) {
this.$.user.disabled = disabled; this.$.user.disabled = disabled;
this.$.pass.disabled = disabled; this.$.pass.disabled = disabled;
this.$.submit.disabled = disabled; this.$.submit.disabled = disabled;
} }
,onPasswordLost: function() { ,onPasswordLost() {
var user = this.$.user.value; var user = this.$.user.value;
if (!user) if (!user)
@ -101,7 +101,7 @@ module.exports = new Class({
this._onPasswordRecovered.bind(this)); this._onPasswordRecovered.bind(this));
} }
,_onPasswordRecovered: function(json, error) { ,_onPasswordRecovered(json, error) {
if (error) if (error)
throw error; throw error;

View File

@ -10,7 +10,7 @@ module.exports = new Class({
,error: false ,error: false
,ready: false ,ready: false
,initialize: function(basePath, path) { ,initialize(basePath, path) {
var absPath = basePath +'/'+ path; var absPath = basePath +'/'+ path;
var aux = path.split('/'); var aux = path.split('/');
@ -28,31 +28,31 @@ module.exports = new Class({
this.moduleName = moduleName; this.moduleName = moduleName;
} }
,addCallback: function(callback) { ,addCallback(callback) {
if (!this.ready) if (!this.ready)
this.callbacks.push(callback); this.callbacks.push(callback);
else else
callback(this); callback(this);
} }
,onLocaleReady: function() { ,onLocaleReady() {
this.localeReady = true; this.localeReady = true;
this.onReady(); this.onReady();
} }
,onJsReady: function(success) { ,onJsReady(success) {
this.jsReady = true; this.jsReady = true;
this.error = !success; this.error = !success;
this.onReady(); this.onReady();
} }
,onUiReady: function(success) { ,onUiReady(success) {
this.uiReady = true; this.uiReady = true;
this.error = !success; this.error = !success;
this.onReady(); this.onReady();
} }
,onReady: function() { ,onReady() {
if (!(this.localeReady && this.jsReady && this.uiReady)) if (!(this.localeReady && this.jsReady && this.uiReady))
return; return;
@ -74,7 +74,7 @@ module.exports = new Class({
callbacks[i](this); callbacks[i](this);
} }
,toCamelCase: function(dashedName) { ,toCamelCase(dashedName) {
var camelCase = dashedName.charAt(0).toUpperCase(); var camelCase = dashedName.charAt(0).toUpperCase();
camelCase += dashedName.substr(1).replace(/\w-\w/g, function(token) { camelCase += dashedName.substr(1).replace(/\w-\w/g, function(token) {
return token.charAt(0) + token.charAt(2).toUpperCase(); return token.charAt(0) + token.charAt(2).toUpperCase();

View File

@ -2,23 +2,23 @@
module.exports = new Class({ module.exports = new Class({
Extends: Vn.Object Extends: Vn.Object
,initialize: function(moduleInfo, gui) { ,initialize(moduleInfo, gui) {
this.info = moduleInfo; this.info = moduleInfo;
this.gui = gui; this.gui = gui;
this.conn = gui.conn; this.conn = gui.conn;
Vn.Object.prototype.initialize.call(this); Vn.Object.prototype.initialize.call(this);
} }
,open: function(lot) { ,open(lot) {
this.lot = lot; this.lot = lot;
this.createWindow(); this.createWindow();
} }
,print: function() { ,print() {
this.window.print(); this.window.print();
} }
,includeCss: function(path) { ,includeCss(path) {
var basePath = location.protocol +'//'+ location.host; var basePath = location.protocol +'//'+ location.host;
basePath += location.port ? ':'+ location.port : ''; basePath += location.port ? ':'+ location.port : '';
basePath += location.pathname.substring(0, basePath += location.pathname.substring(0,
@ -33,7 +33,7 @@ module.exports = new Class({
head.appendChild(link); head.appendChild(link);
} }
,createWindow: function() { ,createWindow() {
var reportWindow = window.open( var reportWindow = window.open(
'js/hedera/report.html', '_blank', 'js/hedera/report.html', '_blank',
'height=650, width=950, resizable=yes, fullscreen=no,'+ 'height=650, width=950, resizable=yes, fullscreen=no,'+
@ -52,7 +52,7 @@ module.exports = new Class({
return true; return true;
} }
,_onWindowLoad: function() { ,_onWindowLoad() {
this.doc = this.window.document this.doc = this.window.document
this.includeCss('reports/'+ this.info.path +'/style.css'); this.includeCss('reports/'+ this.info.path +'/style.css');
@ -64,7 +64,7 @@ module.exports = new Class({
this.onWindowCreate(); this.onWindowCreate();
} }
,onWindowCreate: function() { ,onWindowCreate() {
var builder = new Vn.Builder(); var builder = new Vn.Builder();
builder.compileFile('reports/'+ this.info.path +'/ui.xml'); builder.compileFile('reports/'+ this.info.path +'/ui.xml');

View File

@ -6,21 +6,21 @@ module.exports = new Class({
,Properties: { ,Properties: {
conn: { conn: {
type: Db.Connection type: Db.Connection
,set: function(x) { ,set(x) {
this._conn = x; this._conn = x;
this._refresh(); this._refresh();
} }
,get: function() { ,get() {
return this._conn; return this._conn;
} }
}, },
priority: { priority: {
type: Number type: Number
,set: function(x) { ,set(x) {
this._priority = x; this._priority = x;
this._refresh(); this._refresh();
} }
,get: function() { ,get() {
return this._priority; return this._priority;
} }
} }
@ -28,12 +28,12 @@ module.exports = new Class({
,_priority: 0 ,_priority: 0
,initialize: function() { ,initialize() {
var node = this.createRoot('div'); var node = this.createRoot('div');
node.className = 'htk-social-bar'; node.className = 'htk-social-bar';
} }
,_refresh: function() { ,_refresh() {
if (!this._conn || this._priority === null) if (!this._conn || this._priority === null)
return; return;
@ -44,7 +44,7 @@ module.exports = new Class({
this._conn.execQuery(query, this._onQueryDone.bind(this), params); this._conn.execQuery(query, this._onQueryDone.bind(this), params);
} }
,_onQueryDone: function(resultSet) { ,_onQueryDone(resultSet) {
Vn.Node.removeChilds(this._node); Vn.Node.removeChilds(this._node);
var res = resultSet.fetchResult(); var res = resultSet.fetchResult();

View File

@ -5,7 +5,7 @@ module.exports = new Class({
,tpvOrder: null ,tpvOrder: null
,tpvStatus: null ,tpvStatus: null
,check: function(callback) { ,check(callback) {
this.tpvOrder = this.hash.$.tpvOrder; this.tpvOrder = this.hash.$.tpvOrder;
this.tpvStatus = this.hash.$.tpvStatus; this.tpvStatus = this.hash.$.tpvStatus;
@ -22,11 +22,11 @@ module.exports = new Class({
callback(this, this.tpvOrder, this.tpvStatus); callback(this, this.tpvOrder, this.tpvStatus);
} }
,pay: function(amount, company) { ,pay(amount, company) {
this._realPay(amount * 100, company); this._realPay(amount * 100, company);
} }
,_realPay: function(amount, company) { ,_realPay(amount, company) {
if (isNumeric(amount) && amount > 0) { if (isNumeric(amount) && amount > 0) {
const params = { const params = {
amount: parseInt(amount) amount: parseInt(amount)
@ -41,7 +41,7 @@ module.exports = new Class({
Htk.Toast.showError(_('AmountError')); Htk.Toast.showError(_('AmountError'));
} }
,_onTransactionStart: function(json) { ,_onTransactionStart(json) {
if (json) { if (json) {
const postValues = json.postValues; const postValues = json.postValues;
@ -65,7 +65,7 @@ module.exports = new Class({
Htk.Toast.showWarning(_('PayError')); Htk.Toast.showWarning(_('PayError'));
} }
,retryPay: function() { ,retryPay() {
const params = {transaction: parseInt(this.tpvOrder)}; const params = {transaction: parseInt(this.tpvOrder)};
const query = 'SELECT t.amount, m.companyFk ' const query = 'SELECT t.amount, m.companyFk '
@ -76,7 +76,7 @@ module.exports = new Class({
this._onRetryPayDone.bind(this), params); this._onRetryPayDone.bind(this), params);
} }
,_onRetryPayDone: function(resultSet) { ,_onRetryPayDone(resultSet) {
const res = resultSet.fetchObject(); const res = resultSet.fetchObject();
if (res) if (res)
@ -85,7 +85,7 @@ module.exports = new Class({
Htk.Toast.showError(_('AmountError')); Htk.Toast.showError(_('AmountError'));
} }
,_makeUrl: function(status) { ,_makeUrl(status) {
let path = location.protocol +'//'+ location.hostname; let path = location.protocol +'//'+ location.hostname;
path += location.port ? ':'+ location.port : ''; path += location.port ? ':'+ location.port : '';
path += location.pathname; path += location.pathname;

View File

@ -8,26 +8,26 @@ module.exports = new Class({
Properties: { Properties: {
assistant: { assistant: {
type: Assistant, type: Assistant,
set: function(x) { set(x) {
this.link({_assistant: x}, { this.link({_assistant: x}, {
'step-change': this.onStepChange, 'step-change': this.onStepChange,
'steps-change': this.onStepsChange 'steps-change': this.onStepsChange
}); });
this.onStepsChange(); this.onStepsChange();
}, },
get: function() { get() {
return this._assistant; return this._assistant;
} }
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
set: function(x) { set(x) {
this._disabled = x; this._disabled = x;
this._previousButton.disabled = x; this._previousButton.disabled = x;
this._nextButton.disabled = x; this._nextButton.disabled = x;
this._endButton.disabled = x; this._endButton.disabled = x;
}, },
get: function() { get() {
return this._disabled; return this._disabled;
} }
} }
@ -37,7 +37,7 @@ module.exports = new Class({
_stepIndex: -1, _stepIndex: -1,
_disabled: false, _disabled: false,
render: function() { render() {
var node = this.createRoot('div'); var node = this.createRoot('div');
var previousButton = new Htk.Button({ var previousButton = new Htk.Button({
@ -74,27 +74,27 @@ module.exports = new Class({
this._endButton = endButton; this._endButton = endButton;
}, },
movePrevious: function() { movePrevious() {
if (this._assistant) if (this._assistant)
this._assistant.movePrevious(); this._assistant.movePrevious();
}, },
moveNext: function() { moveNext() {
if (this._assistant) if (this._assistant)
this._assistant.moveNext(); this._assistant.moveNext();
}, },
end: function() { end() {
if (this._assistant) if (this._assistant)
this._assistant.end(); this._assistant.end();
}, },
setStep: function(stepIndex) { setStep(stepIndex) {
if (this._assistant) if (this._assistant)
this._assistant.setStep(stepIndex); this._assistant.setStep(stepIndex);
}, },
onStepsChange: function() { onStepsChange() {
var stepCount = this._assistant.stepCount; var stepCount = this._assistant.stepCount;
var steps = this._steps; var steps = this._steps;
@ -110,7 +110,7 @@ module.exports = new Class({
this.onStepChange(); this.onStepChange();
}, },
onStepChange: function() { onStepChange() {
var childs = this._steps.childNodes; var childs = this._steps.childNodes;
var stepCount = childs ? childs.length : 0; var stepCount = childs ? childs.length : 0;
var stepIndex = this._assistant ? this._assistant.step : -1; var stepIndex = this._assistant ? this._assistant.step : -1;

View File

@ -15,10 +15,10 @@ module.exports = new Class({
*/ */
step: { step: {
type: Number, type: Number,
set: function(x) { set(x) {
this.setStep(x); this.setStep(x);
}, },
get: function() { get() {
return this._stepIndex; return this._stepIndex;
} }
}, },
@ -27,10 +27,10 @@ module.exports = new Class({
*/ */
stepName: { stepName: {
type: String, type: String,
set: function(x) { set(x) {
this.setStepByName(x); this.setStepByName(x);
}, },
get: function() { get() {
return this._stepName; return this._stepName;
} }
}, },
@ -39,12 +39,12 @@ module.exports = new Class({
*/ */
stepsIndex: { stepsIndex: {
type: Array, type: Array,
set: function(x) { set(x) {
this._stepsIndex = x; this._stepsIndex = x;
this.setStep(this._stepIndex); this.setStep(this._stepIndex);
this.emit('steps-change'); this.emit('steps-change');
}, },
get: function() { get() {
return this._stepsIndex; return this._stepsIndex;
} }
}, },
@ -53,7 +53,7 @@ module.exports = new Class({
*/ */
stepCount: { stepCount: {
type: Number, type: Number,
get: function() { get() {
if (this._stepsIndex) if (this._stepsIndex)
return this._stepsIndex.length; return this._stepsIndex.length;
return 0; return 0;
@ -80,12 +80,12 @@ module.exports = new Class({
_stepName: null, _stepName: null,
steps: {}, steps: {},
initialize: function(props) { initialize(props) {
Component.prototype.initialize.call(this, props); Component.prototype.initialize.call(this, props);
this.createRoot('div'); this.createRoot('div');
}, },
appendChild: function(step) { appendChild(step) {
if (!(step instanceof Step)) if (!(step instanceof Step))
throw new Error('Invalid child for assistant'); throw new Error('Invalid child for assistant');
@ -93,12 +93,12 @@ module.exports = new Class({
this.steps[step.name] = step; this.steps[step.name] = step;
}, },
setStepByName: function(stepName) { setStepByName(stepName) {
if (this._stepsIndex) if (this._stepsIndex)
this.setStep(this._stepsIndex.indexOf(stepName)); this.setStep(this._stepsIndex.indexOf(stepName));
}, },
setStep: function(stepIndex) { setStep(stepIndex) {
if ((this.currentStep && stepIndex == this._stepIndex) if ((this.currentStep && stepIndex == this._stepIndex)
|| !this._stepsIndex || !this._stepsIndex
|| !(stepIndex >= -1 && stepIndex < this._stepsIndex.length)) || !(stepIndex >= -1 && stepIndex < this._stepsIndex.length))
@ -140,21 +140,21 @@ module.exports = new Class({
/** /**
* Moves the assistant to the previous step. * Moves the assistant to the previous step.
*/ */
movePrevious: function() { movePrevious() {
this.setStep(this._stepIndex - 1); this.setStep(this._stepIndex - 1);
}, },
/** /**
* Moves the assistant to the next step. * Moves the assistant to the next step.
*/ */
moveNext: function() { moveNext() {
this.setStep(this._stepIndex + 1); this.setStep(this._stepIndex + 1);
}, },
/** /**
* Ends the assistant. If defined, the stepFunc will be called. * Ends the assistant. If defined, the stepFunc will be called.
*/ */
end: function() { end() {
if (this.endFunc) if (this.endFunc)
this.endFunc(); this.endFunc();
} }

View File

@ -6,33 +6,33 @@ module.exports = new Class({
,Properties: { ,Properties: {
image: { image: {
type: String type: String
,set: function(x) { ,set(x) {
this.iconNode.name = x; this.iconNode.name = x;
} }
}, },
icon: { icon: {
type: String type: String
,set: function(x) { ,set(x) {
this.iconNode.name = x; this.iconNode.name = x;
} }
}, },
tip: { tip: {
type: String type: String
,set: function(x) { ,set(x) {
this.node.title = x ? _(x) : ''; this.node.title = x ? _(x) : '';
this.renderContent(); this.renderContent();
} }
,get: function() { ,get() {
return this.node.title; return this.node.title;
} }
}, },
showText: { showText: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._showText = x; this._showText = x;
this.renderContent(); this.renderContent();
} }
,get: function() { ,get() {
return this._showText; return this._showText;
} }
} }
@ -40,14 +40,14 @@ module.exports = new Class({
,_showText: false ,_showText: false
,render: function() { ,render() {
var node = this.createRoot('button'); var node = this.createRoot('button');
this.iconNode = new Htk.Icon(); this.iconNode = new Htk.Icon();
node.appendChild(this.iconNode.node); node.appendChild(this.iconNode.node);
} }
,renderContent: function() { ,renderContent() {
if (this._textNode) if (this._textNode)
Vn.Node.remove(this._textNode); Vn.Node.remove(this._textNode);

View File

@ -6,10 +6,10 @@ module.exports = new Class({
,Properties: { ,Properties: {
restrictFunc: { restrictFunc: {
type: Function type: Function
,set: function(x) { ,set(x) {
this._restrictFunc = x; this._restrictFunc = x;
} }
,get: function() { ,get() {
return this._restrictFunc; return this._restrictFunc;
} }
} }
@ -20,7 +20,7 @@ module.exports = new Class({
,year: null ,year: null
,month: null ,month: null
,render: function() { ,render() {
this.createRoot('div'); this.createRoot('div');
var table = this.createElement('table'); var table = this.createElement('table');
@ -113,7 +113,7 @@ module.exports = new Class({
this.goToCurrentMonth(); this.goToCurrentMonth();
} }
,getMonthDays: function() { ,getMonthDays() {
if (this.month > 6) if (this.month > 6)
return (this.month % 2 != 0) ? 31 : 30; return (this.month % 2 != 0) ? 31 : 30;
else if (this.month != 1) else if (this.month != 1)
@ -122,7 +122,7 @@ module.exports = new Class({
return (this.year % 4 != 0) ? 28 : 29; return (this.year % 4 != 0) ? 28 : 29;
} }
,goToMonth: function(year, month) { ,goToMonth(year, month) {
if (year) if (year)
this.year = year; this.year = year;
if (!isNaN(month)) if (!isNaN(month))
@ -131,7 +131,7 @@ module.exports = new Class({
this.refresh(); this.refresh();
} }
,goToSelectedMonth: function() { ,goToSelectedMonth() {
var date = this._value; var date = this._value;
if (date instanceof Date) if (date instanceof Date)
@ -140,12 +140,12 @@ module.exports = new Class({
this.goToCurrentMonth(); this.goToCurrentMonth();
} }
,goToCurrentMonth: function() { ,goToCurrentMonth() {
var date = new Date(); var date = new Date();
this.goToMonth(date.getFullYear(), date.getMonth()); this.goToMonth(date.getFullYear(), date.getMonth());
} }
,refresh: function() { ,refresh() {
Vn.Node.setText(this.yearNode, this.year); Vn.Node.setText(this.yearNode, this.year);
Vn.Node.setText(this.monthNode, _(Vn.Date.Months[this.month])); Vn.Node.setText(this.monthNode, _(Vn.Date.Months[this.month]));
@ -199,7 +199,7 @@ module.exports = new Class({
this.selectCell(-1); this.selectCell(-1);
} }
,selectCell: function(cellIndex) { ,selectCell(cellIndex) {
if (this.selectedCell != -1) { if (this.selectedCell != -1) {
var node = this.cells[this.selectedCell].node; var node = this.cells[this.selectedCell].node;
Vn.Node.removeClass(node, 'selected'); Vn.Node.removeClass(node, 'selected');
@ -212,11 +212,11 @@ module.exports = new Class({
this.selectedCell = cellIndex; this.selectedCell = cellIndex;
} }
,putValue: function() { ,putValue() {
this.goToSelectedMonth(); this.goToSelectedMonth();
} }
,dayClicked: function(td, cellIndex) { ,dayClicked(td, cellIndex) {
var cell = this.cells[cellIndex]; var cell = this.cells[cellIndex];
if (cell.enabled) { if (cell.enabled) {
@ -241,7 +241,7 @@ module.exports = new Class({
} }
} }
,prevMonthClicked: function() { ,prevMonthClicked() {
if (this.month > 0) if (this.month > 0)
this.month--; this.month--;
else { else {
@ -252,7 +252,7 @@ module.exports = new Class({
this.refresh(); this.refresh();
} }
,nextMonthClicked: function() { ,nextMonthClicked() {
if (this.month < 11) if (this.month < 11)
this.month++; this.month++;
else { else {

View File

@ -3,24 +3,24 @@ module.exports = new Class({
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-check' ,Tag: 'htk-check'
,render: function() { ,render() {
var node = this.createRoot('input'); var node = this.createRoot('input');
node.type = 'checkbox'; node.type = 'checkbox';
node.addEventListener('change', this.changed.bind(this)); node.addEventListener('change', this.changed.bind(this));
} }
,changed: function() { ,changed() {
this.valueChanged(this.node.checked); this.valueChanged(this.node.checked);
} }
,putValue: function(value) { ,putValue(value) {
if (value) if (value)
this.node.checked = true; this.node.checked = true;
else else
this.node.checked = false; this.node.checked = false;
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.disabled = !editable; this.node.disabled = !editable;
} }
}); });

View File

@ -35,7 +35,7 @@ module.exports = new Class({
}, },
class: { class: {
type: String type: String
,set: function(x) { ,set(x) {
this._userCssClass = x; this._userCssClass = x;
if (this._cssClass) if (this._cssClass)
@ -43,7 +43,7 @@ module.exports = new Class({
else else
this._cssClass = x; this._cssClass = x;
} }
,get: function() { ,get() {
return this._userCssClass; return this._userCssClass;
} }
} }
@ -55,12 +55,12 @@ module.exports = new Class({
/** /**
* Initializes the column. * Initializes the column.
*/ */
,initialize: function(props) { ,initialize(props) {
NodeBuilder.prototype.initialize.call(this, props); NodeBuilder.prototype.initialize.call(this, props);
this.td = this.createElement('td'); this.td = this.createElement('td');
} }
,renderHeader: function() { ,renderHeader() {
var th = this.createElement('th'); var th = this.createElement('th');
if (this.title) if (this.title)
@ -74,7 +74,7 @@ module.exports = new Class({
* *
* @return {HTMLTableData} the rendered cell * @return {HTMLTableData} the rendered cell
*/ */
,render: function() { ,render() {
var td = this.td.cloneNode(true); var td = this.td.cloneNode(true);
if (this._cssClass) if (this._cssClass)
@ -83,12 +83,12 @@ module.exports = new Class({
return td; return td;
} }
,updateColumnName: function(model) { ,updateColumnName(model) {
if (this.columnIndex !== -1) if (this.columnIndex !== -1)
this.column = model.getColumnName(this.columnIndex); this.column = model.getColumnName(this.columnIndex);
} }
,changed: function(tr, newValue) { ,changed(tr, newValue) {
this.emit('changed', tr.rowIndex - 1, newValue); this.emit('changed', tr.rowIndex - 1, newValue);
} }
}); });

View File

@ -10,10 +10,10 @@ module.exports = new Class({
}, },
icon: { icon: {
type: String type: String
,set: function(x) { ,set(x) {
this._icon = x; this._icon = x;
} }
,get: function() { ,get() {
return this._icon; return this._icon;
} }
}, },
@ -35,12 +35,12 @@ module.exports = new Class({
} }
}, },
initialize: function(props) { initialize(props) {
this._cssClass = 'cell-button'; this._cssClass = 'cell-button';
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
}, },
render: function(tr) { render(tr) {
const td = Htk.Column.prototype.render.call(this, tr); const td = Htk.Column.prototype.render.call(this, tr);
let button; let button;
@ -69,7 +69,7 @@ module.exports = new Class({
return td; return td;
}, },
buttonClicked: function(value, tr, button) { buttonClicked(value, tr, button) {
this.emit('clicked', value, tr.rowIndex - 1, button); this.emit('clicked', value, tr.rowIndex - 1, button);
} }
}); });

View File

@ -4,12 +4,12 @@ module.exports = new Class({
Extends: Htk.Column Extends: Htk.Column
,Tag: 'htk-column-check' ,Tag: 'htk-column-check'
,initialize: function(props) { ,initialize(props) {
this._cssClass = 'cell-check'; this._cssClass = 'cell-check';
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
} }
,render: function(tr) { ,render(tr) {
var checkButton = this.createElement('input'); var checkButton = this.createElement('input');
checkButton.type = 'checkbox'; checkButton.type = 'checkbox';
checkButton.checked = this.value; checkButton.checked = this.value;
@ -25,7 +25,7 @@ module.exports = new Class({
return td; return td;
} }
,inputChanged: function(tr, node) { ,inputChanged(tr, node) {
this.changed(tr, node.value); this.changed(tr, node.value);
} }
}); });

View File

@ -11,10 +11,10 @@ module.exports = new Class
format: format:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this._format = _(x); this._format = _(x);
} }
,get: function() { ,get() {
return this._format; return this._format;
} }
} }
@ -22,12 +22,12 @@ module.exports = new Class
,_format: _('%a, %e %b %Y') ,_format: _('%a, %e %b %Y')
,initialize: function(props) { ,initialize(props) {
this._cssClass = 'cell-date'; this._cssClass = 'cell-date';
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
} }
,render: function(tr) { ,render(tr) {
var text = Vn.Date.strftime(this.value, this._format); var text = Vn.Date.strftime(this.value, this._format);
var td = Htk.Column.prototype.render.call(this, tr); var td = Htk.Column.prototype.render.call(this, tr);

View File

@ -33,12 +33,12 @@ module.exports = new Class({
} }
} }
,initialize: function(props) { ,initialize(props) {
this._cssClass = 'cell-image'; this._cssClass = 'cell-image';
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
} }
,render: function(tr) { ,render(tr) {
var image = new Htk.Image({ var image = new Htk.Image({
directory: this.directory directory: this.directory
,subdir: this.subdir ,subdir: this.subdir

View File

@ -19,7 +19,7 @@ module.exports = new Class({
} }
} }
,render: function(tr) { ,render(tr) {
var link = this.createElement('a'); var link = this.createElement('a');
link.href = this.href; link.href = this.href;
link.appendChild(this.createTextNode(this.value)); link.appendChild(this.createTextNode(this.value));

View File

@ -5,19 +5,19 @@ module.exports = new Class({
,Properties: { ,Properties: {
param:{ param:{
type: Vn.Param type: Vn.Param
,set: function(x) { ,set(x) {
this.radioGroup.master = x; this.radioGroup.master = x;
} }
} }
} }
,initialize: function(props) { ,initialize(props) {
this._cssClass = 'cell-radio'; this._cssClass = 'cell-radio';
this.radioGroup = new Htk.RadioGroup(this.doc); this.radioGroup = new Htk.RadioGroup(this.doc);
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
} }
,render: function(tr) { ,render(tr) {
var td = Htk.Column.prototype.render.call(this, tr); var td = Htk.Column.prototype.render.call(this, tr);
var radio = this.radioGroup.createButton(this.value); var radio = this.radioGroup.createButton(this.value);
@ -26,7 +26,7 @@ module.exports = new Class({
return td; return td;
} }
,clear: function() { ,clear() {
this.radioGroup.clear(); this.radioGroup.clear();
} }
}); });

View File

@ -20,18 +20,18 @@ module.exports = new Class({
} }
} }
,initialize: function(props) { ,initialize(props) {
this._cssClass = 'cell-spin'; this._cssClass = 'cell-spin';
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
} }
,renderHeader: function() { ,renderHeader() {
var th = Htk.Column.prototype.renderHeader.call(this, ); var th = Htk.Column.prototype.renderHeader.call(this, );
th.className = 'cell-spin'; th.className = 'cell-spin';
return th; return th;
} }
,render: function(tr) { ,render(tr) {
var td = Htk.Column.prototype.render.call(this, tr); var td = Htk.Column.prototype.render.call(this, tr);
var valueString = null; var valueString = null;
@ -58,7 +58,7 @@ module.exports = new Class({
return td; return td;
} }
,inputChanged: function(tr, entry) { ,inputChanged(tr, entry) {
this.changed(tr, parseInt(entry.value)); this.changed(tr, parseInt(entry.value));
} }
}); });

View File

@ -8,10 +8,10 @@ module.exports = new Class({
*/ */
format:{ format:{
type: String type: String
,set: function(x) { ,set(x) {
this._format = _(x); this._format = _(x);
} }
,get: function() { ,get() {
return this._format; return this._format;
} }
} }
@ -19,12 +19,12 @@ module.exports = new Class({
,_format: null ,_format: null
,initialize: function(props) { ,initialize(props) {
this._cssClass = 'cell-text'; this._cssClass = 'cell-text';
Htk.Column.prototype.initialize.call(this, props); Htk.Column.prototype.initialize.call(this, props);
} }
,render: function(tr) { ,render(tr) {
var node; var node;
if (this.editable) { if (this.editable) {
@ -44,7 +44,7 @@ module.exports = new Class({
return td; return td;
} }
,inputChanged: function(tr, node) { ,inputChanged(tr, node) {
this.changed(tr, node.value); this.changed(tr, node.value);
} }
}); });

View File

@ -9,7 +9,7 @@ module.exports = new Class({
,calendar: null ,calendar: null
,ignoreCalendarChange: false ,ignoreCalendarChange: false
,render: function() { ,render() {
const node = this.createRoot('button'); const node = this.createRoot('button');
node.classList.add('input'); node.classList.add('input');
node.addEventListener('click', this._onClick.bind(this)); node.addEventListener('click', this._onClick.bind(this));
@ -25,7 +25,7 @@ module.exports = new Class({
this.setEditable(this._editable); this.setEditable(this._editable);
} }
,putValue: function(value) { ,putValue(value) {
var dateString; var dateString;
if (value instanceof Date) if (value instanceof Date)
@ -36,7 +36,7 @@ module.exports = new Class({
Vn.Node.setText(this.label, dateString); Vn.Node.setText(this.label, dateString);
} }
,setEditable: function(editable) { ,setEditable(editable) {
if (this.calendar) { if (this.calendar) {
this.calendar.disconnectByInstance(this); this.calendar.disconnectByInstance(this);
this.calendar = null; this.calendar = null;
@ -50,7 +50,7 @@ module.exports = new Class({
} }
} }
,_onCalendarChange: function(calendar) { ,_onCalendarChange(calendar) {
if (this.ignoreCalendarChange) if (this.ignoreCalendarChange)
return; return;
@ -61,7 +61,7 @@ module.exports = new Class({
this.valueChanged(newDate); this.valueChanged(newDate);
} }
,_onClick: function() { ,_onClick() {
this.ignoreCalendarChange = true; this.ignoreCalendarChange = true;
this.calendar.value = this._value; this.calendar.value = this._value;
this.calendar.goToSelectedMonth(); this.calendar.goToSelectedMonth();

View File

@ -57,10 +57,10 @@ Dialog.implement({
message: message:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this._message = x; this._message = x;
} }
,get: function() { ,get() {
return this._message; return this._message;
} }
} }
@ -70,10 +70,10 @@ Dialog.implement({
,icon: ,icon:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this._icon = x; this._icon = x;
} }
,get: function() { ,get() {
return this._icon; return this._icon;
} }
} }
@ -83,10 +83,10 @@ Dialog.implement({
,buttons: ,buttons:
{ {
enumType: Button enumType: Button
,set: function(x) { ,set(x) {
this._buttons = x; this._buttons = x;
} }
,get: function() { ,get() {
return this._buttons; return this._buttons;
} }
} }
@ -96,7 +96,7 @@ Dialog.implement({
,_icon: 'info' ,_icon: 'info'
,_buttons: Button.ACCEPT ,_buttons: Button.ACCEPT
,open: function() { ,open() {
Popup.prototype.open.call(this); Popup.prototype.open.call(this);
// Dialog body // Dialog body
@ -150,7 +150,7 @@ Dialog.implement({
this.emit('response', response); this.emit('response', response);
} }
,createButton: function(label, response) { ,createButton(label, response) {
var button = this.createElement('button'); var button = this.createElement('button');
button.className = 'thin'; button.className = 'thin';
button.appendChild(this.createTextNode(label)); button.appendChild(this.createTextNode(label));

View File

@ -9,10 +9,10 @@ module.exports = new Class({
placeholder: placeholder:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this.node.placeholder = x; this.node.placeholder = x;
} }
,get: function() { ,get() {
return this.node.placeholder; return this.node.placeholder;
} }
}, },
@ -22,10 +22,10 @@ module.exports = new Class({
disabled: disabled:
{ {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this.node.disabled = x; this.node.disabled = x;
} }
,get: function() { ,get() {
return this.node.disabled; return this.node.disabled;
} }
}, },
@ -35,22 +35,22 @@ module.exports = new Class({
readonly: readonly:
{ {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this.node.readonly = x; this.node.readonly = x;
} }
,get: function() { ,get() {
return this.node.readonly; return this.node.readonly;
} }
} }
} }
,render: function() { ,render() {
var node = this.createRoot('input'); var node = this.createRoot('input');
node.type = 'text'; node.type = 'text';
node.addEventListener('change', this._onChange.bind(this)); node.addEventListener('change', this._onChange.bind(this));
} }
,_onChange: function() { ,_onChange() {
var newValue; var newValue;
if (this.node.value == '') if (this.node.value == '')
@ -61,14 +61,14 @@ module.exports = new Class({
this.valueChanged(newValue); this.valueChanged(newValue);
} }
,putValue: function(value) { ,putValue(value) {
if (!value) if (!value)
this.node.value = ''; this.node.value = '';
else else
this.node.value = value; this.node.value = value;
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.readOnly = !editable; this.node.readOnly = !editable;
} }
}); });

View File

@ -9,7 +9,7 @@ module.exports = new Class({
,Properties: { ,Properties: {
value: { value: {
type: String type: String
,set: function(x) { ,set(x) {
if (Vn.Value.compare(x, this._value)) if (Vn.Value.compare(x, this._value))
return; return;
@ -20,82 +20,82 @@ module.exports = new Class({
this.putValue(x); this.putValue(x);
this._notifyChanges(); this._notifyChanges();
} }
,get: function() { ,get() {
return this._value; return this._value;
} }
}, },
param: { param: {
type: Vn.ParamIface type: Vn.ParamIface
,set: function(x) { ,set(x) {
this._setParam(x); this._setParam(x);
} }
,get: function() { ,get() {
return this._param; return this._param;
} }
}, },
lot: { lot: {
type: Vn.LotIface type: Vn.LotIface
,set: function(x) { ,set(x) {
this._setLot(x); this._setLot(x);
} }
,get: function() { ,get() {
return this._lot; return this._lot;
} }
}, },
name: { name: {
type: String type: String
,set: function(x) { ,set(x) {
this._setName(x); this._setName(x);
} }
,get: function() { ,get() {
return this._name; return this._name;
} }
}, },
oneWay: { oneWay: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._oneWay = x; this._oneWay = x;
} }
,get: function() { ,get() {
return this._oneWay; return this._oneWay;
} }
}, },
oneTime: { oneTime: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._oneTime = x; this._oneTime = x;
} }
,get: function() { ,get() {
return this._oneTime; return this._oneTime;
} }
}, },
editable: { editable: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
if (x != this._editable) { if (x != this._editable) {
this._editable = x; this._editable = x;
this.setEditable(x); this.setEditable(x);
} }
} }
,get: function() { ,get() {
return this._editable; return this._editable;
} }
}, },
form: { form: {
type: Db.Iterator type: Db.Iterator
,set: function(x) { ,set(x) {
this.lot = x; this.lot = x;
} }
,get: function() { ,get() {
return this._lot; return this._lot;
} }
}, },
column: { column: {
type: String type: String
,set: function(x) { ,set(x) {
this.name = x; this.name = x;
} }
,get: function() { ,get() {
return this._name; return this._name;
} }
}, },
@ -108,7 +108,7 @@ module.exports = new Class({
,_editable: true ,_editable: true
,_lockField: false ,_lockField: false
,_setValue: function(newValue) { ,_setValue(newValue) {
if (!this._putValue(newValue)) if (!this._putValue(newValue))
return; return;
@ -131,7 +131,7 @@ module.exports = new Class({
* *
* @param {Boolean} editable Whether the user is allowed to edit the entry * @param {Boolean} editable Whether the user is allowed to edit the entry
*/ */
,setEditable: function() {} ,setEditable() {}
/** /**
* Virtual method that must be implemented by class childs to put the value * Virtual method that must be implemented by class childs to put the value
@ -139,7 +139,7 @@ module.exports = new Class({
* *
* @param {Object} value The new value for the entry * @param {Object} value The new value for the entry
*/ */
,putValue: function() {} ,putValue() {}
/** /**
* Protected method that should be called from class childs when the value * Protected method that should be called from class childs when the value
@ -147,7 +147,7 @@ module.exports = new Class({
* *
* @param {Object} value The new entry value * @param {Object} value The new entry value
*/ */
,valueChanged: function(value) { ,valueChanged(value) {
this._lockField = true; this._lockField = true;
this._setValue(value); this._setValue(value);
this._lockField = false; this._lockField = false;

View File

@ -13,16 +13,16 @@ module.exports = new Class
fullDir: fullDir:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this._fullDir = x; this._fullDir = x;
} }
,get: function() { ,get() {
return this._fullDir; return this._fullDir;
} }
} }
} }
,show: function(src) { ,show(src) {
var popup = new Popup({class: 'htk-full-image', modal: true}); var popup = new Popup({class: 'htk-full-image', modal: true});
var img = document.createElement('img'); var img = document.createElement('img');
@ -43,7 +43,7 @@ module.exports = new Class
popup.open(); popup.open();
} }
,_onImageLoad: function(popup, img) { ,_onImageLoad(popup, img) {
var scale = null; var scale = null;
var width = img.width; var width = img.width;
var height = img.height; var height = img.height;
@ -70,10 +70,10 @@ module.exports = new Class
popup.reset(); popup.reset();
} }
,_onImageClick: function(popup) { ,_onImageClick(popup) {
popup.hide(); popup.hide();
} }
,_onImageError: function(popup) {} ,_onImageError(popup) {}
}); });

View File

@ -12,7 +12,7 @@ module.exports = new Class({
*/ */
model: { model: {
type: Db.Model type: Db.Model
,set: function(x) { ,set(x) {
this.link({_model: x}, this.link({_model: x},
{ {
'status-changed': this.onModelChange 'status-changed': this.onModelChange
@ -28,7 +28,7 @@ module.exports = new Class({
this.onUpdatableChange(); this.onUpdatableChange();
this.onModelChange(); this.onModelChange();
} }
,get: function() { ,get() {
return this._model; return this._model;
} }
}, },
@ -44,11 +44,11 @@ module.exports = new Class({
*/ */
showHeader: { showHeader: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._showHeader = x; this._showHeader = x;
this.thead.style.display = x ? 'table-header-group' : 'none'; this.thead.style.display = x ? 'table-header-group' : 'none';
} }
,get: function() { ,get() {
return this._showHeader; return this._showHeader;
} }
} }
@ -63,7 +63,7 @@ module.exports = new Class({
,sortWay: null ,sortWay: null
,_showHeader: true ,_showHeader: true
,render: function() { ,render() {
var table = this.createRoot('table'); var table = this.createRoot('table');
var thead = this.createElement('thead'); var thead = this.createElement('thead');
@ -76,16 +76,16 @@ module.exports = new Class({
table.appendChild(this.tbody); table.appendChild(this.tbody);
} }
,appendChild: function(child) { ,appendChild(child) {
this.appendColumn(child); this.appendColumn(child);
} }
,removeClicked: function(column, value, row) { ,removeClicked(column, value, row) {
if (confirm(_('ReallyDelete'))) if (confirm(_('ReallyDelete')))
this._model.deleteRow(row); this._model.deleteRow(row);
} }
,onRowDelete: function(model, row) { ,onRowDelete(model, row) {
var tableRows = this.tbody.childNodes; var tableRows = this.tbody.childNodes;
this.tbody.removeChild(tableRows[row]); this.tbody.removeChild(tableRows[row]);
@ -95,11 +95,11 @@ module.exports = new Class({
this.showNoRecordsFound(); this.showNoRecordsFound();
} }
,onRowInsert: function() { ,onRowInsert() {
this.buildRow(1); this.buildRow(1);
} }
,renderCell: function(row, column, tr) { ,renderCell(row, column, tr) {
if (column.column) if (column.column)
column.value = this._model.data[row][column.column]; column.value = this._model.data[row][column.column];
@ -111,7 +111,7 @@ module.exports = new Class({
return column.render(tr); return column.render(tr);
} }
,refreshRow: function(row, columns) { ,refreshRow(row, columns) {
var x = this.columns; var x = this.columns;
var tr = this.tbody.childNodes[row]; var tr = this.tbody.childNodes[row];
@ -122,11 +122,11 @@ module.exports = new Class({
} }
} }
,onRowUpdate: function(model, row, columns) { ,onRowUpdate(model, row, columns) {
this.refreshRow(row, columns); this.refreshRow(row, columns);
} }
,buildRow: function(count) { ,buildRow(count) {
for (var i = 0; i < count; i++) { for (var i = 0; i < count; i++) {
var tr = this.createElement('tr'); var tr = this.createElement('tr');
@ -142,7 +142,7 @@ module.exports = new Class({
} }
} }
,onUpdatableChange: function() { ,onUpdatableChange() {
if (this._model && this._model.updatable) { if (this._model && this._model.updatable) {
if (!this.internalColumn) { if (!this.internalColumn) {
this.internalColumn = new Htk.ColumnButton({ this.internalColumn = new Htk.ColumnButton({
@ -158,7 +158,7 @@ module.exports = new Class({
} }
} }
,onModelChange: function() { ,onModelChange() {
var emptyMessage = this.emptyMessage ? var emptyMessage = this.emptyMessage ?
this.emptyMessage : _('NoData'); this.emptyMessage : _('NoData');
@ -194,12 +194,12 @@ module.exports = new Class({
this._node.appendChild(this.tbody); this._node.appendChild(this.tbody);
} }
,showNoRecordsFound: function() { ,showNoRecordsFound() {
if (this._model.numRows == 0) if (this._model.numRows == 0)
this.showMessage(_('EmptyList'), 'block'); this.showMessage(_('EmptyList'), 'block');
} }
,showMessage: function(message, src) { ,showMessage(message, src) {
if (this.columns.length == 0) if (this.columns.length == 0)
return; return;
@ -226,7 +226,7 @@ module.exports = new Class({
td.appendChild(message); td.appendChild(message);
} }
,scrollToRow: function(row) { ,scrollToRow(row) {
if (row >= 0) { if (row >= 0) {
var height = parseInt(this.tr.style.height); var height = parseInt(this.tr.style.height);
this.node.scrollTop = (row - 2) * height; this.node.scrollTop = (row - 2) * height;
@ -239,7 +239,7 @@ module.exports = new Class({
} }
} }
,sortModel: function(column) { ,sortModel(column) {
var columnName = column.column; var columnName = column.column;
if (this._model && columnName != -1) { if (this._model && columnName != -1) {
@ -255,14 +255,14 @@ module.exports = new Class({
} }
} }
,columnChanged: function(column, row, newValue) { ,columnChanged(column, row, newValue) {
var columnName = column.column; var columnName = column.column;
if (columnName != -1) if (columnName != -1)
this._model.set(row, columnName, newValue); this._model.set(row, columnName, newValue);
} }
,addColumn: function(pos, column) { ,addColumn(pos, column) {
var header = column.renderHeader(); var header = column.renderHeader();
if (pos == -1 || pos >= this.columns.length) { if (pos == -1 || pos >= this.columns.length) {
@ -290,7 +290,7 @@ module.exports = new Class({
return pos; return pos;
} }
,insertInternalColumn: function(pos, column) { ,insertInternalColumn(pos, column) {
if (pos < 0 || pos > this.internalColumns) if (pos < 0 || pos > this.internalColumns)
pos = this.internalColumns; pos = this.internalColumns;
@ -298,18 +298,18 @@ module.exports = new Class({
return this.addColumn(pos, column); return this.addColumn(pos, column);
} }
,insertColumn: function(pos, column) { ,insertColumn(pos, column) {
if (pos > 0) if (pos > 0)
pos += this.internalColumns; pos += this.internalColumns;
return this.addColumn(pos, column) - this.internalColumns; return this.addColumn(pos, column) - this.internalColumns;
} }
,appendColumn: function(column) { ,appendColumn(column) {
return this.insertColumn(-1, column); return this.insertColumn(-1, column);
} }
,deleteColumn: function(pos) { ,deleteColumn(pos) {
if (pos < 0 || pos >= this.columns.length) if (pos < 0 || pos >= this.columns.length)
return; return;
@ -323,7 +323,7 @@ module.exports = new Class({
rows[i].removeChild(rows[i].childNodes[pos]); rows[i].removeChild(rows[i].childNodes[pos]);
} }
,removeInternalColumn: function(pos) { ,removeInternalColumn(pos) {
if (this.internalColumns == 0) if (this.internalColumns == 0)
return; return;
@ -334,14 +334,14 @@ module.exports = new Class({
this.internalColumns--; this.internalColumns--;
} }
,removeColumn: function(pos) { ,removeColumn(pos) {
if (pos > 0) if (pos > 0)
pos += this.internalColumns; pos += this.internalColumns;
this.deleteColumn(pos); this.deleteColumn(pos);
} }
,reloadModel: function() { ,reloadModel() {
if (this._model != null) if (this._model != null)
this.onModelChange(); this.onModelChange();
} }

View File

@ -4,11 +4,11 @@ module.exports = new Class
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-html' ,Tag: 'htk-html'
,render: function() { ,render() {
this.createRoot('div'); this.createRoot('div');
} }
,putValue: function(value) { ,putValue(value) {
this.node.innerHTML = value; this.node.innerHTML = value;
} }
}); });

View File

@ -8,31 +8,31 @@ module.exports = new Class({
{ {
name: { name: {
type: String type: String
,set: function(x) { ,set(x) {
this._icon = x; this._icon = x;
this._setIcon(); this._setIcon();
} }
,get: function() { ,get() {
return this._icon; return this._icon;
} }
}, },
theme: { theme: {
type: String type: String
,set: function(x) { ,set(x) {
this._theme = x; this._theme = x;
this._setIcon(); this._setIcon();
} }
,get: function() { ,get() {
return this._theme; return this._theme;
} }
}, },
alt: { alt: {
type: String type: String
,set: function(x) { ,set(x) {
this.node.alt = x; this.node.alt = x;
} }
,get: function() { ,get() {
return this.node.alt; return this.node.alt;
} }
} }
@ -40,12 +40,12 @@ module.exports = new Class({
,_icon: null ,_icon: null
,render: function() { ,render() {
const node = this.createRoot('span'); const node = this.createRoot('span');
node.classList.add('material-symbols-rounded'); node.classList.add('material-symbols-rounded');
} }
,_setIcon: function() { ,_setIcon() {
this.node.innerText = this._icon; this.node.innerText = this._icon;
} }
}); });

View File

@ -18,7 +18,7 @@ module.exports = new Class({
} }
}, },
initialize: function(props) { initialize(props) {
this.loadTemplateFromString(Tpl); this.loadTemplateFromString(Tpl);
var self = this; var self = this;
@ -29,7 +29,7 @@ module.exports = new Class({
Component.prototype.initialize.call(this, props); Component.prototype.initialize.call(this, props);
}, },
onNameChange: function() { onNameChange() {
var newValue = this.$.name.value; var newValue = this.$.name.value;
if (!newValue) if (!newValue)
@ -38,7 +38,7 @@ module.exports = new Class({
this.emit('name-changed', newValue); this.emit('name-changed', newValue);
}, },
_onSubmit: function() { _onSubmit() {
this.$.hiddenName.value = this.$.name.value; this.$.hiddenName.value = this.$.name.value;
this.$.submit.disabled = true; this.$.submit.disabled = true;
this.$.spinner.start(); this.$.spinner.start();
@ -47,7 +47,7 @@ module.exports = new Class({
this._onResponse.bind(this)); this._onResponse.bind(this));
}, },
_onResponse: function(json, error) { _onResponse(json, error) {
this.$.submit.disabled = false; this.$.submit.disabled = false;
this.$.spinner.stop(); this.$.spinner.stop();
@ -58,7 +58,7 @@ module.exports = new Class({
this.emit('file-uploaded', this.$.name.value); this.emit('file-uploaded', this.$.name.value);
}, },
setData: function(image, directory) { setData(image, directory) {
this.$.name.value = image; this.$.name.value = image;
this.$.schema.value = directory; this.$.schema.value = directory;
} }

View File

@ -13,11 +13,11 @@ module.exports = new Class({
*/ */
directory: { directory: {
type: String type: String
,set: function(x) { ,set(x) {
this._directory = x; this._directory = x;
this._refreshSrc(); this._refreshSrc();
} }
,get: function() { ,get() {
return this._directory; return this._directory;
} }
}, },
@ -26,11 +26,11 @@ module.exports = new Class({
*/ */
subdir: { subdir: {
type: String type: String
,set: function(x) { ,set(x) {
this._subdir = x; this._subdir = x;
this._refreshSrc(); this._refreshSrc();
} }
,get: function() { ,get() {
return this._subdir; return this._subdir;
} }
}, },
@ -39,11 +39,11 @@ module.exports = new Class({
*/ */
stampColumn: { stampColumn: {
type: String type: String
,set: function(x) { ,set(x) {
this._stampColumn = x; this._stampColumn = x;
this._refreshSrc(); this._refreshSrc();
} }
,get: function() { ,get() {
return this._stampColumn; return this._stampColumn;
} }
}, },
@ -52,11 +52,11 @@ module.exports = new Class({
*/ */
fullDir: { fullDir: {
type: String type: String
,set: function(x) { ,set(x) {
this._fullDir = x; this._fullDir = x;
this._refreshClick(); this._refreshClick();
} }
,get: function() { ,get() {
return this._fullDir; return this._fullDir;
} }
}, },
@ -74,7 +74,7 @@ module.exports = new Class({
,_error: false ,_error: false
,_editable: false ,_editable: false
,render: function() { ,render() {
var node = this.createRoot('div'); var node = this.createRoot('div');
var img = this.img = this.createElement('img'); var img = this.img = this.createElement('img');
@ -86,7 +86,7 @@ module.exports = new Class({
this._refreshSrc(); this._refreshSrc();
} }
,_refreshClick: function() { ,_refreshClick() {
if (!this.node) if (!this.node)
return; return;
@ -103,7 +103,7 @@ module.exports = new Class({
} }
} }
,setEditable: function() { ,setEditable() {
if (!this.node) if (!this.node)
return; return;
@ -124,7 +124,7 @@ module.exports = new Class({
} }
} }
,_makeSrc: function(subdir) { ,_makeSrc(subdir) {
var src = Vn.Config.imageUrl +'/'; var src = Vn.Config.imageUrl +'/';
if (this._directory) if (this._directory)
@ -142,7 +142,7 @@ module.exports = new Class({
return src; return src;
} }
,_refreshSrc: function() { ,_refreshSrc() {
if (!this.node) if (!this.node)
return; return;
@ -153,15 +153,15 @@ module.exports = new Class({
delete this.img.src; delete this.img.src;
} }
,putValue: function() { ,putValue() {
this._refreshSrc(); this._refreshSrc();
} }
,_onImageError: function() { ,_onImageError() {
this._error = true; this._error = true;
} }
,_onClick: function(event) { ,_onClick(event) {
if (!this._fullDir || !this._value || this._error if (!this._fullDir || !this._value || this._error
|| event.defaultPrevented) || event.defaultPrevented)
return; return;
@ -170,7 +170,7 @@ module.exports = new Class({
(new Htk.FullImage()).show(this._makeSrc(this._fullDir)); (new Htk.FullImage()).show(this._makeSrc(this._fullDir));
} }
,_onEditClick: function(event) { ,_onEditClick(event) {
if (event.defaultPrevented) return if (event.defaultPrevented) return
event.preventDefault(); event.preventDefault();
@ -187,17 +187,17 @@ module.exports = new Class({
this.popup.show(this.node); this.popup.show(this.node);
} }
,_onNameChange: function(editor, value) { ,_onNameChange(editor, value) {
this.value = value; this.value = value;
} }
,_onFileUpload: function(cell) { ,_onFileUpload(cell) {
this._stamp = new Date().getTime(); this._stamp = new Date().getTime();
this._refreshSrc(cell); this._refreshSrc(cell);
this.popup.hide(); this.popup.hide();
} }
,_onEditorClose: function(editor) { ,_onEditorClose(editor) {
editor.disconnectByInstance(this); editor.disconnectByInstance(this);
} }
}); });

View File

@ -11,11 +11,11 @@ module.exports = new Class
format: format:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this._format = _(x); this._format = _(x);
this.putValue(this._value); this.putValue(this._value);
} }
,get: function() { ,get() {
return this._format; return this._format;
} }
} }
@ -23,11 +23,11 @@ module.exports = new Class
,_format: null ,_format: null
,render: function() { ,render() {
this.createRoot('label'); this.createRoot('label');
} }
,putValue: function(value) { ,putValue(value) {
Vn.Node.setText(this.node, Vn.Node.setText(this.node,
Vn.Value.format(value, this._format)); Vn.Value.format(value, this._format));
} }

View File

@ -7,17 +7,17 @@ module.exports = new Class({
,Properties: { ,Properties: {
form: { form: {
type: Db.Form type: Db.Form
,set: function(x) { ,set(x) {
this.link({_form: x}, {'status-changed': this.onFormChange}); this.link({_form: x}, {'status-changed': this.onFormChange});
this.onFormChange(); this.onFormChange();
} }
,get: function() { ,get() {
return this._form; return this._form;
} }
} }
} }
,initialize: function(props) { ,initialize(props) {
Component.prototype.initialize.call(this, props); Component.prototype.initialize.call(this, props);
this.createRoot('div'); this.createRoot('div');
@ -36,11 +36,11 @@ module.exports = new Class({
this.stop(); this.stop();
} }
,appendChild: function(child) { ,appendChild(child) {
this.childs.appendChild(child); this.childs.appendChild(child);
} }
,stop: function() { ,stop() {
if (!this.isLoading) if (!this.isLoading)
return; return;
@ -50,7 +50,7 @@ module.exports = new Class({
this.node.appendChild(this.childs); this.node.appendChild(this.childs);
} }
,start: function() { ,start() {
if (this.isLoading) if (this.isLoading)
return; return;
@ -60,7 +60,7 @@ module.exports = new Class({
this.node.appendChild(this.div); this.node.appendChild(this.div);
} }
,onFormChange: function() { ,onFormChange() {
if (this._form.ready) if (this._form.ready)
this.stop(); this.stop();
else else

View File

@ -13,11 +13,11 @@ module.exports = new Class({
*/ */
child: { child: {
type: Component type: Component
,set: function(x) { ,set(x) {
this._child = x; this._child = x;
this._setChildNode(x.node); this._setChildNode(x.node);
} }
,get: function() { ,get() {
return this._child; return this._child;
} }
} }
@ -26,11 +26,11 @@ module.exports = new Class({
*/ */
,childNode: { ,childNode: {
type: Object type: Object
,set: function(x) { ,set(x) {
this._child = null; this._child = null;
this._setChildNode(x); this._setChildNode(x);
} }
,get: function() { ,get() {
return this.node.firstChild; return this.node.firstChild;
} }
} }
@ -39,10 +39,10 @@ module.exports = new Class({
*/ */
,modal: { ,modal: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._modal = x; this._modal = x;
} }
,get: function() { ,get() {
return this._modal; return this._modal;
} }
} }
@ -53,31 +53,31 @@ module.exports = new Class({
,_isOpen: false ,_isOpen: false
,_child: null ,_child: null
,initialize: function(props) { ,initialize(props) {
this._bgMouseDownHandler = this._bgMouseDown.bind(this); this._bgMouseDownHandler = this._bgMouseDown.bind(this);
Component.prototype.initialize.call(this, props); Component.prototype.initialize.call(this, props);
} }
,render: function() { ,render() {
this.createRoot('div'); this.createRoot('div');
} }
,_setChildNode: function(childNode) { ,_setChildNode(childNode) {
Vn.Node.removeChilds(this.node); Vn.Node.removeChilds(this.node);
this.node.appendChild(childNode); this.node.appendChild(childNode);
} }
,show: function(parent, event) { ,show(parent, event) {
this._parent = parent; this._parent = parent;
this._lastEvent = event; this._lastEvent = event;
this.open(); this.open();
} }
,isModal: function() { ,isModal() {
return this._modal || Vn.isMobile(); return this._modal || Vn.isMobile();
} }
,open: function() { ,open() {
if (this._isOpen) { if (this._isOpen) {
this.reset(); this.reset();
return; return;
@ -106,16 +106,16 @@ module.exports = new Class({
setTimeout(this._onResetTimeout.bind(this), 0); setTimeout(this._onResetTimeout.bind(this), 0);
} }
,_onOpacityTimeout: function() { ,_onOpacityTimeout() {
if (this._bg) if (this._bg)
this._bg.style.opacity = 1; this._bg.style.opacity = 1;
} }
,_onResetTimeout: function() { ,_onResetTimeout() {
this.reset(); this.reset();
} }
,reset: function() { ,reset() {
if (!this._isOpen) if (!this._isOpen)
return; return;
@ -162,7 +162,7 @@ module.exports = new Class({
} }
} }
,hide: function() { ,hide() {
if (!this._isOpen) if (!this._isOpen)
return; return;
@ -180,14 +180,14 @@ module.exports = new Class({
this.emit('closed'); this.emit('closed');
} }
,_bgMouseDown: function(e) { ,_bgMouseDown(e) {
if (e !== this._lastEvent) if (e !== this._lastEvent)
this.hide(); this.hide();
this._lastEvent = null; this._lastEvent = null;
} }
,_onMouseDown: function(e) { ,_onMouseDown(e) {
this._lastEvent = e; this._lastEvent = e;
} }
}); });

View File

@ -7,17 +7,17 @@ module.exports = new Class({
,Properties: { ,Properties: {
tip: { tip: {
type: String type: String
,set: function(x) { ,set(x) {
if (x) if (x)
this.node.title = _(x); this.node.title = _(x);
} }
}, },
val: { val: {
type: String type: String
,get: function() { ,get() {
return this._val; return this._val;
} }
,set: function(x) { ,set(x) {
this._val = x; this._val = x;
this.node.value = !x ? '' : x; this.node.value = !x ? '' : x;
this._onRadioGroupChange(); this._onRadioGroupChange();
@ -25,19 +25,19 @@ module.exports = new Class({
}, },
name: { name: {
type: String type: String
,get: function() { ,get() {
return this.node.name; return this.node.name;
} }
,set: function(x) { ,set(x) {
this.node.name = x; this.node.name = x;
} }
}, },
radioGroup: { radioGroup: {
type: RadioGroup type: RadioGroup
,get: function() { ,get() {
return this._radioGroup; return this._radioGroup;
} }
,set: function(x) { ,set(x) {
if (this._radioGroup) if (this._radioGroup)
this._radioGroup.removeButton(this); this._radioGroup.removeButton(this);
@ -51,32 +51,32 @@ module.exports = new Class({
,_radioGroup: null ,_radioGroup: null
,render: function() { ,render() {
var radio = Vn.Browser.createRadio('', this.doc); 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;
} }
,_onChange: function() { ,_onChange() {
if (this.node.checked && this._radioGroup) if (this.node.checked && this._radioGroup)
this._radioGroup.value = this._val || this.value; this._radioGroup.value = this._val || this.value;
} }
,_onRadioGroupChange: function() { ,_onRadioGroupChange() {
const value = this._radioGroup.value; const value = this._radioGroup.value;
this.node.checked = this.node.checked =
value && (value == this._val || value == this.value); value && (value == this._val || value == this.value);
} }
,putValue: function(value) { ,putValue(value) {
if (!value) if (!value)
this.node.value = ''; this.node.value = '';
else else
this.node.value = value; this.node.value = value;
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.disabled = !editable; this.node.disabled = !editable;
} }
}); });

View File

@ -7,24 +7,24 @@ module.exports = new Class({
,radioLock: false ,radioLock: false
,initialize: function(props) { ,initialize(props) {
this.clear(); this.clear();
Htk.Field.prototype.initialize.call(this, props); Htk.Field.prototype.initialize.call(this, props);
} }
,clear: function() { ,clear() {
this.name = htkRadioGroupUid++; this.name = htkRadioGroupUid++;
this.buttons = []; this.buttons = [];
} }
,createButton: function(value) { ,createButton(value) {
var button = Vn.Browser.createRadio(this.name, this.doc); var button = Vn.Browser.createRadio(this.name, this.doc);
button.value = value; button.value = value;
button.radioGroup = this; button.radioGroup = this;
return button; return button;
} }
,removeButton: function(button) { ,removeButton(button) {
for (var i = 0; i < this.buttons.length; i++) for (var i = 0; i < this.buttons.length; i++)
if (this.buttons === button) { if (this.buttons === button) {
this.buttons.splice(i, 1); this.buttons.splice(i, 1);
@ -35,7 +35,7 @@ module.exports = new Class({
/** /**
* @return %true if there is an option selected, otherwise it returns %false * @return %true if there is an option selected, otherwise it returns %false
*/ */
,isSelected: function() { ,isSelected() {
for (var i = 0; i < this.buttons.length; i++) for (var i = 0; i < this.buttons.length; i++)
if (this.buttons[i].value == this.value) if (this.buttons[i].value == this.value)
return true; return true;

View File

@ -11,7 +11,7 @@ module.exports = new Class({
*/ */
model: { model: {
type: Db.Model type: Db.Model
,set: function(x) { ,set(x) {
this.link({_model: x}, { this.link({_model: x}, {
'status-changed': this._onModelChange 'status-changed': this._onModelChange
,'row-deleted': this._onRowDelete ,'row-deleted': this._onRowDelete
@ -21,7 +21,7 @@ module.exports = new Class({
this._onModelChange(); this._onModelChange();
} }
,get: function() { ,get() {
this._model; this._model;
} }
} }
@ -30,10 +30,10 @@ module.exports = new Class({
*/ */
,formId: { ,formId: {
type: String type: String
,set: function(x) { ,set(x) {
this._formId = x; this._formId = x;
} }
,get: function() { ,get() {
this._formId; this._formId;
} }
} }
@ -43,10 +43,10 @@ module.exports = new Class({
*/ */
,renderer: { ,renderer: {
type: Function type: Function
,set: function(x) { ,set(x) {
this._renderer = x; this._renderer = x;
} }
,get: function() { ,get() {
this._renderer; this._renderer;
} }
} }
@ -55,11 +55,11 @@ module.exports = new Class({
*/ */
,showStatus: { ,showStatus: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._showStatus = x; this._showStatus = x;
this._onModelChange(); this._onModelChange();
} }
,get: function() { ,get() {
this._showStatus; this._showStatus;
} }
} }
@ -76,7 +76,7 @@ module.exports = new Class({
,_formId: 'form' ,_formId: 'form'
,_showStatus: true ,_showStatus: true
,render: function() { ,render() {
var div = this.createRoot('div'); var div = this.createRoot('div');
this._container = this.createElement('div'); this._container = this.createElement('div');
@ -84,7 +84,7 @@ module.exports = new Class({
div.appendChild(this._container); div.appendChild(this._container);
} }
,loadXml: function(scope, node) { ,loadXml(scope, node) {
Component.prototype.loadXml.call(this, scope, node); Component.prototype.loadXml.call(this, scope, node);
this._parentScope = scope; this._parentScope = scope;
@ -94,19 +94,19 @@ module.exports = new Class({
this._onModelChange(); this._onModelChange();
} }
,getChild: function(index) { ,getChild(index) {
return this._container.childNodes[index]; return this._container.childNodes[index];
} }
,getBuilder: function(index) { ,getBuilder(index) {
return this._childsData[index].scope; return this._childsData[index].scope;
} }
,getForm: function(index) { ,getForm(index) {
return this._childsData[index].set; return this._childsData[index].set;
} }
,_buildBox: function(index) { ,_buildBox(index) {
var set = new Db.SimpleIterator({ var set = new Db.SimpleIterator({
model: this._model, model: this._model,
row: index row: index
@ -126,7 +126,7 @@ module.exports = new Class({
return scope.getMain(); return scope.getMain();
} }
,_onModelChange: function() { ,_onModelChange() {
if (!this._model || !this._builder) if (!this._model || !this._builder)
return; return;
@ -164,12 +164,12 @@ module.exports = new Class({
this.emit('change'); this.emit('change');
} }
,_showNoRecordsFound: function() { ,_showNoRecordsFound() {
if (this._model.numRows === 0) if (this._model.numRows === 0)
this._showMessage(_('EmptyList'), 'block'); this._showMessage(_('EmptyList'), 'block');
} }
,_showMessage: function(message, src) { ,_showMessage(message, src) {
if (!this._showStatus) if (!this._showStatus)
return; return;
@ -191,7 +191,7 @@ module.exports = new Class({
div.appendChild(this.createTextNode(message)); div.appendChild(this.createTextNode(message));
} }
,_onRowDelete: function(model, row) { ,_onRowDelete(model, row) {
Vn.Node.remove(this._container.childNodes[row]); Vn.Node.remove(this._container.childNodes[row]);
this._unrefChildData(row); this._unrefChildData(row);
this._childsData.splice(row, 1); this._childsData.splice(row, 1);
@ -202,28 +202,28 @@ module.exports = new Class({
this._showNoRecordsFound(); this._showNoRecordsFound();
} }
,_onRowUpdate: function(model, row) { ,_onRowUpdate(model, row) {
this._childsData[row].set.iterChanged(); this._childsData[row].set.iterChanged();
} }
,_onRowInsert: function(model, row) { ,_onRowInsert(model, row) {
var box = this._buildBox(row); var box = this._buildBox(row);
this._container.appendChild(box); this._container.appendChild(box);
} }
,_freeChildsData: function() { ,_freeChildsData() {
if (this._childsData) if (this._childsData)
for (var i = 0; i < this._childsData.length; i++) for (var i = 0; i < this._childsData.length; i++)
this._unrefChildData(i); this._unrefChildData(i);
} }
,_unrefChildData: function(index) { ,_unrefChildData(index) {
var childData = this._childsData[index]; var childData = this._childsData[index];
childData.set.unref(); childData.set.unref();
childData.scope.unref(); childData.scope.unref();
} }
,destroy: function() { ,destroy() {
this._freeChildsData(); this._freeChildsData();
Component.prototype.destroy.call(this); Component.prototype.destroy.call(this);
} }

View File

@ -4,7 +4,7 @@ module.exports = new Class({
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-search-entry' ,Tag: 'htk-search-entry'
,render: function() { ,render() {
var div = this.createRoot('div'); var div = this.createRoot('div');
div.className = 'htk-search-entry'; div.className = 'htk-search-entry';
@ -24,7 +24,7 @@ module.exports = new Class({
this._input = input; this._input = input;
} }
,_onChange: function() { ,_onChange() {
var newValue; var newValue;
if (this._input.value === '') if (this._input.value === '')
@ -35,14 +35,14 @@ module.exports = new Class({
this.valueChanged(newValue); this.valueChanged(newValue);
} }
,putValue: function(value) { ,putValue(value) {
if (!value) if (!value)
this._input.value = ''; this._input.value = '';
else else
this._input.value = value; this._input.value = value;
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.readOnly = !editable; this.node.readOnly = !editable;
} }
}); });

View File

@ -11,11 +11,11 @@ module.exports = new Class({
*/ */
model: { model: {
type: Db.Model type: Db.Model
,set: function(x) { ,set(x) {
this.link({_model: x}, {'status-changed-after': this._onModelChange}); this.link({_model: x}, {'status-changed-after': this._onModelChange});
this._onModelChange(); this._onModelChange();
} }
,get: function() { ,get() {
return this._model; return this._model;
} }
}, },
@ -24,7 +24,7 @@ module.exports = new Class({
*/ */
row: { row: {
type: Number type: Number
,set: function(x) { ,set(x) {
if (!this._model || this._model.numRows <= x || x < -1) if (!this._model || this._model.numRows <= x || x < -1)
x = -1; x = -1;
if (x == this._row) if (x == this._row)
@ -33,7 +33,7 @@ module.exports = new Class({
this._row = x; this._row = x;
this.iterChanged(); this.iterChanged();
} }
,get: function() { ,get() {
return this._row; return this._row;
} }
}, },
@ -42,7 +42,7 @@ module.exports = new Class({
*/ */
numRows:{ numRows:{
type: Number type: Number
,get: function() { ,get() {
if (this._model) if (this._model)
return this._model.numRows; return this._model.numRows;
@ -54,7 +54,7 @@ module.exports = new Class({
*/ */
ready:{ ready:{
type: Boolean type: Boolean
,get: function() { ,get() {
return this._model && this._model.ready; return this._model && this._model.ready;
} }
}, },
@ -63,11 +63,11 @@ module.exports = new Class({
*/ */
placeholder:{ placeholder:{
type: String type: String
,set: function(x) { ,set(x) {
this._placeholder = x; this._placeholder = x;
this._refreshShowText(x); this._refreshShowText(x);
} }
,get: function() { ,get() {
return this._placeholder; return this._placeholder;
} }
}, },
@ -76,10 +76,10 @@ module.exports = new Class({
*/ */
notNull:{ notNull:{
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._notNull = x; this._notNull = x;
} }
,get: function() { ,get() {
return this._notNull; return this._notNull;
} }
}, },
@ -88,13 +88,13 @@ module.exports = new Class({
*/ */
$: { $: {
type: Object type: Object
,get: function() { ,get() {
return this._model.getObject(this._row) || {}; return this._model.getObject(this._row) || {};
} }
}, },
params: { params: {
type: Object type: Object
,get: function() { ,get() {
return this.$; return this.$;
} }
} }
@ -109,7 +109,7 @@ module.exports = new Class({
,_notNull: true ,_notNull: true
,_webkitRefresh: false ,_webkitRefresh: false
,render: function() { ,render() {
const button = this.createRoot('button'); const button = this.createRoot('button');
button.type = 'button'; button.type = 'button';
button.classList.add('input'); button.classList.add('input');
@ -134,7 +134,7 @@ module.exports = new Class({
button.appendChild(dropDown.node); button.appendChild(dropDown.node);
} }
,_setRow: function(row) { ,_setRow(row) {
this._row = row; this._row = row;
this._refreshShowText(); this._refreshShowText();
this.iterChanged(); this.iterChanged();
@ -147,7 +147,7 @@ module.exports = new Class({
this.valueChanged(undefined); this.valueChanged(undefined);
} }
,_onButtonMouseDown: function(event) { ,_onButtonMouseDown(event) {
if (this._popup) { if (this._popup) {
this._popup.hide(); this._popup.hide();
return; return;
@ -178,7 +178,7 @@ module.exports = new Class({
this.emit('menu-show'); this.emit('menu-show');
} }
,_onGridClicked: function(grid, e) { ,_onGridClicked(grid, e) {
let cell; let cell;
let target = e.target; let target = e.target;
@ -204,12 +204,12 @@ module.exports = new Class({
e.stopPropagation(); e.stopPropagation();
} }
,_onPopupClose: function() { ,_onPopupClose() {
this._popup = null; this._popup = null;
this.emit('menu-hide'); this.emit('menu-hide');
} }
,_refreshShowText: function() { ,_refreshShowText() {
var model = this._model; var model = this._model;
if (this._row !== -1) if (this._row !== -1)
@ -224,7 +224,7 @@ module.exports = new Class({
Vn.Node.setText(this.label, showText); Vn.Node.setText(this.label, showText);
} }
,_onModelChange: function() { ,_onModelChange() {
var model = this._model; var model = this._model;
this.emit('status-changed'); this.emit('status-changed');
@ -238,11 +238,11 @@ module.exports = new Class({
this._setRow(-1); this._setRow(-1);
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.disabled = !editable; this.node.disabled = !editable;
} }
,_selectOption: function() { ,_selectOption() {
var row; var row;
if (this._model && this._model.ready) if (this._model && this._model.ready)
@ -253,7 +253,7 @@ module.exports = new Class({
this._setRow(row); this._setRow(row);
} }
,putValue: function() { ,putValue() {
this._selectOption(); this._selectOption();
} }
}); });

View File

@ -3,7 +3,7 @@ module.exports = new Class({
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-spin' ,Tag: 'htk-spin'
,render: function() { ,render() {
var input = this.createRoot('input'); var input = this.createRoot('input');
this.node.type = 'number'; this.node.type = 'number';
input.addEventListener('change', this._onChange.bind(this)); input.addEventListener('change', this._onChange.bind(this));
@ -12,13 +12,13 @@ module.exports = new Class({
this.digits = 0; this.digits = 0;
} }
,_onChange: function() { ,_onChange() {
var newValue = (this.node.value == '') ? null : parseFloat(this.node.value); var newValue = (this.node.value == '') ? null : parseFloat(this.node.value);
this.node.value = newValue; this.node.value = newValue;
this.valueChanged(newValue); this.valueChanged(newValue);
} }
,putValue: function(value) { ,putValue(value) {
var text; var text;
if (value != null) { if (value != null) {
@ -32,7 +32,7 @@ module.exports = new Class({
this.node.value = text; this.node.value = text;
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.readOnly = !editable; this.node.readOnly = !editable;
} }
}); });

View File

@ -7,14 +7,14 @@ module.exports = new Class({
,_started: false ,_started: false
,render: function() { ,render() {
var loader = this.createRoot('div'); var loader = this.createRoot('div');
var spin = this.spin = this.createElement('div'); var spin = this.spin = this.createElement('div');
loader.appendChild(spin); loader.appendChild(spin);
} }
,start: function() { ,start() {
if (this._started) if (this._started)
return; return;
@ -22,7 +22,7 @@ module.exports = new Class({
this._started = true; this._started = true;
} }
,stop: function() { ,stop() {
if (!this._started) if (!this._started)
return; return;

View File

@ -19,28 +19,28 @@ module.exports = new Class({
} }
}, },
initialize: function(props) { initialize(props) {
Component.prototype.initialize.call(this, props); Component.prototype.initialize.call(this, props);
this.createRoot('div'); this.createRoot('div');
}, },
show: function() { show() {
if (this.showFunc) if (this.showFunc)
this.showFunc(); this.showFunc();
this.node.style.display = 'block'; this.node.style.display = 'block';
}, },
hide: function() { hide() {
this.node.style.display = 'none'; this.node.style.display = 'none';
}, },
validate: function() { validate() {
if (this.validateFunc) if (this.validateFunc)
return this.validateFunc(); return this.validateFunc();
return true; return true;
}, },
appendChild: function(child) { appendChild(child) {
if (child instanceof Component) if (child instanceof Component)
child = child.node; child = child.node;
this.node.appendChild(child); this.node.appendChild(child);

View File

@ -6,7 +6,7 @@ module.exports = new Class({
Extends: Entry Extends: Entry
,Tag: 'htk-table' ,Tag: 'htk-table'
,render: function() { ,render() {
var tv = new Htk.TreeView(); var tv = new Htk.TreeView();
this.node.appendChild(tv.node); this.node.appendChild(tv.node);
@ -20,31 +20,31 @@ module.exports = new Class({
this.rbGroup = rbGroup; this.rbGroup = rbGroup;
} }
,setModel: function(model) { ,setModel(model) {
this.treeview.setModel(model); this.treeview.setModel(model);
model.addSignal('status-changed', this.modelRefresh, this); model.addSignal('status-changed', this.modelRefresh, this);
this.selectValue(); this.selectValue();
} }
,changed: function() { ,changed() {
this.realValue = this.rbGroup.getValue(); this.realValue = this.rbGroup.getValue();
this.emit('changed'); this.emit('changed');
} }
,selectValue: function() { ,selectValue() {
this.rbGroup.setValue(this.realValue); this.rbGroup.setValue(this.realValue);
} }
,setRealValue: function() { ,setRealValue() {
this.selectValue(); this.selectValue();
} }
,modelRefresh: function(model, status) { ,modelRefresh(model, status) {
if (status == Db.Model.Status.READY) if (status == Db.Model.Status.READY)
this.selectValue(); this.selectValue();
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.rbGroup.setEditable(editable); this.rbGroup.setEditable(editable);
} }
}); });

View File

@ -3,12 +3,12 @@ module.exports = new Class({
Extends: Htk.Field Extends: Htk.Field
,Tag: 'htk-textarea' ,Tag: 'htk-textarea'
,render: function() { ,render() {
var node = this.createRoot('textarea'); var node = this.createRoot('textarea');
node.addEventListener('change', this.changed.bind(this)); node.addEventListener('change', this.changed.bind(this));
} }
,changed: function() { ,changed() {
var value; var value;
if (this.node.value == '') if (this.node.value == '')
@ -19,11 +19,11 @@ module.exports = new Class({
this.valueChanged(value); this.valueChanged(value);
} }
,setEditable: function(editable) { ,setEditable(editable) {
this.node.readOnly = !editable; this.node.readOnly = !editable;
} }
,putValue: function(value) { ,putValue(value) {
if (!value) if (!value)
this.node.value = ''; this.node.value = '';
else else

View File

@ -11,11 +11,11 @@ module.exports = new Class
format: format:
{ {
type: String type: String
,set: function(x) { ,set(x) {
this._format = _(x); this._format = _(x);
this.putValue(this._value); this.putValue(this._value);
} }
,get: function() { ,get() {
return this._format; return this._format;
} }
} }
@ -23,11 +23,11 @@ module.exports = new Class
,_format: null ,_format: null
,render: function() { ,render() {
this._node = this.createTextNode(''); this._node = this.createTextNode('');
} }
,putValue: function(value) { ,putValue(value) {
this._node.nodeValue = Vn.Value.format(value, this._format); this._node.nodeValue = Vn.Value.format(value, this._format);
} }
}); });

View File

@ -16,7 +16,7 @@ module.exports =
* *
* @param {String} message The message text * @param {String} message The message text
*/ */
,showMessage: function(message) { ,showMessage(message) {
this._showText(message, 'message'); this._showText(message, 'message');
} }
@ -25,7 +25,7 @@ module.exports =
* *
* @param {String} message The message text * @param {String} message The message text
*/ */
,showWarning: function(message) { ,showWarning(message) {
this._showText(message, 'warning'); this._showText(message, 'warning');
} }
@ -34,22 +34,22 @@ module.exports =
* *
* @param {String} message The message text * @param {String} message The message text
*/ */
,showError: function(message) { ,showError(message) {
this._showText(message, 'error'); this._showText(message, 'error');
} }
,pushTop: function(top) { ,pushTop(top) {
this._topHeap.push(top); this._topHeap.push(top);
this._refreshPosition(); this._refreshPosition();
} }
,popTop: function() { ,popTop() {
var top = this._topHeap.pop(); var top = this._topHeap.pop();
this._refreshPosition(); this._refreshPosition();
return top; return top;
} }
,_refreshPosition: function() { ,_refreshPosition() {
if (!this._container) if (!this._container)
return; return;
@ -69,7 +69,7 @@ module.exports =
/** /**
* Hides all currently displayed toast messages. * Hides all currently displayed toast messages.
*/ */
,hide: function() { ,hide() {
if (!this._container) if (!this._container)
return; return;
@ -85,7 +85,7 @@ module.exports =
this.nodes = []; this.nodes = [];
} }
,_createContainer: function() { ,_createContainer() {
if (!this._container) { if (!this._container) {
var container = document.createElement('div'); var container = document.createElement('div');
container.className = 'htk-toast'; container.className = 'htk-toast';
@ -101,7 +101,7 @@ module.exports =
this._refreshPosition(); this._refreshPosition();
} }
,_showText: function(message, className) { ,_showText(message, className) {
this._createContainer(); this._createContainer();
if (this._timeouts.length >= this.maxMessages) if (this._timeouts.length >= this.maxMessages)
@ -122,11 +122,11 @@ module.exports =
setTimeout(this._onShowToastTimeout.bind(this, toast), 50); setTimeout(this._onShowToastTimeout.bind(this, toast), 50);
} }
,_onShowToastTimeout: function(toast) { ,_onShowToastTimeout(toast) {
Vn.Node.addClass(toast, 'show'); Vn.Node.addClass(toast, 'show');
} }
,_onMessageTimeout: function() { ,_onMessageTimeout() {
if (!this._container) if (!this._container)
return; return;
@ -140,7 +140,7 @@ module.exports =
this.hide(); this.hide();
} }
,_onMessageMouseDown: function(event) { ,_onMessageMouseDown(event) {
event.stopPropagation(); event.stopPropagation();
} }
}; };

View File

@ -8,7 +8,7 @@ module.exports = new Class({
Extends: Stmt Extends: Stmt
,Tag: 'sql-delete' ,Tag: 'sql-delete'
,render: function(params) { ,render(params) {
return 'DELETE FROM' return 'DELETE FROM'
+ this.renderTarget(params) + this.renderTarget(params)
+ this.renderIfSet(this.where, 'WHERE', params) + this.renderIfSet(this.where, 'WHERE', params)

View File

@ -12,17 +12,17 @@ module.exports = new Class({
,field: [] ,field: []
,expr: [] ,expr: []
,addSet: function(fieldName, value) { ,addSet(fieldName, value) {
this.field.push(new Field({name: fieldName})); this.field.push(new Field({name: fieldName}));
this.expr.push(new Value({value: value})); this.expr.push(new Value({value: value}));
} }
,addExpr: function(fieldName, expr) { ,addExpr(fieldName, expr) {
this.field.push(new Field({name: fieldName})); this.field.push(new Field({name: fieldName}));
this.expr.push(expr); this.expr.push(expr);
} }
,delSet: function() { ,delSet() {
this.field.splice(0, this.field.length); this.field.splice(0, this.field.length);
this.expr.splice(0, this.expr.length); this.expr.splice(0, this.expr.length);
} }

View File

@ -26,7 +26,7 @@ module.exports = new Class({
} }
} }
,render: function() { ,render() {
return this.renderPreIdent(this.target) return this.renderPreIdent(this.target)
+ this.renderIdent(this.name); + this.renderIdent(this.name);
} }

View File

@ -38,11 +38,11 @@ module.exports = new Class({
/** /**
* Checks if parameter name has been defined and if it has a value. * Checks if parameter name has been defined and if it has a value.
*/ */
,isReady: function(params) { ,isReady(params) {
return this.param != null && params != null && params[this.param] != null; return this.param != null && params != null && params[this.param] != null;
} }
,render: function(params) { ,render(params) {
var newOp = new Operation({type: this.type}); var newOp = new Operation({type: this.type});
newOp.push(new Field({ newOp.push(new Field({
@ -56,7 +56,7 @@ module.exports = new Class({
return newOp.render(params); return newOp.render(params);
} }
,findHolders: function() { ,findHolders() {
return this.param ? [this.param] : null; return this.param ? [this.param] : null;
} }
}); });

View File

@ -13,7 +13,7 @@ module.exports = new Class({
/** /**
* Checks if any of filters childs are ready. * Checks if any of filters childs are ready.
*/ */
,isReady: function(params) { ,isReady(params) {
var exprs = this.exprs; var exprs = this.exprs;
for (var i = exprs.length; i--;) for (var i = exprs.length; i--;)
if (exprs[i].isReady(params)) if (exprs[i].isReady(params))
@ -27,7 +27,7 @@ module.exports = new Class({
* ready is ommitted from the expression. If all of its childs aren't ready * ready is ommitted from the expression. If all of its childs aren't ready
* renders the TRUE expression. * renders the TRUE expression.
*/ */
,render: function(params) { ,render(params) {
var newOp; var newOp;
var newExprs = []; var newExprs = [];

View File

@ -29,16 +29,16 @@ module.exports = new Class({
*/ */
params: { params: {
type: Array type: Array
,set: function(x) { ,set(x) {
this.list = x; this.list = x;
} }
,get: function() { ,get() {
return this.list; return this.list;
} }
} }
} }
,render: function(params) { ,render(params) {
return this.renderPreIdent(this.schema) return this.renderPreIdent(this.schema)
+ this.renderIdent(this.name) + this.renderIdent(this.name)
+ '(' + '('

View File

@ -14,7 +14,7 @@ module.exports = new Class({
} }
} }
,render: function(params) { ,render(params) {
if (params) { if (params) {
var object = params[this.id]; var object = params[this.id];

View File

@ -7,7 +7,7 @@ var Dml = require('./dml');
module.exports = new Class({ module.exports = new Class({
Extends: Dml Extends: Dml
,render: function(params) { ,render(params) {
return 'INSERT INTO' return 'INSERT INTO'
+ this.renderTarget(params) + this.renderTarget(params)
+ ' (' + ' ('

View File

@ -40,7 +40,7 @@ module.exports = new Class({
} }
} }
,render: function(params) { ,render(params) {
return TypeSql[this.type] +' JOIN ' return TypeSql[this.type] +' JOIN '
+ this.target.render(params) + this.target.render(params)
+ this.renderIfSet(this.condition, 'ON', params); + this.renderIfSet(this.condition, 'ON', params);

View File

@ -28,16 +28,16 @@ Klass.implement({
*/ */
targets: { targets: {
type: Array type: Array
,set: function(x) { ,set(x) {
this.list = x; this.list = x;
} }
,get: function() { ,get() {
return this.list; return this.list;
} }
} }
} }
,render: function(params) { ,render(params) {
return '(' return '('
+ this.target.render(params) + this.target.render(params)
+ ' ' + ' '

View File

@ -17,7 +17,7 @@ module.exports = new Class({
,list: [] ,list: []
,appendChild: function(child) { ,appendChild(child) {
this.list.push(child); this.list.push(child);
} }
@ -26,7 +26,7 @@ module.exports = new Class({
* *
* @param {SqlObject} element The element to add * @param {SqlObject} element The element to add
*/ */
,push: function(element) { ,push(element) {
this.list.push(element); this.list.push(element);
} }
@ -35,7 +35,7 @@ module.exports = new Class({
* *
* @param {Number} i The element index * @param {Number} i The element index
*/ */
,splice: function(i) { ,splice(i) {
this.list.splice(i); this.list.splice(i);
} }
@ -44,7 +44,7 @@ module.exports = new Class({
* *
* @param {Number} i The element index * @param {Number} i The element index
*/ */
,get: function(i) { ,get(i) {
return this.list[i]; return this.list[i];
} }

View File

@ -9,30 +9,30 @@ module.exports = new Class({
,objects: [] ,objects: []
,add: function(object) { ,add(object) {
this.objects.push(object.ref()); this.objects.push(object.ref());
object.on('changed', this._onObjectChange, this); object.on('changed', this._onObjectChange, this);
this._onObjectChange(); this._onObjectChange();
} }
,get: function(i) { ,get(i) {
return objects[i]; return objects[i];
} }
,getArray: function() { ,getArray() {
return this.objects; return this.objects;
} }
,remove: function(i) { ,remove(i) {
this._unrefObject(this.objects.splice(i, 1)); this._unrefObject(this.objects.splice(i, 1));
this._onObjectChange(); this._onObjectChange();
} }
,_onObjectChange: function() { ,_onObjectChange() {
this.emit('changed'); this.emit('changed');
} }
,isReady: function() { ,isReady() {
var o = this.objects; var o = this.objects;
if (o.length == 0) if (o.length == 0)
@ -56,12 +56,12 @@ module.exports = new Class({
return ids; return ids;
} }
,_unrefObject: function(object) { ,_unrefObject(object) {
object.disconnect('changed', this._onObjectChange, this); object.disconnect('changed', this._onObjectChange, this);
object.unref(); object.unref();
} }
,_destroy: function() { ,_destroy() {
for (var i = 0; i < this.objects.length; i++) for (var i = 0; i < this.objects.length; i++)
this._unrefObject(this.objects[i]); this._unrefObject(this.objects[i]);

View File

@ -15,16 +15,16 @@ module.exports = new Class({
*/ */
stmts: { stmts: {
type: Array type: Array
,set: function(x) { ,set(x) {
this.list = x; this.list = x;
} }
,get: function() { ,get() {
return this.list; return this.list;
} }
} }
} }
,render: function(params) { ,render(params) {
return this.renderListWs(this.list, params, ";\n"); return this.renderListWs(this.list, params, ";\n");
} }
}); });

View File

@ -10,7 +10,7 @@ module.exports = new Class({
* @param {Object} params The query parameters * @param {Object} params The query parameters
* @return {boolean} %true if the object is ready, %false otherwise * @return {boolean} %true if the object is ready, %false otherwise
*/ */
,isReady: function() { ,isReady() {
return true; return true;
} }
@ -19,7 +19,7 @@ module.exports = new Class({
* *
* @return {Array} An array with the names of the found parameters * @return {Array} An array with the names of the found parameters
*/ */
,findHolders: function() {} ,findHolders() {}
/** /**
* Renders the object as an SQL string. * Renders the object as an SQL string.
@ -27,7 +27,7 @@ module.exports = new Class({
* @param {Object} params The params used to render the object * @param {Object} params The params used to render the object
* @return {string} The SQL string * @return {string} The SQL string
*/ */
,render: function() {} ,render() {}
/** /**
* Renders an objects array. * Renders an objects array.
@ -36,7 +36,7 @@ module.exports = new Class({
* @param {Object} params The parameters * @param {Object} params The parameters
* @return {string} The rendered SQL string * @return {string} The rendered SQL string
*/ */
,renderList: function(list, params) { ,renderList(list, params) {
var sql = ''; var sql = '';
list.forEach(function(item) { list.forEach(function(item) {
@ -54,7 +54,7 @@ module.exports = new Class({
* @param {String} separator The separator between items * @param {String} separator The separator between items
* @return {string} The rendered SQL string * @return {string} The rendered SQL string
*/ */
,renderListWs: function(list, params, separator) { ,renderListWs(list, params, separator) {
var sql = ''; var sql = '';
list.forEach(function(item, i) { list.forEach(function(item, i) {
@ -72,7 +72,7 @@ module.exports = new Class({
* @param {String} identifier The identifier * @param {String} identifier The identifier
* @return {string} The quoted identifier * @return {string} The quoted identifier
*/ */
,renderIdent: function(identifier) { ,renderIdent(identifier) {
return '`'+ identifier +'`'; return '`'+ identifier +'`';
} }
@ -82,7 +82,7 @@ module.exports = new Class({
* @param {String} identifier The identifier * @param {String} identifier The identifier
* @return {string} The quoted identifier * @return {string} The quoted identifier
*/ */
,renderPreIdent: function(identifier) { ,renderPreIdent(identifier) {
if (identifier) if (identifier)
return this.renderIdent(identifier) +'.'; return this.renderIdent(identifier) +'.';
else else
@ -95,7 +95,7 @@ module.exports = new Class({
* @param {String} prefix The rendered string prefix * @param {String} prefix The rendered string prefix
* @return {string} The rendered object with its prefix * @return {string} The rendered object with its prefix
*/ */
,renderIfSet: function(object, prefix, params) { ,renderIfSet(object, prefix, params) {
if (object) if (object)
return ' '+ prefix +' '+ object.render(params); return ' '+ prefix +' '+ object.render(params);
else else

View File

@ -67,16 +67,16 @@ Klass.implement({
}, },
exprs: { exprs: {
type: Array type: Array
,set: function(x) { ,set(x) {
this.list = x; this.list = x;
} }
,get: function() { ,get() {
return this.list; return this.list;
} }
} }
} }
,render: function(params) { ,render(params) {
var operator = ' '+ Operators[this.type] +' '; var operator = ' '+ Operators[this.type] +' ';
return '(' return '('
+ this.renderListWs(this.list, params, operator) + this.renderListWs(this.list, params, operator)

View File

@ -10,11 +10,11 @@ module.exports = new Class({
,expr: [] ,expr: []
,addField: function(fieldName) { ,addField(fieldName) {
this.expr.push(new Field({name: fieldName})); this.expr.push(new Field({name: fieldName}));
} }
,render: function(params) { ,render(params) {
return 'SELECT ' return 'SELECT '
+ this.renderListWs(this.expr, params, ', ') + this.renderListWs(this.expr, params, ', ')
+ ' FROM' + ' FROM'

View File

@ -20,18 +20,18 @@ module.exports = new Class({
,target: [] ,target: []
,addTarget: function(target) { ,addTarget(target) {
this.target.push(target); this.target.push(target);
} }
,renderTarget: function(params) { ,renderTarget(params) {
if (this.target.length > 0) if (this.target.length > 0)
return ' '+ this.renderListWs(this.target, params, ', '); return ' '+ this.renderListWs(this.target, params, ', ');
else else
return ' DUAL'; return ' DUAL';
} }
,renderLimit: function() { ,renderLimit() {
if (this.limit != null) if (this.limit != null)
return ' LIMIT '+ parseInt(this.limit); return ' LIMIT '+ parseInt(this.limit);
else else

View File

@ -17,12 +17,12 @@ module.exports = new Class({
,regexp: /#\w+/g ,regexp: /#\w+/g
,appendChild: function(child) { ,appendChild(child) {
if (child.nodeType === Node.TEXT_NODE) if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent; this.query = child.textContent;
} }
,render: function(params) { ,render(params) {
if (!this.query) if (!this.query)
return null; return null;
@ -34,7 +34,7 @@ module.exports = new Class({
return this.query.replace(this.regexp, replaceFunc); return this.query.replace(this.regexp, replaceFunc);
} }
,findHolders: function() { ,findHolders() {
var ids = this.query.match(this.regexp); var ids = this.query.match(this.regexp);
if (ids) if (ids)

View File

@ -21,7 +21,7 @@ module.exports = new Class({
} }
} }
,render: function() { ,render() {
var sql = this.renderPreIdent(this.schema) var sql = this.renderPreIdent(this.schema)
+ this.renderIdent(this.name); + this.renderIdent(this.name);

View File

@ -7,7 +7,7 @@ var Dml = require('./dml');
module.exports = new Class({ module.exports = new Class({
Extends: Dml Extends: Dml
,render: function(params) { ,render(params) {
var sql = 'UPDATE' var sql = 'UPDATE'
+ this.renderTarget(params) + this.renderTarget(params)
+ ' SET '; + ' SET ';

View File

@ -12,65 +12,65 @@ module.exports = new Class({
,Properties: { ,Properties: {
value: { value: {
type: null type: null
,set: function(x) { ,set(x) {
this._setValue(x); this._setValue(x);
} }
,get: function() { ,get() {
return this._value; return this._value;
} }
}, },
type: { type: {
type: Type type: Type
,set: function(x) { ,set(x) {
this._setType(x); this._setType(x);
} }
,get: function() { ,get() {
return this._type; return this._type;
} }
}, },
param: { param: {
type: Vn.ParamIface type: Vn.ParamIface
,set: function(x) { ,set(x) {
this._setParam(x); this._setParam(x);
} }
,get: function() { ,get() {
return this._param; return this._param;
} }
}, },
lot: { lot: {
type: Vn.LotIface type: Vn.LotIface
,set: function(x) { ,set(x) {
this._setLot(x); this._setLot(x);
} }
,get: function() { ,get() {
return this._lot; return this._lot;
} }
}, },
name: { name: {
type: String type: String
,set: function(x) { ,set(x) {
this._name = x; this._name = x;
this._onLotChange(); this._onLotChange();
} }
,get: function() { ,get() {
return this._name; return this._name;
} }
}, },
oneWay: { oneWay: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._oneWay = x; this._oneWay = x;
} }
,get: function() { ,get() {
return this._oneWay; return this._oneWay;
} }
}, },
oneTime: { oneTime: {
type: Boolean type: Boolean
,set: function(x) { ,set(x) {
this._oneTime = x; this._oneTime = x;
} }
,get: function() { ,get() {
return this._oneTime; return this._oneTime;
} }
} }
@ -78,11 +78,11 @@ module.exports = new Class({
,regexp: new RegExp('(\\\\)|\'', 'g') ,regexp: new RegExp('(\\\\)|\'', 'g')
,isReady: function() { ,isReady() {
return this._value !== undefined; return this._value !== undefined;
} }
,replaceFunc: function(token) { ,replaceFunc(token) {
switch (token) { switch (token) {
case '\\': return '\\\\'; case '\\': return '\\\\';
case '\'': return '\\\''; case '\'': return '\\\'';
@ -91,7 +91,7 @@ module.exports = new Class({
return token; return token;
} }
,render: function() { ,render() {
var v = this._value; var v = this._value;
switch (typeof v) { switch (typeof v) {

View File

@ -1,29 +1,29 @@
module.exports = { module.exports = {
getPageYOffset: function() { getPageYOffset() {
return window.pageYOffset; return window.pageYOffset;
}, },
getPageXOffset: function() { getPageXOffset() {
return window.pageXOffset; return window.pageXOffset;
}, },
getInnerHeight: function() { getInnerHeight() {
return window.innerHeight; return window.innerHeight;
}, },
getInnerWidth: function() { getInnerWidth() {
return window.innerWidth; return window.innerWidth;
}, },
createRadio: function(uid, doc) { createRadio(uid, doc) {
var radio = doc.createElement('input'); var radio = doc.createElement('input');
radio.type = 'radio'; radio.type = 'radio';
radio.name = uid; radio.name = uid;
return radio; return radio;
}, },
setInputTypeNumber: function(input) { setInputTypeNumber(input) {
input.type = 'number'; input.type = 'number';
} }
}; };

View File

@ -24,7 +24,7 @@ module.exports = new Class({
* @param {String} path The XML path * @param {String} path The XML path
* @return {Boolean} %true on success, %false othersise * @return {Boolean} %true on success, %false othersise
*/ */
,compileFile: function(path) { ,compileFile(path) {
this._path = path; this._path = path;
return this.compileDocument(Vn.getXml(path)); return this.compileDocument(Vn.getXml(path));
} }
@ -35,7 +35,7 @@ module.exports = new Class({
* @param {String} xmlString The XML string * @param {String} xmlString The XML string
* @return {Boolean} %true on success, %false othersise * @return {Boolean} %true on success, %false othersise
*/ */
,compileString: function(xmlString) { ,compileString(xmlString) {
const parser = new DOMParser(); const parser = new DOMParser();
const doc = parser.parseFromString(xmlString, 'text/xml'); const doc = parser.parseFromString(xmlString, 'text/xml');
return this.compileDocument(doc); return this.compileDocument(doc);
@ -47,7 +47,7 @@ module.exports = new Class({
* @param {Document} doc The DOM document * @param {Document} doc The DOM document
* @return {Boolean} %true on success, %false othersise * @return {Boolean} %true on success, %false othersise
*/ */
,compileDocument: function(doc) { ,compileDocument(doc) {
if (!doc) if (!doc)
return false; return false;
@ -75,7 +75,7 @@ module.exports = new Class({
* @path Node The DOM node * @path Node The DOM node
* @return %true on success, %false othersise * @return %true on success, %false othersise
*/ */
,compileNode: function(node) { ,compileNode(node) {
this._preCompile(); this._preCompile();
this._mainContext = this._compile(node).id; this._mainContext = this._compile(node).id;
this._postCompile(); this._postCompile();
@ -85,7 +85,7 @@ module.exports = new Class({
/** /**
* Called before starting to compile nodes. * Called before starting to compile nodes.
*/ */
,_preCompile: function() { ,_preCompile() {
this._path = null; this._path = null;
this._tags = {}; this._tags = {};
this._contexts = []; this._contexts = [];
@ -102,7 +102,7 @@ module.exports = new Class({
/** /**
* Called after all nodes have been compiled. * Called after all nodes have been compiled.
*/ */
,_postCompile: function() { ,_postCompile() {
for (const compiler of this._compilers) for (const compiler of this._compilers)
compiler.postCompile(this._contextMap); compiler.postCompile(this._contextMap);
} }
@ -110,7 +110,7 @@ module.exports = new Class({
/** /**
* Compiles a node. * Compiles a node.
*/ */
,_compile: function(node) { ,_compile(node) {
let context = null; let context = null;
let tagName = null; let tagName = null;
const isElement = node.nodeType === Node.ELEMENT_NODE; const isElement = node.nodeType === Node.ELEMENT_NODE;
@ -148,7 +148,7 @@ module.exports = new Class({
return context; return context;
} }
,load: function(dstDocument, thisArg, parentScope) { ,load(dstDocument, thisArg, parentScope) {
if (!this._contexts) return null; if (!this._contexts) return null;
const doc = dstDocument ? dstDocument : document; const doc = dstDocument ? dstDocument : document;
const objects = new Array(this._contexts.length); const objects = new Array(this._contexts.length);
@ -156,7 +156,7 @@ module.exports = new Class({
return new Scope(this, doc, objects, exprValues, thisArg, parentScope); return new Scope(this, doc, objects, exprValues, thisArg, parentScope);
} }
,showError: function(error) { ,showError(error) {
const path = this._path ? this._path : 'Node'; const path = this._path ? this._path : 'Node';
const logArgs = ['Vn.Builder: %s: '+ error, path]; const logArgs = ['Vn.Builder: %s: '+ error, path];

View File

@ -8,7 +8,7 @@ const VnNode = require('./node');
module.exports = new Class({ module.exports = new Class({
Extends: Compiler Extends: Compiler
,compile: function(builder, node, tagName) { ,compile(builder, node, tagName) {
const context = { const context = {
tagName, tagName,
attributes: {}, attributes: {},
@ -44,7 +44,7 @@ const VnNode = require('./node');
return context; return context;
} }
,instantiate: function(doc, context, scope) { ,instantiate(doc, context, scope) {
const object = doc.createElement(context.tagName); const object = doc.createElement(context.tagName);
const attributes = context.attributes; const attributes = context.attributes;
@ -64,7 +64,7 @@ const VnNode = require('./node');
object.setAttribute(property, value); object.setAttribute(property, value);
} }
,link: function(context, object, objects, scope) { ,link(context, object, objects, scope) {
const childs = context.childs; const childs = context.childs;
for (let i = 0; i < childs.length; i++) { for (let i = 0; i < childs.length; i++) {
let child = objects[childs[i]]; let child = objects[childs[i]];

Some files were not shown because too many files have changed in this diff Show More