knitkit 2.1.15 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/controllers/knitkit/base_controller.rb +1 -1
- data/app/controllers/knitkit/comments_controller.rb +7 -2
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +78 -98
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +65 -45
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +22 -12
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +1 -1
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -16
- data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +15 -49
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +4 -3
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +69 -11
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +63 -60
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +98 -82
- data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +77 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +64 -44
- data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +147 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +81 -45
- data/app/controllers/knitkit/mobile_controller.rb +15 -0
- data/app/controllers/knitkit/online_document_sections_controller.rb +2 -1
- data/app/controllers/knitkit/unauthorized_controller.rb +0 -1
- data/app/controllers/knitkit/website_sections_controller.rb +7 -4
- data/app/mailers/website_inquiry_mailer.rb +8 -7
- data/app/models/content.rb +11 -2
- data/app/models/document.rb +2 -17
- data/app/models/published_website.rb +96 -59
- data/app/models/theme.rb +100 -14
- data/app/models/website.rb +260 -28
- data/app/models/website_inquiry.rb +5 -12
- data/app/models/website_section.rb +9 -1
- data/app/views/knitkit/blogs/_add_comment.html.erb +44 -23
- data/app/views/knitkit/blogs/_comment.html.erb +4 -6
- data/app/views/knitkit/blogs/index.html.erb +63 -49
- data/app/views/knitkit/blogs/show.html.erb +17 -12
- data/app/views/knitkit/mobile/index.html.erb +162 -0
- data/app/views/knitkit/online_document_sections/index.html.erb +7 -5
- data/app/views/knitkit/unauthorized/index.html.erb +8 -4
- data/app/views/knitkit/website_sections/index.html.erb +8 -4
- data/app/views/layouts/knitkit/base.html.erb +79 -63
- data/app/views/layouts/knitkit/online_document_sections.html.erb +74 -52
- data/app/views/menus/knitkit/_default_menu.html.erb +4 -4
- data/app/views/menus/knitkit/_default_section_menu.html.erb +22 -23
- data/app/views/shared/knitkit/_bread_crumb.html.erb +10 -7
- data/app/views/shared/knitkit/_footer.html.erb +2 -2
- data/app/views/website_inquiry_mailer/inquiry.erb +23 -2
- data/app/widgets/contact_us/base.rb +25 -50
- data/app/widgets/contact_us/javascript/contact_us.js +7 -7
- data/app/widgets/contact_us/views/error.html.erb +6 -8
- data/app/widgets/contact_us/views/index.html.erb +28 -1
- data/app/widgets/contact_us/views/layouts/base.html.erb +9 -6
- data/app/widgets/contact_us/views/success.html.erb +3 -3
- data/app/widgets/google_map/views/index.html.erb +36 -36
- data/app/widgets/login/base.rb +1 -0
- data/app/widgets/login/javascript/login.js +3 -3
- data/app/widgets/login/views/index.html.erb +46 -26
- data/app/widgets/login/views/layouts/base.html.erb +15 -13
- data/app/widgets/login/views/login_header.html.erb +7 -9
- data/app/widgets/manage_profile/base.rb +116 -164
- data/app/widgets/manage_profile/views/_address.html.erb +184 -0
- data/app/widgets/manage_profile/views/_contact_information_form.html.erb +23 -192
- data/app/widgets/manage_profile/views/_email_address.html.erb +163 -0
- data/app/widgets/manage_profile/views/_password_form.html.erb +23 -20
- data/app/widgets/manage_profile/views/_phone_number.html.erb +165 -0
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +49 -33
- data/app/widgets/manage_profile/views/error.html.erb +6 -0
- data/app/widgets/manage_profile/views/index.html.erb +44 -46
- data/app/widgets/manage_profile/views/layouts/base.html.erb +3 -1
- data/app/widgets/manage_profile/views/success.html.erb +5 -0
- data/app/widgets/reset_password/views/index.html.erb +33 -28
- data/app/widgets/reset_password/views/layouts/base.html.erb +10 -1
- data/app/widgets/search/base.rb +37 -25
- data/app/widgets/search/views/_inline_search_form.html.erb +12 -0
- data/app/widgets/search/views/_search_form.html.erb +41 -0
- data/app/widgets/search/views/index.html.erb +5 -3
- data/app/widgets/search/views/layouts/base.html.erb +13 -23
- data/app/widgets/search/views/show.html.erb +32 -47
- data/app/widgets/signup/base.rb +1 -1
- data/app/widgets/signup/javascript/signup.js +7 -9
- data/app/widgets/signup/views/_signup_form.html.erb +34 -29
- data/app/widgets/signup/views/error.html.erb +11 -11
- data/app/widgets/signup/views/index.html.erb +3 -2
- data/app/widgets/signup/views/layouts/base.html.erb +8 -5
- data/app/widgets/signup/views/success.html.erb +5 -4
- data/config/routes.rb +39 -28
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +3 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +0 -1
- data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +33 -0
- data/db/migrate/20140622212723_update_website_inquiries.rb +22 -0
- data/db/migrate/20140911185022_add_publishing_to_website.rb +5 -0
- data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +12 -0
- data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +13 -0
- data/lib/knitkit.rb +0 -1
- data/lib/knitkit/engine.rb +1 -0
- data/lib/knitkit/extensions.rb +4 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +33 -0
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +0 -12
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +7 -10
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +2 -4
- data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +4 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +16 -13
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +10 -8
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +123 -108
- data/lib/knitkit/extensions/will_paginate/link_renderer.rb +67 -0
- data/lib/knitkit/routing_filter/section_router.rb +10 -8
- data/lib/knitkit/syntax_validator.rb +2 -2
- data/lib/knitkit/version.rb +7 -3
- data/public/images/inline_edit/close.png +0 -0
- data/public/images/knitkit/close_window.png +0 -0
- data/public/images/knitkit/logo.png +0 -0
- data/public/images/knitkit/splash/images/add-site.png +0 -0
- data/public/images/knitkit/splash/images/adjust-site.png +0 -0
- data/public/images/knitkit/splash/images/browse-site.png +0 -0
- data/public/images/knitkit/splash/images/find-themes.png +0 -0
- data/public/images/knitkit/splash/images/settings.png +0 -0
- data/public/images/knitkit/splash/images/tutorials.png +0 -0
- data/public/images/knitkit/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +656 -627
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +444 -333
- data/public/javascripts/erp_app/desktop/applications/knitkit/{east_region.js → east_region/east_region.js} +33 -33
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +332 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +144 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +335 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/{widgets_panel.js → east_region/widgets_panel.js} +55 -55
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +150 -37
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +228 -96
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +89 -85
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +238 -217
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +59 -54
- data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +170 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +1168 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +71 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +301 -306
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +216 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +182 -153
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +48 -65
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +93 -94
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +523 -197
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +20 -34
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +74 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +245 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +360 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +348 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +106 -1132
- data/public/javascripts/knitkit/bootstrap-datepicker.js +474 -0
- data/public/javascripts/knitkit/bootstrap.min.js +7 -0
- data/public/javascripts/knitkit/confirm-bootstrap.js +110 -0
- data/public/javascripts/knitkit/inline_editing.js +73 -50
- data/public/javascripts/knitkit/jquery.maskedinput.min.js +7 -0
- data/public/javascripts/knitkit/mobile/app/view/Main.js +108 -0
- data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +734 -0
- data/public/javascripts/knitkit/theme.js +76 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +95 -35
- data/public/stylesheets/knitkit/bootstrap-responsive.min.css +10 -0
- data/public/stylesheets/knitkit/bootstrap.min.css +7 -0
- data/public/stylesheets/knitkit/custom.css +122 -0
- data/public/stylesheets/knitkit/datepicker.css +182 -0
- data/public/stylesheets/knitkit/inline_editing.css +58 -58
- data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/models/article_spec.rb +3 -3
- data/spec/models/content_spec.rb +9 -9
- data/spec/models/website_spec.rb +1 -1
- metadata +100 -114
- data/app/helpers/application_helper.rb +0 -134
- data/app/views/knitkit/articles/index.html.erb +0 -3
- data/app/views/knitkit/articles/show.html.erb +0 -4
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +0 -43
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +0 -47
- data/app/widgets/contact_us/views/_contact_form.html.erb +0 -36
- data/app/widgets/dynamic_forms/base.rb +0 -139
- data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +0 -110
- data/app/widgets/dynamic_forms/views/error.html.erb +0 -5
- data/app/widgets/dynamic_forms/views/index.html.erb +0 -8
- data/app/widgets/dynamic_forms/views/success.html.erb +0 -4
- data/app/widgets/dynamic_grid/base.rb +0 -130
- data/app/widgets/dynamic_grid/helpers/controller/dynamic_grid_controller_helper.rb +0 -3
- data/app/widgets/dynamic_grid/helpers/view/dynamic_grid_view_helper.rb +0 -3
- data/app/widgets/dynamic_grid/javascript/dynamic_grid.js +0 -177
- data/app/widgets/dynamic_grid/views/index.html.erb +0 -14
- data/app/widgets/login/views/reset_password.html.erb +0 -26
- data/app/widgets/manage_profile/views/default_type_error.html.erb +0 -5
- data/app/widgets/scaffold/base.rb +0 -87
- data/app/widgets/scaffold/helpers/controller/scaffold_controller_helper.rb +0 -3
- data/app/widgets/scaffold/helpers/view/scaffold_view_helper.rb +0 -3
- data/app/widgets/scaffold/javascript/scaffold.js +0 -337
- data/app/widgets/scaffold/views/index.html.erb +0 -15
- data/app/widgets/search/views/_search.html.erb +0 -39
- data/public/images/knitkit/bullet.png +0 -0
- data/public/images/knitkit/close.png +0 -0
- data/public/images/knitkit/content.png +0 -0
- data/public/images/knitkit/footer.png +0 -0
- data/public/images/knitkit/graphic.png +0 -0
- data/public/images/knitkit/greyFadeDown.png +0 -0
- data/public/images/knitkit/link.png +0 -0
- data/public/images/knitkit/menu.png +0 -0
- data/public/images/knitkit/menu_select.png +0 -0
- data/public/images/knitkit/search.png +0 -0
- data/public/images/knitkit/tooltip.gif +0 -0
- data/public/javascripts/ajax_pagination.js +0 -33
- data/public/javascripts/datepicker.js +0 -445
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +0 -341
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +0 -31
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +0 -263
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +0 -722
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +0 -585
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +0 -155
- data/public/javascripts/knitkit/helpers.js +0 -26
- data/public/stylesheets/datepicker.css +0 -121
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +0 -233
- data/public/stylesheets/knitkit/style.css +0 -426
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'will_paginate/view_helpers/action_view'
|
2
|
+
|
3
|
+
module Knitkit
|
4
|
+
module Extensions
|
5
|
+
module WillPaginate
|
6
|
+
class LinkRenderer < ::WillPaginate::ActionView::LinkRenderer
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def page_number(page)
|
11
|
+
unless page == current_page
|
12
|
+
tag(:li, link(page, page, :rel => rel_value(page)))
|
13
|
+
else
|
14
|
+
tag(
|
15
|
+
:li,
|
16
|
+
tag(:a, "#{page} #{tag(:span, '(current)', :class => 'sr-only')}"),
|
17
|
+
:class => 'active'
|
18
|
+
)
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def previous_page
|
24
|
+
num = @collection.current_page > 1 && @collection.current_page - 1
|
25
|
+
previous_or_next_page(num, '«')
|
26
|
+
end
|
27
|
+
|
28
|
+
def next_page
|
29
|
+
num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
|
30
|
+
previous_or_next_page(num, '»')
|
31
|
+
end
|
32
|
+
|
33
|
+
def previous_or_next_page(page, text)
|
34
|
+
if page
|
35
|
+
tag(:li, link(text, page))
|
36
|
+
else
|
37
|
+
tag(:li, link(text, 'javascript:void('');'), :class => 'disabled')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def html_container(html)
|
42
|
+
tag(:ul, html, :class => 'pagination')
|
43
|
+
end
|
44
|
+
|
45
|
+
def url(page)
|
46
|
+
@base_url_params ||= begin
|
47
|
+
url_params = merge_get_params(default_url_params)
|
48
|
+
merge_optional_params(url_params)
|
49
|
+
end
|
50
|
+
|
51
|
+
url_params = @base_url_params.dup
|
52
|
+
add_current_page_param(url_params, page)
|
53
|
+
|
54
|
+
if url_params[:scope]
|
55
|
+
scope = url_params[:scope]
|
56
|
+
url_params.delete(:scope)
|
57
|
+
|
58
|
+
scope.url_for(url_params)
|
59
|
+
else
|
60
|
+
@template.url_for(url_params)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end # LinkRenderer
|
65
|
+
end # WillPaginate
|
66
|
+
end # Extensions
|
67
|
+
end # Knitkit
|
@@ -8,9 +8,10 @@ module RoutingFilter
|
|
8
8
|
website = Website.find_by_host(env["HTTP_HOST"])
|
9
9
|
if website
|
10
10
|
paths = paths_for_website(website)
|
11
|
+
|
11
12
|
if path.to_sym == :/
|
12
13
|
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
|
+
valid_section = website.website_sections.detect { |website_section| website_section.path == home_page_url }
|
14
15
|
type = valid_section.type.pluralize.downcase
|
15
16
|
path.sub!('/', "/#{$1}#{type}/#{valid_section.id}#{$3}")
|
16
17
|
else
|
@@ -24,8 +25,8 @@ module RoutingFilter
|
|
24
25
|
end
|
25
26
|
yield
|
26
27
|
end
|
27
|
-
|
28
|
-
def around_generate(params, &block)
|
28
|
+
|
29
|
+
def around_generate(params, &block)
|
29
30
|
yield.tap do |path|
|
30
31
|
result = result.first if result.is_a?(Array)
|
31
32
|
if result !~ %r(^/([\w]{2,4}/)?admin) and result =~ generate_pattern
|
@@ -34,15 +35,15 @@ module RoutingFilter
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
37
|
-
|
38
|
+
|
38
39
|
protected
|
39
40
|
def paths_for_website(website)
|
40
|
-
website ? website.all_section_paths.map{|path| path[1..path.length]}.sort{|a, b| b.size <=> a.size }.join('|') : []
|
41
|
+
website ? website.all_section_paths.map { |path| path[1..path.length] }.sort { |a, b| b.size <=> a.size }.join('|') : []
|
41
42
|
end
|
42
43
|
|
43
44
|
def website_section_by_path(website, path)
|
44
45
|
path = "/#{path}"
|
45
|
-
valid_section = website.website_sections.detect{|website_section| website_section.path == path }
|
46
|
+
valid_section = website.website_sections.detect { |website_section| website_section.path == path }
|
46
47
|
if valid_section.nil?
|
47
48
|
website.website_sections.each do |website_section|
|
48
49
|
valid_section = website_section.child_by_path(path)
|
@@ -58,8 +59,9 @@ module RoutingFilter
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def generate_pattern
|
61
|
-
types = WebsiteSection.types.map{|type| type.downcase.pluralize }.join('|')
|
62
|
+
types = WebsiteSection.types.map { |type| type.downcase.pluralize }.join('|')
|
62
63
|
%r((#{types})/([\w]+(/?))(\.?)) # ?(?=\b)?
|
63
64
|
end
|
65
|
+
|
64
66
|
end
|
65
|
-
end
|
67
|
+
end
|
data/lib/knitkit/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,681 +1,710 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel",{
|
2
|
-
|
3
|
-
|
4
|
-
deleteArticle : function(id){
|
5
|
-
var self = this;
|
6
|
-
this.initialConfig['centerRegion'].setWindowStatus('Deleting...');
|
7
|
-
Ext.Ajax.request({
|
8
|
-
url: '/knitkit/erp_app/desktop/articles/delete',
|
9
|
-
method: 'POST',
|
10
|
-
params:{id:id},
|
11
|
-
success: function(response) {
|
12
|
-
var obj = Ext.decode(response.responseText);
|
13
|
-
if(obj.success){
|
14
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
15
|
-
self.getStore().load();
|
16
|
-
}
|
17
|
-
else{
|
18
|
-
Ext.Msg.alert('Error', 'Error deleting Article');
|
19
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
20
|
-
}
|
21
|
-
},
|
22
|
-
failure: function(response) {
|
23
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
24
|
-
Ext.Msg.alert('Error', 'Error deleting Article');
|
25
|
-
}
|
26
|
-
});
|
27
|
-
},
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ArticlesGridPanel", {
|
2
|
+
extend: "Ext.grid.Panel",
|
3
|
+
alias: 'widget.knitkit_articlesgridpanel',
|
28
4
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
// minimizable:true,
|
41
|
-
plain: true,
|
42
|
-
buttonAlign:'center',
|
43
|
-
items: {
|
44
|
-
xtype: 'form',
|
45
|
-
labelWidth: 110,
|
46
|
-
frame:false,
|
47
|
-
bodyStyle:'padding:5px 5px 0',
|
48
|
-
width: 425,
|
49
|
-
url:'/knitkit/erp_app/desktop/articles/update/',
|
50
|
-
defaults: {width: 225},
|
51
|
-
items: [
|
52
|
-
{
|
53
|
-
xtype:'textfield',
|
54
|
-
fieldLabel:'Title',
|
55
|
-
allowBlank:false,
|
56
|
-
name:'title',
|
57
|
-
value: record.data.title
|
58
|
-
},
|
59
|
-
{
|
60
|
-
xtype:'radiogroup',
|
61
|
-
fieldLabel:'Display title?',
|
62
|
-
name:'display_title',
|
63
|
-
columns:2,
|
64
|
-
items:[
|
65
|
-
{
|
66
|
-
boxLabel:'Yes',
|
67
|
-
name:'display_title',
|
68
|
-
inputValue: 'yes',
|
69
|
-
checked:record.data.display_title
|
70
|
-
},
|
71
|
-
|
72
|
-
{
|
73
|
-
boxLabel:'No',
|
74
|
-
name:'display_title',
|
75
|
-
inputValue:'no',
|
76
|
-
checked:!record.data.display_title
|
77
|
-
}]
|
78
|
-
},
|
79
|
-
{
|
80
|
-
xtype:'textfield',
|
81
|
-
fieldLabel:'Internal ID',
|
82
|
-
allowBlank:true,
|
83
|
-
name:'internal_identifier',
|
84
|
-
value: record.data.internal_identifier
|
85
|
-
},
|
86
|
-
{
|
87
|
-
xtype:'textfield',
|
88
|
-
fieldLabel:'Tags',
|
89
|
-
allowBlank:true,
|
90
|
-
name:'tags',
|
91
|
-
itemId: 'tag_list',
|
92
|
-
value: record.data.tag_list
|
93
|
-
},
|
94
|
-
{
|
95
|
-
xtype: 'displayfield',
|
96
|
-
fieldLabel: 'Created At',
|
97
|
-
name: 'created_at',
|
98
|
-
value: record.data.created_at
|
99
|
-
},
|
100
|
-
{
|
101
|
-
xtype: 'displayfield',
|
102
|
-
fieldLabel: 'Updated At',
|
103
|
-
name: 'updated_at',
|
104
|
-
value: record.data.updated_at
|
105
|
-
},
|
106
|
-
{
|
107
|
-
xtype:'hidden',
|
108
|
-
allowBlank:false,
|
109
|
-
name:'id',
|
110
|
-
itemId: 'record_id',
|
111
|
-
value: record.data.id
|
112
|
-
}
|
113
|
-
]
|
114
|
-
},
|
115
|
-
buttons: [{
|
116
|
-
text:'Submit',
|
117
|
-
listeners:{
|
118
|
-
'click':function(button){
|
119
|
-
var window = button.findParentByType('window');
|
120
|
-
var formPanel = window.query('form')[0];
|
121
|
-
self.initialConfig['centerRegion'].setWindowStatus('Updating article...');
|
122
|
-
formPanel.getForm().submit({
|
123
|
-
reset:false,
|
124
|
-
success:function(form, action){
|
125
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
126
|
-
var obj = Ext.decode(action.response.responseText);
|
127
|
-
if(obj.success){
|
5
|
+
deleteArticle: function (id) {
|
6
|
+
var self = this;
|
7
|
+
this.initialConfig['centerRegion'].setWindowStatus('Deleting...');
|
8
|
+
Ext.Ajax.request({
|
9
|
+
url: '/knitkit/erp_app/desktop/articles/delete',
|
10
|
+
method: 'POST',
|
11
|
+
params: {id: id},
|
12
|
+
success: function (response) {
|
13
|
+
var obj = Ext.decode(response.responseText);
|
14
|
+
if (obj.success) {
|
15
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
128
16
|
self.getStore().load();
|
129
|
-
if(formPanel.getForm().findField('tag_list')){
|
130
|
-
var tag_list = formPanel.getForm().findField('tag_list').getValue();
|
131
|
-
record.set('tag_list', tag_list);
|
132
|
-
}
|
133
|
-
editArticleWindow.close();
|
134
|
-
}
|
135
|
-
else{
|
136
|
-
Ext.Msg.alert("Error", obj.msg);
|
137
|
-
}
|
138
|
-
},
|
139
|
-
failure:function(form, action){
|
140
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
141
|
-
Ext.Msg.alert("Error", "Error updating article");
|
142
17
|
}
|
143
|
-
|
18
|
+
else {
|
19
|
+
Ext.Msg.alert('Error', 'Error deleting Article');
|
20
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
21
|
+
}
|
22
|
+
},
|
23
|
+
failure: function (response) {
|
24
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
25
|
+
Ext.Msg.alert('Error', 'Error deleting Article');
|
144
26
|
}
|
145
|
-
|
146
|
-
|
147
|
-
text: 'Close',
|
148
|
-
handler: function(){
|
149
|
-
editArticleWindow.close();
|
150
|
-
}
|
151
|
-
}]
|
152
|
-
});
|
153
|
-
}
|
154
|
-
editArticleWindow.show();
|
155
|
-
},
|
27
|
+
});
|
28
|
+
},
|
156
29
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
30
|
+
editArticle: function (record) {
|
31
|
+
var self = this;
|
32
|
+
var itemId = 'editArticle-' + record.get('id');
|
33
|
+
var editArticleWindow = Ext.ComponentQuery.query('#' + itemId).first();
|
161
34
|
|
162
|
-
|
163
|
-
|
35
|
+
if (Compass.ErpApp.Utility.isBlank(editArticleWindow)) {
|
36
|
+
var editArticleWindow = Ext.create("Ext.window.Window", {
|
37
|
+
layout: 'fit',
|
38
|
+
width: 375,
|
39
|
+
title: 'Edit Article',
|
40
|
+
itemId: itemId,
|
41
|
+
// minimizable:true,
|
42
|
+
plain: true,
|
43
|
+
buttonAlign: 'center',
|
44
|
+
items: {
|
45
|
+
xtype: 'form',
|
46
|
+
labelWidth: 110,
|
47
|
+
frame: false,
|
48
|
+
bodyStyle: 'padding:5px 5px 0',
|
49
|
+
width: 425,
|
50
|
+
url: '/knitkit/erp_app/desktop/articles/update/',
|
51
|
+
defaults: {width: 225},
|
52
|
+
items: [
|
53
|
+
{
|
54
|
+
xtype: 'textfield',
|
55
|
+
fieldLabel: 'Title',
|
56
|
+
allowBlank: false,
|
57
|
+
name: 'title',
|
58
|
+
value: record.data.title
|
59
|
+
},
|
60
|
+
{
|
61
|
+
xtype: 'radiogroup',
|
62
|
+
fieldLabel: 'Display title?',
|
63
|
+
name: 'display_title',
|
64
|
+
columns: 2,
|
65
|
+
items: [
|
66
|
+
{
|
67
|
+
boxLabel: 'Yes',
|
68
|
+
name: 'display_title',
|
69
|
+
inputValue: 'yes',
|
70
|
+
checked: record.data.display_title
|
71
|
+
},
|
164
72
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
73
|
+
{
|
74
|
+
boxLabel: 'No',
|
75
|
+
name: 'display_title',
|
76
|
+
inputValue: 'no',
|
77
|
+
checked: !record.data.display_title
|
78
|
+
}
|
79
|
+
]
|
80
|
+
},
|
81
|
+
{
|
82
|
+
xtype: 'textfield',
|
83
|
+
fieldLabel: 'Internal ID',
|
84
|
+
allowBlank: true,
|
85
|
+
name: 'internal_identifier',
|
86
|
+
value: record.data.internal_identifier
|
87
|
+
},
|
88
|
+
{
|
89
|
+
xtype: 'textfield',
|
90
|
+
fieldLabel: 'Tags',
|
91
|
+
allowBlank: true,
|
92
|
+
name: 'tags',
|
93
|
+
itemId: 'tag_list',
|
94
|
+
value: record.data.tag_list
|
95
|
+
},
|
96
|
+
{
|
97
|
+
xtype: 'displayfield',
|
98
|
+
fieldLabel: 'Created At',
|
99
|
+
name: 'created_at',
|
100
|
+
value: record.data.created_at
|
101
|
+
},
|
102
|
+
{
|
103
|
+
xtype: 'displayfield',
|
104
|
+
fieldLabel: 'Updated At',
|
105
|
+
name: 'updated_at',
|
106
|
+
value: record.data.updated_at
|
107
|
+
},
|
108
|
+
{
|
109
|
+
xtype: 'hidden',
|
110
|
+
allowBlank: false,
|
111
|
+
name: 'id',
|
112
|
+
itemId: 'record_id',
|
113
|
+
value: record.data.id
|
114
|
+
}
|
115
|
+
]
|
116
|
+
},
|
117
|
+
buttons: [
|
118
|
+
{
|
119
|
+
text: 'Submit',
|
120
|
+
listeners: {
|
121
|
+
'click': function (button) {
|
122
|
+
var window = button.findParentByType('window');
|
123
|
+
var formPanel = window.query('form')[0];
|
124
|
+
self.initialConfig['centerRegion'].setWindowStatus('Updating article...');
|
125
|
+
formPanel.getForm().submit({
|
126
|
+
reset: false,
|
127
|
+
success: function (form, action) {
|
128
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
129
|
+
var obj = Ext.decode(action.response.responseText);
|
130
|
+
if (obj.success) {
|
131
|
+
self.getStore().load();
|
132
|
+
if (formPanel.getForm().findField('tag_list')) {
|
133
|
+
var tag_list = formPanel.getForm().findField('tag_list').getValue();
|
134
|
+
record.set('tag_list', tag_list);
|
135
|
+
}
|
136
|
+
editArticleWindow.close();
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
Ext.Msg.alert("Error", obj.msg);
|
140
|
+
}
|
141
|
+
},
|
142
|
+
failure: function (form, action) {
|
143
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
144
|
+
Ext.Msg.alert("Error", "Error updating article");
|
145
|
+
}
|
146
|
+
});
|
147
|
+
}
|
148
|
+
}
|
149
|
+
},
|
150
|
+
{
|
151
|
+
text: 'Close',
|
152
|
+
handler: function () {
|
153
|
+
editArticleWindow.close();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
]
|
157
|
+
});
|
158
|
+
}
|
159
|
+
editArticleWindow.show();
|
160
|
+
},
|
188
161
|
|
189
|
-
|
162
|
+
initComponent: function () {
|
163
|
+
this.callParent(arguments);
|
164
|
+
this.getStore().load();
|
165
|
+
},
|
190
166
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
},
|
212
|
-
|
213
|
-
|
214
|
-
}
|
215
|
-
|
167
|
+
constructor: function (config) {
|
168
|
+
var self = this;
|
169
|
+
|
170
|
+
// create the Data Store
|
171
|
+
var store = Ext.create('Ext.data.Store', {
|
172
|
+
storeId: 'knitkit_articlesgridpanelStore',
|
173
|
+
pageSize: 20,
|
174
|
+
proxy: {
|
175
|
+
type: 'ajax',
|
176
|
+
url: '/knitkit/erp_app/desktop/articles/all/',
|
177
|
+
reader: {type: 'json', root: 'data'}
|
178
|
+
},
|
179
|
+
remoteSort: true,
|
180
|
+
fields: [
|
181
|
+
{name: 'id'},
|
182
|
+
{name: 'title'},
|
183
|
+
{name: 'tag_list'},
|
184
|
+
{name: 'excerpt_html'},
|
185
|
+
{name: 'body_html'},
|
186
|
+
{name: 'sections'},
|
187
|
+
{name: 'internal_identifier'},
|
188
|
+
{name: 'display_title'},
|
189
|
+
{name: 'created_at'},
|
190
|
+
{name: 'updated_at'}
|
191
|
+
]
|
216
192
|
});
|
217
193
|
|
218
|
-
|
219
|
-
|
220
|
-
|
194
|
+
var columnItems = [];
|
195
|
+
|
196
|
+
columnItems.push(
|
197
|
+
{
|
198
|
+
header: 'Title',
|
199
|
+
sortable: true,
|
200
|
+
dataIndex: 'title',
|
201
|
+
width: 110,
|
202
|
+
editable: false
|
203
|
+
},
|
221
204
|
{
|
222
|
-
menuDisabled:true,
|
223
|
-
resizable:false,
|
224
|
-
xtype:'actioncolumn',
|
225
|
-
header:'
|
226
|
-
align:'center',
|
227
|
-
|
228
|
-
items:[
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
205
|
+
menuDisabled: true,
|
206
|
+
resizable: false,
|
207
|
+
xtype: 'actioncolumn',
|
208
|
+
header: 'Sections',
|
209
|
+
align: 'center',
|
210
|
+
flex: 1,
|
211
|
+
items: [
|
212
|
+
{
|
213
|
+
iconCls: 'actioncolumn_hover',
|
214
|
+
getClass: function (v, meta, rec) { // Or return a class from a function
|
215
|
+
this.items[0].tooltip = rec.get('sections');
|
216
|
+
return 'info-col';
|
217
|
+
},
|
218
|
+
handler: function (grid, rowIndex, colIndex) {
|
219
|
+
return true;
|
220
|
+
}
|
235
221
|
}
|
236
|
-
|
222
|
+
]
|
237
223
|
});
|
224
|
+
|
225
|
+
if (currentUser.hasCapability('edit', 'Content')) {
|
226
|
+
columnItems.push(
|
227
|
+
{
|
228
|
+
menuDisabled: true,
|
229
|
+
resizable: false,
|
230
|
+
xtype: 'actioncolumn',
|
231
|
+
header: 'Edit',
|
232
|
+
align: 'center',
|
233
|
+
flex: 1,
|
234
|
+
items: [
|
235
|
+
{
|
236
|
+
icon: '/images/icons/edit/edit_16x16.png',
|
237
|
+
iconCls: 'actioncolumn_hover',
|
238
|
+
tooltip: 'Edit',
|
239
|
+
handler: function (grid, rowIndex, colIndex) {
|
240
|
+
var rec = grid.getStore().getAt(rowIndex);
|
241
|
+
self.editArticle(rec);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
]
|
245
|
+
});
|
238
246
|
}
|
239
247
|
|
240
248
|
columnItems.push(
|
241
|
-
{
|
242
|
-
menuDisabled:true,
|
243
|
-
resizable:false,
|
244
|
-
xtype:'actioncolumn',
|
245
|
-
header:'Comments',
|
246
|
-
align:'center',
|
247
|
-
width:60,
|
248
|
-
items:[{
|
249
|
-
icon:'/images/icons/document_text/document_text_16x16.png',
|
250
|
-
iconCls:'actioncolumn_hover',
|
251
|
-
tooltip:'Comments',
|
252
|
-
handler :function(grid, rowIndex, colIndex){
|
253
|
-
var rec = grid.getStore().getAt(rowIndex);
|
254
|
-
self.initialConfig['centerRegion'].viewContentComments(rec.get('id'), rec.get('title') + ' - Comments');
|
255
|
-
}
|
256
|
-
}]
|
257
|
-
});
|
258
|
-
|
259
|
-
if (currentUser.hasCapability('edit_excerpt','Content'))
|
260
|
-
{
|
261
|
-
columnItems.push(
|
262
249
|
{
|
263
|
-
menuDisabled:true,
|
264
|
-
resizable:false,
|
265
|
-
xtype:'actioncolumn',
|
266
|
-
header:'
|
267
|
-
align:'center',
|
268
|
-
|
269
|
-
items:[
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
250
|
+
menuDisabled: true,
|
251
|
+
resizable: false,
|
252
|
+
xtype: 'actioncolumn',
|
253
|
+
header: 'Comments',
|
254
|
+
align: 'center',
|
255
|
+
flex: 1,
|
256
|
+
items: [
|
257
|
+
{
|
258
|
+
icon: '/images/icons/document_text/document_text_16x16.png',
|
259
|
+
iconCls: 'actioncolumn_hover',
|
260
|
+
tooltip: 'Comments',
|
261
|
+
handler: function (grid, rowIndex, colIndex) {
|
262
|
+
var rec = grid.getStore().getAt(rowIndex);
|
263
|
+
self.initialConfig['centerRegion'].viewContentComments(rec.get('id'), rec.get('title') + ' - Comments');
|
264
|
+
grid.up('window').close();
|
265
|
+
}
|
276
266
|
}
|
277
|
-
|
267
|
+
]
|
278
268
|
});
|
269
|
+
|
270
|
+
if (currentUser.hasCapability('edit_excerpt', 'Content')) {
|
271
|
+
columnItems.push(
|
272
|
+
{
|
273
|
+
menuDisabled: true,
|
274
|
+
resizable: false,
|
275
|
+
xtype: 'actioncolumn',
|
276
|
+
header: 'Excerpt',
|
277
|
+
align: 'center',
|
278
|
+
flex: 1,
|
279
|
+
items: [
|
280
|
+
{
|
281
|
+
icon: '/images/icons/edit/edit_16x16.png',
|
282
|
+
iconCls: 'actioncolumn_hover',
|
283
|
+
tooltip: 'Edit Excerpt',
|
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
|
+
grid.up('window').close();
|
288
|
+
}
|
289
|
+
}
|
290
|
+
]
|
291
|
+
});
|
279
292
|
}
|
280
293
|
|
281
294
|
columnItems.push(
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
295
|
+
{
|
296
|
+
menuDisabled: true,
|
297
|
+
resizable: false,
|
298
|
+
xtype: 'actioncolumn',
|
299
|
+
header: 'HTML',
|
300
|
+
align: 'center',
|
301
|
+
flex: 1,
|
302
|
+
items: [
|
303
|
+
{
|
304
|
+
icon: '/images/icons/edit/edit_16x16.png',
|
305
|
+
iconCls: 'actioncolumn_hover',
|
306
|
+
tooltip: 'Edit Content',
|
307
|
+
handler: function (grid, rowIndex, colIndex) {
|
308
|
+
var rec = grid.getStore().getAt(rowIndex);
|
309
|
+
self.initialConfig['centerRegion'].editContent(rec.get('title'), rec.get('id'), rec.get('body_html'), null, 'blog');
|
310
|
+
grid.up('window').close();
|
311
|
+
}
|
312
|
+
}
|
313
|
+
]
|
314
|
+
});
|
299
315
|
|
300
|
-
if (currentUser.hasCapability('delete','Content'))
|
301
|
-
{
|
316
|
+
if (currentUser.hasCapability('delete', 'Content')) {
|
302
317
|
columnItems.push(
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
318
|
+
{
|
319
|
+
menuDisabled: true,
|
320
|
+
resizable: false,
|
321
|
+
xtype: 'actioncolumn',
|
322
|
+
header: 'Delete',
|
323
|
+
align: 'center',
|
324
|
+
flex: 1,
|
325
|
+
items: [
|
326
|
+
{
|
327
|
+
icon: '/images/icons/delete/delete_16x16.png',
|
328
|
+
iconCls: 'actioncolumn_hover',
|
329
|
+
tooltip: 'Delete',
|
330
|
+
handler: function (grid, rowIndex, colIndex) {
|
331
|
+
var rec = grid.getStore().getAt(rowIndex);
|
332
|
+
var id = rec.get('id');
|
333
|
+
Ext.MessageBox.confirm(
|
334
|
+
'Confirm', 'Are you sure?',
|
335
|
+
function (btn) {
|
336
|
+
if (btn == 'yes') {
|
337
|
+
self.deleteArticle(id);
|
338
|
+
}
|
339
|
+
}
|
340
|
+
);
|
323
341
|
}
|
324
|
-
|
325
|
-
|
326
|
-
}
|
327
|
-
}
|
342
|
+
}
|
343
|
+
]
|
344
|
+
}
|
328
345
|
);
|
329
346
|
}
|
330
347
|
|
331
348
|
var tbarItems = [];
|
332
349
|
|
333
|
-
if (currentUser.hasCapability('create','Content'))
|
334
|
-
{
|
350
|
+
if (currentUser.hasCapability('create', 'Content')) {
|
335
351
|
tbarItems.push(
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
inputValue: 'yes',
|
370
|
-
checked:true
|
371
|
-
},
|
352
|
+
{
|
353
|
+
text: 'New Article',
|
354
|
+
iconCls: 'icon-add',
|
355
|
+
handler: function () {
|
356
|
+
Ext.create('widget.window', {
|
357
|
+
title: 'New Article',
|
358
|
+
buttonAlign: 'center',
|
359
|
+
items: new Ext.FormPanel({
|
360
|
+
labelWidth: 110,
|
361
|
+
frame: false,
|
362
|
+
bodyStyle: 'padding:5px 5px 0',
|
363
|
+
width: 425,
|
364
|
+
url: '/knitkit/erp_app/desktop/articles/new/',
|
365
|
+
defaults: {width: 257},
|
366
|
+
items: [
|
367
|
+
{
|
368
|
+
xtype: 'textfield',
|
369
|
+
fieldLabel: 'Title',
|
370
|
+
allowBlank: false,
|
371
|
+
name: 'title'
|
372
|
+
},
|
373
|
+
{
|
374
|
+
xtype: 'radiogroup',
|
375
|
+
fieldLabel: 'Display title?',
|
376
|
+
name: 'display_title',
|
377
|
+
columns: 2,
|
378
|
+
items: [
|
379
|
+
{
|
380
|
+
boxLabel: 'Yes',
|
381
|
+
name: 'display_title',
|
382
|
+
inputValue: 'yes',
|
383
|
+
checked: true
|
384
|
+
},
|
372
385
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
}]
|
378
|
-
},
|
379
|
-
{
|
380
|
-
xtype:'textfield',
|
381
|
-
fieldLabel:'Internal ID',
|
382
|
-
allowBlank:true,
|
383
|
-
name:'internal_identifier'
|
384
|
-
},
|
385
|
-
{
|
386
|
-
xtype:'textfield',
|
387
|
-
fieldLabel:'Tags',
|
388
|
-
allowBlank:true,
|
389
|
-
name:'tags'
|
390
|
-
// id: 'tag_list'
|
391
|
-
}]
|
392
|
-
}),
|
393
|
-
buttons: [{
|
394
|
-
text:'Submit',
|
395
|
-
listeners:{
|
396
|
-
'click':function(button){
|
397
|
-
var window = button.findParentByType('window');
|
398
|
-
var formPanel = window.query('form')[0];
|
399
|
-
self.initialConfig['centerRegion'].setWindowStatus('Creating article...');
|
400
|
-
formPanel.getForm().submit({
|
401
|
-
reset:true,
|
402
|
-
success:function(form, action){
|
403
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
404
|
-
var obj = Ext.decode(action.response.responseText);
|
405
|
-
if(obj.success){
|
406
|
-
self.getStore().load();
|
407
|
-
}
|
408
|
-
else{
|
409
|
-
Ext.Msg.alert("Error", obj.msg);
|
386
|
+
{
|
387
|
+
boxLabel: 'No',
|
388
|
+
name: 'display_title',
|
389
|
+
inputValue: 'no'
|
410
390
|
}
|
411
|
-
|
391
|
+
]
|
392
|
+
},
|
393
|
+
{
|
394
|
+
xtype: 'textfield',
|
395
|
+
fieldLabel: 'Internal ID',
|
396
|
+
allowBlank: true,
|
397
|
+
name: 'internal_identifier'
|
398
|
+
},
|
399
|
+
{
|
400
|
+
xtype: 'textfield',
|
401
|
+
fieldLabel: 'Tags',
|
402
|
+
allowBlank: true,
|
403
|
+
name: 'tags'
|
404
|
+
// id: 'tag_list'
|
405
|
+
}
|
406
|
+
]
|
407
|
+
}),
|
408
|
+
buttons: [
|
409
|
+
{
|
410
|
+
text: 'Submit',
|
411
|
+
listeners: {
|
412
|
+
'click': function (button) {
|
413
|
+
var window = button.findParentByType('window');
|
414
|
+
var formPanel = window.query('form')[0];
|
415
|
+
self.initialConfig['centerRegion'].setWindowStatus('Creating article...');
|
416
|
+
formPanel.getForm().submit({
|
417
|
+
reset: true,
|
418
|
+
success: function (form, action) {
|
419
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
420
|
+
var obj = Ext.decode(action.response.responseText);
|
421
|
+
if (obj.success) {
|
422
|
+
self.getStore().load();
|
423
|
+
}
|
424
|
+
else {
|
425
|
+
Ext.Msg.alert("Error", obj.msg);
|
426
|
+
}
|
427
|
+
addArticleWindow.close();
|
412
428
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
429
|
+
},
|
430
|
+
failure: function (form, action) {
|
431
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
432
|
+
Ext.Msg.alert("Error", "Error creating article");
|
433
|
+
}
|
434
|
+
});
|
417
435
|
}
|
418
|
-
}
|
436
|
+
}
|
437
|
+
},
|
438
|
+
{
|
439
|
+
text: 'Close',
|
440
|
+
handler: function () {
|
441
|
+
addArticleWindow.close();
|
442
|
+
}
|
419
443
|
}
|
420
|
-
|
421
|
-
}
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
}
|
426
|
-
}]
|
427
|
-
});
|
428
|
-
addArticleWindow.show();
|
429
|
-
}
|
430
|
-
},'|');
|
444
|
+
]
|
445
|
+
});
|
446
|
+
addArticleWindow.show();
|
447
|
+
}
|
448
|
+
}, '|');
|
431
449
|
}
|
432
450
|
|
433
451
|
tbarItems.push(
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
},
|
454
|
-
extraParams:{iid:iid}
|
455
|
-
});
|
456
|
-
store.load();
|
457
|
-
}
|
458
|
-
},
|
459
|
-
{
|
460
|
-
text: 'Advanced',
|
461
|
-
iconCls: 'icon-search',
|
462
|
-
handler: function(){
|
463
|
-
var advancedSearchWindow = new Ext.Window({
|
464
|
-
layout:'fit',
|
465
|
-
width:375,
|
466
|
-
title:'Advanced Search',
|
467
|
-
plain: true,
|
468
|
-
buttonAlign:'center',
|
469
|
-
items: new Ext.FormPanel({
|
470
|
-
labelWidth: 110,
|
471
|
-
frame:false,
|
472
|
-
bodyStyle:'padding:5px 5px 0',
|
473
|
-
width: 425,
|
474
|
-
defaults: {width: 257},
|
475
|
-
items:[
|
476
|
-
{
|
477
|
-
xtype:'textfield',
|
478
|
-
fieldLabel:'Title',
|
479
|
-
allowBlank:true,
|
480
|
-
name:'title',
|
481
|
-
id:'global_article_advanced_search_title'
|
482
|
-
},
|
483
|
-
{
|
484
|
-
xtype:'textfield',
|
485
|
-
fieldLabel:'Content',
|
486
|
-
allowBlank:true,
|
487
|
-
name:'content',
|
488
|
-
id:'global_article_advanced_search_content'
|
489
|
-
},
|
490
|
-
{
|
491
|
-
xtype:'fieldset',
|
492
|
-
border: false,
|
493
|
-
autoHeight: true,
|
494
|
-
title:'Created Between',
|
495
|
-
items: [{
|
496
|
-
xtype:'datefield',
|
497
|
-
fieldLabel: "Start",
|
498
|
-
name: 'created_start_date',
|
499
|
-
allowBlank:true,
|
500
|
-
width: 230,
|
501
|
-
id:'global_article_advanced_search_created_start_date'
|
502
|
-
},
|
503
|
-
{
|
504
|
-
xtype:'datefield',
|
505
|
-
fieldLabel: "End",
|
506
|
-
name: 'created_end_date',
|
507
|
-
allowBlank:true,
|
508
|
-
width: 230,
|
509
|
-
id:'global_article_advanced_search_created_end_date'
|
510
|
-
}]
|
511
|
-
},
|
512
|
-
{
|
513
|
-
xtype:'fieldset',
|
514
|
-
border: false,
|
515
|
-
autoHeight: true,
|
516
|
-
title:'Last Updated Between',
|
517
|
-
items: [{
|
518
|
-
xtype:'datefield',
|
519
|
-
fieldLabel: "Start",
|
520
|
-
name: 'updated_start_date',
|
521
|
-
allowBlank:true,
|
522
|
-
width: 230,
|
523
|
-
id:'global_article_advanced_search_updated_start_date'
|
524
|
-
},
|
525
|
-
{
|
526
|
-
xtype:'datefield',
|
527
|
-
fieldLabel: "End",
|
528
|
-
name: 'updated_end_date',
|
529
|
-
allowBlank:true,
|
530
|
-
width: 230,
|
531
|
-
id:'global_article_advanced_search_updated_end_date'
|
532
|
-
}]
|
452
|
+
{
|
453
|
+
xtype: 'textfield',
|
454
|
+
hideLabel: true,
|
455
|
+
id: 'global_article_search_field',
|
456
|
+
width: 300
|
457
|
+
},
|
458
|
+
{
|
459
|
+
text: 'Search',
|
460
|
+
iconCls: 'icon-search',
|
461
|
+
handler: function (button) {
|
462
|
+
var iid = Ext.getCmp('global_article_search_field').getValue();
|
463
|
+
store.setProxy({
|
464
|
+
type: 'ajax',
|
465
|
+
url: '/knitkit/erp_app/desktop/articles/all/',
|
466
|
+
reader: {
|
467
|
+
type: 'json',
|
468
|
+
root: 'data',
|
469
|
+
idProperty: 'id',
|
470
|
+
totalProperty: 'total'
|
533
471
|
},
|
534
|
-
{
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
id:'global_article_advanced_search_viewable_end_date'
|
554
|
-
},
|
555
|
-
{
|
556
|
-
xtype:'radiogroup',
|
557
|
-
fieldLabel:'Show Articles Without Display Dates?',
|
558
|
-
columns:2,
|
559
|
-
id:'global_article_advanced_search_show_articles_without_display_dates',
|
560
|
-
items:[
|
472
|
+
extraParams: {iid: iid}
|
473
|
+
});
|
474
|
+
store.load();
|
475
|
+
}
|
476
|
+
},
|
477
|
+
{
|
478
|
+
text: 'Advanced',
|
479
|
+
iconCls: 'icon-search',
|
480
|
+
handler: function () {
|
481
|
+
Ext.create('widget.window', {
|
482
|
+
title: 'Advanced Search',
|
483
|
+
buttonAlign: 'center',
|
484
|
+
items: Ext.create('widget.form', {
|
485
|
+
labelWidth: 110,
|
486
|
+
frame: false,
|
487
|
+
bodyStyle: 'padding:5px 5px 0',
|
488
|
+
width: 425,
|
489
|
+
defaults: {width: 257},
|
490
|
+
items: [
|
561
491
|
{
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
492
|
+
xtype: 'textfield',
|
493
|
+
fieldLabel: 'Title',
|
494
|
+
allowBlank: true,
|
495
|
+
name: 'title',
|
496
|
+
id: 'global_article_advanced_search_title'
|
566
497
|
},
|
567
498
|
{
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
499
|
+
xtype: 'textfield',
|
500
|
+
fieldLabel: 'Content',
|
501
|
+
allowBlank: true,
|
502
|
+
name: 'content',
|
503
|
+
id: 'global_article_advanced_search_content'
|
504
|
+
},
|
505
|
+
{
|
506
|
+
xtype: 'fieldset',
|
507
|
+
border: false,
|
508
|
+
autoHeight: true,
|
509
|
+
title: 'Created Between',
|
510
|
+
items: [
|
511
|
+
{
|
512
|
+
xtype: 'datefield',
|
513
|
+
fieldLabel: "Start",
|
514
|
+
name: 'created_start_date',
|
515
|
+
allowBlank: true,
|
516
|
+
width: 230,
|
517
|
+
id: 'global_article_advanced_search_created_start_date'
|
518
|
+
},
|
519
|
+
{
|
520
|
+
xtype: 'datefield',
|
521
|
+
fieldLabel: "End",
|
522
|
+
name: 'created_end_date',
|
523
|
+
allowBlank: true,
|
524
|
+
width: 230,
|
525
|
+
id: 'global_article_advanced_search_created_end_date'
|
526
|
+
}
|
527
|
+
]
|
528
|
+
},
|
529
|
+
{
|
530
|
+
xtype: 'fieldset',
|
531
|
+
border: false,
|
532
|
+
autoHeight: true,
|
533
|
+
title: 'Last Updated Between',
|
534
|
+
items: [
|
535
|
+
{
|
536
|
+
xtype: 'datefield',
|
537
|
+
fieldLabel: "Start",
|
538
|
+
name: 'updated_start_date',
|
539
|
+
allowBlank: true,
|
540
|
+
width: 230,
|
541
|
+
id: 'global_article_advanced_search_updated_start_date'
|
542
|
+
},
|
543
|
+
{
|
544
|
+
xtype: 'datefield',
|
545
|
+
fieldLabel: "End",
|
546
|
+
name: 'updated_end_date',
|
547
|
+
allowBlank: true,
|
548
|
+
width: 230,
|
549
|
+
id: 'global_article_advanced_search_updated_end_date'
|
550
|
+
}
|
551
|
+
]
|
552
|
+
},
|
553
|
+
{
|
554
|
+
xtype: 'fieldset',
|
555
|
+
border: false,
|
556
|
+
autoHeight: true,
|
557
|
+
title: 'Viewable Between',
|
558
|
+
items: [
|
559
|
+
{
|
560
|
+
xtype: 'datefield',
|
561
|
+
fieldLabel: "Start",
|
562
|
+
name: 'viewable_start_date',
|
563
|
+
allowBlank: true,
|
564
|
+
width: 230,
|
565
|
+
id: 'global_article_advanced_search_viewable_start_date'
|
566
|
+
},
|
567
|
+
{
|
568
|
+
xtype: 'datefield',
|
569
|
+
fieldLabel: "End",
|
570
|
+
name: 'viewable_end_date',
|
571
|
+
allowBlank: true,
|
572
|
+
width: 230,
|
573
|
+
id: 'global_article_advanced_search_viewable_end_date'
|
574
|
+
},
|
575
|
+
{
|
576
|
+
xtype: 'radiogroup',
|
577
|
+
fieldLabel: 'Show Articles Without Display Dates?',
|
578
|
+
columns: 2,
|
579
|
+
id: 'global_article_advanced_search_show_articles_without_display_dates',
|
580
|
+
items: [
|
581
|
+
{
|
582
|
+
boxLabel: 'Yes',
|
583
|
+
name: 'show_articles_without_display_dates',
|
584
|
+
inputValue: 'true',
|
585
|
+
checked: true
|
586
|
+
},
|
587
|
+
{
|
588
|
+
boxLabel: 'No',
|
589
|
+
name: 'show_articles_without_display_dates',
|
590
|
+
inputValue: 'false'
|
591
|
+
}
|
592
|
+
]
|
593
|
+
}
|
594
|
+
]
|
595
|
+
},
|
596
|
+
{
|
597
|
+
xtype: 'checkbox',
|
598
|
+
fieldLabel: 'Show Orphaned Only',
|
599
|
+
id: 'show_orphaned_checkbox',
|
600
|
+
name: 'show_orphaned',
|
601
|
+
inputValue: 1,
|
602
|
+
uncheckedValue: 0
|
582
603
|
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
604
|
+
},
|
605
|
+
{
|
606
|
+
xtype: 'radiogroup',
|
607
|
+
fieldLabel: 'Archivable',
|
608
|
+
columns: 2,
|
609
|
+
id: 'global_article_advanced_search_archivable',
|
610
|
+
items: [
|
611
|
+
{
|
612
|
+
boxLabel: 'Yes',
|
613
|
+
name: 'archivable',
|
614
|
+
inputValue: 'true'
|
615
|
+
},
|
616
|
+
{
|
617
|
+
boxLabel: 'No',
|
618
|
+
name: 'archivable',
|
619
|
+
inputValue: 'false'
|
620
|
+
},
|
621
|
+
{
|
622
|
+
boxLabel: 'Both',
|
623
|
+
name: 'archivable',
|
624
|
+
inputValue: 'both',
|
625
|
+
checked: true
|
626
|
+
}
|
627
|
+
]
|
628
|
+
}
|
629
|
+
]
|
630
|
+
}),
|
631
|
+
buttons: [
|
595
632
|
{
|
596
|
-
|
597
|
-
|
598
|
-
|
633
|
+
text: 'Submit',
|
634
|
+
listeners: {
|
635
|
+
'click': function (button) {
|
636
|
+
var title = Ext.getCmp('global_article_advanced_search_title').getValue();
|
637
|
+
var content = Ext.getCmp('global_article_advanced_search_content').getValue();
|
638
|
+
var created_start_date = Ext.getCmp('global_article_advanced_search_created_start_date').getValue();
|
639
|
+
var created_end_date = Ext.getCmp('global_article_advanced_search_created_end_date').getValue();
|
640
|
+
var updated_start_date = Ext.getCmp('global_article_advanced_search_updated_start_date').getValue();
|
641
|
+
var updated_end_date = Ext.getCmp('global_article_advanced_search_updated_end_date').getValue();
|
642
|
+
var viewable_start_date = Ext.getCmp('global_article_advanced_search_viewable_start_date').getValue();
|
643
|
+
var viewable_end_date = Ext.getCmp('global_article_advanced_search_viewable_end_date').getValue();
|
644
|
+
var show_articles_without_display_dates = Ext.getCmp('global_article_advanced_search_show_articles_without_display_dates').getValue();
|
645
|
+
var archivable = Ext.getCmp('global_article_advanced_search_archivable').getValue();
|
646
|
+
var show_orphaned = Ext.getCmp('show_orphaned_checkbox').getValue();
|
647
|
+
store.setProxy({
|
648
|
+
type: 'ajax',
|
649
|
+
url: '/knitkit/erp_app/desktop/articles/all/',
|
650
|
+
reader: {
|
651
|
+
type: 'json',
|
652
|
+
root: 'data',
|
653
|
+
idProperty: 'id',
|
654
|
+
totalProperty: 'total'
|
655
|
+
},
|
656
|
+
extraParams: {
|
657
|
+
title: title,
|
658
|
+
content: content,
|
659
|
+
created_start_date: created_start_date,
|
660
|
+
created_end_date: created_end_date,
|
661
|
+
updated_start_date: updated_start_date,
|
662
|
+
updated_end_date: updated_end_date,
|
663
|
+
viewable_start_date: viewable_start_date,
|
664
|
+
viewable_end_date: viewable_end_date,
|
665
|
+
show_articles_without_display_dates: show_articles_without_display_dates,
|
666
|
+
archivable: archivable,
|
667
|
+
show_orphaned: show_orphaned
|
668
|
+
}
|
669
|
+
});
|
670
|
+
store.load();
|
671
|
+
advancedSearchWindow.close();
|
672
|
+
}
|
673
|
+
}
|
599
674
|
},
|
600
675
|
{
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
}]
|
606
|
-
}]
|
607
|
-
}),
|
608
|
-
buttons: [{
|
609
|
-
text:'Submit',
|
610
|
-
listeners:{
|
611
|
-
'click':function(button){
|
612
|
-
var title = Ext.getCmp('global_article_advanced_search_title').getValue();
|
613
|
-
var content = Ext.getCmp('global_article_advanced_search_content').getValue();
|
614
|
-
var created_start_date = Ext.getCmp('global_article_advanced_search_created_start_date').getValue();
|
615
|
-
var created_end_date = Ext.getCmp('global_article_advanced_search_created_end_date').getValue();
|
616
|
-
var updated_start_date = Ext.getCmp('global_article_advanced_search_updated_start_date').getValue();
|
617
|
-
var updated_end_date = Ext.getCmp('global_article_advanced_search_updated_end_date').getValue();
|
618
|
-
var viewable_start_date = Ext.getCmp('global_article_advanced_search_viewable_start_date').getValue();
|
619
|
-
var viewable_end_date = Ext.getCmp('global_article_advanced_search_viewable_end_date').getValue();
|
620
|
-
var show_articles_without_display_dates = Ext.getCmp('global_article_advanced_search_show_articles_without_display_dates').getValue();
|
621
|
-
var archivable = Ext.getCmp('global_article_advanced_search_archivable').getValue();
|
622
|
-
var show_orphaned = Ext.getCmp('show_orphaned_checkbox').getValue();
|
623
|
-
store.setProxy({
|
624
|
-
type: 'ajax',
|
625
|
-
url: '/knitkit/erp_app/desktop/articles/all/',
|
626
|
-
reader: {
|
627
|
-
type: 'json',
|
628
|
-
root: 'data',
|
629
|
-
idProperty: 'id',
|
630
|
-
totalProperty:'total'
|
631
|
-
},
|
632
|
-
extraParams:{
|
633
|
-
title:title,
|
634
|
-
content:content,
|
635
|
-
created_start_date:created_start_date,
|
636
|
-
created_end_date:created_end_date,
|
637
|
-
updated_start_date:updated_start_date,
|
638
|
-
updated_end_date:updated_end_date,
|
639
|
-
viewable_start_date:viewable_start_date,
|
640
|
-
viewable_end_date:viewable_end_date,
|
641
|
-
show_articles_without_display_dates:show_articles_without_display_dates,
|
642
|
-
archivable:archivable,
|
643
|
-
show_orphaned:show_orphaned
|
644
|
-
}
|
645
|
-
});
|
646
|
-
store.load();
|
647
|
-
advancedSearchWindow.close();
|
676
|
+
text: 'Close',
|
677
|
+
handler: function (btn) {
|
678
|
+
btn.up('window').close();
|
679
|
+
}
|
648
680
|
}
|
649
|
-
|
650
|
-
}
|
651
|
-
|
652
|
-
handler: function(){
|
653
|
-
advancedSearchWindow.close();
|
654
|
-
}
|
655
|
-
}]
|
656
|
-
});
|
657
|
-
advancedSearchWindow.show();
|
681
|
+
]
|
682
|
+
}).show();
|
683
|
+
}
|
658
684
|
}
|
659
|
-
}
|
660
685
|
);
|
661
686
|
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
687
|
+
config = Ext.apply({
|
688
|
+
columns: columnItems,
|
689
|
+
store: store,
|
690
|
+
dockedItems: [
|
691
|
+
{
|
692
|
+
xtype: 'pagingtoolbar',
|
693
|
+
store: store,
|
694
|
+
displayInfo: true,
|
695
|
+
displayMsg: '{0} - {1} of {2}',
|
696
|
+
emptyMsg: "Empty",
|
697
|
+
dock: 'bottom'
|
698
|
+
},
|
699
|
+
{
|
700
|
+
xtype: 'toolbar',
|
701
|
+
items: tbarItems,
|
702
|
+
dock: 'top'
|
703
|
+
}
|
704
|
+
],
|
705
|
+
autoScroll: true
|
706
|
+
}, config);
|
678
707
|
|
679
|
-
|
680
|
-
|
708
|
+
this.callParent([config]);
|
709
|
+
}
|
681
710
|
});
|