Re. the advice to edit container.js.

Editing container.js seems to effect the getUrlTemplate method in the code 
which is inserted into the gadget. Ie. the value that I put in container.js is 
I think the value that will be returned by getUrlTemplate. I can't see though 
how this is used when you switch to canvas mode? What is the urlTemplate used 
for?

In the container code there is a method requestNavigateTo. This calls 
getUrlForView to obtain a url. 'canvas' appears to be hardcoded in 
shindig-container.js like this:

shindig.IfrGadgetService.prototype.getUrlForView = function(
    view) {
  if (view === 'canvas') {
    return '/canvas';
  } else if (view === 'profile') {
    return '/profile';
  } else {
    return null;
  }
};

This code does not be appear to be effected by the container.js file which I 
think is only used to populate the gadget code not the container.

So I still have the effect that when the gadget calls 
requestNavigateTo('canvas') the requestNavigateTo method in the container does 
a document.location.href = 'canvas'. 

Our solution for now is to hack (could override obviously) this method in 
shindig-container: shindig.IfrGadgetService.prototype.requestNavigateTo
so that where it does document.location.href = 'canvas'. it now does:
document.getElementById('test').innerHTML = 'draw gadgetx'+id+url; 

Eventually this would become a few lines of code to render the gadget in an 
overlay or a div which took up the full width of the page.

So - I have two questions:

What is the getUrlTemplate method in the gadget code all about?
Is my approach to getting a gadget to render in an overlay, or 'large' div 
outlined above sensible?

Ultimately my aim is to get an effect similar to going to canvas mode in 
iGoogle.

Thanks

Justin 

 




> 
> You need to edit your container.js to define the correct url mapping for
> your canvas page.  Here's the default:
> 
>     "canvas" : {
>       "isOnlyVisible" : true,
>       "urlTemplate" : "http://localhost/gadgets/canvas?{var}";,
>       "aliases" : ["FULL_PAGE"]
>     }
> 
> 
> On Tue, May 25, 2010 at 3:13 AM, Justin Wyllie
> <[email protected]>wrote:
> 
> >
> > Hi
> >
> > Sorry about the last post; escaped too soon.
> >
> > I have a gadget which has a button to navigate to its canvas view. The code
> > is this:
> >
> >   function goToView() {
> >      var supported_views = gadgets.views.getSupportedViews();
> >      gadgets.views.requestNavigateTo(supported_views['canvas']);
> >    };
> >
> >
> >
> > In iGoogle the gadget goes into canvas mode no problem.
> >
> > In my Shindig container the effect is to cause the container window to
> > reload to the current domain then /canvas.
> >
> >
> >
> >
> >
> >
> > _________________________________________________________________
> > http://clk.atdmt.com/UKM/go/195013117/direct/01/
> >
                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/

Reply via email to