diff --git a/package/usr/share/hedera-web/forms/account/address/ui.xml b/package/usr/share/hedera-web/forms/account/address/ui.xml index 3db114cb..89c4076b 100755 --- a/package/usr/share/hedera-web/forms/account/address/ui.xml +++ b/package/usr/share/hedera-web/forms/account/address/ui.xml @@ -1,7 +1,7 @@ - + diff --git a/package/usr/share/hedera-web/forms/admin/access-log/ui.xml b/package/usr/share/hedera-web/forms/admin/access-log/ui.xml index 8a983269..1dff1256 100755 --- a/package/usr/share/hedera-web/forms/admin/access-log/ui.xml +++ b/package/usr/share/hedera-web/forms/admin/access-log/ui.xml @@ -1,7 +1,7 @@ - + diff --git a/package/usr/share/hedera-web/forms/agencies/provinces/provinces.js b/package/usr/share/hedera-web/forms/agencies/provinces/provinces.js index 8e799ba2..b160d5e0 100755 --- a/package/usr/share/hedera-web/forms/agencies/provinces/provinces.js +++ b/package/usr/share/hedera-web/forms/agencies/provinces/provinces.js @@ -2,5 +2,10 @@ Vn.Provinces = new Class ({ Extends: Vn.Module + + ,onReturnClick: function () + { + window.history.back(); + } }); diff --git a/package/usr/share/hedera-web/forms/agencies/provinces/ui.xml b/package/usr/share/hedera-web/forms/agencies/provinces/ui.xml index 08845cec..85fc9fab 100755 --- a/package/usr/share/hedera-web/forms/agencies/provinces/ui.xml +++ b/package/usr/share/hedera-web/forms/agencies/provinces/ui.xml @@ -1,15 +1,22 @@ - +

ByProvince

+
+ +
+
- + CALL vn2008.desglose_volume (#agency) diff --git a/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js b/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js index c131c3a3..8ec0f762 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js +++ b/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js @@ -3,44 +3,36 @@ Vn.Basket = new Class ({ Extends: Vn.Module + ,open: function () + { + if (this.basketChecked) + this.parent (); + } + ,activate: function () { - this.conn.execQuery ('CALL basket_check ()', + Vn.BasketChecker.check (this.conn, this.onBasketCheck.bind (this)); } - ,onBasketCheck: function (resultSet) + ,onBasketCheck: function (isOk) { - var res = resultSet.fetchResult (); - - if (res.next ()) - switch (res.get ('stat')) - { - case 'BAD_CONFIG': - case 'NOT_EXISTS': - this.hash.set ({'form': 'ecomerce/checkout'}); - break; - case 'UPDATED': - (new Htk.Toast ()).showWarning (_('OrderItemsUpdated')); - this.$('order').value = res.get ('order_id'); - break; - case 'OK': - this.$('order').value = res.get ('order_id'); - break; - } + if (!isOk) + return; + + this.basketChecked = true; + this.open (); } ,onConfigureClick: function () { + (new Htk.Toast ()).showWarning (_('RememberReconfiguringImpact')); this.hash.set ({'form': 'ecomerce/checkout'}); } ,onCheckoutClick: function () { - this.hash.set ({ - 'form': 'ecomerce/confirm', - 'order': this.$('order').value - }); + this.hash.set ({'form': 'ecomerce/confirm'}); } ,amountRender: function (renderer, form) @@ -56,7 +48,7 @@ Vn.Basket = new Class ,onAmountChange: function (renderer, row, newValue) { - var model = this.$('order-rows'); + var model = this.$('items'); model.set (row, 'amount', newValue * model.get (row, 'grouping')); } diff --git a/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml index 336216c9..d1db27df 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml @@ -1,18 +1,4 @@ - - - - - SELECT id, date_send, agency_id - FROM basket - - - - - - - -
@@ -31,7 +17,7 @@
- + CALL bionic_from_basket (@calc); SELECT m.id, m.amount, t.available, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura, m.price price, a.Foto @@ -39,9 +25,6 @@ INNER JOIN vn2008.Articles a ON a.Id_Article = m.item_id LEFT JOIN vn2008.Origen o ON a.id_origen = o.id LEFT JOIN cache.bionic t ON m.warehouse_id = t.warehouse_id AND m.item_id = t.item_id AND t.calc_id = @calc; - - - @@ -53,7 +36,7 @@

OrderTotal - +

diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js b/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js index 135d2eb3..bbfe5ac0 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js +++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js @@ -3,10 +3,26 @@ Vn.Catalog = new Class ({ Extends: Vn.Module - ,realmColor: null - + ,open: function () + { + if (this.basketChecked) + this.parent (); + } + ,activate: function () { + Vn.BasketChecker.check (this.conn, + this.onBasketCheck.bind (this)); + } + + ,onBasketCheck: function (isOk) + { + if (!isOk) + return; + + this.basketChecked = true; + this.open (); + this.popup = new Htk.Popup (); this.popup.setChildNode (this.$('lots-popup')); } @@ -33,7 +49,7 @@ Vn.Catalog = new Class ,onTypeChange: function () { - if (Vn.isMobile ()) + if (Vn.isMobile () && this.$('type').value) this.hideMenu (); var realms = this.$('realms-model'); diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml index 7691ba43..87479cba 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml @@ -1,10 +1,10 @@ - + - + diff --git a/package/usr/share/hedera-web/forms/ecomerce/checkout/checkout.js b/package/usr/share/hedera-web/forms/ecomerce/checkout/checkout.js index 1886d6fd..1a470aad 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/checkout/checkout.js +++ b/package/usr/share/hedera-web/forms/ecomerce/checkout/checkout.js @@ -21,7 +21,6 @@ Vn.Checkout = new Class if (orderForm.numRows > 0) { - (new Htk.Toast ()).showWarning (_('RememberReconfiguringImpact')); var i = orderForm; var date = i.get ('date_send'); } diff --git a/package/usr/share/hedera-web/forms/ecomerce/checkout/style.css b/package/usr/share/hedera-web/forms/ecomerce/checkout/style.css index 7e2895c3..854768e3 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/checkout/style.css +++ b/package/usr/share/hedera-web/forms/ecomerce/checkout/style.css @@ -42,12 +42,12 @@ } .address.selected { - background-color: rgba(1, 1, 1, .05); + background-color: rgba(1, 1, 1, .1); } .address:hover { cursor: pointer; - background-color: rgba(1, 1, 1, .1); + background-color: rgba(1, 1, 1, .05); } .address p.consignee { diff --git a/package/usr/share/hedera-web/forms/ecomerce/checkout/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/checkout/ui.xml index b0bc202e..394a2020 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/checkout/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/checkout/ui.xml @@ -1,8 +1,5 @@ - - - diff --git a/package/usr/share/hedera-web/forms/ecomerce/confirm/confirm.js b/package/usr/share/hedera-web/forms/ecomerce/confirm/confirm.js index 5e237567..05536034 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/confirm/confirm.js +++ b/package/usr/share/hedera-web/forms/ecomerce/confirm/confirm.js @@ -2,11 +2,6 @@ Vn.Confirm = new Class ({ Extends: Vn.Module - - ,activate: function () - { - this.tpv = new Vn.Tpv (this.conn, this.hash); - } ,onOrderReady: function (form) { @@ -15,12 +10,12 @@ Vn.Confirm = new Class if (form.get ('method') != 'PICKUP') { - this.$('address').style.display = 'block'; + Vn.Node.show (this.$('address')); Vn.Node.setText (this.$('method'), _('Agency')); } else { - this.$('address').style.display = 'none'; + Vn.Node.hide (this.$('address')); Vn.Node.setText (this.$('method'), _('Warehouse')); } } @@ -72,7 +67,7 @@ Vn.Confirm = new Class this.popup.hide (); if (this.pay) - this.tpv.pay (this.$('total').value, + Vn.Tpv.pay (this.conn, this.$('total').value, this.$('order-form').get ('company_id')); else this.hash.set ({'form': 'ecomerce/orders'}); diff --git a/package/usr/share/hedera-web/forms/ecomerce/confirm/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/confirm/ui.xml index 9cf71e0c..da5e521c 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/confirm/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/confirm/ui.xml @@ -1,11 +1,8 @@ - - - - SELECT o.id, o.date_send, o.note, + SELECT o.id, o.date_send, o.note, o.company_id, ag.description agency, v.code method, c.credit, ad.consignee, ad.zip_code, ad.city, ad.name address FROM basket o @@ -13,9 +10,6 @@ LEFT JOIN address_view ad ON ad.id = o.address_id JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id JOIN customer_view c - - - @@ -26,17 +20,11 @@ IFNULL(SUM(vat + surcharge), 0) vat FROM t_order_vat; DROP TEMPORARY TABLE t_order_vat; - - - CALL basket_confirm (); SELECT customer_get_debt(); - - -
diff --git a/package/usr/share/hedera-web/forms/ecomerce/orders/orders.js b/package/usr/share/hedera-web/forms/ecomerce/orders/orders.js index c6671ff1..6a17a87b 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/orders/orders.js +++ b/package/usr/share/hedera-web/forms/ecomerce/orders/orders.js @@ -8,7 +8,7 @@ Vn.Orders = new Class this.payPopup = new Htk.Popup (); this.payPopup.setChildNode (this.$('balance-popup')); - this.tpv = new Vn.Tpv (this.conn, this.hash); + Vn.Tpv.check (this.conn); } ,onBasketClick: function () @@ -23,15 +23,7 @@ Vn.Orders = new Class 'ticket': ticketId }); } - - ,payRenderer: function (column, form) - { - if (form.get ('company_id') && form.get('total')) - column.td.className = ''; - else - column.td.className = 'hide'; - } - + // TPV ,balanceConditionalFunc: function (field, value) @@ -66,7 +58,7 @@ Vn.Orders = new Class var amount = parseFloat (prompt (_('AmountToPay:'), defaultAmountStr)); - this.tpv.pay (amount, company); + Vn.Tpv.pay (this.conn, amount, company); } }); diff --git a/package/usr/share/hedera-web/forms/ecomerce/ticket/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/ticket/ui.xml index 298693d4..5f6bc1b8 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/ticket/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/ticket/ui.xml @@ -1,7 +1,7 @@ - + diff --git a/package/usr/share/hedera-web/forms/news/new/ui.xml b/package/usr/share/hedera-web/forms/news/new/ui.xml index 0d97bfe5..26e749a6 100755 --- a/package/usr/share/hedera-web/forms/news/new/ui.xml +++ b/package/usr/share/hedera-web/forms/news/new/ui.xml @@ -1,7 +1,7 @@ - + @@ -28,6 +28,7 @@ Accept
+
diff --git a/package/usr/share/hedera-web/js/db/calc.js b/package/usr/share/hedera-web/js/db/calc.js index 99f25906..50730051 100755 --- a/package/usr/share/hedera-web/js/db/calc.js +++ b/package/usr/share/hedera-web/js/db/calc.js @@ -20,8 +20,9 @@ Db.Calc = new Class ,'row-updated-before': this.onRowUpdateBefore ,'row-inserted': this.onRowInsert }); - - this.form = new Db.Form ({model: x}); + + var form = new Db.Form ({model: x}); + this.link ({form: form}); } ,get: function () { diff --git a/package/usr/share/hedera-web/js/htk/grid.js b/package/usr/share/hedera-web/js/htk/grid.js index c45b68ef..efe1ba91 100755 --- a/package/usr/share/hedera-web/js/htk/grid.js +++ b/package/usr/share/hedera-web/js/htk/grid.js @@ -19,7 +19,9 @@ Htk.Grid = new Class ,'updatable-changed': this.onUpdatableChange }); - this.form = new Db.Form ({model: x}); + var form = new Db.Form ({model: x}); + this.link ({form: form}); + this.onUpdatableChange (); this.onModelChange (); } diff --git a/package/usr/share/hedera-web/js/htk/repeater.js b/package/usr/share/hedera-web/js/htk/repeater.js index 1b006257..f68bd4d7 100755 --- a/package/usr/share/hedera-web/js/htk/repeater.js +++ b/package/usr/share/hedera-web/js/htk/repeater.js @@ -68,6 +68,8 @@ Htk.Repeater = new Class ,loadXml: function (builder, node) { + this.parent (builder, node); + var template = node.querySelector ('template:first-of-type'); if (template) @@ -105,7 +107,7 @@ Htk.Repeater = new Class this.childsData.push ({ builder: builder, - form, form + form: form }); var mainNode = builder.loadXmlFromNode (this.xml); @@ -122,6 +124,7 @@ Htk.Repeater = new Class return; Vn.Node.removeChilds (this.node); + this.freeChildsData (); this.childsData = []; switch (this._model.status) @@ -183,4 +186,20 @@ Htk.Repeater = new Class { this.buildBox (row); } + + ,freeChildsData: function () + { + if (this.childsData) + for (var i = 0; i < this.childsData.length; i++) + { + this.childsData[i].form.unref (); + this.childsData[i].builder.unref (); + } + } + + ,destroy: function () + { + this.freeChildsData (); + this.parent (); + } }); diff --git a/package/usr/share/hedera-web/js/sql/batch.js b/package/usr/share/hedera-web/js/sql/batch.js index 21a15c5b..7ec0913f 100755 --- a/package/usr/share/hedera-web/js/sql/batch.js +++ b/package/usr/share/hedera-web/js/sql/batch.js @@ -21,7 +21,7 @@ Sql.Batch = new Class } } - ,params: {} + ,objects: {} ,_blocked: false ,loadXml: function (builder, node) @@ -48,46 +48,51 @@ Sql.Batch = new Class ,get: function (id) { - if (this.params[id]) - return this.params[id]; + if (this.objects[id]) + return this.objects[id]; return null; } ,add: function (id) { - if (!this.params[id]) - this.params[id] = null; + if (!this.objects[id]) + this.objects[id] = null; } - ,remove: function (id) - { - if (this.params[id]) - { - this.params[id].disconnect ('changed', this.emitChanged, this); - delete this.params[id]; - } - } - - ,addObject: function (id, object) + ,_addObject: function (id, object) { this.remove (id); - this.params[id] = object; + 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, + this._addObject (id, new Sql.Value ({value: value})); } ,addParam: function (id, param) { - this.addObject (id, + this._addObject (id, new Sql.Value ({param: param})); } + + ,remove: function (id) + { + if (this.objects[id]) + { + this._unrefObject (this.objects[id]); + delete this.objects[id]; + } + } ,block: function () { @@ -112,12 +117,27 @@ Sql.Batch = new Class ,isReady: function () { - var id; - - for (id in this.params) - if (!(this.params[id] && this.params[id].isReady ())) + 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/package/usr/share/hedera-web/js/sql/list.js b/package/usr/share/hedera-web/js/sql/list.js index be6e86a8..190263e7 100755 --- a/package/usr/share/hedera-web/js/sql/list.js +++ b/package/usr/share/hedera-web/js/sql/list.js @@ -9,9 +9,9 @@ Sql.List = new Class ,add: function (object) { - this.objects.push (object); - object.on ('changed', this.onObjectChange, this); - this.onObjectChange (); + this.objects.push (object.ref ()); + object.on ('changed', this._onObjectChange, this); + this._onObjectChange (); } ,get: function (i) @@ -26,12 +26,11 @@ Sql.List = new Class ,remove: function (i) { - var object = objects.splice (i, 1); - object.disconnect ('changed', this.onObjectChange, this); - this.onObjectChange (); + this._unrefObject (this.objects.splice (i, 1)); + this._onObjectChange (); } - ,onObjectChange: function () + ,_onObjectChange: function () { this.signalEmit ('changed'); } @@ -49,5 +48,19 @@ Sql.List = new Class return true; } + + ,_unrefObject: function (object) + { + object.disconnect ('changed', this._onObjectChange, this); + object.unref (); + } + + ,destroy: function () + { + for (var i = 0; i < this.objects.length; i++) + this._unrefObject (this.objects[i]); + + this.parent (); + } }); diff --git a/package/usr/share/hedera-web/js/sql/multi-stmt.js b/package/usr/share/hedera-web/js/sql/multi-stmt.js index 0c534811..b7878633 100755 --- a/package/usr/share/hedera-web/js/sql/multi-stmt.js +++ b/package/usr/share/hedera-web/js/sql/multi-stmt.js @@ -9,7 +9,6 @@ Sql.MultiStmt = new Class ,addStmt: function (stmt) { - stmt.on ('changed', this.stmtChanged.bind (this)); return this.stmts.push (stmt); } @@ -17,11 +16,6 @@ Sql.MultiStmt = new Class { return this.stmts[index]; } - - ,stmtChanged: function () - { - this.signalEmit ('changed'); - } ,isReady: function () { diff --git a/package/usr/share/hedera-web/js/vn/builder.js b/package/usr/share/hedera-web/js/vn/builder.js index fad48d80..ee80df28 100755 --- a/package/usr/share/hedera-web/js/vn/builder.js +++ b/package/usr/share/hedera-web/js/vn/builder.js @@ -3,19 +3,9 @@ **/ Vn.Builder = new Class ({ - objectMap: {} + Extends: Vn.Object + ,objectMap: {} ,tags: {} - - ,destroy: function () - { - for (var key in this.objectMap) - { - var object = this.objectMap[key]; - - if (object.destroy instanceof Function) - this.objectMap[key].destroy (); - } - } ,loadXml: function (xmlDoc) { @@ -322,5 +312,18 @@ Vn.Builder = new Class return []; } + + ,destroy: function () + { + for (var tag in this.tags) + { + var objects = this.tags[tag]; + + for (var i = 0; i < objects.length; i++) + objects[i].unref (); + } + + this.parent (); + } }); diff --git a/package/usr/share/hedera-web/js/vn/hash-link.js b/package/usr/share/hedera-web/js/vn/hash-link.js deleted file mode 100755 index 477ea258..00000000 --- a/package/usr/share/hedera-web/js/vn/hash-link.js +++ /dev/null @@ -1,88 +0,0 @@ - -Vn.HashLink = new Class -({ - Extends: Vn.Object - ,Tag: 'vn-hash-link' - ,Parent: 'param' - ,Properties: - { - param: - { - type: Vn.Param - ,set: function (x) - { - this.link ({_param: x}, {'changed': this.onParamChange}); - this.onHashChange (); - } - ,get: function () - { - return this._param; - } - }, - hash: - { - type: Vn.Hash - ,set: function (x) - { - this.link ({_hash: x}, {'changed': this.onHashChange}); - this.onHashChange (); - } - ,get: function () - { - return this._hash; - } - }, - key: - { - type: String - ,set: function (x) - { - this._key = x; - this.onHashChange (); - } - ,get: function () - { - return this._key; - } - } - } - - ,lock: false - ,value: null - ,_key: null - - ,onHashChange: function () - { - if (!this._key || !this._hash) - return; - - var newValue = this._hash.get (this._key); - - if (this.value != newValue) - { - this.value = newValue; - this.signalEmit ('changed'); - - if (this._param && !this.lock) - { - this.lock = true; - this._param.value = newValue; - this.lock = false; - } - } - } - - ,onParamChange: function () - { - if (this.lock) - return; - - var map = {}; - map[this.key] = this._param.value; - - this.lock = true; - this._hash.add (map); - this.lock = false; - } -}); - diff --git a/package/usr/share/hedera-web/js/vn/hash.js b/package/usr/share/hedera-web/js/vn/hash.js index f5d7dfb0..3c47d40b 100755 --- a/package/usr/share/hedera-web/js/vn/hash.js +++ b/package/usr/share/hedera-web/js/vn/hash.js @@ -1,24 +1,29 @@ /** * Class to handle the URL. **/ -Vn.Hash = new Class -({ - Extends: Vn.Object - - ,hash: null - ,hashMap: {} +Vn.Hash = +{ + _hash: null + ,_hashMap: {} + ,_listener: null ,initialize: function () { - this.hashChangedHandler = this.hashChanged.bind (this); - window.addEventListener ('hashchange', this.hashChangedHandler); - this.hashChanged (); + this._listener = new Vn.HashListener (); + + this._hashChangedHandler = this._hashChanged.bind (this); + window.addEventListener ('hashchange', this._hashChangedHandler); + this._hashChanged (); } ,destroy: function () { - this.parent (); - window.removeEventListener ('hashchange', this.hashChangedHandler); + window.removeEventListener ('hashchange', this._hashChangedHandler); + } + + ,getListener: function () + { + return this._listener; } /** @@ -28,7 +33,7 @@ Vn.Hash = new Class **/ ,get: function (key) { - return this.hashMap[key]; + return this._hashMap[key]; } /** @@ -38,7 +43,7 @@ Vn.Hash = new Class **/ ,add: function (map) { - var newMap = this.hashMap; + var newMap = this._hashMap; for (var key in map) newMap[key] = map[key]; @@ -59,10 +64,16 @@ Vn.Hash = new Class var newHash = this.make (map); - if (newHash !== this.hash) + if (newHash !== this._hash) { - this.hashMap = map; - this.putHash (newHash); + this._hashMap = map; + this._hash = newHash; + + this._blockChanged = true; + location.hash = newHash; + this._blockChanged = false; + + this._listener.changed (); } } @@ -78,9 +89,9 @@ Vn.Hash = new Class var hash = '#!'; if (add) - for (var key in this.hashMap) + for (var key in this._hashMap) if (!map[key]) - map[key] = this.hashMap[key]; + map[key] = this._hashMap[key]; for (var key in map) { @@ -92,22 +103,15 @@ Vn.Hash = new Class return hash; } - - ,putHash: function (newHash) - { - location.hash = newHash; - this.hash = location.hash; - this.signalEmit ('changed'); - } - ,hashChanged: function () + ,_hashChanged: function () { var newHash = location.hash; - if (newHash === this.hash) + if (this._blockChanged || newHash === this._hash) return; - this.hashMap = {}; + var newMap = hashMap = {}; var kvPairs = newHash.substr(2).split ('&'); for (var i = 0; i < kvPairs.length; i++) @@ -115,9 +119,11 @@ Vn.Hash = new Class var kvPair = kvPairs[i].split ('=', 2); if (kvPair[0]) - this.hashMap[kvPair[0]] = kvPair[1]; + newMap[kvPair[0]] = kvPair[1]; } - this.putHash (newHash); + this._hashMap = newMap; + this._hash = newHash; + this._listener.changed (); } -}); +}; diff --git a/package/usr/share/hedera-web/js/vn/main.php b/package/usr/share/hedera-web/js/vn/main.php index e897aa15..d8198cb3 100755 --- a/package/usr/share/hedera-web/js/vn/main.php +++ b/package/usr/share/hedera-web/js/vn/main.php @@ -21,8 +21,9 @@ Js::includeLib ('vn' ,'mutators' ,'object' ,'param' + ,'hash-listener' ,'hash' - ,'hash-link' + ,'hash-param' ,'node' ,'builder' ,'http-request' diff --git a/package/usr/share/hedera-web/js/vn/node.js b/package/usr/share/hedera-web/js/vn/node.js index d5661c88..01850341 100755 --- a/package/usr/share/hedera-web/js/vn/node.js +++ b/package/usr/share/hedera-web/js/vn/node.js @@ -47,6 +47,16 @@ Vn.Node = if (found) node.className = classes.join (' '); } + + ,hide: function (node) + { + node.style.display = 'none'; + } + + ,show: function (node) + { + node.style.display = ''; + } }; function $ (id) diff --git a/package/usr/share/hedera-web/js/vn/object.js b/package/usr/share/hedera-web/js/vn/object.js index 641bc739..0927f0ea 100755 --- a/package/usr/share/hedera-web/js/vn/object.js +++ b/package/usr/share/hedera-web/js/vn/object.js @@ -7,7 +7,10 @@ Vn.Object = new Class ({ Tag: 'vn-object' ,Properties: {} + ,signals: {} + ,links: {} + ,refCount: 1 ,initialize: function (props) { @@ -15,6 +18,20 @@ Vn.Object = new Class this[prop] = props[prop]; } + ,ref: function () + { + this.refCount++; + return this; + } + + ,unref: function () + { + this.refCount--; + + if (this.refCount === 0) + this._destroy (); + } + ,loadXml: function (builder, node) { return null; @@ -53,7 +70,7 @@ Vn.Object = new Class * @param {Function} callback The callback * @param {Boolean} block %true for lock the signal, %false for unlock **/ - ,blockSignal: function (id, callback, block) + ,blockSignal: function (id, callback, block, instance) { var callbacks = this.signals[id]; @@ -61,7 +78,8 @@ Vn.Object = new Class return; for (var i = 0; i < callbacks.length; i++) - if (callbacks[i].callback == callback) + if (callbacks[i].callback == callback + && callbacks[i].instance == instance) callbacks[i].blocked = block; } @@ -101,19 +119,42 @@ Vn.Object = new Class if (!callbacks) return; - + for (var i = 0; i < callbacks.length; i++) if (callbacks[i].callback == callback && callbacks[i].instance == instance) callbacks.splice (i--, 1); } + + /** + * Disconnects all signals for the given instance. + * + * @param {Object} instance The instance + **/ + ,disconnectByInstance: function (instance) + { + for (var signalId in this.signals) + { + var callbacks = this.signals[signalId]; + + for (var i = 0; i < callbacks.length; i++) + if (callbacks[i].instance == instance) + callbacks.splice (i--, 1); + } + } /** * Destroys the object, this method should only be called before losing * the last reference to the object. **/ - ,destroy: function () + ,_destroy: function () { + var links = this.links; + + for (var key in links) + links[key].disconnectByInstance (this); + + delete this.links; delete this.signals; } @@ -125,15 +166,22 @@ Vn.Object = new Class var oldObject = this[key]; if (oldObject) - for (var signal in handlers) - oldObject.disconnect (signal, handlers[signal], this); + { + oldObject.disconnectByInstance (this); + oldObject.unref (); + } this[key] = newObject; if (newObject) - for (var signal in handlers) - newObject.on (signal, handlers[signal], this); + { + this.links[key] = newObject.ref (); + + for (var signal in handlers) + newObject.on (signal, handlers[signal], this); + } + else if (oldObject) + delete this.links[key]; } } }); - diff --git a/package/usr/share/hedera-web/js/vn/param.js b/package/usr/share/hedera-web/js/vn/param.js index 3e4f0ed1..a62df1b1 100755 --- a/package/usr/share/hedera-web/js/vn/param.js +++ b/package/usr/share/hedera-web/js/vn/param.js @@ -39,8 +39,8 @@ Vn.Param = new Class type: Vn.Param ,set: function (x) { - this.link ({_master: x}, {'changed': this.onMasterChange}); - this.onMasterChange (); + this.link ({_master: x}, {'changed': this._onMasterChange}); + this._onMasterChange (); } ,get: function () { @@ -53,7 +53,7 @@ Vn.Param = new Class ,_master: null ,masterLock: false - ,onMasterChange: function () + ,_onMasterChange: function () { if (this.masterLock) return; diff --git a/package/usr/share/hedera-web/locale/es/forms/agencies/provinces.json b/package/usr/share/hedera-web/locale/es/forms/agencies/provinces.json index 803c52ad..baefde75 100755 --- a/package/usr/share/hedera-web/locale/es/forms/agencies/provinces.json +++ b/package/usr/share/hedera-web/locale/es/forms/agencies/provinces.json @@ -1,5 +1,7 @@ { "ByProvince": "Desglose por provincia" + + ,"Return": "Volver" ,"SelectAgency": "Seleccione una agencia en el listado de la izquierda" ,"Province": "Provincia" diff --git a/package/usr/share/hedera-web/locale/es/forms/ecomerce/basket.json b/package/usr/share/hedera-web/locale/es/forms/ecomerce/basket.json index baec3f82..869d42c0 100755 --- a/package/usr/share/hedera-web/locale/es/forms/ecomerce/basket.json +++ b/package/usr/share/hedera-web/locale/es/forms/ecomerce/basket.json @@ -25,4 +25,5 @@ ,"Subtotal": "Subtotal" ,"OrderItemsUpdated": "Su pedido lleva demasiado tiempo abierto y ha sido actualizado, los precios o cantidades de sus artículos pueden haber cambiado." + ,"RememberReconfiguringImpact": "Recuerde que si vuelve a configurar el pedido los precios o cantidades de sus artículos podrían cambiar." } diff --git a/package/usr/share/hedera-web/locale/es/forms/ecomerce/checkout.json b/package/usr/share/hedera-web/locale/es/forms/ecomerce/checkout.json index eb64c775..4b76cfeb 100755 --- a/package/usr/share/hedera-web/locale/es/forms/ecomerce/checkout.json +++ b/package/usr/share/hedera-web/locale/es/forms/ecomerce/checkout.json @@ -25,5 +25,4 @@ ,"OrderStarted": "Pedido empezado" ,"OrderUpdated": "Pedido actualizado" - ,"RememberReconfiguringImpact": "Recuerde que si vuelve a configurar el pedido los precios o cantidades de sus artículos podrían cambiar." } diff --git a/package/usr/share/hedera-web/locale/es/js/vn.js b/package/usr/share/hedera-web/locale/es/js/vn.js index 5be58ea2..717d028c 100755 --- a/package/usr/share/hedera-web/locale/es/js/vn.js +++ b/package/usr/share/hedera-web/locale/es/js/vn.js @@ -55,6 +55,7 @@ Vn.Locale.add ,"NewVersionAvailable": "Hay una nueva actualización, la página se recargargará automaticamente para descargarla" ,"ChangeLog": "Cambios recientes" ,"CookiesNotification": "Al utilizar este sitio web aceptas el uso de cookies para la personalización de contenidos y análisis." + ,"ReturnToOldWebsite": "Ir a web antigua" ,"Home": "Inicio" ,"Orders": "Pedidos" diff --git a/package/usr/share/hedera-web/locale/es/pages/web.json b/package/usr/share/hedera-web/locale/es/pages/web.json index 443b7269..781b76e8 100755 --- a/package/usr/share/hedera-web/locale/es/pages/web.json +++ b/package/usr/share/hedera-web/locale/es/pages/web.json @@ -1,4 +1,5 @@ { - "Welcome": "Bienvenido/a" - ,"Exit": "Salir" + "Welcome": "Bienvenido/a" + ,"Exit": "Salir" + ,"TestTheNewWebsite": "¡Prueba la nueva web!" } diff --git a/package/usr/share/hedera-web/pages/web/html.php b/package/usr/share/hedera-web/pages/web/html.php index 7039a504..5826a97a 100755 --- a/package/usr/share/hedera-web/pages/web/html.php +++ b/package/usr/share/hedera-web/pages/web/html.php @@ -29,7 +29,12 @@