You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@shindig.apache.org by Justin Wyllie <ju...@hotmail.co.uk> on 2010/05/25 12:13:24 UTC

How to go to canvas mode in Shindig?

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/

RE: How to go to canvas mode in Shindig?

Posted by Justin Wyllie <ju...@hotmail.co.uk>.
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
> <ju...@hotmail.co.uk>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/

RE: How to go to canvas mode in Shindig?

Posted by Justin Wyllie <ju...@hotmail.co.uk>.

Hi Paul

I've changed this setting to a completely different url and cleared both Shindig and browser caches and still I get redirected to /canvas. Is there anything else I could be missing?

Thanks

Justin 



> Date: Tue, 25 May 2010 03:19:07 -0700
> Subject: Re: How to go to canvas mode in Shindig?
> From: lindner@inuus.com
> To: users@shindig.apache.org
> 
> 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
> <ju...@hotmail.co.uk>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/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now

Re: How to go to canvas mode in Shindig?

Posted by Paul Lindner <li...@inuus.com>.
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
<ju...@hotmail.co.uk>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/
>