mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 12:03:51 +08:00
Fixing javasccript encoding issues
Work Items: 19471 --HG-- branch : 1.x
This commit is contained in:
@@ -32,12 +32,13 @@
|
|||||||
.Replace("Y", "y")
|
.Replace("Y", "y")
|
||||||
.Replace("M", "m")
|
.Replace("M", "m")
|
||||||
;
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@functions {
|
@functions {
|
||||||
|
|
||||||
private string FormatJsList(string csv) {
|
private string FormatJsList(string csv) {
|
||||||
return "'" + String.Join("', '", csv.Split(',').Select(x => x.Trim())) + "'";
|
return "'" + String.Join("', '", csv.Split(',').Select(x => HttpUtility.JavaScriptStringEncode(x.Trim()))) + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,21 +46,21 @@
|
|||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
$(function() {
|
$(function() {
|
||||||
$.datepicker.regional[''] = {
|
$.datepicker.regional[''] = {
|
||||||
closeText: '@T("Done")', // Display text for close link
|
closeText: '@HttpUtility.JavaScriptStringEncode(T("Done").Text)', // Display text for close link
|
||||||
prevText: '@T("Prev")', // Display text for previous month link
|
prevText: '@HttpUtility.JavaScriptStringEncode(T("Prev").Text)', // Display text for previous month link
|
||||||
nextText: '@T("Next")', // Display text for next month link
|
nextText: '@HttpUtility.JavaScriptStringEncode(T("Next").Text)', // Display text for next month link
|
||||||
currentText: '@T("Today")', // Display text for current month link
|
currentText: '@HttpUtility.JavaScriptStringEncode(T("Today").Text)', // Display text for current month link
|
||||||
monthNames: [@Html.Raw(monthNames)], // Names of months for drop-down and formatting
|
monthNames: [@Html.Raw(monthNames)], // Names of months for drop-down and formatting
|
||||||
monthNamesShort: [@Html.Raw(monthNamesShort)], // For formatting
|
monthNamesShort: [@Html.Raw(monthNamesShort)], // For formatting
|
||||||
dayNames: [@Html.Raw(dayNames)], // For formatting
|
dayNames: [@Html.Raw(dayNames)], // For formatting
|
||||||
dayNamesShort: [@Html.Raw(dayNamesShort)], // For formatting
|
dayNamesShort: [@Html.Raw(dayNamesShort)], // For formatting
|
||||||
dayNamesMin: [@Html.Raw(dayNamesMin)], // Column headings for days starting at Sunday
|
dayNamesMin: [@Html.Raw(dayNamesMin)], // Column headings for days starting at Sunday
|
||||||
weekHeader: '@T("Wk")', // Column header for week of the year
|
weekHeader: '@HttpUtility.JavaScriptStringEncode(T("Wk").Text)', // Column header for week of the year
|
||||||
dateFormat: '@dateFormat', // See format options on parseDate
|
dateFormat: '@HttpUtility.JavaScriptStringEncode(dateFormat)', // See format options on parseDate
|
||||||
firstDay: @dateTimeLocalization.FirstDay, // The first day of the week, Sun = 0, Mon = 1, ...
|
firstDay: @dateTimeLocalization.FirstDay, // The first day of the week, Sun = 0, Mon = 1, ...
|
||||||
isRTL: @(cultureInfo.TextInfo.IsRightToLeft ? "true" : "false"), // True if right-to-left language, false if left-to-right
|
isRTL: @(cultureInfo.TextInfo.IsRightToLeft ? "true" : "false"), // True if right-to-left language, false if left-to-right
|
||||||
showMonthAfterYear: @(dateTimeLocalization.ShowMonthAfterYear ? "true" : "false"), // True if the year select precedes month, false for month then year
|
showMonthAfterYear: @(dateTimeLocalization.ShowMonthAfterYear ? "true" : "false"), // True if the year select precedes month, false for month then year
|
||||||
yearSuffix: '@dateTimeLocalization.YearSuffix' // Additional text to append to the year in the month headers
|
yearSuffix: '@HttpUtility.JavaScriptStringEncode(dateTimeLocalization.YearSuffix)' // Additional text to append to the year in the month headers
|
||||||
};
|
};
|
||||||
|
|
||||||
$.datepicker.setDefaults($.datepicker.regional['']);
|
$.datepicker.setDefaults($.datepicker.regional['']);
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorkContext.SetState("TimePickerLocalization", new object());
|
WorkContext.SetState("TimePickerLocalization", new object());
|
||||||
|
|
||||||
Style.Require("jQueryUI_TimePicker");
|
Style.Require("jQueryUI_TimePicker");
|
||||||
Script.Require("jQueryUI_TimePicker");
|
Script.Require("jQueryUI_TimePicker");
|
||||||
|
|
||||||
var cultureInfo = CultureInfo.GetCultureInfo(WorkContext.CurrentCulture);
|
var cultureInfo = CultureInfo.GetCultureInfo(WorkContext.CurrentCulture);
|
||||||
|
|
||||||
var timeFormat = cultureInfo.DateTimeFormat.ShortTimePattern
|
var timeFormat = cultureInfo.DateTimeFormat.ShortTimePattern
|
||||||
.Replace("H", "h");
|
.Replace("H", "h");
|
||||||
|
|
||||||
@@ -26,13 +26,13 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
$.timepicker.regional[''] = {
|
$.timepicker.regional[''] = {
|
||||||
timeOnlyTitle: '@T("Choose time")',
|
timeOnlyTitle: '@HttpUtility.JavaScriptStringEncode(T("Choose time").Text)',
|
||||||
timeText: '@T("Time")',
|
timeText: '@HttpUtility.JavaScriptStringEncode(T("Time").Text)',
|
||||||
hourText: '@T("Hour")',
|
hourText: '@HttpUtility.JavaScriptStringEncode(T("Hour").Text)',
|
||||||
minuteText: '@T("Minute")',
|
minuteText: '@HttpUtility.JavaScriptStringEncode(T("Minute").Text)',
|
||||||
currentText: '@T("Now")', // Display text for current time link
|
currentText: '@HttpUtility.JavaScriptStringEncode(T("Now").Text)', // Display text for current time link
|
||||||
closeText: '@T("Done")', // Display text for close link
|
closeText: '@HttpUtility.JavaScriptStringEncode(T("Done").Text)', // Display text for close link
|
||||||
timeFormat: '@timeFormat',
|
timeFormat: '@HttpUtility.JavaScriptStringEncode(timeFormat)',
|
||||||
amNames: ['@cultureInfo.DateTimeFormat.AMDesignator', 'AM', 'A'],
|
amNames: ['@cultureInfo.DateTimeFormat.AMDesignator', 'AM', 'A'],
|
||||||
pmNames: ['@cultureInfo.DateTimeFormat.PMDesignator', 'PM', 'P'],
|
pmNames: ['@cultureInfo.DateTimeFormat.PMDesignator', 'PM', 'P'],
|
||||||
ampm: @ampm,
|
ampm: @ampm,
|
||||||
|
|||||||
Reference in New Issue
Block a user