Esempio n. 1
0
 public QuickLinkExplore(FindOptions findOptions)
 {
     FindOptions = findOptions;
     IsVisible   = Finder.IsFindable(findOptions.QueryName);
     Text        = QueryUtils.GetNiceName(findOptions.QueryName);
     Name        = Finder.ResolveWebQueryName(findOptions.QueryName);
 }
        public static MvcHtmlString QueryTokenBuilder(this HtmlHelper helper, QueryToken queryToken, Context context, QueryTokenBuilderSettings settings)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("span").Id(context.Prefix).Class("token-builder")))
            {
                sb.Add(QueryTokenBuilderOptions(helper, queryToken, context, settings));
            }

            if (settings.ControllerUrl.HasText())
            {
                sb.Add(MvcHtmlString.Create("<script>" + JsModule.Finder["QueryTokenBuilder.init"](context.Prefix,
                                                                                                   Finder.ResolveWebQueryName(settings.QueryDescription.QueryName), settings.ControllerUrl, (int)settings.Options, settings.RequestExtraJSonData).ToString()
                                            + "</script>"));
            }

            return(sb.ToHtml());
        }
Esempio n. 3
0
        public JObject ToJS(string prefix)
        {
            JObject op = new JObject()
            {
                { "prefix", prefix }
            };

            if (FilterOptions.Any())
            {
                QueryDescription queryDescription = DynamicQueryManager.Current.QueryDescription(QueryName);

                FilterOption.SetFilterTokens(this.FilterOptions, queryDescription, false);
            }

            if (QueryName != null)
            {
                op.Add("webQueryName", Finder.ResolveWebQueryName(QueryName));
            }
            if (SearchOnLoad == true)
            {
                op.Add("searchOnLoad", true);
            }
            if (!Navigate)
            {
                op.Add("navigate", false);
            }
            if (!Create)
            {
                op.Add("create", false);
            }
            if (!AllowSelection)
            {
                op.Add("allowSelection", false);
            }
            if (!SelectedItemsContextMenu)
            {
                op.Add("selectedItemsContextMenu", false);
            }
            if (!AllowChangeColumns)
            {
                op.Add("allowChangeColumns", false);
            }
            if (!AllowOrder)
            {
                op.Add("allowOrder", false);
            }
            if (!showHeader)
            {
                op.Add("showHeader", false);
            }
            if (!showFilters)
            {
                op.Add("showFilters", false);
            }
            if (!showFilterButton)
            {
                op.Add("showFilterButton", false);
            }
            if (!showFooter)
            {
                op.Add("showFooter", false);
            }
            if (!showContextMenu)
            {
                op.Add("showContextMenu", false);
            }
            if (FilterOptions.Any())
            {
                op.Add("filters", new JArray(filterOptions.Select(f => f.ToJS())));
            }
            if (OrderOptions.Any())
            {
                op.Add("orders", new JArray(OrderOptions.Select(oo => oo.ToJS())));
            }
            if (ColumnOptions.Any())
            {
                op.Add("columns", new JArray(ColumnOptions.Select(co => co.ToJS())));
            }
            if (ColumnOptionsMode != Entities.DynamicQuery.ColumnOptionsMode.Add)
            {
                op.Add("columnMode", ColumnOptionsMode.ToString());
            }

            if (Pagination != null)
            {
                op.Add("pagination", Pagination.GetMode().ToString());
                int?elems = Pagination.GetElementsPerPage();
                if (elems != null)
                {
                    op.Add("elems", elems.Value.ToString());
                }
            }

            return(op);
        }