Merge with default
This commit is contained in:
6
.hgtags
6
.hgtags
@@ -8,3 +8,9 @@ d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
|
||||
1809f7b2593270c192cd47bdcfdb392100686f79 4.7.2
|
||||
488779dec0ceb1d2874bcef906241b919325c904 4.8.0-beta
|
||||
096f20bb0575d6199f20fcb3147b63554e765a74 Release-4.8.0
|
||||
8f8a203857886b373148af29edd57460a42940be Release-4.8.1
|
||||
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
|
||||
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
|
||||
0000000000000000000000000000000000000000 Release-4.9.0
|
||||
0000000000000000000000000000000000000000 Release-4.9.0
|
||||
09f5a69cf19ebf7ddd9501e5258bee1e6a125391 Release-4.9.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Umbraco.Core.Media
|
||||
{
|
||||
internal interface IEmbedProvider
|
||||
public interface IEmbedProvider
|
||||
{
|
||||
bool SupportsDimensions { get; }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Umbraco.Core.Media
|
||||
{
|
||||
internal interface IEmbedSettingProvider
|
||||
public interface IEmbedSettingProvider
|
||||
{
|
||||
object GetSetting(XmlNode settingNode);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Umbraco.Core.Media
|
||||
{
|
||||
internal class ProviderSetting : Attribute
|
||||
public class ProviderSetting : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -273,11 +273,11 @@
|
||||
<None Include="config\FileSystemProviders.Release.config">
|
||||
<DependentUpon>FileSystemProviders.config</DependentUpon>
|
||||
</None>
|
||||
<Content Include="config\embed.config">
|
||||
<Content Include="config\EmbeddedMedia.config" />
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="config\embed.Release.config">
|
||||
<DependentUpon>embed.config</DependentUpon>
|
||||
<None Include="config\EmbeddedMedia.Release.config">
|
||||
<DependentUpon>EmbeddedMedia.config</DependentUpon>
|
||||
</None>
|
||||
<None Include="config\xsltExtensions.Release.config">
|
||||
<DependentUpon>xsltExtensions.config</DependentUpon>
|
||||
|
||||
@@ -10,16 +10,18 @@ function resizeTextArea(textEditor, offsetX, offsetY) {
|
||||
|
||||
var currentHandle = null, currentLine;
|
||||
function updateLineInfo(cm) {
|
||||
|
||||
var line = cm.getCursor().line, handle = cm.getLineHandle(line);
|
||||
if (handle == currentHandle && line == currentLine) return;
|
||||
|
||||
if (currentHandle) {
|
||||
cm.setLineClass(currentHandle, null, null);
|
||||
cm.clearMarker(currentHandle);
|
||||
// cm.clearMarker(currentHandle);
|
||||
}
|
||||
|
||||
currentHandle = handle; currentLine = line;
|
||||
cm.setLineClass(currentHandle, null, "activeline");
|
||||
cm.setMarker(currentHandle, String(line + 1));
|
||||
//cm.setMarker(currentHandle, String(line + 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,36 +8,9 @@ namespace umbraco.BusinessLogic
|
||||
/// <summary>
|
||||
/// The StateHelper class provides general helper methods for handling sessions, context, viewstate and cookies.
|
||||
/// </summary>
|
||||
public class StateHelper
|
||||
public class StateHelper
|
||||
{
|
||||
|
||||
private static HttpContextBase _customHttpContext;
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the HttpContext object, this is generally used for unit testing. By default this will
|
||||
/// use the HttpContext.Current
|
||||
/// </summary>
|
||||
internal static HttpContextBase HttpContext
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_customHttpContext == null && System.Web.HttpContext.Current != null)
|
||||
{
|
||||
//return the current HttpContxt, do NOT store this in the _customHttpContext field
|
||||
//as it will persist across reqeusts!
|
||||
return new HttpContextWrapper(System.Web.HttpContext.Current);
|
||||
}
|
||||
|
||||
if (_customHttpContext == null && System.Web.HttpContext.Current == null)
|
||||
{
|
||||
throw new NullReferenceException("The HttpContext property has not been set or the object execution is not running inside of an HttpContext");
|
||||
}
|
||||
return _customHttpContext;
|
||||
}
|
||||
set { _customHttpContext = value; }
|
||||
}
|
||||
|
||||
#region Session Helpers
|
||||
#region Session Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Gets the session value.
|
||||
@@ -45,10 +18,10 @@ namespace umbraco.BusinessLogic
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetSessionValue<T>(string key)
|
||||
{
|
||||
return GetSessionValue<T>(HttpContext, key);
|
||||
}
|
||||
public static T GetSessionValue<T>(string key)
|
||||
{
|
||||
return GetSessionValue<T>(HttpContext.Current, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the session value.
|
||||
@@ -57,38 +30,25 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use the GetSessionValue accepting an HttpContextBase instead")]
|
||||
public static T GetSessionValue<T>(HttpContext context, string key)
|
||||
public static T GetSessionValue<T>(HttpContext context, string key)
|
||||
{
|
||||
return GetSessionValue<T>(new HttpContextWrapper(context), key);
|
||||
if (context == null)
|
||||
return default(T);
|
||||
object o = context.Session[key];
|
||||
if (o == null)
|
||||
return default(T);
|
||||
return (T)o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the session value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetSessionValue<T>(HttpContextBase context, string key)
|
||||
{
|
||||
if (context == null)
|
||||
return default(T);
|
||||
object o = context.Session[key];
|
||||
if (o == null)
|
||||
return default(T);
|
||||
return (T)o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a session value.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetSessionValue(string key, object value)
|
||||
{
|
||||
SetSessionValue(HttpContext, key, value);
|
||||
}
|
||||
public static void SetSessionValue(string key, object value)
|
||||
{
|
||||
SetSessionValue(HttpContext.Current, key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the session value.
|
||||
@@ -96,79 +56,54 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
[Obsolete("Use the SetSessionValue accepting an HttpContextBase instead")]
|
||||
public static void SetSessionValue(HttpContext context, string key, object value)
|
||||
{
|
||||
SetSessionValue(new HttpContextWrapper(context), key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the session value.
|
||||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetSessionValue(HttpContextBase context, string key, object value)
|
||||
{
|
||||
if (context == null)
|
||||
return;
|
||||
context.Session[key] = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Context Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetContextValue<T>(string key)
|
||||
{
|
||||
return GetContextValue<T>(HttpContext, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use the GetContextValue accepting an HttpContextBase instead")]
|
||||
public static T GetContextValue<T>(HttpContext context, string key)
|
||||
public static void SetSessionValue(HttpContext context, string key, object value)
|
||||
{
|
||||
return GetContextValue<T>(new HttpContextWrapper(context), key);
|
||||
if (context == null)
|
||||
return;
|
||||
context.Session[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetContextValue<T>(HttpContextBase context, string key)
|
||||
{
|
||||
if (context == null)
|
||||
return default(T);
|
||||
object o = context.Items[key];
|
||||
if (o == null)
|
||||
return default(T);
|
||||
return (T)o;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Context Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetContextValue<T>(string key)
|
||||
{
|
||||
return GetContextValue<T>(HttpContext.Current, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetContextValue<T>(HttpContext context, string key)
|
||||
{
|
||||
if (context == null)
|
||||
return default(T);
|
||||
object o = context.Items[key];
|
||||
if (o == null)
|
||||
return default(T);
|
||||
return (T)o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the context value.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetContextValue(string key, object value)
|
||||
{
|
||||
SetContextValue(HttpContext, key, value);
|
||||
}
|
||||
public static void SetContextValue(string key, object value)
|
||||
{
|
||||
SetContextValue(HttpContext.Current, key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the context value.
|
||||
@@ -176,49 +111,37 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
[Obsolete("Use the SetContextValue accepting an HttpContextBase instead")]
|
||||
public static void SetContextValue(HttpContext context, string key, object value)
|
||||
{
|
||||
SetContextValue(new HttpContextWrapper(context), key, value);
|
||||
}
|
||||
public static void SetContextValue(HttpContext context, string key, object value)
|
||||
{
|
||||
if (context == null)
|
||||
return;
|
||||
context.Items[key] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the context value.
|
||||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetContextValue(HttpContextBase context, string key, object value)
|
||||
{
|
||||
if (context == null)
|
||||
return;
|
||||
context.Items[key] = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ViewState Helpers
|
||||
#region ViewState Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Gets the state bag.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static StateBag GetStateBag()
|
||||
{
|
||||
//if (HttpContext.Current == null)
|
||||
// return null;
|
||||
private static StateBag GetStateBag()
|
||||
{
|
||||
if (HttpContext.Current == null)
|
||||
return null;
|
||||
|
||||
var page = HttpContext.CurrentHandler as Page;
|
||||
if (page == null)
|
||||
return null;
|
||||
Page page = HttpContext.Current.CurrentHandler as Page;
|
||||
if (page == null)
|
||||
return null;
|
||||
|
||||
var pageType = typeof(Page);
|
||||
var viewState = pageType.GetProperty("ViewState", BindingFlags.GetProperty | BindingFlags.Instance);
|
||||
if (viewState == null)
|
||||
return null;
|
||||
Type pageType = typeof(Page);
|
||||
PropertyInfo viewState = pageType.GetProperty("ViewState", BindingFlags.GetProperty | BindingFlags.Instance);
|
||||
if (viewState == null)
|
||||
return null;
|
||||
|
||||
return viewState.GetValue(page, null) as StateBag;
|
||||
}
|
||||
return viewState.GetValue(page, null) as StateBag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view state value.
|
||||
@@ -226,10 +149,10 @@ namespace umbraco.BusinessLogic
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetViewStateValue<T>(string key)
|
||||
{
|
||||
return GetViewStateValue<T>(GetStateBag(), key);
|
||||
}
|
||||
public static T GetViewStateValue<T>(string key)
|
||||
{
|
||||
return GetViewStateValue<T>(GetStateBag(), key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a view-state value.
|
||||
@@ -238,25 +161,25 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="bag">The bag.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static T GetViewStateValue<T>(StateBag bag, string key)
|
||||
{
|
||||
if (bag == null)
|
||||
return default(T);
|
||||
object o = bag[key];
|
||||
if (o == null)
|
||||
return default(T);
|
||||
return (T)o;
|
||||
}
|
||||
public static T GetViewStateValue<T>(StateBag bag, string key)
|
||||
{
|
||||
if (bag == null)
|
||||
return default(T);
|
||||
object o = bag[key];
|
||||
if (o == null)
|
||||
return default(T);
|
||||
return (T)o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the view state value.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetViewStateValue(string key, object value)
|
||||
{
|
||||
SetViewStateValue(GetStateBag(), key, value);
|
||||
}
|
||||
public static void SetViewStateValue(string key, object value)
|
||||
{
|
||||
SetViewStateValue(GetStateBag(), key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the view state value.
|
||||
@@ -264,15 +187,15 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="bag">The bag.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetViewStateValue(StateBag bag, string key, object value)
|
||||
{
|
||||
if (bag != null)
|
||||
bag[key] = value;
|
||||
}
|
||||
public static void SetViewStateValue(StateBag bag, string key, object value)
|
||||
{
|
||||
if (bag != null)
|
||||
bag[key] = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Cookie Helpers
|
||||
#region Cookie Helpers
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a cookie has a value with a specified key.
|
||||
@@ -294,13 +217,13 @@ namespace umbraco.BusinessLogic
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetCookieValue(string key)
|
||||
{
|
||||
if (!Cookies.HasCookies)
|
||||
return null;
|
||||
var cookie = HttpContext.Request.Cookies[key];
|
||||
return cookie == null ? null : cookie.Value;
|
||||
}
|
||||
public static string GetCookieValue(string key)
|
||||
{
|
||||
if (!Cookies.HasCookies)
|
||||
return null;
|
||||
var cookie = HttpContext.Current.Request.Cookies[key];
|
||||
return cookie == null ? null : cookie.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the cookie value.
|
||||
@@ -309,7 +232,7 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="value">The value.</param>
|
||||
public static void SetCookieValue(string key, string value)
|
||||
{
|
||||
SetCookieValue(key, value, 30d); // default Umbraco expires is 30 days
|
||||
SetCookieValue(key, value, 30d); // default Umbraco expires is 30 days
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -320,196 +243,192 @@ namespace umbraco.BusinessLogic
|
||||
/// <param name="daysToPersist">How long the cookie should be present in the browser</param>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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('<p style=\"color:#999\">" + ui.Text("codemirroriewarning").Replace("'", "\\'") + "</p>').insertAfter('#" + this.ClientID + "');";
|
||||
}*/
|
||||
/*
|
||||
if (!UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser == "IE")
|
||||
{
|
||||
jsEventCode += "jQuery('<p style=\"color:#999\">" + ui.Text("codemirroriewarning").Replace("'", "\\'") + "</p>').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" };
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<!--
|
||||
In the example below, the "SetAttributes" transform will change the value of
|
||||
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||
finds an atrribute "name" that has a value of "MyDB".
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MyDB"
|
||||
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||
</connectionStrings>
|
||||
-->
|
||||
|
||||
<appSettings>
|
||||
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="umbracoDbDSN"
|
||||
value="server=localhost;database=4.8.dev;user id=sa;password=password!"/>
|
||||
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="umbracoConfigurationStatus"
|
||||
value="4.8.1"/>
|
||||
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="umbracoContentXML"
|
||||
value="~/App_Data/umbraco.config"/>
|
||||
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="umbracoStorageDirectory"
|
||||
value="~/App_Data"/>
|
||||
</appSettings>
|
||||
|
||||
<system.web>
|
||||
<compilation debug="true" xdt:Transform="SetAttributes(debug)" />
|
||||
<!--
|
||||
In the example below, the "Replace" transform will replace the entire
|
||||
<customErrors> section of your web.config file.
|
||||
Note that because there is only one customErrors section under the
|
||||
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||
|
||||
<customErrors defaultRedirect="GenericError.htm"
|
||||
mode="RemoteOnly" xdt:Transform="Replace">
|
||||
<error statusCode="500" redirect="InternalError.htm"/>
|
||||
</customErrors>
|
||||
-->
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -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"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user