Now let’s move on with the series and we will take the same example that we took in our last post which was part 5. If you have not gone through thePart-1 to Part-5, I would recommend you
reading them first and then continue reading from here.
We are going to add one more group to our tab which is mail service and we are going to change layout of existing group which we used earlier to have three rows to occupy space for three search providers.
I am going to take the same example which I took in part 5; the only thing that I have added here is new group and new template. You can check it for yourself. I have added mail service group with one single row and two large size buttons. Rest everything is same and I have shown the output followed by the entire XML.
<?xml version="1.0" encoding="utf-8"?><Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="SPKings.Ribbon.CustomTab" Location="CommandUI.Ribbon" RegistrationType="List" RegistrationId="101"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.Tabs._children">
<Tab Id="SPKings.Ribbon.CustomTab" Title="Utilities" Description="Different Utilities comes here" Sequence="1501">
<Scaling Id="SPKings.Ribbon.CustomTab.Scaling">
<MaxSize Id="SPKings.Ribbon.CustomTab.SearchGroup.MaxSize" GroupId="SPKings.Ribbon.CustomTab.SearchGroup" Size="ThreeMedium"/>
<MaxSize Id="SPKings.Ribbon.CustomTab.MailGroup.MaxSize" GroupId="SPKings.Ribbon.CustomTab.MailGroup" Size="TwoLarge"/>
<Scale Id="SPKings.Ribbon.CustomTab.SearchGroup.Scaling.CustomTabScaling" GroupId="SPKings.Ribbon.CustomTab.SearchGroup" Size="ThreeMedium" />
<Scale Id="SPKings.Ribbon.CustomTab.SearchGroup.MailGroup.CustomTabScaling" GroupId="SPKings.Ribbon.CustomTab.MailGroup" Size="TwoLarge" />
</Scaling>
<Groups Id="SPKings.Ribbon.CustomTab.Groups">
<Group Id="SPKings.Ribbon.CustomTab.SearchGroup" Description="Different Search Engines" Title="Search Engines" Sequence="52" Template="SearchEnginesGroup">
<Controls Id="SPKings.Ribbon.CustomTab.SearchGroup.Controls">
<Button Id="SPKings.Ribbon.CustomTab.SearchGroup.SearchBingButton" Sequence="15" Image16by16="/_layouts/images/CustomImages/Bing-logo.jpg" Image32by32="/_layouts/images/CustomImages/bing.png" Description="Click to see Bing message" Command="btnGoToBingCommand" LabelText="Bing" TemplateAlias="BingSearch" />
<Button Id="SPKings.Ribbon.CustomTab.SearchGroup.SearchGoogleButton" Sequence="15" Image16by16="/_layouts/images/CustomImages/google-logo.png" Image32by32="/_layouts/images/CustomImages/google_logo.jpg" Description="Click to see google message" Command="btnGoToGoogleCommand" LabelText="Google" TemplateAlias="GoogleSearch" />
<Button Id="SPKings.Ribbon.CustomTab.SearchGroup.SearchYahooButton" Sequence="15" Image16by16="/_layouts/images/CustomImages/yahoo.png" Image32by32="/_layouts/images/CustomImages/yahoo 32.png" Description="Click to see Yahoo message" Command="btnGoToYahooCommand" LabelText="Yahoo" TemplateAlias="YahooSearch" /> </Controls>
</Group>
<Group Id="SPKings.Ribbon.CustomTab.MailGroup" Description="Different Mail Services" Title="Email services" Sequence="54" Template="MailServicesGroup">
<Controls Id="SPKings.Ribbon.CustomTab.MailGroup.Controls">
<Button Id="SPKings.Ribbon.CustomTab.MailGroup.HotmailServiceButton" Sequence="17" Image16by16="/_layouts/images/CustomImages/Hotmail16.bmp" Image32by32="/_layouts/images/CustomImages/Hotmail32.bmp" Description="Click to see Hotmail message" Command="btnGoToHotmailCommand" LabelText="Hotmail" TemplateAlias="HotmailService" />
<Button Id="SPKings.Ribbon.CustomTab.MailGroup.GmailServiceButton" Sequence="17" Image16by16="/_layouts/images/CustomImages/gmail16.png" Image32by32="/_layouts/images/CustomImages/gmail32.bmp" Description="Click to see GMail message" Command="btnGoToGMailCommand" LabelText="GMail" TemplateAlias="GMailService" /> </Controls > </Group >
</Groups> </Tab> </CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="SearchEnginesGroup"> <Layout Title="ThreeMedium" LayoutTitle="ThreeMedium"> <Section Alignment="Top" Type="ThreeRow"> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="BingSearch" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="GoogleSearch" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="YahooSearch" /> </Row> </Section> </Layout> </GroupTemplate>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="MailServicesGroup"> <Layout Title="TwoLarge" LayoutTitle="TwoLarge"> <Section Alignment="Top" Type="OneRow"> <Row> <ControlRef DisplayMode="Large" TemplateAlias="HotmailService" /> <ControlRef DisplayMode="Large" TemplateAlias="GMailService" /> </Row> </Section> </Layout> </GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers> <CommandUIHandler Command="btnGoToBingCommand" CommandAction="javascript: var BingID = SP.UI.Status.addStatus('This will take you to Bing search'); SP.UI.Status.setStatusPriColor(BingID, 'green');"></CommandUIHandler> <CommandUIHandler Command="btnGoToGoogleCommand" CommandAction="javascript: var GoogleId = SP.UI.Status.addStatus('This will take you to Google search'); SP.UI.Status.setStatusPriColor(GoogleId, 'red');"></CommandUIHandler>
<CommandUIHandler Command="btnGoToYahooCommand" CommandAction="javascript: var YahooID = SP.UI.Status.addStatus('This will take you to Yahoo search'); SP.UI.Status.setStatusPriColor(YahooID, 'blue');"></CommandUIHandler>
<CommandUIHandler Command="btnGoToGMailCommand" CommandAction="javascript: var GMailID = SP.UI.Status.addStatus('This will take you to GMail'); SP.UI.Status.setStatusPriColor(GMailID, 'blue');"></CommandUIHandler>
<CommandUIHandler Command="btnGoToHotmailCommand" CommandAction="javascript: var HotmailID = SP.UI.Status.addStatus('This will take you to Hotmail'); SP.UI.Status.setStatusPriColor(HotmailID, 'blue');"></CommandUIHandler> </CommandUIHandlers >
</CommandUIExtension> </CustomAction></Elements>
and here is the output
Read further on Part 7
No comments:
Post a Comment