Ejemplo n.º 1
0
        public static MvcHtmlString SearchControl(this HtmlHelper helper, FindOptions findOptions, Context context, Action <SearchControl> settingsModifier)
        {
            var options = new SearchControl {
                Prefix = context.Prefix
            };

            if (settingsModifier != null)
            {
                settingsModifier(options);
            }

            QueryDescription description = DynamicQueryManager.Current.QueryDescription(findOptions.QueryName);

            FilterOption.SetFilterTokens(findOptions.FilterOptions, description, false);
            OrderOption.SetOrderTokens(findOptions.OrderOptions, description, false);
            ColumnOption.SetColumnTokens(findOptions.ColumnOptions, description, false);
            Finder.Manager.SetSearchViewableAndCreable(findOptions, description);
            FinderManager.SetDefaultOrder(findOptions, description);

            var viewData = new ViewDataDictionary(context);

            viewData[ViewDataKeys.FindOptions]      = findOptions;
            viewData[ViewDataKeys.QueryDescription] = DynamicQueryManager.Current.QueryDescription(findOptions.QueryName);

            viewData[ViewDataKeys.Title] = helper.ViewData.ContainsKey(ViewDataKeys.Title) ?
                                           helper.ViewData[ViewDataKeys.Title] : QueryUtils.GetNiceName(findOptions.QueryName);

            if (!options.ToolBarButton.IsNullOrEmpty())
            {
                viewData[ViewDataKeys.ManualToolbarButtons] = options.ToolBarButton;
            }

            if (options.AvoidFullScreenButton)
            {
                viewData[ViewDataKeys.AvoidFullScreenButton] = true;
            }

            return(helper.Partial(Finder.Manager.SearchControlView, viewData));
        }
Ejemplo n.º 2
0
 public static void Start(FinderManager manager)
 {
     Manager = manager;
 }