private DataView GetDataView() { DataView view = new DataView() { ID = "DataView1" }; XTemplate tpl = new XTemplate() { ID = "XTemplate1" }; string path = ExtNetTransformer.ResolveUrl("~/Areas/DataView_Basic/Content/"); tpl.Html = "<tpl for=\".\">" + "<div class=\"item\">" + "<tpl if=\"!Ext.isIE6\">" + "<img src=\"" + path + "images/touch-icons/{thumb}\" />" + "</tpl>" + "<tpl if=\"Ext.isIE6\">" + "<div style=\"position:relative;width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + path + "images/touch-icons/{thumb}\")></div>" + "</tpl>" + "<h3>{name}</h3>" + "</div>" + "</tpl>"; view.Tpl = tpl; view.Plugins.Add(new DataViewAnimated()); view.ItemSelector = "div.item"; view.Store.Add(this.GetStore()); return(view); }
protected virtual string RegisterRazorResources(string script, List <ResourceItem> resources) { StringBuilder sb = new StringBuilder(); List <Icon> icons = ResourceManager.GlobalIcons; HttpContext.Current.Items.Remove("Ext.Net.GlobalIcons"); if (icons.Count > 0) { string[] arr = new string[icons.Count]; for (int i = 0; i < icons.Count; i++) { arr[i] = icons[i].ToString(); } sb.Append("Ext.net.ResourceMgr.registerIcon("); sb.Append(JSON.Serialize(arr)); sb.Append(");"); } if (resources != null && resources.Count > 0 || ResourceManager.GlobalClientResources.Count > 0) { MvcResourceManagerConfig config = MVC.MvcResourceManager.SharedConfig; sb.Append("Ext.net.ResourceMgr.load(["); bool comma = false; string url; List <ClientResourceItem> gbScripts = ResourceManager.GlobalClientResources; HttpContext.Current.Items.Remove(ResourceManager.GLOBAL_CLIENT_RESOURCES); if (gbScripts.Count > 0) { foreach (ClientResourceItem item in gbScripts) { if (item.Path.IsNotEmpty()) { sb.AppendFormat("{{url:{0}{1}}}", JSON.Serialize(item.Path.StartsWith("~") ? ExtNetTransformer.ResolveUrl(item.Path) : item.Path), item.IsCss ? ",mode:\"css\"" : ""); } else if (item.PathEmbedded.IsNotEmpty()) { sb.AppendFormat("{{url:{0}{1}}{1}}", JSON.Serialize(HttpUtility.HtmlAttributeEncode(ExtNetTransformer.GetWebResourceUrl(item.Type, item.PathEmbedded))), item.IsCss ? ",mode:\"css\"" : ""); } } } if (resources != null) { foreach (ResourceItem item in resources) { if (comma) { sb.Append(","); } comma = true; if (item is ClientStyleItem) { ClientStyleItem styleItem = (ClientStyleItem)item; if (styleItem.IgnoreResourceMode) { if (styleItem.PathEmbedded.IsNotEmpty()) { url = ExtNetTransformer.GetWebResourceUrl(styleItem.Type, styleItem.PathEmbedded); } else { url = styleItem.Path.StartsWith("~") ? ExtNetTransformer.ResolveUrl(styleItem.Path) : styleItem.Path; } } else { url = config.RenderStyles == ResourceLocationType.File ? config.ResourcePath.ConcatWith(styleItem.Path) : ExtNetTransformer.GetWebResourceUrl(styleItem.Type, styleItem.PathEmbedded); } sb.Append("{mode:\"css\",url:").Append(JSON.Serialize(url)).Append("}"); } else if (item is ClientScriptItem) { ClientScriptItem scriptItem = (ClientScriptItem)item; if (scriptItem.IgnoreResourceMode) { if (scriptItem.PathEmbedded.IsNotEmpty()) { url = (config.ScriptMode == ScriptMode.Release || scriptItem.PathEmbeddedDebug.IsEmpty()) ? scriptItem.PathEmbedded : scriptItem.PathEmbeddedDebug; } else { bool isDebug = !(config.ScriptMode == ScriptMode.Release || scriptItem.PathEmbeddedDebug.IsEmpty()); url = (isDebug ? scriptItem.PathDebug : scriptItem.Path).StartsWith("~") ? ExtNetTransformer.ResolveUrl(isDebug ? scriptItem.PathDebug : scriptItem.Path) : (isDebug ? scriptItem.PathDebug : scriptItem.Path); } } else if (config.RenderScripts == ResourceLocationType.File) { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathDebug.IsEmpty()) { url = config.ResourcePath.ConcatWith(scriptItem.Path); } else { url = config.ResourcePath.ConcatWith(scriptItem.PathDebug); } } else { if (config.ScriptMode == ScriptMode.Release || scriptItem.PathEmbeddedDebug.IsEmpty()) { url = ExtNetTransformer.GetWebResourceUrl(scriptItem.Type, scriptItem.PathEmbedded); } else { url = ExtNetTransformer.GetWebResourceUrl(scriptItem.Type, scriptItem.PathEmbeddedDebug); } } // CDN is not supported by loading via Ext.net.ResourceMgr.load (another domain) sb.Append("{url:").Append(JSON.Serialize(url)).Append("}"); } } } sb.Append("], function(){"); sb.Append(script); sb.Append("});"); } else { sb.Append(script); } return(sb.ToString()); }