0
1
Fork 0

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ module.exports = new Class({
,Properties: {
value: {
type: String
,set: function(x) {
,set(x) {
if (Vn.Value.compare(x, this._value))
return;
@ -20,82 +20,82 @@ module.exports = new Class({
this.putValue(x);
this._notifyChanges();
}
,get: function() {
,get() {
return this._value;
}
},
param: {
type: Vn.ParamIface
,set: function(x) {
,set(x) {
this._setParam(x);
}
,get: function() {
,get() {
return this._param;
}
},
lot: {
type: Vn.LotIface
,set: function(x) {
,set(x) {
this._setLot(x);
}
,get: function() {
,get() {
return this._lot;
}
},
name: {
type: String
,set: function(x) {
,set(x) {
this._setName(x);
}
,get: function() {
,get() {
return this._name;
}
},
oneWay: {
type: Boolean
,set: function(x) {
,set(x) {
this._oneWay = x;
}
,get: function() {
,get() {
return this._oneWay;
}
},
oneTime: {
type: Boolean
,set: function(x) {
,set(x) {
this._oneTime = x;
}
,get: function() {
,get() {
return this._oneTime;
}
},
editable: {
type: Boolean
,set: function(x) {
,set(x) {
if (x != this._editable) {
this._editable = x;
this.setEditable(x);
}
}
,get: function() {
,get() {
return this._editable;
}
},
form: {
type: Db.Iterator
,set: function(x) {
,set(x) {
this.lot = x;
}
,get: function() {
,get() {
return this._lot;
}
},
column: {
type: String
,set: function(x) {
,set(x) {
this.name = x;
}
,get: function() {
,get() {
return this._name;
}
},
@ -108,7 +108,7 @@ module.exports = new Class({
,_editable: true
,_lockField: false
,_setValue: function(newValue) {
,_setValue(newValue) {
if (!this._putValue(newValue))
return;
@ -131,7 +131,7 @@ module.exports = new Class({
*
* @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
@ -139,7 +139,7 @@ module.exports = new Class({
*
* @param {Object} value The new value for the entry
*/
,putValue: function() {}
,putValue() {}
/**
* 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
*/
,valueChanged: function(value) {
,valueChanged(value) {
this._lockField = true;
this._setValue(value);
this._lockField = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,24 +7,24 @@ module.exports = new Class({
,radioLock: false
,initialize: function(props) {
,initialize(props) {
this.clear();
Htk.Field.prototype.initialize.call(this, props);
}
,clear: function() {
,clear() {
this.name = htkRadioGroupUid++;
this.buttons = [];
}
,createButton: function(value) {
,createButton(value) {
var button = Vn.Browser.createRadio(this.name, this.doc);
button.value = value;
button.radioGroup = this;
return button;
}
,removeButton: function(button) {
,removeButton(button) {
for (var i = 0; i < this.buttons.length; i++)
if (this.buttons === button) {
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
*/
,isSelected: function() {
,isSelected() {
for (var i = 0; i < this.buttons.length; i++)
if (this.buttons[i].value == this.value)
return true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,17 +12,17 @@ module.exports = new Class({
,field: []
,expr: []
,addSet: function(fieldName, value) {
,addSet(fieldName, value) {
this.field.push(new Field({name: fieldName}));
this.expr.push(new Value({value: value}));
}
,addExpr: function(fieldName, expr) {
,addExpr(fieldName, expr) {
this.field.push(new Field({name: fieldName}));
this.expr.push(expr);
}
,delSet: function() {
,delSet() {
this.field.splice(0, this.field.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)
+ 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.
*/
,isReady: function(params) {
,isReady(params) {
return this.param != null && params != null && params[this.param] != null;
}
,render: function(params) {
,render(params) {
var newOp = new Operation({type: this.type});
newOp.push(new Field({
@ -56,7 +56,7 @@ module.exports = new Class({
return newOp.render(params);
}
,findHolders: function() {
,findHolders() {
return this.param ? [this.param] : null;
}
});

View File

@ -13,7 +13,7 @@ module.exports = new Class({
/**
* Checks if any of filters childs are ready.
*/
,isReady: function(params) {
,isReady(params) {
var exprs = this.exprs;
for (var i = exprs.length; i--;)
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
* renders the TRUE expression.
*/
,render: function(params) {
,render(params) {
var newOp;
var newExprs = [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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