This repository has been archived by the owner on Jun 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit. moved query builder codebase from platform codebase
- Loading branch information
Matt Phillips
committed
Jan 31, 2012
0 parents
commit 8696ff8
Showing
11 changed files
with
1,247 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
RewriteEngine On | ||
RewriteRule query_builder query_builder.html |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Taken directly from http://joncom.be/code/javascript-json-formatter/ | ||
|
||
function FormatJSON(oData, sIndent) { | ||
if (arguments.length < 2) { | ||
var sIndent = ""; | ||
} | ||
var sIndentStyle = " "; | ||
var sDataType = RealTypeOf(oData); | ||
|
||
// open object | ||
if (sDataType == "array") { | ||
if (oData.length == 0) { | ||
return "[]"; | ||
} | ||
var sHTML = "["; | ||
} else { | ||
var iCount = 0; | ||
$.each(oData, function() { | ||
iCount++; | ||
return; | ||
}); | ||
if (iCount == 0) { // object is empty | ||
return "{}"; | ||
} | ||
var sHTML = "{"; | ||
} | ||
|
||
// loop through items | ||
var iCount = 0; | ||
$.each(oData, function(sKey, vValue) { | ||
if (iCount > 0) { | ||
sHTML += ","; | ||
} | ||
if (sDataType == "array") { | ||
sHTML += ("\n" + sIndent + sIndentStyle); | ||
} else { | ||
sHTML += ("\n" + sIndent + sIndentStyle + "\"" + sKey + "\"" + ": "); | ||
} | ||
|
||
// display relevant data type | ||
switch (RealTypeOf(vValue)) { | ||
case "array": | ||
case "object": | ||
sHTML += FormatJSON(vValue, (sIndent + sIndentStyle)); | ||
break; | ||
case "boolean": | ||
case "number": | ||
sHTML += vValue.toString(); | ||
break; | ||
case "null": | ||
sHTML += "null"; | ||
break; | ||
case "string": | ||
sHTML += ("\"" + vValue + "\""); | ||
break; | ||
default: | ||
sHTML += ("TYPEOF: " + typeof(vValue)); } | ||
// loop | ||
iCount++; | ||
} | ||
) | ||
|
||
// close object | ||
if (sDataType == "array") { | ||
sHTML += ("\n" + sIndent + "]"); | ||
} else { | ||
sHTML += ("\n" + sIndent + "}"); | ||
} | ||
|
||
// return | ||
return sHTML; | ||
} | ||
|
||
function RealTypeOf(v) { | ||
if (typeof(v) == "object") { | ||
if (v === null) return "null"; | ||
if (v.constructor == (new Array).constructor) return "array"; | ||
if (v.constructor == (new Date).constructor) return "date"; | ||
if (v.constructor == (new RegExp).constructor) return "regex"; | ||
return "object"; | ||
} | ||
return typeof(v); | ||
} |
Oops, something went wrong.