| 1 |
var AjaxHistory={_callback:{},_defaultCallback:[],_alwaysHashGen:null,_currentIframeHash:"",_currentLocationHash:"",_prefix:"ajax_history",_ignoreOnce:false,add:function(_1,_2){ |
|---|
| 2 |
_2=Object.extend({prefix:this._prefix},_2||{}); |
|---|
| 3 |
this._ignoreOnce=_2.ignoreOnce; |
|---|
| 4 |
var _3=_2.prefix+"_"+_1; |
|---|
| 5 |
if(this._alwaysHashGen&&!_2.ignoreAlwaysHash){ |
|---|
| 6 |
var _4=this._alwaysHashGen(); |
|---|
| 7 |
_3=_4+"|"+_3; |
|---|
| 8 |
} |
|---|
| 9 |
AjaxHistoryPageManager.setHash(_3); |
|---|
| 10 |
},addCallback:function(_5,_6){ |
|---|
| 11 |
var _7=_6?(_6+"_"):this._prefix; |
|---|
| 12 |
this._callback[_7]=_5; |
|---|
| 13 |
},addDefaultCallback:function(_8){ |
|---|
| 14 |
this._defaultCallback.push(_8); |
|---|
| 15 |
},checkIframeHash:function(){ |
|---|
| 16 |
var _9=AjaxHistoryIframeManager.getHash(); |
|---|
| 17 |
if(this._currentIframeHash!=_9){ |
|---|
| 18 |
this._currentIframeHash=_9; |
|---|
| 19 |
this._currentLocationHash=_9; |
|---|
| 20 |
AjaxHistoryPageManager.setHash((_9)?_9:""); |
|---|
| 21 |
this.doEvent(_9); |
|---|
| 22 |
}else{ |
|---|
| 23 |
this.checkLocationHash(); |
|---|
| 24 |
} |
|---|
| 25 |
},checkHash:function(){ |
|---|
| 26 |
if(UserAgent.isIE()){ |
|---|
| 27 |
if(document.readyState=="complete"){ |
|---|
| 28 |
this.checkIframeHash(); |
|---|
| 29 |
} |
|---|
| 30 |
}else{ |
|---|
| 31 |
this.checkLocationHash(); |
|---|
| 32 |
} |
|---|
| 33 |
},checkLocationHash:function(){ |
|---|
| 34 |
var _a=AjaxHistoryPageManager.getHash(); |
|---|
| 35 |
if(this._currentLocationHash!=_a){ |
|---|
| 36 |
this._currentLocationHash=_a; |
|---|
| 37 |
if(UserAgent.isIE()){ |
|---|
| 38 |
AjaxHistoryIframeManager.setHash(_a); |
|---|
| 39 |
}else{ |
|---|
| 40 |
this.doEvent(_a); |
|---|
| 41 |
} |
|---|
| 42 |
} |
|---|
| 43 |
},clearDefaultCallback:function(){ |
|---|
| 44 |
this._defaultCallback=[]; |
|---|
| 45 |
},doEvent:function(_b){ |
|---|
| 46 |
if(this._ignoreOnce){ |
|---|
| 47 |
this._ignoreOnce=false; |
|---|
| 48 |
return; |
|---|
| 49 |
} |
|---|
| 50 |
this._defaultCallback.each(function(_c){ |
|---|
| 51 |
_c.call(); |
|---|
| 52 |
}); |
|---|
| 53 |
var _d=$A(_b.split("|")); |
|---|
| 54 |
for(var _e in this._callback){ |
|---|
| 55 |
var _f=this._callback[_e]; |
|---|
| 56 |
_d.each(function(_10){ |
|---|
| 57 |
if(_10.match(new RegExp("^"+_e))){ |
|---|
| 58 |
var _11=_10.replace(_e,""); |
|---|
| 59 |
_f.call(null,_10.replace(_e,"")); |
|---|
| 60 |
} |
|---|
| 61 |
}); |
|---|
| 62 |
} |
|---|
| 63 |
},init:function(_12,_13){ |
|---|
| 64 |
this.addCallback(_12,_13); |
|---|
| 65 |
if(UserAgent.isIE()){ |
|---|
| 66 |
AjaxHistoryIframeManager.create(); |
|---|
| 67 |
} |
|---|
| 68 |
setInterval(function(){ |
|---|
| 69 |
AjaxHistory.checkHash(); |
|---|
| 70 |
},100); |
|---|
| 71 |
},remove:function(){ |
|---|
| 72 |
var _14=""; |
|---|
| 73 |
if(this._alwaysHashGen){ |
|---|
| 74 |
_14=this._alwaysHashGen(); |
|---|
| 75 |
} |
|---|
| 76 |
AjaxHistoryPageManager.setHash(_14); |
|---|
| 77 |
},removeCallback:function(_15){ |
|---|
| 78 |
_15+="_"; |
|---|
| 79 |
if(this._callback[_15]){ |
|---|
| 80 |
delete this._callback[_15]; |
|---|
| 81 |
} |
|---|
| 82 |
},setAlwaysHashGen:function(_16){ |
|---|
| 83 |
this._alwaysHashGen=_16; |
|---|
| 84 |
}}; |
|---|
| 85 |
var AjaxHistoryIframeManager={_id:"ajax_history_frame",_element:null,_src:IECover.src,create:function(){ |
|---|
| 86 |
document.write("<iframe id=\""+this._id+"\" src=\""+this._src+"\" style=\"display: none;\"></iframe>"); |
|---|
| 87 |
this._element=$(this._id); |
|---|
| 88 |
},getHash:function(){ |
|---|
| 89 |
try{ |
|---|
| 90 |
var _17=this._element.contentWindow.document; |
|---|
| 91 |
return unescape(_17.location.hash.replace(/^#/,"")); |
|---|
| 92 |
} |
|---|
| 93 |
catch(e){ |
|---|
| 94 |
return ""; |
|---|
| 95 |
} |
|---|
| 96 |
},setHash:function(_18){ |
|---|
| 97 |
var _19=this._element.contentWindow.document; |
|---|
| 98 |
_19.open(); |
|---|
| 99 |
_19.close(); |
|---|
| 100 |
_19.location.hash=escape(_18); |
|---|
| 101 |
}}; |
|---|
| 102 |
var AjaxHistoryPageManager={_delimiter:"#",_location:"window.location.href",_query:"",getLocation:function(){ |
|---|
| 103 |
return eval(this._location); |
|---|
| 104 |
},getHash:function(){ |
|---|
| 105 |
var _1a=this.getLocation().split(this._delimiter); |
|---|
| 106 |
return unescape((_1a.length>1)?_1a[_1a.length-1]:this._query); |
|---|
| 107 |
},getSpecifiedValue:function(key){ |
|---|
| 108 |
var _1c=""; |
|---|
| 109 |
$A(this.getHash().split("|")).each(function(_1d){ |
|---|
| 110 |
if(_1d.match(new RegExp("^"+key+"_"))){ |
|---|
| 111 |
_1c=_1d.replace(key+"_",""); |
|---|
| 112 |
} |
|---|
| 113 |
}); |
|---|
| 114 |
return _1c; |
|---|
| 115 |
},getUrl:function(){ |
|---|
| 116 |
var _1e=this.getLocation().split(this._delimiter); |
|---|
| 117 |
return _1e[0]; |
|---|
| 118 |
},setHash:function(_1f){ |
|---|
| 119 |
window.location.hash=escape(_1f); |
|---|
| 120 |
}}; |
|---|
| 121 |
|
|---|
| 122 |
var AutoKana=Class.create(); |
|---|
| 123 |
Object.extend(AutoKana,{kana_extraction_pattern:new RegExp(decodeURIComponent("%5B%5E%20%E3%80%80%E3%81%81%E3%81%82-%E3%82%93%E3%83%BC%5D"),"g"),kana_compacting_pattern:new RegExp(decodeURIComponent("%5B%E3%81%81%E3%81%83%E3%81%85%E3%81%87%E3%81%89%E3%81%A3%E3%82%83%E3%82%85%E3%82%87%5D"),"g"),label_string_hiragana:decodeURIComponent("%E3%81%8B%E3%81%AA%E8%87%AA%E5%8B%95%E8%A3%9C%E5%AE%8C"),label_string_katakana:decodeURIComponent("%E3%82%AB%E3%83%8A%E8%87%AA%E5%8B%95%E8%A3%9C%E5%AE%8C")}); |
|---|
| 124 |
Object.extend(AutoKana.prototype,{initialize:function(_1,_2){ |
|---|
| 125 |
this.elName=$(_1); |
|---|
| 126 |
this.elKana=$(_2); |
|---|
| 127 |
var _3={build:true,katakana:false,toggle:true}; |
|---|
| 128 |
this.options=Object.extend(_3,arguments[2]||{}); |
|---|
| 129 |
this.active=true; |
|---|
| 130 |
this._stateClear(); |
|---|
| 131 |
this._build(); |
|---|
| 132 |
},start:function(){ |
|---|
| 133 |
this.active=true; |
|---|
| 134 |
},stop:function(){ |
|---|
| 135 |
this.active=false; |
|---|
| 136 |
},toggle:function(_4){ |
|---|
| 137 |
var ev=_4||window.event; |
|---|
| 138 |
if(_4){ |
|---|
| 139 |
var el=Event.element(_4); |
|---|
| 140 |
if(el.checked){ |
|---|
| 141 |
this.active=true; |
|---|
| 142 |
}else{ |
|---|
| 143 |
this.active=false; |
|---|
| 144 |
} |
|---|
| 145 |
}else{ |
|---|
| 146 |
this.active=!this.active; |
|---|
| 147 |
} |
|---|
| 148 |
},_addEvents:function(){ |
|---|
| 149 |
Event.observe(this.elName,"blur",this._eventBlur.bindAsEventListener(this)); |
|---|
| 150 |
Event.observe(this.elName,"focus",this._eventFocus.bindAsEventListener(this)); |
|---|
| 151 |
Event.observe(this.elName,"keydown",this._eventKeyDown.bindAsEventListener(this)); |
|---|
| 152 |
},_build:function(){ |
|---|
| 153 |
if(this.options.build){ |
|---|
| 154 |
this._addEvents(); |
|---|
| 155 |
} |
|---|
| 156 |
if(this.options.toggle){ |
|---|
| 157 |
this._buildToggle(); |
|---|
| 158 |
} |
|---|
| 159 |
},_buildToggle:function(){ |
|---|
| 160 |
var _7=this.elName.parentNode; |
|---|
| 161 |
var _8=document.createElement("div"); |
|---|
| 162 |
var _9=this._buildToggleCheckBox(); |
|---|
| 163 |
var _a=this._buildToggleLabel(); |
|---|
| 164 |
_7.replaceChild(_8,this.elName); |
|---|
| 165 |
_8.appendChild(this.elName); |
|---|
| 166 |
_8.appendChild(_9); |
|---|
| 167 |
_8.appendChild(_a); |
|---|
| 168 |
},_buildToggleCheckBox:function(){ |
|---|
| 169 |
var _b=this; |
|---|
| 170 |
var el=document.createElement("input"); |
|---|
| 171 |
el.type="checkbox"; |
|---|
| 172 |
el.id=this.elName.id+"_toggle"; |
|---|
| 173 |
el.checked=true; |
|---|
| 174 |
el.style.border="none"; |
|---|
| 175 |
el.style.background="transparent"; |
|---|
| 176 |
el.style.cursor="pointer"; |
|---|
| 177 |
Event.observe(el,"click",this.toggle.bindAsEventListener(this)); |
|---|
| 178 |
return el; |
|---|
| 179 |
},_buildToggleLabel:function(){ |
|---|
| 180 |
var el=document.createElement("label"); |
|---|
| 181 |
el.htmlFor=this.elName.id+"_toggle"; |
|---|
| 182 |
el.style.cursor="pointer"; |
|---|
| 183 |
el.innerHTML=((this.options.katakana)?AutoKana.label_string_katakana:AutoKana.label_string_hiragana); |
|---|
| 184 |
return el; |
|---|
| 185 |
},_checkConvert:function(_e){ |
|---|
| 186 |
if(!this.flagConvert){ |
|---|
| 187 |
if(Math.abs(this.values.length-_e.length)>1){ |
|---|
| 188 |
var _f=_e.join("").replace(AutoKana.kana_compacting_pattern,"").split(""); |
|---|
| 189 |
if(Math.abs(this.values.length-_f.length)>1){ |
|---|
| 190 |
this._stateConvert(); |
|---|
| 191 |
} |
|---|
| 192 |
}else{ |
|---|
| 193 |
if(this.values.length==this.input.length&&this.values.join("")!=this.input){ |
|---|
| 194 |
this._stateConvert(); |
|---|
| 195 |
} |
|---|
| 196 |
} |
|---|
| 197 |
} |
|---|
| 198 |
},_checkValue:function(){ |
|---|
| 199 |
var _10,_11; |
|---|
| 200 |
_10=this.elName.value; |
|---|
| 201 |
if(_10==""){ |
|---|
| 202 |
this._stateClear(); |
|---|
| 203 |
this._setKana(); |
|---|
| 204 |
}else{ |
|---|
| 205 |
_10=this._removeString(_10); |
|---|
| 206 |
if(this.input==_10){ |
|---|
| 207 |
return; |
|---|
| 208 |
}else{ |
|---|
| 209 |
this.input=_10; |
|---|
| 210 |
if(!this.flagConvert){ |
|---|
| 211 |
_11=_10.replace(AutoKana.kana_extraction_pattern,"").split(""); |
|---|
| 212 |
this._checkConvert(_11); |
|---|
| 213 |
this._setKana(_11); |
|---|
| 214 |
} |
|---|
| 215 |
} |
|---|
| 216 |
} |
|---|
| 217 |
},_clearInterval:function(){ |
|---|
| 218 |
clearInterval(this.timer); |
|---|
| 219 |
},_eventBlur:function(_12){ |
|---|
| 220 |
this._clearInterval(); |
|---|
| 221 |
},_eventFocus:function(_13){ |
|---|
| 222 |
this._stateInput(); |
|---|
| 223 |
this._setInterval(); |
|---|
| 224 |
},_eventKeyDown:function(_14){ |
|---|
| 225 |
if(this.flagConvert){ |
|---|
| 226 |
this._stateInput(); |
|---|
| 227 |
} |
|---|
| 228 |
},_isHiragana:function(c){ |
|---|
| 229 |
return ((c>=12353&&c<=12435)||c==12445||c==12446); |
|---|
| 230 |
},_removeString:function(_16){ |
|---|
| 231 |
if(_16.indexOf(this.ignoreString)>=0){ |
|---|
| 232 |
return _16.replace(this.ignoreString,""); |
|---|
| 233 |
}else{ |
|---|
| 234 |
var i,_18,_19; |
|---|
| 235 |
_18=this.ignoreString.split(""); |
|---|
| 236 |
_19=_16.split(""); |
|---|
| 237 |
for(i=0;i<_18.length;i++){ |
|---|
| 238 |
if(_18[i]==_19[i]){ |
|---|
| 239 |
_19[i]=""; |
|---|
| 240 |
} |
|---|
| 241 |
} |
|---|
| 242 |
return _19.join(""); |
|---|
| 243 |
} |
|---|
| 244 |
},_setInterval:function(){ |
|---|
| 245 |
var _1a=this; |
|---|
| 246 |
this.timer=setInterval(function(){ |
|---|
| 247 |
_1a._checkValue(); |
|---|
| 248 |
},30); |
|---|
| 249 |
},_setKana:function(_1b){ |
|---|
| 250 |
if(!this.flagConvert){ |
|---|
| 251 |
if(_1b){ |
|---|
| 252 |
this.values=_1b; |
|---|
| 253 |
} |
|---|
| 254 |
if(this.active){ |
|---|
| 255 |
this.elKana.value=this._toKatakana(this.baseKana+this.values.join("")); |
|---|
| 256 |
} |
|---|
| 257 |
} |
|---|
| 258 |
},_stateClear:function(){ |
|---|
| 259 |
this.baseKana=""; |
|---|
| 260 |
this.flagConvert=false; |
|---|
| 261 |
this.ignoreString=""; |
|---|
| 262 |
this.input=""; |
|---|
| 263 |
this.values=[]; |
|---|
| 264 |
},_stateInput:function(){ |
|---|
| 265 |
this.baseKana=this.elKana.value; |
|---|
| 266 |
this.flagConvert=false; |
|---|
| 267 |
this.ignoreString=this.elName.value; |
|---|
| 268 |
},_stateConvert:function(){ |
|---|
| 269 |
this.baseKana=this.baseKana+this.values.join(""); |
|---|
| 270 |
this.flagConvert=true; |
|---|
| 271 |
this.values=[]; |
|---|
| 272 |
},_toKatakana:function(src){ |
|---|
| 273 |
if(this.options.katakana){ |
|---|
| 274 |
var c,i,str; |
|---|
| 275 |
str=new String; |
|---|
| 276 |
for(i=0;i<src.length;i++){ |
|---|
| 277 |
c=src.charCodeAt(i); |
|---|
| 278 |
if(this._isHiragana(c)){ |
|---|
| 279 |
str+=String.fromCharCode(c+96); |
|---|
| 280 |
}else{ |
|---|
| 281 |
str+=src.charAt(i); |
|---|
| 282 |
} |
|---|
| 283 |
} |
|---|
| 284 |
return str; |
|---|
| 285 |
}else{ |
|---|
| 286 |
return src; |
|---|
| 287 |
} |
|---|
| 288 |
}}); |
|---|
| 289 |
|
|---|
| 290 |
var Balloon=Class.create(); |
|---|
| 291 |
Balloon.classNames={tooltip:"balloon_tooltip",top:"balloon_top",topLeft:"balloon_top_left",topMiddle:"balloon_top_middle",topRight:"balloon_top_right",middle:"balloon_middle",middleLeft:"balloon_middle_left",middleRight:"balloon_middle_right",middleLeftRowT:"balloon_middle_left_row",middleLeftRowB:"balloon_middle_left_row",middleRightRowT:"balloon_middle_right_row",middleRightRowB:"balloon_middle_right_row",leftArrow:"balloon_left_arrow",rightArrow:"balloon_right_arrow",leftUpArrow:"balloon_left_up_arrow",leftDownArrow:"balloon_left_down_arrow",rightUpArrow:"balloon_right_up_arrow",rightDownArrow:"balloon_right_down_arrow",body:"balloon_body",bottom:"balloon_bottom",bottomLeft:"balloon_bottom_left",bottomMiddle:"balloon_bottom_middle",bottomRight:"balloon_bottom_right"}; |
|---|
| 292 |
Balloon.allBalloons=[]; |
|---|
| 293 |
Balloon.closeAll=function(){ |
|---|
| 294 |
Balloon.allBalloons.each(function(b){ |
|---|
| 295 |
b.close(); |
|---|
| 296 |
}); |
|---|
| 297 |
}; |
|---|
| 298 |
Balloon.prototype={initialize:function(_2,_3){ |
|---|
| 299 |
this.target=$(_2); |
|---|
| 300 |
this.options=Object.extend({cssPrefix:"custom_",trigger:this.target,tipId:this.target.id+"_balloon",events:["click"],width:300,height:200,marginTop:0,build:true},arguments[2]||{}); |
|---|
| 301 |
var _4=CssUtil.appendPrefix(this.options.cssPrefix,Balloon.classNames); |
|---|
| 302 |
this.classNames=new CssUtil([Balloon.classNames,_4]); |
|---|
| 303 |
if(this.options.build){ |
|---|
| 304 |
this.tipNode=this._buildTipNode(_3); |
|---|
| 305 |
Element.hide(this.tipNode); |
|---|
| 306 |
this._setMessage(_3); |
|---|
| 307 |
Element.appendToBody(this.tipNode); |
|---|
| 308 |
this._setEvent(); |
|---|
| 309 |
}else{ |
|---|
| 310 |
this.tipNode=$(this.options.tipId); |
|---|
| 311 |
this.top=$(this.options.tipId+"_top"); |
|---|
| 312 |
this.topLeft=$(this.options.tipId+"_top_left"); |
|---|
| 313 |
this.topMiddle=$(this.options.tipId+"_top_middle"); |
|---|
| 314 |
this.topRight=$(this.options.tipId+"_top_bottom"); |
|---|
| 315 |
this.middle=$(this.options.tipId+"_middle"); |
|---|
| 316 |
this.middleLeft=$(this.options.tipId+"_middle_left"); |
|---|
| 317 |
this.middleLeftRowT=$(this.options.tipId+"_middle_left_top"); |
|---|
| 318 |
this.leftArrow=$(this.options.tipId+"_middle_left_center"); |
|---|
| 319 |
this.middleLeftRowB=$(this.options.tipId+"_middle_left_bottom"); |
|---|
| 320 |
this.body=$(this.options.tipId+"_middle_center"); |
|---|
| 321 |
this.middleRight=$(this.options.tipId+"_middle_right"); |
|---|
| 322 |
this.middleRightRowT=$(this.options.tipId+"_middle_right_top"); |
|---|
| 323 |
this.rightArrow=$(this.options.tipId+"_middle_right_center"); |
|---|
| 324 |
this.middleRightRowB=$(this.options.tipId+"_middle_right_bottom"); |
|---|
| 325 |
this.bottom=$(this.options.tipId+"_bottom"); |
|---|
| 326 |
this.bottomLeft=$(this.options.tipId+"_bottom_left"); |
|---|
| 327 |
this.bottomMiddle=$(this.options.tipId+"_bottom_middle"); |
|---|
| 328 |
this.bottomRight=$(this.options.tipId+"_bottom_right"); |
|---|
| 329 |
Element.appendToBody(this.tipNode); |
|---|
| 330 |
} |
|---|
| 331 |
Balloon.allBalloons.push(this); |
|---|
| 332 |
this._setSize(); |
|---|
| 333 |
},_setEvent:function(){ |
|---|
| 334 |
var _5=this; |
|---|
| 335 |
this.options.events.each(function(e){ |
|---|
| 336 |
Event.observe(_5.options.trigger,e,_5.open.bindAsEventListener(_5)); |
|---|
| 337 |
}); |
|---|
| 338 |
Event.observe(this.tipNode,"click",this.close.bind(this),true); |
|---|
| 339 |
if(!Event.observers.find(function(o){ |
|---|
| 340 |
return o[2]==Balloon.closeAll; |
|---|
| 341 |
})){ |
|---|
| 342 |
Event.observe(document,"click",Balloon.closeAll,true); |
|---|
| 343 |
} |
|---|
| 344 |
},_buildTipNode:function(){ |
|---|
| 345 |
var _8=Builder.node("div",{id:this.options.tipId}); |
|---|
| 346 |
this.classNames.addClassNames(_8,"tooltip"); |
|---|
| 347 |
_8.appendChild(this._buildTop()); |
|---|
| 348 |
_8.appendChild(this._buildMiddle()); |
|---|
| 349 |
_8.appendChild(this._buildBottom()); |
|---|
| 350 |
return _8; |
|---|
| 351 |
},_setMessage:function(_9){ |
|---|
| 352 |
var _a=_9.constructor; |
|---|
| 353 |
if(_a==String){ |
|---|
| 354 |
this.body.innerHTML=_9; |
|---|
| 355 |
}else{ |
|---|
| 356 |
if(_a==Object){ |
|---|
| 357 |
this.body.appendChild(_9); |
|---|
| 358 |
} |
|---|
| 359 |
} |
|---|
| 360 |
},_buildTop:function(){ |
|---|
| 361 |
return this._buildMulti("top",["topLeft","topMiddle","topRight"],true); |
|---|
| 362 |
},_buildBottom:function(){ |
|---|
| 363 |
return this._buildMulti("bottom",["bottomLeft","bottomMiddle","bottomRight"],true); |
|---|
| 364 |
},_buildMiddle:function(){ |
|---|
| 365 |
this.middle=Builder.node("div"); |
|---|
| 366 |
this.classNames.addClassNames(this.middle,"middle"); |
|---|
| 367 |
this.middle.appendChild(this._buildMulti("middleLeft",["middleLeftRowT","leftArrow","middleLeftRowB"],true)); |
|---|
| 368 |
this.middle.appendChild(this._buildMulti("body",[],true)); |
|---|
| 369 |
this.middle.appendChild(this._buildMulti("middleRight",["middleRightRowT","rightArrow","middleRightRowB"],true)); |
|---|
| 370 |
return this.middle; |
|---|
| 371 |
},_buildMulti:function(_b,_c,_d){ |
|---|
| 372 |
var _e=Builder.node("div"); |
|---|
| 373 |
this.classNames.addClassNames(_e,_b); |
|---|
| 374 |
if(_d){ |
|---|
| 375 |
this[_b]=_e; |
|---|
| 376 |
} |
|---|
| 377 |
var _f=this; |
|---|
| 378 |
var _10=null; |
|---|
| 379 |
_c.each(function(s){ |
|---|
| 380 |
_10=Builder.node("div"); |
|---|
| 381 |
_f.classNames.addClassNames(_10,s); |
|---|
| 382 |
_e.appendChild(_10); |
|---|
| 383 |
if(_d){ |
|---|
| 384 |
_f[s]=_10; |
|---|
| 385 |
} |
|---|
| 386 |
}); |
|---|
| 387 |
return _e; |
|---|
| 388 |
},_setPosition:function(){ |
|---|
| 389 |
var _12=Position.realOffset(this.tipNode); |
|---|
| 390 |
var _13=document.documentElement.clientWidth; |
|---|
| 391 |
var _14=document.documentElement.clientHeight; |
|---|
| 392 |
var _15=Position.cumulativeOffset(this.target); |
|---|
| 393 |
var _16=Element.getDimensions(this.target); |
|---|
| 394 |
var _17=Math.round(_15[0]+_16.width); |
|---|
| 395 |
var _18=Element.getDimensions(this.tipNode); |
|---|
| 396 |
var _19=Math.round(_15[1]-_18.height/2); |
|---|
| 397 |
var _1a="left"; |
|---|
| 398 |
var _1b="right"; |
|---|
| 399 |
if((tmpY=_19-_12[1])<0){ |
|---|
| 400 |
_19-=tmpY; |
|---|
| 401 |
} |
|---|
| 402 |
if((_17+_18.width)>(_13+_12[0])){ |
|---|
| 403 |
_17=Math.round(_15[0]-_18.width); |
|---|
| 404 |
_1a="right"; |
|---|
| 405 |
_1b="left"; |
|---|
| 406 |
} |
|---|
| 407 |
var y=_15[1]-_19; |
|---|
| 408 |
this._setArrow(_1a,y); |
|---|
| 409 |
this._unsetArrow(_1b); |
|---|
| 410 |
Element.setStyle(this.tipNode,{top:_19+this.options.marginTop+"px",left:_17+"px",zIndex:ZindexManager.getIndex()}); |
|---|
| 411 |
},_setArrow:function(lr,y){ |
|---|
| 412 |
var _1f=(this.options.height-this.middleH)/2; |
|---|
| 413 |
var _20,_21,h,ud; |
|---|
| 414 |
var _24=10; |
|---|
| 415 |
if(lr=="left"){ |
|---|
| 416 |
h=this.middleH-this.leftArrowH; |
|---|
| 417 |
}else{ |
|---|
| 418 |
h=this.middleH-this.rightArrowH; |
|---|
| 419 |
} |
|---|
| 420 |
if(_1f>y){ |
|---|
| 421 |
_20=_24; |
|---|
| 422 |
_21=h-_20; |
|---|
| 423 |
ud="up"; |
|---|
| 424 |
}else{ |
|---|
| 425 |
if((this.middleH+_1f)<y){ |
|---|
| 426 |
_21=_24; |
|---|
| 427 |
_20=h-_21; |
|---|
| 428 |
ud="down"; |
|---|
| 429 |
}else{ |
|---|
| 430 |
_20=y-_1f; |
|---|
| 431 |
_20=(_20<_24)?_24:_20; |
|---|
| 432 |
_21=h-_20; |
|---|
| 433 |
ud="up"; |
|---|
| 434 |
} |
|---|
| 435 |
} |
|---|
| 436 |
if(lr=="left"){ |
|---|
| 437 |
if(ud=="up"){ |
|---|
| 438 |
this.classNames.refreshClassNames(this.leftArrow,"leftUpArrow"); |
|---|
| 439 |
Element.setStyle(this.leftArrow,{height:this.leftArrowH+"px"}); |
|---|
| 440 |
Element.setStyle(this.middleLeftRowT,{height:_20+"px"}); |
|---|
| 441 |
Element.setStyle(this.middleLeftRowB,{height:_21+"px"}); |
|---|
| 442 |
}else{ |
|---|
| 443 |
this.classNames.refreshClassNames(this.leftArrow,"leftDownArrow"); |
|---|
| 444 |
Element.setStyle(this.leftArrow,{height:this.leftArrowH+"px"}); |
|---|
| 445 |
Element.setStyle(this.middleLeftRowT,{height:_20+"px"}); |
|---|
| 446 |
Element.setStyle(this.middleLeftRowB,{height:_21+"px"}); |
|---|
| 447 |
} |
|---|
| 448 |
}else{ |
|---|
| 449 |
if(ud=="up"){ |
|---|
| 450 |
this.classNames.refreshClassNames(this.rightArrow,"rightUpArrow"); |
|---|
| 451 |
Element.setStyle(this.rightArrow,{height:this.rightArrowH+"px"}); |
|---|
| 452 |
Element.setStyle(this.middleRightRowT,{height:_20+"px"}); |
|---|
| 453 |
Element.setStyle(this.middleRightRowB,{height:_21+"px"}); |
|---|
| 454 |
}else{ |
|---|
| 455 |
this.classNames.refreshClassNames(this.rightArrow,"rightDownArrow"); |
|---|
| 456 |
Element.setStyle(this.rightArrow,{height:this.rightArrowH+"px"}); |
|---|
| 457 |
Element.setStyle(this.middleRightRowT,{height:_20+"px"}); |
|---|
| 458 |
Element.setStyle(this.middleRightRowB,{height:_21+"px"}); |
|---|
| 459 |
} |
|---|
| 460 |
} |
|---|
| 461 |
},_unsetArrow:function(_25){ |
|---|
| 462 |
if(_25=="left"){ |
|---|
| 463 |
var h=(this.middleH-this.leftArrowH)/2; |
|---|
| 464 |
this.classNames.refreshClassNames(this.leftArrow,"middleLeftRowB"); |
|---|
| 465 |
Element.setStyle(this.leftArrow,{height:this.leftArrowH+"px"}); |
|---|
| 466 |
Element.setStyle(this.middleLeftRowT,{height:h+"px"}); |
|---|
| 467 |
Element.setStyle(this.middleLeftRowB,{height:h+"px"}); |
|---|
| 468 |
}else{ |
|---|
| 469 |
var h=(this.middleH-this.rightArrowH)/2; |
|---|
| 470 |
this.classNames.refreshClassNames(this.rightArrow,"middleRightRowB"); |
|---|
| 471 |
Element.setStyle(this.rightArrow,{height:this.rightArrowH+"px"}); |
|---|
| 472 |
Element.setStyle(this.middleRightRowT,{height:h+"px"}); |
|---|
| 473 |
Element.setStyle(this.middleRightRowB,{height:h+"px"}); |
|---|
| 474 |
} |
|---|
| 475 |
},_setSize:function(){ |
|---|
| 476 |
var _27=this.options.width; |
|---|
| 477 |
var _28=this.options.height; |
|---|
| 478 |
Element.setStyle(this.tipNode,{width:_27+"px",height:_28+"px"}); |
|---|
| 479 |
var _29=parseInt(Element.getStyle(this.top,"height")); |
|---|
| 480 |
var _2a=parseInt(Element.getStyle(this.bottom,"height")); |
|---|
| 481 |
var _2b=this.options.height-_29-_2a; |
|---|
| 482 |
var _2c={height:_2b+"px"}; |
|---|
| 483 |
Element.setStyle(this.middle,_2c); |
|---|
| 484 |
Element.setStyle(this.middleLeft,_2c); |
|---|
| 485 |
Element.setStyle(this.middleRight,_2c); |
|---|
| 486 |
Element.setStyle(this.body,_2c); |
|---|
| 487 |
this.leftArrowH=parseInt(Element.getStyle(this.leftArrow,"height")); |
|---|
| 488 |
this.rightArrowH=parseInt(Element.getStyle(this.rightArrow,"height")); |
|---|
| 489 |
this.middleH=_2b; |
|---|
| 490 |
},open:function(){ |
|---|
| 491 |
if(!Element.visible(this.tipNode)){ |
|---|
| 492 |
this._setPosition(); |
|---|
| 493 |
Effect.Appear(this.tipNode); |
|---|
| 494 |
} |
|---|
| 495 |
},close:function(){ |
|---|
| 496 |
if(Element.visible(this.tipNode)){ |
|---|
| 497 |
this._setPosition(); |
|---|
| 498 |
Effect.Fade(this.tipNode); |
|---|
| 499 |
} |
|---|
| 500 |
}}; |
|---|
| 501 |
|
|---|
| 502 |
var Calendar=Class.create(); |
|---|
| 503 |
Calendar.className={container:"calendar",header:"calendar_header",preYears:"calendar_preYears",nextYears:"calendar_nextYears",preYears2:"calendar_preYears2",nextYears2:"calendar_nextYears2",years:"calendar_years",mark:"calendar_mark",ym:"calendar_ym",table:"calendar_table",thRight:"right",tdRight:"right",tdBottom:"bottom",date:"calendar_date",holiday:"calendar_holiday",regularHoliday:"calendar_regularHoliday",schedule:"calendar_schedule",highlightDay:"calendar_highlightDay",highlightTime:"calendar_highlightTime",scheduleListContainer:"calendar_scheduleListContainer",scheduleItem:"calendar_scheduleItem",scheduleTimeArea:"calendar_scheduleItemTimeArea",scheduleTimeAreaMonth:"calendar_scheduleItemTimeAreaMonth",scheduleHandler:"calendar_scheduleHandler",holidayName:"calendar_holidayName",dateContainer:"calendar_dateContainer",tableHeader:"calendar_tableHeader",rowContent:"calendar_rowContent",selected:"calendar_selected",nextYearMark:"calendar_nextYearMark",nextMonthMark:"calendar_nextMonthMark",nextWeekMark:"calendar_nextWeekMark",preYearMark:"calendar_preYearMark",preMonthMark:"calendar_preMonthMark",preWeekMark:"calendar_preWeekMark",nextYearMark2:"calendar_nextYearMark2",nextMonthMark2:"calendar_nextMonthMark2",nextWeekMark2:"calendar_nextWeekMark2",preYearMark2:"calendar_preYearMark2",preMonthMark2:"calendar_preMonthMark2",preWeekMark2:"calendar_preWeekMark2",weekTable:"calendar_weekContainerTable",weekMainTable:"calendar_weekMainTable",timeLine:"calendar_timeline",timeLineTimeTop:"calendar_timelineTimeTop",timeLineTime:"calendar_timelineTime",headerColumn:"calendar_headerColumn",columnTopDate:"calendar_columnTopDate",columnDate:"calendar_columnDate",columnDateOdd:"calendar_columnOddDate",scheduleItemSamll:"calendar_scheduleItemSmall",scheduleItemLarge:"calendar_scheduleItemLarge",scheduleItemNoBorder:"calendar_scheduleItemNoBorder",scheduleItemSelect:"calendar_scheduleItemSelect",skipNode:"calendar_skipNode",deleteImg:"calendar_deleteImage",copyImg:"calendar_copyImage",privateImg:"calendar_privateImage",scheduleContainer:"calendar_weekScheduleContainer",selector:"calendar_selector",cover:"calendar_cover"}; |
|---|
| 504 |
Calendar.smallClassName={container:"calendar_small",header:"calendar_header_small",calendar:"calendar_calendar_small",table:"calendar_tableSmall"}; |
|---|
| 505 |
Calendar.size={large:"large",small:"small"}; |
|---|
| 506 |
Calendar.marks={nextYear:"next year",nextMonth:"next month",nextWeek:"next week",nextDay:"next day",preYear:"previous year",preMonth:"previous month",preWeek:"previous week",preDay:"previous day"}; |
|---|
| 507 |
Calendar.privateImgPath=null; |
|---|
| 508 |
Calendar.defaultIconPath=null; |
|---|
| 509 |
Calendar.prototype={initialize:function(_1){ |
|---|
| 510 |
this.building=true; |
|---|
| 511 |
this.element=$(_1); |
|---|
| 512 |
this.options=Object.extend({initDate:new Date(),cssPrefix:"custom_",holidays:[],schedules:[],size:Calendar.size.large,regularHoliday:[0,6],displayIndexes:[0,1,2,3,4,5,6],displayTime:[{hour:0,min:0},{hour:24,min:0}],weekIndex:0,dblclickListener:null,afterSelect:Prototype.emptyFunction,beforeRefresh:Prototype.emptyFunction,afterRefresh:Prototype.emptyFunction,changeSchedule:Prototype.emptyFunction,changeCalendar:Prototype.emptyFunction,displayType:"month",highlightDay:true,beforeRemoveSchedule:function(){ |
|---|
| 513 |
return true; |
|---|
| 514 |
},copySchedule:Prototype.emptyFunction,dblclickSchedule:null,updateTirm:Prototype.emptyFunction,displayTimeLine:true,clickDateText:null,monthHeaderFormat:null,weekHeaderFormat:null,weekSubHeaderFormat:null,dayHeaderFormat:null,dayOfWeek:DateUtil.dayOfWeek,skipString:"... #{count} more",clickSkipNode:Prototype.emptyFunction,noEvent:false,build:true,startAfterBuild:Prototype.emptyFunction,endAfterBuild:Prototype.emptyFunction,enableCtrKey:false,useImgMark:true},arguments[1]||{}); |
|---|
| 515 |
this.date=this.options.initDate; |
|---|
| 516 |
this.options.holidays=this.toHolidayHash(this.options.holidays); |
|---|
| 517 |
if(this.options.build){ |
|---|
| 518 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 519 |
Element.hide(this.element); |
|---|
| 520 |
this.setIndex(); |
|---|
| 521 |
this.makeCss(); |
|---|
| 522 |
this.element.innerHTML=this.build(); |
|---|
| 523 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 524 |
Element.show(this.element); |
|---|
| 525 |
this.builder.afterBuild(); |
|---|
| 526 |
this.builder.setEvent(); |
|---|
| 527 |
}else{ |
|---|
| 528 |
this.makeCss(); |
|---|
| 529 |
this.build(); |
|---|
| 530 |
this.builder.afterBuild(); |
|---|
| 531 |
} |
|---|
| 532 |
this.building=false; |
|---|
| 533 |
this.setDocumentEvent(); |
|---|
| 534 |
},setDocumentEvent:function(){ |
|---|
| 535 |
Event.observe(document,"mouseup",this.onMouseUp.bindAsEventListener(this)); |
|---|
| 536 |
this.windowResize=this.onResize.bind(this); |
|---|
| 537 |
if(this.options.size!="small"){ |
|---|
| 538 |
Event.observe(window,"resize",this.windowResize); |
|---|
| 539 |
} |
|---|
| 540 |
},makeCss:function(){ |
|---|
| 541 |
this.classNames=null; |
|---|
| 542 |
if(this.options.size==Calendar.size.large){ |
|---|
| 543 |
this.classNames=Calendar.className; |
|---|
| 544 |
}else{ |
|---|
| 545 |
this.classNames=$H({}).merge(Calendar.className); |
|---|
| 546 |
this.classNames=this.classNames.merge(Calendar.smallClassName); |
|---|
| 547 |
} |
|---|
| 548 |
this.css=CssUtil.getInstance(this.options.cssPrefix,this.classNames); |
|---|
| 549 |
this.classNames=this.css.allJoinClassNames(); |
|---|
| 550 |
},onResize:function(){ |
|---|
| 551 |
try{ |
|---|
| 552 |
var _2=this.builder.containerDimensions; |
|---|
| 553 |
var _3=Element.getDimensions(this.builder.container); |
|---|
| 554 |
if(_3.height!=_2.height||_3.width!=_2.width){ |
|---|
| 555 |
this.refresh(); |
|---|
| 556 |
} |
|---|
| 557 |
} |
|---|
| 558 |
catch(e){ |
|---|
| 559 |
} |
|---|
| 560 |
},destroy:function(){ |
|---|
| 561 |
Event.stopObserving(window,"resize",this.windowResize); |
|---|
| 562 |
},setIndex:function(){ |
|---|
| 563 |
var _4=this.options; |
|---|
| 564 |
_4.displayIndexes=this.sortWeekIndex(_4.displayIndexes); |
|---|
| 565 |
this.setLastWday(); |
|---|
| 566 |
},sortWeekIndex:function(_5){ |
|---|
| 567 |
var _6=this.options; |
|---|
| 568 |
var _7=[]; |
|---|
| 569 |
var up=[]; |
|---|
| 570 |
var _9=null; |
|---|
| 571 |
_5.sort(); |
|---|
| 572 |
_5.each(function(i){ |
|---|
| 573 |
if(_9==null){ |
|---|
| 574 |
if(_6.weekIndex<=i){ |
|---|
| 575 |
_9=i; |
|---|
| 576 |
up.push(i); |
|---|
| 577 |
}else{ |
|---|
| 578 |
_7.push(i); |
|---|
| 579 |
} |
|---|
| 580 |
}else{ |
|---|
| 581 |
up.push(i); |
|---|
| 582 |
} |
|---|
| 583 |
}); |
|---|
| 584 |
return up.concat(_7); |
|---|
| 585 |
},setLastWday:function(){ |
|---|
| 586 |
var _b=this.options.weekIndex; |
|---|
| 587 |
var _c=6; |
|---|
| 588 |
var _d=0; |
|---|
| 589 |
var _e=$R(_b,_c,false).toArray(); |
|---|
| 590 |
if(_b!=_d){ |
|---|
| 591 |
_e=_e.concat($R(_d,_b-1,false).toArray()); |
|---|
| 592 |
} |
|---|
| 593 |
this.lastWday=_e.last(); |
|---|
| 594 |
this.wdays=_e; |
|---|
| 595 |
},build:function(){ |
|---|
| 596 |
if(this.builder){ |
|---|
| 597 |
this.builder.destroy(); |
|---|
| 598 |
} |
|---|
| 599 |
if(this.options.displayType=="week"){ |
|---|
| 600 |
this.builder=new CalendarWeek(this); |
|---|
| 601 |
}else{ |
|---|
| 602 |
if(this.options.displayType=="day"){ |
|---|
| 603 |
this.builder=new CalendarDay(this); |
|---|
| 604 |
}else{ |
|---|
| 605 |
this.builder=new CalendarMonth(this); |
|---|
| 606 |
} |
|---|
| 607 |
} |
|---|
| 608 |
this.builder.beforeBuild(); |
|---|
| 609 |
if(this.options.build){ |
|---|
| 610 |
return this.builder.build(); |
|---|
| 611 |
} |
|---|
| 612 |
},undo:function(){ |
|---|
| 613 |
if(this.cached){ |
|---|
| 614 |
this.cached.start=this.cached.start_old; |
|---|
| 615 |
this.cached.finish=this.cached.finish_old; |
|---|
| 616 |
this.cached=null; |
|---|
| 617 |
this.refreshSchedule(); |
|---|
| 618 |
} |
|---|
| 619 |
},hideSatSun:function(){ |
|---|
| 620 |
var _f=0; |
|---|
| 621 |
var sat=6; |
|---|
| 622 |
this.options.displayIndexes=this.options.displayIndexes.without(_f,sat); |
|---|
| 623 |
this.setIndex(); |
|---|
| 624 |
this.refresh(); |
|---|
| 625 |
},showSatSun:function(){ |
|---|
| 626 |
var sun=0; |
|---|
| 627 |
var sat=6; |
|---|
| 628 |
var _13=this.options.displayIndexes; |
|---|
| 629 |
if(!_13.include(sun)){ |
|---|
| 630 |
_13.push(sun); |
|---|
| 631 |
} |
|---|
| 632 |
if(!_13.include(sat)){ |
|---|
| 633 |
_13.push(sat); |
|---|
| 634 |
} |
|---|
| 635 |
this.setIndex(); |
|---|
| 636 |
this.refresh(); |
|---|
| 637 |
},changeDisplayIndexes:function(_14){ |
|---|
| 638 |
this.options.displayIndexes=_14; |
|---|
| 639 |
this.setIndex(); |
|---|
| 640 |
this.refresh(); |
|---|
| 641 |
},changeDisplayTime:function(_15){ |
|---|
| 642 |
this.options.displayTime=_15; |
|---|
| 643 |
this.refresh(); |
|---|
| 644 |
},refresh:function(){ |
|---|
| 645 |
try{ |
|---|
| 646 |
if(!this.building){ |
|---|
| 647 |
this.building=true; |
|---|
| 648 |
this.options.build=true; |
|---|
| 649 |
this.options.beforeRefresh(this); |
|---|
| 650 |
this.destroy(); |
|---|
| 651 |
this.selectedBase=null; |
|---|
| 652 |
this.element.innerHTML=this.build(); |
|---|
| 653 |
this.builder.afterBuild(); |
|---|
| 654 |
this.builder.setEvent(); |
|---|
| 655 |
if(this.options.size!="small"){ |
|---|
| 656 |
Event.observe(window,"resize",this.windowResize); |
|---|
| 657 |
} |
|---|
| 658 |
this.building=false; |
|---|
| 659 |
this.options.afterRefresh(this); |
|---|
| 660 |
} |
|---|
| 661 |
} |
|---|
| 662 |
catch(e){ |
|---|
| 663 |
} |
|---|
| 664 |
},changeCalendar:function(_16){ |
|---|
| 665 |
this.builder.changeCalendar(_16); |
|---|
| 666 |
},changeDisplayType:function(_17){ |
|---|
| 667 |
this.options.displayType=_17; |
|---|
| 668 |
this.refresh(); |
|---|
| 669 |
},selectDate:function(_18){ |
|---|
| 670 |
var _19=this; |
|---|
| 671 |
this.abstractSelect(_18,function(_1a,_1b){ |
|---|
| 672 |
if(_19.selectedBase||_19.hasSelectedDate()){ |
|---|
| 673 |
if(_18.ctrlKey&&_19.options.enableCtrKey){ |
|---|
| 674 |
if(Element.hasClassName(_1b,Calendar.className.selected)){ |
|---|
| 675 |
_19.addSelectedClass(_1b); |
|---|
| 676 |
return; |
|---|
| 677 |
} |
|---|
| 678 |
}else{ |
|---|
| 679 |
if(_19.selectedBase){ |
|---|
| 680 |
var _1c=_19.selectedBase.id; |
|---|
| 681 |
$(_1c).className=_19.selectedBase.className; |
|---|
| 682 |
_19.clearSelected(); |
|---|
| 683 |
if(_1c==_1b.id){ |
|---|
| 684 |
_19.selectedBase=null; |
|---|
| 685 |
return; |
|---|
| 686 |
} |
|---|
| 687 |
} |
|---|
| 688 |
} |
|---|
| 689 |
} |
|---|
| 690 |
_19.selectedBase={id:_1b.id,date:_1a,className:_1b.className}; |
|---|
| 691 |
_19.addSelectedClass(_1b); |
|---|
| 692 |
if(_1a&&_19.options.displayType=="month"&&_19.options.size==Calendar.size.small){ |
|---|
| 693 |
_19.options.afterSelect(_1a,_19); |
|---|
| 694 |
} |
|---|
| 695 |
}); |
|---|
| 696 |
if(_19.options.displayType!="month"||_19.options.size!=Calendar.size.small){ |
|---|
| 697 |
this.mouseDown=true; |
|---|
| 698 |
} |
|---|
| 699 |
},clearSelect:function(){ |
|---|
| 700 |
this.selectedBase=null; |
|---|
| 701 |
this.clearSelected(); |
|---|
| 702 |
},showDayOfWeek:function(_1d){ |
|---|
| 703 |
var _1e=this.options.displayIndexes; |
|---|
| 704 |
this.recurrence(_1d,function(d){ |
|---|
| 705 |
if(!_1e.include(d)){ |
|---|
| 706 |
_1e.push(d); |
|---|
| 707 |
} |
|---|
| 708 |
}); |
|---|
| 709 |
this.setIndex(); |
|---|
| 710 |
this.refresh(); |
|---|
| 711 |
},hideDayOfWeek:function(_20){ |
|---|
| 712 |
var _21=this.options.displayIndexes; |
|---|
| 713 |
var _22=this; |
|---|
| 714 |
this.recurrence(_20,function(d){ |
|---|
| 715 |
var _24=_22.findIndex(_21,d); |
|---|
| 716 |
if(_24){ |
|---|
| 717 |
_21.remove(_24); |
|---|
| 718 |
}else{ |
|---|
| 719 |
if(!_24.isNaN){ |
|---|
| 720 |
_21.shift(); |
|---|
| 721 |
} |
|---|
| 722 |
} |
|---|
| 723 |
}); |
|---|
| 724 |
this.refresh(); |
|---|
| 725 |
},addHoliday:function(_25){ |
|---|
| 726 |
_25=this.inspectArgument(_25); |
|---|
| 727 |
var _26=this.toHolidayHash(_25); |
|---|
| 728 |
this.options.holidays=this.options.holidays.merge(_26); |
|---|
| 729 |
this.refresh(); |
|---|
| 730 |
},removeHoliday:function(_27){ |
|---|
| 731 |
var _28=this; |
|---|
| 732 |
_27=_28.inspectDateArgument(_27); |
|---|
| 733 |
if(!_27){ |
|---|
| 734 |
return; |
|---|
| 735 |
} |
|---|
| 736 |
this.recurrence(_27,function(d){ |
|---|
| 737 |
var key=d.toDateString(); |
|---|
| 738 |
if(_28.options.holidays[key]){ |
|---|
| 739 |
delete _28.options.holidays[key]; |
|---|
| 740 |
} |
|---|
| 741 |
}); |
|---|
| 742 |
this.refresh(); |
|---|
| 743 |
},refreshHoliday:function(_2b,_2c){ |
|---|
| 744 |
_2b=this.inspectArgument(_2b); |
|---|
| 745 |
this.options.holidays=this.toHolidayHash(_2b); |
|---|
| 746 |
if(_2c){ |
|---|
| 747 |
this.refresh(); |
|---|
| 748 |
} |
|---|
| 749 |
},clearHoliday:function(){ |
|---|
| 750 |
this.refreshHoliday([],true); |
|---|
| 751 |
},getHoliday:function(_2d){ |
|---|
| 752 |
_2d=this.inspectDateArgument(_2d); |
|---|
| 753 |
if(!_2d){ |
|---|
| 754 |
return; |
|---|
| 755 |
} |
|---|
| 756 |
var _2e=this; |
|---|
| 757 |
var _2f=[]; |
|---|
| 758 |
this.recurrence(_2d,function(o){ |
|---|
| 759 |
var h=_2e.options.holidays[o.toDateString()]; |
|---|
| 760 |
if(h){ |
|---|
| 761 |
_2f.push(h); |
|---|
| 762 |
} |
|---|
| 763 |
}); |
|---|
| 764 |
return _2f; |
|---|
| 765 |
},addSchedule:function(_32){ |
|---|
| 766 |
var _33=this.options.schedules; |
|---|
| 767 |
if(_32.constructor==Array){ |
|---|
| 768 |
_32.each(function(s){ |
|---|
| 769 |
var _35=_33.detect(function(tmp){ |
|---|
| 770 |
return s.id==tmp.id; |
|---|
| 771 |
}); |
|---|
| 772 |
if(!_35){ |
|---|
| 773 |
_33.push(s); |
|---|
| 774 |
} |
|---|
| 775 |
}); |
|---|
| 776 |
}else{ |
|---|
| 777 |
var _37=_33.detect(function(tmp){ |
|---|
| 778 |
return tmp.id==_32.id; |
|---|
| 779 |
}); |
|---|
| 780 |
if(!_37){ |
|---|
| 781 |
_33.push(_32); |
|---|
| 782 |
} |
|---|
| 783 |
} |
|---|
| 784 |
this.options.schedule=_33.sort(function(a,b){ |
|---|
| 785 |
return DateUtil.toDate(a.start).getTime()-DateUtil.toDate(b.start); |
|---|
| 786 |
}); |
|---|
| 787 |
this.refreshSchedule(); |
|---|
| 788 |
},replaceSchedule:function(_3b){ |
|---|
| 789 |
this.options.schedules=_3b; |
|---|
| 790 |
this.refreshSchedule(); |
|---|
| 791 |
},removeSchedule:function(ids,_3d){ |
|---|
| 792 |
if(ids.constructor!=Array){ |
|---|
| 793 |
ids=[ids]; |
|---|
| 794 |
} |
|---|
| 795 |
var _3e=this; |
|---|
| 796 |
ids.each(function(id){ |
|---|
| 797 |
var _40=null; |
|---|
| 798 |
_3e.options.schedules.each(function(s,i){ |
|---|
| 799 |
if(s.id==id){ |
|---|
| 800 |
_40=i; |
|---|
| 801 |
throw $break; |
|---|
| 802 |
} |
|---|
| 803 |
}); |
|---|
| 804 |
if(_40!=null){ |
|---|
| 805 |
var _43=_3e.options.schedules[_40]; |
|---|
| 806 |
if(_43){ |
|---|
| 807 |
_3e.options.schedules.remove(_40); |
|---|
| 808 |
} |
|---|
| 809 |
} |
|---|
| 810 |
}); |
|---|
| 811 |
if(_3d){ |
|---|
| 812 |
this.refreshSchedule(); |
|---|
| 813 |
} |
|---|
| 814 |
},refreshSchedule:function(){ |
|---|
| 815 |
this.builder.scheduleNodes.each(function(_44){ |
|---|
| 816 |
Element.remove(_44); |
|---|
| 817 |
}); |
|---|
| 818 |
(this.builder.skipNode||[]).each(function(_45){ |
|---|
| 819 |
Element.remove(_45.value); |
|---|
| 820 |
}); |
|---|
| 821 |
this.builder.afterBuild(); |
|---|
| 822 |
},mergeSchedule:function(_46){ |
|---|
| 823 |
var _47=-1; |
|---|
| 824 |
this.options.schedules.each(function(s,i){ |
|---|
| 825 |
if(s.id==_46.id){ |
|---|
| 826 |
_47=i; |
|---|
| 827 |
throw $break; |
|---|
| 828 |
} |
|---|
| 829 |
}); |
|---|
| 830 |
if(_47!=-1){ |
|---|
| 831 |
this.options.schedules[_47]=_46; |
|---|
| 832 |
this.refreshSchedule(); |
|---|
| 833 |
}else{ |
|---|
| 834 |
this.addSchedule(_46); |
|---|
| 835 |
} |
|---|
| 836 |
},clearSchedule:function(){ |
|---|
| 837 |
this.options.schedules=[]; |
|---|
| 838 |
this.refreshSchedule(); |
|---|
| 839 |
},getSchedule:function(_4a){ |
|---|
| 840 |
var _4b=[]; |
|---|
| 841 |
var _4c=this; |
|---|
| 842 |
_4a=this.inspectArgument(_4a||{}); |
|---|
| 843 |
this.recurrence(_4a,function(o){ |
|---|
| 844 |
var _4e=_4c.options.schedules[o.date.toDateString()]; |
|---|
| 845 |
if(!_4e){ |
|---|
| 846 |
return; |
|---|
| 847 |
} |
|---|
| 848 |
if(o.start){ |
|---|
| 849 |
_4e=_4e.detect(function(s){ |
|---|
| 850 |
return ((s.start.hour==o.start.hour)&&(s.start.min==o.start.min)); |
|---|
| 851 |
}); |
|---|
| 852 |
if(_4e){ |
|---|
| 853 |
_4b.push(_4e); |
|---|
| 854 |
} |
|---|
| 855 |
}else{ |
|---|
| 856 |
if(o.number){ |
|---|
| 857 |
_4e=_4e[o.number]; |
|---|
| 858 |
if(_4e){ |
|---|
| 859 |
_4b.push(_4e); |
|---|
| 860 |
} |
|---|
| 861 |
}else{ |
|---|
| 862 |
_4b=_4b.concat(_4e); |
|---|
| 863 |
} |
|---|
| 864 |
} |
|---|
| 865 |
}); |
|---|
| 866 |
return _4b; |
|---|
| 867 |
},getSelected:function(){ |
|---|
| 868 |
return this.element.getElementsByClassName(Calendar.className.selected,this.element); |
|---|
| 869 |
},changeSchedule:function(){ |
|---|
| 870 |
var _50=this; |
|---|
| 871 |
return function(_51,_52){ |
|---|
| 872 |
var _53=_51.id.split("_"); |
|---|
| 873 |
var i=_53.pop(); |
|---|
| 874 |
var _55=_53.pop(); |
|---|
| 875 |
_55=_50.getDate(_55); |
|---|
| 876 |
var _56=_50.getDate(_52); |
|---|
| 877 |
var _57=_50.getSchedule({date:_55,number:i}); |
|---|
| 878 |
if(_57.length!=1){ |
|---|
| 879 |
return; |
|---|
| 880 |
} |
|---|
| 881 |
_57=_57.pop(); |
|---|
| 882 |
_57.date=_56; |
|---|
| 883 |
_50.removeSchedule({date:_55,number:i},false); |
|---|
| 884 |
_50.addSchedule(_57); |
|---|
| 885 |
_50.options.changeSchedule(_57); |
|---|
| 886 |
}; |
|---|
| 887 |
},getSelectedDates:function(){ |
|---|
| 888 |
return this.builder.getSelectedDates(); |
|---|
| 889 |
},getSelectedTerm:function(){ |
|---|
| 890 |
return this.builder.getSelectedTerm(); |
|---|
| 891 |
},isMovedScheduler:function(_58){ |
|---|
| 892 |
var _59=_58.currentDelta(); |
|---|
| 893 |
var _5a=_58.delta; |
|---|
| 894 |
var _5b=5; |
|---|
| 895 |
return (_58.element.moved||!($R(_5a[0]-_5b,_5a[0]).include(_59[0])&&$R(_5a[1]-_5b,_5a[1]).include(_59[1]))); |
|---|
| 896 |
},abstractSelect:function(_5c,_5d){ |
|---|
| 897 |
this.builder.abstractSelect(_5c,_5d); |
|---|
| 898 |
},createRange:function(a,b){ |
|---|
| 899 |
var _60=null; |
|---|
| 900 |
if(a<=b){ |
|---|
| 901 |
_60=$R(a,b); |
|---|
| 902 |
}else{ |
|---|
| 903 |
_60=$R(b,a); |
|---|
| 904 |
} |
|---|
| 905 |
return _60; |
|---|
| 906 |
},formatTime:function(_61){ |
|---|
| 907 |
var _62=(_61.hour<10)?"0"+_61.hour:_61.hour; |
|---|
| 908 |
var min=(_61.min<10)?"0"+_61.min:_61.min; |
|---|
| 909 |
return _62+":"+min; |
|---|
| 910 |
},clearSelected:function(){ |
|---|
| 911 |
var _64=this.getSelected(); |
|---|
| 912 |
var _65=this; |
|---|
| 913 |
_64.each(function(e){ |
|---|
| 914 |
if(Element.hasClassName(e,Calendar.className.selected)){ |
|---|
| 915 |
_65.removeSelectedClass(e); |
|---|
| 916 |
} |
|---|
| 917 |
}); |
|---|
| 918 |
},onDblClick:function(_67){ |
|---|
| 919 |
this.abstractSelect(_67,this.options.dblclickListener); |
|---|
| 920 |
},onMouseUp:function(_68){ |
|---|
| 921 |
var e=_68||window.event; |
|---|
| 922 |
var _6a=this; |
|---|
| 923 |
if(_6a.mouseDown){ |
|---|
| 924 |
setTimeout(function(){ |
|---|
| 925 |
_6a.mouseDown=false; |
|---|
| 926 |
_6a.options.afterSelect(_68); |
|---|
| 927 |
},10); |
|---|
| 928 |
} |
|---|
| 929 |
},setRegularHolidayClass:function(_6b){ |
|---|
| 930 |
this.classNames.refreshClassNames(_6b,"regularHoliday"); |
|---|
| 931 |
},getHolidayClass:function(){ |
|---|
| 932 |
this.classNames.refreshClassNames(node,"holiday"); |
|---|
| 933 |
},setWorkdayClass:function(_6c){ |
|---|
| 934 |
this.classNames.refreshClassNames(_6c,"date"); |
|---|
| 935 |
},setScheduleClass:function(_6d){ |
|---|
| 936 |
this.classNames.refreshClassNames(_6d,"schedule"); |
|---|
| 937 |
},addSelectedClass:function(_6e){ |
|---|
| 938 |
this.css.addClassNames(_6e,"selected"); |
|---|
| 939 |
},removeSelectedClass:function(_6f){ |
|---|
| 940 |
this.css.removeClassNames(_6f,"selected"); |
|---|
| 941 |
},getDatasWithMonthAndYear:function(_70){ |
|---|
| 942 |
var _71=this; |
|---|
| 943 |
var _72=_70.findAll(function(h){ |
|---|
| 944 |
return _71.isSameYearAndMonth(h.date); |
|---|
| 945 |
}); |
|---|
| 946 |
return _72; |
|---|
| 947 |
},isSameYearAndMonth:function(a,b){ |
|---|
| 948 |
if(a.constructor==Date){ |
|---|
| 949 |
if(!b){ |
|---|
| 950 |
b=this.date; |
|---|
| 951 |
} |
|---|
| 952 |
return ((a.getYear()==b.getYear())&&(a.getMonth()==b.getMonth())); |
|---|
| 953 |
}else{ |
|---|
| 954 |
return (a.year==b.year&&a.month==b.month&&a.day==a.day); |
|---|
| 955 |
} |
|---|
| 956 |
},isSameDate:function(a,b){ |
|---|
| 957 |
if(a.constructor==Date){ |
|---|
| 958 |
if(!b){ |
|---|
| 959 |
b=this.date; |
|---|
| 960 |
} |
|---|
| 961 |
return (this.isSameYearAndMonth(a,b)&&(a.getDate()==b.getDate())); |
|---|
| 962 |
}else{ |
|---|
| 963 |
return (this.isSameYearAndMonth(a,b)&&a.day==b.day); |
|---|
| 964 |
} |
|---|
| 965 |
},isSameTime:function(a,b){ |
|---|
| 966 |
return ((a.hour==b.hour)&&(a.min==b.min)); |
|---|
| 967 |
},betweenDate:function(_7a,_7b){ |
|---|
| 968 |
var _7c=this.toDateNumber(_7a.start); |
|---|
| 969 |
var _7d=this.toDateNumber(_7a.finish); |
|---|
| 970 |
_7b=this.toDateNumber(_7b); |
|---|
| 971 |
return _7c<=_7b&&_7b<=_7d; |
|---|
| 972 |
},toDateNumber:function(_7e){ |
|---|
| 973 |
if(_7e.constructor==Date){ |
|---|
| 974 |
return _7e.getFullYear()*10000+_7e.getMonth()*100+_7e.getDate(); |
|---|
| 975 |
}else{ |
|---|
| 976 |
return _7e.year*10000+_7e.month*100+_7e.day; |
|---|
| 977 |
} |
|---|
| 978 |
},getTimeDiff:function(a,b){ |
|---|
| 979 |
var _81={hour:b.hour-a.hour,min:b.min-a.min}; |
|---|
| 980 |
if(_81.min>=60){ |
|---|
| 981 |
_81.hour++; |
|---|
| 982 |
_81.min-=60; |
|---|
| 983 |
}else{ |
|---|
| 984 |
if(_81.min<0){ |
|---|
| 985 |
_81.hour--; |
|---|
| 986 |
_81.min+=60; |
|---|
| 987 |
} |
|---|
| 988 |
} |
|---|
| 989 |
return _81; |
|---|
| 990 |
},findIndex:function(_82,_83){ |
|---|
| 991 |
var _84=null; |
|---|
| 992 |
_82.each(function(v,i){ |
|---|
| 993 |
if(v==_83){ |
|---|
| 994 |
_84=i; |
|---|
| 995 |
throw $break; |
|---|
| 996 |
} |
|---|
| 997 |
}); |
|---|
| 998 |
return _84; |
|---|
| 999 |
},recurrence:function(_87,_88){ |
|---|
| 1000 |
var _89=this; |
|---|
| 1001 |
if(_87.constructor==Array){ |
|---|
| 1002 |
_87.each(function(o){ |
|---|
| 1003 |
_89.recurrence(o,_88); |
|---|
| 1004 |
}); |
|---|
| 1005 |
}else{ |
|---|
| 1006 |
if(_87.keys){ |
|---|
| 1007 |
_87.each(function(_8b){ |
|---|
| 1008 |
_89.recurrence(_8b[1],_88); |
|---|
| 1009 |
}); |
|---|
| 1010 |
}else{ |
|---|
| 1011 |
_88(_87); |
|---|
| 1012 |
} |
|---|
| 1013 |
} |
|---|
| 1014 |
},toHolidayHash:function(_8c){ |
|---|
| 1015 |
var _8d=this; |
|---|
| 1016 |
var _8e={}; |
|---|
| 1017 |
this.recurrence(_8c,function(o){ |
|---|
| 1018 |
if(!o.name){ |
|---|
| 1019 |
return; |
|---|
| 1020 |
} |
|---|
| 1021 |
if(o.date.constructor==Object){ |
|---|
| 1022 |
o.date=new Date(o.date.year,o.date.month,o.date.day); |
|---|
| 1023 |
} |
|---|
| 1024 |
_8e[o.date.toDateString()]=o; |
|---|
| 1025 |
}); |
|---|
| 1026 |
return $H(_8e); |
|---|
| 1027 |
},inspectArgument:function(_90,_91){ |
|---|
| 1028 |
return this.builder.inspectArgument(_90,_91); |
|---|
| 1029 |
},inspectDateArgument:function(_92){ |
|---|
| 1030 |
return this.builder.inspectDateArgument(_92); |
|---|
| 1031 |
},sortSchedule:function(a,b){ |
|---|
| 1032 |
if(a.start.hour==b.start.hour){ |
|---|
| 1033 |
if(a.start.min==b.start.min){ |
|---|
| 1034 |
return 0; |
|---|
| 1035 |
} |
|---|
| 1036 |
if(a.start.min<b.start.min){ |
|---|
| 1037 |
return -1; |
|---|
| 1038 |
} |
|---|
| 1039 |
return 1; |
|---|
| 1040 |
} |
|---|
| 1041 |
if(a.start.hour<b.start.hour){ |
|---|
| 1042 |
return -1; |
|---|
| 1043 |
} |
|---|
| 1044 |
return 1; |
|---|
| 1045 |
},hasSelectedDate:function(){ |
|---|
| 1046 |
return (this.getSelected().length!=0); |
|---|
| 1047 |
},getDate:function(_95){ |
|---|
| 1048 |
return this.builder.getDate(_95); |
|---|
| 1049 |
},isRegularHoliday:function(day){ |
|---|
| 1050 |
return this.options.regularHoliday.include(day); |
|---|
| 1051 |
},isHoliday:function(_97){ |
|---|
| 1052 |
return this.options.holidays[_97.toDateString()]; |
|---|
| 1053 |
},isScheduleDay:function(_98){ |
|---|
| 1054 |
return this.options.schedules[_98.toDateString()]; |
|---|
| 1055 |
},cacheSchedule:function(_99){ |
|---|
| 1056 |
this.cached=_99; |
|---|
| 1057 |
_99.start_old=Object.clone(_99.start); |
|---|
| 1058 |
_99.finish_old=Object.clone(_99.finish); |
|---|
| 1059 |
}}; |
|---|
| 1060 |
var AbstractCalendar=Class.create(); |
|---|
| 1061 |
AbstractCalendar.id={container:"container",scheduleContainer:"scheduleContainer",selector:"selector",tooltip:"tooltip"}; |
|---|
| 1062 |
AbstractCalendar.prototype={destroy:Prototype.emptyFunction,beforeBuild:Prototype.emptyFunction,build:function(){ |
|---|
| 1063 |
return "<div id='"+this.getContainerId()+"' class='"+this.calendar.classNames.container+"'>"+this.buildHeader()+this.buildCalendar()+"<div id=\""+this.getTooltipId()+"\" class=\"calendar_tooltip\" style=\"display: none;\"></div>"+"</div>"; |
|---|
| 1064 |
},buildHeader:function(){ |
|---|
| 1065 |
var _9a=this.calendar.options.noEvent; |
|---|
| 1066 |
return "<table class='"+this.calendar.classNames.header+"' style='table-layout: auto;'>"+"<tr>"+(_9a?"":this.buildHeaderLeft())+this.buildHeaderCenter()+(_9a?"":this.buildHeaderRight())+"</tr>"+"</table>"; |
|---|
| 1067 |
},buildSelector:function(){ |
|---|
| 1068 |
var _9b="display: none; zindex:"+ZindexManager.getIndex(); |
|---|
| 1069 |
return "<div id='"+this.getSelectorId()+"' class='"+this.calendar.classNames.selector+"' style='"+_9b+"'>"+"</div>"; |
|---|
| 1070 |
},buildCover:function(){ |
|---|
| 1071 |
this.cover=Builder.node("div",{id:this.calendar.element.id.appendSuffix("cover")}); |
|---|
| 1072 |
this.calendar.css.addClassNames(this.cover,"cover"); |
|---|
| 1073 |
if(!this.calendar.options.noEvent){ |
|---|
| 1074 |
Event.observe(this.cover,"mousedown",this.calendar.selectDate.bindAsEventListener(this.calendar)); |
|---|
| 1075 |
if(this.calendar.options.displayType!="month"||this.calendar.options.size!="samll"){ |
|---|
| 1076 |
Event.observe(this.cover,"mousemove",this.multipleSelection.bindAsEventListener(this)); |
|---|
| 1077 |
} |
|---|
| 1078 |
} |
|---|
| 1079 |
return this.cover; |
|---|
| 1080 |
},changeCalendar:function(_9c){ |
|---|
| 1081 |
var _9d=Event.element(_9c); |
|---|
| 1082 |
if(_9d.tagName.toLowerCase().match(/a/)){ |
|---|
| 1083 |
_9d=_9d.parentNode; |
|---|
| 1084 |
} |
|---|
| 1085 |
var _9e=this.calendar.date; |
|---|
| 1086 |
var _9f=new Date(_9e.toDateString()); |
|---|
| 1087 |
if(this.hasClassName(_9d,Calendar.className.preYearMark)||this.hasClassName(_9d,Calendar.className.preYearMark2)){ |
|---|
| 1088 |
_9e.setDate(1); |
|---|
| 1089 |
_9e.setFullYear(_9e.getFullYear()-1); |
|---|
| 1090 |
}else{ |
|---|
| 1091 |
if(this.hasClassName(_9d,Calendar.className.preMonthMark)||this.hasClassName(_9d,Calendar.className.preMonthMark2)){ |
|---|
| 1092 |
_9e.setDate(1); |
|---|
| 1093 |
_9e.setMonth(_9e.getMonth()-1); |
|---|
| 1094 |
}else{ |
|---|
| 1095 |
if(this.hasClassName(_9d,Calendar.className.preWeekMark)||this.hasClassName(_9d,Calendar.className.preWeekMark2)){ |
|---|
| 1096 |
_9e.setDate(_9e.getDate()-7); |
|---|
| 1097 |
}else{ |
|---|
| 1098 |
if(this.hasClassName(_9d,Calendar.className.nextYearMark)||this.hasClassName(_9d,Calendar.className.nextYearMark2)){ |
|---|
| 1099 |
_9e.setDate(1); |
|---|
| 1100 |
_9e.setFullYear(_9e.getFullYear()+1); |
|---|
| 1101 |
}else{ |
|---|
| 1102 |
if(this.hasClassName(_9d,Calendar.className.nextMonthMark)||this.hasClassName(_9d,Calendar.className.nextMonthMark2)){ |
|---|
| 1103 |
_9e.setDate(1); |
|---|
| 1104 |
_9e.setMonth(_9e.getMonth()+1); |
|---|
| 1105 |
}else{ |
|---|
| 1106 |
if(this.hasClassName(_9d,Calendar.className.nextWeekMark)||this.hasClassName(_9d,Calendar.className.nextWeekMark2)){ |
|---|
| 1107 |
_9e.setDate(_9e.getDate()+7); |
|---|
| 1108 |
} |
|---|
| 1109 |
} |
|---|
| 1110 |
} |
|---|
| 1111 |
} |
|---|
| 1112 |
} |
|---|
| 1113 |
} |
|---|
| 1114 |
this.calendar.options.changeCalendar(_9e,_9f); |
|---|
| 1115 |
this.calendar.refresh(); |
|---|
| 1116 |
},hasClassName:function(_a0,_a1){ |
|---|
| 1117 |
return Element.hasClassName(_a0,_a1)||Element.hasClassName(_a0,_a1+"Hover"); |
|---|
| 1118 |
},clickDeleteImage:function(_a2){ |
|---|
| 1119 |
if(this.calendar.options.beforeRemoveSchedule(_a2)){ |
|---|
| 1120 |
this.calendar.removeSchedule(_a2.id,true); |
|---|
| 1121 |
} |
|---|
| 1122 |
},clickCopyImage:function(_a3){ |
|---|
| 1123 |
this.calendar.options.copySchedule(_a3,true); |
|---|
| 1124 |
},showImage:function(_a4,_a5){ |
|---|
| 1125 |
_a4.each(function(img){ |
|---|
| 1126 |
Element.show(img); |
|---|
| 1127 |
}); |
|---|
| 1128 |
if(_a5){ |
|---|
| 1129 |
Element.setStyle(_a5,{right:(17*_a4.length)+"px"}); |
|---|
| 1130 |
} |
|---|
| 1131 |
},hideImage:function(_a7,_a8){ |
|---|
| 1132 |
_a7.each(function(img){ |
|---|
| 1133 |
Element.hide(img); |
|---|
| 1134 |
}); |
|---|
| 1135 |
if(_a8){ |
|---|
| 1136 |
Element.setStyle(_a8,{right:"0px"}); |
|---|
| 1137 |
} |
|---|
| 1138 |
},_constrain:function(n,_ab,_ac){ |
|---|
| 1139 |
if(n>_ac){ |
|---|
| 1140 |
return _ac; |
|---|
| 1141 |
}else{ |
|---|
| 1142 |
if(n<_ab){ |
|---|
| 1143 |
return _ab; |
|---|
| 1144 |
}else{ |
|---|
| 1145 |
return n; |
|---|
| 1146 |
} |
|---|
| 1147 |
} |
|---|
| 1148 |
},getContainerId:function(){ |
|---|
| 1149 |
return this.calendar.element.id.appendSuffix(AbstractCalendar.id.container); |
|---|
| 1150 |
},getTooltipId:function(){ |
|---|
| 1151 |
return this.calendar.element.id.appendSuffix(AbstractCalendar.id.tooltip); |
|---|
| 1152 |
},getScheduleContainerId:function(){ |
|---|
| 1153 |
return this.calendar.element.id.appendSuffix(AbstractCalendar.id.scheduleContainer); |
|---|
| 1154 |
},setColumnWidth:function(){ |
|---|
| 1155 |
var _ad=this.getAdjustSize(); |
|---|
| 1156 |
var _ae=$(this.getScheduleContainerId())||this.container; |
|---|
| 1157 |
var _af=this.calendar.options.displayIndexes; |
|---|
| 1158 |
this.column.width=_ae.offsetWidth/_af.length-_ad; |
|---|
| 1159 |
if(this.column.width<0){ |
|---|
| 1160 |
this.column.width=0; |
|---|
| 1161 |
} |
|---|
| 1162 |
},setCover:function(){ |
|---|
| 1163 |
var _b0=$(this.getScheduleContainerId())||this.container; |
|---|
| 1164 |
this.cover=this.cover||$(this.calendar.element.id.appendSuffix("cover")); |
|---|
| 1165 |
if(this.cover){ |
|---|
| 1166 |
this.cover.remove(); |
|---|
| 1167 |
this.cover=null; |
|---|
| 1168 |
} |
|---|
| 1169 |
_b0.appendChild(this.buildCover()); |
|---|
| 1170 |
Element.setStyle(this.cover,{height:Element.getHeight(_b0)+"px"}); |
|---|
| 1171 |
},getDragDistance:function(){ |
|---|
| 1172 |
var _b1=this.getAdjustSize(); |
|---|
| 1173 |
return [this.column.width+_b1,this.column.height/2]; |
|---|
| 1174 |
},getWeek:function(){ |
|---|
| 1175 |
var _b2=this.calendar.date; |
|---|
| 1176 |
var _b3=this.calendar.sortWeekIndex([0,1,2,3,4,5,6]); |
|---|
| 1177 |
var _b4=_b2.getDay(); |
|---|
| 1178 |
var _b5=_b3.indexOf(_b4); |
|---|
| 1179 |
var _b6=[]; |
|---|
| 1180 |
var _b7=[]; |
|---|
| 1181 |
var _b8=this.calendar.options.displayIndexes; |
|---|
| 1182 |
_b3.each(function(_b9){ |
|---|
| 1183 |
var _ba=_b9-_b4; |
|---|
| 1184 |
var _bb=_b3.indexOf(_b9); |
|---|
| 1185 |
if((_bb<_b5)&&(_ba>0)){ |
|---|
| 1186 |
_ba-=7; |
|---|
| 1187 |
}else{ |
|---|
| 1188 |
if((_bb>_b5)&&(_ba<0)){ |
|---|
| 1189 |
_ba+=7; |
|---|
| 1190 |
} |
|---|
| 1191 |
} |
|---|
| 1192 |
var _bc=DateUtil.afterDays(_b2,_ba); |
|---|
| 1193 |
if(_b8.indexOf(_b9)>=0){ |
|---|
| 1194 |
_b6.push(_bc); |
|---|
| 1195 |
}else{ |
|---|
| 1196 |
_b7.push(_bc); |
|---|
| 1197 |
} |
|---|
| 1198 |
}.bind(this)); |
|---|
| 1199 |
return [_b6,_b7]; |
|---|
| 1200 |
},isSameStartDate:function(_bd,_be){ |
|---|
| 1201 |
return ((_be.getFullYear()==_bd.start.year)&&(_be.getMonth()==_bd.start.month)&&(_be.getDate()==_bd.start.day)); |
|---|
| 1202 |
},isSameFinishDate:function(_bf,_c0){ |
|---|
| 1203 |
return ((_c0.getFullYear()==_bf.finish.year)&&(_c0.getMonth()==_bf.finish.month)&&(_c0.getDate()==_bf.finish.day)); |
|---|
| 1204 |
},getSelectorId:function(){ |
|---|
| 1205 |
return this.calendar.element.id.appendSuffix(AbstractCalendar.id.selector); |
|---|
| 1206 |
},clickDateText:function(_c1,_c2){ |
|---|
| 1207 |
Event.stop(_c1); |
|---|
| 1208 |
this.calendar.date=_c2; |
|---|
| 1209 |
this.calendar.options.displayType="day"; |
|---|
| 1210 |
this.calendar.refresh(); |
|---|
| 1211 |
},getAdjustSize:function(){ |
|---|
| 1212 |
return 3; |
|---|
| 1213 |
},setContainerInfo:function(){ |
|---|
| 1214 |
this.container=$(this.getScheduleContainerId()); |
|---|
| 1215 |
this.containerDimensions=Element.getDimensions(this.container); |
|---|
| 1216 |
this.containerOffset=Position.cumulativeOffset(this.container); |
|---|
| 1217 |
},mouseOverSubSchedule:function(_c3){ |
|---|
| 1218 |
_c3.each(function(_c4){ |
|---|
| 1219 |
var _c5=Element.getStyle(_c4,"borderTopColor"); |
|---|
| 1220 |
var _c6=Element.getStyle(_c4,"borderTop"); |
|---|
| 1221 |
if(_c5&&(_c5!="")&&_c6&&(_c6!="")){ |
|---|
| 1222 |
if(!_c4.originalBorderColor){ |
|---|
| 1223 |
_c4.originalBorderColor=_c5; |
|---|
| 1224 |
} |
|---|
| 1225 |
Element.setStyle(_c4,{borderColor:new Color(_c5).invert()}); |
|---|
| 1226 |
}else{ |
|---|
| 1227 |
Element.addClassName(_c4,Calendar.className.scheduleItemSelect); |
|---|
| 1228 |
} |
|---|
| 1229 |
}); |
|---|
| 1230 |
},mouseOutSubSchedule:function(_c7){ |
|---|
| 1231 |
_c7.each(function(_c8){ |
|---|
| 1232 |
if(_c8.originalBorderColor){ |
|---|
| 1233 |
Element.setStyle(_c8,{borderColor:_c8.originalBorderColor}); |
|---|
| 1234 |
}else{ |
|---|
| 1235 |
Element.removeClassName(_c8,Calendar.className.scheduleItemSelect); |
|---|
| 1236 |
} |
|---|
| 1237 |
}); |
|---|
| 1238 |
},toDate:function(_c9){ |
|---|
| 1239 |
return DateUtil.toDate(_c9); |
|---|
| 1240 |
},getCalendarTableId:function(){ |
|---|
| 1241 |
return this.ids.calTable; |
|---|
| 1242 |
},setSkipNode:function(){ |
|---|
| 1243 |
var _ca=new Template(this.calendar.options.skipString); |
|---|
| 1244 |
this.skipNode.each(function(_cb){ |
|---|
| 1245 |
_cb.value.innerHTML=_ca.evaluate({count:this.skipSchedules[_cb.key].length}); |
|---|
| 1246 |
}.bind(this)); |
|---|
| 1247 |
},clickSkipNode:function(){ |
|---|
| 1248 |
this.hideTooltip(); |
|---|
| 1249 |
this.calendar.options.clickSkipNode.apply(this,arguments); |
|---|
| 1250 |
},showTooltip:function(e,id,_ce){ |
|---|
| 1251 |
var _cf=$(this.getTooltipId()); |
|---|
| 1252 |
var _d0=this.skipSchedules[id]; |
|---|
| 1253 |
var _d1=null; |
|---|
| 1254 |
var _d2=null; |
|---|
| 1255 |
_cf.innerHTML=_d0.map(function(s){ |
|---|
| 1256 |
_d1=(DateUtil.toDate(s.start).sameDate(_ce))?s.start:{hour:0,min:0}; |
|---|
| 1257 |
_d2=(DateUtil.toDate(s.finish).sameDate(_ce))?s.finish:{hour:0,min:0}; |
|---|
| 1258 |
return this.calendar.formatTime(_d1)+"-"+this.calendar.formatTime(_d2)+" "+s.description; |
|---|
| 1259 |
}.bind(this)).join("<br />"); |
|---|
| 1260 |
Element.positionedByCursor(_cf,e,{top:10,left:10}); |
|---|
| 1261 |
_cf.show(); |
|---|
| 1262 |
},hideTooltip:function(){ |
|---|
| 1263 |
$(this.getTooltipId()).hide(); |
|---|
| 1264 |
}}; |
|---|
| 1265 |
var CalendarMonth=Class.create(); |
|---|
| 1266 |
CalendarMonth.id=["year","month","column","nextYear","nextMonth","preYear","preMonth","calTable","scheduleContainer","container","emptyRow"]; |
|---|
| 1267 |
Object.extend(CalendarMonth.prototype,AbstractCalendar.prototype); |
|---|
| 1268 |
Object.extend(CalendarMonth.prototype,{initialize:function(_d4){ |
|---|
| 1269 |
this.calendar=_d4; |
|---|
| 1270 |
this.week=this.getWeek()[0]; |
|---|
| 1271 |
this.ids=SpinelzUtil.concat(this.calendar.element.id,CalendarMonth.id); |
|---|
| 1272 |
this.columnIds=[]; |
|---|
| 1273 |
},buildHeaderLeft:function(){ |
|---|
| 1274 |
if(this.calendar.options.useImgMark){ |
|---|
| 1275 |
return "<td class='"+this.calendar.classNames.preYears+"'>"+"<div id='"+this.ids.preYear+"' class='"+this.calendar.classNames.preYearMark+"'></div>"+"<div id='"+this.ids.preMonth+"' class='"+this.calendar.classNames.preMonthMark+"'></div>"+"</td>"; |
|---|
| 1276 |
} |
|---|
| 1277 |
return "<td class='"+this.calendar.classNames.preYears2+"'>"+"<div id='"+this.ids.preYear+"' class='"+this.calendar.classNames.preYearMark2+"'><a href=\"javascript:void(0)\">"+Calendar.marks.preYear+"</a></div>"+"<div id='"+this.ids.preMonth+"' class='"+this.calendar.classNames.preMonthMark2+"'><a href=\"javascript:void(0)\">"+Calendar.marks.preMonth+"</a></div>"+"</td>"; |
|---|
| 1278 |
},buildHeaderCenter:function(){ |
|---|
| 1279 |
var _d5=[]; |
|---|
| 1280 |
if(this.calendar.options.monthHeaderFormat){ |
|---|
| 1281 |
var _d6=this.calendar.date; |
|---|
| 1282 |
var _d7=new Template(this.calendar.options.monthHeaderFormat).evaluate({year:_d6.getFullYear(),month:_d6.getMonth()+1}); |
|---|
| 1283 |
_d5=[_d7," "]; |
|---|
| 1284 |
} |
|---|
| 1285 |
return "<td class='"+this.calendar.classNames.years+"'>"+"<span id='"+this.ids.month+"' class='"+this.calendar.classNames.ym+"'>"+(_d5[0]||DateUtil.months[this.calendar.date.getMonth()])+"</span>"+"<span id='"+this.ids.year+"' class='"+this.calendar.classNames.ym+"'>"+(_d5[1]||this.calendar.date.getFullYear())+"</span>"+"</td>"; |
|---|
| 1286 |
},buildHeaderRight:function(){ |
|---|
| 1287 |
if(this.calendar.options.useImgMark){ |
|---|
| 1288 |
return "<td class='"+this.calendar.classNames.nextYears+"'>"+"<div id='"+this.ids.nextMonth+"' class='"+this.calendar.classNames.nextMonthMark+"'></div>"+"<div id='"+this.ids.nextYear+"' class='"+this.calendar.classNames.nextYearMark+"'></div>"+"</td>"; |
|---|
| 1289 |
} |
|---|
| 1290 |
return "<td class='"+this.calendar.classNames.nextYears2+"' align='right'>"+"<div id='"+this.ids.nextMonth+"' class='"+this.calendar.classNames.nextMonthMark2+"'><a href=\"javascript:void(0)\">"+Calendar.marks.nextMonth+"</a></div>"+"<div id='"+this.ids.nextYear+"' class='"+this.calendar.classNames.nextYearMark2+"'><a href=\"javascript:void(0)\">"+Calendar.marks.nextYear+"</a></div>"+"</td>"; |
|---|
| 1291 |
},buildCalendar:function(){ |
|---|
| 1292 |
return "<div>"+this.buildTableHeader()+this.buildScheduleContainer()+"</div>"; |
|---|
| 1293 |
},buildTableHeader:function(){ |
|---|
| 1294 |
var _d8=100/this.calendar.options.displayIndexes.length+"%"; |
|---|
| 1295 |
var _d9=this.calendar.options.displayIndexes.last(); |
|---|
| 1296 |
var _da=this.ids.column; |
|---|
| 1297 |
var _db=this.calendar.options.displayIndexes.inject("",function(_dc,i){ |
|---|
| 1298 |
var id=_da.appendSuffix(i); |
|---|
| 1299 |
this.columnIds.push(id); |
|---|
| 1300 |
var _df=(_d9==i)?this.calendar.classNames.thRight:""; |
|---|
| 1301 |
_dc+="<th id='"+id+"' class='"+_df+"' width='"+_d8+"'>"+this.calendar.options.dayOfWeek[i]+"</th>"; |
|---|
| 1302 |
return _dc; |
|---|
| 1303 |
}.bind(this)); |
|---|
| 1304 |
return "<table class='"+this.calendar.classNames.table+"'>"+"<tr>"+_db+"</tr>"+"</table>"; |
|---|
| 1305 |
},buildScheduleContainer:function(){ |
|---|
| 1306 |
var _e0=(this.calendar.options.size=="large")?"position: relative":""; |
|---|
| 1307 |
return "<div id='"+this.getScheduleContainerId()+"' style='"+_e0+";'>"+this.buildTableData()+this.buildSelector()+"</div>"; |
|---|
| 1308 |
},buildTableData:function(){ |
|---|
| 1309 |
var _e1=this.calendar.options.displayIndexes; |
|---|
| 1310 |
var _e2=new Date(); |
|---|
| 1311 |
var _e3=this.calendar.date.getFullYear(); |
|---|
| 1312 |
var _e4=this.calendar.date.getMonth(); |
|---|
| 1313 |
var _e5=DateUtil.getFirstDate(_e3,_e4).getDay(); |
|---|
| 1314 |
var _e6=DateUtil.getLastDate(_e3,_e4).getDate(); |
|---|
| 1315 |
var trs=[]; |
|---|
| 1316 |
var tds=[]; |
|---|
| 1317 |
var _e9=100/_e1.length+"%"; |
|---|
| 1318 |
var _ea=_e1.last(); |
|---|
| 1319 |
var _eb,_ec,_ed,_ee,_ef,i=null; |
|---|
| 1320 |
this.dateMap={}; |
|---|
| 1321 |
var _f1=this.calendar.options.weekIndex; |
|---|
| 1322 |
var _f2=DateUtil.dayOfWeek.length*6; |
|---|
| 1323 |
var i=null; |
|---|
| 1324 |
var day=1; |
|---|
| 1325 |
if(_f1<=_e5){ |
|---|
| 1326 |
i=_f1; |
|---|
| 1327 |
_f2+=i; |
|---|
| 1328 |
}else{ |
|---|
| 1329 |
i=_f1-7; |
|---|
| 1330 |
_f2-=i; |
|---|
| 1331 |
} |
|---|
| 1332 |
var _f4=_e5-_f1; |
|---|
| 1333 |
if(_f4<0){ |
|---|
| 1334 |
_f4+DateUtil.dayOfWeek.length; |
|---|
| 1335 |
} |
|---|
| 1336 |
if((_e6+_f4)>_f2){ |
|---|
| 1337 |
_f2+=DateUtil.dayOfWeek.length; |
|---|
| 1338 |
} |
|---|
| 1339 |
var _f5=_f1; |
|---|
| 1340 |
var _f6=0; |
|---|
| 1341 |
for(;i<_f2;i++){ |
|---|
| 1342 |
if(_e1.include(_f5)){ |
|---|
| 1343 |
var _f7=(_f5==_ea)?this.calendar.classNames.tdRight:""; |
|---|
| 1344 |
if(i<_e5){ |
|---|
| 1345 |
var _f8=i-_e5+1; |
|---|
| 1346 |
_ee=new Date(this.calendar.date.getFullYear(),this.calendar.date.getMonth(),_f8); |
|---|
| 1347 |
tds.push(this.buildEmptyRow(_ee,_e9,_f7,_f8)); |
|---|
| 1348 |
}else{ |
|---|
| 1349 |
if(day>_e6){ |
|---|
| 1350 |
_ee=new Date(this.calendar.date.getFullYear(),this.calendar.date.getMonth(),day); |
|---|
| 1351 |
tds.push(this.buildEmptyRow(_ee,_e9,_f7,day)); |
|---|
| 1352 |
}else{ |
|---|
| 1353 |
if(i==_e5){ |
|---|
| 1354 |
_f2+=_f6; |
|---|
| 1355 |
} |
|---|
| 1356 |
_ee=new Date(this.calendar.date.getFullYear(),this.calendar.date.getMonth(),day); |
|---|
| 1357 |
_ec=this.calendar.options.holidays[_ee.toDateString()]; |
|---|
| 1358 |
if(this.calendar.options.size==Calendar.size.large){ |
|---|
| 1359 |
tds.push(this.buildLargeRow(_ee,_ec,_e2,_e9,_f7)); |
|---|
| 1360 |
}else{ |
|---|
| 1361 |
_ed=this.calendar.options.schedules.detect(function(_f9){ |
|---|
| 1362 |
return this.calendar.betweenDate(_f9,_ee); |
|---|
| 1363 |
}.bind(this)); |
|---|
| 1364 |
tds.push(this.buildSmallRow(_ee,_ec,_ed,_e2,_e9,_f7)); |
|---|
| 1365 |
} |
|---|
| 1366 |
} |
|---|
| 1367 |
} |
|---|
| 1368 |
_f6++; |
|---|
| 1369 |
} |
|---|
| 1370 |
if(i>=_e5){ |
|---|
| 1371 |
day++; |
|---|
| 1372 |
} |
|---|
| 1373 |
if(_f5==_ea){ |
|---|
| 1374 |
if(!(tds.first().match(/empty/)&&tds.last().match(/empty/))){ |
|---|
| 1375 |
trs.push("<tr>"+tds.join("")+"</tr>"); |
|---|
| 1376 |
} |
|---|
| 1377 |
tds=[]; |
|---|
| 1378 |
} |
|---|
| 1379 |
if(_f5>=6){ |
|---|
| 1380 |
_f5=0; |
|---|
| 1381 |
}else{ |
|---|
| 1382 |
_f5++; |
|---|
| 1383 |
} |
|---|
| 1384 |
} |
|---|
| 1385 |
this.rowMax=trs.length-1; |
|---|
| 1386 |
return "<table id='"+this.getCalendarTableId()+"' class='"+this.calendar.classNames.table+"'>"+trs.join("")+"</table>"; |
|---|
| 1387 |
},buildEmptyRow:function(_fa,_fb,_fc,_fd){ |
|---|
| 1388 |
var id=this.ids.emptyRow.appendSuffix(_fd); |
|---|
| 1389 |
this.dateMap[id]=_fa; |
|---|
| 1390 |
return "<td id='"+id+"' class='"+_fc+"' width='"+_fb+"'> </td>"; |
|---|
| 1391 |
},buildLargeRow:function(_ff,_100,_101,_102,_103){ |
|---|
| 1392 |
var _104=null; |
|---|
| 1393 |
var _105=(_ff.days()==_101.days())?this.calendar.classNames.highlightDay:""; |
|---|
| 1394 |
var _106=this.calendar.options.clickDateText; |
|---|
| 1395 |
if(_106||(_106==null)){ |
|---|
| 1396 |
_104="<span class='"+_105+"'>"+_ff.getDate()+"</span>"; |
|---|
| 1397 |
}else{ |
|---|
| 1398 |
_104="<span class='"+_105+"' style='text-decoration: none;'>"+_ff.getDate()+"</span>"; |
|---|
| 1399 |
} |
|---|
| 1400 |
var _107=""; |
|---|
| 1401 |
var name=""; |
|---|
| 1402 |
if(_100){ |
|---|
| 1403 |
_107=this.calendar.classNames.holiday; |
|---|
| 1404 |
name="<span class='"+this.calendar.classNames.holidayName+"'>"+_100.name+"</span>"; |
|---|
| 1405 |
}else{ |
|---|
| 1406 |
if(this.calendar.isRegularHoliday(_ff.getDay())){ |
|---|
| 1407 |
_107=this.calendar.classNames.regularHoliday; |
|---|
| 1408 |
}else{ |
|---|
| 1409 |
_107=this.calendar.classNames.date; |
|---|
| 1410 |
} |
|---|
| 1411 |
} |
|---|
| 1412 |
_103=[_107,_103]; |
|---|
| 1413 |
var id=this.getDateId(_ff); |
|---|
| 1414 |
this.dateMap[id]=_ff; |
|---|
| 1415 |
return "<td id='"+id+"' class='"+_103.join(" ")+"' width='"+_102+"'>"+"<div class='"+this.calendar.classNames.dateContainer+"'>"+_104+name+"</div>"+"</td>"; |
|---|
| 1416 |
},buildSmallRow:function(date,_10b,_10c,_10d,_10e,_10f){ |
|---|
| 1417 |
var id=this.getDateId(date); |
|---|
| 1418 |
this.dateMap[id]=date; |
|---|
| 1419 |
var _111=$H({id:id,width:_10e}); |
|---|
| 1420 |
_10f=[]; |
|---|
| 1421 |
if(_10c){ |
|---|
| 1422 |
_10f.push(this.calendar.classNames.schedule); |
|---|
| 1423 |
var _112=_10c[0]; |
|---|
| 1424 |
if(_112){ |
|---|
| 1425 |
_111.title=_112.description; |
|---|
| 1426 |
} |
|---|
| 1427 |
}else{ |
|---|
| 1428 |
if(_10b){ |
|---|
| 1429 |
_10f.push(this.calendar.classNames.holiday); |
|---|
| 1430 |
_111.title=_10b.name.stripTags(); |
|---|
| 1431 |
}else{ |
|---|
| 1432 |
if(this.calendar.isRegularHoliday(date.getDay())){ |
|---|
| 1433 |
_10f.push(this.calendar.classNames.regularHoliday); |
|---|
| 1434 |
}else{ |
|---|
| 1435 |
_10f.push(this.calendar.classNames.date); |
|---|
| 1436 |
} |
|---|
| 1437 |
} |
|---|
| 1438 |
} |
|---|
| 1439 |
if(date.days()==_10d.days()){ |
|---|
| 1440 |
_10f.push(Calendar.className.highlightDay); |
|---|
| 1441 |
} |
|---|
| 1442 |
_10f.push(_10f); |
|---|
| 1443 |
_10f=_10f.join(" "); |
|---|
| 1444 |
_111=_111.inject("",function(html,pair){ |
|---|
| 1445 |
return html+" "+pair.key+"=\""+pair.value+"\""; |
|---|
| 1446 |
}); |
|---|
| 1447 |
return "<td class=\""+_10f+"\""+_111+">"+date.getDate()+"</td>"; |
|---|
| 1448 |
},beforeBuild:function(){ |
|---|
| 1449 |
this.column={}; |
|---|
| 1450 |
var rule=CssUtil.getCssRuleBySelectorText("."+Calendar.className.table+" td"); |
|---|
| 1451 |
this.column.height=parseInt(rule.style["height"],10); |
|---|
| 1452 |
rule=CssUtil.getCssRuleBySelectorText("."+Calendar.className.dateContainer); |
|---|
| 1453 |
this.column.dateTextHeight=parseInt(rule.style["height"],10); |
|---|
| 1454 |
},buildSchedule:function(_116,_117){ |
|---|
| 1455 |
var _118=this.calendar.options.noEvent; |
|---|
| 1456 |
var id="scheduleItem_"+_116.id; |
|---|
| 1457 |
var _11a=(_116.edit==undefined||_116.edit); |
|---|
| 1458 |
var item=Builder.node("DIV",{id:id}); |
|---|
| 1459 |
var _11c=""; |
|---|
| 1460 |
if(!_118&&_11a){ |
|---|
| 1461 |
_11c+="cursor: move"; |
|---|
| 1462 |
} |
|---|
| 1463 |
var _11d=Builder.node("DIV",{id:id+"_container",style:_11c}); |
|---|
| 1464 |
item.appendChild(_11d); |
|---|
| 1465 |
var _11e=DateUtil.toDate(_116.start); |
|---|
| 1466 |
var _11f=DateUtil.toDate(_116.finish); |
|---|
| 1467 |
if(_116.finish.hour==0&&_116.finish.min==0){ |
|---|
| 1468 |
_11f=_11f.advance({days:-1}); |
|---|
| 1469 |
} |
|---|
| 1470 |
var _120={}; |
|---|
| 1471 |
if(!UserAgent.isIE()){ |
|---|
| 1472 |
_120.whiteSpace="nowrap"; |
|---|
| 1473 |
} |
|---|
| 1474 |
if(_118){ |
|---|
| 1475 |
_120.cursor="default"; |
|---|
| 1476 |
} |
|---|
| 1477 |
if(_11e.sameDate(_11f)){ |
|---|
| 1478 |
this.calendar.css.addClassNames(item,"scheduleItemNoBorder"); |
|---|
| 1479 |
}else{ |
|---|
| 1480 |
if(_116.frame_color){ |
|---|
| 1481 |
_120.border="2px solid "+_116.frame_color; |
|---|
| 1482 |
_120.backgroundColor=_116.frame_color; |
|---|
| 1483 |
} |
|---|
| 1484 |
this.calendar.css.addClassNames(item,"scheduleItemLarge"); |
|---|
| 1485 |
} |
|---|
| 1486 |
Element.setStyle(item,_120); |
|---|
| 1487 |
var _121=[]; |
|---|
| 1488 |
var _122=(_116.removable==undefined||_116.removable); |
|---|
| 1489 |
if(_11a&&_122){ |
|---|
| 1490 |
var _123=Builder.node("DIV",{id:"scheduleDeleteImg_"+_116.id,className:this.calendar.css.joinClassNames("deleteImg"),style:"display: none;"}); |
|---|
| 1491 |
_121.push(_123); |
|---|
| 1492 |
_11d.appendChild(_123); |
|---|
| 1493 |
if(!_118){ |
|---|
| 1494 |
Event.observe(_123,"click",this.clickDeleteImage.bind(this,_116)); |
|---|
| 1495 |
} |
|---|
| 1496 |
} |
|---|
| 1497 |
if(!_118&&this.calendar.options.dblclickSchedule){ |
|---|
| 1498 |
Event.observe(item,"dblclick",this.calendar.options.dblclickSchedule.bind(this,_116)); |
|---|
| 1499 |
} |
|---|
| 1500 |
var icon=null; |
|---|
| 1501 |
if(_116.icon){ |
|---|
| 1502 |
icon=Builder.node("IMG",{id:"private_img_"+_116.id,src:_116.icon,alt:_116.type_name,style:"float: left;",width:16,height:16}); |
|---|
| 1503 |
_11d.appendChild(icon); |
|---|
| 1504 |
}else{ |
|---|
| 1505 |
if(Calendar.defaultIconPath){ |
|---|
| 1506 |
icon=Builder.node("IMG",{id:"private_img_"+_116.id,src:Calendar.defaultIconPath,alt:_116.type_name,style:"float: left;",width:16,height:16}); |
|---|
| 1507 |
_11d.appendChild(icon); |
|---|
| 1508 |
} |
|---|
| 1509 |
} |
|---|
| 1510 |
var _125=null; |
|---|
| 1511 |
if(!_116.publicity){ |
|---|
| 1512 |
if(Calendar.privateImgPath){ |
|---|
| 1513 |
_125=Builder.node("IMG",{src:Calendar.privateImgPath,alt:"private",style:"position: absolute; right: 0px; display: block;",width:16,height:16}); |
|---|
| 1514 |
_11d.appendChild(_125); |
|---|
| 1515 |
}else{ |
|---|
| 1516 |
_125=Builder.node("DIV",{id:"private_img_"+_116.id}); |
|---|
| 1517 |
this.calendar.css.addClassNames(_125,"privateImg"); |
|---|
| 1518 |
_11d.appendChild(_125); |
|---|
| 1519 |
} |
|---|
| 1520 |
} |
|---|
| 1521 |
if(!_118&&(_121.length>0)){ |
|---|
| 1522 |
Event.observe(item,"mouseover",this.showImage.bind(this,_121,_125)); |
|---|
| 1523 |
Event.observe(item,"mouseout",this.hideImage.bind(this,_121,_125)); |
|---|
| 1524 |
} |
|---|
| 1525 |
var body=Builder.node("DIV"); |
|---|
| 1526 |
var text=this.getTimeText((_117)?_116.start:{hour:"0",min:"0"},_116.finish); |
|---|
| 1527 |
var _128=Builder.node("DIV",{id:id+"_text",style:"float: left;"},[text]); |
|---|
| 1528 |
this.calendar.css.addClassNames(_128,"scheduleTimeAreaMonth"); |
|---|
| 1529 |
_11d.appendChild(_128); |
|---|
| 1530 |
var _129=_116.description.unescapeHTML(); |
|---|
| 1531 |
_11d.appendChild(Builder.node("DIV",{id:id+"_description"},[_129])); |
|---|
| 1532 |
item.title=text+"-"+this.calendar.formatTime(_116.finish)+" "+_116.popup.unescapeHTML()+"\n "+_116.popup2.unescapeHTML()+"\n "+_116.popup3.unescapeHTML(); |
|---|
| 1533 |
item.schedule=_116; |
|---|
| 1534 |
return [item,_11d]; |
|---|
| 1535 |
},adjustScheduleStyle:function(item,_12b,_12c,_12d){ |
|---|
| 1536 |
var self=this; |
|---|
| 1537 |
var _12f=parseInt(Element.getStyle(item,"height"),10); |
|---|
| 1538 |
var top=parseInt(Element.getStyle(item,"top"),10); |
|---|
| 1539 |
var _131=this.getScheduleRange(item); |
|---|
| 1540 |
var tops=[]; |
|---|
| 1541 |
var _133=3; |
|---|
| 1542 |
_12d.each(function(_134){ |
|---|
| 1543 |
var _135=self.getScheduleRange(_134); |
|---|
| 1544 |
if(_131.any(function(r){ |
|---|
| 1545 |
return _135.include(r); |
|---|
| 1546 |
})){ |
|---|
| 1547 |
tops.push(_134.topIndex); |
|---|
| 1548 |
} |
|---|
| 1549 |
}); |
|---|
| 1550 |
var _137=$R(0,tops.length,true).detect(function(i){ |
|---|
| 1551 |
return !tops.include(i); |
|---|
| 1552 |
}); |
|---|
| 1553 |
if(isNaN(_137)){ |
|---|
| 1554 |
_137=tops.length; |
|---|
| 1555 |
} |
|---|
| 1556 |
item.topIndex=_137; |
|---|
| 1557 |
Element.setStyle(item,{top:top+(_12f+2)*_137+"px"}); |
|---|
| 1558 |
if(_137>=_133){ |
|---|
| 1559 |
Element.hide(item); |
|---|
| 1560 |
var node=this.buildSkipSchedule(_12b+"_"+_12c,item); |
|---|
| 1561 |
if(node){ |
|---|
| 1562 |
var left=Element.getStyle(item,"left"); |
|---|
| 1563 |
Element.setStyle(node,{top:top+(_12f+2)*_137+"px",left:left}); |
|---|
| 1564 |
} |
|---|
| 1565 |
return node; |
|---|
| 1566 |
} |
|---|
| 1567 |
},buildSkipSchedule:function(_13b,item){ |
|---|
| 1568 |
var id=this.calendar.element.id.appendSuffix(_13b); |
|---|
| 1569 |
if(!this.skipNode[id]){ |
|---|
| 1570 |
var _13e=this.getAdjustSize()+(UserAgent.isIE()?0.5:0); |
|---|
| 1571 |
var _13f=this.column.width+_13e-1+"px"; |
|---|
| 1572 |
var node=Builder.node("a",{id:id,style:"display: block; z-index: 1000; cursor: pointer; width: "+_13f+";",href:"javascript:void(0);"},["more"]); |
|---|
| 1573 |
this.calendar.css.addClassNames(node,"skipNode"); |
|---|
| 1574 |
node.skipId=id; |
|---|
| 1575 |
this.skipNode[id]=node; |
|---|
| 1576 |
this.skipSchedules[id]=[item.schedule]; |
|---|
| 1577 |
return node; |
|---|
| 1578 |
} |
|---|
| 1579 |
this.skipSchedules[id].push(item.schedule); |
|---|
| 1580 |
},getScheduleRange:function(item){ |
|---|
| 1581 |
return $R(0,item.length,true).map(function(i){ |
|---|
| 1582 |
return item.cellIndex+i; |
|---|
| 1583 |
}); |
|---|
| 1584 |
},setScheduleBaseStyle:function(item,_144,_145,_146){ |
|---|
| 1585 |
var _147=this.column.height; |
|---|
| 1586 |
var top=_147*_144+this.column.dateTextHeight; |
|---|
| 1587 |
var _149=this.getAdjustSize()+(UserAgent.isIE()?0.5:0); |
|---|
| 1588 |
Element.setStyle(item,{top:top+"px",width:this.column.width*_146+_149*(_146-1)+"px",left:this.column.width*_145+_145*_149+"px"}); |
|---|
| 1589 |
},afterBuild:function(){ |
|---|
| 1590 |
this.calendar.options.startAfterBuild(); |
|---|
| 1591 |
var _14a=this.getTooltipId(); |
|---|
| 1592 |
if($(_14a)){ |
|---|
| 1593 |
Element.appendToBody(_14a); |
|---|
| 1594 |
} |
|---|
| 1595 |
this.scheduleNodes=[]; |
|---|
| 1596 |
this.skipNode=$H({}); |
|---|
| 1597 |
this.skipSchedules=$H({}); |
|---|
| 1598 |
this.hasInvisibleSchedule=false; |
|---|
| 1599 |
if(this.calendar.options.size!=Calendar.size.small){ |
|---|
| 1600 |
this.calendarTable=$(this.getCalendarTableId()); |
|---|
| 1601 |
this.setContainerInfo(); |
|---|
| 1602 |
this.setColumnWidth(); |
|---|
| 1603 |
this.setCover(); |
|---|
| 1604 |
this.setSelector(); |
|---|
| 1605 |
var self=this; |
|---|
| 1606 |
var _14c=this.calendar.options.displayIndexes; |
|---|
| 1607 |
var _14d=this.getDragDistance(); |
|---|
| 1608 |
var _14e=$R(0,$(this.getCalendarTableId()).rows.length).map(function(){ |
|---|
| 1609 |
return []; |
|---|
| 1610 |
}); |
|---|
| 1611 |
var date=this.calendar.date; |
|---|
| 1612 |
var _150=DateUtil.getFirstDate(date.getFullYear(),date.getMonth()); |
|---|
| 1613 |
var _151=_150.days(); |
|---|
| 1614 |
var _152=DateUtil.getLastDate(date.getFullYear(),date.getMonth()).days(); |
|---|
| 1615 |
self.calendar.options.schedules.each(function(_153,_154){ |
|---|
| 1616 |
var _155=self.toDate(_153.start); |
|---|
| 1617 |
var _156=_155.days(); |
|---|
| 1618 |
var _157=self.toDate(_153.finish); |
|---|
| 1619 |
var _158=_157.days(); |
|---|
| 1620 |
var days=self.getDayDiff(_153); |
|---|
| 1621 |
if(_153.finish.hour==0&&_153.finish.min==0){ |
|---|
| 1622 |
days--; |
|---|
| 1623 |
} |
|---|
| 1624 |
if((_151<=_156&&_156<=_152)||(_151<=_158&&_158<=_152)||((_156<=_151)&&(_152<=_158))){ |
|---|
| 1625 |
if(!_150.sameMonth(_155)){ |
|---|
| 1626 |
_155=_150; |
|---|
| 1627 |
} |
|---|
| 1628 |
self.setSchedule(_153,_14e,_14d,days); |
|---|
| 1629 |
} |
|---|
| 1630 |
}); |
|---|
| 1631 |
this.setSkipNode(); |
|---|
| 1632 |
this.calendar.options.endAfterBuild(); |
|---|
| 1633 |
} |
|---|
| 1634 |
},setEvent:function(){ |
|---|
| 1635 |
if(!this.calendar.options.noEvent){ |
|---|
| 1636 |
Event.observe(this.ids.preYear,"click",this.calendar.changeCalendar.bindAsEventListener(this.calendar)); |
|---|
| 1637 |
Event.observe(this.ids.preMonth,"click",this.calendar.changeCalendar.bindAsEventListener(this.calendar)); |
|---|
| 1638 |
Event.observe(this.ids.nextMonth,"click",this.calendar.changeCalendar.bindAsEventListener(this.calendar)); |
|---|
| 1639 |
Event.observe(this.ids.nextYear,"click",this.calendar.changeCalendar.bindAsEventListener(this.calendar)); |
|---|
| 1640 |
if(this.calendar.options.useImgMark){ |
|---|
| 1641 |
new Hover(this.ids.preYear); |
|---|
| 1642 |
new Hover(this.ids.preMonth); |
|---|
| 1643 |
new Hover(this.ids.nextMonth); |
|---|
| 1644 |
new Hover(this.ids.nextYear); |
|---|
| 1645 |
} |
|---|
| 1646 |
if(this.calendar.options.size=="small"){ |
|---|
| 1647 |
$H(this.dateMap).each(function(pair){ |
|---|
| 1648 |
var node=$(pair.key); |
|---|
| 1649 |
if(node){ |
|---|
| 1650 |
Event.observe(node,"mousedown",this.calendar.selectDate.bindAsEventListener(this.calendar)); |
|---|
| 1651 |
} |
|---|
| 1652 |
}.bind(this)); |
|---|
| 1653 |
} |
|---|
| 1654 |
} |
|---|
| 1655 |
},setSchedule:function(_15c,_15d,_15e,days){ |
|---|
| 1656 |
var _160=[]; |
|---|
| 1657 |
var _161=6; |
|---|
| 1658 |
var _162=DateUtil.toDate(_15c.start); |
|---|
| 1659 |
var date=_162; |
|---|
| 1660 |
var _164=this.calendar.options.displayIndexes; |
|---|
| 1661 |
var _165=this.calendar.date; |
|---|
| 1662 |
var _166=this.calendar.options.noEvent; |
|---|
| 1663 |
var _167=this.calendar.options.clickSkipNode; |
|---|
| 1664 |
while(days>=0){ |
|---|
| 1665 |
var _168=this.getLastWday(date); |
|---|
| 1666 |
var _169=days+1; |
|---|
| 1667 |
var _16a=date.getDay(); |
|---|
| 1668 |
var _16b=date.advance({days:_169-1}); |
|---|
| 1669 |
if(_16b.getTime()>_168.getTime()){ |
|---|
| 1670 |
_16b=_168; |
|---|
| 1671 |
_169=_16b.days()-date.days()+1; |
|---|
| 1672 |
} |
|---|
| 1673 |
var _16c=_16b.getDay(); |
|---|
| 1674 |
var _16d=null; |
|---|
| 1675 |
if(_16a<=_16c){ |
|---|
| 1676 |
_16d=$R(_16a,_16c,false); |
|---|
| 1677 |
}else{ |
|---|
| 1678 |
_16d=$R(0,_16c,false).toArray().concat($R(_16a,_161,false).toArray()); |
|---|
| 1679 |
} |
|---|
| 1680 |
var _16e=_16d.findAll(function(day){ |
|---|
| 1681 |
return _164.include(day); |
|---|
| 1682 |
}).length; |
|---|
| 1683 |
var _170=new Date(date.getTime()); |
|---|
| 1684 |
while(_170.days()<=_16b.days()){ |
|---|
| 1685 |
if((_170.getFullYear()==_165.getFullYear())&&(_170.getMonth()==_165.getMonth())){ |
|---|
| 1686 |
var _171=this.getCellPosition(_170.getDate()); |
|---|
| 1687 |
if(_171){ |
|---|
| 1688 |
var _172=_171.rowIndex; |
|---|
| 1689 |
var _173=_171.cellIndex; |
|---|
| 1690 |
var _174=this.buildSchedule(_15c,_162.sameDate(_170)); |
|---|
| 1691 |
var item=_174.first(); |
|---|
| 1692 |
item.length=_16e; |
|---|
| 1693 |
item.cellIndex=_173; |
|---|
| 1694 |
item.cellDate=_170; |
|---|
| 1695 |
this.container.appendChild(item); |
|---|
| 1696 |
this.setScheduleBaseStyle(item,_172,_173,_16e); |
|---|
| 1697 |
var _176=this.adjustScheduleStyle(item,_172,_173,_15d[_172]); |
|---|
| 1698 |
if(_176){ |
|---|
| 1699 |
this.container.appendChild(_176); |
|---|
| 1700 |
Event.observe(_176,"click",this.clickSkipNode.bindAsEventListener(this,_170)); |
|---|
| 1701 |
Event.observe(_176,"mouseover",this.showTooltip.bindAsEventListener(this,_176.skipId,_170)); |
|---|
| 1702 |
Event.observe(_176,"mouseout",this.hideTooltip.bindAsEventListener(this)); |
|---|
| 1703 |
} |
|---|
| 1704 |
if(item.visible()){ |
|---|
| 1705 |
if(!_166&&((_15c.edit==undefined)||_15c.edit)){ |
|---|
| 1706 |
this.setDraggable(item,_174.last(),_15e); |
|---|
| 1707 |
this.setResize(item); |
|---|
| 1708 |
} |
|---|
| 1709 |
_15d[_172].push(item); |
|---|
| 1710 |
this.scheduleNodes.push(item); |
|---|
| 1711 |
break; |
|---|
| 1712 |
}else{ |
|---|
| 1713 |
item.remove(); |
|---|
| 1714 |
_16e--; |
|---|
| 1715 |
} |
|---|
| 1716 |
}else{ |
|---|
| 1717 |
if(_164.include(_170.getDay())){ |
|---|
| 1718 |
_16e--; |
|---|
| 1719 |
}else{ |
|---|
| 1720 |
this.hasInvisibleSchedule=true; |
|---|
| 1721 |
} |
|---|
| 1722 |
} |
|---|
| 1723 |
}else{ |
|---|
| 1724 |
if(_164.include(_170.getDay())){ |
|---|
| 1725 |
_16e--; |
|---|
| 1726 |
} |
|---|
| 1727 |
} |
|---|
| 1728 |
_170=_170.advance({days:1}); |
|---|
| 1729 |
} |
|---|
| 1730 |
if(_160.length==0){ |
|---|
| 1731 |
days-=_169; |
|---|
| 1732 |
}else{ |
|---|
| 1733 |
days-=7; |
|---|
| 1734 |
} |
|---|
| 1735 |
var date=_16b.advance({days:1}); |
|---|
| 1736 |
if(item){ |
|---|
| 1737 |
_160.push(item); |
|---|
| 1738 |
} |
|---|
| 1739 |
} |
|---|
| 1740 |
var self=this; |
|---|
| 1741 |
if(!_166){ |
|---|
| 1742 |
_160.each(function(item){ |
|---|
| 1743 |
Event.observe(item,"mouseover",self.mouseOverSubSchedule.bind(this,_160)); |
|---|
| 1744 |
Event.observe(item,"mouseout",self.mouseOutSubSchedule.bind(this,_160)); |
|---|
| 1745 |
}); |
|---|
| 1746 |
} |
|---|
| 1747 |
},getLastWday:function(date){ |
|---|
| 1748 |
if(!this.calendar.wdays){ |
|---|
| 1749 |
this.calendar.setIndex(); |
|---|
| 1750 |
} |
|---|
| 1751 |
var _17a=this.calendar.wdays.indexOf(date.getDay())+1; |
|---|
| 1752 |
return date.advance({days:this.calendar.wdays.length-_17a}); |
|---|
| 1753 |
},setSelector:function(){ |
|---|
| 1754 |
var _17b=$(this.getSelectorId()); |
|---|
| 1755 |
Element.setStyle(_17b,{width:this.column.width+"px",height:this.column.height-2+"px"}); |
|---|
| 1756 |
Element.setOpacity(_17b,0.6); |
|---|
| 1757 |
},setDraggable:function(item,_17d,_17e){ |
|---|
| 1758 |
var self=this; |
|---|
| 1759 |
var _180=Position.cumulativeOffset(this.container); |
|---|
| 1760 |
var _181=$(this.getSelectorId()); |
|---|
| 1761 |
var _182=this.column.width+(UserAgent.isIE()?0.5:0); |
|---|
| 1762 |
var _183=this.column.height+(UserAgent.isIE()?1:0); |
|---|
| 1763 |
var _184=this.rowMax||$(this.getCalendarTableId()).rows.length; |
|---|
| 1764 |
var _185=this.calendar.options.displayIndexes.length-1; |
|---|
| 1765 |
var _186=this.getAdjustSize(); |
|---|
| 1766 |
new Draggable(item,{handle:_17d,scroll:window,starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction,onStart:function(_187,_188){ |
|---|
| 1767 |
Element.show(_181); |
|---|
| 1768 |
},onDrag:function(_189,_18a){ |
|---|
| 1769 |
var _18b=_189.element; |
|---|
| 1770 |
var top=parseInt(Element.getStyle(_18b,"top"),10)+_189.offset[1]; |
|---|
| 1771 |
var _18d=Math.floor(top/_183); |
|---|
| 1772 |
var left=parseInt(Element.getStyle(_18b,"left"),10)+_189.offset[0]; |
|---|
| 1773 |
var _18f=Math.floor(left/_182); |
|---|
| 1774 |
if((_18f>=0&&_18d>=0)&&(_18f<=_185&&_18d<=_184)){ |
|---|
| 1775 |
Element.setStyle(_181,{left:_182*_18f+_186*_18f+"px",top:_183*_18d+"px"}); |
|---|
| 1776 |
} |
|---|
| 1777 |
},onEnd:function(_190,_191){ |
|---|
| 1778 |
var _192=_190.currentDelta(); |
|---|
| 1779 |
Element.hide(_181); |
|---|
| 1780 |
if(!(_192[0]==_190.delta[0]&&_192[1]==_190.delta[1])){ |
|---|
| 1781 |
self.changeSchedule(_190); |
|---|
| 1782 |
} |
|---|
| 1783 |
}}); |
|---|
| 1784 |
},setResize:function(item){ |
|---|
| 1785 |
var self=this; |
|---|
| 1786 |
new CalendarResizeableEx(item,{left:0,top:0,bottom:0,distance:this.column.width,restriction:true,resize:function(_195){ |
|---|
| 1787 |
self.updateTirm(_195); |
|---|
| 1788 |
}}); |
|---|
| 1789 |
},getDate:function(_196){ |
|---|
| 1790 |
var date=this.calendar.date; |
|---|
| 1791 |
if(_196.constructor==String){ |
|---|
| 1792 |
return new Date(date.getFullYear(),date.getMonth(),_196); |
|---|
| 1793 |
}else{ |
|---|
| 1794 |
return new Date(date.getFullYear(),date.getMonth(),_196.id.getSuffix()); |
|---|
| 1795 |
} |
|---|
| 1796 |
},abstractSelect:function(_198,_199){ |
|---|
| 1797 |
var _19a=null; |
|---|
| 1798 |
if(this.calendar.options.size=="large"){ |
|---|
| 1799 |
_19a=this.findClickedElement(_198); |
|---|
| 1800 |
}else{ |
|---|
| 1801 |
_19a=Event.element(_198); |
|---|
| 1802 |
if(_19a.tagName!="TD"){ |
|---|
| 1803 |
_19a=Element.getParentByTagName(["TD"],_19a); |
|---|
| 1804 |
} |
|---|
| 1805 |
} |
|---|
| 1806 |
if(_19a&&_19a.id&&!_19a.id.match(/emptyRow/)){ |
|---|
| 1807 |
var date=this.getDate(_19a); |
|---|
| 1808 |
_199(date,_19a); |
|---|
| 1809 |
} |
|---|
| 1810 |
},getSelectedTerm:function(){ |
|---|
| 1811 |
var self=this; |
|---|
| 1812 |
var _19d=this.calendar.getSelected(); |
|---|
| 1813 |
return [_19d.first(),_19d.last()].map(function(e){ |
|---|
| 1814 |
return self.getDate(e); |
|---|
| 1815 |
}); |
|---|
| 1816 |
},selectDay:function(_19f){ |
|---|
| 1817 |
var _1a0=this.calendar; |
|---|
| 1818 |
var th=Event.element(_19f); |
|---|
| 1819 |
if(th.tagName!="TH"){ |
|---|
| 1820 |
th=Element.getParentByTagName("TH",th); |
|---|
| 1821 |
} |
|---|
| 1822 |
this.iterateTable({doCell:function(cell){ |
|---|
| 1823 |
if((cell.cellIndex==th.cellIndex)&&cell.id){ |
|---|
| 1824 |
_1a0.addSelectedClass(cell); |
|---|
| 1825 |
} |
|---|
| 1826 |
}}); |
|---|
| 1827 |
},inspectArgument:function(_1a3,time){ |
|---|
| 1828 |
var self=this; |
|---|
| 1829 |
var _1a6=this.calendar.getSelected(); |
|---|
| 1830 |
var _1a7=[]; |
|---|
| 1831 |
self.calendar.recurrence(_1a3,function(o){ |
|---|
| 1832 |
if(!o.date){ |
|---|
| 1833 |
_1a6.each(function(d){ |
|---|
| 1834 |
var _1aa={}; |
|---|
| 1835 |
if(!o.date){ |
|---|
| 1836 |
_1aa={date:self.getDate(d)}; |
|---|
| 1837 |
if(time){ |
|---|
| 1838 |
_1aa.start={hour:0,min:0}; |
|---|
| 1839 |
_1aa.finish={hour:0,min:0}; |
|---|
| 1840 |
} |
|---|
| 1841 |
} |
|---|
| 1842 |
Object.extend(_1aa,o); |
|---|
| 1843 |
_1a7.push(_1aa); |
|---|
| 1844 |
}); |
|---|
| 1845 |
}else{ |
|---|
| 1846 |
if(o.date.constructor==Object){ |
|---|
| 1847 |
o.date=new Date(o.date.year,o.date.month,o.date.day); |
|---|
| 1848 |
_1a7.push(o); |
|---|
| 1849 |
}else{ |
|---|
| 1850 |
_1a7.push(o); |
|---|
| 1851 |
} |
|---|
| 1852 |
} |
|---|
| 1853 |
}); |
|---|
| 1854 |
return _1a7; |
|---|
| 1855 |
},inspectDateArgument:function(date){ |
|---|
| 1856 |
if(date){ |
|---|
| 1857 |
map=[]; |
|---|
| 1858 |
this.calendar.recurrence(date,function(d){ |
|---|
| 1859 |
if(d.constructor==Object){ |
|---|
| 1860 |
map.push(new Date(d.year,d.month,d.day)); |
|---|
| 1861 |
}else{ |
|---|
| 1862 |
map.push(d); |
|---|
| 1863 |
} |
|---|
| 1864 |
}); |
|---|
| 1865 |
return map; |
|---|
| 1866 |
}else{ |
|---|
| 1867 |
var _1ad=this; |
|---|
| 1868 |
var _1ae=this.calendar.getSelected(); |
|---|
| 1869 |
if(_1ae.length==0){ |
|---|
| 1870 |
return null; |
|---|
| 1871 |
} |
|---|
| 1872 |
return _1ae.collect(function(d){ |
|---|
| 1873 |
return _1ad.getDate(d); |
|---|
| 1874 |
}); |
|---|
| 1875 |
} |
|---|
| 1876 |
},findClickedElement:function(_1b0){ |
|---|
| 1877 |
var _1b1=$(this.getScheduleContainerId()); |
|---|
| 1878 |
var _1b2=Position.cumulativeOffset(_1b1); |
|---|
| 1879 |
var _1b3=Position.realOffset(_1b1).last(); |
|---|
| 1880 |
_1b3-=document.documentElement.scrollTop||document.body.scrollTop; |
|---|
| 1881 |
var x=Event.pointerX(_1b0)-_1b2[0]; |
|---|
| 1882 |
var y=Event.pointerY(_1b0)-_1b2[1]+_1b3; |
|---|
| 1883 |
var _1b6=Math.floor(y/this.column.height); |
|---|
| 1884 |
var _1b7=Math.floor(x/this.column.width); |
|---|
| 1885 |
return $(this.calendarTable.rows[_1b6].cells[_1b7]); |
|---|
| 1886 |
},multipleSelection:function(_1b8){ |
|---|
| 1887 |
if(!this.calendar.selectedBase||!this.calendar.mouseDown){ |
|---|
| 1888 |
return; |
|---|
| 1889 |
} |
|---|
| 1890 |
var self=this; |
|---|
| 1891 |
var _1ba=this.calendar; |
|---|
| 1892 |
var _1bb=this.calendar.selectedBase; |
|---|
| 1893 |
this.abstractSelect(_1b8,function(date,_1bd){ |
|---|
| 1894 |
var _1be=$(_1bb.id); |
|---|
| 1895 |
var _1bf=_1ba.createRange(parseInt(_1be.id.getSuffix()),parseInt(_1bd.id.getSuffix())); |
|---|
| 1896 |
self.iterateTable({doCell:function(cell){ |
|---|
| 1897 |
if(cell.tagName!="TD"||!cell.id){ |
|---|
| 1898 |
throw $continue; |
|---|
| 1899 |
} |
|---|
| 1900 |
var id=parseInt(cell.id.getSuffix(),10); |
|---|
| 1901 |
if(_1bf.include(id)){ |
|---|
| 1902 |
_1ba.addSelectedClass(cell); |
|---|
| 1903 |
}else{ |
|---|
| 1904 |
_1ba.removeSelectedClass(cell); |
|---|
| 1905 |
} |
|---|
| 1906 |
}}); |
|---|
| 1907 |
}); |
|---|
| 1908 |
},iterateTable:function(){ |
|---|
| 1909 |
var _1c2=Object.extend({doTable:null,doRow:null,doCell:null},arguments[0]); |
|---|
| 1910 |
var _1c3=$(this.getCalendarTableId()); |
|---|
| 1911 |
if(_1c2.doTable){ |
|---|
| 1912 |
_1c2.doTable(_1c3); |
|---|
| 1913 |
} |
|---|
| 1914 |
$A(_1c3.rows).each(function(row){ |
|---|
| 1915 |
if(_1c2.doRow){ |
|---|
| 1916 |
_1c2.doRow(row); |
|---|
| 1917 |
} |
|---|
| 1918 |
$A(row.cells).each(function(cell){ |
|---|
| 1919 |
if(_1c2.doCell){ |
|---|
| 1920 |
_1c2.doCell(cell); |
|---|
| 1921 |
} |
|---|
| 1922 |
}); |
|---|
| 1923 |
}); |
|---|
| 1924 |
},findRow:function(_1c6){ |
|---|
| 1925 |
var _1c7=$(this.getCalendarTableId()); |
|---|
| 1926 |
return $A(_1c7.rows).detect(function(row){ |
|---|
| 1927 |
return row.rowIndex==_1c6; |
|---|
| 1928 |
}); |
|---|
| 1929 |
},findCell:function(_1c9,_1ca){ |
|---|
| 1930 |
return $A(this.findRow(_1c9).cells).detect(function(cell){ |
|---|
| 1931 |
return cell.cellIndex==_1ca; |
|---|
| 1932 |
}); |
|---|
| 1933 |
},getDateId:function(date){ |
|---|
| 1934 |
var day=null; |
|---|
| 1935 |
if(date.constructor==Date){ |
|---|
| 1936 |
day=date.getDate(); |
|---|
| 1937 |
}else{ |
|---|
| 1938 |
day=date; |
|---|
| 1939 |
} |
|---|
| 1940 |
return this.calendar.element.id.appendSuffix(day); |
|---|
| 1941 |
},getCell:function(day){ |
|---|
| 1942 |
return $(this.getDateId(day)); |
|---|
| 1943 |
},getCellPosition:function(day){ |
|---|
| 1944 |
var cell=this.getCell(day); |
|---|
| 1945 |
if(cell){ |
|---|
| 1946 |
var row=Element.getParentByTagName(["tr"],cell); |
|---|
| 1947 |
return {cellIndex:cell.cellIndex,rowIndex:row.rowIndex}; |
|---|
| 1948 |
} |
|---|
| 1949 |
},changeSchedule:function(_1d2){ |
|---|
| 1950 |
var _1d3=_1d2.element; |
|---|
| 1951 |
var _1d4=_1d3.schedule; |
|---|
| 1952 |
this.calendar.cacheSchedule(_1d4); |
|---|
| 1953 |
var _1d5=$(this.getSelectorId()); |
|---|
| 1954 |
var top=parseInt(Element.getStyle(_1d5,"top"),10); |
|---|
| 1955 |
var _1d7=Math.floor(top/this.column.height); |
|---|
| 1956 |
var left=parseInt(Element.getStyle(_1d5,"left"),10); |
|---|
| 1957 |
var _1d9=Math.floor(left/this.column.width); |
|---|
| 1958 |
var _1da=$(this.getCalendarTableId()); |
|---|
| 1959 |
var _1db=_1da.rows.length-1; |
|---|
| 1960 |
var _1dc=this.calendar.options.displayIndexes.length-1; |
|---|
| 1961 |
if((_1d9>=0&&_1d7>=0)&&(_1d9<=_1dc&&_1d7<=_1db)){ |
|---|
| 1962 |
var cell=this.findCell(_1d7,_1d9); |
|---|
| 1963 |
var date=new Date(this.calendar.date.getTime()); |
|---|
| 1964 |
var _1df=_1d3.cellDate.days()-DateUtil.toDate(_1d4.start).days(); |
|---|
| 1965 |
date.setDate(parseInt(cell.id.getSuffix(),10)-_1df); |
|---|
| 1966 |
var diff=this.getDayDiff(_1d4); |
|---|
| 1967 |
var _1e1=date.advance({days:diff}); |
|---|
| 1968 |
if(_1d4.start.month==date.getMonth()&&_1d4.start.day==date.getDate()&&_1d4.finish.month==_1e1.getMonth()&&_1d4.finish.day==_1e1.getDate()){ |
|---|
| 1969 |
this.calendar.refreshSchedule(); |
|---|
| 1970 |
return; |
|---|
| 1971 |
} |
|---|
| 1972 |
_1d4.start.year=date.getFullYear(); |
|---|
| 1973 |
_1d4.start.month=date.getMonth(); |
|---|
| 1974 |
_1d4.start.day=date.getDate(); |
|---|
| 1975 |
_1d4.finish.year=_1e1.getFullYear(); |
|---|
| 1976 |
_1d4.finish.month=_1e1.getMonth(); |
|---|
| 1977 |
_1d4.finish.day=_1e1.getDate(); |
|---|
| 1978 |
var arr=this.calendar.options.schedules; |
|---|
| 1979 |
var idx=arr.indexOf(_1d4); |
|---|
| 1980 |
arr.remove(idx); |
|---|
| 1981 |
var _1e4=DateUtil.toDate(_1d4.start); |
|---|
| 1982 |
arr.each(function(s,i){ |
|---|
| 1983 |
idx=i; |
|---|
| 1984 |
if(_1e4<DateUtil.toDate(s.start)){ |
|---|
| 1985 |
throw $break; |
|---|
| 1986 |
} |
|---|
| 1987 |
}); |
|---|
| 1988 |
arr.insert(idx,_1d4); |
|---|
| 1989 |
this.calendar.refreshSchedule(); |
|---|
| 1990 |
this.calendar.options.changeSchedule(_1d4); |
|---|
| 1991 |
}else{ |
|---|
| 1992 |
this.calendar.refreshSchedule(); |
|---|
| 1993 |
} |
|---|
| 1994 |
},updateTirm:function(_1e7){ |
|---|
| 1995 |
var _1e8=_1e7.schedule; |
|---|
| 1996 |
var _1e9=parseInt(Element.getStyle(_1e7,"width")); |
|---|
| 1997 |
var top=parseInt(Element.getStyle(_1e7,"top")); |
|---|
| 1998 |
var left=parseInt(Element.getStyle(_1e7,"left")); |
|---|
| 1999 |
var _1ec=Math.round((left+_1e9)/this.column.width)-1; |
|---|
| 2000 |
var _1ed=Math.round(top/this.column.height); |
|---|
| 2001 |
var cell=this.findCell(_1ed,_1ec); |
|---|
| 2002 |
var _1ef=_1e8.finish; |
|---|
| 2003 |
var _1f0=null; |
|---|
| 2004 |
if(this.dateMap){ |
|---|
| 2005 |
_1f0=this.dateMap[cell.id].toHash(); |
|---|
| 2006 |
}else{ |
|---|
| 2007 |
_1f0=new Date(this.calendar.date.getTime()); |
|---|
| 2008 |
_1f0.setDate(parseInt(cell.id.getSuffix(),10)); |
|---|
| 2009 |
_1f0=_1f0.toHash(); |
|---|
| 2010 |
} |
|---|
| 2011 |
_1f0.hour=_1ef.hour; |
|---|
| 2012 |
_1f0.min=_1ef.min; |
|---|
| 2013 |
if(DateUtil.toDate(_1e8.start).getTime()>=DateUtil.toDate(_1f0).getTime()){ |
|---|
| 2014 |
var _1f1=23; |
|---|
| 2015 |
var _1f2=55; |
|---|
| 2016 |
if(_1e8.start.hour==_1f1&&_1e8.start.min==_1f2){ |
|---|
| 2017 |
this.calendar.refreshSchedule(); |
|---|
| 2018 |
if(!((_1f0.year==_1ef.year)&&(_1f0.month==_1ef.month)&&(_1f0.day==_1ef.day))){ |
|---|
| 2019 |
this.calendar.options.updateTirm(); |
|---|
| 2020 |
} |
|---|
| 2021 |
return; |
|---|
| 2022 |
}else{ |
|---|
| 2023 |
_1f0.hour=_1f1; |
|---|
| 2024 |
_1f0.min=_1f2; |
|---|
| 2025 |
} |
|---|
| 2026 |
} |
|---|
| 2027 |
_1e8.finish=_1f0; |
|---|
| 2028 |
this.calendar.refreshSchedule(); |
|---|
| 2029 |
if(!((_1f0.year==_1ef.year)&&(_1f0.month==_1ef.month)&&(_1f0.day==_1ef.day))){ |
|---|
| 2030 |
this.calendar.options.updateTirm(_1e8); |
|---|
| 2031 |
} |
|---|
| 2032 |
},getTimeText:function(_1f3,_1f4){ |
|---|
| 2033 |
var _1f5=this.calendar; |
|---|
| 2034 |
return _1f5.formatTime(_1f3); |
|---|
| 2035 |
},getDayDiff:function(_1f6){ |
|---|
| 2036 |
return DateUtil.numberOfDays(this.toDate(_1f6.start),this.toDate(_1f6.finish)); |
|---|
| 2037 |
}}); |
|---|
| 2038 |
var CalendarWeek=Class.create(); |
|---|
| 2039 |
CalendarWeek.id=["calTable","columnContainer","columnHeader","column","next","pre","headerText"]; |
|---|
| 2040 |
Object.extend(CalendarWeek.prototype,AbstractCalendar.prototype); |
|---|
| 2041 |
Object.extend(CalendarWeek.prototype,{initialize:function(_1f7){ |
|---|
| 2042 |
this.calendar=_1f7; |
|---|
| 2043 |
var _1f8=this.getWeek(); |
|---|
| 2044 |
this.week=_1f8[0]; |
|---|
| 2045 |
this.invisibleWeek=_1f8[1]; |
|---|
| 2046 |
this.ids=SpinelzUtil.concat(this.calendar.element.id,CalendarWeek.id); |
|---|
| 2047 |
this.setDisplayTime(); |
|---|
| 2048 |
},buildHeaderLeft:function(){ |
|---|
| 2049 |
if(this.calendar.options.useImgMark){ |
|---|
| 2050 |
return "<td class='"+this.calendar.classNames.preYears+"'>"+"<div id='"+this.ids.pre+"' class='"+this.calendar.classNames.preWeekMark+"'></div>"+"</td>"; |
|---|
| 2051 |
} |
|---|
| 2052 |
return "<td class='"+this.calendar.classNames.preYears2+"'>"+"<div id='"+this.ids.pre+"' class='"+this.calendar.classNames.preWeekMark2+"'><a href=\"javascript:void(0)\">"+this.preMarkChars()+"</a></div>"+"</td>"; |
|---|
| 2053 |
},buildHeaderCenter:function(){ |
|---|
| 2054 |
var _1f9=[]; |
|---|
| 2055 |
if(this.calendar.options.weekHeaderFormat){ |
|---|
| 2056 |
_1f9=[this.formatHeaderDate(this.week.first()),"-",this.formatHeaderDate(this.week.last())]; |
|---|
| 2057 |
} |
|---|
| 2058 |
return "<td class='"+this.calendar.classNames.years+"'>"+"<span class='"+this.calendar.classNames.ym+"'>"+(_1f9[0]||this.week[0].toDateString())+"</span>"+"<span class='"+this.calendar.classNames.ym+"'>"+(_1f9[1]||"-")+"</span>"+"<span class='"+this.calendar.classNames.ym+"'>"+(_1f9[2]||this.week.last().toDateString())+"</span>"+"</td>"; |
|---|
| 2059 |
},formatHeaderDate:function(date){ |
|---|
| 2060 |
if(this.calendar.options.weekHeaderFormat){ |
|---|
| 2061 |
return new Template(this.calendar.options.weekHeaderFormat).evaluate({year:date.getFullYear(),month:date.getMonth()+1,day:date.getDate(),wday:this.calendar.options.dayOfWeek[date.getDay()]}); |
|---|
| 2062 |
} |
|---|
| 2063 |
return []; |
|---|
| 2064 |
},buildHeaderRight:function(){ |
|---|
| 2065 |
if(this.calendar.options.useImgMark){ |
|---|
| 2066 |
return "<td class='"+this.calendar.classNames.nextYears+"' align='right'>"+"<div id='"+this.ids.next+"' class='"+this.calendar.classNames.nextWeekMark+"'></div>"+"</td>"; |
|---|
| 2067 |
} |
|---|
| 2068 |
return "<td class='"+this.calendar.classNames.nextYears2+"' align='right'>"+"<div id='"+this.ids.next+"' class='"+this.calendar.classNames.nextWeekMark2+"'><a href=\"javascript:void(0)\">"+this.nextMarkChars()+"</a></div>"+"</td>"; |
|---|
| 2069 |
},preMarkChars:function(){ |
|---|
| 2070 |
return Calendar.marks.preWeek; |
|---|
| 2071 |
},nextMarkChars:function(){ |
|---|
| 2072 |
return Calendar.marks.nextWeek; |
|---|
| 2073 |
},buildCalendar:function(){ |
|---|
| 2074 |
var _1fb=(this.calendar.options.displayTimeLine)?this.buildTimeLine():""; |
|---|
| 2075 |
_1fb+=this.buildCalendarContainer(); |
|---|
| 2076 |
return "<table id='"+this.ids.columnContainer+"' class='"+this.calendar.classNames.weekTable+"'>"+"<tr>"+_1fb+"</tr>"+"</table>"; |
|---|
| 2077 |
},buildTimeLine:function(){ |
|---|
| 2078 |
var time=new Date(); |
|---|
| 2079 |
var hour=0,_1fe=24; |
|---|
| 2080 |
time.setHours(hour); |
|---|
| 2081 |
time.setMinutes(0); |
|---|
| 2082 |
var _1ff=this.buildTimeLineTop(); |
|---|
| 2083 |
var now=new Date().getHours(); |
|---|
| 2084 |
while(hour<_1fe){ |
|---|
| 2085 |
if(this.includeDisplayTime(hour)){ |
|---|
| 2086 |
var _201="pointer: default;"; |
|---|
| 2087 |
if(_1ff.length==0){ |
|---|
| 2088 |
_201+="border-top: none;"; |
|---|
| 2089 |
} |
|---|
| 2090 |
var _202=this.calendar.classNames.timeLineTime; |
|---|
| 2091 |
if(hour==now){ |
|---|
| 2092 |
_202+=" "+this.calendar.classNames.highlightTime; |
|---|
| 2093 |
} |
|---|
| 2094 |
_1ff+="<div class='"+_202+"' style='"+_201+"'>"+this.formatTime(time)+"</div>"; |
|---|
| 2095 |
} |
|---|
| 2096 |
hour++; |
|---|
| 2097 |
time.setHours(hour); |
|---|
| 2098 |
} |
|---|
| 2099 |
return "<td class='"+this.calendar.classNames.timeLine+"'>"+_1ff+"</td>"; |
|---|
| 2100 |
},buildTimeLineTop:function(){ |
|---|
| 2101 |
return "<div class='"+this.calendar.classNames.timeLineTimeTop+"'></div>"; |
|---|
| 2102 |
},buildCalendarContainer:function(){ |
|---|
| 2103 |
return "<td>"+"<table class='"+this.calendar.classNames.weekMainTable+"'>"+this.buildCalendarHeader()+this.buildCalendarMain()+"</table>"+"</td>"; |
|---|
| 2104 |
},buildCalendarHeader:function(){ |
|---|
| 2105 |
var _203=this.calendar.options.displayIndexes; |
|---|
| 2106 |
var ths=""; |
|---|
| 2107 |
var _205=new Date().days(); |
|---|
| 2108 |
var _206=100/_203.length+"%"; |
|---|
| 2109 |
var _207=this.calendar.element.id.appendSuffix(this.ids.column); |
|---|
| 2110 |
var _208=this.calendar.element.id.appendSuffix(this.ids.headerText); |
|---|
| 2111 |
this.headers=[]; |
|---|
| 2112 |
var _209=this.calendar.options.noEvent; |
|---|
| 2113 |
var _20a=(this.calendar.options.weekSubHeaderFormat)?new Template(this.calendar.options.weekSubHeaderFormat):null; |
|---|
| 2114 |
this.week.each(function(w,_20c){ |
|---|
| 2115 |
var text=null; |
|---|
| 2116 |
if(_20a){ |
|---|
| 2117 |
text=_20a.evaluate({month:w.getMonth().succ(),day:w.getDate(),wday:this.calendar.options.dayOfWeek[w.getDay()]}); |
|---|
| 2118 |
}else{ |
|---|
| 2119 |
text=w.toDateString().split(" "); |
|---|
| 2120 |
text.pop(); |
|---|
| 2121 |
text=text.join(" "); |
|---|
| 2122 |
} |
|---|
| 2123 |
var _20e=(w.days()==_205)?this.calendar.classNames.highlightDay:""; |
|---|
| 2124 |
var _20f=_208.appendSuffix(_20c); |
|---|
| 2125 |
var node="<div class='"+this.calendar.classNames.headerColumn+"'>"; |
|---|
| 2126 |
if(_209){ |
|---|
| 2127 |
node+="<span='#' id='"+_20f+"' class='"+_20e+"' style='cursor: default;'>"+text+"</a>"; |
|---|
| 2128 |
}else{ |
|---|
| 2129 |
node+="<a href='#' id='"+_20f+"' class='"+_20e+"'>"+text+"</a>"; |
|---|
| 2130 |
} |
|---|
| 2131 |
node+="</div>"; |
|---|
| 2132 |
this.headers.push({id:_20f,wday:w}); |
|---|
| 2133 |
ths+="<th id='"+_207.appendSuffix(_20c)+"' width='"+_206+"'>"+node+"</th>"; |
|---|
| 2134 |
}.bind(this)); |
|---|
| 2135 |
return "<tr>"+"<td>"+"<table class='"+this.calendar.classNames.weekMainTable+"'>"+"<tr>"+ths+"</tr>"+"</table>"+"</td>"+"</tr>"; |
|---|
| 2136 |
},buildCalendarMain:function(){ |
|---|
| 2137 |
var _211=this.calendar.options.displayIndexes; |
|---|
| 2138 |
var tds=""; |
|---|
| 2139 |
var _213=100/_211.length+"%"; |
|---|
| 2140 |
this.dateMap={}; |
|---|
| 2141 |
this.week.each(function(w,_215){ |
|---|
| 2142 |
var _216=this.calendar.options.schedules[w.toDateString()]; |
|---|
| 2143 |
var _217=""; |
|---|
| 2144 |
var i=0,j=0; |
|---|
| 2145 |
while(i<24){ |
|---|
| 2146 |
if(this.includeDisplayTime(i)){ |
|---|
| 2147 |
var _21a=""; |
|---|
| 2148 |
if(_217.length==0){ |
|---|
| 2149 |
_21a=this.calendar.classNames.columnTopDate; |
|---|
| 2150 |
}else{ |
|---|
| 2151 |
if(i%1==0){ |
|---|
| 2152 |
_21a=this.calendar.classNames.columnDate; |
|---|
| 2153 |
}else{ |
|---|
| 2154 |
_21a=this.calendar.classNames.columnDateOdd; |
|---|
| 2155 |
} |
|---|
| 2156 |
} |
|---|
| 2157 |
var id=this.getDateId(w,i,_215); |
|---|
| 2158 |
var hour=i/1; |
|---|
| 2159 |
var min=i%1*60; |
|---|
| 2160 |
this.dateMap[id]=new Date(w.getFullYear(),w.getMonth(),w.getDate(),hour,min,0); |
|---|
| 2161 |
_217+="<div id='"+id+"' class='"+_21a+"'></div>"; |
|---|
| 2162 |
} |
|---|
| 2163 |
i+=0.5; |
|---|
| 2164 |
} |
|---|
| 2165 |
tds+="<td width='"+_213+"'>"+_217+"</td>"; |
|---|
| 2166 |
}.bind(this)); |
|---|
| 2167 |
return "<tr>"+"<td>"+"<div id='"+this.getScheduleContainerId()+"' class='"+this.calendar.classNames.scheduleContainer+"' style='position: relative;'>"+"<table id='"+this.getCalendarTableId()+"' class='"+this.calendar.classNames.weekMainTable+"' style='position: relative;'>"+"<tr>"+tds+"</tr>"+"</table>"+"</div>"+"</td>"+"</tr>"; |
|---|
| 2168 |
},setColumnEvent:function(node){ |
|---|
| 2169 |
},beforeBuild:function(){ |
|---|
| 2170 |
this.column={}; |
|---|
| 2171 |
var rule=CssUtil.getCssRuleBySelectorText("."+Calendar.className.columnDate); |
|---|
| 2172 |
this.column.height=parseInt(rule.style["height"],10)+1; |
|---|
| 2173 |
},buildSchedule:function(_220){ |
|---|
| 2174 |
var id="scheduleItem_"+_220.id; |
|---|
| 2175 |
var _222=(_220.edit==undefined||_220.edit); |
|---|
| 2176 |
var item=Builder.node("DIV",{id:id}); |
|---|
| 2177 |
this.calendar.css.addClassNames(item,"scheduleItemLarge"); |
|---|
| 2178 |
var _224=this.calendar.options.noEvent; |
|---|
| 2179 |
var term=DateUtil.toDate(_220.finish).minutes()-DateUtil.toDate(_220.start).minutes(); |
|---|
| 2180 |
var _226={}; |
|---|
| 2181 |
if(_220.background_color){ |
|---|
| 2182 |
_226.backgroundColor=_220.background_color; |
|---|
| 2183 |
} |
|---|
| 2184 |
if(_220.frame_color){ |
|---|
| 2185 |
_226.borderTop="2px solid "+_220.frame_color; |
|---|
| 2186 |
_226.borderLeft="1px solid "+_220.frame_color; |
|---|
| 2187 |
_226.borderRight="1px solid "+_220.frame_color; |
|---|
| 2188 |
_226.borderBottom="2px solid "+_220.frame_color; |
|---|
| 2189 |
if(term<=30){ |
|---|
| 2190 |
_226.backgroundColor=_220.frame_color; |
|---|
| 2191 |
} |
|---|
| 2192 |
} |
|---|
| 2193 |
if(_224){ |
|---|
| 2194 |
_226.cursor="default"; |
|---|
| 2195 |
} |
|---|
| 2196 |
Element.setStyle(item,_226); |
|---|
| 2197 |
var _227=[]; |
|---|
| 2198 |
if(_222){ |
|---|
| 2199 |
var _228=Builder.node("DIV",{id:"scheduleDeleteImg_"+_220.id,className:this.calendar.css.joinClassNames("deleteImg"),style:"display: none;"}); |
|---|
| 2200 |
_227.push(_228); |
|---|
| 2201 |
item.appendChild(_228); |
|---|
| 2202 |
if(!_224){ |
|---|
| 2203 |
Event.observe(_228,"click",this.clickDeleteImage.bind(this,_220)); |
|---|
| 2204 |
} |
|---|
| 2205 |
} |
|---|
| 2206 |
if(!_224&&this.calendar.options.dblclickSchedule){ |
|---|
| 2207 |
Event.observe(item,"dblclick",this.calendar.options.dblclickSchedule.bind(this,_220)); |
|---|
| 2208 |
} |
|---|
| 2209 |
var icon=null; |
|---|
| 2210 |
if(_220.icon){ |
|---|
| 2211 |
icon=Builder.node("IMG",{src:_220.icon,alt:_220.type_name,style:"float: left;",width:16,height:16}); |
|---|
| 2212 |
}else{ |
|---|
| 2213 |
if(Calendar.defaultIconPath){ |
|---|
| 2214 |
icon=Builder.node("IMG",{src:Calendar.defaultIconPath,alt:_220.type_name,style:"float: left;",width:16,height:16}); |
|---|
| 2215 |
} |
|---|
| 2216 |
} |
|---|
| 2217 |
var _22a=null; |
|---|
| 2218 |
if(!_220.publicity){ |
|---|
| 2219 |
if(Calendar.privateImgPath){ |
|---|
| 2220 |
_22a=Builder.node("IMG",{id:"private_img_"+_220.id,src:Calendar.privateImgPath,alt:"private",style:"position: absolute; right: 0px; display: block;",width:16,height:16}); |
|---|
| 2221 |
item.appendChild(_22a); |
|---|
| 2222 |
}else{ |
|---|
| 2223 |
_22a=Builder.node("DIV",{id:"private_img_"+_220.id}); |
|---|
| 2224 |
this.calendar.css.addClassNames(_22a,"privateImg"); |
|---|
| 2225 |
item.appendChild(_22a); |
|---|
| 2226 |
} |
|---|
| 2227 |
} |
|---|
| 2228 |
if(!_224&&(_227.length>0)){ |
|---|
| 2229 |
Event.observe(item,"mouseover",this.showImage.bind(this,_227,_22a)); |
|---|
| 2230 |
Event.observe(item,"mouseout",this.hideImage.bind(this,_227,_22a)); |
|---|
| 2231 |
} |
|---|
| 2232 |
var text=this.getTimeText(_220.start,_220.finish); |
|---|
| 2233 |
var _22c=_220.description.unescapeHTML(); |
|---|
| 2234 |
var _22d={id:id+"_text"}; |
|---|
| 2235 |
if(_220.frame_color){ |
|---|
| 2236 |
_22d.style="background-color:"+_220.frame_color+";"; |
|---|
| 2237 |
} |
|---|
| 2238 |
if(!_224&&_222){ |
|---|
| 2239 |
_22d.style+="cursor: move;"; |
|---|
| 2240 |
} |
|---|
| 2241 |
if(term<=15){ |
|---|
| 2242 |
var _22e=this.calendar.formatTime(_220.start); |
|---|
| 2243 |
_22d.style+="line-height: 12px;"; |
|---|
| 2244 |
if(UserAgent.isFF()){ |
|---|
| 2245 |
_22d.style+="white-space: nowrap;"; |
|---|
| 2246 |
} |
|---|
| 2247 |
var _22f=Builder.node("DIV",_22d,[icon,_22e+" "+_22c]); |
|---|
| 2248 |
this.calendar.css.addClassNames(_22f,"scheduleTimeArea"); |
|---|
| 2249 |
item.appendChild(_22f); |
|---|
| 2250 |
}else{ |
|---|
| 2251 |
if(term<=30){ |
|---|
| 2252 |
var _22e=this.calendar.formatTime(_220.start); |
|---|
| 2253 |
if(UserAgent.isIE()){ |
|---|
| 2254 |
_22d.style+="line-height: 20px;"; |
|---|
| 2255 |
}else{ |
|---|
| 2256 |
_22d.style+="line-height: 18px; white-space: nowrap;"; |
|---|
| 2257 |
} |
|---|
| 2258 |
var _22f=Builder.node("DIV",_22d,[icon,_22e+" "+_22c]); |
|---|
| 2259 |
this.calendar.css.addClassNames(_22f,"scheduleTimeArea"); |
|---|
| 2260 |
item.appendChild(_22f); |
|---|
| 2261 |
}else{ |
|---|
| 2262 |
_22d.style+="line-height: 18px;"; |
|---|
| 2263 |
var _22f=Builder.node("DIV",_22d,[icon,text]); |
|---|
| 2264 |
this.calendar.css.addClassNames(_22f,"scheduleTimeArea"); |
|---|
| 2265 |
item.appendChild(_22f); |
|---|
| 2266 |
item.appendChild(Builder.node("DIV",{id:id+"_description"},[_22c])); |
|---|
| 2267 |
} |
|---|
| 2268 |
} |
|---|
| 2269 |
item.title=text.replace(/ /g,"")+" "+_220.popup.unescapeHTML()+"\n "+_220.popup2.unescapeHTML()+"\n "+_220.popup3.unescapeHTML(); |
|---|
| 2270 |
item.schedule=_220; |
|---|
| 2271 |
return [item,_22f]; |
|---|
| 2272 |
},adjustScheduleStyle:function(item,_231,_232){ |
|---|
| 2273 |
var _233=item.schedule; |
|---|
| 2274 |
var time=this.convertHours(_233); |
|---|
| 2275 |
var _235=time[0]; |
|---|
| 2276 |
var _236=time[1]; |
|---|
| 2277 |
var same=[]; |
|---|
| 2278 |
var self=this; |
|---|
| 2279 |
if(!_232.sames){ |
|---|
| 2280 |
_232.sames=[]; |
|---|
| 2281 |
} |
|---|
| 2282 |
_232.each(function(h){ |
|---|
| 2283 |
var _23a=self.convertHours(h.schedule); |
|---|
| 2284 |
var _23b=_23a[0]; |
|---|
| 2285 |
var _23c=_23a[1]; |
|---|
| 2286 |
if(((_23b<=_235)&&(_23c>_235))||((_23b<_236)&&(_23c>=_236))||((_235<=_23b)&&(_236>_23b))||((_235<_23c)&&(_236>=_23c))){ |
|---|
| 2287 |
same.push(h); |
|---|
| 2288 |
} |
|---|
| 2289 |
}); |
|---|
| 2290 |
var _23d=_231*this.getAdjustSize(); |
|---|
| 2291 |
if(UserAgent.isIE()||this.calendar.options.noEvent){ |
|---|
| 2292 |
_23d+=1; |
|---|
| 2293 |
} |
|---|
| 2294 |
var left=this.column.width*_231+_23d; |
|---|
| 2295 |
if(same.length==0){ |
|---|
| 2296 |
Element.setStyle(item,{left:left+"px"}); |
|---|
| 2297 |
}else{ |
|---|
| 2298 |
var _23f=false; |
|---|
| 2299 |
_232.sames.each(function(_240){ |
|---|
| 2300 |
if(_23f){ |
|---|
| 2301 |
throw $break; |
|---|
| 2302 |
} |
|---|
| 2303 |
same.each(function(s){ |
|---|
| 2304 |
if(_240.include(s)){ |
|---|
| 2305 |
same=_240; |
|---|
| 2306 |
_23f=true; |
|---|
| 2307 |
throw $break; |
|---|
| 2308 |
} |
|---|
| 2309 |
}); |
|---|
| 2310 |
}); |
|---|
| 2311 |
same.push(item); |
|---|
| 2312 |
var _242=parseInt(Element.getStyle(item,"width"),10)/(same.length)-(UserAgent.isIE()?1:2)+1; |
|---|
| 2313 |
same.each(function(s,i){ |
|---|
| 2314 |
var _245=left+_242*i+(2*i); |
|---|
| 2315 |
Element.setStyle(s,{width:_242+"px",left:_245+"px"}); |
|---|
| 2316 |
}); |
|---|
| 2317 |
if(!_23f){ |
|---|
| 2318 |
_232.sames.push(same); |
|---|
| 2319 |
} |
|---|
| 2320 |
} |
|---|
| 2321 |
return left; |
|---|
| 2322 |
},setScheduleBaseStyle:function(item){ |
|---|
| 2323 |
var _247=item.schedule; |
|---|
| 2324 |
if(!this.calendar.isSameDate(_247.start,_247.finish)){ |
|---|
| 2325 |
_247.finish.hour=24; |
|---|
| 2326 |
_247.finish.min=0; |
|---|
| 2327 |
} |
|---|
| 2328 |
var time=this.convertHours(_247); |
|---|
| 2329 |
var _249=time.first(); |
|---|
| 2330 |
var _24a=time.last(); |
|---|
| 2331 |
var _24b=this.column.height*2; |
|---|
| 2332 |
var diff=this.calendar.getTimeDiff(_247.start,_247.finish); |
|---|
| 2333 |
var rate=(diff.hour+(diff.min/60))||1; |
|---|
| 2334 |
var over=0; |
|---|
| 2335 |
var top=0; |
|---|
| 2336 |
var _250=0; |
|---|
| 2337 |
var _251=this.includeDisplayTime(_249); |
|---|
| 2338 |
var _252=this.includeDisplayTime(_24a,true); |
|---|
| 2339 |
if(!_251&&!_252){ |
|---|
| 2340 |
if((this.startTime<=_249&&this.startTime<=_24a)||(_249<this.finishTime&&_24a<this.finishTime)){ |
|---|
| 2341 |
top=_250=0; |
|---|
| 2342 |
Element.hide(item); |
|---|
| 2343 |
this.hasInvisibleSchedule=true; |
|---|
| 2344 |
}else{ |
|---|
| 2345 |
top=0; |
|---|
| 2346 |
_250=_24b*(this.finishTime-this.startTime)-3; |
|---|
| 2347 |
} |
|---|
| 2348 |
}else{ |
|---|
| 2349 |
if(_251){ |
|---|
| 2350 |
top=_24b*(_249-this.startTime); |
|---|
| 2351 |
_250=_24b*rate-3; |
|---|
| 2352 |
}else{ |
|---|
| 2353 |
top=0; |
|---|
| 2354 |
over=this.startTime-_249; |
|---|
| 2355 |
_250=_24b*(rate-over); |
|---|
| 2356 |
} |
|---|
| 2357 |
if(_252){ |
|---|
| 2358 |
}else{ |
|---|
| 2359 |
over=_24a-this.finishTime; |
|---|
| 2360 |
_250-=_24b*over; |
|---|
| 2361 |
} |
|---|
| 2362 |
} |
|---|
| 2363 |
try{ |
|---|
| 2364 |
Element.setStyle(item,{top:top+"px",width:this.column.width+"px",height:_250+"px"}); |
|---|
| 2365 |
} |
|---|
| 2366 |
catch(e){ |
|---|
| 2367 |
} |
|---|
| 2368 |
},afterBuild:function(){ |
|---|
| 2369 |
this.calendar.options.startAfterBuild(); |
|---|
| 2370 |
this.hasInvisibleSchedule=false; |
|---|
| 2371 |
this.calendarTable=$(this.getCalendarTableId()); |
|---|
| 2372 |
this.setContainerInfo(); |
|---|
| 2373 |
this.setColumnWidth(); |
|---|
| 2374 |
this.setCover(); |
|---|
| 2375 |
var self=this; |
|---|
| 2376 |
var _254=$(this.getScheduleContainerId()); |
|---|
| 2377 |
var _255=this.getDragDistance(); |
|---|
| 2378 |
this.scheduleNodes=[]; |
|---|
| 2379 |
var _256=this.week.map(function(){ |
|---|
| 2380 |
return []; |
|---|
| 2381 |
}); |
|---|
| 2382 |
var _257=this.week.legth-1; |
|---|
| 2383 |
var _258=this.calendar.options.noEvent; |
|---|
| 2384 |
this.calendar.options.schedules.each(function(_259){ |
|---|
| 2385 |
var _25a=[]; |
|---|
| 2386 |
var sub,_25c,_25d=null; |
|---|
| 2387 |
self.week.each(function(date,_25f){ |
|---|
| 2388 |
if(self.calendar.betweenDate(_259,date)){ |
|---|
| 2389 |
if(self.isSameStartDate(_259,date)&&self.isSameFinishDate(_259,date)){ |
|---|
| 2390 |
_25d=self.setSchedule(_259,_25f,_256,_254,_255); |
|---|
| 2391 |
_25d.cellDate=date; |
|---|
| 2392 |
_25a.push(_25d); |
|---|
| 2393 |
}else{ |
|---|
| 2394 |
sub=self.copyOneDaySchedule(_259,date); |
|---|
| 2395 |
if(sub.finish.hour==0&&sub.finish.min==0){ |
|---|
| 2396 |
throw $continue; |
|---|
| 2397 |
} |
|---|
| 2398 |
_25c=self.setSchedule(sub,_25f,_256,_254,_255); |
|---|
| 2399 |
_25c.originalSchedule=_259; |
|---|
| 2400 |
_25c.cellDate=date; |
|---|
| 2401 |
_25a.push(_25c); |
|---|
| 2402 |
} |
|---|
| 2403 |
}else{ |
|---|
| 2404 |
if(sub){ |
|---|
| 2405 |
throw $break; |
|---|
| 2406 |
} |
|---|
| 2407 |
} |
|---|
| 2408 |
}); |
|---|
| 2409 |
if(!self.hasInvisibleSchedule){ |
|---|
| 2410 |
(self.invisibleWeek||[]).each(function(date){ |
|---|
| 2411 |
if(self.calendar.betweenDate(_259,date)){ |
|---|
| 2412 |
self.hasInvisibleSchedule=true; |
|---|
| 2413 |
throw $break; |
|---|
| 2414 |
} |
|---|
| 2415 |
}); |
|---|
| 2416 |
} |
|---|
| 2417 |
if(!_258){ |
|---|
| 2418 |
_25a.each(function(item){ |
|---|
| 2419 |
Event.observe(item,"mouseover",self.mouseOverSubSchedule.bind(this,_25a)); |
|---|
| 2420 |
Event.observe(item,"mouseout",self.mouseOutSubSchedule.bind(this,_25a)); |
|---|
| 2421 |
}); |
|---|
| 2422 |
} |
|---|
| 2423 |
if(!self.hasInvisibleSchedule&&(_25a.length==0)){ |
|---|
| 2424 |
self.hasInvisibleSchedule=true; |
|---|
| 2425 |
} |
|---|
| 2426 |
}); |
|---|
| 2427 |
this.calendar.options.endAfterBuild(); |
|---|
| 2428 |
},setEvent:function(){ |
|---|
| 2429 |
if(!this.calendar.options.noEvent){ |
|---|
| 2430 |
Event.observe(this.ids.pre,"click",this.calendar.changeCalendar.bindAsEventListener(this.calendar)); |
|---|
| 2431 |
Event.observe(this.ids.next,"click",this.calendar.changeCalendar.bindAsEventListener(this.calendar)); |
|---|
| 2432 |
if(this.calendar.options.useImgMark){ |
|---|
| 2433 |
new Hover(this.ids.pre); |
|---|
| 2434 |
new Hover(this.ids.next); |
|---|
| 2435 |
} |
|---|
| 2436 |
var _262=this.calendar.options.clickDateText||this.clickDateText; |
|---|
| 2437 |
if(this.headers){ |
|---|
| 2438 |
this.headers.each(function(_263){ |
|---|
| 2439 |
Event.observe(_263.id,"mousedown",_262.bindAsEventListener(this,_263.wday)); |
|---|
| 2440 |
}.bind(this)); |
|---|
| 2441 |
} |
|---|
| 2442 |
} |
|---|
| 2443 |
},copyOneDaySchedule:function(_264,date){ |
|---|
| 2444 |
var sub=null; |
|---|
| 2445 |
if(this.isSameStartDate(_264,date)){ |
|---|
| 2446 |
sub=this.copySchedule(_264,date); |
|---|
| 2447 |
sub.finish.hour=24; |
|---|
| 2448 |
sub.finish.min=0; |
|---|
| 2449 |
}else{ |
|---|
| 2450 |
if(this.isSameFinishDate(_264,date)){ |
|---|
| 2451 |
sub=this.copySchedule(_264,date); |
|---|
| 2452 |
sub.start.hour=0; |
|---|
| 2453 |
sub.start.min=0; |
|---|
| 2454 |
}else{ |
|---|
| 2455 |
sub=this.copySchedule(_264,date); |
|---|
| 2456 |
sub.start.hour=0; |
|---|
| 2457 |
sub.start.min=0; |
|---|
| 2458 |
sub.finish.hour=24; |
|---|
| 2459 |
sub.finish.min=0; |
|---|
| 2460 |
} |
|---|
| 2461 |
} |
|---|
| 2462 |
return sub; |
|---|
| 2463 |
},copySchedule:function(_267,date){ |
|---|
| 2464 |
sub=Object.extend({},_267); |
|---|
| 2465 |
sub.start={year:date.getFullYear(),month:date.getMonth(),day:date.getDate(),hour:_267.start.hour,min:_267.start.min}; |
|---|
| 2466 |
sub.finish={year:date.getFullYear(),month:date.getMonth(),day:date.getDate(),hour:_267.finish.hour,min:_267.finish.min}; |
|---|
| 2467 |
return sub; |
|---|
| 2468 |
},setSchedule:function(_269,_26a,_26b,_26c,_26d){ |
|---|
| 2469 |
var _26e=this.buildSchedule(_269); |
|---|
| 2470 |
var item=_26e.first(); |
|---|
| 2471 |
_26c.appendChild(item); |
|---|
| 2472 |
this.setScheduleBaseStyle(item); |
|---|
| 2473 |
var left=this.adjustScheduleStyle(item,_26a,_26b[_26a]); |
|---|
| 2474 |
var _271=_26a*this.getAdjustSize(); |
|---|
| 2475 |
var _272=this.column.width+_271+"px"; |
|---|
| 2476 |
if(!this.calendar.options.noEvent&&((_269.edit==undefined)||_269.edit)){ |
|---|
| 2477 |
this.setDraggable(item,_26e.last(),_26c,_26d); |
|---|
| 2478 |
this.setResize(item); |
|---|
| 2479 |
} |
|---|
| 2480 |
_26b[_26a].push(item); |
|---|
| 2481 |
this.scheduleNodes.push(item); |
|---|
| 2482 |
return item; |
|---|
| 2483 |
},getDragDistance:function(){ |
|---|
| 2484 |
var _273=this.getAdjustSize(); |
|---|
| 2485 |
return [this.column.width+_273,this.column.height/2]; |
|---|
| 2486 |
},setDraggable:function(item,_275,_276,_277){ |
|---|
| 2487 |
var self=this; |
|---|
| 2488 |
new Draggable(item,{handle:_275,scroll:window,starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction,snap:function(x,y,_27b){ |
|---|
| 2489 |
var _27c=Element.getDimensions(item); |
|---|
| 2490 |
var _27d=Element.getDimensions(_276); |
|---|
| 2491 |
var _27e=(self.column.height/2); |
|---|
| 2492 |
var _27f=_27b.offset; |
|---|
| 2493 |
x=Math.floor((x+_27f[0])/_277[0])*_277[0]; |
|---|
| 2494 |
y=Math.round((y)/_277[1])*_277[1]; |
|---|
| 2495 |
xy=[self._constrain(x,0,_27d.width-_27c.width),self._constrain(y,0-(_27c.height-_27e),_27d.height-_27e)]; |
|---|
| 2496 |
return xy; |
|---|
| 2497 |
},onEnd:function(_280,_281){ |
|---|
| 2498 |
if(_280.element.moved){ |
|---|
| 2499 |
self.changeSchedule(_280,_281); |
|---|
| 2500 |
}else{ |
|---|
| 2501 |
self.calendar.refreshSchedule(); |
|---|
| 2502 |
} |
|---|
| 2503 |
},change:function(_282){ |
|---|
| 2504 |
if(self.calendar.isMovedScheduler(_282)){ |
|---|
| 2505 |
_282.element.moved=true; |
|---|
| 2506 |
self.changeTimeDisplay(_282.element); |
|---|
| 2507 |
} |
|---|
| 2508 |
}}); |
|---|
| 2509 |
},setResize:function(item){ |
|---|
| 2510 |
new CalendarResizeableEx(item,{left:0,right:0,top:0,distance:this.column.height/2,restriction:true,resize:function(_284){ |
|---|
| 2511 |
this.updateTirm(_284); |
|---|
| 2512 |
}.bind(this),change:function(_285){ |
|---|
| 2513 |
this.changeTimeDisplay(_285); |
|---|
| 2514 |
}.bind(this)}); |
|---|
| 2515 |
},getDate:function(_286){ |
|---|
| 2516 |
return _286.date; |
|---|
| 2517 |
},abstractSelect:function(_287,_288){ |
|---|
| 2518 |
var _289=this.findClickedElement(_287); |
|---|
| 2519 |
if(_289){ |
|---|
| 2520 |
if(Element.hasClassName(_289,Calendar.className.columnDate)||Element.hasClassName(_289,Calendar.className.columnDateOdd)||Element.hasClassName(_289,Calendar.className.columnTopDate)){ |
|---|
| 2521 |
var date=this.getDate(_289); |
|---|
| 2522 |
_288(date,_289); |
|---|
| 2523 |
} |
|---|
| 2524 |
} |
|---|
| 2525 |
},getSelectedTerm:function(){ |
|---|
| 2526 |
var _28b=this.calendar.getSelected(); |
|---|
| 2527 |
if(_28b.length==0){ |
|---|
| 2528 |
return; |
|---|
| 2529 |
} |
|---|
| 2530 |
if(this.calendar.options.build){ |
|---|
| 2531 |
var last=_28b.last(); |
|---|
| 2532 |
if(last){ |
|---|
| 2533 |
last=this.dateMap[last.id]; |
|---|
| 2534 |
}else{ |
|---|
| 2535 |
last=this.dateMap[_28b.first().id]; |
|---|
| 2536 |
} |
|---|
| 2537 |
last=new Date(last.getFullYear(),last.getMonth(),last.getDate(),last.getHours(),last.getMinutes(),0); |
|---|
| 2538 |
last.setMinutes(last.getMinutes()+30); |
|---|
| 2539 |
return [this.dateMap[_28b.first().id],last]; |
|---|
| 2540 |
}else{ |
|---|
| 2541 |
var last=this._getDateTimeFromElement(_28b.last()); |
|---|
| 2542 |
last.setMinutes(last.getMinutes()+30); |
|---|
| 2543 |
return [this._getDateTimeFromElement(_28b.first()),last]; |
|---|
| 2544 |
} |
|---|
| 2545 |
},setWidth:function(node){ |
|---|
| 2546 |
Element.setStyle(node,{width:this.column.width+"px"}); |
|---|
| 2547 |
},inspectArgument:function(_28e,time){ |
|---|
| 2548 |
if(_28e.date){ |
|---|
| 2549 |
return _28e; |
|---|
| 2550 |
} |
|---|
| 2551 |
var self=this; |
|---|
| 2552 |
var _291=this.calendar.getSelected(); |
|---|
| 2553 |
var _292=[]; |
|---|
| 2554 |
this.calendar.recurrence(_28e,function(o){ |
|---|
| 2555 |
var _294={}; |
|---|
| 2556 |
if(!o.date){ |
|---|
| 2557 |
_294={date:self.getDate(_291[0])}; |
|---|
| 2558 |
if(!o.start){ |
|---|
| 2559 |
_294.start=_291[0].time; |
|---|
| 2560 |
} |
|---|
| 2561 |
if(!o.finish){ |
|---|
| 2562 |
_294.finish=_291[_291.length-1].time; |
|---|
| 2563 |
} |
|---|
| 2564 |
} |
|---|
| 2565 |
Object.extend(_294,o); |
|---|
| 2566 |
_292.push(_294); |
|---|
| 2567 |
}); |
|---|
| 2568 |
return _292; |
|---|
| 2569 |
},inspectDateArgument:function(date){ |
|---|
| 2570 |
if(date){ |
|---|
| 2571 |
return date; |
|---|
| 2572 |
} |
|---|
| 2573 |
var _296=this; |
|---|
| 2574 |
var _297=this.getSelected(); |
|---|
| 2575 |
if(_297.length==0){ |
|---|
| 2576 |
return null; |
|---|
| 2577 |
} |
|---|
| 2578 |
return _297.collect(function(d){ |
|---|
| 2579 |
return _296.getDate(d); |
|---|
| 2580 |
}); |
|---|
| 2581 |
},addColumnClass:function(_299){ |
|---|
| 2582 |
if(document.all){ |
|---|
| 2583 |
this.calendar.css.addClassNames(_299,"columnWin"); |
|---|
| 2584 |
}else{ |
|---|
| 2585 |
this.calendar.css.addClassNames(_299,"column"); |
|---|
| 2586 |
} |
|---|
| 2587 |
},getHeaderId:function(){ |
|---|
| 2588 |
return this.calendar.element.id.appendSuffix(CalendarWeek.id.columnHeader); |
|---|
| 2589 |
},getColumnId:function(i){ |
|---|
| 2590 |
return this.calendar.element.id.appendSuffix(CalendarWeek.id.column+"_"+i); |
|---|
| 2591 |
},changeSchedule:function(_29b,_29c){ |
|---|
| 2592 |
var _29d=_29b.element; |
|---|
| 2593 |
var _29e=_29d.schedule; |
|---|
| 2594 |
var time=this.getTimeByElement(_29d); |
|---|
| 2595 |
this.calendar.cacheSchedule(_29e); |
|---|
| 2596 |
var _2a0=$(this.getScheduleContainerId()); |
|---|
| 2597 |
var _2a1=Element.getDimensions(_2a0); |
|---|
| 2598 |
var _2a2=Position.cumulativeOffset(_2a0); |
|---|
| 2599 |
var x=Event.pointerX(_29c); |
|---|
| 2600 |
var y=Event.pointerY(_29c); |
|---|
| 2601 |
var left=parseInt(Element.getStyle(_29d,"left")); |
|---|
| 2602 |
var _2a6=Math.round(left/this.column.width); |
|---|
| 2603 |
var date=this.week[_2a6]; |
|---|
| 2604 |
if(_29e.start.year==date.getFullYear()&&_29e.start.month==date.getMonth()&&_29e.start.day==date.getDate()&&_29e.start.hour==time[0].hour&&_29e.start.min==time[0].min&&_29e.finish.year==date.getFullYear()&&_29e.finish.month==date.getMonth()&&_29e.finish.day==date.getDate()&&_29e.finish.hour==time[1].hour&&_29e.finish.min==time[1].min){ |
|---|
| 2605 |
this.calendar.refreshSchedule(); |
|---|
| 2606 |
return; |
|---|
| 2607 |
} |
|---|
| 2608 |
if(_29d.originalSchedule){ |
|---|
| 2609 |
_29e=_29d.originalSchedule; |
|---|
| 2610 |
} |
|---|
| 2611 |
var _2a8={year:date.getFullYear(),month:date.getMonth(),day:date.getDate(),hour:time[0].hour,min:time[0].min}; |
|---|
| 2612 |
var _2a9=DateUtil.toDate(_2a8); |
|---|
| 2613 |
var _2aa=_29d.cellDate.days()-DateUtil.toDate(_29e.start).days(); |
|---|
| 2614 |
_2a9.setDate(_2a9.getDate()-_2aa); |
|---|
| 2615 |
var diff=_2a9.getTime()-DateUtil.toDate(_29e.start).getTime(); |
|---|
| 2616 |
_29e.start=_2a9.toHash(); |
|---|
| 2617 |
_29e.finish=new Date(DateUtil.toDate(_29e.finish).getTime()+diff).toHash(); |
|---|
| 2618 |
this.calendar.refreshSchedule(); |
|---|
| 2619 |
this.calendar.options.changeSchedule(_29e); |
|---|
| 2620 |
},updateTirm:function(_2ac){ |
|---|
| 2621 |
var _2ad=_2ac.schedule; |
|---|
| 2622 |
var time=this.getTimeByElement(_2ac); |
|---|
| 2623 |
this.calendar.cacheSchedule(_2ad); |
|---|
| 2624 |
var left=parseInt(Element.getStyle(_2ac,"left")); |
|---|
| 2625 |
var _2b0=Math.floor(left/this.column.width); |
|---|
| 2626 |
var date=this.week[_2b0]; |
|---|
| 2627 |
var _2b2=this.isChengeSchedule(_2ac,time); |
|---|
| 2628 |
if(_2ac.originalSchedule){ |
|---|
| 2629 |
_2ad=_2ac.originalSchedule; |
|---|
| 2630 |
} |
|---|
| 2631 |
if(_2b2.start){ |
|---|
| 2632 |
_2ad.start.year=date.getFullYear(); |
|---|
| 2633 |
_2ad.start.month=date.getMonth(); |
|---|
| 2634 |
_2ad.start.day=date.getDate(); |
|---|
| 2635 |
_2ad.start.hour=time[0].hour; |
|---|
| 2636 |
_2ad.start.min=time[0].min; |
|---|
| 2637 |
} |
|---|
| 2638 |
if(_2b2.finish){ |
|---|
| 2639 |
_2ad.finish.year=date.getFullYear(); |
|---|
| 2640 |
_2ad.finish.month=date.getMonth(); |
|---|
| 2641 |
_2ad.finish.day=date.getDate(); |
|---|
| 2642 |
_2ad.finish.hour=time[1].hour; |
|---|
| 2643 |
_2ad.finish.min=time[1].min; |
|---|
| 2644 |
} |
|---|
| 2645 |
this.calendar.refreshSchedule(); |
|---|
| 2646 |
if(_2b2.start||_2b2.finish){ |
|---|
| 2647 |
this.calendar.options.updateTirm(_2ad); |
|---|
| 2648 |
} |
|---|
| 2649 |
},changeTimeDisplay:function(_2b3){ |
|---|
| 2650 |
var _2b4=_2b3.schedule; |
|---|
| 2651 |
var time=this.getTimeByElement(_2b3); |
|---|
| 2652 |
var _2b6=Element.getElementsByClassName(_2b3,Calendar.className.scheduleTimeArea)[0]; |
|---|
| 2653 |
var text=this.getTimeText(time[0],time[1]); |
|---|
| 2654 |
_2b6.innerHTML=text; |
|---|
| 2655 |
},findClickedElement:function(_2b8){ |
|---|
| 2656 |
var _2b9=$(this.getScheduleContainerId()); |
|---|
| 2657 |
var _2ba=Position.cumulativeOffset(_2b9); |
|---|
| 2658 |
var _2bb=Position.realOffset(_2b9).last(); |
|---|
| 2659 |
_2bb-=document.documentElement.scrollTop||document.body.scrollTop; |
|---|
| 2660 |
var x=Event.pointerX(_2b8)-_2ba[0]; |
|---|
| 2661 |
var y=Event.pointerY(_2b8)-_2ba[1]+_2bb; |
|---|
| 2662 |
var _2be=Math.floor(y/this.column.height); |
|---|
| 2663 |
var _2bf=Math.floor(x/this.column.width); |
|---|
| 2664 |
var row=this.calendarTable.rows[0]; |
|---|
| 2665 |
if(_2bf>=row.cells.length){ |
|---|
| 2666 |
_2bf--; |
|---|
| 2667 |
} |
|---|
| 2668 |
return $(row.cells[_2bf]).down(_2be); |
|---|
| 2669 |
},multipleSelection:function(_2c1){ |
|---|
| 2670 |
if(!this.calendar.selectedBase||!this.calendar.mouseDown){ |
|---|
| 2671 |
return; |
|---|
| 2672 |
} |
|---|
| 2673 |
var self=this; |
|---|
| 2674 |
var _2c3=this.calendar; |
|---|
| 2675 |
var _2c4=this.calendar.selectedBase; |
|---|
| 2676 |
var _2c5=this._getDateFromElement(_2c4).getDate(); |
|---|
| 2677 |
this.abstractSelect(_2c1,function(date,_2c7){ |
|---|
| 2678 |
var _2c8=$(_2c4.id); |
|---|
| 2679 |
if(_2c5!=self._getDateFromElement(_2c7).getDate()){ |
|---|
| 2680 |
return; |
|---|
| 2681 |
} |
|---|
| 2682 |
var _2c9=$A(_2c8.parentNode.childNodes); |
|---|
| 2683 |
var ids=[this._getTime(_2c4),this._getTime(_2c7)]; |
|---|
| 2684 |
ids.sort(function(a,b){ |
|---|
| 2685 |
return a-b; |
|---|
| 2686 |
}); |
|---|
| 2687 |
_2c9.each(function(n){ |
|---|
| 2688 |
if(!n.id){ |
|---|
| 2689 |
throw $continue; |
|---|
| 2690 |
} |
|---|
| 2691 |
var id=this._getTime(n); |
|---|
| 2692 |
if((id<ids[0])||(ids[1]<id)){ |
|---|
| 2693 |
_2c3.removeSelectedClass(n); |
|---|
| 2694 |
}else{ |
|---|
| 2695 |
if(!Element.hasClassName(n,Calendar.className.selected)){ |
|---|
| 2696 |
_2c3.addSelectedClass(n); |
|---|
| 2697 |
} |
|---|
| 2698 |
} |
|---|
| 2699 |
}.bind(this)); |
|---|
| 2700 |
}.bind(this)); |
|---|
| 2701 |
},getTimeByElement:function(_2cf){ |
|---|
| 2702 |
var _2d0=_2cf.schedule; |
|---|
| 2703 |
var top=parseInt(Element.getStyle(_2cf,"top"),10); |
|---|
| 2704 |
var _2d2=parseInt(Element.getStyle(_2cf,"height"),10); |
|---|
| 2705 |
var _2d3=this.column.height*2; |
|---|
| 2706 |
var _2d4=15/60; |
|---|
| 2707 |
var _2d5=top/_2d3+this.startTime; |
|---|
| 2708 |
_2d5=Math.round(_2d5/_2d4)*_2d4; |
|---|
| 2709 |
var _2d6={}; |
|---|
| 2710 |
_2d6.hour=Math.floor(_2d5); |
|---|
| 2711 |
_2d6.min=(_2d5-_2d6.hour)*60; |
|---|
| 2712 |
var _2d7=Math.round(_2d2/_2d3/_2d4)*_2d4+_2d5; |
|---|
| 2713 |
var _2d8={}; |
|---|
| 2714 |
_2d8.hour=Math.floor(_2d7); |
|---|
| 2715 |
_2d8.min=Math.round((_2d7-_2d8.hour)*60); |
|---|
| 2716 |
if(_2d8.min==60){ |
|---|
| 2717 |
_2d8.hour+=1; |
|---|
| 2718 |
_2d8.min=0; |
|---|
| 2719 |
} |
|---|
| 2720 |
return [_2d6,_2d8]; |
|---|
| 2721 |
},getTimeByTop:function(top){ |
|---|
| 2722 |
var _2da=this.column.height*2; |
|---|
| 2723 |
var _2db=15/60; |
|---|
| 2724 |
var _2dc=top/_2da+this.startTime; |
|---|
| 2725 |
_2dc=Math.round(_2dc/_2db)*_2db; |
|---|
| 2726 |
var _2dd={}; |
|---|
| 2727 |
_2dd.hour=Math.floor(_2dc); |
|---|
| 2728 |
_2dd.min=(_2dc-_2dd.hour)*60; |
|---|
| 2729 |
return _2dd; |
|---|
| 2730 |
},getDateId:function(date,time,_2e0){ |
|---|
| 2731 |
var id=this.calendar.element.id.appendSuffix(_2e0+"_"+date.getDate()); |
|---|
| 2732 |
return id.appendSuffix(time*10); |
|---|
| 2733 |
},dateIdToTime:function(id){ |
|---|
| 2734 |
id=id.getSuffix()/10; |
|---|
| 2735 |
var hour=Math.floor(id); |
|---|
| 2736 |
return {hour:hour,min:(id-hour)*60}; |
|---|
| 2737 |
},formatTime:function(date){ |
|---|
| 2738 |
var time=date.toTimeString(); |
|---|
| 2739 |
time=time.split(" "); |
|---|
| 2740 |
time=time[0].split(":"); |
|---|
| 2741 |
time.pop(); |
|---|
| 2742 |
return time.join(":"); |
|---|
| 2743 |
},includeDisplayTime:function(_2e6,_2e7){ |
|---|
| 2744 |
if(_2e7){ |
|---|
| 2745 |
return (this.startTime<_2e6)&&(_2e6<this.finishTime); |
|---|
| 2746 |
}else{ |
|---|
| 2747 |
return (this.startTime<=_2e6)&&(_2e6<this.finishTime); |
|---|
| 2748 |
} |
|---|
| 2749 |
},convertHours:function(_2e8){ |
|---|
| 2750 |
return [_2e8.start.hour+_2e8.start.min/60,_2e8.finish.hour+_2e8.finish.min/60]; |
|---|
| 2751 |
},setDisplayTime:function(){ |
|---|
| 2752 |
this.startTime=this.calendar.options.displayTime.first().hour; |
|---|
| 2753 |
var _2e9=this.calendar.options.displayTime.last(); |
|---|
| 2754 |
this.finishTime=Math.ceil(_2e9.hour+_2e9.min/60); |
|---|
| 2755 |
},getTimeText:function(_2ea,_2eb){ |
|---|
| 2756 |
var _2ec=this.calendar; |
|---|
| 2757 |
return _2ec.formatTime(_2ea)+" - "+_2ec.formatTime(_2eb); |
|---|
| 2758 |
},isChengeSchedule:function(_2ed,_2ee){ |
|---|
| 2759 |
var _2ef=_2ed.schedule; |
|---|
| 2760 |
var _2f0=((_2ef.start.hour!=_2ee[0].hour)||(_2ef.start.min!=_2ee[0].min)); |
|---|
| 2761 |
var _2f1=((_2ef.finish.hour!=_2ee[1].hour)||(_2ef.finish.min!=_2ee[1].min)); |
|---|
| 2762 |
if(_2ed.originalSchedule){ |
|---|
| 2763 |
if(_2f0&&_2f1){ |
|---|
| 2764 |
var _2f2=DateUtil.toDate(_2ef.start).getTime(); |
|---|
| 2765 |
var _2f3=DateUtil.toDate(_2ed.originalSchedule.start).getTime(); |
|---|
| 2766 |
if(_2f2==_2f3){ |
|---|
| 2767 |
_2f1=false; |
|---|
| 2768 |
}else{ |
|---|
| 2769 |
_2f0=false; |
|---|
| 2770 |
} |
|---|
| 2771 |
}else{ |
|---|
| 2772 |
_2f0=false; |
|---|
| 2773 |
} |
|---|
| 2774 |
} |
|---|
| 2775 |
return {start:_2f0,finish:_2f1}; |
|---|
| 2776 |
},_getDateFromElement:function(_2f4){ |
|---|
| 2777 |
var arr=_2f4.id.split("_"); |
|---|
| 2778 |
var _2f6=arr[arr.length-3]; |
|---|
| 2779 |
return this.week[_2f6]; |
|---|
| 2780 |
},_getDateTimeFromElement:function(_2f7){ |
|---|
| 2781 |
var id=_2f7.id.split("_"); |
|---|
| 2782 |
var _2f9=id[id.length-3]; |
|---|
| 2783 |
if(this.week[_2f9]){ |
|---|
| 2784 |
var date=new Date(this.week[_2f9].getTime()); |
|---|
| 2785 |
date.setMinutes(parseInt(id.pop(),10)); |
|---|
| 2786 |
date.setHours(parseInt(id.pop(),10)); |
|---|
| 2787 |
return date; |
|---|
| 2788 |
}else{ |
|---|
| 2789 |
return this._getDate(_2f7); |
|---|
| 2790 |
} |
|---|
| 2791 |
},_getDate:function(_2fb){ |
|---|
| 2792 |
var id=_2fb.id.split("_"); |
|---|
| 2793 |
var date=new Date(this.calendar.date.getTime()); |
|---|
| 2794 |
date.setMinutes(parseInt(id.pop(),10)); |
|---|
| 2795 |
date.setHours(parseInt(id.pop(),10)); |
|---|
| 2796 |
return date; |
|---|
| 2797 |
},_getTimeString:function(_2fe){ |
|---|
| 2798 |
var arr=_2fe.id.split("_"); |
|---|
| 2799 |
var min=arr[arr.length-1]; |
|---|
| 2800 |
if(min=="0"){ |
|---|
| 2801 |
min="00"; |
|---|
| 2802 |
}else{ |
|---|
| 2803 |
if(min.length<2){ |
|---|
| 2804 |
min="0"+min; |
|---|
| 2805 |
} |
|---|
| 2806 |
} |
|---|
| 2807 |
return arr[arr.length-2]+min; |
|---|
| 2808 |
},_getTime:function(_301){ |
|---|
| 2809 |
return parseInt(this._getTimeString(_301),10); |
|---|
| 2810 |
}}); |
|---|
| 2811 |
var CalendarDay=Class.create(); |
|---|
| 2812 |
CalendarDay.id=["dayHeader"]; |
|---|
| 2813 |
Object.extend(CalendarDay.prototype,CalendarWeek.prototype); |
|---|
| 2814 |
Object.extend(CalendarDay.prototype,{initialize:function(_302){ |
|---|
| 2815 |
var day=_302.date.getDay(); |
|---|
| 2816 |
this.calendar=_302; |
|---|
| 2817 |
this.ids=SpinelzUtil.concat(this.calendar.element.id,CalendarWeek.id); |
|---|
| 2818 |
this.dayIds=SpinelzUtil.concat(this.calendar.element.id,CalendarDay.id); |
|---|
| 2819 |
this.setDisplayTime(); |
|---|
| 2820 |
this.calendar.options.displayIndexesOld=this.calendar.options.displayIndexes; |
|---|
| 2821 |
this.calendar.options.displayIndexes=[day]; |
|---|
| 2822 |
this.calendar.options.weekIndexOld=this.calendar.options.weekIndex; |
|---|
| 2823 |
this.calendar.options.weekIndex=day; |
|---|
| 2824 |
this.week=this.getWeek()[0]; |
|---|
| 2825 |
},destroy:function(){ |
|---|
| 2826 |
this.calendar.options.displayIndexes=this.calendar.options.displayIndexesOld; |
|---|
| 2827 |
this.calendar.options.weekIndex=this.calendar.options.weekIndexOld; |
|---|
| 2828 |
delete this.calendar.options.displayIndexesOld; |
|---|
| 2829 |
delete this.calendar.options.weekIndexOld; |
|---|
| 2830 |
},buildHeaderCenter:function(){ |
|---|
| 2831 |
var _304=this.calendar.date.toDateString(); |
|---|
| 2832 |
if(this.calendar.options.dayHeaderFormat){ |
|---|
| 2833 |
var date=this.calendar.date; |
|---|
| 2834 |
_304=new Template(this.calendar.options.dayHeaderFormat).evaluate({year:date.getFullYear(),month:date.getMonth()+1,day:date.getDate(),wday:this.calendar.options.dayOfWeek[date.getDay()]}); |
|---|
| 2835 |
} |
|---|
| 2836 |
return "<td class='"+this.calendar.classNames.years+"'>"+"<span id='"+this.dayIds.header+"' class='"+this.calendar.classNames.ym+"'>"+_304+"</span>"+"</td>"; |
|---|
| 2837 |
},preMarkChars:function(){ |
|---|
| 2838 |
return Calendar.marks.preDay; |
|---|
| 2839 |
},nextMarkChars:function(){ |
|---|
| 2840 |
return Calendar.marks.nextDay; |
|---|
| 2841 |
},buildTimeLineTop:function(){ |
|---|
| 2842 |
return ""; |
|---|
| 2843 |
},buildCalendarHeader:function(){ |
|---|
| 2844 |
return ""; |
|---|
| 2845 |
},changeCalendar:function(_306){ |
|---|
| 2846 |
var _307=Event.element(_306); |
|---|
| 2847 |
if(_307.tagName.toLowerCase().match(/^a$/)){ |
|---|
| 2848 |
_307=_307.parentNode; |
|---|
| 2849 |
} |
|---|
| 2850 |
var _308=new Date(this.calendar.date.toDateString()); |
|---|
| 2851 |
if(this.hasClassName(_307,Calendar.className.preWeekMark)||this.hasClassName(_307,Calendar.className.preWeekMark2)){ |
|---|
| 2852 |
this.calendar.date.setDate(this.calendar.date.getDate()-1); |
|---|
| 2853 |
}else{ |
|---|
| 2854 |
if(this.hasClassName(_307,Calendar.className.nextWeekMark)||this.hasClassName(_307,Calendar.className.nextWeekMark2)){ |
|---|
| 2855 |
this.calendar.date.setDate(this.calendar.date.getDate()+1); |
|---|
| 2856 |
} |
|---|
| 2857 |
} |
|---|
| 2858 |
this.calendar.options.changeCalendar(this.calendar.date,_308); |
|---|
| 2859 |
this.calendar.refresh(); |
|---|
| 2860 |
}}); |
|---|
| 2861 |
var CalendarResizeableEx=Class.create(); |
|---|
| 2862 |
Object.extend(CalendarResizeableEx.prototype,Resizeable.prototype); |
|---|
| 2863 |
Object.extend(CalendarResizeableEx.prototype,{initialize:function(_309){ |
|---|
| 2864 |
var _30a=Object.extend({top:3,bottom:3,left:3,right:3,minHeight:0,minWidth:0,zindex:1000,resize:null,distance:1,change:Prototype.emptyFunction,restriction:true},arguments[1]||{}); |
|---|
| 2865 |
this.element=$(_309); |
|---|
| 2866 |
this.handle=this.element; |
|---|
| 2867 |
Element.makePositioned(this.element); |
|---|
| 2868 |
this.options=_30a; |
|---|
| 2869 |
this.active=false; |
|---|
| 2870 |
this.resizing=false; |
|---|
| 2871 |
this.currentDirection=""; |
|---|
| 2872 |
this.eventMouseDown=this.startResize.bindAsEventListener(this); |
|---|
| 2873 |
this.eventMouseUp=this.endResize.bindAsEventListener(this); |
|---|
| 2874 |
this.eventMouseMove=this.update.bindAsEventListener(this); |
|---|
| 2875 |
this.eventCursorCheck=this.cursor.bindAsEventListener(this); |
|---|
| 2876 |
this.eventKeypress=this.keyPress.bindAsEventListener(this); |
|---|
| 2877 |
this.registerEvents(); |
|---|
| 2878 |
},startResize:function(_30b){ |
|---|
| 2879 |
Event.stop(_30b); |
|---|
| 2880 |
if(Event.isLeftClick(_30b)){ |
|---|
| 2881 |
var src=Event.element(_30b); |
|---|
| 2882 |
if(src.tagName&&(src.tagName=="INPUT"||src.tagName=="SELECT"||src.tagName=="BUTTON"||src.tagName=="TEXTAREA")){ |
|---|
| 2883 |
return; |
|---|
| 2884 |
} |
|---|
| 2885 |
var dir=this.directions(_30b); |
|---|
| 2886 |
if(dir.length>0){ |
|---|
| 2887 |
this.active=true; |
|---|
| 2888 |
this.startTop=parseInt(Element.getStyle(this.element,"top"),10); |
|---|
| 2889 |
this.startLeft=parseInt(Element.getStyle(this.element,"left"),10); |
|---|
| 2890 |
this.startWidth=parseInt(Element.getStyle(this.element,"width"),10); |
|---|
| 2891 |
this.startHeight=parseInt(Element.getStyle(this.element,"height"),10); |
|---|
| 2892 |
this.startX=_30b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft; |
|---|
| 2893 |
this.startY=_30b.clientY+document.body.scrollTop+document.documentElement.scrollTop; |
|---|
| 2894 |
this.currentDirection=dir; |
|---|
| 2895 |
if(this.options.restriction){ |
|---|
| 2896 |
var _30e=this.element.parentNode; |
|---|
| 2897 |
this.restDimensions=Element.getDimensions(_30e); |
|---|
| 2898 |
this.restOffset=Position.cumulativeOffset(_30e); |
|---|
| 2899 |
this.scroll=Position.realOffset(this.element)[1]-(document.documentElement.scrollTop||document.body.scrollTop); |
|---|
| 2900 |
} |
|---|
| 2901 |
} |
|---|
| 2902 |
} |
|---|
| 2903 |
},draw:function(_30f){ |
|---|
| 2904 |
Event.stop(_30f); |
|---|
| 2905 |
var _310=[Event.pointerX(_30f),Event.pointerY(_30f)]; |
|---|
| 2906 |
var _311=this.element.style; |
|---|
| 2907 |
if(this.currentDirection.indexOf("n")!=-1){ |
|---|
| 2908 |
if(this.restOffset[1]-this.scroll>=_310[1]){ |
|---|
| 2909 |
return; |
|---|
| 2910 |
} |
|---|
| 2911 |
var _312=this.startY-_310[1]; |
|---|
| 2912 |
var _313=this.map(this.startHeight+_312); |
|---|
| 2913 |
if(_313>this.options.minHeight){ |
|---|
| 2914 |
_311.height=(_313-4)+"px"; |
|---|
| 2915 |
_311.top=this.map(this.startTop-_312)+"px"; |
|---|
| 2916 |
} |
|---|
| 2917 |
} |
|---|
| 2918 |
if(this.currentDirection.indexOf("w")!=-1){ |
|---|
| 2919 |
var _312=this.map(this.startX-_310[0]); |
|---|
| 2920 |
var _314=Element.getStyle(this.element,"margin-left")||"0"; |
|---|
| 2921 |
var _315=this.startWidth+_312; |
|---|
| 2922 |
if(_315>this.options.minWidth){ |
|---|
| 2923 |
_311.left=(this.startLeft-_312-parseInt(_314))+"px"; |
|---|
| 2924 |
_311.width=_315+"px"; |
|---|
| 2925 |
} |
|---|
| 2926 |
} |
|---|
| 2927 |
if(this.currentDirection.indexOf("s")!=-1){ |
|---|
| 2928 |
var _316=this.restDimensions.height+this.restOffset[1]; |
|---|
| 2929 |
var _312=_310[1]-this.startY; |
|---|
| 2930 |
if(_316-this.scroll<=_310[1]){ |
|---|
| 2931 |
return; |
|---|
| 2932 |
} |
|---|
| 2933 |
var _313=this.map(this.startHeight+_310[1]-this.startY); |
|---|
| 2934 |
if(_313>this.options.minHeight){ |
|---|
| 2935 |
_311.height=(_313-4)+"px"; |
|---|
| 2936 |
} |
|---|
| 2937 |
} |
|---|
| 2938 |
if(this.currentDirection.indexOf("e")!=-1){ |
|---|
| 2939 |
var _315=this.map(this.startWidth+_310[0]-this.startX); |
|---|
| 2940 |
if(_315>this.options.minWidth){ |
|---|
| 2941 |
_311.width=_315+"px"; |
|---|
| 2942 |
} |
|---|
| 2943 |
} |
|---|
| 2944 |
if(_311.visibility=="hidden"){ |
|---|
| 2945 |
_311.visibility=""; |
|---|
| 2946 |
} |
|---|
| 2947 |
this.options.change(this.element); |
|---|
| 2948 |
},directions:function(_317){ |
|---|
| 2949 |
var _318=[Event.pointerX(_317),Event.pointerY(_317)]; |
|---|
| 2950 |
var _319=Position.cumulativeOffset(this.element); |
|---|
| 2951 |
var _31a=document.documentElement.scrollTop||document.body.scrollTop; |
|---|
| 2952 |
var _31b=Position.realOffset(this.element)[1]-_31a; |
|---|
| 2953 |
var _31c=""; |
|---|
| 2954 |
if(this.between(_318[1]-_319[1]+_31b,0,this.options.top)){ |
|---|
| 2955 |
_31c+="n"; |
|---|
| 2956 |
} |
|---|
| 2957 |
if(this.between((_319[1]+this.element.offsetHeight)-_318[1]-_31b,0,this.options.bottom)){ |
|---|
| 2958 |
_31c+="s"; |
|---|
| 2959 |
} |
|---|
| 2960 |
if(this.between(_318[0]-_319[0],0,this.options.left)){ |
|---|
| 2961 |
_31c+="w"; |
|---|
| 2962 |
} |
|---|
| 2963 |
if(this.between((_319[0]+this.element.offsetWidth)-_318[0],0,this.options.right)){ |
|---|
| 2964 |
_31c+="e"; |
|---|
| 2965 |
} |
|---|
| 2966 |
return _31c; |
|---|
| 2967 |
},map:function(_31d){ |
|---|
| 2968 |
return Math.round(_31d/this.options.distance)*this.options.distance; |
|---|
| 2969 |
}}); |
|---|
| 2970 |
|
|---|
| 2971 |
var ColorPicker=Class.create(); |
|---|
| 2972 |
ColorPicker.className={}; |
|---|
| 2973 |
ColorPicker.prototype={initialize:function(_1){ |
|---|
| 2974 |
this.element=$(_1); |
|---|
| 2975 |
Element.setStyle(this.element,{position:"absolute"}); |
|---|
| 2976 |
this.hide(); |
|---|
| 2977 |
this.element.innerHTML=this.build(); |
|---|
| 2978 |
this.setEvent(); |
|---|
| 2979 |
this.doclistener=this.hide.bindAsEventListener(this); |
|---|
| 2980 |
if(!UserAgent.isIE()){ |
|---|
| 2981 |
Element.setStyle(this.element,{width:15*18+"px",height:15*12+"px"}); |
|---|
| 2982 |
} |
|---|
| 2983 |
Element.setStyle(this.element,{border:"3px solid gray"}); |
|---|
| 2984 |
this.setting=$H({}); |
|---|
| 2985 |
this.triggerId=null; |
|---|
| 2986 |
},set:function(_2){ |
|---|
| 2987 |
var _3=$(_2.trigger); |
|---|
| 2988 |
this.setting[_3.id]=_2; |
|---|
| 2989 |
Event.observe(_3,"click",this.show.bindAsEventListener(this,_3.id)); |
|---|
| 2990 |
},build:function(){ |
|---|
| 2991 |
var _4=[0,0,0]; |
|---|
| 2992 |
var _5=null; |
|---|
| 2993 |
var id=null; |
|---|
| 2994 |
var _7=this.element.id; |
|---|
| 2995 |
var _8="<div style='cursor: pointer;'>"; |
|---|
| 2996 |
var _9=51*3; |
|---|
| 2997 |
this.idList=[]; |
|---|
| 2998 |
for(var i=0;i<=255;i+=51){ |
|---|
| 2999 |
if(i==_9){ |
|---|
| 3000 |
_8+="<div style='clear: left;'></div>"; |
|---|
| 3001 |
} |
|---|
| 3002 |
for(var j=0;j<=255;j+=51){ |
|---|
| 3003 |
_8+="<div style='float: left; width: 15px;'>"; |
|---|
| 3004 |
for(var k=0;k<=255;k+=51){ |
|---|
| 3005 |
_5="#"+i.toColorPart()+j.toColorPart()+k.toColorPart(); |
|---|
| 3006 |
id=_7.appendSuffix(_5); |
|---|
| 3007 |
this.idList.push(id); |
|---|
| 3008 |
_8+="<div id='"+id+"' style='width: 100%; height: 15px; background-color: "+_5+"'></div>"; |
|---|
| 3009 |
} |
|---|
| 3010 |
_8+="</div>"; |
|---|
| 3011 |
} |
|---|
| 3012 |
} |
|---|
| 3013 |
return _8+"</div>"; |
|---|
| 3014 |
},setEvent:function(){ |
|---|
| 3015 |
this.idList.each(function(id){ |
|---|
| 3016 |
Event.observe(id,"mousedown",this.mouseDown.bind(this,id)); |
|---|
| 3017 |
}.bind(this)); |
|---|
| 3018 |
},mouseOver:function(id){ |
|---|
| 3019 |
this.setColor(id.getSuffix()); |
|---|
| 3020 |
},mouseDown:function(id){ |
|---|
| 3021 |
this.setValue(id.getSuffix()); |
|---|
| 3022 |
this.setColor(id.getSuffix()); |
|---|
| 3023 |
},setValue:function(_10){ |
|---|
| 3024 |
var _11=$(this.setting[this.triggerId].value); |
|---|
| 3025 |
if(_11){ |
|---|
| 3026 |
if(_11.tagName.toLowerCase()=="input"){ |
|---|
| 3027 |
_11.value=_10; |
|---|
| 3028 |
}else{ |
|---|
| 3029 |
_11.innerHTML=_10; |
|---|
| 3030 |
} |
|---|
| 3031 |
} |
|---|
| 3032 |
},setColor:function(_12){ |
|---|
| 3033 |
var _13=$(this.setting[this.triggerId].color); |
|---|
| 3034 |
if(_13){ |
|---|
| 3035 |
Element.setStyle(_13,{backgroundColor:_12}); |
|---|
| 3036 |
} |
|---|
| 3037 |
},show:function(_14,_15){ |
|---|
| 3038 |
this.triggerId=_15; |
|---|
| 3039 |
Element.setStyle(this.element,{zIndex:ZindexManager.getIndex(),left:Event.pointerX(_14)+"px",top:Event.pointerY(_14)+"px"}); |
|---|
| 3040 |
this.element.show(); |
|---|
| 3041 |
Event.observe(document,"click",this.doclistener); |
|---|
| 3042 |
if(_14){ |
|---|
| 3043 |
Event.stop(_14); |
|---|
| 3044 |
} |
|---|
| 3045 |
},hide:function(){ |
|---|
| 3046 |
this.triggerId=null; |
|---|
| 3047 |
Event.stopObserving(document,"click",this.doclistener); |
|---|
| 3048 |
this.element.hide(); |
|---|
| 3049 |
}}; |
|---|
| 3050 |
|
|---|
| 3051 |
var DatePicker=Class.create(); |
|---|
| 3052 |
DatePicker.className={container:"datepicker",header:"datepicker_header",footer:"datepicker_footer",preYears:"datepicker_preYears",nextYears:"datepicker_nextYears",years:"datepicker_years",calendar:"datepicker_calendar",date:"datepicker_date",holiday:"datepicker_holiday",ym:"datepicker_ym",table:"datepicker_table",tableTh:"datepicker_tableTh",nextMonthMark:"datepicker_nextMonthMark",nextYearMark:"datepicker_nextYearMark",preMonthMark:"datepicker_preMonthMark",preYearMark:"datepicker_preYearMark",today:"datepicker_today",zIndex:null}; |
|---|
| 3053 |
DatePicker.prototype={initialize:function(_1,_2,_3){ |
|---|
| 3054 |
this.element=$(_1); |
|---|
| 3055 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 3056 |
this.target=$(_2); |
|---|
| 3057 |
this.options=Object.extend({date:new Date(),regularHoliday:[0,6],format:DateUtil.toLocaleDateString,cssPrefix:"custom_",callBack:Prototype.emptyFunction,standBy:false,headerFormat:null,dayOfWeek:DateUtil.dayOfWeek,appendToBody:false,invalidDates:[]},arguments[3]||{}); |
|---|
| 3058 |
this.css=CssUtil.getInstance(this.options.cssPrefix,DatePicker.className); |
|---|
| 3059 |
this.classNames=this.css.allJoinClassNames(); |
|---|
| 3060 |
this.format=this.options.format; |
|---|
| 3061 |
this.callBack=Prototype.emptyFunction; |
|---|
| 3062 |
if(this.options.date){ |
|---|
| 3063 |
if(this.options.date.constructor==Date){ |
|---|
| 3064 |
this.date=this.options.date; |
|---|
| 3065 |
}else{ |
|---|
| 3066 |
this.date=DateUtil.toDate(this.options.date); |
|---|
| 3067 |
} |
|---|
| 3068 |
}else{ |
|---|
| 3069 |
this.date=new Date(); |
|---|
| 3070 |
} |
|---|
| 3071 |
this.originalDate=new Date(this.date.getTime()); |
|---|
| 3072 |
this.ids={}; |
|---|
| 3073 |
this.dateIds=[]; |
|---|
| 3074 |
this.element.innerHTML=this.build(); |
|---|
| 3075 |
this.cover=new IECover(this.element); |
|---|
| 3076 |
this.setEvent(); |
|---|
| 3077 |
this.doclistener=this.hide.bindAsEventListener(this); |
|---|
| 3078 |
this.hide(); |
|---|
| 3079 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 3080 |
this.triggerSet={}; |
|---|
| 3081 |
if(_3&&_2){ |
|---|
| 3082 |
this.set(_3,_2,this.options.callBack); |
|---|
| 3083 |
} |
|---|
| 3084 |
if(this.options.appendToBody){ |
|---|
| 3085 |
Element.appendToBody.callAfterLoading(this,this.element); |
|---|
| 3086 |
} |
|---|
| 3087 |
},set:function(_4,_5,_6){ |
|---|
| 3088 |
_4=$(_4); |
|---|
| 3089 |
_6=_6||{}; |
|---|
| 3090 |
if(_6.constructor==Function){ |
|---|
| 3091 |
_6={callBack:_6}; |
|---|
| 3092 |
} |
|---|
| 3093 |
_6=$H({callBack:Prototype.emptyFunction,invalidDates:[]}).merge(_6); |
|---|
| 3094 |
if(_6.invalidDates.constructor!=Array){ |
|---|
| 3095 |
_6.invalidDates=[_6.invalidDates]; |
|---|
| 3096 |
} |
|---|
| 3097 |
this.triggerSet[_4.id]={target:$(_5),options:_6}; |
|---|
| 3098 |
this.addTrigger(_4); |
|---|
| 3099 |
},setEvent:function(){ |
|---|
| 3100 |
var _7=$(this.ids.preMonth); |
|---|
| 3101 |
if(!Event.observers||!Event.observers.any(function(_8){ |
|---|
| 3102 |
return _7==_8.first(); |
|---|
| 3103 |
})){ |
|---|
| 3104 |
Event.observe(this.ids.preMonth,"click",this.changeCalendar.bindAsEventListener(this)); |
|---|
| 3105 |
Event.observe(this.ids.preYear,"click",this.changeCalendar.bindAsEventListener(this)); |
|---|
| 3106 |
Event.observe(this.ids.nextMonth,"click",this.changeCalendar.bindAsEventListener(this)); |
|---|
| 3107 |
Event.observe(this.ids.nextYear,"click",this.changeCalendar.bindAsEventListener(this)); |
|---|
| 3108 |
new Hover(this.ids.preMonth); |
|---|
| 3109 |
new Hover(this.ids.preYear); |
|---|
| 3110 |
new Hover(this.ids.nextMonth); |
|---|
| 3111 |
new Hover(this.ids.nextYear); |
|---|
| 3112 |
this.hovers={}; |
|---|
| 3113 |
this.dateIds.each(function(id){ |
|---|
| 3114 |
this.hovers[id]=new Hover(id,{beforeToggle:this.hasDate.bind(this,id)}); |
|---|
| 3115 |
Event.observe(id,"click",this.selectDate.bindAsEventListener(this)); |
|---|
| 3116 |
}.bind(this)); |
|---|
| 3117 |
} |
|---|
| 3118 |
},build:function(){ |
|---|
| 3119 |
this.ids.calendar=this.element.id.appendSuffix("calendar"); |
|---|
| 3120 |
var _a="<div id='"+this.ids.calendar+"' class='"+this.classNames["container"]+"'>"+this.buildHeader()+this.buildCalendar()+this.buildFooter()+"</div>"; |
|---|
| 3121 |
return _a; |
|---|
| 3122 |
},buildHeader:function(){ |
|---|
| 3123 |
var _b="<table class='"+this.classNames["header"]+"'>"+"<tr>"+this.buildHeaderLeft()+this.buildHeaderCenter()+this.buildHeaderRight()+"</tr>"+"</table>"; |
|---|
| 3124 |
return _b; |
|---|
| 3125 |
},buildFooter:function(){ |
|---|
| 3126 |
return "<div class='"+this.classNames["footer"]+"'></div>"; |
|---|
| 3127 |
},buildHeaderLeft:function(){ |
|---|
| 3128 |
this.ids.preYear=this.element.id.appendSuffix("preYear"); |
|---|
| 3129 |
this.ids.preMonth=this.element.id.appendSuffix("preMonth"); |
|---|
| 3130 |
var _c="<td class='"+this.classNames["preYears"]+"'>"+"<div id='"+this.ids.preYear+"' class='"+this.classNames["preYearMark"]+"'></div>"+"<div id='"+this.ids.preMonth+"' class='"+this.classNames["preMonthMark"]+"'></div>"+"</td>"; |
|---|
| 3131 |
return _c; |
|---|
| 3132 |
},buildHeaderCenter:function(){ |
|---|
| 3133 |
var _d=this.getHeaderYearMonth(); |
|---|
| 3134 |
var _e=this.element.id; |
|---|
| 3135 |
var _f="<td class='"+this.classNames["years"]+"'>"+"<span id='"+_e.appendSuffix("ym0")+"'class='"+this.classNames["ym"]+"'>"+_d[0]+"</span>"+"<span id='"+_e.appendSuffix("ym1")+"' class='"+this.classNames["ym"]+"'>"+_d[1]+"</span>"+"</td>"; |
|---|
| 3136 |
return _f; |
|---|
| 3137 |
},getHeaderYearMonth:function(){ |
|---|
| 3138 |
if(this.options.headerFormat){ |
|---|
| 3139 |
var _10=new Template(this.options.headerFormat); |
|---|
| 3140 |
return [_10.evaluate({year:this.date.getFullYear(),month:this.date.getMonth()+1})," "]; |
|---|
| 3141 |
} |
|---|
| 3142 |
return [DateUtil.months[this.date.getMonth()],this.date.getFullYear()]; |
|---|
| 3143 |
},buildHeaderRight:function(){ |
|---|
| 3144 |
this.ids.nextYear=this.element.id.appendSuffix("nextYear"); |
|---|
| 3145 |
this.ids.nextMonth=this.element.id.appendSuffix("nextMonth"); |
|---|
| 3146 |
var _11="<td class='"+this.classNames["nextYears"]+"'>"+"<div id='"+this.ids.nextMonth+"' class='"+this.classNames["nextMonthMark"]+"'></div>"+"<div id='"+this.ids.nextYear+"' class='"+this.classNames["nextYearMark"]+"'></div>"+"</td>"; |
|---|
| 3147 |
return _11; |
|---|
| 3148 |
},multiBuild:function(_12,_13,_14,_15,_16){ |
|---|
| 3149 |
var _17=[]; |
|---|
| 3150 |
for(var i=0;i<_13.length;i++){ |
|---|
| 3151 |
var _19=Builder.node(_12,[_13[i]]); |
|---|
| 3152 |
if(_14){ |
|---|
| 3153 |
this.classNames.addClassNames(_19,_14); |
|---|
| 3154 |
} |
|---|
| 3155 |
if(_15){ |
|---|
| 3156 |
new Hover(_19); |
|---|
| 3157 |
} |
|---|
| 3158 |
if(_16){ |
|---|
| 3159 |
Event.observe(_19,"click",_16.bindAsEventListener(this)); |
|---|
| 3160 |
} |
|---|
| 3161 |
_17.push(_19); |
|---|
| 3162 |
} |
|---|
| 3163 |
return _17; |
|---|
| 3164 |
},buildCalendar:function(){ |
|---|
| 3165 |
var _1a="<div class='"+this.classNames["calendar"]+"'>"+"<table class='"+this.classNames["table"]+"' id='"+this.element.id.appendSuffix("dates")+"'>"+this.buildTableHeader()+this.buildTableData()+"</table>"+"</div>"; |
|---|
| 3166 |
return _1a; |
|---|
| 3167 |
},buildTableHeader:function(){ |
|---|
| 3168 |
var _1b=this.classNames["tableTh"]; |
|---|
| 3169 |
var _1c="<tr>"; |
|---|
| 3170 |
for(var i=0;i<DateUtil.dayOfWeek.length;i++){ |
|---|
| 3171 |
_1c+="<th class='"+_1b+"'>"+this.options.dayOfWeek[i]+"</th>"; |
|---|
| 3172 |
} |
|---|
| 3173 |
_1c+="</tr>"; |
|---|
| 3174 |
return _1c; |
|---|
| 3175 |
},buildTableData:function(){ |
|---|
| 3176 |
var _1e=DateUtil.dayOfWeek.length*6; |
|---|
| 3177 |
var _1f=this.date.getFullYear(); |
|---|
| 3178 |
var _20=this.date.getMonth(); |
|---|
| 3179 |
var _21=DateUtil.getFirstDate(_1f,_20).getDay(); |
|---|
| 3180 |
var _22=DateUtil.getLastDate(_1f,_20).getDate(); |
|---|
| 3181 |
var _23=this.element.id.appendSuffix("date"); |
|---|
| 3182 |
var _24=new Date(); |
|---|
| 3183 |
var _25=_24.sameMonth(this.date); |
|---|
| 3184 |
var trs=""; |
|---|
| 3185 |
var tds=""; |
|---|
| 3186 |
for(var i=0,day=1;i<_1e;i++){ |
|---|
| 3187 |
var id=_23.appendSuffix(i); |
|---|
| 3188 |
this.dateIds.push(id); |
|---|
| 3189 |
var _2b=this.options.regularHoliday.include(i%7)?"holiday":"date"; |
|---|
| 3190 |
var _2c=this.classNames[_2b]; |
|---|
| 3191 |
if((i<_21)||day>_22){ |
|---|
| 3192 |
tds+="<td id='"+id+"' class='"+_2c+"'></td>"; |
|---|
| 3193 |
}else{ |
|---|
| 3194 |
if(_25&&(_24.getDate()==day)){ |
|---|
| 3195 |
_2c=this.classNames["today"]+" "+_2c; |
|---|
| 3196 |
this.todayCell=id; |
|---|
| 3197 |
} |
|---|
| 3198 |
tds+="<td id='"+id+"' class='"+_2c+"'>"+day+"</td>"; |
|---|
| 3199 |
day++; |
|---|
| 3200 |
} |
|---|
| 3201 |
if((i+1)%7==0){ |
|---|
| 3202 |
trs+="<tr>"+tds+"</tr>"; |
|---|
| 3203 |
tds=""; |
|---|
| 3204 |
} |
|---|
| 3205 |
} |
|---|
| 3206 |
return trs; |
|---|
| 3207 |
},rebuildHeaderCenter:function(){ |
|---|
| 3208 |
var _2d=this.getHeaderYearMonth(); |
|---|
| 3209 |
var _2e=this.element.id; |
|---|
| 3210 |
$(_2e.appendSuffix("ym0")).innerHTML=_2d[0]; |
|---|
| 3211 |
$(_2e.appendSuffix("ym1")).innerHTML=_2d[1]; |
|---|
| 3212 |
},rebuildTableData:function(){ |
|---|
| 3213 |
var _2f=DateUtil.dayOfWeek.length*6; |
|---|
| 3214 |
var _30=this.date.getFullYear(); |
|---|
| 3215 |
var _31=this.date.getMonth(); |
|---|
| 3216 |
var _32=DateUtil.getFirstDate(_30,_31).getDay(); |
|---|
| 3217 |
var _33=DateUtil.getLastDate(_30,_31).getDate(); |
|---|
| 3218 |
var _34=this.element.id.appendSuffix("date"); |
|---|
| 3219 |
var _35=new Date(); |
|---|
| 3220 |
var _36=_35.sameMonth(this.date); |
|---|
| 3221 |
this.todayClassToNormalClass(); |
|---|
| 3222 |
for(var i=0,day=1;i<_2f;i++){ |
|---|
| 3223 |
var id=_34.appendSuffix(i); |
|---|
| 3224 |
var _3a=$(id); |
|---|
| 3225 |
if((i<_32)||(day>_33)){ |
|---|
| 3226 |
_3a.innerHTML=""; |
|---|
| 3227 |
}else{ |
|---|
| 3228 |
_3a.innerHTML=day; |
|---|
| 3229 |
if(_36&&(_35.getDate()==day)){ |
|---|
| 3230 |
_3a.className=this.classNames["today"]+" "+_3a.className; |
|---|
| 3231 |
this.todayCell=id; |
|---|
| 3232 |
this.hovers[id].resetClasses(); |
|---|
| 3233 |
} |
|---|
| 3234 |
day++; |
|---|
| 3235 |
} |
|---|
| 3236 |
} |
|---|
| 3237 |
},todayClassToNormalClass:function(){ |
|---|
| 3238 |
var _3b=this.classNames["today"].split(" "); |
|---|
| 3239 |
var _3c=$(this.todayCell); |
|---|
| 3240 |
if(_3c){ |
|---|
| 3241 |
_3c.className=_3c.className.split(" ").select(function(_3d){ |
|---|
| 3242 |
return !_3b.include(_3d); |
|---|
| 3243 |
}).join(" "); |
|---|
| 3244 |
this.hovers[this.todayCell].resetClasses(); |
|---|
| 3245 |
} |
|---|
| 3246 |
this.todayCell=null; |
|---|
| 3247 |
},refresh:function(){ |
|---|
| 3248 |
this.rebuildHeaderCenter(); |
|---|
| 3249 |
this.rebuildTableData(); |
|---|
| 3250 |
},getMonth:function(){ |
|---|
| 3251 |
return DateUtil.months[this.date.getMonth()]; |
|---|
| 3252 |
},changeCalendar:function(_3e){ |
|---|
| 3253 |
var _3f=Event.element(_3e); |
|---|
| 3254 |
this.date.setDate(1); |
|---|
| 3255 |
if(this.hasClassName(_3f,DatePicker.className.preYearMark)){ |
|---|
| 3256 |
this.date.setFullYear(this.date.getFullYear()-1); |
|---|
| 3257 |
}else{ |
|---|
| 3258 |
if(this.hasClassName(_3f,DatePicker.className.nextYearMark)){ |
|---|
| 3259 |
this.date.setFullYear(this.date.getFullYear()+1); |
|---|
| 3260 |
}else{ |
|---|
| 3261 |
if(this.hasClassName(_3f,DatePicker.className.preMonthMark)){ |
|---|
| 3262 |
this.date.setMonth(this.date.getMonth()-1); |
|---|
| 3263 |
}else{ |
|---|
| 3264 |
if(this.hasClassName(_3f,DatePicker.className.nextMonthMark)){ |
|---|
| 3265 |
this.date.setMonth(this.date.getMonth()+1); |
|---|
| 3266 |
} |
|---|
| 3267 |
} |
|---|
| 3268 |
} |
|---|
| 3269 |
} |
|---|
| 3270 |
this.refresh(); |
|---|
| 3271 |
if(_3e){ |
|---|
| 3272 |
Event.stop(_3e); |
|---|
| 3273 |
} |
|---|
| 3274 |
},hasClassName:function(_40,_41){ |
|---|
| 3275 |
return Element.hasClassName(_40,_41)||Element.hasClassName(_40,_41+"Hover"); |
|---|
| 3276 |
},selectDate:function(_42){ |
|---|
| 3277 |
var src=Event.element(_42); |
|---|
| 3278 |
var _44=Element.getTextNodes(src)[0]; |
|---|
| 3279 |
if(_44){ |
|---|
| 3280 |
this.date.setDate(_44.nodeValue); |
|---|
| 3281 |
var _45=this.formatDateString(); |
|---|
| 3282 |
if(this.target.value||this.target.value==""){ |
|---|
| 3283 |
this.target.value=_45; |
|---|
| 3284 |
}else{ |
|---|
| 3285 |
this.target.innerHTML=_45; |
|---|
| 3286 |
} |
|---|
| 3287 |
var _46=this.hovers[src.id]; |
|---|
| 3288 |
if(_46){ |
|---|
| 3289 |
src.className=_46.normal; |
|---|
| 3290 |
} |
|---|
| 3291 |
this.hide(); |
|---|
| 3292 |
this.callBack(this); |
|---|
| 3293 |
} |
|---|
| 3294 |
},show:function(_47){ |
|---|
| 3295 |
if(_47){ |
|---|
| 3296 |
Event.stop(_47); |
|---|
| 3297 |
var set=this.triggerSet[Event.element(_47).id]; |
|---|
| 3298 |
if(set){ |
|---|
| 3299 |
this.target=set.target; |
|---|
| 3300 |
this.options=$H(this.options).merge(set.options); |
|---|
| 3301 |
this.callBack=this.options.callBack; |
|---|
| 3302 |
} |
|---|
| 3303 |
if(this.options.invalidDates.include(this.target.value)){ |
|---|
| 3304 |
this.date=new Date(this.originalDate.getTime()); |
|---|
| 3305 |
}else{ |
|---|
| 3306 |
var _49=Date.parse(this.target.value); |
|---|
| 3307 |
if(_49){ |
|---|
| 3308 |
this.date=new Date(_49); |
|---|
| 3309 |
}else{ |
|---|
| 3310 |
this.date=new Date(this.originalDate.getTime()); |
|---|
| 3311 |
} |
|---|
| 3312 |
} |
|---|
| 3313 |
} |
|---|
| 3314 |
var _4a=$H({zIndex:ZindexManager.getIndex(this.options.zIndex)}); |
|---|
| 3315 |
if(this.options.standBy){ |
|---|
| 3316 |
this.defaultParent=this.element.parentNode; |
|---|
| 3317 |
document.body.appendChild(this.element); |
|---|
| 3318 |
_4a=_4a.merge({position:"absolute",left:Event.pointerX(_47)+"px",top:Event.pointerY(_47)+"px"}); |
|---|
| 3319 |
} |
|---|
| 3320 |
Element.setStyle(this.element,_4a); |
|---|
| 3321 |
Element.show(this.element); |
|---|
| 3322 |
this.cover.resetSize(); |
|---|
| 3323 |
Event.observe(document,"click",this.doclistener); |
|---|
| 3324 |
this.refresh(); |
|---|
| 3325 |
},hide:function(){ |
|---|
| 3326 |
Event.stopObserving(document,"click",this.doclistener); |
|---|
| 3327 |
Element.hide(this.element); |
|---|
| 3328 |
if(this.defaultParent){ |
|---|
| 3329 |
this.defaultParent.appendChild(this.element); |
|---|
| 3330 |
} |
|---|
| 3331 |
},addTrigger:function(_4b){ |
|---|
| 3332 |
Event.observe($(_4b),"click",this.show.bindAsEventListener(this)); |
|---|
| 3333 |
},changeTarget:function(_4c){ |
|---|
| 3334 |
this.target=$(_4c); |
|---|
| 3335 |
},formatDateString:function(){ |
|---|
| 3336 |
var _4d=""; |
|---|
| 3337 |
if(this.format.constructor==Function){ |
|---|
| 3338 |
_4d=this.format(this.date); |
|---|
| 3339 |
}else{ |
|---|
| 3340 |
if(this.format.constructor==String){ |
|---|
| 3341 |
_4d=this.date.strftime(this.format); |
|---|
| 3342 |
} |
|---|
| 3343 |
} |
|---|
| 3344 |
return _4d; |
|---|
| 3345 |
},hasDate:function(_4e){ |
|---|
| 3346 |
var _4f=$(_4e).innerHTML; |
|---|
| 3347 |
return _4f&&(_4f!=""); |
|---|
| 3348 |
},refreshRegularHoliday:function(_50){ |
|---|
| 3349 |
this.options.regularHoliday=_50; |
|---|
| 3350 |
this.css=CssUtil.getInstance(this.options.cssPrefix,DatePicker.className); |
|---|
| 3351 |
this.classNames=this.css.allJoinClassNames(); |
|---|
| 3352 |
$A($(this.element.id.appendSuffix("dates")).rows).each(function(row,i){ |
|---|
| 3353 |
if(i==0){ |
|---|
| 3354 |
throw $continue; |
|---|
| 3355 |
} |
|---|
| 3356 |
$A(row.cells).each(function(_53,j){ |
|---|
| 3357 |
var _55=this.options.regularHoliday.include(j%7)?"holiday":"date"; |
|---|
| 3358 |
_53.className=this.classNames[_55]; |
|---|
| 3359 |
}.bind(this)); |
|---|
| 3360 |
}.bind(this)); |
|---|
| 3361 |
$H(this.hovers).each(function(_56){ |
|---|
| 3362 |
_56.value.resetClasses(); |
|---|
| 3363 |
}); |
|---|
| 3364 |
}}; |
|---|
| 3365 |
|
|---|
| 3366 |
InPlaceEditorEx=Class.create(); |
|---|
| 3367 |
Object.extend(Object.extend(InPlaceEditorEx.prototype,Ajax.InPlaceEditor.prototype),{initialize:function(_1,_2){ |
|---|
| 3368 |
this.element=$(_1); |
|---|
| 3369 |
this.options=Object.extend({okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(_3,_4){ |
|---|
| 3370 |
new Effect.Highlight(_4,{startcolor:this.options.highlightcolor}); |
|---|
| 3371 |
},onFailure:function(_5){ |
|---|
| 3372 |
alert("Error communicating with the server: "+_5.responseText.stripTags()); |
|---|
| 3373 |
},callback:function(_6){ |
|---|
| 3374 |
return Form.serialize(_6); |
|---|
| 3375 |
},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},_2||{}); |
|---|
| 3376 |
if(!this.options.formId&&this.element.id){ |
|---|
| 3377 |
this.options.formId=this.element.id+"-inplaceeditor"; |
|---|
| 3378 |
if($(this.options.formId)){ |
|---|
| 3379 |
this.options.formId=null; |
|---|
| 3380 |
} |
|---|
| 3381 |
} |
|---|
| 3382 |
if(this.options.externalControl){ |
|---|
| 3383 |
this.options.externalControl=$(this.options.externalControl); |
|---|
| 3384 |
} |
|---|
| 3385 |
this.originalBackground=Element.getStyle(this.element,"background-color"); |
|---|
| 3386 |
if(!this.originalBackground){ |
|---|
| 3387 |
this.originalBackground="transparent"; |
|---|
| 3388 |
} |
|---|
| 3389 |
this.element.title=this.options.clickToEditText; |
|---|
| 3390 |
this.ondblclickListener=this.enterEditMode.bindAsEventListener(this); |
|---|
| 3391 |
this.mouseoverListener=this.enterHover.bindAsEventListener(this); |
|---|
| 3392 |
this.mouseoutListener=this.leaveHover.bindAsEventListener(this); |
|---|
| 3393 |
Event.observe(this.element,"dblclick",this.ondblclickListener); |
|---|
| 3394 |
Event.observe(this.element,"mouseover",this.mouseoverListener); |
|---|
| 3395 |
Event.observe(this.element,"mouseout",this.mouseoutListener); |
|---|
| 3396 |
if(this.options.externalControl){ |
|---|
| 3397 |
Event.observe(this.options.externalControl,"dblclick",this.ondblclickListener); |
|---|
| 3398 |
Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener); |
|---|
| 3399 |
Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener); |
|---|
| 3400 |
} |
|---|
| 3401 |
},getText:function(){ |
|---|
| 3402 |
return this.element.innerHTML.unescapeHTML(); |
|---|
| 3403 |
},onSubmit:function(){ |
|---|
| 3404 |
var _7=this.editField.value.escapeHTML(); |
|---|
| 3405 |
if(_7==""){ |
|---|
| 3406 |
this.onclickCancel(); |
|---|
| 3407 |
return false; |
|---|
| 3408 |
}else{ |
|---|
| 3409 |
this.onLoading(); |
|---|
| 3410 |
this.element.innerHTML=_7; |
|---|
| 3411 |
new InPlaceEditorEx(this.element.id,this.options); |
|---|
| 3412 |
return true; |
|---|
| 3413 |
} |
|---|
| 3414 |
},removeForm:function(){ |
|---|
| 3415 |
if(this.form){ |
|---|
| 3416 |
if(this.form.parentNode){ |
|---|
| 3417 |
var _8=this.form.parentNode.childNodes; |
|---|
| 3418 |
for(var i=0;i<_8.length;i++){ |
|---|
| 3419 |
_8[i].data=""; |
|---|
| 3420 |
} |
|---|
| 3421 |
Element.remove(this.form); |
|---|
| 3422 |
} |
|---|
| 3423 |
this.form=null; |
|---|
| 3424 |
} |
|---|
| 3425 |
}}); |
|---|
| 3426 |
|
|---|
| 3427 |
var MenuBar=Class.create(); |
|---|
| 3428 |
MenuBar.cssNames={container:"menubar",menu:"menubar_menu",menuBody:"menubar_menuBody",menuBodyHover:"menubar_menuBodyHover",subMenu:"menubar_subMenu",subMenuBody:"menubar_subMenuBody",subMenuBodyHover:"menubar_subMenuBodyHover",subMenuContainer:"menubar_menuContainer",dirMark:"menubar_dirMark"}; |
|---|
| 3429 |
MenuBar.idSuffixes=["topContaier","menu","body"]; |
|---|
| 3430 |
MenuBar.mark={dir:">>"}; |
|---|
| 3431 |
MenuBar.prototype={initialize:function(_1){ |
|---|
| 3432 |
this.options=Object.extend({build:true,callbackClickMenu:Prototype.emptyFunction,cssPrefix:"custom_",hideOnClickSubmenu:true,beforeShow:Prototype.emptyFunction,afterShow:Prototype.emptyFunction,beforeHide:Prototype.emptyFunction,afterHide:Prototype.emptyFunction},arguments[1]||{}); |
|---|
| 3433 |
this.element=$(_1); |
|---|
| 3434 |
this.classNames=CssUtil.getInstance(this.options.cssPrefix,MenuBar.cssNames).allJoinClassNames(); |
|---|
| 3435 |
this.baseIds=SpinelzUtil.concat(this.element.id,MenuBar.idSuffixes); |
|---|
| 3436 |
this.menuIds=[]; |
|---|
| 3437 |
this.clicked=[]; |
|---|
| 3438 |
if(this.options.build){ |
|---|
| 3439 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 3440 |
Element.hide(this.element); |
|---|
| 3441 |
Element.update(this.element,this.build(this.element)); |
|---|
| 3442 |
} |
|---|
| 3443 |
this.menubar=$(this.baseIds.topContaier); |
|---|
| 3444 |
Event.observe(document,"click",this.hideAllTrigger(this.menubar).bindAsEventListener(this)); |
|---|
| 3445 |
if(this.options.build){ |
|---|
| 3446 |
this.setEvent(); |
|---|
| 3447 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 3448 |
Element.show(this.element); |
|---|
| 3449 |
} |
|---|
| 3450 |
},build:function(_2){ |
|---|
| 3451 |
var _3=$A(_2.childNodes).inject("",function(_4,_5){ |
|---|
| 3452 |
return _4+(Element.isElementNode(_5)?this.buildMenu(_5,"menu"):""); |
|---|
| 3453 |
}.bind(this)); |
|---|
| 3454 |
return "<div id='"+this.baseIds.topContaier+"'class='"+this.classNames["container"]+"'>"+_3+"</div>"; |
|---|
| 3455 |
},buildMenu:function(_6,_7){ |
|---|
| 3456 |
var _8=""; |
|---|
| 3457 |
var _9=""; |
|---|
| 3458 |
$A(_6.childNodes).each(function(_a){ |
|---|
| 3459 |
if(Element.isTextNode(_a)){ |
|---|
| 3460 |
_8+=_a.nodeValue; |
|---|
| 3461 |
}else{ |
|---|
| 3462 |
if(Element.isElementNode(_a)){ |
|---|
| 3463 |
if(Element.hasTagName(_a,"div")){ |
|---|
| 3464 |
_9+=this.buildMenu(_a,"subMenu"); |
|---|
| 3465 |
}else{ |
|---|
| 3466 |
_8+=Element.outerHTML(_a); |
|---|
| 3467 |
} |
|---|
| 3468 |
} |
|---|
| 3469 |
} |
|---|
| 3470 |
}.bind(this)); |
|---|
| 3471 |
var _b=""; |
|---|
| 3472 |
if(_9!=""){ |
|---|
| 3473 |
if(_7=="subMenu"){ |
|---|
| 3474 |
_b="<div class='"+this.classNames["dirMark"]+"'>"+MenuBar.mark.dir+"</div>"; |
|---|
| 3475 |
} |
|---|
| 3476 |
_9="<div style='visibility: hidden;' class='"+this.classNames["subMenuContainer"]+"'>"+_9+"</div>"; |
|---|
| 3477 |
} |
|---|
| 3478 |
var _c=SpinelzUtil.getId(this.baseIds.menu); |
|---|
| 3479 |
var _d=SpinelzUtil.getId(this.baseIds.body); |
|---|
| 3480 |
this.menuIds.push({menu:_c,body:_d}); |
|---|
| 3481 |
var _e="<div id='"+_c+"'class='"+this.classNames[_7]+"'>"+"<div id='"+_d+"' class='"+this.classNames[_7+"Body"]+"'>"+_8+_b+"</div>"+_9+"</div>"; |
|---|
| 3482 |
return _e; |
|---|
| 3483 |
},setEvent:function(){ |
|---|
| 3484 |
this.menuIds.each(function(_f){ |
|---|
| 3485 |
new Hover(_f.body); |
|---|
| 3486 |
Event.observe(_f.menu,"click",this.onClick.bindAsEventListener(this,$(_f.body))); |
|---|
| 3487 |
}.bind(this)); |
|---|
| 3488 |
},onClick:function(_10,_11){ |
|---|
| 3489 |
var _12=_11.parentNode; |
|---|
| 3490 |
var _13=this.getParentContainer(_12); |
|---|
| 3491 |
var _14=this.getContainer(_12); |
|---|
| 3492 |
var _15=MenuBar.cssNames.menu; |
|---|
| 3493 |
if(Element.hasClassName(_12,_15)){ |
|---|
| 3494 |
if(this.clicked.length>0){ |
|---|
| 3495 |
this.hideAll(this.menubar); |
|---|
| 3496 |
this.clicked=[]; |
|---|
| 3497 |
} |
|---|
| 3498 |
if(_14){ |
|---|
| 3499 |
this.showAtBottom(_14,_11); |
|---|
| 3500 |
} |
|---|
| 3501 |
}else{ |
|---|
| 3502 |
if(_14){ |
|---|
| 3503 |
var _16=this.clicked.pop(); |
|---|
| 3504 |
var _17=_16.parentNode; |
|---|
| 3505 |
var _18=this.getContainer(_17); |
|---|
| 3506 |
var _19=this.getParentContainer(_17); |
|---|
| 3507 |
if(_17==_12){ |
|---|
| 3508 |
this.hide(_14); |
|---|
| 3509 |
}else{ |
|---|
| 3510 |
if(Element.hasClassName(_18,MenuBar.cssNames.container)){ |
|---|
| 3511 |
this.clicked.push(last); |
|---|
| 3512 |
}else{ |
|---|
| 3513 |
if(_19==_13){ |
|---|
| 3514 |
this.hide(_18); |
|---|
| 3515 |
}else{ |
|---|
| 3516 |
this.clicked.push(_16); |
|---|
| 3517 |
} |
|---|
| 3518 |
} |
|---|
| 3519 |
} |
|---|
| 3520 |
this.showAtLeft(_14,_12); |
|---|
| 3521 |
}else{ |
|---|
| 3522 |
if(this.options.hideOnClickSubmenu){ |
|---|
| 3523 |
this.hideAll(this.menubar); |
|---|
| 3524 |
} |
|---|
| 3525 |
} |
|---|
| 3526 |
} |
|---|
| 3527 |
if(_14){ |
|---|
| 3528 |
this.clicked.push(_11); |
|---|
| 3529 |
} |
|---|
| 3530 |
this.options.callbackClickMenu(this); |
|---|
| 3531 |
Event.stop(_10); |
|---|
| 3532 |
},showAtBottom:function(_1a,_1b){ |
|---|
| 3533 |
var _1c=Position.positionedOffset(_1b); |
|---|
| 3534 |
var _1d=0; |
|---|
| 3535 |
if(_1b.style.height){ |
|---|
| 3536 |
_1d=Element.getHeight(_1b); |
|---|
| 3537 |
}else{ |
|---|
| 3538 |
_1d=_1b.clientHeight; |
|---|
| 3539 |
} |
|---|
| 3540 |
_1d+=_1c[1]; |
|---|
| 3541 |
_1d+=(UserAgent.isIE())?4:3; |
|---|
| 3542 |
_1a.style.top=_1d+"px"; |
|---|
| 3543 |
_1a.style.left=_1c[0]+"px"; |
|---|
| 3544 |
this.show(_1a); |
|---|
| 3545 |
},showAtLeft:function(_1e,_1f){ |
|---|
| 3546 |
var _20=Position.positionedOffset(_1f); |
|---|
| 3547 |
_1e.style.top=(_20[1]-1)+"px"; |
|---|
| 3548 |
_1e.style.left=(_20[0]+_1f.offsetWidth+2)+"px"; |
|---|
| 3549 |
this.show(_1e); |
|---|
| 3550 |
},hideAllTrigger:function(_21){ |
|---|
| 3551 |
return function(_22){ |
|---|
| 3552 |
if(!this.isMenuElement(Event.element(_22))){ |
|---|
| 3553 |
this.hideAll(_21); |
|---|
| 3554 |
} |
|---|
| 3555 |
}; |
|---|
| 3556 |
},hideAll:function(_23){ |
|---|
| 3557 |
var _24=_23.childNodes; |
|---|
| 3558 |
for(var i=0;i<_24.length;i++){ |
|---|
| 3559 |
if(_24[i].nodeType==1){ |
|---|
| 3560 |
if(Element.hasClassName(_24[i],MenuBar.cssNames.subMenuContainer)){ |
|---|
| 3561 |
this.hide(_24[i]); |
|---|
| 3562 |
} |
|---|
| 3563 |
this.hideAll(_24[i]); |
|---|
| 3564 |
} |
|---|
| 3565 |
} |
|---|
| 3566 |
},show:function(_26){ |
|---|
| 3567 |
this.options.beforeShow(_26); |
|---|
| 3568 |
_26.style.visibility="visible"; |
|---|
| 3569 |
this.options.afterShow(_26); |
|---|
| 3570 |
},hide:function(_27){ |
|---|
| 3571 |
this.options.beforeHide(_27); |
|---|
| 3572 |
_27.style.visibility="hidden"; |
|---|
| 3573 |
this.options.afterHide(_27); |
|---|
| 3574 |
},getContainer:function(_28){ |
|---|
| 3575 |
if(!_28){ |
|---|
| 3576 |
return; |
|---|
| 3577 |
} |
|---|
| 3578 |
return document.getElementsByClassName(MenuBar.cssNames.subMenuContainer,_28)[0]; |
|---|
| 3579 |
},getParentContainer:function(_29){ |
|---|
| 3580 |
var _2a=Element.getParentByClassName(MenuBar.cssNames.subMenuContainer,_29); |
|---|
| 3581 |
if(!_2a){ |
|---|
| 3582 |
_2a=Element.getParentByClassName(MenuBar.cssNames.container,_29); |
|---|
| 3583 |
} |
|---|
| 3584 |
return _2a; |
|---|
| 3585 |
},isMenuElement:function(_2b){ |
|---|
| 3586 |
return Element.hasClassName(_2b,MenuBar.cssNames.menuBodyHover)||Element.hasClassName(_2b,MenuBar.cssNames.subMenuBodyHover)||Element.hasClassName(_2b,MenuBar.cssNames.dirMark); |
|---|
| 3587 |
}}; |
|---|
| 3588 |
|
|---|
| 3589 |
NavPanel=Class.create(); |
|---|
| 3590 |
NavPanel.className={navPanel:"navPanel",panel:"navPanel_panel",tab:"navPanel_tab",tabLeftInactive:"navPanel_tabLeftInactive",tabLeftActive:"navPanel_tabLeftActive",tabMiddleInactive:"navPanel_tabMiddleInactive",tabMiddleActive:"navPanel_tabMiddleActive",tabRightInactive:"navPanel_tabRightInactive",tabRightActive:"navPanel_tabRightActive"}; |
|---|
| 3591 |
NavPanel.prototype={initialize:function(_1){ |
|---|
| 3592 |
var _2=Object.extend({selected:1,cssPrefix:"custom_"},arguments[1]||{}); |
|---|
| 3593 |
this.options=_2; |
|---|
| 3594 |
this.element=$(_1); |
|---|
| 3595 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 3596 |
Element.hide(this.element); |
|---|
| 3597 |
var _3=CssUtil.appendPrefix(this.options.cssPrefix,NavPanel.className); |
|---|
| 3598 |
this.classNames=new CssUtil([NavPanel.className,_3]); |
|---|
| 3599 |
this.classNames.addClassNames(this.element,"navPanel"); |
|---|
| 3600 |
this.selected=(this.options.selected>0)?this.options.selected-1:0; |
|---|
| 3601 |
this.start(); |
|---|
| 3602 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 3603 |
Element.show(this.element); |
|---|
| 3604 |
},start:function(){ |
|---|
| 3605 |
this.tabs=[]; |
|---|
| 3606 |
this.panels=[]; |
|---|
| 3607 |
this.panelList=[]; |
|---|
| 3608 |
this.tabId=this.element.id+"_tab"; |
|---|
| 3609 |
this.tabLeftId=this.tabId+"_left"; |
|---|
| 3610 |
this.tabMiddleId=this.tabId+"_middle"; |
|---|
| 3611 |
this.tabRightId=this.tabId+"_right"; |
|---|
| 3612 |
this.panelId=this.element.id+"_panel"; |
|---|
| 3613 |
this.build(); |
|---|
| 3614 |
},build:function(){ |
|---|
| 3615 |
Element.cleanWhitespace(this.element); |
|---|
| 3616 |
this.panelList=this.element.childNodes; |
|---|
| 3617 |
for(var i=0;i<this.panelList.length;i++){ |
|---|
| 3618 |
if(this.panelList[i].nodeType!=1){ |
|---|
| 3619 |
Element.remove(this.panelList[i]); |
|---|
| 3620 |
i--; |
|---|
| 3621 |
continue; |
|---|
| 3622 |
} |
|---|
| 3623 |
Element.cleanWhitespace(this.panelList[i]); |
|---|
| 3624 |
var _5=this.panelList[i].childNodes; |
|---|
| 3625 |
this.buildTab(_5[0],i); |
|---|
| 3626 |
this.buildPanel(_5[0],i); |
|---|
| 3627 |
} |
|---|
| 3628 |
this.selectTab(); |
|---|
| 3629 |
},buildTab:function(_6,i){ |
|---|
| 3630 |
var _8=Builder.node("div",{id:this.tabId+i}); |
|---|
| 3631 |
this.classNames.addClassNames(_8,"tab"); |
|---|
| 3632 |
var _9=Builder.node("div",{id:this.tabLeftId+i}); |
|---|
| 3633 |
var _a=Builder.node("div",{id:this.tabMiddleId+i}); |
|---|
| 3634 |
_a.appendChild(_6); |
|---|
| 3635 |
var _b=Builder.node("div",{id:this.tabRightId+i}); |
|---|
| 3636 |
_8.appendChild(_9); |
|---|
| 3637 |
_8.appendChild(_a); |
|---|
| 3638 |
_8.appendChild(_b); |
|---|
| 3639 |
Event.observe(_8,"click",this.selectTab.bindAsEventListener(this)); |
|---|
| 3640 |
this.tabs[i]=_8; |
|---|
| 3641 |
this.setTabInactive(_8); |
|---|
| 3642 |
this.panelList[i].appendChild(_8); |
|---|
| 3643 |
},buildPanel:function(_c,i){ |
|---|
| 3644 |
var _e=Builder.node("div",{id:this.panelId+i}); |
|---|
| 3645 |
this.classNames.addClassNames(_e,"panel"); |
|---|
| 3646 |
_e.appendChild(_c); |
|---|
| 3647 |
Element.hide(_e); |
|---|
| 3648 |
this.panels[i]=_e; |
|---|
| 3649 |
this.panelList[i].appendChild(_e); |
|---|
| 3650 |
},selectTab:function(e){ |
|---|
| 3651 |
if(!e){ |
|---|
| 3652 |
if(!this.panels[this.selected]){ |
|---|
| 3653 |
this.selected=0; |
|---|
| 3654 |
} |
|---|
| 3655 |
Element.show(this.panels[this.selected]); |
|---|
| 3656 |
this.setTabActive(this.tabs[this.selected]); |
|---|
| 3657 |
return; |
|---|
| 3658 |
} |
|---|
| 3659 |
var _10=Event.element(e); |
|---|
| 3660 |
var _11=this.getTargetIndex(_10); |
|---|
| 3661 |
if(_11==this.selected){ |
|---|
| 3662 |
return; |
|---|
| 3663 |
} |
|---|
| 3664 |
var _12=this.panels[this.selected]; |
|---|
| 3665 |
var _13=this.panels[_11]; |
|---|
| 3666 |
this.setTabInactive(this.tabs[this.selected]); |
|---|
| 3667 |
this.setTabActive(this.tabs[_11]); |
|---|
| 3668 |
Element.show(_13); |
|---|
| 3669 |
Element.hide(_12); |
|---|
| 3670 |
this.selected=_11; |
|---|
| 3671 |
},setTabActive:function(tab){ |
|---|
| 3672 |
var _15=tab.childNodes; |
|---|
| 3673 |
this.classNames.refreshClassNames(_15[0],"tabLeftActive"); |
|---|
| 3674 |
this.classNames.refreshClassNames(_15[1],"tabMiddleActive"); |
|---|
| 3675 |
this.classNames.refreshClassNames(_15[2],"tabRightActive"); |
|---|
| 3676 |
},setTabInactive:function(tab){ |
|---|
| 3677 |
var _17=tab.childNodes; |
|---|
| 3678 |
this.classNames.refreshClassNames(_17[0],"tabLeftInactive"); |
|---|
| 3679 |
this.classNames.refreshClassNames(_17[1],"tabMiddleInactive"); |
|---|
| 3680 |
this.classNames.refreshClassNames(_17[2],"tabRightInactive"); |
|---|
| 3681 |
},getTargetIndex:function(_18){ |
|---|
| 3682 |
while(_18){ |
|---|
| 3683 |
if(_18.id&&_18.id.indexOf(this.tabId,0)>=0){ |
|---|
| 3684 |
var _19=_18.id.substring(this.tabId.length); |
|---|
| 3685 |
if(!isNaN(_19)){ |
|---|
| 3686 |
return _19; |
|---|
| 3687 |
} |
|---|
| 3688 |
} |
|---|
| 3689 |
_18=_18.parentNode; |
|---|
| 3690 |
} |
|---|
| 3691 |
}}; |
|---|
| 3692 |
|
|---|
| 3693 |
var SelectableTable=Class.create(); |
|---|
| 3694 |
SelectableTable.classNames={table:"selectableTable_table",tr:"selectableTable_tr",trHover:"selectableTable_trHover",trSelected:"selectableTable_trSelected"}; |
|---|
| 3695 |
SelectableTable.prototype={initialize:function(_1){ |
|---|
| 3696 |
this.element=$(_1); |
|---|
| 3697 |
var _2={arrayDefaultData:[],build:true,flagAllowUnselect:true,flagInitialAllowMultiple:false,flagKeypressAvailable:false,flagKeypressDeleteAvailable:false,flagKeypressInsertAvailable:false,functionClickCallback:Prototype.emptyFunction,functionDoubleClickCallback:Prototype.emptyFunction,functionPostAdd:Prototype.emptyFunction,functionPostBuild:Prototype.emptyFunction,functionPostDelete:Prototype.emptyFunction,functionPostPressLeft:Prototype.emptyFunction,functionPostPressRight:Prototype.emptyFunction,functionPostSelect:Prototype.emptyFunction,functionPostUnselect:Prototype.emptyFunction,functionPreAdd:function(){ |
|---|
| 3698 |
return true; |
|---|
| 3699 |
},functionPreDelete:function(){ |
|---|
| 3700 |
return true; |
|---|
| 3701 |
},functionSubmit:Prototype.emptyFunction,initialSelected:null,prefixTrId:"selectable_table_",prefixCSS:"custom_"}; |
|---|
| 3702 |
this.options=Object.extend(_2,arguments[1]||{}); |
|---|
| 3703 |
Object.extend(this,{classNames:new CssUtil([SelectableTable.classNames,CssUtil.appendPrefix(this.options.prefixCSS,SelectableTable.classNames)]),flagAllowMultiple:this.options.flagInitialAllowMultiple,flagAvailable:true,focused:null,lastSelected:null,lineIdArray:[],newNumber:1,selected:{}}); |
|---|
| 3704 |
this.build(); |
|---|
| 3705 |
if(this.options.initialSelected){ |
|---|
| 3706 |
this.selectEffect(this.buildTrId(this.options.initialSelected)); |
|---|
| 3707 |
} |
|---|
| 3708 |
},add:function(){ |
|---|
| 3709 |
if(!this.flagAvailable){ |
|---|
| 3710 |
return; |
|---|
| 3711 |
} |
|---|
| 3712 |
if(!this.options.functionPreAdd(this)){ |
|---|
| 3713 |
return; |
|---|
| 3714 |
} |
|---|
| 3715 |
if(arguments[0]==null){ |
|---|
| 3716 |
arguments[0]=this.options.arrayDefaultData; |
|---|
| 3717 |
} |
|---|
| 3718 |
if(typeof (arguments[0])!="string"){ |
|---|
| 3719 |
arguments=arguments[0]; |
|---|
| 3720 |
} |
|---|
| 3721 |
if(arguments[0]==null){ |
|---|
| 3722 |
return; |
|---|
| 3723 |
} |
|---|
| 3724 |
var _3,_4; |
|---|
| 3725 |
_3=document.createElement("tr"); |
|---|
| 3726 |
_3.id="new_"+this.newNumber; |
|---|
| 3727 |
this.buildTr(_3); |
|---|
| 3728 |
for(var i=0;i<arguments.length;i++){ |
|---|
| 3729 |
_4=document.createElement("td"); |
|---|
| 3730 |
_4.innerHTML=arguments[i]; |
|---|
| 3731 |
_3.appendChild(_4); |
|---|
| 3732 |
} |
|---|
| 3733 |
this.element.tBodies[0].appendChild(_3); |
|---|
| 3734 |
this.newNumber++; |
|---|
| 3735 |
this.options.functionPostAdd(this); |
|---|
| 3736 |
},addKeyboardEvent:function(){ |
|---|
| 3737 |
var _6=this; |
|---|
| 3738 |
if(this.options.flagKeypressAvailable){ |
|---|
| 3739 |
this.shortcutManager=new ShortcutManager(); |
|---|
| 3740 |
var _7=[["enter",function(){ |
|---|
| 3741 |
_6.selectOrUnselect(_6.focused,false); |
|---|
| 3742 |
}],["shift+enter",function(){ |
|---|
| 3743 |
_6.selectOrUnselectRange(_6.focused); |
|---|
| 3744 |
}],["ctrl+enter",function(){ |
|---|
| 3745 |
_6.selectOrUnselect(_6.focused,true); |
|---|
| 3746 |
}],["backspace",Prototype.emptyFunction],["esc",Prototype.emptyFunction],["up",function(){ |
|---|
| 3747 |
_6.focusMove("up"); |
|---|
| 3748 |
}],["down",function(){ |
|---|
| 3749 |
_6.focusMove("down"); |
|---|
| 3750 |
}],["left",function(){ |
|---|
| 3751 |
_6.options.functionPostPressLeft(this); |
|---|
| 3752 |
}],["right",function(){ |
|---|
| 3753 |
_6.options.functionPostPressRight(this); |
|---|
| 3754 |
}]]; |
|---|
| 3755 |
if(this.options.flagKeypressInsertAvailable){ |
|---|
| 3756 |
_7.push(["insert",function(){ |
|---|
| 3757 |
_6.add(); |
|---|
| 3758 |
}]); |
|---|
| 3759 |
} |
|---|
| 3760 |
if(this.options.flagKeypressDeleteAvailable){ |
|---|
| 3761 |
_7.push(["delete",function(){ |
|---|
| 3762 |
_6.deleteAll(); |
|---|
| 3763 |
}]); |
|---|
| 3764 |
} |
|---|
| 3765 |
this.shortcutManager.add(_7); |
|---|
| 3766 |
} |
|---|
| 3767 |
this.cmdPressed=false; |
|---|
| 3768 |
this.cmdManager=new ShortcutManager({detectKeyup:true}); |
|---|
| 3769 |
this.cmdManager.add("cmd",function(){ |
|---|
| 3770 |
_6.cmdPressed=true; |
|---|
| 3771 |
}); |
|---|
| 3772 |
this.cmdManager.add("cmd",function(){ |
|---|
| 3773 |
_6.cmdPressed=false; |
|---|
| 3774 |
},true); |
|---|
| 3775 |
},addMouseEvent:function(){ |
|---|
| 3776 |
Event.observe(this.element,"mousedown",this.eventMouseDown.bindAsEventListener(this)); |
|---|
| 3777 |
Event.observe(document,"mouseup",this.eventMouseUp.bindAsEventListener(this)); |
|---|
| 3778 |
},build:function(){ |
|---|
| 3779 |
this.addKeyboardEvent(); |
|---|
| 3780 |
this.addMouseEvent(); |
|---|
| 3781 |
if(this.options.build){ |
|---|
| 3782 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 3783 |
this.classNames.addClassNames(this.element,"table"); |
|---|
| 3784 |
var _8=this.element.tBodies[0].rows; |
|---|
| 3785 |
for(var i=0;i<_8.length;i++){ |
|---|
| 3786 |
this.buildTr(_8[i]); |
|---|
| 3787 |
this.lineIdArray.push(_8[i].id); |
|---|
| 3788 |
} |
|---|
| 3789 |
this.options.functionPostBuild(this); |
|---|
| 3790 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 3791 |
}else{ |
|---|
| 3792 |
this.lineIdArray=$A(this.element.tBodies[0].rows).collect(function(el){ |
|---|
| 3793 |
return el.id; |
|---|
| 3794 |
}); |
|---|
| 3795 |
} |
|---|
| 3796 |
this.length=this.size(); |
|---|
| 3797 |
},buildTr:function(_b){ |
|---|
| 3798 |
_b.id=this.buildTrId(_b.id); |
|---|
| 3799 |
this.classNames.addClassNames(_b,"tr"); |
|---|
| 3800 |
Event.observe(_b,"click",this.eventClick.bindAsEventListener(this),true); |
|---|
| 3801 |
Event.observe(_b,"dblclick",this.eventDoubleClick.bindAsEventListener(this),true); |
|---|
| 3802 |
Event.observe(_b,"mouseout",this.eventFocusOut.bindAsEventListener(this),true); |
|---|
| 3803 |
Event.observe(_b,"mouseover",this.eventFocusOver.bindAsEventListener(this),true); |
|---|
| 3804 |
},buildTrId:function(_c){ |
|---|
| 3805 |
return this.options.prefixTrId+_c; |
|---|
| 3806 |
},deleteAll:function(){ |
|---|
| 3807 |
if(!this.flagAvailable){ |
|---|
| 3808 |
return; |
|---|
| 3809 |
} |
|---|
| 3810 |
if(!this.options.functionPreDelete(this)){ |
|---|
| 3811 |
return; |
|---|
| 3812 |
} |
|---|
| 3813 |
for(var _d in this.selected){ |
|---|
| 3814 |
this.element.tBodies[0].removeChild($(_d)); |
|---|
| 3815 |
delete this.selected[_d]; |
|---|
| 3816 |
} |
|---|
| 3817 |
this.focused=null; |
|---|
| 3818 |
this.options.functionPostDelete(this); |
|---|
| 3819 |
},destroy:function(){ |
|---|
| 3820 |
if(this.options.flagKeypressAvailable){ |
|---|
| 3821 |
this.shortcutManager.destroy(); |
|---|
| 3822 |
} |
|---|
| 3823 |
this.cmdManager.destroy(); |
|---|
| 3824 |
},eventClick:function(_e){ |
|---|
| 3825 |
Event.stop(_e); |
|---|
| 3826 |
if(!this.flagAvailable){ |
|---|
| 3827 |
return; |
|---|
| 3828 |
} |
|---|
| 3829 |
if(this.options.functionClickCallback.constructor==Function){ |
|---|
| 3830 |
if(this.options.functionClickCallback!=Prototype.emptyFunction){ |
|---|
| 3831 |
this.options.functionClickCallback(Event.findElement(_e,"tr").id.replace(this.options.prefixTrId,"")); |
|---|
| 3832 |
} |
|---|
| 3833 |
} |
|---|
| 3834 |
if(_e.shiftKey){ |
|---|
| 3835 |
this.selectOrUnselectRange(Event.findElement(_e,"tr").id); |
|---|
| 3836 |
}else{ |
|---|
| 3837 |
this.selectOrUnselect(Event.findElement(_e,"tr").id,_e.ctrlKey||this.cmdPressed); |
|---|
| 3838 |
} |
|---|
| 3839 |
},eventDoubleClick:function(_f){ |
|---|
| 3840 |
Event.stop(_f); |
|---|
| 3841 |
if(!this.flagAvailable){ |
|---|
| 3842 |
return; |
|---|
| 3843 |
} |
|---|
| 3844 |
if(this.options.functionDoubleClickCallback.constructor==Function){ |
|---|
| 3845 |
if(this.options.functionDoubleClickCallback!=Prototype.emptyFunction){ |
|---|
| 3846 |
this.options.functionDoubleClickCallback(Event.findElement(_f,"tr").id.replace(this.options.prefixTrId,"")); |
|---|
| 3847 |
} |
|---|
| 3848 |
} |
|---|
| 3849 |
if(this.flagAllowMultiple){ |
|---|
| 3850 |
this.select(Event.findElement(_f,"tr").id,false); |
|---|
| 3851 |
this.submit(); |
|---|
| 3852 |
} |
|---|
| 3853 |
},eventFocusOut:function(_10){ |
|---|
| 3854 |
Event.stop(_10); |
|---|
| 3855 |
if(!this.flagAvailable){ |
|---|
| 3856 |
return; |
|---|
| 3857 |
} |
|---|
| 3858 |
this.focusOff(); |
|---|
| 3859 |
},eventFocusOver:function(_11){ |
|---|
| 3860 |
Event.stop(_11); |
|---|
| 3861 |
SpinelzUtil.blur(); |
|---|
| 3862 |
if(!this.flagAvailable){ |
|---|
| 3863 |
return; |
|---|
| 3864 |
} |
|---|
| 3865 |
this.focusOn(Event.findElement(_11,"tr").id); |
|---|
| 3866 |
SpinelzUtil.clearBrowserSelection(); |
|---|
| 3867 |
},eventMouseDown:function(_12){ |
|---|
| 3868 |
Event.stop(_12); |
|---|
| 3869 |
if(!_12.shiftKey&&!_12.ctrlKey&&this.flagAllowMultiple){ |
|---|
| 3870 |
this.onMouseDown(Event.findElement(_12,"tr").id); |
|---|
| 3871 |
} |
|---|
| 3872 |
},eventMouseUp:function(_13){ |
|---|
| 3873 |
Event.stop(_13); |
|---|
| 3874 |
this.onMouseUp(); |
|---|
| 3875 |
},focusMove:function(_14){ |
|---|
| 3876 |
if(!this.flagAvailable){ |
|---|
| 3877 |
return; |
|---|
| 3878 |
} |
|---|
| 3879 |
if(this.focused==null){ |
|---|
| 3880 |
if(this.element.tBodies[0].rows[0]){ |
|---|
| 3881 |
this.focusOn(this.element.tBodies[0].rows[0].id); |
|---|
| 3882 |
} |
|---|
| 3883 |
}else{ |
|---|
| 3884 |
var _15=$(this.focused).rowIndex; |
|---|
| 3885 |
var _16,_17; |
|---|
| 3886 |
switch(_14){ |
|---|
| 3887 |
case "down": |
|---|
| 3888 |
_16=1; |
|---|
| 3889 |
_17=this.isBottom(_15); |
|---|
| 3890 |
break; |
|---|
| 3891 |
case "up": |
|---|
| 3892 |
_16=-1; |
|---|
| 3893 |
_17=this.isTop(_15); |
|---|
| 3894 |
break; |
|---|
| 3895 |
} |
|---|
| 3896 |
if(!_17){ |
|---|
| 3897 |
this.focusOn(this.element.rows[_15+_16].id); |
|---|
| 3898 |
} |
|---|
| 3899 |
} |
|---|
| 3900 |
},focusOff:function(){ |
|---|
| 3901 |
if(!this.flagAvailable){ |
|---|
| 3902 |
return; |
|---|
| 3903 |
} |
|---|
| 3904 |
if(this.focused!=null){ |
|---|
| 3905 |
var _18=$(this.focused); |
|---|
| 3906 |
this.classNames.removeClassNames(_18,"trHover"); |
|---|
| 3907 |
this.focused=null; |
|---|
| 3908 |
} |
|---|
| 3909 |
},focusOn:function(_19){ |
|---|
| 3910 |
if(!this.flagAvailable){ |
|---|
| 3911 |
return; |
|---|
| 3912 |
} |
|---|
| 3913 |
if($(_19)!=null){ |
|---|
| 3914 |
this.focusOff(); |
|---|
| 3915 |
if(this.flagAllowMultiple&&this.mouseDown){ |
|---|
| 3916 |
this.mouseSelect(_19); |
|---|
| 3917 |
}else{ |
|---|
| 3918 |
this.classNames.addClassNames($(_19),"trHover"); |
|---|
| 3919 |
this.focused=_19; |
|---|
| 3920 |
} |
|---|
| 3921 |
} |
|---|
| 3922 |
},getSelected:function(){ |
|---|
| 3923 |
var _1a=new Array(); |
|---|
| 3924 |
for(var _1b in this.selected){ |
|---|
| 3925 |
_1a.push(_1b.replace(this.options.prefixTrId,"")); |
|---|
| 3926 |
} |
|---|
| 3927 |
return _1a; |
|---|
| 3928 |
},getSelectedElement:function(id){ |
|---|
| 3929 |
var _1d=this.options.prefixTrId+id; |
|---|
| 3930 |
return $(_1d); |
|---|
| 3931 |
},isBottom:function(_1e){ |
|---|
| 3932 |
return (_1e==this.element.rows.length-1)?true:false; |
|---|
| 3933 |
},isTop:function(_1f){ |
|---|
| 3934 |
return (_1f==this.element.tBodies[0].rows[0].rowIndex)?true:false; |
|---|
| 3935 |
},makeAvailable:function(){ |
|---|
| 3936 |
this.flagAvailable=true; |
|---|
| 3937 |
if(this.options.flagKeypressAvailable){ |
|---|
| 3938 |
this.shortcutManager.start(); |
|---|
| 3939 |
} |
|---|
| 3940 |
},makeMultiple:function(){ |
|---|
| 3941 |
this.flagAllowMultiple=true; |
|---|
| 3942 |
},makeSingular:function(){ |
|---|
| 3943 |
this.flagAllowMultiple=false; |
|---|
| 3944 |
this.unselectAll(); |
|---|
| 3945 |
},makeUnavailable:function(){ |
|---|
| 3946 |
if(this.options.flagKeypressAvailable){ |
|---|
| 3947 |
this.shortcutManager.stop(); |
|---|
| 3948 |
} |
|---|
| 3949 |
this.flagAvailable=false; |
|---|
| 3950 |
},mouseSelect:function(_20){ |
|---|
| 3951 |
if(!this.flagAvailable){ |
|---|
| 3952 |
return; |
|---|
| 3953 |
} |
|---|
| 3954 |
if(this.mouseDownCurrent==_20){ |
|---|
| 3955 |
return; |
|---|
| 3956 |
} |
|---|
| 3957 |
this.mouseDownCurrent=_20; |
|---|
| 3958 |
var _21=[]; |
|---|
| 3959 |
if(_20==this.mouseDownBase){ |
|---|
| 3960 |
_21.push(_20); |
|---|
| 3961 |
}else{ |
|---|
| 3962 |
var _22=false; |
|---|
| 3963 |
var _23=this; |
|---|
| 3964 |
this.lineIdArray.each(function(_24){ |
|---|
| 3965 |
if(_22){ |
|---|
| 3966 |
_21.push(_24); |
|---|
| 3967 |
} |
|---|
| 3968 |
if(_24==_23.mouseDownBase||_24==_23.mouseDownCurrent){ |
|---|
| 3969 |
_22=(_22!=true); |
|---|
| 3970 |
_21.push(_24); |
|---|
| 3971 |
} |
|---|
| 3972 |
}); |
|---|
| 3973 |
_21.uniq(); |
|---|
| 3974 |
} |
|---|
| 3975 |
this.unselectAll(); |
|---|
| 3976 |
var _23=this; |
|---|
| 3977 |
_21.each(function(_25){ |
|---|
| 3978 |
_23.selectEffect(_25,true); |
|---|
| 3979 |
}); |
|---|
| 3980 |
},onMouseDown:function(_26){ |
|---|
| 3981 |
if(!this.flagAvailable){ |
|---|
| 3982 |
return; |
|---|
| 3983 |
} |
|---|
| 3984 |
this.unselectAll(); |
|---|
| 3985 |
if(_26){ |
|---|
| 3986 |
Object.extend(this,{mouseDown:true,mouseDownBase:_26,mouseDownCurrent:null}); |
|---|
| 3987 |
this.mouseSelect(_26); |
|---|
| 3988 |
} |
|---|
| 3989 |
},onMouseUp:function(){ |
|---|
| 3990 |
if(!this.flagAvailable){ |
|---|
| 3991 |
return; |
|---|
| 3992 |
} |
|---|
| 3993 |
if(this.mouseDown){ |
|---|
| 3994 |
this.mouseDown=false; |
|---|
| 3995 |
} |
|---|
| 3996 |
},select:function(_27,_28){ |
|---|
| 3997 |
if(!this.flagAvailable){ |
|---|
| 3998 |
return; |
|---|
| 3999 |
} |
|---|
| 4000 |
this.selectEffect(_27,_28); |
|---|
| 4001 |
this.lastSelected=_27; |
|---|
| 4002 |
this.options.functionPostSelect(this); |
|---|
| 4003 |
if(!this.flagAllowMultiple){ |
|---|
| 4004 |
this.submit(); |
|---|
| 4005 |
} |
|---|
| 4006 |
},selectAll:function(){ |
|---|
| 4007 |
if(!this.flagAvailable){ |
|---|
| 4008 |
return; |
|---|
| 4009 |
} |
|---|
| 4010 |
if(!this.flagAllowMultiple){ |
|---|
| 4011 |
return; |
|---|
| 4012 |
} |
|---|
| 4013 |
this.selected=new Object(); |
|---|
| 4014 |
var _29=this.element.tBodies[0].rows; |
|---|
| 4015 |
for(var i=0;i<_29.length;i++){ |
|---|
| 4016 |
this.select(_29[i].id,true); |
|---|
| 4017 |
} |
|---|
| 4018 |
},selectEffect:function(_2b,_2c){ |
|---|
| 4019 |
if(!this.flagAllowMultiple||!_2c){ |
|---|
| 4020 |
this.unselectAll(); |
|---|
| 4021 |
} |
|---|
| 4022 |
var el=$(_2b); |
|---|
| 4023 |
if(el){ |
|---|
| 4024 |
this.classNames.addClassNames(el,"trSelected"); |
|---|
| 4025 |
this.selected[_2b]=true; |
|---|
| 4026 |
} |
|---|
| 4027 |
},selectOrUnselect:function(_2e,_2f){ |
|---|
| 4028 |
if(!this.flagAvailable){ |
|---|
| 4029 |
return; |
|---|
| 4030 |
} |
|---|
| 4031 |
if(_2e==null){ |
|---|
| 4032 |
return; |
|---|
| 4033 |
} |
|---|
| 4034 |
if(_2f&&this.selected[_2e]){ |
|---|
| 4035 |
if(!this.flagAllowMultiple&&!this.options.flagAllowUnselect){ |
|---|
| 4036 |
return; |
|---|
| 4037 |
} |
|---|
| 4038 |
this.unselect(_2e); |
|---|
| 4039 |
}else{ |
|---|
| 4040 |
this.select(_2e,_2f); |
|---|
| 4041 |
if(_2f){ |
|---|
| 4042 |
SpinelzUtil.clearBrowserSelection(); |
|---|
| 4043 |
} |
|---|
| 4044 |
} |
|---|
| 4045 |
},selectOrUnselectRange:function(_30){ |
|---|
| 4046 |
if(!this.flagAvailable){ |
|---|
| 4047 |
return; |
|---|
| 4048 |
} |
|---|
| 4049 |
if(_30==null){ |
|---|
| 4050 |
return; |
|---|
| 4051 |
} |
|---|
| 4052 |
if(this.lastSelected==null||this.lastSelected==_30){ |
|---|
| 4053 |
this.selectOrUnselect(_30); |
|---|
| 4054 |
return; |
|---|
| 4055 |
} |
|---|
| 4056 |
var _31=false; |
|---|
| 4057 |
var _32=this.element.tBodies[0].rows; |
|---|
| 4058 |
var _33=this.lastSelected; |
|---|
| 4059 |
for(var i=0;i<_32.length;i++){ |
|---|
| 4060 |
if(_32[i].id==_30||_32[i].id==_33){ |
|---|
| 4061 |
_31=(_31)?false:true; |
|---|
| 4062 |
}else{ |
|---|
| 4063 |
if(!_31){ |
|---|
| 4064 |
continue; |
|---|
| 4065 |
} |
|---|
| 4066 |
} |
|---|
| 4067 |
if(this.selected[_33]){ |
|---|
| 4068 |
this.select(_32[i].id,true); |
|---|
| 4069 |
}else{ |
|---|
| 4070 |
this.unselect(_32[i].id); |
|---|
| 4071 |
} |
|---|
| 4072 |
} |
|---|
| 4073 |
SpinelzUtil.clearBrowserSelection(); |
|---|
| 4074 |
},size:function(){ |
|---|
| 4075 |
return this.lineIdArray.size(); |
|---|
| 4076 |
},submit:function(_35){ |
|---|
| 4077 |
if(!this.flagAvailable){ |
|---|
| 4078 |
return; |
|---|
| 4079 |
} |
|---|
| 4080 |
var _36=this.getSelected(); |
|---|
| 4081 |
this.options.functionSubmit(_36[0]); |
|---|
| 4082 |
},unselect:function(_37){ |
|---|
| 4083 |
if(!this.flagAvailable){ |
|---|
| 4084 |
return; |
|---|
| 4085 |
} |
|---|
| 4086 |
this.classNames.removeClassNames($(_37),"trSelected"); |
|---|
| 4087 |
delete this.selected[_37]; |
|---|
| 4088 |
this.lastSelected=_37; |
|---|
| 4089 |
this.options.functionPostUnselect(this); |
|---|
| 4090 |
},unselectAll:function(){ |
|---|
| 4091 |
if(!this.flagAvailable){ |
|---|
| 4092 |
return; |
|---|
| 4093 |
} |
|---|
| 4094 |
var _38=this.element.tBodies[0].rows; |
|---|
| 4095 |
for(var i=0;i<_38.length;i++){ |
|---|
| 4096 |
this.unselect(_38[i].id); |
|---|
| 4097 |
} |
|---|
| 4098 |
}}; |
|---|
| 4099 |
var SelectableTableLib={navi:function(_3a,_3b){ |
|---|
| 4100 |
var _3c=_3b||(SelectableTableManager.active||"")+"_navigation_top"; |
|---|
| 4101 |
var _3b=$(_3c+"_"+_3a); |
|---|
| 4102 |
if(_3b!=null){ |
|---|
| 4103 |
if(UserAgent.isIE()){ |
|---|
| 4104 |
_3b.fireEvent("onclick"); |
|---|
| 4105 |
}else{ |
|---|
| 4106 |
var evt=document.createEvent("MouseEvents"); |
|---|
| 4107 |
evt.initEvent("click",true,true); |
|---|
| 4108 |
_3b.dispatchEvent(evt); |
|---|
| 4109 |
} |
|---|
| 4110 |
} |
|---|
| 4111 |
}}; |
|---|
| 4112 |
var SelectableTableCreator={create:function(){ |
|---|
| 4113 |
var key=arguments[0]; |
|---|
| 4114 |
var _3f=arguments[1]||{}; |
|---|
| 4115 |
var _40=arguments[2]||null; |
|---|
| 4116 |
var _41=arguments[3]||false; |
|---|
| 4117 |
if(_40){ |
|---|
| 4118 |
try{ |
|---|
| 4119 |
_40.destroy(); |
|---|
| 4120 |
} |
|---|
| 4121 |
catch(e){ |
|---|
| 4122 |
} |
|---|
| 4123 |
} |
|---|
| 4124 |
var _42=new SelectableTable(key,_3f); |
|---|
| 4125 |
if(_41){ |
|---|
| 4126 |
SelectableTableManager.push(key,_42); |
|---|
| 4127 |
} |
|---|
| 4128 |
return _42; |
|---|
| 4129 |
}}; |
|---|
| 4130 |
var SelectableTableManager={active:null,list:$H({}),activate:function(key){ |
|---|
| 4131 |
this.stop(); |
|---|
| 4132 |
if(this.list[key]){ |
|---|
| 4133 |
this.list[key].makeAvailable(); |
|---|
| 4134 |
this.active=key; |
|---|
| 4135 |
}else{ |
|---|
| 4136 |
this.active=null; |
|---|
| 4137 |
} |
|---|
| 4138 |
},deactivate:function(){ |
|---|
| 4139 |
this.stop(); |
|---|
| 4140 |
this.active=null; |
|---|
| 4141 |
},destroy:function(){ |
|---|
| 4142 |
this.deactivate(); |
|---|
| 4143 |
this.list=$H({}); |
|---|
| 4144 |
},push:function(key,_45){ |
|---|
| 4145 |
if(this.list[key]){ |
|---|
| 4146 |
this.list[key].makeUnavailable(); |
|---|
| 4147 |
} |
|---|
| 4148 |
this.list[key]=_45; |
|---|
| 4149 |
this.activate(key); |
|---|
| 4150 |
},start:function(){ |
|---|
| 4151 |
var _46=this.active; |
|---|
| 4152 |
if(_46){ |
|---|
| 4153 |
this.list[_46].makeAvailable(); |
|---|
| 4154 |
} |
|---|
| 4155 |
},stop:function(){ |
|---|
| 4156 |
this.list.each(function(el){ |
|---|
| 4157 |
if(el[1]){ |
|---|
| 4158 |
el[1].makeUnavailable(); |
|---|
| 4159 |
} |
|---|
| 4160 |
}); |
|---|
| 4161 |
}}; |
|---|
| 4162 |
|
|---|
| 4163 |
SideBarBox=Class.create(); |
|---|
| 4164 |
SideBarBox.className={panelContainer:"sideBarBox_panelContainer",tabContainer:"sideBarBox_tabContainer",title:"sideBarBox_tabTitle",tab:"sideBarBox_tab",tabTopInactive:"sideBarBox_tabTopInactive",tabTopActive:"sideBarBox_tabTopActive",tabMiddleInactive:"sideBarBox_tabMiddleInactive",tabMiddleActive:"sideBarBox_tabMiddleActive",tabBottomInactive:"sideBarBox_tabBottomInactive",tabBottomActive:"sideBarBox_tabBottomActive"}; |
|---|
| 4165 |
SideBarBox.prototype={initialize:function(_1){ |
|---|
| 4166 |
var _2=Object.extend({selected:1,beforeSelect:function(){ |
|---|
| 4167 |
return true; |
|---|
| 4168 |
},afterSelect:Prototype.emptyFunction,visible:false,close:true,cssPrefix:"custom_",build:true},arguments[1]||{}); |
|---|
| 4169 |
this.options=_2; |
|---|
| 4170 |
this.element=$(_1); |
|---|
| 4171 |
if(this.options.build){ |
|---|
| 4172 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 4173 |
} |
|---|
| 4174 |
this.css=CssUtil.getInstance(this.options.cssPrefix,SideBarBox.className); |
|---|
| 4175 |
this.classNames=this.css.allJoinClassNames(); |
|---|
| 4176 |
this.start(); |
|---|
| 4177 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 4178 |
},start:function(){ |
|---|
| 4179 |
this.tabs=[]; |
|---|
| 4180 |
this.panelContents=[]; |
|---|
| 4181 |
this.tabSets=[]; |
|---|
| 4182 |
this.visible=this.options.visible; |
|---|
| 4183 |
this.selected=(this.options.selected>0)?this.options.selected-1:0; |
|---|
| 4184 |
this.selected=(this.visible)?this.selected:-1; |
|---|
| 4185 |
this.tabId=this.element.id+"_tab"; |
|---|
| 4186 |
this.tabTopId=this.tabId+"_top"; |
|---|
| 4187 |
this.tabMiddleId=this.tabId+"_middle"; |
|---|
| 4188 |
this.tabBottomId=this.tabId+"_bottom"; |
|---|
| 4189 |
this.tabContainerId=this.element.id+"_tabContainer"; |
|---|
| 4190 |
this.panelId=this.element.id+"_panel"; |
|---|
| 4191 |
this.panelContainerId=this.element.id+"_panelContainer"; |
|---|
| 4192 |
this.ids=[]; |
|---|
| 4193 |
this.holder=[]; |
|---|
| 4194 |
if(this.options.build){ |
|---|
| 4195 |
this.buildTabBox(); |
|---|
| 4196 |
} |
|---|
| 4197 |
this.tabContainer=$(this.tabContainerId); |
|---|
| 4198 |
this.panelContainer=$(this.panelContainerId); |
|---|
| 4199 |
this.tabs=this.tabs.collect(function(_3){ |
|---|
| 4200 |
return $(_3); |
|---|
| 4201 |
}); |
|---|
| 4202 |
this.panelContents=this.panelContents.collect(function(_4){ |
|---|
| 4203 |
return $(_4); |
|---|
| 4204 |
}); |
|---|
| 4205 |
if(this.options.build){ |
|---|
| 4206 |
this.selectTab(); |
|---|
| 4207 |
this.setEvent(); |
|---|
| 4208 |
this.appendElements(); |
|---|
| 4209 |
} |
|---|
| 4210 |
},setEvent:function(){ |
|---|
| 4211 |
this.ids.each(function(_5){ |
|---|
| 4212 |
Event.observe(_5,"click",this.selectTab.bindAsEventListener(this)); |
|---|
| 4213 |
}.bind(this)); |
|---|
| 4214 |
},appendElements:function(){ |
|---|
| 4215 |
this.holder.each(function(_6){ |
|---|
| 4216 |
$(this.tabMiddleId+_6.number).appendChild(_6.tab); |
|---|
| 4217 |
this.panelContents[_6.number].appendChild(_6.content); |
|---|
| 4218 |
}.bind(this)); |
|---|
| 4219 |
},buildTabBox:function(){ |
|---|
| 4220 |
var _7="<div id='"+this.tabContainerId+"' class='"+this.classNames["tabContainer"]+"'>"; |
|---|
| 4221 |
var _8="<div id='"+this.panelContainerId+"' class='"+this.classNames["panelContainer"]+"'>"; |
|---|
| 4222 |
var _9=0; |
|---|
| 4223 |
$A(this.element.childNodes).each(function(_a){ |
|---|
| 4224 |
if(Element.isElementNode(_a)){ |
|---|
| 4225 |
var _b=this.buildTabSet(_a,_9); |
|---|
| 4226 |
_7+=_b.tab; |
|---|
| 4227 |
_8+=_b.panel; |
|---|
| 4228 |
_9++; |
|---|
| 4229 |
} |
|---|
| 4230 |
}.bind(this)); |
|---|
| 4231 |
_7+="</div>"; |
|---|
| 4232 |
_8+="</div>"; |
|---|
| 4233 |
this.addContainers(_8,_7); |
|---|
| 4234 |
},addContainers:function(_c,_d){ |
|---|
| 4235 |
this.element.innerHTML=_c+_d+"<div style='clear: left'></div>"; |
|---|
| 4236 |
},buildTabSet:function(_e,i){ |
|---|
| 4237 |
var _10=Element.getChildNodesWithoutWhitespace(_e); |
|---|
| 4238 |
this.holdElements(_10[0],_10[1],i); |
|---|
| 4239 |
return {tab:this.buildTab(_10[0],i),panel:this.buildPanel(_10[1],i)}; |
|---|
| 4240 |
},buildTab:function(tab,i){ |
|---|
| 4241 |
var _13=this.tabId+i; |
|---|
| 4242 |
this.ids.push(_13); |
|---|
| 4243 |
this.tabs[i]=_13; |
|---|
| 4244 |
var _14=tab.title; |
|---|
| 4245 |
_14=_14?" title='"+_14+"'":""; |
|---|
| 4246 |
var _15="<div id='"+_13+"' class='"+this.classNames["tab"]+"'"+_14+">"+"<div id='"+this.tabTopId+i+"' class='"+this.classNames["tabTopInactive"]+"'></div>"+"<div id='"+this.tabMiddleId+i+"' class='"+this.classNames["tabMiddleInactive"]+"'>"+"</div>"+"<div id='"+this.tabBottomId+i+"' class='"+this.classNames["tabBottomInactive"]+"'></div>"+"</div>"; |
|---|
| 4247 |
return _15; |
|---|
| 4248 |
},buildPanel:function(_16,i){ |
|---|
| 4249 |
var id=this.panelId+i; |
|---|
| 4250 |
this.panelContents[i]=id; |
|---|
| 4251 |
return "<div id='"+id+"' style='display: none;'></div>"; |
|---|
| 4252 |
},holdElements:function(tab,_1a,_1b){ |
|---|
| 4253 |
this.holder.push({number:_1b,tab:tab,content:_1a}); |
|---|
| 4254 |
var _1c=document.createDocumentFragment(); |
|---|
| 4255 |
_1c.appendChild(tab); |
|---|
| 4256 |
_1c.appendChild(_1a); |
|---|
| 4257 |
},selectTab:function(e){ |
|---|
| 4258 |
if(!this.options.beforeSelect()){ |
|---|
| 4259 |
return; |
|---|
| 4260 |
} |
|---|
| 4261 |
if(!e){ |
|---|
| 4262 |
this.setTabActive(this.tabs[this.selected]); |
|---|
| 4263 |
Element.show(this.panelContents[this.selected]); |
|---|
| 4264 |
return; |
|---|
| 4265 |
} |
|---|
| 4266 |
var _1e=this.panelContents[this.selected]; |
|---|
| 4267 |
var _1f=this.tabs[this.selected]; |
|---|
| 4268 |
var _20=null; |
|---|
| 4269 |
if(e.nodeType){ |
|---|
| 4270 |
_20=e; |
|---|
| 4271 |
}else{ |
|---|
| 4272 |
_20=Event.element(e); |
|---|
| 4273 |
} |
|---|
| 4274 |
var _21=this.getTargetIndex(_20); |
|---|
| 4275 |
var _22=this.panelContents[_21]; |
|---|
| 4276 |
var _23=this.tabs[_21]; |
|---|
| 4277 |
if(this.visible){ |
|---|
| 4278 |
if(_23.id==_1f.id){ |
|---|
| 4279 |
if(this.options.close){ |
|---|
| 4280 |
Effect.SlideRightOutOfView(this.panelContainer); |
|---|
| 4281 |
this.visible=false; |
|---|
| 4282 |
this.selected=-1; |
|---|
| 4283 |
this.setTabInactive(_1f); |
|---|
| 4284 |
Element.toggle(_22); |
|---|
| 4285 |
} |
|---|
| 4286 |
}else{ |
|---|
| 4287 |
this.setTabActive(_23); |
|---|
| 4288 |
this.setTabInactive(_1f); |
|---|
| 4289 |
Element.toggle(_1e); |
|---|
| 4290 |
Element.toggle(_22); |
|---|
| 4291 |
this.selected=_21; |
|---|
| 4292 |
} |
|---|
| 4293 |
}else{ |
|---|
| 4294 |
this.setTabActive(_23); |
|---|
| 4295 |
Element.toggle(_22); |
|---|
| 4296 |
Effect.SlideRightIntoView(this.panelContainer); |
|---|
| 4297 |
this.visible=true; |
|---|
| 4298 |
this.selected=_21; |
|---|
| 4299 |
} |
|---|
| 4300 |
this.options.afterSelect(_22,_1e); |
|---|
| 4301 |
},setTabActive:function(tab){ |
|---|
| 4302 |
var _25=Element.getTagNodes(tab); |
|---|
| 4303 |
this.css.refreshClassNames(_25[0],"tabTopActive"); |
|---|
| 4304 |
this.css.refreshClassNames(_25[1],"tabMiddleActive"); |
|---|
| 4305 |
this.css.refreshClassNames(_25[2],"tabBottomActive"); |
|---|
| 4306 |
},setTabInactive:function(tab){ |
|---|
| 4307 |
var _27=Element.getTagNodes(tab); |
|---|
| 4308 |
this.css.refreshClassNames(_27[0],"tabTopInactive"); |
|---|
| 4309 |
this.css.refreshClassNames(_27[1],"tabMiddleInactive"); |
|---|
| 4310 |
this.css.refreshClassNames(_27[2],"tabBottomInactive"); |
|---|
| 4311 |
},getTargetIndex:function(_28){ |
|---|
| 4312 |
while(_28){ |
|---|
| 4313 |
if(_28.id&&_28.id.indexOf(this.tabId,0)>=0){ |
|---|
| 4314 |
var _29=_28.id.substring(this.tabId.length); |
|---|
| 4315 |
if(!isNaN(_29)){ |
|---|
| 4316 |
return _29; |
|---|
| 4317 |
} |
|---|
| 4318 |
} |
|---|
| 4319 |
_28=_28.parentNode; |
|---|
| 4320 |
} |
|---|
| 4321 |
},hasNextTab:function(){ |
|---|
| 4322 |
return this.getNextTab()?true:false; |
|---|
| 4323 |
},hasPreviousTab:function(){ |
|---|
| 4324 |
return this.getPreviousTab()?true:false; |
|---|
| 4325 |
},getNextTab:function(){ |
|---|
| 4326 |
return Element.next(this.getCurrentTab()); |
|---|
| 4327 |
},getPreviousTab:function(){ |
|---|
| 4328 |
return Element.previous(this.getCurrentTab()); |
|---|
| 4329 |
},selectNextTab:function(){ |
|---|
| 4330 |
this.selectTab(this.getNextTab()); |
|---|
| 4331 |
},selectPreviousTab:function(){ |
|---|
| 4332 |
this.selectTab(this.getPreviousTab()); |
|---|
| 4333 |
},tabCount:function(){ |
|---|
| 4334 |
return this.tabs.inject(0,function(i,t){ |
|---|
| 4335 |
return t?++i:i; |
|---|
| 4336 |
}); |
|---|
| 4337 |
},getCurrentPanel:function(){ |
|---|
| 4338 |
return this.panelContents[this.selected]; |
|---|
| 4339 |
},getCurrentTab:function(){ |
|---|
| 4340 |
return this.tabs[this.selected]; |
|---|
| 4341 |
}}; |
|---|
| 4342 |
|
|---|
| 4343 |
Effect.SlideRightIntoView=function(_1){ |
|---|
| 4344 |
_1=$(_1); |
|---|
| 4345 |
Element.cleanWhitespace(_1); |
|---|
| 4346 |
var _2=_1.firstChild.style.right; |
|---|
| 4347 |
var _3=Element.getDimensions(_1); |
|---|
| 4348 |
return new Effect.Scale(_1,100,Object.extend({scaleContent:false,scaleY:false,scaleFrom:0,scaleMode:{originalHeight:_3.height,originalWidth:_3.width},restoreAfterFinish:true,afterSetup:function(_4){ |
|---|
| 4349 |
Element.makePositioned(_4.element.firstChild); |
|---|
| 4350 |
if(window.opera){ |
|---|
| 4351 |
_4.element.firstChild.style.left=""; |
|---|
| 4352 |
} |
|---|
| 4353 |
Element.makeClipping(_4.element); |
|---|
| 4354 |
_1.style.width="0"; |
|---|
| 4355 |
Element.show(_1); |
|---|
| 4356 |
},afterUpdateInternal:function(_5){ |
|---|
| 4357 |
_5.element.firstChild.style.right=(_5.dims[1]-_5.element.clientWidth)+"px"; |
|---|
| 4358 |
},afterFinishInternal:function(_6){ |
|---|
| 4359 |
Element.undoClipping(_6.element); |
|---|
| 4360 |
Element.undoPositioned(_6.element.firstChild); |
|---|
| 4361 |
_6.element.firstChild.style.right=_2; |
|---|
| 4362 |
}},arguments[1]||{})); |
|---|
| 4363 |
}; |
|---|
| 4364 |
Effect.SlideRightOutOfView=function(_7){ |
|---|
| 4365 |
_7=$(_7); |
|---|
| 4366 |
Element.cleanWhitespace(_7); |
|---|
| 4367 |
var _8=_7.firstChild.style.right; |
|---|
| 4368 |
return new Effect.Scale(_7,0,Object.extend({scaleContent:false,scaleY:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_9){ |
|---|
| 4369 |
Element.makePositioned(_9.element.firstChild); |
|---|
| 4370 |
if(window.opera){ |
|---|
| 4371 |
_9.element.firstChild.style.left=""; |
|---|
| 4372 |
} |
|---|
| 4373 |
Element.makeClipping(_9.element); |
|---|
| 4374 |
Element.show(_7); |
|---|
| 4375 |
},afterUpdateInternal:function(_a){ |
|---|
| 4376 |
_a.element.firstChild.style.right=(_a.dims[1]-_a.element.clientWidth)+"px"; |
|---|
| 4377 |
},afterFinishInternal:function(_b){ |
|---|
| 4378 |
Element.hide(_b.element); |
|---|
| 4379 |
Element.undoClipping(_b.element); |
|---|
| 4380 |
Element.undoPositioned(_b.element.firstChild); |
|---|
| 4381 |
_b.element.firstChild.style.right=_8; |
|---|
| 4382 |
}},arguments[1]||{})); |
|---|
| 4383 |
}; |
|---|
| 4384 |
|
|---|
| 4385 |
SortableEx=Object.extend({},Sortable); |
|---|
| 4386 |
SortableEx=Object.extend(SortableEx,{selector:"sortable_selector",create:function(_1){ |
|---|
| 4387 |
_1=$(_1); |
|---|
| 4388 |
var _2=Object.extend({element:_1,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:_1,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:/(true\_\d+$|false\_\d+$)/,onStart:this._onStart.bind(this),onDrag:Prototype.emptyFunction,onEnd:this._onEnd.bind(this),onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction,sortFloat:false,selector:SortableEx.selector},arguments[1]||{}); |
|---|
| 4389 |
var _3=_2.onChange; |
|---|
| 4390 |
_2.onChange=function(_4){ |
|---|
| 4391 |
_3(_4); |
|---|
| 4392 |
this.setSelector(_4,_2.selector); |
|---|
| 4393 |
}.bind(this); |
|---|
| 4394 |
this.destroy(_1); |
|---|
| 4395 |
var _5={revert:true,scroll:_2.scroll,scrollSpeed:_2.scrollSpeed,scrollSensitivity:_2.scrollSensitivity,delay:_2.delay,ghosting:_2.ghosting,constraint:_2.constraint,handle:_2.handle,onStart:_2.onStart,onDrag:_2.onDrag,onEnd:_2.onEnd,selector:_2.selector}; |
|---|
| 4396 |
if(_2.starteffect){ |
|---|
| 4397 |
_5.starteffect=_2.starteffect; |
|---|
| 4398 |
} |
|---|
| 4399 |
if(_2.reverteffect){ |
|---|
| 4400 |
_5.reverteffect=_2.reverteffect; |
|---|
| 4401 |
}else{ |
|---|
| 4402 |
if(_2.ghosting){ |
|---|
| 4403 |
_5.reverteffect=function(_6){ |
|---|
| 4404 |
_6.style.top=0; |
|---|
| 4405 |
_6.style.left=0; |
|---|
| 4406 |
}; |
|---|
| 4407 |
} |
|---|
| 4408 |
} |
|---|
| 4409 |
if(_2.endeffect){ |
|---|
| 4410 |
_5.endeffect=_2.endeffect; |
|---|
| 4411 |
} |
|---|
| 4412 |
if(_2.zindex){ |
|---|
| 4413 |
_5.zindex=_2.zindex; |
|---|
| 4414 |
} |
|---|
| 4415 |
var _7={overlap:_2.overlap,containment:_2.containment,tree:_2.tree,hoverclass:_2.hoverclass,onHover:(_2.sortFloat)?rubricks.advanced_home.AdvancedHomeSortableEx.onHoverFloat:Sortable.onHover}; |
|---|
| 4416 |
var _8={onHover:Sortable.onEmptyHover,overlap:_2.overlap,containment:_2.containment,hoverclass:_2.hoverclass}; |
|---|
| 4417 |
Element.cleanWhitespace(_1); |
|---|
| 4418 |
_2.draggables=[]; |
|---|
| 4419 |
_2.droppables=[]; |
|---|
| 4420 |
if(_2.dropOnEmpty||_2.tree){ |
|---|
| 4421 |
Droppables.add(_1,_8); |
|---|
| 4422 |
_2.droppables.push(_1); |
|---|
| 4423 |
} |
|---|
| 4424 |
(this.findElements(_1,_2)||[]).each(function(e){ |
|---|
| 4425 |
var _a=_2.handle?$(e).down("."+_2.handle,0):e; |
|---|
| 4426 |
_2.draggables.push(new Draggable(e,Object.extend(_5,{handle:_a}))); |
|---|
| 4427 |
Droppables.add(e,_7); |
|---|
| 4428 |
if(_2.tree){ |
|---|
| 4429 |
e.treeNode=_1; |
|---|
| 4430 |
} |
|---|
| 4431 |
_2.droppables.push(e); |
|---|
| 4432 |
}); |
|---|
| 4433 |
if(_2.tree){ |
|---|
| 4434 |
(Sortable.findTreeElements(_1,_2)||[]).each(function(e){ |
|---|
| 4435 |
Droppables.add(e,_8); |
|---|
| 4436 |
e.treeNode=_1; |
|---|
| 4437 |
_2.droppables.push(e); |
|---|
| 4438 |
}); |
|---|
| 4439 |
} |
|---|
| 4440 |
this.sortables[_1.id]=_2; |
|---|
| 4441 |
Draggables.addObserver(new SortableObserver(_1,_2.onUpdate)); |
|---|
| 4442 |
},setSelector:function(_c,_d){ |
|---|
| 4443 |
var _e=_c.offsetWidth; |
|---|
| 4444 |
var _f=_c.offsetHeight; |
|---|
| 4445 |
var _10=Position.cumulativeOffset(_c); |
|---|
| 4446 |
var _11=Position.cumulativeOffset(Position.offsetParent($(_d))); |
|---|
| 4447 |
Element.setStyle(_d,{width:_e+"px",height:_f+"px",left:_10[0]-_11[0]-(parseInt(Element.getStyle(_c,"left"),10)||0)+"px",top:_10[1]-_11[1]-(parseInt(Element.getStyle(_c,"top"),10)||0)+"px"}); |
|---|
| 4448 |
},showSelector:function(_12,_13){ |
|---|
| 4449 |
$(_13).show(); |
|---|
| 4450 |
this.setSelector(_12.element,_13); |
|---|
| 4451 |
},hideSelector:function(_14){ |
|---|
| 4452 |
$(_14).hide(); |
|---|
| 4453 |
},onHoverFloat:function(_15,_16,_17){ |
|---|
| 4454 |
if(Element.isParent(_16,_15)){ |
|---|
| 4455 |
return; |
|---|
| 4456 |
} |
|---|
| 4457 |
if(_17>0.33&&_17<0.66&&Sortable.options(_16).tree){ |
|---|
| 4458 |
return; |
|---|
| 4459 |
}else{ |
|---|
| 4460 |
if(_17>0.5){ |
|---|
| 4461 |
Sortable.mark(_16,"before"); |
|---|
| 4462 |
if(_16.previousSibling!=_15){ |
|---|
| 4463 |
var _18=_15.parentNode; |
|---|
| 4464 |
var _19=_15.nextSibling; |
|---|
| 4465 |
_15.style.visibility="hidden"; |
|---|
| 4466 |
_16.parentNode.insertBefore(_15,_16); |
|---|
| 4467 |
_18.insertBefore(_16,_19); |
|---|
| 4468 |
if(_16.parentNode!=_18){ |
|---|
| 4469 |
Sortable.options(_18).onChange(_15); |
|---|
| 4470 |
} |
|---|
| 4471 |
Sortable.options(_16.parentNode).onChange(_15); |
|---|
| 4472 |
} |
|---|
| 4473 |
}else{ |
|---|
| 4474 |
Sortable.mark(_16,"after"); |
|---|
| 4475 |
var _1a=_16.nextSibling||null; |
|---|
| 4476 |
if(_1a!=_15){ |
|---|
| 4477 |
var _18=_15.parentNode; |
|---|
| 4478 |
var _19=_15.nextSibling; |
|---|
| 4479 |
_15.style.visibility="hidden"; |
|---|
| 4480 |
_16.parentNode.insertBefore(_15,_1a); |
|---|
| 4481 |
_18.insertBefore(_16,_19); |
|---|
| 4482 |
if(_16.parentNode!=_18){ |
|---|
| 4483 |
Sortable.options(_18).onChange(_15); |
|---|
| 4484 |
} |
|---|
| 4485 |
Sortable.options(_16.parentNode).onChange(_15); |
|---|
| 4486 |
} |
|---|
| 4487 |
} |
|---|
| 4488 |
} |
|---|
| 4489 |
},_onStart:function(_1b){ |
|---|
| 4490 |
if(UserAgent.isIE()){ |
|---|
| 4491 |
var _1c=$A(_1b.element.getElementsByTagName("select")); |
|---|
| 4492 |
_1c.each(function(_1d){ |
|---|
| 4493 |
Element.setStyle(_1d,{visibility:"hidden"}); |
|---|
| 4494 |
}); |
|---|
| 4495 |
} |
|---|
| 4496 |
this.showSelector(_1b,_1b.options.selector); |
|---|
| 4497 |
},_onEnd:function(_1e){ |
|---|
| 4498 |
if(UserAgent.isIE()){ |
|---|
| 4499 |
var _1f=$A(_1e.element.getElementsByTagName("select")); |
|---|
| 4500 |
_1f.each(function(_20){ |
|---|
| 4501 |
Element.setStyle(_20,{visibility:"visible"}); |
|---|
| 4502 |
}); |
|---|
| 4503 |
} |
|---|
| 4504 |
this.hideSelector(_1e.options.selector); |
|---|
| 4505 |
}}); |
|---|
| 4506 |
|
|---|
| 4507 |
var Switcher=Class.create(); |
|---|
| 4508 |
Switcher.classNames={open:"switcher_state_open",openActive:"switcher_state_open_active",close:"switcher_state_close",closeActive:"switcher_state_close_active",sw:"switcher_switch",title:"switcher_title",titleActive:"switcher_title_active"}; |
|---|
| 4509 |
Switcher.prototype={initialize:function(sw,_2){ |
|---|
| 4510 |
this.options=Object.extend({open:false,duration:0.4,beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,effect:false,cssPrefix:"custom_",subSwitch:[],mouseover:true,build:true},arguments[2]||{}); |
|---|
| 4511 |
this.sw=$(sw); |
|---|
| 4512 |
this.content=$(_2); |
|---|
| 4513 |
if(this.sw){ |
|---|
| 4514 |
this.swTitle=$(this.sw.id+"_title"); |
|---|
| 4515 |
} |
|---|
| 4516 |
var _3=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); |
|---|
| 4517 |
this.classNames=new CssUtil([Switcher.classNames,_3]); |
|---|
| 4518 |
if(this.options.build){ |
|---|
| 4519 |
if(this.options.open){ |
|---|
| 4520 |
Element.show(this.content); |
|---|
| 4521 |
this.classNames.addClassNames(this.sw,"open"); |
|---|
| 4522 |
}else{ |
|---|
| 4523 |
Element.hide(this.content); |
|---|
| 4524 |
this.classNames.addClassNames(this.sw,"close"); |
|---|
| 4525 |
} |
|---|
| 4526 |
var _4=[this.sw].concat(this.options.subSwitch); |
|---|
| 4527 |
this.setSwitch(_4); |
|---|
| 4528 |
} |
|---|
| 4529 |
},setSwitch:function(_5){ |
|---|
| 4530 |
_5=(_5.constructor==Array)?_5:[_5]; |
|---|
| 4531 |
_5.each(function(sw){ |
|---|
| 4532 |
this.classNames.addClassNames(sw,"sw"); |
|---|
| 4533 |
Event.observe(sw,"click",this.toggle.bindAsEventListener(this)); |
|---|
| 4534 |
if(this.options.mouseover){ |
|---|
| 4535 |
Event.observe(sw,"mouseover",this.mouseover.bindAsEventListener(this)); |
|---|
| 4536 |
Event.observe(sw,"mouseout",this.mouseout.bindAsEventListener(this)); |
|---|
| 4537 |
} |
|---|
| 4538 |
var _7=($(sw).id+"_title"); |
|---|
| 4539 |
if(_7){ |
|---|
| 4540 |
this.classNames.addClassNames(_7,"title"); |
|---|
| 4541 |
Event.observe(_7,"click",this.toggle.bindAsEventListener(this)); |
|---|
| 4542 |
} |
|---|
| 4543 |
}.bind(this)); |
|---|
| 4544 |
},mouseover:function(){ |
|---|
| 4545 |
if(Element.hasClassName(this.sw,Switcher.classNames.close)&&!Element.hasClassName(this.sw,Switcher.classNames.closeActive)){ |
|---|
| 4546 |
this.classNames.addClassNames(this.sw,"closeActive"); |
|---|
| 4547 |
}else{ |
|---|
| 4548 |
if(Element.hasClassName(this.sw,Switcher.classNames.open)&&!Element.hasClassName(this.sw,Switcher.classNames.openActive)){ |
|---|
| 4549 |
this.classNames.addClassNames(this.sw,"openActive"); |
|---|
| 4550 |
} |
|---|
| 4551 |
} |
|---|
| 4552 |
},mouseout:function(){ |
|---|
| 4553 |
this.classNames.removeClassNames(this.sw,"openActive"); |
|---|
| 4554 |
this.classNames.removeClassNames(this.sw,"closeActive"); |
|---|
| 4555 |
},mouseoverWithTitle:function(){ |
|---|
| 4556 |
this.mouseover(); |
|---|
| 4557 |
if(this.swTitle){ |
|---|
| 4558 |
this.classNames.addClassNames(this.swTitle,"titleActive"); |
|---|
| 4559 |
} |
|---|
| 4560 |
},mouseoutWithTitle:function(){ |
|---|
| 4561 |
this.mouseout(); |
|---|
| 4562 |
if(this.swTitle){ |
|---|
| 4563 |
this.classNames.removeClassNames(this.swTitle,"titleActive"); |
|---|
| 4564 |
} |
|---|
| 4565 |
},toggle:function(_8){ |
|---|
| 4566 |
if(Element.hasClassName(this.sw,Switcher.classNames.close)){ |
|---|
| 4567 |
this.open(); |
|---|
| 4568 |
}else{ |
|---|
| 4569 |
this.close(); |
|---|
| 4570 |
} |
|---|
| 4571 |
Event.stop(_8); |
|---|
| 4572 |
},open:function(){ |
|---|
| 4573 |
this.options.beforeOpen(this.content); |
|---|
| 4574 |
this.classNames.removeClassNames(this.sw,"close"); |
|---|
| 4575 |
this.classNames.addClassNames(this.sw,"open"); |
|---|
| 4576 |
if(Element.hasClassName(this.sw,Switcher.classNames.closeActive)){ |
|---|
| 4577 |
this.classNames.removeClassNames(this.sw,"closeActive"); |
|---|
| 4578 |
this.classNames.addClassNames(this.sw,"openActive"); |
|---|
| 4579 |
} |
|---|
| 4580 |
if(this.options.effect){ |
|---|
| 4581 |
new Effect.BlindDown(this.content,{duration:this.options.duration}); |
|---|
| 4582 |
}else{ |
|---|
| 4583 |
Element.show(this.content); |
|---|
| 4584 |
} |
|---|
| 4585 |
this.options.afterOpen(this.content); |
|---|
| 4586 |
},close:function(){ |
|---|
| 4587 |
this.options.beforeClose(this.content); |
|---|
| 4588 |
this.classNames.removeClassNames(this.sw,"open"); |
|---|
| 4589 |
this.classNames.addClassNames(this.sw,"close"); |
|---|
| 4590 |
if(Element.hasClassName(this.sw,Switcher.classNames.openActive)){ |
|---|
| 4591 |
this.classNames.removeClassNames(this.sw,"openActive"); |
|---|
| 4592 |
this.classNames.addClassNames(this.sw,"closeActive"); |
|---|
| 4593 |
} |
|---|
| 4594 |
if(this.options.effect){ |
|---|
| 4595 |
new Effect.BlindUp(this.content,{duration:this.options.duration}); |
|---|
| 4596 |
}else{ |
|---|
| 4597 |
Element.hide(this.content); |
|---|
| 4598 |
} |
|---|
| 4599 |
this.options.afterClose(this.content); |
|---|
| 4600 |
}}; |
|---|
| 4601 |
Switcher.common=new Switcher(null,null,{build:false}); |
|---|
| 4602 |
Switcher.common.originalOptions=Switcher.common.options; |
|---|
| 4603 |
Object.extend(Switcher.common,{mouseoverWithTitle:function(sw,_a){ |
|---|
| 4604 |
this._init(sw,null,_a); |
|---|
| 4605 |
Switcher.prototype.mouseover.call(this); |
|---|
| 4606 |
this.classNames.addClassNames($(this.sw.id+"_title"),"titleActive"); |
|---|
| 4607 |
},mouseoutWithTitle:function(sw,_c){ |
|---|
| 4608 |
this._init(sw,null,_c); |
|---|
| 4609 |
Switcher.prototype.mouseout.call(this); |
|---|
| 4610 |
this.classNames.removeClassNames($(this.sw.id+"_title"),"titleActive"); |
|---|
| 4611 |
},toggle:function(_d,sw,_f,_10){ |
|---|
| 4612 |
this._init(sw,_f,_10); |
|---|
| 4613 |
if(Element.hasClassName(this.sw,Switcher.classNames.close)){ |
|---|
| 4614 |
Switcher.prototype.open.call(this); |
|---|
| 4615 |
}else{ |
|---|
| 4616 |
Switcher.prototype.close.call(this); |
|---|
| 4617 |
} |
|---|
| 4618 |
Event.stop(_d); |
|---|
| 4619 |
},open:function(sw,_12,_13){ |
|---|
| 4620 |
this._init(sw,_12,_13); |
|---|
| 4621 |
Switcher.prototype.open.call(this); |
|---|
| 4622 |
},close:function(sw,_15,_16){ |
|---|
| 4623 |
this._init(sw,_15,_16); |
|---|
| 4624 |
Switcher.prototype.close.call(this); |
|---|
| 4625 |
},_init:function(sw,_18,_19){ |
|---|
| 4626 |
this.sw=$(sw); |
|---|
| 4627 |
this.content=$(_18); |
|---|
| 4628 |
if(_19){ |
|---|
| 4629 |
this.options=Object.extend(Object.clone(this.originalOptions),_19); |
|---|
| 4630 |
} |
|---|
| 4631 |
var _1a=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); |
|---|
| 4632 |
this.classNames=new CssUtil([Switcher.classNames,_1a]); |
|---|
| 4633 |
}}); |
|---|
| 4634 |
|
|---|
| 4635 |
TabBox=Class.create(); |
|---|
| 4636 |
TabBox.className={tabBox:"tabBox_tabBox",panelContainer:"tabBox_panelContainer",tabContainer:"tabBox_tabContainer",tabBar:"tabBox_tabBar",tab:"tabBox_tab",tabLeftInactive:"tabBox_tabLeftInactive",tabLeftActive:"tabBox_tabLeftActive",tabMiddleInactive:"tabBox_tabMiddleInactive",tabMiddleActive:"tabBox_tabMiddleActive",tabRightInactive:"tabBox_tabRightInactive",tabRightActive:"tabBox_tabRightActive",tabTitle:"tabBox_tabTitle",closeButton:"tabBox_closeButton"}; |
|---|
| 4637 |
TabBox.prototype={initialize:function(_1){ |
|---|
| 4638 |
var _2=Object.extend({selected:1,cssPrefix:"custom_",beforeSelect:function(){ |
|---|
| 4639 |
return true; |
|---|
| 4640 |
},afterSelect:Prototype.emptyFunction,afterSelectOnce:Prototype.emptyFunction,onRemove:function(){ |
|---|
| 4641 |
return true; |
|---|
| 4642 |
},sortable:false,closeButton:false,afterSort:Prototype.emptyFunction,onSort:Prototype.emptyFunction,lazyLoadUrl:[],onLazyLoad:Prototype.emptyFunction,afterLazyLoad:Prototype.emptyFunction,lazyLoadFailure:Prototype.emptyFunction,failureLimitOver:Prototype.emptyFunction,failureLimit:5,tabRow:null,titleLength:null,build:true},arguments[1]||{}); |
|---|
| 4643 |
this.options=_2; |
|---|
| 4644 |
this.element=$(_1); |
|---|
| 4645 |
if(this.options.build){ |
|---|
| 4646 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 4647 |
Element.hide(this.element); |
|---|
| 4648 |
} |
|---|
| 4649 |
this.selected=(this.options.selected>0)?this.options.selected-1:0; |
|---|
| 4650 |
this.css=CssUtil.getInstance(this.options.cssPrefix,TabBox.className); |
|---|
| 4651 |
this.classNames=this.css.allJoinClassNames(); |
|---|
| 4652 |
this.css.addClassNames(this.element,"tabBox"); |
|---|
| 4653 |
this.start(); |
|---|
| 4654 |
if(this.options.build){ |
|---|
| 4655 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 4656 |
Element.show(this.element); |
|---|
| 4657 |
} |
|---|
| 4658 |
if(this.options.lazyLoadUrl.length>0){ |
|---|
| 4659 |
this.lazyLoad(0); |
|---|
| 4660 |
} |
|---|
| 4661 |
},start:function(){ |
|---|
| 4662 |
this.tabs=[]; |
|---|
| 4663 |
this.panelList=[]; |
|---|
| 4664 |
this.tabId=this.element.id+"_tab"; |
|---|
| 4665 |
this.tabLeftId=this.tabId+"_left"; |
|---|
| 4666 |
this.tabMiddleId=this.tabId+"_middle"; |
|---|
| 4667 |
this.tabRightId=this.tabId+"_right"; |
|---|
| 4668 |
this.tabContainerId=this.element.id+"_tabContainer"; |
|---|
| 4669 |
this.panelId=this.element.id+"_panel"; |
|---|
| 4670 |
this.panelContainerId=this.element.id+"_panelContainer"; |
|---|
| 4671 |
this.tabTitleId=this.element.id+"_tabTitle"; |
|---|
| 4672 |
this.ids=[]; |
|---|
| 4673 |
this.holder=[]; |
|---|
| 4674 |
if(this.options.build){ |
|---|
| 4675 |
this.build(); |
|---|
| 4676 |
} |
|---|
| 4677 |
this.tabs=this.tabs.collect(function(_3){ |
|---|
| 4678 |
return $(_3); |
|---|
| 4679 |
}); |
|---|
| 4680 |
this.panelList=this.panelList.collect(function(_4){ |
|---|
| 4681 |
return $(_4); |
|---|
| 4682 |
}); |
|---|
| 4683 |
this.tabContainer=$(this.tabContainerId); |
|---|
| 4684 |
this.panelContainer=$(this.panelContainerId); |
|---|
| 4685 |
if(this.options.build){ |
|---|
| 4686 |
this.selectTab(); |
|---|
| 4687 |
this.setEvent(); |
|---|
| 4688 |
this.appendElements(); |
|---|
| 4689 |
if(this.options.sortable){ |
|---|
| 4690 |
this.setDrag(); |
|---|
| 4691 |
} |
|---|
| 4692 |
} |
|---|
| 4693 |
},setDrag:function(){ |
|---|
| 4694 |
Sortable.create(this.tabContainerId,{tag:"div",overlap:"horizontal",constraint:"horizontal",onChange:function(_5){ |
|---|
| 4695 |
this.options.onSort(_5); |
|---|
| 4696 |
this._setBrTag(); |
|---|
| 4697 |
}.bind(this),onUpdate:this.options.afterSort,starteffect:Prototype.emptyFunction,endeffect:Prototype.emptyFunction}); |
|---|
| 4698 |
},setEvent:function(){ |
|---|
| 4699 |
this.ids.each(function(_6){ |
|---|
| 4700 |
Event.observe(_6.tab,"click",this.selectTab.bindAsEventListener(this)); |
|---|
| 4701 |
Event.observe(_6.tab,"mouseover",this.onMouseOver.bindAsEventListener(this)); |
|---|
| 4702 |
Event.observe(_6.tab,"mouseout",this.onMouseOut.bindAsEventListener(this)); |
|---|
| 4703 |
if(this.options.closeButton){ |
|---|
| 4704 |
Event.observe(_6.button,"click",this.onRemove.bindAsEventListener(this)); |
|---|
| 4705 |
} |
|---|
| 4706 |
}.bind(this)); |
|---|
| 4707 |
},appendElements:function(){ |
|---|
| 4708 |
this.holder.each(function(_7){ |
|---|
| 4709 |
$(this.tabTitleId+_7.number).appendChild(_7.tab); |
|---|
| 4710 |
$(this.panelId+_7.number).appendChild(_7.content); |
|---|
| 4711 |
}.bind(this)); |
|---|
| 4712 |
},build:function(){ |
|---|
| 4713 |
var _8=(UserAgent.isIE7())?" style='height: auto;'":""; |
|---|
| 4714 |
var _9="<div id='"+this.tabContainerId+"' class='"+this.classNames["tabContainer"]+"'"+_8+">"; |
|---|
| 4715 |
var _a="<div id='"+this.panelContainerId+"' class='"+this.classNames["panelContainer"]+"'>"; |
|---|
| 4716 |
var _b=0; |
|---|
| 4717 |
$A(this.element.childNodes).each(function(_c){ |
|---|
| 4718 |
if(Element.isElementNode(_c)){ |
|---|
| 4719 |
var _d=this.buildTabSet(_c,_b); |
|---|
| 4720 |
_9+=_d.tab; |
|---|
| 4721 |
_a+=_d.panel; |
|---|
| 4722 |
_b++; |
|---|
| 4723 |
} |
|---|
| 4724 |
}.bind(this)); |
|---|
| 4725 |
_9+="</div>"; |
|---|
| 4726 |
_a+="</div>"; |
|---|
| 4727 |
this.element.innerHTML=_9+"<div class='"+this.classNames["tabBar"]+"'></div>"+_a; |
|---|
| 4728 |
},buildTabSet:function(_e,i,_10){ |
|---|
| 4729 |
var _11=Element.getChildNodesWithoutWhitespace(_e); |
|---|
| 4730 |
this.holdElements(_11[0],_11[1],i); |
|---|
| 4731 |
return {tab:this.buildTab(_11[0],i,Element.attributeHTML(_e,"onclick"),_10),panel:this.buildPanel(_11[1],i,_10)}; |
|---|
| 4732 |
},buildTab:function(tab,i,_14,_15){ |
|---|
| 4733 |
_15=_15||i; |
|---|
| 4734 |
var _16=this.tabId+i; |
|---|
| 4735 |
var ids={tab:_16}; |
|---|
| 4736 |
this.ids.push(ids); |
|---|
| 4737 |
this.tabs[_15]=_16; |
|---|
| 4738 |
var _18=""; |
|---|
| 4739 |
if(this.options.closeButton){ |
|---|
| 4740 |
var _19=this.element.id.appendSuffix("closeButton_"+i); |
|---|
| 4741 |
ids.button=_19; |
|---|
| 4742 |
_18="<div id='"+_19+"' class='"+this.classNames["closeButton"]+"'></div>"; |
|---|
| 4743 |
} |
|---|
| 4744 |
var _1a=""; |
|---|
| 4745 |
var br=""; |
|---|
| 4746 |
if(this.options.tabRow&&!isNaN(this.options.tabRow)&&((_15.succ()%this.options.tabRow)==0)){ |
|---|
| 4747 |
br="<br style=\"clear: both;\" />"; |
|---|
| 4748 |
} |
|---|
| 4749 |
var _1c=this.getTabText(tab); |
|---|
| 4750 |
this.setTabText(tab,this.chopTabText(_1c)); |
|---|
| 4751 |
var _1d="<div id='"+_16+"' class='"+this.classNames["tab"]+"'"+_1a+" "+_14+">"+"<div id='"+this.tabLeftId+i+"' class='"+this.classNames["tabLeftInactive"]+"'></div>"+"<div id='"+this.tabMiddleId+i+"' class='"+this.classNames["tabMiddleInactive"]+"'>"+"<div id=\""+this.tabTitleId+i+"\" class=\""+this.classNames["tabTitle"]+"\" title=\""+_1c+"\">"+"</div>"+_18+"</div>"+"<div id='"+this.tabRightId+i+"' class='"+this.classNames["tabRightInactive"]+"'></div>"+"</div>"+br; |
|---|
| 4752 |
return _1d; |
|---|
| 4753 |
},setTabText:function(_1e,_1f){ |
|---|
| 4754 |
if(Element.isTextNode(_1e)){ |
|---|
| 4755 |
_1e.nodeValue=_1f; |
|---|
| 4756 |
}else{ |
|---|
| 4757 |
if(Element.isElementNode(_1e)){ |
|---|
| 4758 |
_1e.innerHTML=_1f; |
|---|
| 4759 |
} |
|---|
| 4760 |
} |
|---|
| 4761 |
},getTabText:function(_20){ |
|---|
| 4762 |
var _21=null; |
|---|
| 4763 |
if(Element.isTextNode(_20)){ |
|---|
| 4764 |
_21=_20.nodeValue; |
|---|
| 4765 |
}else{ |
|---|
| 4766 |
if(Element.isElementNode(_20)){ |
|---|
| 4767 |
_21=Element.collectTextNodes(_20); |
|---|
| 4768 |
}else{ |
|---|
| 4769 |
_21=""; |
|---|
| 4770 |
} |
|---|
| 4771 |
} |
|---|
| 4772 |
return _21.escapeHTML().replace(/"/g,""").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); |
|---|
| 4773 |
},chopTabText:function(_22){ |
|---|
| 4774 |
_22=_22.unescapeHTML(); |
|---|
| 4775 |
var _23=this.options.titleLength; |
|---|
| 4776 |
if(_23&&!isNaN(_23)&&(_22.length>_23)){ |
|---|
| 4777 |
_22=_22.truncate(_23+3); |
|---|
| 4778 |
} |
|---|
| 4779 |
return _22.escapeHTML(); |
|---|
| 4780 |
},buildPanel:function(_24,i,_26){ |
|---|
| 4781 |
_26=_26||i; |
|---|
| 4782 |
var id=this.panelId+i; |
|---|
| 4783 |
this.panelList[_26]=id; |
|---|
| 4784 |
return "<div id='"+id+"' style='display: none;'></div>"; |
|---|
| 4785 |
},holdElements:function(tab,_29,_2a){ |
|---|
| 4786 |
this.holder.push({number:_2a,tab:tab,content:_29}); |
|---|
| 4787 |
var _2b=document.createDocumentFragment(); |
|---|
| 4788 |
_2b.appendChild(tab); |
|---|
| 4789 |
_2b.appendChild(_29); |
|---|
| 4790 |
},selectTab:function(e){ |
|---|
| 4791 |
if(!e){ |
|---|
| 4792 |
if(!this._callBeforeSelect(this.panelList[this.selected])){ |
|---|
| 4793 |
return; |
|---|
| 4794 |
} |
|---|
| 4795 |
this.setTabActive(this.tabs[this.selected]); |
|---|
| 4796 |
Element.show(this.panelList[this.selected]); |
|---|
| 4797 |
return; |
|---|
| 4798 |
} |
|---|
| 4799 |
var _2d=this.getCurrentPanel(); |
|---|
| 4800 |
var _2e=this.getCurrentTab(); |
|---|
| 4801 |
var _2f=null; |
|---|
| 4802 |
if(e.nodeType){ |
|---|
| 4803 |
_2f=e; |
|---|
| 4804 |
}else{ |
|---|
| 4805 |
_2f=Event.element(e); |
|---|
| 4806 |
} |
|---|
| 4807 |
var _30=this.getTargetIndex(_2f); |
|---|
| 4808 |
if(_30==this.selected){ |
|---|
| 4809 |
return; |
|---|
| 4810 |
} |
|---|
| 4811 |
var _31=this.panelList[_30]; |
|---|
| 4812 |
var _32=this.tabs[_30]; |
|---|
| 4813 |
if(this._callBeforeSelect(_31)){ |
|---|
| 4814 |
if(_2e){ |
|---|
| 4815 |
this.setTabInactive(_2e); |
|---|
| 4816 |
} |
|---|
| 4817 |
this.setTabActive(_32); |
|---|
| 4818 |
if(_2d){ |
|---|
| 4819 |
Element.hide(_2d); |
|---|
| 4820 |
} |
|---|
| 4821 |
Element.show(_31); |
|---|
| 4822 |
this.selected=_30; |
|---|
| 4823 |
this._callAfterSelect(_31,_2d); |
|---|
| 4824 |
if(!_31.selected){ |
|---|
| 4825 |
this._callAfterSelectOnce(_31); |
|---|
| 4826 |
_31.selected=true; |
|---|
| 4827 |
} |
|---|
| 4828 |
} |
|---|
| 4829 |
},setTabActive:function(tab){ |
|---|
| 4830 |
if(!$(tab)){ |
|---|
| 4831 |
return; |
|---|
| 4832 |
} |
|---|
| 4833 |
var _34=$(tab).immediateDescendants(); |
|---|
| 4834 |
this.css.refreshClassNames(_34[0],"tabLeftActive"); |
|---|
| 4835 |
this.css.refreshClassNames(_34[1],"tabMiddleActive"); |
|---|
| 4836 |
this.css.refreshClassNames(_34[2],"tabRightActive"); |
|---|
| 4837 |
},setTabInactive:function(tab){ |
|---|
| 4838 |
if(!$(tab)){ |
|---|
| 4839 |
return; |
|---|
| 4840 |
} |
|---|
| 4841 |
var _36=$(tab).immediateDescendants(); |
|---|
| 4842 |
this.css.refreshClassNames(_36[0],"tabLeftInactive"); |
|---|
| 4843 |
this.css.refreshClassNames(_36[1],"tabMiddleInactive"); |
|---|
| 4844 |
this.css.refreshClassNames(_36[2],"tabRightInactive"); |
|---|
| 4845 |
},getTargetIndex:function(_37){ |
|---|
| 4846 |
while(_37){ |
|---|
| 4847 |
if(_37.id&&_37.id.indexOf(this.tabId,0)>=0){ |
|---|
| 4848 |
var _38=_37.id.substring(this.tabId.length); |
|---|
| 4849 |
if(!isNaN(_38)){ |
|---|
| 4850 |
return this.tabs.indexOf(_37); |
|---|
| 4851 |
} |
|---|
| 4852 |
} |
|---|
| 4853 |
_37=_37.parentNode; |
|---|
| 4854 |
} |
|---|
| 4855 |
},onRemove:function(_39){ |
|---|
| 4856 |
Event.stop(_39); |
|---|
| 4857 |
var _3a=Event.element(_39); |
|---|
| 4858 |
var _3b=this.getTargetIndex(_3a); |
|---|
| 4859 |
var tab=this.tabs[_3b]; |
|---|
| 4860 |
if(r=this.options.onRemove(tab)){ |
|---|
| 4861 |
this.remove(tab); |
|---|
| 4862 |
} |
|---|
| 4863 |
},remove:function(tab){ |
|---|
| 4864 |
if(tab){ |
|---|
| 4865 |
var _3e=tab.parentNode; |
|---|
| 4866 |
var _3f=this.getTargetIndex(tab); |
|---|
| 4867 |
var _40=this.getNextTab(); |
|---|
| 4868 |
if(!_40){ |
|---|
| 4869 |
_40=this.getPreviousTab(); |
|---|
| 4870 |
} |
|---|
| 4871 |
var _41=this.tabs[this.selected]; |
|---|
| 4872 |
Element.remove(tab); |
|---|
| 4873 |
Element.remove(this.panelList[_3f]); |
|---|
| 4874 |
this.tabs[_3f]=null; |
|---|
| 4875 |
this.panelList[_3f]=null; |
|---|
| 4876 |
this.tabs=this.tabs.select(function(t){ |
|---|
| 4877 |
return t; |
|---|
| 4878 |
}); |
|---|
| 4879 |
this.panelList=this.panelList.select(function(t){ |
|---|
| 4880 |
return t; |
|---|
| 4881 |
}); |
|---|
| 4882 |
if(_3f==this.selected){ |
|---|
| 4883 |
if(_40){ |
|---|
| 4884 |
this.selected=null; |
|---|
| 4885 |
this.selectTab(_40); |
|---|
| 4886 |
} |
|---|
| 4887 |
}else{ |
|---|
| 4888 |
this.selected=this.getTargetIndex(_41); |
|---|
| 4889 |
} |
|---|
| 4890 |
this._setBrTag(); |
|---|
| 4891 |
} |
|---|
| 4892 |
},addByElement:function(_44){ |
|---|
| 4893 |
this.holder=[]; |
|---|
| 4894 |
this.ids=[]; |
|---|
| 4895 |
this.contents=[]; |
|---|
| 4896 |
var _45=0; |
|---|
| 4897 |
var _46=this.getLastTab(); |
|---|
| 4898 |
if(_46){ |
|---|
| 4899 |
_45=parseInt(_46.id.match(/[0-9]+$/)[0],10).succ(); |
|---|
| 4900 |
} |
|---|
| 4901 |
var _47=this.buildTabSet($(_44),_45,this.tabs.length); |
|---|
| 4902 |
var _48=_47.tab.toElements(); |
|---|
| 4903 |
this.tabContainer.appendChild(_48[0]); |
|---|
| 4904 |
if(_48[1]){ |
|---|
| 4905 |
this.tabContainer.appendChild(_48[1]); |
|---|
| 4906 |
} |
|---|
| 4907 |
this.panelContainer.appendChild(_47.panel.toElement()); |
|---|
| 4908 |
this.tabs[this.tabs.length-1]=$(this.tabs.last()); |
|---|
| 4909 |
this.panelList[this.panelList.length-1]=$(this.panelList.last()); |
|---|
| 4910 |
this.setEvent(); |
|---|
| 4911 |
this.appendElements(); |
|---|
| 4912 |
if(this.options.sortable){ |
|---|
| 4913 |
this.setDrag(); |
|---|
| 4914 |
} |
|---|
| 4915 |
},add:function(_49,_4a){ |
|---|
| 4916 |
var _4b=[]; |
|---|
| 4917 |
var _4c=Builder.node("div"); |
|---|
| 4918 |
_4c.innerHTML=_49; |
|---|
| 4919 |
_4b.push(_4c); |
|---|
| 4920 |
_4c=Builder.node("div"); |
|---|
| 4921 |
_4c.innerHTML=_4a; |
|---|
| 4922 |
_4b.push(_4c); |
|---|
| 4923 |
this.addByElement(Builder.node("div",_4b)); |
|---|
| 4924 |
},lazyLoad:function(_4d){ |
|---|
| 4925 |
this.errorCount=0; |
|---|
| 4926 |
this.loadedList=[]; |
|---|
| 4927 |
this.load(_4d); |
|---|
| 4928 |
},load:function(_4e){ |
|---|
| 4929 |
var _4f=this.panelList[_4e]; |
|---|
| 4930 |
var url=this.options.lazyLoadUrl[_4e]; |
|---|
| 4931 |
var _51=this; |
|---|
| 4932 |
if(_4f&&url){ |
|---|
| 4933 |
new Ajax.Updater({success:_4f},url,{onSuccess:function(){ |
|---|
| 4934 |
_51.setLoaded(_4e); |
|---|
| 4935 |
_51.options.onLazyLoad(_4f,_51); |
|---|
| 4936 |
_51.load(++_4e); |
|---|
| 4937 |
if(_51.isFinishLazyLoad()){ |
|---|
| 4938 |
_51.options.afterLazyLoad(_51); |
|---|
| 4939 |
} |
|---|
| 4940 |
},onFailure:function(){ |
|---|
| 4941 |
_51.errorCount++; |
|---|
| 4942 |
_51.options.lazyLoadFailure(_4f,_51); |
|---|
| 4943 |
if(_51.errorCount<=_51.options.failureLimit){ |
|---|
| 4944 |
_51.load(_4e); |
|---|
| 4945 |
}else{ |
|---|
| 4946 |
_51.options.failureLimitOver(_51); |
|---|
| 4947 |
} |
|---|
| 4948 |
},asynchronous:true,evalScripts:true}); |
|---|
| 4949 |
} |
|---|
| 4950 |
},isFinishLazyLoad:function(){ |
|---|
| 4951 |
return this.loadedList.length==this.panelList.length; |
|---|
| 4952 |
},setLoaded:function(i){ |
|---|
| 4953 |
this.loadedList.push(i); |
|---|
| 4954 |
},onMouseOver:function(_53){ |
|---|
| 4955 |
var _54=Event.element(_53); |
|---|
| 4956 |
var _55=this.getTargetIndex(_54); |
|---|
| 4957 |
if(_55!=this.selected){ |
|---|
| 4958 |
var _56=this.tabs[_55]; |
|---|
| 4959 |
this.setTabActive(_56); |
|---|
| 4960 |
} |
|---|
| 4961 |
},onMouseOut:function(_57){ |
|---|
| 4962 |
var _58=Event.element(_57); |
|---|
| 4963 |
var _59=this.getTargetIndex(_58); |
|---|
| 4964 |
if(_59!=this.selected){ |
|---|
| 4965 |
var _5a=this.tabs[_59]; |
|---|
| 4966 |
this.setTabInactive(_5a); |
|---|
| 4967 |
} |
|---|
| 4968 |
},hasNextTab:function(){ |
|---|
| 4969 |
return this.getNextTab()?true:false; |
|---|
| 4970 |
},hasPreviousTab:function(){ |
|---|
| 4971 |
return this.getPreviousTab()?true:false; |
|---|
| 4972 |
},getNextTab:function(tab){ |
|---|
| 4973 |
var e=Element.next(tab||this.getCurrentTab()); |
|---|
| 4974 |
return (e&&e.tagName.toLowerCase()=="br")?this.getNextTab(e):e; |
|---|
| 4975 |
},getPreviousTab:function(tab){ |
|---|
| 4976 |
var e=Element.previous(tab||this.getCurrentTab()); |
|---|
| 4977 |
return (e&&e.tagName.toLowerCase()=="br")?this.getPreviousTab(e):e; |
|---|
| 4978 |
},selectNextTab:function(){ |
|---|
| 4979 |
this.selectTab(this.getNextTab()); |
|---|
| 4980 |
},selectPreviousTab:function(){ |
|---|
| 4981 |
this.selectTab(this.getPreviousTab()); |
|---|
| 4982 |
},tabCount:function(){ |
|---|
| 4983 |
return this.tabs.inject(0,function(i,t){ |
|---|
| 4984 |
return t?++i:i; |
|---|
| 4985 |
}); |
|---|
| 4986 |
},getCurrentPanel:function(){ |
|---|
| 4987 |
return this.panelList[this.selected]; |
|---|
| 4988 |
},getCurrentTab:function(){ |
|---|
| 4989 |
return this.tabs[this.selected]; |
|---|
| 4990 |
},getLastTab:function(){ |
|---|
| 4991 |
return this.tabs.last(); |
|---|
| 4992 |
},_callBeforeSelect:function(_61){ |
|---|
| 4993 |
var _62=this._findCallback(this.options.beforeSelect,_61); |
|---|
| 4994 |
return (_62)?_62():true; |
|---|
| 4995 |
},_callAfterSelect:function(_63,_64){ |
|---|
| 4996 |
var _65=this._findCallback(this.options.afterSelect,_63); |
|---|
| 4997 |
if(_65){ |
|---|
| 4998 |
_65(_63,_64); |
|---|
| 4999 |
} |
|---|
| 5000 |
},_callAfterSelectOnce:function(_66){ |
|---|
| 5001 |
var _67=this._findCallback(this.options.afterSelectOnce,_66); |
|---|
| 5002 |
if(_67){ |
|---|
| 5003 |
_67(_66); |
|---|
| 5004 |
} |
|---|
| 5005 |
},_findCallback:function(_68,_69){ |
|---|
| 5006 |
if(!_68){ |
|---|
| 5007 |
return; |
|---|
| 5008 |
} |
|---|
| 5009 |
if(_68.constructor!=Function){ |
|---|
| 5010 |
if(_68.constructor==Array){ |
|---|
| 5011 |
_68=_68[this.panelList.indexOf(_69)]; |
|---|
| 5012 |
}else{ |
|---|
| 5013 |
_68=_68[this.panelList.indexOf(_69).succ()]; |
|---|
| 5014 |
} |
|---|
| 5015 |
} |
|---|
| 5016 |
return _68; |
|---|
| 5017 |
},_setBrTag:function(){ |
|---|
| 5018 |
if(this.options.tabRow){ |
|---|
| 5019 |
var _6a=this.tabContainer; |
|---|
| 5020 |
var _6b=[]; |
|---|
| 5021 |
var brs=[]; |
|---|
| 5022 |
Element.getTagNodes(_6a).each(function(n){ |
|---|
| 5023 |
((n.tagName.toLowerCase()=="div")?_6b:brs).push(n); |
|---|
| 5024 |
}); |
|---|
| 5025 |
_6b.each(function(t,i){ |
|---|
| 5026 |
if((i.succ()%this.options.tabRow)==0){ |
|---|
| 5027 |
if(brs[0]){ |
|---|
| 5028 |
_6a.insertBefore(brs[0],t.nextSibling); |
|---|
| 5029 |
brs.shift(); |
|---|
| 5030 |
}else{ |
|---|
| 5031 |
_6a.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); |
|---|
| 5032 |
} |
|---|
| 5033 |
} |
|---|
| 5034 |
}.bind(this)); |
|---|
| 5035 |
(brs||[]).each(function(b){ |
|---|
| 5036 |
Element.remove(b); |
|---|
| 5037 |
}); |
|---|
| 5038 |
} |
|---|
| 5039 |
}}; |
|---|
| 5040 |
|
|---|
| 5041 |
var TimePicker=Class.create(); |
|---|
| 5042 |
TimePicker.className={container:"timepicker_container",header:"timepicker_header",preYears:"timepicker_preYears",nextYears:"timepicker_nextYears",years:"timepicker_years",mark:"timepicker_mark",ym:"timepicker_ym",table:"timepicker_table",thRight:"right",tdRight:"right",tdBottom:"bottom",date:"timepicker_date",holiday:"timepicker_holiday",regularHoliday:"timepicker_regularHoliday",schedule:"timepicker_schedule",highlightDay:"timepicker_highlightDay",scheduleListContainer:"timepicker_scheduleListContainer",scheduleItem:"timepicker_scheduleItem",scheduleTimeArea:"timepicker_scheduleItemTimeArea",scheduleHandler:"timepicker_scheduleHandler",holidayName:"timepicker_holidayName",dateContainer:"timepicker_dateContainer",tableHeader:"timepicker_tableHeader",rowContent:"timepicker_rowContent",selected:"timepicker_selected",displayToggle:"timepicker_displayToggle",nextYearMark:"timepicker_nextYearMark",nextMonthMark:"timepicker_nextMonthMark",nextWeekMark:"timepicker_nextWeekMark",preYearMark:"timepicker_preYearMark",preMonthMark:"timepicker_preMonthMark",preWeekMark:"timepicker_preWeekMark",weekTable:"timepicker_weekContainerTable",weekMainTable:"timepicker_weekMainTable",timeLine:"timepicker_timeline",timeLineTimeTop:"timepicker_timelineTimeTop",timeLineTime:"timepicker_timelineTime",timeLineTimeIe7:"timepicker_timelineTime_ie7",timeLineTimeIe:"timepicker_timelineTime_ie",timeLineTimeIeTop:"timepicker_timelineTime_ieTop",headerColumn:"timepicker_headerColumn",columnTopDate:"timepicker_columnTopDate",columnDate:"timepicker_columnDate",columnDateOdd:"timepicker_columnOddDate",scheduleItemSamll:"timepicker_scheduleItemSmall",scheduleItemLarge:"timepicker_scheduleItemLarge",scheduleItemSelect:"timepicker_scheduleItemSelect",deleteImg:"timepicker_deleteImage",privateImg:"timepicker_privateImage",scheduleContainer:"timepicker_weekScheduleContainer",selector:"timepicker_selector",cover:"timepicker_cover"}; |
|---|
| 5043 |
Object.extend(TimePicker.prototype,Calendar.prototype); |
|---|
| 5044 |
Object.extend(TimePicker.prototype,{initialize:function(_1){ |
|---|
| 5045 |
this.options=Object.extend({initDate:new Date(),cssPrefix:"custom_",holidays:[],schedules:[],size:Calendar.size.large,regularHoliday:[0,6],displayIndexes:[0,1,2,3,4,5,6],displayTime:[{hour:0,min:0},{hour:24,min:0}],weekIndex:0,dblclickListener:null,afterSelect:Prototype.emptyFunction,beforeRefresh:Prototype.emptyFunction,changeSchedule:Prototype.emptyFunction,changeCalendar:Prototype.emptyFunction,displayType:"month",highlightDay:true,beforeRemoveSchedule:function(){ |
|---|
| 5046 |
return true; |
|---|
| 5047 |
},dblclickSchedule:null,updateTirm:Prototype.emptyFunction,displayTimeLine:true,clickDateText:null,getMonthHeaderText:Prototype.emptyFunction,getMonthSubHeaderText:Prototype.emptyFunction,getWeekHeaderText:Prototype.emptyFunction,getWeekSubHeaderText:Prototype.emptyFunction,getDayHeaderText:Prototype.emptyFunction,setPosition:true,headerTitle:"",standardTime:false,oneDayLabel:"24H",standardTimeLabel:"standard",build:true},arguments[1]||{}); |
|---|
| 5048 |
if(this.options.standardTime){ |
|---|
| 5049 |
this.options.displayTime=this.options.standardTime; |
|---|
| 5050 |
this.options.oneDay=[{hour:0,min:0},{hour:24,min:0}]; |
|---|
| 5051 |
} |
|---|
| 5052 |
this.element=$(_1); |
|---|
| 5053 |
this.date=new Date(); |
|---|
| 5054 |
this.css=CssUtil.getInstance(this.options.cssPrefix,TimePicker.className); |
|---|
| 5055 |
this.classNames=this.css.allJoinClassNames(); |
|---|
| 5056 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 5057 |
this.builder=new TimePickerBuilder(this); |
|---|
| 5058 |
this.builder.beforeBuild(); |
|---|
| 5059 |
this.element.innerHTML=this.builder.build(); |
|---|
| 5060 |
this.builder.afterBuild(); |
|---|
| 5061 |
this.builder.setEvent(); |
|---|
| 5062 |
Element.hide(_1); |
|---|
| 5063 |
Element.setStyle(this.element,{position:"absolute"}); |
|---|
| 5064 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 5065 |
this.mouseupListener=this.onMouseUp.bindAsEventListener(this); |
|---|
| 5066 |
Event.observe(document,"mouseup",this.mouseupListener); |
|---|
| 5067 |
},destroy:function(){ |
|---|
| 5068 |
Event.stopObserving(document,"mouseup",this.mouseupListener); |
|---|
| 5069 |
},refresh:function(){ |
|---|
| 5070 |
this.options.beforeRefresh(this); |
|---|
| 5071 |
this.destroy(); |
|---|
| 5072 |
this.selectedBase=null; |
|---|
| 5073 |
this.builder=new TimePickerBuilder(this); |
|---|
| 5074 |
this.builder.beforeBuild(); |
|---|
| 5075 |
this.element.innerHTML=this.builder.build(); |
|---|
| 5076 |
this.builder.afterBuild(); |
|---|
| 5077 |
this.builder.setEvent(); |
|---|
| 5078 |
Event.observe(document,"mouseup",this.mouseupListener); |
|---|
| 5079 |
},show:function(_2,_3){ |
|---|
| 5080 |
Event.stop(_2); |
|---|
| 5081 |
var _4=[Event.pointerX(_2),Event.pointerY(_2)]; |
|---|
| 5082 |
if(this.options.setPosition.constructor==Function){ |
|---|
| 5083 |
this.options.setPosition(this.element,_4); |
|---|
| 5084 |
}else{ |
|---|
| 5085 |
if(this.options.setPosition){ |
|---|
| 5086 |
Element.setStyle(this.element,{left:_4[0]+"px",top:_4[1]+"px"}); |
|---|
| 5087 |
} |
|---|
| 5088 |
} |
|---|
| 5089 |
Element.setStyle(this.element,{zIndex:ZindexManager.getIndex()}); |
|---|
| 5090 |
Element.show(this.element); |
|---|
| 5091 |
this.builder.setColumnWidth(); |
|---|
| 5092 |
this.builder.setCover(); |
|---|
| 5093 |
Event.observe(document,"mouseup",this.mouseupListener); |
|---|
| 5094 |
},hide:function(){ |
|---|
| 5095 |
Element.hide(this.element); |
|---|
| 5096 |
this.clearSelected(); |
|---|
| 5097 |
Event.stopObserving(document,"mouseup",this.mouseupListener); |
|---|
| 5098 |
},clearSelected:function(){ |
|---|
| 5099 |
var _5=this.getSelected(); |
|---|
| 5100 |
var _6=this; |
|---|
| 5101 |
_5.each(function(e){ |
|---|
| 5102 |
if(Element.hasClassName(e,TimePicker.className.selected)){ |
|---|
| 5103 |
_6.removeSelectedClass(e); |
|---|
| 5104 |
} |
|---|
| 5105 |
}); |
|---|
| 5106 |
},setTrigger:function(_8,_9){ |
|---|
| 5107 |
_8=$(_8); |
|---|
| 5108 |
Event.observe(_8,"click",this.show.bindAsEventListener(this)); |
|---|
| 5109 |
},setTargets:function(_a){ |
|---|
| 5110 |
this.targets=_a; |
|---|
| 5111 |
},onMouseUp:function(_b){ |
|---|
| 5112 |
var _c=this; |
|---|
| 5113 |
var _d=Element.getDimensions(this.element); |
|---|
| 5114 |
var _e=Position.cumulativeOffset(this.element); |
|---|
| 5115 |
var x=Event.pointerX(_b); |
|---|
| 5116 |
var y=Event.pointerY(_b); |
|---|
| 5117 |
if((x<_e[0])||((_e[0]+_d.width)<x)||(y<_e[1])||((_e[1]+_d.height)<y)){ |
|---|
| 5118 |
this.hide(); |
|---|
| 5119 |
} |
|---|
| 5120 |
if(_c.mouseDown){ |
|---|
| 5121 |
setTimeout(function(){ |
|---|
| 5122 |
if(_c.mouseDown){ |
|---|
| 5123 |
_c.mouseDown=false; |
|---|
| 5124 |
_c.hide(); |
|---|
| 5125 |
} |
|---|
| 5126 |
},10); |
|---|
| 5127 |
} |
|---|
| 5128 |
var _11=this.builder.getSelectedTerm(); |
|---|
| 5129 |
if(_11){ |
|---|
| 5130 |
var _12=_11.first(); |
|---|
| 5131 |
var _13=_11.last(); |
|---|
| 5132 |
var _14=_13.getHours(); |
|---|
| 5133 |
var _15=_13.getMinutes(); |
|---|
| 5134 |
if((_14==0)&&(_15==0)){ |
|---|
| 5135 |
_14=23; |
|---|
| 5136 |
_15=55; |
|---|
| 5137 |
} |
|---|
| 5138 |
this.setTime(this.targets.start.hour,_12.getHours()); |
|---|
| 5139 |
this.setTime(this.targets.start.min,_12.getMinutes()); |
|---|
| 5140 |
this.setTime(this.targets.finish.hour,_14); |
|---|
| 5141 |
this.setTime(this.targets.finish.min,_15); |
|---|
| 5142 |
this.hide(); |
|---|
| 5143 |
this.options.afterSelect(_b); |
|---|
| 5144 |
} |
|---|
| 5145 |
},setTime:function(_16,_17){ |
|---|
| 5146 |
$A($(_16).options).each(function(_18){ |
|---|
| 5147 |
if(_18.value==_17){ |
|---|
| 5148 |
_18.selected=true; |
|---|
| 5149 |
}else{ |
|---|
| 5150 |
_18.selected=false; |
|---|
| 5151 |
} |
|---|
| 5152 |
}); |
|---|
| 5153 |
},getSelected:function(){ |
|---|
| 5154 |
return this.element.getElementsByClassName(TimePicker.className.selected,this.element); |
|---|
| 5155 |
}}); |
|---|
| 5156 |
var TimePickerBuilder=Class.create(); |
|---|
| 5157 |
Object.extend(TimePickerBuilder.prototype,CalendarDay.prototype); |
|---|
| 5158 |
Object.extend(TimePickerBuilder.prototype,{initialize:function(_19){ |
|---|
| 5159 |
var day=_19.date.getDay(); |
|---|
| 5160 |
this.calendar=_19; |
|---|
| 5161 |
this.ids=SpinelzUtil.concat(this.calendar.element.id,CalendarWeek.id); |
|---|
| 5162 |
this.ids.label=this.calendar.element.id.appendSuffix("label"); |
|---|
| 5163 |
this.setDisplayTime(); |
|---|
| 5164 |
this.calendar.options.displayIndexesOld=this.calendar.options.displayIndexes; |
|---|
| 5165 |
this.calendar.options.displayIndexes=[day]; |
|---|
| 5166 |
this.calendar.options.weekIndexOld=this.calendar.options.weekIndex; |
|---|
| 5167 |
this.calendar.options.weekIndex=day; |
|---|
| 5168 |
this.week=this.getWeek()[0]; |
|---|
| 5169 |
},buildHeader:function(){ |
|---|
| 5170 |
return "<table class='"+this.calendar.classNames.header+"'>"+"<tr>"+this.buildHeaderCenter()+"</tr>"+"</table>"; |
|---|
| 5171 |
},buildHeaderCenter:function(){ |
|---|
| 5172 |
return "<td><span>"+this.calendar.options.headerTitle+"</span></td>"; |
|---|
| 5173 |
},buildTimeLine:function(){ |
|---|
| 5174 |
var _1b=new Date(); |
|---|
| 5175 |
var _1c=0,_1d=24; |
|---|
| 5176 |
_1b.setHours(_1c); |
|---|
| 5177 |
_1b.setMinutes(0); |
|---|
| 5178 |
var _1e=null; |
|---|
| 5179 |
var _1f="timeLineTime"; |
|---|
| 5180 |
var _20="timeLineTime"; |
|---|
| 5181 |
if(UserAgent.isIE()){ |
|---|
| 5182 |
if(UserAgent.isIE7()){ |
|---|
| 5183 |
_1f="timeLineTimeIe7"; |
|---|
| 5184 |
_20="timeLineTimeIeTop"; |
|---|
| 5185 |
}else{ |
|---|
| 5186 |
_1f="timeLineTimeIe"; |
|---|
| 5187 |
_20="timeLineTimeIeTop"; |
|---|
| 5188 |
} |
|---|
| 5189 |
} |
|---|
| 5190 |
_1e="<div class='"+this.calendar.classNames.timeLineTimeTop+"'></div>"; |
|---|
| 5191 |
while(_1c<_1d){ |
|---|
| 5192 |
if(this.includeDisplayTime(_1c)){ |
|---|
| 5193 |
var _21=""; |
|---|
| 5194 |
if(_1e.length==0){ |
|---|
| 5195 |
_21=this.calendar.classNames[_20]; |
|---|
| 5196 |
}else{ |
|---|
| 5197 |
_21=this.calendar.classNames[_1f]; |
|---|
| 5198 |
} |
|---|
| 5199 |
_1e+="<div class='"+_21+"'>"+this.formatTime(_1b)+"</div>"; |
|---|
| 5200 |
} |
|---|
| 5201 |
_1c++; |
|---|
| 5202 |
_1b.setHours(_1c); |
|---|
| 5203 |
} |
|---|
| 5204 |
return "<td class='"+this.calendar.classNames.timeLine+"'>"+_1e+"</td>"; |
|---|
| 5205 |
},buildCalendarHeader:function(){ |
|---|
| 5206 |
var _22=(this.calendar.options.displayTime==this.calendar.options.standardTime)?"oneDayLabel":"standardTimeLabel"; |
|---|
| 5207 |
return "<tr><td align='center'>"+"<div id='"+this.ids.label+"'class='"+this.calendar.classNames.headerColumn+"'>"+"<a href='javascript:void(0)'>"+this.calendar.options[_22]+"</a>"+"</div>"+"</td></tr>"; |
|---|
| 5208 |
},abstractSelect:function(_23,_24){ |
|---|
| 5209 |
var _25=this.findClickedElement(_23); |
|---|
| 5210 |
if(_25){ |
|---|
| 5211 |
if(Element.hasClassName(_25,TimePicker.className.columnDate)||Element.hasClassName(_25,TimePicker.className.columnDateOdd)||Element.hasClassName(_25,TimePicker.className.columnTopDate)){ |
|---|
| 5212 |
var _26=this.getDate(_25); |
|---|
| 5213 |
_24(_26,_25); |
|---|
| 5214 |
} |
|---|
| 5215 |
} |
|---|
| 5216 |
},toggleDisplayTime:function(_27,_28){ |
|---|
| 5217 |
Event.stop(_27); |
|---|
| 5218 |
if(this.calendar.options.displayTime==this.calendar.options.oneDay){ |
|---|
| 5219 |
this.calendar.options.displayTime=this.calendar.options.standardTime; |
|---|
| 5220 |
}else{ |
|---|
| 5221 |
this.calendar.options.displayTime=this.calendar.options.oneDay; |
|---|
| 5222 |
} |
|---|
| 5223 |
this.calendar.refresh(); |
|---|
| 5224 |
},findClickedElement:function(_29){ |
|---|
| 5225 |
var _2a=$(this.getScheduleContainerId()); |
|---|
| 5226 |
var _2b=Position.cumulativeOffset(_2a); |
|---|
| 5227 |
var x=Event.pointerX(_29)-_2b[0]; |
|---|
| 5228 |
var y=Event.pointerY(_29)-_2b[1]; |
|---|
| 5229 |
var _2e=this.calendarTable.rows[0].cells[0].getElementsByTagName("div"); |
|---|
| 5230 |
var _2f=parseInt(Element.getHeight(_2a),10)/_2e.length; |
|---|
| 5231 |
var _30=Math.floor(y/_2f); |
|---|
| 5232 |
return _2e[_30]; |
|---|
| 5233 |
},beforeBuild:function(){ |
|---|
| 5234 |
this.column={}; |
|---|
| 5235 |
var _31=CssUtil.getCssRuleBySelectorText("."+TimePicker.className.columnDate); |
|---|
| 5236 |
this.column.height=parseInt(_31.style["height"],10)+1; |
|---|
| 5237 |
},afterBuild:function(){ |
|---|
| 5238 |
this.calendarTable=$(this.getCalendarTableId()); |
|---|
| 5239 |
this.setColumnWidth(); |
|---|
| 5240 |
this.setCover(); |
|---|
| 5241 |
},setEvent:function(){ |
|---|
| 5242 |
var _32=$(this.ids.label); |
|---|
| 5243 |
Event.observe(_32,"click",this.toggleDisplayTime.bindAsEventListener(this,_32)); |
|---|
| 5244 |
}}); |
|---|
| 5245 |
|
|---|
| 5246 |
var TreeView=Class.create(); |
|---|
| 5247 |
TreeView.className={top:"treeview",dir:"treeview_dir",dirBody:"treeview_dirBody",dirBodyText:"treeview_dirBodyText",dirBodyTextActive:"treeview_dirBodyTextActive",dirContainer:"treeview_dirContainer",dirContainerHover:"treeview_dirContainerHover",file:"treeview_file",fileBody:"treeview_fileBody",fileBodyText:"treeview_fileBodyText",fileBodyTextActive:"treeview_fileBodyTextActive",state_open:"treeview_stateOpen",state_close:"treeview_stateClose",state_empty:"treeview_stateEmpty",dirIcon:"treeview_dirIcon",fileIcon:"treeview_fileIcon",handle:"treeview_handle"}; |
|---|
| 5248 |
TreeView.iconId="treeview_icon"; |
|---|
| 5249 |
TreeView.prototype={initialize:function(_1){ |
|---|
| 5250 |
this.options=Object.extend({dirSymbol:"dir",fileSymbol:"file",cssPrefix:"custom_",open:true,closeIds:[],callBackFunctions:false,dirSelect:true,fileSelect:true,noSelectedInsert:true,iconIdPrefix:TreeView.iconId,move:false,unselected:Prototype.emptyFunction,enableUnselected:true,sortOptions:{},openDir:Prototype.emptyFunction,closeDir:Prototype.emptyFunction,emptyImg:false,initialSelected:null,build:true},arguments[1]||{}); |
|---|
| 5251 |
this.element=$(_1); |
|---|
| 5252 |
this.customCss=CssUtil.appendPrefix(this.options.cssPrefix,TreeView.className); |
|---|
| 5253 |
this.classNames=new CssUtil([TreeView.className,this.customCss]); |
|---|
| 5254 |
if(this.options.build){ |
|---|
| 5255 |
Element.setStyle(this.element,{visibility:"hidden"}); |
|---|
| 5256 |
Element.hide(this.element); |
|---|
| 5257 |
this.idCount=0; |
|---|
| 5258 |
this.fileIds=[]; |
|---|
| 5259 |
this.dirIds=[]; |
|---|
| 5260 |
this.buildTreeView(this.element); |
|---|
| 5261 |
this.observeEvent(); |
|---|
| 5262 |
this.classNames.addClassNames(this.element,"top"); |
|---|
| 5263 |
Element.setStyle(this.element,{visibility:"visible"}); |
|---|
| 5264 |
Element.show(this.element); |
|---|
| 5265 |
if(this.options.initialSelected){ |
|---|
| 5266 |
this.selectEffect(this.options.initialSelected); |
|---|
| 5267 |
} |
|---|
| 5268 |
if(this.options.move){ |
|---|
| 5269 |
this.setSortable(); |
|---|
| 5270 |
} |
|---|
| 5271 |
} |
|---|
| 5272 |
},open:function(_2){ |
|---|
| 5273 |
this._toggle(_2,Element.show); |
|---|
| 5274 |
},openAll:function(){ |
|---|
| 5275 |
var _3=this.element.getElementsByTagName("ul"); |
|---|
| 5276 |
$A(_3).each(function(_4){ |
|---|
| 5277 |
Element.show(_4); |
|---|
| 5278 |
this.refreshStateImg(_4.parentNode); |
|---|
| 5279 |
}.bind(this)); |
|---|
| 5280 |
},close:function(_5){ |
|---|
|
|---|