Exemplo n.º 1
0
        /// <summary>
        /// Adds any form-specific addons for the current page that are required by the package rendering components and views.
        /// </summary>
        /// <remarks>This is only called if a page contains a form.</remarks>
        public async Task AddFormsAddOnsAsync()
        {
            SkinAccess skinAccess = new SkinAccess();

            if (!Manager.SkinInfo.UsingBootstrap || !Manager.SkinInfo.UsingBootstrapButtons)
            {
                await JqueryUICore.UseAsync(); // using jquery UI buttons
            }
        }
Exemplo n.º 2
0
        public async Task <string> RenderAsync(PageBarInfo model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            string pane = model.ContentPane;

            string styleCss;
            string styleListCss = "";
            string activeCss;

            switch (model.Style)
            {
            default:
            case PageBarModule.PanelStyleEnum.Vertical:
                styleCss = "t_stylesvert";
                break;

            case PageBarModule.PanelStyleEnum.Horizontal:
                styleCss = "t_styleshorz";
                break;
            }
            if (model.UseSkinFormatting)
            {
                await JqueryUICore.UseAsync();// needed for css

                styleCss    += " t_skin";
                styleListCss = " ui-widget-content";
                activeCss    = " t_active ui-state-active";
            }
            else
            {
                styleCss += " t_noskin";
                activeCss = " t_active";
            }

            string paneContents = "";

            if (model.ContentPage != null)
            {
                paneContents = await model.ContentPage.RenderPaneAsync(HtmlHelper, pane == ""?Globals.MainPane : pane, PaneDiv : false);
            }

            string      pageUrl = Manager.CurrentPage.EvaluatedCanonicalUrl;
            string      pageUrlOnly;
            QueryHelper qh = QueryHelper.FromUrl(pageUrl, out pageUrlOnly);

            hb.Append($@"
<div class='yt_panels_pagebarinfo t_display {styleCss}' id='{ControlId}'>
    <div class='yt_panels_pagebarinfo_list yNoPrint{styleListCss}'>");

            foreach (PageBarInfo.PanelEntry entry in model.Panels)
            {
                string caption = entry.Caption.ToString();
                if (string.IsNullOrWhiteSpace(caption))
                {
                    caption = this.__ResStr("emptyCaption", "(no caption - Page Title)");
                }
                string actionLinkClass = "yaction-link";

                string active = "";
                if (model.ContentUri != null)
                {
                    Uri uriLink = new Uri(entry.Url);
                    if (uriLink.AbsolutePath.ToLower() == model.ContentUri.AbsolutePath.ToLower())
                    {
                        active = activeCss;
                    }
                }

                qh.Add("!ContentUrl", entry.Url, Replace: true);
                string anchor = $"<a class='{actionLinkClass}' data-contenttarget='{DivId}' data-contentpane='{HAE(pane == "" ? "MainPane" : pane)}' {Basics.CssSaveReturnUrl}='' href='{HAE(qh.ToUrl(pageUrlOnly))}' data-tooltip='{HAE(entry.ToolTip.ToString())}'>";

                hb.Append($@"
        <div class='t_entry{active}'>
            <div class='t_image'>
                {anchor}
                    <img src='{HAE(entry.ImageUrl)}' alt='{HAE(caption)}' title='{HAE(entry.ToolTip.ToString())}' />
                </a>
            </div>
            <div class='t_link'>
                {anchor}
                {HE(caption)}</a>
            </div>
        </div>");
            }

            hb.Append($@"
    </div>
    <div class='t_area' id='{DivId}'>
        {paneContents}
    </div>
</div>");

            Setup setup = new Setup {
                Resize    = model.Style == PageBarModule.PanelStyleEnum.Vertical,
                ActiveCss = activeCss,
            };

            Manager.ScriptManager.AddLast($@"new YetaWF_Panels.PageBarInfoComponent('{ControlId}', {Utility.JsonSerialize(setup)});");

            return(hb.ToString());
        }