Merge in from pre_0.1 branch

git-svn-id: file:///svn-source/pmgr/trunk/site@847 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-09-15 02:38:28 +00:00
parent 7b3707ef89
commit cc12d5ff93
128 changed files with 4126 additions and 1330 deletions

View File

@@ -9,7 +9,7 @@
* array/hash/object that is given.
* 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 = "";
if(!level) level = 0;
@@ -34,53 +34,55 @@ function dump(arr,level) {
return dumped_text;
}
function dump(element, limit, depth) {
limit = (limit == null) ? 1 : limit;
depth = (depth == null) ? 0 : depth;
function var_dump(element, limit, depth)
{
depth = depth?depth:0;
limit = limit?limit:1;
var rep1 = new Array(5);
var pad1 = rep1.join(" ");
var rep = new Array(depth+1);
var pad = rep.join(pad1);
returnString = '<ol>';
for(property in element)
var props = new Array;
for(property in element)
{
//Property domConfig isn't accessable
if (property != 'domConfig')
{
returnString += '<li><strong>'+ property + '</strong> <small>(' + (typeof element[property]) +')</small>';
//Property domConfig isn't accessable
if (property == 'domConfig')
continue;
if (typeof element[property] == 'number' || typeof element[property] == 'boolean')
returnString += ' : <em>' + element[property] + '</em>';
if (typeof element[property] == 'string' && element[property])
returnString += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' +
element[property].replace(/</g, '&amp;lt;').replace(/>/g, '&amp;gt;') + '</code></div>';
var propstr = '<strong>'+ property + '</strong>';
propstr += ' <small>(' + (typeof element[property]) +')</small>';
if ((typeof element[property] == 'object') && (depth < limit))
returnString += var_dump(element[property], limit, (depth + 1));
if (typeof element[property] == 'number' || typeof element[property] == 'boolean')
propstr += ' : <em>' + element[property] + '</em>';
if (typeof element[property] == 'string' && element[property])
propstr += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' +
htmlEscape(element[property]) + '</code></div>';
if ((typeof element[property] == 'object') && (depth < limit))
propstr += "\n" + pad + dump(element[property], limit, (depth + 1));
returnString += '</li>';
}
props.push(propstr);
}
returnString += '</ol>';
if(depth == 0)
{
winpop = window.open("", "","width=800,height=600,scrollbars,resizable");
winpop.document.write('<pre>'+returnString+ '</pre>');
winpop.document.close();
}
if (props.length == 0)
return '';
return returnString;
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.document.write(dump(element, limit));
winpop.document.close();
}
function htmlEncode(s)
{
//return s;
function htmlEscape (s) {
return s.replace(/&(?!\w+([;\s]|$))/g, "&amp;")
.replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function htmlEncode(s) { return htmlEscape(s); }
function addDiv(id_name, div_name, into_div_name, flash, html, script) {
var id = $('#'+id_name).val();
@@ -102,14 +104,13 @@ function addDiv(id_name, div_name, into_div_name, flash, html, script) {
$("#"+into_div_name).append(html);
if (flash) {
$('#'+div_name+'-'+id)
.css({'background-color' : 'yellow'})
.slideDown()
//.animate({ backgroundColor: "yellow" }, 300)
.animate({ backgroundColor: "white" }, 500);
$('#'+div_name+'-'+id)
//.addClass('ui-state-focus')
.slideDown()
//.removeClass('ui-state-focus', 500)
;
} else {
$('#'+div_name+'-'+id)
.show();
$('#'+div_name+'-'+id).show();
}
id = id - 0 + 1;
@@ -128,7 +129,7 @@ function fmtCurrency(amount) {
// Get rid of any extraneous characters, determine
// the sign, and round to the nearest cent.
amount = amount.toString().replace(/\$|\,/g,'');
sign = (amount == (amount = Math.abs(amount)));
var sign = (amount == (amount = Math.abs(amount)));
amount = (amount+0.0000000001).toFixed(2);
// Insert thousands separator
@@ -145,13 +146,37 @@ function fmtCurrency(amount) {
//
// Datepicker helpers
function datepicker(id) {
$("#"+id).attr('autocomplete', 'off');
if ($("#"+id).datepicker != null) {
$("#"+id)
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
}
}
function datepickerNow(id, usetime) {
now = new Date();
// datepicker seems to squash the time portion,
// so we have to pass in a copy of now instead.
$("#"+id).datepicker('setDate', new Date(now));
var now = new Date();
if ($("#"+id).datepicker != null) {
// datepicker seems to squash the time portion,
// so we have to pass in a copy of now instead.
$("#"+id).datepicker('setDate', new Date(now));
}
else {
$("#"+id).val(((now.getMonth()+1) < 10 ? '0' : '')
+ (now.getMonth()+1) + '/'
+ (now.getDate() < 10 ? '0' : '')
+ now.getDate() + '/'
+ now.getFullYear());
}
if (usetime == null)
usetime = true;
$("#"+id).val($("#"+id).val() +
(usetime
? (' '
@@ -163,17 +188,30 @@ function datepickerNow(id, usetime) {
}
function datepickerSet(fromid, id, a, b) {
var dt;
if (fromid == null)
dt = new Date();
else
dt = new Date($("#"+fromid).datepicker('getDate'));
else {
if ($("#"+id).datepicker != null)
dt = new Date($("#"+fromid).datepicker('getDate'));
else
dt = new Date($("#"+fromid).val());
}
if (a != null)
dt.setDate(a);
if (b != null)
dt.setDate(b);
$("#"+id).datepicker('setDate', dt);
if ($("#"+id).datepicker != null)
$("#"+id).datepicker('setDate', dt);
else {
$("#"+id).val(((dt.getMonth()+1) < 10 ? '0' : '')
+ (dt.getMonth()+1) + '/'
+ (dt.getDate() < 10 ? '0' : '')
+ dt.getDate() + '/'
+ dt.getFullYear());
}
}
function datepickerBOM(fromid, id) {