knitkit 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/{public → app/assets}/images/check.png +0 -0
  3. data/{public → app/assets}/images/credit_card.png +0 -0
  4. data/{public → app/assets}/images/inline_edit/close.png +0 -0
  5. data/{public → app/assets}/images/knitkit/icons/document.png +0 -0
  6. data/{public → app/assets}/images/knitkit/icons/multi_doc.png +0 -0
  7. data/{public → app/assets}/images/knitkit/logo.png +0 -0
  8. data/{public → app/assets}/images/knitkit/splash/images/add-site.png +0 -0
  9. data/app/assets/images/knitkit/splash/images/add_website_105x105-active.png +0 -0
  10. data/app/assets/images/knitkit/splash/images/add_website_105x105.png +0 -0
  11. data/{public → app/assets}/images/knitkit/splash/images/adjust-site.png +0 -0
  12. data/{public → app/assets}/images/knitkit/splash/images/browse-site.png +0 -0
  13. data/app/assets/images/knitkit/splash/images/browse_db_105x105-active.png +0 -0
  14. data/app/assets/images/knitkit/splash/images/browse_db_105x105.png +0 -0
  15. data/app/assets/images/knitkit/splash/images/console_105x105-active.png +0 -0
  16. data/app/assets/images/knitkit/splash/images/console_105x105.png +0 -0
  17. data/{public → app/assets}/images/knitkit/splash/images/find-themes.png +0 -0
  18. data/app/assets/images/knitkit/splash/images/find_themes_105x105-active.png +0 -0
  19. data/app/assets/images/knitkit/splash/images/find_themes_105x105.png +0 -0
  20. data/app/assets/images/knitkit/splash/images/learn_more_105x105-active.png +0 -0
  21. data/app/assets/images/knitkit/splash/images/learn_more_105x105.png +0 -0
  22. data/{public → app/assets}/images/knitkit/splash/images/settings.png +0 -0
  23. data/{public → app/assets}/images/knitkit/splash/images/tutorials.png +0 -0
  24. data/app/assets/images/knitkit/splash/splash.png +0 -0
  25. data/app/assets/images/widgets/manage_profile/contact_information.png +0 -0
  26. data/app/assets/images/widgets/manage_profile/password.png +0 -0
  27. data/app/assets/images/widgets/manage_profile/user_information.png +0 -0
  28. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/app.js +24 -0
  29. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +15 -12
  30. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/center_region.js +69 -48
  31. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +214 -0
  32. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/east_region.js +0 -0
  33. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +17 -19
  34. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +13 -3
  35. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +59 -48
  36. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/widgets_panel.js +0 -0
  37. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +2 -2
  38. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/module.js +2 -2
  39. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +0 -0
  40. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +1 -1
  41. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +268 -0
  42. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +85 -33
  43. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +0 -0
  44. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +5 -28
  45. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +22 -8
  46. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +143 -25
  47. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +5 -1
  48. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +2 -0
  49. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +181 -65
  50. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +0 -0
  51. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +0 -0
  52. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +0 -0
  53. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +121 -116
  54. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +101 -10
  55. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +9 -5
  56. data/app/assets/javascripts/knitkit-web.js +22 -0
  57. data/app/assets/javascripts/knitkit/additional-methods.min.js +4 -0
  58. data/app/assets/javascripts/knitkit/bootstrap.min.js +7 -0
  59. data/app/assets/javascripts/knitkit/captcha.js +154 -0
  60. data/{public → app/assets}/javascripts/knitkit/confirm-bootstrap.js +1 -1
  61. data/{public → app/assets}/javascripts/knitkit/inline_editing.js +1 -1
  62. data/{public → app/assets}/javascripts/knitkit/jquery.maskedinput.min.js +0 -0
  63. data/app/assets/javascripts/knitkit/jquery.validate.min.js +4 -0
  64. data/app/assets/javascripts/knitkit/js.cookie.js +145 -0
  65. data/{public → app/assets}/javascripts/knitkit/theme.js +0 -0
  66. data/app/assets/stylesheets/erp_app/desktop/applications/knitkit/app.css +12 -0
  67. data/{public → app/assets}/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +23 -33
  68. data/app/assets/stylesheets/erp_app/shared/knitkit_shared.css +21 -0
  69. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.eot +0 -0
  70. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.svg +288 -0
  71. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.ttf +0 -0
  72. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff +0 -0
  73. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  74. data/app/assets/stylesheets/knitkit-web.css +16 -0
  75. data/app/assets/stylesheets/knitkit/bootstrap.min.css +5 -0
  76. data/app/assets/stylesheets/knitkit/captcha.css +59 -0
  77. data/app/assets/stylesheets/knitkit/custom.css +144 -0
  78. data/{public → app/assets}/stylesheets/knitkit/inline_editing.css +0 -0
  79. data/app/assets/stylesheets/knitkit/submenu.css +93 -0
  80. data/app/controllers/api/v1/websites_controller.rb +14 -0
  81. data/app/controllers/captcha_controller.rb +53 -0
  82. data/app/controllers/knitkit/base_controller.rb +1 -5
  83. data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +2 -9
  84. data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +20 -7
  85. data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +38 -28
  86. data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +16 -9
  87. data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +69 -15
  88. data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +45 -58
  89. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +64 -29
  90. data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +36 -13
  91. data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +12 -0
  92. data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +4 -11
  93. data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +2 -9
  94. data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +56 -20
  95. data/app/controllers/knitkit/online_document_sections_controller.rb +9 -3
  96. data/app/mailers/website_inquiry_mailer.rb +11 -3
  97. data/app/models/content.rb +16 -6
  98. data/app/models/documented_item.rb +12 -1
  99. data/app/models/online_document_section.rb +54 -20
  100. data/app/models/published_website.rb +16 -0
  101. data/app/models/theme.rb +53 -47
  102. data/app/models/website.rb +172 -191
  103. data/app/models/website_section.rb +64 -30
  104. data/app/views/knitkit/blogs/show.html.erb +5 -2
  105. data/app/views/layouts/knitkit/base.html.erb +54 -51
  106. data/app/views/menus/knitkit/_default_menu.html.erb +11 -11
  107. data/app/views/menus/knitkit/_default_section_menu.html.erb +2 -2
  108. data/app/views/menus/knitkit/_default_sub_menu.erb +27 -0
  109. data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +30 -0
  110. data/app/views/website_inquiry_mailer/inquiry.html.erb +266 -0
  111. data/app/widgets/contact_us/base.rb +26 -16
  112. data/app/widgets/contact_us/javascript/contact_us.js +1 -1
  113. data/app/widgets/contact_us/views/error.html.erb +7 -3
  114. data/app/widgets/contact_us/views/index.html.erb +36 -28
  115. data/app/widgets/google_map/javascript/google_map.js +1 -1
  116. data/app/widgets/google_map/views/index.html.erb +1 -1
  117. data/app/widgets/login/javascript/login.js +1 -1
  118. data/app/widgets/login/views/index.html.erb +1 -1
  119. data/app/widgets/manage_profile/base.rb +141 -112
  120. data/app/widgets/manage_profile/javascript/manage_profile.js +2 -2
  121. data/app/widgets/manage_profile/views/_password_form.html.erb +1 -1
  122. data/app/widgets/manage_profile/views/_user_information_form.html.erb +1 -30
  123. data/app/widgets/manage_profile/views/index.html.erb +42 -40
  124. data/app/widgets/reset_password/base.rb +39 -8
  125. data/app/widgets/reset_password/javascript/reset_password.js +1 -1
  126. data/app/widgets/reset_password/views/index.html.erb +3 -3
  127. data/app/widgets/reset_password/views/invalid_reset_token.html.erb +7 -0
  128. data/app/widgets/reset_password/views/layouts/base.html.erb +1 -1
  129. data/app/widgets/reset_password/views/reset_password.html.erb +39 -0
  130. data/app/widgets/reset_password/views/reset_success.html.erb +5 -0
  131. data/app/widgets/search/base.rb +5 -5
  132. data/app/widgets/search/javascript/search.js +6 -6
  133. data/app/widgets/search/views/_inline_search_form.html.erb +23 -12
  134. data/app/widgets/search/views/_search_form.html.erb +34 -30
  135. data/app/widgets/search/views/layouts/base.html.erb +6 -1
  136. data/app/widgets/signup/base.rb +73 -30
  137. data/app/widgets/signup/javascript/signup.js +1 -1
  138. data/app/widgets/signup/views/_signup_form.html.erb +2 -1
  139. data/app/widgets/signup/views/layouts/base.html.erb +1 -1
  140. data/app/widgets/signup/views/success.html.erb +2 -3
  141. data/config/routes.rb +25 -4
  142. data/db/data_migrations/20110509223702_add_publisher_role.rb +0 -2
  143. data/db/data_migrations/20110816153456_add_knitkit_application.rb +7 -15
  144. data/db/data_migrations/20120127150505_create_website_default_configuration.rb +63 -3
  145. data/db/data_migrations/20150118180450_add_website_member_roles.rb +12 -0
  146. data/db/data_migrations/20150414150359_nest_knitkit_security_roles.rb +35 -0
  147. data/db/data_migrations/20150414173437_move_website_roles_under_website_builder.rb +19 -0
  148. data/db/migrate/20110211002317_setup_knitkit.rb +86 -39
  149. data/lib/knitkit.rb +8 -2
  150. data/lib/knitkit/config.rb +2 -3
  151. data/lib/knitkit/engine.rb +35 -4
  152. data/lib/knitkit/extensions.rb +2 -1
  153. data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +1 -1
  154. data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +1 -1
  155. data/lib/knitkit/extensions/compass_ae/mailers/user_mailer.rb +31 -0
  156. data/lib/knitkit/extensions/compass_ae/widgets/base.rb +1 -1
  157. data/lib/knitkit/extensions/railties/action_controller/captcha_helper.rb +43 -0
  158. data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +1 -1
  159. data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +11 -1
  160. data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +83 -0
  161. data/lib/knitkit/routing_filter/section_router.rb +24 -14
  162. data/lib/knitkit/version.rb +1 -1
  163. data/lib/tasks/knitkit_tasks.rake +89 -4
  164. data/lib/tasks/theme_parser.rake +85 -0
  165. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  166. data/public/fonts/glyphicons-halflings-regular.svg +288 -0
  167. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  168. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  169. data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
  170. data/public/paypal-button.min.js +7 -0
  171. metadata +161 -82
  172. data/app/assets/javascripts/knitkit/application.js +0 -9
  173. data/app/assets/stylesheets/knitkit/application.css +0 -7
  174. data/app/mailers/document_mailer.rb +0 -10
  175. data/app/views/document_mailer/email_document.html.erb +0 -12
  176. data/app/views/knitkit/mobile/index.html.erb +0 -162
  177. data/app/views/knitkit/online_document_sections/index.html.erb +0 -279
  178. data/app/views/layouts/knitkit/online_document_sections.html.erb +0 -80
  179. data/app/views/website_inquiry_mailer/inquiry.erb +0 -24
  180. data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +0 -33
  181. data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +0 -16
  182. data/db/data_migrations/20120809020508_update_website_and_configuration.rb +0 -82
  183. data/db/data_migrations/20121129185611_upgrade_website_role_iid.rb +0 -20
  184. data/db/migrate/20130405184234_add_use_markdown_to_section.rb +0 -19
  185. data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +0 -33
  186. data/db/migrate/20140622212723_update_website_inquiries.rb +0 -22
  187. data/db/migrate/20140911185022_add_publishing_to_website.rb +0 -5
  188. data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +0 -12
  189. data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +0 -13
  190. data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +0 -49
  191. data/public/images/knitkit/close_window.png +0 -0
  192. data/public/images/knitkit/splash/splash.png +0 -0
  193. data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +0 -215
  194. data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +0 -108
  195. data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +0 -170
  196. data/public/javascripts/knitkit/bootstrap-datepicker.js +0 -474
  197. data/public/javascripts/knitkit/bootstrap.min.js +0 -7
  198. data/public/javascripts/knitkit/mobile/app/view/Main.js +0 -108
  199. data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +0 -734
  200. data/public/stylesheets/knitkit/bootstrap-responsive.min.css +0 -10
  201. data/public/stylesheets/knitkit/bootstrap.min.css +0 -7
  202. data/public/stylesheets/knitkit/custom.css +0 -122
  203. data/public/stylesheets/knitkit/datepicker.css +0 -182
@@ -57,7 +57,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel", {
57
57
  flex: 0.5,
58
58
  items: [
59
59
  {
60
- icon: '/images/icons/eye/eye_16x16.png',
60
+ icon: '/assets/icons/eye/eye_16x16.png',
61
61
  tooltip: 'View',
62
62
  getClass: function (v, meta, rec) {
63
63
  return 'x-action-col-icon';
@@ -68,7 +68,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel", {
68
68
  }
69
69
  },
70
70
  {
71
- icon: '/images/icons/document_down/document_down_16x16.png',
71
+ icon: '/assets/icons/document_down/document_down_16x16.png',
72
72
  tooltip: 'Revert',
73
73
  getClass: function (v, meta, rec) {
74
74
  return 'x-action-col-icon';
@@ -374,30 +374,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsBlogGridPanel",
374
374
  name: 'publisher'
375
375
  }
376
376
  ]
377
- }),
378
- columns: [
379
- {
380
- menuDisabled: true,
381
- resizable: false,
382
- xtype: 'actioncolumn',
383
- header: 'Action',
384
- align: 'center',
385
- width: 50,
386
- items: [
387
- {
388
- icon: '/images/icons/document_view/document_view_16x16.png',
389
- tooltip: 'View',
390
- getClass: function (v, meta, rec) {
391
- return 'x-action-col-icon';
392
- },
393
- handler: function (grid, rowIndex, colIndex) {
394
- var rec = grid.getStore().getAt(rowIndex);
395
- grid.initialConfig['centerRegion'].viewContent(rec.get('title') + " Excerpt - Revision " + rec.get('version'), rec.get('body_html'));
396
- }
397
- }
398
- ]
399
- }
400
- ]
377
+ })
401
378
  }, config);
402
379
 
403
380
  this.callParent([config]);
@@ -648,7 +625,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGrid
648
625
  flex: 0.5,
649
626
  items: [
650
627
  {
651
- icon: '/images/icons/document_view/document_view_16x16.png',
628
+ icon: '/assets/icons/eye/eye_16x16.png',
652
629
  tooltip: 'View',
653
630
  getClass: function (v, meta, rec) {
654
631
  return 'x-action-col-icon';
@@ -659,7 +636,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGrid
659
636
  }
660
637
  },
661
638
  {
662
- icon: '/images/icons/document_down/document_down_16x16.png',
639
+ icon: '/assets/icons/document_down/document_down_16x16.png',
663
640
  tooltip: 'Revert',
664
641
  getClass: function (v, meta, rec) {
665
642
  return 'x-action-col-icon';
@@ -4,7 +4,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addArticleOptions = function (self,
4
4
  iconCls: 'icon-edit',
5
5
  listeners: {
6
6
  'click': function () {
7
- var itemId = 'editArticle-' + record.get('id'),
7
+ var itemId = 'editArticle-' + record.get('recordId'),
8
8
  editArticleWindow = Ext.ComponentQuery.query('#' + itemId).first();
9
9
 
10
10
  if (Compass.ErpApp.Utility.isBlank(editArticleWindow)) {
@@ -88,7 +88,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addArticleOptions = function (self,
88
88
  allowBlank: false,
89
89
  name: 'id',
90
90
  itemId: 'record_id',
91
- value: record.data.id
91
+ value: record.get('recordId')
92
92
  },
93
93
  {
94
94
  xtype: 'hidden',
@@ -114,8 +114,10 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addArticleOptions = function (self,
114
114
  record.set('text', values.title);
115
115
  record.set('display_title', !Ext.isEmpty(values.display_title));
116
116
  record.set('content_area', values.content_area);
117
- if (formPanel.getForm().findField('tag_list')) {
118
- var tag_list = formPanel.getForm().findField('tag_list').getValue();
117
+ record.set('internal_identifier', values.internal_identifier);
118
+
119
+ if (formPanel.getForm().findField('tags')) {
120
+ var tag_list = formPanel.getForm().findField('tags').getValue();
119
121
  record.set('tag_list', tag_list);
120
122
  }
121
123
  window.close();
@@ -154,23 +156,35 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addArticleOptions = function (self,
154
156
  var centerRegion = Ext.getCmp('knitkitCenterRegion'),
155
157
  websiteId = compassDesktop.getModule('knitkit-win').currentWebsite.id;
156
158
 
157
- var url = '/knitkit/erp_app/desktop/articles/show/' + record.data.id
159
+ var url = '/knitkit/erp_app/desktop/articles/show/' + record.get('recordId');
158
160
 
159
161
  Ext.Ajax.request({
160
162
  url: url,
161
163
  method: 'GET',
162
164
  extraParams: {
163
- id: record.data.id
165
+ id: record.get('recordId')
164
166
  },
165
167
  timeout: 90000,
166
168
  success: function (response) {
167
169
  var article = Ext.decode(response.responseText);
168
- centerRegion.editExcerpt(article.title + ' - Excerpt', record.data.id, article.excerpt_html, websiteId);
170
+ centerRegion.editExcerpt(article.title + ' - Excerpt', record.get('recordId'), article.excerpt_html, websiteId);
169
171
  }
170
172
  });
171
173
  }
172
174
  }
173
175
  });
176
+
177
+ items.push({
178
+ text: 'View Comments',
179
+ iconCls: 'icon-eye',
180
+ listeners: {
181
+ 'click': function () {
182
+ var centerRegion = Ext.getCmp('knitkitCenterRegion');
183
+
184
+ centerRegion.viewContentComments(record.get('recordId'), record.get('title') + ' - Comments');
185
+ }
186
+ }
187
+ });
174
188
  }
175
189
 
176
190
  items.push({
@@ -190,7 +204,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addArticleOptions = function (self,
190
204
  method: 'POST',
191
205
  params: {
192
206
  id: record.data.parentItemId,
193
- article_id: record.data.id
207
+ article_id: record.get('recordId')
194
208
  },
195
209
  success: function (response) {
196
210
  var obj = Ext.decode(response.responseText);
@@ -1,6 +1,8 @@
1
1
  Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self, items, record) {
2
- var sectionId = record.data.id.split('_')[1];
2
+ var sectionId = record.get('recordId');
3
+ var websiteId = compassDesktop.getModule('knitkit-win').currentWebsite.id;
3
4
 
5
+ // Update security
4
6
  if (currentUser.hasCapability('unsecure', 'WebsiteSection') || currentUser.hasCapability('secure', 'WebsiteSection')) {
5
7
  items.push({
6
8
  text: 'Security',
@@ -8,12 +10,13 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
8
10
  listeners: {
9
11
  'click': function () {
10
12
  var westRegion = Ext.getCmp('knitkitWestRegion');
11
- westRegion.changeSecurity(record, '/knitkit/erp_app/desktop/section/update_security', record.data.id.split('_')[1]);
13
+ westRegion.changeSecurity(record, '/knitkit/erp_app/desktop/section/update_security', record.get('recordId'));
12
14
  }
13
15
  }
14
16
  });
15
17
  }
16
18
 
19
+ // Create Document Section
17
20
  if (currentUser.hasCapability('create', 'WebsiteSection')) {
18
21
  items.push({
19
22
  text: 'Add Document',
@@ -26,11 +29,12 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
26
29
  title: 'New Document Section',
27
30
  plain: true,
28
31
  buttonAlign: 'center',
29
- items: new Ext.FormPanel({
32
+ items: {
33
+ xtype: 'form',
30
34
  labelWidth: 110,
31
35
  frame: false,
32
36
  bodyStyle: 'padding:5px 5px 0',
33
- url: '/knitkit/erp_app/desktop/online_document_sections/new',
37
+ url: '/knitkit/erp_app/desktop/online_document_sections',
34
38
  defaults: {
35
39
  width: 225
36
40
  },
@@ -59,18 +63,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
59
63
  allowBlank: false,
60
64
  triggerAction: 'all'
61
65
  },
62
- {
63
- xtype: 'combo',
64
- forceSelection: true,
65
- store: [
66
- ['Content', 'Content']
67
- ],
68
- value: 'Content',
69
- fieldLabel: 'Document Type',
70
- name: 'documenttype',
71
- allowBlank: false,
72
- triggerAction: 'all'
73
- },
74
66
  {
75
67
  xtype: 'radiogroup',
76
68
  fieldLabel: 'Display in menu?',
@@ -94,7 +86,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
94
86
  {
95
87
  xtype: 'hidden',
96
88
  name: 'website_section_id',
97
- value: record.data.id.split('_')[1]
89
+ value: record.get('recordId')
98
90
  },
99
91
  {
100
92
  xtype: 'hidden',
@@ -102,15 +94,16 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
102
94
  value: record.data.siteId
103
95
  }
104
96
  ]
105
- }),
97
+ },
106
98
  buttons: [
107
99
  {
108
100
  text: 'Submit',
109
101
  listeners: {
110
102
  'click': function (button) {
111
103
  var window = button.findParentByType('window');
112
- var formPanel = window.query('.form')[0];
104
+ var formPanel = window.down('form');
113
105
  formPanel.getForm().submit({
106
+ method: 'post',
114
107
  reset: true,
115
108
  waitMsg: 'Creating document section...',
116
109
  success: function (form, action) {
@@ -118,7 +111,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
118
111
  if (obj.success) {
119
112
  record.appendChild(obj.node);
120
113
 
121
- var centerRegion = Ext.getComp('knitkitCenterRegion');
114
+ var centerRegion = Ext.getCmp('knitkitCenterRegion');
122
115
  centerRegion.editContent(obj.documented_content.title, obj.documented_content.id, obj.documented_content.body_html, record.data.siteId, 'article');
123
116
  window.close();
124
117
  }
@@ -153,6 +146,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
153
146
  });
154
147
  }
155
148
 
149
+ // Edit Document Section
156
150
  if (currentUser.hasCapability('edit', 'WebsiteSection')) {
157
151
  var contentInfo = record.data['contentInfo'];
158
152
 
@@ -234,7 +228,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
234
228
  {
235
229
  xtype: 'hidden',
236
230
  name: 'id',
237
- value: record.data.id.split('_')[1]
231
+ value: record.get('recordId')
238
232
  }
239
233
  ]
240
234
  }),
@@ -279,13 +273,140 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
279
273
  });
280
274
  }
281
275
 
276
+ // Copy Document Section
277
+ items.push({
278
+ text: 'Copy Document',
279
+ iconCls: 'icon-copy',
280
+ listeners: {
281
+ 'click': function () {
282
+ Ext.widget("window", {
283
+ layout: 'fit',
284
+ modal: true,
285
+ title: 'Copy Document',
286
+ plain: true,
287
+ buttonAlign: 'center',
288
+ items: {
289
+ xtype: 'form',
290
+ labelWidth: 110,
291
+ frame: false,
292
+ bodyStyle: 'padding:5px 5px 0',
293
+ url: '/knitkit/erp_app/desktop/online_document_sections/copy',
294
+ defaults: {
295
+ width: 375
296
+ },
297
+ items: [
298
+ {
299
+ xtype: 'combo',
300
+ name: 'parent_section_id',
301
+ width: 320,
302
+ loadingText: 'Retrieving Sections...',
303
+ store: Ext.create("Ext.data.Store", {
304
+ proxy: {
305
+ type: 'ajax',
306
+ url: '/knitkit/erp_app/desktop/online_document_sections/existing_documents',
307
+ reader: {
308
+ type: 'json'
309
+ },
310
+ extraParams: {
311
+ website_id: websiteId
312
+ }
313
+ },
314
+ autoLoad: true,
315
+ fields: [
316
+ {
317
+ name: 'id'
318
+ },
319
+ {
320
+ name: 'title_permalink'
321
+
322
+ }
323
+ ]
324
+ }),
325
+ forceSelection: true,
326
+ allowBlank: true,
327
+ fieldLabel: 'Parent Document',
328
+ mode: 'local',
329
+ displayField: 'title_permalink',
330
+ valueField: 'id',
331
+ triggerAction: 'all'
332
+ },
333
+ {
334
+ xtype: 'textfield',
335
+ fieldLabel: 'Title',
336
+ width: 320,
337
+ value: record.data.text,
338
+ name: 'title'
339
+ },
340
+ {
341
+ xtype: 'hidden',
342
+ name: 'id',
343
+ value: sectionId
344
+ },
345
+ {
346
+ xtype: 'hidden',
347
+ name: 'website_id',
348
+ value: websiteId
349
+ }
350
+ ]
351
+ },
352
+ buttons: [
353
+ {
354
+ text: 'Submit',
355
+ listeners: {
356
+ 'click': function (button) {
357
+ var window = button.findParentByType('window');
358
+ var formPanel = window.query('.form')[0];
359
+
360
+ formPanel.getForm().submit({
361
+ waitMsg: 'Copying document section...',
362
+ success: function (form, action) {
363
+ var obj = Ext.decode(action.response.responseText);
364
+ var values = formPanel.getValues();
365
+ var parentNode = record.getOwnerTree().getRootNode();
366
+
367
+ if (!Ext.isEmpty(values.parent_section_id)) {
368
+ parentNode = parentNode.findChildBy(function (node) {
369
+ if (node.get('recordType') == 'WebsiteSection'
370
+ && node.get('recordId') == values.parent_section_id) {
371
+ return true;
372
+ }
373
+ }, this, true);
374
+ }
375
+
376
+ if (parentNode && parentNode != record.getOwnerTree().getRootNode()){
377
+ record.getOwnerTree().getStore().load({node: parentNode});
378
+ }
379
+
380
+ window.close();
381
+ },
382
+ failure: function (form, action) {
383
+ var obj = Ext.decode(action.response.responseText);
384
+ Ext.Msg.alert("Error", obj.message);
385
+ }
386
+ });
387
+ }
388
+ }
389
+ },
390
+ {
391
+ text: 'Close',
392
+ handler: function (btn) {
393
+ btn.up('window').close();
394
+ }
395
+ }
396
+ ]
397
+ }).show();
398
+ }
399
+ }
400
+ });
401
+
402
+ // Delete Document Section
282
403
  if (currentUser.hasCapability('delete', 'WebsiteSection')) {
283
404
  items.push({
284
405
  text: 'Delete Document Section',
285
406
  iconCls: 'icon-delete',
286
407
  listeners: {
287
408
  'click': function () {
288
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this document section?', function (btn) {
409
+ Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the document section?<h3>'+record.data["text"]+'</h3>', function (btn) {
289
410
  if (btn == 'no') {
290
411
  return false;
291
412
  }
@@ -297,7 +418,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
297
418
  id: sectionId
298
419
  },
299
420
  success: function (response) {
300
-
301
421
  var obj = Ext.decode(response.responseText);
302
422
  if (obj.success) {
303
423
  record.remove();
@@ -312,8 +432,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addDocumentOptions = function (self,
312
432
  });
313
433
  }
314
434
  });
315
-
316
- record.remove();
317
435
  }
318
436
  }
319
437
  });
@@ -9,6 +9,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addHostOptions = function (self, ite
9
9
  title: 'Update Host',
10
10
  modal: true,
11
11
  buttonAlign: 'center',
12
+ defaultFocus: 'host',
12
13
  items: Ext.create("Ext.form.Panel", {
13
14
  labelWidth: 50,
14
15
  frame: false,
@@ -23,6 +24,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addHostOptions = function (self, ite
23
24
  fieldLabel: 'Host',
24
25
  id: 'knitkitUpdateWebsiteHostHost',
25
26
  name: 'host',
27
+ itemId: 'host',
26
28
  value: record.data.host,
27
29
  allowBlank: false
28
30
  }
@@ -52,7 +54,9 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addHostOptions = function (self, ite
52
54
  }
53
55
  },
54
56
  failure: function (form, action) {
55
- Ext.Msg.alert("Error", "Error updating Host");
57
+ var obj = Ext.decode(action.response.responseText);
58
+ var message = obj.message.indexOf('Host') == 0 ? obj.message : "Error Updating Host"
59
+ Ext.Msg.alert("Error", message);
56
60
  }
57
61
  });
58
62
  }
@@ -12,6 +12,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addMenuOptions = function (self, ite
12
12
  title: 'New Menu Item',
13
13
  modal: true,
14
14
  buttonAlign: 'center',
15
+ defaultFocus: 'title',
15
16
  items: Ext.create('Ext.form.Panel', {
16
17
  labelWidth: 50,
17
18
  frame: false,
@@ -25,6 +26,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addMenuOptions = function (self, ite
25
26
  xtype: 'textfield',
26
27
  fieldLabel: 'Title',
27
28
  width: 320,
29
+ itemId: 'title',
28
30
  allowBlank: false,
29
31
  name: 'title'
30
32
  },