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
@@ -1,68 +1,57 @@
|
|
1
1
|
Compass.ErpApp.Desktop.Applications.Knitkit.addHostOptions = function (self, items, record) {
|
2
|
-
if (currentUser.hasCapability('edit','WebsiteHost')) {
|
2
|
+
if (currentUser.hasCapability('edit', 'WebsiteHost')) {
|
3
3
|
items.push({
|
4
|
-
text:'Update',
|
5
|
-
iconCls:'icon-edit',
|
6
|
-
listeners:{
|
7
|
-
'click':function () {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
width:425,
|
20
|
-
url:'/knitkit/erp_app/desktop/site/update_host',
|
21
|
-
defaults:{
|
22
|
-
width:225
|
4
|
+
text: 'Update',
|
5
|
+
iconCls: 'icon-edit',
|
6
|
+
listeners: {
|
7
|
+
'click': function () {
|
8
|
+
Ext.create("Ext.window.Window", {
|
9
|
+
title: 'Update Host',
|
10
|
+
modal: true,
|
11
|
+
buttonAlign: 'center',
|
12
|
+
items: Ext.create("Ext.form.Panel", {
|
13
|
+
labelWidth: 50,
|
14
|
+
frame: false,
|
15
|
+
bodyStyle: 'padding:5px 5px 0',
|
16
|
+
url: '/knitkit/erp_app/desktop/website_host/' + record.data.websiteHostId,
|
17
|
+
defaults: {
|
18
|
+
width: 300
|
23
19
|
},
|
24
|
-
items:[
|
20
|
+
items: [
|
25
21
|
{
|
26
|
-
xtype:'textfield',
|
27
|
-
fieldLabel:'Host',
|
28
|
-
id:'knitkitUpdateWebsiteHostHost',
|
29
|
-
name:'host',
|
30
|
-
value:record.data.host,
|
31
|
-
allowBlank:false
|
32
|
-
},
|
33
|
-
{
|
34
|
-
xtype:'hidden',
|
35
|
-
name:'id',
|
36
|
-
value:record.data.websiteHostId
|
22
|
+
xtype: 'textfield',
|
23
|
+
fieldLabel: 'Host',
|
24
|
+
id: 'knitkitUpdateWebsiteHostHost',
|
25
|
+
name: 'host',
|
26
|
+
value: record.data.host,
|
27
|
+
allowBlank: false
|
37
28
|
}
|
38
29
|
]
|
39
30
|
}),
|
40
|
-
buttons:[
|
31
|
+
buttons: [
|
41
32
|
{
|
42
|
-
text:'Submit',
|
43
|
-
listeners:{
|
44
|
-
'click':function (button) {
|
33
|
+
text: 'Submit',
|
34
|
+
listeners: {
|
35
|
+
'click': function (button) {
|
45
36
|
var window = button.findParentByType('window');
|
46
37
|
var formPanel = window.query('form')[0];
|
47
|
-
|
38
|
+
|
48
39
|
formPanel.getForm().submit({
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
method: 'PUT',
|
41
|
+
waitMsg: 'Please wait...',
|
42
|
+
success: function (form, action) {
|
52
43
|
var obj = Ext.decode(action.response.responseText);
|
53
44
|
if (obj.success) {
|
54
45
|
var newHost = Ext.getCmp('knitkitUpdateWebsiteHostHost').getValue();
|
55
46
|
record.set('host', newHost);
|
56
47
|
record.set('text', newHost);
|
57
|
-
|
58
|
-
updateHostWindow.close();
|
48
|
+
window.close();
|
59
49
|
}
|
60
50
|
else {
|
61
51
|
Ext.Msg.alert("Error", obj.msg);
|
62
52
|
}
|
63
53
|
},
|
64
|
-
failure:function (form, action) {
|
65
|
-
self.clearWindowStatus();
|
54
|
+
failure: function (form, action) {
|
66
55
|
Ext.Msg.alert("Error", "Error updating Host");
|
67
56
|
}
|
68
57
|
});
|
@@ -70,49 +59,43 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addHostOptions = function (self, ite
|
|
70
59
|
}
|
71
60
|
},
|
72
61
|
{
|
73
|
-
text:'Close',
|
74
|
-
handler:function () {
|
75
|
-
|
62
|
+
text: 'Close',
|
63
|
+
handler: function (btn) {
|
64
|
+
btn.up('window').close();
|
76
65
|
}
|
77
66
|
}
|
78
67
|
]
|
79
|
-
});
|
80
|
-
updateHostWindow.show();
|
68
|
+
}).show();
|
81
69
|
}
|
82
70
|
}
|
83
71
|
});
|
84
72
|
}
|
85
73
|
|
86
|
-
if (currentUser.hasCapability('delete','WebsiteHost')) {
|
74
|
+
if (currentUser.hasCapability('delete', 'WebsiteHost')) {
|
87
75
|
items.push({
|
88
|
-
text:'Delete',
|
89
|
-
iconCls:'icon-delete',
|
90
|
-
listeners:{
|
91
|
-
'click':function () {
|
76
|
+
text: 'Delete',
|
77
|
+
iconCls: 'icon-delete',
|
78
|
+
listeners: {
|
79
|
+
'click': function () {
|
92
80
|
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this Host?', function (btn) {
|
93
81
|
if (btn == 'no') {
|
94
82
|
return false;
|
95
83
|
}
|
96
84
|
else if (btn == 'yes') {
|
97
|
-
|
85
|
+
|
98
86
|
Ext.Ajax.request({
|
99
|
-
url:'/knitkit/erp_app/desktop/
|
100
|
-
method:'
|
101
|
-
|
102
|
-
id:record.data.websiteHostId
|
103
|
-
},
|
104
|
-
success:function (response) {
|
105
|
-
self.clearWindowStatus();
|
87
|
+
url: '/knitkit/erp_app/desktop/website_host/' + record.data.websiteHostId,
|
88
|
+
method: 'DELETE',
|
89
|
+
success: function (response) {
|
106
90
|
var obj = Ext.decode(response.responseText);
|
107
91
|
if (obj.success) {
|
108
|
-
record.remove(
|
92
|
+
record.remove();
|
109
93
|
}
|
110
94
|
else {
|
111
95
|
Ext.Msg.alert('Error', 'Error deleting Host');
|
112
96
|
}
|
113
97
|
},
|
114
|
-
failure:function (response) {
|
115
|
-
self.clearWindowStatus();
|
98
|
+
failure: function (response) {
|
116
99
|
Ext.Msg.alert('Error', 'Error deleting Host');
|
117
100
|
}
|
118
101
|
});
|
@@ -1,51 +1,53 @@
|
|
1
1
|
Compass.ErpApp.Desktop.Applications.Knitkit.addMenuOptions = function (self, items, record) {
|
2
|
+
var websiteId = compassDesktop.getModule('knitkit-win').currentWebsite.id;
|
3
|
+
|
2
4
|
if (record.data['canAddMenuItems']) {
|
3
|
-
if (currentUser.hasCapability('create','WebsiteNavItem')) {
|
5
|
+
if (currentUser.hasCapability('create', 'WebsiteNavItem')) {
|
6
|
+
|
4
7
|
items.push({
|
5
|
-
text:'Add Menu Item',
|
6
|
-
iconCls:'icon-add',
|
7
|
-
handler:function (btn) {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
url:'/knitkit/erp_app/desktop/website_nav/add_menu_item',
|
20
|
-
defaults:{
|
21
|
-
width:225
|
8
|
+
text: 'Add Menu Item',
|
9
|
+
iconCls: 'icon-add',
|
10
|
+
handler: function (btn) {
|
11
|
+
Ext.create("Ext.window.Window", {
|
12
|
+
title: 'New Menu Item',
|
13
|
+
modal: true,
|
14
|
+
buttonAlign: 'center',
|
15
|
+
items: Ext.create('Ext.form.Panel', {
|
16
|
+
labelWidth: 50,
|
17
|
+
frame: false,
|
18
|
+
bodyStyle: 'padding:5px 5px 0',
|
19
|
+
url: '/knitkit/erp_app/desktop/website_nav_item',
|
20
|
+
defaults: {
|
21
|
+
width: 375
|
22
22
|
},
|
23
|
-
items:[
|
23
|
+
items: [
|
24
24
|
{
|
25
|
-
xtype:'textfield',
|
26
|
-
fieldLabel:'Title',
|
27
|
-
|
28
|
-
|
25
|
+
xtype: 'textfield',
|
26
|
+
fieldLabel: 'Title',
|
27
|
+
width: 320,
|
28
|
+
allowBlank: false,
|
29
|
+
name: 'title'
|
29
30
|
},
|
30
31
|
{
|
31
|
-
xtype:'combo',
|
32
|
-
fieldLabel:'Link to',
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
32
|
+
xtype: 'combo',
|
33
|
+
fieldLabel: 'Link to',
|
34
|
+
width: 320,
|
35
|
+
name: 'link_to',
|
36
|
+
id: 'knitkit_nav_item_link_to',
|
37
|
+
allowBlank: false,
|
38
|
+
forceSelection: true,
|
39
|
+
editable: false,
|
40
|
+
autoSelect: true,
|
41
|
+
typeAhead: false,
|
42
|
+
mode: 'local',
|
43
|
+
triggerAction: 'all',
|
44
|
+
store: [
|
43
45
|
['website_section', 'Section'],
|
44
46
|
['url', 'Url']
|
45
47
|
],
|
46
|
-
value:'website_section',
|
47
|
-
listeners:{
|
48
|
-
'change':function (combo, newValue, oldValue) {
|
48
|
+
value: 'website_section',
|
49
|
+
listeners: {
|
50
|
+
'change': function (combo, newValue, oldValue) {
|
49
51
|
switch (newValue) {
|
50
52
|
case 'website_section':
|
51
53
|
Ext.getCmp('knitkit_create_website_nav_item_section').show();
|
@@ -60,87 +62,85 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addMenuOptions = function (self, ite
|
|
60
62
|
}
|
61
63
|
},
|
62
64
|
{
|
63
|
-
xtype:'combo',
|
64
|
-
id:'knitkit_create_website_nav_item_section',
|
65
|
-
hiddenName:'website_section_id',
|
66
|
-
name:'website_section_id',
|
67
|
-
width:
|
68
|
-
loadingText:'Retrieving Sections...',
|
69
|
-
store:Ext.create("Ext.data.Store", {
|
70
|
-
proxy:{
|
71
|
-
type:'ajax',
|
72
|
-
url:'/knitkit/erp_app/desktop/section/existing_sections',
|
73
|
-
reader:{
|
74
|
-
type:'json'
|
65
|
+
xtype: 'combo',
|
66
|
+
id: 'knitkit_create_website_nav_item_section',
|
67
|
+
hiddenName: 'website_section_id',
|
68
|
+
name: 'website_section_id',
|
69
|
+
width: 320,
|
70
|
+
loadingText: 'Retrieving Sections...',
|
71
|
+
store: Ext.create("Ext.data.Store", {
|
72
|
+
proxy: {
|
73
|
+
type: 'ajax',
|
74
|
+
url: '/knitkit/erp_app/desktop/section/existing_sections',
|
75
|
+
reader: {
|
76
|
+
type: 'json'
|
75
77
|
},
|
76
|
-
extraParams:{
|
77
|
-
website_id:
|
78
|
+
extraParams: {
|
79
|
+
website_id: websiteId
|
78
80
|
}
|
79
81
|
},
|
80
|
-
autoLoad:true,
|
81
|
-
fields:[
|
82
|
+
autoLoad: true,
|
83
|
+
fields: [
|
82
84
|
{
|
83
|
-
name:'id'
|
85
|
+
name: 'id'
|
84
86
|
},
|
85
87
|
{
|
86
|
-
name:'title_permalink'
|
88
|
+
name: 'title_permalink'
|
87
89
|
|
88
90
|
}
|
89
91
|
]
|
90
92
|
}),
|
91
|
-
forceSelection:true,
|
92
|
-
editable:false,
|
93
|
-
fieldLabel:'Section',
|
94
|
-
autoSelect:true,
|
95
|
-
typeAhead:false,
|
96
|
-
mode:'local',
|
97
|
-
displayField:'title_permalink',
|
98
|
-
valueField:'id',
|
99
|
-
|
100
|
-
triggerAction:'all'
|
93
|
+
forceSelection: true,
|
94
|
+
editable: false,
|
95
|
+
fieldLabel: 'Section',
|
96
|
+
autoSelect: true,
|
97
|
+
typeAhead: false,
|
98
|
+
mode: 'local',
|
99
|
+
displayField: 'title_permalink',
|
100
|
+
valueField: 'id',
|
101
|
+
triggerAction: 'all'
|
101
102
|
},
|
102
103
|
{
|
103
|
-
xtype:'textfield',
|
104
|
-
fieldLabel:'Url',
|
105
|
-
id:'knitkit_create_website_nav_item_url',
|
106
|
-
hidden:true,
|
107
|
-
name:'url'
|
104
|
+
xtype: 'textfield',
|
105
|
+
fieldLabel: 'Url',
|
106
|
+
id: 'knitkit_create_website_nav_item_url',
|
107
|
+
hidden: true,
|
108
|
+
name: 'url'
|
108
109
|
},
|
109
110
|
{
|
110
|
-
xtype:'hidden',
|
111
|
-
name:'klass',
|
112
|
-
value:((record.data['
|
111
|
+
xtype: 'hidden',
|
112
|
+
name: 'klass',
|
113
|
+
value: ((record.data['isWebsiteNav']) ? 'WebsiteNav' : 'WebsiteNavItem')
|
113
114
|
},
|
114
115
|
{
|
115
|
-
xtype:'hidden',
|
116
|
-
name:'
|
117
|
-
value:record.data['websiteNavId']
|
116
|
+
xtype: 'hidden',
|
117
|
+
name: 'parent_id',
|
118
|
+
value: ((record.data['isWebsiteNav']) ? record.data['websiteNavId'] : record.data['websiteNavItemId'])
|
118
119
|
}
|
119
120
|
]
|
120
121
|
}),
|
121
|
-
buttons:[
|
122
|
+
buttons: [
|
122
123
|
{
|
123
|
-
text:'Submit',
|
124
|
-
listeners:{
|
125
|
-
'click':function (button) {
|
124
|
+
text: 'Submit',
|
125
|
+
listeners: {
|
126
|
+
'click': function (button) {
|
126
127
|
var window = button.findParentByType('window'),
|
127
|
-
|
128
|
-
|
128
|
+
formPanel = window.query('form')[0];
|
129
|
+
|
129
130
|
formPanel.getForm().submit({
|
130
|
-
|
131
|
-
success:function (form, action) {
|
132
|
-
self.clearWindowStatus();
|
131
|
+
waitMsg: 'Please wait...',
|
132
|
+
success: function (form, action) {
|
133
133
|
var obj = Ext.decode(action.response.responseText);
|
134
134
|
if (obj.success) {
|
135
135
|
record.appendChild(obj.node);
|
136
|
+
record.expand();
|
137
|
+
window.close();
|
136
138
|
}
|
137
139
|
else {
|
138
140
|
Ext.Msg.alert("Error", obj.msg);
|
139
141
|
}
|
140
|
-
window.close();
|
141
142
|
},
|
142
|
-
failure:function (form, action) {
|
143
|
-
self.clearWindowStatus();
|
143
|
+
failure: function (form, action) {
|
144
144
|
if (action.response === null) {
|
145
145
|
Ext.Msg.alert("Error", 'Could not create menu item');
|
146
146
|
}
|
@@ -155,14 +155,13 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addMenuOptions = function (self, ite
|
|
155
155
|
}
|
156
156
|
},
|
157
157
|
{
|
158
|
-
text:'Close',
|
159
|
-
handler:function () {
|
160
|
-
|
158
|
+
text: 'Close',
|
159
|
+
handler: function (btn) {
|
160
|
+
btn.up('window').close();
|
161
161
|
}
|
162
162
|
}
|
163
163
|
]
|
164
|
-
});
|
165
|
-
addMenuItemWindow.show();
|
164
|
+
}).show();
|
166
165
|
}
|
167
166
|
});
|
168
167
|
}
|
@@ -1,146 +1,438 @@
|
|
1
1
|
Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self, items, record) {
|
2
|
+
var sectionId = record.data.id.split('_')[1];
|
3
|
+
|
2
4
|
items.push({
|
3
|
-
text:'
|
4
|
-
iconCls:'icon-document',
|
5
|
-
listeners:{
|
6
|
-
'click':function () {
|
7
|
-
|
5
|
+
text: 'Add Article',
|
6
|
+
iconCls: 'icon-document',
|
7
|
+
listeners: {
|
8
|
+
'click': function () {
|
9
|
+
|
10
|
+
var addFormItems = [
|
11
|
+
{
|
12
|
+
xtype: 'textfield',
|
13
|
+
fieldLabel: 'Title',
|
14
|
+
allowBlank: false,
|
15
|
+
name: 'title'
|
16
|
+
},
|
17
|
+
{
|
18
|
+
xtype: 'radiogroup',
|
19
|
+
fieldLabel: 'Display title?',
|
20
|
+
name: 'display_title',
|
21
|
+
columns: 2,
|
22
|
+
items: [
|
23
|
+
{
|
24
|
+
boxLabel: 'Yes',
|
25
|
+
name: 'display_title',
|
26
|
+
inputValue: 'yes',
|
27
|
+
checked: true
|
28
|
+
},
|
29
|
+
|
30
|
+
{
|
31
|
+
boxLabel: 'No',
|
32
|
+
name: 'display_title',
|
33
|
+
inputValue: 'no'
|
34
|
+
}
|
35
|
+
]
|
36
|
+
},
|
37
|
+
{
|
38
|
+
xtype: 'textfield',
|
39
|
+
fieldLabel: 'Content Area',
|
40
|
+
allowBlank: true,
|
41
|
+
name: 'content_area'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
xtype: 'textfield',
|
45
|
+
fieldLabel: 'Tags',
|
46
|
+
allowBlank: true,
|
47
|
+
name: 'tags'
|
48
|
+
},
|
49
|
+
{
|
50
|
+
xtype: 'textfield',
|
51
|
+
fieldLabel: 'Internal ID',
|
52
|
+
allowBlank: true,
|
53
|
+
name: 'internal_identifier'
|
54
|
+
}
|
55
|
+
];
|
56
|
+
|
57
|
+
Ext.widget('window', {
|
58
|
+
layout: 'fit',
|
59
|
+
modal: true,
|
60
|
+
width: 375,
|
61
|
+
title: 'Create New Article',
|
62
|
+
plain: true,
|
63
|
+
buttonAlign: 'center',
|
64
|
+
items: {
|
65
|
+
xtype: 'form',
|
66
|
+
labelWidth: 110,
|
67
|
+
frame: false,
|
68
|
+
bodyStyle: 'padding:5px 5px 0',
|
69
|
+
width: 425,
|
70
|
+
url: '/knitkit/erp_app/desktop/articles/new/' + sectionId,
|
71
|
+
defaults: {
|
72
|
+
width: 300
|
73
|
+
},
|
74
|
+
items: addFormItems
|
75
|
+
},
|
76
|
+
buttons: [
|
77
|
+
{
|
78
|
+
text: 'Submit',
|
79
|
+
listeners: {
|
80
|
+
'click': function (button) {
|
81
|
+
var window = button.findParentByType('window');
|
82
|
+
var formPanel = window.query('form')[0];
|
83
|
+
|
84
|
+
formPanel.getForm().submit({
|
85
|
+
reset: true,
|
86
|
+
success: function (form, action) {
|
87
|
+
var obj = Ext.decode(action.response.responseText);
|
88
|
+
if (obj.success) {
|
89
|
+
obj.node.createdAt = obj.node.created_at;
|
90
|
+
obj.node.updatedAt = obj.node.updated_at;
|
91
|
+
record.appendChild(Ext.create('SiteContentsModel', obj.node));
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
Ext.Msg.alert("Error", obj.msg);
|
95
|
+
}
|
96
|
+
window.close();
|
97
|
+
},
|
98
|
+
failure: function (form, action) {
|
99
|
+
Ext.Msg.alert("Error", "Error creating article");
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}
|
103
|
+
}
|
104
|
+
},
|
105
|
+
{
|
106
|
+
text: 'Close',
|
107
|
+
handler: function (btn) {
|
108
|
+
btn.up('window').close();
|
109
|
+
}
|
110
|
+
}
|
111
|
+
]
|
112
|
+
}).show();
|
113
|
+
}
|
114
|
+
}
|
115
|
+
})
|
116
|
+
;
|
117
|
+
|
118
|
+
items.push({
|
119
|
+
text: 'Attach Article',
|
120
|
+
iconCls: 'icon-copy',
|
121
|
+
listeners: {
|
122
|
+
'click': function () {
|
123
|
+
Ext.widget('window', {
|
124
|
+
layout: 'fit',
|
125
|
+
width: 375,
|
126
|
+
title: 'Attach Existing Article',
|
127
|
+
plain: true,
|
128
|
+
buttonAlign: 'center',
|
129
|
+
items: {
|
130
|
+
xtype: 'form',
|
131
|
+
labelWidth: 75,
|
132
|
+
frame: false,
|
133
|
+
bodyStyle: 'padding:5px 5px 0',
|
134
|
+
width: 425,
|
135
|
+
url: '/knitkit/erp_app/desktop/articles/add_existing/' + sectionId,
|
136
|
+
items: [
|
137
|
+
{
|
138
|
+
itemId: 'available_articles_filter_combobox',
|
139
|
+
xtype: 'combo',
|
140
|
+
hiddenName: 'website_id',
|
141
|
+
name: 'website_id',
|
142
|
+
labelWidth: 50,
|
143
|
+
width: 350,
|
144
|
+
loadingText: 'Retrieving Websites...',
|
145
|
+
store: Ext.create('Ext.data.Store', {
|
146
|
+
autoLoad: true,
|
147
|
+
proxy: {
|
148
|
+
type: 'ajax',
|
149
|
+
reader: {
|
150
|
+
type: 'json',
|
151
|
+
root: 'websites'
|
152
|
+
},
|
153
|
+
extraParams: {
|
154
|
+
section_id: sectionId
|
155
|
+
},
|
156
|
+
url: '/knitkit/erp_app/desktop/section/available_articles_filter'
|
157
|
+
},
|
158
|
+
fields: [
|
159
|
+
{
|
160
|
+
name: 'id'
|
161
|
+
},
|
162
|
+
{
|
163
|
+
name: 'internal_identifier'
|
164
|
+
|
165
|
+
},
|
166
|
+
{
|
167
|
+
name: 'name'
|
168
|
+
|
169
|
+
}
|
170
|
+
],
|
171
|
+
listeners: {
|
172
|
+
'load': function (store) {
|
173
|
+
available_articles_filter_combobox = Ext.ComponentQuery.query('#available_articles_filter_combobox')[0];
|
174
|
+
available_articles_filter_combobox.select(0);
|
175
|
+
available_articles_filter_combobox.fireEvent('select');
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}),
|
179
|
+
forceSelection: true,
|
180
|
+
fieldLabel: 'Filter By',
|
181
|
+
queryMode: 'local',
|
182
|
+
autoSelect: true,
|
183
|
+
typeAhead: true,
|
184
|
+
displayField: 'name',
|
185
|
+
valueField: 'id',
|
186
|
+
triggerAction: 'all',
|
187
|
+
allowBlank: false,
|
188
|
+
listeners: {
|
189
|
+
'select': function (combo, records) {
|
190
|
+
available_articles_combobox = Ext.ComponentQuery.query('#available_articles_combobox')[0];
|
191
|
+
available_articles_combobox.getPicker().setLoading(false);
|
192
|
+
available_articles_combobox.getStore().load({
|
193
|
+
params: {
|
194
|
+
section_id: sectionId,
|
195
|
+
website_id: Ext.ComponentQuery.query('#available_articles_filter_combobox')[0].getValue()
|
196
|
+
}
|
197
|
+
});
|
198
|
+
}
|
199
|
+
}
|
200
|
+
},
|
201
|
+
{
|
202
|
+
xtype: 'combo',
|
203
|
+
itemId: 'available_articles_combobox',
|
204
|
+
hiddenName: 'article_id',
|
205
|
+
name: 'article_id',
|
206
|
+
labelWidth: 50,
|
207
|
+
width: 350,
|
208
|
+
loadingText: 'Retrieving Articles...',
|
209
|
+
store: Ext.create('Ext.data.Store', {
|
210
|
+
autoLoad: false,
|
211
|
+
remoteFilter: true,
|
212
|
+
proxy: {
|
213
|
+
type: 'ajax',
|
214
|
+
reader: {
|
215
|
+
type: 'json',
|
216
|
+
root: 'articles'
|
217
|
+
},
|
218
|
+
extraParams: {
|
219
|
+
section_id: sectionId
|
220
|
+
},
|
221
|
+
url: '/knitkit/erp_app/desktop/section/available_articles'
|
222
|
+
},
|
223
|
+
fields: [
|
224
|
+
{
|
225
|
+
name: 'id'
|
226
|
+
},
|
227
|
+
{
|
228
|
+
name: 'internal_identifier'
|
229
|
+
|
230
|
+
},
|
231
|
+
{
|
232
|
+
name: 'combobox_display_value'
|
233
|
+
}
|
234
|
+
],
|
235
|
+
listeners: {
|
236
|
+
'beforeload': function (store) {
|
237
|
+
Ext.apply(store.getProxy().extraParams, {
|
238
|
+
website_id: Ext.ComponentQuery.query('#available_articles_filter_combobox')[0].getValue()
|
239
|
+
});
|
240
|
+
},
|
241
|
+
'load': function (store, records) {
|
242
|
+
available_articles_combobox = Ext.ComponentQuery.query('#available_articles_combobox')[0];
|
243
|
+
available_articles_combobox.setValue(store.getAt(0).data.id);
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}),
|
247
|
+
queryMode: 'local',
|
248
|
+
forceSelection: true,
|
249
|
+
fieldLabel: 'Article',
|
250
|
+
autoSelect: true,
|
251
|
+
typeAhead: true,
|
252
|
+
displayField: 'combobox_display_value',
|
253
|
+
valueField: 'id',
|
254
|
+
triggerAction: 'all',
|
255
|
+
allowBlank: false,
|
256
|
+
loadMask: false
|
257
|
+
}
|
258
|
+
]
|
259
|
+
},
|
260
|
+
buttons: [
|
261
|
+
{
|
262
|
+
text: 'Submit',
|
263
|
+
listeners: {
|
264
|
+
'click': function (button) {
|
265
|
+
var window = button.findParentByType('window');
|
266
|
+
var formPanel = window.query('form')[0];
|
267
|
+
formPanel.getForm().submit({
|
268
|
+
reset: true,
|
269
|
+
success: function (form, action) {
|
270
|
+
var obj = Ext.decode(action.response.responseText);
|
271
|
+
if (obj.success) {
|
272
|
+
obj.article.createdAt = obj.article.created_at;
|
273
|
+
obj.article.updatedAt = obj.article.updated_at;
|
274
|
+
|
275
|
+
record.appendChild(Ext.create('SiteContentsModel', obj.article));
|
276
|
+
|
277
|
+
window.close();
|
278
|
+
} else {
|
279
|
+
Ext.Msg.alert("Error", "Error Attaching article");
|
280
|
+
}
|
281
|
+
},
|
282
|
+
failure: function (form, action) {
|
283
|
+
Ext.Msg.alert("Error", "Error Attaching article");
|
284
|
+
}
|
285
|
+
});
|
286
|
+
}
|
287
|
+
}
|
288
|
+
},
|
289
|
+
{
|
290
|
+
text: 'Close',
|
291
|
+
handler: function (btn) {
|
292
|
+
btn.up('window').close();
|
293
|
+
}
|
294
|
+
}
|
295
|
+
]
|
296
|
+
}).show();
|
8
297
|
}
|
9
298
|
}
|
10
299
|
});
|
11
300
|
|
12
|
-
if (currentUser.hasCapability('unsecure','WebsiteSection') || currentUser.hasCapability('secure','WebsiteSection')) {
|
301
|
+
if (currentUser.hasCapability('unsecure', 'WebsiteSection') || currentUser.hasCapability('secure', 'WebsiteSection')) {
|
13
302
|
items.push({
|
14
|
-
text:'Security',
|
15
|
-
iconCls:'icon-document_lock',
|
16
|
-
listeners:{
|
17
|
-
'click':function () {
|
18
|
-
|
303
|
+
text: 'Security',
|
304
|
+
iconCls: 'icon-document_lock',
|
305
|
+
listeners: {
|
306
|
+
'click': function () {
|
307
|
+
var westRegion = Ext.getCmp('knitkitWestRegion');
|
308
|
+
westRegion.changeSecurity(record, '/knitkit/erp_app/desktop/section/update_security', sectionId);
|
19
309
|
}
|
20
310
|
}
|
21
311
|
});
|
22
312
|
}
|
23
313
|
|
24
|
-
if (currentUser.hasCapability('create','WebsiteSection')) {
|
314
|
+
if (currentUser.hasCapability('create', 'WebsiteSection') && !record.get('isBlog')) {
|
25
315
|
items.push({
|
26
|
-
text:'Add Section',
|
27
|
-
iconCls:'icon-add',
|
28
|
-
listeners:{
|
29
|
-
'click':function () {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
316
|
+
text: 'Add Section',
|
317
|
+
iconCls: 'icon-add',
|
318
|
+
listeners: {
|
319
|
+
'click': function () {
|
320
|
+
Ext.widget("window", {
|
321
|
+
modal: true,
|
322
|
+
layout: 'fit',
|
323
|
+
width: 375,
|
324
|
+
title: 'New Section',
|
325
|
+
plain: true,
|
326
|
+
buttonAlign: 'center',
|
327
|
+
items: {
|
328
|
+
xtype: 'form',
|
329
|
+
labelWidth: 110,
|
330
|
+
frame: false,
|
331
|
+
bodyStyle: 'padding:5px 5px 0',
|
332
|
+
url: '/knitkit/erp_app/desktop/section/new',
|
333
|
+
defaults: {
|
334
|
+
width: 225
|
43
335
|
},
|
44
|
-
items:[
|
336
|
+
items: [
|
45
337
|
{
|
46
|
-
xtype:'textfield',
|
47
|
-
fieldLabel:'Title',
|
48
|
-
allowBlank:false,
|
49
|
-
name:'title'
|
338
|
+
xtype: 'textfield',
|
339
|
+
fieldLabel: 'Title',
|
340
|
+
allowBlank: false,
|
341
|
+
name: 'title'
|
50
342
|
},
|
51
343
|
{
|
52
|
-
xtype:'textfield',
|
53
|
-
fieldLabel:'Internal ID',
|
54
|
-
allowBlank:true,
|
55
|
-
name:'internal_identifier'
|
344
|
+
xtype: 'textfield',
|
345
|
+
fieldLabel: 'Internal ID',
|
346
|
+
allowBlank: true,
|
347
|
+
name: 'internal_identifier'
|
56
348
|
},
|
57
349
|
{
|
58
|
-
xtype:'combo',
|
59
|
-
forceSelection:true,
|
60
|
-
store:[
|
350
|
+
xtype: 'combo',
|
351
|
+
forceSelection: true,
|
352
|
+
store: [
|
61
353
|
['Page', 'Page'],
|
62
354
|
['Blog', 'Blog']
|
63
355
|
],
|
64
|
-
value:'Page',
|
65
|
-
fieldLabel:'Type',
|
66
|
-
name:'type',
|
67
|
-
allowBlank:false,
|
68
|
-
triggerAction:'all'
|
356
|
+
value: 'Page',
|
357
|
+
fieldLabel: 'Type',
|
358
|
+
name: 'type',
|
359
|
+
allowBlank: false,
|
360
|
+
triggerAction: 'all'
|
69
361
|
},
|
70
362
|
{
|
71
|
-
xtype:'radiogroup',
|
72
|
-
fieldLabel:'Display in menu?',
|
73
|
-
name:'in_menu',
|
74
|
-
columns:2,
|
75
|
-
items:[
|
363
|
+
xtype: 'radiogroup',
|
364
|
+
fieldLabel: 'Display in menu?',
|
365
|
+
name: 'in_menu',
|
366
|
+
columns: 2,
|
367
|
+
items: [
|
76
368
|
{
|
77
|
-
boxLabel:'Yes',
|
78
|
-
name:'in_menu',
|
79
|
-
inputValue:'yes',
|
80
|
-
checked:true
|
369
|
+
boxLabel: 'Yes',
|
370
|
+
name: 'in_menu',
|
371
|
+
inputValue: 'yes',
|
372
|
+
checked: true
|
81
373
|
},
|
82
374
|
|
83
375
|
{
|
84
|
-
boxLabel:'No',
|
85
|
-
name:'in_menu',
|
86
|
-
inputValue:'no'
|
376
|
+
boxLabel: 'No',
|
377
|
+
name: 'in_menu',
|
378
|
+
inputValue: 'no'
|
87
379
|
}
|
88
380
|
]
|
89
381
|
},
|
90
382
|
{
|
91
|
-
xtype:'radiogroup',
|
92
|
-
fieldLabel:'Render with Base Layout?',
|
93
|
-
name:'render_with_base_layout',
|
94
|
-
columns:2,
|
95
|
-
items:[
|
383
|
+
xtype: 'radiogroup',
|
384
|
+
fieldLabel: 'Render with Base Layout?',
|
385
|
+
name: 'render_with_base_layout',
|
386
|
+
columns: 2,
|
387
|
+
items: [
|
96
388
|
{
|
97
|
-
boxLabel:'Yes',
|
98
|
-
name:'render_with_base_layout',
|
99
|
-
inputValue:'yes',
|
100
|
-
checked:true
|
389
|
+
boxLabel: 'Yes',
|
390
|
+
name: 'render_with_base_layout',
|
391
|
+
inputValue: 'yes',
|
392
|
+
checked: true
|
101
393
|
},
|
102
394
|
|
103
395
|
{
|
104
|
-
boxLabel:'No',
|
105
|
-
name:'render_with_base_layout',
|
106
|
-
inputValue:'no'
|
396
|
+
boxLabel: 'No',
|
397
|
+
name: 'render_with_base_layout',
|
398
|
+
inputValue: 'no'
|
107
399
|
}
|
108
400
|
]
|
109
401
|
},
|
110
402
|
{
|
111
|
-
xtype:'hidden',
|
112
|
-
name:'website_section_id',
|
113
|
-
value:
|
403
|
+
xtype: 'hidden',
|
404
|
+
name: 'website_section_id',
|
405
|
+
value: sectionId
|
114
406
|
},
|
115
407
|
{
|
116
|
-
xtype:'hidden',
|
117
|
-
name:'website_id',
|
118
|
-
value:record.data.siteId
|
408
|
+
xtype: 'hidden',
|
409
|
+
name: 'website_id',
|
410
|
+
value: record.data.siteId
|
119
411
|
}
|
120
412
|
]
|
121
|
-
}
|
122
|
-
buttons:[
|
413
|
+
},
|
414
|
+
buttons: [
|
123
415
|
{
|
124
|
-
text:'Submit',
|
125
|
-
listeners:{
|
126
|
-
'click':function (button) {
|
416
|
+
text: 'Submit',
|
417
|
+
listeners: {
|
418
|
+
'click': function (button) {
|
127
419
|
var window = button.findParentByType('window');
|
128
420
|
var formPanel = window.query('.form')[0];
|
129
|
-
|
421
|
+
|
130
422
|
formPanel.getForm().submit({
|
131
|
-
reset:true,
|
132
|
-
success:function (form, action) {
|
133
|
-
self.clearWindowStatus();
|
423
|
+
reset: true,
|
424
|
+
success: function (form, action) {
|
134
425
|
var obj = Ext.decode(action.response.responseText);
|
135
426
|
if (obj.success) {
|
136
427
|
record.appendChild(obj.node);
|
428
|
+
window.close();
|
137
429
|
}
|
138
430
|
else {
|
139
431
|
Ext.Msg.alert("Error", obj.message);
|
140
432
|
}
|
141
433
|
},
|
142
|
-
failure:function (form, action) {
|
143
|
-
self.clearWindowStatus();
|
434
|
+
failure: function (form, action) {
|
435
|
+
//self.clearWindowStatus();
|
144
436
|
var obj = Ext.decode(action.response.responseText);
|
145
437
|
if (obj.message) {
|
146
438
|
Ext.Msg.alert("Error", obj.message);
|
@@ -154,119 +446,125 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
|
|
154
446
|
}
|
155
447
|
},
|
156
448
|
{
|
157
|
-
text:'Close',
|
158
|
-
handler:function () {
|
159
|
-
|
449
|
+
text: 'Close',
|
450
|
+
handler: function (btn) {
|
451
|
+
btn.up('window').close();
|
160
452
|
}
|
161
453
|
}
|
162
454
|
]
|
163
|
-
});
|
164
|
-
addSectionWindow.show();
|
455
|
+
}).show();
|
165
456
|
}
|
166
457
|
}
|
167
458
|
});
|
168
459
|
}
|
169
460
|
|
170
|
-
if (currentUser.hasCapability('edit','WebsiteSection')) {
|
461
|
+
if (currentUser.hasCapability('edit', 'WebsiteSection')) {
|
171
462
|
items.push({
|
172
|
-
text:'Update
|
173
|
-
iconCls:'icon-edit',
|
174
|
-
listeners:{
|
175
|
-
'click':function () {
|
176
|
-
|
177
|
-
layout:'fit',
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
463
|
+
text: 'Update ' + record.data["type"],
|
464
|
+
iconCls: 'icon-edit',
|
465
|
+
listeners: {
|
466
|
+
'click': function () {
|
467
|
+
Ext.widget("window", {
|
468
|
+
layout: 'fit',
|
469
|
+
modal: true,
|
470
|
+
width: 375,
|
471
|
+
title: 'Update Section',
|
472
|
+
plain: true,
|
473
|
+
buttonAlign: 'center',
|
474
|
+
items: {
|
475
|
+
xtype: 'form',
|
476
|
+
labelWidth: 110,
|
477
|
+
frame: false,
|
478
|
+
bodyStyle: 'padding:5px 5px 0',
|
479
|
+
url: '/knitkit/erp_app/desktop/section/update',
|
480
|
+
defaults: {
|
481
|
+
width: 375
|
189
482
|
},
|
190
|
-
items:[
|
483
|
+
items: [
|
191
484
|
{
|
192
|
-
xtype:'textfield',
|
193
|
-
fieldLabel:'Title',
|
194
|
-
|
195
|
-
|
485
|
+
xtype: 'textfield',
|
486
|
+
fieldLabel: 'Title',
|
487
|
+
width: 320,
|
488
|
+
value: record.data.text,
|
489
|
+
name: 'title'
|
196
490
|
},
|
197
491
|
{
|
198
|
-
xtype:'textfield',
|
199
|
-
fieldLabel:'Internal ID',
|
200
|
-
|
201
|
-
|
202
|
-
|
492
|
+
xtype: 'textfield',
|
493
|
+
fieldLabel: 'Internal ID',
|
494
|
+
width: 320,
|
495
|
+
allowBlank: true,
|
496
|
+
name: 'internal_identifier',
|
497
|
+
value: record.data.internal_identifier
|
203
498
|
},
|
204
499
|
{
|
205
|
-
xtype:'radiogroup',
|
206
|
-
fieldLabel:'Display in menu?',
|
207
|
-
|
208
|
-
|
209
|
-
|
500
|
+
xtype: 'radiogroup',
|
501
|
+
fieldLabel: 'Display in menu?',
|
502
|
+
width: 220,
|
503
|
+
name: 'in_menu',
|
504
|
+
columns: 2,
|
505
|
+
items: [
|
210
506
|
{
|
211
|
-
boxLabel:'Yes',
|
212
|
-
name:'in_menu',
|
213
|
-
inputValue:'yes',
|
214
|
-
checked:record.data.inMenu
|
507
|
+
boxLabel: 'Yes',
|
508
|
+
name: 'in_menu',
|
509
|
+
inputValue: 'yes',
|
510
|
+
checked: record.data.inMenu
|
215
511
|
},
|
216
512
|
|
217
513
|
{
|
218
|
-
boxLabel:'No',
|
219
|
-
name:'in_menu',
|
220
|
-
inputValue:'no',
|
221
|
-
checked
|
514
|
+
boxLabel: 'No',
|
515
|
+
name: 'in_menu',
|
516
|
+
inputValue: 'no',
|
517
|
+
checked: !record.data.inMenu
|
222
518
|
}
|
223
519
|
]
|
224
520
|
},
|
225
521
|
{
|
226
|
-
xtype:'radiogroup',
|
227
|
-
fieldLabel:'Render with Base Layout?',
|
228
|
-
|
229
|
-
|
230
|
-
|
522
|
+
xtype: 'radiogroup',
|
523
|
+
fieldLabel: 'Render with Base Layout?',
|
524
|
+
width: 220,
|
525
|
+
name: 'render_with_base_layout',
|
526
|
+
columns: 2,
|
527
|
+
items: [
|
231
528
|
{
|
232
|
-
boxLabel:'Yes',
|
233
|
-
name:'render_with_base_layout',
|
234
|
-
inputValue:'yes',
|
235
|
-
checked:record.data.renderWithBaseLayout
|
529
|
+
boxLabel: 'Yes',
|
530
|
+
name: 'render_with_base_layout',
|
531
|
+
inputValue: 'yes',
|
532
|
+
checked: record.data.renderWithBaseLayout
|
236
533
|
},
|
237
534
|
|
238
535
|
{
|
239
|
-
boxLabel:'No',
|
240
|
-
name:'render_with_base_layout',
|
241
|
-
inputValue:'no',
|
242
|
-
checked
|
536
|
+
boxLabel: 'No',
|
537
|
+
name: 'render_with_base_layout',
|
538
|
+
inputValue: 'no',
|
539
|
+
checked: !record.data.renderWithBaseLayout
|
243
540
|
}
|
244
541
|
]
|
245
542
|
},
|
246
543
|
{
|
247
|
-
xtype:'displayfield',
|
248
|
-
fieldLabel:'Path',
|
249
|
-
|
250
|
-
|
544
|
+
xtype: 'displayfield',
|
545
|
+
fieldLabel: 'Path',
|
546
|
+
width: 320,
|
547
|
+
name: 'path',
|
548
|
+
value: record.data.path
|
251
549
|
},
|
252
550
|
{
|
253
|
-
xtype:'hidden',
|
254
|
-
name:'id',
|
255
|
-
value:
|
551
|
+
xtype: 'hidden',
|
552
|
+
name: 'id',
|
553
|
+
value: sectionId
|
256
554
|
}
|
257
555
|
]
|
258
|
-
}
|
259
|
-
buttons:[
|
556
|
+
},
|
557
|
+
buttons: [
|
260
558
|
{
|
261
|
-
text:'Submit',
|
262
|
-
listeners:{
|
263
|
-
'click':function (button) {
|
559
|
+
text: 'Submit',
|
560
|
+
listeners: {
|
561
|
+
'click': function (button) {
|
264
562
|
var window = button.findParentByType('window');
|
265
563
|
var formPanel = window.query('.form')[0];
|
266
|
-
self.setWindowStatus('Updating section...');
|
564
|
+
//self.setWindowStatus('Updating section...');
|
267
565
|
formPanel.getForm().submit({
|
268
|
-
success:function (form, action) {
|
269
|
-
self.clearWindowStatus();
|
566
|
+
success: function (form, action) {
|
567
|
+
//self.clearWindowStatus();
|
270
568
|
var values = formPanel.getValues();
|
271
569
|
record.set('title', values.title);
|
272
570
|
record.set('text', values.title);
|
@@ -274,10 +572,10 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
|
|
274
572
|
record.set("inMenu", (values.in_menu == 'yes'));
|
275
573
|
record.set("renderWithBaseLayout", (values.render_with_base_layout == 'yes'));
|
276
574
|
record.commit();
|
277
|
-
|
575
|
+
window.close();
|
278
576
|
},
|
279
|
-
failure:function (form, action) {
|
280
|
-
self.clearWindowStatus();
|
577
|
+
failure: function (form, action) {
|
578
|
+
//self.clearWindowStatus();
|
281
579
|
var obj = Ext.decode(action.response.responseText);
|
282
580
|
Ext.Msg.alert("Error", obj.msg);
|
283
581
|
}
|
@@ -286,58 +584,60 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
|
|
286
584
|
}
|
287
585
|
},
|
288
586
|
{
|
289
|
-
text:'Close',
|
290
|
-
handler:function () {
|
291
|
-
|
587
|
+
text: 'Close',
|
588
|
+
handler: function (btn) {
|
589
|
+
btn.up('window').close();
|
292
590
|
}
|
293
591
|
}
|
294
592
|
]
|
295
|
-
});
|
296
|
-
updateSectionWindow.show();
|
593
|
+
}).show();
|
297
594
|
}
|
298
595
|
}
|
299
|
-
})
|
596
|
+
})
|
597
|
+
;
|
300
598
|
}
|
301
599
|
|
302
600
|
//no layouts for blogs.
|
303
601
|
if (Compass.ErpApp.Utility.isBlank(record.data['isBlog']) && record.data['hasLayout']) {
|
304
|
-
if (currentUser.hasCapability('edit','WebsiteSectionLayout')) {
|
602
|
+
if (currentUser.hasCapability('edit', 'WebsiteSectionLayout')) {
|
305
603
|
items.push({
|
306
|
-
text:'Edit Layout',
|
307
|
-
iconCls:'icon-edit',
|
308
|
-
listeners:{
|
309
|
-
'click':function () {
|
310
|
-
|
604
|
+
text: 'Edit Layout',
|
605
|
+
iconCls: 'icon-edit',
|
606
|
+
listeners: {
|
607
|
+
'click': function () {
|
608
|
+
var sectionPanel = Ext.ComponentQuery.query('#knitkitSiteContentsTreePanel').first();
|
609
|
+
sectionPanel.editSectionLayout(record.data.text, sectionId, record.data.siteId);
|
311
610
|
}
|
312
611
|
}
|
313
612
|
});
|
314
613
|
}
|
315
614
|
}
|
316
615
|
else if (Compass.ErpApp.Utility.isBlank(record.data['isBlog'])) {
|
317
|
-
if (currentUser.hasCapability('create','WebsiteSectionLayout')) {
|
616
|
+
if (currentUser.hasCapability('create', 'WebsiteSectionLayout')) {
|
318
617
|
items.push({
|
319
|
-
text:'Add Layout',
|
320
|
-
iconCls:'icon-add',
|
321
|
-
listeners:{
|
322
|
-
'click':function () {
|
323
|
-
var sectionId = record.data.id.split('_')[1];
|
618
|
+
text: 'Add Layout',
|
619
|
+
iconCls: 'icon-add',
|
620
|
+
listeners: {
|
621
|
+
'click': function () {
|
324
622
|
Ext.Ajax.request({
|
325
|
-
url:'/knitkit/erp_app/desktop/section/add_layout',
|
326
|
-
method:'POST',
|
327
|
-
params:{
|
328
|
-
id:sectionId
|
623
|
+
url: '/knitkit/erp_app/desktop/section/add_layout',
|
624
|
+
method: 'POST',
|
625
|
+
params: {
|
626
|
+
id: sectionId
|
329
627
|
},
|
330
|
-
success:function (response) {
|
628
|
+
success: function (response) {
|
331
629
|
var obj = Ext.decode(response.responseText);
|
332
630
|
if (obj.success) {
|
333
631
|
record.data.hasLayout = true;
|
334
|
-
|
632
|
+
|
633
|
+
var sectionPanel = Ext.ComponentQuery.query('#knitkitSiteContentsTreePanel').first();
|
634
|
+
sectionPanel.editSectionLayout(record.data.text, sectionId, record.data.siteId);
|
335
635
|
}
|
336
636
|
else {
|
337
637
|
Ext.Msg.alert('Status', obj.message);
|
338
638
|
}
|
339
639
|
},
|
340
|
-
failure:function (response) {
|
640
|
+
failure: function (response) {
|
341
641
|
Ext.Msg.alert('Status', 'Error adding layout.');
|
342
642
|
}
|
343
643
|
});
|
@@ -347,17 +647,43 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
|
|
347
647
|
}
|
348
648
|
}
|
349
649
|
|
350
|
-
if (currentUser.hasCapability('delete','WebsiteSection')) {
|
650
|
+
if (currentUser.hasCapability('delete', 'WebsiteSection')) {
|
351
651
|
items.push({
|
352
|
-
text:'Delete ' + record.data["type"],
|
353
|
-
iconCls:'icon-delete',
|
354
|
-
listeners:{
|
355
|
-
'click':function () {
|
356
|
-
|
652
|
+
text: 'Delete ' + record.data["type"],
|
653
|
+
iconCls: 'icon-delete',
|
654
|
+
listeners: {
|
655
|
+
'click': function () {
|
656
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this section?<br> NOTE: Articles belonging to this section will be orphaned.<br><br>', function (btn) {
|
657
|
+
if (btn == 'no') {
|
658
|
+
return false;
|
659
|
+
}
|
660
|
+
else if (btn == 'yes') {
|
661
|
+
Ext.Ajax.request({
|
662
|
+
url: '/knitkit/erp_app/desktop/section/delete',
|
663
|
+
method: 'POST',
|
664
|
+
params: {
|
665
|
+
id: sectionId
|
666
|
+
},
|
667
|
+
success: function (response) {
|
668
|
+
|
669
|
+
var obj = Ext.decode(response.responseText);
|
670
|
+
if (obj.success) {
|
671
|
+
record.remove();
|
672
|
+
}
|
673
|
+
else {
|
674
|
+
Ext.Msg.alert('Error', 'Error deleting section');
|
675
|
+
}
|
676
|
+
},
|
677
|
+
failure: function (response) {
|
678
|
+
Ext.Msg.alert('Error', 'Error deleting section');
|
679
|
+
}
|
680
|
+
});
|
681
|
+
}
|
682
|
+
});
|
357
683
|
}
|
358
684
|
}
|
359
685
|
});
|
360
686
|
}
|
361
|
-
|
362
687
|
return items;
|
363
|
-
}
|
688
|
+
}
|
689
|
+
;
|