switch modules to new dojo definition format

This commit is contained in:
Andrew Dolgov 2016-08-10 13:40:24 +03:00
parent 546b419f52
commit d39a2f8005
7 changed files with 1151 additions and 1134 deletions

View File

@ -1,10 +1,6 @@
dojo.provide("fox.FeedTree"); require(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) {
dojo.provide("fox.FeedStoreModel");
dojo.require("dijit.Tree"); return declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
dojo.require("dijit.Menu");
dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
getItemsInCategory: function (id) { getItemsInCategory: function (id) {
if (!this.store._itemsByIdentity) return undefined; if (!this.store._itemsByIdentity) return undefined;
@ -95,9 +91,13 @@ dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
else else
return false; return false;
}, },
});
}); });
dojo.declare("fox.FeedTree", dijit.Tree, { require(["dojo/_base/declare", "dijit/Tree", "dijit/Menu"], function (declare) {
return declare("fox.FeedTree", dijit.Tree, {
_onKeyPress: function(/* Event */ e) { _onKeyPress: function(/* Event */ e) {
return; // Stop dijit.Tree from interpreting keystrokes return; // Stop dijit.Tree from interpreting keystrokes
}, },
@ -587,3 +587,5 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
} }
}, },
}); });
});

View File

@ -1,10 +1,6 @@
dojo.provide("fox.PrefFeedTree"); require(["dojo/_base/declare", "dojo/data/ItemFileWriteStore"], function (declare) {
dojo.provide("fox.PrefFeedStore");
dojo.require("lib.CheckBoxTree"); return declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, {
dojo.require("dojo.data.ItemFileWriteStore");
dojo.declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, {
_saveEverything: function(saveCompleteCallback, saveFailedCallback, _saveEverything: function(saveCompleteCallback, saveFailedCallback,
newFileContentString) { newFileContentString) {
@ -19,7 +15,11 @@ dojo.declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, {
}); });
dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, { });
require(["dojo/_base/declare", "lib/CheckBoxTree"], function (declare) {
return declare("fox.PrefFeedTree", lib.CheckBoxTree, {
_createTreeNode: function(args) { _createTreeNode: function(args) {
var tnode = this.inherited(arguments); var tnode = this.inherited(arguments);
@ -122,4 +122,5 @@ dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
} }
}, },
}); });
});

View File

@ -1,24 +1,27 @@
dojo.provide("fox.PrefFilterTree"); require(["dojo/_base/declare", "dojo/data/ItemFileWriteStore"], function (declare) {
dojo.require("lib.CheckBoxTree"); return declare("fox.PrefFilterStore", dojo.data.ItemFileWriteStore, {
dojo.require("dojo.data.ItemFileWriteStore");
dojo.declare("fox.PrefFilterStore", dojo.data.ItemFileWriteStore, {
_saveEverything: function (saveCompleteCallback, saveFailedCallback, _saveEverything: function (saveCompleteCallback, saveFailedCallback,
newFileContentString) { newFileContentString) {
dojo.xhrPost({ dojo.xhrPost({
url: "backend.php", url: "backend.php",
content: {op: "pref-filters", method: "savefilterorder", content: {
payload: newFileContentString}, op: "pref-filters", method: "savefilterorder",
payload: newFileContentString
},
error: saveFailedCallback, error: saveFailedCallback,
load: saveCompleteCallback}); load: saveCompleteCallback
});
}, },
}); });
});
dojo.declare("fox.PrefFilterTree", lib.CheckBoxTree, { require(["dojo/_base/declare", "lib/CheckBoxTree"], function (declare) {
return declare("fox.PrefFilterTree", lib.CheckBoxTree, {
_createTreeNode: function(args) { _createTreeNode: function(args) {
var tnode = this.inherited(arguments); var tnode = this.inherited(arguments);
@ -94,3 +97,6 @@ dojo.declare("fox.PrefFilterTree", lib.CheckBoxTree, {
}, },
}); });
});

View File

@ -1,9 +1,6 @@
dojo.provide("fox.PrefLabelTree"); require(["dojo/_base/declare", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare) {
dojo.require("lib.CheckBoxTree"); return declare("fox.PrefLabelTree", lib.CheckBoxTree, {
dojo.require("dijit.form.DropDownButton");
dojo.declare("fox.PrefLabelTree", lib.CheckBoxTree, {
setNameById: function (id, name) { setNameById: function (id, name) {
var item = this.model.store._itemsByIdentity['LABEL:' + id]; var item = this.model.store._itemsByIdentity['LABEL:' + id];
@ -41,3 +38,6 @@ dojo.declare("fox.PrefLabelTree", lib.CheckBoxTree, {
}, },
}); });
});

View File

@ -943,15 +943,12 @@ function init() {
"dijit/Toolbar", "dijit/Toolbar",
"dijit/Tree", "dijit/Tree",
"dijit/tree/dndSource", "dijit/tree/dndSource",
"dojo/data/ItemFileWriteStore"], function (dojo, ready, parser) { "dojo/data/ItemFileWriteStore",
"fox/PrefFeedTree",
"fox/PrefFilterTree",
"fox/PrefLabelTree" ], function (dojo, ready, parser) {
ready(function() { ready(function() {
dojo.require("lib.CheckBoxTree");
dojo.require("fox.PrefFeedTree");
dojo.require("fox.PrefFilterTree");
dojo.require("fox.PrefLabelTree");
parser.parse(); parser.parse();
loading_set_progress(50); loading_set_progress(50);

View File

@ -248,12 +248,11 @@ function init() {
"dijit/Tree", "dijit/Tree",
"dijit/tree/dndSource", "dijit/tree/dndSource",
"dijit/tree/ForestStoreModel", "dijit/tree/ForestStoreModel",
"dojo/data/ItemFileWriteStore" ], function (dojo, ready, parser) { "dojo/data/ItemFileWriteStore",
"fox/FeedTree" ], function (dojo, ready, parser) {
ready(function() { ready(function() {
dojo.require("fox.FeedTree");
parser.parse(); parser.parse();
if (!genericSanityCheck()) if (!genericSanityCheck())

View File

@ -1,15 +1,17 @@
dojo.provide("lib.CheckBoxTree"); //dojo.provide("lib.CheckBoxTree");
dojo.provide("lib.CheckBoxStoreModel"); //dojo.provide("lib.CheckBoxStoreModel");
// THIS WIDGET IS BASED ON DOJO/DIJIT 1.4.0 AND WILL NOT WORK WITH PREVIOUS VERSIONS // THIS WIDGET IS BASED ON DOJO/DIJIT 1.4.0 AND WILL NOT WORK WITH PREVIOUS VERSIONS
// //
// Release date: 02/05/2010 // Release date: 02/05/2010
// //
dojo.require("dijit.Tree"); //dojo.require("dijit.Tree");
dojo.require("dijit.form.CheckBox"); //dojo.require("dijit.form.CheckBox");
dojo.declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel, require(["dojo/_base/declare", "dijit/tree/TreeStoreModel"], function (declare) {
return declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel,
{ {
// checkboxAll: Boolean // checkboxAll: Boolean
// If true, every node in the tree will receive a checkbox regardless if the 'checkbox' attribute // If true, every node in the tree will receive a checkbox regardless if the 'checkbox' attribute
@ -334,7 +336,11 @@ dojo.declare( "lib.CheckBoxStoreModel", dijit.tree.TreeStoreModel,
}); });
dojo.declare( "lib._CheckBoxTreeNode", dijit._TreeNode, });
require(["dojo/_base/declare", "dijit/Tree"], function (declare) {
return declare("lib._CheckBoxTreeNode", dijit._TreeNode,
{ {
// _checkbox: [protected] dojo.doc.element // _checkbox: [protected] dojo.doc.element
// Local reference to the dojo.doc.element of type 'checkbox' // Local reference to the dojo.doc.element of type 'checkbox'
@ -371,8 +377,11 @@ dojo.declare( "lib._CheckBoxTreeNode", dijit._TreeNode,
} }
}); });
});
dojo.declare( "lib.CheckBoxTree", dijit.Tree, require(["dojo/_base/declare", "dijit/Tree"], function (declare) {
return declare( "lib.CheckBoxTree", dijit.Tree,
{ {
onNodeChecked: function(/*dojo.data.Item*/ storeItem, /*treeNode*/ treeNode) { onNodeChecked: function(/*dojo.data.Item*/ storeItem, /*treeNode*/ treeNode) {
@ -472,3 +481,6 @@ dojo.declare( "lib.CheckBoxTree", dijit.Tree,
} }
}); });
});