Ejemplo n.º 1
0
        public static MvcHtmlString ActionDialogFormButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, ActionParameters actionParameters, ActionDialogFormParamters actionDialogFormParamters)
        {
            var tBuilder = new TagBuilder("a");

            tBuilder.SetInnerText("REPLACE");
            if (actionParameters.Action.Substring(0, 1) == "/")
            {
                tBuilder.Attributes.Add("href", actionParameters.Action);
            }
            else
            {
                tBuilder.Attributes.Add("href", new UrlHelper(htmlHelper.ViewContext.RequestContext).Action(actionParameters.Action, actionParameters.Controller, actionParameters.RouteValues));
            }

            tBuilder.Attributes.Add("data-dialog-title", actionDialogFormParamters.DialogTitle);
            tBuilder.Attributes.Add("data-update-target-id", actionDialogFormParamters.UpdateTargetId);
            tBuilder.Attributes.Add("data-update-url", actionDialogFormParamters.UpdateUrl);
            tBuilder.Attributes.Add("data-update-url-index", actionDialogFormParamters.UpdateUrlFormIndexFieldName);
            tBuilder.Attributes.Add("data-onSuccessfunction", actionDialogFormParamters.OnSuccessClientFunction);
            tBuilder.Attributes.Add("data-action", actionDialogFormParamters.Action);

            tBuilder.AddCssClass("dialogLink");

            var str = buttonParameters.ButtonConstructor(tBuilder.ToString()).ToString();

            return(new MvcHtmlString(str));
        }
Ejemplo n.º 2
0
        public static MvcHtmlString ActionWindowButton(this HtmlHelper htmlHelper, ButtonParametersBase buttonParameters, ActionParameters actionParameters, ActionButtonWindowParameters actionButtonWindowParameters)
        {
            var str = string.Format("<a id='{0}' href='#' class='actionWindow'>REPLACE</a>", actionButtonWindowParameters.Name);

            str  = buttonParameters.ButtonConstructor(str).ToString();
            str += WindowBuilderHelper.CreateWindow(htmlHelper, actionButtonWindowParameters, actionParameters);
            return(new MvcHtmlString(str));
        }
Ejemplo n.º 3
0
        public static MvcHtmlString ActionButton(this AjaxHelper ajaxHelper, ButtonParameters buttonParameters, ActionParameters actionParameters, AjaxOptions ajaxOptions)
        {
            var htmlStr = ajaxHelper.ActionLink("REPLACE", actionParameters.Action, actionParameters.Controller, actionParameters.RouteValues, ajaxOptions).ToHtmlString();

            return(buttonParameters.ButtonConstructor(htmlStr));
        }
Ejemplo n.º 4
0
        public static MvcHtmlString ActionDialogLink(this HtmlHelper htmlHelper, string linkText, ActionParameters actionParameters, ActionDialogFormParamters actionDialogFormParamters)
        {
            var tBuilder = new TagBuilder("a");

            tBuilder.SetInnerText(linkText);
            tBuilder.Attributes.Add("href", new UrlHelper(htmlHelper.ViewContext.RequestContext).Action(actionParameters.Action, actionParameters.Controller, actionParameters.RouteValues));
            tBuilder.Attributes.Add("data-dialog-title", actionDialogFormParamters.DialogTitle);
            tBuilder.Attributes.Add("data-update-target-id", actionDialogFormParamters.UpdateTargetId);
            tBuilder.Attributes.Add("data-update-url", actionDialogFormParamters.UpdateUrl);
            tBuilder.Attributes.Add("data-update-url-index", actionDialogFormParamters.UpdateUrlFormIndexFieldName);
            tBuilder.Attributes.Add("data-onSuccessfunction", actionDialogFormParamters.OnSuccessClientFunction);
            tBuilder.Attributes.Add("data-action", actionDialogFormParamters.Action);

            tBuilder.AddCssClass("dialogLink");


            return(new MvcHtmlString(tBuilder.ToString()));
        }
Ejemplo n.º 5
0
        public static MvcHtmlString GridTopDialogForm(this HtmlHelper helper, ButtonParameters buttonParameters, ActionParameters actionParameters, ActionDialogFormParamters actionDialogFormParamters)
        {
            var fdButton   = helper.ActionDialogFormButton(buttonParameters, actionParameters, actionDialogFormParamters).ToString();
            var gridTopDiv = "<div class='t-toolbar t-grid-toolbar t-grid-top'>DIAGFORMBUTTON</div>";
            var comb       = gridTopDiv.Replace("DIAGFORMBUTTON", fdButton);

            return(new MvcHtmlString(comb));
        }
Ejemplo n.º 6
0
        public static WindowBuilder CreateWindow(HtmlHelper helper, ActionButtonWindowParameters actionButtonWindowParameters, ActionParameters actionParameters)
        {
            var hlpr       = helper.Telerik();
            var winName    = actionButtonWindowParameters.Name.ToUpper().EndsWith("WINDOW") ? actionButtonWindowParameters.Name : actionButtonWindowParameters.Name + "Window";
            var wdw        = hlpr.Window().Name(winName).Title(actionButtonWindowParameters.HeaderText);
            var controller = String.IsNullOrEmpty(actionParameters.Controller)
                                 ? helper.ViewContext.RouteData.Values["controller"]
                                 : actionParameters.Controller;

            wdw.HtmlAttributes(new Dictionary <string, object>()
            {
                { "data-action", UrlHelper.GenerateContentUrl("~/" + controller + "/" + actionParameters.Action, helper.ViewContext.HttpContext) },
                { "data-values", HtmlHelperExtensions.SerializeToQueryString(actionParameters.RouteValues) }
            });
            //.LoadContentFrom(parameters.Action,parameters.Controller,parameters.RouteValues)
            var loadXpos = (actionButtonWindowParameters.WidthInPx / 2) - 16;
            var loadYpos = (actionButtonWindowParameters.HeightInPx / 2) - 16;

            wdw.Content("<div class='window-loading t-loading' style='position:relative;top:" + loadYpos + "px;left:" + loadXpos + "px;width:16px;height:16px;'> </div><div class='window-contents' style='overflow:auto;'></div>")
            .Width(actionButtonWindowParameters.WidthInPx).Height(actionButtonWindowParameters.HeightInPx)
            .Resizable().Modal(true).Visible(false).Draggable(true);
            if (!String.IsNullOrEmpty(actionButtonWindowParameters.OnWindowCloseClientFunction))
            {
                wdw.ClientEvents(ev => ev.OnClose(actionButtonWindowParameters.OnWindowCloseClientFunction));
            }
            var wtb = actionButtonWindowParameters.TitleBarButtons;

            if ((wtb & ActionWindowTitleBarButtons.Close) == ActionWindowTitleBarButtons.Close)
            {
                wdw.Buttons(buttons => buttons.Close());
            }
            if ((wtb & ActionWindowTitleBarButtons.Maximise) == ActionWindowTitleBarButtons.Maximise)
            {
                wdw.Buttons(buttons => buttons.Maximize());
            }
            if ((wtb & ActionWindowTitleBarButtons.Refresh) == ActionWindowTitleBarButtons.Refresh)
            {
                wdw.Buttons(buttons => buttons.Refresh());
            }
            if ((wtb & ActionWindowTitleBarButtons.None) == ActionWindowTitleBarButtons.None)
            {
                wdw.Buttons(buttons => buttons.Clear());
            }
            return(wdw);
        }