Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
        public void Start(Mubble.Data.IData data, TypeInfo type)
        {
            json.WriteStartObject();
            //json.WritePropertyName("type");

            //json.WriteValue(type.Name);

            closings.Push(json.WriteEndObject);
        }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 public MubbleUrl(Mubble.Models.Link link, string handler)
     : this(link.Path, link.Extra, handler)
 {
     this.Params = link.Params;
 }
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
        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();
        }
Exemplo n.º 14
0
 public static string Url(Mubble.Models.Link link, string handler)
 {
     return Create(link, handler).ToString();
 }
Exemplo n.º 15
0
 public static MubbleUrl Create(Mubble.Models.Link link, string handler)
 {
     return new MubbleUrl(link, handler);
 }
Exemplo n.º 16
0
 public static void RedirectPermanently(Mubble.Models.Link url)
 {
     RedirectPermanently(MubbleUrl.Create(url.Path, url.Extra));
 }
Exemplo n.º 17
0
 public virtual void GetVisibleIndexes(Mubble.Models.QueryEngine.QueryResults results, List<int> visibleIndexes)
 {
 }
Exemplo n.º 18
0
 public virtual Mubble.Models.QueryEngine.Query BuildQuery(Mubble.Models.QueryEngine.Query current)
 {
     return current;
 }
Exemplo n.º 19
0
        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;
        }
Exemplo n.º 20
0
 public void Start(Mubble.Data.IData data, TypeInfo type)
 {
     root.Add(new XAttribute("type", type.Name));
 }