I didn't find anything to help me out, so I'm asking your help.
I work with sharepoint 2010. I have a team Site where the ribbon is hidden. (never trust users, thay are evil :p )
On this team site I have a calendar to organise meetings and so. They can create event, edit them, that's all fine. All but one little details... To change the calendar display scope, I need the ribbon (day, week or month view).
My idea would be to create links/buttons that would act like the ones in the ribbon. Is there a way to call a ribbon event, as if the user clicked on the ribbon despite he is hidden ?
thanks,
Marie
Edit 1 :
It seems that ribbon is hidden but still in the page. So, I can access it with javascript. I've created 3 buttons And I simulate clicks on the hidden ribbon.
btnDay .onclick=function(){
//look if the calendar menu on ribbon is displayed
if(document.getElementById("Ribbon.Calendar.Calendar.Scope")==null)
{
//If it's not, I simulate a click on the calendar menu of the ribbon
document.getElementById("Ribbon.Calendar.Calendar-title").firstElementChild.click();
//and wait for it to take effect
setTimeout(function(){document.getElementById("Day-Small").click();}, 500);
}
else
{
//If it is, I simulate a click on the button I want to fire
document.getElementById("Ribbon.Calendar.Calendar.Scope").firstChild.firstChild.firstChild.firstChild.firstChild.childNodes[0].click();
}
}
The "firstChild.firstChild.firstCh..." thing can look like odd, but the names of his childs change with the size of display. So if I want it to work all the time, I have to use this.
Now, it works when the calendar is selected. User have to click on calendar and then click on my button. Thats better than nothing, but not acceptable.
Launching a click event on my webpart don't seems to select it and don't make the calendar menu "appear" on my ribbon. Any clue about this ?