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,33 +1,33 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.EastRegion",{
|
2
|
-
extend:"Ext.tab.Panel",
|
3
|
-
alias:'widget.knitkit_eastregion',
|
4
|
-
|
5
|
-
constructor
|
6
|
-
this.imageAssetsPanel = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel', { module: config.module });
|
7
|
-
this.widgetsPanel = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.WidgetsPanel', { module: config.module });
|
8
|
-
this.fileAssetsPanel = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel', { module: config.module });
|
9
|
-
this.items = [];
|
10
|
-
|
11
|
-
if (currentUser.hasCapability('view','GlobalImageAsset') || currentUser.hasCapability('view','SiteImageAsset')){
|
12
|
-
this.items.push(this.imageAssetsPanel);
|
13
|
-
}
|
14
|
-
|
15
|
-
if (currentUser.hasCapability('view','GlobalFileAsset') || currentUser.hasCapability('view','SiteFileAsset')){
|
16
|
-
this.items.push(this.fileAssetsPanel);
|
17
|
-
}
|
18
|
-
|
19
|
-
this.items.push(this.widgetsPanel);
|
20
|
-
|
21
|
-
config = Ext.apply({
|
22
|
-
deferredRender:false,
|
23
|
-
|
24
|
-
region:'east',
|
25
|
-
width:
|
26
|
-
split:true,
|
27
|
-
collapsible:true,
|
28
|
-
activeTab: 0
|
29
|
-
}, config);
|
30
|
-
|
31
|
-
this.callParent([config]);
|
32
|
-
}
|
33
|
-
});
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.EastRegion", {
|
2
|
+
extend: "Ext.tab.Panel",
|
3
|
+
alias: 'widget.knitkit_eastregion',
|
4
|
+
|
5
|
+
constructor: function (config) {
|
6
|
+
this.imageAssetsPanel = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel', { module: config.module });
|
7
|
+
this.widgetsPanel = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.WidgetsPanel', { module: config.module });
|
8
|
+
this.fileAssetsPanel = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel', { module: config.module });
|
9
|
+
this.items = [];
|
10
|
+
|
11
|
+
if (currentUser.hasCapability('view', 'GlobalImageAsset') || currentUser.hasCapability('view', 'SiteImageAsset')) {
|
12
|
+
this.items.push(this.imageAssetsPanel);
|
13
|
+
}
|
14
|
+
|
15
|
+
if (currentUser.hasCapability('view', 'GlobalFileAsset') || currentUser.hasCapability('view', 'SiteFileAsset')) {
|
16
|
+
this.items.push(this.fileAssetsPanel);
|
17
|
+
}
|
18
|
+
|
19
|
+
this.items.push(this.widgetsPanel);
|
20
|
+
|
21
|
+
config = Ext.apply({
|
22
|
+
deferredRender: false,
|
23
|
+
id: 'knitkitEastRegion',
|
24
|
+
region: 'east',
|
25
|
+
width: 280,
|
26
|
+
split: true,
|
27
|
+
collapsible: true,
|
28
|
+
activeTab: 0
|
29
|
+
}, config);
|
30
|
+
|
31
|
+
this.callParent([config]);
|
32
|
+
}
|
33
|
+
});
|
@@ -0,0 +1,332 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel", {
|
2
|
+
extend: "Ext.tab.Panel",
|
3
|
+
alias: 'widget.knitkit_FileAssetsPanel',
|
4
|
+
cls: 'file-assets-panel',
|
5
|
+
|
6
|
+
constructor: function (config) {
|
7
|
+
this.websiteId = null;
|
8
|
+
var self = this;
|
9
|
+
self.module = config.module;
|
10
|
+
|
11
|
+
this.changeSecurityOnFile = function (node, secure, model, websiteId) {
|
12
|
+
var updateUrl = '/knitkit/erp_app/desktop/file_assets/' + model + '/update_security';
|
13
|
+
Ext.Ajax.request({
|
14
|
+
url: '/knitkit/erp_app/desktop/available_roles',
|
15
|
+
method: 'POST',
|
16
|
+
success: function (response) {
|
17
|
+
var obj = Ext.decode(response.responseText);
|
18
|
+
if (obj.success) {
|
19
|
+
Ext.create('widget.knikit_selectroleswindow', {
|
20
|
+
baseParams: {
|
21
|
+
path: node.get('id'),
|
22
|
+
website_id: websiteId
|
23
|
+
},
|
24
|
+
url: updateUrl,
|
25
|
+
currentRoles: node.get('roles'),
|
26
|
+
availableRoles: obj.availableRoles,
|
27
|
+
listeners: {
|
28
|
+
success: function (window, response) {
|
29
|
+
if (response.success) {
|
30
|
+
node.set('roles', response.roles);
|
31
|
+
if (response.secured) {
|
32
|
+
node.set('iconCls', 'icon-document_lock');
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
node.set('iconCls', 'icon-document');
|
36
|
+
}
|
37
|
+
node.set('isSecured', response.secured);
|
38
|
+
node.commit();
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
Ext.Msg.alert('Error', 'Error securing file.');
|
42
|
+
}
|
43
|
+
},
|
44
|
+
failure: function () {
|
45
|
+
Ext.Msg.alert('Error', 'Could not update security');
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}).show();
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
Ext.Msg.alert('Error', 'Could not load available roles');
|
52
|
+
}
|
53
|
+
},
|
54
|
+
failure: function (response) {
|
55
|
+
Ext.Msg.alert('Error', 'Could not load available roles');
|
56
|
+
}
|
57
|
+
});
|
58
|
+
};
|
59
|
+
|
60
|
+
this.sharedFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree", {
|
61
|
+
loadMask: true,
|
62
|
+
collapsible: false,
|
63
|
+
title: 'Shared',
|
64
|
+
rootText: 'Shared Files',
|
65
|
+
allowDownload: false,
|
66
|
+
addViewContentsToContextMenu: false,
|
67
|
+
showNewFileMenuItem: false,
|
68
|
+
rootVisible: true,
|
69
|
+
multiSelect: true,
|
70
|
+
controllerPath: '/knitkit/erp_app/desktop/file_assets/shared',
|
71
|
+
standardUploadUrl: '/knitkit/erp_app/desktop/file_assets/shared/upload_file',
|
72
|
+
url: '/knitkit/erp_app/desktop/file_assets/shared/expand_directory',
|
73
|
+
containerScroll: true,
|
74
|
+
additionalContextMenuItems: [
|
75
|
+
{
|
76
|
+
nodeType: 'leaf',
|
77
|
+
text: 'Insert link at cursor',
|
78
|
+
iconCls: 'icon-add',
|
79
|
+
listeners: {
|
80
|
+
scope: self,
|
81
|
+
'click': function () {
|
82
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
83
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function (btn, text) {
|
84
|
+
if (btn == 'ok') {
|
85
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/' + node.data.text + '?path=' + node.data.downloadPath + '">' + text + '</a>');
|
86
|
+
}
|
87
|
+
});
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
{
|
92
|
+
nodeType: 'leaf',
|
93
|
+
text: 'Insert link at cursor (inline)',
|
94
|
+
iconCls: 'icon-add',
|
95
|
+
listeners: {
|
96
|
+
scope: self,
|
97
|
+
'click': function () {
|
98
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
99
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function (btn, text) {
|
100
|
+
if (btn == 'ok') {
|
101
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/' + node.data.text + '?path=' + node.data.downloadPath + '&disposition=inline">' + text + '</a>');
|
102
|
+
}
|
103
|
+
});
|
104
|
+
}
|
105
|
+
}
|
106
|
+
},
|
107
|
+
{
|
108
|
+
nodeType: 'leaf',
|
109
|
+
text: 'Insert link at cursor (prompt)',
|
110
|
+
iconCls: 'icon-add',
|
111
|
+
listeners: {
|
112
|
+
scope: self,
|
113
|
+
'click': function () {
|
114
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
115
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function (btn, text) {
|
116
|
+
if (btn == 'ok') {
|
117
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/' + node.data.text + '?path=' + node.data.downloadPath + '&disposition=attachment">' + text + '</a>');
|
118
|
+
}
|
119
|
+
});
|
120
|
+
}
|
121
|
+
}
|
122
|
+
},
|
123
|
+
{
|
124
|
+
nodeType: 'leaf',
|
125
|
+
text: 'Security',
|
126
|
+
iconCls: 'icon-document_lock',
|
127
|
+
listeners: {
|
128
|
+
scope: self,
|
129
|
+
'click': function () {
|
130
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
131
|
+
self.changeSecurityOnFile(node, !node.get('isSecured'), 'shared');
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
],
|
136
|
+
listeners: {
|
137
|
+
'allowdelete': function () {
|
138
|
+
return currentUser.hasCapability('delete', 'GlobalFileAsset');
|
139
|
+
},
|
140
|
+
'allowupload': function () {
|
141
|
+
return currentUser.hasCapability('upload', 'GlobalFileAsset');
|
142
|
+
},
|
143
|
+
'itemclick': function (view, record, item, index, e) {
|
144
|
+
e.stopEvent();
|
145
|
+
return false;
|
146
|
+
},
|
147
|
+
'fileDeleted': function (fileTreePanel, node) {
|
148
|
+
},
|
149
|
+
'fileUploaded': function (fileTreePanel, node) {
|
150
|
+
},
|
151
|
+
'downloadfile': function (fileTreePanel, node) {
|
152
|
+
window.open("/download/" + node.data.text + "?path=" + node.data.downloadPath, 'mywindow', 'width=400,height=200');
|
153
|
+
return false;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
this.websiteFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree", {
|
159
|
+
itemId: 'websiteFileAssetsTreePanel',
|
160
|
+
autoRender: true,
|
161
|
+
loadMask: true,
|
162
|
+
collapsible: false,
|
163
|
+
autoLoadRoot: false,
|
164
|
+
title: 'Website',
|
165
|
+
allowDownload: false,
|
166
|
+
addViewContentsToContextMenu: false,
|
167
|
+
showNewFileMenuItem: false,
|
168
|
+
rootVisible: true,
|
169
|
+
multiSelect: true,
|
170
|
+
controllerPath: '/knitkit/erp_app/desktop/file_assets/website',
|
171
|
+
standardUploadUrl: '/knitkit/erp_app/desktop/file_assets/website/upload_file',
|
172
|
+
url: '/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
173
|
+
containerScroll: true,
|
174
|
+
additionalContextMenuItems: [
|
175
|
+
{
|
176
|
+
nodeType: 'leaf',
|
177
|
+
text: 'Insert link at cursor',
|
178
|
+
iconCls: 'icon-add',
|
179
|
+
listeners: {
|
180
|
+
scope: self,
|
181
|
+
'click': function () {
|
182
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
183
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function (btn, text) {
|
184
|
+
if (btn == 'ok') {
|
185
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/' + node.data.text + '?path=' + node.data.downloadPath + '">' + text + '</a>');
|
186
|
+
}
|
187
|
+
});
|
188
|
+
}
|
189
|
+
}
|
190
|
+
},
|
191
|
+
{
|
192
|
+
nodeType: 'leaf',
|
193
|
+
text: 'Insert link at cursor (inline)',
|
194
|
+
iconCls: 'icon-add',
|
195
|
+
listeners: {
|
196
|
+
scope: self,
|
197
|
+
'click': function () {
|
198
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
199
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function (btn, text) {
|
200
|
+
if (btn == 'ok') {
|
201
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/' + node.data.text + '?path=' + node.data.downloadPath + '&disposition=inline">' + text + '</a>');
|
202
|
+
}
|
203
|
+
});
|
204
|
+
}
|
205
|
+
}
|
206
|
+
},
|
207
|
+
{
|
208
|
+
nodeType: 'leaf',
|
209
|
+
text: 'Insert link at cursor (prompt)',
|
210
|
+
iconCls: 'icon-add',
|
211
|
+
listeners: {
|
212
|
+
scope: self,
|
213
|
+
'click': function () {
|
214
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
215
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function (btn, text) {
|
216
|
+
if (btn == 'ok') {
|
217
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/' + node.data.text + '?path=' + node.data.downloadPath + '&disposition=attachment">' + text + '</a>');
|
218
|
+
}
|
219
|
+
});
|
220
|
+
}
|
221
|
+
}
|
222
|
+
},
|
223
|
+
{
|
224
|
+
nodeType: 'leaf',
|
225
|
+
text: 'Security',
|
226
|
+
iconCls: 'icon-document_lock',
|
227
|
+
listeners: {
|
228
|
+
scope: self,
|
229
|
+
'click': function () {
|
230
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
231
|
+
self.changeSecurityOnFile(node, !node.get('isSecured'), 'website', this.websiteId);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
],
|
236
|
+
listeners: {
|
237
|
+
scope: self,
|
238
|
+
'load': function (store, node, records) {
|
239
|
+
store.getRootNode().data.text = self.websiteName;
|
240
|
+
self.websiteFileAssetsTreePanel.view.refresh();
|
241
|
+
},
|
242
|
+
'show': function (panel) {
|
243
|
+
// workaround for extJS rendering bug. tree tries to load faster than extjs can render, wait X ms
|
244
|
+
setTimeout(function () {
|
245
|
+
self.reloadWebsiteFileAssetsTreePanel(self.websiteId);
|
246
|
+
}, 100);
|
247
|
+
},
|
248
|
+
'itemclick': function (view, record, item, index, e) {
|
249
|
+
e.stopEvent();
|
250
|
+
return false;
|
251
|
+
},
|
252
|
+
'fileDeleted': function (fileTreePanel, node) {
|
253
|
+
},
|
254
|
+
'fileUploaded': function (fileTreePanel, node) {
|
255
|
+
},
|
256
|
+
'downloadfile': function (fileTreePanel, node) {
|
257
|
+
window.open("/download/" + node.data.text + "?path=" + node.data.downloadPath, 'mywindow', 'width=400,height=200');
|
258
|
+
return false;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
});
|
262
|
+
|
263
|
+
this.selectWebsite = function (website) {
|
264
|
+
this.websiteId = website.id;
|
265
|
+
this.websiteName = website.name;
|
266
|
+
this.reloadWebsiteFileAssetsTreePanel(website.id);
|
267
|
+
};
|
268
|
+
|
269
|
+
this.clearWebsite = function () {
|
270
|
+
this.websiteId = null;
|
271
|
+
this.websiteName = null;
|
272
|
+
|
273
|
+
this.websiteFileAssetsTreePanel.extraPostData = {
|
274
|
+
website_id: null
|
275
|
+
};
|
276
|
+
this.websiteFileAssetsTreePanel.getStore().setProxy({
|
277
|
+
type: 'ajax',
|
278
|
+
url: '/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
279
|
+
extraParams: {
|
280
|
+
website_id: null
|
281
|
+
}
|
282
|
+
});
|
283
|
+
|
284
|
+
this.websiteFileAssetsTreePanel.getRootNode().removeAll(true);
|
285
|
+
};
|
286
|
+
|
287
|
+
this.reloadWebsiteFileAssetsTreePanel = function (websiteId) {
|
288
|
+
this.websiteFileAssetsTreePanel.extraPostData = {
|
289
|
+
website_id: websiteId
|
290
|
+
};
|
291
|
+
this.websiteFileAssetsTreePanel.getStore().setProxy({
|
292
|
+
type: 'ajax',
|
293
|
+
url: '/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
294
|
+
extraParams: {
|
295
|
+
website_id: websiteId
|
296
|
+
}
|
297
|
+
});
|
298
|
+
|
299
|
+
if (websiteId) {
|
300
|
+
while (delNode = this.websiteFileAssetsTreePanel.getRootNode().childNodes[0]) {
|
301
|
+
this.websiteFileAssetsTreePanel.getRootNode().removeChild(delNode);
|
302
|
+
}
|
303
|
+
this.websiteFileAssetsTreePanel.getRootNode().expand();
|
304
|
+
|
305
|
+
if (!this.websiteFileAssetsTreePanel.getStore().isLoading()) {
|
306
|
+
this.websiteFileAssetsTreePanel.getStore().load();
|
307
|
+
}
|
308
|
+
}
|
309
|
+
};
|
310
|
+
|
311
|
+
var items = [];
|
312
|
+
|
313
|
+
if (currentUser.hasCapability('view', 'GlobalFileAsset')) {
|
314
|
+
items.push(this.sharedFileAssetsTreePanel);
|
315
|
+
}
|
316
|
+
|
317
|
+
if (currentUser.hasCapability('view', 'SiteFileAsset')) {
|
318
|
+
items.push(this.websiteFileAssetsTreePanel);
|
319
|
+
}
|
320
|
+
|
321
|
+
config = Ext.apply({
|
322
|
+
deferredRender: false,
|
323
|
+
layout: 'fit',
|
324
|
+
title: 'Files',
|
325
|
+
items: items,
|
326
|
+
activeTab: 0
|
327
|
+
}, config);
|
328
|
+
|
329
|
+
this.callParent([config]);
|
330
|
+
|
331
|
+
}
|
332
|
+
});
|
data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView", {
|
2
|
+
extend: "Ext.view.View",
|
3
|
+
alias: 'widget.knitkit_imageassetsdataview',
|
4
|
+
directory: null,
|
5
|
+
websiteId: null,
|
6
|
+
constructor: function (config) {
|
7
|
+
var self = this;
|
8
|
+
|
9
|
+
listeners = config.listeners || {};
|
10
|
+
|
11
|
+
listeners['render'] = function (view) {
|
12
|
+
var store = view.getStore();
|
13
|
+
|
14
|
+
if (window.FileReader) {
|
15
|
+
var viewElement = this.getEl();
|
16
|
+
|
17
|
+
Compass.ErpApp.Utility.addEventHandler(viewElement.dom, 'dragover', function (e) {
|
18
|
+
viewElement.setStyle('border', 'solid 1px red');
|
19
|
+
e.preventDefault()
|
20
|
+
});
|
21
|
+
Compass.ErpApp.Utility.addEventHandler(viewElement.dom, 'dragenter', function () {
|
22
|
+
viewElement.setStyle('border', 'solid 1px red');
|
23
|
+
});
|
24
|
+
Compass.ErpApp.Utility.addEventHandler(viewElement.dom, 'dragleave', function () {
|
25
|
+
viewElement.setStyle('border', 'none');
|
26
|
+
});
|
27
|
+
Compass.ErpApp.Utility.addEventHandler(viewElement.dom, 'drop', function (e) {
|
28
|
+
e.preventDefault();
|
29
|
+
|
30
|
+
var dt = e.dataTransfer,
|
31
|
+
files = dt.files;
|
32
|
+
|
33
|
+
for (var i = 0; i < files.length; i++) {
|
34
|
+
var file = files[i],
|
35
|
+
reader = new FileReader();
|
36
|
+
|
37
|
+
Compass.ErpApp.Utility.addEventHandler(reader, 'loadend', function (e, file) {
|
38
|
+
var bin = this.result;
|
39
|
+
|
40
|
+
Ext.Ajax.request({
|
41
|
+
headers: {'Content-Type': file.type},
|
42
|
+
url: config['uploadUrl'],
|
43
|
+
jsonData: bin,
|
44
|
+
params: {
|
45
|
+
name: file.name,
|
46
|
+
directory: self.directory,
|
47
|
+
website_id: self.websiteId,
|
48
|
+
is_drag_drop: true
|
49
|
+
},
|
50
|
+
success: function (result) {
|
51
|
+
resultObj = Ext.JSON.decode(result.responseText);
|
52
|
+
if (resultObj.success) {
|
53
|
+
store.load({
|
54
|
+
params: {
|
55
|
+
directory: self.directory
|
56
|
+
}
|
57
|
+
});
|
58
|
+
self.fireEvent('imageuploaded', self);
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
Ext.Msg.alert('Error', 'Could not upload image');
|
62
|
+
}
|
63
|
+
},
|
64
|
+
failure: function (result) {
|
65
|
+
Ext.Msg.alert('Error', 'Could not upload image');
|
66
|
+
}
|
67
|
+
});
|
68
|
+
}.bindToEventHandler(file));
|
69
|
+
|
70
|
+
reader.readAsDataURL(file);
|
71
|
+
}
|
72
|
+
|
73
|
+
viewElement.setStyle('border', 'none');
|
74
|
+
|
75
|
+
return false;
|
76
|
+
})
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
listeners['itemcontextmenu'] = function (view, record, htmlitem, index, e, options) {
|
84
|
+
e.stopEvent();
|
85
|
+
|
86
|
+
var contextMenu = Ext.create("Ext.menu.Menu", {
|
87
|
+
items: [
|
88
|
+
{
|
89
|
+
text: 'Insert Image At Cursor',
|
90
|
+
iconCls: 'icon-add',
|
91
|
+
handler: function () {
|
92
|
+
var imgTagHtml = '<img';
|
93
|
+
if (record.get('width') && record.get('height')) {
|
94
|
+
imgTagHtml += (' width="' + record.get('width') + '" height="' + record.get('height') + '"');
|
95
|
+
}
|
96
|
+
imgTagHtml += ' alt="' + record.get('name') + '" src="' + record.get('url') + '" >';
|
97
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror(imgTagHtml);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
]
|
101
|
+
});
|
102
|
+
contextMenu.showAt(e.xy);
|
103
|
+
};
|
104
|
+
|
105
|
+
config = Ext.apply({
|
106
|
+
autoDestroy: true,
|
107
|
+
style: 'overflow:auto',
|
108
|
+
itemSelector: 'div.thumb-wrap',
|
109
|
+
store: Ext.create('Ext.data.Store', {
|
110
|
+
proxy: {
|
111
|
+
type: 'ajax',
|
112
|
+
url: config['url'],
|
113
|
+
reader: {
|
114
|
+
type: 'json',
|
115
|
+
root: 'images'
|
116
|
+
}
|
117
|
+
},
|
118
|
+
fields: ['name', 'url', 'shortName', 'id', 'downloadPath', 'height', 'width']
|
119
|
+
}),
|
120
|
+
tpl: new Ext.XTemplate(
|
121
|
+
'<tpl for=".">',
|
122
|
+
'<div class="thumb-wrap" id="{name}">',
|
123
|
+
'<div class="thumb"><img src="{url}" title="{name}" alt="{name}" class="thumb-img"></div>',
|
124
|
+
'<span>{shortName}</span></div>',
|
125
|
+
'</tpl>'),
|
126
|
+
listeners: listeners
|
127
|
+
}, config);
|
128
|
+
|
129
|
+
this.callParent([config]);
|
130
|
+
},
|
131
|
+
|
132
|
+
initComponent: function () {
|
133
|
+
this.callParent(arguments);
|
134
|
+
|
135
|
+
this.addEvents(
|
136
|
+
/**
|
137
|
+
* @event save
|
138
|
+
* Fired when image is uploaded.
|
139
|
+
* @param {Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView} This component
|
140
|
+
*/
|
141
|
+
'imageuploaded'
|
142
|
+
);
|
143
|
+
}
|
144
|
+
});
|