In a number of articles and blog posts I've been looking at using Google Apps Script to publish data, to store it a scriptDB and to behave as a proxy for both access and processing. Pulling it all together, here is a way to publish data in multiple formats from scriptdb, to publish custom data, and even to publish the code of your own scripts. In these examples for now, all data and scripts are public. I haven't implemented oAuth as part of the tool yet. To implement your own version of this, see Step by Step Gas Publisher
What you need to do to use.Almost all of the code is in the mcpher shared library. You will need to copy the provided code into a new project of your own, attach the mcpher library, and also attach any other of your projects as libraries that you would want to access. The js and html template can also be copied as is. For each library that will be accessed, you also need to create a couple of function that return your scriptDB and your scriptApp object. Finally if you expect to publish source code on google sites, you will need to use the provided gadget for embedding in your site. Parameters
ContainersHere is a container using type js - try it. When you use a type other than html, you need to create a container do deal with the data returned from the content service. Here's the code for the example http://xliberation.com/p/gaspubcontainer.html?source=gist&library=4117688&module=gaspubcontainer.html What's happening hereYou'll notice that this prettifies the code just like in the GAS script IDE. You can use this with no modification, except perhaps to set up your own default parameters. The key thing to note here is that the js type will create a script with a function getMyEmbedded(). To include that in your web page, you simply have to set some elements .innerHTML to the code returned by getMyEmbedded() as below. $('#myEmbedded').html(getMyEmbedded() ); Here's the same thing directly from the webThe 'web' parameter will show the source code of a given url. So here is the same thing, directly from the web with this commandhttp://xliberation.com/p/gaspubcontainer.html?source=web&module=http://xliberation.com/p/gaspubcontainer.htmlEmbedding in google sites and other places.You can use iFrames to include this container. It wont break any cross domain rules. You can use one of the public iFrame gadgets when you insert a gadget in Google Sites. Embedded below is the code for the Publisher. The Url displayed in the iFrame is "http://xliberation.com/p/gaspubcontainer.html?source=script&module=Code" What about scriptDbIn Hosting your public scriptdb I covered how to use scriptdb to store private data. You can use exactly the same mechanism, with the same range of outputs for scriptdb as you can for scripts. Here's what we get when we embed this link in the usual iFrame gadget, http://xliberation.com/p/gaspubcontainer.html?source=scriptdb&module=favorites&library=pubstuff |


