/// <summary>
    /// Initialize design.
    /// </summary>
    private void InitDesign()
    {
        // Register css styles for uploader
        CssRegistration.RegisterCssBlock(Page, "dfu_" + containerDiv.ClientID, CreateCss(containerDiv.ClientID));

        bool isRTL = IsLiveSite ? CultureHelper.IsPreferredCultureRTL() : CultureHelper.IsUICultureRTL();

        // Prepare loading image
        imgLoading.Style.Add("float", isRTL ? "right" : "left");
        imgLoading.Attributes["title"] = GetString("tree.loading");

        // Loading css class
        lblProgress.CssClass = InnerLoadingElementClass;

        // Ensure nowrap on loading text
        pnlLoading.Style.Add("white-space", "nowrap;");
        pnlLoading.Style.Add("display", "none");

        // Decide between icon or text mode
        uploadIcon.Visible = ShowIconMode;
        btnUpload.Visible  = !ShowIconMode;

        // Disable everything properly
        if (!Enabled)
        {
            btnUpload.Enabled = false;
            uploadIcon.Attributes["class"] += " icon-disabled";
            pnlInnerDiv.CssClass           += " uploader-button-disabled";
        }

        uploaderFrame.Visible     = Enabled;
        mfuDirectUploader.Visible = Enabled;

        // Inner div html and design
        if (!String.IsNullOrEmpty(Text))
        {
            btnUpload.Text = Text;
        }
        if (!String.IsNullOrEmpty(InnerElementClass))
        {
            pnlInnerDiv.CssClass += " " + InnerElementClass;
        }

        // Container div styles
        containerDiv.Style.Add("position", "relative");
        if (DisplayInline)
        {
            containerDiv.Style.Add("float", isRTL ? "right" : "left");
        }

        if (!String.IsNullOrEmpty(ControlGroup))
        {
            containerDiv.Attributes.Add("class", ControlGroup);
        }

        string initScript = String.Format("if (typeof(DFU) !== 'undefined') {{ $cmsj(function () {{DFU.initializeDesign({0});}}); }}", ScriptHelper.GetString(containerDiv.ClientID));

        RegisterScript("DFUInit_" + ClientID, initScript);
    }
Exemple #2
0
    /// <summary>
    /// PreRender event handler.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (!StopProcessing)
        {
            // Register scripts
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "InitResizers", "$cmsj(InitResizers());", true);
            CssRegistration.RegisterCssBlock(Page, "themeCss", ".TooltipImage{max-width:200px; max-height:200;}");

            ScriptHelper.HideVerticalTabs(Page);
        }

        base.OnPreRender(e);
    }
Exemple #3
0
    private void RegisterCSS()
    {
        CssRegistration.RegisterCssBlock(this, "SupportHelper", String.Format(@"
			.ck-link-form .ck-input-text {{
				width: inherit !important;
			}}
            .cms-bootstrap .editing-form-value-cell i {{
                margin: inherit;
            }}
			.cms-bootstrap .ck-editor__editable a:hover,
			.cms-bootstrap .ck-editor__editable .link:hover,
			.cms-bootstrap .ck-editor__editable a:focus,
			.cms-bootstrap .ck-editor__editable .link:focus {{
				color: black;
				text-decoration: none;
			}}
			.cms-bootstrap .ck-editor__editable h2,
			.cms-bootstrap .ck-editor__editable h3,
			.cms-bootstrap .ck-editor__editable h4,
			.cms-bootstrap .ck-editor__editable strong {{
				color: black;
			}}
			#{0} {{
				height: 300px;
				max-width: 500px !important;
				border: 2px solid #bdbbbb;
				border-radius: 3px;
			}}
			#{0}:focus {{
				border-bottom: 2px solid #1175ae;
			}}
			#{1} {{
				margin: 7px 0 0;
			}}
			#{2} {{
				display: block;
			}}
			.PLCFix > div {{
				top: 70px;
			}}
		"        , txtDescription.ClientID, txtCategoryCustom.ClientID, drpCategory.ClientID));
    }
    /// <summary>
    /// Prepares the layout of the web part.
    /// </summary>
    protected override void PrepareLayout()
    {
        StartLayout();

        if (IsDesign)
        {
            Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">");

            if (ViewModeIsDesign())
            {
                Append("<tr><td class=\"LayoutHeader\">");

                // Add header container
                AddHeaderContainer();

                Append("</td></tr>");
            }

            Append("<tr><td>");
        }

        // Content before zones
        Append(BeforeZones);

        string separator = Separator;
        string before    = BeforeZone;
        string after     = AfterZone;

        string zoneclass = ZoneCSSClass;
        string zonewidth = ZoneWidth;

        // Render the zones
        for (int i = 1; i <= Zones; i++)
        {
            if (i > 1)
            {
                Append(separator);
            }
            Append("<div");

            // Zone class
            if (!String.IsNullOrEmpty(zoneclass))
            {
                Append(" class=\"", zoneclass, "\"");
            }

            // Zone width
            if (!String.IsNullOrEmpty(zonewidth))
            {
                Append(" style=\"width: ", zonewidth, "\";");
            }

            Append(">", before);

            // Add the zone
            CMSWebPartZone zone = AddZone(ID + "_" + i, "[" + i + "]");

            Append(after, "</div>");
        }

        // Content after zones
        Append(AfterZones);

        if (IsDesign)
        {
            Append("</td></tr>");

            // Footer
            if (AllowDesignMode)
            {
                Append("<tr><td class=\"LayoutFooter cms-bootstrap\" colspan=\"2\"><div class=\"LayoutFooterContent\">");

                // Zone actions
                AppendRemoveAction(ResHelper.GetString("Layout.RemoveZone"), "Zones");
                Append("&nbsp;&nbsp;");
                AppendAddAction(ResHelper.GetString("Layout.AddZone"), "Zones");

                Append("</div></td></tr>");
            }

            Append("</table>");
        }

        // Register scripts
        string[] scripts = ScriptFiles.Split('\r', '\n');
        foreach (string script in scripts)
        {
            // Register the script file
            string sfile = script.Trim();
            if (!String.IsNullOrEmpty(sfile))
            {
                ScriptHelper.RegisterScriptFile(Page, sfile);
            }
        }

        // Add init script
        string resolvedInitScript = MacroResolver.Resolve(InitScript);

        if (!string.IsNullOrEmpty(resolvedInitScript))
        {
            ScriptHelper.RegisterStartupScript(this, typeof(string), ShortClientID + "_Init", ScriptHelper.GetScript(resolvedInitScript));
        }

        // Register CSS files
        string[] cssFiles = CSSFiles.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
        Array.ForEach(cssFiles, cssFile => CssRegistration.RegisterCssLink(Page, cssFile.Trim()));

        // Add inline CSS
        string inlinecss = MacroResolver.Resolve(InlineCSS);

        if (!string.IsNullOrEmpty(inlinecss))
        {
            // Add css to page header
            CssRegistration.RegisterCssBlock(Page, "zonesWithEffectInlineCss_" + ClientID, inlinecss);
        }

        FinishLayout();
    }