Updated EditMacro.js to support inserting different syntax depending on rendering engine. Just need to get it to insert the params for MVC now.

Added HttpRequestExtenions with a method GetItemAsString which obsoletes/supercedes the old 'umbraco.helper.Request' method.
This commit is contained in:
Shannon Deminick
2013-01-03 06:21:55 +03:00
parent e0550a9a57
commit 872c163999
8 changed files with 414 additions and 342 deletions

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Umbraco.Core;
namespace Umbraco.Web
{
/// <summary>
/// Extension methods for the HttpRequest and HttpRequestBase objects
/// </summary>
public static class HttpRequestExtensions
{
/// <summary>
/// Safely get a request item as string, if the item does not exist, an empty string is returned.
/// </summary>
/// <param name="request"></param>
/// <param name="key"></param>
/// <returns></returns>
public static string GetItemAsString(this HttpRequest request, string key)
{
return new HttpRequestWrapper(request).GetItemAsString(key);
}
/// <summary>
/// Safely get a request item as string, if the item does not exist, an empty string is returned.
/// </summary>
/// <param name="request"></param>
/// <param name="key"></param>
/// <returns></returns>
public static string GetItemAsString(this HttpRequestBase request, string key)
{
var val = HttpContext.Current.Request[key];
return !val.IsNullOrWhiteSpace() ? val : string.Empty;
}
}
}