commit 2e62a6ade072f17b1b08d2db8c81ce8c2566530e
parent fe156591cb0a3b38b9a2df474bd9e76b8b1197fd
Author: Felicitus <felicitus@felicitus.org>
Date: Mon, 2 Jan 2012 11:51:55 +0100
Removed old ExtJS bugfixes, added bugfix for EXTJSIV-4312
Diffstat:
4 files changed, 19 insertions(+), 253 deletions(-)
diff --git a/src/frontend/js/ExtJS/Bugfixes/Ext.selection.Model-lateBinding.js b/src/frontend/js/ExtJS/Bugfixes/Ext.selection.Model-lateBinding.js
@@ -1,39 +0,0 @@
-/**
- * Bugfix for Ext.selection.Model:
- *
- * If a store isn't bound yet, defer binding.
- */
-Ext.override(Ext.selection.Model, {
- /**
- * @private
- * Defines if the selection model is already bound to a store.
- */
- _bound: false,
-
- constructor: function (cfg) {
- /**
- * @event _bind
- * Fires as soon as a store is bound
- */
- this.addEvents("_bind");
-
- this.callOverridden(arguments);
- },
- select: function(records, keepExisting, suppressEvent) {
- // Check if we are bound to a store. If not, delay the select operation until the store is bound
- if (this._bound) {
- this.doSelect(records, keepExisting, suppressEvent);
- } else {
- this.on("_bind", function () {
- this.doSelect(records, keepExisting, suppressEvent);
- }, this, { single: true });
- }
-
- },
- bind: function(store, initial) {
- this.callOverridden(arguments);
-
- this._bound = true;
- this.fireEvent("_bind");
- }
-});
diff --git a/src/frontend/js/ExtJS/Bugfixes/Ext.selection.RowModel-EXTJSIV-4312.js b/src/frontend/js/ExtJS/Bugfixes/Ext.selection.RowModel-EXTJSIV-4312.js
@@ -0,0 +1,17 @@
+/**
+ * This is a hackish bugfix for ExtJS 4.0.7. According to sencha, this has been fixed in EXTJSIV-4312. Remove this
+ * as soon as a newer version as ExtJS 4.0.7 is out and fixes this bug.
+ */
+Ext.override(Ext.selection.RowModel, {
+ onLastFocusChanged: function(oldFocused, newFocused, supressFocus) {
+ if (this.views && this.views.length) {
+ this.callOverridden(arguments);
+ }
+ },
+ onSelectChange: function(record, isSelected, suppressEvent, commitFn) {
+ if (this.views && this.views.length) {
+ this.callOverridden(arguments);
+ }
+ }
+
+});+
\ No newline at end of file
diff --git a/src/frontend/js/Models/Part.js b/src/frontend/js/Models/Part.js
@@ -48,6 +48,7 @@ Ext.define("PartKeepr.Part", {
{ model: 'PartKeepr.PartParameter', name: 'parameters'},
{ model: 'PartKeepr.PartAttachment', name: 'attachments'}
],
+ proxy: PartKeepr.getRESTProxy("Part"),
getRecordName: function () {
return this.get("name");
}
diff --git a/src/frontend/js/bugfixes.js b/src/frontend/js/bugfixes.js
@@ -1,214 +0,0 @@
-
-Ext.override(Ext.data.reader.Reader,
-{
- readRecords: function(data) {
- var dt = this.callOverridden(arguments);
-
- //if (dt.success === false) {
- //Ext.Msg.alert("Error", data.message);
- //}
-
-
- return dt;
- }
-
- });
-
-
-
-
-
-
-
-
-Ext.view.AbstractView.override({
- /**
- * Changes the data store bound to this view and refreshes it.
- * @param {Store} store The store to bind to this view
- */
- bindStore : function(store, initial) {
- var me = this;
-
- if (!initial && me.store) {
- if (store !== me.store && me.store.autoDestroy) {
- me.store.destroy();
- }
- else {
- me.mun(me.store, {
- scope: me,
- datachanged: me.onDataChanged,
- add: me.onAdd,
- remove: me.onRemove,
- update: me.onUpdate,
- clear: me.refresh
- });
- }
- if (!store) {
- if (me.loadMask && me.loadMask.bindStore) {
- me.loadMask.bindStore(null);
- }
- me.store = null;
- }
- }
- if (store) {
- store = Ext.data.StoreManager.lookup(store);
- me.mon(store, {
- scope: me,
- datachanged: me.onDataChanged,
- add: me.onAdd,
- remove: me.onRemove,
- update: me.onUpdate,
- clear: me.refresh
- });
- if (me.loadMask && me.loadMask.bindStore) {
- me.loadMask.bindStore(store);
- }
- }
-
- me.store = store;
- // Bind the store to our selection model
- me.getSelectionModel().bind(store);
-
- if (store && (!initial || store.getCount())) {
- me.refresh(true);
- }
- },
- onItemSelect: function(record, cnt) {
- if (!cnt) { cnt = 0; }
-
- var node = this.getNode(record);
- if (Ext.fly(node)) {
- Ext.fly(node).addCls(this.selectedItemCls);
- } else {
- if (cnt < 20) {
- cnt++;
- Ext.Function.defer(this.onItemSelect, 500, this, [record, cnt]);
- }
-
- }
- },
- onItemDeselect: function(record, cnt) {
- if (!cnt) { cnt = 0; }
-
- var node = this.getNode(record);
- if (Ext.fly(node)) {
- Ext.fly(node).removeCls(this.selectedItemCls);
- } else {
- if (cnt < 20) {
- cnt++;
- Ext.Function.defer(this.onItemDeselect, 500, this, [record, cnt]);
- }
- }
- }
-});
-
-Ext.form.field.ComboBox.override({
- beforeBlur: function() {
- var me = this;
- me.doQueryTask.cancel();
-
- me.assertValue();
- },
-
- // private
- assertValue: function() {
- var me = this,
- value = me.getRawValue(),
- rec;
-
- if (me.forceSelection) {
- if (me.multiSelect) {
- // For multiselect, check that the current displayed value matches the current
- // selection, if it does not then revert to the most recent selection.
- if (value !== me.getDisplayValue()) {
- me.setValue(me.lastSelection);
- }
- } else {
- // For single-select, match the displayed value to a record and select it,
- // if it does not match a record then revert to the most recent selection.
- rec = me.findRecordByDisplay(value);
- if (rec) {
- me.select(rec);
- } else {
- me.setValue(me.lastSelection);
- }
- }
- }
- me.collapse();
- },
-
-
- setValue: function(value, doSelect) {
- var me = this,
- valueNotFoundText = me.valueNotFoundText,
- inputEl = me.inputEl,
- i, len, record,
- models = [],
- displayTplData = [],
- processedValue = [];
-
- if (me.store.loading) {
- // Called while the Store is loading. Ensure it is processed by the onLoad method.
- me.value = value;
- return me;
- }
-
- // This method processes multi-values, so ensure value is an array.
- value = Ext.Array.from(value);
-
- // Loop through values
- for (i = 0, len = value.length; i < len; i++) {
- record = value[i];
- if (!record || !record.isModel) {
- var tmpRecord = me.findRecordByValue(record);
-
- record = tmpRecord;
-
- }
- // record found, select it.
- if (record) {
- models.push(record);
- displayTplData.push(record.data);
- processedValue.push(record.get(me.valueField));
- }
- // record was not found, this could happen because
- // store is not loaded or they set a value not in the store
- else {
- if (!me.forceSelection) {
- displayTplData.push(value[i]);
- } else {
- // if valueNotFoundText is defined, display it, otherwise display nothing for this value
- if (Ext.isDefined(valueNotFoundText)) {
- displayTplData.push(valueNotFoundText);
- }
- }
- processedValue.push(value[i]);
- }
- }
-
- // Set the value of this field. If we are multiselecting, then that is an array.
- me.value = me.multiSelect ? processedValue : processedValue[0];
- if (!Ext.isDefined(me.value)) {
- me.value = null;
- }
- me.displayTplData = displayTplData; //store for getDisplayValue method
- me.lastSelection = me.valueModels = models;
-
- if (inputEl && me.emptyText && !Ext.isEmpty(value)) {
- inputEl.removeCls(me.emptyCls);
- }
-
- // Calculate raw value from the collection of Model data
- me.setRawValue(me.getDisplayValue());
- me.checkChange();
-
- if (doSelect !== false) {
- me.syncSelection();
- }
- me.applyEmptyText();
-
- return me;
- }
-
-});
-