knitkit 2.1.15 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +7 -0
  2. data/app/controllers/knitkit/base_controller.rb +1 -1
  3. data/app/controllers/knitkit/comments_controller.rb +7 -2
  4. data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +78 -98
  5. data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +65 -45
  6. data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +22 -12
  7. data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +1 -1
  8. data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -16
  9. data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +15 -49
  10. data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +4 -3
  11. data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +69 -11
  12. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +63 -60
  13. data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +98 -82
  14. data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +77 -0
  15. data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +64 -44
  16. data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +147 -0
  17. data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +81 -45
  18. data/app/controllers/knitkit/mobile_controller.rb +15 -0
  19. data/app/controllers/knitkit/online_document_sections_controller.rb +2 -1
  20. data/app/controllers/knitkit/unauthorized_controller.rb +0 -1
  21. data/app/controllers/knitkit/website_sections_controller.rb +7 -4
  22. data/app/mailers/website_inquiry_mailer.rb +8 -7
  23. data/app/models/content.rb +11 -2
  24. data/app/models/document.rb +2 -17
  25. data/app/models/published_website.rb +96 -59
  26. data/app/models/theme.rb +100 -14
  27. data/app/models/website.rb +260 -28
  28. data/app/models/website_inquiry.rb +5 -12
  29. data/app/models/website_section.rb +9 -1
  30. data/app/views/knitkit/blogs/_add_comment.html.erb +44 -23
  31. data/app/views/knitkit/blogs/_comment.html.erb +4 -6
  32. data/app/views/knitkit/blogs/index.html.erb +63 -49
  33. data/app/views/knitkit/blogs/show.html.erb +17 -12
  34. data/app/views/knitkit/mobile/index.html.erb +162 -0
  35. data/app/views/knitkit/online_document_sections/index.html.erb +7 -5
  36. data/app/views/knitkit/unauthorized/index.html.erb +8 -4
  37. data/app/views/knitkit/website_sections/index.html.erb +8 -4
  38. data/app/views/layouts/knitkit/base.html.erb +79 -63
  39. data/app/views/layouts/knitkit/online_document_sections.html.erb +74 -52
  40. data/app/views/menus/knitkit/_default_menu.html.erb +4 -4
  41. data/app/views/menus/knitkit/_default_section_menu.html.erb +22 -23
  42. data/app/views/shared/knitkit/_bread_crumb.html.erb +10 -7
  43. data/app/views/shared/knitkit/_footer.html.erb +2 -2
  44. data/app/views/website_inquiry_mailer/inquiry.erb +23 -2
  45. data/app/widgets/contact_us/base.rb +25 -50
  46. data/app/widgets/contact_us/javascript/contact_us.js +7 -7
  47. data/app/widgets/contact_us/views/error.html.erb +6 -8
  48. data/app/widgets/contact_us/views/index.html.erb +28 -1
  49. data/app/widgets/contact_us/views/layouts/base.html.erb +9 -6
  50. data/app/widgets/contact_us/views/success.html.erb +3 -3
  51. data/app/widgets/google_map/views/index.html.erb +36 -36
  52. data/app/widgets/login/base.rb +1 -0
  53. data/app/widgets/login/javascript/login.js +3 -3
  54. data/app/widgets/login/views/index.html.erb +46 -26
  55. data/app/widgets/login/views/layouts/base.html.erb +15 -13
  56. data/app/widgets/login/views/login_header.html.erb +7 -9
  57. data/app/widgets/manage_profile/base.rb +116 -164
  58. data/app/widgets/manage_profile/views/_address.html.erb +184 -0
  59. data/app/widgets/manage_profile/views/_contact_information_form.html.erb +23 -192
  60. data/app/widgets/manage_profile/views/_email_address.html.erb +163 -0
  61. data/app/widgets/manage_profile/views/_password_form.html.erb +23 -20
  62. data/app/widgets/manage_profile/views/_phone_number.html.erb +165 -0
  63. data/app/widgets/manage_profile/views/_user_information_form.html.erb +49 -33
  64. data/app/widgets/manage_profile/views/error.html.erb +6 -0
  65. data/app/widgets/manage_profile/views/index.html.erb +44 -46
  66. data/app/widgets/manage_profile/views/layouts/base.html.erb +3 -1
  67. data/app/widgets/manage_profile/views/success.html.erb +5 -0
  68. data/app/widgets/reset_password/views/index.html.erb +33 -28
  69. data/app/widgets/reset_password/views/layouts/base.html.erb +10 -1
  70. data/app/widgets/search/base.rb +37 -25
  71. data/app/widgets/search/views/_inline_search_form.html.erb +12 -0
  72. data/app/widgets/search/views/_search_form.html.erb +41 -0
  73. data/app/widgets/search/views/index.html.erb +5 -3
  74. data/app/widgets/search/views/layouts/base.html.erb +13 -23
  75. data/app/widgets/search/views/show.html.erb +32 -47
  76. data/app/widgets/signup/base.rb +1 -1
  77. data/app/widgets/signup/javascript/signup.js +7 -9
  78. data/app/widgets/signup/views/_signup_form.html.erb +34 -29
  79. data/app/widgets/signup/views/error.html.erb +11 -11
  80. data/app/widgets/signup/views/index.html.erb +3 -2
  81. data/app/widgets/signup/views/layouts/base.html.erb +8 -5
  82. data/app/widgets/signup/views/success.html.erb +5 -4
  83. data/config/routes.rb +39 -28
  84. data/db/data_migrations/20120809020508_update_website_and_configuration.rb +3 -0
  85. data/db/migrate/20110211002317_setup_knitkit.rb +0 -1
  86. data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +33 -0
  87. data/db/migrate/20140622212723_update_website_inquiries.rb +22 -0
  88. data/db/migrate/20140911185022_add_publishing_to_website.rb +5 -0
  89. data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +12 -0
  90. data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +13 -0
  91. data/lib/knitkit.rb +0 -1
  92. data/lib/knitkit/engine.rb +1 -0
  93. data/lib/knitkit/extensions.rb +4 -0
  94. data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +33 -0
  95. data/lib/knitkit/extensions/active_record/acts_as_document.rb +0 -12
  96. data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +7 -10
  97. data/lib/knitkit/extensions/compass_ae/widgets/base.rb +2 -4
  98. data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +4 -1
  99. data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +16 -13
  100. data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +10 -8
  101. data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +123 -108
  102. data/lib/knitkit/extensions/will_paginate/link_renderer.rb +67 -0
  103. data/lib/knitkit/routing_filter/section_router.rb +10 -8
  104. data/lib/knitkit/syntax_validator.rb +2 -2
  105. data/lib/knitkit/version.rb +7 -3
  106. data/public/images/inline_edit/close.png +0 -0
  107. data/public/images/knitkit/close_window.png +0 -0
  108. data/public/images/knitkit/logo.png +0 -0
  109. data/public/images/knitkit/splash/images/add-site.png +0 -0
  110. data/public/images/knitkit/splash/images/adjust-site.png +0 -0
  111. data/public/images/knitkit/splash/images/browse-site.png +0 -0
  112. data/public/images/knitkit/splash/images/find-themes.png +0 -0
  113. data/public/images/knitkit/splash/images/settings.png +0 -0
  114. data/public/images/knitkit/splash/images/tutorials.png +0 -0
  115. data/public/images/knitkit/splash/splash.png +0 -0
  116. data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +656 -627
  117. data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +444 -333
  118. data/public/javascripts/erp_app/desktop/applications/knitkit/{east_region.js → east_region/east_region.js} +33 -33
  119. data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +332 -0
  120. data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +144 -0
  121. data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +335 -0
  122. data/public/javascripts/erp_app/desktop/applications/knitkit/{widgets_panel.js → east_region/widgets_panel.js} +55 -55
  123. data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +150 -37
  124. data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +228 -96
  125. data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +89 -85
  126. data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +238 -217
  127. data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +59 -54
  128. data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +170 -0
  129. data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +1168 -0
  130. data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +71 -0
  131. data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +301 -306
  132. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +216 -0
  133. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +182 -153
  134. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +48 -65
  135. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +93 -94
  136. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +523 -197
  137. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +20 -34
  138. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +74 -0
  139. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +245 -0
  140. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +360 -0
  141. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +348 -0
  142. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +106 -1132
  143. data/public/javascripts/knitkit/bootstrap-datepicker.js +474 -0
  144. data/public/javascripts/knitkit/bootstrap.min.js +7 -0
  145. data/public/javascripts/knitkit/confirm-bootstrap.js +110 -0
  146. data/public/javascripts/knitkit/inline_editing.js +73 -50
  147. data/public/javascripts/knitkit/jquery.maskedinput.min.js +7 -0
  148. data/public/javascripts/knitkit/mobile/app/view/Main.js +108 -0
  149. data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +734 -0
  150. data/public/javascripts/knitkit/theme.js +76 -0
  151. data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +95 -35
  152. data/public/stylesheets/knitkit/bootstrap-responsive.min.css +10 -0
  153. data/public/stylesheets/knitkit/bootstrap.min.css +7 -0
  154. data/public/stylesheets/knitkit/custom.css +122 -0
  155. data/public/stylesheets/knitkit/datepicker.css +182 -0
  156. data/public/stylesheets/knitkit/inline_editing.css +58 -58
  157. data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +1 -1
  158. data/spec/dummy/config/application.rb +1 -1
  159. data/spec/models/article_spec.rb +3 -3
  160. data/spec/models/content_spec.rb +9 -9
  161. data/spec/models/website_spec.rb +1 -1
  162. metadata +100 -114
  163. data/app/helpers/application_helper.rb +0 -134
  164. data/app/views/knitkit/articles/index.html.erb +0 -3
  165. data/app/views/knitkit/articles/show.html.erb +0 -4
  166. data/app/views/menus/knitkit/_default_sub_menu.html.erb +0 -43
  167. data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +0 -47
  168. data/app/widgets/contact_us/views/_contact_form.html.erb +0 -36
  169. data/app/widgets/dynamic_forms/base.rb +0 -139
  170. data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +0 -110
  171. data/app/widgets/dynamic_forms/views/error.html.erb +0 -5
  172. data/app/widgets/dynamic_forms/views/index.html.erb +0 -8
  173. data/app/widgets/dynamic_forms/views/success.html.erb +0 -4
  174. data/app/widgets/dynamic_grid/base.rb +0 -130
  175. data/app/widgets/dynamic_grid/helpers/controller/dynamic_grid_controller_helper.rb +0 -3
  176. data/app/widgets/dynamic_grid/helpers/view/dynamic_grid_view_helper.rb +0 -3
  177. data/app/widgets/dynamic_grid/javascript/dynamic_grid.js +0 -177
  178. data/app/widgets/dynamic_grid/views/index.html.erb +0 -14
  179. data/app/widgets/login/views/reset_password.html.erb +0 -26
  180. data/app/widgets/manage_profile/views/default_type_error.html.erb +0 -5
  181. data/app/widgets/scaffold/base.rb +0 -87
  182. data/app/widgets/scaffold/helpers/controller/scaffold_controller_helper.rb +0 -3
  183. data/app/widgets/scaffold/helpers/view/scaffold_view_helper.rb +0 -3
  184. data/app/widgets/scaffold/javascript/scaffold.js +0 -337
  185. data/app/widgets/scaffold/views/index.html.erb +0 -15
  186. data/app/widgets/search/views/_search.html.erb +0 -39
  187. data/public/images/knitkit/bullet.png +0 -0
  188. data/public/images/knitkit/close.png +0 -0
  189. data/public/images/knitkit/content.png +0 -0
  190. data/public/images/knitkit/footer.png +0 -0
  191. data/public/images/knitkit/graphic.png +0 -0
  192. data/public/images/knitkit/greyFadeDown.png +0 -0
  193. data/public/images/knitkit/link.png +0 -0
  194. data/public/images/knitkit/menu.png +0 -0
  195. data/public/images/knitkit/menu_select.png +0 -0
  196. data/public/images/knitkit/search.png +0 -0
  197. data/public/images/knitkit/tooltip.gif +0 -0
  198. data/public/javascripts/ajax_pagination.js +0 -33
  199. data/public/javascripts/datepicker.js +0 -445
  200. data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +0 -341
  201. data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +0 -31
  202. data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +0 -263
  203. data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +0 -722
  204. data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +0 -585
  205. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +0 -155
  206. data/public/javascripts/knitkit/helpers.js +0 -26
  207. data/public/stylesheets/datepicker.css +0 -121
  208. data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +0 -233
  209. data/public/stylesheets/knitkit/style.css +0 -426
@@ -1,181 +1,50 @@
1
1
  Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.WestRegion", {
2
- extend:"Ext.tab.Panel",
3
- id:'knitkitWestRegion',
4
- alias:'widget.knitkit_westregion',
5
- setWindowStatus:function (status) {
2
+ extend: "Ext.panel.Panel",
3
+ id: 'knitkitWestRegion',
4
+ alias: 'widget.knitkit_westregion',
5
+ layout: 'accordion',
6
+
7
+ setWindowStatus: function (status) {
6
8
  this.findParentByType('statuswindow').setStatus(status);
7
9
  },
8
10
 
9
- clearWindowStatus:function () {
11
+ clearWindowStatus: function () {
10
12
  this.findParentByType('statuswindow').clearStatus();
11
13
  },
12
14
 
13
- deleteSection:function (node) {
14
- var self = this;
15
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this section?<br> NOTE: Articles belonging to this section will be orphaned.<br><br>', function (btn) {
16
- if (btn == 'no') {
17
- return false;
18
- }
19
- else if (btn == 'yes') {
20
- self.setWindowStatus('Deleting Section...');
21
- Ext.Ajax.request({
22
- url:'/knitkit/erp_app/desktop/section/delete',
23
- method:'POST',
24
- params:{
25
- id:node.data.id.split('_')[1]
26
- },
27
- success:function (response) {
28
- self.clearWindowStatus();
29
- var obj = Ext.decode(response.responseText);
30
- if (obj.success) {
31
- node.remove(true);
32
- }
33
- else {
34
- Ext.Msg.alert('Error', 'Error deleting section');
35
- }
36
- },
37
- failure:function (response) {
38
- self.clearWindowStatus();
39
- Ext.Msg.alert('Error', 'Error deleting section');
40
- }
41
- });
42
- }
43
- });
44
- },
45
-
46
- exportSite:function (id) {
47
- var self = this;
48
- self.setWindowStatus('Exporting Website...');
49
- window.open('/knitkit/erp_app/desktop/site/export?id=' + id, 'mywindow', 'width=400,height=200');
50
- self.clearWindowStatus();
51
- },
52
-
53
- deleteSite:function (node) {
54
- var self = this;
55
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this Website?', function (btn) {
56
- if (btn == 'no') {
57
- return false;
58
- }
59
- else if (btn == 'yes') {
60
- self.setWindowStatus('Deleting Website...');
61
- Ext.Ajax.request({
62
- url:'/knitkit/erp_app/desktop/site/delete',
63
- method:'POST',
64
- params:{
65
- id:node.data.id.split('_')[1]
66
- },
67
- success:function (response) {
68
- self.clearWindowStatus();
69
- var obj = Ext.decode(response.responseText);
70
- if (obj.success) {
71
- node.removeAll();
72
- node.remove();
73
- }
74
- else {
75
- Ext.Msg.alert('Error', 'Error deleting Website');
76
- }
77
- },
78
- failure:function (response) {
79
- self.clearWindowStatus();
80
- Ext.Msg.alert('Error', 'Error deleting Website');
81
- }
82
- });
83
- }
84
- });
85
- },
86
-
87
- publish:function (node) {
88
- var self = this;
89
- var publishWindow = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow',{
90
- baseParams:{
91
- id:node.id.split('_')[1]
92
- },
93
- url:'/knitkit/erp_app/desktop/site/publish',
94
- listeners:{
95
- 'publish_success':function (window, response) {
96
- if (response.success) {
97
- self.getPublications(node);
98
- }
99
- else {
100
- Ext.Msg.alert('Error', 'Error publishing Website');
101
- }
102
- },
103
- 'publish_failure':function (window, response) {
104
- Ext.Msg.alert('Error', 'Error publishing Website');
105
- }
106
- }
107
- });
108
-
109
- publishWindow.show();
110
- },
111
-
112
- editSectionLayout:function (sectionName, sectionId, websiteId) {
113
- var self = this;
114
- self.selectWebsite(websiteId);
115
- self.setWindowStatus('Loading section template...');
116
- Ext.Ajax.request({
117
- url:'/knitkit/erp_app/desktop/section/get_layout',
118
- method:'POST',
119
- params:{
120
- id:sectionId
121
- },
122
- success:function (response) {
123
- self.initialConfig['centerRegion'].editSectionLayout(
124
- sectionName,
125
- websiteId,
126
- sectionId,
127
- response.responseText,
128
- [
129
- {
130
- text:'Insert Content Area',
131
- handler:function (btn) {
132
- var codeMirror = btn.findParentByType('codemirror');
133
- Ext.MessageBox.prompt('New File', 'Please enter content area name:', function (btn, text) {
134
- if (btn == 'ok') {
135
- codeMirror.insertContent('<%=render_content_area(:' + text + ')%>');
136
- }
137
-
138
- });
139
- }
140
- }
141
- ]);
142
- self.clearWindowStatus();
143
- },
144
- failure:function (response) {
145
- self.clearWindowStatus();
146
- Ext.Msg.alert('Error', 'Error loading section layout.');
147
- }
148
- });
149
- },
150
-
151
- changeSecurity:function (node, updateUrl, id) {
15
+ changeSecurity: function (node, updateUrl, id) {
152
16
  Ext.Ajax.request({
153
- url:'/knitkit/erp_app/desktop/available_roles',
154
- method:'POST',
155
- success:function (response) {
17
+ url: '/knitkit/erp_app/desktop/available_roles',
18
+ method: 'POST',
19
+ success: function (response) {
156
20
  var obj = Ext.decode(response.responseText);
157
21
  if (obj.success) {
158
- Ext.create('widget.knikit_selectroleswindow',{
159
- baseParams:{
160
- id:id,
161
- site_id:node.get('siteId')
22
+ Ext.create('widget.knikit_selectroleswindow', {
23
+ baseParams: {
24
+ id: id,
25
+ site_id: node.get('siteId')
162
26
  },
163
27
  url: updateUrl,
164
- currentRoles:node.get('roles'),
165
- availableRoles:obj.availableRoles,
166
- listeners:{
167
- success:function(window, response){
28
+ currentRoles: node.get('roles'),
29
+ availableRoles: obj.availableRoles,
30
+ listeners: {
31
+ success: function (window, response) {
168
32
  node.set('roles', response.roles);
169
33
  if (response.secured) {
170
- node.set('iconCls', 'icon-document_lock');
34
+ node.set('iconCls', 'icon-section_lock');
171
35
  }
172
36
  else {
173
- node.set('iconCls', 'icon-document');
37
+ if (node.get('isBlog')) {
38
+ node.set('iconCls', 'icon-blog');
39
+ }
40
+ else {
41
+ node.set('iconCls', 'icon-section');
42
+ }
174
43
  }
175
44
  node.set('isSecured', response.secured);
176
45
  node.commit();
177
46
  },
178
- failure:function(){
47
+ failure: function () {
179
48
  Ext.Msg.alert('Error', 'Could not update security');
180
49
  }
181
50
  }
@@ -185,1014 +54,119 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.WestRegion", {
185
54
  Ext.Msg.alert('Error', 'Could not load available roles');
186
55
  }
187
56
  },
188
- failure:function (response) {
57
+ failure: function (response) {
189
58
  Ext.Msg.alert('Error', 'Could not load available roles');
190
59
  }
191
60
  });
192
61
  },
193
62
 
194
- selectWebsite:function (websiteId) {
195
- var node = this.sitesTree.getStore().getNodeById("website_" + websiteId);
196
- if (node.data.iconCls != 'icon-globe') {
197
- node.set('iconCls', 'icon-globe');
198
- node.commit();
199
- }
200
- node.parentNode.eachChild(function (child) {
201
- if (node.data.id != child.data.id) {
202
- if (child.data.iconCls != 'icon-globe_disconnected') {
203
- child.set('iconCls', 'icon-globe_disconnected');
204
- child.commit();
205
- }
206
- }
207
- });
208
- var eastRegion = Ext.ComponentQuery.query('#knitkitEastRegion').first();
209
- eastRegion.fileAssetsPanel.selectWebsite(websiteId, node.data.text);
210
- eastRegion.imageAssetsPanel.selectWebsite(websiteId, node.data.text);
63
+ selectWebsite: function (website) {
64
+ var siteContentsPanel = Ext.ComponentQuery.query('#knitkitSiteContentsTreePanel').first();
65
+ siteContentsPanel.selectWebsite(website);
211
66
 
212
- Compass.ErpApp.Shared.FileManagerTree.extraPostData = {
213
- website_id:websiteId
214
- };
215
- },
67
+ var themePanel = Ext.ComponentQuery.query('#themesTreePanel').first();
68
+ themePanel.selectWebsite(website);
216
69
 
217
- updateWebsiteConfiguration:function (rec) {
218
- var configurationWindow = Ext.create("Ext.window.Window", {
219
- layout:'fit',
220
- width:600,
221
- title:'Configuration',
222
- height:400,
223
- autoScroll:true,
224
- plain:true,
225
- items:[
226
- {
227
- xtype:'sharedconfigurationpanel',
228
- configurationId:rec.get('configurationId')
229
- }
230
- ]
231
- });
70
+ var menuPanel = Ext.ComponentQuery.query('#knitkitMenuTreePanel').first();
71
+ menuPanel.selectWebsite(website);
232
72
 
233
- configurationWindow.show();
73
+ var hostPanel = Ext.ComponentQuery.query('#knitkitHostListPanel').first();
74
+ hostPanel.selectWebsite(website);
234
75
  },
235
76
 
236
- initComponent:function () {
237
- var self = this;
77
+ clearWebsite: function () {
78
+ var siteContentsPanel = Ext.ComponentQuery.query('#knitkitSiteContentsTreePanel').first();
79
+ siteContentsPanel.clearWebsite();
238
80
 
239
- var store = Ext.create('Ext.data.TreeStore', {
240
- proxy:{
241
- type:'ajax',
242
- url:'/knitkit/erp_app/desktop/websites',
243
- timeout:90000
244
- },
245
- root:{
246
- text:'Websites',
247
- expanded:true
248
- },
249
- fields:[
250
- {
251
- name:'text'
252
- },
253
- {
254
- name:'iconCls'
255
- },
256
- {
257
- name:'leaf'
258
- },
259
- {
260
- name:'canAddMenuItems'
261
- },
262
- {
263
- name:'isWebsiteNavItem'
264
- },
265
- {
266
- name:'isSection'
267
- },
268
- {
269
- name:'isDocument'
270
- },
271
- {
272
- name:'contentInfo'
273
- },
274
- {
275
- name:'isHost'
276
- },
277
- {
278
- name:'isSecured'
279
- },
280
- {
281
- name:'url'
282
- },
283
- {
284
- name:'path'
285
- },
286
- {
287
- name:'inMenu'
288
- },
289
- {
290
- name:'isBlog'
291
- },
292
- {
293
- name:'hasLayout'
294
- },
295
- {
296
- name:'siteId'
297
- },
298
- {
299
- name:'type'
300
- },
301
- {
302
- name:'isWebsite'
303
- },
304
- {
305
- name:'name'
306
- },
307
- {
308
- name:'title'
309
- },
310
- {
311
- name:'subtitle'
312
- },
313
- {
314
- name:'isHostRoot'
315
- },
316
- {
317
- name:'websiteHostId'
318
- },
319
- {
320
- name:'host'
321
- },
322
- {
323
- name:'websiteId'
324
- },
325
- {
326
- name:'isSectionRoot'
327
- },
328
- {
329
- name:'isWebsiteNav'
330
- },
331
- {
332
- name:'isMenuRoot'
333
- },
334
- {
335
- name:'linkToType'
336
- },
337
- {
338
- name:'linkedToId'
339
- },
340
- {
341
- name:'websiteNavItemId'
342
- },
343
- {
344
- name:'siteName'
345
- },
346
- {
347
- name:'websiteNavId'
348
- },
349
- {
350
- name:'internal_identifier'
351
- },
352
- {
353
- name:'configurationId'
354
- },
355
- {
356
- name:'renderWithBaseLayout'
357
- },
358
- {
359
- name:'publication_comments_enabled'
360
- },
361
- {
362
- name:'roles'
363
- },
364
- {
365
- name:'useMarkdown'
366
- }
367
- ],
368
- listeners:{
369
- 'load':function(store, node, records){
370
- if(records.length > 0){
371
- var websiteId = records[0].id.split('_')[1];
372
- westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first();
373
- westRegion.selectWebsite(websiteId);
374
- }
375
- }
376
- }
377
- });
378
-
379
- var pluginItems = [];
81
+ var themePanel = Ext.ComponentQuery.query('#themesTreePanel').first();
82
+ themePanel.clearWebsite();
380
83
 
381
- if (currentUser.hasCapability('drag_item','WebsiteTree')) {
382
- pluginItems.push({
383
- ptype:'treeviewdragdrop'
384
- });
385
- }
386
-
387
- var viewConfigItems = {
388
- markDirty:false,
389
- plugins:pluginItems,
390
- listeners:{
391
- 'beforedrop':function (node, data, overModel, dropPosition, dropFunction, options) {
392
- if (overModel.data['isWebsiteNavItem']) {
393
- return true;
394
- }
395
- else if (overModel.data['isSection']) {
396
- if (overModel.parentNode.data['isSectionRoot']) {
397
- return true;
398
- }
399
- }
400
- else if (overModel.data['isDocument']) {
401
- return true;
402
- }
403
- return false;
404
- },
405
- 'drop':function (node, data, overModel, dropPosition, options) {
406
- var positionArray = [];
407
- var counter = 0;
408
- var dropNode = data.records[0];
84
+ var menuPanel = Ext.ComponentQuery.query('#knitkitMenuTreePanel').first();
85
+ menuPanel.clearWebsite();
409
86
 
410
- if (dropNode.data['isWebsiteNavItem']) {
411
- overModel.parentNode.eachChild(function (node) {
412
- positionArray.push({
413
- id:node.data.websiteNavItemId,
414
- position:counter,
415
- klass:'WebsiteNavItem'
416
- });
417
- counter++;
418
- });
419
- }
420
- else {
421
- overModel.parentNode.eachChild(function (node) {
422
- positionArray.push({
423
- id:node.data.id.split('_')[1],
424
- position:counter,
425
- klass:'WebsiteSection'
426
- });
427
- counter++;
428
- });
429
- }
87
+ var hostPanel = Ext.ComponentQuery.query('#knitkitHostListPanel').first();
88
+ hostPanel.clearWebsite();
89
+ },
430
90
 
431
- Ext.Ajax.request({
432
- url:'/knitkit/erp_app/desktop/position/update',
433
- method:'PUT',
434
- jsonData:{
435
- position_array:positionArray
436
- },
437
- success:function (response) {
438
- var obj = Ext.decode(response.responseText);
439
- if (obj.success) {
91
+ initComponent: function () {
440
92
 
441
- }
442
- else {
443
- Ext.Msg.alert("Error", obj.message);
444
- }
445
- },
446
- failure:function (response) {
447
- Ext.Msg.alert('Error', 'Error saving positions.');
448
- }
449
- });
93
+ var siteContentsPanel = Ext.create('Ext.panel.Panel', {
94
+ title: 'Site Contents',
95
+ autoScroll: true,
96
+ items: [
97
+ {
98
+ xtype: 'knitkit_sitecontentstreepanel',
99
+ centerRegion: this.initialConfig['module'].centerRegion,
100
+ header: false
450
101
  }
451
- }
452
- };
453
-
454
- this.sitesTree = Ext.create('Ext.tree.TreePanel',{
455
- viewConfig:viewConfigItems,
456
- store:store,
457
- region:'center',
458
- rootVisible:false,
459
- enableDD:true,
460
- listeners:{
461
- 'itemclick':function (view, record, htmlItem, index, e) {
462
- e.stopEvent();
463
- if (record.data['isWebsite']) {
464
- self.selectWebsite(record.data.id.split('_')[1]);
465
- }
466
- else if (record.data['isSection']) {
467
- self.getArticles(record);
468
- }
469
- else if (record.data['isHost']) {
470
- var webNavigator = window.compassDesktop.getModule('web-navigator-win');
471
- webNavigator.createWindow(record.data['url']);
472
- }
473
- else if (record.data['isDocument']) {
474
- var contentInfo = record.data['contentInfo'];
475
- if(record.data['useMarkdown']){
476
- self.initialConfig['centerRegion'].editDocumentationMarkdown(
477
- contentInfo.title,
478
- record.data['siteId'],
479
- contentInfo.id,
480
- contentInfo.body_html,
481
- []
482
- );
483
- }
484
- else{
485
- self.initialConfig['centerRegion'].editContent(
486
- record.data['contentInfo'].title,
487
- record.data['contentInfo'].id,
488
- record.data['contentInfo'].body_html,
489
- record.data['siteId'],
490
- 'article'
491
- );
492
- }
493
-
494
- }
495
- },
496
- 'itemcontextmenu':function (view, record, htmlItem, index, e) {
497
- e.stopEvent();
498
- var items = [];
499
-
500
- if (!Compass.ErpApp.Utility.isBlank(record.data['url'])) {
501
- items.push({
502
- text:'View In Web Navigator',
503
- iconCls:'icon-globe',
504
- listeners:{
505
- 'click':function () {
506
- var webNavigator = window.compassDesktop.getModule('web-navigator-win');
507
- webNavigator.createWindow(record.data['url']);
508
- }
509
- }
510
- });
511
- }
512
-
513
- items = Compass.ErpApp.Desktop.Applications.Knitkit.addMenuOptions(self, items, record);
514
-
515
- if (record.data['isDocument']) {
516
- items = Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions(self, items, record);
517
- }
518
-
519
- if (record.data['isSection']) {
520
- items = Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions(self, items, record);
521
- }
522
- else if (record.data['isWebsite']) {
523
- items = Compass.ErpApp.Desktop.Applications.Knitkit.addWebsiteOptions(self, items, record);
524
- }
525
- else if (record.data['isHostRoot']) {
526
- if (currentUser.hasCapability('create','WebsiteHost')) {
527
- items.push({
528
- text:'Add Host',
529
- iconCls:'icon-add',
530
- listeners:{
531
- 'click':function () {
532
- var addHostWindow = Ext.create("Ext.window.Window", {
533
- layout:'fit',
534
- width:310,
535
- title:'Add Host',
536
- height:100,
537
- plain:true,
538
- buttonAlign:'center',
539
- items:Ext.create("Ext.form.Panel", {
540
- labelWidth:50,
541
- frame:false,
542
- bodyStyle:'padding:5px 5px 0',
543
- width:425,
544
- url:'/knitkit/erp_app/desktop/site/add_host',
545
- defaults:{
546
- width:225
547
- },
548
- items:[
549
- {
550
- xtype:'textfield',
551
- fieldLabel:'Host',
552
- name:'host',
553
- allowBlank:false
554
- },
555
- {
556
- xtype:'hidden',
557
- name:'id',
558
- value:record.data.websiteId
559
- }
560
- ]
561
- }),
562
- buttons:[
563
- {
564
- text:'Submit',
565
- listeners:{
566
- 'click':function (button) {
567
- var window = button.findParentByType('window');
568
- var formPanel = window.query('form')[0];
569
- self.setWindowStatus('Adding Host...');
570
- formPanel.getForm().submit({
571
- reset:true,
572
- success:function (form, action) {
573
- self.clearWindowStatus();
574
- var obj = Ext.decode(action.response.responseText);
575
- if (obj.success) {
576
- addHostWindow.close();
577
- record.appendChild(obj.node);
578
- }
579
- else {
580
- Ext.Msg.alert("Error", obj.msg);
581
- }
582
- },
583
- failure:function (form, action) {
584
- self.clearWindowStatus();
585
- Ext.Msg.alert("Error", "Error adding Host");
586
- }
587
- });
588
- }
589
- }
590
- },
591
- {
592
- text:'Close',
593
- handler:function () {
594
- addHostWindow.close();
595
- }
596
- }
597
- ]
598
- });
599
- addHostWindow.show();
600
- }
601
- }
602
- });
603
- }
604
- }
605
- else if (record.data['isHost']) {
606
- items = Compass.ErpApp.Desktop.Applications.Knitkit.addHostOptions(self, items, record);
607
- }
608
- else if (record.data['isSectionRoot']) {
609
- if (currentUser.hasCapability('create','WebsiteSection')) {
610
- items.push({
611
- text:'Add Section',
612
- iconCls:'icon-add',
613
- listeners:{
614
- 'click':function () {
615
- var addSectionWindow = Ext.create("Ext.window.Window", {
616
- layout:'fit',
617
- width:375,
618
- title:'New Section',
619
- plain:true,
620
- buttonAlign:'center',
621
- items:Ext.create("Ext.form.Panel", {
622
- labelWidth:110,
623
- frame:false,
624
- bodyStyle:'padding:5px 5px 0',
625
- url:'/knitkit/erp_app/desktop/section/new',
626
- defaults:{
627
- width:225
628
- },
629
- items:[
630
- {
631
- xtype:'textfield',
632
- fieldLabel:'Title',
633
- allowBlank:false,
634
- name:'title'
635
- },
636
- {
637
- xtype:'textfield',
638
- fieldLabel:'Internal ID',
639
- allowBlank:true,
640
- name:'internal_identifier'
641
- },
642
- {
643
- xtype:'combo',
644
- forceSelection:true,
645
- store:[
646
- ['Page', 'Page'],
647
- ['Blog', 'Blog'],
648
- ['OnlineDocumentSection', 'Online Document Section']
649
- ],
650
- value:'Page',
651
- fieldLabel:'Type',
652
- name:'type',
653
- allowBlank:false,
654
- triggerAction:'all'
655
- },
656
- {
657
- xtype:'radiogroup',
658
- fieldLabel:'Display in menu?',
659
- name:'in_menu',
660
- columns:2,
661
- items:[
662
- {
663
- boxLabel:'Yes',
664
- name:'in_menu',
665
- inputValue:'yes',
666
- checked:true
667
- },
668
-
669
- {
670
- boxLabel:'No',
671
- name:'in_menu',
672
- inputValue:'no'
673
- }
674
- ]
675
- },
676
- {
677
- xtype:'radiogroup',
678
- fieldLabel:'Render with Base Layout?',
679
- name:'render_with_base_layout',
680
- columns:2,
681
- items:[
682
- {
683
- boxLabel:'Yes',
684
- name:'render_with_base_layout',
685
- inputValue:'yes',
686
- checked:true
687
- },
688
-
689
- {
690
- boxLabel:'No',
691
- name:'render_with_base_layout',
692
- inputValue:'no'
693
- }
694
- ]
695
- },
696
- {
697
- xtype:'hidden',
698
- name:'website_id',
699
- value:record.data.websiteId
700
- }
701
- ]
702
- }),
703
- buttons:[
704
- {
705
- text:'Submit',
706
- listeners:{
707
- 'click':function (button) {
708
- var window = button.findParentByType('window');
709
- var formPanel = window.query('form')[0];
710
- self.setWindowStatus('Creating section...');
711
- formPanel.getForm().submit({
712
- reset:true,
713
- success:function (form, action) {
714
- self.clearWindowStatus();
715
- var obj = Ext.decode(action.response.responseText);
716
- if (obj.success) {
717
- record.appendChild(obj.node);
718
- addSectionWindow.close();
719
- }
720
- else {
721
- Ext.Msg.alert("Error", obj.msg);
722
- }
723
- },
724
- failure:function (form, action) {
725
- self.clearWindowStatus();
726
- var obj = Ext.decode(action.response.responseText);
727
- if (obj.message) {
728
- Ext.Msg.alert("Error", obj.message);
729
- }
730
- else {
731
- Ext.Msg.alert("Error", "Error creating section.");
732
- }
733
- }
734
- });
735
- }
736
- }
737
- },
738
- {
739
- text:'Close',
740
- handler:function () {
741
- addSectionWindow.close();
742
- }
743
- }
744
- ]
745
- });
746
- addSectionWindow.show();
747
- }
748
- }
749
- });
750
- }
751
- }
752
- else if (record.data['isMenuRoot']) {
753
- if (currentUser.hasCapability('create','WebsiteNav')) {
754
- items.push({
755
- text:'Add Menu',
756
- iconCls:'icon-add',
757
- handler:function (btn) {
758
- var addMenuWindow = Ext.create("Ext.window.Window", {
759
- layout:'fit',
760
- width:375,
761
- title:'New Menu',
762
- height:100,
763
- plain:true,
764
- buttonAlign:'center',
765
- items:Ext.create("Ext.form.Panel", {
766
- labelWidth:50,
767
- frame:false,
768
- bodyStyle:'padding:5px 5px 0',
769
- url:'/knitkit/erp_app/desktop/website_nav/new',
770
- defaults:{
771
- width:225
772
- },
773
- items:[
774
- {
775
- xtype:'textfield',
776
- fieldLabel:'name',
777
- allowBlank:false,
778
- name:'name'
779
- },
780
- {
781
- xtype:'hidden',
782
- name:'website_id',
783
- value:record.data.websiteId
784
- }
785
- ]
786
- }),
787
- buttons:[
788
- {
789
- text:'Submit',
790
- listeners:{
791
- 'click':function (button) {
792
- var window = button.findParentByType('window');
793
- var formPanel = window.query('form')[0];
794
- self.setWindowStatus('Creating menu...');
795
- formPanel.getForm().submit({
796
- reset:true,
797
- success:function (form, action) {
798
- self.clearWindowStatus();
799
- var obj = Ext.decode(action.response.responseText);
800
- if (obj.success) {
801
- record.appendChild(obj.node);
802
- }
803
- else {
804
- Ext.Msg.alert("Error", obj.msg);
805
- }
806
- },
807
- failure:function (form, action) {
808
- self.clearWindowStatus();
809
- var obj = Ext.decode(action.response.responseText);
810
- Ext.Msg.alert("Error", obj.msg);
811
- }
812
- });
813
- }
814
- }
815
- },
816
- {
817
- text:'Close',
818
- handler:function () {
819
- addMenuWindow.close();
820
- }
821
- }
822
- ]
823
- });
824
- addMenuWindow.show();
825
- }
826
- });
827
- }
828
- }
829
- else if (record.data['isWebsiteNav']) {
830
- if (currentUser.hasCapability('edit','WebsiteNav')) {
831
- items.push({
832
- text:'Update',
833
- iconCls:'icon-edit',
834
- handler:function (btn) {
835
- var updateMenuWindow = Ext.create("Ext.window.Window", {
836
- layout:'fit',
837
- width:375,
838
- title:'Update Menu',
839
- height:100,
840
- plain:true,
841
- buttonAlign:'center',
842
- items:new Ext.FormPanel({
843
- labelWidth:50,
844
- frame:false,
845
- bodyStyle:'padding:5px 5px 0',
846
- url:'/knitkit/erp_app/desktop/website_nav/update',
847
- defaults:{
848
- width:225
849
- },
850
- items:[
851
- {
852
- xtype:'textfield',
853
- fieldLabel:'Name',
854
- value:record.data.text,
855
- id:'knitkit_website_nav_update_name',
856
- allowBlank:false,
857
- name:'name'
858
- },
859
- {
860
- xtype:'hidden',
861
- name:'website_nav_id',
862
- value:record.data.websiteNavId
863
- }
864
- ]
865
- }),
866
- buttons:[
867
- {
868
- text:'Submit',
869
- listeners:{
870
- 'click':function (button) {
871
- var window = button.findParentByType('window');
872
- var formPanel = window.query('form')[0];
873
- self.setWindowStatus('Creating menu...');
874
- formPanel.getForm().submit({
875
- reset:false,
876
- success:function (form, action) {
877
- self.clearWindowStatus();
878
- var obj = Ext.decode(action.response.responseText);
879
- if (obj.success) {
880
- var newText = Ext.getCmp('knitkit_website_nav_update_name').getValue();
881
- record.set('text', newText);
882
- record.commit();
883
- }
884
- else {
885
- Ext.Msg.alert("Error", obj.msg);
886
- }
887
- },
888
- failure:function (form, action) {
889
- self.clearWindowStatus();
890
- var obj = Ext.decode(action.response.responseText);
891
- Ext.Msg.alert("Error", obj.msg);
892
- }
893
- });
894
- }
895
- }
896
- },
897
- {
898
- text:'Close',
899
- handler:function () {
900
- updateMenuWindow.close();
901
- }
902
- }
903
- ]
904
- });
905
- updateMenuWindow.show();
906
- }
907
- });
908
- }
102
+ ]
103
+ });
909
104
 
910
- if (currentUser.hasCapability('delete','WebsiteNav')) {
911
- items.push({
912
- text:'Delete',
913
- iconCls:'icon-delete',
914
- handler:function (btn) {
915
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this menu?', function (btn) {
916
- if (btn == 'no') {
917
- return false;
918
- }
919
- else if (btn == 'yes') {
920
- self.setWindowStatus('Deleting menu...');
921
- Ext.Ajax.request({
922
- url:'/knitkit/erp_app/desktop/website_nav/delete',
923
- method:'POST',
924
- params:{
925
- id:record.data.websiteNavId
926
- },
927
- success:function (response) {
928
- self.clearWindowStatus();
929
- var obj = Ext.decode(response.responseText);
930
- if (obj.success) {
931
- record.remove(true);
932
- }
933
- else {
934
- Ext.Msg.alert('Error', 'Error deleting menu');
935
- }
936
- },
937
- failure:function (response) {
938
- self.clearWindowStatus();
939
- Ext.Msg.alert('Error', 'Error deleting menu');
940
- }
941
- });
942
- }
943
- });
944
- }
945
- });
946
- }
947
- }
948
- else if (record.data['isWebsiteNavItem']) {
949
- items = Compass.ErpApp.Desktop.Applications.Knitkit.addWebsiteNavItemOptions(self, items, record);
950
- }
951
- if (items.length != 0) {
952
- var contextMenu = Ext.create("Ext.menu.Menu", {
953
- items:items
954
- });
955
- contextMenu.showAt(e.xy);
956
- }
105
+ var themesPanel = Ext.create('Ext.panel.Panel', {
106
+ title: 'Visual Theme Files',
107
+ autoScroll: true,
108
+ items: [
109
+ {
110
+ xtype: 'knitkit_themestreepanel',
111
+ centerRegion: this.initialConfig['module'].centerRegion,
112
+ header: false
957
113
  }
958
- }
959
- });
114
+ ]
960
115
 
961
- this.contentsCardPanel = Ext.create('Ext.Panel',{
962
- layout:'card',
963
- region:'south',
964
- split:true,
965
- height:300,
966
- collapsible:true
967
116
  });
968
117
 
969
- var tbarItems = [];
970
-
971
- if (currentUser.hasCapability('create','Website')) {
972
- tbarItems.push({
973
- text:'New Website',
974
- iconCls:'icon-add',
975
- handler:function (btn) {
976
- var addWebsiteWindow = Ext.create("Ext.window.Window", {
977
- title:'New Website',
978
- plain:true,
979
- buttonAlign:'center',
980
- items:new Ext.FormPanel({
981
- labelWidth:110,
982
- frame:false,
983
- bodyStyle:'padding:5px 5px 0',
984
- url:'/knitkit/erp_app/desktop/site/new',
985
- defaults:{
986
- width:225
987
- },
988
- items:[
989
- {
990
- xtype:'textfield',
991
- fieldLabel:'Name',
992
- allowBlank:false,
993
- name:'name'
994
- },
995
- {
996
- xtype:'textfield',
997
- fieldLabel:'Host',
998
- allowBlank:false,
999
- name:'host'
1000
- },
1001
- {
1002
- xtype:'textfield',
1003
- fieldLabel:'Title',
1004
- allowBlank:false,
1005
- name:'title'
1006
- },
1007
- {
1008
- xtype:'textfield',
1009
- fieldLabel:'Sub Title',
1010
- allowBlank:true,
1011
- name:'subtitle'
1012
- }
1013
- ]
1014
- }),
1015
- buttons:[
1016
- {
1017
- text:'Submit',
1018
- listeners:{
1019
- 'click':function (button) {
1020
- var window = button.findParentByType('window');
1021
- var formPanel = window.query('.form')[0];
1022
- self.setWindowStatus('Creating website...');
1023
- formPanel.getForm().submit({
1024
- success:function (form, action) {
1025
- self.clearWindowStatus();
1026
- var obj = Ext.decode(action.response.responseText);
1027
- if (obj.success) {
1028
- self.sitesTree.getStore().load();
1029
- addWebsiteWindow.close();
1030
- }
1031
- },
1032
- failure:function (form, action) {
1033
- self.clearWindowStatus();
1034
- Ext.Msg.alert("Error", "Error creating website");
1035
- }
1036
- });
1037
- }
1038
- }
1039
- },
1040
- {
1041
- text:'Close',
1042
- handler:function () {
1043
- addWebsiteWindow.close();
1044
- }
1045
- }
1046
- ]
1047
- });
1048
- addWebsiteWindow.show();
1049
- }
118
+ var menuPanel = Ext.create('Ext.panel.Panel', {
119
+ title: 'Menus and Navigation',
120
+ autoScroll: true,
121
+ items: [
122
+ {
123
+ xtype: 'knitkit_menutreepanel'
1050
124
  }
1051
- );
1052
- }
125
+ ]
126
+ });
1053
127
 
1054
- if (currentUser.hasCapability('import','Website')) {
1055
- tbarItems.push({
1056
- text:'Import Website',
1057
- iconCls:'icon-globe',
1058
- handler:function (btn) {
1059
- var importWebsiteWindow = Ext.create("Ext.window.Window", {
1060
- layout:'fit',
1061
- width:375,
1062
- title:'Import Website',
1063
- height:100,
1064
- plain:true,
1065
- buttonAlign:'center',
1066
- items:new Ext.FormPanel({
1067
- labelWidth:110,
1068
- frame:false,
1069
- fileUpload:true,
1070
- bodyStyle:'padding:5px 5px 0',
1071
- url:'/knitkit/erp_app/desktop/site/import',
1072
- defaults:{
1073
- width:225
1074
- },
1075
- items:[
1076
- {
1077
- xtype:'fileuploadfield',
1078
- fieldLabel:'Upload Website',
1079
- buttonText:'Upload',
1080
- buttonOnly:false,
1081
- allowBlank:false,
1082
- name:'website_data'
1083
- }
1084
- ]
1085
- }),
1086
- buttons:[
1087
- {
1088
- text:'Submit',
1089
- listeners:{
1090
- 'click':function (button) {
1091
- var window = button.findParentByType('window');
1092
- var formPanel = window.query('form')[0];
1093
- self.setWindowStatus('Importing website...');
1094
- formPanel.getForm().submit({
1095
- success:function (form, action) {
1096
- self.clearWindowStatus();
1097
- var obj = Ext.decode(action.response.responseText);
1098
- if (obj.success) {
1099
- self.sitesTree.getStore().load();
1100
- importWebsiteWindow.close();
1101
- }
1102
- else {
1103
- Ext.Msg.alert("Error", obj.message);
1104
- }
1105
- },
1106
- failure:function (form, action) {
1107
- self.clearWindowStatus();
1108
- var obj = Ext.decode(action.response.responseText);
1109
- if (obj != null) {
1110
- Ext.Msg.alert("Error", obj.message);
1111
- }
1112
- else {
1113
- Ext.Msg.alert("Error", "Error importing website");
1114
- }
1115
- }
1116
- });
1117
- }
1118
- }
1119
- },
1120
- {
1121
- text:'Close',
1122
- handler:function () {
1123
- importWebsiteWindow.close();
1124
- }
1125
- }
1126
- ]
1127
- });
1128
- importWebsiteWindow.show();
128
+ var configPanel = Ext.create('Ext.panel.Panel', {
129
+ title: 'Hosts',
130
+ autoScroll: true,
131
+ items: [
132
+ {
133
+ xtype: 'knitkit_hostspanel'
1129
134
  }
1130
- });
1131
- }
135
+ ]
1132
136
 
1133
- var layout = Ext.create('Ext.panel.Panel',{
1134
- layout:'border',
1135
- title:'Websites',
1136
- items:[this.sitesTree, this.contentsCardPanel],
1137
- tbar:{
1138
- items:tbarItems
1139
- }
1140
137
  });
1141
138
 
1142
- if (currentUser.hasCapability('view','Theme')) {
1143
- this.items = [layout,
1144
- {
1145
- xtype:'knitkit_themestreepanel',
1146
- centerRegion:this.initialConfig['module'].centerRegion
1147
- },
1148
- {
1149
- xtype:'knitkit_articlesgridpanel',
1150
- centerRegion:this.initialConfig['module'].centerRegion
1151
- }];
1152
- } else {
1153
- this.items = [layout,
1154
- {
1155
- xtype:'knitkit_articlesgridpanel',
1156
- centerRegion:this.initialConfig['module'].centerRegion
1157
- }];
1158
- }
139
+ this.items = [siteContentsPanel, themesPanel, menuPanel, configPanel];
140
+
141
+ this.dockedItems = [
142
+ {
143
+ xtype: 'toolbar',
144
+ dock: 'top',
145
+ items: [
146
+ {
147
+ text: 'Site:'
148
+ },
149
+ {
150
+ xtype: 'websitescombo',
151
+ width: 205
152
+ }
153
+ ]
154
+ }
155
+ ];
1159
156
 
1160
157
  this.callParent(arguments);
1161
- this.setActiveTab(0);
1162
158
  },
1163
159
 
1164
- getArticles:function (node) {
1165
- this.contentsCardPanel.removeAll(true);
1166
- var xtype = 'knitkit_' + node.data.type.toLowerCase() + 'articlesgridpanel';
1167
- this.contentsCardPanel.add({
1168
- xtype:xtype,
1169
- title:node.data.siteName + ' - ' + node.data.text + ' - Articles',
1170
- sectionId:node.data.id.split('_')[1],
1171
- centerRegion:this.initialConfig['module'].centerRegion,
1172
- siteId:node.data.siteId
1173
- });
1174
- this.contentsCardPanel.getLayout().setActiveItem(this.contentsCardPanel.items.length - 1);
1175
- },
160
+ constructor: function (config) {
161
+ config = Ext.apply({
1176
162
 
1177
- getPublications:function (node) {
1178
- this.contentsCardPanel.removeAll(true);
1179
- this.contentsCardPanel.add({
1180
- xtype:'knitkit_publishedgridpanel',
1181
- title:node.data.siteName + ' Publications',
1182
- siteId:node.data.id.split('_')[1],
1183
- centerRegion:this.initialConfig['module'].centerRegion
1184
- });
1185
- this.contentsCardPanel.getLayout().setActiveItem(this.contentsCardPanel.items.length - 1);
1186
- },
163
+ region: 'west',
164
+ split: true,
165
+ width: 300,
166
+ collapsible: true
1187
167
 
1188
- constructor:function (config) {
1189
- config = Ext.apply({
1190
- region:'west',
1191
- split:true,
1192
- width:350,
1193
- collapsible:true
1194
168
  }, config);
1195
169
 
1196
170
  this.callParent([config]);
1197
171
  }
1198
- });
172
+ });