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,445 +0,0 @@
|
|
1
|
-
var datePickerDivID = "datepicker";
|
2
|
-
var iFrameDivID = "datepickeriframe";
|
3
|
-
|
4
|
-
var dayArrayShort = new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa');
|
5
|
-
var dayArrayMed = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
6
|
-
var dayArrayLong = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
|
7
|
-
var monthArrayShort = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
8
|
-
var monthArrayMed = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
|
9
|
-
var monthArrayLong = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
|
10
|
-
|
11
|
-
// these variables define the date formatting we're expecting and outputting.
|
12
|
-
// If you want to use a different format by default, change the defaultDateSeparator
|
13
|
-
// and defaultDateFormat variables either here or on your HTML page.
|
14
|
-
var defaultDateSeparator = "/"; // common values would be "/" or "."
|
15
|
-
var defaultDateFormat = "mdy" // valid values are "mdy", "dmy", and "ymd"
|
16
|
-
var dateSeparator = defaultDateSeparator;
|
17
|
-
var dateFormat = defaultDateFormat;
|
18
|
-
|
19
|
-
/**
|
20
|
-
This is the main function you'll call from the onClick event of a button.
|
21
|
-
Normally, you'll have something like this on your HTML page:
|
22
|
-
|
23
|
-
Start Date: <input name="StartDate">
|
24
|
-
<input type=button value="select" onclick="displayDatePicker('StartDate');">
|
25
|
-
|
26
|
-
That will cause the datepicker to be displayed beneath the StartDate field and
|
27
|
-
any date that is chosen will update the value of that field. If you'd rather have the
|
28
|
-
datepicker display beneath the button that was clicked, you can code the button
|
29
|
-
like this:
|
30
|
-
|
31
|
-
<input type=button value="select" onclick="displayDatePicker('StartDate', this);">
|
32
|
-
|
33
|
-
So, pretty much, the first argument (dateFieldName) is a string representing the
|
34
|
-
name of the field that will be modified if the user picks a date, and the second
|
35
|
-
argument (displayBelowThisObject) is optional and represents an actual node
|
36
|
-
on the HTML document that the datepicker should be displayed below.
|
37
|
-
|
38
|
-
In version 1.1 of this code, the dtFormat and dtSep variables were added, allowing
|
39
|
-
you to use a specific date format or date separator for a given call to this function.
|
40
|
-
Normally, you'll just want to set these defaults globally with the defaultDateSeparator
|
41
|
-
and defaultDateFormat variables, but it doesn't hurt anything to add them as optional
|
42
|
-
parameters here. An example of use is:
|
43
|
-
|
44
|
-
<input type=button value="select" onclick="displayDatePicker('StartDate', false, 'dmy', '.');">
|
45
|
-
|
46
|
-
This would display the datepicker beneath the StartDate field (because the
|
47
|
-
displayBelowThisObject parameter was false), and update the StartDate field with
|
48
|
-
the chosen value of the datepicker using a date format of dd.mm.yyyy
|
49
|
-
*/
|
50
|
-
function displayDatePicker(dateFieldName, displayBelowThisObject, dtFormat, dtSep)
|
51
|
-
{
|
52
|
-
var targetDateField = document.getElementsByName (dateFieldName).item(0);
|
53
|
-
|
54
|
-
// if we weren't told what node to display the datepicker beneath, just display it
|
55
|
-
// beneath the date field we're updating
|
56
|
-
if (!displayBelowThisObject)
|
57
|
-
displayBelowThisObject = targetDateField;
|
58
|
-
|
59
|
-
// if a date separator character was given, update the dateSeparator variable
|
60
|
-
if (dtSep)
|
61
|
-
dateSeparator = dtSep;
|
62
|
-
else
|
63
|
-
dateSeparator = defaultDateSeparator;
|
64
|
-
|
65
|
-
// if a date format was given, update the dateFormat variable
|
66
|
-
if (dtFormat)
|
67
|
-
dateFormat = dtFormat;
|
68
|
-
else
|
69
|
-
dateFormat = defaultDateFormat;
|
70
|
-
|
71
|
-
var x = displayBelowThisObject.offsetLeft;
|
72
|
-
var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
|
73
|
-
|
74
|
-
// deal with elements inside tables and such
|
75
|
-
var parent = displayBelowThisObject;
|
76
|
-
while (parent.offsetParent) {
|
77
|
-
parent = parent.offsetParent;
|
78
|
-
x += parent.offsetLeft;
|
79
|
-
y += parent.offsetTop ;
|
80
|
-
}
|
81
|
-
|
82
|
-
drawDatePicker(targetDateField, x, y);
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
/**
|
87
|
-
Draw the datepicker object (which is just a table with calendar elements) at the
|
88
|
-
specified x and y coordinates, using the targetDateField object as the input tag
|
89
|
-
that will ultimately be populated with a date.
|
90
|
-
|
91
|
-
This function will normally be called by the displayDatePicker function.
|
92
|
-
*/
|
93
|
-
function drawDatePicker(targetDateField, x, y)
|
94
|
-
{
|
95
|
-
var dt = getFieldDate(targetDateField.value );
|
96
|
-
|
97
|
-
// the datepicker table will be drawn inside of a <div> with an ID defined by the
|
98
|
-
// global datePickerDivID variable. If such a div doesn't yet exist on the HTML
|
99
|
-
// document we're working with, add one.
|
100
|
-
if (!document.getElementById(datePickerDivID)) {
|
101
|
-
// don't use innerHTML to update the body, because it can cause global variables
|
102
|
-
// that are currently pointing to objects on the page to have bad references
|
103
|
-
//document.body.innerHTML += "<div id='" + datePickerDivID + "' class='dpDiv'></div>";
|
104
|
-
var newNode = document.createElement("div");
|
105
|
-
newNode.setAttribute("id", datePickerDivID);
|
106
|
-
newNode.setAttribute("class", "dpDiv");
|
107
|
-
newNode.setAttribute("style", "visibility: hidden;");
|
108
|
-
document.body.appendChild(newNode);
|
109
|
-
}
|
110
|
-
|
111
|
-
// move the datepicker div to the proper x,y coordinate and toggle the visiblity
|
112
|
-
var pickerDiv = document.getElementById(datePickerDivID);
|
113
|
-
pickerDiv.style.position = "absolute";
|
114
|
-
pickerDiv.style.left = x + "px";
|
115
|
-
pickerDiv.style.top = y + "px";
|
116
|
-
pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible");
|
117
|
-
pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
|
118
|
-
pickerDiv.style.zIndex = 10000;
|
119
|
-
|
120
|
-
// draw the datepicker table
|
121
|
-
refreshDatePicker(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate());
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
/**
|
126
|
-
This is the function that actually draws the datepicker calendar.
|
127
|
-
*/
|
128
|
-
function refreshDatePicker(dateFieldName, year, month, day)
|
129
|
-
{
|
130
|
-
// if no arguments are passed, use today's date; otherwise, month and year
|
131
|
-
// are required (if a day is passed, it will be highlighted later)
|
132
|
-
var thisDay = new Date();
|
133
|
-
|
134
|
-
if ((month >= 0) && (year > 0)) {
|
135
|
-
thisDay = new Date(year, month, 1);
|
136
|
-
} else {
|
137
|
-
day = thisDay.getDate();
|
138
|
-
thisDay.setDate(1);
|
139
|
-
}
|
140
|
-
|
141
|
-
// the calendar will be drawn as a table
|
142
|
-
// you can customize the table elements with a global CSS style sheet,
|
143
|
-
// or by hardcoding style and formatting elements below
|
144
|
-
var crlf = "\r\n";
|
145
|
-
var TABLE = "<table cols=7 class='dpTable'>" + crlf;
|
146
|
-
var xTABLE = "</table>" + crlf;
|
147
|
-
var TR = "<tr class='dpTR'>";
|
148
|
-
var TR_title = "<tr class='dpTitleTR'>";
|
149
|
-
var TR_days = "<tr class='dpDayTR'>";
|
150
|
-
var TR_todaybutton = "<tr class='dpTodayButtonTR'>";
|
151
|
-
var xTR = "</tr>" + crlf;
|
152
|
-
var TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver=' this.className=\"dpTDHover\";' "; // leave this tag open, because we'll be adding an onClick event
|
153
|
-
var TD_title = "<td colspan=5 class='dpTitleTD'>";
|
154
|
-
var TD_buttons = "<td class='dpButtonTD'>";
|
155
|
-
var TD_todaybutton = "<td colspan=7 class='dpTodayButtonTD'>";
|
156
|
-
var TD_days = "<td class='dpDayTD'>";
|
157
|
-
var TD_selected = "<td class='dpDayHighlightTD' onMouseOut='this.className=\"dpDayHighlightTD\";' onMouseOver='this.className=\"dpTDHover\";' "; // leave this tag open, because we'll be adding an onClick event
|
158
|
-
var xTD = "</td>" + crlf;
|
159
|
-
var DIV_title = "<div class='dpTitleText'>";
|
160
|
-
var DIV_selected = "<div class='dpDayHighlight'>";
|
161
|
-
var xDIV = "</div>";
|
162
|
-
|
163
|
-
// start generating the code for the calendar table
|
164
|
-
var html = TABLE;
|
165
|
-
|
166
|
-
// this is the title bar, which displays the month and the buttons to
|
167
|
-
// go back to a previous month or forward to the next month
|
168
|
-
html += TR_title;
|
169
|
-
html += TD_buttons + getButtonCode(dateFieldName, thisDay, -1, "<") + xTD;
|
170
|
-
html += TD_title + DIV_title + monthArrayLong[ thisDay.getMonth()] + " " + thisDay.getFullYear() + xDIV + xTD;
|
171
|
-
html += TD_buttons + getButtonCode(dateFieldName, thisDay, 1, ">") + xTD;
|
172
|
-
html += xTR;
|
173
|
-
|
174
|
-
// this is the row that indicates which day of the week we're on
|
175
|
-
html += TR_days;
|
176
|
-
for(i = 0; i < dayArrayShort.length; i++)
|
177
|
-
html += TD_days + dayArrayShort[i] + xTD;
|
178
|
-
html += xTR;
|
179
|
-
|
180
|
-
// now we'll start populating the table with days of the month
|
181
|
-
html += TR;
|
182
|
-
|
183
|
-
// first, the leading blanks
|
184
|
-
for (i = 0; i < thisDay.getDay(); i++)
|
185
|
-
html += TD + " " + xTD;
|
186
|
-
|
187
|
-
// now, the days of the month
|
188
|
-
do {
|
189
|
-
dayNum = thisDay.getDate();
|
190
|
-
if(new Date(thisDay.getFullYear(), thisDay.getMonth(), (thisDay.getDate() + 1)) >= new Date()){
|
191
|
-
TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString(thisDay) + "');\">";
|
192
|
-
}
|
193
|
-
else{
|
194
|
-
TD_onclick = " onclick=\"alert('Invalid Date');\">";
|
195
|
-
}
|
196
|
-
|
197
|
-
if (dayNum == day)
|
198
|
-
html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
|
199
|
-
else
|
200
|
-
html += TD + TD_onclick + dayNum + xTD;
|
201
|
-
|
202
|
-
// if this is a Saturday, start a new row
|
203
|
-
if (thisDay.getDay() == 6)
|
204
|
-
html += xTR + TR;
|
205
|
-
|
206
|
-
// increment the day
|
207
|
-
thisDay.setDate(thisDay.getDate() + 1);
|
208
|
-
} while (thisDay.getDate() > 1)
|
209
|
-
|
210
|
-
// fill in any trailing blanks
|
211
|
-
if (thisDay.getDay() > 0) {
|
212
|
-
for (i = 6; i > thisDay.getDay(); i--)
|
213
|
-
html += TD + " " + xTD;
|
214
|
-
}
|
215
|
-
html += xTR;
|
216
|
-
|
217
|
-
// add a button to allow the user to easily return to today, or close the calendar
|
218
|
-
var today = new Date();
|
219
|
-
var todayString = "Today is " + dayArrayMed[today.getDay()] + ", " + monthArrayMed[ today.getMonth()] + " " + today.getDate();
|
220
|
-
html += TR_todaybutton + TD_todaybutton;
|
221
|
-
html += "<button class='dpTodayButton' onClick='refreshDatePicker(\"" + dateFieldName + "\");'>this month</button> ";
|
222
|
-
html += "<button class='dpTodayButton' onClick='updateDateField(\"" + dateFieldName + "\");'>close</button>";
|
223
|
-
html += xTD + xTR;
|
224
|
-
|
225
|
-
// and finally, close the table
|
226
|
-
html += xTABLE;
|
227
|
-
|
228
|
-
document.getElementById(datePickerDivID).innerHTML = html;
|
229
|
-
// add an "iFrame shim" to allow the datepicker to display above selection lists
|
230
|
-
adjustiFrame();
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
/**
|
235
|
-
Convenience function for writing the code for the buttons that bring us back or forward
|
236
|
-
a month.
|
237
|
-
*/
|
238
|
-
function getButtonCode(dateFieldName, dateVal, adjust, label)
|
239
|
-
{
|
240
|
-
var newMonth = (dateVal.getMonth () + adjust) % 12;
|
241
|
-
var newYear = dateVal.getFullYear() + parseInt((dateVal.getMonth() + adjust) / 12);
|
242
|
-
if (newMonth < 0) {
|
243
|
-
newMonth += 12;
|
244
|
-
newYear += -1;
|
245
|
-
}
|
246
|
-
|
247
|
-
return "<button class='dpButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", " + newYear + ", " + newMonth + ");'>" + label + "</button>";
|
248
|
-
}
|
249
|
-
|
250
|
-
|
251
|
-
/**
|
252
|
-
Convert a JavaScript Date object to a string, based on the dateFormat and dateSeparator
|
253
|
-
variables at the beginning of this script library.
|
254
|
-
*/
|
255
|
-
function getDateString(dateVal)
|
256
|
-
{
|
257
|
-
var dayString = "00" + dateVal.getDate();
|
258
|
-
var monthString = "00" + (dateVal.getMonth()+1);
|
259
|
-
dayString = dayString.substring(dayString.length - 2);
|
260
|
-
monthString = monthString.substring(monthString.length - 2);
|
261
|
-
|
262
|
-
switch (dateFormat) {
|
263
|
-
case "dmy" :
|
264
|
-
return dayString + dateSeparator + monthString + dateSeparator + dateVal.getFullYear();
|
265
|
-
case "ymd" :
|
266
|
-
return dateVal.getFullYear() + dateSeparator + monthString + dateSeparator + dayString;
|
267
|
-
case "mdy" :
|
268
|
-
default :
|
269
|
-
return monthString + dateSeparator + dayString + dateSeparator + dateVal.getFullYear();
|
270
|
-
}
|
271
|
-
}
|
272
|
-
|
273
|
-
|
274
|
-
/**
|
275
|
-
Convert a string to a JavaScript Date object.
|
276
|
-
*/
|
277
|
-
function getFieldDate(dateString)
|
278
|
-
{
|
279
|
-
var dateVal;
|
280
|
-
var dArray;
|
281
|
-
var d, m, y;
|
282
|
-
|
283
|
-
try {
|
284
|
-
dArray = splitDateString(dateString);
|
285
|
-
if (dArray) {
|
286
|
-
switch (dateFormat) {
|
287
|
-
case "dmy" :
|
288
|
-
d = parseInt(dArray[0], 10);
|
289
|
-
m = parseInt(dArray[1], 10) - 1;
|
290
|
-
y = parseInt(dArray[2], 10);
|
291
|
-
break;
|
292
|
-
case "ymd" :
|
293
|
-
d = parseInt(dArray[2], 10);
|
294
|
-
m = parseInt(dArray[1], 10) - 1;
|
295
|
-
y = parseInt(dArray[0], 10);
|
296
|
-
break;
|
297
|
-
case "mdy" :
|
298
|
-
default :
|
299
|
-
d = parseInt(dArray[1], 10);
|
300
|
-
m = parseInt(dArray[0], 10) - 1;
|
301
|
-
y = parseInt(dArray[2], 10);
|
302
|
-
break;
|
303
|
-
}
|
304
|
-
dateVal = new Date(y, m, d);
|
305
|
-
} else if (dateString) {
|
306
|
-
dateVal = new Date(dateString);
|
307
|
-
} else {
|
308
|
-
dateVal = new Date();
|
309
|
-
}
|
310
|
-
} catch(e) {
|
311
|
-
dateVal = new Date();
|
312
|
-
}
|
313
|
-
|
314
|
-
return dateVal;
|
315
|
-
}
|
316
|
-
|
317
|
-
|
318
|
-
/**
|
319
|
-
Try to split a date string into an array of elements, using common date separators.
|
320
|
-
If the date is split, an array is returned; otherwise, we just return false.
|
321
|
-
*/
|
322
|
-
function splitDateString(dateString)
|
323
|
-
{
|
324
|
-
var dArray;
|
325
|
-
if (dateString.indexOf("/") >= 0)
|
326
|
-
dArray = dateString.split("/");
|
327
|
-
else if (dateString.indexOf(".") >= 0)
|
328
|
-
dArray = dateString.split(".");
|
329
|
-
else if (dateString.indexOf("-") >= 0)
|
330
|
-
dArray = dateString.split("-");
|
331
|
-
else if (dateString.indexOf("\\") >= 0)
|
332
|
-
dArray = dateString.split("\\");
|
333
|
-
else
|
334
|
-
dArray = false;
|
335
|
-
|
336
|
-
return dArray;
|
337
|
-
}
|
338
|
-
|
339
|
-
/**
|
340
|
-
Update the field with the given dateFieldName with the dateString that has been passed,
|
341
|
-
and hide the datepicker. If no dateString is passed, just close the datepicker without
|
342
|
-
changing the field value.
|
343
|
-
|
344
|
-
Also, if the page developer has defined a function called datePickerClosed anywhere on
|
345
|
-
the page or in an imported library, we will attempt to run that function with the updated
|
346
|
-
field as a parameter. This can be used for such things as date validation, setting default
|
347
|
-
values for related fields, etc. For example, you might have a function like this to validate
|
348
|
-
a start date field:
|
349
|
-
|
350
|
-
function datePickerClosed(dateField)
|
351
|
-
{
|
352
|
-
var dateObj = getFieldDate(dateField.value);
|
353
|
-
var today = new Date();
|
354
|
-
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
355
|
-
|
356
|
-
if (dateField.name == "StartDate") {
|
357
|
-
if (dateObj < today) {
|
358
|
-
// if the date is before today, alert the user and display the datepicker again
|
359
|
-
alert("Please enter a date that is today or later");
|
360
|
-
dateField.value = "";
|
361
|
-
document.getElementById(datePickerDivID).style.visibility = "visible";
|
362
|
-
adjustiFrame();
|
363
|
-
} else {
|
364
|
-
// if the date is okay, set the EndDate field to 7 days after the StartDate
|
365
|
-
dateObj.setTime(dateObj.getTime() + (7 * 24 * 60 * 60 * 1000));
|
366
|
-
var endDateField = document.getElementsByName ("EndDate").item(0);
|
367
|
-
endDateField.value = getDateString(dateObj);
|
368
|
-
}
|
369
|
-
}
|
370
|
-
}
|
371
|
-
|
372
|
-
*/
|
373
|
-
function updateDateField(dateFieldName, dateString)
|
374
|
-
{
|
375
|
-
var targetDateField = document.getElementsByName (dateFieldName).item(0);
|
376
|
-
if (dateString)
|
377
|
-
targetDateField.value = dateString;
|
378
|
-
|
379
|
-
var pickerDiv = document.getElementById(datePickerDivID);
|
380
|
-
pickerDiv.style.visibility = "hidden";
|
381
|
-
pickerDiv.style.display = "none";
|
382
|
-
|
383
|
-
adjustiFrame();
|
384
|
-
targetDateField.focus();
|
385
|
-
|
386
|
-
// after the datepicker has closed, optionally run a user-defined function called
|
387
|
-
// datePickerClosed, passing the field that was just updated as a parameter
|
388
|
-
// (note that this will only run if the user actually selected a date from the datepicker)
|
389
|
-
if ((dateString) && (typeof(datePickerClosed) == "function"))
|
390
|
-
datePickerClosed(targetDateField);
|
391
|
-
}
|
392
|
-
|
393
|
-
|
394
|
-
/**
|
395
|
-
Use an "iFrame shim" to deal with problems where the datepicker shows up behind
|
396
|
-
selection list elements, if they're below the datepicker. The problem and solution are
|
397
|
-
described at:
|
398
|
-
|
399
|
-
http://dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx
|
400
|
-
http://dotnetjunkies.com/WebLog/jking/archive/2003/10/30/2975.aspx
|
401
|
-
*/
|
402
|
-
function adjustiFrame(pickerDiv, iFrameDiv)
|
403
|
-
{
|
404
|
-
// we know that Opera doesn't like something about this, so if we
|
405
|
-
// think we're using Opera, don't even try
|
406
|
-
var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
|
407
|
-
if (is_opera)
|
408
|
-
return;
|
409
|
-
|
410
|
-
// put a try/catch block around the whole thing, just in case
|
411
|
-
try {
|
412
|
-
if (!document.getElementById(iFrameDivID)) {
|
413
|
-
// don't use innerHTML to update the body, because it can cause global variables
|
414
|
-
// that are currently pointing to objects on the page to have bad references
|
415
|
-
//document.body.innerHTML += "<iframe id='" + iFrameDivID + "' src='javascript:false;' scrolling='no' frameborder='0'>";
|
416
|
-
var newNode = document.createElement("iFrame");
|
417
|
-
newNode.setAttribute("id", iFrameDivID);
|
418
|
-
newNode.setAttribute("src", "javascript:false;");
|
419
|
-
newNode.setAttribute("scrolling", "no");
|
420
|
-
newNode.setAttribute ("frameborder", "0");
|
421
|
-
document.body.appendChild(newNode);
|
422
|
-
}
|
423
|
-
|
424
|
-
if (!pickerDiv)
|
425
|
-
pickerDiv = document.getElementById(datePickerDivID);
|
426
|
-
if (!iFrameDiv)
|
427
|
-
iFrameDiv = document.getElementById(iFrameDivID);
|
428
|
-
|
429
|
-
try {
|
430
|
-
iFrameDiv.style.position = "absolute";
|
431
|
-
iFrameDiv.style.width = pickerDiv.offsetWidth;
|
432
|
-
iFrameDiv.style.height = pickerDiv.offsetHeight ;
|
433
|
-
iFrameDiv.style.top = pickerDiv.style.top;
|
434
|
-
iFrameDiv.style.left = pickerDiv.style.left;
|
435
|
-
iFrameDiv.style.zIndex = pickerDiv.style.zIndex - 1;
|
436
|
-
iFrameDiv.style.visibility = pickerDiv.style.visibility ;
|
437
|
-
iFrameDiv.style.display = pickerDiv.style.display;
|
438
|
-
} catch(e) {
|
439
|
-
}
|
440
|
-
|
441
|
-
} catch (ee) {
|
442
|
-
}
|
443
|
-
|
444
|
-
}
|
445
|
-
|
@@ -1,341 +0,0 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel",{
|
2
|
-
extend:"Ext.tab.Panel",
|
3
|
-
alias:'widget.knitkit_FileAssetsPanel',
|
4
|
-
|
5
|
-
constructor : function(config) {
|
6
|
-
this.websiteId = null;
|
7
|
-
var self = this;
|
8
|
-
self.module = config.module;
|
9
|
-
|
10
|
-
this.changeSecurityOnFile = function(node, secure, model, websiteId){
|
11
|
-
var updateUrl = '/knitkit/erp_app/desktop/file_assets/'+model+'/update_security';
|
12
|
-
Ext.Ajax.request({
|
13
|
-
url:'/knitkit/erp_app/desktop/available_roles',
|
14
|
-
method:'POST',
|
15
|
-
success:function (response) {
|
16
|
-
var obj = Ext.decode(response.responseText);
|
17
|
-
if (obj.success) {
|
18
|
-
Ext.create('widget.knikit_selectroleswindow',{
|
19
|
-
baseParams:{
|
20
|
-
path:node.get('id'),
|
21
|
-
website_id:websiteId
|
22
|
-
},
|
23
|
-
url: updateUrl,
|
24
|
-
currentRoles:node.get('roles'),
|
25
|
-
availableRoles:obj.availableRoles,
|
26
|
-
listeners:{
|
27
|
-
success:function(window, response){
|
28
|
-
if(response.success){
|
29
|
-
node.set('roles', response.roles);
|
30
|
-
if (response.secured) {
|
31
|
-
node.set('iconCls', 'icon-document_lock');
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
node.set('iconCls', 'icon-document');
|
35
|
-
}
|
36
|
-
node.set('isSecured', response.secured);
|
37
|
-
node.commit();
|
38
|
-
}
|
39
|
-
else{
|
40
|
-
Ext.Msg.alert('Error', 'Error securing file.');
|
41
|
-
}
|
42
|
-
},
|
43
|
-
failure:function(){
|
44
|
-
Ext.Msg.alert('Error', 'Could not update security');
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}).show();
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
Ext.Msg.alert('Error', 'Could not load available roles');
|
51
|
-
}
|
52
|
-
},
|
53
|
-
failure:function (response) {
|
54
|
-
Ext.Msg.alert('Error', 'Could not load available roles');
|
55
|
-
}
|
56
|
-
});
|
57
|
-
},
|
58
|
-
|
59
|
-
// this.changeSecurityOnFile = function(node, secure, model, websiteId){
|
60
|
-
// var msg = secure ? 'Securing file...' : 'Unsecuring file...';
|
61
|
-
// var waitMsg = Ext.Msg.wait("Please Wait", msg);
|
62
|
-
// Ext.Ajax.request({
|
63
|
-
// url: '/knitkit/erp_app/desktop/file_assets/'+model+'/update_security',
|
64
|
-
// method: 'POST',
|
65
|
-
// params:{
|
66
|
-
// path:node.get('id'),
|
67
|
-
// secure:secure,
|
68
|
-
// website_id:websiteId
|
69
|
-
// },
|
70
|
-
// success: function(response) {
|
71
|
-
// var obj = Ext.decode(response.responseText);
|
72
|
-
// if(obj.success){
|
73
|
-
// waitMsg.hide();
|
74
|
-
// if(secure){
|
75
|
-
// node.set('iconCls', 'icon-document_lock');
|
76
|
-
// }
|
77
|
-
// else{
|
78
|
-
// node.set('iconCls', 'icon-document');
|
79
|
-
// }
|
80
|
-
// node.set('isSecured',secure);
|
81
|
-
// node.commit();
|
82
|
-
// }
|
83
|
-
// else{
|
84
|
-
// Ext.Msg.alert('Error', 'Error securing file.');
|
85
|
-
// }
|
86
|
-
// },
|
87
|
-
// failure: function(response) {
|
88
|
-
// waitMsg.hide();
|
89
|
-
// Ext.Msg.alert('Error', 'Error securing file.');
|
90
|
-
// }
|
91
|
-
// });
|
92
|
-
// };
|
93
|
-
|
94
|
-
this.sharedFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
95
|
-
loadMask: true,
|
96
|
-
collapsible:false,
|
97
|
-
title:'Shared',
|
98
|
-
rootText:'Shared Files',
|
99
|
-
allowDownload:false,
|
100
|
-
addViewContentsToContextMenu:false,
|
101
|
-
showNewFileMenuItem:false,
|
102
|
-
rootVisible:true,
|
103
|
-
multiSelect:true,
|
104
|
-
controllerPath:'/knitkit/erp_app/desktop/file_assets/shared',
|
105
|
-
standardUploadUrl:'/knitkit/erp_app/desktop/file_assets/shared/upload_file',
|
106
|
-
url:'/knitkit/erp_app/desktop/file_assets/shared/expand_directory',
|
107
|
-
containerScroll: true,
|
108
|
-
additionalContextMenuItems:[
|
109
|
-
{
|
110
|
-
nodeType:'leaf',
|
111
|
-
text:'Insert link at cursor',
|
112
|
-
iconCls:'icon-add',
|
113
|
-
listeners:{
|
114
|
-
scope:self,
|
115
|
-
'click':function(){
|
116
|
-
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
117
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
118
|
-
if(btn == 'ok'){
|
119
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
120
|
-
}
|
121
|
-
});
|
122
|
-
}
|
123
|
-
}
|
124
|
-
},
|
125
|
-
{
|
126
|
-
nodeType:'leaf',
|
127
|
-
text:'Insert link at cursor (inline)',
|
128
|
-
iconCls:'icon-add',
|
129
|
-
listeners:{
|
130
|
-
scope:self,
|
131
|
-
'click':function(){
|
132
|
-
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
133
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
134
|
-
if(btn == 'ok'){
|
135
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=inline">'+text+'</a>');
|
136
|
-
}
|
137
|
-
});
|
138
|
-
}
|
139
|
-
}
|
140
|
-
},
|
141
|
-
{
|
142
|
-
nodeType:'leaf',
|
143
|
-
text:'Insert link at cursor (prompt)',
|
144
|
-
iconCls:'icon-add',
|
145
|
-
listeners:{
|
146
|
-
scope:self,
|
147
|
-
'click':function(){
|
148
|
-
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
149
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
150
|
-
if(btn == 'ok'){
|
151
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
152
|
-
}
|
153
|
-
});
|
154
|
-
}
|
155
|
-
}
|
156
|
-
},
|
157
|
-
{
|
158
|
-
nodeType:'leaf',
|
159
|
-
text:'Security',
|
160
|
-
iconCls:'icon-document_lock',
|
161
|
-
listeners:{
|
162
|
-
scope:self,
|
163
|
-
'click':function(){
|
164
|
-
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
165
|
-
self.changeSecurityOnFile(node, !node.get('isSecured'), 'shared');
|
166
|
-
}
|
167
|
-
}
|
168
|
-
}],
|
169
|
-
listeners:{
|
170
|
-
'allowdelete':function(){
|
171
|
-
return currentUser.hasCapability('delete','GlobalFileAsset');
|
172
|
-
},
|
173
|
-
'allowupload':function(){
|
174
|
-
return currentUser.hasCapability('upload','GlobalFileAsset');
|
175
|
-
},
|
176
|
-
'itemclick':function(view, record, item, index, e){
|
177
|
-
e.stopEvent();
|
178
|
-
return false;
|
179
|
-
},
|
180
|
-
'fileDeleted':function(fileTreePanel, node){},
|
181
|
-
'fileUploaded':function(fileTreePanel, node){},
|
182
|
-
'downloadfile':function(fileTreePanel, node){
|
183
|
-
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath,'mywindow','width=400,height=200');
|
184
|
-
return false;
|
185
|
-
}
|
186
|
-
}
|
187
|
-
});
|
188
|
-
|
189
|
-
this.websiteFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
190
|
-
itemId: 'websiteFileAssetsTreePanel',
|
191
|
-
autoRender:true,
|
192
|
-
loadMask: true,
|
193
|
-
collapsible:false,
|
194
|
-
autoLoadRoot:false,
|
195
|
-
title:'Website',
|
196
|
-
allowDownload:false,
|
197
|
-
addViewContentsToContextMenu:false,
|
198
|
-
showNewFileMenuItem:false,
|
199
|
-
rootVisible:true,
|
200
|
-
multiSelect:true,
|
201
|
-
controllerPath:'/knitkit/erp_app/desktop/file_assets/website',
|
202
|
-
standardUploadUrl:'/knitkit/erp_app/desktop/file_assets/website/upload_file',
|
203
|
-
url:'/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
204
|
-
containerScroll: true,
|
205
|
-
additionalContextMenuItems:[
|
206
|
-
{
|
207
|
-
nodeType:'leaf',
|
208
|
-
text:'Insert link at cursor',
|
209
|
-
iconCls:'icon-add',
|
210
|
-
listeners:{
|
211
|
-
scope:self,
|
212
|
-
'click':function(){
|
213
|
-
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
214
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
215
|
-
if(btn == 'ok'){
|
216
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
217
|
-
}
|
218
|
-
});
|
219
|
-
}
|
220
|
-
}
|
221
|
-
},
|
222
|
-
{
|
223
|
-
nodeType:'leaf',
|
224
|
-
text:'Insert link at cursor (inline)',
|
225
|
-
iconCls:'icon-add',
|
226
|
-
listeners:{
|
227
|
-
scope:self,
|
228
|
-
'click':function(){
|
229
|
-
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
230
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
231
|
-
if(btn == 'ok'){
|
232
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=inline">'+text+'</a>');
|
233
|
-
}
|
234
|
-
});
|
235
|
-
}
|
236
|
-
}
|
237
|
-
},
|
238
|
-
{
|
239
|
-
nodeType:'leaf',
|
240
|
-
text:'Insert link at cursor (prompt)',
|
241
|
-
iconCls:'icon-add',
|
242
|
-
listeners:{
|
243
|
-
scope:self,
|
244
|
-
'click':function(){
|
245
|
-
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
246
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
247
|
-
if(btn == 'ok'){
|
248
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
249
|
-
}
|
250
|
-
});
|
251
|
-
}
|
252
|
-
}
|
253
|
-
},
|
254
|
-
{
|
255
|
-
nodeType:'leaf',
|
256
|
-
text:'Security',
|
257
|
-
iconCls:'icon-document_lock',
|
258
|
-
listeners:{
|
259
|
-
scope:self,
|
260
|
-
'click':function(){
|
261
|
-
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
262
|
-
self.changeSecurityOnFile(node, !node.get('isSecured'), 'website', this.websiteId);
|
263
|
-
}
|
264
|
-
}
|
265
|
-
}],
|
266
|
-
listeners:{
|
267
|
-
scope:self,
|
268
|
-
'load':function(store, node, records){
|
269
|
-
store.getRootNode().data.text = self.websiteName;
|
270
|
-
self.websiteFileAssetsTreePanel.view.refresh();
|
271
|
-
},
|
272
|
-
'show': function(panel){
|
273
|
-
// workaround for extJS rendering bug. tree tries to load faster than extjs can render, wait X ms
|
274
|
-
setTimeout(function(){
|
275
|
-
self.reloadWebsiteFileAssetsTreePanel(self.websiteId);
|
276
|
-
},100);
|
277
|
-
},
|
278
|
-
'itemclick':function(view, record, item, index, e){
|
279
|
-
e.stopEvent();
|
280
|
-
return false;
|
281
|
-
},
|
282
|
-
'fileDeleted':function(fileTreePanel, node){},
|
283
|
-
'fileUploaded':function(fileTreePanel, node){},
|
284
|
-
'downloadfile':function(fileTreePanel, node){
|
285
|
-
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath,'mywindow','width=400,height=200');
|
286
|
-
return false;
|
287
|
-
}
|
288
|
-
}
|
289
|
-
});
|
290
|
-
|
291
|
-
this.selectWebsite = function(websiteId, websiteName){
|
292
|
-
this.websiteId = websiteId;
|
293
|
-
this.websiteName = websiteName;
|
294
|
-
};
|
295
|
-
|
296
|
-
this.reloadWebsiteFileAssetsTreePanel = function(websiteId){
|
297
|
-
this.websiteFileAssetsTreePanel.extraPostData = {
|
298
|
-
website_id:websiteId
|
299
|
-
};
|
300
|
-
this.websiteFileAssetsTreePanel.getStore().setProxy({
|
301
|
-
type: 'ajax',
|
302
|
-
url:'/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
303
|
-
extraParams:{
|
304
|
-
website_id:websiteId
|
305
|
-
}
|
306
|
-
});
|
307
|
-
|
308
|
-
if (websiteId){
|
309
|
-
while (delNode = this.websiteFileAssetsTreePanel.getRootNode().childNodes[0]) {
|
310
|
-
this.websiteFileAssetsTreePanel.getRootNode().removeChild(delNode);
|
311
|
-
}
|
312
|
-
this.websiteFileAssetsTreePanel.getRootNode().expand();
|
313
|
-
|
314
|
-
if (!this.websiteFileAssetsTreePanel.getStore().isLoading()){
|
315
|
-
this.websiteFileAssetsTreePanel.getStore().load();
|
316
|
-
}
|
317
|
-
}
|
318
|
-
};
|
319
|
-
|
320
|
-
var items = [];
|
321
|
-
|
322
|
-
if (currentUser.hasCapability('view','GlobalFileAsset')){
|
323
|
-
items.push(this.sharedFileAssetsTreePanel);
|
324
|
-
}
|
325
|
-
|
326
|
-
if (currentUser.hasCapability('view','SiteFileAsset')){
|
327
|
-
items.push(this.websiteFileAssetsTreePanel);
|
328
|
-
}
|
329
|
-
|
330
|
-
config = Ext.apply({
|
331
|
-
deferredRender:false,
|
332
|
-
layout: 'fit',
|
333
|
-
title:'Files',
|
334
|
-
items: items,
|
335
|
-
activeTab: 0
|
336
|
-
}, config);
|
337
|
-
|
338
|
-
this.callParent([config]);
|
339
|
-
|
340
|
-
}
|
341
|
-
});
|