/// <summary>
/// Gets the JavaScript to send to the specific client device based on the
/// request context provided.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private static string GetFeatureJavaScript(HttpContext context)
{
var queryString = context.Request.QueryString.ToString();
var match = WebProvider.GetMatch(context.Request);
var features = new List <string>();
if (String.IsNullOrEmpty(queryString))
{
foreach (var property in WebProvider.ActiveProvider.DataSet.Properties.Where(i =>
i._valueType != Entities.Property.PropertyValueType.JavaScript))
{
GetFeatureJavaScript(match, features, property);
}
}
else
{
foreach (var propertyName in HttpUtility.UrlDecode(queryString).Split(
new char[] { ' ', ',', '&', '|' }))
{
var property = WebProvider.ActiveProvider.DataSet.Properties.FirstOrDefault(i =>
i.Name.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase));
if (property != null)
{
GetFeatureJavaScript(match, features, property);
}
}
}
return(String.Format("var FODF={{{0}}};", String.Join(",", features.ToArray())));
}