fastui 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +53 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/fastui/application/application.png +0 -0
  6. data/app/assets/images/fastui/application/application_add.png +0 -0
  7. data/app/assets/images/fastui/application/application_cascade.png +0 -0
  8. data/app/assets/images/fastui/application/application_delete.png +0 -0
  9. data/app/assets/images/fastui/application/application_double.png +0 -0
  10. data/app/assets/images/fastui/application/application_edit.png +0 -0
  11. data/app/assets/images/fastui/application/application_error.png +0 -0
  12. data/app/assets/images/fastui/application/application_form.png +0 -0
  13. data/app/assets/images/fastui/application/application_form_add.png +0 -0
  14. data/app/assets/images/fastui/application/application_form_delete.png +0 -0
  15. data/app/assets/images/fastui/application/application_form_edit.png +0 -0
  16. data/app/assets/images/fastui/application/application_form_magnify.png +0 -0
  17. data/app/assets/images/fastui/application/application_get.png +0 -0
  18. data/app/assets/images/fastui/application/application_go.png +0 -0
  19. data/app/assets/images/fastui/application/application_home.png +0 -0
  20. data/app/assets/images/fastui/application/application_key.png +0 -0
  21. data/app/assets/images/fastui/application/application_lightning.png +0 -0
  22. data/app/assets/images/fastui/application/application_link.png +0 -0
  23. data/app/assets/images/fastui/application/application_osx.png +0 -0
  24. data/app/assets/images/fastui/application/application_osx_terminal.png +0 -0
  25. data/app/assets/images/fastui/application/application_put.png +0 -0
  26. data/app/assets/images/fastui/application/application_side_boxes.png +0 -0
  27. data/app/assets/images/fastui/application/application_side_contract.png +0 -0
  28. data/app/assets/images/fastui/application/application_side_expand.png +0 -0
  29. data/app/assets/images/fastui/application/application_side_list.png +0 -0
  30. data/app/assets/images/fastui/application/application_side_tree.png +0 -0
  31. data/app/assets/images/fastui/application/application_split.png +0 -0
  32. data/app/assets/images/fastui/application/application_tile_horizontal.png +0 -0
  33. data/app/assets/images/fastui/application/application_tile_vertical.png +0 -0
  34. data/app/assets/images/fastui/application/application_view_columns.png +0 -0
  35. data/app/assets/images/fastui/application/application_view_detail.png +0 -0
  36. data/app/assets/images/fastui/application/application_view_gallery.png +0 -0
  37. data/app/assets/images/fastui/application/application_view_icons.png +0 -0
  38. data/app/assets/images/fastui/application/application_view_list.png +0 -0
  39. data/app/assets/images/fastui/application/application_view_tile.png +0 -0
  40. data/app/assets/images/fastui/application/application_xp.png +0 -0
  41. data/app/assets/images/fastui/application/application_xp_terminal.png +0 -0
  42. data/app/assets/images/fastui/arrow/accept.png +0 -0
  43. data/app/assets/images/fastui/arrow/add.png +0 -0
  44. data/app/assets/images/fastui/arrow/arrow_branch.png +0 -0
  45. data/app/assets/images/fastui/arrow/arrow_divide.png +0 -0
  46. data/app/assets/images/fastui/arrow/arrow_down.png +0 -0
  47. data/app/assets/images/fastui/arrow/arrow_in.png +0 -0
  48. data/app/assets/images/fastui/arrow/arrow_inout.png +0 -0
  49. data/app/assets/images/fastui/arrow/arrow_join.png +0 -0
  50. data/app/assets/images/fastui/arrow/arrow_left.png +0 -0
  51. data/app/assets/images/fastui/arrow/arrow_merge.png +0 -0
  52. data/app/assets/images/fastui/arrow/arrow_out.png +0 -0
  53. data/app/assets/images/fastui/arrow/arrow_redo.png +0 -0
  54. data/app/assets/images/fastui/arrow/arrow_refresh.png +0 -0
  55. data/app/assets/images/fastui/arrow/arrow_refresh_small.png +0 -0
  56. data/app/assets/images/fastui/arrow/arrow_rotate_anticlockwise.png +0 -0
  57. data/app/assets/images/fastui/arrow/arrow_rotate_clockwise.png +0 -0
  58. data/app/assets/images/fastui/arrow/arrow_switch.png +0 -0
  59. data/app/assets/images/fastui/arrow/arrow_turn_left.png +0 -0
  60. data/app/assets/images/fastui/arrow/arrow_turn_right.png +0 -0
  61. data/app/assets/images/fastui/arrow/arrow_undo.png +0 -0
  62. data/app/assets/images/fastui/arrow/arrow_up.png +0 -0
  63. data/app/assets/images/fastui/arrow/cross.png +0 -0
  64. data/app/assets/images/fastui/cross.png +0 -0
  65. data/app/assets/images/fastui/key_go.png +0 -0
  66. data/app/assets/images/fastui/list1211.png +0 -0
  67. data/app/assets/images/fastui/loading.gif +0 -0
  68. data/app/assets/images/fastui/lock.png +0 -0
  69. data/app/assets/images/fastui/locked.png +0 -0
  70. data/app/assets/images/fastui/table/help.png +0 -0
  71. data/app/assets/images/fastui/table/table.png +0 -0
  72. data/app/assets/images/fastui/table/table_add.png +0 -0
  73. data/app/assets/images/fastui/table/table_delete.png +0 -0
  74. data/app/assets/images/fastui/table/table_edit.png +0 -0
  75. data/app/assets/images/fastui/table/table_save.png +0 -0
  76. data/app/assets/images/fastui/upload.png +0 -0
  77. data/app/assets/javascripts/fastui/app/Ctx.js +33 -0
  78. data/app/assets/javascripts/fastui/app/Env.js +38 -0
  79. data/app/assets/javascripts/fastui/app/Evaluator.js +6 -0
  80. data/app/assets/javascripts/fastui/app/inflection.js +656 -0
  81. data/app/assets/javascripts/fastui/app/store/MListMgr.js +34 -0
  82. data/app/assets/javascripts/fastui/app/store/MWindowMgr.js +27 -0
  83. data/app/assets/javascripts/fastui/app/view/FormFactory.js +11 -0
  84. data/app/assets/javascripts/fastui/app/view/Rest.js +40 -0
  85. data/app/assets/javascripts/fastui/app/view/VCommentForm.js +53 -0
  86. data/app/assets/javascripts/fastui/app/view/VCriteria.js +25 -0
  87. data/app/assets/javascripts/fastui/app/view/VCustomForm.js +34 -0
  88. data/app/assets/javascripts/fastui/app/view/VCustomTab.js +266 -0
  89. data/app/assets/javascripts/fastui/app/view/VForm.js +117 -0
  90. data/app/assets/javascripts/fastui/app/view/VGrid.js +172 -0
  91. data/app/assets/javascripts/fastui/app/view/VHelpWindow.js +21 -0
  92. data/app/assets/javascripts/fastui/app/view/VLoginForm.js +101 -0
  93. data/app/assets/javascripts/fastui/app/view/VLoginWindow.js +73 -0
  94. data/app/assets/javascripts/fastui/app/view/VMenu.js +75 -0
  95. data/app/assets/javascripts/fastui/app/view/VSearchWindow.js +102 -0
  96. data/app/assets/javascripts/fastui/app/view/VTab.js +293 -0
  97. data/app/assets/javascripts/fastui/app/view/VToolbar.js +23 -0
  98. data/app/assets/javascripts/fastui/app/view/VTreeGrid.js +158 -0
  99. data/app/assets/javascripts/fastui/app/view/VVWindow.js +72 -0
  100. data/app/assets/javascripts/fastui/app/view/VWindow.js +52 -0
  101. data/app/assets/javascripts/fastui/app/view/Viewport.js +54 -0
  102. data/app/assets/javascripts/fastui/app/view/vfield/VCheckBox.js +19 -0
  103. data/app/assets/javascripts/fastui/app/view/vfield/VCheckboxGroup.js +19 -0
  104. data/app/assets/javascripts/fastui/app/view/vfield/VDate.js +19 -0
  105. data/app/assets/javascripts/fastui/app/view/vfield/VFieldFactory.js +77 -0
  106. data/app/assets/javascripts/fastui/app/view/vfield/VFile.js +22 -0
  107. data/app/assets/javascripts/fastui/app/view/vfield/VHtmlEditor.js +19 -0
  108. data/app/assets/javascripts/fastui/app/view/vfield/VLongComboBox.js +19 -0
  109. data/app/assets/javascripts/fastui/app/view/vfield/VLookup.js +45 -0
  110. data/app/assets/javascripts/fastui/app/view/vfield/VMultipleChoice.js +46 -0
  111. data/app/assets/javascripts/fastui/app/view/vfield/VNumber.js +18 -0
  112. data/app/assets/javascripts/fastui/app/view/vfield/VSexSelect.js +30 -0
  113. data/app/assets/javascripts/fastui/app/view/vfield/VSingleChoice.js +35 -0
  114. data/app/assets/javascripts/fastui/app/view/vfield/VText.js +17 -0
  115. data/app/assets/javascripts/fastui/app/view/vfield/VTextArea.js +19 -0
  116. data/app/assets/javascripts/fastui/app/view/vfield/VTree.js +17 -0
  117. data/app/assets/javascripts/fastui/app/view/vfield/VYesOrNo.js +30 -0
  118. data/app/assets/javascripts/fastui/application.js +18 -0
  119. data/app/assets/javascripts/fastui/data/mwindows.json +7 -0
  120. data/app/assets/javascripts/fastui/data/updateMWindows.json +4 -0
  121. data/app/assets/javascripts/fastui/extjs4/locale/ext-lang-zh_CN.js +304 -0
  122. data/app/assets/javascripts/fastui/fastui.js +23 -0
  123. data/app/assets/stylesheets/fastui/admin.css +95 -0
  124. data/app/assets/stylesheets/fastui/application.css +14 -0
  125. data/app/controllers/fastui/admin_controller.rb +9 -0
  126. data/app/controllers/fastui/application_controller.rb +19 -0
  127. data/app/controllers/fastui/m_list_items_controller.rb +64 -0
  128. data/app/controllers/fastui/m_lists_controller.rb +58 -0
  129. data/app/controllers/fastui/m_menu_items_controller.rb +69 -0
  130. data/app/controllers/fastui/m_menus_controller.rb +58 -0
  131. data/app/controllers/fastui/m_orgs_controller.rb +62 -0
  132. data/app/controllers/fastui/m_people_controller.rb +89 -0
  133. data/app/controllers/fastui/m_roles_controller.rb +61 -0
  134. data/app/controllers/fastui/m_views_controller.rb +18 -0
  135. data/app/controllers/fastui/sessions_controller.rb +42 -0
  136. data/app/helpers/fastui/admin_helper.rb +4 -0
  137. data/app/helpers/fastui/application_helper.rb +4 -0
  138. data/app/models/fastui/acl.rb +21 -0
  139. data/app/models/fastui/ctx.rb +15 -0
  140. data/app/models/fastui/env.rb +16 -0
  141. data/app/models/fastui/m_acl_entry.rb +5 -0
  142. data/app/models/fastui/m_list.rb +6 -0
  143. data/app/models/fastui/m_list_item.rb +8 -0
  144. data/app/models/fastui/m_menu.rb +10 -0
  145. data/app/models/fastui/m_menu_item.rb +11 -0
  146. data/app/models/fastui/m_object.rb +41 -0
  147. data/app/models/fastui/m_org.rb +16 -0
  148. data/app/models/fastui/m_person.rb +21 -0
  149. data/app/models/fastui/m_relationship.rb +9 -0
  150. data/app/models/fastui/m_role.rb +11 -0
  151. data/app/models/fastui/user_authenticator.rb +18 -0
  152. data/app/views/fastui/admin/index.html.erb +2 -0
  153. data/app/views/layouts/fastui/application.html.erb +22 -0
  154. data/config/routes.rb +19 -0
  155. data/db/migrate/20121017013727_create_fastui_m_menu_items.rb +28 -0
  156. data/db/migrate/20121017014112_create_fastui_m_menus.rb +20 -0
  157. data/db/migrate/20121017024943_create_fastui_m_orgs.rb +26 -0
  158. data/db/migrate/20121017025014_create_fastui_m_people.rb +24 -0
  159. data/db/migrate/20121204021053_create_fastui_m_roles.rb +22 -0
  160. data/db/migrate/20121204061207_create_fastui_m_relationships.rb +25 -0
  161. data/db/migrate/20121211062955_create_fastui_m_lists.rb +23 -0
  162. data/db/migrate/20121211074436_create_fastui_m_list_items.rb +21 -0
  163. data/db/migrate/20121217020606_create_fastui_m_acl_entries.rb +22 -0
  164. data/lib/fastui/engine.rb +8 -0
  165. data/lib/fastui/m_model.rb +26 -0
  166. data/lib/fastui/tab.rb +26 -0
  167. data/lib/fastui/version.rb +3 -0
  168. data/lib/fastui/view.rb +32 -0
  169. data/lib/fastui/window.rb +43 -0
  170. data/lib/fastui.rb +8 -0
  171. data/lib/generators/fastui/USAGE +21 -0
  172. data/lib/generators/fastui/install_generator.rb +31 -0
  173. data/lib/generators/fastui/templates/fastui_config.erb +77 -0
  174. data/lib/tasks/create_sys_data.rake +11 -0
  175. data/lib/tasks/fastui_tasks.rake +707 -0
  176. data/lib/tasks/loading_data.rake +28 -0
  177. metadata +276 -0
@@ -0,0 +1,172 @@
1
+ Ext.define('FastUI.view.VGrid', {
2
+ extend: 'Ext.grid.Panel',
3
+ requires: ['FastUI.store.MListMgr'],
4
+ tab: {},
5
+ selType: 'rowmodel',
6
+ multiSelect: false,
7
+ border: false,
8
+ //plugins: [Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1})],
9
+ initComponent: function () {
10
+ this.title = this.getValue('title');
11
+ this.store = this.getGStore();
12
+ this.store.pageSize = 6;
13
+
14
+ this.columns = this.getGColumns();
15
+ this.bbar = this.pageBar();
16
+ this.callParent();
17
+ },
18
+ pageBar: function () {
19
+ this.bar = Ext.create('Ext.toolbar.Paging', {
20
+ store: this.store,
21
+ displayInfo: true,
22
+ beforePageText: '第',
23
+ afterPageText: '页共 {0}页',
24
+ displayMsg: '显示第{0} 条到第 {1} 条记录,总共{2}条记录'
25
+ }, this);
26
+ return this.bar;
27
+ },
28
+ listeners: {
29
+ itemclick: function (view, record, item, index, e, eOpts) {
30
+ //alert(this.tab.rest.getKey() + '='+ record.get('id'));
31
+ this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getKey(), record.get('id'));
32
+ this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getTitle(), record.get('title'));
33
+ if (record.get('m_entity_id')) {
34
+ this.tab.winCtx.setWinCtx(this.tab.winId, 'm_entity_id', record.get('m_entity_id'));
35
+ }
36
+ this.tab.getBtn('edit').enable();
37
+ this.tab.getBtn('del').enable();
38
+ }
39
+ },
40
+ selectedId: function () {
41
+ var id = 0;
42
+ var records = this.getSelectionModel().getSelection();
43
+ if (!Ext.isEmpty(records)) {
44
+ id = records[0].get('id');
45
+ }
46
+ return id;
47
+ },
48
+ getValue: function (key) {
49
+ return this.tab.valueObject[key] || '';
50
+ },
51
+
52
+ getGStore: function () {
53
+ var jsonStore = new Ext.data.JsonStore({
54
+ autoLoad: true,
55
+ proxy: {
56
+ type: 'ajax',
57
+ url: this.tab.rest.indexPath(),
58
+ reader: {
59
+ type: 'json',
60
+ root: 'rows',
61
+ totalProperty: "totalCount"
62
+ },
63
+ extraParams: this.tab.getParams()
64
+ },
65
+ fields: this.getGFields()
66
+ });
67
+ // jsonStore.load({
68
+ // scope: this,
69
+ // callback: function(records, operation, success) {
70
+ // console.log(jsonStore.getCount());
71
+ //
72
+ // }
73
+ // });
74
+ return jsonStore;
75
+ },
76
+ getMEntity: function () {
77
+ return this.tab.valueObject.entity;
78
+ },
79
+ getMColumns: function () {
80
+ return this.tab.valueObject.members || [];
81
+ },
82
+ getGFields: function () {
83
+ var fields = [];
84
+ Ext.each(this.getMColumns(), function (column) {
85
+ fields.push({
86
+ name: column.name,
87
+ type: 'auto'
88
+ });
89
+
90
+ switch (column.datatype) {
91
+ case 'VLookup':
92
+ fields.push({
93
+ name: column.name.replace('_id', ''),
94
+ type: 'auto'
95
+ });
96
+ break;
97
+
98
+ case 'VSingleChoice':
99
+ fields.push({
100
+ name: column.name.replace('_id', '').pluralize(),
101
+ type: 'auto'
102
+ });
103
+ break;
104
+
105
+ default:
106
+ break;
107
+ }
108
+ }, this);
109
+ return fields;
110
+ },
111
+ getGColumns: function () {
112
+ var columns = [];
113
+ Ext.each(this.getMColumns(), function (column) {
114
+ column.display = column.display || 'all';
115
+ if (column.display == 'all' || column.display == 'grid') {
116
+ var col = {
117
+ text: column.title,
118
+ dataIndex: column.name
119
+ //width: column.column_width || 75
120
+ //xtype:''
121
+ };
122
+
123
+ switch (column.datatype) {
124
+ case 'VLookup':
125
+ col.xtype = 'templatecolumn';
126
+ var entity = column.name.replace('_id', '');
127
+ col.tpl = new Ext.XTemplate(
128
+ '<tpl for="' + entity + '">',
129
+ '{title}',
130
+ '</tpl>'
131
+ );
132
+ break;
133
+ case 'MultipleChoice':
134
+ col.xtype = 'templatecolumn';
135
+ var plur_entity = column.name.replace('_ids', '').pluralize();
136
+ col.tpl = new Ext.XTemplate(
137
+ '<tpl for="' + plur_entity + '">',
138
+ '{title}',
139
+ '</tpl>'
140
+ );
141
+ break;
142
+ case 'VSingleChoice':
143
+ var list_store = FastUI.store.MListMgr.getStore(column.name);
144
+ col.renderer = function (val) {
145
+ var index = list_store.findExact('name', val);
146
+ if (index > -1) {
147
+ var rs = list_store.getAt(index).data;
148
+ return rs.title;
149
+ }
150
+ return "";
151
+ };
152
+ break;
153
+ case 'VSexSelect':
154
+ col.renderer = function (val) {
155
+ return val ? '男' : '女'
156
+ };
157
+ break;
158
+ case 'VYesOrNo':
159
+ col.renderer = function (val) {
160
+ return val ? '是' : '否';
161
+ };
162
+ break;
163
+ default:
164
+ break;
165
+ }
166
+ columns.push(col);
167
+ }
168
+ }, this);
169
+
170
+ return columns;
171
+ }
172
+ });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Created with JetBrains RubyMine.
3
+ * User: Administrator
4
+ * Date: 12-12-3
5
+ * Time: 上午9:39
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+ Ext.define('FastUI.view.VHelpWindow', {
9
+ extend:'Ext.window.Window',
10
+ title:'帮助',
11
+ width: 500,
12
+ height: 300,
13
+ resizable: true,
14
+ maximizable: true,
15
+ minimizable: true,
16
+ autoScroll: true,
17
+ closeAction: 'close' ,
18
+ initComponent:function(){
19
+ this.callParent();
20
+ }
21
+ });
@@ -0,0 +1,101 @@
1
+ Ext.define('FastUI.view.VLoginForm', {
2
+ extend:'Ext.form.Panel',
3
+ alias:'widget.loginForm',
4
+
5
+ header: false,
6
+ region: 'center',
7
+ border:false,
8
+ bodyPadding:10,
9
+ fieldDefaults:{
10
+ labelAlign:'left',
11
+ labelWidth: 75,
12
+ labelStyle:'font-weight:bold'
13
+ },
14
+ layout: {
15
+ type: 'vbox',
16
+ align: 'stretch'
17
+ },
18
+ //defaultFocus:'UserName',
19
+ items:[
20
+ {
21
+ xtype : 'fieldcontainer',
22
+ fieldLabel : '用户类型',
23
+ defaultType: 'radiofield',
24
+ defaults: {
25
+ flex: 1
26
+ },
27
+ layout: 'hbox',
28
+ items: [
29
+ {
30
+ boxLabel : '教师',
31
+ name : 'type',
32
+ inputValue: 'Teacher',
33
+ id : 'teacher'
34
+ }, {
35
+ boxLabel : '学生',
36
+ name : 'type',
37
+ inputValue: 'Student',
38
+ id : 'student'
39
+ }, {
40
+ boxLabel : '家长',
41
+ name : 'type',
42
+ inputValue: 'Guardian',
43
+ id : 'guardian'
44
+ },{
45
+ boxLabel : '管理员',
46
+ name : 'type',
47
+ inputValue: 'Fastui::MPerson',
48
+ id : 'person'
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ xtype:'textfield',
54
+ fieldLabel:'用户名',
55
+ blankText:'用户名不能为空',
56
+ name:'username',
57
+ id:'username',
58
+ allowBlank:false,
59
+ width:240
60
+ },
61
+ {
62
+ xtype:'textfield',
63
+ fieldLabel:'密 码',
64
+ allowBlank:false,
65
+ blankText:'密码不能为空',
66
+ name:'password',
67
+ id:'password',
68
+ width:240,
69
+ inputType:'password'
70
+ },
71
+ {
72
+ xtype: 'box',
73
+ autoEl: {
74
+ html: '<div style="text-align: right;"><a href="about:blank" target="_blank">忘记密码了吗?</a></div>'
75
+ }
76
+ },
77
+
78
+ {
79
+ xtype: 'checkbox',
80
+ itemId: 'rememberMe',
81
+ name: 'data[User][rememberme]',
82
+ padding: '0 0 0 80',
83
+ boxLabel: '记住我!',
84
+ listeners: {
85
+ render: function(checkbox) {
86
+ // checkbox.bodyEl.child('input').set({
87
+ // 'data-qtip': this.qtips.rememberme
88
+ // });
89
+ },
90
+ scope: this
91
+ }
92
+ }
93
+
94
+ ],
95
+ initComponent:function () {
96
+
97
+ this.callParent(arguments);
98
+ }
99
+
100
+
101
+ });
@@ -0,0 +1,73 @@
1
+ Ext.define('FastUI.view.VLoginWindow', {
2
+ extend:'Ext.window.Window',
3
+
4
+ width:420,
5
+ height:280,
6
+ title:'用户登陆',
7
+ closeAction:'hide',
8
+ closable:false,
9
+ iconCls:'fastui-login-title',
10
+ layout:'fit',
11
+ modal:true,
12
+ layout:'border',
13
+ resizable:false,
14
+ autoShow:true,
15
+ defaultFocus:'UserName',
16
+ initComponent:function () {
17
+ this.items = [
18
+ {
19
+ cls: 'fastui-login-header',
20
+ baseCls:'x-plain',
21
+ region:'north',
22
+ height:80,
23
+ border:false,
24
+ html:'只允许授权用户访问。<br />' + '请输入用户名和密码。'
25
+ },
26
+ Ext.create('FastUI.view.VLoginForm')
27
+ ];
28
+ this.buttons = [
29
+ {
30
+ text:'重置',
31
+ iconCls:'fastui-login-cancel',
32
+ handler:function () {
33
+ this.child('form').getForm().reset();
34
+ },
35
+ scope:this
36
+ },
37
+ {
38
+ text:'登录',
39
+ iconCls:'fastui-login-submit',
40
+ handler:function () {
41
+ this.doLogin();
42
+ },
43
+ scope:this
44
+ }
45
+ ];
46
+ this.callParent(arguments);
47
+ },
48
+ doLogin:function () {
49
+ var form = this.child('form').getForm();
50
+ var win = this;
51
+ if (form.isValid()) {
52
+ form.submit({
53
+ clientValidation:true,
54
+ waitMsg:'请稍后',
55
+ waitTitle:'正在验证登录',
56
+ url:'/fastui/sessions/login.json',
57
+ success:function (form, action) {
58
+ win.hide();
59
+ Ext.getCmp('SystemMenus').store.load();
60
+ },
61
+ failure:function (form, action) {
62
+ Ext.MessageBox.show({
63
+ width:150,
64
+ title:"登录失败",
65
+ buttons:Ext.MessageBox.OK,
66
+ msg:action.result.msg
67
+ })
68
+ }
69
+ });
70
+ }
71
+ }
72
+
73
+ });
@@ -0,0 +1,75 @@
1
+ Ext.define('FastUI.view.VMenu', {
2
+ extend:'Ext.tree.Panel',
3
+ requires:['FastUI.store.MWindowMgr'],
4
+ alias: 'widget.vMenu',
5
+ title:'菜单',
6
+ animate:false,
7
+ collapseMode:"mini",
8
+ collapsible:true,
9
+ iconCls:"fastui-menu",
10
+ lines:false,
11
+ rootVisible:false,
12
+ split:true,
13
+ dockedItems:[{dock:"top",items:[{xtype:"tbfill"},
14
+ {iconCls:"fastui-tree-expand",tooltip:"Expand All",xtype:"button", listeners:{click:{fn:function (sender ,e ,eOpts) {sender.up().up().expandAll();}}}},
15
+ {iconCls:"fastui-tree-collapse",tooltip:"Collapse All",xtype:"button", listeners:{click:{fn:function (sender ,e ,eOpts) { sender.up().up().collapseAll(); sender.up().up().getRootNode().expand();}}}}],xtype:"toolbar"}
16
+ ],
17
+
18
+ initComponent: function(){
19
+ this.store = Ext.create('Ext.data.TreeStore', {
20
+ autoLoad:true,
21
+ fields:['id', {name:'text', mapping:'title'},{name:'leaf',mapping:'leaf?'},{name:'expanded',mapping:'child?'}, 'window'],
22
+ proxy:{
23
+ type:'ajax',
24
+ url:'/fastui/m_menu_items.json',
25
+ reader:{
26
+ type:'json',
27
+ root:'',
28
+ record:''
29
+ //successProperty:''
30
+ }
31
+ },
32
+ root:{
33
+ name:'菜单',
34
+ expanded:true
35
+ }
36
+ });
37
+ this.callParent(arguments);
38
+ },
39
+
40
+ listeners:{
41
+ itemclick:function(self, record, item, index, e, eOpts){
42
+ this.loadVWindow(self, record, item, index, e, eOpts);
43
+ }
44
+ },
45
+
46
+ loadVWindow:function (self, record, item, index, e, eOpts) {
47
+ var c = Ext.getCmp('mycenter');
48
+ c.setLoading(true);
49
+ var id = record.get('window');
50
+ //var id = 'm_list';
51
+
52
+
53
+ if (record.get('leaf')) {
54
+ FastUI.store.MWindowMgr.load(id, function (obj) {
55
+ var winId = 'win-' + id;
56
+ var win = Ext.getCmp(winId);
57
+ if (!win) {
58
+ win = Ext.create('FastUI.view.VWindow', {
59
+ id: winId,
60
+ valueObject: obj
61
+ });
62
+ c.add(win);
63
+ }
64
+ c.setActiveTab(win);
65
+ c.setLoading(false);
66
+ });
67
+ }
68
+
69
+ }
70
+ });
71
+
72
+
73
+
74
+
75
+
@@ -0,0 +1,102 @@
1
+ Ext.define('FastUI.view.VSearchWindow', {
2
+ extend:'Ext.window.Window',
3
+ rest:{},
4
+ height:300,
5
+ width:600,
6
+ layout:'fit',
7
+ vlookup:{},
8
+
9
+ initComponent:function () {
10
+
11
+ this.title = this.getValue('title');
12
+ this.items = {
13
+ xtype: 'grid',
14
+ border: false,
15
+ columns: [
16
+ {header:'ID', dataIndex:'id'},
17
+ {header:'Title', dataIndex:'title'}
18
+ ],
19
+ store: this.getStore(), // A dummy empty data store
20
+ listeners:{
21
+ itemclick:function (grid, record, item, index, e, eOpts) {
22
+ var id = record.get('id');
23
+ if (!this.vlookup.store.getById(id)){
24
+ this.vlookup.store.add({id:id,title:record.get('title')});
25
+ }
26
+ this.vlookup.setValue(id);
27
+ },
28
+ scope:this
29
+ }
30
+ };
31
+ this.tbar = this.searchPanel();
32
+ this.bbar = this.pageBar();
33
+ this.callParent();
34
+ },
35
+ getValue:function (key) {
36
+ return this.vlookup.valueObject[key];
37
+ },
38
+ getMEntity:function(){
39
+ return this.vlookup.valueObject.ref.entity;
40
+ },
41
+
42
+ // getDataType:function(){
43
+ // return this.this.vlookup.valueObject.class_name
44
+ // },
45
+
46
+ searchPanel:function () {
47
+ this.tbar = ['标题', {
48
+ xtype:'textfield',
49
+ id:'searchField',
50
+ hideLabel:true,
51
+ width:200,
52
+ listeners:{
53
+ }
54
+ }, { xtype:'button', text:'搜索',
55
+ handler:function () {
56
+ var searchText = Ext.getCmp('searchField').getValue();
57
+ this.store.load({
58
+ params:{
59
+ search:searchText
60
+ }})
61
+ }, scope:this}];
62
+ return this.tbar
63
+ },
64
+
65
+ pageBar:function () {
66
+ this.pagebar = Ext.create('Ext.toolbar.Paging', {
67
+ //store:this.getStore(),
68
+ displayInfo:true,
69
+ beforePageText:'第',
70
+ afterPageText:'页共 {0}页',
71
+ displayMsg:'显示第{0} 条到第 {1} 条记录,总共{2}条记录'
72
+ }, this);
73
+ return this.pagebar;
74
+ },
75
+ getParams:function(){
76
+ // var s = "{m_window_id:${m_window_id}}";
77
+ var s = this.getValue('filter');
78
+ if(s == '') return '';
79
+ s = this.vlookup.winCtx.parseCtx(this.vlookup.winId,s);
80
+ return Ext.decode(s);
81
+ },
82
+ getStore:function () {
83
+ var rest = Ext.create('FastUI.view.Rest', this.getMEntity());
84
+ return new Ext.data.JsonStore({
85
+ autoLoad:{start:0, limit:25},
86
+ // pageSize:2, // items per page
87
+ fields:['id', 'title'],
88
+ proxy:{
89
+ type:'ajax',
90
+ // extraParams:this.getParams(),
91
+ url:rest.indexPath(), //+ '?' + this.getParams(),
92
+ reader:{
93
+ type:'json',
94
+ root:'rows',
95
+ totalProperty:"totalCount"
96
+ }
97
+ }
98
+ });
99
+ }
100
+
101
+
102
+ });