예제 #1
0
        private void RegisterListTab()
        {
            var lcid = Thread.CurrentThread.CurrentUICulture.LCID;

            var listTab = new RibbonTab("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List")
                              {
                                  Title = LocalizationHelper.GetStringFromCoreResource("cui_TabList"),
                                  Sequence = 500
                              };

            var viewFormatGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.ViewFormat")
                    {
                        Sequence = 10,
                        Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpViewFormat"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = -256,
                        Image32By32PopupTop = -256,
                        GroupTemplate = RibbonGroupTemplate.Flexible2
                    };
            viewFormatGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.List.Scaling.ViewFormat.MaxSize")
                                             {Sequence = 10, Group = viewFormatGroup, Size = RibbonSize.LargeLarge});
            viewFormatGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.ViewFormat.Popup")
                                           {Sequence = 240, Group = viewFormatGroup, Size = RibbonSize.Popup});
            listTab.Groups.Add(viewFormatGroup);
            RegisterRibbonControls(viewFormatGroup);

            var btnStandard =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.ViewFormat.Controls.Standard")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButStandardView"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -32,
                        Image16By16Left = -144,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -256,
                        Image32By32Left = -256,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButStandardView"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButStandardView"),
                        TemplateAlias = "c1",
                    };
            viewFormatGroup.Controls.Add(btnStandard);

            var btnDatasheet =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.ViewFormat.Controls.Datasheet")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButDataSheetView"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -48,
                        Image16By16Left = -144,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = 0,
                        Image32By32Left = -288,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButDataSheetView"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButDatasheetView"),
                        TemplateAlias = "c1",
                    };
            viewFormatGroup.Controls.Add(btnDatasheet);

            var datasheetGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Datasheet")
                    {
                        Sequence = 20,
                        Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpDatasheet"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = -448,
                        Image32By32PopupTop = -256,
                        GroupTemplate = RibbonGroupTemplate.Flexible2
                    };
            viewFormatGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.List.Scaling.Datasheet.MaxSize")
                                             {Sequence = 20, Group = datasheetGroup, Size = RibbonSize.LargeMedium});
            viewFormatGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Datasheet.LargeSmall")
                                           {Sequence = 90, Group = datasheetGroup, Size = RibbonSize.LargeSmall});
            viewFormatGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Datasheet.Popup")
                                           {Sequence = 170, Group = datasheetGroup, Size = RibbonSize.Popup});
            listTab.Groups.Add(datasheetGroup);
            RegisterRibbonControls(datasheetGroup);

            var btnNewRow =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Datasheet.Controls.NewRow")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButNewRow"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -80,
                        Image16By16Left = -192,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -160,
                        Image32By32Left = -384,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButNewRow"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButNewRow"),
                        TemplateAlias = "c1",
                    };
            datasheetGroup.Controls.Add(btnNewRow);

            var btnShowTaskPane =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Datasheet.Controls.ShowTaskPane")
                    {
                        Sequence = 20,
                        LabelText = "",
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -16,
                        Image16By16Left = -152,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -256,
                        Image32By32Left = -224,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButShowTaskPane"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButShowTaskPane"),
                        TemplateAlias = "c2",
                    };
            datasheetGroup.Controls.Add(btnShowTaskPane);

            var btnShowTotals =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Datasheet.Controls.ShowTotals")
                    {
                        Sequence = 30,
                        LabelText = "",
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -240,
                        Image16By16Left = -224,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -448,
                        Image32By32Left = -256,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButShowTotals"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButShowTotals"),
                        TemplateAlias = "c2",
                    };
            datasheetGroup.Controls.Add(btnShowTotals);

            var btnRefreshData =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Datasheet.Controls.RefreshData")
                    {
                        Sequence = 40,
                        LabelText = "",
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -240,
                        Image16By16Left = -208,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -448,
                        Image32By32Left = -224,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButRefreshData"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButRefreshData"),
                        TemplateAlias = "c2",
                    };
            datasheetGroup.Controls.Add(btnRefreshData);

            var customViewsGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.CustomViews")
                    {
                        Sequence = 40,
                        Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpManageViews"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = -352,
                        Image32By32PopupTop = -320,
                        GroupTemplate = RibbonGroupTemplate.ManageViewsGroup
                    };
            customViewsGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.List.Scaling.CustomViews.MaxSize")
                                              {Sequence = 40, Group = customViewsGroup, Size = RibbonSize.LargeMedium});
            customViewsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.CustomViews.LargeSmall")
                                            {Sequence = 160, Group = customViewsGroup, Size = RibbonSize.LargeSmall});
            customViewsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.CustomViews.Popup")
                                            {Sequence = 220, Group = customViewsGroup, Size = RibbonSize.Popup});
            listTab.Groups.Add(customViewsGroup);
            RegisterRibbonControls(customViewsGroup);

            var btnCreateView =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.CustomViews.Controls.CreateView")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButCreateView"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -48,
                        Image16By16Left = -192,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -352,
                        Image32By32Left = -352,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButCreateView"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButCreateView"),
                        TemplateAlias = "c1",
                    };
            customViewsGroup.Controls.Add(btnCreateView);

            var btnModifyView =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.CustomViews.Controls.ModifyView")
                    {
                        Sequence = 20,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButModifyThisView"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -32,
                        Image16By16Left = -192,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -352,
                        Image32By32Left = -320,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButModifyThisView"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButModifyThisView"),
                        TemplateAlias = "c2",
                    };
            customViewsGroup.Controls.Add(btnModifyView);

            var btnCreateColumn =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.CustomViews.Controls.CreateColumn")
                    {
                        Sequence = 30,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButCreateColumn"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -144,
                        Image16By16Left = -176,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -96,
                        Image32By32Left = -352,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButCreateColumn"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButCreateColumn"),
                        TemplateAlias = "c2",
                    };
            customViewsGroup.Controls.Add(btnCreateColumn);

            var btnNavigateUp =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.CustomViews.Controls.NavigateUp")
                    {
                        Sequence = 30,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButNavigateUp"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = 0,
                        Image16By16Left = -56,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -64,
                        Image32By32Left = 0,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButNavigateUp"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButNavigateUp"),
                        TemplateAlias = "c2",
                    };

            var rootFolder = Page.Request.QueryString["RootFolder"];
            if (!string.IsNullOrEmpty(rootFolder))
            {
                var folder = SPContext.Current.Web.GetFolder(rootFolder);
                if (folder.ParentFolder != null && folder.UniqueId != List.RootFolder.UniqueId)
                {
                    var urlBuilder = new UrlBuilder(Page.Request.RawUrl);
                    urlBuilder.AddQueryString("RootFolder", folder.ParentFolder.ServerRelativeUrl);
                    urlBuilder.RemoveAllFilterQueryString();
                    urlBuilder.RemoveQueryString("Source");

                    btnNavigateUp.Command =
                        new SPRibbonCommand("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Commands.NavigateUp",
                            string.Format("window.location = '{0}';", urlBuilder));
                }
            }

            customViewsGroup.Controls.Add(btnNavigateUp);

            var shareGroup = new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Share")
                                 {
                                     Sequence = 50,
                                     Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpShare"),
                                     Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                                     Image32By32PopupLeft = -448,
                                     Image32By32PopupTop = -256,
                                     GroupTemplate = RibbonGroupTemplate.Flexible2
                                 };
            shareGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.List.Scaling.Share.MaxSize")
                                        {Sequence = 40, Group = shareGroup, Size = RibbonSize.LargeLarge});
            shareGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Share.MediumMedium")
                                      {Sequence = 90, Group = shareGroup, Size = RibbonSize.MediumMedium});
            shareGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Share.Popup")
                                      {Sequence = 170, Group = shareGroup, Size = RibbonSize.Popup});
            listTab.Groups.Add(shareGroup);
            RegisterRibbonControls(shareGroup);

            var handlerStatement = new StringBuilder();
            handlerStatement.AppendFormat("window.location = 'mailto:?body={0}';", DataViewUtils.Escape(Page.Request.Url.OriginalString));

            var btnEmailLibraryLink =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Share.Controls.EmailLibraryLink")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButEmailLink"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -16,
                        Image16By16Left = -88,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -128,
                        Image32By32Left = -448,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButEmailLink"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButEmailLinkList"),
                        Command =
                            new SPRibbonCommand(
                            "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Commands.EmailLibraryLink",
                            handlerStatement.ToString()),
                        TemplateAlias = "c1",
                    };
            shareGroup.Controls.Add(btnEmailLibraryLink);

            handlerStatement = new StringBuilder();
            handlerStatement.AppendFormat("window.location = '{0}/_layouts/listfeed.aspx?List={1}';",
                                          Utilities.GetWebUrl(SPContext.Current.Web.Url), List.ID);

            var btnViewRssFeed =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Share.Controls.ViewRSSFeed")
                    {
                        Sequence = 30,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButViewRSSFeed"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -128,
                        Image16By16Left = -112,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -224,
                        Image32By32Left = -128,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButViewRSSFeed"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButViewRSSFeedList"),
                        Command =
                            new SPRibbonCommand(
                            "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Commands.ViewRSSFeed",
                            handlerStatement.ToString()),
                        TemplateAlias = "c1",
                    };
            shareGroup.Controls.Add(btnViewRssFeed);

            var actionsGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Actions")
                {
                    Sequence = 60,
                    Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpConnect"),
                    Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                    Image32By32PopupLeft = -224,
                    Image32By32PopupTop = -288,
                    GroupTemplate = RibbonGroupTemplate.Flexible2
                };
            actionsGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.List.Scaling.Actions.MaxSize") { Sequence = 50, Group = actionsGroup, Size = RibbonSize.LargeMedium });
            actionsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Actions.MediumMedium") { Sequence = 120, Group = actionsGroup, Size = RibbonSize.MediumMedium });
            actionsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Actions.MediumSmall") { Sequence = 140, Group = actionsGroup, Size = RibbonSize.MediumSmall });
            listTab.Groups.Add(actionsGroup);

            var btnTakeOfflineToClient =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Actions.Controls.TakeOfflineToClient")
                {
                    Sequence = 20,
                    LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButSyncToComputer"),
                    Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                    Image16By16Top = -160,
                    Image16By16Left = -176,
                    Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                    Image32By32Top = -288,
                    Image32By32Left = -224,
                    ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButSyncToComputer"),
                    ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButSyncListToComputer"),
                    TemplateAlias = "c1",
                };
            actionsGroup.Controls.Add(btnTakeOfflineToClient);

            var btnConnectToClient =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Actions.Controls.ConnectToClient")
                {
                    Sequence = 30,
                    LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButConnectToClient"),
                    Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                    Image16By16Top = 0,
                    Image16By16Left = -168,
                    Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                    Image32By32Top = -128,
                    Image32By32Left = -352,
                    ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButConnectToClient"),
                    ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButConnectToClient"),
                    TemplateAlias = "c1",
                };
            actionsGroup.Controls.Add(btnConnectToClient);

            var exportToSpreadsheetCommand = string.Format("window.location='{0}/_vti_bin/owssvr.dll?CS=65001&Using=_layouts/query.iqy&List={1}&View={2}&RootFolder={3}&CacheControl=1';", Utilities.GetWebUrl(SPContext.Current.Web.Url), List.ID, SPContext.Current.ViewContext.ViewId, List.RootFolder.Url);

            var btnExportToSpreadsheet =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Actions.Controls.ExportToSpreadsheet")
                {
                    Sequence = 30,
                    LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButExportToSpreadsheet"),
                    Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                    Image16By16Top = -152,
                    Image16By16Left = -32,
                    Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                    Image32By32Top = -352,
                    Image32By32Left = 0,
                    ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButExportToSpreadsheet"),
                    ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButExportListToSpreadsheet"),
                    TemplateAlias = "c1",
                    Command = new SPRibbonCommand("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Commands.ExportToSpreadsheet", exportToSpreadsheetCommand, "true")
                };
            actionsGroup.Controls.Add(btnExportToSpreadsheet);

            var settingsGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Settings")
                    {
                        Sequence = 80,
                        Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpSettings"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = 0,
                        Image32By32PopupTop = -384,
                        GroupTemplate = RibbonGroupTemplate.Flexible2
                    };
            settingsGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.List.Scaling.Settings.MaxSize")
                                           {Sequence = 70, Group = settingsGroup, Size = RibbonSize.LargeLarge});
            settingsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Settings.LargeMedium")
                                         {Sequence = 100, Group = settingsGroup, Size = RibbonSize.LargeMedium});
            settingsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Settings.LargeSmall")
                                         {Sequence = 130, Group = settingsGroup, Size = RibbonSize.LargeSmall});
            settingsGroup.Scales.Add(new RibbonScale("Ribbon.List.Scaling.Settings.Popup")
                                         {Sequence = 190, Group = settingsGroup, Size = RibbonSize.Popup});
            listTab.Groups.Add(settingsGroup);
            RegisterRibbonControls(settingsGroup);

            handlerStatement = new StringBuilder();
            handlerStatement.AppendFormat("window.location = '{0}/_layouts/listedit.aspx?List={1}';",
                                          Utilities.GetWebUrl(SPContext.Current.Web.Url), List.ID);

            var btnListSettings =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Settings.Controls.ListSettings")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButListSettings"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -64,
                        Image16By16Left = -192,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = 0,
                        Image32By32Left = -384,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButListSettings"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButListSettings"),
                        Command =
                            new SPRibbonCommand(
                            "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Commands.ListSettings",
                            handlerStatement.ToString()),
                        TemplateAlias = "c1",
                    };
            settingsGroup.Controls.Add(btnListSettings);

            var btnListPermissions =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Settings.Controls.ListPermissions")
                    {
                        Sequence = 20,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButListPermissions"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -128,
                        Image16By16Left = 0,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = 0,
                        Image32By32Left = -416,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButListPermissions"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButListPermissions"),
                        TemplateAlias = "c2",
                    };
            settingsGroup.Controls.Add(btnListPermissions);

            var btnManageWorkflows =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.List.Groups.Settings.Controls.ManageWorkflows")
                    {
                        Sequence = 30,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButManageWorkflow"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -112,
                        Image16By16Left = -112,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -160,
                        Image32By32Left = -416,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButManageWorkflow"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButListManageWorkflow"),
                        TemplateAlias = "c2",
                    };
            settingsGroup.Controls.Add(btnManageWorkflows);

            // Register custom ribbon groups
            RegisterRibbonGroups(listTab);

            // Manual register group template
            ((BaseUserControl) NamingContainer).RegisterRibbonGroupTemplate(RibbonGroupTemplate.ManageViewsGroup);
            ((BaseUserControl) NamingContainer).RegisterRibbonTab(listTab, false);
            ((BaseUserControl) NamingContainer).LoadRibbonTab(listTab);
        }