/// <summary>
    /// Method leading the menu construction.
    /// </summary>
    private void AddMainTable()
    {
        int panelCount = Buttons.Count / MaximumItems;

        if ((Buttons.Count % MaximumItems) > 0)
        {
            panelCount++;
        }

        TabGroup.CellPadding = 0;
        TabGroup.CellSpacing = 0;
        TableRow tabGroupRow = null;

        Controls.Clear();
        Controls.Add(TabGroup);

        // Add all panels to control
        for (int i = 0; i < panelCount; i++)
        {
            if (!HorizontalLayout || i == 0)
            {
                tabGroupRow = new TableRow();
                TabGroup.Rows.Add(tabGroupRow);
            }

            TableCell tabGroupCell = new TableCell();
            tabGroupCell.VerticalAlign = VerticalAlign.Top;
            if (tabGroupRow != null)
            {
                tabGroupRow.Cells.Add(tabGroupCell);
            }

            AddPanelTo(tabGroupCell, i);
        }

        // Add params for JavaScript module
        JsModuleData.Add("elemsSelector", mElemsIds);
        if (!String.IsNullOrEmpty(defaultSelectedClientID))
        {
            JsModuleData.Add("defaultSelection", defaultSelectedClientID);
        }
    }
示例#2
0
    /// <summary>
    /// Initializes view mode switchers.
    /// </summary>
    private void InitViewModeButtons()
    {
        btnEdit.Attributes.Add("data-view-mode", "edit");
        btnPreview.Attributes.Add("data-view-mode", "preview");
        btnListing.Attributes.Add("data-view-mode", "listing");

        btnEdit.ToolTip    = GetString("mode.edittooltip");
        btnPreview.ToolTip = GetString("mode.previewtooltip");
        btnListing.ToolTip = GetString("mode.listingtooltip");

        btnEdit.Text    = GetString("content.ui.edit");
        btnPreview.Text = GetString("content.ui.preview");
        btnListing.Text = GetString("content.ui.list");

        string elemsIds = "#" + btnEdit.ClientID + "," + "#" + btnPreview.ClientID + "," + "#" + btnListing.ClientID;

        // Add parameters for JavaScript module
        JsModuleData.Add("elemsSelector", elemsIds);

        string defaultClientID;

        switch (SelectedMode)
        {
        case "preview":
            defaultClientID = btnPreview.ClientID;
            break;

        case "listing":
            defaultClientID = btnListing.ClientID;
            break;

        default:
            defaultClientID = btnEdit.ClientID;
            break;
        }

        JsModuleData.Add("defaultSelection", "#" + defaultClientID);

        ScriptHelper.RegisterModule(Page, "CMS/ContentMenu", JsModuleData);
    }