-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
AddEditNew
@@ -38,11 +38,11 @@
-
+
-
+
SELECT name, description FROM news_tag
diff --git a/forms/news/news/news.js b/forms/news/news/news.js
index 9b1ceda2..9465449f 100644
--- a/forms/news/news/news.js
+++ b/forms/news/news/news.js
@@ -19,7 +19,7 @@ Hedera.News = new Class
,onAddClick: function ()
{
- this.hash.set ({
+ this.hash.setAll ({
'form': 'news/new',
'new': 0
});
diff --git a/forms/news/news/ui.xml b/forms/news/news/ui.xml
index 2466c3f6..5db940b5 100755
--- a/forms/news/news/ui.xml
+++ b/forms/news/news/ui.xml
@@ -23,15 +23,15 @@
-
+
-
+
Priority
-
+
diff --git a/forms/preview/preview.js b/forms/preview/preview.js
index 99056385..98562d47 100644
--- a/forms/preview/preview.js
+++ b/forms/preview/preview.js
@@ -5,7 +5,7 @@ Hedera.Preview = new Class
,activate: function ()
{
- var reportName = Vn.Hash.get ('report');
+ var reportName = this.hash.get ('report');
if (!reportName)
{
@@ -34,15 +34,12 @@ Hedera.Preview = new Class
Htk.Toast.showError (_('Error loading report'));
return;
}
-
- var batch = new Sql.Batch ();
- batch.addValues (Vn.Hash._hashMap);
this.report = new module.klass ({
info: module,
conn: this.conn
});
- this.report.open (batch, this.node);
+ this.report.open (this.hash, this.node);
}
,onPrintClick: function ()
diff --git a/js/db/connection.js b/js/db/connection.js
index 2100f479..83cbbf9f 100644
--- a/js/db/connection.js
+++ b/js/db/connection.js
@@ -56,11 +56,11 @@ Connection.implement
*
* @param {Sql.Stmt} stmt The statement
* @param {Function} callback The function to call when operation is done
- * @param {Sql.Batch} batch The batch used to set the parameters
+ * @param {Object} params The statement parameters
*/
- ,execStmt: function (stmt, callback, batch)
+ ,execStmt: function (stmt, callback, params)
{
- this.execSql (stmt.render (batch), callback);
+ this.execSql (stmt.render (params), callback);
}
/**
@@ -68,11 +68,11 @@ Connection.implement
*
* @param {String} query The SQL statement
* @param {Function} callback The function to call when operation is done
- * @param {Sql.Batch} batch The batch used to set the parameters
+ * @param {Object} params The statement parameters
*/
- ,execQuery: function (query, callback, batch)
+ ,execQuery: function (query, callback, params)
{
- this.execStmt (new Sql.String ({query: query}), callback, batch);
+ this.execStmt (new Sql.String ({query: query}), callback, params);
}
/*
diff --git a/js/db/db.js b/js/db/db.js
index e1ba4ec9..901b7e6b 100644
--- a/js/db/db.js
+++ b/js/db/db.js
@@ -9,7 +9,6 @@ Db = module.exports = {
,Iterator : require ('./iterator')
,SimpleIterator : require ('./simple-iterator')
,Form : require ('./form')
- ,Param : require ('./param')
,Query : require ('./query')
,Calc : require ('./calc')
,CalcSum : require ('./calc-sum')
diff --git a/js/db/model.js b/js/db/model.js
index 28f3e5b5..b33afeef 100644
--- a/js/db/model.js
+++ b/js/db/model.js
@@ -101,6 +101,22 @@ Model.implement
return this._batch;
}
},
+ /**
+ * The lot used to execute the statement.
+ */
+ lot:
+ {
+ type: Vn.Lot
+ ,set: function (x)
+ {
+ this.link ({_lot: x}, {'change': this._autoLoad});
+ this._autoLoad ();
+ }
+ ,get: function ()
+ {
+ return this._lot;
+ }
+ },
/**
* The model select statement.
*/
diff --git a/js/db/param.js b/js/db/param.js
deleted file mode 100644
index 00c77baa..00000000
--- a/js/db/param.js
+++ /dev/null
@@ -1,97 +0,0 @@
-
-var Form = require ('./form');
-
-module.exports = new Class
-({
- Extends: Vn.Param
- ,Tag: 'db-param'
- ,Parent: 'form'
- ,Properties:
- {
- /**
- * The form field referenced by this param.
- */
- column:
- {
- type: String
- ,set: function (x)
- {
- this._columnName = x;
- this.refresh ();
- }
- ,get: function ()
- {
- this._columnName;
- }
- },
- /**
- * The form referenced by this param.
- */
- form:
- {
- type: Form
- ,set: function (x)
- {
- this.link ({_set: x},
- {
- 'change': this.onSetChange
- });
-
- this.refresh ();
- }
- ,get: function ()
- {
- return this._set;
- }
- },
- /**
- * Determines whether the link to the form is unidirectional, ie, a
- * change in the form updates the parameter but not vice versa.
- */
- oneWay:
- {
- type: Boolean
- ,set: function (x)
- {
- this._oneWay = x;
- }
- ,get: function ()
- {
- return this._oneWay;
- }
- }
- }
-
- ,_columnName: null
- ,_set: null
- ,_setLock: false
- ,_oneWay: false
- ,_setValue: null
-
- ,initialize: function (props)
- {
- this.parent (props);
- this.on ('changed', this.onChange, this);
- }
-
- ,refresh: function ()
- {
- if (this._set)
- this.onSetChange ();
- }
-
- ,onSetChange: function ()
- {
- this._setLock = true;
- var formValue = this._set.get (this._columnName);
- this.value = formValue;
- this._setLock = false;
- }
-
- ,onChange: function ()
- {
- if (!this._setLock && this._columnName && !this.oneWay)
- this._set.set (this._columnName, this._value);
- }
-});
-
diff --git a/js/db/query.js b/js/db/query.js
index cb30a7aa..9670c028 100644
--- a/js/db/query.js
+++ b/js/db/query.js
@@ -56,19 +56,19 @@ module.exports = new Class
}
},
/**
- * The batch used to execute the statement.
+ * The lot used to execute the statement.
*/
- batch:
+ lot:
{
- type: Sql.Batch
+ type: Vn.Lot
,set: function (x)
{
- this.link ({_batch: x}, {'changed': this.onChange});
- this.onChange ();
+ this.link ({_lot: x}, {'change': this.onChange});
+ this._autoLoad ();
}
,get: function ()
{
- return this._batch;
+ return this._lot;
}
},
/**
@@ -81,11 +81,6 @@ module.exports = new Class
}
}
- ,initialize: function (props)
- {
- this.parent (props);
- }
-
,loadXml: function (builder, node)
{
this.parent (builder, node);
diff --git a/js/hedera/app.js b/js/hedera/app.js
index 6871c10b..6f69dbd3 100644
--- a/js/hedera/app.js
+++ b/js/hedera/app.js
@@ -21,7 +21,7 @@ module.exports = new Class
{
window.onerror = this._onWindowError.bind (this);
window.onunload = this._onWindowUnload.bind (this);
- Vn.Hash.initialize ();
+ this._hash = new Vn.Hash ({window: window});
var conn = new Db.Connection ();
this.link ({_conn: conn}, {'error': this._onConnError});
@@ -34,7 +34,10 @@ module.exports = new Class
if (this.tryAutoLogin ())
return;
- var login = this._login = new Login ({conn: this._conn});
+ var login = this._login = new Login ({
+ conn: this._conn,
+ hash: this._hash
+ });
login.on ('login', this._onLogin, this);
login.show ();
}
@@ -43,7 +46,10 @@ module.exports = new Class
{
this._freeLogin ();
- var gui = this._gui = new Gui ({conn: this._conn});
+ var gui = this._gui = new Gui ({
+ conn: this._conn,
+ hash: this._hash
+ });
gui.on ('logout', this._onLogout, this);
gui.show ();
}
@@ -82,7 +88,7 @@ module.exports = new Class
this._logout ();
break;
case 'OutdatedVersion':
- this._newVersion (error);
+ this._newVersion ();
break;
default:
Htk.Toast.showError (error.message);
@@ -100,7 +106,7 @@ module.exports = new Class
this._gui.logout ();
}
- ,_newVersion: function (error)
+ ,_newVersion: function ()
{
if (this.ignoreVersion)
return;
@@ -162,6 +168,7 @@ module.exports = new Class
this._freeGui ();
this.deinitAutoLogin ();
this._conn.unref ();
+ this._hash.unref ();
}
// Auto login functionality
@@ -170,15 +177,17 @@ module.exports = new Class
,initAutoLogin: function ()
{
- var isGuest = new Vn.HashParam
+ var isGuest = new Vn.Param
({
+ lot: this._hash,
type: Boolean,
key: 'guest'
});
this.link ({_isGuest: isGuest}, {'changed': this._onGuestChange});
- var token = new Vn.HashParam
+ var token = new Vn.Param
({
+ lot: this._hash,
type: String,
key: 'token'
});
diff --git a/js/hedera/basket-checker.js b/js/hedera/basket-checker.js
index 253d8bba..6a36c209 100644
--- a/js/hedera/basket-checker.js
+++ b/js/hedera/basket-checker.js
@@ -1,8 +1,9 @@
module.exports =
{
- check: function (conn, callback)
+ check: function (conn, hash, callback)
{
+ this.hash = hash;
conn.execQuery ('CALL basketCheck ()',
this._onBasketCheck.bind (this, callback));
}
@@ -10,7 +11,7 @@ module.exports =
,_onBasketCheck: function (callback, resultSet)
{
var status = resultSet.fetchValue ();
-
+
if (!status)
return;
@@ -21,6 +22,6 @@ module.exports =
if (callback)
callback (isOk);
if (!isOk)
- Vn.Hash.set ({'form': 'ecomerce/checkout'});
+ this.hash.setAll ({'form': 'ecomerce/checkout'});
}
};
diff --git a/js/hedera/form.js b/js/hedera/form.js
index 786d2fb3..b09a423f 100644
--- a/js/hedera/form.js
+++ b/js/hedera/form.js
@@ -23,6 +23,7 @@ module.exports = new Class
var builder = new Vn.Builder ();
builder.signalData = this;
builder.add ('conn', this.conn);
+ builder.add ('hash', this.hash);
builder.loadXml ('forms/'+ this.formInfo.path +'/ui.xml');
var res = this.builderResultInit (builder);
diff --git a/js/hedera/gui.css b/js/hedera/gui.css
index b554fcf2..3bb52633 100644
--- a/js/hedera/gui.css
+++ b/js/hedera/gui.css
@@ -318,7 +318,7 @@
{
margin-left: 0;
}
- .vn-gui .menu-button
+ .vn-gui .navbar .menu-button
{
display: block;
}
diff --git a/js/hedera/gui.js b/js/hedera/gui.js
index da9282ac..a1dfebca 100644
--- a/js/hedera/gui.js
+++ b/js/hedera/gui.js
@@ -77,10 +77,13 @@ module.exports = new Class
window.addEventListener ('scroll', this._onScrollHandler );
}
- this.hash = Vn.Hash;
- this.formParam = new Vn.HashParam ({key: 'form'});
+ this.formParam = new Vn.Param ({
+ lot: this.hash,
+ type: String,
+ key: 'form'
+ });
this.formParam.on ('changed', this._onFormChange, this);
-
+
if (!localStorage.getItem ('hederaCookies'))
{
localStorage.setItem ('hederaCookies', true);
@@ -220,7 +223,7 @@ module.exports = new Class
if (res.get ('path'))
{
- a.href = Vn.Hash.make ({'form': res.get ('path')});
+ a.href = this.hash.make ({'form': res.get ('path')});
this.menuOptions[res.get ('path')] = a;
}
@@ -374,7 +377,7 @@ module.exports = new Class
,_onFormChange: function ()
{
var formPath = this.formParam.value;
-
+
if (!formPath)
formPath = Vn.Config['default_form'];
@@ -475,7 +478,7 @@ module.exports = new Class
form: 'preview',
report: reportName
};
- Vn.Hash.set (Object.assign (hashParams, params));
+ this.hash.setAll (Object.assign (hashParams, params));
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant
diff --git a/js/hedera/report.js b/js/hedera/report.js
index 36e95631..9316032b 100644
--- a/js/hedera/report.js
+++ b/js/hedera/report.js
@@ -3,6 +3,11 @@ module.exports = new Class
({
Extends: Htk.Component
+ ,activate: function ()
+ {
+ this.renderReport ();
+ }
+
,open: function (batch, body)
{
this.batch = batch;
@@ -11,11 +16,6 @@ module.exports = new Class
this.activate (batch, body);
}
- ,activate: function (batch, body)
- {
- this.renderReport ();
- }
-
,openIframe: function (batch)
{
this.batch = batch;
diff --git a/js/hedera/social-bar.js b/js/hedera/social-bar.js
index 0ff058f3..16ed1e41 100644
--- a/js/hedera/social-bar.js
+++ b/js/hedera/social-bar.js
@@ -46,12 +46,10 @@ module.exports = new Class
if (!this._conn || this._priority === null)
return;
- var batch = new Sql.Batch ();
- batch.addValue ('priority', this._priority);
-
+ var params = {priority: this._priority};
var query = 'SELECT title, link, icon FROM social '
+'WHERE priority >= #priority ORDER BY priority';
- this._conn.execQuery (query, this._onQueryDone.bind (this), batch);
+ this._conn.execQuery (query, this._onQueryDone.bind (this), params);
}
,_onQueryDone: function (resultSet)
diff --git a/js/hedera/style.css b/js/hedera/style.css
index 8374650c..e4140d05 100644
--- a/js/hedera/style.css
+++ b/js/hedera/style.css
@@ -56,15 +56,15 @@
}
/* Mobile - High DPI */
-@media screen and
- (max-device-width: 411px) and (min-resolution: 249dpi),
- (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3)
+@media
+ screen and (max-device-width: 411px) and (min-resolution: 249dpi),
+ screen and (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3)
{
body { font-size: 10pt; }
}
-@media screen and
- (min-device-width: 412px) and (min-resolution: 249dpi),
- (min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3)
+@media
+ screen and (min-device-width: 412px) and (min-resolution: 249dpi),
+ screen and (min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3)
{
body { font-size: 11pt; }
}
@@ -160,6 +160,7 @@ button,
.clickable
{
transition: background-color 200ms ease-out;
+ -webkit-transition: background-color 200ms ease-out;
}
button:hover,
.list-row:hover,
@@ -171,6 +172,7 @@ button:hover,
.clickable-img
{
transition: opacity 200ms ease-out;
+ -webkit-transition: opacity 200ms ease-out;
}
.clickable-img:hover
{
diff --git a/js/hedera/tpv.js b/js/hedera/tpv.js
index ec276777..d87879b2 100644
--- a/js/hedera/tpv.js
+++ b/js/hedera/tpv.js
@@ -8,17 +8,17 @@ module.exports = new Class
,check: function (callback)
{
- this.tpvOrder = Vn.Hash.get ('tpvOrder');
- this.tpvStatus = Vn.Hash.get ('tpvStatus');
+ this.tpvOrder = this.hash.get ('tpvOrder');
+ this.tpvStatus = this.hash.get ('tpvStatus');
if (this.tpvStatus)
{
- var batch = new Sql.Batch ();
- batch.addValue ('transaction', this.tpvOrder);
- batch.addValue ('status', this.tpvStatus);
-
var query = 'CALL transactionEnd (#transaction, #status)';
- this.conn.execQuery (query, null, batch);
+ var params = {
+ transaction: this.tpvOrder,
+ status: this.tpvStatus
+ };
+ this.conn.execQuery (query, null, params);
}
if (callback)
@@ -35,10 +35,10 @@ module.exports = new Class
if (amount > 0)
{
var params = {
- 'amount': parseInt (amount)
- ,'urlOk': this._makeUrl ('ok')
- ,'urlKo': this._makeUrl ('ko')
- ,'company': company
+ amount: parseInt (amount)
+ ,urlOk: this._makeUrl ('ok')
+ ,urlKo: this._makeUrl ('ko')
+ ,company: company
};
this.conn.send ('tpv/transaction', params,
@@ -48,7 +48,7 @@ module.exports = new Class
Htk.Toast.showError (_('AmountError'));
}
- ,_onTransactionStart: function (json, error)
+ ,_onTransactionStart: function (json)
{
if (json)
{
@@ -59,9 +59,9 @@ module.exports = new Class
var fieldsMap =
{
- 'Ds_SignatureVersion': 'HMAC_SHA256_V1'
- ,'Ds_MerchantParameters': json.params
- ,'Ds_Signature': json.signature
+ Ds_SignatureVersion: 'HMAC_SHA256_V1'
+ ,Ds_MerchantParameters: json.params
+ ,Ds_Signature: json.signature
};
for (var field in fieldsMap)
@@ -83,15 +83,13 @@ module.exports = new Class
,retryPay: function ()
{
- var batch = new Sql.Batch ();
- batch.addValue ('transaction', parseInt (this.tpvOrder));
-
var query = 'SELECT t.amount, m.company_id '
+'FROM tpv_transaction_view t '
+'JOIN tpv_merchant m ON t.merchant_id = m.id '
+'WHERE t.id = #transaction';
+ var params = {transaction: parseInt (this.tpvOrder)};
this.conn.execQuery (query,
- this._onRetryPayDone.bind (this), batch);
+ this._onRetryPayDone.bind (this), params);
}
,_onRetryPayDone: function (resultSet)
@@ -104,13 +102,13 @@ module.exports = new Class
Htk.Toast.showError (_('AmountError'));
}
- ,_makeUrl: function (status, order)
+ ,_makeUrl: function (status)
{
var path = location.protocol +'//'+ location.host;
path += location.port ? ':'+ location.port : '';
path += location.pathname;
path += location.search ? location.search : '';
- path += Vn.Hash.make ({
+ path += this.hash.make ({
'form': 'ecomerce/orders',
'tpvStatus': status,
'tpvOrder': '%s'
diff --git a/js/htk/field.js b/js/htk/field.js
index 7d8ef106..086fafe4 100644
--- a/js/htk/field.js
+++ b/js/htk/field.js
@@ -5,7 +5,6 @@ module.exports = new Class
({
Extends: Widget
,Tag: 'htk-field'
- ,Child: 'param'
,Properties:
{
value:
@@ -22,7 +21,7 @@ module.exports = new Class
this.valueChanged (x);
this.putValue (x);
}
- ,get: function (x)
+ ,get: function ()
{
return this._value;
}
@@ -56,22 +55,22 @@ module.exports = new Class
return this._editable;
}
},
- form:
+ lot:
{
type: Db.Iterator
,set: function (x)
{
- this._form = x;
- this.bindToForm ();
+ this._lot = x;
+ this.bindToLot ();
}
},
- column:
+ name:
{
type: String
,set: function (x)
{
this._paramName = x;
- this.bindToForm ();
+ this.bindToLot ();
}
},
conditionalFunc:
@@ -97,13 +96,13 @@ module.exports = new Class
}
}
- ,bindToForm: function ()
+ ,bindToLot: function ()
{
- if (this._form && this._paramName)
- this.param = new Db.Param
+ if (this._lot && this._paramName)
+ this.param = new Vn.Param
({
- form: this._form
- ,column: this._paramName
+ lot: this._lot
+ ,name: this._paramName
});
}
diff --git a/js/sql/batch.js b/js/sql/batch.js
deleted file mode 100644
index ef88ae52..00000000
--- a/js/sql/batch.js
+++ /dev/null
@@ -1,169 +0,0 @@
-
-var Object = require ('./object');
-var Value = require ('./value');
-
-/**
- * A map container for many Sql.Object
- */
-module.exports = new Class
-({
- Extends: Object
- ,Tag: 'sql-batch'
- ,Properties:
- {
- blocked:
- {
- type: Boolean
- ,set: function (x)
- {
- this._blocked = x;
- }
- ,get: function ()
- {
- return this._blocked;
- }
- }
- }
-
- ,objects: {}
- ,_blocked: false
-
- ,loadXml: function (builder, node)
- {
- this.parent (builder, node);
-
- var childs = node.childNodes;
-
- for (var i = 0; i < childs.length; i++)
- if (childs[i].tagName && childs[i].tagName.toLowerCase () == 'item')
- {
- var object;
- var id = childs[i].getAttribute ('name');
-
- if (id)
- {
- if (object = builder.getById (childs[i].getAttribute ('param')))
- this.addParam (id, object);
- else if (object = builder.getById (childs[i].getAttribute ('object')))
- this.addObject (id, object);
- }
- }
- }
-
- ,get: function (id)
- {
- if (this.objects[id])
- return this.objects[id];
-
- return null;
- }
-
- ,add: function (id)
- {
- if (!this.objects[id])
- this.objects[id] = null;
- }
-
- ,_addObject: function (id, object)
- {
- this.remove (id);
- this.objects[id] = object;
- object.on ('changed', this.emitChanged, this);
- this.emitChanged ();
- }
-
- ,addObject: function (id, object)
- {
- this._addObject (id, object.ref ());
- }
-
- ,addValue: function (id, value)
- {
- this._addObject (id,
- new Value ({value: value}));
- }
-
- ,addValues: function (values)
- {
- for (var id in values)
- this.addValue (id, values[id]);
- }
-
- ,addParam: function (id, param)
- {
- this._addObject (id,
- new Value ({param: param}));
- }
-
- ,getValue: function (id)
- {
- var object = this.objects[id];
-
- if (object instanceof Value)
- return object.value;
-
- return null;
- }
-
- ,addParams: function (params)
- {
- for (var id in params)
- this.addParam (id, params[id]);
- }
-
- ,remove: function (id)
- {
- if (this.objects[id])
- {
- this._unrefObject (this.objects[id]);
- delete this.objects[id];
- }
- }
-
- ,block: function ()
- {
- this._blocked = true;
- }
-
- ,unblock: function ()
- {
- this._blocked = false;
- }
-
- ,emitChanged: function ()
- {
- if (!this._blocked)
- this.signalEmit ('changed');
- }
-
- ,changed: function ()
- {
- this.signalEmit ('changed');
- }
-
- ,isReady: function ()
- {
- for (var id in this.objects)
- if (!(this.objects[id] && this.objects[id].isReady ()))
- return false;
-
- return true;
- }
-
- ,_unrefObject: function (object)
- {
- if (object)
- {
- object.disconnect ('changed', this.emitChanged, this);
- object.unref ();
- }
- }
-
- ,_destroy: function ()
- {
- for (var id in this.objects)
- this._unrefObject (this.objects[id]);
-
- this.parent ();
- }
-});
diff --git a/js/sql/holder.js b/js/sql/holder.js
index 34777aca..3ca40e0d 100644
--- a/js/sql/holder.js
+++ b/js/sql/holder.js
@@ -1,12 +1,13 @@
-var Object = require ('./object');
+var SqlObject = require ('./object');
+var Value = require ('./value');
/**
* A holder for another object.
*/
module.exports = new Class
({
- Extends: Object
+ Extends: SqlObject
,Properties:
{
id:
@@ -16,12 +17,21 @@ module.exports = new Class
}
}
- ,render: function (batch)
+ ,render: function (params)
{
var object;
- if (batch && (object = batch.get (this.id)))
- return object.render (batch);
+ if (params && (object = params[this.id]))
+ {
+ if (!(object instanceof SqlObject))
+ {
+ var sqlValue = new Value ();
+ sqlValue.value = object;
+ return sqlValue.render ();
+ }
+ else
+ return object.render (params);
+ }
return '#'+ this.id;
}
diff --git a/js/sql/object.js b/js/sql/object.js
index 284756f2..7d936cf6 100644
--- a/js/sql/object.js
+++ b/js/sql/object.js
@@ -8,10 +8,10 @@ module.exports = new Class
/**
* Renders the object as an SQL string.
*
- * @param {Sql.Batch} batch The batch used to render the object
+ * @param {Object} params The params used to render the object
* @return {String} The SQL string
*/
- ,render: function (batch) {}
+ ,render: function () {}
/**
* Gets if the object is ready to be rendered.
@@ -26,7 +26,7 @@ module.exports = new Class
/**
* Through the query looking for containers and adds it to the batch.
*
- * @return {Sql.Batch} batch The batch
+ * @return {Object} The found statement parameters
*/
- ,findHolders: function (batch) {}
+ ,findHolders: function () {}
});
diff --git a/js/sql/sql.js b/js/sql/sql.js
index 7de038f9..3443f157 100644
--- a/js/sql/sql.js
+++ b/js/sql/sql.js
@@ -4,7 +4,6 @@ require ('vn/vn');
Sql = module.exports = {
Object : require ('./object')
,Holder : require ('./holder')
- ,Batch : require ('./batch')
,List : require ('./list')
,Expr : require ('./expr')
,Value : require ('./value')
diff --git a/js/vn/basic-set.js b/js/vn/basic-lot.js
similarity index 93%
rename from js/vn/basic-set.js
rename to js/vn/basic-lot.js
index 093aa3d1..d7ae72ff 100644
--- a/js/vn/basic-set.js
+++ b/js/vn/basic-lot.js
@@ -1,11 +1,11 @@
var Object = require ('./object');
-var Set = require ('./set');
+var Lot = require ('./lot');
module.exports = new Class
({
Extends: Object
- ,Implements: Set
+ ,Implements: Lot
,Tag: 'vn-basic-set'
,Properties:
{
diff --git a/js/vn/hash-listener.js b/js/vn/hash-listener.js
deleted file mode 100644
index 69d3a086..00000000
--- a/js/vn/hash-listener.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-var Object = require ('./object');
-
-/**
- * Class to handle the URL.
- */
-module.exports = new Class
-({
- Extends: Object
-
- ,changed: function ()
- {
- this.signalEmit ('changed');
- }
-});
diff --git a/js/vn/hash-param.js b/js/vn/hash-param.js
deleted file mode 100644
index 4f76666f..00000000
--- a/js/vn/hash-param.js
+++ /dev/null
@@ -1,138 +0,0 @@
-
-var Object = require ('./object');
-var Param = require ('./param');
-var Hash = require ('./hash');
-var Type = require ('./type');
-var VnDate = require ('./date');
-
-module.exports = new Class
-({
- Extends: Object
- ,Tag: 'vn-hash-param'
- ,Child: 'param'
- ,Properties:
- {
- param:
- {
- type: Param
- ,set: function (x)
- {
- this.link ({_param: x}, {'changed': this._onParamChange});
- this._refreshParam ();
- }
- ,get: function ()
- {
- return this._param;
- }
- },
- key:
- {
- type: String
- ,set: function (x)
- {
- this._key = x;
- this._onHashChange ();
- }
- ,get: function ()
- {
- return this._key;
- }
- },
- value:
- {
- type: Object
- ,set: function (x)
- {
- this._setValue (x, true);
- }
- ,get: function ()
- {
- return this._value;
- }
- },
- type:
- {
- type: Type
- ,set: function (x)
- {
- this._type = x;
- this._onHashChange ();
- }
- ,get: function ()
- {
- return this._type;
- }
- }
- }
-
- ,_hashLock: false
- ,_paramLock: false
- ,_value: undefined
- ,_key: null
- ,_type: null
-
- ,initialize: function (props)
- {
- this.parent (props);
- var listener = Hash.getListener ();
- this.link ({_listener: listener}, {'changed': this._onHashChange});
- this._onHashChange ();
- }
-
- ,_onHashChange: function ()
- {
- if (this._hashLock || !this._key || !this._listener)
- return;
-
- var newValue = Hash.get (this._key, this._type);
-
- this._hashLock = true;
- this._setValue (newValue, true);
- this._hashLock = false;
- }
-
- ,_setValue: function (newValue, signal)
- {
- if (newValue == this._value)
- return;
-
- this._value = newValue;
-
- if (this._key && !this._hashLock)
- {
- this._hashLock = true;
-
- var map = {};
- map[this._key] = newValue;
- Hash.add (map);
-
- this._hashLock = false;
- }
-
- this._refreshParam ();
-
- if (signal)
- this.signalEmit ('changed', newValue);
- }
-
- ,_refreshParam: function ()
- {
- if (this._param && !this._paramLock)
- {
- this._paramLock = true;
- this._param.value = this._value;
- this._paramLock = false;
- }
- }
-
- ,_onParamChange: function ()
- {
- if (this._paramLock)
- return;
-
- this._paramLock = true;
- this._setValue (this._param.value);
- this._paramLock = false;
- }
-});
-
diff --git a/js/vn/hash.js b/js/vn/hash.js
index dff2c86d..fee1d9e6 100644
--- a/js/vn/hash.js
+++ b/js/vn/hash.js
@@ -1,58 +1,78 @@
-var HashListener = require ('./hash-listener');
+var VnObject = require ('./object');
var VnDate = require ('./date');
+var Lot = require ('./lot');
/**
* Class to handle the URL.
*/
-module.exports =
-{
- _hash: null
- ,_hashMap: {}
- ,_listener: null
+module.exports = new Class
+({
+ Extends: VnObject
+ ,Implements: Lot
+ ,Properties: {
+ window:
+ {
+ type: Window
+ ,set: function (x)
+ {
+ this._window = x;
+ x.addEventListener ('hashchange', this._hashChangedHandler);
+ this._hashChanged ();
+ }
+ ,get: function ()
+ {
+ return this._window;
+ }
+ },
+ params:
+ {
+ type: Object
+ ,set: function (x)
+ {
+ this.setAll (x);
+ }
+ ,get: function ()
+ {
+ return this._hashMap;
+ }
+ }
+ }
- ,initialize: function ()
+ ,initialize: function (props)
{
- this._listener = new HashListener ();
-
+ this._hash = null;
+ this._hashMap = null;
+ this._window = null;
this._hashChangedHandler = this._hashChanged.bind (this);
- window.addEventListener ('hashchange', this._hashChangedHandler);
- this._hashChanged ();
+ this.parent (props);
}
- ,destroy: function ()
- {
- window.removeEventListener ('hashchange', this._hashChangedHandler);
- }
-
- ,getListener: function ()
- {
- return this._listener;
- }
-
- /**
- * Gets the hash part of the URL.
- *
- * @param {string} key The variable name
- */
,get: function (key, type)
{
return this.parseValue (this._hashMap[key], type);
}
+
+ ,set: function (key, value)
+ {
+ var map = {};
+ map[key] = value;
+ this.assign (map);
+ }
/**
* Sets the hash part of the URL, respecting the current hash variables.
*
* @param {Object} map A key-value map
*/
- ,add: function (map)
+ ,assign: function (map)
{
var newMap = this._hashMap;
for (var key in map)
newMap[key] = map[key];
- this.set (newMap);
+ this.setAll (newMap);
}
/**
@@ -60,7 +80,7 @@ module.exports =
*
* @param {Object} map A key-value map
*/
- ,set: function (map)
+ ,setAll: function (map)
{
if (map)
for (var key in map)
@@ -81,7 +101,7 @@ module.exports =
location.hash = newHash;
this._blockChanged = false;
- this._listener.changed ();
+ this.changed ();
}
}
@@ -106,7 +126,7 @@ module.exports =
if (hash.length > 2)
hash += '&';
- hash += key +'='+ this.renderValue (map[key]);
+ hash += encodeURIComponent (key) +'='+ this.renderValue (map[key]);
}
return hash;
@@ -127,12 +147,12 @@ module.exports =
var kvPair = kvPairs[i].split ('=', 2);
if (kvPair[0])
- newMap[kvPair[0]] = decodeURIComponent (kvPair[1]);
+ newMap[decodeURIComponent (kvPair[0])] = decodeURIComponent (kvPair[1]);
}
this._hashMap = newMap;
this._hash = newHash;
- this._listener.changed ();
+ this.changed ();
}
,renderValue: function (v)
@@ -171,4 +191,11 @@ module.exports =
return v;
}
-};
+
+ ,_destroy: function ()
+ {
+ this._window.removeEventListener ('hashchange', this._hashChangedHandler);
+ this._window = null;
+ this.parent ();
+ }
+});
diff --git a/js/vn/set.js b/js/vn/lot.js
similarity index 100%
rename from js/vn/set.js
rename to js/vn/lot.js
diff --git a/js/vn/param.js b/js/vn/param.js
index 7001198c..c558f23b 100644
--- a/js/vn/param.js
+++ b/js/vn/param.js
@@ -1,71 +1,157 @@
-var Object = require ('./object');
-var Param = require ('./param');
-var Value = require ('./value');
+var VnObject = require ('./object');
+var Lot = require ('./lot');
+var Type = require ('./type');
-/**
- * Simply a linkable value holder.
- */
module.exports = new Class
({
- Extends: Object
+ Extends: VnObject
,Tag: 'vn-param'
+ ,Child: 'param'
,Properties:
{
- value:
+ param:
+ {
+ type: Object
+ ,set: function (x)
+ {
+ this.link ({_param: x}, {'changed': this._onParamChange});
+ this._refreshParam ();
+ }
+ ,get: function ()
+ {
+ return this._param;
+ }
+ },
+ key:
{
type: String
,set: function (x)
{
- if (Value.compare (x, this._value))
- return;
-
- if (x instanceof Date)
- x = x.clone ();
-
- this._value = x;
-
- if (this._master && !this.masterLock)
- {
- this.masterLock = true;
- this._master.value = x;
- this.masterLock = false;
- }
-
- this.signalEmit ('changed', this._value);
+ this._key = x;
+ this._onLotChange ();
+ }
+ ,get: function ()
+ {
+ return this._key;
+ }
+ },
+ value:
+ {
+ type: Object
+ ,set: function (x)
+ {
+ this._setValue (x, true);
}
,get: function ()
{
return this._value;
}
},
- master:
+ type:
{
- type: Param
+ type: Type
,set: function (x)
{
- this.link ({_master: x}, {'changed': this._onMasterChange});
- this._onMasterChange ();
+ this._type = x;
+ this._onLotChange ();
}
,get: function ()
{
- return this._master;
+ return this._type;
+ }
+ },
+ lot:
+ {
+ type: Lot
+ ,set: function (x)
+ {
+ this.link ({_lot: x}, {'change': this._onLotChange});
+ this._onLotChange ();
+ }
+ ,get: function ()
+ {
+ return this._lot;
+ }
+ },
+ /**
+ * Determines whether the link to the form is unidirectional, ie, a
+ * change in the lot updates the parameter but not vice versa.
+ */
+ oneWay:
+ {
+ type: Boolean
+ ,set: function (x)
+ {
+ this._oneWay = x;
+ }
+ ,get: function ()
+ {
+ return this._oneWay;
}
}
}
-
+
+ ,_lotLock: false
+ ,_paramLock: false
,_value: undefined
- ,_master: null
- ,masterLock: false
+ ,_lot: null
+ ,_key: null
+ ,_type: null
+ ,_oneWay: false
- ,_onMasterChange: function ()
+ ,_onLotChange: function ()
{
- if (this.masterLock)
+ if (this._lotLock || !this._key || !this._lot)
+ return;
+
+ var newValue = this._lot.get (this._key, this._type);
+
+ this._lotLock = true;
+ this._setValue (newValue, true);
+ this._lotLock = false;
+ }
+
+ ,_setValue: function (newValue, signal)
+ {
+ if (newValue == this._value)
return;
- this.masterLock = true;
- this.value = this._master.value;
- this.masterLock = false;
+ if (newValue instanceof Date)
+ newValue = newValue.clone ();
+
+ this._value = newValue;
+
+ if (this._lot && this._key && !this._lotLock && !this._oneWay)
+ {
+ this._lotLock = true;
+ this._lot.set (this._key, newValue);
+ this._lotLock = false;
+ }
+
+ this._refreshParam ();
+
+ if (signal)
+ this.signalEmit ('changed', newValue);
+ }
+
+ ,_refreshParam: function ()
+ {
+ if (this._param && !this._paramLock)
+ {
+ this._paramLock = true;
+ this._param.value = this._value;
+ this._paramLock = false;
+ }
+ }
+
+ ,_onParamChange: function ()
+ {
+ if (this._paramLock)
+ return;
+
+ this._paramLock = true;
+ this._setValue (this._param.value);
+ this._paramLock = false;
}
});
-
diff --git a/js/vn/vn.js b/js/vn/vn.js
index 3da01551..b78db811 100644
--- a/js/vn/vn.js
+++ b/js/vn/vn.js
@@ -12,12 +12,10 @@ Vn = module.exports = {
,Value : require ('./value')
,Url : require ('./url')
,Mutators : require ('./mutators')
- ,Set : require ('./set')
- ,BasicSet : require ('./basic-set')
- ,Param : require ('./param')
- ,HashListener : require ('./hash-listener')
+ ,Lot : require ('./lot')
+ ,BasicLot : require ('./basic-lot')
,Hash : require ('./hash')
- ,HashParam : require ('./hash-param')
+ ,Param : require ('./param')
,Node : require ('./node')
,Builder : require ('./builder')
,JsonException : require ('./json-exception')
diff --git a/reports/delivery-note/ui.xml b/reports/delivery-note/ui.xml
index 08db656d..f4c2c3c7 100755
--- a/reports/delivery-note/ui.xml
+++ b/reports/delivery-note/ui.xml
@@ -10,25 +10,25 @@
-
+
-
+
-
+
-
+
-
-
- ( )
+
+
+ ( )
- Delivery
+ Delivery
@@ -37,23 +37,23 @@
CALL clientTicketRowGet(#ticket)
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/webpack.config.js b/webpack.config.js
index 69f283a8..41034d10 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -72,8 +72,8 @@ var devConfig = {
port: wpConfig.devServerPort,
headers: { "Access-Control-Allow-Origin": "*" },
stats: { chunks: false }
- },
- devtool: 'eval-source-map'
+ }/*,
+ devtool: 'eval-source-map'*/
};
var mrgConfig = devMode ? devConfig : prodConfig;
-
-
-
+
-
-
-
-
-