rwiki 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Capfile +2 -0
- data/Gemfile +30 -0
- data/Rakefile +22 -65
- data/VERSION +1 -1
- data/config.ru +11 -0
- data/config/config.yml.example +1 -0
- data/config/deploy.rb +37 -0
- data/features/create_page.feature +30 -20
- data/features/delete_page.feature +23 -18
- data/features/display_page.feature +10 -11
- data/features/editor.feature +45 -0
- data/features/history.feature +46 -0
- data/features/rename_page.feature +42 -37
- data/features/step_definitions/common_steps.rb +19 -47
- data/features/step_definitions/common_transforms.rb +5 -0
- data/features/step_definitions/dialog_box_steps.rb +16 -0
- data/features/step_definitions/history_steps.rb +11 -0
- data/features/step_definitions/tab_panel_steps.rb +27 -0
- data/features/step_definitions/tree_panel_steps.rb +42 -0
- data/features/step_definitions/wait_steps.rb +21 -0
- data/features/support/env.rb +6 -0
- data/features/tab_panel.feature +47 -0
- data/features/tree_panel.feature +14 -15
- data/lib/rwiki.rb +1 -0
- data/lib/rwiki/app.rb +14 -2
- data/lib/rwiki/models/folder.rb +1 -1
- data/lib/rwiki/models/node.rb +11 -1
- data/lib/rwiki/models/page.rb +1 -1
- data/public/favicon.ico +0 -0
- data/public/images/compressed.png +0 -0
- data/public/images/css.png +0 -0
- data/public/images/file.png +0 -0
- data/public/images/html.png +0 -0
- data/public/images/icon_word.png +0 -0
- data/public/images/image.png +0 -0
- data/public/images/javascript.png +0 -0
- data/public/images/pdf.png +0 -0
- data/public/images/php.png +0 -0
- data/public/images/presentation.png +0 -0
- data/public/images/ruby.png +0 -0
- data/public/images/shellscript.png +0 -0
- data/public/images/stylesheet.png +0 -0
- data/public/images/text.png +0 -0
- data/public/images/wordprocessing.png +0 -0
- data/public/javascripts/Rwiki.js +71 -29
- data/public/javascripts/Rwiki/EditorPanel.js +5 -37
- data/public/javascripts/Rwiki/EditorPanel/Editor.js +8 -44
- data/public/javascripts/Rwiki/EditorWindow.js +66 -0
- data/public/javascripts/Rwiki/FuzzyFinderDialog.js +61 -0
- data/public/javascripts/Rwiki/NavigationPanel.js +25 -0
- data/public/javascripts/Rwiki/NodeManager.js +2 -0
- data/public/javascripts/Rwiki/TabPanel.js +39 -2
- data/public/javascripts/Rwiki/TreePanel.js +39 -26
- data/public/javascripts/Rwiki/TreePanel/Menu.js +1 -1
- data/public/javascripts/Rwiki/TreePanel/Node.js +46 -0
- data/public/javascripts/vendor/ext/adapter/ext/ext-base-debug.js +836 -710
- data/public/javascripts/vendor/ext/adapter/ext/ext-base.js +5 -5
- data/public/javascripts/vendor/ext/adapter/jquery/ext-jquery-adapter-debug.js +47 -700
- data/public/javascripts/vendor/ext/adapter/jquery/ext-jquery-adapter.js +5 -5
- data/public/javascripts/vendor/ext/adapter/prototype/ext-prototype-adapter-debug.js +45 -698
- data/public/javascripts/vendor/ext/adapter/prototype/ext-prototype-adapter.js +5 -5
- data/public/javascripts/vendor/ext/adapter/yui/ext-yui-adapter-debug.js +39 -696
- data/public/javascripts/vendor/ext/adapter/yui/ext-yui-adapter.js +5 -5
- data/public/javascripts/vendor/ext/ext-all-debug-w-comments.js +17932 -12860
- data/public/javascripts/vendor/ext/ext-all-debug.js +11674 -8102
- data/public/javascripts/vendor/ext/ext-all.js +6 -6
- data/public/javascripts/vendor/ext/ux/StatusBar.js +418 -0
- data/public/resources/ext/charts.swf +0 -0
- data/public/resources/ext/css/debug.css +4 -4
- data/public/resources/ext/css/ext-all-notheme.css +204 -52
- data/public/resources/ext/css/ext-all.css +234 -54
- data/public/resources/ext/css/reset-min.css +4 -4
- data/public/resources/ext/css/structure/borders.css +4 -4
- data/public/resources/ext/css/structure/box.css +4 -4
- data/public/resources/ext/css/structure/button.css +7 -7
- data/public/resources/ext/css/structure/combo.css +4 -4
- data/public/resources/ext/css/structure/core.css +15 -5
- data/public/resources/ext/css/structure/date-picker.css +4 -4
- data/public/resources/ext/css/structure/dd.css +4 -4
- data/public/resources/ext/css/structure/debug.css +4 -4
- data/public/resources/ext/css/structure/dialog.css +6 -9
- data/public/resources/ext/css/structure/editor.css +4 -4
- data/public/resources/ext/css/structure/form.css +14 -4
- data/public/resources/ext/css/structure/grid.css +15 -5
- data/public/resources/ext/css/structure/layout.css +7 -7
- data/public/resources/ext/css/structure/list-view.css +4 -4
- data/public/resources/ext/css/structure/menu.css +13 -6
- data/public/resources/ext/css/structure/panel-reset.css +4 -4
- data/public/resources/ext/css/structure/panel.css +70 -22
- data/public/resources/ext/css/structure/pivotgrid.css +65 -0
- data/public/resources/ext/css/structure/progress.css +4 -4
- data/public/resources/ext/css/structure/qtips.css +4 -4
- data/public/resources/ext/css/structure/reset.css +11 -5
- data/public/resources/ext/css/structure/resizable.css +4 -4
- data/public/resources/ext/css/structure/slider.css +4 -4
- data/public/resources/ext/css/structure/tabs.css +13 -8
- data/public/resources/ext/css/structure/toolbar.css +5 -5
- data/public/resources/ext/css/structure/tree.css +11 -11
- data/public/resources/ext/css/structure/window.css +5 -5
- data/public/resources/ext/css/theme-access/borders.css +4 -4
- data/public/resources/ext/css/theme-access/box.css +4 -4
- data/public/resources/ext/css/theme-access/button.css +4 -4
- data/public/resources/ext/css/theme-access/combo.css +4 -4
- data/public/resources/ext/css/theme-access/core.css +4 -4
- data/public/resources/ext/css/theme-access/date-picker.css +4 -4
- data/public/resources/ext/css/theme-access/dd.css +4 -4
- data/public/resources/ext/css/theme-access/debug.css +4 -4
- data/public/resources/ext/css/theme-access/dialog.css +4 -4
- data/public/resources/ext/css/theme-access/editor.css +4 -4
- data/public/resources/ext/css/theme-access/form.css +4 -4
- data/public/resources/ext/css/theme-access/grid.css +4 -4
- data/public/resources/ext/css/theme-access/layout.css +4 -4
- data/public/resources/ext/css/theme-access/list-view.css +8 -4
- data/public/resources/ext/css/theme-access/menu.css +4 -4
- data/public/resources/ext/css/theme-access/panel.css +4 -4
- data/public/resources/ext/css/theme-access/progress.css +4 -4
- data/public/resources/ext/css/theme-access/qtips.css +4 -4
- data/public/resources/ext/css/theme-access/resizable.css +4 -4
- data/public/resources/ext/css/theme-access/slider.css +4 -4
- data/public/resources/ext/css/theme-access/tabs.css +4 -4
- data/public/resources/ext/css/theme-access/toolbar.css +4 -4
- data/public/resources/ext/css/theme-access/tree.css +4 -4
- data/public/resources/ext/css/theme-access/window.css +5 -5
- data/public/resources/ext/css/theme-gray/borders.css +4 -4
- data/public/resources/ext/css/theme-gray/box.css +4 -4
- data/public/resources/ext/css/theme-gray/button.css +4 -4
- data/public/resources/ext/css/theme-gray/combo.css +4 -4
- data/public/resources/ext/css/theme-gray/core.css +6 -4
- data/public/resources/ext/css/theme-gray/date-picker.css +4 -4
- data/public/resources/ext/css/theme-gray/dd.css +4 -4
- data/public/resources/ext/css/theme-gray/debug.css +4 -4
- data/public/resources/ext/css/theme-gray/dialog.css +4 -4
- data/public/resources/ext/css/theme-gray/editor.css +4 -4
- data/public/resources/ext/css/theme-gray/form.css +4 -4
- data/public/resources/ext/css/theme-gray/grid.css +10 -6
- data/public/resources/ext/css/theme-gray/layout.css +4 -4
- data/public/resources/ext/css/theme-gray/list-view.css +5 -5
- data/public/resources/ext/css/theme-gray/menu.css +4 -4
- data/public/resources/ext/css/theme-gray/panel.css +4 -4
- data/public/resources/ext/css/theme-gray/pivotgrid.css +28 -0
- data/public/resources/ext/css/theme-gray/progress.css +4 -4
- data/public/resources/ext/css/theme-gray/qtips.css +4 -4
- data/public/resources/ext/css/theme-gray/resizable.css +4 -4
- data/public/resources/ext/css/theme-gray/slider.css +4 -4
- data/public/resources/ext/css/theme-gray/tabs.css +4 -4
- data/public/resources/ext/css/theme-gray/toolbar.css +4 -4
- data/public/resources/ext/css/theme-gray/tree.css +4 -4
- data/public/resources/ext/css/theme-gray/window.css +4 -4
- data/public/resources/ext/css/visual/borders.css +4 -4
- data/public/resources/ext/css/visual/box.css +4 -4
- data/public/resources/ext/css/visual/button.css +4 -4
- data/public/resources/ext/css/visual/combo.css +4 -4
- data/public/resources/ext/css/visual/core.css +6 -4
- data/public/resources/ext/css/visual/date-picker.css +4 -4
- data/public/resources/ext/css/visual/dd.css +4 -4
- data/public/resources/ext/css/visual/debug.css +4 -4
- data/public/resources/ext/css/visual/dialog.css +4 -4
- data/public/resources/ext/css/visual/editor.css +4 -4
- data/public/resources/ext/css/visual/form.css +4 -4
- data/public/resources/ext/css/visual/grid.css +8 -4
- data/public/resources/ext/css/visual/layout.css +4 -4
- data/public/resources/ext/css/visual/list-view.css +4 -4
- data/public/resources/ext/css/visual/menu.css +4 -4
- data/public/resources/ext/css/visual/panel.css +4 -4
- data/public/resources/ext/css/visual/pivotgrid.css +28 -0
- data/public/resources/ext/css/visual/progress.css +4 -4
- data/public/resources/ext/css/visual/qtips.css +4 -4
- data/public/resources/ext/css/visual/resizable.css +4 -4
- data/public/resources/ext/css/visual/slider.css +4 -4
- data/public/resources/ext/css/visual/tabs.css +4 -4
- data/public/resources/ext/css/visual/toolbar.css +5 -5
- data/public/resources/ext/css/visual/tree.css +4 -4
- data/public/resources/ext/css/visual/window.css +4 -4
- data/public/resources/ext/css/xtheme-access.css +9 -5
- data/public/resources/ext/css/xtheme-blue.css +34 -6
- data/public/resources/ext/css/xtheme-gray.css +35 -7
- data/public/resources/ext/css/yourtheme.css +11 -5
- data/public/resources/ext/images/access/panel/tool-sprites.gif +0 -0
- data/public/resources/ext/images/default/grid/grid3-rowheader.gif +0 -0
- data/public/resources/ext/images/default/grid/refresh-disabled.gif +0 -0
- data/public/resources/ext/images/default/panel/tool-sprites.gif +0 -0
- data/public/resources/ext/images/gray/grid/sort-hd.gif +0 -0
- data/public/resources/ext/images/gray/panel/tool-sprites.gif +0 -0
- data/public/resources/ext/images/gray/window/left-corners.png +0 -0
- data/public/resources/ext/images/gray/window/left-right.png +0 -0
- data/public/resources/ext/images/gray/window/right-corners.png +0 -0
- data/public/resources/ext/images/gray/window/top-bottom.png +0 -0
- data/public/stylesheets/coderay.css +3 -0
- data/public/stylesheets/markitup.css +19 -0
- data/public/stylesheets/style.css +1 -1
- data/run_tests.sh +1 -0
- data/rwiki.gemspec +56 -37
- data/test/fixtures/pages/Info/dummy +0 -0
- data/test/rwiki/models/test_folder.rb +4 -4
- data/vendor/.gitkeep +0 -0
- data/views/layout.erb +13 -5
- metadata +78 -69
- data/.idea/projectCodeStyle.xml +0 -80
- data/.rvmrc +0 -1
- data/public/javascripts/Rwiki/SidePanel.js +0 -26
- data/public/javascripts/Rwiki/Toolbar.js +0 -31
- data/public/javascripts/Rwiki/Viewport.js +0 -10
- data/tmp/ExtDesigner/MyViewport.js +0 -18
- data/tmp/ExtDesigner/MyViewport.ui.js +0 -29
- data/tmp/ExtDesigner/Rwiki.EditorPanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.EditorPanel.ui.js +0 -27
- data/tmp/ExtDesigner/Rwiki.MainPanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.MainPanel.ui.js +0 -29
- data/tmp/ExtDesigner/Rwiki.TabPane.PageTab.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TabPane.PageTab.ui.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TabPanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TabPanel.ui.js +0 -27
- data/tmp/ExtDesigner/Rwiki.TreePanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TreePanel.ui.js +0 -27
- data/tmp/ExtDesigner/Rwiki.Viewport.js +0 -18
- data/tmp/ExtDesigner/Rwiki.Viewport.ui.js +0 -30
- data/tmp/ExtDesigner/rwiki.xds +0 -192
- data/tmp/ExtDesigner/xds_includeOrder.txt +0 -12
- data/tmp/ExtDesigner/xds_index.html +0 -26
- data/tmp/ExtDesigner/xds_index.js +0 -19
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Ext.ns('Rwiki');
|
|
2
|
+
|
|
3
|
+
Rwiki.FuzzyFinderDialog = Ext.extend(Ext.Window, {
|
|
4
|
+
constructor: function() {
|
|
5
|
+
var self = this;
|
|
6
|
+
|
|
7
|
+
var dataStore = new Ext.data.Store({
|
|
8
|
+
proxy: new Ext.data.HttpProxy({
|
|
9
|
+
method: 'GET',
|
|
10
|
+
url: '/fuzzy_finder'
|
|
11
|
+
}),
|
|
12
|
+
|
|
13
|
+
reader: new Ext.data.JsonReader({
|
|
14
|
+
root: 'results',
|
|
15
|
+
totalProperty: 'count',
|
|
16
|
+
id: 'path'
|
|
17
|
+
}, [
|
|
18
|
+
{name: 'path', mapping: 'path'},
|
|
19
|
+
{name: 'score', mapping: 'score'},
|
|
20
|
+
{name: 'highlighted_path', mapping: 'highlighted_path'}
|
|
21
|
+
])
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Custom rendering Template
|
|
25
|
+
var resultTpl = new Ext.XTemplate(
|
|
26
|
+
'<tpl for="."><div class="search-item">',
|
|
27
|
+
'{highlighted_path}',
|
|
28
|
+
'</div></tpl>'
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
var search = new Ext.form.ComboBox({
|
|
32
|
+
store: dataStore,
|
|
33
|
+
displayField: 'title',
|
|
34
|
+
typeAhead: false,
|
|
35
|
+
loadingText: 'Searching...',
|
|
36
|
+
pageSize: 10,
|
|
37
|
+
hideTrigger: true,
|
|
38
|
+
tpl: resultTpl,
|
|
39
|
+
itemSelector: 'div.search-item',
|
|
40
|
+
onSelect: function(record) {
|
|
41
|
+
var path = record.data.path;
|
|
42
|
+
Rwiki.NodeManager.getInstance().loadPage(path);
|
|
43
|
+
self.close();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
Ext.apply(this, {
|
|
48
|
+
title: 'FuzzyFinder',
|
|
49
|
+
maximizable: false,
|
|
50
|
+
modal: true,
|
|
51
|
+
width: 400,
|
|
52
|
+
layout: 'fit',
|
|
53
|
+
plain: true,
|
|
54
|
+
bodyStyle: 'padding: 5px;',
|
|
55
|
+
items: [search],
|
|
56
|
+
defaultButton: search
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
Rwiki.FuzzyFinderDialog.superclass.constructor.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Ext.ns('Rwiki');
|
|
2
|
+
|
|
3
|
+
Rwiki.NavigationPanel = Ext.extend(Ext.Panel, {
|
|
4
|
+
constructor: function() {
|
|
5
|
+
|
|
6
|
+
Ext.apply(this, {
|
|
7
|
+
region: 'west',
|
|
8
|
+
layout: 'border',
|
|
9
|
+
|
|
10
|
+
header: true,
|
|
11
|
+
title: 'Navigation panel',
|
|
12
|
+
|
|
13
|
+
split: true,
|
|
14
|
+
collapsible: true,
|
|
15
|
+
|
|
16
|
+
width: 255,
|
|
17
|
+
minSize: 255,
|
|
18
|
+
maxSize: 500,
|
|
19
|
+
margins: '3 0 3 3',
|
|
20
|
+
cmargins: '3 3 3 3'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
Rwiki.NavigationPanel.superclass.constructor.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -11,6 +11,7 @@ Rwiki.NodeManager = Ext.extend(Ext.util.Observable, {
|
|
|
11
11
|
|
|
12
12
|
initEvents: function() {
|
|
13
13
|
this.addEvents(
|
|
14
|
+
'rwiki:beforePageLoad',
|
|
14
15
|
'rwiki:pageLoaded',
|
|
15
16
|
'rwiki:nodeDeleted',
|
|
16
17
|
'rwiki:folderCreated',
|
|
@@ -23,6 +24,7 @@ Rwiki.NodeManager = Ext.extend(Ext.util.Observable, {
|
|
|
23
24
|
|
|
24
25
|
loadPage: function(path) {
|
|
25
26
|
var self = this;
|
|
27
|
+
self.fireEvent('rwiki:beforePageLoad', path);
|
|
26
28
|
|
|
27
29
|
$.ajax({
|
|
28
30
|
type: 'GET',
|
|
@@ -10,7 +10,17 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
|
10
10
|
defaults: {
|
|
11
11
|
autoScroll: true
|
|
12
12
|
},
|
|
13
|
-
plugins: new Ext.ux.TabCloseMenu()
|
|
13
|
+
plugins: new Ext.ux.TabCloseMenu(),
|
|
14
|
+
tbar: [{
|
|
15
|
+
text: 'Edit the page',
|
|
16
|
+
scope: this,
|
|
17
|
+
handler: this.onEditPage,
|
|
18
|
+
iconCls: 'icon-edit'
|
|
19
|
+
}, {
|
|
20
|
+
text: 'Find page',
|
|
21
|
+
scope: this,
|
|
22
|
+
handler: this.onFuzzyFinder
|
|
23
|
+
}]
|
|
14
24
|
});
|
|
15
25
|
|
|
16
26
|
Rwiki.TabPanel.superclass.initComponent.apply(this, arguments);
|
|
@@ -18,7 +28,9 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
|
18
28
|
|
|
19
29
|
initEvents: function() {
|
|
20
30
|
Rwiki.TabPanel.superclass.initEvents.apply(this, arguments);
|
|
21
|
-
|
|
31
|
+
|
|
32
|
+
this.addEvents('rwiki:editPage');
|
|
33
|
+
|
|
22
34
|
this.on('pageSelected', this.onPageSelected),
|
|
23
35
|
this.on('tabchange', this.onTabChange);
|
|
24
36
|
|
|
@@ -70,8 +82,11 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
|
70
82
|
|
|
71
83
|
onTabChange: function(panel, tab) {
|
|
72
84
|
if (tab) {
|
|
85
|
+
Ext.History.add(tab.getPagePath());
|
|
86
|
+
document.title = 'Rwiki ' + tab.getPagePath();
|
|
73
87
|
Rwiki.NodeManager.getInstance().loadPage(tab.getPagePath());
|
|
74
88
|
} else {
|
|
89
|
+
document.title = 'Rwiki';
|
|
75
90
|
Rwiki.NodeManager.getInstance().fireEvent('rwiki:lastPageClosed');
|
|
76
91
|
}
|
|
77
92
|
},
|
|
@@ -101,6 +116,8 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
|
101
116
|
var oldPath = data.oldPath;
|
|
102
117
|
var path = data.path;
|
|
103
118
|
|
|
119
|
+
var currentTab = this.getActiveTab();
|
|
120
|
+
|
|
104
121
|
var tab = null;
|
|
105
122
|
var isPage = oldPath.match(new RegExp('\.txt$'));
|
|
106
123
|
if (isPage) {
|
|
@@ -110,12 +127,20 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
|
110
127
|
tab.setPagePath(path);
|
|
111
128
|
var title = data.baseName.replace(new RegExp('\.txt$'), '');
|
|
112
129
|
tab.setTitle(title);
|
|
130
|
+
|
|
131
|
+
if (tab == currentTab) {
|
|
132
|
+
document.title = 'Rwiki ' + path;
|
|
133
|
+
}
|
|
113
134
|
} else {
|
|
114
135
|
var tabs = this.findTabsByParentPath(oldPath);
|
|
115
136
|
for (var i = 0; i < tabs.length; i++) {
|
|
116
137
|
tab = tabs[i];
|
|
117
138
|
var newPath = tab.getPagePath().replace(oldPath, path);
|
|
118
139
|
tab.setPagePath(newPath);
|
|
140
|
+
|
|
141
|
+
if (tab == currentTab) {
|
|
142
|
+
document.title = 'Rwiki ' + newPath;
|
|
143
|
+
}
|
|
119
144
|
}
|
|
120
145
|
}
|
|
121
146
|
},
|
|
@@ -126,5 +151,17 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
|
126
151
|
var tab = tabs[i];
|
|
127
152
|
this.remove(tab);
|
|
128
153
|
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
onEditPage: function() {
|
|
157
|
+
var currentTab = this.getActiveTab();
|
|
158
|
+
if (currentTab) {
|
|
159
|
+
this.fireEvent('rwiki:editPage', currentTab.getPagePath());
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
onFuzzyFinder: function() {
|
|
164
|
+
var fuzzyFinder = new Rwiki.FuzzyFinderDialog(this.dataStore);
|
|
165
|
+
fuzzyFinder.show();
|
|
129
166
|
}
|
|
130
167
|
});
|
|
@@ -6,11 +6,12 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
6
6
|
|
|
7
7
|
Ext.apply(this, {
|
|
8
8
|
id: 'tree',
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
region: 'center',
|
|
10
|
+
autoScroll: true,
|
|
11
|
+
|
|
11
12
|
animate: true,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
useArrows: true,
|
|
14
|
+
rootVisible: true,
|
|
14
15
|
loader: new Rwiki.TreePanel.Loader(),
|
|
15
16
|
|
|
16
17
|
enableDD: true,
|
|
@@ -30,6 +31,9 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
30
31
|
|
|
31
32
|
Rwiki.TreePanel.superclass.constructor.apply(this, arguments);
|
|
32
33
|
|
|
34
|
+
this.contextMenu = new Rwiki.TreePanel.Menu();
|
|
35
|
+
this.on('contextmenu', this.onContextMenu, this);
|
|
36
|
+
|
|
33
37
|
this.filter = new Rwiki.TreePanel.Filter(this);
|
|
34
38
|
this.root.expand();
|
|
35
39
|
|
|
@@ -59,16 +63,12 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
59
63
|
|
|
60
64
|
this.on('click', this.onClick);
|
|
61
65
|
|
|
66
|
+
this.on('rwiki:pageLoaded', this.onPageLoaded);
|
|
62
67
|
this.on('rwiki:folderCreated', this.onFolderCreated);
|
|
63
68
|
this.on('rwiki:pageCreated', this.onPageCreated);
|
|
64
69
|
this.on('rwiki:nodeRenamed', this.onNodeRenamed);
|
|
65
70
|
this.on('rwiki:nodeDeleted', this.onNodeDeleted);
|
|
66
|
-
this.on('beforemovenode', this.
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
setContextMenu: function(contextMenu) {
|
|
70
|
-
this.contextMenu = contextMenu;
|
|
71
|
-
this.on('contextmenu', this.onContextMenu, this);
|
|
71
|
+
this.on('beforemovenode', this.onBeforeMoveNode);
|
|
72
72
|
},
|
|
73
73
|
|
|
74
74
|
onContextMenu: function(node, e) {
|
|
@@ -88,8 +88,15 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
88
88
|
this.fireEvent('pageSelected', path);
|
|
89
89
|
},
|
|
90
90
|
|
|
91
|
+
onPageLoaded: function(data) {
|
|
92
|
+
var node = this.findNodeByPath(data.path);
|
|
93
|
+
if (node) {
|
|
94
|
+
node.select();
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
91
98
|
onFolderCreated: function(data) {
|
|
92
|
-
var node = new
|
|
99
|
+
var node = new Rwiki.TreePanel.Node({
|
|
93
100
|
baseName: data.baseName,
|
|
94
101
|
text: data.baseName,
|
|
95
102
|
cls: 'folder',
|
|
@@ -98,11 +105,12 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
98
105
|
});
|
|
99
106
|
|
|
100
107
|
var parentNode = this.findNodeByPath(data.parentPath);
|
|
108
|
+
parentNode.expand();
|
|
101
109
|
parentNode.appendChild(node);
|
|
102
110
|
},
|
|
103
111
|
|
|
104
112
|
onPageCreated: function(data) {
|
|
105
|
-
var node = new
|
|
113
|
+
var node = new Rwiki.TreePanel.Node({
|
|
106
114
|
baseName: data.baseName,
|
|
107
115
|
text: data.baseName.replace(new RegExp('\.txt$'), ''),
|
|
108
116
|
cls: 'page',
|
|
@@ -118,7 +126,7 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
118
126
|
|
|
119
127
|
onNodeRenamed: function(data) {
|
|
120
128
|
var node = this.findNodeByPath(data.oldPath);
|
|
121
|
-
node.
|
|
129
|
+
node.setBaseName(data.baseName);
|
|
122
130
|
|
|
123
131
|
var title = data.baseName.replace(new RegExp('\.txt$'), '');
|
|
124
132
|
node.setText(title);
|
|
@@ -130,7 +138,7 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
130
138
|
node.remove();
|
|
131
139
|
},
|
|
132
140
|
|
|
133
|
-
|
|
141
|
+
onBeforeMoveNode: function(tree, node, oldParent, newParent, index) {
|
|
134
142
|
var path = node.getPath();
|
|
135
143
|
var newParentPath = newParent.getPath();
|
|
136
144
|
|
|
@@ -140,20 +148,25 @@ Rwiki.TreePanel = Ext.extend(Ext.tree.TreePanel, {
|
|
|
140
148
|
},
|
|
141
149
|
|
|
142
150
|
findNodeByPath: function(path) {
|
|
143
|
-
var
|
|
144
|
-
|
|
151
|
+
var node = null;
|
|
152
|
+
this.root.cascadeAll(function(curretNode) {
|
|
153
|
+
if (curretNode.getPath() == path) {
|
|
154
|
+
node = curretNode;
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
145
158
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
159
|
+
return node;
|
|
160
|
+
},
|
|
149
161
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (baseName == '') continue;
|
|
153
|
-
|
|
154
|
-
node = node.findChild('baseName', baseName);
|
|
155
|
-
}
|
|
162
|
+
openNodeFromLocationHash: function() {
|
|
163
|
+
if (!location.hash) return;
|
|
156
164
|
|
|
157
|
-
|
|
165
|
+
var path = location.hash.replace(new RegExp('^#'), '');
|
|
166
|
+
var node = this.findNodeByPath(path);
|
|
167
|
+
if (node) {
|
|
168
|
+
node.expandAll();
|
|
169
|
+
this.onClick(node);
|
|
170
|
+
}
|
|
158
171
|
}
|
|
159
172
|
});
|
|
@@ -93,7 +93,7 @@ Rwiki.TreePanel.Menu = Ext.extend(Ext.menu.Menu, {
|
|
|
93
93
|
var callback = function(button) {
|
|
94
94
|
if (button != 'yes') return;
|
|
95
95
|
Rwiki.NodeManager.getInstance().deleteNode(path);
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
|
|
98
98
|
var message = 'Delete "' + path + '"?';
|
|
99
99
|
Ext.MessageBox.confirm('Confirm', message, callback);
|
|
@@ -8,7 +8,53 @@ Rwiki.TreePanel.Node = Ext.extend(Ext.tree.AsyncTreeNode, {
|
|
|
8
8
|
return path.replace(/^\//, '');
|
|
9
9
|
},
|
|
10
10
|
|
|
11
|
+
setBaseName: function(baseName) {
|
|
12
|
+
this.attributes.baseName = baseName;
|
|
13
|
+
},
|
|
14
|
+
|
|
11
15
|
getBaseName: function() {
|
|
12
16
|
return this.attributes.baseName;
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
expandAll: function() {
|
|
20
|
+
var nodes = [];
|
|
21
|
+
|
|
22
|
+
this.bubble(function(n) {
|
|
23
|
+
nodes.push(n);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
nodes = nodes.reverse();
|
|
27
|
+
|
|
28
|
+
for (var i = 0, len = nodes.length; i < len; i++) {
|
|
29
|
+
var node = nodes[i];
|
|
30
|
+
if (node.isExpandable()) {
|
|
31
|
+
node.expand(false);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Better version of cascade function.
|
|
38
|
+
* It can iterate through collapsed nodes.
|
|
39
|
+
* @see cascade
|
|
40
|
+
*/
|
|
41
|
+
cascadeAll: function(fn, scope, args) {
|
|
42
|
+
var wasCollapsed = this.isExpandable() && !this.isExpanded();
|
|
43
|
+
|
|
44
|
+
if (wasCollapsed) {
|
|
45
|
+
this.expand(false, false);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (fn.apply(scope || this, args || [this]) !== false){
|
|
49
|
+
var cs = this.childNodes;
|
|
50
|
+
for (var i = 0, len = cs.length; i < len; i++) {
|
|
51
|
+
cs[i].cascadeAll(fn, args);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (wasCollapsed) {
|
|
56
|
+
this.collapse(false, false);
|
|
57
|
+
}
|
|
13
58
|
}
|
|
59
|
+
|
|
14
60
|
});
|
|
@@ -1,22 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Ext JS Library 3.3.1
|
|
3
|
+
* Copyright(c) 2006-2010 Sencha Inc.
|
|
4
|
+
* licensing@sencha.com
|
|
5
|
+
* http://www.sencha.com/license
|
|
6
|
+
*/
|
|
7
|
+
// for old browsers
|
|
3
8
|
window.undefined = window.undefined;
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @class Ext
|
|
12
|
+
* Ext core utilities and functions.
|
|
13
|
+
* @singleton
|
|
14
|
+
*/
|
|
6
15
|
|
|
7
16
|
Ext = {
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The version of the framework
|
|
19
|
+
* @type String
|
|
20
|
+
*/
|
|
21
|
+
version : '3.3.1',
|
|
10
22
|
versionDetail : {
|
|
11
|
-
major: 3,
|
|
12
|
-
minor:
|
|
13
|
-
patch: 1
|
|
23
|
+
major : 3,
|
|
24
|
+
minor : 3,
|
|
25
|
+
patch : 1
|
|
14
26
|
}
|
|
15
27
|
};
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Copies all the properties of config to obj.
|
|
31
|
+
* @param {Object} obj The receiver of the properties
|
|
32
|
+
* @param {Object} config The source of the properties
|
|
33
|
+
* @param {Object} defaults A different object that will also be applied for default values
|
|
34
|
+
* @return {Object} returns obj
|
|
35
|
+
* @member Ext apply
|
|
36
|
+
*/
|
|
18
37
|
Ext.apply = function(o, c, defaults){
|
|
19
|
-
|
|
38
|
+
// no "this" reference for friendly out of scope calls
|
|
20
39
|
if(defaults){
|
|
21
40
|
Ext.apply(o, defaults);
|
|
22
41
|
}
|
|
@@ -36,17 +55,18 @@ Ext.apply = function(o, c, defaults){
|
|
|
36
55
|
return r.test(ua);
|
|
37
56
|
},
|
|
38
57
|
DOC = document,
|
|
58
|
+
docMode = DOC.documentMode,
|
|
39
59
|
isStrict = DOC.compatMode == "CSS1Compat",
|
|
40
60
|
isOpera = check(/opera/),
|
|
41
61
|
isChrome = check(/\bchrome\b/),
|
|
42
62
|
isWebKit = check(/webkit/),
|
|
43
63
|
isSafari = !isChrome && check(/safari/),
|
|
44
|
-
isSafari2 = isSafari && check(/applewebkit\/4/),
|
|
64
|
+
isSafari2 = isSafari && check(/applewebkit\/4/), // unique to Safari 2
|
|
45
65
|
isSafari3 = isSafari && check(/version\/3/),
|
|
46
66
|
isSafari4 = isSafari && check(/version\/4/),
|
|
47
67
|
isIE = !isOpera && check(/msie/),
|
|
48
|
-
isIE7 = isIE && check(/msie 7/),
|
|
49
|
-
isIE8 = isIE && check(/msie 8/),
|
|
68
|
+
isIE7 = isIE && (check(/msie 7/) || docMode == 7),
|
|
69
|
+
isIE8 = isIE && (check(/msie 8/) && docMode != 7),
|
|
50
70
|
isIE6 = isIE && !isIE7 && !isIE8,
|
|
51
71
|
isGecko = !isWebKit && check(/gecko/),
|
|
52
72
|
isGecko2 = isGecko && check(/rv:1\.8/),
|
|
@@ -58,7 +78,7 @@ Ext.apply = function(o, c, defaults){
|
|
|
58
78
|
isLinux = check(/linux/),
|
|
59
79
|
isSecure = /^https/i.test(window.location.protocol);
|
|
60
80
|
|
|
61
|
-
|
|
81
|
+
// remove css image flicker
|
|
62
82
|
if(isIE6){
|
|
63
83
|
try{
|
|
64
84
|
DOC.execCommand("BackgroundImageCache", false, true);
|
|
@@ -66,30 +86,76 @@ Ext.apply = function(o, c, defaults){
|
|
|
66
86
|
}
|
|
67
87
|
|
|
68
88
|
Ext.apply(Ext, {
|
|
69
|
-
|
|
89
|
+
/**
|
|
90
|
+
* URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent
|
|
91
|
+
* the IE insecure content warning (<tt>'about:blank'</tt>, except for IE in secure mode, which is <tt>'javascript:""'</tt>).
|
|
92
|
+
* @type String
|
|
93
|
+
*/
|
|
70
94
|
SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank',
|
|
71
|
-
|
|
95
|
+
/**
|
|
96
|
+
* True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode
|
|
97
|
+
* @type Boolean
|
|
98
|
+
*/
|
|
72
99
|
isStrict : isStrict,
|
|
73
|
-
|
|
100
|
+
/**
|
|
101
|
+
* True if the page is running over SSL
|
|
102
|
+
* @type Boolean
|
|
103
|
+
*/
|
|
74
104
|
isSecure : isSecure,
|
|
75
|
-
|
|
105
|
+
/**
|
|
106
|
+
* True when the document is fully initialized and ready for action
|
|
107
|
+
* @type Boolean
|
|
108
|
+
*/
|
|
76
109
|
isReady : false,
|
|
77
110
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
111
|
+
/**
|
|
112
|
+
* True if the {@link Ext.Fx} Class is available
|
|
113
|
+
* @type Boolean
|
|
114
|
+
* @property enableFx
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* HIGHLY EXPERIMENTAL
|
|
119
|
+
* True to force css based border-box model override and turning off javascript based adjustments. This is a
|
|
120
|
+
* runtime configuration and must be set before onReady.
|
|
121
|
+
* @type Boolean
|
|
122
|
+
*/
|
|
123
|
+
enableForcedBoxModel : false,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
|
|
127
|
+
* @type Boolean
|
|
128
|
+
*/
|
|
81
129
|
enableGarbageCollector : true,
|
|
82
130
|
|
|
83
|
-
|
|
131
|
+
/**
|
|
132
|
+
* True to automatically purge event listeners during garbageCollection (defaults to false).
|
|
133
|
+
* @type Boolean
|
|
134
|
+
*/
|
|
84
135
|
enableListenerCollection : false,
|
|
85
136
|
|
|
86
|
-
|
|
137
|
+
/**
|
|
138
|
+
* EXPERIMENTAL - True to cascade listener removal to child elements when an element is removed.
|
|
139
|
+
* Currently not optimized for performance.
|
|
140
|
+
* @type Boolean
|
|
141
|
+
*/
|
|
87
142
|
enableNestedListenerRemoval : false,
|
|
88
143
|
|
|
89
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Indicates whether to use native browser parsing for JSON methods.
|
|
146
|
+
* This option is ignored if the browser does not support native JSON methods.
|
|
147
|
+
* <b>Note: Native JSON methods will not work with objects that have functions.
|
|
148
|
+
* Also, property names must be quoted, otherwise the data will not parse.</b> (Defaults to false)
|
|
149
|
+
* @type Boolean
|
|
150
|
+
*/
|
|
90
151
|
USE_NATIVE_JSON : false,
|
|
91
152
|
|
|
92
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Copies all the properties of config to obj if they don't already exist.
|
|
155
|
+
* @param {Object} obj The receiver of the properties
|
|
156
|
+
* @param {Object} config The source of the properties
|
|
157
|
+
* @return {Object} returns obj
|
|
158
|
+
*/
|
|
93
159
|
applyIf : function(o, c){
|
|
94
160
|
if(o){
|
|
95
161
|
for(var p in c){
|
|
@@ -101,7 +167,12 @@ Ext.apply = function(o, c, defaults){
|
|
|
101
167
|
return o;
|
|
102
168
|
},
|
|
103
169
|
|
|
104
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Generates unique ids. If the element already has an id, it is unchanged
|
|
172
|
+
* @param {Mixed} el (optional) The element to generate an id for
|
|
173
|
+
* @param {String} prefix (optional) Id prefix (defaults "ext-gen")
|
|
174
|
+
* @return {String} The generated Id.
|
|
175
|
+
*/
|
|
105
176
|
id : function(el, prefix){
|
|
106
177
|
el = Ext.getDom(el, true) || {};
|
|
107
178
|
if (!el.id) {
|
|
@@ -110,9 +181,57 @@ Ext.apply = function(o, c, defaults){
|
|
|
110
181
|
return el.id;
|
|
111
182
|
},
|
|
112
183
|
|
|
113
|
-
|
|
184
|
+
/**
|
|
185
|
+
* <p>Extends one class to create a subclass and optionally overrides members with the passed literal. This method
|
|
186
|
+
* also adds the function "override()" to the subclass that can be used to override members of the class.</p>
|
|
187
|
+
* For example, to create a subclass of Ext GridPanel:
|
|
188
|
+
* <pre><code>
|
|
189
|
+
MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
|
|
190
|
+
constructor: function(config) {
|
|
191
|
+
|
|
192
|
+
// Create configuration for this Grid.
|
|
193
|
+
var store = new Ext.data.Store({...});
|
|
194
|
+
var colModel = new Ext.grid.ColumnModel({...});
|
|
195
|
+
|
|
196
|
+
// Create a new config object containing our computed properties
|
|
197
|
+
// *plus* whatever was in the config parameter.
|
|
198
|
+
config = Ext.apply({
|
|
199
|
+
store: store,
|
|
200
|
+
colModel: colModel
|
|
201
|
+
}, config);
|
|
202
|
+
|
|
203
|
+
MyGridPanel.superclass.constructor.call(this, config);
|
|
204
|
+
|
|
205
|
+
// Your postprocessing here
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
yourMethod: function() {
|
|
209
|
+
// etc.
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
</code></pre>
|
|
213
|
+
*
|
|
214
|
+
* <p>This function also supports a 3-argument call in which the subclass's constructor is
|
|
215
|
+
* passed as an argument. In this form, the parameters are as follows:</p>
|
|
216
|
+
* <div class="mdetail-params"><ul>
|
|
217
|
+
* <li><code>subclass</code> : Function <div class="sub-desc">The subclass constructor.</div></li>
|
|
218
|
+
* <li><code>superclass</code> : Function <div class="sub-desc">The constructor of class being extended</div></li>
|
|
219
|
+
* <li><code>overrides</code> : Object <div class="sub-desc">A literal with members which are copied into the subclass's
|
|
220
|
+
* prototype, and are therefore shared among all instances of the new class.</div></li>
|
|
221
|
+
* </ul></div>
|
|
222
|
+
*
|
|
223
|
+
* @param {Function} superclass The constructor of class being extended.
|
|
224
|
+
* @param {Object} overrides <p>A literal with members which are copied into the subclass's
|
|
225
|
+
* prototype, and are therefore shared between all instances of the new class.</p>
|
|
226
|
+
* <p>This may contain a special member named <tt><b>constructor</b></tt>. This is used
|
|
227
|
+
* to define the constructor of the new class, and is returned. If this property is
|
|
228
|
+
* <i>not</i> specified, a constructor is generated and returned which just calls the
|
|
229
|
+
* superclass's constructor passing on its parameters.</p>
|
|
230
|
+
* <p><b>It is essential that you call the superclass constructor in any provided constructor. See example code.</b></p>
|
|
231
|
+
* @return {Function} The subclass constructor from the <code>overrides</code> parameter, or a generated one if not provided.
|
|
232
|
+
*/
|
|
114
233
|
extend : function(){
|
|
115
|
-
|
|
234
|
+
// inline overrides
|
|
116
235
|
var io = function(o){
|
|
117
236
|
for(var m in o){
|
|
118
237
|
this[m] = o[m];
|
|
@@ -150,7 +269,23 @@ Ext.apply = function(o, c, defaults){
|
|
|
150
269
|
};
|
|
151
270
|
}(),
|
|
152
271
|
|
|
153
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name.
|
|
274
|
+
* Usage:<pre><code>
|
|
275
|
+
Ext.override(MyClass, {
|
|
276
|
+
newMethod1: function(){
|
|
277
|
+
// etc.
|
|
278
|
+
},
|
|
279
|
+
newMethod2: function(foo){
|
|
280
|
+
// etc.
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
</code></pre>
|
|
284
|
+
* @param {Object} origclass The class to override
|
|
285
|
+
* @param {Object} overrides The list of functions to add to origClass. This should be specified as an object literal
|
|
286
|
+
* containing one or more methods.
|
|
287
|
+
* @method override
|
|
288
|
+
*/
|
|
154
289
|
override : function(origclass, overrides){
|
|
155
290
|
if(overrides){
|
|
156
291
|
var p = origclass.prototype;
|
|
@@ -161,7 +296,21 @@ Ext.apply = function(o, c, defaults){
|
|
|
161
296
|
}
|
|
162
297
|
},
|
|
163
298
|
|
|
164
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Creates namespaces to be used for scoping variables and classes so that they are not global.
|
|
301
|
+
* Specifying the last node of a namespace implicitly creates all other nodes. Usage:
|
|
302
|
+
* <pre><code>
|
|
303
|
+
Ext.namespace('Company', 'Company.data');
|
|
304
|
+
Ext.namespace('Company.data'); // equivalent and preferable to above syntax
|
|
305
|
+
Company.Widget = function() { ... }
|
|
306
|
+
Company.data.CustomStore = function(config) { ... }
|
|
307
|
+
</code></pre>
|
|
308
|
+
* @param {String} namespace1
|
|
309
|
+
* @param {String} namespace2
|
|
310
|
+
* @param {String} etc
|
|
311
|
+
* @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
|
|
312
|
+
* @method namespace
|
|
313
|
+
*/
|
|
165
314
|
namespace : function(){
|
|
166
315
|
var o, d;
|
|
167
316
|
Ext.each(arguments, function(v) {
|
|
@@ -174,7 +323,12 @@ Ext.apply = function(o, c, defaults){
|
|
|
174
323
|
return o;
|
|
175
324
|
},
|
|
176
325
|
|
|
177
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value.
|
|
328
|
+
* @param {Object} o
|
|
329
|
+
* @param {String} pre (optional) A prefix to add to the url encoded string
|
|
330
|
+
* @return {String}
|
|
331
|
+
*/
|
|
178
332
|
urlEncode : function(o, pre){
|
|
179
333
|
var empty,
|
|
180
334
|
buf = [],
|
|
@@ -193,7 +347,15 @@ Ext.apply = function(o, c, defaults){
|
|
|
193
347
|
return pre + buf.join('');
|
|
194
348
|
},
|
|
195
349
|
|
|
196
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Takes an encoded URL and and converts it to an object. Example: <pre><code>
|
|
352
|
+
Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}
|
|
353
|
+
Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}
|
|
354
|
+
</code></pre>
|
|
355
|
+
* @param {String} string
|
|
356
|
+
* @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).
|
|
357
|
+
* @return {Object} A literal with members
|
|
358
|
+
*/
|
|
197
359
|
urlDecode : function(string, overwrite){
|
|
198
360
|
if(Ext.isEmpty(string)){
|
|
199
361
|
return {};
|
|
@@ -213,7 +375,13 @@ Ext.apply = function(o, c, defaults){
|
|
|
213
375
|
return obj;
|
|
214
376
|
},
|
|
215
377
|
|
|
216
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Appends content to the query string of a URL, handling logic for whether to place
|
|
380
|
+
* a question mark or ampersand.
|
|
381
|
+
* @param {String} url The URL to append to.
|
|
382
|
+
* @param {String} s The content to append to the URL.
|
|
383
|
+
* @return (String) The resulting URL
|
|
384
|
+
*/
|
|
217
385
|
urlAppend : function(url, s){
|
|
218
386
|
if(!Ext.isEmpty(s)){
|
|
219
387
|
return url + (url.indexOf('?') === -1 ? '?' : '&') + s;
|
|
@@ -221,7 +389,13 @@ Ext.apply = function(o, c, defaults){
|
|
|
221
389
|
return url;
|
|
222
390
|
},
|
|
223
391
|
|
|
224
|
-
|
|
392
|
+
/**
|
|
393
|
+
* Converts any iterable (numeric indices and a length property) into a true array
|
|
394
|
+
* Don't use this on strings. IE doesn't support "abc"[0] which this implementation depends on.
|
|
395
|
+
* For strings, use this instead: "abc".match(/./g) => [a,b,c];
|
|
396
|
+
* @param {Iterable} the iterable object to be turned into a true Array.
|
|
397
|
+
* @return (Array) array
|
|
398
|
+
*/
|
|
225
399
|
toArray : function(){
|
|
226
400
|
return isIE ?
|
|
227
401
|
function(a, i, j, res){
|
|
@@ -233,24 +407,46 @@ Ext.apply = function(o, c, defaults){
|
|
|
233
407
|
} :
|
|
234
408
|
function(a, i, j){
|
|
235
409
|
return Array.prototype.slice.call(a, i || 0, j || a.length);
|
|
236
|
-
}
|
|
410
|
+
};
|
|
237
411
|
}(),
|
|
238
412
|
|
|
239
413
|
isIterable : function(v){
|
|
240
|
-
|
|
414
|
+
//check for array or arguments
|
|
241
415
|
if(Ext.isArray(v) || v.callee){
|
|
242
416
|
return true;
|
|
243
417
|
}
|
|
244
|
-
|
|
418
|
+
//check for node list type
|
|
245
419
|
if(/NodeList|HTMLCollection/.test(toString.call(v))){
|
|
246
420
|
return true;
|
|
247
421
|
}
|
|
248
|
-
|
|
249
|
-
|
|
422
|
+
//NodeList has an item and length property
|
|
423
|
+
//IXMLDOMNodeList has nextNode method, needs to be checked first.
|
|
250
424
|
return ((typeof v.nextNode != 'undefined' || v.item) && Ext.isNumber(v.length));
|
|
251
425
|
},
|
|
252
426
|
|
|
253
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Iterates an array calling the supplied function.
|
|
429
|
+
* @param {Array/NodeList/Mixed} array The array to be iterated. If this
|
|
430
|
+
* argument is not really an array, the supplied function is called once.
|
|
431
|
+
* @param {Function} fn The function to be called with each item. If the
|
|
432
|
+
* supplied function returns false, iteration stops and this method returns
|
|
433
|
+
* the current <code>index</code>. This function is called with
|
|
434
|
+
* the following arguments:
|
|
435
|
+
* <div class="mdetail-params"><ul>
|
|
436
|
+
* <li><code>item</code> : <i>Mixed</i>
|
|
437
|
+
* <div class="sub-desc">The item at the current <code>index</code>
|
|
438
|
+
* in the passed <code>array</code></div></li>
|
|
439
|
+
* <li><code>index</code> : <i>Number</i>
|
|
440
|
+
* <div class="sub-desc">The current index within the array</div></li>
|
|
441
|
+
* <li><code>allItems</code> : <i>Array</i>
|
|
442
|
+
* <div class="sub-desc">The <code>array</code> passed as the first
|
|
443
|
+
* argument to <code>Ext.each</code>.</div></li>
|
|
444
|
+
* </ul></div>
|
|
445
|
+
* @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed.
|
|
446
|
+
* Defaults to the <code>item</code> at the current <code>index</code>
|
|
447
|
+
* within the passed <code>array</code>.
|
|
448
|
+
* @return See description for the fn parameter.
|
|
449
|
+
*/
|
|
254
450
|
each : function(array, fn, scope){
|
|
255
451
|
if(Ext.isEmpty(array, true)){
|
|
256
452
|
return;
|
|
@@ -265,7 +461,26 @@ Ext.apply = function(o, c, defaults){
|
|
|
265
461
|
}
|
|
266
462
|
},
|
|
267
463
|
|
|
268
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Iterates either the elements in an array, or each of the properties in an object.
|
|
466
|
+
* <b>Note</b>: If you are only iterating arrays, it is better to call {@link #each}.
|
|
467
|
+
* @param {Object/Array} object The object or array to be iterated
|
|
468
|
+
* @param {Function} fn The function to be called for each iteration.
|
|
469
|
+
* The iteration will stop if the supplied function returns false, or
|
|
470
|
+
* all array elements / object properties have been covered. The signature
|
|
471
|
+
* varies depending on the type of object being interated:
|
|
472
|
+
* <div class="mdetail-params"><ul>
|
|
473
|
+
* <li>Arrays : <tt>(Object item, Number index, Array allItems)</tt>
|
|
474
|
+
* <div class="sub-desc">
|
|
475
|
+
* When iterating an array, the supplied function is called with each item.</div></li>
|
|
476
|
+
* <li>Objects : <tt>(String key, Object value, Object)</tt>
|
|
477
|
+
* <div class="sub-desc">
|
|
478
|
+
* When iterating an object, the supplied function is called with each key-value pair in
|
|
479
|
+
* the object, and the iterated object</div></li>
|
|
480
|
+
* </ul></div>
|
|
481
|
+
* @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed. Defaults to
|
|
482
|
+
* the <code>object</code> being iterated.
|
|
483
|
+
*/
|
|
269
484
|
iterate : function(obj, fn, scope){
|
|
270
485
|
if(Ext.isEmpty(obj)){
|
|
271
486
|
return;
|
|
@@ -284,7 +499,29 @@ Ext.apply = function(o, c, defaults){
|
|
|
284
499
|
}
|
|
285
500
|
},
|
|
286
501
|
|
|
287
|
-
|
|
502
|
+
/**
|
|
503
|
+
* Return the dom node for the passed String (id), dom node, or Ext.Element.
|
|
504
|
+
* Optional 'strict' flag is needed for IE since it can return 'name' and
|
|
505
|
+
* 'id' elements by using getElementById.
|
|
506
|
+
* Here are some examples:
|
|
507
|
+
* <pre><code>
|
|
508
|
+
// gets dom node based on id
|
|
509
|
+
var elDom = Ext.getDom('elId');
|
|
510
|
+
// gets dom node based on the dom node
|
|
511
|
+
var elDom1 = Ext.getDom(elDom);
|
|
512
|
+
|
|
513
|
+
// If we don't know if we are working with an
|
|
514
|
+
// Ext.Element or a dom node use Ext.getDom
|
|
515
|
+
function(el){
|
|
516
|
+
var dom = Ext.getDom(el);
|
|
517
|
+
// do something with the dom node
|
|
518
|
+
}
|
|
519
|
+
* </code></pre>
|
|
520
|
+
* <b>Note</b>: the dom node to be found actually needs to exist (be rendered, etc)
|
|
521
|
+
* when this method is called to be successful.
|
|
522
|
+
* @param {Mixed} el
|
|
523
|
+
* @return HTMLElement
|
|
524
|
+
*/
|
|
288
525
|
getDom : function(el, strict){
|
|
289
526
|
if(!el || !DOC){
|
|
290
527
|
return null;
|
|
@@ -294,8 +531,8 @@ Ext.apply = function(o, c, defaults){
|
|
|
294
531
|
} else {
|
|
295
532
|
if (typeof el == 'string') {
|
|
296
533
|
var e = DOC.getElementById(el);
|
|
297
|
-
|
|
298
|
-
|
|
534
|
+
// IE returns elements with the 'name' and 'id' attribute.
|
|
535
|
+
// we do a strict check to return the element with only the id attribute
|
|
299
536
|
if (e && isIE && strict) {
|
|
300
537
|
if (el == e.getAttribute('id')) {
|
|
301
538
|
return e;
|
|
@@ -310,13 +547,40 @@ Ext.apply = function(o, c, defaults){
|
|
|
310
547
|
}
|
|
311
548
|
},
|
|
312
549
|
|
|
313
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Returns the current document body as an {@link Ext.Element}.
|
|
552
|
+
* @return Ext.Element The document body
|
|
553
|
+
*/
|
|
314
554
|
getBody : function(){
|
|
315
555
|
return Ext.get(DOC.body || DOC.documentElement);
|
|
316
556
|
},
|
|
317
|
-
|
|
318
|
-
|
|
319
557
|
|
|
558
|
+
/**
|
|
559
|
+
* Returns the current document body as an {@link Ext.Element}.
|
|
560
|
+
* @return Ext.Element The document body
|
|
561
|
+
*/
|
|
562
|
+
getHead : function() {
|
|
563
|
+
var head;
|
|
564
|
+
|
|
565
|
+
return function() {
|
|
566
|
+
if (head == undefined) {
|
|
567
|
+
head = Ext.get(DOC.getElementsByTagName("head")[0]);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return head;
|
|
571
|
+
};
|
|
572
|
+
}(),
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Removes a DOM node from the document.
|
|
576
|
+
*/
|
|
577
|
+
/**
|
|
578
|
+
* <p>Removes this element from the document, removes all DOM event listeners, and deletes the cache reference.
|
|
579
|
+
* All DOM event listeners are removed from this element. If {@link Ext#enableNestedListenerRemoval} is
|
|
580
|
+
* <code>true</code>, then DOM event listeners are also removed from all child nodes. The body node
|
|
581
|
+
* will be ignored if passed in.</p>
|
|
582
|
+
* @param {HTMLElement} node The node to remove
|
|
583
|
+
*/
|
|
320
584
|
removeNode : isIE && !isIE8 ? function(){
|
|
321
585
|
var d;
|
|
322
586
|
return function(n){
|
|
@@ -327,7 +591,7 @@ Ext.apply = function(o, c, defaults){
|
|
|
327
591
|
d.innerHTML = '';
|
|
328
592
|
delete Ext.elCache[n.id];
|
|
329
593
|
}
|
|
330
|
-
}
|
|
594
|
+
};
|
|
331
595
|
}() : function(n){
|
|
332
596
|
if(n && n.parentNode && n.tagName != 'BODY'){
|
|
333
597
|
(Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
|
|
@@ -336,112 +600,261 @@ Ext.apply = function(o, c, defaults){
|
|
|
336
600
|
}
|
|
337
601
|
},
|
|
338
602
|
|
|
339
|
-
|
|
603
|
+
/**
|
|
604
|
+
* <p>Returns true if the passed value is empty.</p>
|
|
605
|
+
* <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
|
|
606
|
+
* <li>null</li>
|
|
607
|
+
* <li>undefined</li>
|
|
608
|
+
* <li>an empty array</li>
|
|
609
|
+
* <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
|
|
610
|
+
* </ul></div>
|
|
611
|
+
* @param {Mixed} value The value to test
|
|
612
|
+
* @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)
|
|
613
|
+
* @return {Boolean}
|
|
614
|
+
*/
|
|
340
615
|
isEmpty : function(v, allowBlank){
|
|
341
616
|
return v === null || v === undefined || ((Ext.isArray(v) && !v.length)) || (!allowBlank ? v === '' : false);
|
|
342
617
|
},
|
|
343
618
|
|
|
344
|
-
|
|
619
|
+
/**
|
|
620
|
+
* Returns true if the passed value is a JavaScript array, otherwise false.
|
|
621
|
+
* @param {Mixed} value The value to test
|
|
622
|
+
* @return {Boolean}
|
|
623
|
+
*/
|
|
345
624
|
isArray : function(v){
|
|
346
625
|
return toString.apply(v) === '[object Array]';
|
|
347
626
|
},
|
|
348
627
|
|
|
349
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Returns true if the passed object is a JavaScript date object, otherwise false.
|
|
630
|
+
* @param {Object} object The object to test
|
|
631
|
+
* @return {Boolean}
|
|
632
|
+
*/
|
|
350
633
|
isDate : function(v){
|
|
351
634
|
return toString.apply(v) === '[object Date]';
|
|
352
635
|
},
|
|
353
636
|
|
|
354
|
-
|
|
637
|
+
/**
|
|
638
|
+
* Returns true if the passed value is a JavaScript Object, otherwise false.
|
|
639
|
+
* @param {Mixed} value The value to test
|
|
640
|
+
* @return {Boolean}
|
|
641
|
+
*/
|
|
355
642
|
isObject : function(v){
|
|
356
643
|
return !!v && Object.prototype.toString.call(v) === '[object Object]';
|
|
357
644
|
},
|
|
358
645
|
|
|
359
|
-
|
|
646
|
+
/**
|
|
647
|
+
* Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
|
|
648
|
+
* @param {Mixed} value The value to test
|
|
649
|
+
* @return {Boolean}
|
|
650
|
+
*/
|
|
360
651
|
isPrimitive : function(v){
|
|
361
652
|
return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);
|
|
362
653
|
},
|
|
363
654
|
|
|
364
|
-
|
|
655
|
+
/**
|
|
656
|
+
* Returns true if the passed value is a JavaScript Function, otherwise false.
|
|
657
|
+
* @param {Mixed} value The value to test
|
|
658
|
+
* @return {Boolean}
|
|
659
|
+
*/
|
|
365
660
|
isFunction : function(v){
|
|
366
661
|
return toString.apply(v) === '[object Function]';
|
|
367
662
|
},
|
|
368
663
|
|
|
369
|
-
|
|
664
|
+
/**
|
|
665
|
+
* Returns true if the passed value is a number. Returns false for non-finite numbers.
|
|
666
|
+
* @param {Mixed} value The value to test
|
|
667
|
+
* @return {Boolean}
|
|
668
|
+
*/
|
|
370
669
|
isNumber : function(v){
|
|
371
670
|
return typeof v === 'number' && isFinite(v);
|
|
372
671
|
},
|
|
373
672
|
|
|
374
|
-
|
|
673
|
+
/**
|
|
674
|
+
* Returns true if the passed value is a string.
|
|
675
|
+
* @param {Mixed} value The value to test
|
|
676
|
+
* @return {Boolean}
|
|
677
|
+
*/
|
|
375
678
|
isString : function(v){
|
|
376
679
|
return typeof v === 'string';
|
|
377
680
|
},
|
|
378
681
|
|
|
379
|
-
|
|
682
|
+
/**
|
|
683
|
+
* Returns true if the passed value is a boolean.
|
|
684
|
+
* @param {Mixed} value The value to test
|
|
685
|
+
* @return {Boolean}
|
|
686
|
+
*/
|
|
380
687
|
isBoolean : function(v){
|
|
381
688
|
return typeof v === 'boolean';
|
|
382
689
|
},
|
|
383
690
|
|
|
384
|
-
|
|
691
|
+
/**
|
|
692
|
+
* Returns true if the passed value is an HTMLElement
|
|
693
|
+
* @param {Mixed} value The value to test
|
|
694
|
+
* @return {Boolean}
|
|
695
|
+
*/
|
|
385
696
|
isElement : function(v) {
|
|
386
697
|
return v ? !!v.tagName : false;
|
|
387
698
|
},
|
|
388
699
|
|
|
389
|
-
|
|
700
|
+
/**
|
|
701
|
+
* Returns true if the passed value is not undefined.
|
|
702
|
+
* @param {Mixed} value The value to test
|
|
703
|
+
* @return {Boolean}
|
|
704
|
+
*/
|
|
390
705
|
isDefined : function(v){
|
|
391
706
|
return typeof v !== 'undefined';
|
|
392
707
|
},
|
|
393
708
|
|
|
394
|
-
|
|
709
|
+
/**
|
|
710
|
+
* True if the detected browser is Opera.
|
|
711
|
+
* @type Boolean
|
|
712
|
+
*/
|
|
395
713
|
isOpera : isOpera,
|
|
396
|
-
|
|
714
|
+
/**
|
|
715
|
+
* True if the detected browser uses WebKit.
|
|
716
|
+
* @type Boolean
|
|
717
|
+
*/
|
|
397
718
|
isWebKit : isWebKit,
|
|
398
|
-
|
|
719
|
+
/**
|
|
720
|
+
* True if the detected browser is Chrome.
|
|
721
|
+
* @type Boolean
|
|
722
|
+
*/
|
|
399
723
|
isChrome : isChrome,
|
|
400
|
-
|
|
724
|
+
/**
|
|
725
|
+
* True if the detected browser is Safari.
|
|
726
|
+
* @type Boolean
|
|
727
|
+
*/
|
|
401
728
|
isSafari : isSafari,
|
|
402
|
-
|
|
729
|
+
/**
|
|
730
|
+
* True if the detected browser is Safari 3.x.
|
|
731
|
+
* @type Boolean
|
|
732
|
+
*/
|
|
403
733
|
isSafari3 : isSafari3,
|
|
404
|
-
|
|
734
|
+
/**
|
|
735
|
+
* True if the detected browser is Safari 4.x.
|
|
736
|
+
* @type Boolean
|
|
737
|
+
*/
|
|
405
738
|
isSafari4 : isSafari4,
|
|
406
|
-
|
|
739
|
+
/**
|
|
740
|
+
* True if the detected browser is Safari 2.x.
|
|
741
|
+
* @type Boolean
|
|
742
|
+
*/
|
|
407
743
|
isSafari2 : isSafari2,
|
|
408
|
-
|
|
744
|
+
/**
|
|
745
|
+
* True if the detected browser is Internet Explorer.
|
|
746
|
+
* @type Boolean
|
|
747
|
+
*/
|
|
409
748
|
isIE : isIE,
|
|
410
|
-
|
|
749
|
+
/**
|
|
750
|
+
* True if the detected browser is Internet Explorer 6.x.
|
|
751
|
+
* @type Boolean
|
|
752
|
+
*/
|
|
411
753
|
isIE6 : isIE6,
|
|
412
|
-
|
|
754
|
+
/**
|
|
755
|
+
* True if the detected browser is Internet Explorer 7.x.
|
|
756
|
+
* @type Boolean
|
|
757
|
+
*/
|
|
413
758
|
isIE7 : isIE7,
|
|
414
|
-
|
|
759
|
+
/**
|
|
760
|
+
* True if the detected browser is Internet Explorer 8.x.
|
|
761
|
+
* @type Boolean
|
|
762
|
+
*/
|
|
415
763
|
isIE8 : isIE8,
|
|
416
|
-
|
|
764
|
+
/**
|
|
765
|
+
* True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).
|
|
766
|
+
* @type Boolean
|
|
767
|
+
*/
|
|
417
768
|
isGecko : isGecko,
|
|
418
|
-
|
|
769
|
+
/**
|
|
770
|
+
* True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).
|
|
771
|
+
* @type Boolean
|
|
772
|
+
*/
|
|
419
773
|
isGecko2 : isGecko2,
|
|
420
|
-
|
|
774
|
+
/**
|
|
775
|
+
* True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).
|
|
776
|
+
* @type Boolean
|
|
777
|
+
*/
|
|
421
778
|
isGecko3 : isGecko3,
|
|
422
|
-
|
|
779
|
+
/**
|
|
780
|
+
* True if the detected browser is Internet Explorer running in non-strict mode.
|
|
781
|
+
* @type Boolean
|
|
782
|
+
*/
|
|
423
783
|
isBorderBox : isBorderBox,
|
|
424
|
-
|
|
784
|
+
/**
|
|
785
|
+
* True if the detected platform is Linux.
|
|
786
|
+
* @type Boolean
|
|
787
|
+
*/
|
|
425
788
|
isLinux : isLinux,
|
|
426
|
-
|
|
789
|
+
/**
|
|
790
|
+
* True if the detected platform is Windows.
|
|
791
|
+
* @type Boolean
|
|
792
|
+
*/
|
|
427
793
|
isWindows : isWindows,
|
|
428
|
-
|
|
794
|
+
/**
|
|
795
|
+
* True if the detected platform is Mac OS.
|
|
796
|
+
* @type Boolean
|
|
797
|
+
*/
|
|
429
798
|
isMac : isMac,
|
|
430
|
-
|
|
799
|
+
/**
|
|
800
|
+
* True if the detected platform is Adobe Air.
|
|
801
|
+
* @type Boolean
|
|
802
|
+
*/
|
|
431
803
|
isAir : isAir
|
|
432
804
|
});
|
|
433
805
|
|
|
434
|
-
|
|
806
|
+
/**
|
|
807
|
+
* Creates namespaces to be used for scoping variables and classes so that they are not global.
|
|
808
|
+
* Specifying the last node of a namespace implicitly creates all other nodes. Usage:
|
|
809
|
+
* <pre><code>
|
|
810
|
+
Ext.namespace('Company', 'Company.data');
|
|
811
|
+
Ext.namespace('Company.data'); // equivalent and preferable to above syntax
|
|
812
|
+
Company.Widget = function() { ... }
|
|
813
|
+
Company.data.CustomStore = function(config) { ... }
|
|
814
|
+
</code></pre>
|
|
815
|
+
* @param {String} namespace1
|
|
816
|
+
* @param {String} namespace2
|
|
817
|
+
* @param {String} etc
|
|
818
|
+
* @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
|
|
819
|
+
* @method ns
|
|
820
|
+
*/
|
|
435
821
|
Ext.ns = Ext.namespace;
|
|
436
822
|
})();
|
|
437
823
|
|
|
438
|
-
Ext.ns(
|
|
824
|
+
Ext.ns('Ext.util', 'Ext.lib', 'Ext.data', 'Ext.supports');
|
|
439
825
|
|
|
440
826
|
Ext.elCache = {};
|
|
441
827
|
|
|
442
|
-
|
|
828
|
+
/**
|
|
829
|
+
* @class Function
|
|
830
|
+
* These functions are available on every Function object (any JavaScript function).
|
|
831
|
+
*/
|
|
443
832
|
Ext.apply(Function.prototype, {
|
|
444
|
-
|
|
833
|
+
/**
|
|
834
|
+
* Creates an interceptor function. The passed function is called before the original one. If it returns false,
|
|
835
|
+
* the original one is not called. The resulting function returns the results of the original function.
|
|
836
|
+
* The passed function is called with the parameters of the original function. Example usage:
|
|
837
|
+
* <pre><code>
|
|
838
|
+
var sayHi = function(name){
|
|
839
|
+
alert('Hi, ' + name);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
sayHi('Fred'); // alerts "Hi, Fred"
|
|
843
|
+
|
|
844
|
+
// create a new function that validates input without
|
|
845
|
+
// directly modifying the original function:
|
|
846
|
+
var sayHiToFriend = sayHi.createInterceptor(function(name){
|
|
847
|
+
return name == 'Brian';
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
sayHiToFriend('Fred'); // no alert
|
|
851
|
+
sayHiToFriend('Brian'); // alerts "Hi, Brian"
|
|
852
|
+
</code></pre>
|
|
853
|
+
* @param {Function} fcn The function to call before the original
|
|
854
|
+
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
|
|
855
|
+
* <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
|
|
856
|
+
* @return {Function} The new function
|
|
857
|
+
*/
|
|
445
858
|
createInterceptor : function(fcn, scope){
|
|
446
859
|
var method = this;
|
|
447
860
|
return !Ext.isFunction(fcn) ?
|
|
@@ -457,9 +870,32 @@ Ext.apply(Function.prototype, {
|
|
|
457
870
|
};
|
|
458
871
|
},
|
|
459
872
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
873
|
+
/**
|
|
874
|
+
* Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
|
|
875
|
+
* Call directly on any function. Example: <code>myFunction.createCallback(arg1, arg2)</code>
|
|
876
|
+
* Will create a function that is bound to those 2 args. <b>If a specific scope is required in the
|
|
877
|
+
* callback, use {@link #createDelegate} instead.</b> The function returned by createCallback always
|
|
878
|
+
* executes in the window scope.
|
|
879
|
+
* <p>This method is required when you want to pass arguments to a callback function. If no arguments
|
|
880
|
+
* are needed, you can simply pass a reference to the function as a callback (e.g., callback: myFn).
|
|
881
|
+
* However, if you tried to pass a function with arguments (e.g., callback: myFn(arg1, arg2)) the function
|
|
882
|
+
* would simply execute immediately when the code is parsed. Example usage:
|
|
883
|
+
* <pre><code>
|
|
884
|
+
var sayHi = function(name){
|
|
885
|
+
alert('Hi, ' + name);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// clicking the button alerts "Hi, Fred"
|
|
889
|
+
new Ext.Button({
|
|
890
|
+
text: 'Say Hi',
|
|
891
|
+
renderTo: Ext.getBody(),
|
|
892
|
+
handler: sayHi.createCallback('Fred')
|
|
893
|
+
});
|
|
894
|
+
</code></pre>
|
|
895
|
+
* @return {Function} The new function
|
|
896
|
+
*/
|
|
897
|
+
createCallback : function(/*args...*/){
|
|
898
|
+
// make args available, in function below
|
|
463
899
|
var args = arguments,
|
|
464
900
|
method = this;
|
|
465
901
|
return function() {
|
|
@@ -467,7 +903,37 @@ Ext.apply(Function.prototype, {
|
|
|
467
903
|
};
|
|
468
904
|
},
|
|
469
905
|
|
|
470
|
-
|
|
906
|
+
/**
|
|
907
|
+
* Creates a delegate (callback) that sets the scope to obj.
|
|
908
|
+
* Call directly on any function. Example: <code>this.myFunction.createDelegate(this, [arg1, arg2])</code>
|
|
909
|
+
* Will create a function that is automatically scoped to obj so that the <tt>this</tt> variable inside the
|
|
910
|
+
* callback points to obj. Example usage:
|
|
911
|
+
* <pre><code>
|
|
912
|
+
var sayHi = function(name){
|
|
913
|
+
// Note this use of "this.text" here. This function expects to
|
|
914
|
+
// execute within a scope that contains a text property. In this
|
|
915
|
+
// example, the "this" variable is pointing to the btn object that
|
|
916
|
+
// was passed in createDelegate below.
|
|
917
|
+
alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
var btn = new Ext.Button({
|
|
921
|
+
text: 'Say Hi',
|
|
922
|
+
renderTo: Ext.getBody()
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// This callback will execute in the scope of the
|
|
926
|
+
// button instance. Clicking the button alerts
|
|
927
|
+
// "Hi, Fred. You clicked the "Say Hi" button."
|
|
928
|
+
btn.on('click', sayHi.createDelegate(btn, ['Fred']));
|
|
929
|
+
</code></pre>
|
|
930
|
+
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.
|
|
931
|
+
* <b>If omitted, defaults to the browser window.</b>
|
|
932
|
+
* @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
|
|
933
|
+
* @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
|
|
934
|
+
* if a number the args are inserted at the specified position
|
|
935
|
+
* @return {Function} The new function
|
|
936
|
+
*/
|
|
471
937
|
createDelegate : function(obj, args, appendArgs){
|
|
472
938
|
var method = this;
|
|
473
939
|
return function() {
|
|
@@ -476,15 +942,41 @@ Ext.apply(Function.prototype, {
|
|
|
476
942
|
callArgs = Array.prototype.slice.call(arguments, 0);
|
|
477
943
|
callArgs = callArgs.concat(args);
|
|
478
944
|
}else if (Ext.isNumber(appendArgs)){
|
|
479
|
-
callArgs = Array.prototype.slice.call(arguments, 0);
|
|
480
|
-
var applyArgs = [appendArgs, 0].concat(args);
|
|
481
|
-
Array.prototype.splice.apply(callArgs, applyArgs);
|
|
945
|
+
callArgs = Array.prototype.slice.call(arguments, 0); // copy arguments first
|
|
946
|
+
var applyArgs = [appendArgs, 0].concat(args); // create method call params
|
|
947
|
+
Array.prototype.splice.apply(callArgs, applyArgs); // splice them in
|
|
482
948
|
}
|
|
483
949
|
return method.apply(obj || window, callArgs);
|
|
484
950
|
};
|
|
485
951
|
},
|
|
486
952
|
|
|
487
|
-
|
|
953
|
+
/**
|
|
954
|
+
* Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
|
|
955
|
+
* <pre><code>
|
|
956
|
+
var sayHi = function(name){
|
|
957
|
+
alert('Hi, ' + name);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// executes immediately:
|
|
961
|
+
sayHi('Fred');
|
|
962
|
+
|
|
963
|
+
// executes after 2 seconds:
|
|
964
|
+
sayHi.defer(2000, this, ['Fred']);
|
|
965
|
+
|
|
966
|
+
// this syntax is sometimes useful for deferring
|
|
967
|
+
// execution of an anonymous function:
|
|
968
|
+
(function(){
|
|
969
|
+
alert('Anonymous');
|
|
970
|
+
}).defer(100);
|
|
971
|
+
</code></pre>
|
|
972
|
+
* @param {Number} millis The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately)
|
|
973
|
+
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.
|
|
974
|
+
* <b>If omitted, defaults to the browser window.</b>
|
|
975
|
+
* @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
|
|
976
|
+
* @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
|
|
977
|
+
* if a number the args are inserted at the specified position
|
|
978
|
+
* @return {Number} The timeout id that can be used with clearTimeout
|
|
979
|
+
*/
|
|
488
980
|
defer : function(millis, obj, args, appendArgs){
|
|
489
981
|
var fn = this.createDelegate(obj, args, appendArgs);
|
|
490
982
|
if(millis > 0){
|
|
@@ -495,9 +987,25 @@ Ext.apply(Function.prototype, {
|
|
|
495
987
|
}
|
|
496
988
|
});
|
|
497
989
|
|
|
498
|
-
|
|
990
|
+
/**
|
|
991
|
+
* @class String
|
|
992
|
+
* These functions are available on every String object.
|
|
993
|
+
*/
|
|
499
994
|
Ext.applyIf(String, {
|
|
500
|
-
|
|
995
|
+
/**
|
|
996
|
+
* Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
|
|
997
|
+
* token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
|
|
998
|
+
* <pre><code>
|
|
999
|
+
var cls = 'my-class', text = 'Some text';
|
|
1000
|
+
var s = String.format('<div class="{0}">{1}</div>', cls, text);
|
|
1001
|
+
// s now contains the string: '<div class="my-class">Some text</div>'
|
|
1002
|
+
* </code></pre>
|
|
1003
|
+
* @param {String} string The tokenized string to be formatted
|
|
1004
|
+
* @param {String} value1 The value to replace token {0}
|
|
1005
|
+
* @param {String} value2 Etc...
|
|
1006
|
+
* @return {String} The formatted string
|
|
1007
|
+
* @static
|
|
1008
|
+
*/
|
|
501
1009
|
format : function(format){
|
|
502
1010
|
var args = Ext.toArray(arguments, 1);
|
|
503
1011
|
return format.replace(/\{(\d+)\}/g, function(m, i){
|
|
@@ -506,9 +1014,16 @@ Ext.applyIf(String, {
|
|
|
506
1014
|
}
|
|
507
1015
|
});
|
|
508
1016
|
|
|
509
|
-
|
|
1017
|
+
/**
|
|
1018
|
+
* @class Array
|
|
1019
|
+
*/
|
|
510
1020
|
Ext.applyIf(Array.prototype, {
|
|
511
|
-
|
|
1021
|
+
/**
|
|
1022
|
+
* Checks whether or not the specified object exists in the array.
|
|
1023
|
+
* @param {Object} o The object to check for
|
|
1024
|
+
* @param {Number} from (Optional) The index at which to begin the search
|
|
1025
|
+
* @return {Number} The index of o in the array (or -1 if it is not found)
|
|
1026
|
+
*/
|
|
512
1027
|
indexOf : function(o, from){
|
|
513
1028
|
var len = this.length;
|
|
514
1029
|
from = from || 0;
|
|
@@ -521,7 +1036,11 @@ Ext.applyIf(Array.prototype, {
|
|
|
521
1036
|
return -1;
|
|
522
1037
|
},
|
|
523
1038
|
|
|
524
|
-
|
|
1039
|
+
/**
|
|
1040
|
+
* Removes the specified object from the array. If the object is not found nothing happens.
|
|
1041
|
+
* @param {Object} o The object to remove
|
|
1042
|
+
* @return {Array} this array
|
|
1043
|
+
*/
|
|
525
1044
|
remove : function(o){
|
|
526
1045
|
var index = this.indexOf(o);
|
|
527
1046
|
if(index != -1){
|
|
@@ -530,397 +1049,39 @@ Ext.applyIf(Array.prototype, {
|
|
|
530
1049
|
return this;
|
|
531
1050
|
}
|
|
532
1051
|
});
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
getDoc : function(){
|
|
559
|
-
return Ext.get(document);
|
|
560
|
-
},
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
num : function(v, defaultValue){
|
|
564
|
-
v = Number(Ext.isEmpty(v) || Ext.isArray(v) || typeof v == 'boolean' || (typeof v == 'string' && v.trim().length == 0) ? NaN : v);
|
|
565
|
-
return isNaN(v) ? defaultValue : v;
|
|
566
|
-
},
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
value : function(v, defaultValue, allowBlank){
|
|
570
|
-
return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
|
|
571
|
-
},
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
escapeRe : function(s) {
|
|
575
|
-
return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
|
|
576
|
-
},
|
|
577
|
-
|
|
578
|
-
sequence : function(o, name, fn, scope){
|
|
579
|
-
o[name] = o[name].createSequence(fn, scope);
|
|
580
|
-
},
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
addBehaviors : function(o){
|
|
584
|
-
if(!Ext.isReady){
|
|
585
|
-
Ext.onReady(function(){
|
|
586
|
-
Ext.addBehaviors(o);
|
|
587
|
-
});
|
|
588
|
-
} else {
|
|
589
|
-
var cache = {},
|
|
590
|
-
parts,
|
|
591
|
-
b,
|
|
592
|
-
s;
|
|
593
|
-
for (b in o) {
|
|
594
|
-
if ((parts = b.split('@'))[1]) {
|
|
595
|
-
s = parts[0];
|
|
596
|
-
if(!cache[s]){
|
|
597
|
-
cache[s] = Ext.select(s);
|
|
598
|
-
}
|
|
599
|
-
cache[s].on(parts[1], o[b]);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
cache = null;
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
getScrollBarWidth: function(force){
|
|
608
|
-
if(!Ext.isReady){
|
|
609
|
-
return 0;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if(force === true || scrollWidth === null){
|
|
613
|
-
|
|
614
|
-
var div = Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
|
|
615
|
-
child = div.child('div', true);
|
|
616
|
-
var w1 = child.offsetWidth;
|
|
617
|
-
div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
|
|
618
|
-
var w2 = child.offsetWidth;
|
|
619
|
-
div.remove();
|
|
620
|
-
|
|
621
|
-
scrollWidth = w1 - w2 + 2;
|
|
622
|
-
}
|
|
623
|
-
return scrollWidth;
|
|
624
|
-
},
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
combine : function(){
|
|
629
|
-
var as = arguments, l = as.length, r = [];
|
|
630
|
-
for(var i = 0; i < l; i++){
|
|
631
|
-
var a = as[i];
|
|
632
|
-
if(Ext.isArray(a)){
|
|
633
|
-
r = r.concat(a);
|
|
634
|
-
}else if(a.length !== undefined && !a.substr){
|
|
635
|
-
r = r.concat(Array.prototype.slice.call(a, 0));
|
|
636
|
-
}else{
|
|
637
|
-
r.push(a);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
return r;
|
|
641
|
-
},
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
copyTo : function(dest, source, names){
|
|
645
|
-
if(typeof names == 'string'){
|
|
646
|
-
names = names.split(/[,;\s]/);
|
|
647
|
-
}
|
|
648
|
-
Ext.each(names, function(name){
|
|
649
|
-
if(source.hasOwnProperty(name)){
|
|
650
|
-
dest[name] = source[name];
|
|
651
|
-
}
|
|
652
|
-
}, this);
|
|
653
|
-
return dest;
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
destroy : function(){
|
|
658
|
-
Ext.each(arguments, function(arg){
|
|
659
|
-
if(arg){
|
|
660
|
-
if(Ext.isArray(arg)){
|
|
661
|
-
this.destroy.apply(this, arg);
|
|
662
|
-
}else if(typeof arg.destroy == 'function'){
|
|
663
|
-
arg.destroy();
|
|
664
|
-
}else if(arg.dom){
|
|
665
|
-
arg.remove();
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}, this);
|
|
669
|
-
},
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
destroyMembers : function(o, arg1, arg2, etc){
|
|
673
|
-
for(var i = 1, a = arguments, len = a.length; i < len; i++) {
|
|
674
|
-
Ext.destroy(o[a[i]]);
|
|
675
|
-
delete o[a[i]];
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
clean : function(arr){
|
|
681
|
-
var ret = [];
|
|
682
|
-
Ext.each(arr, function(v){
|
|
683
|
-
if(!!v){
|
|
684
|
-
ret.push(v);
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
return ret;
|
|
688
|
-
},
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
unique : function(arr){
|
|
692
|
-
var ret = [],
|
|
693
|
-
collect = {};
|
|
694
|
-
|
|
695
|
-
Ext.each(arr, function(v) {
|
|
696
|
-
if(!collect[v]){
|
|
697
|
-
ret.push(v);
|
|
698
|
-
}
|
|
699
|
-
collect[v] = true;
|
|
700
|
-
});
|
|
701
|
-
return ret;
|
|
702
|
-
},
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
flatten : function(arr){
|
|
706
|
-
var worker = [];
|
|
707
|
-
function rFlatten(a) {
|
|
708
|
-
Ext.each(a, function(v) {
|
|
709
|
-
if(Ext.isArray(v)){
|
|
710
|
-
rFlatten(v);
|
|
711
|
-
}else{
|
|
712
|
-
worker.push(v);
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
return worker;
|
|
716
|
-
}
|
|
717
|
-
return rFlatten(arr);
|
|
718
|
-
},
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
min : function(arr, comp){
|
|
722
|
-
var ret = arr[0];
|
|
723
|
-
comp = comp || function(a,b){ return a < b ? -1 : 1; };
|
|
724
|
-
Ext.each(arr, function(v) {
|
|
725
|
-
ret = comp(ret, v) == -1 ? ret : v;
|
|
726
|
-
});
|
|
727
|
-
return ret;
|
|
728
|
-
},
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
max : function(arr, comp){
|
|
732
|
-
var ret = arr[0];
|
|
733
|
-
comp = comp || function(a,b){ return a > b ? 1 : -1; };
|
|
734
|
-
Ext.each(arr, function(v) {
|
|
735
|
-
ret = comp(ret, v) == 1 ? ret : v;
|
|
736
|
-
});
|
|
737
|
-
return ret;
|
|
738
|
-
},
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
mean : function(arr){
|
|
742
|
-
return arr.length > 0 ? Ext.sum(arr) / arr.length : undefined;
|
|
743
|
-
},
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
sum : function(arr){
|
|
747
|
-
var ret = 0;
|
|
748
|
-
Ext.each(arr, function(v) {
|
|
749
|
-
ret += v;
|
|
750
|
-
});
|
|
751
|
-
return ret;
|
|
752
|
-
},
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
partition : function(arr, truth){
|
|
756
|
-
var ret = [[],[]];
|
|
757
|
-
Ext.each(arr, function(v, i, a) {
|
|
758
|
-
ret[ (truth && truth(v, i, a)) || (!truth && v) ? 0 : 1].push(v);
|
|
759
|
-
});
|
|
760
|
-
return ret;
|
|
761
|
-
},
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
invoke : function(arr, methodName){
|
|
765
|
-
var ret = [],
|
|
766
|
-
args = Array.prototype.slice.call(arguments, 2);
|
|
767
|
-
Ext.each(arr, function(v,i) {
|
|
768
|
-
if (v && typeof v[methodName] == 'function') {
|
|
769
|
-
ret.push(v[methodName].apply(v, args));
|
|
770
|
-
} else {
|
|
771
|
-
ret.push(undefined);
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
return ret;
|
|
775
|
-
},
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
pluck : function(arr, prop){
|
|
779
|
-
var ret = [];
|
|
780
|
-
Ext.each(arr, function(v) {
|
|
781
|
-
ret.push( v[prop] );
|
|
782
|
-
});
|
|
783
|
-
return ret;
|
|
784
|
-
},
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
zip : function(){
|
|
788
|
-
var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
|
|
789
|
-
arrs = parts[0],
|
|
790
|
-
fn = parts[1][0],
|
|
791
|
-
len = Ext.max(Ext.pluck(arrs, "length")),
|
|
792
|
-
ret = [];
|
|
793
|
-
|
|
794
|
-
for (var i = 0; i < len; i++) {
|
|
795
|
-
ret[i] = [];
|
|
796
|
-
if(fn){
|
|
797
|
-
ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
|
|
798
|
-
}else{
|
|
799
|
-
for (var j = 0, aLen = arrs.length; j < aLen; j++){
|
|
800
|
-
ret[i].push( arrs[j][i] );
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
return ret;
|
|
805
|
-
},
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
getCmp : function(id){
|
|
809
|
-
return Ext.ComponentMgr.get(id);
|
|
810
|
-
},
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
useShims: E.isIE6 || (E.isMac && E.isGecko2),
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
type : function(o){
|
|
818
|
-
if(o === undefined || o === null){
|
|
819
|
-
return false;
|
|
820
|
-
}
|
|
821
|
-
if(o.htmlElement){
|
|
822
|
-
return 'element';
|
|
823
|
-
}
|
|
824
|
-
var t = typeof o;
|
|
825
|
-
if(t == 'object' && o.nodeName) {
|
|
826
|
-
switch(o.nodeType) {
|
|
827
|
-
case 1: return 'element';
|
|
828
|
-
case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
if(t == 'object' || t == 'function') {
|
|
832
|
-
switch(o.constructor) {
|
|
833
|
-
case Array: return 'array';
|
|
834
|
-
case RegExp: return 'regexp';
|
|
835
|
-
case Date: return 'date';
|
|
836
|
-
}
|
|
837
|
-
if(typeof o.length == 'number' && typeof o.item == 'function') {
|
|
838
|
-
return 'nodelist';
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
return t;
|
|
842
|
-
},
|
|
843
|
-
|
|
844
|
-
intercept : function(o, name, fn, scope){
|
|
845
|
-
o[name] = o[name].createInterceptor(fn, scope);
|
|
846
|
-
},
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
callback : function(cb, scope, args, delay){
|
|
850
|
-
if(typeof cb == 'function'){
|
|
851
|
-
if(delay){
|
|
852
|
-
cb.defer(delay, scope, args || []);
|
|
853
|
-
}else{
|
|
854
|
-
cb.apply(scope, args || []);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
}());
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
Ext.apply(Function.prototype, {
|
|
863
|
-
|
|
864
|
-
createSequence : function(fcn, scope){
|
|
865
|
-
var method = this;
|
|
866
|
-
return (typeof fcn != 'function') ?
|
|
867
|
-
this :
|
|
868
|
-
function(){
|
|
869
|
-
var retval = method.apply(this || window, arguments);
|
|
870
|
-
fcn.apply(scope || this || window, arguments);
|
|
871
|
-
return retval;
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
Ext.applyIf(String, {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
escape : function(string) {
|
|
882
|
-
return string.replace(/('|\\)/g, "\\$1");
|
|
883
|
-
},
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
leftPad : function (val, size, ch) {
|
|
887
|
-
var result = String(val);
|
|
888
|
-
if(!ch) {
|
|
889
|
-
ch = " ";
|
|
890
|
-
}
|
|
891
|
-
while (result.length < size) {
|
|
892
|
-
result = ch + result;
|
|
893
|
-
}
|
|
894
|
-
return result;
|
|
895
|
-
}
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
String.prototype.toggle = function(value, other){
|
|
900
|
-
return this == value ? other : value;
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
String.prototype.trim = function(){
|
|
905
|
-
var re = /^\s+|\s+$/g;
|
|
906
|
-
return function(){ return this.replace(re, ""); };
|
|
907
|
-
}();
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
Date.prototype.getElapsed = function(date) {
|
|
912
|
-
return Math.abs((date || new Date()).getTime()-this.getTime());
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
Ext.applyIf(Number.prototype, {
|
|
918
|
-
|
|
919
|
-
constrain : function(min, max){
|
|
920
|
-
return Math.min(Math.max(this, min), max);
|
|
921
|
-
}
|
|
1052
|
+
/**
|
|
1053
|
+
* @class Ext.util.TaskRunner
|
|
1054
|
+
* Provides the ability to execute one or more arbitrary tasks in a multithreaded
|
|
1055
|
+
* manner. Generally, you can use the singleton {@link Ext.TaskMgr} instead, but
|
|
1056
|
+
* if needed, you can create separate instances of TaskRunner. Any number of
|
|
1057
|
+
* separate tasks can be started at any time and will run independently of each
|
|
1058
|
+
* other. Example usage:
|
|
1059
|
+
* <pre><code>
|
|
1060
|
+
// Start a simple clock task that updates a div once per second
|
|
1061
|
+
var updateClock = function(){
|
|
1062
|
+
Ext.fly('clock').update(new Date().format('g:i:s A'));
|
|
1063
|
+
}
|
|
1064
|
+
var task = {
|
|
1065
|
+
run: updateClock,
|
|
1066
|
+
interval: 1000 //1 second
|
|
1067
|
+
}
|
|
1068
|
+
var runner = new Ext.util.TaskRunner();
|
|
1069
|
+
runner.start(task);
|
|
1070
|
+
|
|
1071
|
+
// equivalent using TaskMgr
|
|
1072
|
+
Ext.TaskMgr.start({
|
|
1073
|
+
run: updateClock,
|
|
1074
|
+
interval: 1000
|
|
922
1075
|
});
|
|
923
1076
|
|
|
1077
|
+
* </code></pre>
|
|
1078
|
+
* <p>See the {@link #start} method for details about how to configure a task object.</p>
|
|
1079
|
+
* Also see {@link Ext.util.DelayedTask}.
|
|
1080
|
+
*
|
|
1081
|
+
* @constructor
|
|
1082
|
+
* @param {Number} interval (optional) The minimum precision in milliseconds supported by this TaskRunner instance
|
|
1083
|
+
* (defaults to 10)
|
|
1084
|
+
*/
|
|
924
1085
|
Ext.util.TaskRunner = function(interval){
|
|
925
1086
|
interval = interval || 10;
|
|
926
1087
|
var tasks = [],
|
|
@@ -928,14 +1089,14 @@ Ext.util.TaskRunner = function(interval){
|
|
|
928
1089
|
id = 0,
|
|
929
1090
|
running = false,
|
|
930
1091
|
|
|
931
|
-
|
|
1092
|
+
// private
|
|
932
1093
|
stopThread = function(){
|
|
933
1094
|
running = false;
|
|
934
1095
|
clearInterval(id);
|
|
935
1096
|
id = 0;
|
|
936
1097
|
},
|
|
937
1098
|
|
|
938
|
-
|
|
1099
|
+
// private
|
|
939
1100
|
startThread = function(){
|
|
940
1101
|
if(!running){
|
|
941
1102
|
running = true;
|
|
@@ -943,7 +1104,7 @@ Ext.util.TaskRunner = function(interval){
|
|
|
943
1104
|
}
|
|
944
1105
|
},
|
|
945
1106
|
|
|
946
|
-
|
|
1107
|
+
// private
|
|
947
1108
|
removeTask = function(t){
|
|
948
1109
|
removeQueue.push(t);
|
|
949
1110
|
if(t.onStop){
|
|
@@ -951,7 +1112,7 @@ Ext.util.TaskRunner = function(interval){
|
|
|
951
1112
|
}
|
|
952
1113
|
},
|
|
953
1114
|
|
|
954
|
-
|
|
1115
|
+
// private
|
|
955
1116
|
runTasks = function(){
|
|
956
1117
|
var rqLen = removeQueue.length,
|
|
957
1118
|
now = new Date().getTime();
|
|
@@ -983,7 +1144,30 @@ Ext.util.TaskRunner = function(interval){
|
|
|
983
1144
|
}
|
|
984
1145
|
};
|
|
985
1146
|
|
|
986
|
-
|
|
1147
|
+
/**
|
|
1148
|
+
* Starts a new task.
|
|
1149
|
+
* @method start
|
|
1150
|
+
* @param {Object} task <p>A config object that supports the following properties:<ul>
|
|
1151
|
+
* <li><code>run</code> : Function<div class="sub-desc"><p>The function to execute each time the task is invoked. The
|
|
1152
|
+
* function will be called at each interval and passed the <code>args</code> argument if specified, and the
|
|
1153
|
+
* current invocation count if not.</p>
|
|
1154
|
+
* <p>If a particular scope (<code>this</code> reference) is required, be sure to specify it using the <code>scope</code> argument.</p>
|
|
1155
|
+
* <p>Return <code>false</code> from this function to terminate the task.</p></div></li>
|
|
1156
|
+
* <li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
|
|
1157
|
+
* should be invoked.</div></li>
|
|
1158
|
+
* <li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
|
|
1159
|
+
* specified by <code>run</code>. If not specified, the current invocation count is passed.</div></li>
|
|
1160
|
+
* <li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (<tt>this</tt> reference) in which to execute the
|
|
1161
|
+
* <code>run</code> function. Defaults to the task config object.</div></li>
|
|
1162
|
+
* <li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to invoke
|
|
1163
|
+
* the task before stopping automatically (defaults to indefinite).</div></li>
|
|
1164
|
+
* <li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to invoke the task before
|
|
1165
|
+
* stopping automatically (defaults to indefinite).</div></li>
|
|
1166
|
+
* </ul></p>
|
|
1167
|
+
* <p>Before each invocation, Ext injects the property <code>taskRunCount</code> into the task object so
|
|
1168
|
+
* that calculations based on the repeat count can be performed.</p>
|
|
1169
|
+
* @return {Object} The task
|
|
1170
|
+
*/
|
|
987
1171
|
this.start = function(task){
|
|
988
1172
|
tasks.push(task);
|
|
989
1173
|
task.taskStartTime = new Date().getTime();
|
|
@@ -993,13 +1177,21 @@ Ext.util.TaskRunner = function(interval){
|
|
|
993
1177
|
return task;
|
|
994
1178
|
};
|
|
995
1179
|
|
|
996
|
-
|
|
1180
|
+
/**
|
|
1181
|
+
* Stops an existing running task.
|
|
1182
|
+
* @method stop
|
|
1183
|
+
* @param {Object} task The task to stop
|
|
1184
|
+
* @return {Object} The task
|
|
1185
|
+
*/
|
|
997
1186
|
this.stop = function(task){
|
|
998
1187
|
removeTask(task);
|
|
999
1188
|
return task;
|
|
1000
1189
|
};
|
|
1001
1190
|
|
|
1002
|
-
|
|
1191
|
+
/**
|
|
1192
|
+
* Stops all tasks that are currently running.
|
|
1193
|
+
* @method stopAll
|
|
1194
|
+
*/
|
|
1003
1195
|
this.stopAll = function(){
|
|
1004
1196
|
stopThread();
|
|
1005
1197
|
for(var i = 0, len = tasks.length; i < len; i++){
|
|
@@ -1012,7 +1204,24 @@ Ext.util.TaskRunner = function(interval){
|
|
|
1012
1204
|
};
|
|
1013
1205
|
};
|
|
1014
1206
|
|
|
1015
|
-
|
|
1207
|
+
/**
|
|
1208
|
+
* @class Ext.TaskMgr
|
|
1209
|
+
* @extends Ext.util.TaskRunner
|
|
1210
|
+
* A static {@link Ext.util.TaskRunner} instance that can be used to start and stop arbitrary tasks. See
|
|
1211
|
+
* {@link Ext.util.TaskRunner} for supported methods and task config properties.
|
|
1212
|
+
* <pre><code>
|
|
1213
|
+
// Start a simple clock task that updates a div once per second
|
|
1214
|
+
var task = {
|
|
1215
|
+
run: function(){
|
|
1216
|
+
Ext.fly('clock').update(new Date().format('g:i:s A'));
|
|
1217
|
+
},
|
|
1218
|
+
interval: 1000 //1 second
|
|
1219
|
+
}
|
|
1220
|
+
Ext.TaskMgr.start(task);
|
|
1221
|
+
</code></pre>
|
|
1222
|
+
* <p>See the {@link #start} method for details about how to configure a task object.</p>
|
|
1223
|
+
* @singleton
|
|
1224
|
+
*/
|
|
1016
1225
|
Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
1017
1226
|
var libFlyweight;
|
|
1018
1227
|
|
|
@@ -1152,7 +1361,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1152
1361
|
ret = [x,y];
|
|
1153
1362
|
}
|
|
1154
1363
|
}
|
|
1155
|
-
return ret
|
|
1364
|
+
return ret;
|
|
1156
1365
|
},
|
|
1157
1366
|
|
|
1158
1367
|
setXY : function(el, xy) {
|
|
@@ -1163,7 +1372,9 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1163
1372
|
pos;
|
|
1164
1373
|
|
|
1165
1374
|
for (pos in pts) {
|
|
1166
|
-
if(!isNaN(pts[pos]))
|
|
1375
|
+
if (!isNaN(pts[pos])) {
|
|
1376
|
+
style[pos] = pts[pos] + "px";
|
|
1377
|
+
}
|
|
1167
1378
|
}
|
|
1168
1379
|
},
|
|
1169
1380
|
|
|
@@ -1175,9 +1386,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1175
1386
|
this.setXY(el, [false, y]);
|
|
1176
1387
|
}
|
|
1177
1388
|
};
|
|
1178
|
-
})();Ext.lib.
|
|
1179
|
-
return Ext.lib.Region.getRegion(el);
|
|
1180
|
-
};Ext.lib.Event = function() {
|
|
1389
|
+
})();Ext.lib.Event = function() {
|
|
1181
1390
|
var loadComplete = false,
|
|
1182
1391
|
unloadListeners = {},
|
|
1183
1392
|
retryCount = 0,
|
|
@@ -1187,13 +1396,11 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1187
1396
|
win = window,
|
|
1188
1397
|
doc = document,
|
|
1189
1398
|
|
|
1190
|
-
|
|
1399
|
+
// constants
|
|
1191
1400
|
POLL_RETRYS = 200,
|
|
1192
1401
|
POLL_INTERVAL = 20,
|
|
1193
|
-
EL = 0,
|
|
1194
1402
|
TYPE = 0,
|
|
1195
1403
|
FN = 1,
|
|
1196
|
-
WFN = 2,
|
|
1197
1404
|
OBJ = 2,
|
|
1198
1405
|
ADJ_SCOPE = 3,
|
|
1199
1406
|
SCROLLLEFT = 'scrollLeft',
|
|
@@ -1201,7 +1408,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1201
1408
|
UNLOAD = 'unload',
|
|
1202
1409
|
MOUSEOVER = 'mouseover',
|
|
1203
1410
|
MOUSEOUT = 'mouseout',
|
|
1204
|
-
|
|
1411
|
+
// private
|
|
1205
1412
|
doAdd = function() {
|
|
1206
1413
|
var ret;
|
|
1207
1414
|
if (win.addEventListener) {
|
|
@@ -1227,7 +1434,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1227
1434
|
}
|
|
1228
1435
|
return ret;
|
|
1229
1436
|
}(),
|
|
1230
|
-
|
|
1437
|
+
// private
|
|
1231
1438
|
doRemove = function(){
|
|
1232
1439
|
var ret;
|
|
1233
1440
|
if (win.removeEventListener) {
|
|
@@ -1268,7 +1475,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1268
1475
|
return false;
|
|
1269
1476
|
}
|
|
1270
1477
|
|
|
1271
|
-
|
|
1478
|
+
// private
|
|
1272
1479
|
function _tryPreloadAttach() {
|
|
1273
1480
|
var ret = false,
|
|
1274
1481
|
notAvail = [],
|
|
@@ -1306,7 +1513,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1306
1513
|
return ret;
|
|
1307
1514
|
}
|
|
1308
1515
|
|
|
1309
|
-
|
|
1516
|
+
// private
|
|
1310
1517
|
function startInterval() {
|
|
1311
1518
|
if(!_interval){
|
|
1312
1519
|
var callback = function() {
|
|
@@ -1316,7 +1523,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1316
1523
|
}
|
|
1317
1524
|
}
|
|
1318
1525
|
|
|
1319
|
-
|
|
1526
|
+
// private
|
|
1320
1527
|
function getScroll() {
|
|
1321
1528
|
var dd = doc.documentElement,
|
|
1322
1529
|
db = doc.body;
|
|
@@ -1329,7 +1536,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1329
1536
|
}
|
|
1330
1537
|
}
|
|
1331
1538
|
|
|
1332
|
-
|
|
1539
|
+
// private
|
|
1333
1540
|
function getPageCoord (ev, xy) {
|
|
1334
1541
|
ev = ev.browserEvent || ev;
|
|
1335
1542
|
var coord = ev['page' + xy];
|
|
@@ -1358,7 +1565,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1358
1565
|
startInterval();
|
|
1359
1566
|
},
|
|
1360
1567
|
|
|
1361
|
-
|
|
1568
|
+
// This function should ALWAYS be called from Ext.EventManager
|
|
1362
1569
|
addListener: function(el, eventName, fn) {
|
|
1363
1570
|
el = Ext.getDom(el);
|
|
1364
1571
|
if (el && fn) {
|
|
@@ -1374,7 +1581,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1374
1581
|
return false;
|
|
1375
1582
|
},
|
|
1376
1583
|
|
|
1377
|
-
|
|
1584
|
+
// This function should ALWAYS be called from Ext.EventManager
|
|
1378
1585
|
removeListener: function(el, eventName, fn) {
|
|
1379
1586
|
el = Ext.getDom(el);
|
|
1380
1587
|
var i, len, li, lis;
|
|
@@ -1402,7 +1609,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1402
1609
|
if(!node){
|
|
1403
1610
|
return;
|
|
1404
1611
|
}
|
|
1405
|
-
|
|
1612
|
+
// work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197
|
|
1406
1613
|
var s = HTMLElement.prototype.toString.call(node);
|
|
1407
1614
|
if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
|
|
1408
1615
|
return;
|
|
@@ -1415,8 +1622,8 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1415
1622
|
getRelatedTarget : function(ev) {
|
|
1416
1623
|
ev = ev.browserEvent || ev;
|
|
1417
1624
|
return this.resolveTextNode(ev.relatedTarget ||
|
|
1418
|
-
|
|
1419
|
-
|
|
1625
|
+
(/(mouseout|mouseleave)/.test(ev.type) ? ev.toElement :
|
|
1626
|
+
/(mouseover|mouseenter)/.test(ev.type) ? ev.fromElement : null));
|
|
1420
1627
|
},
|
|
1421
1628
|
|
|
1422
1629
|
getPageX : function(ev) {
|
|
@@ -1475,31 +1682,30 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1475
1682
|
return ev.charCode || ev.keyCode || 0;
|
|
1476
1683
|
},
|
|
1477
1684
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1685
|
+
//clearCache: function() {},
|
|
1686
|
+
// deprecated, call from EventManager
|
|
1480
1687
|
getListeners : function(el, eventName) {
|
|
1481
1688
|
Ext.EventManager.getListeners(el, eventName);
|
|
1482
1689
|
},
|
|
1483
1690
|
|
|
1484
|
-
|
|
1691
|
+
// deprecated, call from EventManager
|
|
1485
1692
|
purgeElement : function(el, recurse, eventName) {
|
|
1486
1693
|
Ext.EventManager.purgeElement(el, recurse, eventName);
|
|
1487
1694
|
},
|
|
1488
1695
|
|
|
1489
1696
|
_load : function(e) {
|
|
1490
1697
|
loadComplete = true;
|
|
1491
|
-
|
|
1698
|
+
|
|
1492
1699
|
if (Ext.isIE && e !== true) {
|
|
1493
|
-
|
|
1494
|
-
|
|
1700
|
+
// IE8 complains that _load is null or not an object
|
|
1701
|
+
// so lets remove self via arguments.callee
|
|
1495
1702
|
doRemove(win, "load", arguments.callee);
|
|
1496
1703
|
}
|
|
1497
1704
|
},
|
|
1498
1705
|
|
|
1499
1706
|
_unload : function(e) {
|
|
1500
1707
|
var EU = Ext.lib.Event,
|
|
1501
|
-
i,
|
|
1502
|
-
|
|
1708
|
+
i, v, ul, id, len, scope;
|
|
1503
1709
|
|
|
1504
1710
|
for (id in unloadListeners) {
|
|
1505
1711
|
ul = unloadListeners[id];
|
|
@@ -1520,7 +1726,7 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1520
1726
|
}
|
|
1521
1727
|
};
|
|
1522
1728
|
|
|
1523
|
-
|
|
1729
|
+
// Initialize stuff.
|
|
1524
1730
|
pub.on = pub.addListener;
|
|
1525
1731
|
pub.un = pub.removeListener;
|
|
1526
1732
|
if (doc && doc.body) {
|
|
@@ -1533,17 +1739,23 @@ Ext.TaskMgr = new Ext.util.TaskRunner();(function(){
|
|
|
1533
1739
|
|
|
1534
1740
|
return pub;
|
|
1535
1741
|
}();
|
|
1536
|
-
|
|
1742
|
+
/*
|
|
1743
|
+
* Portions of this file are based on pieces of Yahoo User Interface Library
|
|
1744
|
+
* Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
|
1745
|
+
* YUI licensed under the BSD License:
|
|
1746
|
+
* http://developer.yahoo.net/yui/license.txt
|
|
1747
|
+
*/
|
|
1537
1748
|
Ext.lib.Ajax = function() {
|
|
1538
|
-
var activeX = ['
|
|
1539
|
-
'
|
|
1540
|
-
'
|
|
1749
|
+
var activeX = ['Msxml2.XMLHTTP.6.0',
|
|
1750
|
+
'Msxml2.XMLHTTP.3.0',
|
|
1751
|
+
'Msxml2.XMLHTTP'],
|
|
1541
1752
|
CONTENTTYPE = 'Content-Type';
|
|
1542
1753
|
|
|
1543
|
-
|
|
1754
|
+
// private
|
|
1544
1755
|
function setHeader(o) {
|
|
1545
1756
|
var conn = o.conn,
|
|
1546
|
-
prop
|
|
1757
|
+
prop,
|
|
1758
|
+
headers = {};
|
|
1547
1759
|
|
|
1548
1760
|
function setTheHeaders(conn, headers){
|
|
1549
1761
|
for (prop in headers) {
|
|
@@ -1553,17 +1765,12 @@ Ext.lib.Ajax = function() {
|
|
|
1553
1765
|
}
|
|
1554
1766
|
}
|
|
1555
1767
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
if (pub.headers) {
|
|
1561
|
-
setTheHeaders(conn, pub.headers);
|
|
1562
|
-
delete pub.headers;
|
|
1563
|
-
}
|
|
1768
|
+
Ext.apply(headers, pub.headers, pub.defaultHeaders);
|
|
1769
|
+
setTheHeaders(conn, headers);
|
|
1770
|
+
delete pub.headers;
|
|
1564
1771
|
}
|
|
1565
1772
|
|
|
1566
|
-
|
|
1773
|
+
// private
|
|
1567
1774
|
function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {
|
|
1568
1775
|
return {
|
|
1569
1776
|
tId : tId,
|
|
@@ -1575,19 +1782,19 @@ Ext.lib.Ajax = function() {
|
|
|
1575
1782
|
};
|
|
1576
1783
|
}
|
|
1577
1784
|
|
|
1578
|
-
|
|
1785
|
+
// private
|
|
1579
1786
|
function initHeader(label, value) {
|
|
1580
1787
|
(pub.headers = pub.headers || {})[label] = value;
|
|
1581
1788
|
}
|
|
1582
1789
|
|
|
1583
|
-
|
|
1790
|
+
// private
|
|
1584
1791
|
function createResponseObject(o, callbackArg) {
|
|
1585
1792
|
var headerObj = {},
|
|
1586
1793
|
headerStr,
|
|
1587
1794
|
conn = o.conn,
|
|
1588
1795
|
t,
|
|
1589
1796
|
s,
|
|
1590
|
-
|
|
1797
|
+
// see: https://prototype.lighthouseapp.com/projects/8886/tickets/129-ie-mangles-http-response-status-code-204-to-1223
|
|
1591
1798
|
isBrokenStatus = conn.status == 1223;
|
|
1592
1799
|
|
|
1593
1800
|
try {
|
|
@@ -1606,18 +1813,18 @@ Ext.lib.Ajax = function() {
|
|
|
1606
1813
|
|
|
1607
1814
|
return {
|
|
1608
1815
|
tId : o.tId,
|
|
1609
|
-
|
|
1816
|
+
// Normalize the status and statusText when IE returns 1223, see the above link.
|
|
1610
1817
|
status : isBrokenStatus ? 204 : conn.status,
|
|
1611
1818
|
statusText : isBrokenStatus ? 'No Content' : conn.statusText,
|
|
1612
1819
|
getResponseHeader : function(header){return headerObj[header.toLowerCase()];},
|
|
1613
|
-
getAllResponseHeaders : function(){return headerStr},
|
|
1820
|
+
getAllResponseHeaders : function(){return headerStr;},
|
|
1614
1821
|
responseText : conn.responseText,
|
|
1615
1822
|
responseXML : conn.responseXML,
|
|
1616
1823
|
argument : callbackArg
|
|
1617
1824
|
};
|
|
1618
1825
|
}
|
|
1619
1826
|
|
|
1620
|
-
|
|
1827
|
+
// private
|
|
1621
1828
|
function releaseObject(o) {
|
|
1622
1829
|
if (o.tId) {
|
|
1623
1830
|
pub.conn[o.tId] = null;
|
|
@@ -1626,7 +1833,7 @@ Ext.lib.Ajax = function() {
|
|
|
1626
1833
|
o = null;
|
|
1627
1834
|
}
|
|
1628
1835
|
|
|
1629
|
-
|
|
1836
|
+
// private
|
|
1630
1837
|
function handleTransactionResponse(o, callback, isAbort, isTimeout) {
|
|
1631
1838
|
if (!callback) {
|
|
1632
1839
|
releaseObject(o);
|
|
@@ -1692,10 +1899,28 @@ Ext.lib.Ajax = function() {
|
|
|
1692
1899
|
releaseObject(o);
|
|
1693
1900
|
responseObject = null;
|
|
1694
1901
|
}
|
|
1902
|
+
|
|
1903
|
+
function checkResponse(o, callback, conn, tId, poll, cbTimeout){
|
|
1904
|
+
if (conn && conn.readyState == 4) {
|
|
1905
|
+
clearInterval(poll[tId]);
|
|
1906
|
+
poll[tId] = null;
|
|
1695
1907
|
|
|
1908
|
+
if (cbTimeout) {
|
|
1909
|
+
clearTimeout(pub.timeout[tId]);
|
|
1910
|
+
pub.timeout[tId] = null;
|
|
1911
|
+
}
|
|
1912
|
+
handleTransactionResponse(o, callback);
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
function checkTimeout(o, callback){
|
|
1917
|
+
pub.abort(o, callback, true);
|
|
1918
|
+
}
|
|
1696
1919
|
|
|
1920
|
+
|
|
1921
|
+
// private
|
|
1697
1922
|
function handleReadyState(o, callback){
|
|
1698
|
-
|
|
1923
|
+
callback = callback || {};
|
|
1699
1924
|
var conn = o.conn,
|
|
1700
1925
|
tId = o.tId,
|
|
1701
1926
|
poll = pub.poll,
|
|
@@ -1703,29 +1928,12 @@ Ext.lib.Ajax = function() {
|
|
|
1703
1928
|
|
|
1704
1929
|
if (cbTimeout) {
|
|
1705
1930
|
pub.conn[tId] = conn;
|
|
1706
|
-
pub.timeout[tId] = setTimeout(
|
|
1707
|
-
pub.abort(o, callback, true);
|
|
1708
|
-
}, cbTimeout);
|
|
1931
|
+
pub.timeout[tId] = setTimeout(checkTimeout.createCallback(o, callback), cbTimeout);
|
|
1709
1932
|
}
|
|
1710
|
-
|
|
1711
|
-
poll[tId] = setInterval(
|
|
1712
|
-
function() {
|
|
1713
|
-
if (conn && conn.readyState == 4) {
|
|
1714
|
-
clearInterval(poll[tId]);
|
|
1715
|
-
poll[tId] = null;
|
|
1716
|
-
|
|
1717
|
-
if (cbTimeout) {
|
|
1718
|
-
clearTimeout(pub.timeout[tId]);
|
|
1719
|
-
pub.timeout[tId] = null;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
handleTransactionResponse(o, callback);
|
|
1723
|
-
}
|
|
1724
|
-
},
|
|
1725
|
-
pub.pollInterval);
|
|
1933
|
+
poll[tId] = setInterval(checkResponse.createCallback(o, callback, conn, tId, poll, cbTimeout), pub.pollInterval);
|
|
1726
1934
|
}
|
|
1727
1935
|
|
|
1728
|
-
|
|
1936
|
+
// private
|
|
1729
1937
|
function asyncRequest(method, uri, callback, postData) {
|
|
1730
1938
|
var o = getConnectionObject() || null;
|
|
1731
1939
|
|
|
@@ -1750,7 +1958,7 @@ Ext.lib.Ajax = function() {
|
|
|
1750
1958
|
return o;
|
|
1751
1959
|
}
|
|
1752
1960
|
|
|
1753
|
-
|
|
1961
|
+
// private
|
|
1754
1962
|
function getConnectionObject() {
|
|
1755
1963
|
var o;
|
|
1756
1964
|
|
|
@@ -1764,7 +1972,7 @@ Ext.lib.Ajax = function() {
|
|
|
1764
1972
|
}
|
|
1765
1973
|
}
|
|
1766
1974
|
|
|
1767
|
-
|
|
1975
|
+
// private
|
|
1768
1976
|
function createXhrObject(transactionId) {
|
|
1769
1977
|
var http;
|
|
1770
1978
|
|
|
@@ -1804,33 +2012,31 @@ Ext.lib.Ajax = function() {
|
|
|
1804
2012
|
},
|
|
1805
2013
|
|
|
1806
2014
|
serializeForm : function(form) {
|
|
1807
|
-
var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
|
|
1808
|
-
hasSubmit = false,
|
|
1809
|
-
encoder = encodeURIComponent,
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
Ext.each(fElements, function(element) {
|
|
2015
|
+
var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
|
|
2016
|
+
hasSubmit = false,
|
|
2017
|
+
encoder = encodeURIComponent,
|
|
2018
|
+
name,
|
|
2019
|
+
data = '',
|
|
2020
|
+
type,
|
|
2021
|
+
hasValue;
|
|
2022
|
+
|
|
2023
|
+
Ext.each(fElements, function(element){
|
|
1818
2024
|
name = element.name;
|
|
1819
2025
|
type = element.type;
|
|
1820
|
-
|
|
1821
|
-
if (!element.disabled && name){
|
|
1822
|
-
if(/select-(one|multiple)/i.test(type)) {
|
|
1823
|
-
Ext.each(element.options, function(opt)
|
|
2026
|
+
|
|
2027
|
+
if (!element.disabled && name) {
|
|
2028
|
+
if (/select-(one|multiple)/i.test(type)) {
|
|
2029
|
+
Ext.each(element.options, function(opt){
|
|
1824
2030
|
if (opt.selected) {
|
|
1825
|
-
|
|
2031
|
+
hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
|
|
2032
|
+
data += String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
|
|
1826
2033
|
}
|
|
1827
2034
|
});
|
|
1828
|
-
} else if(
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
}
|
|
2035
|
+
} else if (!(/file|undefined|reset|button/i.test(type))) {
|
|
2036
|
+
if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
|
|
2037
|
+
data += encoder(name) + '=' + encoder(element.value) + '&';
|
|
2038
|
+
hasSubmit = /submit/i.test(type);
|
|
2039
|
+
}
|
|
1834
2040
|
}
|
|
1835
2041
|
}
|
|
1836
2042
|
});
|
|
@@ -1847,32 +2053,32 @@ Ext.lib.Ajax = function() {
|
|
|
1847
2053
|
pollInterval : 50,
|
|
1848
2054
|
transactionId : 0,
|
|
1849
2055
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
2056
|
+
// This is never called - Is it worth exposing this?
|
|
2057
|
+
// setProgId : function(id) {
|
|
2058
|
+
// activeX.unshift(id);
|
|
2059
|
+
// },
|
|
2060
|
+
|
|
2061
|
+
// This is never called - Is it worth exposing this?
|
|
2062
|
+
// setDefaultPostHeader : function(b) {
|
|
2063
|
+
// this.useDefaultHeader = b;
|
|
2064
|
+
// },
|
|
2065
|
+
|
|
2066
|
+
// This is never called - Is it worth exposing this?
|
|
2067
|
+
// setDefaultXhrHeader : function(b) {
|
|
2068
|
+
// this.useDefaultXhrHeader = b;
|
|
2069
|
+
// },
|
|
2070
|
+
|
|
2071
|
+
// This is never called - Is it worth exposing this?
|
|
2072
|
+
// setPollingInterval : function(i) {
|
|
2073
|
+
// if (typeof i == 'number' && isFinite(i)) {
|
|
2074
|
+
// this.pollInterval = i;
|
|
2075
|
+
// }
|
|
2076
|
+
// },
|
|
2077
|
+
|
|
2078
|
+
// This is never called - Is it worth exposing this?
|
|
2079
|
+
// resetDefaultHeaders : function() {
|
|
2080
|
+
// this.defaultHeaders = null;
|
|
2081
|
+
// },
|
|
1876
2082
|
|
|
1877
2083
|
abort : function(o, callback, isTimeout) {
|
|
1878
2084
|
var me = this,
|
|
@@ -1892,97 +2098,12 @@ Ext.lib.Ajax = function() {
|
|
|
1892
2098
|
},
|
|
1893
2099
|
|
|
1894
2100
|
isCallInProgress : function(o) {
|
|
1895
|
-
|
|
2101
|
+
// if there is a connection and readyState is not 0 or 4
|
|
1896
2102
|
return o.conn && !{0:true,4:true}[o.conn.readyState];
|
|
1897
2103
|
}
|
|
1898
2104
|
};
|
|
1899
2105
|
return pub;
|
|
1900
|
-
}();
|
|
1901
|
-
var me = this;
|
|
1902
|
-
me.top = t;
|
|
1903
|
-
me[1] = t;
|
|
1904
|
-
me.right = r;
|
|
1905
|
-
me.bottom = b;
|
|
1906
|
-
me.left = l;
|
|
1907
|
-
me[0] = l;
|
|
1908
|
-
};
|
|
1909
|
-
|
|
1910
|
-
Ext.lib.Region.prototype = {
|
|
1911
|
-
contains : function(region) {
|
|
1912
|
-
var me = this;
|
|
1913
|
-
return ( region.left >= me.left &&
|
|
1914
|
-
region.right <= me.right &&
|
|
1915
|
-
region.top >= me.top &&
|
|
1916
|
-
region.bottom <= me.bottom );
|
|
1917
|
-
|
|
1918
|
-
},
|
|
1919
|
-
|
|
1920
|
-
getArea : function() {
|
|
1921
|
-
var me = this;
|
|
1922
|
-
return ( (me.bottom - me.top) * (me.right - me.left) );
|
|
1923
|
-
},
|
|
1924
|
-
|
|
1925
|
-
intersect : function(region) {
|
|
1926
|
-
var me = this,
|
|
1927
|
-
t = Math.max(me.top, region.top),
|
|
1928
|
-
r = Math.min(me.right, region.right),
|
|
1929
|
-
b = Math.min(me.bottom, region.bottom),
|
|
1930
|
-
l = Math.max(me.left, region.left);
|
|
1931
|
-
|
|
1932
|
-
if (b >= t && r >= l) {
|
|
1933
|
-
return new Ext.lib.Region(t, r, b, l);
|
|
1934
|
-
}
|
|
1935
|
-
},
|
|
1936
|
-
|
|
1937
|
-
union : function(region) {
|
|
1938
|
-
var me = this,
|
|
1939
|
-
t = Math.min(me.top, region.top),
|
|
1940
|
-
r = Math.max(me.right, region.right),
|
|
1941
|
-
b = Math.max(me.bottom, region.bottom),
|
|
1942
|
-
l = Math.min(me.left, region.left);
|
|
1943
|
-
|
|
1944
|
-
return new Ext.lib.Region(t, r, b, l);
|
|
1945
|
-
},
|
|
1946
|
-
|
|
1947
|
-
constrainTo : function(r) {
|
|
1948
|
-
var me = this;
|
|
1949
|
-
me.top = me.top.constrain(r.top, r.bottom);
|
|
1950
|
-
me.bottom = me.bottom.constrain(r.top, r.bottom);
|
|
1951
|
-
me.left = me.left.constrain(r.left, r.right);
|
|
1952
|
-
me.right = me.right.constrain(r.left, r.right);
|
|
1953
|
-
return me;
|
|
1954
|
-
},
|
|
1955
|
-
|
|
1956
|
-
adjust : function(t, l, b, r) {
|
|
1957
|
-
var me = this;
|
|
1958
|
-
me.top += t;
|
|
1959
|
-
me.left += l;
|
|
1960
|
-
me.right += r;
|
|
1961
|
-
me.bottom += b;
|
|
1962
|
-
return me;
|
|
1963
|
-
}
|
|
1964
|
-
};
|
|
1965
|
-
|
|
1966
|
-
Ext.lib.Region.getRegion = function(el) {
|
|
1967
|
-
var p = Ext.lib.Dom.getXY(el),
|
|
1968
|
-
t = p[1],
|
|
1969
|
-
r = p[0] + el.offsetWidth,
|
|
1970
|
-
b = p[1] + el.offsetHeight,
|
|
1971
|
-
l = p[0];
|
|
1972
|
-
|
|
1973
|
-
return new Ext.lib.Region(t, r, b, l);
|
|
1974
|
-
}; Ext.lib.Point = function(x, y) {
|
|
1975
|
-
if (Ext.isArray(x)) {
|
|
1976
|
-
y = x[1];
|
|
1977
|
-
x = x[0];
|
|
1978
|
-
}
|
|
1979
|
-
var me = this;
|
|
1980
|
-
me.x = me.right = me.left = me[0] = x;
|
|
1981
|
-
me.y = me.top = me.bottom = me[1] = y;
|
|
1982
|
-
};
|
|
1983
|
-
|
|
1984
|
-
Ext.lib.Point.prototype = new Ext.lib.Region();
|
|
1985
|
-
(function(){
|
|
2106
|
+
}();(function(){
|
|
1986
2107
|
var EXTLIB = Ext.lib,
|
|
1987
2108
|
noNegatives = /width|height|opacity|padding/i,
|
|
1988
2109
|
offsetAttribute = /^((width|height)|(top|left))$/,
|
|
@@ -2354,7 +2475,6 @@ Ext.lib.Ajax = function() {
|
|
|
2354
2475
|
Ext.extend(EXTLIB.Motion, Ext.lib.AnimBase);
|
|
2355
2476
|
|
|
2356
2477
|
var superclass = EXTLIB.Motion.superclass,
|
|
2357
|
-
proto = EXTLIB.Motion.prototype,
|
|
2358
2478
|
pointsRe = /^points$/i;
|
|
2359
2479
|
|
|
2360
2480
|
Ext.apply(EXTLIB.Motion.prototype, {
|
|
@@ -2407,7 +2527,13 @@ Ext.lib.Ajax = function() {
|
|
|
2407
2527
|
if(control.length > 0 && !Ext.isArray(control[0])){
|
|
2408
2528
|
control = [control];
|
|
2409
2529
|
}else{
|
|
2410
|
-
|
|
2530
|
+
/*
|
|
2531
|
+
var tmp = [];
|
|
2532
|
+
for (i = 0,len = control.length; i < len; ++i) {
|
|
2533
|
+
tmp[i] = control[i];
|
|
2534
|
+
}
|
|
2535
|
+
control = tmp;
|
|
2536
|
+
*/
|
|
2411
2537
|
}
|
|
2412
2538
|
|
|
2413
2539
|
Ext.fly(el, '_anim').position();
|
|
@@ -2445,9 +2571,9 @@ Ext.lib.Ajax = function() {
|
|
|
2445
2571
|
return [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]];
|
|
2446
2572
|
};
|
|
2447
2573
|
})();
|
|
2448
|
-
})()
|
|
2574
|
+
})();// Easing functions
|
|
2449
2575
|
(function(){
|
|
2450
|
-
|
|
2576
|
+
// shortcuts to aid compression
|
|
2451
2577
|
var abs = Math.abs,
|
|
2452
2578
|
pi = Math.PI,
|
|
2453
2579
|
asin = Math.asin,
|
|
@@ -2578,10 +2704,10 @@ Ext.lib.Ajax = function() {
|
|
|
2578
2704
|
|
|
2579
2705
|
(function() {
|
|
2580
2706
|
var EXTLIB = Ext.lib;
|
|
2581
|
-
|
|
2707
|
+
// Color Animation
|
|
2582
2708
|
EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {
|
|
2583
2709
|
return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);
|
|
2584
|
-
}
|
|
2710
|
+
};
|
|
2585
2711
|
|
|
2586
2712
|
EXTLIB.ColorAnim = function(el, attributes, duration, method) {
|
|
2587
2713
|
EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
|
|
@@ -2599,7 +2725,7 @@ Ext.lib.Ajax = function() {
|
|
|
2599
2725
|
return typeof v !== 'undefined';
|
|
2600
2726
|
};
|
|
2601
2727
|
|
|
2602
|
-
|
|
2728
|
+
// private
|
|
2603
2729
|
function parseColor(s) {
|
|
2604
2730
|
var pi = parseInt,
|
|
2605
2731
|
base,
|
|
@@ -2688,7 +2814,7 @@ Ext.lib.Ajax = function() {
|
|
|
2688
2814
|
|
|
2689
2815
|
|
|
2690
2816
|
(function() {
|
|
2691
|
-
|
|
2817
|
+
// Scroll Animation
|
|
2692
2818
|
var EXTLIB = Ext.lib;
|
|
2693
2819
|
EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {
|
|
2694
2820
|
return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);
|
|
@@ -2744,7 +2870,7 @@ Ext.lib.Ajax = function() {
|
|
|
2744
2870
|
}
|
|
2745
2871
|
});
|
|
2746
2872
|
})();
|
|
2747
|
-
if(Ext.isIE) {
|
|
2873
|
+
if (Ext.isIE) {
|
|
2748
2874
|
function fnCleanUp() {
|
|
2749
2875
|
var p = Function.prototype;
|
|
2750
2876
|
delete p.createSequence;
|
|
@@ -2757,4 +2883,4 @@ Ext.lib.Ajax = function() {
|
|
|
2757
2883
|
}
|
|
2758
2884
|
window.attachEvent("onunload", fnCleanUp);
|
|
2759
2885
|
}
|
|
2760
|
-
})();
|
|
2886
|
+
})();
|