@@ -320,196 +243,192 @@ namespace umbraco.BusinessLogic
/// How long the cookie should be present in the browser
public static void SetCookieValue(string key, string value, double daysToPersist)
{
- if (!Cookies.HasCookies)
- return;
- var context = HttpContext;
+ if (!Cookies.HasCookies)
+ return;
+ var context = HttpContext.Current;
- HttpCookie cookie = new HttpCookie(key, value);
- cookie.Expires = DateTime.Now.AddDays(daysToPersist);
- context.Response.Cookies.Set(cookie);
+ HttpCookie cookie = new HttpCookie(key, value);
+ cookie.Expires = DateTime.Now.AddDays(daysToPersist);
+ context.Response.Cookies.Set(cookie);
- cookie = context.Request.Cookies[key];
- if (cookie != null)
- cookie.Value = value;
- }
+ cookie = context.Request.Cookies[key];
+ if (cookie != null)
+ cookie.Value = value;
+ }
- // zb-00004 #29956 : refactor cookies names & handling
- public static class Cookies
- {
- /*
- * helper class to manage cookies
- *
- * beware! SetValue(string value) does _not_ set expires, unless the cookie has been
- * configured to have one. This allows us to have cookies w/out an expires timespan.
- * However, default behavior in Umbraco was to set expires to 30days by default. This
- * must now be managed in the Cookie constructor or by using an overriden SetValue(...).
- *
- * we currently reproduce this by configuring each cookie with a 30d expires, but does
- * that actually make sense? shouldn't some cookie have _no_ expires?
- */
- static readonly Cookie _preview = new Cookie("UMB_PREVIEW", 30d); // was "PreviewSet"
- static readonly Cookie _userContext = new Cookie("UMB_UCONTEXT", 30d); // was "UserContext"
- static readonly Cookie _member = new Cookie("UMB_MEMBER", 30d); // was "umbracoMember"
+ // zb-00004 #29956 : refactor cookies names & handling
+ public static class Cookies
+ {
+ /*
+ * helper class to manage cookies
+ *
+ * beware! SetValue(string value) does _not_ set expires, unless the cookie has been
+ * configured to have one. This allows us to have cookies w/out an expires timespan.
+ * However, default behavior in Umbraco was to set expires to 30days by default. This
+ * must now be managed in the Cookie constructor or by using an overriden SetValue(...).
+ *
+ * we currently reproduce this by configuring each cookie with a 30d expires, but does
+ * that actually make sense? shouldn't some cookie have _no_ expires?
+ */
+ static readonly Cookie _preview = new Cookie("UMB_PREVIEW", 30d); // was "PreviewSet"
+ static readonly Cookie _userContext = new Cookie("UMB_UCONTEXT", 30d); // was "UserContext"
+ static readonly Cookie _member = new Cookie("UMB_MEMBER", 30d); // was "umbracoMember"
- public static Cookie Preview { get { return _preview; } }
- public static Cookie UserContext { get { return _userContext; } }
- public static Cookie Member { get { return _member; } }
+ public static Cookie Preview { get { return _preview; } }
+ public static Cookie UserContext { get { return _userContext; } }
+ public static Cookie Member { get { return _member; } }
- public static bool HasCookies
- {
- get
- {
- var context = HttpContext;
- // although just checking context should be enough?!
- // but in some (replaced) umbraco code, everything is checked...
- return context != null
- && context.Request != null & context.Request.Cookies != null
- && context.Response != null && context.Response.Cookies != null;
- }
- }
+ public static bool HasCookies
+ {
+ get
+ {
+ System.Web.HttpContext context = HttpContext.Current;
+ // although just checking context should be enough?!
+ // but in some (replaced) umbraco code, everything is checked...
+ return context != null
+ && context.Request != null & context.Request.Cookies != null
+ && context.Response != null && context.Response.Cookies != null;
+ }
+ }
- public static void ClearAll()
- {
- HttpContext.Response.Cookies.Clear();
- }
+ public static void ClearAll()
+ {
+ HttpContext.Current.Response.Cookies.Clear();
+ }
- public class Cookie
- {
- const string cookiesExtensionConfigKey = "umbracoCookiesExtension";
+ public class Cookie
+ {
+ const string cookiesExtensionConfigKey = "umbracoCookiesExtension";
- static readonly string _ext;
- TimeSpan _expires;
- string _key;
+ static readonly string _ext;
+ TimeSpan _expires;
+ string _key;
- static Cookie()
- {
- var appSettings = System.Configuration.ConfigurationManager.AppSettings;
- _ext = appSettings[cookiesExtensionConfigKey] == null ? "" : "_" + (string)appSettings[cookiesExtensionConfigKey];
- }
+ static Cookie()
+ {
+ var appSettings = System.Configuration.ConfigurationManager.AppSettings;
+ _ext = appSettings[cookiesExtensionConfigKey] == null ? "" : "_" + (string)appSettings[cookiesExtensionConfigKey];
+ }
- public Cookie(string key)
- : this(key, TimeSpan.Zero, true)
- { }
+ public Cookie(string key)
+ : this(key, TimeSpan.Zero, true)
+ { }
- public Cookie(string key, double days)
- : this(key, TimeSpan.FromDays(days), true)
- { }
+ public Cookie(string key, double days)
+ : this(key, TimeSpan.FromDays(days), true)
+ { }
- public Cookie(string key, TimeSpan expires)
- : this(key, expires, true)
- { }
+ public Cookie(string key, TimeSpan expires)
+ : this(key, expires, true)
+ { }
- public Cookie(string key, bool appendExtension)
- : this(key, TimeSpan.Zero, appendExtension)
- { }
+ public Cookie(string key, bool appendExtension)
+ : this(key, TimeSpan.Zero, appendExtension)
+ { }
- public Cookie(string key, double days, bool appendExtension)
- : this(key, TimeSpan.FromDays(days), appendExtension)
- { }
+ public Cookie(string key, double days, bool appendExtension)
+ : this(key, TimeSpan.FromDays(days), appendExtension)
+ { }
- public Cookie(string key, TimeSpan expires, bool appendExtension)
- {
- _key = appendExtension ? key + _ext : key;
- _expires = expires;
- }
+ public Cookie(string key, TimeSpan expires, bool appendExtension)
+ {
+ _key = appendExtension ? key + _ext : key;
+ _expires = expires;
+ }
- public string Key
- {
- get { return _key; }
- }
+ public string Key
+ {
+ get { return _key; }
+ }
- public bool HasValue
- {
- get { return RequestCookie != null; }
- }
+ public bool HasValue
+ {
+ get { return RequestCookie != null; }
+ }
- public string GetValue()
- {
- return RequestCookie == null ? null : RequestCookie.Value;
- }
+ public string GetValue()
+ {
+ return RequestCookie == null ? null : RequestCookie.Value;
+ }
+
+ public void SetValue(string value)
+ {
+ SetValueWithDate(value, DateTime.Now + _expires);
+ }
+
+ public void SetValue(string value, double days)
+ {
+ SetValue(value, DateTime.Now.AddDays(days));
+ }
+
+ public void SetValue(string value, TimeSpan expires)
+ {
+ SetValue(value, DateTime.Now + expires);
+ }
+
+ public void SetValue(string value, DateTime expires)
+ {
+ SetValueWithDate(value, expires);
+ }
+
+ private void SetValueWithDate(string value, DateTime expires)
+ {
+ HttpCookie cookie = new HttpCookie(_key, value);
- public void SetValue(string value)
- {
- HttpCookie cookie = new HttpCookie(_key, value);
if (GlobalSettings.UseSSL)
cookie.Secure = true;
- if (!TimeSpan.Zero.Equals(_expires))
- cookie.Expires = DateTime.Now + _expires;
- ResponseCookie = cookie;
- // original Umbraco code also does this
- // so we can GetValue() back what we previously set
- cookie = RequestCookie;
- if (cookie != null)
- cookie.Value = value;
- }
-
- public void SetValue(string value, double days)
- {
- SetValue(value, DateTime.Now.AddDays(days));
- }
-
- public void SetValue(string value, TimeSpan expires)
- {
- SetValue(value, DateTime.Now + expires);
- }
-
- public void SetValue(string value, DateTime expires)
- {
- HttpCookie cookie = new HttpCookie(_key, value);
- if (GlobalSettings.UseSSL)
- cookie.Secure = true;
cookie.Expires = expires;
- ResponseCookie = cookie;
+ ResponseCookie = cookie;
- // original Umbraco code also does this
- // so we can GetValue() back what we previously set
- cookie = RequestCookie;
- if (cookie != null)
- cookie.Value = value;
- }
+ // original Umbraco code also does this
+ // so we can GetValue() back what we previously set
+ cookie = RequestCookie;
+ if (cookie != null)
+ cookie.Value = value;
+ }
- public void Clear()
- {
- if (RequestCookie != null || ResponseCookie != null)
- {
- HttpCookie cookie = new HttpCookie(_key);
- cookie.Expires = DateTime.Now.AddDays(-1);
- ResponseCookie = cookie;
- }
- }
+ public void Clear()
+ {
+ if (RequestCookie != null || ResponseCookie != null)
+ {
+ HttpCookie cookie = new HttpCookie(_key);
+ cookie.Expires = DateTime.Now.AddDays(-1);
+ ResponseCookie = cookie;
+ }
+ }
- public void Remove()
- {
- // beware! will not clear browser's cookie
- // you probably want to use .Clear()
- HttpContext.Response.Cookies.Remove(_key);
- }
+ public void Remove()
+ {
+ // beware! will not clear browser's cookie
+ // you probably want to use .Clear()
+ HttpContext.Current.Response.Cookies.Remove(_key);
+ }
- public HttpCookie RequestCookie
- {
- get
- {
- return HttpContext.Request.Cookies[_key];
- }
- }
+ public HttpCookie RequestCookie
+ {
+ get
+ {
+ return HttpContext.Current.Request.Cookies[_key];
+ }
+ }
- public HttpCookie ResponseCookie
- {
- get
- {
- return HttpContext.Response.Cookies[_key];
- }
- set
- {
- // .Set() ensures the uniqueness of cookies in the cookie collection
- // ie it is the same as .Remove() + .Add() -- .Add() allows duplicates
- HttpContext.Response.Cookies.Set(value);
- }
- }
- }
- }
+ public HttpCookie ResponseCookie
+ {
+ get
+ {
+ return HttpContext.Current.Response.Cookies[_key];
+ }
+ set
+ {
+ // .Set() ensures the uniqueness of cookies in the cookie collection
+ // ie it is the same as .Remove() + .Add() -- .Add() allows duplicates
+ HttpContext.Current.Response.Cookies.Set(value);
+ }
+ }
+ }
+ }
#endregion
- }
+ }
}
diff --git a/src/umbraco.controls/CodeArea.cs b/src/umbraco.controls/CodeArea.cs
index cd28223241..a6adc8e4d6 100644
--- a/src/umbraco.controls/CodeArea.cs
+++ b/src/umbraco.controls/CodeArea.cs
@@ -62,7 +62,7 @@ namespace umbraco.uicontrols
public EditorType CodeBase { get; set; }
public string ClientSaveMethod { get; set; }
- public enum EditorType { JavaScript, Css, Python, XML, HTML, Razor, HtmlMixed}
+ public enum EditorType { JavaScript, Css, Python, XML, HTML, Razor, HtmlMixed }
protected override void OnInit(EventArgs e)
{
@@ -72,8 +72,8 @@ namespace umbraco.uicontrols
if (CodeMirrorEnabled)
{
ClientDependencyLoader.Instance.RegisterDependency(0, "CodeMirror/js/lib/codemirror.js", "UmbracoClient", ClientDependencyType.Javascript);
-
-
+
+
ClientDependencyLoader.Instance.RegisterDependency(2, "CodeMirror/js/mode/" + CodeBase.ToString().ToLower() + "/" + CodeBase.ToString().ToLower() + ".js", "UmbracoClient", ClientDependencyType.Javascript);
if (CodeBase == EditorType.HtmlMixed)
{
@@ -82,19 +82,21 @@ namespace umbraco.uicontrols
ClientDependencyLoader.Instance.RegisterDependency(1, "CodeMirror/js/mode/css/css.js", "UmbracoClient", ClientDependencyType.Javascript);
}
-
+
ClientDependencyLoader.Instance.RegisterDependency(2, "CodeMirror/js/lib/codemirror.css", "UmbracoClient", ClientDependencyType.Css);
ClientDependencyLoader.Instance.RegisterDependency(3, "CodeArea/styles.css", "UmbracoClient", ClientDependencyType.Css);
- if (AutoSuggest && HttpContext.Current.Request.Browser.Browser != "IE")
- {
- ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/js/lib/util/simple-hint-customized.js", "UmbracoClient", ClientDependencyType.Javascript);
-
- ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hint.js", "UmbracoClient", ClientDependencyType.Javascript);
- ClientDependencyLoader.Instance.RegisterDependency(5, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hints.js", "UmbracoClient", ClientDependencyType.Javascript);
-
- ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/simple-hint.css", "UmbracoClient", ClientDependencyType.Css);
- }
+
+
+ //if (AutoSuggest && HttpContext.Current.Request.Browser.Browser != "IE")
+ //{
+ // ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/js/lib/util/simple-hint-customized.js", "UmbracoClient", ClientDependencyType.Javascript);
+
+ // ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hint.js", "UmbracoClient", ClientDependencyType.Javascript);
+ // ClientDependencyLoader.Instance.RegisterDependency(5, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hints.js", "UmbracoClient", ClientDependencyType.Javascript);
+
+ // ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/simple-hint.css", "UmbracoClient", ClientDependencyType.Css);
+ //}
}
}
@@ -137,7 +139,7 @@ namespace umbraco.uicontrols
EnsureChildControls();
var jsEventCode = "";
-
+
if (!CodeMirrorEnabled)
{
@@ -167,8 +169,6 @@ namespace umbraco.uicontrols
OffSetX += 20;
}
-
-
jsEventCode += @"
//create the editor
@@ -181,11 +181,11 @@ namespace umbraco.uicontrols
jQuery(window).resize(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });
jQuery(document).ready(function(){ resizeTextArea(m_textEditor, " + OffSetX.ToString() + "," + OffSetY.ToString() + @"); });";
- /*
- if (!UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser == "IE")
- {
- jsEventCode += "jQuery('" + ui.Text("codemirroriewarning").Replace("'", "\\'") + "
').insertAfter('#" + this.ClientID + "');";
- }*/
+ /*
+ if (!UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser == "IE")
+ {
+ jsEventCode += "jQuery('" + ui.Text("codemirroriewarning").Replace("'", "\\'") + "
').insertAfter('#" + this.ClientID + "');";
+ }*/
}
@@ -209,15 +209,16 @@ namespace umbraco.uicontrols
var extraKeys = "";
var editorMimetype = "";
- if (AutoSuggest)
- {
- extraKeys = @",
- extraKeys: {
- ""'@'"": function(cm) { CodeMirror.{lang}Hint(cm, '@'); },
- ""'.'"": function(cm) { CodeMirror.{lang}Hint(cm, '.'); },
- ""Ctrl-Space"": function(cm) { CodeMirror.{lang}Hint(cm, ''); }
- }".Replace("{lang}", CodeBase.ToString().ToLower());
- }
+// if (AutoSuggest && HttpContext.Current.Request.Browser.Browser != "IE")
+// {
+// extraKeys = @",
+// extraKeys: {
+// ""'@'"": function(cm) { CodeMirror.{lang}Hint(cm, '@'); },
+// ""'.'"": function(cm) { CodeMirror.{lang}Hint(cm, '.'); },
+// ""Ctrl-Space"": function(cm) { CodeMirror.{lang}Hint(cm, ''); }
+// }".Replace("{lang}", CodeBase.ToString().ToLower());
+// }
+
if (!string.IsNullOrEmpty(EditorMimeType))
editorMimetype = @",
@@ -235,18 +236,17 @@ namespace umbraco.uicontrols
indentUnit: 4,
indentWithTabs: true,
enterMode: ""keep"",
- textWrapping: false" +
- editorMimetype + @",
- gutter: true,
onCursorActivity: updateLineInfo,
- onChange: updateLineInfo" +
+ lineWrapping: false" +
+ editorMimetype + @",
+ lineNumbers: true" +
extraKeys + @"
});
-
- updateLineInfo(codeEditor);
+
+ updateLineInfo(codeEditor);
";
-
+
/*
string[] parserFiles = new string[] { "tokenizejavascript.js", "parsejavascript.js" };
string[] cssFile = new string[] { "jscolors.css", "umbracoCustom.css" };
diff --git a/src/umbraco.presentation/web.Template.PeterGregory-PC.Debug.config b/src/umbraco.presentation/web.Template.PeterGregory-PC.Debug.config
new file mode 100644
index 0000000000..34466b5f80
--- /dev/null
+++ b/src/umbraco.presentation/web.Template.PeterGregory-PC.Debug.config
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/umbraco.webservices/media/mediaService.cs b/src/umbraco.webservices/media/mediaService.cs
index 3a321a6688..062082ee93 100644
--- a/src/umbraco.webservices/media/mediaService.cs
+++ b/src/umbraco.webservices/media/mediaService.cs
@@ -199,7 +199,7 @@ namespace umbraco.webservices.media
//todo cache embed doc
var xmlConfig = new XmlDocument();
- xmlConfig.Load(GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar + "Embed.config");
+ xmlConfig.Load(GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar + "EmbeddedMedia.config");
foreach (XmlNode node in xmlConfig.SelectNodes("//provider"))
{