Calendar View contribution integrated

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7546 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-12-05 15:59:28 +00:00
parent b39830a2bd
commit 64ab846e77
66 changed files with 13965 additions and 3 deletions

View File

@@ -1716,9 +1716,9 @@ error_search=Search failed due to system error: {0}
error_search_query=Search failed as the system was unable to process your query, please try a different search.
error_not_found={0} not found in {1}.
error_exists=A Space or File with that name already exists: {0}
error_delete_space=Unable to delete Space due to system error:
error_delete_file=Unable to delete File due to system error:
error_delete_sandbox=Unable to delete Sandbox due to system error:
error_delete_space=Unable to delete Space due to system error: {0}
error_delete_file=Unable to delete File due to system error: {0}
error_delete_sandbox=Unable to delete Sandbox due to system error: {0}
error_checkout=Unable to check out Content Node due to system error:
error_update=Unable to update Content Node due to system error:
error_cancel_checkout=Unable to cancel check out of Content Node due to system error:

View File

@@ -438,5 +438,31 @@
<icon name="project" path="/images/icons/project.gif" />
</icons>
</config>
<config evaluator="node-type" condition="ia:calendarEvent">
<property-sheet>
<show-property name="mimetype" display-label-id="content_type"
component-generator="MimeTypeSelectorGenerator" />
<show-property name="size" display-label-id="size"
converter="org.alfresco.faces.ByteSizeConverter"
show-in-edit-mode="false" />
<show-property name="ia:whatEvent" />
<show-property name="ia:fromDate" />
<show-property name="ia:toDate" />
<show-property name="ia:whereEvent" />
<show-property name="ia:descriptionEvent" />
<show-property name="ia:colorEvent" />
</property-sheet>
</config>
<config evaluator="node-type" condition="ia:calendar">
<property-sheet>
<show-property name="ia:whatEventDefault" />
<show-property name="ia:fromDateDefault" />
<show-property name="ia:toDateDefault" />
<show-property name="ia:whereEventDefault" />
<show-property name="ia:colorEventDefault" />
</property-sheet>
</config>
</alfresco-config>

View File

@@ -0,0 +1,100 @@
div.calendar_entry {
height: 30px;
width: 70px;
float: left;
background: white;
border-right: 1px solid black;
margin: 0 3px 0 3px;
padding-top: 1px;
}
div.calendar_spacer {
height: 30px;
width: 77px;
float: left;
margin: 0 3px 0 3px;
padding-top: 1px;
}
.buttonStyle
{
font-size: smaller;
cursor: pointer;
color: white;
background-color: cornflowerblue;
}
.inputBox
{
border-right: 0px solid;
border-top: 0px solid;
border-left: 0px solid;
border-bottom: 0px solid;
background-color: lightyellow;
}
.alternateRow
{
background-color:#D3E6FE;
}
.eventViewTable
{
border:solid 1px #99CCFF;
border-collapse:collapse;
}
.eventViewTable td
{
border-right: 1px solid #99CCFF;
border-top: 1px solid #FFFFFF;
border-bottom: 1px solid #99CCFF;
border-left: 1px solid #99CCFF;
}
.eventCaption
{
cursor:pointer;
padding-left:1px;
margin-bottom:2px;
}
.eventCaptionAllDay
{
cursor:pointer;
vertical-align:top;
padding-left:1px;
margin-bottom:2px;
}
.eventCaptionNonEditable
{
padding-left:1px;
margin-bottom:2px;
}
.eventCaptionAllDayNonEditable
{
vertical-align:top;
padding-left:1px;
margin-bottom:2px;
}
.divDates
{
background-color: #e9f0f4;
color: blue;
text-align: center;
font-size:x-small;
text-align:center;
}
.weekDay
{
vertical-align:top;
}
.weekEnd
{
vertical-align:top;
}

View File

@@ -0,0 +1,191 @@
#dhtmlgoodies_colorPicker{
position:absolute;
width:250px;
padding-bottom:1px;
background-color:#FFF;
border:1px solid #317082;
width: 252px; /* IE 5.x */
width/* */:/**/250px; /* Other browsers */
width: /**/250px;
}
#dhtmlgoodies_colorPicker .colorPicker_topRow{
padding-bottom:1px;
border-bottom:3px double #317082;
background-color:#E2EBED;
padding-left:2px;
width: 250px; /* IE 5.x */
width/* */:/**/248px; /* Other browsers */
width: /**/248px;
height: 20px; /* IE 5.x */
height/* */:/**/16px; /* Other browsers */
height: /**/16px;
}
#dhtmlgoodies_colorPicker .colorPicker_statusBar{
height:13px;
padding-bottom:2px;
width:248px;
border-top:3px double #317082;
background-color:#E2EBED;
padding-left:2px;
clear:both;
width: 250px; /* IE 5.x */
width/* */:/**/248px; /* Other browsers */
width: /**/248px;
height: 18px; /* IE 5.x */
height/* */:/**/13px; /* Other browsers */
height: /**/13px;
}
#dhtmlgoodies_colorPicker .colorSquare{
margin-left:1px;
margin-bottom:1px;
float:left;
border:1px solid #000;
cursor:pointer;
width: 12px; /* IE 5.x */
width/* */:/**/10px; /* Other browsers */
width: /**/10px;
height: 12px; /* IE 5.x */
height/* */:/**/10px; /* Other browsers */
height: /**/10px;
}
.colorPickerTab_inactive,.colorPickerTab_active{
height:17px;
padding-left:4px;
cursor:pointer;
}
.colorPickerTab_inactive span{
background-image:url('images/tab_left_inactive.gif');
}
.colorPickerTab_active span{
background-image:url('images/tab_left_active.gif');
}
.colorPickerTab_inactive span, .colorPickerTab_active span{
line-height:16px;
font-weight:bold;
font-family:arial;
font-size:11px;
padding-top:1px;
vertical-align:middle;
background-position:top left;
background-repeat: no-repeat;
float:left;
padding-left:6px;
-moz-user-select:no;
}
.colorPickerTab_inactive img,.colorPickerTab_active img{
float:left;
}
.colorPickerCloseButton{
width:11px;
height:11px;
text-align:center;
line-height:10px;
border:1px solid #317082;
position:absolute;
right:1px;
font-size:12px;
font-weight:bold;
top:1px;
padding:1px;
cursor:pointer;
width: 15px; /* IE 5.x */
width/* */:/**/11px; /* Other browsers */
width: /**/11px;
height: 15px; /* IE 5.x */
height/* */:/**/11px; /* Other browsers */
height: /**/11px;
}
#colorPicker_statusBarTxt{
font-size:11px;
font-family:arial;
vertical-align:top;
line-height:13px;
}
form{
padding-left:5px;
}
.form_widget_amount_slider{
border-top:1px solid #9d9c99;
border-left:1px solid #9d9c99;
border-bottom:1px solid #eee;
border-right:1px solid #eee;
background-color:#f0ede0;
position:absolute;
bottom:0px;
width: 5px; /* IE 5.x */
width/* */:/**/3px; /* Other browsers */
width: /**/3px;
height: 5px; /* IE 5.x */
height/* */:/**/3px; /* Other browsers */
height: /**/3px;
}
.colorSliderLabel{
width:15px;
height:20px;
float:left;
font-size:11px;
font-weight:bold;
}
.colorSlider{
width:175px;
height:20px;
float:left;
}
.colorInput{
width:45px;
height:20px;
float:left;
}
.colorPreviewDiv{
width:186px;
margin-right:2px;
margin-top:1px;
border:1px solid #CCC;
height:20px;
float:left;
cursor:pointer;
width: 188px; /* IE 5.x */
width/* */:/**/186px; /* Other browsers */
width: /**/186px;
height: 22px; /* IE 5.x */
height/* */:/**/20px; /* Other browsers */
height: /**/20px;
}
.colorCodeDiv{
width:50px;
height:20px;
float:left;
}

View File

@@ -0,0 +1,11 @@
<html>
<head>
<script type="text/javascript" src="/alfresco/scripts/calendar/color_picker.js" ></script>
<base target="_self" />
</head>
<body topmargin="0" leftmargin="0">
<div align="center">
<script language="javascript" type="text/javascript">renderColorMap();</script>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View File

@@ -0,0 +1,75 @@
// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download.
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================
/* SOURCE FILE: AnchorPosition.js */
function getAnchorPosition(anchorname){var useWindow=false;var coordinates=new Object();var x=0,y=0;var use_gebi=false, use_css=false, use_layers=false;if(document.getElementById){use_gebi=true;}else if(document.all){use_css=true;}else if(document.layers){use_layers=true;}if(use_gebi && document.all){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}else if(use_gebi){var o=document.getElementById(anchorname);x=AnchorPosition_getPageOffsetLeft(o);y=AnchorPosition_getPageOffsetTop(o);}else if(use_css){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}else if(use_layers){var found=0;for(var i=0;i<document.anchors.length;i++){if(document.anchors[i].name==anchorname){found=1;break;}}if(found==0){coordinates.x=0;coordinates.y=0;return coordinates;}x=document.anchors[i].x;y=document.anchors[i].y;}else{coordinates.x=0;coordinates.y=0;return coordinates;}coordinates.x=x;coordinates.y=y;return coordinates;}
function getAnchorWindowPosition(anchorname){var coordinates=getAnchorPosition(anchorname);var x=0;var y=0;if(document.getElementById){if(isNaN(window.screenX)){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else{x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}}else if(document.all){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else if(document.layers){x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}coordinates.x=x;coordinates.y=y;return coordinates;}
function AnchorPosition_getPageOffsetLeft(el){var ol=el.offsetLeft;while((el=el.offsetParent) != null){ol += el.offsetLeft;}return ol;}
function AnchorPosition_getWindowOffsetLeft(el){return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;}
function AnchorPosition_getPageOffsetTop(el){var ot=el.offsetTop;while((el=el.offsetParent) != null){ot += el.offsetTop;}return ot;}
function AnchorPosition_getWindowOffsetTop(el){return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;}
/* SOURCE FILE: PopupWindow.js */
function PopupWindow_getXYPosition(anchorname){var coordinates;if(this.type == "WINDOW"){coordinates = getAnchorWindowPosition(anchorname);}else{coordinates = getAnchorPosition(anchorname);}this.x = coordinates.x;this.y = coordinates.y;}
function PopupWindow_setSize(width,height){this.width = width;this.height = height;}
function PopupWindow_populate(contents){this.contents = contents;this.populated = false;}
function PopupWindow_setUrl(url){this.url = url;}
function PopupWindow_setWindowProperties(props){this.windowProperties = props;}
function PopupWindow_refresh(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).innerHTML = this.contents;}else if(this.use_css){document.all[this.divName].innerHTML = this.contents;}else if(this.use_layers){var d = document.layers[this.divName];d.document.open();d.document.writeln(this.contents);d.document.close();}}else{if(this.popupWindow != null && !this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url;}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close();}this.popupWindow.focus();}}}
function PopupWindow_showPopup(anchorname){this.getXYPosition(anchorname); this.x += this.offsetX;this.y += this.offsetY;if(!this.populated &&(this.contents != "")){this.populated = true;this.refresh();}if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.left = this.x + "px";document.getElementById(this.divName).style.top = this.y;document.getElementById(this.divName).style.display = "block";}else if(this.use_css){document.all[this.divName].style.left = this.x;document.all[this.divName].style.top = this.y;document.all[this.divName].style.display = "block";}else if(this.use_layers){document.layers[this.divName].left = this.x;document.layers[this.divName].top = this.y;document.layers[this.divName].visibility = "visible";}}else{if(this.popupWindow == null || this.popupWindow.closed){if(this.x<0){this.x=0;}if(this.y<0){this.y=0;}if(screen && screen.availHeight){if((this.y + this.height) > screen.availHeight){this.y = screen.availHeight - this.height;}}if(screen && screen.availWidth){if((this.x + this.width) > screen.availWidth){this.x = screen.availWidth - this.width;}}var avoidAboutBlank = window.opera ||( document.layers && !navigator.mimeTypes['*']) || navigator.vendor == 'KDE' ||( document.childNodes && !document.all && !navigator.taintEnabled);this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");}this.refresh();}}
function PopupWindow_hidePopup(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.display = "none";}else if(this.use_css){document.all[this.divName].style.display = "none";}else if(this.use_layers){document.layers[this.divName].visibility = "none";}}else{if(this.popupWindow && !this.popupWindow.closed){this.popupWindow.close();this.popupWindow = null;}}}
function PopupWindow_isClicked(e){if(this.divName != null){if(this.use_layers){var clickX = e.pageX;var clickY = e.pageY;var t = document.layers[this.divName];if((clickX > t.left) &&(clickX < t.left+t.clip.width) &&(clickY > t.top) &&(clickY < t.top+t.clip.height)){return true;}else{return false;}}else if(document.all){var t = window.event.srcElement;while(t.parentElement != null){if(t.id==this.divName){return true;}t = t.parentElement;}return false;}else if(this.use_gebi && e){var t = e.originalTarget;while(t.parentNode != null){if(t.id==this.divName){return true;}t = t.parentNode;}return false;}return false;}return false;}
function PopupWindow_hideIfNotClicked(e){if(this.autoHideEnabled && !this.isClicked(e)){this.hidePopup();}}
function PopupWindow_autoHide(){this.autoHideEnabled = true;}
function PopupWindow_hidePopupWindows(e){for(var i=0;i<popupWindowObjects.length;i++){if(popupWindowObjects[i] != null){var p = popupWindowObjects[i];p.hideIfNotClicked(e);}}}
function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP);}window.popupWindowOldEventListener = document.onmouseup;if(window.popupWindowOldEventListener != null){document.onmouseup = new Function("window.popupWindowOldEventListener();PopupWindow_hidePopupWindows();");}else{document.onmouseup = PopupWindow_hidePopupWindows;}}
function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex = 0;}if(!window.popupWindowObjects){window.popupWindowObjects = new Array();}if(!window.listenerAttached){window.listenerAttached = true;PopupWindow_attachListener();}this.index = popupWindowIndex++;popupWindowObjects[this.index] = this;this.divName = null;this.popupWindow = null;this.width=0;this.height=0;this.populated = false;this.visible = false;this.autoHideEnabled = false;this.contents = "";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName = arguments[0];}else{this.type="WINDOW";}this.use_gebi = false;this.use_css = false;this.use_layers = false;if(document.getElementById){this.use_gebi = true;}else if(document.all){this.use_css = true;}else if(document.layers){this.use_layers = true;}else{this.type = "WINDOW";}this.offsetX = 0;this.offsetY = 0;this.getXYPosition = PopupWindow_getXYPosition;this.populate = PopupWindow_populate;this.setUrl = PopupWindow_setUrl;this.setWindowProperties = PopupWindow_setWindowProperties;this.refresh = PopupWindow_refresh;this.showPopup = PopupWindow_showPopup;this.hidePopup = PopupWindow_hidePopup;this.setSize = PopupWindow_setSize;this.isClicked = PopupWindow_isClicked;this.autoHide = PopupWindow_autoHide;this.hideIfNotClicked = PopupWindow_hideIfNotClicked;}
/* SOURCE FILE: ColorPicker2.js */
ColorPicker_targetInput = null;
function ColorPicker_writeDiv(){document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"display:none;\"> </DIV>");}
function ColorPicker_show(anchorname){this.showPopup(anchorname);}
function ColorPicker_pickColor(color,obj){obj.hidePopup();pickColor(color);}
function pickColor(color){if(ColorPicker_targetInput==null){alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");return;}ColorPicker_targetInput.value = color;}
function ColorPicker_select(inputobj,linkname){if(inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea"){alert("colorpicker.select: Input object passed is not a valid form input object");window.ColorPicker_targetInput=null;return;}window.ColorPicker_targetInput = inputobj;this.show(linkname);}
function ColorPicker_highlightColor(c){var thedoc =(arguments.length>1)?arguments[1]:window.document;var d = thedoc.getElementById("colorPickerSelectedColor");d.style.backgroundColor = c;d = thedoc.getElementById("colorPickerSelectedColorValue");d.innerHTML = c;}
function ColorPicker(){var windowMode = false;if(arguments.length==0){var divname = "colorPickerDiv";}else if(arguments[0] == "window"){var divname = '';windowMode = true;}else{var divname = arguments[0];}if(divname != ""){var cp = new PopupWindow(divname);}else{var cp = new PopupWindow();cp.setSize(225,250);}cp.currentValue = "#FFFFFF";cp.writeDiv = ColorPicker_writeDiv;cp.highlightColor = ColorPicker_highlightColor;cp.show = ColorPicker_show;cp.select = ColorPicker_select;var colors = new Array("#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC",
"#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099",
"#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066",
"#FF0099","#FF00CC","#FF00FF","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333",
"#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300",
"#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF",
"#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#006600","#006633","#006666","#006699","#0066CC",
"#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699",
"#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666",
"#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#009900","#009933",
"#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900",
"#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF",
"#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC",
"#FF99FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99",
"#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66",
"#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33",
"#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00",
"#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF",
"#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC",
"#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF");var total = colors.length;var width = 18;var cp_contents = "";var windowRef =(windowMode)?"window.opener.":"";if(windowMode){cp_contents += "<HTML><HEAD><TITLE>Select Color</TITLE></HEAD>";cp_contents += "<BODY MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0><CENTER>";}cp_contents += "<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=0>";var use_highlight =(document.getElementById || document.all)?true:false;for(var i=0;i<total;i++){if((i % width) == 0){cp_contents += "<TR>";}if(use_highlight){var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"';}else{mo = "";}cp_contents += '<TD BGCOLOR="'+colors[i]+'"><FONT SIZE="-3"><A HREF="#" onClick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+' STYLE="text-decoration:none;">&nbsp;&nbsp;&nbsp;</A></FONT></TD>';if( ((i+1)>=total) ||(((i+1) % width) == 0)){cp_contents += "</TR>";}}if(document.getElementById){var width1 = Math.floor(width/2);var width2 = width = width1;cp_contents += "<TR><TD COLSPAN='"+width1+"' BGCOLOR='#ffffff' ID='colorPickerSelectedColor'>&nbsp;</TD><TD COLSPAN='"+width2+"' ALIGN='CENTER' ID='colorPickerSelectedColorValue'>#FFFFFF</TD></TR>";}cp_contents += "</TABLE>";if(windowMode){cp_contents += "</CENTER></BODY></HTML>";}cp.populate(cp_contents+"\n");cp.offsetY = 25;cp.autoHide();return cp;}

View File

@@ -0,0 +1,79 @@

var DaysArray = function()
{
var _arr = new Array();
_arr[0] = "Sunday";
_arr[1] = "Monday";
_arr[2] = "Tuesday";
_arr[3] = "Wednesday";
_arr[4] = "Thursday";
_arr[5] = "Friday";
_arr[6] = "Saturday";
return _arr;
}
var HoursArray = function()
{
var _arr = new Array();
_arr[0] = "00:00";
_arr[1] = "00:30";
for (i=1; i<24; i++) {
_arr[i*2] = i + ":00";
_arr[i*2+1] = i + ":30";
}
return _arr;
}
var MonthsArray = function()
{
var _arr = new Array();
_arr[0] = "January";
_arr[1] = "February";
_arr[2] = "March";
_arr[3] = "April";
_arr[4] = "May";
_arr[5] = "June";
_arr[6] = "July";
_arr[7] = "August";
_arr[8] = "September";
_arr[9] = "October";
_arr[10] = "November";
_arr[11] = "December";
return _arr;
}
function refreshAllViews()
{
callEventRetrieverWeekView();
callEventRetrieverDayView();
callEventRetrieverMonthView();
}
// Removes leading whitespaces
function lTrim( value )
{
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}
// Removes ending whitespaces
function rTrim( value )
{
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trim( value )
{
return lTrim(rTrim(value));
}
String.prototype.pad = function(l, s, t)
{
return s || (s = " "), (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length)
+ 1).join(s)).substr(0, t = !t ? l : t == 1 ? 0 : Math.ceil(l / 2))
+ this + s.substr(0, l - t) : this;
};

View File

@@ -0,0 +1,114 @@
//
// TODO: package up in an calendar object
// instead of having functions floating
// around in the global namespace.
//
// Author: simon@webteq.eu
//
function applyFilter(query) {
if (query == "") {
query = "\S"; // match everything
}
var re = new RegExp(query,"i");
var select = document.getElementById("availcals");
for (i=0; i<select.length;i++) {
var display;
if (!re.test(select.options[i].text)) {
display = "none";
} else {
display = "block";
}
select.options[i].style.display = display;
}
};
var addSuccessHandler = function(o) {
var result = o.responseText;
var _div = document.getElementById("subscribedCalendars");
if (_div != null) {
_div.innerHTML = result;
}
refreshAllViews();
};
var addFailureHandler = function(o) {
alert("Couldn't get calendar subscriptions");
};
var addCallback = {
success:addSuccessHandler,
failure:addFailureHandler,
argument: { foo:"foo", bar:"bar" }
};
function setupCalendarSubscription() {
// Determine which option is selected
var selectList = document.getElementById("availcals");
var idx = selectList.options.selectedIndex;
if (idx > -1) {
addCalendarSubscription(selectList.options[idx].value);
}
}
function addCalendarSubscription(calendarRef) {
var url = getContextPath() + "/wcservice/calendar/calendarSubscriptions";
var params = new Array();
params[0] = "ref=" + spaceRef;
params[1] = "calendar=" + calendarRef;
var request = YAHOO.util.Connect.asyncRequest("POST", url + "?" + params.join("&"), addCallback, null);
}
//
// Functions for removing subscriptions
//
var removeFailureHandler = function(o) {
alert(o.responseText);
};
var removeCallback = {
success:addSuccessHandler,
failure:removeFailureHandler,
argument: { foo:"foo", bar:"bar" }
};
function removeCalendarSubscription() {
// Determine which option is selected
var selectList = document.getElementById("subscriptions");
var idx = selectList.options.selectedIndex;
if (idx > -1) {
var url = getContextPath() + "/wcservice/calendar/calendarRemove";
var params = new Array();
params[0] = "ref=" + spaceRef;
params[1] = "calendar=" + selectList.options[idx].value;
var request = YAHOO.util.Connect.asyncRequest("POST", url + "?" + params.join("&"), removeCallback, null);
}
}
function colorHandler(o) {
// Success
};
function colorFailureHandler(o) {
alert("Failed to set color");
};
// Color picker functions
function pickColor(color) {
document.getElementById("color2").style.background = color;
// Update the calendar color property
var params = new Array();
params[0] = "ref=" + spaceRef;
params[1] = "color=" + color;
var url = getContextPath() + "/wcservice/calendar/setColor";
var colorCallback = {
success:colorHandler,
failure:colorFailureHandler,
argument: { ref:spaceRef, color:color }
};
var request = YAHOO.util.Connect.asyncRequest("POST", url, colorCallback, null);
};
//YAHOO.util.Event.addListener("window", "load", retrieveAvailableCalendars);

View File

@@ -0,0 +1,11 @@
var CalendarUtil = {
DAYTAB: 2,
setDayView: function(day, tabs) {
var thedate = new Date(_currentDateForMonthView);
thedate.setDate(day);
_currentDateForDayView = thedate; // global refers to the current day
callEventRetrieverDayView(); // load the events for the given date
tabs.set('activeIndex', CalendarUtil.DAYTAB);
}
};

View File

@@ -0,0 +1,134 @@
function createDayTextBoxNode(e)
{
var obj;
if (window.event)
obj = window.event.srcElement;
else
obj = e.target;
if (obj.tagName != 'TD') return false;
var newBox = document.createElement('input');
newBox.className = "inputBox";
newBox.value = defaultCaption;
newBox.size = 80;
newBox.onblur = function(e) { initiateSaveDayEvent(e); }
//newBox.onblur = function(e) { removeTextBoxNode(e); }
newBox.onkeypress = function(e) { checkDayKeyPressed(e); }
obj.appendChild(newBox);
newBox.focus();
}
function initiateSaveDayEvent(e)
{
saveDayEvent(e);
removeTextBoxNode(e);
}
function saveDayEvent(e)
{
var newBox;
if (window.event)
newBox = window.event.srcElement;
else
newBox = e.target;
var ownerTR = newBox.parentNode.parentNode;
var timeTD = ownerTR.firstChild;
var whatEvent = trim(newBox.value);
if (whatEvent.length <= 0)
{
return false;
}
if (!ValidateString(whatEvent))
{
return false;
}
showSavingIndicator('d');
var fromDate = _currentDateForDayView;
var toDate = _currentDateForDayView;
var fromTime;
if (window.event)
fromTime = timeTD.innerText;
else
fromTime = timeTD.textContent;
var x = fromTime.split(":");
var y = ":00";
var toTime = x[0];
if (x[1] == "00")
y = ":30";
else
toTime = parseInt(x[0]) + 1;
toTime += y;
var whereEvent = defaultPlace;
var descriptionEvent = "";
var fromMonth = fromDate.getMonth() + 1;
var toMonth = toDate.getMonth() + 1;
var colorEvent = defaultColor;
var data = "";
data += "s=" + spaceRef;
data += "&";
data += "what=" + whatEvent;
data += "&";
data += "fd=" + fromDate.getFullYear() + "/" + fromMonth + "/" + fromDate.getDate();
data += "&";
data += "ft=" + fromTime;
data += "&";
data += "td=" + toDate.getFullYear() + "/" + toMonth + "/" + toDate.getDate();
data += "&";
data += "tt=" + toTime;
data += "&";
data += "where=" + whereEvent;
data += "&";
data += "desc=" + descriptionEvent;
data += "&";
data += "color=" + colorEvent;
var sUrl = getContextPath() + '/wcservice/calendar/SaveCalendarEvent?';
sUrl += data;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackDayViewSaveEvent, null);
}
function checkDayKeyPressed(e)
{
var key;
if (window.event)
key = window.event.keyCode;
else
key = e.which;
if (key == 13)
{
//saveDayEvent(e);
window.focus();
return false;
}
else
return true;
}
var handleSuccessDayViewSaveEvent = function(o)
{
hideSavingIndicator('d');
refreshAllViews();
}
var handleFailureDayViewSaveEvent = function(o)
{
hideSavingIndicator('d');
alert("Unable to Save, " + o.statusText);
}
var callbackDayViewSaveEvent =
{
success:handleSuccessDayViewSaveEvent,
failure:handleFailureDayViewSaveEvent,
argument: { foo:"foo", bar:"bar" }
};

View File

@@ -0,0 +1,140 @@
var _currentSelectedDate = new Date();
function createWeekTextBoxNode(e, currYear, currMonth, currDate)
{
_currentSelectedDate.setDate(currDate);
_currentSelectedDate.setMonth(currMonth);
_currentSelectedDate.setFullYear(currYear);
var obj;
if (window.event)
obj = window.event.srcElement;
else
obj = e.target;
if (obj.tagName != 'TD') return false;
var newBox = document.createElement('input');
newBox.className = "inputBox";
newBox.value = defaultCaption;
newBox.size = 10;
newBox.onblur = function(e) { initiateSaveWeekEvent(e); }
//newBox.onblur = function(e) { removeTextBoxNode(e); }
newBox.onkeypress = function(e) { checkWeekKeyPressed(e); }
obj.appendChild(newBox);
newBox.focus();
}
function initiateSaveWeekEvent(e)
{
saveWeekEvent(e);
removeTextBoxNode(e);
}
function saveWeekEvent(e)
{
var newBox;
if (window.event)
newBox = window.event.srcElement;
else
newBox = e.target;
var ownerTR = newBox.parentNode.parentNode;
var timeTD = ownerTR.firstChild;
var whatEvent = trim(newBox.value);
if (whatEvent.length <= 0)
{
return false;
}
if (!ValidateString(whatEvent))
{
return false;
}
showSavingIndicator('w');
var fromDate = _currentSelectedDate;
var toDate = _currentSelectedDate;
var fromTime;
if (window.event)
fromTime = timeTD.innerText;
else
fromTime = timeTD.textContent;
var x = fromTime.split(":");
var y = ":00";
var toTime = x[0];
if (x[1] == "00")
y = ":30";
else
toTime = parseInt(x[0]) + 1;
toTime += y;
var whereEvent = defaultPlace;
var descriptionEvent = "";
var fromMonth = fromDate.getMonth() + 1;
var toMonth = toDate.getMonth() + 1;
var colorEvent = defaultColor;
var data = "";
data += "s=" + spaceRef;
data += "&";
data += "what=" + whatEvent;
data += "&";
data += "fd=" + fromDate.getFullYear() + "/" + fromMonth + "/" + fromDate.getDate();
data += "&";
data += "ft=" + fromTime;
data += "&";
data += "td=" + toDate.getFullYear() + "/" + toMonth + "/" + toDate.getDate();
data += "&";
data += "tt=" + toTime;
data += "&";
data += "where=" + whereEvent;
data += "&";
data += "desc=" + descriptionEvent;
data += "&";
data += "color=" + colorEvent;
var sUrl = getContextPath() + '/wcservice/calendar/SaveCalendarEvent?';
sUrl += data;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackWeekViewSaveEvent, null);
}
function checkWeekKeyPressed(e)
{
var key;
if (window.event)
key = window.event.keyCode;
else
key = e.which;
if (key == 13)
{
//saveWeekEvent(e);
window.focus();
return false;
}
else
return true;
}
var handleSuccessWeekViewSaveEvent = function(o)
{
hideSavingIndicator('w');
refreshAllViews();
}
var handleFailureWeekViewSaveEvent = function(o)
{
hideSavingIndicator('w');
alert("Unable to Save, " + o.statusText);
}
var callbackWeekViewSaveEvent =
{
success:handleSuccessWeekViewSaveEvent,
failure:handleFailureWeekViewSaveEvent,
argument: { foo:"foo", bar:"bar" }
};

View File

@@ -0,0 +1,97 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
YAHOO.util.Color = function() {
var hexchars = "0123456789ABCDEF";
var real2int = function(n) {
return Math.min(255, Math.round(n*256));
};
return {
/**
* HSV to RGB. h[0,360], s[0,1], v[0,1]
*/
hsv2rgb: function(h,s,v) {
var r,g,b,i,f,p,q,t;
i = Math.floor((h/60)%6);
f = (h/60)-i;
p = v*(1-s);
q = v*(1-f*s);
t = v*(1-(1-f)*s);
switch(i) {
case 0: r=v; g=t; b=p; break;
case 1: r=q; g=v; b=p; break;
case 2: r=p; g=v; b=t; break;
case 3: r=p; g=q; b=v; break;
case 4: r=t; g=p; b=v; break;
case 5: r=v; g=p; b=q; break;
}
//alert([h,s,v] + "-" + [r,g,b]);
return [real2int(r), real2int(g), real2int(b)];
},
rgb2hsv: function(r,g,b) {
var min,max,delta,h,s,v;
min = Math.min(Math.min(r,g),b);
max = Math.max(Math.max(r,g),b);
delta = max-min;
switch (max) {
case min: h=0; break;
case r: h=(g-b)/delta;
if (g<b) {
h+=360;
}
break;
case g: h=((b-r)/delta)+120; break;
case b: h=((r-g)/delta)+240; break;
}
s = (max==0) ? 0 : 1-(mix/max);
return {"h": h, "s": s, "v": max};
},
rgb2hex: function (r,g,b) {
return this.int2hex(r) + this.int2hex(g) + this.int2hex(b);
},
/**
* Converts an int [0,255] to hex [00,FF]
*/
int2hex: function(n) {
n = n || 0;
n = parseInt(n, 10);
if (isNaN(n)) n = 0;
n = Math.round(Math.min(Math.max(0, n), 255));
return hexchars.charAt((n - n % 16) / 16) + hexchars.charAt(n % 16);
},
hex2dec: function(hexchar) {
return hexchars.indexOf(hexchar.toUpperCase());
},
hex2rgb: function(s) {
var rgb = [];
rgb[0] = (this.hex2dec(s.substr(0, 1)) * 16) + this.hex2dec(s.substr(1, 1));
rgb[1] = (this.hex2dec(s.substr(2, 1)) * 16) + this.hex2dec(s.substr(3, 1));
rgb[2] = (this.hex2dec(s.substr(4, 1)) * 16) + this.hex2dec(s.substr(5, 1));
// gLogger.debug("hex2rgb: " + str + ", " + rgb.toString());
return rgb;
},
isValidRGB: function(a) {
if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255) return false;
if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255) return false;
if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255) return false;
return true;
}
}
}();

View File

@@ -0,0 +1,167 @@
function baseConverter (number,ob,nb) {
number = number + "";
number = number.toUpperCase();
var list = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var dec = 0;
for (var i = 0; i <= number.length; i++) {
dec += (list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1)));
}
number = "";
var magnitude = Math.floor((Math.log(dec))/(Math.log(nb)));
for (var i = magnitude; i >= 0; i--) {
var amount = Math.floor(dec/Math.pow(nb,i));
number = number + list.charAt(amount);
dec -= amount*(Math.pow(nb,i));
}
if(number.length==0)number=0;
return number;
}
// Converts a RGB color to HSV
function toHSV(rgbColor){
rgbColor = rgbColor.replace('#','');
red = baseConverter(rgbColor.substr(0,2),16,10);
green = baseConverter(rgbColor.substr(2,2),16,10);
blue = baseConverter(rgbColor.substr(4,2),16,10);
if(red.length==0)red=0;
if(green.length==0)green=0;
if(blue.length==0)blue=0;
red = red/255;
green = green/255;
blue = blue/255;
maxValue = Math.max(red,green,blue);
minValue = Math.min(red,green,blue);
var hue = 0;
if(maxValue==minValue){
hue = 0;
saturation=0;
}else{
if(red == maxValue){
hue = (green - blue) / (maxValue-minValue)/1;
}else if(green == maxValue){
hue = 2 + (blue - red)/1 / (maxValue-minValue)/1;
}else if(blue == maxValue){
hue = 4 + (red - green) / (maxValue-minValue)/1;
}
saturation = (maxValue-minValue) / maxValue;
}
hue = hue * 60;
valueBrightness = maxValue;
if(valueBrightness/1<0.5){
//saturation = (maxValue - minValue) / (maxValue + minValue);
}
if(valueBrightness/1>= 0.5){
//saturation = (maxValue - minValue) / (2 - maxValue - minValue);
}
returnArray = [hue,saturation,valueBrightness];
return returnArray;
}
function toRgb(hue,saturation,valueBrightness){
Hi = Math.floor(hue / 60);
if(hue==360)Hi=0;
f = hue/60 - Hi;
p = (valueBrightness * (1- saturation)).toPrecision(2);
q = (valueBrightness * (1 - (f * saturation))).toPrecision(2);
t = (valueBrightness * (1 - ((1-f)*saturation))).toPrecision(2);
switch(Hi){
case 0:
red = valueBrightness;
green = t;
blue = p;
break;
case 1:
red = q;
green = valueBrightness;
blue = p;
break;
case 2:
red = q;
green = valueBrightness;
blue = t;
break;
case 3:
red = p;
green = q;;
blue = valueBrightness;
break;
case 4:
red = t;
green = p;
blue = valueBrightness;
break;
case 5:
red = valueBrightness;
green = p;
blue = q;
break;
}
if(saturation==0){
red = valueBrightness;
green = valueBrightness;
blue = valueBrightness;
}
red*=255;
green*=255;
blue*=255;
red = Math.round(red);
green = Math.round(green);
blue = Math.round(blue);
red = baseConverter(red,10,16);
green = baseConverter(green,10,16);
blue = baseConverter(blue,10,16);
red = red + "";
green = green + "";
blue = blue + "";
while(red.length<2){
red = "0" + red;
}
while(green.length<2){
green = "0" + green;
}
while(blue.length<2){
blue = "0" + "" + blue;
}
rgbColor = "#" + red + "" + green + "" + blue;
return rgbColor.toUpperCase();
}
function findColorByDegrees(rgbColor,degrees){
rgbColor = rgbColor.replace('#','');
myArray = toHSV(rgbColor);
myArray[0]+=degrees;
if(myArray[0]>=360)myArray[0]-=360;
if(myArray[0]<0)myArray[0]+=360;
return toRgb(myArray[0],myArray[1],myArray[2]);
}
function findColorByBrightness(rgbColor,brightness){
rgbColor = rgbColor.replace('#','');
myArray = toHSV(rgbColor);
myArray[2]+=brightness/100;
if(myArray[2]>1)myArray[2]=1;
if(myArray[2]<0)myArray[2]=0;
myArray[1]+=brightness/100;
if(myArray[1]>1)myArray[1]=1;
if(myArray[1]<0)myArray[1]=0;
return toRgb(myArray[0],myArray[1],myArray[2]);
}

View File

@@ -0,0 +1,109 @@
function selectColor() {
var color = document.getElementById("selectedColorBox").value;
if (window.opener != null)
{
var mainWinTxtColor = window.opener.document.getElementById(window.colorControl);
if (mainWinTxtColor != null)
{
mainWinTxtColor.value = color;
mainWinTxtColor.style.backgroundColor = color;
}
}
window.close();
}
function showColor(color) {
document.getElementById("selectedColor").style.backgroundColor = color;
document.getElementById("selectedColorBox").value = color;
}
var colors = new Array(
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
);
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function renderColorMap() {
var html = "";
var inputColor = convertRGBToHex('ff88ff');
html += '<table border="0" cellspacing="1" cellpadding="0">'
+ '<tr>';
for (var i=0; i<colors.length; i++) {
html += '<td bgcolor="' + colors[i] + '">'
+ '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">'
+ '<img border="0" src="/alfresco/images/calendar/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>';
if ((i+1) % 18 == 0)
html += '</tr><tr>';
}
html += '<tr><td colspan="18">'
+ '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
+ '<tr><td>'
+ '<img id="selectedColor" style="background-color:' + 'ff88ff' + '" border="0" src="/alfresco/images/calendar/spacer.gif" width="80" height="16" />'
+ '</td><td align="right">'
+ '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'
+ '</td></tr>'
+ '</table>'
+ '</td></tr>'
+ '</table>';
document.write(html);
}

View File

@@ -0,0 +1,81 @@
YAHOO.example.ColorPicker = function() {
var Slider=YAHOO.widget.Slider;
var Color=YAHOO.util.Color;
var Dom=YAHOO.util.Dom;
var pickerSize=180;
var hue,picker,panel;
// hue, int[0,359]
var getH = function() {
var h = (pickerSize - hue.getValue()) / pickerSize;
h = Math.round(h*360);
return (h == 360) ? 0 : h;
}
// saturation, int[0,1], left to right
var getS = function() {
return picker.getXValue() / pickerSize;
}
// value, int[0,1], top to bottom
var getV = function() {
return (pickerSize - picker.getYValue()) / pickerSize;
}
var swatchUpdate = function() {
var h=getH(), s=getS(), v=getV();
Dom.get("hval").value = h;
Dom.get("sval").value = Math.round(s*100);
Dom.get("vval").value = Math.round(v*100);
var rgb = Color.hsv2rgb(h, s, v);
var styleDef = "rgb(" + rgb.join(",") + ")";
Dom.setStyle("swatch", "background-color", styleDef);
Dom.get("rval").value = rgb[0];
Dom.get("gval").value = rgb[1];
Dom.get("bval").value = rgb[2];
Dom.get("hexval").value = Color.rgb2hex(rgb[0], rgb[1], rgb[2]);
};
var hueUpdate = function(newOffset) {
YAHOO.log("hue update: " + newOffset , "warn");
var rgb = Color.hsv2rgb(getH(), 1, 1);
var styleDef = "rgb(" + rgb.join(",") + ")";
Dom.setStyle("pickerDiv", "background-color", styleDef);
swatchUpdate();
};
pickerUpdate = function(newOffset) {
YAHOO.log("picker update [" + newOffset.x + ", " + newOffset.y + "]" , "warn");
swatchUpdate();
};
return {
init: function () {
hue = Slider.getVertSlider("hueBg", "hueThumb", 0, pickerSize);
hue.subscribe("change", hueUpdate);
picker = Slider.getSliderRegion("pickerDiv", "selector",
0, pickerSize, 0, pickerSize);
picker.subscribe("change", pickerUpdate);
hueUpdate(0);
panel = new YAHOO.util.DD("ddPicker");
panel.setHandleElId("pickerHandle");
}
}
}();
//YAHOO.util.Event.on(window, "load", YAHOO.example.ColorPicker.init);

View File

@@ -0,0 +1,64 @@
var _currentActiveEditingEvent = null;
function editEvent(eventId)
{
_currentActiveEditingEvent = eventId;
if (_currentActiveEditingEvent == null) return false;
retrieveCalendarEvent();
}
function populateEventDetailsForEdit(response)
{
var _details = response.split("^");
if (_details.length <=0)
{
alert("Unable to Retrieve details of Event");
return false;
}
var _fromDate = new Date(_details[1]);
var _toDate = new Date(_details[3]);
document.getElementById("txtWhatEvent").value = _details[0];
document.getElementById("hidFromDate").value = _details[1];
document.getElementById("txtFromDate").value = _fromDate.toDateString();
document.getElementById("lstFromTime").value = _details[2];
document.getElementById("hidToDate").value = _details[3];
document.getElementById("txtToDate").value = _toDate.toDateString();
document.getElementById("lstToTime").value = _details[4];
document.getElementById("txtWhereEvent").value = _details[5];
document.getElementById("txtDescriptionEvent").value = _details[6];
document.getElementById("txtColor").value = _details[7];
tabView.set('activeIndex', 3); //tabView: the main YUI TabView Control - defined in FTL.
document.getElementById("txtWhatEvent").focus();
}
var handleSuccessRetrieveEvent = function(o)
{
populateEventDetailsForEdit(o.responseText);
}
var handleFailureRetrieveEvent = function(o)
{
alert("Unable to Retrieve Event Details, " + o.statusText);
}
var callbackRetrieveEvent =
{
success:handleSuccessRetrieveEvent,
failure:handleFailureRetrieveEvent,
argument: { foo:"foo", bar:"bar" }
};
function retrieveCalendarEvent()
{
var sUrl = getContextPath() + '/wcservice/calendar/RetrieveEventDetails?';
var postData = "e=" + _currentActiveEditingEvent;
sUrl += postData;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackRetrieveEvent, null);
}

View File

@@ -0,0 +1,70 @@
function showSavingIndicator(mode)
{
var obj = null;
switch(mode)
{
case 'd':
{
obj = document.getElementById("spnCurrentDisplayDay");
break;
}
case 'w':
{
obj = document.getElementById("spnCurrentDisplayWeek");
break;
}
case 'c':
{
obj = document.getElementById("spnEventCapture");
break;
}
}
if (obj == null) return false;
var newImg = document.createElement('img');
newImg.src = "/alfresco/yui/img/indicator.gif";
var txt = document.createTextNode(' Saving...');
obj.appendChild(newImg);
obj.appendChild(txt);
}
function hideSavingIndicator(mode)
{
var obj = null;
switch(mode)
{
case 'd':
{
obj = document.getElementById("spnCurrentDisplayDay");
break;
}
case 'w':
{
obj = document.getElementById("spnCurrentDisplayWeek");
break;
}
case 'c':
{
obj = document.getElementById("spnEventCapture");
break;
}
}
if (obj == null) return false;
while (obj.hasChildNodes())
obj.removeChild(obj.firstChild);
}
function removeTextBoxNode(e)
{
var txtNode;
if (window.event)
txtNode = window.event.srcElement;
else
txtNode = e.target;
var owner = txtNode.parentNode;
owner.removeChild(txtNode);
}

View File

@@ -0,0 +1,44 @@
var _currentDateForDayView = new Date();
var handleSuccessDayView = function(o)
{
var response = o.responseText;
var _divDayView = document.getElementById("divDayView");
if (_divDayView != null) {
_divDayView.innerHTML = response;
document.getElementById("spnCurrentDisplayDayDayView").innerHTML = _currentDateForDayView.toDateString();
}
}
var handleFailureDayView = function(o)
{
alert("Unable to retrieve, " + o.statusText);
}
var callbackDayView =
{
success:handleSuccessDayView,
failure:handleFailureDayView,
argument: { foo:"foo", bar:"bar" }
};
function callEventRetrieverDayView()
{
var sUrl = getContextPath() + '/wcservice/calendar/RetrieveDayEvents?';
var month = _currentDateForDayView.getMonth() + 1;
var postData = "s=" + spaceRef + "&d=" + _currentDateForDayView.getFullYear() + "/" + month + "/" + _currentDateForDayView.getDate();
sUrl += postData;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackDayView, null);
}
function callLoadersDayView(change)
{
if (isNaN(change)) change = 0;
if (change == 0) _currentDateForDayView = new Date();
_currentDateForDayView.setDate(_currentDateForDayView.getDate() + change);
//document.getElementById("spnCurrentDisplayDayDayView").innerHTML = _currentDateForDayView.toDateString();
callEventRetrieverDayView();
}
YAHOO.util.Event.addListener(window, "load", callLoadersDayView);

View File

@@ -0,0 +1,54 @@
var _currentDateForMonthView = new Date();
function setCurrentMonthView()
{
_currentDateForMonthView = new Date();
callEventRetrieverMonthView();
}
function addMonthsMonthView(n)
{
_currentDateForMonthView.setMonth(_currentDateForMonthView.getMonth() + n);
callEventRetrieverMonthView();
}
function addYearsMonthView(n)
{
_currentDateForMonthView.setFullYear(_currentDateForMonthView.getFullYear() + n);
callEventRetrieverMonthView();
}
var handleSuccessMonthView = function(o)
{
var response = o.responseText;
var _divMonthView = document.getElementById("divMonthView");
if (_divMonthView != null)
_divMonthView.innerHTML = response;
}
var handleFailureMonthView = function(o)
{
alert("Unable to retrieve, " + o.statusText);
}
var callbackMonthView =
{
success:handleSuccessMonthView,
failure:handleFailureMonthView,
argument: { foo:"foo", bar:"bar" }
};
function callEventRetrieverMonthView()
{
var _arrMonths = MonthsArray();
var month = _currentDateForMonthView.getMonth() + 1;
document.getElementById("spnCurrentDisplayMonthMonthView").innerHTML = _arrMonths[month-1] + ", " + _currentDateForMonthView.getFullYear();
var sUrl = getContextPath() + '/wcservice/calendar/RetrieveMonthEvents?';
var postData = "s=" + spaceRef + "&d=" + _currentDateForMonthView.getFullYear() + "/" + month + "/" + _currentDateForMonthView.getDate();
sUrl += postData;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackMonthView, null);
}
YAHOO.util.Event.addListener(window, "load", callEventRetrieverMonthView);

View File

@@ -0,0 +1,49 @@
var _currentDateForWeekView = new Date();
function setCurrentDateForWeekView(change)
{
if (isNaN(change)) change = 0;
if (change == 0) _currentDateForWeekView = new Date();
_currentDateForWeekView.setDate(_currentDateForWeekView.getDate() + change);
}
var handleSuccessWeekView = function(o)
{
var response = o.responseText;
var _divWeekView = document.getElementById("divWeekView");
if (_divWeekView != null)
_divWeekView.innerHTML = response;
//document.getElementById("spnCurrentDisplayWeekWeekView").innerHTML = response[1];
}
var handleFailureWeekView = function(o)
{
alert("Unable to retrieve, " + o.statusText);
}
var callbackWeekView =
{
success:handleSuccessWeekView,
failure:handleFailureWeekView,
argument: { foo:"foo", bar:"bar" }
};
function callEventRetrieverWeekView()
{
var month = _currentDateForWeekView.getMonth() + 1;
var sUrl = getContextPath() + '/wcservice/calendar/RetrieveWeekEvents?';
var postData = "s=" + spaceRef + "&d=" + _currentDateForWeekView .getFullYear() + "/" + month + "/" + _currentDateForWeekView .getDate();
sUrl += postData;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackWeekView, null);
}
function callLoadersWeekView(change)
{
if (isNaN(change)) change = 0;
setCurrentDateForWeekView(change);
callEventRetrieverWeekView();
}
YAHOO.util.Event.addListener(window, "load", callLoadersWeekView);

View File

@@ -0,0 +1,200 @@
var currentBox = null;
var currentVisibleBox = null;
// Variables to hold Event Default values.
var defaultCaption = "";
var defaultPlace = "";
var defaultFromDate = new Date();
var defaultFromDateString = "";
var defaultFromTime = "";
var defaultToDate = new Date();
var defaultToDateString = "";
var defaultToTime = "";
var defaultColor = "";
YAHOO.namespace("example.calendar");
function handleSelect(type, args, obj)
{
var dates = args[0];
var date = dates[0];
var year = date[0], month = date[1], day = date[2];
var dateValue = month + "/" + day + "/" + year;
var dateData = new Date();
dateData.setFullYear(year, month-1, day);
if (currentBox != null)
{
currentBox.value = dateValue;
}
if (currentVisibleBox != null)
{
currentVisibleBox.value = dateData.toDateString();
}
ToggleCalendar(0, null);
}
function init()
{
YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1Container", { mindate:"1/1/2006", maxdate:"12/31/2008" });
YAHOO.example.calendar.cal1.selectEvent.subscribe(handleSelect, YAHOO.example.calendar.cal1, true);
YAHOO.example.calendar.cal1.render();
tabView = new YAHOO.widget.TabView('divCalendarMainContainer');
document.onclick = function(e) { HideCalendar(e); }
PopulateTimes();
retrieveEventDefaults();
initCalendarProperties();
}
function ToggleCalendar(mode, txtBox)
{
if (isNaN(mode)) mode = 0;
var calendar = document.getElementById("cal1Container");
if (calendar == null) return;
calendar.style.display = mode == 1 ? "inline" : "none";
if (txtBox == null) return;
if (mode == 1)
{
calendar.style.left = txtBox.offsetParent.offsetLeft + txtBox.offsetLeft;
calendar.style.top = txtBox.offsetParent.offsetTop + txtBox.offsetHeight;
}
currentVisibleBox = txtBox;
if (txtBox.id == "txtFromDate")
currentBox = document.getElementById("hidFromDate");
else if (txtBox.id == "txtToDate")
currentBox = document.getElementById("hidToDate");
}
function HideCalendar(e)
{
var obj = null;
if (window.event)
obj = window.event.srcElement;
else
obj = e.target;
if (obj.id != "txtFromDate" && obj.id != "txtToDate")
ToggleCalendar(0);
}
function PopulateTimes()
{
var _arr = HoursArray();
for (i=0; i<_arr.length; i++)
{
var _option1 = document.createElement("OPTION");
_option1.text = _arr[i];
_option1.value = _arr[i];
document.getElementById("lstFromTime").options.add(_option1);
var _option2 = document.createElement("OPTION");
_option2.text = _arr[i];
_option2.value = _arr[i];
document.getElementById("lstToTime").options.add(_option2);
}
}
/////////////
function initSuccessHandler(o) {
var result = o.responseText;
var _div = document.getElementById("calendarSubscribe");
if (_div != null) {
_div.innerHTML = result;
}
}
function initFailureHandler(o) {
alert("Failed to initialise calendar properties");
}
function initCalendarProperties() {
var url = getContextPath() + "/wcservice/calendar/calendarInit";
var initCallback = {
success:initSuccessHandler,
failure:initFailureHandler
};
var request = YAHOO.util.Connect.asyncRequest("GET", url + "?ref=" + spaceRef, initCallback, null);
}
/////////////
YAHOO.util.Event.addListener(window, "load", init);
var handleSuccessInitEvent = function(o)
{
populateEventDefaults(o.responseText);
}
var handleFailureInitEvent = function(o)
{
alert("Unable to Retrieve Default values for Events, " + o.statusText);
}
var callbackInitEvent =
{
success:handleSuccessInitEvent,
failure:handleFailureInitEvent,
argument: { foo:"foo", bar:"bar" }
};
function retrieveEventDefaults()
{
var sUrl = getContextPath() + '/wcservice/calendar/RetrieveEventDefaults?';
var postData = "s=" + spaceRef;
sUrl += postData;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackInitEvent, null);
}
function populateEventDefaults(response)
{
var _details = response.split("^");
if (_details.length <=0)
{
alert("Unable to Retrieve Event Defaults");
return false;
}
defaultCaption = _details[0];
var _fromDate = new Date(_details[1]);
defaultFromDate = new Date(_fromDate);
var x = _fromDate.getMonth() + 1;
defaultFromDateString = x + "/" + _fromDate.getDate() + "/" + _fromDate.getFullYear();
defaultFromTime = _fromDate.getHours() + ":" + _fromDate.getMinutes().toString().pad(2, "0", 1);
var _toDate = new Date(_details[2]);
defaultToDate = new Date(_toDate);
var y = _toDate.getMonth() + 1;
defaultToDateString = y + "/" + _toDate.getDate() + "/" + _toDate.getFullYear();
defaultToTime = _toDate.getHours() + ":" + _toDate.getMinutes().toString().pad(2, "0", 1);
defaultPlace = _details[3];
defaultColor = _details[4];
document.getElementById("txtWhatEvent").value = defaultCaption;
document.getElementById("hidFromDate").value = defaultFromDateString;
document.getElementById("txtFromDate").value = _fromDate.toDateString();
document.getElementById("lstFromTime").value = defaultFromTime;
document.getElementById("hidToDate").value = defaultToDateString;
document.getElementById("txtToDate").value = _toDate.toDateString();
document.getElementById("lstToTime").value = defaultToTime;
document.getElementById("txtWhereEvent").value = defaultPlace;
document.getElementById("txtColor").value = defaultColor;
}

View File

@@ -0,0 +1,585 @@
/************************************************************************************************************
(C) www.dhtmlgoodies.com, October 2005
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
Thank you!
www.dhtmlgoodies.com
Alf Magne Kalleland
************************************************************************************************************/
var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;
var navigatorVersion = navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1;
var form_widget_amount_slider_handle = '/alfresco/images/calendar/slider_handle.gif';
var slider_handle_image_obj = false;
var sliderObjectArray = new Array();
var slider_counter = 0;
var slideInProgress = false;
var handle_start_x;
var event_start_x;
var currentSliderIndex;
function form_widget_cancel_event()
{
return false;
}
function getImageSliderHeight(){
if(!slider_handle_image_obj){
slider_handle_image_obj = new Image();
slider_handle_image_obj.src = form_widget_amount_slider_handle;
}
if(slider_handle_image_obj.width>0){
return;
}else{
setTimeout('getImageSliderHeight()',50);
}
}
function positionSliderImage(e,theIndex,inputObj)
{
if(this)inputObj = this;
if(!theIndex)theIndex = inputObj.getAttribute('sliderIndex');
var handleImg = document.getElementById('slider_handle' + theIndex);
var ratio = sliderObjectArray[theIndex]['width'] / (sliderObjectArray[theIndex]['max']-sliderObjectArray[theIndex]['min']);
var currentValue = sliderObjectArray[theIndex]['formTarget'].value-sliderObjectArray[theIndex]['min'];
handleImg.style.left = currentValue * ratio + 'px';
setColorByRGB();
}
function adjustFormValue(theIndex)
{
var handleImg = document.getElementById('slider_handle' + theIndex);
var ratio = sliderObjectArray[theIndex]['width'] / (sliderObjectArray[theIndex]['max']-sliderObjectArray[theIndex]['min']);
var currentPos = handleImg.style.left.replace('px','');
sliderObjectArray[theIndex]['formTarget'].value = Math.round(currentPos / ratio) + sliderObjectArray[theIndex]['min'];
}
function initMoveSlider(e)
{
if(document.all)e = event;
slideInProgress = true;
event_start_x = e.clientX;
handle_start_x = this.style.left.replace('px','');
currentSliderIndex = this.id.replace(/[^\d]/g,'');
return false;
}
function startMoveSlider(e)
{
if(document.all)e = event;
if(!slideInProgress)return;
var leftPos = handle_start_x/1 + e.clientX/1 - event_start_x;
if(leftPos<0)leftPos = 0;
if(leftPos/1>sliderObjectArray[currentSliderIndex]['width'])leftPos = sliderObjectArray[currentSliderIndex]['width'];
document.getElementById('slider_handle' + currentSliderIndex).style.left = leftPos + 'px';
adjustFormValue(currentSliderIndex);
if(sliderObjectArray[currentSliderIndex]['onchangeAction']){
eval(sliderObjectArray[currentSliderIndex]['onchangeAction']);
}
}
function stopMoveSlider()
{
slideInProgress = false;
}
function form_widget_amount_slider(targetElId,formTarget,width,min,max,onchangeAction)
{
if(!slider_handle_image_obj){
getImageSliderHeight();
}
slider_counter = slider_counter +1;
sliderObjectArray[slider_counter] = new Array();
sliderObjectArray[slider_counter] = {"width":width - 9,"min":min,"max":max,"formTarget":formTarget,"onchangeAction":onchangeAction};
formTarget.setAttribute('sliderIndex',slider_counter);
formTarget.onchange = positionSliderImage;
var parentObj = document.createElement('DIV');
parentObj.style.width = width + 'px';
parentObj.style.height = '12px'; // The height of the image
parentObj.style.position = 'relative';
parentObj.id = 'slider_container' + slider_counter;
document.getElementById(targetElId).appendChild(parentObj);
var obj = document.createElement('DIV');
obj.className = 'form_widget_amount_slider';
obj.innerHTML = '<span></span>';
obj.style.width = width + 'px';
obj.id = 'slider_slider' + slider_counter;
obj.style.position = 'absolute';
obj.style.bottom = '0px';
parentObj.appendChild(obj);
var handleImg = document.createElement('IMG');
handleImg.style.position = 'absolute';
handleImg.style.left = '0px';
handleImg.style.zIndex = 5;
handleImg.src = slider_handle_image_obj.src;
handleImg.id = 'slider_handle' + slider_counter;
handleImg.onmousedown = initMoveSlider;
if(document.body.onmouseup){
if(document.body.onmouseup.toString().indexOf('stopMoveSlider')==-1){
alert('You allready have an onmouseup event assigned to the body tag');
}
}else{
document.body.onmouseup = stopMoveSlider;
document.body.onmousemove = startMoveSlider;
}
handleImg.ondragstart = form_widget_cancel_event;
parentObj.appendChild(handleImg);
positionSliderImage(false,slider_counter);
}
var namedColors = new Array('AliceBlue','AntiqueWhite','Aqua','Aquamarine','Azure','Beige','Bisque','Black','BlanchedAlmond','Blue','BlueViolet','Brown',
'BurlyWood','CadetBlue','Chartreuse','Chocolate','Coral','CornflowerBlue','Cornsilk','Crimson','Cyan','DarkBlue','DarkCyan','DarkGoldenRod','DarkGray',
'DarkGreen','DarkKhaki','DarkMagenta','DarkOliveGreen','Darkorange','DarkOrchid','DarkRed','DarkSalmon','DarkSeaGreen','DarkSlateBlue','DarkSlateGray',
'DarkTurquoise','DarkViolet','DeepPink','DeepSkyBlue','DimGray','DodgerBlue','Feldspar','FireBrick','FloralWhite','ForestGreen','Fuchsia','Gainsboro',
'GhostWhite','Gold','GoldenRod','Gray','Green','GreenYellow','HoneyDew','HotPink','IndianRed','Indigo','Ivory','Khaki','Lavender','LavenderBlush',
'LawnGreen','LemonChiffon','LightBlue','LightCoral','LightCyan','LightGoldenRodYellow','LightGrey','LightGreen','LightPink','LightSalmon','LightSeaGreen',
'LightSkyBlue','LightSlateBlue','LightSlateGray','LightSteelBlue','LightYellow','Lime','LimeGreen','Linen','Magenta','Maroon','MediumAquaMarine',
'MediumBlue','MediumOrchid','MediumPurple','MediumSeaGreen','MediumSlateBlue','MediumSpringGreen','MediumTurquoise','MediumVioletRed','MidnightBlue',
'MintCream','MistyRose','Moccasin','NavajoWhite','Navy','OldLace','Olive','OliveDrab','Orange','OrangeRed','Orchid','PaleGoldenRod','PaleGreen',
'PaleTurquoise','PaleVioletRed','PapayaWhip','PeachPuff','Peru','Pink','Plum','PowderBlue','Purple','Red','RosyBrown','RoyalBlue','SaddleBrown',
'Salmon','SandyBrown','SeaGreen','SeaShell','Sienna','Silver','SkyBlue','SlateBlue','SlateGray','Snow','SpringGreen','SteelBlue','Tan','Teal','Thistle',
'Tomato','Turquoise','Violet','VioletRed','Wheat','White','WhiteSmoke','Yellow','YellowGreen');
var namedColorRGB = new Array('#F0F8FF','#FAEBD7','#00FFFF','#7FFFD4','#F0FFFF','#F5F5DC','#FFE4C4','#000000','#FFEBCD','#0000FF','#8A2BE2','#A52A2A','#DEB887',
'#5F9EA0','#7FFF00','#D2691E','#FF7F50','#6495ED','#FFF8DC','#DC143C','#00FFFF','#00008B','#008B8B','#B8860B','#A9A9A9','#006400','#BDB76B','#8B008B',
'#556B2F','#FF8C00','#9932CC','#8B0000','#E9967A','#8FBC8F','#483D8B','#2F4F4F','#00CED1','#9400D3','#FF1493','#00BFFF','#696969','#1E90FF','#D19275',
'#B22222','#FFFAF0','#228B22','#FF00FF','#DCDCDC','#F8F8FF','#FFD700','#DAA520','#808080','#008000','#ADFF2F','#F0FFF0','#FF69B4','#CD5C5C','#4B0082',
'#FFFFF0','#F0E68C','#E6E6FA','#FFF0F5','#7CFC00','#FFFACD','#ADD8E6','#F08080','#E0FFFF','#FAFAD2','#D3D3D3','#90EE90','#FFB6C1','#FFA07A','#20B2AA',
'#87CEFA','#8470FF','#778899','#B0C4DE','#FFFFE0','#00FF00','#32CD32','#FAF0E6','#FF00FF','#800000','#66CDAA','#0000CD','#BA55D3','#9370D8','#3CB371',
'#7B68EE','#00FA9A','#48D1CC','#C71585','#191970','#F5FFFA','#FFE4E1','#FFE4B5','#FFDEAD','#000080','#FDF5E6','#808000','#6B8E23','#FFA500','#FF4500',
'#DA70D6','#EEE8AA','#98FB98','#AFEEEE','#D87093','#FFEFD5','#FFDAB9','#CD853F','#FFC0CB','#DDA0DD','#B0E0E6','#800080','#FF0000','#BC8F8F','#4169E1',
'#8B4513','#FA8072','#F4A460','#2E8B57','#FFF5EE','#A0522D','#C0C0C0','#87CEEB','#6A5ACD','#708090','#FFFAFA','#00FF7F','#4682B4','#D2B48C','#008080',
'#D8BFD8','#FF6347','#40E0D0','#EE82EE','#D02090','#F5DEB3','#FFFFFF','#F5F5F5','#FFFF00','#9ACD32');
var color_picker_div = false;
var color_picker_active_tab = false;
var color_picker_form_field = false;
var color_picker_active_input = false;
function baseConverter (number,ob,nb) {
number = number + "";
number = number.toUpperCase();
var list = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var dec = 0;
for (var i = 0; i <= number.length; i++) {
dec += (list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1)));
}
number = "";
var magnitude = Math.floor((Math.log(dec))/(Math.log(nb)));
for (var i = magnitude; i >= 0; i--) {
var amount = Math.floor(dec/Math.pow(nb,i));
number = number + list.charAt(amount);
dec -= amount*(Math.pow(nb,i));
}
if(number.length==0)number=0;
return number;
}
function colorPickerGetTopPos(inputObj)
{
var returnValue = inputObj.offsetTop;
while((inputObj = inputObj.offsetParent) != null){
returnValue += inputObj.offsetTop;
}
return returnValue;
}
function colorPickerGetLeftPos(inputObj)
{
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
return returnValue;
}
function cancelColorPickerEvent(){
return false;
}
function showHideColorOptions(e,inputObj)
{
var thisObj = this;
if(inputObj){
var parentNode = inputObj.parentNode;
thisObj = inputObj;
}else var parentNode = this.parentNode;
var activeColorDiv = false;
var subDiv = parentNode.getElementsByTagName('DIV')[0];
counter=0;
var initZIndex = 10;
var contentDiv = document.getElementById('color_picker_content').getElementsByTagName('DIV')[0];
do{
if(subDiv.tagName=='DIV' && subDiv.className!='colorPickerCloseButton'){
if(subDiv==thisObj){
thisObj.className='colorPickerTab_active';
thisObj.style.zIndex = 50;
var img = thisObj.getElementsByTagName('IMG')[0];
img.src = "/alfresco/images/calendar/tab_right_active.gif"
img.src = img.src.replace(/inactive/,'active');
contentDiv.style.display='block';
activeColorDiv = contentDiv;
}else{
subDiv.className = 'colorPickerTab_inactive';
var img = subDiv.getElementsByTagName('IMG')[0];
img.src = "/alfresco/images/calendar/tab_right_inactive.gif";
if(activeColorDiv)
subDiv.style.zIndex = initZIndex - counter;
else
subDiv.style.zIndex = counter;
contentDiv.style.display='none';
}
counter++;
}
subDiv = subDiv.nextSibling;
if(contentDiv.nextSibling)contentDiv = contentDiv.nextSibling;
}while(subDiv);
document.getElementById('colorPicker_statusBarTxt').innerHTML = '&nbsp;';
}
function createColorPickerTopRow(inputObj){
var tabs = ['RGB','Named colors','Color slider'];
var tabWidths = [37,90,70];
var div = document.createElement('DIV');
div.className='colorPicker_topRow';
inputObj.appendChild(div);
var currentWidth = 0;
for(var no=0;no<tabs.length;no++){
var tabDiv = document.createElement('DIV');
tabDiv.onselectstart = cancelColorPickerEvent;
tabDiv.ondragstart = cancelColorPickerEvent;
if(no==0){
suffix = 'active';
color_picker_active_tab = this;
}else suffix = 'inactive';
tabDiv.id = 'colorPickerTab' + no;
tabDiv.onclick = showHideColorOptions;
if(no==0)tabDiv.style.zIndex = 50; else tabDiv.style.zIndex = 1 + (tabs.length-no);
tabDiv.style.left = currentWidth + 'px';
tabDiv.style.position = 'absolute';
tabDiv.className='colorPickerTab_' + suffix;
var tabSpan = document.createElement('SPAN');
tabSpan.innerHTML = tabs[no];
tabDiv.appendChild(tabSpan);
var tabImg = document.createElement('IMG');
tabImg.src = "/alfresco/images/calendar/tab_right_" + suffix + ".gif";
tabDiv.appendChild(tabImg);
div.appendChild(tabDiv);
if(navigatorVersion<6 && MSIE){ /* Lower IE version fix */
tabSpan.style.position = 'relative';
tabImg.style.position = 'relative';
tabImg.style.left = '-3px';
tabDiv.style.cursor = 'hand';
}
currentWidth = currentWidth + tabWidths[no];
}
var closeButton = document.createElement('DIV');
closeButton.className='colorPickerCloseButton';
closeButton.innerHTML = 'x';
closeButton.onclick = closeColorPicker;
closeButton.onmouseover = toggleCloseButton;
closeButton.onmouseout = toggleOffCloseButton;
div.appendChild(closeButton);
}
function toggleCloseButton()
{
this.style.color='#FFF';
this.style.backgroundColor = '#317082';
}
function toggleOffCloseButton()
{
this.style.color='';
this.style.backgroundColor = '';
}
function closeColorPicker()
{
color_picker_div.style.display='none';
}
function createWebColors(inputObj){
var webColorDiv = document.createElement('DIV');
webColorDiv.style.paddingTop = '1px';
inputObj.appendChild(webColorDiv);
for(var r=15;r>=0;r-=3){
for(var g=0;g<=15;g+=3){
for(var b=0;b<=15;b+=3){
var red = baseConverter(r,10,16) + '';
var green = baseConverter(g,10,16) + '';
var blue = baseConverter(b,10,16) + '';
var color = '#' + red + red + green + green + blue + blue;
var div = document.createElement('DIV');
div.style.backgroundColor=color;
div.innerHTML = '<span></span>';
div.className='colorSquare';
div.title = color;
div.onclick = chooseColor;
div.setAttribute('rgbColor',color);
div.onmouseover = colorPickerShowStatusBarText;
div.onmouseout = colorPickerHideStatusBarText;
webColorDiv.appendChild(div);
}
}
}
}
function createNamedColors(inputObj){
var namedColorDiv = document.createElement('DIV');
namedColorDiv.style.paddingTop = '1px';
namedColorDiv.style.display='none';
inputObj.appendChild(namedColorDiv);
for(var no=0;no<namedColors.length;no++){
var color = namedColorRGB[no];
var div = document.createElement('DIV');
div.style.backgroundColor=color;
div.innerHTML = '<span></span>';
div.className='colorSquare';
div.title = namedColors[no];
div.onclick = chooseColor;
div.onmouseover = colorPickerShowStatusBarText;
div.onmouseout = colorPickerHideStatusBarText;
div.setAttribute('rgbColor',color);
namedColorDiv.appendChild(div);
}
}
function colorPickerHideStatusBarText()
{
document.getElementById('colorPicker_statusBarTxt').innerHTML = '&nbsp;';
}
function colorPickerShowStatusBarText()
{
var txt = this.getAttribute('rgbColor');
if(this.title.indexOf('#')<0)txt = txt + " (" + this.title + ")";
document.getElementById('colorPicker_statusBarTxt').innerHTML = txt;
}
function createAllColorDiv(inputObj){
var allColorDiv = document.createElement('DIV');
allColorDiv.style.display='none';
allColorDiv.className = 'js_color_picker_allColorDiv';
allColorDiv.style.paddingLeft = '3px';
allColorDiv.style.paddingTop = '5px';
allColorDiv.style.paddingBottom = '5px';
inputObj.appendChild(allColorDiv);
var labelDiv = document.createElement('DIV');
labelDiv.className='colorSliderLabel';
labelDiv.innerHTML = 'R';
allColorDiv.appendChild(labelDiv);
var innerDiv = document.createElement('DIV');
innerDiv.className = 'colorSlider';
innerDiv.id = 'sliderRedColor';
allColorDiv.appendChild(innerDiv);
var innerDivInput = document.createElement('DIV');
innerDivInput.className='colorInput';
var input = document.createElement('INPUT');
input.id = 'js_color_picker_red_color';
input.maxlength = 3;
input.style.width = '48px';
input.style.fontSize = '11px';
input.name = 'redColor';
input.value = 0;
innerDivInput.appendChild(input);
allColorDiv.appendChild(innerDivInput);
var labelDiv = document.createElement('DIV');
labelDiv.className='colorSliderLabel';
labelDiv.innerHTML = 'G';
allColorDiv.appendChild(labelDiv);
var innerDiv = document.createElement('DIV');
innerDiv.className = 'colorSlider';
innerDiv.id = 'sliderGreenColor';
allColorDiv.appendChild(innerDiv);
var innerDivInput = document.createElement('DIV');
innerDivInput.className='colorInput';
var input = document.createElement('INPUT');
input.id = 'js_color_picker_green_color';
input.maxlength = 3;
input.style.width = '48px';
input.style.fontSize = '11px';
input.name = 'GreenColor';
input.value = 0;
innerDivInput.appendChild(input);
allColorDiv.appendChild(innerDivInput);
var labelDiv = document.createElement('DIV');
labelDiv.className='colorSliderLabel';
labelDiv.innerHTML = 'B';
allColorDiv.appendChild(labelDiv);
var innerDiv = document.createElement('DIV');
innerDiv.className = 'colorSlider';
innerDiv.id = 'sliderBlueColor';
allColorDiv.appendChild(innerDiv);
var innerDivInput = document.createElement('DIV');
innerDivInput.className='colorInput';
var input = document.createElement('INPUT');
input.id = 'js_color_picker_blue_color';
input.maxlength = 3;
input.style.width = '48px';
input.style.fontSize = '11px';
input.name = 'BlueColor';
input.value = 0;
innerDivInput.appendChild(input);
allColorDiv.appendChild(innerDivInput);
var colorPreview = document.createElement('DIV');
colorPreview.className='colorPreviewDiv';
colorPreview.id = 'colorPreview';
colorPreview.style.backgroundColor = '#000000';
colorPreview.innerHTML = '<span></span>';
colorPreview.title = 'Click on me to assign color';
allColorDiv.appendChild(colorPreview);
colorPreview.onclick = chooseColorSlider;
var colorCodeDiv = document.createElement('DIV');
colorCodeDiv.className='colorCodeDiv';
var input = document.createElement('INPUT');
input.id = 'js_color_picker_color_code';
colorCodeDiv.appendChild(input);
input.maxLength = 7;
input.style.fontSize = '11px';
input.style.width = '48px';
input.value = '#000000';
input.onchange = setPreviewColorFromTxt;
input.onblur = setPreviewColorFromTxt;
allColorDiv.appendChild(colorCodeDiv);
var clearingDiv = document.createElement('DIV');
clearingDiv.style.clear = 'both';
allColorDiv.appendChild(clearingDiv);
form_widget_amount_slider('sliderRedColor',document.getElementById('js_color_picker_red_color'),170,0,255,"setColorByRGB()");
form_widget_amount_slider('sliderGreenColor',document.getElementById('js_color_picker_green_color'),170,0,255,"setColorByRGB()");
form_widget_amount_slider('sliderBlueColor',document.getElementById('js_color_picker_blue_color'),170,0,255,"setColorByRGB()");
}
function setPreviewColorFromTxt()
{
if(this.value.match(/\#[0-9A-F]{6}/g)){
document.getElementById('colorPreview').style.backgroundColor=this.value;
var r = this.value.substr(1,2);
var g = this.value.substr(3,2);
var b = this.value.substr(5,2);
document.getElementById('js_color_picker_red_color').value = baseConverter(r,16,10);
document.getElementById('js_color_picker_green_color').value = baseConverter(g,16,10);
document.getElementById('js_color_picker_blue_color').value = baseConverter(b,16,10);
positionSliderImage(false,1,document.getElementById('js_color_picker_red_color'));
positionSliderImage(false,2,document.getElementById('js_color_picker_green_color'));
positionSliderImage(false,3,document.getElementById('js_color_picker_blue_color'));
}
}
function chooseColor()
{
color_picker_form_field.value = this.getAttribute('rgbColor');
color_picker_div.style.display='none';
}
function createStatusBar(inputObj)
{
var div = document.createElement('DIV');
div.className='colorPicker_statusBar';
var innerSpan = document.createElement('SPAN');
innerSpan.id = 'colorPicker_statusBarTxt';
div.appendChild(innerSpan);
inputObj.appendChild(div);
}
function chooseColorSlider()
{
color_picker_form_field.value = document.getElementById('js_color_picker_color_code').value;
color_picker_div.style.display='none';
}
function showColorPicker(inputObj,formField)
{
if(!color_picker_div){
color_picker_div = document.createElement('DIV');
color_picker_div.id = 'dhtmlgoodies_colorPicker';
color_picker_div.style.display='none';
document.body.appendChild(color_picker_div);
createColorPickerTopRow(color_picker_div);
var contentDiv = document.createElement('DIV');
contentDiv.id = 'color_picker_content';
color_picker_div.appendChild(contentDiv);
createWebColors(contentDiv);
createNamedColors(contentDiv);
createAllColorDiv(contentDiv);
createStatusBar(color_picker_div);
}
if(color_picker_div.style.display=='none' || color_picker_active_input!=inputObj)color_picker_div.style.display='block'; else color_picker_div.style.display='none';
color_picker_div.style.left = colorPickerGetLeftPos(inputObj) + 'px';
color_picker_div.style.top = colorPickerGetTopPos(inputObj) + inputObj.offsetHeight + 2 + 'px';
color_picker_form_field = formField;
color_picker_active_input = inputObj;
}
function setColorByRGB()
{
var formObj = document.forms[0];
var r = document.getElementById('js_color_picker_red_color').value.replace(/[^\d]/,'');
var g = document.getElementById('js_color_picker_green_color').value.replace(/[^\d]/,'');
var b = document.getElementById('js_color_picker_blue_color').value.replace(/[^\d]/,'');
if(r/1>255)r=255;
if(g/1>255)g=255;
if(b/1>255)b=255;
r = baseConverter(r,10,16) + '';
g = baseConverter(g,10,16) + '';
b = baseConverter(b,10,16) + '';
if(r.length==1)r = '0' + r;
if(g.length==1)g = '0' + g;
if(b.length==1)b = '0' + b;
document.getElementById('colorPreview').style.backgroundColor = '#' + r + g + b;
document.getElementById('js_color_picker_color_code').value = '#' + r + g + b;
}

View File

@@ -0,0 +1,187 @@
var handleSuccessSaveEvent = function(o)
{
hideSavingIndicator('c');
alert("Calendar updated!");
resetEventDetails();
refreshAllViews();
}
var handleFailureSaveEvent = function(o)
{
hideSavingIndicator('c');
alert("Unable to Save, " + o.statusText);
}
var callbackSaveEvent =
{
success:handleSuccessSaveEvent,
failure:handleFailureSaveEvent,
argument: { foo:"foo", bar:"bar" }
};
function saveCalendarEvent(toDelete)
{
if (!validateEventDetails(toDelete)) return;
showSavingIndicator('c');
var sUrl = getContextPath() + '/wcservice/calendar/SaveCalendarEvent?';
var postData = constructCalendarData(toDelete);
sUrl += postData;
var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackSaveEvent, null);
}
function constructCalendarData(toDelete)
{
var data = "";
data += "s=" + spaceRef;
data += "&";
data += "what=" + document.getElementById("txtWhatEvent").value;
data += "&";
data += "fd=" + document.getElementById("hidFromDate").value;
data += "&";
data += "ft=" + document.getElementById("lstFromTime").value;
data += "&";
data += "td=" + document.getElementById("hidToDate").value;
data += "&";
data += "tt=" + document.getElementById("lstToTime").value;
data += "&";
data += "where=" + document.getElementById("txtWhereEvent").value;
data += "&";
data += "desc=" + document.getElementById("txtDescriptionEvent").value;
data += "&";
data += "color=" + document.getElementById("txtColor").value;
data += "&";
if (toDelete)
{
data += "d=true";
}
else
{
data += "d=false";
}
if (_currentActiveEditingEvent != null)
{
data += "&";
data += "e=" + _currentActiveEditingEvent;
}
return data;
}
function resetEventDetails()
{
document.getElementById("txtWhatEvent").value = defaultCaption;
document.getElementById("hidFromDate").value = defaultFromDateString;
document.getElementById("txtFromDate").value = defaultFromDate.toDateString();
document.getElementById("lstFromTime").value = defaultFromTime;
document.getElementById("hidToDate").value = defaultToDateString;
document.getElementById("txtToDate").value = defaultToDate.toDateString();
document.getElementById("lstToTime").value = defaultToTime;
document.getElementById("txtWhereEvent").value = defaultPlace;
document.getElementById("txtColor").value = defaultColor;
/*document.getElementById("txtWhatEvent").value = "";
document.getElementById("hidFromDate").value = "";
document.getElementById("txtFromDate").value = "";
document.getElementById("lstFromTime").selectedIndex = 0;
document.getElementById("hidToDate").value = "";
document.getElementById("txtToDate").value = "";
document.getElementById("lstToTime").selectedIndex = 0;
document.getElementById("txtWhereEvent").value = "";
document.getElementById("txtDescriptionEvent").value = "";
document.getElementById("txtColor").value = "";*/
document.getElementById("txtWhatEvent").focus();
_currentActiveEditingEvent = null;
}
function validateEventDetails(toDelete)
{
if (toDelete)
if (_currentActiveEditingEvent == null)
{
alert("No Event Currently selected.\rPlease select an Event first from Month/Week/Day view to delete.");
return false;
}
if (trim(document.getElementById("txtWhatEvent").value) == "")
{
alert("Please enter Event Information!");
document.getElementById("txtWhatEvent").focus();
return false;
}
if (!ValidateString(trim(document.getElementById("txtWhatEvent").value)))
{
document.getElementById("txtWhatEvent").focus();
return false;
}
if (trim(document.getElementById("txtFromDate").value) == "")
{
alert("Please select a valid Starting Date!");
document.getElementById("txtFromDate").focus();
return false;
}
if (trim(document.getElementById("txtToDate").value) == "")
{
alert("Please select a valid Ending Date!");
document.getElementById("txtToDate").focus();
return false;
}
if (!ValidateDateSet())
{
alert("Ending Date must be greater than Starting Date!");
document.getElementById("txtToDate").focus();
return false;
}
return true;
}
function ValidateString(dataValue)
{
for(var j=0; j<dataValue.length; j++)
{
var alphaa = dataValue.charAt(j);
var hh = alphaa.charCodeAt(0);
/*
Allowed Characters:
48-57 -> 0-9
64-91 -> A-Z
96-123 -> a-z
32 -> space bar
44 -> ,
59 -> ;
40 -> (
41 -> )
63 -> ?
33 -> !
45 -> -
95 -> _
*/
if((hh>=48 && hh<=57) || (hh>64 && hh<91) || (hh>96 && hh<123) || (hh==32) || (hh==44) || (hh==59) || (hh==40) || (hh==41) || (hh==63) || (hh==33) || (hh==45) || (hh==95))
{
}
else
{
alert("Event Information has some invalid characters.\rAllowed Characters are 0-9 a-z A-Z , ; ( ) ? ! - _");
return false;
}
}
return true;
}
function ValidateDateSet()
{
var fromDate = new Date(document.getElementById("hidFromDate").value);
var fromTime = document.getElementById("lstFromTime").value.split(":");
fromDate.setHours(fromTime[0]);
fromDate.setMinutes(fromTime[1]);
var toDate = new Date(document.getElementById("hidToDate").value);
var toTime = document.getElementById("lstToTime").value.split(":");
toDate.setHours(toTime[0]);
toDate.setMinutes(toTime[1]);
return !(toDate <= fromDate);
}

View File

@@ -0,0 +1,5 @@
.eventCapture, showDayEvents, showWeekEvents, showMonthEvents
{
background-color:#EFF7FF;
}

View File

@@ -0,0 +1,54 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
.yui-navset .yui-nav li a, .yui-navset .yui-content {
border:1px solid #000; /* label and content borders */
}
.yui-navset .yui-nav .selected a, .yui-navset .yui-nav a:hover, .yui-navset .yui-content {
background-color:#f6f7ee; /* active tab, tab hover, and content bgcolor */
}
.yui-navset .yui-nav li em { padding:.5em; } /* tab padding */
/* defaults to orientation "top" */
.yui-navset .yui-nav .selected a {
border-bottom-width:0; /* no bottom border for active tab */
padding-bottom:1px; /* to match height of other tabs */
}
.yui-navset .yui-content {
margin-top:-1px; /* for active tab overlap */
}
/* overrides for other orientations */
.yui-navset-bottom .yui-nav .selected a {
border-width:0 1px 1px; /* no top border for active tab */
padding:1px 0 0; /* to match height of other tabs */
}
.yui-navset-bottom .yui-content {
margin:0 0 -1px; /* for active tab overlap */
}
.yui-navset-left .yui-nav li.selected a {
border-width:1px 0 1px 1px; /* no right border for active tab */
padding:0 1px 0 0; /* to match width of other tabs */
}
.yui-navset-left .yui-content {
margin:0 0 0 -1px; /* for active tab overlap */
}
.yui-navset-right .yui-nav li.selected a {
border-width:1px 1px 1px 0; /* no left border for active tab */
padding:0 0 0 1px; /* to match width of other tabs */
}
.yui-navset-right .yui-content {
margin:0 -1px 0 0; /* for active tab overlap */
}

View File

@@ -0,0 +1,197 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
.yui-calcontainer {
position:relative;
padding:5px;
background-color:#F7F9FB;
border:1px solid #7B9EBD;
float:left;
overflow:hidden;
}
.yui-calcontainer iframe {
position:absolute;
border:none;
margin:0;padding:0;
left:-1px;
top:-1px;
z-index:0;
width:50em;
height:50em;
}
.yui-calcontainer.multi {
padding:0;
}
.yui-calcontainer.multi .groupcal {
padding:5px;
background-color:transparent;
z-index:1;
float:left;
position:relative;
border:none;
}
.yui-calcontainer .title {
font:100% sans-serif;
color:#000;
font-weight:bold;
margin-bottom:5px;
height:25px;
position:absolute;
top:3px;left:5px;
z-index:1;
}
.yui-calcontainer .close-icon {
position:absolute;
right:3px;
top:3px;
border:none;
z-index:1;
}
.yui-calcontainer .calclose {
background: url("calx.gif") no-repeat;
width:17px;
height:13px;
cursor:pointer;
}
/* Calendar element styles */
.yui-calendar {
font:100% sans-serif;
text-align:center;
border-spacing:0;
border-collapse:separate;
position:relative;
}
.yui-calcontainer.withtitle {
padding-top:1.5em;
}
.yui-calendar .calnavleft {
position:absolute;
cursor:pointer;
top:2px;
bottom:0;
width:9px;
height:12px;
left:2px;
z-index:1;
background: url("callt.gif") no-repeat;
}
.yui-calendar .calnavright {
position:absolute;
cursor:pointer;
top:2px;
bottom:0;
width:9px;
height:12px;
right:2px;
z-index:1;
background: url("calrt.gif") no-repeat;
}
.yui-calendar td.calcell {
padding:.1em .2em;
border:1px solid #E0E0E0;
text-align:center;
}
.yui-calendar td.calcell a {
color:#003DB8;
text-decoration:none;
}
.yui-calendar td.calcell.today {
border:1px solid #000;
}
.yui-calendar td.calcell.oom {
cursor:default;
color:#999;
background-color:#EEE;
border:1px solid #E0E0E0;
}
.yui-calendar td.calcell.selected {
color:#003DB8;
background-color:#FFF19F;
border:1px solid #FF9900;
}
.yui-calendar td.calcell.calcellhover {
cursor:pointer;
color:#FFF;
background-color:#FF9900;
border:1px solid #FF9900;
}
.yui-calendar td.calcell.calcellhover a {
color:#FFF;
}
.yui-calendar td.calcell.restricted {
text-decoration:line-through;
}
.yui-calendar td.calcell.previous {
color:#CCC;
}
.yui-calendar td.calcell.highlight1 { background-color:#CCFF99; }
.yui-calendar td.calcell.highlight2 { background-color:#99CCFF; }
.yui-calendar td.calcell.highlight3 { background-color:#FFCCCC; }
.yui-calendar td.calcell.highlight4 { background-color:#CCFF99; }
.yui-calendar .calhead {
border:1px solid #E0E0E0;
vertical-align:middle;
background-color:#FFF;
}
.yui-calendar .calheader {
position:relative;
width:100%;
text-align:center;
}
.yui-calendar .calheader img {
border:none;
}
.yui-calendar .calweekdaycell {
color:#666;
font-weight:normal;
text-align:center;
width:1.5em;
}
.yui-calendar .calfoot {
background-color:#EEE;
}
.yui-calendar .calrowhead, .yui-calendar .calrowfoot {
color:#666;
font-size:9px;
font-style:italic;
font-weight:normal;
width:15px;
}
.yui-calendar .calrowhead {
border-right-width:2px;
}
/* Specific changes for calendar running under fonts/reset */
.yui-calendar .calbody a:hover {background:inherit;}
p#clear {clear:left; padding-top:10px;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

View File

@@ -0,0 +1,76 @@
.yui-navset .yui-content {
border:1px solid #99CCFF;
}
.yui-navset .yui-nav .selected a, .yui-navset .yui-nav a:hover {
background-color:#EFF7FF;
}
.yui-navset .yui-nav li a {
background:#EFF7FF url(../img/round_4px_trans_gray.gif) no-repeat;
}
.yui-navset .yui-nav li a em {
background:transparent url(../img/round_4px_trans_gray.gif) no-repeat top right;
padding:0.5em;
}
/* top oriented */
.yui-navset-top .yui-nav { margin-bottom:-1px; } /* for overlap, based on content border-width */
.yui-navset-top .yui-nav li a {
border-bottom:1px solid #ccc;
}
.yui-navset-top .yui-nav .selected a { border-bottom:0; }
.yui-navset-top .yui-nav .selected a em { padding-bottom:0.6em; } /* adjust height */
/* top & bottom oriented */
.yui-navset-top .yui-nav li a em, .yui-navset-bottom .yui-nav li a em {
margin-left:4px; /* based on border-radius */
padding-right:8px; /* based on border-radius (2x left to balance margin) */
padding-left:4px;
}
/* bottom oriented */
.yui-navset-bottom .yui-nav { margin-top:-1px; } /* for overlap, based on content border-width */
.yui-navset-bottom .yui-nav li a { border-top:1px solid #ccc; }
.yui-navset-bottom .yui-nav .selected a { border-top:0; }
.yui-navset-bottom .yui-nav .selected a em { padding-top:0.6em; } /* adjust height */
.yui-navset-bottom .yui-nav li a { background-position:bottom left; }
.yui-navset-bottom .yui-nav li a em { background-position:bottom right; }
/* left oriented */
.yui-navset-left .yui-content { margin-left:-1px; } /* for overlap, based on content border-width */
.yui-navset-left .yui-nav li a {
border-right:1px solid #ccc;
padding-bottom:4px;
}
.yui-navset-left .yui-nav li a em, .yui-navset-right .yui-nav li a em {
padding-top:8px; /* based on border-radius (2x left to balance margin) */
}
.yui-navset-left .yui-nav .selected a { border-right:0; }
.yui-navset-left .yui-nav .selected a em { padding-left:0.6em; } /* adjust width */
.yui-navset-left .yui-nav li a { background-position:bottom left; }
.yui-navset-left .yui-nav li a em { background-position:top left; }
/* right oriented */
.yui-navset-right .yui-content { margin-right:-1px; } /* for overlap, based on content border-width */
.yui-navset-right .yui-nav li a {
border-left:1px solid #ccc;
padding-bottom:4px;
}
.yui-navset-right .yui-nav .selected a { border-left:0; }
.yui-navset-right .yui-nav .selected a em { padding-left:0.6em; } /* adjust width */
.yui-navset-right .yui-nav li a { background-position:bottom right; }
.yui-navset-right .yui-nav li a em { background-position:top right; }

View File

@@ -0,0 +1,75 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
/* default space between tabs */
.yui-navset .yui-nav li {
margin-right:0.5em; /* horizontal tabs */
}
.yui-navset-left .yui-nav li, .yui-navset-right .yui-nav li {
margin:0 0 0.5em; /* vertical tabs */
}
/* default width for side tabs */
.yui-navset-left .yui-nav, .yui-navset-right .yui-nav { width:6em; }
.yui-navset-left { padding-left:6em; } /* map to nav width */
.yui-navset-right { padding-right:6em; } /* ditto */
/* core */
.yui-nav, .yui-nav li {
margin:0;
padding:0;
list-style:none;
}
.yui-navset li em { font-style:normal; }
.yui-navset {
position:relative; /* contain absolute positioned tabs (left/right) */
zoom:1;
}
.yui-navset .yui-content { zoom:1; }
.yui-navset .yui-nav li {
display:inline-block;
display:-moz-inline-stack;
*display:inline; /* IE */
vertical-align:bottom; /* safari: for overlap */
cursor:pointer; /* gecko: due to -moz-inline-stack on anchor */
zoom:1; /* IE: kill space between horizontal tabs */
}
.yui-navset-left .yui-nav li, .yui-navset-right .yui-nav li {
display:block;
}
.yui-navset .yui-nav a {
outline:0; /* gecko: keep from shifting */
}
.yui-navset .yui-nav a { position:relative; } /* IE: to allow overlap */
.yui-navset .yui-nav li a {
display:block;
display:inline-block;
vertical-align:bottom; /* safari: for overlap */
zoom:1;
}
.yui-navset-left .yui-nav li a, .yui-navset-right .yui-nav li a {
display:block;
}
.yui-navset-bottom .yui-nav li a {
vertical-align:text-top; /* for inline overlap (reverse for Op border bug) */
}
.yui-navset .yui-nav li a em { display:block; }
/* position left and right oriented tabs */
.yui-navset-left .yui-nav, .yui-navset-right .yui-nav { position:absolute; z-index:1; }
.yui-navset-left .yui-nav { left:0; }
.yui-navset-right .yui-nav { right:0; }

4309
source/web/yui/calendar.js vendored Normal file

File diff suppressed because it is too large Load Diff

104
source/web/yui/connection-min.js vendored Normal file
View File

@@ -0,0 +1,104 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_use_default_xhr_header:true,_default_xhr_header:'XMLHttpRequest',_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._use_default_post_header=b;},setDefaultXhrHeader:function(b)
{this._use_default_xhr_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;}
if(method.toUpperCase()=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
else{uri+="?"+this._sFormData;}}
else if(method.toUpperCase()=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
o.conn.open(method,uri,true);if(this._use_default_xhr_header){if(!this._default_headers['X-Requested-With']){this.initHeader('X-Requested-With',this._default_xhr_header,true);}}
if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
if(this._has_default_headers||this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback)
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value,isDefault)
{var headerObj=(isDefault)?this._default_headers:this._http_headers;if(headerObj[label]===undefined){headerObj[label]=value;}
else{headerObj[label]=value+","+headerObj[label];}
if(isDefault){this._has_default_headers=true;}
else{this._has_http_headers=true;}},setHeader:function(o)
{if(this._has_default_headers){for(var prop in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){o.conn.setRequestHeader(prop,this._default_headers[prop]);}}}
if(this._has_http_headers){for(var prop in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){o.conn.setRequestHeader(prop,this._http_headers[prop]);}}
delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers
this._default_headers={};this._has_default_headers=false;},setForm:function(formId,isUpload,secureUri)
{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){oForm=formId;}
else{return;}
if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
else if(typeof secureURI=='string'){io.src=secureUri;}}
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var uploadEncoding='multipart/form-data';var io=document.getElementById(frameId);this._formNode.action=uri;this._formNode.method='POST';this._formNode.target=frameId;if(this._formNode.encoding){this._formNode.encoding=uploadEncoding;}
else{this._formNode.enctype=uploadEncoding;}
if(postData){var oElements=this.appendPostData(postData);}
this._formNode.submit();if(oElements&&oElements.length>0){for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
this.resetFormState();var uploadCallback=function()
{var obj={};obj.tId=id;obj.argument=callback.argument;try
{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
catch(e){}
if(callback&&callback.upload){if(!callback.scope){callback.upload(obj);}
else{callback.upload.apply(callback.scope,[obj]);}}
if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
else{io.removeEventListener('load',uploadCallback,false);}
setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
this.handleTransactionResponse(o,callback,true);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};
YAHOO.register("connection", YAHOO.widget.Module, {version: "2.2.0", build: "127"});

1054
source/web/yui/connection.js vendored Normal file

File diff suppressed because it is too large Load Diff

901
source/web/yui/dom.js vendored Normal file
View File

@@ -0,0 +1,901 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
*/
/**
* The dom module provides helper methods for manipulating Dom elements.
* @module dom
*
*/
(function() {
var Y = YAHOO.util, // internal shorthand
getStyle, // for load time browser branching
setStyle, // ditto
id_counter = 0, // for use with generateId
propertyCache = {}; // for faster hyphen converts
// brower detection
var ua = navigator.userAgent.toLowerCase(),
isOpera = (ua.indexOf('opera') > -1),
isSafari = (ua.indexOf('safari') > -1),
isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
isIE = (!isOpera && ua.indexOf('msie') > -1);
// regex cache
var patterns = {
HYPHEN: /(-[a-z])/i
};
var toCamel = function(property) {
if ( !patterns.HYPHEN.test(property) ) {
return property; // no hyphens
}
if (propertyCache[property]) { // already converted
return propertyCache[property];
}
while( patterns.HYPHEN.exec(property) ) {
property = property.replace(RegExp.$1,
RegExp.$1.substr(1).toUpperCase());
}
propertyCache[property] = property;
return property;
//return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
};
// branching at load instead of runtime
if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
getStyle = function(el, property) {
var value = null;
var computed = document.defaultView.getComputedStyle(el, '');
if (computed) { // test computed before touching for safari
value = computed[toCamel(property)];
}
return el.style[property] || value;
};
} else if (document.documentElement.currentStyle && isIE) { // IE method
getStyle = function(el, property) {
switch( toCamel(property) ) {
case 'opacity' :// IE opacity uses filter
var val = 100;
try { // will error if no DXImageTransform
val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
} catch(e) {
try { // make sure its in the document
val = el.filters('alpha').opacity;
} catch(e) {
}
}
return val / 100;
break;
default:
// test currentStyle before touching
var value = el.currentStyle ? el.currentStyle[property] : null;
return ( el.style[property] || value );
}
};
} else { // default to inline only
getStyle = function(el, property) { return el.style[property]; };
}
if (isIE) {
setStyle = function(el, property, val) {
switch (property) {
case 'opacity':
if ( typeof el.style.filter == 'string' ) { // in case not appended
el.style.filter = 'alpha(opacity=' + val * 100 + ')';
if (!el.currentStyle || !el.currentStyle.hasLayout) {
el.style.zoom = 1; // when no layout or cant tell
}
}
break;
default:
el.style[property] = val;
}
};
} else {
setStyle = function(el, property, val) {
el.style[property] = val;
};
}
/**
* Provides helper methods for DOM elements.
* @namespace YAHOO.util
* @class Dom
*/
YAHOO.util.Dom = {
/**
* Returns an HTMLElement reference.
* @method get
* @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
* @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
*/
get: function(el) {
if (!el) { return null; } // nothing to work with
if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
return el;
}
if (typeof el == 'string') { // ID
return document.getElementById(el);
}
else { // array of ID's and/or elements
var collection = [];
for (var i = 0, len = el.length; i < len; ++i) {
collection[collection.length] = Y.Dom.get(el[i]);
}
return collection;
}
return null; // safety, should never happen
},
/**
* Normalizes currentStyle and ComputedStyle.
* @method getStyle
* @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
* @param {String} property The style property whose value is returned.
* @return {String | Array} The current value of the style property for the element(s).
*/
getStyle: function(el, property) {
property = toCamel(property);
var f = function(element) {
return getStyle(element, property);
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
* @method setStyle
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
* @param {String} property The style property to be set.
* @param {String} val The value to apply to the given property.
*/
setStyle: function(el, property, val) {
property = toCamel(property);
var f = function(element) {
setStyle(element, property, val);
};
Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method getXY
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
* @return {Array} The XY position of the element(s)
*/
getXY: function(el) {
var f = function(el) {
// has to be part of document to have pageXY
if (el.parentNode === null || el.offsetParent === null ||
this.getStyle(el, 'display') == 'none') {
return false;
}
var parentNode = null;
var pos = [];
var box;
if (el.getBoundingClientRect) { // IE
box = el.getBoundingClientRect();
var doc = document;
if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
doc = parent.document;
if ( !this.isAncestor(doc.documentElement, el) ) {
return false;
}
}
var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
return [box.left + scrollLeft, box.top + scrollTop];
}
else { // safari, opera, & gecko
pos = [el.offsetLeft, el.offsetTop];
parentNode = el.offsetParent;
if (parentNode != el) {
while (parentNode) {
pos[0] += parentNode.offsetLeft;
pos[1] += parentNode.offsetTop;
parentNode = parentNode.offsetParent;
}
}
if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
pos[0] -= document.body.offsetLeft;
pos[1] -= document.body.offsetTop;
}
}
if (el.parentNode) { parentNode = el.parentNode; }
else { parentNode = null; }
while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
{ // account for any scrolled ancestors
if (Y.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
pos[0] -= parentNode.scrollLeft;
pos[1] -= parentNode.scrollTop;
}
if (parentNode.parentNode) {
parentNode = parentNode.parentNode;
} else { parentNode = null; }
}
return pos;
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method getX
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
* @return {String | Array} The X position of the element(s)
*/
getX: function(el) {
var f = function(el) {
return Y.Dom.getXY(el)[0];
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method getY
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
* @return {String | Array} The Y position of the element(s)
*/
getY: function(el) {
var f = function(el) {
return Y.Dom.getXY(el)[1];
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Set the position of an html element in page coordinates, regardless of how the element is positioned.
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setXY
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
* @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
* @param {Boolean} noRetry By default we try and set the position a second time if the first fails
*/
setXY: function(el, pos, noRetry) {
var f = function(el) {
var style_pos = this.getStyle(el, 'position');
if (style_pos == 'static') { // default to relative
this.setStyle(el, 'position', 'relative');
style_pos = 'relative';
}
var pageXY = this.getXY(el);
if (pageXY === false) { // has to be part of doc to have pageXY
return false;
}
var delta = [ // assuming pixels; if not we will have to retry
parseInt( this.getStyle(el, 'left'), 10 ),
parseInt( this.getStyle(el, 'top'), 10 )
];
if ( isNaN(delta[0]) ) {// in case of 'auto'
delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
}
if ( isNaN(delta[1]) ) { // in case of 'auto'
delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
}
if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
if (!noRetry) {
var newXY = this.getXY(el);
// if retry is true, try one more time if we miss
if ( (pos[0] !== null && newXY[0] != pos[0]) ||
(pos[1] !== null && newXY[1] != pos[1]) ) {
this.setXY(el, pos, true);
}
}
};
Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Set the X position of an html element in page coordinates, regardless of how the element is positioned.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setX
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
* @param {Int} x The value to use as the X coordinate for the element(s).
*/
setX: function(el, x) {
Y.Dom.setXY(el, [x, null]);
},
/**
* Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setY
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
* @param {Int} x To use as the Y coordinate for the element(s).
*/
setY: function(el, y) {
Y.Dom.setXY(el, [null, y]);
},
/**
* Returns the region position of the given element.
* The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
* @method getRegion
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
* @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
*/
getRegion: function(el) {
var f = function(el) {
var region = new Y.Region.getRegion(el);
return region;
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Returns the width of the client (viewport).
* @method getClientWidth
* @deprecated Now using getViewportWidth. This interface left intact for back compat.
* @return {Int} The width of the viewable area of the page.
*/
getClientWidth: function() {
return Y.Dom.getViewportWidth();
},
/**
* Returns the height of the client (viewport).
* @method getClientHeight
* @deprecated Now using getViewportHeight. This interface left intact for back compat.
* @return {Int} The height of the viewable area of the page.
*/
getClientHeight: function() {
return Y.Dom.getViewportHeight();
},
/**
* Returns a array of HTMLElements with the given class.
* For optimized performance, include a tag and/or root node when possible.
* @method getElementsByClassName
* @param {String} className The class name to match against
* @param {String} tag (optional) The tag name of the elements being collected
* @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
* @return {Array} An array of elements that have the given class name
*/
getElementsByClassName: function(className, tag, root) {
var method = function(el) { return Y.Dom.hasClass(el, className); };
return Y.Dom.getElementsBy(method, tag, root);
},
/**
* Determines whether an HTMLElement has the given className.
* @method hasClass
* @param {String | HTMLElement | Array} el The element or collection to test
* @param {String} className the class name to search for
* @return {Boolean | Array} A boolean value or array of boolean values
*/
hasClass: function(el, className) {
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
var f = function(el) {
return re.test(el['className']);
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Adds a class name to a given element or collection of elements.
* @method addClass
* @param {String | HTMLElement | Array} el The element or collection to add the class to
* @param {String} className the class name to add to the class attribute
*/
addClass: function(el, className) {
var f = function(el) {
if (this.hasClass(el, className)) { return; } // already present
el['className'] = [el['className'], className].join(' ');
};
Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Removes a class name from a given element or collection of elements.
* @method removeClass
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
* @param {String} className the class name to remove from the class attribute
*/
removeClass: function(el, className) {
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
var f = function(el) {
if (!this.hasClass(el, className)) { return; } // not present
var c = el['className'];
el['className'] = c.replace(re, ' ');
if ( this.hasClass(el, className) ) { // in case of multiple adjacent
this.removeClass(el, className);
}
};
Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Replace a class with another class for a given element or collection of elements.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
*/
replaceClass: function(el, oldClassName, newClassName) {
if (oldClassName === newClassName) { // avoid infinite loop
return false;
}
var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
var f = function(el) {
if ( !this.hasClass(el, oldClassName) ) {
this.addClass(el, newClassName); // just add it if nothing to replace
return; // note return
}
el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
this.replaceClass(el, oldClassName, newClassName);
}
};
Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Generates a unique ID
* @method generateId
* @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
* @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
* @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
*/
generateId: function(el, prefix) {
prefix = prefix || 'yui-gen';
el = el || {};
var f = function(el) {
if (el) {
el = Y.Dom.get(el);
} else {
el = {}; // just generating ID in this case
}
if (!el.id) {
el.id = prefix + id_counter++;
} // dont override existing
return el.id;
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
* @method isAncestor
* @param {String | HTMLElement} haystack The possible ancestor
* @param {String | HTMLElement} needle The possible descendent
* @return {Boolean} Whether or not the haystack is an ancestor of needle
*/
isAncestor: function(haystack, needle) {
haystack = Y.Dom.get(haystack);
if (!haystack || !needle) { return false; }
var f = function(needle) {
if (haystack.contains && !isSafari) { // safari "contains" is broken
return haystack.contains(needle);
}
else if ( haystack.compareDocumentPosition ) {
return !!(haystack.compareDocumentPosition(needle) & 16);
}
else { // loop up and test each parent
var parent = needle.parentNode;
while (parent) {
if (parent == haystack) {
return true;
}
else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
return false;
}
parent = parent.parentNode;
}
return false;
}
};
return Y.Dom.batch(needle, f, Y.Dom, true);
},
/**
* Determines whether an HTMLElement is present in the current document.
* @method inDocument
* @param {String | HTMLElement} el The element to search for
* @return {Boolean} Whether or not the element is present in the current document
*/
inDocument: function(el) {
var f = function(el) {
return this.isAncestor(document.documentElement, el);
};
return Y.Dom.batch(el, f, Y.Dom, true);
},
/**
* Returns a array of HTMLElements that pass the test applied by supplied boolean method.
* For optimized performance, include a tag and/or root node when possible.
* @method getElementsBy
* @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
* @param {String} tag (optional) The tag name of the elements being collected
* @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
* @return {Array} Array of HTMLElements
*/
getElementsBy: function(method, tag, root) {
tag = tag || '*';
var nodes = [];
if (root) {
root = Y.Dom.get(root);
if (!root) { // if no root node, then no children
return nodes;
}
} else {
root = document;
}
var elements = root.getElementsByTagName(tag);
if ( !elements.length && (tag == '*' && root.all) ) {
elements = root.all; // IE < 6
}
for (var i = 0, len = elements.length; i < len; ++i) {
if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
}
return nodes;
},
/**
* Returns an array of elements that have had the supplied method applied.
* The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
* @method batch
* @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
* @param {Function} method The method to apply to the element(s)
* @param {Any} o (optional) An optional arg that is passed to the supplied method
* @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
* @return {HTMLElement | Array} The element(s) with the method applied
*/
batch: function(el, method, o, override) {
var id = el;
el = Y.Dom.get(el);
var scope = (override) ? o : window;
if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
if (!el) {
return false;
}
return method.call(scope, el, o);
}
var collection = [];
for (var i = 0, len = el.length; i < len; ++i) {
if (!el[i]) {
id = el[i];
}
collection[collection.length] = method.call(scope, el[i], o);
}
return collection;
},
/**
* Returns the height of the document.
* @method getDocumentHeight
* @return {Int} The height of the actual document (which includes the body and its margin).
*/
getDocumentHeight: function() {
var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
return h;
},
/**
* Returns the width of the document.
* @method getDocumentWidth
* @return {Int} The width of the actual document (which includes the body and its margin).
*/
getDocumentWidth: function() {
var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
return w;
},
/**
* Returns the current height of the viewport.
* @method getViewportHeight
* @return {Int} The height of the viewable area of the page (excludes scrollbars).
*/
getViewportHeight: function() {
var height = self.innerHeight; // Safari, Opera
var mode = document.compatMode;
if ( (mode || isIE) && !isOpera ) { // IE, Gecko
height = (mode == 'CSS1Compat') ?
document.documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
return height;
},
/**
* Returns the current width of the viewport.
* @method getViewportWidth
* @return {Int} The width of the viewable area of the page (excludes scrollbars).
*/
getViewportWidth: function() {
var width = self.innerWidth; // Safari
var mode = document.compatMode;
if (mode || isIE) { // IE, Gecko, Opera
width = (mode == 'CSS1Compat') ?
document.documentElement.clientWidth : // Standards
document.body.clientWidth; // Quirks
}
return width;
}
};
})();
/**
* A region is a representation of an object on a grid. It is defined
* by the top, right, bottom, left extents, so is rectangular by default. If
* other shapes are required, this class could be extended to support it.
* @namespace YAHOO.util
* @class Region
* @param {Int} t the top extent
* @param {Int} r the right extent
* @param {Int} b the bottom extent
* @param {Int} l the left extent
* @constructor
*/
YAHOO.util.Region = function(t, r, b, l) {
/**
* The region's top extent
* @property top
* @type Int
*/
this.top = t;
/**
* The region's top extent as index, for symmetry with set/getXY
* @property 1
* @type Int
*/
this[1] = t;
/**
* The region's right extent
* @property right
* @type int
*/
this.right = r;
/**
* The region's bottom extent
* @property bottom
* @type Int
*/
this.bottom = b;
/**
* The region's left extent
* @property left
* @type Int
*/
this.left = l;
/**
* The region's left extent as index, for symmetry with set/getXY
* @property 0
* @type Int
*/
this[0] = l;
};
/**
* Returns true if this region contains the region passed in
* @method contains
* @param {Region} region The region to evaluate
* @return {Boolean} True if the region is contained with this region,
* else false
*/
YAHOO.util.Region.prototype.contains = function(region) {
return ( region.left >= this.left &&
region.right <= this.right &&
region.top >= this.top &&
region.bottom <= this.bottom );
};
/**
* Returns the area of the region
* @method getArea
* @return {Int} the region's area
*/
YAHOO.util.Region.prototype.getArea = function() {
return ( (this.bottom - this.top) * (this.right - this.left) );
};
/**
* Returns the region where the passed in region overlaps with this one
* @method intersect
* @param {Region} region The region that intersects
* @return {Region} The overlap region, or null if there is no overlap
*/
YAHOO.util.Region.prototype.intersect = function(region) {
var t = Math.max( this.top, region.top );
var r = Math.min( this.right, region.right );
var b = Math.min( this.bottom, region.bottom );
var l = Math.max( this.left, region.left );
if (b >= t && r >= l) {
return new YAHOO.util.Region(t, r, b, l);
} else {
return null;
}
};
/**
* Returns the region representing the smallest region that can contain both
* the passed in region and this region.
* @method union
* @param {Region} region The region that to create the union with
* @return {Region} The union region
*/
YAHOO.util.Region.prototype.union = function(region) {
var t = Math.min( this.top, region.top );
var r = Math.max( this.right, region.right );
var b = Math.max( this.bottom, region.bottom );
var l = Math.min( this.left, region.left );
return new YAHOO.util.Region(t, r, b, l);
};
/**
* toString
* @method toString
* @return string the region properties
*/
YAHOO.util.Region.prototype.toString = function() {
return ( "Region {" +
"top: " + this.top +
", right: " + this.right +
", bottom: " + this.bottom +
", left: " + this.left +
"}" );
};
/**
* Returns a region that is occupied by the DOM element
* @method getRegion
* @param {HTMLElement} el The element
* @return {Region} The region that the element occupies
* @static
*/
YAHOO.util.Region.getRegion = function(el) {
var p = YAHOO.util.Dom.getXY(el);
var t = p[1];
var r = p[0] + el.offsetWidth;
var b = p[1] + el.offsetHeight;
var l = p[0];
return new YAHOO.util.Region(t, r, b, l);
};
/////////////////////////////////////////////////////////////////////////////
/**
* A point is a region that is special in that it represents a single point on
* the grid.
* @namespace YAHOO.util
* @class Point
* @param {Int} x The X position of the point
* @param {Int} y The Y position of the point
* @constructor
* @extends YAHOO.util.Region
*/
YAHOO.util.Point = function(x, y) {
if (x instanceof Array) { // accept output from Dom.getXY
y = x[1];
x = x[0];
}
/**
* The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
* @property x
* @type Int
*/
this.x = this.right = this.left = this[0] = x;
/**
* The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
* @property y
* @type Int
*/
this.y = this.top = this.bottom = this[1] = y;
};
YAHOO.util.Point.prototype = new YAHOO.util.Region();
YAHOO.register("dom", YAHOO.util.Dom, {version: "2.2.0", build: "127"});

896
source/web/yui/element-beta.js vendored Normal file
View File

@@ -0,0 +1,896 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
/**
* Provides Attribute configurations.
* @namespace YAHOO.util
* @class Attribute
* @constructor
* @param hash {Object} The intial Attribute.
* @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
*/
YAHOO.util.Attribute = function(hash, owner) {
if (owner) {
this.owner = owner;
this.configure(hash, true);
}
};
YAHOO.util.Attribute.prototype = {
/**
* The name of the attribute.
* @property name
* @type String
*/
name: undefined,
/**
* The value of the attribute.
* @property value
* @type String
*/
value: null,
/**
* The owner of the attribute.
* @property owner
* @type YAHOO.util.AttributeProvider
*/
owner: null,
/**
* Whether or not the attribute is read only.
* @property readOnly
* @type Boolean
*/
readOnly: false,
/**
* Whether or not the attribute can only be written once.
* @property writeOnce
* @type Boolean
*/
writeOnce: false,
/**
* The attribute's initial configuration.
* @private
* @property _initialConfig
* @type Object
*/
_initialConfig: null,
/**
* Whether or not the attribute's value has been set.
* @private
* @property _written
* @type Boolean
*/
_written: false,
/**
* The method to use when setting the attribute's value.
* The method recieves the new value as the only argument.
* @property method
* @type Function
*/
method: null,
/**
* The validator to use when setting the attribute's value.
* @property validator
* @type Function
* @return Boolean
*/
validator: null,
/**
* Retrieves the current value of the attribute.
* @method getValue
* @return {any} The current value of the attribute.
*/
getValue: function() {
return this.value;
},
/**
* Sets the value of the attribute and fires beforeChange and change events.
* @method setValue
* @param {Any} value The value to apply to the attribute.
* @param {Boolean} silent If true the change events will not be fired.
* @return {Boolean} Whether or not the value was set.
*/
setValue: function(value, silent) {
var beforeRetVal;
var owner = this.owner;
var name = this.name;
var event = {
type: name,
prevValue: this.getValue(),
newValue: value
};
if (this.readOnly || ( this.writeOnce && this._written) ) {
return false; // write not allowed
}
if (this.validator && !this.validator.call(owner, value) ) {
return false; // invalid value
}
if (!silent) {
beforeRetVal = owner.fireBeforeChangeEvent(event);
if (beforeRetVal === false) {
return false;
}
}
if (this.method) {
this.method.call(owner, value);
}
this.value = value;
this._written = true;
event.type = name;
if (!silent) {
this.owner.fireChangeEvent(event);
}
return true;
},
/**
* Allows for configuring the Attribute's properties.
* @method configure
* @param {Object} map A key-value map of Attribute properties.
* @param {Boolean} init Whether or not this should become the initial config.
*/
configure: function(map, init) {
map = map || {};
this._written = false; // reset writeOnce
this._initialConfig = this._initialConfig || {};
for (var key in map) {
if ( key && YAHOO.lang.hasOwnProperty(map, key) ) {
this[key] = map[key];
if (init) {
this._initialConfig[key] = map[key];
}
}
}
},
/**
* Resets the value to the initial config value.
* @method resetValue
* @return {Boolean} Whether or not the value was set.
*/
resetValue: function() {
return this.setValue(this._initialConfig.value);
},
/**
* Resets the attribute config to the initial config state.
* @method resetConfig
*/
resetConfig: function() {
this.configure(this._initialConfig);
},
/**
* Resets the value to the current value.
* Useful when values may have gotten out of sync with actual properties.
* @method refresh
* @return {Boolean} Whether or not the value was set.
*/
refresh: function(silent) {
this.setValue(this.value, silent);
}
};
(function() {
var Lang = YAHOO.util.Lang;
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
*/
/**
* Provides and manages YAHOO.util.Attribute instances
* @namespace YAHOO.util
* @class AttributeProvider
* @uses YAHOO.util.EventProvider
*/
YAHOO.util.AttributeProvider = function() {};
YAHOO.util.AttributeProvider.prototype = {
/**
* A key-value map of Attribute configurations
* @property _configs
* @protected (may be used by subclasses and augmentors)
* @private
* @type {Object}
*/
_configs: null,
/**
* Returns the current value of the attribute.
* @method get
* @param {String} key The attribute whose value will be returned.
*/
get: function(key){
var configs = this._configs || {};
var config = configs[key];
if (!config) {
return undefined;
}
return config.value;
},
/**
* Sets the value of a config.
* @method set
* @param {String} key The name of the attribute
* @param {Any} value The value to apply to the attribute
* @param {Boolean} silent Whether or not to suppress change events
* @return {Boolean} Whether or not the value was set.
*/
set: function(key, value, silent){
var configs = this._configs || {};
var config = configs[key];
if (!config) {
return false;
}
return config.setValue(value, silent);
},
/**
* Returns an array of attribute names.
* @method getAttributeKeys
* @return {Array} An array of attribute names.
*/
getAttributeKeys: function(){
var configs = this._configs;
var keys = [];
var config;
for (var key in configs) {
config = configs[key];
if ( Lang.hasOwnProperty(configs, key) &&
!Lang.isUndefined(config) ) {
keys[keys.length] = key;
}
}
return keys;
},
/**
* Sets multiple attribute values.
* @method setAttributes
* @param {Object} map A key-value map of attributes
* @param {Boolean} silent Whether or not to suppress change events
*/
setAttributes: function(map, silent){
for (var key in map) {
if ( Lang.hasOwnProperty(map, key) ) {
this.set(key, map[key], silent);
}
}
},
/**
* Resets the specified attribute's value to its initial value.
* @method resetValue
* @param {String} key The name of the attribute
* @param {Boolean} silent Whether or not to suppress change events
* @return {Boolean} Whether or not the value was set
*/
resetValue: function(key, silent){
var configs = this._configs || {};
if (configs[key]) {
this.set(key, configs[key]._initialConfig.value, silent);
return true;
}
return false;
},
/**
* Sets the attribute's value to its current value.
* @method refresh
* @param {String | Array} key The attribute(s) to refresh
* @param {Boolean} silent Whether or not to suppress change events
*/
refresh: function(key, silent){
var configs = this._configs;
key = ( ( Lang.isString(key) ) ? [key] : key ) ||
this.getAttributeKeys();
for (var i = 0, len = key.length; i < len; ++i) {
if ( // only set if there is a value and not null
configs[key[i]] &&
! Lang.isUndefined(configs[key[i]].value) &&
! Lang.isNull(configs[key[i]].value) ) {
configs[key[i]].refresh(silent);
}
}
},
/**
* Adds an Attribute to the AttributeProvider instance.
* @method register
* @param {String} key The attribute's name
* @param {Object} map A key-value map containing the
* attribute's properties.
* @deprecated Use setAttributeConfig
*/
register: function(key, map) {
this.setAttributeConfig(key, map);
},
/**
* Returns the attribute's properties.
* @method getAttributeConfig
* @param {String} key The attribute's name
* @private
* @return {object} A key-value map containing all of the
* attribute's properties.
*/
getAttributeConfig: function(key) {
var configs = this._configs || {};
var config = configs[key] || {};
var map = {}; // returning a copy to prevent overrides
for (key in config) {
if ( Lang.hasOwnProperty(config, key) ) {
map[key] = config[key];
}
}
return map;
},
/**
* Sets or updates an Attribute instance's properties.
* @method setAttributeConfig
* @param {String} key The attribute's name.
* @param {Object} map A key-value map of attribute properties
* @param {Boolean} init Whether or not this should become the intial config.
*/
setAttributeConfig: function(key, map, init) {
var configs = this._configs || {};
map = map || {};
if (!configs[key]) {
map.name = key;
configs[key] = new YAHOO.util.Attribute(map, this);
} else {
configs[key].configure(map, init);
}
},
/**
* Sets or updates an Attribute instance's properties.
* @method configureAttribute
* @param {String} key The attribute's name.
* @param {Object} map A key-value map of attribute properties
* @param {Boolean} init Whether or not this should become the intial config.
*/
configureAttribute: function(key, map, init) {
this.setAttributeConfig(key, map, init);
},
/**
* Resets an attribute to its intial configuration.
* @method resetAttributeConfig
* @param {String} key The attribute's name.
* @private
*/
resetAttributeConfig: function(key){
var configs = this._configs || {};
configs[key].resetConfig();
},
/**
* Fires the attribute's beforeChange event.
* @method fireBeforeChangeEvent
* @param {String} key The attribute's name.
* @param {Obj} e The event object to pass to handlers.
*/
fireBeforeChangeEvent: function(e) {
var type = 'before';
type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
e.type = type;
return this.fireEvent(e.type, e);
},
/**
* Fires the attribute's change event.
* @method fireChangeEvent
* @param {String} key The attribute's name.
* @param {Obj} e The event object to pass to the handlers.
*/
fireChangeEvent: function(e) {
e.type += 'Change';
return this.fireEvent(e.type, e);
}
};
YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
})();
(function() {
// internal shorthand
var Dom = YAHOO.util.Dom,
EventPublisher = YAHOO.util.EventPublisher,
AttributeProvider = YAHOO.util.AttributeProvider;
/**
* Element provides an wrapper object to simplify adding
* event listeners, using dom methods, and managing attributes.
* @module element
* @namespace YAHOO.util
* @requires yahoo, dom, event
* @beta
*/
/**
* Element provides an wrapper object to simplify adding
* event listeners, using dom methods, and managing attributes.
* @class Element
* @uses YAHOO.util.AttributeProvider
* @constructor
* @param el {HTMLElement | String} The html element that
* represents the Element.
* @param {Object} map A key-value map of initial config names and values
*/
YAHOO.util.Element = function(el, map) {
if (arguments.length) {
this.init(el, map);
}
};
YAHOO.util.Element.prototype = {
/**
* Dom events supported by the Element instance.
* @property DOM_EVENTS
* @type Object
*/
DOM_EVENTS: null,
/**
* Wrapper for HTMLElement method.
* @method appendChild
* @param {Boolean} deep Whether or not to do a deep clone
*/
appendChild: function(child) {
child = child.get ? child.get('element') : child;
this.get('element').appendChild(child);
},
/**
* Wrapper for HTMLElement method.
* @method getElementsByTagName
* @param {String} tag The tagName to collect
*/
getElementsByTagName: function(tag) {
return this.get('element').getElementsByTagName(tag);
},
/**
* Wrapper for HTMLElement method.
* @method hasChildNodes
* @return {Boolean} Whether or not the element has childNodes
*/
hasChildNodes: function() {
return this.get('element').hasChildNodes();
},
/**
* Wrapper for HTMLElement method.
* @method insertBefore
* @param {HTMLElement} element The HTMLElement to insert
* @param {HTMLElement} before The HTMLElement to insert
* the element before.
*/
insertBefore: function(element, before) {
element = element.get ? element.get('element') : element;
before = (before && before.get) ? before.get('element') : before;
this.get('element').insertBefore(element, before);
},
/**
* Wrapper for HTMLElement method.
* @method removeChild
* @param {HTMLElement} child The HTMLElement to remove
*/
removeChild: function(child) {
child = child.get ? child.get('element') : child;
this.get('element').removeChild(child);
return true;
},
/**
* Wrapper for HTMLElement method.
* @method replaceChild
* @param {HTMLElement} newNode The HTMLElement to insert
* @param {HTMLElement} oldNode The HTMLElement to replace
*/
replaceChild: function(newNode, oldNode) {
newNode = newNode.get ? newNode.get('element') : newNode;
oldNode = oldNode.get ? oldNode.get('element') : oldNode;
return this.get('element').replaceChild(newNode, oldNode);
},
/**
* Registers Element specific attributes.
* @method initAttributes
* @param {Object} map A key-value map of initial attribute configs
*/
initAttributes: function(map) {
map = map || {};
var element = Dom.get(map.element) || null;
/**
* The HTMLElement the Element instance refers to.
* @config element
* @type HTMLElement
*/
this.setAttributeConfig('element', {
value: element,
readOnly: true
});
},
/**
* Adds a listener for the given event. These may be DOM or
* customEvent listeners. Any event that is fired via fireEvent
* can be listened for. All handlers receive an event object.
* @method addListener
* @param {String} type The name of the event to listen for
* @param {Function} fn The handler to call when the event fires
* @param {Any} obj A variable to pass to the handler
* @param {Object} scope The object to use for the scope of the handler
*/
addListener: function(type, fn, obj, scope) {
var el = this.get('element');
var scope = scope || this;
el = this.get('id') || el;
if (!this._events[type]) { // create on the fly
if ( this.DOM_EVENTS[type] ) {
YAHOO.util.Event.addListener(el, type, function(e) {
if (e.srcElement && !e.target) { // supplement IE with target
e.target = e.srcElement;
}
this.fireEvent(type, e);
}, obj, scope);
}
this.createEvent(type, this);
this._events[type] = true;
}
this.subscribe.apply(this, arguments); // notify via customEvent
},
/**
* Alias for addListener
* @method on
* @param {String} type The name of the event to listen for
* @param {Function} fn The function call when the event fires
* @param {Any} obj A variable to pass to the handler
* @param {Object} scope The object to use for the scope of the handler
*/
on: function() { this.addListener.apply(this, arguments); },
/**
* Remove an event listener
* @method removeListener
* @param {String} type The name of the event to listen for
* @param {Function} fn The function call when the event fires
*/
removeListener: function(type, fn) {
this.unsubscribe.apply(this, arguments);
},
/**
* Wrapper for Dom method.
* @method addClass
* @param {String} className The className to add
*/
addClass: function(className) {
Dom.addClass(this.get('element'), className);
},
/**
* Wrapper for Dom method.
* @method getElementsByClassName
* @param {String} className The className to collect
* @param {String} tag (optional) The tag to use in
* conjunction with class name
* @return {Array} Array of HTMLElements
*/
getElementsByClassName: function(className, tag) {
return Dom.getElementsByClassName(className, tag,
this.get('element') );
},
/**
* Wrapper for Dom method.
* @method hasClass
* @param {String} className The className to add
* @return {Boolean} Whether or not the element has the class name
*/
hasClass: function(className) {
return Dom.hasClass(this.get('element'), className);
},
/**
* Wrapper for Dom method.
* @method removeClass
* @param {String} className The className to remove
*/
removeClass: function(className) {
return Dom.removeClass(this.get('element'), className);
},
/**
* Wrapper for Dom method.
* @method replaceClass
* @param {String} oldClassName The className to replace
* @param {String} newClassName The className to add
*/
replaceClass: function(oldClassName, newClassName) {
return Dom.replaceClass(this.get('element'),
oldClassName, newClassName);
},
/**
* Wrapper for Dom method.
* @method setStyle
* @param {String} property The style property to set
* @param {String} value The value to apply to the style property
*/
setStyle: function(property, value) {
var el = this.get('element');
if (!el) {
this._queue[this._queue.length] = ['setStyle', arguments];
return false;
}
return Dom.setStyle(this.get('element'), property, value);
},
/**
* Wrapper for Dom method.
* @method getStyle
* @param {String} property The style property to retrieve
* @return {String} The current value of the property
*/
getStyle: function(property) {
return Dom.getStyle(this.get('element'), property);
},
/**
* Apply any queued set calls.
* @method fireQueue
*/
fireQueue: function() {
var queue = this._queue;
for (var i = 0, len = queue.length; i < len; ++i) {
this[queue[i][0]].apply(this, queue[i][1]);
}
},
/**
* Appends the HTMLElement into either the supplied parentNode.
* @method appendTo
* @param {HTMLElement | Element} parentNode The node to append to
* @param {HTMLElement | Element} before An optional node to insert before
*/
appendTo: function(parent, before) {
parent = (parent.get) ? parent.get('element') : Dom.get(parent);
this.fireEvent('beforeAppendTo', {
type: 'beforeAppendTo',
target: parent
});
before = (before && before.get) ?
before.get('element') : Dom.get(before);
var element = this.get('element');
if (!element) {
return false;
}
if (!parent) {
return false;
}
if (element.parent != parent) {
if (before) {
parent.insertBefore(element, before);
} else {
parent.appendChild(element);
}
}
this.fireEvent('appendTo', {
type: 'appendTo',
target: parent
});
},
get: function(key) {
var configs = this._configs || {};
var el = configs.element; // avoid loop due to 'element'
if (el && !configs[key] && !YAHOO.lang.isUndefined(el.value[key]) ) {
return el.value[key];
}
return AttributeProvider.prototype.get.call(this, key);
},
set: function(key, value, silent) {
var el = this.get('element');
if (!el) {
this._queue[this._queue.length] = ['set', arguments];
if (this._configs[key]) {
this._configs[key].value = value; // so "get" works while queueing
}
return;
}
// set it on the element if not configured and is an HTML attribute
if ( !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
_registerHTMLAttr.call(this, key);
}
return AttributeProvider.prototype.set.apply(this, arguments);
},
setAttributeConfig: function(key, map, init) {
var el = this.get('element');
if (el && !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
_registerHTMLAttr.call(this, key, map);
} else {
AttributeProvider.prototype.setAttributeConfig.apply(this, arguments);
}
},
getAttributeKeys: function() {
var el = this.get('element');
var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
//add any unconfigured element keys
for (var key in el) {
if (!this._configs[key]) {
keys[key] = keys[key] || el[key];
}
}
return keys;
},
init: function(el, attr) {
this._queue = this._queue || [];
this._events = this._events || {};
this._configs = this._configs || {};
attr = attr || {};
attr.element = attr.element || el || null;
this.DOM_EVENTS = {
'click': true,
'keydown': true,
'keypress': true,
'keyup': true,
'mousedown': true,
'mousemove': true,
'mouseout': true,
'mouseover': true,
'mouseup': true
};
var readyHandler = function() {
this.initAttributes(attr);
this.setAttributes(attr, true);
this.fireQueue();
this.fireEvent('contentReady', {
type: 'contentReady',
target: attr.element
});
};
if ( YAHOO.lang.isString(el) ) {
_registerHTMLAttr.call(this, 'id', { value: el });
YAHOO.util.Event.onAvailable(el, function() {
attr.element = Dom.get(el);
this.fireEvent('available', {
type: 'available',
target: attr.element
});
}, this, true);
YAHOO.util.Event.onContentReady(el, function() {
readyHandler.call(this);
}, this, true);
} else {
readyHandler.call(this);
}
}
};
/**
* Sets the value of the property and fires beforeChange and change events.
* @private
* @method _registerHTMLAttr
* @param {YAHOO.util.Element} element The Element instance to
* register the config to.
* @param {String} key The name of the config to register
* @param {Object} map A key-value map of the config's params
*/
var _registerHTMLAttr = function(key, map) {
var el = this.get('element');
map = map || {};
map.name = key;
map.method = map.method || function(value) {
el[key] = value;
};
map.value = map.value || el[key];
this._configs[key] = new YAHOO.util.Attribute(map, this);
};
/**
* Fires when the Element's HTMLElement can be retrieved by Id.
* <p>See: <a href="#addListener">Element.addListener</a></p>
* <p><strong>Event fields:</strong><br>
* <code>&lt;String&gt; type</code> available<br>
* <code>&lt;HTMLElement&gt;
* target</code> the HTMLElement bound to this Element instance<br>
* <p><strong>Usage:</strong><br>
* <code>var handler = function(e) {var target = e.target};<br>
* myTabs.addListener('available', handler);</code></p>
* @event available
*/
/**
* Fires when the Element's HTMLElement subtree is rendered.
* <p>See: <a href="#addListener">Element.addListener</a></p>
* <p><strong>Event fields:</strong><br>
* <code>&lt;String&gt; type</code> contentReady<br>
* <code>&lt;HTMLElement&gt;
* target</code> the HTMLElement bound to this Element instance<br>
* <p><strong>Usage:</strong><br>
* <code>var handler = function(e) {var target = e.target};<br>
* myTabs.addListener('contentReady', handler);</code></p>
* @event contentReady
*/
YAHOO.augment(YAHOO.util.Element, AttributeProvider);
})();
YAHOO.register("element", YAHOO.util.Element, {version: "2.2.0", build: "127"});

84
source/web/yui/event-min.js vendored Normal file
View File

@@ -0,0 +1,84 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var lastError=null;return{POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/KHTML/gi).test(navigator.userAgent),webkit:function(){var v=navigator.userAgent.match(/AppleWebKit\/([^ ]*)/);if(v&&v[1]){return v[1];}
return null;}(),isIE:(!this.webkit&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;}
if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;}
return ok;}else if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}}
if(!el){return false;}
if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;}
var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}}
return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}}
return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);}
return ok;}
if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners.splice(i,1);return true;}}
return false;}
var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);}
if(index>=0){cacheItem=listeners[index];}
if(!el||!cacheItem){return false;}
if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist.splice(i,1);break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}}
delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners.splice(index,1);return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
c=c.caller;}}
return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
return id;},_isValidCollection:function(o){return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){loadComplete=true;var EU=YAHOO.util.Event;if(this.isIE){EU._simpleRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}
this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);}
var notAvail=[];for(var i=0,len=onAvailStack.length;i<len;++i){var item=onAvailStack[i];if(item){var el=this.getEl(item.id);if(el){if(!item.checkReady||loadComplete||el.nextSibling||(document&&document.body)){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
item.fn.call(scope,item.obj);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn);}}
if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}
unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}
j=j-1;}
l=null;EU.clearCache();}
for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;}
legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(document&&document.body){EU._load();}else{EU._simpleAdd(window,"load",EU._load);}
EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}
YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}
var args=[],ret=true,i;for(i=0;i<arguments.length;++i){args.push(arguments[i]);}
var argslength=args.length;if(!this.silent){}
for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}
var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);}
if(false===ret){if(!this.silent){}
return false;}}}
return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}
return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
this.subscribers.splice(index,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=obj||null;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}else{return false;}},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=opts.silent||null;var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
if(!keyData.alt){keyData.alt=false;}
if(!keyData.ctrl){keyData.ctrl=false;}
if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.2.0",build:"127"});

2054
source/web/yui/event.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
Version: 0.10.0
*/
body {
margin:0;
font:small arial;
}
#doc {
margin:10px;
}
ul, li {
list-style:none;
}
form, p, ul, li, h1, h2, h3, h4, h5, h6 {
margin:0;
padding:0;
}
p {
padding:1em 0;
}
h1 {
color:#666;
font:bold 150% palatino, georgia;
}
h2 {
font:bold 130% arial;
margin:1em 0 0.5em;
}
#hd img {
vertical-align:middle;
}
#hd h1 {
display:inline;
margin:0 0 0 20px;
vertical-align:middle;
}
#examples li {
padding:0.5em 1em;
}

29
source/web/yui/fonts.css Normal file
View File

@@ -0,0 +1,29 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
/**
* Percents could work for IE, but for backCompat purposes, we are using keywords.
* x-small is for IE6/7 quirks mode.
*
*/
body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
table {font-size:inherit;font:100%;}
/**
* 99% for safari; 100% is too large
*/
select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
/**
* Bump up !IE to get to 13px equivalent
*/
pre, code {font:115% monospace;*font-size:100%;}
/**
* Default line-height based on font-size rather than "computed-value"
* see: http://www.w3.org/TR/CSS21/visudet.html#line-height
*/
body * {line-height:1.22em;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
source/web/yui/img/next.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

BIN
source/web/yui/img/now.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
source/web/yui/img/prev.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

15
source/web/yui/reset.css Normal file
View File

@@ -0,0 +1,15 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;}
fieldset,img{border:0;}
address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
ol,ul {list-style:none;}
caption,th {text-align:left;}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
q:before,q:after{content:'';}
abbr,acronym {border:0;}

1021
source/web/yui/tabview.js vendored Normal file

File diff suppressed because it is too large Load Diff

15
source/web/yui/yahoo-min.js vendored Normal file
View File

@@ -0,0 +1,15 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
if(typeof YAHOO=="undefined"){var YAHOO={};}
YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.init=function(){this.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
if(unique){ls.push(l);}}}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[],getVersion:function(name){return YAHOO.env.modules[name]||null;}};YAHOO.lang={isArray:function(obj){if(obj.constructor&&obj.constructor.toString().indexOf('Array')>-1){return true;}else{return YAHOO.lang.isObject(obj)&&obj.constructor==Array;}},isBoolean:function(obj){return typeof obj=='boolean';},isFunction:function(obj){return typeof obj=='function';},isNull:function(obj){return obj===null;},isNumber:function(obj){return typeof obj=='number'&&isFinite(obj);},isObject:function(obj){return typeof obj=='object'||YAHOO.lang.isFunction(obj);},isString:function(obj){return typeof obj=='string';},isUndefined:function(obj){return typeof obj=='undefined';},hasOwnProperty:function(obj,prop){if(Object.prototype.hasOwnProperty){return obj.hasOwnProperty(prop);}
return!YAHOO.lang.isUndefined(obj[prop])&&obj.constructor.prototype[prop]!==obj[prop];},extend:function(subc,superc,overrides){var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];}}},augment:function(r,s){var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;i=i+1){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}}};YAHOO.init();YAHOO.util.Lang=YAHOO.lang;YAHOO.augment=YAHOO.lang.augment;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.2.0",build:"127"});

433
source/web/yui/yahoo.js vendored Normal file
View File

@@ -0,0 +1,433 @@
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
/**
* The YAHOO object is the single global object used by YUI Library. It
* contains utility function for setting up namespaces, inheritance, and
* logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
* created automatically for and used by the library.
* @module yahoo
* @title YAHOO Global
*/
/**
* YAHOO_config is not included part of the library. Instead it is an object
* that can be defined by the implementer immediately before including the
* YUI library. The properties included in this object will be used to
* configure global properties needed as soon as the library begins to load.
* @class YAHOO_config
* @static
*/
/**
* A reference to a function that will be executed every time a YAHOO module
* is loaded. As parameter, this function will receive the version
* information for the module. See <a href="YAHOO.env.html#getVersion">
* YAHOO.env.getVersion</a> for the description of the version data structure.
* @property listener
* @static
*/
if (typeof YAHOO == "undefined") {
/**
* The YAHOO global namespace object. If YAHOO is already defined, the
* existing YAHOO object will not be overwritten so that defined
* namespaces are preserved.
* @class YAHOO
* @static
*/
var YAHOO = {};
}
/**
* Returns the namespace specified and creates it if it doesn't exist
* <pre>
* YAHOO.namespace("property.package");
* YAHOO.namespace("YAHOO.property.package");
* </pre>
* Either of the above would create YAHOO.property, then
* YAHOO.property.package
*
* Be careful when naming packages. Reserved words may work in some browsers
* and not others. For instance, the following will fail in Safari:
* <pre>
* YAHOO.namespace("really.long.nested.namespace");
* </pre>
* This fails because "long" is a future reserved word in ECMAScript
*
* @method namespace
* @static
* @param {String*} arguments 1-n namespaces to create
* @return {Object} A reference to the last namespace object created
*/
YAHOO.namespace = function() {
var a=arguments, o=null, i, j, d;
for (i=0; i<a.length; i=i+1) {
d=a[i].split(".");
o=YAHOO;
// YAHOO is implied, so it is ignored if it is included
for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
o[d[j]]=o[d[j]] || {};
o=o[d[j]];
}
}
return o;
};
/**
* Uses YAHOO.widget.Logger to output a log message, if the widget is
* available.
*
* @method log
* @static
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {String} src The source of the the message (opt)
* @return {Boolean} True if the log operation was successful.
*/
YAHOO.log = function(msg, cat, src) {
var l=YAHOO.widget.Logger;
if(l && l.log) {
return l.log(msg, cat, src);
} else {
return false;
}
};
/**
* Initializes the global by creating the default namespaces and applying
* any new configuration information that is detected.
* @method init
* @static
*/
YAHOO.init = function() {
this.namespace("util", "widget", "example");
if (typeof YAHOO_config != "undefined") {
var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;
if (l) {
// if YAHOO is loaded multiple times we need to check to see if
// this is a new config object. If it is, add the new component
// load listener to the stack
for (i=0;i<ls.length;i=i+1) {
if (ls[i]==l) {
unique=false;
break;
}
}
if (unique) {
ls.push(l);
}
}
}
};
/**
* Registers a module with the YAHOO object
* @method register
* @static
* @param {String} name the name of the module (event, slider, etc)
* @param {Function} mainClass a reference to class in the module. This
* class will be tagged with the version info
* so that it will be possible to identify the
* version that is in use when multiple versions
* have loaded
* @param {Object} data metadata object for the module. Currently it
* is expected to contain a "version" property
* and a "build" property at minimum.
*/
YAHOO.register = function(name, mainClass, data) {
var mods = YAHOO.env.modules;
if (!mods[name]) {
mods[name] = { versions:[], builds:[] };
}
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;
m.name = name;
m.version = v;
m.build = b;
m.versions.push(v);
m.builds.push(b);
m.mainClass = mainClass;
// fire the module load listeners
for (var i=0;i<ls.length;i=i+1) {
ls[i](m);
}
// label the main class
if (mainClass) {
mainClass.VERSION = v;
mainClass.BUILD = b;
} else {
YAHOO.log("mainClass is undefined for module " + name, "warn");
}
};
/**
* YAHOO.env is used to keep track of what is known about the YUI library and
* the browsing environment
* @class YAHOO.env
* @type Object
* @static
*/
YAHOO.env = YAHOO.env || {
/**
* Keeps the version info for all YUI modules that have reported themselves
* @property modules
* @type Object[]
*/
modules: [],
/**
* List of functions that should be executed every time a YUI module
* reports itself.
* @property listeners
* @type Function[]
*/
listeners: [],
/**
* Returns the version data for the specified module:
* <dl>
* <dt>name:</dt> <dd>The name of the module</dd>
* <dt>version:</dt> <dd>The version in use</dd>
* <dt>build:</dt> <dd>The build number in use</dd>
* <dt>versions:</dt> <dd>All versions that were registered</dd>
* <dt>builds:</dt> <dd>All builds that were registered.</dd>
* <dt>mainClass:</dt> <dd>An object that was was stamped with the
* current version and build. If
* mainClass.VERSION != version or mainClass.BUILD != build,
* multiple versions of pieces of the library have been
* loaded, potentially causing issues.</dd>
* </dl>
*
* @method getVersion
* @static
* @param {String} name the name of the module (event, slider, etc)
* @return {Object} The version info
*/
getVersion: function(name) {
return YAHOO.env.modules[name] || null;
}
};
/**
* Provides the language utilites and extensions used by the library
* @class YAHOO.lang
*/
YAHOO.lang = {
/**
* Determines whether or not the provided object is an array
* @method isArray
* @param {any} obj The object being testing
* @return Boolean
*/
isArray: function(obj) { // frames lose type, so test constructor string
if (obj.constructor && obj.constructor.toString().indexOf('Array') > -1) {
return true;
} else {
return YAHOO.lang.isObject(obj) && obj.constructor == Array;
}
},
/**
* Determines whether or not the provided object is a boolean
* @method isBoolean
* @param {any} obj The object being testing
* @return Boolean
*/
isBoolean: function(obj) {
return typeof obj == 'boolean';
},
/**
* Determines whether or not the provided object is a function
* @method isFunction
* @param {any} obj The object being testing
* @return Boolean
*/
isFunction: function(obj) {
return typeof obj == 'function';
},
/**
* Determines whether or not the provided object is null
* @method isNull
* @param {any} obj The object being testing
* @return Boolean
*/
isNull: function(obj) {
return obj === null;
},
/**
* Determines whether or not the provided object is a legal number
* @method isNumber
* @param {any} obj The object being testing
* @return Boolean
*/
isNumber: function(obj) {
return typeof obj == 'number' && isFinite(obj);
},
/**
* Determines whether or not the provided object is of type object
* or function
* @method isObject
* @param {any} obj The object being testing
* @return Boolean
*/
isObject: function(obj) {
return typeof obj == 'object' || YAHOO.lang.isFunction(obj);
},
/**
* Determines whether or not the provided object is a string
* @method isString
* @param {any} obj The object being testing
* @return Boolean
*/
isString: function(obj) {
return typeof obj == 'string';
},
/**
* Determines whether or not the provided object is undefined
* @method isUndefined
* @param {any} obj The object being testing
* @return Boolean
*/
isUndefined: function(obj) {
return typeof obj == 'undefined';
},
/**
* Determines whether or not the property was added
* to the object instance. Returns false if the property is not present
* in the object, or was inherited from the prototype.
* This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
* There is a discrepancy between YAHOO.lang.hasOwnProperty and
* Object.prototype.hasOwnProperty when the property is a primitive added to
* both the instance AND prototype with the same value:
* <pre>
* var A = function() {};
* A.prototype.foo = 'foo';
* var a = new A();
* a.foo = 'foo';
* alert(a.hasOwnProperty('foo')); // true
* alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
* </pre>
* @method hasOwnProperty
* @param {any} obj The object being testing
* @return Boolean
*/
hasOwnProperty: function(obj, prop) {
if (Object.prototype.hasOwnProperty) {
return obj.hasOwnProperty(prop);
}
return !YAHOO.lang.isUndefined(obj[prop]) &&
obj.constructor.prototype[prop] !== obj[prop];
},
/**
* Utility to set up the prototype, constructor and superclass properties to
* support an inheritance strategy that can chain constructors and methods.
*
* @method extend
* @static
* @param {Function} subc the object to modify
* @param {Function} superc the object to inherit
* @param {Object} overrides additional properties/methods to add to the
* subclass prototype. These will override the
* matching items obtained from the superclass
* if present.
*/
extend: function(subc, superc, overrides) {
var F = function() {};
F.prototype=superc.prototype;
subc.prototype=new F();
subc.prototype.constructor=subc;
subc.superclass=superc.prototype;
if (superc.prototype.constructor == Object.prototype.constructor) {
superc.prototype.constructor=superc;
}
if (overrides) {
for (var i in overrides) {
subc.prototype[i]=overrides[i];
}
}
},
/**
* Applies all prototype properties in the supplier to the receiver if the
* receiver does not have these properties yet. Optionally, one or more
* methods/properties can be specified (as additional parameters). This
* option will overwrite the property if receiver has it already.
*
* @method augment
* @static
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param {String*} arguments zero or more properties methods to augment the
* receiver with. If none specified, everything
* in the supplier will be used unless it would
* overwrite an existing property in the receiver
*/
augment: function(r, s) {
var rp=r.prototype, sp=s.prototype, a=arguments, i, p;
if (a[2]) {
for (i=2; i<a.length; i=i+1) {
rp[a[i]] = sp[a[i]];
}
} else {
for (p in sp) {
if (!rp[p]) {
rp[p] = sp[p];
}
}
}
}
};
YAHOO.init();
/*
* An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
* @class YAHOO.util.Lang
*/
YAHOO.util.Lang = YAHOO.lang;
/**
* An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
* @for YAHOO
* @method augment
* @static
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param {String*} arguments zero or more properties methods to augment the
* receiver with. If none specified, everything
* in the supplier will be used unless it would
* overwrite an existing property in the receiver
*/
YAHOO.augment = YAHOO.lang.augment;
/**
* An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
* @method extend
* @static
* @param {Function} subc the object to modify
* @param {Function} superc the object to inherit
* @param {Object} overrides additional properties/methods to add to the
* subclass prototype. These will override the
* matching items obtained from the superclass
* if present.
*/
YAHOO.extend = YAHOO.lang.extend;
YAHOO.register("yahoo", YAHOO, {version: "2.2.0", build: "127"});