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,7 +1,7 @@
1
- Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.SelectRolesWindow",{
2
- extend:"Ext.window.Window",
3
- alias:'widget.knikit_selectroleswindow',
4
- initComponent : function() {
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.SelectRolesWindow", {
2
+ extend: "Ext.window.Window",
3
+ alias: 'widget.knikit_selectroleswindow',
4
+ initComponent: function () {
5
5
 
6
6
  this.addEvents(
7
7
  /**
@@ -23,78 +23,83 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.SelectRolesWindow",{
23
23
  this.callParent(arguments);
24
24
  },
25
25
 
26
- constructor : function(config) {
26
+ constructor: function (config) {
27
27
  var currentRoles = config['currentRoles'],
28
28
  availableRoles = config['availableRoles'],
29
29
  checkBoxes = [];
30
30
 
31
- Ext.each(availableRoles, function(role){
31
+ Ext.each(availableRoles, function (role) {
32
32
  checkBoxes.push({
33
- name:role['internal_identifier'],
34
- boxLabel:role['description'],
35
- checked:currentRoles.contains(role['internal_identifier'])
33
+ name: role['internal_identifier'],
34
+ boxLabel: role['description'],
35
+ checked: currentRoles.contains(role['internal_identifier'])
36
36
  })
37
37
  });
38
38
 
39
39
  config = Ext.apply({
40
- layout:'fit',
41
- title:'Secure',
42
- iconCls:'icon-document_lock',
43
- width:250,
44
- height:300,
45
- buttonAlign:'center',
40
+ layout: 'fit',
41
+ modal: true,
42
+ title: 'Secure',
43
+ iconCls: 'icon-document_lock',
44
+ width: 250,
45
+ height: 300,
46
+ buttonAlign: 'center',
46
47
  plain: true,
47
- items: Ext.create('widget.form',{
48
+ items: Ext.create('widget.form', {
48
49
  timeout: 130000,
49
- baseParams:config['baseParams'],
50
- autoHeight:true,
51
- labelWidth:110,
52
- bodyPadding:'5px',
53
- frame:false,
54
- layout:'fit',
55
- url:config['url'],
50
+ baseParams: config['baseParams'],
51
+ autoHeight: true,
52
+ labelWidth: 110,
53
+ bodyPadding: '5px',
54
+ frame: false,
55
+ layout: 'fit',
56
+ url: config['url'],
56
57
  defaults: {
57
58
  width: 225
58
59
  },
59
- items: [{
60
- xtype: 'fieldset',
61
- autoScroll:true,
62
- title:'Select Roles',
63
- defaultType: 'checkbox',
64
- items:checkBoxes
65
- }]
60
+ items: [
61
+ {
62
+ xtype: 'fieldset',
63
+ autoScroll: true,
64
+ title: 'Select Roles',
65
+ defaultType: 'checkbox',
66
+ items: checkBoxes
67
+ }
68
+ ]
66
69
  }),
67
- buttons: [{
68
- text:'Submit',
69
- listeners:{
70
- 'click':function(button){
71
- var win = button.up('knikit_selectroleswindow');
72
- var formPanel = win.down('form');
73
- formPanel.getForm().submit({
74
- method:'POST',
75
- waitMsg:'Updating Security...',
76
- success:function(form, action){
77
- var response = Ext.decode(action.response.responseText);
78
- win.fireEvent('success', win, response);
79
- win.close();
80
- },
81
- failure:function(form, action){
82
- var response = Ext.decode(action.response.responseText);
83
- win.fireEvent('failure', win, response);
84
- }
85
- });
70
+ buttons: [
71
+ {
72
+ text: 'Submit',
73
+ listeners: {
74
+ 'click': function (button) {
75
+ var win = button.up('knikit_selectroleswindow');
76
+ var formPanel = win.down('form');
77
+ formPanel.getForm().submit({
78
+ method: 'POST',
79
+ waitMsg: 'Updating Security...',
80
+ success: function (form, action) {
81
+ var response = Ext.decode(action.response.responseText);
82
+ win.fireEvent('success', win, response);
83
+ win.close();
84
+ },
85
+ failure: function (form, action) {
86
+ var response = Ext.decode(action.response.responseText);
87
+ win.fireEvent('failure', win, response);
88
+ }
89
+ });
90
+ }
86
91
  }
87
- }
88
- },
92
+ },
89
93
  {
90
94
  text: 'Cancel',
91
- listeners:{
92
- 'click':function(button){
95
+ listeners: {
96
+ 'click': function (button) {
93
97
  var win = button.up('knikit_selectroleswindow');
94
98
  win.close();
95
99
  }
96
100
  }
97
- }]
101
+ }
102
+ ]
98
103
  }, config);
99
104
 
100
105
  this.callParent([config]);
@@ -0,0 +1,170 @@
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.SplashScreen", {
2
+ extend: "Ext.panel.Panel",
3
+ alias: 'widget.knitkit_splash_screen',
4
+ title: 'Startup',
5
+ closable: true,
6
+ items: [
7
+ {
8
+ html: "<div style='margin: 15px 50px 5px 50px;'><hr /><h2 style='margin: 3px 0px 0px 0px; color: #555; text-align: center'>Website Builder Home</h2><hr /></div>"
9
+ },
10
+
11
+ {
12
+ xtype: 'image',
13
+ style: 'padding-left: 50%; margin-left: -300px;',
14
+ src: '/images/knitkit/splash/splash.png'
15
+ },
16
+
17
+ {
18
+ html: "<div style='margin: 15px 50px 5px 50px;'><p style='margin: 0px; color: #222; text-align: center; font-size: 16px; font-weight: 300;'>Click on the shortcuts below to get started.</p></div>"
19
+ },
20
+
21
+ {
22
+ xtype: 'panel',
23
+ layout: 'column',
24
+ style: 'width: 480px; margin-top: 0px; margin-left: auto; margin-right: auto;',
25
+ items: [
26
+
27
+ {
28
+ xtype: 'panel',
29
+ height: 140,
30
+ width: 140,
31
+ style:{
32
+ margin: '0px 0px 5px 10px;',
33
+ cursor: 'pointer'
34
+ },
35
+ bodyStyle: 'background: #ddd; padding: 20px; border-radius: 7px; border-color: #aaa !important;',
36
+ border: true,
37
+ bodyBorder: true,
38
+ overCls: 'shortcut-hover',
39
+ items: [
40
+ {
41
+ xtype: 'image',
42
+ src: '/images/knitkit/splash/images/browse-site.png',
43
+ height: 80,
44
+ width: 80,
45
+ style:{
46
+ margin: '0px 0px 5px 10px;',
47
+ cursor: 'pointer'
48
+ },
49
+ listeners: {
50
+ render: function (component) {
51
+ component.getEl().on('click', function (e) {
52
+
53
+ var currentWebsite = compassDesktop.getModule('knitkit-win').currentWebsite;
54
+ if(currentWebsite){
55
+ window.open(currentWebsite.url,'_blank');
56
+ }
57
+ else{
58
+ Ext.Msg.alert('Error', 'No website selected');
59
+ }
60
+
61
+ }, component);
62
+ }
63
+ }
64
+ },
65
+ {
66
+ html: "<p style='background-color: #ddd; margin: 0px; text-align: center'>View the current site in a browser</p>"
67
+ }
68
+ ]
69
+ },
70
+
71
+ {
72
+ xtype: 'panel',
73
+ height: 140,
74
+ width: 140,
75
+ style:{
76
+ margin: '0px 0px 5px 10px;',
77
+ cursor: 'pointer'
78
+ },
79
+ bodyStyle: 'background: #ddd; padding: 20px; border-radius: 7px; border-color: #aaa !important;',
80
+ border: true,
81
+ bodyBorder: true,
82
+ overCls: 'shortcut-hover',
83
+ items: [
84
+ {
85
+ xtype: 'image',
86
+ src: '/images/knitkit/splash/images/find-themes.png',
87
+ height: 80,
88
+ width: 80,
89
+ style:{
90
+ margin: '0px 0px 5px 10px;',
91
+ cursor: 'pointer'
92
+ },
93
+ listeners: {
94
+ render: function (component) {
95
+ component.getEl().on('click', function (e) {
96
+
97
+ var cr = this.findParentByType('knitkit_centerregion');
98
+
99
+ cr.setWindowStatus('Finding themes...');
100
+ cr.openIframeInTab('Find Themes', 'http://themes.compassagile.com');
101
+ cr.clearWindowStatus();
102
+
103
+
104
+ }, component);
105
+ }
106
+ }
107
+ },
108
+ {
109
+ html: "<p style='background-color: #ddd; margin: 0px; text-align: center'>Find themes</p>"
110
+ }
111
+ ]
112
+ },
113
+
114
+ {
115
+ xtype: 'panel',
116
+ height: 140,
117
+ width: 140,
118
+ style:{
119
+ margin: '0px 0px 5px 10px;',
120
+ cursor: 'pointer'
121
+ },
122
+ bodyStyle: 'background: #ddd; padding: 20px; border-radius: 7px; border-color: #aaa !important;',
123
+ border: true,
124
+ bodyBorder: true,
125
+ overCls: 'shortcut-hover',
126
+ items: [
127
+ {
128
+ xtype: 'image',
129
+ src: '/images/knitkit/splash/images/tutorials.png',
130
+ height: 80,
131
+ width: 80,
132
+ style:{
133
+ margin: '0px 0px 5px 10px;',
134
+ cursor: 'pointer'
135
+ },
136
+ listeners: {
137
+ render: function (component) {
138
+ component.getEl().on('click', function (e) {
139
+
140
+ var cr = this.findParentByType('knitkit_centerregion');
141
+
142
+ cr.setWindowStatus('Retrieving Docs...');
143
+ cr.openIframeInTab('Tutorials', 'http://tutorials.compassagile.com');
144
+ cr.clearWindowStatus();
145
+
146
+ }, component);
147
+ }
148
+ }
149
+ },
150
+ {
151
+ html: "<p style='background-color: #ddd; margin: 0px; text-align: center'>Learn more!</p>"
152
+ }
153
+ ]
154
+ }
155
+ ]
156
+ }
157
+ ],
158
+ constructor: function (config) {
159
+
160
+ var self = this;
161
+
162
+ config = Ext.apply({
163
+ //placeholder
164
+ }, config);
165
+
166
+ self.callParent(config);
167
+ }
168
+ });
169
+
170
+
@@ -0,0 +1,1168 @@
1
+ // Website
2
+ Compass.ErpApp.Desktop.Applications.Knitkit.editWebsiteMenuItem = function (disabled) {
3
+ return {
4
+ text: 'Edit Website',
5
+ iconCls: 'icon-edit',
6
+ itemId: 'editWebsiteMenuItem',
7
+ disabled: disabled,
8
+ handler: function () {
9
+ var knitkitModule = compassDesktop.getModule('knitkit-win');
10
+
11
+ Ext.create("Ext.window.Window", {
12
+ title: 'Update Website',
13
+ plain: true,
14
+ buttonAlign: 'center',
15
+ items: Ext.create("Ext.form.Panel", {
16
+ labelWidth: 110,
17
+ frame: false,
18
+ bodyStyle: 'padding:5px 5px 0',
19
+ url: '/knitkit/erp_app/desktop/site/update',
20
+ defaults: {
21
+ width: 225
22
+ },
23
+ items: [
24
+ {
25
+ xtype: 'textfield',
26
+ fieldLabel: 'Name',
27
+ allowBlank: false,
28
+ name: 'name',
29
+ value: knitkitModule.currentWebsite.name
30
+ },
31
+ {
32
+ xtype: 'textfield',
33
+ fieldLabel: 'Title',
34
+ id: 'knitkitUpdateSiteTitle',
35
+ allowBlank: false,
36
+ name: 'title',
37
+ value: knitkitModule.currentWebsite.title
38
+ },
39
+ {
40
+ xtype: 'textfield',
41
+ fieldLabel: 'Sub Title',
42
+ allowBlank: true,
43
+ name: 'subtitle',
44
+ value: knitkitModule.currentWebsite.subtitle
45
+
46
+ },
47
+ {
48
+ xtype: 'hidden',
49
+ name: 'website_id',
50
+ value: knitkitModule.currentWebsite.id
51
+ }
52
+ ]
53
+ }),
54
+ buttons: [
55
+ {
56
+ text: 'Submit',
57
+ listeners: {
58
+ 'click': function (button) {
59
+ var window = button.findParentByType('window');
60
+ var formPanel = window.query('form')[0];
61
+
62
+ formPanel.getForm().submit({
63
+ waitMsg: 'Please wait...',
64
+ success: function (form, action) {
65
+ knitkitModule.currentWebsite.name = form.findField('name').getValue();
66
+ knitkitModule.currentWebsite.title = form.findField('title').getValue();
67
+ knitkitModule.currentWebsite.subtitle = form.findField('subtitle').getValue();
68
+
69
+ var websiteCombo = compassDesktop.desktop.getWindow('knitkit').down('websitescombo');
70
+ websiteCombo.getStore().load({
71
+ callback: function () {
72
+ websiteCombo.select(knitkitModule.currentWebsite.id);
73
+ }
74
+ })
75
+
76
+ window.close();
77
+ },
78
+ failure: function (form, action) {
79
+ Ext.Msg.alert("Error", "Error updating website");
80
+ }
81
+ });
82
+ }
83
+ }
84
+ },
85
+ {
86
+ text: 'Close',
87
+ handler: function (btn) {
88
+ btn.up('window').close();
89
+ }
90
+ }
91
+ ]
92
+ }).show();
93
+ }
94
+ }
95
+ };
96
+
97
+ Compass.ErpApp.Desktop.Applications.Knitkit.exportWebsiteMenuItem = function (disabled) {
98
+ return {
99
+ text: 'Export Website',
100
+ iconCls: 'icon-website-export',
101
+ itemId: 'exportWebsiteMenuItem',
102
+ disabled: disabled,
103
+ handler: function () {
104
+ var knitkitWin = compassDesktop.getModule('knitkit-win'),
105
+ websiteId = knitkitWin.currentWebsite.id;
106
+
107
+ window.open('/knitkit/erp_app/desktop/site/export?website_id=' + websiteId, '_blank');
108
+ }
109
+ }
110
+ };
111
+
112
+ Compass.ErpApp.Desktop.Applications.Knitkit.configureWebsiteMenuItem = function (disabled) {
113
+ return {
114
+ text: 'Configure Website',
115
+ iconCls: 'icon-knitkit',
116
+ itemId: 'configureWebsiteMenuItem',
117
+ disabled: disabled,
118
+ handler: function () {
119
+ var knitkitWin = compassDesktop.getModule('knitkit-win'),
120
+ configurationId = knitkitWin.currentWebsite.configurationId;
121
+
122
+ Ext.create("Ext.window.Window", {
123
+ layout: 'fit',
124
+ height: 500,
125
+ width: 700,
126
+ modal: true,
127
+ title: 'Configuration',
128
+ autoScroll: true,
129
+ items: [
130
+ {
131
+ xtype: 'sharedconfigurationpanel',
132
+ configurationId: configurationId
133
+ }
134
+ ]
135
+ }).show();
136
+ }
137
+ }
138
+ };
139
+
140
+ Compass.ErpApp.Desktop.Applications.Knitkit.websitePublicationsMenuItem = function (disabled) {
141
+ return {
142
+ text: 'Website Publications',
143
+ itemId: 'websitePublicationsMenuItem',
144
+ disabled: disabled,
145
+ iconCls: 'icon-website-publications',
146
+ handler: function () {
147
+ var knitkitWin = compassDesktop.getModule('knitkit-win'),
148
+ websiteId = knitkitWin.currentWebsite.id;
149
+
150
+ Ext.create("Ext.window.Window", {
151
+ layout: 'fit',
152
+ height: 500,
153
+ width: 800,
154
+ modal: true,
155
+ title: 'Publications',
156
+ autoScroll: true,
157
+ items: [
158
+ {
159
+ xtype: 'knitkit_publishedgridpanel',
160
+ siteId: websiteId
161
+ }
162
+ ]
163
+ }).show();
164
+ }
165
+ }
166
+ };
167
+
168
+ Compass.ErpApp.Desktop.Applications.Knitkit.websitePublishMenuItem = function (disabled) {
169
+ return {
170
+ text: 'Publish Website',
171
+ itemId: 'publishWebsiteMenuItem',
172
+ disabled: disabled,
173
+ iconCls: 'icon-document_up',
174
+ handler: function () {
175
+ var knitkitWin = compassDesktop.getModule('knitkit-win'),
176
+ websiteId = knitkitWin.currentWebsite.id;
177
+
178
+ Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow', {
179
+ baseParams: {
180
+ website_id: websiteId
181
+ },
182
+ url: '/knitkit/erp_app/desktop/site/publish',
183
+ listeners: {
184
+ 'publish_success': function (window, response) {
185
+ if (!response.success) {
186
+ Ext.Msg.alert('Error', 'Error publishing Website');
187
+ }
188
+ },
189
+ 'publish_failure': function (window, response) {
190
+ Ext.Msg.alert('Error', 'Error publishing Website');
191
+ }
192
+ }
193
+ }).show();
194
+ }
195
+ }
196
+ };
197
+
198
+ Compass.ErpApp.Desktop.Applications.Knitkit.websiteInquiresMenuItem = function (disabled) {
199
+ return {
200
+ text: 'View Inquires',
201
+ itemId: 'websiteInquiresMenuItem',
202
+ disabled: disabled,
203
+ iconCls: 'icon-document',
204
+ handler: function () {
205
+ var knitkitModule = compassDesktop.getModule('knitkit-win')
206
+ knitkitWindow = compassDesktop.desktop.getWindow('knitkit');
207
+
208
+ knitkitWindow.down('knitkit_centerregion').viewWebsiteInquiries(knitkitModule.currentWebsite.id, knitkitModule.currentWebsite.name);
209
+ }
210
+ }
211
+ };
212
+
213
+ Compass.ErpApp.Desktop.Applications.Knitkit.websiteMenu = function () {
214
+ return {
215
+ text: 'Websites',
216
+ iconCls: 'icon-website',
217
+ menu: {
218
+ xtype: 'menu',
219
+ items: [
220
+ {
221
+ text: 'New Website',
222
+ iconCls: 'icon-add',
223
+ handler: function (btn) {
224
+ Ext.create("Ext.window.Window", {
225
+ modal: true,
226
+ title: 'New Website',
227
+ buttonAlign: 'center',
228
+ width: 360,
229
+ items: Ext.create('widget.form', {
230
+ labelWidth: 110,
231
+ frame: false,
232
+ bodyStyle: 'padding:5px 5px 0',
233
+ url: '/knitkit/erp_app/desktop/site/new',
234
+ defaults: {
235
+ width: 320
236
+ },
237
+ items: [
238
+ {
239
+ xtype: 'textfield',
240
+ fieldLabel: 'Name *',
241
+ allowBlank: false,
242
+ name: 'name',
243
+ plugins: [new helpQtip("This is required and must be unique. Spaces are OK.")]
244
+ },
245
+ {
246
+ xtype: 'textfield',
247
+ fieldLabel: 'Host *',
248
+ allowBlank: false,
249
+ name: 'host',
250
+ plugins: [new helpQtip("If you are running locally, this will probably be localhost:3000.<br> Otherwise, it is the domain or subdomain for this CompassAE instance")]
251
+ },
252
+ {
253
+ xtype: 'textfield',
254
+ fieldLabel: 'Title *',
255
+ allowBlank: false,
256
+ name: 'title'
257
+ },
258
+ {
259
+ xtype: 'textfield',
260
+ fieldLabel: 'Sub Title',
261
+ allowBlank: true,
262
+ name: 'subtitle'
263
+ }
264
+ ]
265
+ }),
266
+ buttons: [
267
+ {
268
+ text: 'Submit',
269
+ listeners: {
270
+ 'click': function (button) {
271
+ var knitkitModule = compassDesktop.getModule('knitkit-win'),
272
+ knitkitWindow = compassDesktop.desktop.getWindow('knitkit'),
273
+ window = button.findParentByType('window'),
274
+ formPanel = window.query('.form')[0];
275
+
276
+ formPanel.getForm().submit({
277
+ waitMsg: 'Please wait...',
278
+ success: function (form, action) {
279
+ var obj = Ext.decode(action.response.responseText);
280
+ if (obj.success) {
281
+ var combo = knitkitWindow.down('websitescombo');
282
+ combo.store.load({
283
+ callback: function (records, operation, succes) {
284
+ for (i = 0; i < records.length; i++) {
285
+ if (records[i].data.id == obj.website.id) {
286
+ combo.select(records[i]);
287
+
288
+ knitkitModule.selectWebsite(records[i]);
289
+ window.close();
290
+
291
+ break;
292
+ }
293
+ }
294
+ }
295
+ });
296
+ }
297
+ },
298
+ failure: function (form, action) {
299
+ Ext.Msg.alert("Error", "Error creating website");
300
+ }
301
+ });
302
+ }
303
+ }
304
+ },
305
+ {
306
+ text: 'Close',
307
+ handler: function (btn) {
308
+ btn.up('window').close();
309
+ }
310
+ }
311
+ ]
312
+ }).show();
313
+ }
314
+ },
315
+ {
316
+ text: 'Import Website',
317
+ iconCls: 'icon-website-import',
318
+ handler: function (btn) {
319
+ Ext.create("Ext.window.Window", {
320
+ modal: true,
321
+ layout: 'fit',
322
+ width: 375,
323
+ title: 'Import Website',
324
+ height: 120,
325
+ plain: true,
326
+ buttonAlign: 'center',
327
+ items: new Ext.FormPanel({
328
+ labelWidth: 110,
329
+ frame: false,
330
+ fileUpload: true,
331
+ bodyStyle: 'padding:5px 5px 0',
332
+ url: '/knitkit/erp_app/desktop/site/import',
333
+ defaults: {
334
+ width: 320
335
+ },
336
+ items: [
337
+ {
338
+ xtype: 'fileuploadfield',
339
+ fieldLabel: 'Upload Website',
340
+ buttonText: 'Upload',
341
+ buttonOnly: false,
342
+ allowBlank: false,
343
+ name: 'website_data'
344
+ }
345
+ ]
346
+ }),
347
+ buttons: [
348
+ {
349
+ text: 'Submit',
350
+ listeners: {
351
+ 'click': function (button) {
352
+ var knitkitModule = compassDesktop.getModule('knitkit-win'),
353
+ knitkitWindow = compassDesktop.desktop.getWindow('knitkit'),
354
+ window = button.findParentByType('window'),
355
+ formPanel = window.query('.form')[0];
356
+
357
+ formPanel.getForm().submit({
358
+ waitMsg: 'Please wait...',
359
+ success: function (form, action) {
360
+ var obj = Ext.decode(action.response.responseText);
361
+ if (obj.success) {
362
+ var combo = knitkitWindow.down('websitescombo');
363
+ combo.store.load({
364
+ callback: function (records, operation, succes) {
365
+ for (i = 0; i < records.length; i++) {
366
+ if (records[i].data.id == obj.website.id) {
367
+ combo.select(records[i]);
368
+
369
+ knitkitModule.selectWebsite(records[i]);
370
+ window.close();
371
+
372
+ break;
373
+ }
374
+ }
375
+ }
376
+ });
377
+ }
378
+ else {
379
+ Ext.Msg.alert("Error", obj.message);
380
+ }
381
+ },
382
+ failure: function (form, action) {
383
+ var obj = Ext.decode(action.response.responseText);
384
+ if (obj != null) {
385
+ Ext.Msg.alert("Error", obj.message);
386
+ }
387
+ else {
388
+ Ext.Msg.alert("Error", "Error importing website");
389
+ }
390
+ }
391
+ });
392
+ }
393
+ }
394
+ },
395
+ {
396
+ text: 'Close',
397
+ handler: function (btn) {
398
+ btn.up('window').close();
399
+ }
400
+ }
401
+ ]
402
+ }).show();
403
+ }
404
+ },
405
+ {
406
+ xtype: 'menuseparator'
407
+ },
408
+ Compass.ErpApp.Desktop.Applications.Knitkit.editWebsiteMenuItem(true),
409
+ Compass.ErpApp.Desktop.Applications.Knitkit.configureWebsiteMenuItem(true),
410
+ Compass.ErpApp.Desktop.Applications.Knitkit.exportWebsiteMenuItem(true),
411
+ Compass.ErpApp.Desktop.Applications.Knitkit.websitePublicationsMenuItem(true),
412
+ Compass.ErpApp.Desktop.Applications.Knitkit.websitePublishMenuItem(true),
413
+ Compass.ErpApp.Desktop.Applications.Knitkit.websiteInquiresMenuItem(true),
414
+ {
415
+ text: 'Delete Website',
416
+ itemId: 'deleteWebsiteMenuItem',
417
+ disabled: true,
418
+ iconCls: 'icon-delete',
419
+ handler: function () {
420
+ var knitkitModule = compassDesktop.getModule('knitkit-win'),
421
+ knitkitWindow = compassDesktop.desktop.getWindow('knitkit'),
422
+ websiteId = knitkitModule.currentWebsite.id;
423
+
424
+ Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this Website?', function (btn) {
425
+ if (btn == 'no') {
426
+ return false;
427
+ }
428
+ else if (btn == 'yes') {
429
+ Ext.Ajax.request({
430
+ url: '/knitkit/erp_app/desktop/site/delete',
431
+ method: 'POST',
432
+ params: {
433
+ website_id: websiteId
434
+ },
435
+ success: function (response) {
436
+ var obj = Ext.decode(response.responseText);
437
+ if (obj.success) {
438
+ var combo = knitkitWindow.down('websitescombo');
439
+ combo.store.load({
440
+ callback: function (records, operation, succes) {
441
+ if (records.length > 0) {
442
+ combo.select(records.first());
443
+
444
+ knitkitModule.selectWebsite(records.first());
445
+ }
446
+ else {
447
+ knitkitModule.clearWebsite()
448
+ }
449
+ }
450
+ });
451
+ }
452
+ else {
453
+ Ext.Msg.alert('Error', 'Error deleting Website');
454
+ }
455
+ },
456
+ failure: function (response) {
457
+ Ext.Msg.alert('Error', 'Error deleting Website');
458
+ }
459
+ });
460
+ }
461
+ });
462
+ }
463
+ }
464
+ ]
465
+ }
466
+ }
467
+ };
468
+
469
+ // Articles
470
+ Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesMenu = function () {
471
+ return {
472
+ text: 'Articles',
473
+ iconCls: 'icon-documents',
474
+ handler: function () {
475
+ var centerRegion = Ext.getCmp('knitkitCenterRegion');
476
+
477
+ Ext.create('widget.window', {
478
+ modal: true,
479
+ title: 'Articles',
480
+ width: 800,
481
+ height: 500,
482
+ layout: 'fit',
483
+ items: [
484
+ {
485
+ xtype: 'knitkit_articlesgridpanel',
486
+ centerRegion: centerRegion
487
+ }
488
+ ]
489
+ }).show();
490
+ }
491
+ }
492
+ };
493
+
494
+ // New Section
495
+ Compass.ErpApp.Desktop.Applications.Knitkit.newSectionMenuItem = {
496
+ text: 'Add Section',
497
+ iconCls: 'icon-add',
498
+ listeners: {
499
+ 'click': function () {
500
+ if (currentUser.hasCapability('create', 'WebsiteSection')) {
501
+ var westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
502
+ knitkitSiteContentsTreePanel = westRegion.down('#knitkitSiteContentsTreePanel'),
503
+ knitkitWin = compassDesktop.getModule('knitkit-win'),
504
+ websiteId = knitkitWin.currentWebsite.id;
505
+
506
+ Ext.create("Ext.window.Window", {
507
+ model: true,
508
+ layout: 'fit',
509
+ title: 'New Section',
510
+ buttonAlign: 'center',
511
+ items: Ext.create("Ext.form.Panel", {
512
+ labelWidth: 110,
513
+ frame: false,
514
+ bodyStyle: 'padding:5px 5px 0',
515
+ url: '/knitkit/erp_app/desktop/section/new',
516
+ defaults: {
517
+ width: 225
518
+ },
519
+ items: [
520
+ {
521
+ xtype: 'textfield',
522
+ fieldLabel: 'Title',
523
+ allowBlank: false,
524
+ name: 'title'
525
+ },
526
+ {
527
+ xtype: 'textfield',
528
+ fieldLabel: 'Internal ID',
529
+ allowBlank: true,
530
+ name: 'internal_identifier'
531
+ },
532
+ {
533
+ xtype: 'combo',
534
+ forceSelection: true,
535
+ store: [
536
+ ['Page', 'Page'],
537
+ ['Blog', 'Blog'],
538
+ ['OnlineDocumentSection', 'Online Document Section']
539
+ ],
540
+ value: 'Page',
541
+ fieldLabel: 'Type',
542
+ name: 'type',
543
+ allowBlank: false,
544
+ triggerAction: 'all'
545
+ },
546
+ {
547
+ xtype: 'radiogroup',
548
+ fieldLabel: 'Display in menu?',
549
+ name: 'in_menu',
550
+ columns: 2,
551
+ items: [
552
+ {
553
+ boxLabel: 'Yes',
554
+ name: 'in_menu',
555
+ inputValue: 'yes',
556
+ checked: true
557
+ },
558
+
559
+ {
560
+ boxLabel: 'No',
561
+ name: 'in_menu',
562
+ inputValue: 'no'
563
+ }
564
+ ]
565
+ },
566
+ {
567
+ xtype: 'radiogroup',
568
+ fieldLabel: 'Render with Base Layout?',
569
+ name: 'render_with_base_layout',
570
+ columns: 2,
571
+ items: [
572
+ {
573
+ boxLabel: 'Yes',
574
+ name: 'render_with_base_layout',
575
+ inputValue: 'yes',
576
+ checked: true
577
+ },
578
+
579
+ {
580
+ boxLabel: 'No',
581
+ name: 'render_with_base_layout',
582
+ inputValue: 'no'
583
+ }
584
+ ]
585
+ },
586
+ {
587
+ xtype: 'hidden',
588
+ name: 'website_id',
589
+ value: websiteId
590
+ }
591
+ ]
592
+ }),
593
+ buttons: [
594
+ {
595
+ text: 'Submit',
596
+ listeners: {
597
+ 'click': function (button) {
598
+ var window = button.findParentByType('window');
599
+ var formPanel = window.query('form')[0];
600
+
601
+ formPanel.getForm().submit({
602
+ reset: true,
603
+ success: function (form, action) {
604
+
605
+ var obj = Ext.decode(action.response.responseText);
606
+ if (obj.success) {
607
+ knitkitSiteContentsTreePanel.getRootNode().appendChild(obj.node);
608
+ window.close();
609
+ }
610
+ else {
611
+ Ext.Msg.alert("Error", obj.msg);
612
+ }
613
+ },
614
+ failure: function (form, action) {
615
+ var obj = Ext.decode(action.response.responseText);
616
+ if (obj.message) {
617
+ Ext.Msg.alert("Error", obj.message);
618
+ }
619
+ else {
620
+ Ext.Msg.alert("Error", "Error creating section.");
621
+ }
622
+ }
623
+ });
624
+ }
625
+ }
626
+ },
627
+ {
628
+ text: 'Close',
629
+ handler: function (btn) {
630
+ btn.up('window').close();
631
+ }
632
+ }
633
+ ]
634
+ }).show();
635
+ }
636
+ else {
637
+ Ext.Msg.alert('Error', 'Your do not have permission to perform this action');
638
+ }
639
+
640
+ }
641
+ }
642
+ };
643
+
644
+ Compass.ErpApp.Desktop.Applications.Knitkit.SectionsMenu = function () {
645
+ return {
646
+ text: 'Sections / Pages',
647
+ iconCls: 'icon-ia',
648
+ disabled: true,
649
+ itemId: 'sectionsPagesMenuItem',
650
+ menu: {
651
+ xtype: 'menu',
652
+ items: [
653
+ Compass.ErpApp.Desktop.Applications.Knitkit.newSectionMenuItem
654
+ ]
655
+ }
656
+ }
657
+ };
658
+
659
+ // New Theme
660
+ Compass.ErpApp.Desktop.Applications.Knitkit.newThemeMenuItem = {
661
+ text: 'New Theme',
662
+ iconCls: 'icon-add',
663
+ handler: function (btn) {
664
+ var westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
665
+ themesTreePanel = westRegion.down('#themesTreePanel'),
666
+ knitkitWin = compassDesktop.getModule('knitkit-win'),
667
+ websiteId = knitkitWin.currentWebsite.id;
668
+
669
+ Ext.create("Ext.window.Window", {
670
+ layout: 'fit',
671
+ modal: true,
672
+ title: 'New Theme',
673
+ width: 360,
674
+ plain: true,
675
+ buttonAlign: 'center',
676
+ items: Ext.create('widget.form', {
677
+ labelWidth: 110,
678
+ frame: false,
679
+ bodyStyle: 'padding:5px 5px 0',
680
+ fileUpload: true,
681
+ url: '/knitkit/erp_app/desktop/theme/new',
682
+ defaults: {
683
+ width: 320
684
+ },
685
+ items: [
686
+ {
687
+ xtype: 'hidden',
688
+ name: 'website_id',
689
+ value: websiteId
690
+ },
691
+ {
692
+ xtype: 'textfield',
693
+ fieldLabel: 'Name *',
694
+ allowBlank: false,
695
+ name: 'name'
696
+ },
697
+ {
698
+ xtype: 'textfield',
699
+ fieldLabel: 'Theme ID *',
700
+ allowBlank: false,
701
+ name: 'theme_id'
702
+ },
703
+ {
704
+ xtype: 'textfield',
705
+ fieldLabel: 'Version',
706
+ allowBlank: true,
707
+ name: 'version'
708
+ },
709
+ {
710
+ xtype: 'textfield',
711
+ fieldLabel: 'Author',
712
+ allowBlank: true,
713
+ name: 'author'
714
+ },
715
+ {
716
+ xtype: 'textfield',
717
+ fieldLabel: 'HomePage',
718
+ allowBlank: true,
719
+ name: 'homepage'
720
+ },
721
+ {
722
+ xtype: 'textarea',
723
+ fieldLabel: 'Summary',
724
+ allowBlank: true,
725
+ name: 'summary'
726
+ }
727
+ ]
728
+ }),
729
+ buttons: [
730
+ {
731
+ text: 'Submit',
732
+ listeners: {
733
+ 'click': function (button) {
734
+ var window = button.findParentByType('window'),
735
+ formPanel = window.query('form')[0];
736
+
737
+ var loading = new Ext.LoadMask(window, {msg: 'Please wait...'});
738
+ loading.show();
739
+
740
+ formPanel.getForm().submit({
741
+ reset: true,
742
+ success: function (form, action) {
743
+ loading.hide();
744
+ window.close();
745
+
746
+ var obj = Ext.decode(action.response.responseText);
747
+ if (obj.success) {
748
+ themesTreePanel.getStore().load({
749
+ node: themesTreePanel.getRootNode()
750
+ });
751
+ }
752
+ },
753
+ failure: function (form, action) {
754
+ loading.hide();
755
+
756
+ Ext.Msg.alert("Error", "Error creating theme");
757
+ }
758
+ });
759
+ }
760
+ }
761
+ },
762
+ {
763
+ text: 'Close',
764
+ handler: function (btn) {
765
+ btn.up('window').close();
766
+ }
767
+ }
768
+ ]
769
+ }).show();
770
+ }
771
+ };
772
+
773
+ // Upload Theme
774
+ Compass.ErpApp.Desktop.Applications.Knitkit.uploadThemeMenuItem = {
775
+ text: 'Upload',
776
+ iconCls: 'icon-theme-upload',
777
+ handler: function (btn) {
778
+ var westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
779
+ themesTreePanel = westRegion.down('#themesTreePanel'),
780
+ knitkitWin = compassDesktop.getModule('knitkit-win'),
781
+ websiteId = knitkitWin.currentWebsite.id;
782
+
783
+ Ext.create("Ext.window.Window", {
784
+ modal: true,
785
+ title: 'New Theme',
786
+ buttonAlign: 'center',
787
+ items: Ext.create('widget.form', {
788
+ frame: false,
789
+ bodyStyle: 'padding:5px 5px 0',
790
+ fileUpload: true,
791
+ url: '/knitkit/erp_app/desktop/theme/new',
792
+ items: [
793
+ {
794
+ xtype: 'hidden',
795
+ name: 'website_id',
796
+ value: websiteId
797
+ },
798
+ {
799
+ xtype: 'fileuploadfield',
800
+ width: '350px',
801
+ fieldLabel: 'Upload Theme',
802
+ buttonText: 'Upload',
803
+ buttonOnly: false,
804
+ allowBlank: true,
805
+ name: 'theme_data'
806
+ }
807
+ ]
808
+ }),
809
+ buttons: [
810
+ {
811
+ text: 'Submit',
812
+ listeners: {
813
+ 'click': function (button) {
814
+ var window = this.up('window'),
815
+ form = window.query('form')[0].getForm();
816
+
817
+ if (form.isValid()) {
818
+ form.submit({
819
+ waitMsg: 'Creating theme...',
820
+ success: function (form, action) {
821
+ var obj = Ext.decode(action.response.responseText);
822
+ if (obj.success) {
823
+ themesTreePanel.getStore().load({
824
+ node: themesTreePanel.getRootNode()
825
+ });
826
+ }
827
+ window.close();
828
+ },
829
+ failure: function (form, action) {
830
+ Ext.Msg.alert("Error", "Error creating theme");
831
+ }
832
+ });
833
+ }
834
+ }
835
+ }
836
+ },
837
+ {
838
+ text: 'Close',
839
+ handler: function (btn) {
840
+ btn.up('window').close();
841
+ }
842
+ }
843
+ ]
844
+ }).show();
845
+ }
846
+ };
847
+
848
+ Compass.ErpApp.Desktop.Applications.Knitkit.ThemeMenu = function () {
849
+ return {
850
+ text: 'Themes',
851
+ iconCls: 'icon-theme',
852
+ disabled: true,
853
+ itemId: 'themeMenuItem',
854
+ menu: {
855
+ xtype: 'menu',
856
+ items: [
857
+ Compass.ErpApp.Desktop.Applications.Knitkit.newThemeMenuItem,
858
+ Compass.ErpApp.Desktop.Applications.Knitkit.uploadThemeMenuItem
859
+ ]
860
+ }
861
+ }
862
+ };
863
+
864
+ // New Navigation / Menu
865
+ Compass.ErpApp.Desktop.Applications.Knitkit.newNavigationMenuItem = {
866
+ text: 'New Menu',
867
+ iconCls: 'icon-add',
868
+ handler: function (btn) {
869
+ if (currentUser.hasCapability('create', 'WebsiteNav')) {
870
+ var westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
871
+ tree = westRegion.down('#knitkitMenuTreePanel');
872
+
873
+ Ext.create("Ext.window.Window", {
874
+ modal: true,
875
+ title: 'New Menu',
876
+ buttonAlign: 'center',
877
+ items: Ext.create("Ext.form.Panel", {
878
+ labelWidth: 50,
879
+ frame: false,
880
+ bodyStyle: 'padding:5px 5px 0',
881
+ url: '/knitkit/erp_app/desktop/website_nav',
882
+ defaults: {
883
+ width: 300
884
+ },
885
+ items: [
886
+ {
887
+ xtype: 'textfield',
888
+ fieldLabel: 'Menu name: ',
889
+ width: 320,
890
+ allowBlank: false,
891
+ name: 'name'
892
+ },
893
+ {
894
+ xtype: 'hidden',
895
+ name: 'website_id',
896
+ itemId: 'websiteId'
897
+ }
898
+ ]
899
+ }),
900
+ buttons: [
901
+ {
902
+ text: 'Submit',
903
+ listeners: {
904
+ 'click': function (button) {
905
+ var window = button.findParentByType('window'),
906
+ formPanel = window.query('form')[0],
907
+ knitkitWin = compassDesktop.getModule('knitkit-win'),
908
+ websiteId = knitkitWin.currentWebsite.id;
909
+
910
+ formPanel.down('#websiteId').setValue(websiteId);
911
+
912
+ formPanel.getForm().submit({
913
+ waitMsg: 'Please wait...',
914
+ success: function (form, action) {
915
+ var obj = Ext.decode(action.response.responseText);
916
+ if (obj.success) {
917
+ tree.getRootNode().appendChild(obj.node);
918
+ window.close();
919
+ }
920
+ else {
921
+ Ext.Msg.alert("Error", obj.msg);
922
+ }
923
+ },
924
+ failure: function (form, action) {
925
+ var obj = Ext.decode(action.response.responseText);
926
+ Ext.Msg.alert("Error", obj.msg);
927
+ }
928
+ });
929
+ }
930
+ }
931
+ },
932
+ {
933
+ text: 'Close',
934
+ handler: function (btn) {
935
+ btn.up('window').close();
936
+ }
937
+ }
938
+ ]
939
+ }).show();
940
+ }
941
+ else {
942
+ Ext.Msg.alert('Error', 'Your do not have permission to perform this action');
943
+ }
944
+ }
945
+ };
946
+
947
+ Compass.ErpApp.Desktop.Applications.Knitkit.NavigationMenu = function () {
948
+ return {
949
+ text: 'Navigation',
950
+ iconCls: 'icon-menu',
951
+ itemId: 'navigationMenuItem',
952
+ disabled: true,
953
+ menu: {
954
+ xtype: 'menu',
955
+ items: [
956
+ Compass.ErpApp.Desktop.Applications.Knitkit.newNavigationMenuItem
957
+ ]
958
+ }
959
+ }
960
+ };
961
+
962
+ // New Hosts
963
+ Compass.ErpApp.Desktop.Applications.Knitkit.newHostMenuItem = {
964
+ text: 'New Host',
965
+ iconCls: 'icon-add',
966
+ handler: function (btn) {
967
+ var westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
968
+ tree = westRegion.down('#knitkitHostListPanel'),
969
+ knitkitWin = compassDesktop.getModule('knitkit-win'),
970
+ websiteId = knitkitWin.currentWebsite.id;
971
+
972
+ Ext.create("Ext.window.Window", {
973
+ modal: true,
974
+ title: 'Add Host',
975
+ buttonAlign: 'center',
976
+ items: Ext.create("Ext.form.Panel", {
977
+ labelWidth: 50,
978
+ frame: false,
979
+ bodyStyle: 'padding:5px 5px 0',
980
+ url: '/knitkit/erp_app/desktop/website_host',
981
+ defaults: {
982
+ width: 300
983
+ },
984
+ items: [
985
+ {
986
+ xtype: 'textfield',
987
+ fieldLabel: 'Host',
988
+ name: 'host',
989
+ allowBlank: false
990
+ },
991
+ {
992
+ xtype: 'hidden',
993
+ name: 'website_id',
994
+ value: websiteId
995
+ }
996
+ ]
997
+ }),
998
+ buttons: [
999
+ {
1000
+ text: 'Submit',
1001
+ listeners: {
1002
+ 'click': function (button) {
1003
+ var window = button.findParentByType('window');
1004
+ var formPanel = window.query('form')[0];
1005
+
1006
+ formPanel.getForm().submit({
1007
+ waitMsg: 'Please wait...',
1008
+ success: function (form, action) {
1009
+ var obj = Ext.decode(action.response.responseText);
1010
+ if (obj.success) {
1011
+ window.close();
1012
+ tree.getRootNode().appendChild(obj.node);
1013
+ }
1014
+ else {
1015
+ Ext.Msg.alert("Error", obj.msg);
1016
+ }
1017
+ },
1018
+ failure: function (form, action) {
1019
+ Ext.Msg.alert("Error", "Error adding Host");
1020
+ }
1021
+ });
1022
+ }
1023
+ }
1024
+ },
1025
+ {
1026
+ text: 'Close',
1027
+ handler: function (btn) {
1028
+ btn.up('window').close();
1029
+ }
1030
+ }
1031
+ ]
1032
+ }).show();
1033
+ }
1034
+ };
1035
+
1036
+ Compass.ErpApp.Desktop.Applications.Knitkit.HostsMenu = function () {
1037
+ return {
1038
+ text: 'Hosts',
1039
+ iconCls: 'icon-gear',
1040
+ itemId: 'hostsMenuItem',
1041
+ disabled: true,
1042
+ menu: {
1043
+ xtype: 'menu',
1044
+ items: [
1045
+ Compass.ErpApp.Desktop.Applications.Knitkit.newHostMenuItem
1046
+ ]
1047
+ }
1048
+ }
1049
+ };
1050
+
1051
+
1052
+ Compass.ErpApp.Desktop.Applications.Knitkit.TemplateMenu = function () {
1053
+ return {
1054
+ text: 'Templates',
1055
+ iconCls: 'icon-website',
1056
+ itemId: 'templatesMenuItem',
1057
+ menu: {
1058
+ xtype: 'menu',
1059
+ items: [
1060
+ {
1061
+ text: 'Template Import',
1062
+ iconCls: 'icon-website-import',
1063
+ handler: function (btn) {
1064
+ var westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
1065
+ themesTreePanel = westRegion.down('#themesTreePanel'),
1066
+ knitkitWin = compassDesktop.getModule('knitkit-win')
1067
+
1068
+ Ext.create("Ext.window.Window", {
1069
+ modal: true,
1070
+ title: 'Import Template',
1071
+ buttonAlign: 'center',
1072
+ items: Ext.create('widget.form', {
1073
+ frame: false,
1074
+ bodyStyle: 'padding:5px 5px 0',
1075
+ fileUpload: true,
1076
+ url: '/knitkit/erp_app/desktop/site/importtemplate',
1077
+ items: [
1078
+
1079
+ {
1080
+ xtype: 'fileuploadfield',
1081
+ width: '350px',
1082
+ fieldLabel: 'Upload Template',
1083
+ buttonText: 'Upload',
1084
+ buttonOnly: false,
1085
+ allowBlank: true,
1086
+ name: 'website_data'
1087
+ }
1088
+ ]
1089
+ }),
1090
+ buttons: [
1091
+ {
1092
+ text: 'Submit',
1093
+ listeners: {
1094
+ 'click': function (button) {
1095
+ var knitkitModule = compassDesktop.getModule('knitkit-win'),
1096
+ knitkitWindow = compassDesktop.desktop.getWindow('knitkit'),
1097
+ window = button.findParentByType('window'),
1098
+ formPanel = window.query('.form')[0];
1099
+
1100
+ formPanel.getForm().submit({
1101
+
1102
+ waitMsg: 'Please wait...',
1103
+ success: function (form, action) {
1104
+
1105
+ var obj = Ext.decode(action.response.responseText);
1106
+ if (obj.success) {
1107
+ var combo = knitkitWindow.down('websitescombo');
1108
+ combo.store.load({
1109
+ callback: function (records, operation, succes) {
1110
+ for (i = 0; i < records.length; i++) {
1111
+ if (records[i].data.id == obj.website.id) {
1112
+ combo.select(records[i]);
1113
+
1114
+ knitkitModule.selectWebsite(records[i]);
1115
+ window.close();
1116
+
1117
+ break;
1118
+ }
1119
+ }
1120
+ }
1121
+ });
1122
+ }
1123
+ else {
1124
+ Ext.Msg.alert("Error", obj.message);
1125
+ }
1126
+ },
1127
+ failure: function (form, action) {
1128
+ var obj = Ext.decode(action.response.responseText);
1129
+ if (obj != null) {
1130
+ Ext.Msg.alert("Error", obj.message);
1131
+ }
1132
+ else {
1133
+ Ext.Msg.alert("Error", "Error importing template");
1134
+ }
1135
+ }
1136
+ });
1137
+ }
1138
+ }
1139
+ },
1140
+ {
1141
+ text: 'Close',
1142
+ handler: function (btn) {
1143
+ btn.up('window').close();
1144
+ }
1145
+ }
1146
+ ]
1147
+ }).show();
1148
+ }
1149
+ },
1150
+ {
1151
+ itemId: 'exportTemplateMenuItem',
1152
+ text: 'Export Current Site and Active Theme as Template',
1153
+ disabled: true,
1154
+ iconCls: 'icon-website-export',
1155
+ handler: function () {
1156
+ var knitkitWin = compassDesktop.getModule('knitkit-win'),
1157
+ websiteId = knitkitWin.currentWebsite.id;
1158
+ ifrm = document.createElement("IFRAME");
1159
+ ifrm.setAttribute("src", '/knitkit/erp_app/desktop/site/exporttemplate?website_id=' + websiteId);
1160
+ ifrm.style.width = 0+"px";
1161
+ ifrm.style.height = 0+"px";
1162
+ document.body.appendChild(ifrm);
1163
+ }
1164
+ }
1165
+ ]
1166
+ }
1167
+ }
1168
+ };