knitkit 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. data/README.md +22 -0
  2. data/app/controllers/knitkit/base_controller.rb +15 -2
  3. data/app/controllers/knitkit/blogs_controller.rb +4 -4
  4. data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +16 -2
  5. data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +198 -57
  6. data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +25 -11
  7. data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +123 -44
  8. data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +83 -9
  9. data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +38 -0
  10. data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +15 -6
  11. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +185 -98
  12. data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +38 -16
  13. data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +126 -68
  14. data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +154 -107
  15. data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +113 -54
  16. data/app/controllers/knitkit/online_document_sections_controller.rb +45 -0
  17. data/app/controllers/knitkit/unauthorized_controller.rb +5 -0
  18. data/app/controllers/knitkit/website_sections_controller.rb +8 -9
  19. data/app/mailers/document_mailer.rb +10 -0
  20. data/app/models/article.rb +1 -1
  21. data/app/models/content.rb +35 -3
  22. data/app/models/document.rb +8 -0
  23. data/app/models/document_type.rb +3 -0
  24. data/app/models/documented_content.rb +29 -0
  25. data/app/models/documented_item.rb +31 -0
  26. data/app/models/extensions/configuration.rb +5 -0
  27. data/app/models/extensions/party.rb +13 -0
  28. data/app/models/online_document_section.rb +40 -0
  29. data/app/models/theme.rb +22 -26
  30. data/app/models/valid_document.rb +4 -0
  31. data/app/models/website.rb +158 -119
  32. data/app/models/website_inquiry.rb +7 -2
  33. data/app/models/website_inquiry_mailer.rb +4 -3
  34. data/app/models/website_party_role.rb +5 -0
  35. data/app/models/website_section.rb +76 -38
  36. data/app/views/document_mailer/email_document.html.erb +12 -0
  37. data/app/views/knitkit/blogs/_add_comment.html.erb +2 -2
  38. data/app/views/knitkit/online_document_sections/index.html.erb +149 -0
  39. data/app/views/knitkit/website_sections/index.html.erb +0 -1
  40. data/app/views/layouts/knitkit/base.html.erb +4 -2
  41. data/app/views/layouts/knitkit/online_document_sections.html.erb +59 -0
  42. data/app/views/menus/knitkit/_default_menu.html.erb +1 -1
  43. data/app/views/menus/knitkit/_default_section_menu.html.erb +1 -1
  44. data/app/views/menus/knitkit/_default_sub_menu.html.erb +2 -2
  45. data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +1 -1
  46. data/app/widgets/contact_us/base.rb +5 -5
  47. data/app/widgets/contact_us/javascript/contact_us.js +2 -1
  48. data/app/widgets/google_map/base.rb +0 -4
  49. data/app/widgets/google_map/javascript/google_map.js +4 -3
  50. data/app/widgets/login/base.rb +0 -5
  51. data/app/widgets/login/javascript/login.js +155 -153
  52. data/app/widgets/login/views/index.html.erb +3 -3
  53. data/app/widgets/login/views/reset_password.html.erb +2 -2
  54. data/app/widgets/manage_profile/base.rb +46 -67
  55. data/app/widgets/manage_profile/javascript/manage_profile.js +2 -1
  56. data/app/widgets/manage_profile/views/_user_information_form.html.erb +5 -1
  57. data/app/widgets/reset_password/base.rb +4 -6
  58. data/app/widgets/reset_password/javascript/reset_password.js +2 -1
  59. data/app/widgets/reset_password/views/index.html.erb +4 -3
  60. data/app/widgets/search/base.rb +1 -5
  61. data/app/widgets/search/javascript/search.js +2 -1
  62. data/app/widgets/search/views/show.html.erb +2 -2
  63. data/app/widgets/signup/base.rb +7 -6
  64. data/app/widgets/signup/javascript/signup.js +2 -1
  65. data/app/widgets/signup/views/error.html.erb +1 -1
  66. data/config/routes.rb +6 -2
  67. data/db/data_migrations/20110509223702_add_publisher_role.rb +10 -0
  68. data/db/data_migrations/20111118182910_setup_knitkit_capabilities.rb +84 -0
  69. data/db/data_migrations/20120127144444_create_website_role_types.rb +13 -0
  70. data/db/data_migrations/20120127150505_create_website_default_configuration.rb +72 -0
  71. data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +33 -0
  72. data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +16 -0
  73. data/db/data_migrations/upgrade/20120210195616_add_website_configs.rb +19 -0
  74. data/db/data_migrations/upgrade/20120213205519_populate_website_iids.rb +17 -0
  75. data/db/migrate/20110211002317_setup_knitkit.rb +22 -5
  76. data/db/migrate/20111207161928_create_documented_items_table.rb +13 -0
  77. data/db/migrate/20111208180539_add_document_id_to_documented_item.rb +9 -0
  78. data/db/migrate/20120315163736_add_document.rb +32 -0
  79. data/db/migrate/20120503183431_create_valid_documents.rb +16 -0
  80. data/db/migrate/upgrade/20120116201510_add_render_base_layout_flag.rb +13 -0
  81. data/db/migrate/upgrade/20120127143745_create_website_party_roles.rb +24 -0
  82. data/db/migrate/upgrade/20120213184509_add_iid_to_websites.rb +14 -0
  83. data/lib/knitkit.rb +2 -0
  84. data/lib/knitkit/config.rb +31 -0
  85. data/lib/knitkit/engine.rb +12 -3
  86. data/lib/knitkit/extensions.rb +1 -3
  87. data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +2 -3
  88. data/lib/knitkit/extensions/active_record/acts_as_document.rb +63 -0
  89. data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +5 -4
  90. data/lib/knitkit/extensions/compass_ae/widgets/base.rb +70 -0
  91. data/lib/knitkit/extensions/railties/action_view.rb +22 -10
  92. data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +3 -3
  93. data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +8 -3
  94. data/lib/knitkit/routing_filter/section_router.rb +16 -6
  95. data/lib/knitkit/version.rb +7 -1
  96. data/public/images/check.png +0 -0
  97. data/public/images/credit_card.png +0 -0
  98. data/public/images/knitkit/tooltip.gif +0 -0
  99. data/public/javascripts/ajax_pagination.js +33 -0
  100. data/public/javascripts/datepicker.js +6 -1
  101. data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +731 -258
  102. data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +289 -238
  103. data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +2 -4
  104. data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +29 -3
  105. data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +193 -21
  106. data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +27 -26
  107. data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +167 -20
  108. data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +1 -2
  109. data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +5 -1
  110. data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +2 -2
  111. data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +20 -11
  112. data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +279 -228
  113. data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +40 -40
  114. data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +83 -76
  115. data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +1961 -1397
  116. data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +47 -43
  117. data/public/javascripts/knitkit/helpers.js +26 -0
  118. data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +1 -2
  119. data/public/stylesheets/knitkit/documentation.css +50 -0
  120. data/public/stylesheets/knitkit/style.css +23 -1
  121. data/spec/controllers/knitkit/erp_app/desktop/articles_controller_spec.rb +8 -0
  122. data/spec/controllers/knitkit/erp_app/desktop/website_controller_spec.rb +396 -0
  123. data/spec/controllers/knitkit/erp_app/desktop/website_nav_controller_spec.rb +260 -0
  124. data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +222 -0
  125. data/spec/dummy/Rakefile +7 -0
  126. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  127. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  128. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  129. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  130. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  131. data/spec/dummy/config.ru +4 -0
  132. data/spec/dummy/config/application.rb +43 -0
  133. data/spec/dummy/config/boot.rb +10 -0
  134. data/spec/dummy/config/database.yml +8 -0
  135. data/spec/dummy/config/environment.rb +5 -0
  136. data/spec/dummy/config/environments/spec.rb +27 -0
  137. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  138. data/spec/dummy/config/initializers/inflections.rb +10 -0
  139. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  140. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  141. data/spec/dummy/config/initializers/session_store.rb +8 -0
  142. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  143. data/spec/dummy/config/locales/en.yml +5 -0
  144. data/spec/dummy/config/routes.rb +4 -0
  145. data/spec/dummy/config/workflow.yml +1 -0
  146. data/spec/dummy/public/404.html +26 -0
  147. data/spec/dummy/public/422.html +26 -0
  148. data/spec/dummy/public/500.html +26 -0
  149. data/spec/dummy/public/favicon.ico +0 -0
  150. data/spec/dummy/script/rails +6 -0
  151. data/spec/factories/article.rb +4 -0
  152. data/spec/factories/basic.rb +3 -0
  153. data/spec/factories/blog.rb +5 -0
  154. data/spec/factories/documented_content.rb +4 -0
  155. data/spec/factories/documented_item.rb +4 -0
  156. data/spec/factories/online_document_section.rb +6 -0
  157. data/spec/factories/published_website.rb +4 -0
  158. data/spec/factories/theme.rb +6 -0
  159. data/spec/factories/website.rb +5 -0
  160. data/spec/factories/website_host.rb +4 -0
  161. data/spec/factories/website_nav.rb +5 -0
  162. data/spec/factories/website_nav_item.rb +4 -0
  163. data/spec/factories/website_section.rb +5 -0
  164. data/spec/models/article_spec.rb +35 -0
  165. data/spec/models/attribute_type_spec.rb +55 -0
  166. data/spec/models/attribute_value_spec.rb +114 -0
  167. data/spec/models/blog_spec.rb +16 -0
  168. data/spec/models/comment_spec.rb +11 -0
  169. data/spec/models/content_spec.rb +187 -0
  170. data/spec/models/documented_item_spec.rb +29 -0
  171. data/spec/models/online_document_section_spec.rb +34 -0
  172. data/spec/models/published_element_spec.rb +11 -0
  173. data/spec/models/published_website_spec.rb +11 -0
  174. data/spec/models/theme_spec.rb +12 -0
  175. data/spec/models/website_host_spec.rb +11 -0
  176. data/spec/models/website_inquiry_spec.rb +24 -0
  177. data/spec/models/website_nav_item_spec.rb +11 -0
  178. data/spec/models/website_nav_spec.rb +11 -0
  179. data/spec/models/website_section_content_spec.rb +11 -0
  180. data/spec/models/website_section_spec.rb +49 -0
  181. data/spec/models/website_spec.rb +146 -0
  182. data/spec/spec_helper.rb +61 -0
  183. metadata +391 -154
  184. data/app/controllers/knitkit/articles_controller.rb +0 -7
  185. data/lib/knitkit/extensions/compass/widgets/base.rb +0 -53
@@ -11,7 +11,7 @@ module ActionView
11
11
  module AssetTagHelper
12
12
  def theme_javascript_path(theme, source)
13
13
  theme = controller.website.themes.find_by_theme_id(theme) unless theme.is_a?(Theme)
14
- file = theme.files.where('name = ? and directory = ?', source, "/#{theme.url}/javascripts").first
14
+ file = theme.files.where('name = ? and directory = ?', source, "#{theme.url}/javascripts").first
15
15
  file.nil? ? '' : file.data.url
16
16
  end
17
17
  alias_method :theme_path_to_javascript, :theme_javascript_path
@@ -41,7 +41,7 @@ module ActionView
41
41
 
42
42
  def theme_stylesheet_path(theme, source)
43
43
  theme = controller.website.themes.find_by_theme_id(theme) unless theme.is_a?(Theme)
44
- file = theme.files.where('name = ? and directory = ?', source, "/#{theme.url}/stylesheets").first
44
+ file = theme.files.where('name = ? and directory = ?', source, "#{theme.url}/stylesheets").first
45
45
  file.nil? ? '' : file.data.url
46
46
  end
47
47
  alias_method :theme_path_to_stylesheet, :theme_stylesheet_path
@@ -71,7 +71,7 @@ module ActionView
71
71
 
72
72
  def theme_image_path(theme, source)
73
73
  theme = controller.website.themes.find_by_theme_id(theme) unless theme.is_a?(Theme)
74
- file = theme.files.where('name = ? and directory = ?', source, "/#{theme.url}/images").first
74
+ file = theme.files.where('name = ? and directory = ?', source, "#{theme.url}/images").first
75
75
  file.nil? ? '' : file.data.url
76
76
  end
77
77
  alias_method :theme_path_to_image, :theme_image_path # aliased to avoid conflicts with an image_path named route
@@ -9,10 +9,15 @@ module ActionView
9
9
  @cached[key][name][prefix][partial][locals] = decorate(yield, path_info, details, locals)
10
10
  else
11
11
  @cached[key][name][prefix][partial][locals].each do |template|
12
- last_update = mtime(template.identifier)
13
- if last_update > template.updated_at
12
+ #check if the file still exists
13
+ if File.exists? template.identifier
14
+ last_update = mtime(template.identifier)
15
+ if last_update > template.updated_at
16
+ @cached[key][name][prefix][partial][locals].delete_if{|item| item.identifier == template.identifier}
17
+ @cached[key][name][prefix][partial][locals] << build_template(template.identifier, template.virtual_path, (details[:formats] || [:html] if template.formats.empty?), template.locals)
18
+ end
19
+ else
14
20
  @cached[key][name][prefix][partial][locals].delete_if{|item| item.identifier == template.identifier}
15
- @cached[key][name][prefix][partial][locals] << build_template(template.identifier, template.virtual_path, (details[:formats] || [:html] if template.formats.empty?), template.locals)
16
21
  end
17
22
  end
18
23
  @cached[key][name][prefix][partial][locals]
@@ -2,20 +2,30 @@
2
2
  # of the path, replace it by "sections/:id" segments.
3
3
 
4
4
  module RoutingFilter
5
+ require 'logger'
5
6
  class SectionRouter < Filter
6
7
  def around_recognize(path, env, &block)
7
8
  website = Website.find_by_host(env["HTTP_HOST"])
8
- paths = paths_for_website(website)
9
- if path !~ %r(^/([\w]{2,4}/)?admin) and !paths.empty? and path =~ recognize_pattern(paths)
10
- if section = website_section_by_path(website, $2)
11
- type = section.type.pluralize.downcase
12
- path.sub! %r(^/([\w]{2,4}/)?(#{paths})(?=/|\.|$)), "/#{$1}#{type}/#{section.id}#{$3}"
9
+ if website
10
+ paths = paths_for_website(website)
11
+ if path.to_sym == :/
12
+ home_page_url = website.configurations.first.get_configuration_item(ConfigurationItemType.find_by_internal_identifier('homepage_url')).options.first.value
13
+ valid_section = website.website_sections.detect{|website_section| website_section.path == home_page_url }
14
+ type = valid_section.type.pluralize.downcase
15
+ path.sub!('/', "/#{$1}#{type}/#{valid_section.id}#{$3}")
16
+ else
17
+ if !Rails.application.config.knitkit.ignored_prefix_paths.include?(path) and path !~ %r(^/([\w]{2,4}/)?admin) and !paths.empty? and path =~ recognize_pattern(paths)
18
+ if section = website_section_by_path(website, $2)
19
+ type = section.type.pluralize.downcase
20
+ path.sub! %r(^/([\w]{2,4}/)?(#{paths})(?=/|\.|$)), "/#{$1}#{type}/#{section.id}#{$3}"
21
+ end
22
+ end
13
23
  end
14
24
  end
15
25
  yield
16
26
  end
17
27
 
18
- def around_generate(params, &block)
28
+ def around_generate(params, &block)
19
29
  yield.tap do |path|
20
30
  result = result.first if result.is_a?(Array)
21
31
  if result !~ %r(^/([\w]{2,4}/)?admin) and result =~ generate_pattern
@@ -1,3 +1,9 @@
1
1
  module Knitkit
2
- VERSION = "2.0.0"
2
+ module VERSION #:nodoc:
3
+ MAJOR = 2
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
+ end
3
9
  end
Binary file
Binary file
Binary file
@@ -0,0 +1,33 @@
1
+ /* ajax pagination */
2
+
3
+ /* Prototype implementation let here for reference
4
+ document.observe("dom:loaded", function() {
5
+ // the element in which we will observe all clicks and capture
6
+ // ones originating from pagination links
7
+ var container = $(document.body);
8
+
9
+ if (container) {
10
+ var img = new Image;
11
+ img.src = '/images/erp_app/ajax-loader.gif';
12
+
13
+ function createSpinner() {
14
+ return new Element('img', { src: img.src, 'class': 'spinner' });
15
+ }
16
+
17
+ container.observe('click', function(e) {
18
+ var el = e.element();
19
+ if (el.match('.pagination a')) {
20
+ el.up('.pagination').insert(createSpinner());
21
+ new Ajax.Request(el.href, { method: 'get' });
22
+ e.stop();
23
+ }
24
+ });
25
+ }
26
+ });
27
+ */
28
+
29
+ /* jQuery implementation
30
+ NOTE: Does not work standalone like the prototype implementation did, you have to do it inline in the ajax response */
31
+ jQuery(function(){
32
+ jQuery('.pagination a').attr('data-remote', 'true');
33
+ });
@@ -187,7 +187,12 @@ function refreshDatePicker(dateFieldName, year, month, day)
187
187
  // now, the days of the month
188
188
  do {
189
189
  dayNum = thisDay.getDate();
190
- TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString(thisDay) + "');\">";
190
+ if(new Date(thisDay.getFullYear(), thisDay.getMonth(), (thisDay.getDate() + 1)) >= new Date()){
191
+ TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString(thisDay) + "');\">";
192
+ }
193
+ else{
194
+ TD_onclick = " onclick=\"alert('Invalid Date');\">";
195
+ }
191
196
 
192
197
  if (dayNum == day)
193
198
  html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
@@ -4,8 +4,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel",{
4
4
  deleteArticle : function(id){
5
5
  var self = this;
6
6
  this.initialConfig['centerRegion'].setWindowStatus('Deleting...');
7
- var conn = new Ext.data.Connection();
8
- conn.request({
7
+ Ext.Ajax.request({
9
8
  url: '/knitkit/erp_app/desktop/articles/delete',
10
9
  method: 'POST',
11
10
  params:{
@@ -29,6 +28,242 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel",{
29
28
  });
30
29
  },
31
30
 
31
+ // shouldnt need this anymore
32
+ deleteAttribute : function(id){
33
+ var self = this;
34
+ this.initialConfig['centerRegion'].setWindowStatus('Deleting...');
35
+ var conn = new Ext.data.Connection();
36
+ conn.request({
37
+ url: '/knitkit/erp_app/desktop/articles/delete_attribute',
38
+ method: 'POST',
39
+ params:{
40
+ id:id
41
+ },
42
+ success: function(response) {
43
+ var obj = Ext.decode(response.responseText);
44
+ if(obj.success){
45
+ self.initialConfig['centerRegion'].clearWindowStatus();
46
+ Ext.getCmp('editGlobalArticleAttributesWindowGrid').getStore().load();
47
+ }
48
+ else{
49
+ Ext.Msg.alert('Error', 'Error deleting Article');
50
+ self.initialConfig['centerRegion'].clearWindowStatus();
51
+ }
52
+ },
53
+ failure: function(response) {
54
+ self.initialConfig['centerRegion'].clearWindowStatus();
55
+ Ext.Msg.alert('Error', 'Error deleting Article');
56
+ }
57
+ });
58
+ },
59
+
60
+ // shouldnt need this
61
+ editAttributes :function(record) {
62
+ var self = this;
63
+
64
+ var attributesStore = Ext.create('Ext.data.Store', {
65
+ proxy: {
66
+ type: 'ajax',
67
+ url:'/knitkit/erp_app/desktop/articles/article_attributes/',
68
+ extraParams:{
69
+ article_id:record.get('id')
70
+ },
71
+ reader: {
72
+ type: 'json',
73
+ root: 'data'
74
+ }
75
+ },
76
+ remoteSort: true,
77
+ fields:[
78
+ {
79
+ name:'id'
80
+ },
81
+ {
82
+ name:'description'
83
+ },
84
+ {
85
+ name:'data_type'
86
+ },
87
+ {
88
+ name:'value'
89
+ }
90
+ ]
91
+ });
92
+
93
+ var editArticleAttributesWindow = Ext.create("Ext.window.Window",{
94
+ layout:'fit',
95
+ width:375,
96
+ height:253,
97
+ title:'Edit Attributes',
98
+ plain: true,
99
+ buttonAlign:'center',
100
+ items: {
101
+ xtype: 'grid',
102
+ id: 'editGlobalArticleAttributesWindowGrid',
103
+ border:false,
104
+ frame:false,
105
+ store: attributesStore,
106
+ columns: [
107
+ {
108
+ header: "id",
109
+ width: 30,
110
+ dataIndex: 'id',
111
+ sortable: true,
112
+ hidden:true
113
+ },
114
+ {
115
+ id: 'description',
116
+ header: "Name",
117
+ width: 151,
118
+ dataIndex: 'description',
119
+ sortable: true
120
+ },
121
+ {
122
+ id: 'data_type',
123
+ header: "Data_Type",
124
+ width: 70,
125
+ dataIndex: 'data_type',
126
+ sortable: true
127
+ },
128
+ {
129
+ id: 'value',
130
+ header: "Value",
131
+ width: 100,
132
+ dataIndex: 'value',
133
+ sortable: true
134
+ },
135
+ {
136
+ menuDisabled:true,
137
+ resizable:false,
138
+ xtype:'actioncolumn',
139
+ header:'Delete',
140
+ align:'center',
141
+ width:40,
142
+ items:[{
143
+ icon:'/images/icons/delete/delete_16x16.png',
144
+ tooltip:'Delete',
145
+ handler :function(grid, rowIndex, colIndex){
146
+ var rec = grid.getStore().getAt(rowIndex);
147
+ var id = rec.get('id');
148
+ var messageBox = Ext.MessageBox.confirm(
149
+ 'Confirm', 'Are you sure?',
150
+ function(btn){
151
+ if (btn == 'yes'){
152
+ self.deleteAttribute(id);
153
+ }
154
+ }
155
+ );
156
+ }
157
+ }]
158
+ }],
159
+ tbar: [{
160
+ text: 'Add Attribute',
161
+ iconCls: 'icon-add',
162
+ handler : function(){
163
+ var addAttributeWindow = new Ext.Window({
164
+ layout:'fit',
165
+ width:375,
166
+ title:'New Attribute',
167
+ plain: true,
168
+ buttonAlign:'center',
169
+ items: new Ext.FormPanel({
170
+ labelWidth: 110,
171
+ frame:false,
172
+ bodyStyle:'padding:5px 5px 0',
173
+ width: 425,
174
+ url:'/knitkit/erp_app/desktop/articles/new_attribute/',
175
+ defaults: {
176
+ width: 257
177
+ },
178
+ items:[
179
+ {
180
+ xtype:'hidden',
181
+ name:'article_id',
182
+ value:record.get('id')
183
+ },
184
+ {
185
+ xtype:'textfield',
186
+ fieldLabel:'Name',
187
+ allowBlank:false,
188
+ name:'description'
189
+ },
190
+ {
191
+ xtype:'combo',
192
+ fieldLabel:'Data_type',
193
+ forceSelection:true,
194
+ store:[
195
+ ['Text','Text'],
196
+ ['Date', 'Date'],
197
+ ['Boolean', 'Boolean'],
198
+ ['Integer', 'Integer'],
199
+ ['Float', 'Float']
200
+ ],
201
+ value:'Text',
202
+ name:'data_type',
203
+ allowBlank: false,
204
+ triggerAction:'all'
205
+ },
206
+ {
207
+ xtype:'textfield',
208
+ fieldLabel:'Value',
209
+ allowBlank:false,
210
+ name:'value'
211
+ }]
212
+ }),
213
+ buttons: [{
214
+ text:'Submit',
215
+ listeners:{
216
+ 'click':function(button){
217
+ var window = button.findParentByType('window');
218
+ var formPanel = window.query('form')[0];
219
+ self.initialConfig['centerRegion'].setWindowStatus('Creating attribute...');
220
+ formPanel.getForm().submit({
221
+ reset:true,
222
+ success:function(form, action){
223
+ self.initialConfig['centerRegion'].clearWindowStatus();
224
+ var obj = Ext.decode(action.response.responseText);
225
+ if(obj.success){
226
+ Ext.getCmp('editGlobalArticleAttributesWindowGrid').getStore().load()
227
+ }
228
+ else{
229
+ Ext.Msg.alert("Error", obj.msg);
230
+ }
231
+ addAttributeWindow.close();
232
+
233
+ },
234
+ failure:function(form, action){
235
+ self.initialConfig['centerRegion'].clearWindowStatus();
236
+ Ext.Msg.alert("Error", "Error creating attribute");
237
+ }
238
+ });
239
+ }
240
+ }
241
+ },{
242
+ text: 'Close',
243
+ handler: function(){
244
+ addAttributeWindow.close();
245
+ }
246
+ }]
247
+ });
248
+ addAttributeWindow.show();
249
+ }
250
+ }],
251
+ bbar: new Ext.PagingToolbar({
252
+ pageSize: 5,
253
+ store: attributesStore,
254
+ displayInfo: true,
255
+ displayMsg: '{0} - {1} of {2}',
256
+ emptyMsg: "Empty"
257
+ }),
258
+ renderTo: Ext.getBody(),
259
+ autoscroll: true,
260
+ loadMask: true
261
+ }
262
+ });
263
+ attributesStore.loadPage(1);
264
+ editArticleAttributesWindow.show();
265
+ },
266
+
32
267
  editArticle : function(record){
33
268
  var self = this;
34
269
 
@@ -91,6 +326,18 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel",{
91
326
  id: 'tag_list',
92
327
  value: record.get('tag_list')
93
328
  },
329
+ {
330
+ xtype: 'displayfield',
331
+ fieldLabel: 'Created At',
332
+ name: 'created_at',
333
+ value: record.data.created_at
334
+ },
335
+ {
336
+ xtype: 'displayfield',
337
+ fieldLabel: 'Updated At',
338
+ name: 'updated_at',
339
+ value: record.data.updated_at
340
+ },
94
341
  {
95
342
  xtype:'hidden',
96
343
  allowBlank:false,
@@ -151,6 +398,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel",{
151
398
 
152
399
  // create the Data Store
153
400
  var store = Ext.create('Ext.data.Store', {
401
+ pageSize: 20,
154
402
  proxy: {
155
403
  type: 'ajax',
156
404
  url:'/knitkit/erp_app/desktop/articles/all/',
@@ -184,277 +432,502 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel",{
184
432
  },
185
433
  {
186
434
  name:'display_title'
187
- }
188
- ]
189
- });
190
-
191
- config = Ext.apply({
192
- title:'Articles',
193
- columns:[
194
- {
195
- header:'Title',
196
- sortable:true,
197
- dataIndex:'title',
198
- width:110,
199
- editable:false
200
435
  },
201
436
  {
202
- header:'Unique Name',
203
- sortable:true,
204
- dataIndex:'internal_identifier',
205
- width:110,
206
- editable:false
437
+ name:'created_at'
207
438
  },
208
439
  {
209
- menuDisabled:true,
210
- resizable:false,
211
- xtype:'actioncolumn',
212
- header:'Tags',
213
- align:'center',
214
- width:40,
215
- items:[{
216
- getClass: function(v, meta, rec) { // Or return a class from a function
217
- this.items[0].tooltip = rec.get('tag_list');
218
- return 'info-col';
219
- },
220
- handler :function(grid, rowIndex, colIndex){
221
- return true;
222
- }
223
- }]
224
- },
225
- {
226
- menuDisabled:true,
227
- resizable:false,
228
- xtype:'actioncolumn',
229
- header:'Sections',
230
- align:'center',
231
- width:50,
232
- items:[{
233
- getClass: function(v, meta, rec) { // Or return a class from a function
234
- this.items[0].tooltip = rec.get('sections');
235
- return 'info-col';
236
- },
237
- handler :function(grid, rowIndex, colIndex){
238
- return true;
239
- }
240
- }]
241
- },
242
- {
243
- menuDisabled:true,
244
- resizable:false,
245
- xtype:'actioncolumn',
246
- header:'Edit',
247
- align:'center',
248
- width:40,
249
- items:[{
250
- icon:'/images/icons/edit/edit_16x16.png',
251
- tooltip:'Edit',
252
- handler :function(grid, rowIndex, colIndex){
253
- var rec = grid.getStore().getAt(rowIndex);
254
- self.editArticle(rec);
255
- }
256
- }]
257
- },
258
- {
259
- menuDisabled:true,
260
- resizable:false,
261
- xtype:'actioncolumn',
262
- header:'Comments',
263
- align:'center',
264
- width:60,
265
- items:[{
266
- icon:'/images/icons/document_text/document_text_16x16.png',
267
- tooltip:'Comments',
268
- handler :function(grid, rowIndex, colIndex){
269
- var rec = grid.getStore().getAt(rowIndex);
270
- self.initialConfig['centerRegion'].viewContentComments(rec.get('id'), rec.get('title') + ' - Comments');
271
- }
272
- }]
273
- },
274
- {
275
- menuDisabled:true,
276
- resizable:false,
277
- xtype:'actioncolumn',
278
- header:'Excerpt',
279
- align:'center',
280
- width:50,
281
- items:[{
282
- icon:'/images/icons/edit/edit_16x16.png',
283
- tooltip:'Edit',
284
- handler :function(grid, rowIndex, colIndex){
285
- var rec = grid.getStore().getAt(rowIndex);
286
- self.initialConfig['centerRegion'].editExcerpt(rec.get('title') + ' - Excerpt', rec.get('id'), rec.get('excerpt_html'), self.initialConfig.siteId);
287
- }
288
- }]
289
- },
290
- {
291
- menuDisabled:true,
292
- resizable:false,
293
- xtype:'actioncolumn',
294
- header:'HTML',
295
- align:'center',
296
- width:40,
297
- items:[{
298
- icon:'/images/icons/edit/edit_16x16.png',
299
- tooltip:'Edit',
300
- handler :function(grid, rowIndex, colIndex){
301
- var rec = grid.getStore().getAt(rowIndex);
302
- self.initialConfig['centerRegion'].editContent(rec.get('title'), rec.get('id'), rec.get('body_html'), null, 'blog');
303
- }
304
- }]
305
- },
306
- {
307
- menuDisabled:true,
308
- resizable:false,
309
- xtype:'actioncolumn',
310
- header:'Delete',
311
- align:'center',
312
- width:40,
313
- items:[{
314
- icon:'/images/icons/delete/delete_16x16.png',
315
- tooltip:'Delete',
316
- handler :function(grid, rowIndex, colIndex){
317
- var rec = grid.getStore().getAt(rowIndex);
318
- var id = rec.get('id');
319
- var messageBox = Ext.MessageBox.confirm(
320
- 'Confirm', 'Are you sure?',
321
- function(btn){
322
- if (btn == 'yes'){
323
- self.deleteArticle(id);
324
- }
325
- }
326
- );
327
- }
328
- }]
440
+ name:'updated_at'
329
441
  }
330
- ],
331
- store:store,
332
- tbar: [{
333
- text: 'Add New Article',
334
- iconCls: 'icon-add',
335
- handler : function(){
336
- var addArticleWindow = new Ext.Window({
337
- layout:'fit',
338
- width:375,
339
- title:'New Article',
340
- plain: true,
341
- buttonAlign:'center',
342
- items: new Ext.FormPanel({
343
- labelWidth: 110,
344
- frame:false,
345
- bodyStyle:'padding:5px 5px 0',
346
- width: 425,
347
- url:'/knitkit/erp_app/desktop/articles/new/',
348
- defaults: {
349
- width: 225
350
- },
351
- items:[
352
- {
353
- xtype:'textfield',
354
- fieldLabel:'Title',
355
- allowBlank:false,
356
- name:'title'
357
- },
358
- {
359
- xtype:'radiogroup',
360
- fieldLabel:'Display title?',
361
- name:'display_title',
362
- columns:2,
363
- items:[
364
- {
365
- boxLabel:'Yes',
366
- name:'display_title',
367
- inputValue: 'yes',
368
- checked:true
442
+ ]
443
+ });
444
+
445
+ var columnItems = [];
446
+
447
+ columnItems.push(
448
+ {
449
+ header:'Title',
450
+ sortable:true,
451
+ dataIndex:'title',
452
+ width:110,
453
+ editable:false
454
+ },
455
+ {
456
+ menuDisabled:true,
457
+ resizable:false,
458
+ xtype:'actioncolumn',
459
+ header:'Sections',
460
+ align:'center',
461
+ width:50,
462
+ items:[{
463
+ getClass: function(v, meta, rec) { // Or return a class from a function
464
+ this.items[0].tooltip = rec.get('sections');
465
+ return 'info-col';
369
466
  },
467
+ handler :function(grid, rowIndex, colIndex){
468
+ return true;
469
+ }
470
+ }]
471
+ });
370
472
 
371
- {
372
- boxLabel:'No',
373
- name:'display_title',
374
- inputValue: 'no'
375
- }]
376
- },
377
- {
378
- xtype:'textfield',
379
- fieldLabel:'Unique Name',
380
- allowBlank:true,
381
- name:'internal_identifier'
382
- },
383
- {
384
- xtype:'textfield',
385
- fieldLabel:'Tags',
386
- allowBlank:true,
387
- name:'tags',
388
- id: 'tag_list'
389
- }
390
- ]
391
- }),
392
- buttons: [{
393
- text:'Submit',
394
- listeners:{
395
- 'click':function(button){
396
- var window = button.findParentByType('window');
397
- var formPanel = window.query('form')[0];
398
- self.initialConfig['centerRegion'].setWindowStatus('Creating article...');
399
- formPanel.getForm().submit({
400
- reset:true,
401
- success:function(form, action){
402
- self.initialConfig['centerRegion'].clearWindowStatus();
403
- var obj = Ext.decode(action.response.responseText);
404
- if(obj.success){
405
- self.getStore().load();
406
- }
407
- else{
408
- Ext.Msg.alert("Error", obj.msg);
409
- }
410
- addArticleWindow.close();
473
+ if (currentUser.hasApplicationCapability('knitkit', {
474
+ capability_type_iid:'edit',
475
+ resource:'Article'
476
+ }))
411
477
 
412
- },
413
- failure:function(form, action){
414
- self.initialConfig['centerRegion'].clearWindowStatus();
415
- Ext.Msg.alert("Error", "Error creating article");
478
+ {
479
+ columnItems.push(
480
+ {
481
+ menuDisabled:true,
482
+ resizable:false,
483
+ xtype:'actioncolumn',
484
+ header:'Edit',
485
+ align:'center',
486
+ width:40,
487
+ items:[{
488
+ icon:'/images/icons/edit/edit_16x16.png',
489
+ tooltip:'Edit',
490
+ handler :function(grid, rowIndex, colIndex){
491
+ var rec = grid.getStore().getAt(rowIndex);
492
+ self.editArticle(rec);
416
493
  }
417
- });
494
+ }]
495
+ });
496
+ }
497
+
498
+ columnItems.push(
499
+ {
500
+ menuDisabled:true,
501
+ resizable:false,
502
+ xtype:'actioncolumn',
503
+ header:'Comments',
504
+ align:'center',
505
+ width:60,
506
+ items:[{
507
+ icon:'/images/icons/document_text/document_text_16x16.png',
508
+ tooltip:'Comments',
509
+ handler :function(grid, rowIndex, colIndex){
510
+ var rec = grid.getStore().getAt(rowIndex);
511
+ self.initialConfig['centerRegion'].viewContentComments(rec.get('id'), rec.get('title') + ' - Comments');
418
512
  }
419
- }
420
- },{
421
- text: 'Close',
422
- handler: function(){
423
- addArticleWindow.close();
424
- }
425
513
  }]
426
- });
427
- addArticleWindow.show();
514
+ });
515
+
516
+ if (currentUser.hasApplicationCapability('knitkit', {
517
+ capability_type_iid:'edit_excerpt',
518
+ resource:'Article'
519
+ }))
520
+
521
+ {
522
+ columnItems.push(
523
+ {
524
+ menuDisabled:true,
525
+ resizable:false,
526
+ xtype:'actioncolumn',
527
+ header:'Excerpt',
528
+ align:'center',
529
+ width:50,
530
+ items:[{
531
+ icon:'/images/icons/edit/edit_16x16.png',
532
+ tooltip:'Edit Excerpt',
533
+ handler :function(grid, rowIndex, colIndex){
534
+ var rec = grid.getStore().getAt(rowIndex);
535
+ self.initialConfig['centerRegion'].editExcerpt(rec.get('title') + ' - Excerpt', rec.get('id'), rec.get('excerpt_html'), self.initialConfig.siteId);
536
+ }
537
+ }]
538
+ });
428
539
  }
429
- },'|',
430
- {
431
- xtype:'textfield',
432
- hideLabel:true,
433
- id:'global_article_search_field'
434
- },
435
- {
436
- text: 'Search',
437
- iconCls: 'icon-search',
438
- handler: function(button) {
439
- var iid = Ext.getCmp('global_article_search_field').getValue();
440
- store.setProxy({
441
- type: 'ajax',
442
- url: '/knitkit/erp_app/desktop/articles/all/',
443
- reader: {
444
- type: 'json',
445
- root: 'data',
446
- idProperty: 'id',
447
- totalProperty:'totalCount'
448
- },
449
- extraParams:{
450
- iid:iid
540
+
541
+ columnItems.push(
542
+ {
543
+ menuDisabled:true,
544
+ resizable:false,
545
+ xtype:'actioncolumn',
546
+ header:'HTML',
547
+ align:'center',
548
+ width:40,
549
+ items:[{
550
+ icon:'/images/icons/edit/edit_16x16.png',
551
+ tooltip:'Edit Content',
552
+ handler :function(grid, rowIndex, colIndex){
553
+ var rec = grid.getStore().getAt(rowIndex);
554
+ self.initialConfig['centerRegion'].editContent(rec.get('title'), rec.get('id'), rec.get('body_html'), null, 'blog');
555
+ }
556
+ }]
557
+ });
558
+
559
+ if (currentUser.hasApplicationCapability('knitkit', {
560
+ capability_type_iid:'delete',
561
+ resource:'Article'
562
+ }))
563
+
564
+ {
565
+ columnItems.push(
566
+ {
567
+ menuDisabled:true,
568
+ resizable:false,
569
+ xtype:'actioncolumn',
570
+ header:'Delete',
571
+ align:'center',
572
+ width:40,
573
+ items:[{
574
+ icon:'/images/icons/delete/delete_16x16.png',
575
+ tooltip:'Delete',
576
+ handler :function(grid, rowIndex, colIndex){
577
+ var rec = grid.getStore().getAt(rowIndex);
578
+ var id = rec.get('id');
579
+ var messageBox = Ext.MessageBox.confirm(
580
+ 'Confirm', 'Are you sure?',
581
+ function(btn){
582
+ if (btn == 'yes'){
583
+ self.deleteArticle(id);
584
+ }
585
+ }
586
+ );
587
+ }
588
+ }]
451
589
  }
452
- });
453
- store.loadPage(1);
590
+ );
454
591
  }
455
- }],
592
+
593
+ var tbarItems = [];
594
+
595
+ if (currentUser.hasApplicationCapability('knitkit', {
596
+ capability_type_iid:'create',
597
+ resource:'Article'
598
+ }))
599
+
600
+ {
601
+ tbarItems.push(
602
+ {
603
+ text: 'New Article',
604
+ iconCls: 'icon-add',
605
+ handler : function(){
606
+ var addArticleWindow = new Ext.Window({
607
+ layout:'fit',
608
+ width:375,
609
+ title:'New Article',
610
+ plain: true,
611
+ buttonAlign:'center',
612
+ items: new Ext.FormPanel({
613
+ labelWidth: 110,
614
+ frame:false,
615
+ bodyStyle:'padding:5px 5px 0',
616
+ width: 425,
617
+ url:'/knitkit/erp_app/desktop/articles/new/',
618
+ defaults: {
619
+ width: 257
620
+ },
621
+ items:[
622
+ {
623
+ xtype:'textfield',
624
+ fieldLabel:'Title',
625
+ allowBlank:false,
626
+ name:'title'
627
+ },
628
+ {
629
+ xtype:'radiogroup',
630
+ fieldLabel:'Display title?',
631
+ name:'display_title',
632
+ columns:2,
633
+ items:[
634
+ {
635
+ boxLabel:'Yes',
636
+ name:'display_title',
637
+ inputValue: 'yes',
638
+ checked:true
639
+ },
640
+
641
+ {
642
+ boxLabel:'No',
643
+ name:'display_title',
644
+ inputValue: 'no'
645
+ }]
646
+ },
647
+ {
648
+ xtype:'textfield',
649
+ fieldLabel:'Unique Name',
650
+ allowBlank:true,
651
+ name:'internal_identifier'
652
+ },
653
+ {
654
+ xtype:'textfield',
655
+ fieldLabel:'Tags',
656
+ allowBlank:true,
657
+ name:'tags',
658
+ id: 'tag_list'
659
+ }]
660
+ }),
661
+ buttons: [{
662
+ text:'Submit',
663
+ listeners:{
664
+ 'click':function(button){
665
+ var window = button.findParentByType('window');
666
+ var formPanel = window.query('form')[0];
667
+ self.initialConfig['centerRegion'].setWindowStatus('Creating article...');
668
+ formPanel.getForm().submit({
669
+ reset:true,
670
+ success:function(form, action){
671
+ self.initialConfig['centerRegion'].clearWindowStatus();
672
+ var obj = Ext.decode(action.response.responseText);
673
+ if(obj.success){
674
+ self.getStore().load();
675
+ }
676
+ else{
677
+ Ext.Msg.alert("Error", obj.msg);
678
+ }
679
+ addArticleWindow.close();
680
+
681
+ },
682
+ failure:function(form, action){
683
+ self.initialConfig['centerRegion'].clearWindowStatus();
684
+ Ext.Msg.alert("Error", "Error creating article");
685
+ }
686
+ });
687
+ }
688
+ }
689
+ },{
690
+ text: 'Close',
691
+ handler: function(){
692
+ addArticleWindow.close();
693
+ }
694
+ }]
695
+ });
696
+ addArticleWindow.show();
697
+ }
698
+ },'|');
699
+ }
700
+
701
+ tbarItems.push(
702
+ {
703
+ xtype:'textfield',
704
+ hideLabel:true,
705
+ id:'global_article_search_field',
706
+ width:75
707
+ },
708
+ {
709
+ text: 'Search',
710
+ iconCls: 'icon-search',
711
+ handler: function(button) {
712
+ var iid = Ext.getCmp('global_article_search_field').getValue();
713
+ store.setProxy({
714
+ type: 'ajax',
715
+ url: '/knitkit/erp_app/desktop/articles/all/',
716
+ reader: {
717
+ type: 'json',
718
+ root: 'data',
719
+ idProperty: 'id',
720
+ totalProperty:'total'
721
+ },
722
+ extraParams:{
723
+ iid:iid,
724
+ }
725
+ });
726
+ store.load();
727
+ }
728
+ },
729
+ {
730
+ text: 'Advanced',
731
+ iconCls: 'icon-search',
732
+ handler: function(){
733
+ var advancedSearchWindow = new Ext.Window({
734
+ layout:'fit',
735
+ width:375,
736
+ title:'Advanced Search',
737
+ plain: true,
738
+ buttonAlign:'center',
739
+ items: new Ext.FormPanel({
740
+ labelWidth: 110,
741
+ frame:false,
742
+ bodyStyle:'padding:5px 5px 0',
743
+ width: 425,
744
+ defaults: {
745
+ width: 257
746
+ },
747
+ items:[
748
+ {
749
+ xtype:'textfield',
750
+ fieldLabel:'Title',
751
+ allowBlank:true,
752
+ name:'title',
753
+ id:'global_article_advanced_search_title'
754
+ },
755
+ {
756
+ xtype:'fieldset',
757
+ border: false,
758
+ autoHeight: true,
759
+ title:'Created Between',
760
+ items: [{
761
+ xtype:'datefield',
762
+ fieldLabel: "Start",
763
+ name: 'created_start_date',
764
+ allowBlank:true,
765
+ width: 230,
766
+ id:'global_article_advanced_search_created_start_date'
767
+ },
768
+ {
769
+ xtype:'datefield',
770
+ fieldLabel: "End",
771
+ name: 'created_end_date',
772
+ allowBlank:true,
773
+ width: 230,
774
+ id:'global_article_advanced_search_created_end_date'
775
+ }]
776
+ },
777
+ {
778
+ xtype:'fieldset',
779
+ border: false,
780
+ autoHeight: true,
781
+ title:'Last Updated Between',
782
+ items: [{
783
+ xtype:'datefield',
784
+ fieldLabel: "Start",
785
+ name: 'updated_start_date',
786
+ allowBlank:true,
787
+ width: 230,
788
+ id:'global_article_advanced_search_updated_start_date'
789
+ },
790
+ {
791
+ xtype:'datefield',
792
+ fieldLabel: "End",
793
+ name: 'updated_end_date',
794
+ allowBlank:true,
795
+ width: 230,
796
+ id:'global_article_advanced_search_updated_end_date'
797
+ }]
798
+ },
799
+ {
800
+ xtype:'fieldset',
801
+ border: false,
802
+ autoHeight: true,
803
+ title:'Viewable Between',
804
+ items: [{
805
+ xtype:'datefield',
806
+ fieldLabel: "Start",
807
+ name: 'viewable_start_date',
808
+ allowBlank:true,
809
+ width: 230,
810
+ id:'global_article_advanced_search_viewable_start_date'
811
+ },
812
+ {
813
+ xtype:'datefield',
814
+ fieldLabel: "End",
815
+ name: 'viewable_end_date',
816
+ allowBlank:true,
817
+ width: 230,
818
+ id:'global_article_advanced_search_viewable_end_date'
819
+ },
820
+ {
821
+ xtype:'radiogroup',
822
+ fieldLabel:'Show Articles Without Display Dates?',
823
+ columns:2,
824
+ id:'global_article_advanced_search_show_articles_without_display_dates',
825
+ items:[
826
+ {
827
+ boxLabel:'Yes',
828
+ name:'show_articles_without_display_dates',
829
+ inputValue: 'true',
830
+ checked:true
831
+ },
832
+ {
833
+ boxLabel:'No',
834
+ name:'show_articles_without_display_dates',
835
+ inputValue: 'false'
836
+ }
837
+ ]
838
+ }]
839
+ },
840
+ {
841
+ xtype: 'checkbox',
842
+ fieldLabel: 'Show Orphaned Only',
843
+ id: 'show_orphaned_checkbox',
844
+ name: 'show_orphaned',
845
+ inputValue: 1,
846
+ uncheckedValue: 0
847
+
848
+ },
849
+ {
850
+ xtype:'radiogroup',
851
+ fieldLabel:'Archivable',
852
+ columns:2,
853
+ id:'global_article_advanced_search_archivable',
854
+ items:[
855
+ {
856
+ boxLabel:'Yes',
857
+ name:'archivable',
858
+ inputValue: 'true'
859
+ },
860
+ {
861
+ boxLabel:'No',
862
+ name:'archivable',
863
+ inputValue: 'false'
864
+ },
865
+ {
866
+ boxLabel:'Both',
867
+ name:'archivable',
868
+ inputValue: 'both',
869
+ checked:true
870
+ }]
871
+ }]
872
+ }),
873
+ buttons: [{
874
+ text:'Submit',
875
+ listeners:{
876
+ 'click':function(button){
877
+ var iid = Ext.getCmp('global_article_advanced_search_title').getValue();
878
+ var created_start_date = Ext.getCmp('global_article_advanced_search_created_start_date').getValue();
879
+ var created_end_date = Ext.getCmp('global_article_advanced_search_created_end_date').getValue();
880
+ var updated_start_date = Ext.getCmp('global_article_advanced_search_updated_start_date').getValue();
881
+ var updated_end_date = Ext.getCmp('global_article_advanced_search_updated_end_date').getValue();
882
+ var viewable_start_date = Ext.getCmp('global_article_advanced_search_viewable_start_date').getValue();
883
+ var viewable_end_date = Ext.getCmp('global_article_advanced_search_viewable_end_date').getValue();
884
+ var show_articles_without_display_dates = Ext.getCmp('global_article_advanced_search_show_articles_without_display_dates').getValue();
885
+ var archivable = Ext.getCmp('global_article_advanced_search_archivable').getValue();
886
+ var show_orphaned = Ext.getCmp('show_orphaned_checkbox').getValue();
887
+ store.setProxy({
888
+ type: 'ajax',
889
+ url: '/knitkit/erp_app/desktop/articles/all/',
890
+ reader: {
891
+ type: 'json',
892
+ root: 'data',
893
+ idProperty: 'id',
894
+ totalProperty:'total'
895
+ },
896
+ extraParams:{
897
+ iid:iid,
898
+ created_start_date:created_start_date,
899
+ created_end_date:created_end_date,
900
+ updated_start_date:updated_start_date,
901
+ updated_end_date:updated_end_date,
902
+ viewable_start_date:viewable_start_date,
903
+ viewable_end_date:viewable_end_date,
904
+ show_articles_without_display_dates:show_articles_without_display_dates,
905
+ archivable:archivable,
906
+ show_orphaned:show_orphaned
907
+ }
908
+ });
909
+ store.load();
910
+ advancedSearchWindow.close();
911
+ }
912
+ }
913
+ },{
914
+ text: 'Close',
915
+ handler: function(){
916
+ advancedSearchWindow.close();
917
+ }
918
+ }]
919
+ });
920
+ advancedSearchWindow.show();
921
+ }
922
+ }
923
+ );
924
+
925
+ config = Ext.apply({
926
+ title:'Articles',
927
+ columns:columnItems,
928
+ store:store,
929
+ tbar: tbarItems,
456
930
  bbar: new Ext.PagingToolbar({
457
- pageSize: 10,
458
931
  store: store,
459
932
  displayInfo: true,
460
933
  displayMsg: '{0} - {1} of {2}',