public static string NormalizeRawToken(string script) { if (TokenUtils.IsRawToken(script)) { return(TokenUtils.ReplaceRawToken(script)); } return(string.Concat("\"", script, "\"")); }
public static string ReplaceRawToken(string script) { if (TokenUtils.IsRawToken(script)) { script = (script.StartsWith("<raw>")) ? script.Substring(5) : script.Substring(0, script.Length - 1).Substring(2); } return(script); }
protected string ParseTarget(string target) { string parsedTarget = TokenUtils.ParseTokens(target, this); if (TokenUtils.IsRawToken(parsedTarget)) { return(TokenUtils.ReplaceRawToken(parsedTarget)); } return(string.Concat("\"", parsedTarget, "\"")); }
public virtual void Filter(string field, string value, bool anyMatch, bool caseSensitive) { if (TokenUtils.IsRawToken(value)) { value = TokenUtils.ReplaceRawToken(value); } else { value = JSON.Serialize(value); } this.AddScript("{0}.filter({1},{2},{3},{4});", this.ClientID, JSON.Serialize(field), value, JSON.Serialize(anyMatch), JSON.Serialize(caseSensitive)); }
public string ToString(bool camelNames) { ParameterMode mode = this.Mode; string name = camelNames ? StringUtils.ToLowerCamelCase(this.Name) : this.Name; if (this.Params.Count > 0) { return(this.ToStringInnerParams(name)); } else { string script = TokenUtils.ParseTokens(this.Value, this.Owner); if (TokenUtils.IsRawToken(script)) { mode = ParameterMode.Raw; script = TokenUtils.ReplaceRawToken(script); } return(string.Concat(JSON.Serialize(name), ":", this.Encode ? "Ext.encode(" : "", mode == ParameterMode.Raw ? script : JSON.Serialize(script), this.Encode ? ")" : "")); } }
public static string ParseTokens(string script, Control seed) { if (seed == null) { seed = TokenUtils.Page; } bool isRaw = ( TokenUtils.IsAlertToken(script) || TokenUtils.IsRawToken(script) || TokenUtils.IsSelectToken(script)); script = TokenUtils.ReplaceIDTokens(script, seed); script = TokenUtils.ReplaceSelectTokens(script); script = TokenUtils.ReplaceAlertToken(script); script = TokenUtils.ReplaceRawToken(script); script = TokenUtils.ReplaceFunctionToken(script); return((isRaw || TokenUtils.IsFunction(script)) ? string.Concat("<raw>", script) : script); }
public string ValueToString() { ParameterMode mode = this.Mode; if (this.Params.Count > 0) { return(this.ToStringInnerParams(null)); } else { string script = TokenUtils.ParseTokens(this.Value, this.Owner); if (TokenUtils.IsRawToken(script)) { mode = ParameterMode.Raw; script = TokenUtils.ReplaceRawToken(script); } return(string.Concat(this.Encode ? "Ext.encode(" : "", mode == ParameterMode.Raw ? script : JSON.Serialize(script), this.Encode ? ")" : "")); } }
public virtual string ToConfigString() { if (this.Format != RendererFormat.None) { if (this.FormatArgs != null && this.FormatArgs.Length > 0) { return(new JFunction( string.Concat( "return Ext.util.Format.", StringUtils.ToLowerCamelCase(this.Format.ToString()), "(value,", StringUtils.Concat(this.FormatArgs), ");"), "value").ToString()); } if (string.IsNullOrEmpty(this.Handler)) { return(string.Concat("Ext.util.Format.", StringUtils.ToLowerCamelCase(this.Format.ToString()))); } } if (!string.IsNullOrEmpty(this.Handler)) { string temp = TokenUtils.ParseTokens(this.Handler, this.Owner); if (TokenUtils.IsRawToken(temp)) { return(TokenUtils.ReplaceRawToken(temp)); } return(new JFunction( temp, new string[] { "value", "metadata", "record", "rowIndex", "colIndex", "store" }) .ToString()); } return(TokenUtils.ReplaceRawToken(TokenUtils.ParseTokens(this.Fn))); }
public static void Redirect(string url, string msg, string msgCls) { ScriptManager sm = ScriptManager.GetInstance(HttpContext.Current); if (sm == null) { throw new InvalidOperationException("The ScriptManager can not be found during the Ext.Redirect."); } if (string.IsNullOrEmpty(url)) { throw new ArgumentNullException("url", "The redirection url is empty"); } if (!string.IsNullOrEmpty(msg)) { Mask.Show(new Mask.Config { Msg = msg, MsgCls = msgCls }); } sm.AddScript(string.Concat("window.location=\"", (Coolite.Utilities.UrlUtils.IsUrl(url) || sm.Page == null || TokenUtils.IsRawToken(url)) ? url : sm.Page.ResolveUrl(url), "\";")); }