Permalink
Browse files

put in cache helper query string, refactor central static class

first second stab at region date/time formatting update
  • Loading branch information...
ninianne98 committed Oct 31, 2018
1 parent 875fa98 commit ebfc9f28017f1fde15e5fa67ee51f1a735a41514
View
@@ -18,10 +18,6 @@
<OldToolsVersion>4.0</OldToolsVersion>
<UpgradeBackupLocation />
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -1423,7 +1419,6 @@
<Folder Include="c3-admin\tiny_mce\plugins\autosave\langs\" />
<Folder Include="c3-admin\tiny_mce\plugins\spellchecker\classes\utils\" />
<Folder Include="c3-admin\tiny_mce\plugins\spellchecker\includes\" />
<Folder Include="cmsPlugins\" />
</ItemGroup>
<ItemGroup>
<Content Include="abundant\abundant.master" />
@@ -1,13 +1,12 @@
using System;
using Carrotware.CMS.Core;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web.Script.Services;
using System.Web.Security;
using System.Web.Services;
using System.Xml.Serialization;
using Carrotware.CMS.Core;
/*
* CarrotCake CMS
@@ -37,8 +36,6 @@ public class CMS : System.Web.Services.WebService {
private Guid CurrentPageGuid = Guid.Empty;
private ContentPage filePage = null;
private DateTimeFormatInfo _dtf = CultureInfo.CurrentCulture.DateTimeFormat;
public CMS() {
if (!this.User.Identity.IsAuthenticated) {
throw new Exception("Not Authenticated!");
@@ -47,10 +44,6 @@ public class CMS : System.Web.Services.WebService {
if (!(SecurityData.IsAdmin || SecurityData.IsSiteEditor)) {
throw new Exception("Not Authorizeed!");
}
if (_dtf == null) {
_dtf = CultureInfo.CreateSpecificCulture("en-US").DateTimeFormat;
}
}
private List<ContentPage> _pages = null;
@@ -183,18 +176,6 @@ public class CMS : System.Web.Services.WebService {
return SiteData.AdminFolderPath;
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetShortDatePattern() {
return Helper.ShortDatePattern;
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetShortTimePattern() {
return Helper.ShortTimePattern;
}
private string CurrentEditPage = String.Empty;
[WebMethod]
@@ -2,6 +2,9 @@
throw new Error('Common Utils JavaScript requires jQuery')
}
var cmsDatePattern = '';
var cmsTimePattern = '';
function AjaxBtnLoad() {
$(function () {
$('#jqtabs, .jqtabs').tabs();
@@ -29,35 +32,38 @@ function AjaxBtnLoad() {
cmsSetDateRegion();
}
cmsSetTimeRegion();
//if (!cmsTimePattern || cmsTimePattern.length < 1) {
// cmsGetShortTimePattern();
//} else {
// cmsSetTimeRegion();
//}
if (!cmsTimePattern || cmsTimePattern.length < 1) {
cmsGetShortTimePattern();
} else {
cmsSetTimeRegion();
}
}
var webSvc = "/c3-admin/CMS.asmx";
function cmsGetShortDatePattern() {
var webMthd = webSvc + "/GetShortDatePattern";
$.ajax({
type: "POST",
url: webMthd,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: cmsSetShortDatePattern,
error: cmsAjaxFailed
});
function cmsScrubDate(val) {
val = val.replace(/m/gi, 'mm');
val = val.replace(/mmm/gi, 'mm');
val = val.replace(/d/gi, 'dd');
val = val.replace(/ddd/gi, 'dd');
return val.replace(/yyyy/gi, 'yy');
}
var cmsDatePattern = '';
function cmsScrubTime(val) {
val = val.replace(/h/gi, 'hh');
val = val.replace(/hhh/gi, 'hh');
val = val.replace(/HH/gi, 'HH');
val = val.replace(/HHH/gi, 'HH');
val = val.replace(/t/gi, 'tt');
val = val.replace(/ttt/gi, 'tt');
function cmsSetShortDatePattern(data, status) {
var datePatrn = data.d.toLowerCase();
cmsDatePattern = datePatrn.replace(/yyyy/gi, 'yy');
return val.replace(/yyyy/gi, 'yy');
}
function cmsGetShortDatePattern() {
var datePatrn = __carrotGetDateFormat();
cmsDatePattern = cmsScrubDate(datePatrn);
cmsSetDateRegion();
}
@@ -66,6 +72,7 @@ function cmsSetDateRegion() {
$(".dateRegion").each(function () {
$(this).datepicker({
dateFormat: cmsDatePattern,
buttonText: cmsDatePattern,
changeMonth: true,
changeYear: true,
showOn: "both",
@@ -77,38 +84,29 @@ function cmsSetDateRegion() {
}
function cmsGetShortTimePattern() {
var webMthd = webSvc + "/GetShortTimePattern";
$.ajax({
type: "POST",
url: webMthd,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: cmsSetShortTimePattern,
error: cmsAjaxFailed
});
}
var cmsTimePattern = '';
function cmsSetShortTimePattern(data, status) {
var datePatrn = data.d.toLowerCase();
cmsTimePattern = datePatrn.replace(/yyyy/gi, 'yy');
var datePatrn = __carrotGetTimeFormat();
cmsTimePattern = cmsScrubTime(datePatrn);
cmsSetTimeRegion();
}
function cmsSetTimeRegion() {
var showAmPm = (cmsTimePattern.indexOf('tt') != -1) || !(cmsTimePattern.indexOf('HH') != -1);
var stringAM = __carrotGetAMDateFormat();
var stringPM = __carrotGetPMDateFormat();
$(".timeRegion").each(function () {
if (!$(this).hasClass("hasTimePicker")) {
$(this).addClass("hasTimePicker");
var id = $(this).attr('id');
$('<img class="ui-timepicker-trigger" src="/c3-admin/images/clock.png" for="' + id + '" id="' + id + '_triggerbtn" alt="..." title="...">').insertAfter(this);
$('<img class="ui-timepicker-trigger" src="/c3-admin/images/clock.png" for="' + id + '" id="' + id + '_triggerbtn" alt="' + cmsTimePattern + '" title="' + cmsTimePattern + '">').insertAfter(this);
$(this).timepicker({
showOn: "both",
button: '#' + id + '_triggerbtn',
showPeriod: true,
showPeriodLabels: showAmPm,
showPeriod: showAmPm,
amPmText: [stringAM, stringPM],
showLeadingZero: true
});
};
Oops, something went wrong.

0 comments on commit ebfc9f2

Please sign in to comment.