Permalink
Browse files

adding support for env files and cleaning up function names

  • Loading branch information...
1 parent b4e6e9c commit 6e11c921c130756a84134599554e9cd20044c519 @sh1mmer committed Jul 7, 2009
Showing with 13 additions and 6 deletions.
  1. +13 −6 js-yql-display/yql_js_widget.js
@@ -36,6 +36,13 @@ yqlWidget = function() {
var getYQLData = function(query){
//prepare the URL for YQL query:
var sURL = yqlPublicQueryURL + "q=" + query + "&format=json&callback=yqlWidget.getYQLDataCallback";
+
+ //add any environment files specified in the config
+ if (setupConfig['communitytables']) {
+ sURL += "&env=http%3A%2F%2Fdatatables.org%2Falltables.env";
+ } else if (setupConfig['env']) {
+ sURL += "&env=" + escape(setupConfig['env']);
+ }
//make GET request to YQL with provided query
var transactionObj = YAHOO.util.Get.script(sURL, {
@@ -69,23 +76,23 @@ yqlWidget = function() {
if (firstChild.length !== undefined){
//multiple results - array
for(var i = 0; i < firstChild.length; i++){
- html += parseConfig(firstChild[i]);
+ html += parseFormat(firstChild[i]);
}
} else {
//single result - object
- html += parseConfig(firstChild);
+ html += parseFormat(firstChild);
}
document.getElementById(queryInsert).innerHTML = html;
yqlWidget.render();
}
/************************************************************
- * Method: Parse Config
- * Description: Loop through configuration array for provided
+ * Method: Parse Format
+ * Description: Loop through format array for provided
* data set node
************************************************************/
- var parseConfig = function(node){
+ var parseFormat = function(node){
currString = node;
//replace YQL result placeholders with return content
@@ -133,4 +140,4 @@ yqlWidget = function() {
parseYQLResults(o.query.results);
}
}
-}();
+}();

0 comments on commit 6e11c92

Please sign in to comment.