Esempio n. 1
0
 public void AddRibbonTab(RibbonTab ribbonTab)
 {
     ribbonTabs.Add(ribbonTab.Id, ribbonTab);
 }
Esempio n. 2
0
        private void RegisterListItemTab()
        {
            var lcid = Thread.CurrentThread.CurrentUICulture.LCID;

            var listItemTab = new RibbonTab("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem")
                                  {
                                      Title = LocalizationHelper.GetStringFromCoreResource("cui_TabItems"),
                                      Sequence = 400
                                  };

            var newGroup = new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.New")
                               {
                                   Sequence = 10,
                                   Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpNew"),
                                   Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                                   Image32By32PopupLeft = -64,
                                   Image32By32PopupTop = -320,
                                   GroupTemplate = RibbonGroupTemplate.Flexible2
                               };
            newGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.ListItem.Scaling.New.MaxSize")
                                      {Sequence = 10, Group = newGroup, Size = RibbonSize.LargeLarge});
            newGroup.Scales.Add(new RibbonScale("Ribbon.ListItem.Scaling.New.Popup")
                                    {Sequence = 160, Group = newGroup, Size = RibbonSize.Popup});

            listItemTab.Groups.Add(newGroup);

            RegisterRibbonControls(newGroup);

            RegisterAddListItemControl(newGroup, lcid);

            var btnNewFolder =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.New.Controls.NewFolder")
                    {
                        Sequence = 20,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButNewFolder"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -16,
                        Image16By16Left = -248,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -448,
                        Image32By32Left = -320,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButNewFolder"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButNewListFolder"),
                        TemplateAlias = "c1"
                    };

            if (EnableAddNewItem && List.EnableFolderCreation)
            {
                var command = new StringBuilder();
                command.Append("var options = SP.UI.$create_DialogOptions();");
                command.AppendFormat(
                    "options.url = '{0}/_layouts/listform.aspx?&Type=1&PageType=8&ListId={1}&RootFolder={2}';",
                    Utilities.GetWebUrl(SPContext.Current.Web.Url), List.ID, SPEncode.UrlEncode(Page.Request.QueryString["RootFolder"]));
                command.Append("options.dialogReturnValueCallback = Function.createDelegate(null, function(result, target){if(result == SP.UI.DialogResult.OK){");
                command.AppendFormat("$('#{0}').val('True');", hdfAddNewItem.ClientID);
                command.Append("SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);");
                command.Append("}});");
                command.Append("SP.UI.ModalDialog.showModalDialog(options);");

                var newItemCommand =
                    new SPRibbonCommand("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Commands.NewFolder")
                    {
                        HandlerStatement = command.ToString()
                    };
                btnNewFolder.Command = newItemCommand;
            }

            newGroup.Controls.Add(btnNewFolder);

            var manageGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Manage")
                    {
                        Sequence = 20,
                        Title = LocalizationHelper.GetStringFromCoreResource("GrpManage"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = -64,
                        Image32By32PopupTop = -448,
                        GroupTemplate = RibbonGroupTemplate.Flexible2
                    };
            manageGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.ListItem.Scaling.Manage.MaxSize")
                                         {Sequence = 10, Group = manageGroup, Size = RibbonSize.LargeMedium});
            manageGroup.Scales.Add(new RibbonScale("Ribbon.ListItem.Scaling.Manage.LargeSmall")
                                       {Group = manageGroup, Sequence = 100, Size = RibbonSize.LargeSmall});
            manageGroup.Scales.Add(new RibbonScale("Ribbon.ListItem.Scaling.Manage.Popup")
                                       {Group = manageGroup, Sequence = 150, Size = RibbonSize.Popup});
            listItemTab.Groups.Add(manageGroup);
            RegisterRibbonControls(manageGroup);

            var handlerStatement = new StringBuilder();
            handlerStatement.Append("var item = getSelectedItems()[0];");
            handlerStatement.Append("var options = SP.UI.$create_DialogOptions();");
            handlerStatement.AppendFormat(
                "options.url = '{0}/_layouts/listform.aspx?PageType=4&ListId=' + item.refListId + '&ID=' + item.refId;",
                Utilities.GetWebUrl(SPContext.Current.Web.Url));
            handlerStatement.Append(
                "options.dialogReturnValueCallback = Function.createDelegate(null, function(result, target){if(result == SP.UI.DialogResult.OK){SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);}});");
            handlerStatement.Append("SP.UI.ModalDialog.showModalDialog(options);");

            var viewPropertiesCommand =
                new SPRibbonCommand("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Commands.ViewItem")
                    {
                        HandlerStatement = handlerStatement.ToString(),
                        EnabledStatement = "(getSelectedItems().length == 1)"
                    };

            var btnViewProperties =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Manage.Controls.ViewProperties")
                    {
                        Sequence = 20,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButViewItem"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -32,
                        Image16By16Left = -80,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -96,
                        Image32By32Left = -448,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButViewItem"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButViewItem"),
                        Command = viewPropertiesCommand,
                        TemplateAlias = "c1"
                    };
            manageGroup.Controls.Add(btnViewProperties);

            var btnEditProperties =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Manage.Controls.EditProperties")
                    {
                        Sequence = 20,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButEditItem"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -128,
                        Image16By16Left = -224,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -128,
                        Image32By32Left = -96,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButEditItem"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButEditItem"),
                        TemplateAlias = "c1"
                    };
            manageGroup.Controls.Add(btnEditProperties);

            if (EnableEditItem)
            {
                handlerStatement = new StringBuilder();
                handlerStatement.Append("var item = getSelectedItems()[0];");
                handlerStatement.Append("var options = SP.UI.$create_DialogOptions();");
                handlerStatement.AppendFormat(
                    "options.url = '{0}/_layouts/listform.aspx?PageType=6&ListId=' + item.refListId + '&ID=' + item.refId;",
                    Utilities.GetWebUrl(SPContext.Current.Web.Url));
                handlerStatement.Append(
                    "options.dialogReturnValueCallback = Function.createDelegate(null, function(result, target){if(result == SP.UI.DialogResult.OK){SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);}});");
                handlerStatement.Append("SP.UI.ModalDialog.showModalDialog(options);");

                var editPropertiesCommand =
                    new SPRibbonCommand("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Commands.EditItem")
                        {
                            HandlerStatement = handlerStatement.ToString(),
                            EnabledStatement = "(getSelectedItems().length == 1)"
                        };
                btnEditProperties.Command = editPropertiesCommand;
            }

            var btnViewVersions =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Manage.Controls.ViewVersions")
                    {
                        Sequence = 30,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButVersionHistory"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -48,
                        Image16By16Left = -80,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -64,
                        Image32By32Left = -448,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButVersionHistory"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButItemVersionHistory"),
                        TemplateAlias = "c2"
                    };
            manageGroup.Controls.Add(btnViewVersions);

            var btnManagePermissions =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Manage.Controls.ManagePermissions")
                    {
                        Sequence = 40,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButItemPermissions"),
                        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_ButItemPermissions"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButItemPermissions"),
                        TemplateAlias = "c2"
                    };
            manageGroup.Controls.Add(btnManagePermissions);

            var btnDelete =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Manage.Controls.Delete")
                    {
                        Sequence = 50,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButDeleteItem"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -112,
                        Image16By16Left = -224,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -128,
                        Image32By32Left = -128,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButDeleteItem"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButDeleteItem"),
                        TemplateAlias = "c2"
                    };
            manageGroup.Controls.Add(btnDelete);

            if (EnableDeleteItem)
            {
                handlerStatement = new StringBuilder();
                handlerStatement.Append(
                    "if(!confirm('Are you sure you want to send the item(s) to the site Recycle Bin?')) return;");
                handlerStatement.Append("var items = getSelectedItems();");
                handlerStatement.Append("var ctx = new SP.ClientContext.get_current();");
                if (SPContext.Current.Site.WebApplication.RecycleBinEnabled)
                {
                    handlerStatement.Append("$.each(items, function(index, item){var list = ctx.get_web().get_lists().getById(item.refListId);var listItem = list.getItemById(item.refId);listItem.recycle();});");
                }
                else
                {
                    handlerStatement.Append("$.each(items, function(index, item){var list = ctx.get_web().get_lists().getById(item.refListId);var listItem = list.getItemById(item.refId);listItem.deleteObject();});");
                }

                handlerStatement.Append("ctx.executeQueryAsync(Function.createDelegate(null, function(){SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);}), null);");

                var deleteItemCommand =
                    new SPRibbonCommand(
                        "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Commands.DeleteItem")
                        {
                            HandlerStatement = handlerStatement.ToString(),
                            EnabledStatement = "(getSelectedItems().length > 0)"
                        };
                btnDelete.Command = deleteItemCommand;
            }

            var actionsGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Actions")
                    {
                        Sequence = 30,
                        Title = LocalizationHelper.GetStringFromCoreResource("cui_GrpActions"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = -352,
                        Image32By32PopupTop = -128,
                        GroupTemplate = RibbonGroupTemplate.Flexible2
                    };
            actionsGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.ListItem.Scaling.Actions.MaxSize")
                                          {Sequence = 30, Group = actionsGroup, Size = RibbonSize.LargeLarge});
            actionsGroup.Scales.Add(new RibbonScale("Ribbon.ListItem.Scaling.Actions.Popup")
                                        {Sequence = 130, Group = actionsGroup, Size = RibbonSize.Popup});
            listItemTab.Groups.Add(actionsGroup);
            RegisterRibbonControls(actionsGroup);

            var btnAttachFile =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Actions.Controls.AttachFile")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButAttachFile"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -128,
                        Image16By16Left = -144,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -352,
                        Image32By32Left = -128,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButAttachFile"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButAttachFile"),
                        TemplateAlias = "c1"
                    };
            actionsGroup.Controls.Add(btnAttachFile);

            var workflowGroup =
                new RibbonGroup("VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Workflows")
                    {
                        Sequence = 50,
                        Title = LocalizationHelper.GetStringFromCoreResource("GrpWorkflow"),
                        Image32By32Popup = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32PopupLeft = -192,
                        Image32By32PopupTop = -416,
                        GroupTemplate = RibbonGroupTemplate.Flexible2
                    };
            workflowGroup.MaxSizes.Add(new RibbonMaxSize("Ribbon.ListItem.Scaling.Workflows.MaxSize")
                                           {Sequence = 50, Group = workflowGroup, Size = RibbonSize.LargeLarge});
            workflowGroup.Scales.Add(new RibbonScale("Ribbon.ListItem.Scaling.Workflows.MediumMedium")
                                         {Sequence = 70, Group = workflowGroup, Size = RibbonSize.MediumMedium});
            workflowGroup.Scales.Add(new RibbonScale("Ribbon.ListItem.Scaling.Workflows.Popup")
                                         {Sequence = 110, Group = workflowGroup, Size = RibbonSize.Popup});
            listItemTab.Groups.Add(workflowGroup);
            RegisterRibbonControls(workflowGroup);

            var btnViewWorkflows =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Workflows.Controls.ViewWorkflows")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButWorkflows"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -48,
                        Image16By16Left = -208,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -192,
                        Image32By32Left = -416,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButWorkflows"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButItemManageWorkflow"),
                        TemplateAlias = "c1"
                    };
            workflowGroup.Controls.Add(btnViewWorkflows);

            var btnModerate =
                new RibbonButton(
                    "VP.Sharepoint.CQ.Core.Ribbon.Tabs.ListItem.Groups.Workflows.Controls.Moderate")
                    {
                        Sequence = 10,
                        LabelText = LocalizationHelper.GetStringFromCoreResource("cui_ButApproveReject"),
                        Image16By16 = string.Format("/_layouts/{0}/images/formatmap16x16.png", lcid),
                        Image16By16Top = -48,
                        Image16By16Left = -240,
                        Image32By32 = string.Format("/_layouts/{0}/images/formatmap32x32.png", lcid),
                        Image32By32Top = -448,
                        Image32By32Left = -384,
                        ToolTipTitle = LocalizationHelper.GetStringFromCoreResource("cui_ButApproveReject"),
                        ToolTipDescription = LocalizationHelper.GetStringFromCoreResource("cui_STT_ButItemApproveReject"),
                        TemplateAlias = "c1"
                    };
            workflowGroup.Controls.Add(btnModerate);

            // Register custom ribbon groups
            RegisterRibbonGroups(listItemTab);

            ((BaseUserControl) NamingContainer).RegisterRibbonTab(listItemTab);
            ((BaseUserControl) NamingContainer).LoadRibbonTab(listItemTab);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
 private void RegisterRibbonGroups(RibbonTab ribbonTab)
 {
     if (ribbonGroups.Contains(ribbonTab.Id))
     {
         var groups = (IList<RibbonGroup>) ribbonGroups[ribbonTab.Id];
         ribbonTab.Groups.AddRange(groups);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Initially show the ribbon tab
 /// </summary>
 /// <param name="ribbonTab">Ribbon tab</param>
 public void ShowRibbonTab(RibbonTab ribbonTab)
 {
     ShowRibbonTab(ribbonTab.Id);
 }
Esempio n. 6
0
        public void RegisterRibbonTab(RibbonTab ribbonTab, bool registerGroupTemplates)
        {
            // Tab
            Ribbon.RegisterDataExtension(ribbonTab.GetXmlDefinition(), "Ribbon.Tabs._children");

            if (registerGroupTemplates)
            {
                // Group Template
                var groupsTemplates =
                    ribbonTab.Groups.Select(item => item.GroupTemplate).Where(item => item != null).Distinct(
                        new RibbonGroupTemplateComparer());
                foreach (var groupTemplate in groupsTemplates)
                {
                    Ribbon.RegisterDataExtension(groupTemplate.GetXmlDefinition(), "Ribbon.Templates._children");
                }
            }

            // Select all command to register
            var commands = ribbonTab.Groups
                .SelectMany(item => item.Controls)
                .Select(item => item.Command)
                .Where(item => item != null);

            commands.Union(ribbonTab.Groups
                .SelectMany(item => item.Controls)
                .SelectMany(item => item.ChildControls)
                .Select(item => item.Command)
                .Where(item => item != null));
            RibbonCommands.AddRange(commands.Distinct(new RibbonCommandComparer()));
        }
Esempio n. 7
0
 public void RegisterRibbonTab(RibbonTab ribbonTab)
 {
     RegisterRibbonTab(ribbonTab, true);
 }
Esempio n. 8
0
 /// <summary>
 /// Load the ribbon tab to the ribbon bar without showing it
 /// </summary>
 /// <param name="ribbonTab">Ribbon tab</param>
 public void LoadRibbonTab(RibbonTab ribbonTab)
 {
     LoadRibbonTab(ribbonTab.Id);
 }
Esempio n. 9
0
 protected void RegisterRibbonExtension(RibbonTab ribbonTab)
 {
     RegisterRibbonExtension(ribbonTab, true);
 }