Personnalisation des balises sociales et des notes sur le ruban
-
09-12-2019 - |
Question
Je veux changer de balises sociales et de notes dans le ruban, mais je ne sais pas comment et même si cela est possible.
Nous avons donc 2 boutons sociaux dans le ruban, je l'aime et des tags et des notes.Je veux changer ces boutons:
- changer le texte sur les boutons.
- changer la photo
est-ce possible?Et où devrais-je commencer?
Si ce n'est pas possible, quelle est une grande chance, dois-je créer mes propres actions personnalisées, avec du texte et des images?
Mais où puis-je trouver les définitions de:
- ribbon.listitem.tagsandnotes.ilikIkit
- ribbon.listitem.tagsandnotes.tagsandnotes
Je ne peux pas les trouver dans cmdui.xml Mais la question est de savoir comment puis-je ajouter la fonctionnalité des boutons OOTB?
mise à jour:
Après l'article MSDN (http://msdn.microsoft.com/en-us/library/ff407619.aspx) J'ai créé ici un bouton de remplacement mais il ne fonctionne pas:
<CustomAction Id="Ribbon.ListItem.TagsAndNotes.ILikeIt" Location="CommandUI.Ribbon" Title="Sanco version of I Like It"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.ListItem.TagsAndNotes.ILikeIt"> <Button Id="Ribbon.ListItem.TagsAndNotes.ILikeIt" Sequence="5" Command="ReplacementButtonCommand" LabelText="Replaced Button" TemplateAlias="o1" /> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="ReplacementButtonCommand" CommandAction="javascript:alert('This button has been replaced.');" /> </CommandUIHandlers> </CommandUIExtension> </CustomAction>
La solution
Ok I found the solution with this modified xml I did achieve expected results:
<CustomAction Id="Ribbon.ListItem.TagsAndNotes.NewLike"
Location="CommandUI.Ribbon"
Title="New version of I Like It">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListItem.TagsAndNotes.ILikeIt">
<Button Id="Ribbon.ListItem.TagsAndNotes.Like.NewButton"
Command="ILikeIt"
LabelText="New Text"
Sequence="90"
Image32by32="/_layouts/images/custom.png"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
</CommandUIExtension>
</CustomAction>
With this xml I could change the name and also add different pictures on the buttons, same time having exactly the same functionality.
I hope this will safe time for someone.
PS: after deploying the solution clear cache of the browser cuz it seems sometimes the ribbon is cashed and you might not see the results.
Autres conseils
The easiest would be to do it with Javascript (JQuery). You can set them to display:none through CSS, modify them on document.ready(), and make them visible again. This will avoid the usual flicker occuring when you modify something visible on the page right after page load.
If you want to use CSS only, you can change the icons by hiding the current ones and using a background image to show new ones. You will not be able to change the text with CSS.
Rebuilding your own control sounds like overkill where a simple javascript will do the job.