public override Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { XmlDocument x = new XmlDocument(); x.LoadXml(this.Xml); Mubble.Models.QueryEngine.Query.Parse(x, current); return current; }
public override Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { if (!string.IsNullOrEmpty(current.Text)) { current.Text += " "; } current.Text += this.Text; return current; }
public bool MatchesPath(Mubble.Models.Controller content) { string pattern = this.PathPattern; if (this.PatternType == PathDependantPatternType.Simple) { pattern = string.Format("^{0}$", pattern.Replace("*", ".*")); } return Regex.IsMatch(content.Path, pattern, RegexOptions.IgnoreCase); }
public void StartRelated(string name, Mubble.Data.IData data, TypeInfo type) { var c = new XElement("related", new XAttribute("name", name), new XAttribute("type", type.Name) ); current.Add(c); current = c; }
public void Start(Mubble.Data.IData data, TypeInfo type) { json.WriteStartObject(); //json.WritePropertyName("type"); //json.WriteValue(type.Name); closings.Push(json.WriteEndObject); }
public override Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { string author = this.Parent.Url.GetPathItem(0, "---"); if (author != "---") { current.AddTerm("Author", author, true, false); } else { current.IsValid = false; } return current; }
public override Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { if (this.Value != null && this.Name != null) { current.AddTerm( this.Name, this.Value, this.Value.Contains("*"), this.Mode == IndexFieldMode.Require, this.Mode == IndexFieldMode.Exclude ); } return current; }
public override Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { Controller c = null; if (string.IsNullOrEmpty(this.Path)) { c = Control.GetCurrentScope<Controller>(this.Parent.Parent); } else { c = DataBroker.GetController(this.Path); } if (c != null) { this.Path = c.Path; current.AddTerm("Path", this.Path + "*", true, true, false); current.AddTerm("ActiveObjectsID", c.ID.ToString(), false, true); } return current; }
public override Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { if (this.Content != null) { HasMetadata md = this.Content.DataManager.ActsAs(typeof(HasMetadata)) as HasMetadata; if (md != null && this.Content.DataManager[md.FieldName] is MetaDataCollection) { MetaDataCollection metadata = this.Content.DataManager[md.FieldName] as MetaDataCollection; List<Tag> tags = metadata.Get(this.MetadataName); if (tags.Count == 0) { current.IsValid = false; return current; } double maxNumericValue = 0; foreach (Tag t in tags) { if (t.NumericValue > maxNumericValue) maxNumericValue = t.NumericValue; } Query q = current; foreach (Tag t in tags) { float score = (float)Math.Abs(t.NumericValue - maxNumericValue); if (score <= 1) score = 1; TermClause tc = new TermClause(this.MetadataName, t.StringValueNormalized, TermClauseType.Fuzzy, score); q.Add(tc); } q.OrderBy = "Score"; return q; } } return current; }
protected void SetPageData(Mubble.Models.Page workingPage) { this.txtTitle.Text = this.FeaturedContent.Title; if (workingPage != null && workingPage.Body != null) { this.txtBody.Text = workingPage.Body; } this.PageList.DataSource = this.FeaturedContent.Pages.Sort("PageNumber"); this.PageList.DataBind(); this.CurrentPageNumber = workingPage.PageNumber; this.Title = (this.FeaturedContent.DataManager.IsDirty) ? "[Unsaved] " : ""; this.Title += string.Format("Editing \"{0}\"", this.FeaturedContent.Title); }
public MubbleUrl(Mubble.Models.Link link, string handler) : this(link.Path, link.Extra, handler) { this.Params = link.Params; }
protected StringBuilder AppendParamsToQueryString(StringBuilder builder, Mubble.Models.LinkParameters parameters) { if (parameters == null) return builder; if (parameters.Keys.Count > 0) builder.Append('?'); int paramCount = 0; foreach (string key in parameters.Keys) { List<object> values = parameters[key] as List<object>; if(values == null) values = new List<object>(); bool multi = values.Count > 1; if(values.Count == 0) { if(paramCount > 0) builder.Append('&'); builder.Append(key); builder.Append('='); paramCount++; } foreach(object value in values) { if(paramCount > 0) builder.Append('&'); builder.Append(HttpUtility.UrlEncode(key)); builder.Append((multi) ? "[]=" : "="); builder.Append(HttpUtility.UrlEncode(value.ToString())); paramCount++; } } return builder; }
public string ToString(string handler, string pathExtra, Mubble.Models.LinkParameters parameters) { string url = string.Format( "{0}{1}{2}{3}", MubbleUrl.ApplicationPath == "/" ? "" : MubbleUrl.ApplicationPath, path, Mubble.Handlers.Settings.Extensions.FindByKey(handler), pathExtra ); Uri current = HttpContext.Current != null ? HttpContext.Current.Request.Url : firstUri; StringBuilder uri = new StringBuilder(url); uri.Insert(0, current.GetLeftPart(UriPartial.Authority)); return this.AppendParamsToQueryString(uri, parameters).ToString(); }
public static string Url(Mubble.Models.Link link, string handler) { return Create(link, handler).ToString(); }
public static MubbleUrl Create(Mubble.Models.Link link, string handler) { return new MubbleUrl(link, handler); }
public static void RedirectPermanently(Mubble.Models.Link url) { RedirectPermanently(MubbleUrl.Create(url.Path, url.Extra)); }
public virtual void GetVisibleIndexes(Mubble.Models.QueryEngine.QueryResults results, List<int> visibleIndexes) { }
public virtual Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current) { return current; }
protected PagePair GetPagePair(Mubble.Models.Page contentPage) { PagePair pPair = new PagePair(); pPair.Link = string.Format(this.PageLinkFormat, contentPage.PageNumber); pPair.Name = (contentPage.Name == null || contentPage.Name.Trim() == string.Empty) ? "Page " + contentPage.PageNumber : contentPage.Name; ; return pPair; }
public void Start(Mubble.Data.IData data, TypeInfo type) { root.Add(new XAttribute("type", type.Name)); }