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

19
webroot/js/jquery-1.3.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,136 @@
/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
*
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
*
* hoverIntent is currently available for use in all personal or commercial
* projects under both MIT and GPL licenses. This means that you can choose
* the license that best suits your project, and use it accordingly.
*
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
*
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
* sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
* interval: 100, // number = milliseconds of polling interval
* over: showNav, // function = onMouseOver callback (required)
* timeout: 0, // number = milliseconds delay before onMouseOut function call
* out: hideNav // function = onMouseOut callback (required)
* });
*
* @param f onMouseOver function || An object with configuration options
* @param g onMouseOut function || Nothing (use configuration options object)
* @author Brian Cherne <brian@cherne.net>
*/
(function($) {
$.fn.hoverIntent = function(f,g) {
// default configuration options
var cfg = {
sensitivity: 7,
interval: 100,
timeout: 0
};
// override configuration options with user supplied object
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
// instantiate variables
// cX, cY = current X and Y position of mouse, updated by mousemove event
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
var cX, cY, pX, pY;
// A private function for getting mouse position
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
// A private function for comparing current and previous mouse position
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).unbind("mousemove",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
} else {
// set previous coordinates for next time
pX = cX; pY = cY;
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
// A private function for delaying the mouseOut function
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = 0;
return cfg.out.apply(ob,[ev]);
};
// A private function for handling mouse 'hovering'
var handleHover = function(e) {
// REVISIT <AP>: 20090829; Unknown why mouseenter/mouseleave are being used
var etype = e.type;
etype = etype.replace(/mouseenter/, "mouseover");
etype = etype.replace(/mouseleave/, "mouseout");
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
var p = (etype == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
if ( p == this ) { return false; }
// copy objects to be passed into t (required for event object to be passed in IE)
var ev = jQuery.extend({},e);
var ob = this;
// cancel hoverIntent timer if it exists
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
// else e.type == "onmouseover"
if (etype == "mouseover") {
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).bind("mousemove",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "onmouseout"
} else {
// unbind expensive mousemove event
$(ob).unbind("mousemove",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// bind the function to the two event listeners
return this.mouseover(handleHover).mouseout(handleHover);
};
})(jQuery);
$.event.special.hoverintent = {
setup: function() {
$(this).hoverIntent({
over: jQuery.event.special.hoverintent.over,
out: jQuery.event.special.hoverintent.out
});
},
teardown: function() {
},
over: function(ev) {
ev.type = 'hoverintent';
jQuery.event.handle.apply(this, arguments);
},
out: function(event) {
}
};

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) {