|
|
|
@@ -9,7 +9,7 @@
|
|
|
|
* array/hash/object that is given.
|
|
|
|
* array/hash/object that is given.
|
|
|
|
* Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php
|
|
|
|
* Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function dump(arr,level) {
|
|
|
|
function dump_old(arr,level) {
|
|
|
|
var dumped_text = "";
|
|
|
|
var dumped_text = "";
|
|
|
|
if(!level) level = 0;
|
|
|
|
if(!level) level = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -34,53 +34,55 @@ function dump(arr,level) {
|
|
|
|
return dumped_text;
|
|
|
|
return dumped_text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function dump(element, limit, depth) {
|
|
|
|
|
|
|
|
limit = (limit == null) ? 1 : limit;
|
|
|
|
|
|
|
|
depth = (depth == null) ? 0 : depth;
|
|
|
|
|
|
|
|
|
|
|
|
function var_dump(element, limit, depth)
|
|
|
|
var rep1 = new Array(5);
|
|
|
|
{
|
|
|
|
var pad1 = rep1.join(" ");
|
|
|
|
depth = depth?depth:0;
|
|
|
|
var rep = new Array(depth+1);
|
|
|
|
limit = limit?limit:1;
|
|
|
|
var pad = rep.join(pad1);
|
|
|
|
|
|
|
|
|
|
|
|
returnString = '<ol>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var props = new Array;
|
|
|
|
for(property in element)
|
|
|
|
for(property in element)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//Property domConfig isn't accessable
|
|
|
|
//Property domConfig isn't accessable
|
|
|
|
if (property != 'domConfig')
|
|
|
|
if (property == 'domConfig')
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
returnString += '<li><strong>'+ property + '</strong> <small>(' + (typeof element[property]) +')</small>';
|
|
|
|
|
|
|
|
|
|
|
|
var propstr = '<strong>'+ property + '</strong>';
|
|
|
|
|
|
|
|
propstr += ' <small>(' + (typeof element[property]) +')</small>';
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof element[property] == 'number' || typeof element[property] == 'boolean')
|
|
|
|
if (typeof element[property] == 'number' || typeof element[property] == 'boolean')
|
|
|
|
returnString += ' : <em>' + element[property] + '</em>';
|
|
|
|
propstr += ' : <em>' + element[property] + '</em>';
|
|
|
|
if (typeof element[property] == 'string' && element[property])
|
|
|
|
if (typeof element[property] == 'string' && element[property])
|
|
|
|
returnString += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' +
|
|
|
|
propstr += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' +
|
|
|
|
element[property].replace(/</g, '&lt;').replace(/>/g, '&gt;') + '</code></div>';
|
|
|
|
htmlEscape(element[property]) + '</code></div>';
|
|
|
|
|
|
|
|
|
|
|
|
if ((typeof element[property] == 'object') && (depth < limit))
|
|
|
|
if ((typeof element[property] == 'object') && (depth < limit))
|
|
|
|
returnString += var_dump(element[property], limit, (depth + 1));
|
|
|
|
propstr += "\n" + pad + dump(element[property], limit, (depth + 1));
|
|
|
|
|
|
|
|
|
|
|
|
returnString += '</li>';
|
|
|
|
props.push(propstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
returnString += '</ol>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(depth == 0)
|
|
|
|
if (props.length == 0)
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return pad + '<ol><li>' + props.join("</li>\n" + pad + pad1 + "<li>") + "</li>\n" + pad + "</ol>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function dump_window(element, limit) {
|
|
|
|
winpop = window.open("", "","width=800,height=600,scrollbars,resizable");
|
|
|
|
winpop = window.open("", "","width=800,height=600,scrollbars,resizable");
|
|
|
|
winpop.document.write('<pre>'+returnString+ '</pre>');
|
|
|
|
winpop.document.write(dump(element, limit));
|
|
|
|
winpop.document.close();
|
|
|
|
winpop.document.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return returnString;
|
|
|
|
function htmlEscape (s) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function htmlEncode(s)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//return s;
|
|
|
|
|
|
|
|
return s.replace(/&(?!\w+([;\s]|$))/g, "&")
|
|
|
|
return s.replace(/&(?!\w+([;\s]|$))/g, "&")
|
|
|
|
.replace(/</g, "<").replace(/>/g, ">");
|
|
|
|
.replace(/</g, "<").replace(/>/g, ">");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function htmlEncode(s) { return htmlEscape(s); }
|
|
|
|
|
|
|
|
|
|
|
|
function addDiv(id_name, div_name, into_div_name, flash, html, script) {
|
|
|
|
function addDiv(id_name, div_name, into_div_name, flash, html, script) {
|
|
|
|
var id = $('#'+id_name).val();
|
|
|
|
var id = $('#'+id_name).val();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -128,7 +130,7 @@ function fmtCurrency(amount) {
|
|
|
|
// Get rid of any extraneous characters, determine
|
|
|
|
// Get rid of any extraneous characters, determine
|
|
|
|
// the sign, and round to the nearest cent.
|
|
|
|
// the sign, and round to the nearest cent.
|
|
|
|
amount = amount.toString().replace(/\$|\,/g,'');
|
|
|
|
amount = amount.toString().replace(/\$|\,/g,'');
|
|
|
|
sign = (amount == (amount = Math.abs(amount)));
|
|
|
|
var sign = (amount == (amount = Math.abs(amount)));
|
|
|
|
amount = (amount+0.0000000001).toFixed(2);
|
|
|
|
amount = (amount+0.0000000001).toFixed(2);
|
|
|
|
|
|
|
|
|
|
|
|
// Insert thousands separator
|
|
|
|
// Insert thousands separator
|
|
|
|
@@ -146,7 +148,7 @@ function fmtCurrency(amount) {
|
|
|
|
// Datepicker helpers
|
|
|
|
// Datepicker helpers
|
|
|
|
|
|
|
|
|
|
|
|
function datepickerNow(id, usetime) {
|
|
|
|
function datepickerNow(id, usetime) {
|
|
|
|
now = new Date();
|
|
|
|
var now = new Date();
|
|
|
|
// datepicker seems to squash the time portion,
|
|
|
|
// datepicker seems to squash the time portion,
|
|
|
|
// so we have to pass in a copy of now instead.
|
|
|
|
// so we have to pass in a copy of now instead.
|
|
|
|
$("#"+id).datepicker('setDate', new Date(now));
|
|
|
|
$("#"+id).datepicker('setDate', new Date(now));
|
|
|
|
@@ -163,6 +165,7 @@ function datepickerNow(id, usetime) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function datepickerSet(fromid, id, a, b) {
|
|
|
|
function datepickerSet(fromid, id, a, b) {
|
|
|
|
|
|
|
|
var dt;
|
|
|
|
if (fromid == null)
|
|
|
|
if (fromid == null)
|
|
|
|
dt = new Date();
|
|
|
|
dt = new Date();
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|