リビジョン | 1652 (tree) |
---|---|
日時 | 2018-10-03 17:53:14 |
作者 | takahashi_m |
(メッセージはありません)
@@ -1 +1 @@ | ||
1 | -var orgFldCls=null;$(function(){if(USE_FOCUS_HILIGHT){setEvent('textarea,select,input[type="text"]',"focusin",function(){doFocus2(this)});setEvent('textarea,select,input[type="text"]',"focusout",function(){doBlur2(this)})}});function doFocus2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.orgBgColor=a.style.backgroundColor;a.style.backgroundColor="#ffcccc"}else{orgFldCls=a.className;a.className="focusField "+orgFldCls}}}}function doBlur2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.style.backgroundColor=a.orgBgColor}else{if(orgFldCls!=null){a.className=orgFldCls}else{a.className="notFocusField"}}}}}oldDoFocusFlag=true;function doFocus(a){if(oldDoFocusFlag){oldDoFocusFlag=false;setTimeout(alert("Old Script Error!!\ncustom/query_info.jsp,custom/result_info.jsp Please delete the following part.\n<script>Tag(Header fix and Focus) , BODY onLoad and oncontextmenu Attribute"),100)}}function doBlur(a){}$(function(){setEvent('textarea,select,input[type="text"]',"focusout",function(){convert(this)})});function convert(b){var c,a;c=b.value;a=b.className;if(c!=null&&a!=null){if(a.match(/XL/)&&!(a.match(/XLU/))){b.value=c.toLowerCase()}else{if((a.match(/XU/)&&!(a.match(/XUL/)))||a.match(/PN2/)){b.value=c.toUpperCase()}}}return true}var colMap;var notFireCols;var jH_evElm;$(function(){if(!(typeof(EC_NAME)=="undefined")){jH_evElm=$(".h_evElm");makeColMapping();setEvent('textarea,select,input[type="text"]',"change",function(){makeColumn(this)},".h_evCol",true,addEvColCls);setEvent("input[type=checkbox],input[type=radio]","click",function(){makeColumn(this)},".h_evCol",true)}});function makeColMapping(){var b,a,e,d,c;if(colMap){return}colMap=new Object();for(b=0;b<EC_EVCOL.length;b++){e=EC_EVCOL[b].split(",");for(a=0;a<e.length;a++){d=e[a];if(d.charAt(0)=="_"){d=d.substring(1);if(notFireCols){notFireCols+=","}notFireCols+=d}c=colMap[d];if(!c){c=new Array()}c[c.length]=EC_NAME[b];colMap[d]=c}}}function addEvColCls(){for(var a in colMap){$("#"+a+",[id^="+a+"__]").addClass("h_evCol")}}function makeColumn(e){var k,l,g,j,b,h,d,c,a,f;if(jH_evElm&&isEndInitEvent()){jH_evElm=null}k=$(e);l=k.attr("id");g=l.split("__")[0];j=colMap[g];if(!j){return}if(!isEndInitEvent()&¬FireCols&¬FireCols.indexOf(g)>=0){return}for(b=0;b<j.length;b++){h=(l==g?"":"__"+l.split("__")[1]);d=j[b]+h;c=d.split("__")[0];a=isEndInitEvent()?$(".h_evElm[h_evCid="+d+"]"):jH_evElm.filter("[h_evCid="+d+"]");f=a.attr("h_evWrtbl");eventColumn(k,a,d,c,h,f)}}function eventColumn(jEvCol,jTag,cid,cname,suffix,writable){var evVal,url,param,_pos1,_pos2,_repClm,_rep,_clm,noVal,columnFocus,jCol,val,renderer,editor,ATTRS,optAttrs,i,optAtt,vtype,isAdd;var callback;if(!jTag||jTag.length==0){alert("[SYSTEM_ERROR] : jTag is null. The element of the replacement object doesn't exist. ["+cname+"]");return}if(!isEndInitEvent()){evVal=jEvCol.get(0).value;if(!evVal||evVal==null||evVal==""){return}}try{url=eval("EC_"+cname+"_URL")}catch(e){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. (variable undefinition). ["+cname+"]");return}if(!url||url==""){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. ["+cname+"]");return}param="";try{param=(writable?eval("EC_"+cname+"_EDITPARAM"):eval("EC_"+cname+"_RENDPARAM"))}catch(e){}if(param!=null&¶m!=""){url+="?";_pos1=0;_pos2=0;while((_pos1=param.indexOf("{@",_pos2))!=-1){_pos2=param.indexOf("}",_pos1);_clm=param.substring(_pos1+2,_pos2);if(_clm.indexOf(".")<0){_repClm="{@"+_clm+"}";var rtnNull=function(){console.log("noDifined:");console.log(arguments[0]);return null};_rep=suffix==""?$("#"+_clm)[0]?$("#"+_clm).get(0).value:rtnNull(_clm):$("#"+_clm+suffix)[0]?$("#"+_clm+suffix).get(0).value:rtnNull(_clm+suffix);_rep=(_rep==null?"":_rep);param=param.replace(_repClm,_rep);url+=_clm+"="+encodeURIComponent(_rep)+"&"}_pos2=_pos1+1}}noVal=function(){_firstOption=jCol.children("option").get(0);if(_firstOption==null||_firstOption.value!=""){return false}return true};columnFocus=function(){jCol.attr("isfocus","true")};if(cid!=null&&cid!=""){jCol=jTag.find("#"+cid)}else{jCol=new Array(0)}if(jCol.length>0&&isEndInitEvent()){jCol.bind("focus",columnFocus)}val="";if(jCol.length>0){if(isEndInitEvent()){val=(jCol.val()==null?"":jCol.val())}else{val=(jTag.attr("h_evVal")==null?"":jTag.attr("h_evVal"))}}renderer="";try{renderer=eval("EC_"+cname+"_RENDERER")}catch(e){}editor="";try{editor=eval("EC_"+cname+"_EDITOR")}catch(e){}ATTRS=["title","style","tabindex","readonly","disabled","onClick","onChange","onBlur","onFocus","ondblClick","onMouseDown","onMouseUp","onMouseMove","onMouseOut","onMouseOver","onSelect","onKeydown","onKeypress","onKeyup","eventCallBack","multiple"];optAttrs="";if(jCol.length>0){for(i=0;i<ATTRS.length;i++){optAtt=jCol.attr(ATTRS[i]);if(optAtt!=null){vtype=typeof(optAtt);isAdd=false;if(vtype=="function"){optAtt=optAtt.toString();isAdd=optAtt.length>0?true:false;optAtt="("+optAtt+")()"}else{if(vtype=="boolean"){isAdd=optAtt}else{isAdd=optAtt.length>0?true:false}}if(isAdd){optAttrs+=ATTRS[i]+"='"+optAtt+"' "}}}}$.ajax({url:url,data:{EC_CID:(cid==null?"":cid),EC_CNAME:(cname==null?"":cname),EC_RENDERER:renderer,EC_EDITOR:editor,EC_PARAM:param,EC_SQL:param,EC_WRITABLE:(writable==null?"":writable),EC_CVALUE:val,EC_NOVALUE:(jCol.length==0?"":noVal()),EC_CLASS:(jCol.length==0?"":jCol.attr("class")),EC_SIZE:(jCol.length==0?"":jCol.attr("size")),EC_MAXLENGTH:(jCol.length==0?"":jCol.attr("maxlength")),EC_OPTATTRS:optAttrs,EC_PNAME:jEvCol.attr("id")==null?"":jEvCol.attr("id").split("__")[0],EC_PVALUE:jEvCol.get(0).value==null?"":jEvCol.get(0).value,EC_USESLBL:(suffix==null||suffix=="")?"false":"true"},type:"POST",dataType:"html",async:isEndInitEvent(),error:function(r,s,e){if(url.indexOf(".htm")<0){alert("EventColumnError:"+r+":"+s+":"+e+":"+cname)}},success:function(data,status){var jNewCol=$(data);if(jCol.length>0){if(isEndInitEvent()){jCol.unbind("focus",columnFocus)}bindOldEvents(jNewCol.get(0),jQuery.data(jCol.clone(true).get(0),"events"))}jTag.empty().append(jNewCol);if(jCol.length>0){jTag.find("input,select,textarea").attr("name",cid).attr("id",cid);if(isEndInitEvent()){if(jCol.attr("isfocus")){jNewCol.get(0).focus();if($.browser.msie){jNewCol.get(0).focus()}}}if(!isEndInitEvent()){jNewCol.change()}if(jCol.attr("eventCallback")){callback=function(){eval(jCol.attr("eventCallback")+"(arguments);")};callback(cid,jNewCol.val(),jCol.get(0).value)}}if(suffix!=null&&suffix!=""){if(isEndInitEvent()){$("table#viewTable").resizeView()}}}})}function bindOldEvents(d,a){var c,b;for(c in a){for(b in a[c]){jQuery.event.add(d,c,a[c][b],a[c][b].data)}}}var isShowTip=false;$(function(){if(USE_REAL_TIME_CHECK){setEvent('textarea:not([realTimeChk="false"]),select:not([realTimeChk="false"]),input[type="text"]:not([realTimeChk="false"])',"focusout",function(){var b=RegExp(/jsp/);var a=location.pathname.match(b);check(this,RegExp.leftContext+"jsp/common/realtimecheck.jsp")});$("table#viewTable").parent().parent().scroll(function(){if(isShowTip){isShowTip=false;$(".tipErr").remove()}})}});function check(f,b){var c,d,h,g,e,j,a,i;c=f.name;if(typeof jQuery!="undefined"&&c.indexOf("h_")!=0){d=f.value;if(f.rtOption!="null"&&f.rtOption!="undefined"){i=f.getAttribute("rtOption")}h=c.split("__");g=(2==h.length);e="command=RENEW&checkType="+(g?"ENTRY":"NEW")+(g?"&h_rowSel="+h[1]:"")+"&column="+h[0]+"&"+c+"="+encodeURIComponent(d)+(i?"&"+i:"");j={dataType:"html",type:"POST",url:b,data:e};j.error=function(){};j.success=function(k){a=$(f).data("tipId");$("#"+a).remove();if($.trim(k).indexOf("row_error")>=0){showCheckTip(f,k);isShowTip=true}};$.ajax(j)}return true}function showCheckTip(a,c){var j,i,k,g,e,h,f,d,b;j=$(a);i=j.offset();if(i.top>=30){e="<div class='tipErr'><div id='tipArrowBottom'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+(-11-h[0].offsetHeight)}else{e="<div class='tipErr'><div id='tipArrowTop'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+11+h[0].offsetHeight}b=(new Date()).getTime();$(a).data("tipId",b);h.css({left:f+"px",top:d+"px"}).attr("id",b).click(function(){$(this).remove()}).show()}$(function(){bindEvents()});$.fn.simpleColorPickerOg=function(a){var c={colorsPerLine:8,colors:["#000000","#444444","#666666","#999999","#cccccc","#eeeeee","#f3f3f3","#ffffff","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#0000ff","#9900ff","#ff00ff","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79","#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47","#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4C1130"],showEffect:"",hideEffect:"",onChangeColor:false};var b=$.extend(c,a);return this.each(function(){var g=$(this);var l="";var j=g.attr("id").replace(/-/g,"")+"_";for(var f=0;f<b.colors.length;f++){var m=b.colors[f];var k="";if(f%b.colorsPerLine==0){k="clear: both; "}if(f>0&&k&&$.browser&&$.browser.msie&&$.browser.version<=7){k="";l+='<li style="float: none; clear: both; overflow: hidden; background-color: #fff; display: block; height: 1px; line-height: 1px; font-size: 1px; margin-bottom: -2px;"></li>'}l+='<li id="'+j+"color-"+f+'" class="color-box" style="'+k+"background-color: "+m+'" title="'+m+'"></li>'}k="clear: both; ";l+='<li id="'+j+'color-default" class="color-box" style="width:80px; text-align:center; '+k+'background-color:white;" title="clear">clear</li>';var h=$('<div id="'+j+'color-picker" class="color-picker" style="position: absolute; left: 0px; top: 0px;"><ul>'+l+'</ul><div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("li.color-box").click(function(){var i=isNaN(this.id.substr(this.id.indexOf("-")+1))?"":b.colors[this.id.substr(this.id.indexOf("-")+1)];if(!g.is("input")){g.val(i);g.blur()}if($.isFunction(c.onChangeColor)){c.onChangeColor.call(g,i)}d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){g=$(this);i.stopPropagation();if(!g.is("input")){e(h)}});g.change(function(i){if(g.val()!=g.css("background-color")){g.css("background-color",g.val()).css("color",g.val())}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.simpleColorPickerOg){$("input.colorPicker").simpleColorPickerOg({onChangeColor:function(a){$(this).val(a).css("background-color",a).css("color",a).change()}})}});jQuery.fn.ogClockpicker=function(options,callback){var org_settings={starthour:6,endhour:20,showminutes:"true",minutedivisions:4,military:true,event:"click",layout:"vertical",valuefield:null,useBgiframe:false,hoursopacity:1,minutesopacity:1,second:""};if(options){jQuery.extend(org_settings,options)}var callback=callback||function(){},v=(org_settings.layout=="vertical");errorcheck(org_settings);jQuery(this)[org_settings.event](function(e){var self=this,$self=jQuery(this),$body=jQuery("body");var settings=jQuery.extend(true,{},org_settings);if($self.attr("valuefield")){settings.valuefield=$self.attr("valuefield")}if($self.attr("starthour")){settings.starthour=parseInt($self.attr("starthour"))}if($self.attr("endhour")){settings.endhour=parseInt($self.attr("endhour"))}if($self.attr("minutedivisions")){settings.minutedivisions=parseInt($self.attr("minutedivisions"))}if($self.attr("military")){settings.military=$self.attr("military")}if($self.attr("showminutes")){settings.showminutes=$self.attr("showminutes")}if($self.attr("usesecond")=="true"){settings.second="00"}if($self.attr("layout")){settings.layout=$self.attr("layout");org_settings.layout=settings.layout;v=(settings.layout=="vertical")}errorcheck(settings);if(!settings.valuefield){$self.unbind("keydown").bind("keydown",keyhandler)}else{var inputfield=jQuery("[name="+settings.valuefield+"]");inputfield.unbind("keydown").bind("keydown",keyhandler)[0].focus();inputfield.bind("click",function(){inputfield.unbind("keydown")})}jQuery("#CP_hourcont,#CP_minutecont").remove();var $hourcont=jQuery("<div id='CP_hourcont' class='CP' />").appendTo($body);!settings.useBgiframe?$hourcont.css("opacity",settings.hoursopacity):null;binder($hourcont);var $hourcol=[];for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){$hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo($body))}if(settings.showminutes=="true"){var $mc=jQuery("<div id='CP_minutecont' class='CP' />").appendTo($body);!settings.useBgiframe?$mc.css("opacity",settings.minutesopacity):null;binder($mc)}if(!v){$hourcont.css("width","auto");if(settings.showminutes=="true"){$mc.css("width","auto")}}else{for(i=0;i<$hourcol.length;i++){$hourcol[i].addClass("floatleft")}}renderhours();putcontainer();function renderhours(){var c=1;var numberC=0;for(var h=settings.starthour;h<=settings.endhour;h++){if(h%12==0){c=1}var displayhours=((!settings.military&&h>12)?h-12:h);var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}var $hd=jQuery("<div class='CP_hour' id='hr_"+h+"_"+c+"' value='"+valuehouers+"' >"+displayhours+set_tt(h)+"</div>");if(settings.military){$hd.width(20)}binder($hd);if(!v){$hd.css("float","left")}$hourcol[numberC].append($hd);if((h+1)%12==0){numberC++}c++}for(var j=0;j<$hourcol.length;j++){if(v){if(j!=0&&j%2==0){$hourcol[j].css("margin-left",$mc.width()+4+"px")}}else{$hourcont.append("<div style='clear:left' />");if(j!=0&&j%2==0){$hourcol[j].css("margin-top","19px")}}$hourcont.append($hourcol[j])}}function renderminutes(h){var realhours=h;var displayhours=(!settings.military&&h>12)?h-12:h;var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}$mc.empty();var n=60/settings.minutedivisions,tt=set_tt(realhours),counter=1;for(var m=0;m<60;m=m+n){$md=jQuery("<div class='CP_minute' id='"+realhours+"_"+m+"' value='"+valuehouers+((m<10)?"0":"")+m+"'>"+displayhours+":"+((m<10)?"0":"")+m+tt+"</div>");if(!v){$md.css("float","left");if(settings.minutedivisions>6&&counter==settings.minutedivisions/2+1){$mc.append("<div style='clear:left' />")}}$mc.append($md);binder($md);counter++}}function set_tt(realhours){if(!settings.military){return(realhours>=12)?" PM":" AM"}else{return""}}function putcontainer(){if(e.type!="focus"){$hourcont[0].style.left=e.pageX-5+"px";$hourcont[0].style.top=e.pageY-(Math.floor($hourcont.height()/2))+"px";rectify($hourcont)}else{$self.after($hourcont)}$hourcont.slideDown("fast");if(settings.useBgiframe){bgi($hourcont)}}function rectify($obj){var ph=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var pw=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;var t=parseInt($obj[0].style.top);var l=parseInt($obj[0].style.left);var st=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;if(t<=st&&!$obj.is("#CP_minutecont")){$obj.css("top",st+10+"px")}else{if(t+$obj.height()-st>ph){$obj.css("top",st+ph-$obj.height()-10+"px")}}if(l<=0){$obj.css("left","10px")}}function bgi(ob){if(typeof jQuery.fn.bgIframe=="function"){ob.bgIframe()}else{alert("bgIframe plugin not loaded.")}}function binder($obj){if($obj.attr("id")=="CP_hourcont"){$obj.mouseout(function(e){hourcont_out(e)})}else{if($obj.attr("id")=="CP_minutecont"){$obj.mouseout(function(e){minutecont_out(e)})}else{if($obj.attr("class")=="CP_hour"){$obj.mouseover(function(e){hourdiv_over($obj,e)});$obj.mouseout(function(){hourdiv_out($obj)});$obj.click(function(){hourdiv_click($obj)})}else{if($obj.attr("class")=="CP_minute"){$obj.mouseover(function(){minutediv_over($obj)});$obj.mouseout(function(){minutediv_out($obj)});$obj.click(function(){minutediv_click($obj)})}}}}}function hourcont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function minutecont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function hourdiv_over($obj,e){var h=$obj.attr("id").split("_")[1],i=$obj.attr("id").split("_")[2],l,t,nn;$obj.addClass("CP_over");nn=Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2);if(settings.showminutes=="true"){$mc.hide();renderminutes(h);if(v){t=e.type=="mouseover"?e.pageY-15:$hourcont.offset().top+2+($obj.height()*i);l=$hourcont.offset().left+$hourcol[0].width()*2*nn+$mc.width()*(nn-1)+4*nn-2}else{l=(e.type=="mouseover")?e.pageX-10:$hourcont.offset().left+($obj.width()-5)*i;t=$hourcont.offset().top+($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn+$mc.height()*(nn-1)+2*nn-1}$mc.css("left",l+"px").css("top",t+"px");rectify($mc);$mc.show();if(settings.useBgiframe){bgi($mc)}}return false}function hourdiv_out($obj){$obj.removeClass("CP_over");return false}function hourdiv_click($obj){var h=$obj.attr("id").split("_")[1],tt=set_tt(h),str=$obj.attr("value");if(str.indexOf(" ")!=-1){var cleanstr=str.substring(0,str.indexOf(" "))}else{var cleanstr=str}$obj.text(cleanstr+"00"+settings.second);setval($obj);cleardivs()}function minutediv_over($obj){$obj.addClass("CP_over");return false}function minutediv_out($obj){$obj.removeClass("CP_over");return false}function minutediv_click($obj){$obj.text($obj.attr("value")+settings.second);setval($obj);cleardivs()}function setval($obj){if(!settings.valuefield){self.value=$obj.text()}else{jQuery("input[name="+settings.valuefield+"]").val($obj.text()).change()}callback.apply($self,[$obj.text()]);$self.unbind("keydown",keyhandler)}function cleardivs(){if(settings.showminutes=="true"){$mc.hide()}$hourcont.slideUp("fast");$self.unbind("keydown",keyhandler)}function keyhandler(e){var $obj=$("div.CP_over").size()?$("div.CP_over"):$("div.CP_hour:first"),divtype=$obj.is(".CP_hour")?"hour":"minute",hi=(divtype=="hour")?$obj[0].id.split("_")[2]:0,h=(divtype=="minute")?$obj[0].id.split("_")[0]:$obj[0].id.split("_")[1];if(divtype=="minute"){if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){var curloc="m1"}else{if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){var curloc="m2"}else{var curloc="m3"}}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var curloc="h1"}else{var curloc="h2"}}function divprev($obj){if($obj.prev().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.prev(), e)")}else{return false}}function divnext($obj){if($obj.next().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.next(), e)")}else{return false}}function hourtohour($obj){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1)}var ctx="#hourcol"+next;$newobj=jQuery(".CP_hour[id$=_"+hi+"]",ctx);if($newobj.size()){hourdiv_out($obj);hourdiv_over($newobj,e)}else{return false}}function hourtominute($obj){hourdiv_out($obj);minutediv_over($(".CP_minute:first"))}function minutetohour($obj,where){minutediv_out($obj);if(where<0){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)-12)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)+12)}}var ctx="#hourcol"+next;var $newobj=jQuery(".CP_hour[id^=hr_"+h+"]",ctx);hourdiv_over($newobj,e)}switch(e.keyCode){case 37:if(v){switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}else{divprev($obj)}break;case 38:if(v){divprev($obj)}else{switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}break;case 39:if(v){switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}else{divnext($obj)}break;case 40:if(v){divnext($obj)}else{switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}break;case 13:eval(divtype+"div_click($obj)");break;default:return true}return false}return false});function errorcheck(settings){if(settings.starthour>=settings.endhour){alert("Error - start hour must be less than end hour.");return false}else{if(60%settings.minutedivisions!=0){alert("Error - param minutedivisions must divide evenly into 60.");return false}}}return this};$(function(){if($.fn.ogClockpicker){$(document).ready(function(){$(".clockpick").ogClockpicker()})}});function likeComp(c){var b=c.substring(6);var d=$("#"+c).attr("aimaiType");var a=$("#"+b).val();a=a.replace(/^%+|%+$/g,"");if(a!=""){switch(d){case"1":a=a+"%";break;case"2":a="%"+a;break;case"3":a="%"+a+"%";break}}$("#"+b).val(a)}$(function(){$("form").submit(function(){$("[id^='AIMAI_']").each(function(){likeComp(this.id)})})});$.fn.aimaiPickerOg=function(a){var c={texts:[" V "," V*","*V ","*V*"],titls:["完全一致","前方一致","後方一致","前後曖昧"]};var b=$.extend(c,a);return this.each(function(){var g=$(this);var j="PIC_"+g.attr("id").replace(/-/g,"")+"_";var l="";for(var f=0;f<b.texts.length;f++){var m=b.texts[f];var k=b.titls[f];l+='<span id="'+j+"text-"+f+'" class="text-box"" title="'+k+'">('+m+") </span>"}var h=$('<div id="'+j+'aimai-picker" class="aimai-picker" style="position: absolute; left: 0px; top: 0px;">'+l+'<div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("span.text-box").click(function(){var i=this.id.substr(this.id.indexOf("-")+1);g.attr("aimaiType",i);g.attr("title",b.titls[i]);g.text(b.texts[i]);g.blur();d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){i.stopPropagation();if(!g.is("input")){e(h)}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.aimaiPickerOg){$(".aimaiClm").aimaiPickerOg()}});(function(){$.fn.glDatePicker=function(options){var pluginName="glDatePicker";var instance=this.data(pluginName);if(!instance){return this.each(function(){return $(this).data(pluginName,new glDatePicker(this,options))})}return(options===true)?instance:this};$.fn.glDatePicker.defaults={cssName:"default",zIndex:1000,borderSize:1,calendarOffset:{x:0,y:1},showAlways:false,hideOnClick:true,allowMonthSelect:true,allowYearSelect:true,todayDate:new Date(),selectedDate:null,prevArrow:"\u25c4",nextArrow:"\u25ba",selectableDates:null,selectableDateRange:null,specialDates:null,selectableMonths:null,selectableYears:null,selectableDOW:null,monthNames:null,dowNames:null,dowOffset:(HYBS_CAL_START_MON==true?1:0),onClick:(function(el,cell,date,data){var tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){var _targetId=el.attr("targetId");if(_targetId!=null){tgt=$("#"+_targetId)}}var year=date.getFullYear();var month=date.getMonth()+1;var day=date.getDate();if(month<10){month="0"+month}if(day<10){day="0"+day}var oldval=tgt.val();var str=year+""+month+""+day;tgt.val(str);if(oldval!=str){tgt.change()}}),onHover:function(el,cell,date,data){},onShow:function(calendar){calendar.show()},onHide:function(calendar){calendar.hide()},firstDate:null};var glDatePicker=(function(){function glDatePicker(element,userOptions){var self=this;self.el=$(element);var el=self.el;self.options=$.extend(true,{},$.fn.glDatePicker.defaults,userOptions);var options=self.options;var _tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){if(el.attr("targetId")){_tgt=$("#"+el.attr("targetId"))}}var _inputDate=_tgt.val();if(_inputDate!=null&&_inputDate.length>=8){_inputDate=_inputDate.replace(/\u002f/g,"");try{_inputDate=_inputDate.substr(0,4)+"/"+_inputDate.substr(4,2)+"/"+_inputDate.substr(6,2)}catch(e){_inputDate=null}}else{_inputDate=null}self.calendar=$($.find("[gldp-el="+el.attr("gldp-id")+" ]"));options.selectedDate=(options.selectedDate||new Date(_inputDate||options.todayDate))||options.todayDate;options.firstDate=(new Date((options.firstDate||options.selectedDate)))._first();if(!(el.attr("gldp-id")||"").length){el.attr("gldp-id","gldp-"+Math.round(Math.random()*10000000000))}el.addClass("gldp-el").bind("click",function(e){self.show(e)});if(self.calendar.length&&!options.showAlways){self.calendar.hide()}$(document).bind("mouseup",function(e){var target=e.target;var calendar=self.calendar;if(!el.is(target)&&!calendar.is(target)&&calendar.has(target).length===0&&calendar.is(":visible")){self.hide()}})}glDatePicker.prototype={show:function(){this.render();$.each($(".gldp-el").not(this.el),function(i,o){if(o.length){o.options.onHide(o.calendar)}});this.options.onShow(this.calendar)},hide:function(){if(this.options&&!this.options.showAlways){this.options.onHide(this.calendar)}},render:function(renderCalback){var self=this;var el=self.el;var options=self.options;var calendar=self.calendar;var coreClass=" core border ";var cssName="gldp-"+options.cssName;var todayVal=options.todayDate._val();var todayTime=todayVal.time;var maxRow=6;var maxCol=7;var borderSize=options.borderSize+"px";var getSelectableList=function(min,max,userList){var resultList=[];for(var i=min;i<=max;i++){resultList.push(i)}if(userList){var newList=[];$.each(userList,function(i,v){if(v>=min&&v<=max&&newList._indexOf(v)<0){newList.push(v)}});resultList=newList.length?newList:resultList}resultList.sort();return resultList};var selectableMonths=getSelectableList(0,11,options.selectableMonths);var selectableYears=getSelectableList(todayVal.year-5,todayVal.year+5,options.selectableYears);var selectableDOW=getSelectableList(0,6,options.selectableDOW);var dowNames=options.dowNames||["日","月","火","水","木","金","土"];var monthNames=options.monthNames||["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];var containerSize=window.innerHeight?window.innerHeight:180;if(containerSize<180){containerSize=(containerSize>135?containerSize:135)}else{containerSize=180}var containerWidth=options.conainerWidth||containerSize;var containerHeight=containerWidth;var getCellSize=function(_size,_count){return(_size/_count)+((options.borderSize/_count)*(_count-1))-1};var cellWidth=getCellSize(containerWidth,maxCol);var cellHeight=getCellSize(containerHeight,maxRow+2);if(!calendar.length){self.calendar=calendar=$("<div/>").attr("gldp-el",el.attr("gldp-id")).data("is",true).css({display:(options.showAlways?undefined:"none"),zIndex:options.zIndex,width:((cellWidth+1)*maxCol)+"px"});$("body").append(calendar)}else{if(!eval(calendar.data("is"))){containerWidth=calendar.outerWidth();containerHeight=calendar.outerHeight();cellWidth=getCellSize(containerWidth,maxCol);cellHeight=getCellSize(containerHeight,maxRow+2)}self.calendar.css({width:((cellWidth+1)*maxCol)+"px"})}if(!el.is(":visible")){calendar.hide()}calendar.removeClass().addClass(cssName).children().remove();var onResize=function(){var elPos=el.offset();calPosTop=(elPos.top+el.outerHeight()+options.calendarOffset.y)-20;calPosLeft=(elPos.left+options.calendarOffset.x);if(calPosTop>$(window).height()-150){calPosTop-=130}if(calPosLeft>$(window).width()-150){calPosLeft-=150}if(calPosTop<0){calPosTop=0}if(calPosLeft<0){calPosLeft=0}calendar.css({top:calPosTop+"px",left:calPosLeft+"px"})};$(window).resize(onResize);onResize();var cellCSS={width:cellWidth+"px",height:cellHeight+"px",lineHeight:cellHeight+"px"};var setFirstDate=function(_date){if(_date){options.firstDate=_date;self.render()}};var getFirstDate=function(_offset){var _date=new Date(options.firstDate);_offset=_offset||0;while(true){_date.setMonth(_date.getMonth()+_offset);_date.setDate(Math.min(1,_date._max()));if(_offset==0){break}var dateVal=_date._val();var dateMonth=dateVal.month;var dateYear=dateVal.year;if(selectableMonths._indexOf(dateMonth)!=-1){if(selectableYears._indexOf(dateYear)!=-1){break}else{if(dateYear<selectableYears[0]||dateYear>selectableYears[selectableYears.length-1]){return null}}}}return _date};var prevFirstDate=getFirstDate(-1);var nextFirstDate=getFirstDate(1);var firstDate=(options.firstDate=getFirstDate());var firstDateVal=firstDate._val();var firstDateMonth=firstDateVal.month;var firstDateYear=firstDateVal.year;var startDate=new Date(firstDate);var dowOffset=Math.abs(Math.min(6,Math.max(0,options.dowOffset)));var startOffset=startDate.getDay()-dowOffset;startOffset=startOffset<1?-7-startOffset:-startOffset;dowNames=(dowNames.concat(dowNames)).slice(dowOffset,dowOffset+7);startDate._add(startOffset);var showPrev=(prevFirstDate);var showNext=(nextFirstDate);var monyearClass=coreClass+"monyear ";var prevCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{borderWidth:borderSize+" 0 0 "+borderSize})).append($("<a/>").addClass("prev-arrow"+(showPrev?"":"-off")).html(options.prevArrow)).mousedown(function(){return false}).click(function(e){if(options.prevArrow!=""&&showPrev){e.stopPropagation();setFirstDate(prevFirstDate)}});var titleCellCount=maxCol-2;var titleWidth=(cellWidth*titleCellCount)-(titleCellCount*options.borderSize)+(options.borderSize);var titleCell=$("<div/>").addClass(monyearClass+"title").css($.extend({},cellCSS,{width:titleWidth+"px",borderTopWidth:borderSize,marginLeft:"-"+(borderSize)}));var nextCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{marginLeft:"-"+(borderSize),borderWidth:borderSize+" "+borderSize+" 0 0"})).append($("<a/>").addClass("next-arrow"+(showNext?"":"-off")).html(options.nextArrow)).mousedown(function(){return false}).click(function(e){if(options.nextArrow!=""&&showNext){e.stopPropagation();setFirstDate(nextFirstDate)}});calendar.append(prevCell).append(titleCell).append(nextCell);for(var row=0,cellIndex=0;row<maxRow+1;row++){for(var col=0;col<maxCol;col++,cellIndex++){var cellDate=new Date(startDate);var cellClass="day";var cellZIndex=options.zIndex+(cellIndex);var cell=$("<div/>");if(!row){cellClass="dow";cell.html(dowNames[col]);cellDate=null}else{cellDate._add(col+((row-1)*maxCol));var cellDateVal=cellDate._val();var cellDateTime=cellDateVal.time;var specialData=null;var isSelectable=true;var getRepeatDate=function(v,date){if(v.repeatYear===true){date.setYear(cellDateVal.year)}if(v.repeatMonth===true){date.setMonth(cellDateVal.month)}return date._val()};cell.html(cellDateVal.date);if(options.selectableDateRange){isSelectable=false;$.each(options.selectableDateRange,function(i,v){var dateFrom=v.from;var dateTo=(v.to||null);dateTo=dateTo||new Date(v.from.getFullYear(),v.from.getMonth(),v.from._max());dateFrom=getRepeatDate(v,dateFrom);dateTo=getRepeatDate(v,dateTo);if(cellDateTime>=dateFrom.time&&cellDateTime<=dateTo.time){isSelectable=true;return true}})}if(options.selectableDates){if((options.selectableDateRange&&!isSelectable)||(isSelectable&&!options.selectableDateRange)){isSelectable=false}$.each(options.selectableDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){return(isSelectable=true)}})}if(!isSelectable||selectableYears._indexOf(cellDateVal.year)<0||selectableMonths._indexOf(cellDateVal.month)<0||selectableDOW._indexOf(cellDateVal.day)<0){cellClass="noday"}else{cellClass=(["sun","mon","tue","wed","thu","fri","sat"])[cellDateVal.day];if(firstDateMonth!=cellDateVal.month){cellClass+=" outday"}if(todayTime==cellDateTime){cellClass="today";cellZIndex+=50}if(options.selectedDate._time()==cellDateTime){cellClass="selected";cellZIndex+=51}if(options.specialDates){$.each(options.specialDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){cellClass=(v.cssClass||"special");cellZIndex+=52;specialData=v.data}})}cell.mousedown(function(){return false}).hover(function(e){e.stopPropagation();var hoverData=$(this).data("data");options.onHover(el,cell,hoverData.date,hoverData.data)}).click(function(e){e.stopPropagation();var clickedData=$(this).data("data");options.selectedDate=options.firstDate=clickedData.date;self.render(function(){if(!options.showAlways&&options.hideOnClick){self.hide()}});options.onClick(el,$(this),clickedData.date,clickedData.data)})}}$.extend(cellCSS,{borderTopWidth:borderSize,borderBottomWidth:borderSize,borderLeftWidth:(row>0||(!row&&!col))?borderSize:0,borderRightWidth:(row>0||(!row&&col==6))?borderSize:0,marginLeft:(col>0)?"-"+(borderSize):0,marginTop:(row>0)?"-"+(borderSize):0,zIndex:cellZIndex});cell.data("data",{date:cellDate,data:specialData}).addClass(coreClass+cellClass).css(cellCSS);calendar.append(cell)}}var toggleYearMonthSelect=function(showYear){var show="inline-block";var hide="none";if(options.allowMonthSelect){monthText.css({display:!showYear?hide:show});monthSelect.css({display:!showYear?show:hide})}if(options.allowYearSelect){yearText.css({display:showYear?hide:show});yearSelect.css({display:showYear?show:hide})}};var onYearMonthSelect=function(){options.firstDate=new Date(yearSelect.val(),monthSelect.val(),1);self.render()};var monthSelect=$("<select/>").hide().change(onYearMonthSelect);var yearSelect=$("<select/>").hide().change(onYearMonthSelect);var monthText=$("<span/>").html(monthNames[firstDateMonth]).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(false)});var yearText=$("<span/>").html(firstDateYear).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(true)});$.each(monthNames,function(i,v){if(options.allowMonthSelect&&selectableMonths._indexOf(i)!=-1){var o=$("<option/>").html(v).attr("value",i);if(i==firstDateMonth){o.attr("selected","selected")}monthSelect.append(o)}});$.each(selectableYears,function(i,v){if(options.allowYearSelect){var o=$("<option/>").html(v).attr("value",v);if(v==firstDateYear){o.attr("selected","selected")}yearSelect.append(o)}});var titleYearMonth=$("<div/>").append(monthText).append(monthSelect).append(yearText).append(yearSelect);titleCell.children().remove();titleCell.append(titleYearMonth);renderCalback=renderCalback||(function(){});renderCalback();var mousewheelevent="onwheel" in document?"wheel":"onmousewheel" in document?"mousewheel":"DOMMouseScroll";calendar.bind(mousewheelevent,function(e){e.preventDefault();var delta=e.originalEvent.deltaY?-(e.originalEvent.deltaY):e.originalEvent.wheelDelta?e.originalEvent.wheelDelta:-(e.originalEvent.detail);if(delta<0){nextCell.click()}else{prevCell.click()}})}};return glDatePicker})();(function(){Date.prototype._clear=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype._time=function(){return this._clear().getTime()};Date.prototype._max=function(){var isLeapYear=(new Date(this.getYear(),1,29).getMonth()==1)?1:0;var days=[31,28+isLeapYear,31,30,31,30,31,31,30,31,30,31];return days[this.getMonth()]};Date.prototype._add=function(days){this.setDate(this.getDate()+days)};Date.prototype._first=function(){var date=new Date(this);date.setDate(1);return date};Date.prototype._val=function(){this._clear();return{year:this.getFullYear(),month:this.getMonth(),date:this.getDate(),time:this.getTime(),day:this.getDay()}};Array.prototype._indexOf=function(value){return $.inArray(value,this)}})()})();$(function(){if($.fn.glDatePicker){$(".calPic").glDatePicker()}});function selectScroll(a){var d=4;if(a.getAttribute("size")){d=a.getAttribute("size")}var e=a.options;for(var c=0;c<e.length;c++){if(e[c].selected){if(e[c].parentNode.tagName.toUpperCase()=="OPTGROUP"){c+=$(e[c].parentNode).prev().length}var b=c*($(a).height()/d);break}}$(a).scrollTop(b)}$(function(){$("select[multiple]").each(function(){selectScroll(this)})}); | |
\ No newline at end of file | ||
1 | +var orgFldCls=null;$(function(){if(USE_FOCUS_HILIGHT){setEvent('textarea,select,input[type="text"]',"focusin",function(){doFocus2(this)});setEvent('textarea,select,input[type="text"]',"focusout",function(){doBlur2(this)})}});function doFocus2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.orgBgColor=a.style.backgroundColor;a.style.backgroundColor="#ffcccc"}else{orgFldCls=a.className;a.className="focusField "+orgFldCls}}}}function doBlur2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.style.backgroundColor=a.orgBgColor}else{if(orgFldCls!=null){a.className=orgFldCls}else{a.className="notFocusField"}}}}}oldDoFocusFlag=true;function doFocus(a){if(oldDoFocusFlag){oldDoFocusFlag=false;setTimeout(alert("Old Script Error!!\ncustom/query_info.jsp,custom/result_info.jsp Please delete the following part.\n<script>Tag(Header fix and Focus) , BODY onLoad and oncontextmenu Attribute"),100)}}function doBlur(a){}$(function(){setEvent('textarea,select,input[type="text"]',"focusout",function(){convert(this)})});function convert(b){var c,a;c=b.value;a=b.className;if(c!=null&&a!=null){if(a.match(/XL/)&&!(a.match(/XLU/))){b.value=c.toLowerCase()}else{if((a.match(/XU/)&&!(a.match(/XUL/)))||a.match(/PN2/)){b.value=c.toUpperCase()}}}return true}var colMap;var notFireCols;var jH_evElm;$(function(){if(!(typeof(EC_NAME)=="undefined")){jH_evElm=$(".h_evElm");makeColMapping();setEvent('textarea,select,input[type="text"]',"change",function(){makeColumn(this)},".h_evCol",true,addEvColCls);setEvent("input[type=checkbox],input[type=radio]","click",function(){makeColumn(this)},".h_evCol",true)}});function makeColMapping(){var b,a,e,d,c;if(colMap){return}colMap=new Object();for(b=0;b<EC_EVCOL.length;b++){e=EC_EVCOL[b].split(",");for(a=0;a<e.length;a++){d=e[a];if(d.charAt(0)=="_"){d=d.substring(1);if(notFireCols){notFireCols+=","}notFireCols+=d}c=colMap[d];if(!c){c=new Array()}c[c.length]=EC_NAME[b];colMap[d]=c}}}function addEvColCls(){for(var a in colMap){$("#"+a+",[id^="+a+"__]").addClass("h_evCol")}}function makeColumn(e){var k,l,g,j,b,h,d,c,a,f;if(jH_evElm&&isEndInitEvent()){jH_evElm=null}k=$(e);l=k.attr("id");g=l.split("__")[0];j=colMap[g];if(!j){return}if(!isEndInitEvent()&¬FireCols&¬FireCols.indexOf(g)>=0){return}for(b=0;b<j.length;b++){h=(l==g?"":"__"+l.split("__")[1]);d=j[b]+h;c=d.split("__")[0];a=isEndInitEvent()?$(".h_evElm[h_evCid="+d+"]"):jH_evElm.filter("[h_evCid="+d+"]");f=a.attr("h_evWrtbl");eventColumn(k,a,d,c,h,f)}}function eventColumn(jEvCol,jTag,cid,cname,suffix,writable){var evVal,url,param,_pos1,_pos2,_repClm,_rep,_clm,noVal,columnFocus,jCol,val,renderer,editor,ATTRS,optAttrs,i,optAtt,vtype,isAdd;var callback;var keys,keysList,flgEncrypt;var obj={};if(!jTag||jTag.length==0){alert("[SYSTEM_ERROR] : jTag is null. The element of the replacement object doesn't exist. ["+cname+"]");return}if(!isEndInitEvent()){evVal=jEvCol.get(0).value;if(!evVal||evVal==null||evVal==""){return}}try{url=eval("EC_"+cname+"_URL")}catch(e){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. (variable undefinition). ["+cname+"]");return}if(!url||url==""){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. ["+cname+"]");return}param="";try{param=(writable?eval("EC_"+cname+"_EDITPARAM"):eval("EC_"+cname+"_RENDPARAM"))}catch(e){}try{keys=(writable?eval("EC_"+cname+"_EDITPARAMKEYS"):eval("EC_"+cname+"_RENDPARAMKEYS"))}catch(e){}flgEncrypt=eval("EC_"+cname+"_FLGENCRYPT");if(flgEncrypt==="true"){if(keys){keysList=keys.split(",");for(var i=0;i<keysList.length;i++){var key=keysList[i];var val=suffix==""?$("#"+key).get(0).value:$("#"+key+suffix).get(0).value;obj[key]=val}}}else{if(param!=null&¶m!=""){url+="?";_pos1=0;_pos2=0;while((_pos1=param.indexOf("{@",_pos2))!=-1){_pos2=param.indexOf("}",_pos1);_clm=param.substring(_pos1+2,_pos2);if(_clm.indexOf(".")<0){_repClm="{@"+_clm+"}";var rtnNull=function(){console.log("noDifined:");console.log(arguments[0]);return null};_rep=suffix==""?$("#"+_clm)[0]?$("#"+_clm).get(0).value:rtnNull(_clm):$("#"+_clm+suffix)[0]?$("#"+_clm+suffix).get(0).value:rtnNull(_clm+suffix);_rep=(_rep==null?"":_rep);param=param.replace(_repClm,_rep);url+=_clm+"="+encodeURIComponent(_rep)+"&"}_pos2=_pos1+1}}}noVal=function(){_firstOption=jCol.children("option").get(0);if(_firstOption==null||_firstOption.value!=""){return false}return true};columnFocus=function(){jCol.attr("isfocus","true")};if(cid!=null&&cid!=""){jCol=jTag.find("#"+cid)}else{jCol=new Array(0)}if(jCol.length>0&&isEndInitEvent()){jCol.bind("focus",columnFocus)}val="";if(jCol.length>0){if(isEndInitEvent()){val=(jCol.val()==null?"":jCol.val())}else{val=(jTag.attr("h_evVal")==null?"":jTag.attr("h_evVal"))}}renderer="";try{renderer=eval("EC_"+cname+"_RENDERER")}catch(e){}editor="";try{editor=eval("EC_"+cname+"_EDITOR")}catch(e){}ATTRS=["title","style","tabindex","readonly","disabled","onClick","onChange","onBlur","onFocus","ondblClick","onMouseDown","onMouseUp","onMouseMove","onMouseOut","onMouseOver","onSelect","onKeydown","onKeypress","onKeyup","eventCallBack","multiple"];optAttrs="";if(jCol.length>0){for(i=0;i<ATTRS.length;i++){optAtt=jCol.attr(ATTRS[i]);if(optAtt!=null){vtype=typeof(optAtt);isAdd=false;if(vtype=="function"){optAtt=optAtt.toString();isAdd=optAtt.length>0?true:false;optAtt="("+optAtt+")()"}else{if(vtype=="boolean"){isAdd=optAtt}else{isAdd=optAtt.length>0?true:false}}if(isAdd){optAttrs+=ATTRS[i]+"='"+optAtt+"' "}}}}obj.EC_CID=(cid==null?"":cid);obj.EC_CNAME=(cname==null?"":cname);obj.EC_RENDERER=renderer;obj.EC_EDITOR=editor;obj.EC_PARAM=param;obj.EC_SQL=param;obj.EC_WRITABLE=(writable==null?"":writable);obj.EC_CVALUE=val;obj.EC_NOVALUE=(jCol.length==0?"":noVal());obj.EC_CLASS=(jCol.length==0?"":jCol.attr("class"));obj.EC_SIZE=(jCol.length==0?"":jCol.attr("size"));obj.EC_MAXLENGTH=(jCol.length==0?"":jCol.attr("maxlength"));obj.EC_OPTATTRS=optAttrs;obj.EC_PNAME=jEvCol.attr("id")==null?"":jEvCol.attr("id").split("__")[0];obj.EC_PVALUE=jEvCol.get(0).value==null?"":jEvCol.get(0).value;obj.EC_USESLBL=(suffix==null||suffix=="")?"false":"true";$.ajax({url:url,data:obj,type:"POST",dataType:"html",async:isEndInitEvent(),error:function(r,s,e){if(url.indexOf(".htm")<0){alert("EventColumnError:"+r+":"+s+":"+e+":"+cname)}},success:function(data,status){var jNewCol=$(data);if(jCol.length>0){if(isEndInitEvent()){jCol.unbind("focus",columnFocus)}bindOldEvents(jNewCol.get(0),jQuery.data(jCol.clone(true).get(0),"events"))}jTag.empty().append(jNewCol);if(jCol.length>0){jTag.find("input,select,textarea").attr("name",cid).attr("id",cid);if(isEndInitEvent()){if(jCol.attr("isfocus")){jNewCol.get(0).focus();if($.browser.msie){jNewCol.get(0).focus()}}}if(!isEndInitEvent()){jNewCol.change()}if(jCol.attr("eventCallback")){callback=function(){eval(jCol.attr("eventCallback")+"(arguments);")};callback(cid,jNewCol.val(),jCol.get(0).value)}}if(suffix!=null&&suffix!=""){if(isEndInitEvent()){$("table#viewTable").resizeView()}}}})}function bindOldEvents(d,a){var c,b;for(c in a){for(b in a[c]){jQuery.event.add(d,c,a[c][b],a[c][b].data)}}}var isShowTip=false;$(function(){if(USE_REAL_TIME_CHECK){setEvent('textarea:not([realTimeChk="false"]),select:not([realTimeChk="false"]),input[type="text"]:not([realTimeChk="false"])',"focusout",function(){var b=RegExp(/jsp/);var a=location.pathname.match(b);check(this,RegExp.leftContext+"jsp/common/realtimecheck.jsp")});$("table#viewTable").parent().parent().scroll(function(){if(isShowTip){isShowTip=false;$(".tipErr").remove()}})}});function check(f,b){var c,d,h,g,e,j,a,i;c=f.name;if(typeof jQuery!="undefined"&&c.indexOf("h_")!=0){d=f.value;if(f.rtOption!="null"&&f.rtOption!="undefined"){i=f.getAttribute("rtOption")}h=c.split("__");g=(2==h.length);e="command=RENEW&checkType="+(g?"ENTRY":"NEW")+(g?"&h_rowSel="+h[1]:"")+"&column="+h[0]+"&"+c+"="+encodeURIComponent(d)+(i?"&"+i:"");j={dataType:"html",type:"POST",url:b,data:e};j.error=function(){};j.success=function(k){a=$(f).data("tipId");$("#"+a).remove();if($.trim(k).indexOf("row_error")>=0){showCheckTip(f,k);isShowTip=true}};$.ajax(j)}return true}function showCheckTip(a,c){var j,i,k,g,e,h,f,d,b;j=$(a);i=j.offset();if(i.top>=30){e="<div class='tipErr'><div id='tipArrowBottom'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+(-11-h[0].offsetHeight)}else{e="<div class='tipErr'><div id='tipArrowTop'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+11+h[0].offsetHeight}b=(new Date()).getTime();$(a).data("tipId",b);h.css({left:f+"px",top:d+"px"}).attr("id",b).click(function(){$(this).remove()}).show()}$(function(){bindEvents()});$.fn.simpleColorPickerOg=function(a){var c={colorsPerLine:8,colors:["#000000","#444444","#666666","#999999","#cccccc","#eeeeee","#f3f3f3","#ffffff","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#0000ff","#9900ff","#ff00ff","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79","#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47","#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4C1130"],showEffect:"",hideEffect:"",onChangeColor:false};var b=$.extend(c,a);return this.each(function(){var g=$(this);var l="";var j=g.attr("id").replace(/-/g,"")+"_";for(var f=0;f<b.colors.length;f++){var m=b.colors[f];var k="";if(f%b.colorsPerLine==0){k="clear: both; "}if(f>0&&k&&$.browser&&$.browser.msie&&$.browser.version<=7){k="";l+='<li style="float: none; clear: both; overflow: hidden; background-color: #fff; display: block; height: 1px; line-height: 1px; font-size: 1px; margin-bottom: -2px;"></li>'}l+='<li id="'+j+"color-"+f+'" class="color-box" style="'+k+"background-color: "+m+'" title="'+m+'"></li>'}k="clear: both; ";l+='<li id="'+j+'color-default" class="color-box" style="width:80px; text-align:center; '+k+'background-color:white;" title="clear">clear</li>';var h=$('<div id="'+j+'color-picker" class="color-picker" style="position: absolute; left: 0px; top: 0px;"><ul>'+l+'</ul><div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("li.color-box").click(function(){var i=isNaN(this.id.substr(this.id.indexOf("-")+1))?"":b.colors[this.id.substr(this.id.indexOf("-")+1)];if(!g.is("input")){g.val(i);g.blur()}if($.isFunction(c.onChangeColor)){c.onChangeColor.call(g,i)}d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){g=$(this);i.stopPropagation();if(!g.is("input")){e(h)}});g.change(function(i){if(g.val()!=g.css("background-color")){g.css("background-color",g.val()).css("color",g.val())}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.simpleColorPickerOg){$("input.colorPicker").simpleColorPickerOg({onChangeColor:function(a){$(this).val(a).css("background-color",a).css("color",a).change()}})}});jQuery.fn.ogClockpicker=function(options,callback){var org_settings={starthour:6,endhour:20,showminutes:"true",minutedivisions:4,military:true,event:"click",layout:"vertical",valuefield:null,useBgiframe:false,hoursopacity:1,minutesopacity:1,second:""};if(options){jQuery.extend(org_settings,options)}var callback=callback||function(){},v=(org_settings.layout=="vertical");errorcheck(org_settings);jQuery(this)[org_settings.event](function(e){var self=this,$self=jQuery(this),$body=jQuery("body");var settings=jQuery.extend(true,{},org_settings);if($self.attr("valuefield")){settings.valuefield=$self.attr("valuefield")}if($self.attr("starthour")){settings.starthour=parseInt($self.attr("starthour"))}if($self.attr("endhour")){settings.endhour=parseInt($self.attr("endhour"))}if($self.attr("minutedivisions")){settings.minutedivisions=parseInt($self.attr("minutedivisions"))}if($self.attr("military")){settings.military=$self.attr("military")}if($self.attr("showminutes")){settings.showminutes=$self.attr("showminutes")}if($self.attr("usesecond")=="true"){settings.second="00"}if($self.attr("layout")){settings.layout=$self.attr("layout");org_settings.layout=settings.layout;v=(settings.layout=="vertical")}errorcheck(settings);if(!settings.valuefield){$self.unbind("keydown").bind("keydown",keyhandler)}else{var inputfield=jQuery("[name="+settings.valuefield+"]");inputfield.unbind("keydown").bind("keydown",keyhandler)[0].focus();inputfield.bind("click",function(){inputfield.unbind("keydown")})}jQuery("#CP_hourcont,#CP_minutecont").remove();var $hourcont=jQuery("<div id='CP_hourcont' class='CP' />").appendTo($body);!settings.useBgiframe?$hourcont.css("opacity",settings.hoursopacity):null;binder($hourcont);var $hourcol=[];for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){$hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo($body))}if(settings.showminutes=="true"){var $mc=jQuery("<div id='CP_minutecont' class='CP' />").appendTo($body);!settings.useBgiframe?$mc.css("opacity",settings.minutesopacity):null;binder($mc)}if(!v){$hourcont.css("width","auto");if(settings.showminutes=="true"){$mc.css("width","auto")}}else{for(i=0;i<$hourcol.length;i++){$hourcol[i].addClass("floatleft")}}renderhours();putcontainer();function renderhours(){var c=1;var numberC=0;for(var h=settings.starthour;h<=settings.endhour;h++){if(h%12==0){c=1}var displayhours=((!settings.military&&h>12)?h-12:h);var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}var $hd=jQuery("<div class='CP_hour' id='hr_"+h+"_"+c+"' value='"+valuehouers+"' >"+displayhours+set_tt(h)+"</div>");if(settings.military){$hd.width(20)}binder($hd);if(!v){$hd.css("float","left")}$hourcol[numberC].append($hd);if((h+1)%12==0){numberC++}c++}for(var j=0;j<$hourcol.length;j++){if(v){if(j!=0&&j%2==0){$hourcol[j].css("margin-left",$mc.width()+4+"px")}}else{$hourcont.append("<div style='clear:left' />");if(j!=0&&j%2==0){$hourcol[j].css("margin-top","19px")}}$hourcont.append($hourcol[j])}}function renderminutes(h){var realhours=h;var displayhours=(!settings.military&&h>12)?h-12:h;var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}$mc.empty();var n=60/settings.minutedivisions,tt=set_tt(realhours),counter=1;for(var m=0;m<60;m=m+n){$md=jQuery("<div class='CP_minute' id='"+realhours+"_"+m+"' value='"+valuehouers+((m<10)?"0":"")+m+"'>"+displayhours+":"+((m<10)?"0":"")+m+tt+"</div>");if(!v){$md.css("float","left");if(settings.minutedivisions>6&&counter==settings.minutedivisions/2+1){$mc.append("<div style='clear:left' />")}}$mc.append($md);binder($md);counter++}}function set_tt(realhours){if(!settings.military){return(realhours>=12)?" PM":" AM"}else{return""}}function putcontainer(){if(e.type!="focus"){$hourcont[0].style.left=e.pageX-5+"px";$hourcont[0].style.top=e.pageY-(Math.floor($hourcont.height()/2))+"px";rectify($hourcont)}else{$self.after($hourcont)}$hourcont.slideDown("fast");if(settings.useBgiframe){bgi($hourcont)}}function rectify($obj){var ph=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var pw=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;var t=parseInt($obj[0].style.top);var l=parseInt($obj[0].style.left);var st=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;if(t<=st&&!$obj.is("#CP_minutecont")){$obj.css("top",st+10+"px")}else{if(t+$obj.height()-st>ph){$obj.css("top",st+ph-$obj.height()-10+"px")}}if(l<=0){$obj.css("left","10px")}}function bgi(ob){if(typeof jQuery.fn.bgIframe=="function"){ob.bgIframe()}else{alert("bgIframe plugin not loaded.")}}function binder($obj){if($obj.attr("id")=="CP_hourcont"){$obj.mouseout(function(e){hourcont_out(e)})}else{if($obj.attr("id")=="CP_minutecont"){$obj.mouseout(function(e){minutecont_out(e)})}else{if($obj.attr("class")=="CP_hour"){$obj.mouseover(function(e){hourdiv_over($obj,e)});$obj.mouseout(function(){hourdiv_out($obj)});$obj.click(function(){hourdiv_click($obj)})}else{if($obj.attr("class")=="CP_minute"){$obj.mouseover(function(){minutediv_over($obj)});$obj.mouseout(function(){minutediv_out($obj)});$obj.click(function(){minutediv_click($obj)})}}}}}function hourcont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function minutecont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function hourdiv_over($obj,e){var h=$obj.attr("id").split("_")[1],i=$obj.attr("id").split("_")[2],l,t,nn;$obj.addClass("CP_over");nn=Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2);if(settings.showminutes=="true"){$mc.hide();renderminutes(h);if(v){t=e.type=="mouseover"?e.pageY-15:$hourcont.offset().top+2+($obj.height()*i);l=$hourcont.offset().left+$hourcol[0].width()*2*nn+$mc.width()*(nn-1)+4*nn-2}else{l=(e.type=="mouseover")?e.pageX-10:$hourcont.offset().left+($obj.width()-5)*i;t=$hourcont.offset().top+($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn+$mc.height()*(nn-1)+2*nn-1}$mc.css("left",l+"px").css("top",t+"px");rectify($mc);$mc.show();if(settings.useBgiframe){bgi($mc)}}return false}function hourdiv_out($obj){$obj.removeClass("CP_over");return false}function hourdiv_click($obj){var h=$obj.attr("id").split("_")[1],tt=set_tt(h),str=$obj.attr("value");if(str.indexOf(" ")!=-1){var cleanstr=str.substring(0,str.indexOf(" "))}else{var cleanstr=str}$obj.text(cleanstr+"00"+settings.second);setval($obj);cleardivs()}function minutediv_over($obj){$obj.addClass("CP_over");return false}function minutediv_out($obj){$obj.removeClass("CP_over");return false}function minutediv_click($obj){$obj.text($obj.attr("value")+settings.second);setval($obj);cleardivs()}function setval($obj){if(!settings.valuefield){self.value=$obj.text()}else{jQuery("input[name="+settings.valuefield+"]").val($obj.text()).change()}callback.apply($self,[$obj.text()]);$self.unbind("keydown",keyhandler)}function cleardivs(){if(settings.showminutes=="true"){$mc.hide()}$hourcont.slideUp("fast");$self.unbind("keydown",keyhandler)}function keyhandler(e){var $obj=$("div.CP_over").size()?$("div.CP_over"):$("div.CP_hour:first"),divtype=$obj.is(".CP_hour")?"hour":"minute",hi=(divtype=="hour")?$obj[0].id.split("_")[2]:0,h=(divtype=="minute")?$obj[0].id.split("_")[0]:$obj[0].id.split("_")[1];if(divtype=="minute"){if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){var curloc="m1"}else{if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){var curloc="m2"}else{var curloc="m3"}}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var curloc="h1"}else{var curloc="h2"}}function divprev($obj){if($obj.prev().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.prev(), e)")}else{return false}}function divnext($obj){if($obj.next().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.next(), e)")}else{return false}}function hourtohour($obj){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1)}var ctx="#hourcol"+next;$newobj=jQuery(".CP_hour[id$=_"+hi+"]",ctx);if($newobj.size()){hourdiv_out($obj);hourdiv_over($newobj,e)}else{return false}}function hourtominute($obj){hourdiv_out($obj);minutediv_over($(".CP_minute:first"))}function minutetohour($obj,where){minutediv_out($obj);if(where<0){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)-12)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)+12)}}var ctx="#hourcol"+next;var $newobj=jQuery(".CP_hour[id^=hr_"+h+"]",ctx);hourdiv_over($newobj,e)}switch(e.keyCode){case 37:if(v){switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}else{divprev($obj)}break;case 38:if(v){divprev($obj)}else{switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}break;case 39:if(v){switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}else{divnext($obj)}break;case 40:if(v){divnext($obj)}else{switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}break;case 13:eval(divtype+"div_click($obj)");break;default:return true}return false}return false});function errorcheck(settings){if(settings.starthour>=settings.endhour){alert("Error - start hour must be less than end hour.");return false}else{if(60%settings.minutedivisions!=0){alert("Error - param minutedivisions must divide evenly into 60.");return false}}}return this};$(function(){if($.fn.ogClockpicker){$(document).ready(function(){$(".clockpick").ogClockpicker()})}});function likeComp(c){var b=c.substring(6);var d=$("#"+c).attr("aimaiType");var a=$("#"+b).val();a=a.replace(/^%+|%+$/g,"");if(a!=""){switch(d){case"1":a=a+"%";break;case"2":a="%"+a;break;case"3":a="%"+a+"%";break}}$("#"+b).val(a)}$(function(){$("form").submit(function(){$("[id^='AIMAI_']").each(function(){likeComp(this.id)})})});$.fn.aimaiPickerOg=function(a){var c={texts:[" V "," V*","*V ","*V*"],titls:["完全一致","前方一致","後方一致","前後曖昧"]};var b=$.extend(c,a);return this.each(function(){var g=$(this);var j="PIC_"+g.attr("id").replace(/-/g,"")+"_";var l="";for(var f=0;f<b.texts.length;f++){var m=b.texts[f];var k=b.titls[f];l+='<span id="'+j+"text-"+f+'" class="text-box"" title="'+k+'">('+m+") </span>"}var h=$('<div id="'+j+'aimai-picker" class="aimai-picker" style="position: absolute; left: 0px; top: 0px;">'+l+'<div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("span.text-box").click(function(){var i=this.id.substr(this.id.indexOf("-")+1);g.attr("aimaiType",i);g.attr("title",b.titls[i]);g.text(b.texts[i]);g.blur();d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){i.stopPropagation();if(!g.is("input")){e(h)}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.aimaiPickerOg){$(".aimaiClm").aimaiPickerOg()}});(function(){$.fn.glDatePicker=function(options){var pluginName="glDatePicker";var instance=this.data(pluginName);if(!instance){return this.each(function(){return $(this).data(pluginName,new glDatePicker(this,options))})}return(options===true)?instance:this};$.fn.glDatePicker.defaults={cssName:"default",zIndex:1000,borderSize:1,calendarOffset:{x:0,y:1},showAlways:false,hideOnClick:true,allowMonthSelect:true,allowYearSelect:true,todayDate:new Date(),selectedDate:null,prevArrow:"\u25c4",nextArrow:"\u25ba",selectableDates:null,selectableDateRange:null,specialDates:null,selectableMonths:null,selectableYears:null,selectableDOW:null,monthNames:null,dowNames:null,dowOffset:(HYBS_CAL_START_MON==true?1:0),onClick:(function(el,cell,date,data){var tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){var _targetId=el.attr("targetId");if(_targetId!=null){tgt=$("#"+_targetId)}}var year=date.getFullYear();var month=date.getMonth()+1;var day=date.getDate();if(month<10){month="0"+month}if(day<10){day="0"+day}var oldval=tgt.val();var str=year+""+month+""+day;tgt.val(str);if(oldval!=str){tgt.change()}}),onHover:function(el,cell,date,data){},onShow:function(calendar){calendar.show()},onHide:function(calendar){calendar.hide()},firstDate:null};var glDatePicker=(function(){function glDatePicker(element,userOptions){var self=this;self.el=$(element);var el=self.el;self.options=$.extend(true,{},$.fn.glDatePicker.defaults,userOptions);var options=self.options;var _tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){if(el.attr("targetId")){_tgt=$("#"+el.attr("targetId"))}}var _inputDate=_tgt.val();if(_inputDate!=null&&_inputDate.length>=8){_inputDate=_inputDate.replace(/\u002f/g,"");try{_inputDate=_inputDate.substr(0,4)+"/"+_inputDate.substr(4,2)+"/"+_inputDate.substr(6,2)}catch(e){_inputDate=null}}else{_inputDate=null}self.calendar=$($.find("[gldp-el="+el.attr("gldp-id")+" ]"));options.selectedDate=(options.selectedDate||new Date(_inputDate||options.todayDate))||options.todayDate;options.firstDate=(new Date((options.firstDate||options.selectedDate)))._first();if(!(el.attr("gldp-id")||"").length){el.attr("gldp-id","gldp-"+Math.round(Math.random()*10000000000))}el.addClass("gldp-el").bind("click",function(e){self.show(e)});if(self.calendar.length&&!options.showAlways){self.calendar.hide()}$(document).bind("mouseup",function(e){var target=e.target;var calendar=self.calendar;if(!el.is(target)&&!calendar.is(target)&&calendar.has(target).length===0&&calendar.is(":visible")){self.hide()}})}glDatePicker.prototype={show:function(){this.render();$.each($(".gldp-el").not(this.el),function(i,o){if(o.length){o.options.onHide(o.calendar)}});this.options.onShow(this.calendar)},hide:function(){if(this.options&&!this.options.showAlways){this.options.onHide(this.calendar)}},render:function(renderCalback){var self=this;var el=self.el;var options=self.options;var calendar=self.calendar;var coreClass=" core border ";var cssName="gldp-"+options.cssName;var todayVal=options.todayDate._val();var todayTime=todayVal.time;var maxRow=6;var maxCol=7;var borderSize=options.borderSize+"px";var getSelectableList=function(min,max,userList){var resultList=[];for(var i=min;i<=max;i++){resultList.push(i)}if(userList){var newList=[];$.each(userList,function(i,v){if(v>=min&&v<=max&&newList._indexOf(v)<0){newList.push(v)}});resultList=newList.length?newList:resultList}resultList.sort();return resultList};var selectableMonths=getSelectableList(0,11,options.selectableMonths);var selectableYears=getSelectableList(todayVal.year-5,todayVal.year+5,options.selectableYears);var selectableDOW=getSelectableList(0,6,options.selectableDOW);var dowNames=options.dowNames||["日","月","火","水","木","金","土"];var monthNames=options.monthNames||["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];var containerSize=window.innerHeight?window.innerHeight:180;if(containerSize<180){containerSize=(containerSize>135?containerSize:135)}else{containerSize=180}var containerWidth=options.conainerWidth||containerSize;var containerHeight=containerWidth;var getCellSize=function(_size,_count){return(_size/_count)+((options.borderSize/_count)*(_count-1))-1};var cellWidth=getCellSize(containerWidth,maxCol);var cellHeight=getCellSize(containerHeight,maxRow+2);if(!calendar.length){self.calendar=calendar=$("<div/>").attr("gldp-el",el.attr("gldp-id")).data("is",true).css({display:(options.showAlways?undefined:"none"),zIndex:options.zIndex,width:((cellWidth+1)*maxCol)+"px"});$("body").append(calendar)}else{if(!eval(calendar.data("is"))){containerWidth=calendar.outerWidth();containerHeight=calendar.outerHeight();cellWidth=getCellSize(containerWidth,maxCol);cellHeight=getCellSize(containerHeight,maxRow+2)}self.calendar.css({width:((cellWidth+1)*maxCol)+"px"})}if(!el.is(":visible")){calendar.hide()}calendar.removeClass().addClass(cssName).children().remove();var onResize=function(){var elPos=el.offset();calPosTop=(elPos.top+el.outerHeight()+options.calendarOffset.y)-20;calPosLeft=(elPos.left+options.calendarOffset.x);if(calPosTop>$(window).height()-150){calPosTop-=130}if(calPosLeft>$(window).width()-150){calPosLeft-=150}if(calPosTop<0){calPosTop=0}if(calPosLeft<0){calPosLeft=0}calendar.css({top:calPosTop+"px",left:calPosLeft+"px"})};$(window).resize(onResize);onResize();var cellCSS={width:cellWidth+"px",height:cellHeight+"px",lineHeight:cellHeight+"px"};var setFirstDate=function(_date){if(_date){options.firstDate=_date;self.render()}};var getFirstDate=function(_offset){var _date=new Date(options.firstDate);_offset=_offset||0;while(true){_date.setMonth(_date.getMonth()+_offset);_date.setDate(Math.min(1,_date._max()));if(_offset==0){break}var dateVal=_date._val();var dateMonth=dateVal.month;var dateYear=dateVal.year;if(selectableMonths._indexOf(dateMonth)!=-1){if(selectableYears._indexOf(dateYear)!=-1){break}else{if(dateYear<selectableYears[0]||dateYear>selectableYears[selectableYears.length-1]){return null}}}}return _date};var prevFirstDate=getFirstDate(-1);var nextFirstDate=getFirstDate(1);var firstDate=(options.firstDate=getFirstDate());var firstDateVal=firstDate._val();var firstDateMonth=firstDateVal.month;var firstDateYear=firstDateVal.year;var startDate=new Date(firstDate);var dowOffset=Math.abs(Math.min(6,Math.max(0,options.dowOffset)));var startOffset=startDate.getDay()-dowOffset;startOffset=startOffset<1?-7-startOffset:-startOffset;dowNames=(dowNames.concat(dowNames)).slice(dowOffset,dowOffset+7);startDate._add(startOffset);var showPrev=(prevFirstDate);var showNext=(nextFirstDate);var monyearClass=coreClass+"monyear ";var prevCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{borderWidth:borderSize+" 0 0 "+borderSize})).append($("<a/>").addClass("prev-arrow"+(showPrev?"":"-off")).html(options.prevArrow)).mousedown(function(){return false}).click(function(e){if(options.prevArrow!=""&&showPrev){e.stopPropagation();setFirstDate(prevFirstDate)}});var titleCellCount=maxCol-2;var titleWidth=(cellWidth*titleCellCount)-(titleCellCount*options.borderSize)+(options.borderSize);var titleCell=$("<div/>").addClass(monyearClass+"title").css($.extend({},cellCSS,{width:titleWidth+"px",borderTopWidth:borderSize,marginLeft:"-"+(borderSize)}));var nextCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{marginLeft:"-"+(borderSize),borderWidth:borderSize+" "+borderSize+" 0 0"})).append($("<a/>").addClass("next-arrow"+(showNext?"":"-off")).html(options.nextArrow)).mousedown(function(){return false}).click(function(e){if(options.nextArrow!=""&&showNext){e.stopPropagation();setFirstDate(nextFirstDate)}});calendar.append(prevCell).append(titleCell).append(nextCell);for(var row=0,cellIndex=0;row<maxRow+1;row++){for(var col=0;col<maxCol;col++,cellIndex++){var cellDate=new Date(startDate);var cellClass="day";var cellZIndex=options.zIndex+(cellIndex);var cell=$("<div/>");if(!row){cellClass="dow";cell.html(dowNames[col]);cellDate=null}else{cellDate._add(col+((row-1)*maxCol));var cellDateVal=cellDate._val();var cellDateTime=cellDateVal.time;var specialData=null;var isSelectable=true;var getRepeatDate=function(v,date){if(v.repeatYear===true){date.setYear(cellDateVal.year)}if(v.repeatMonth===true){date.setMonth(cellDateVal.month)}return date._val()};cell.html(cellDateVal.date);if(options.selectableDateRange){isSelectable=false;$.each(options.selectableDateRange,function(i,v){var dateFrom=v.from;var dateTo=(v.to||null);dateTo=dateTo||new Date(v.from.getFullYear(),v.from.getMonth(),v.from._max());dateFrom=getRepeatDate(v,dateFrom);dateTo=getRepeatDate(v,dateTo);if(cellDateTime>=dateFrom.time&&cellDateTime<=dateTo.time){isSelectable=true;return true}})}if(options.selectableDates){if((options.selectableDateRange&&!isSelectable)||(isSelectable&&!options.selectableDateRange)){isSelectable=false}$.each(options.selectableDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){return(isSelectable=true)}})}if(!isSelectable||selectableYears._indexOf(cellDateVal.year)<0||selectableMonths._indexOf(cellDateVal.month)<0||selectableDOW._indexOf(cellDateVal.day)<0){cellClass="noday"}else{cellClass=(["sun","mon","tue","wed","thu","fri","sat"])[cellDateVal.day];if(firstDateMonth!=cellDateVal.month){cellClass+=" outday"}if(todayTime==cellDateTime){cellClass="today";cellZIndex+=50}if(options.selectedDate._time()==cellDateTime){cellClass="selected";cellZIndex+=51}if(options.specialDates){$.each(options.specialDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){cellClass=(v.cssClass||"special");cellZIndex+=52;specialData=v.data}})}cell.mousedown(function(){return false}).hover(function(e){e.stopPropagation();var hoverData=$(this).data("data");options.onHover(el,cell,hoverData.date,hoverData.data)}).click(function(e){e.stopPropagation();var clickedData=$(this).data("data");options.selectedDate=options.firstDate=clickedData.date;self.render(function(){if(!options.showAlways&&options.hideOnClick){self.hide()}});options.onClick(el,$(this),clickedData.date,clickedData.data)})}}$.extend(cellCSS,{borderTopWidth:borderSize,borderBottomWidth:borderSize,borderLeftWidth:(row>0||(!row&&!col))?borderSize:0,borderRightWidth:(row>0||(!row&&col==6))?borderSize:0,marginLeft:(col>0)?"-"+(borderSize):0,marginTop:(row>0)?"-"+(borderSize):0,zIndex:cellZIndex});cell.data("data",{date:cellDate,data:specialData}).addClass(coreClass+cellClass).css(cellCSS);calendar.append(cell)}}var toggleYearMonthSelect=function(showYear){var show="inline-block";var hide="none";if(options.allowMonthSelect){monthText.css({display:!showYear?hide:show});monthSelect.css({display:!showYear?show:hide})}if(options.allowYearSelect){yearText.css({display:showYear?hide:show});yearSelect.css({display:showYear?show:hide})}};var onYearMonthSelect=function(){options.firstDate=new Date(yearSelect.val(),monthSelect.val(),1);self.render()};var monthSelect=$("<select/>").hide().change(onYearMonthSelect);var yearSelect=$("<select/>").hide().change(onYearMonthSelect);var monthText=$("<span/>").html(monthNames[firstDateMonth]).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(false)});var yearText=$("<span/>").html(firstDateYear).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(true)});$.each(monthNames,function(i,v){if(options.allowMonthSelect&&selectableMonths._indexOf(i)!=-1){var o=$("<option/>").html(v).attr("value",i);if(i==firstDateMonth){o.attr("selected","selected")}monthSelect.append(o)}});$.each(selectableYears,function(i,v){if(options.allowYearSelect){var o=$("<option/>").html(v).attr("value",v);if(v==firstDateYear){o.attr("selected","selected")}yearSelect.append(o)}});var titleYearMonth=$("<div/>").append(monthText).append(monthSelect).append(yearText).append(yearSelect);titleCell.children().remove();titleCell.append(titleYearMonth);renderCalback=renderCalback||(function(){});renderCalback();var mousewheelevent="onwheel" in document?"wheel":"onmousewheel" in document?"mousewheel":"DOMMouseScroll";calendar.bind(mousewheelevent,function(e){e.preventDefault();var delta=e.originalEvent.deltaY?-(e.originalEvent.deltaY):e.originalEvent.wheelDelta?e.originalEvent.wheelDelta:-(e.originalEvent.detail);if(delta<0){nextCell.click()}else{prevCell.click()}})}};return glDatePicker})();(function(){Date.prototype._clear=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype._time=function(){return this._clear().getTime()};Date.prototype._max=function(){var isLeapYear=(new Date(this.getYear(),1,29).getMonth()==1)?1:0;var days=[31,28+isLeapYear,31,30,31,30,31,31,30,31,30,31];return days[this.getMonth()]};Date.prototype._add=function(days){this.setDate(this.getDate()+days)};Date.prototype._first=function(){var date=new Date(this);date.setDate(1);return date};Date.prototype._val=function(){this._clear();return{year:this.getFullYear(),month:this.getMonth(),date:this.getDate(),time:this.getTime(),day:this.getDay()}};Array.prototype._indexOf=function(value){return $.inArray(value,this)}})()})();$(function(){if($.fn.glDatePicker){$(".calPic").glDatePicker()}});function selectScroll(a){var d=4;if(a.getAttribute("size")){d=a.getAttribute("size")}var e=a.options;for(var c=0;c<e.length;c++){if(e[c].selected){if(e[c].parentNode.tagName.toUpperCase()=="OPTGROUP"){c+=$(e[c].parentNode).prev().length}var b=c*($(a).height()/d);break}}$(a).scrollTop(b)}$(function(){$("select[multiple]").each(function(){selectScroll(this)})}); | |
\ No newline at end of file |
@@ -1,4 +1,25 @@ | ||
1 | -5.10.3.2 (2018/09/28) | |
1 | +5.10.4.0 (2018/10/05) | |
2 | + [eventColumn改善] | |
3 | + eventColumnの方法を若干変更し、セキュリティ上の対応を行います。 | |
4 | + hayabusa.taglib.ValueTag#release2() | |
5 | + hayabusa.taglib.ValueTag#actionExec( final String action,final String value ) | |
6 | + hayabusa.taglib.ValueTag#setCryptKey( final String cKey ) | |
7 | + hayabusa.taglib.ValueTag#toString() | |
8 | + hayabusa.db.DBEventColumn#DBEventColumn( final String name, final String evCol, final String eventUrl, | |
9 | + final String renderer, final String editor, final String rendParam, final String editParam ) | |
10 | + hayabusa.db.DBEventColumn#DBEventColumn( final String name, final String evCol, final String eventUrl, | |
11 | + final String renderer, final String editor, final String rendParam, final String editParam, | |
12 | + final String rendParamKeys, final String editParamKeys, final String flgEncrypt ) | |
13 | + hayabusa.db.DBEventColumn#getRendParamKeys() | |
14 | + hayabusa.db.DBEventColumn#getEditParamKeys() | |
15 | + hayabusa.db.DBEventColumn#getFlgEncrypt() | |
16 | + jsp/common/eventScript.js#eventColumn( jEvCol, jTag, cid, cname, suffix, writable ) | |
17 | + jsp/common/eventColumn.jsp | |
18 | + jsp/common/eventColumnMaker.jsp | |
19 | + hybs-taglib.tld | |
20 | + hayabusa.common.SystemData#EVENT_SQL_ENCRYPT | |
21 | + | |
22 | +5.10.3.2 (2018/09/28) | |
2 | 23 | [JavaScriptグラフ修正] |
3 | 24 | タイムスケールでUNIX時間を数値として与える事が出来るようにします。 |
4 | 25 | これにより、時間に応じた位置にグラフがプロットされます。 |
@@ -1 +1 @@ | ||
1 | -var orgFldCls=null;$(function(){if(USE_FOCUS_HILIGHT){setEvent('textarea,select,input[type="text"]',"focusin",function(){doFocus2(this)});setEvent('textarea,select,input[type="text"]',"focusout",function(){doBlur2(this)})}});function doFocus2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.orgBgColor=a.style.backgroundColor;a.style.backgroundColor="#ffcccc"}else{orgFldCls=a.className;a.className="focusField "+orgFldCls}}}}function doBlur2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.style.backgroundColor=a.orgBgColor}else{if(orgFldCls!=null){a.className=orgFldCls}else{a.className="notFocusField"}}}}}oldDoFocusFlag=true;function doFocus(a){if(oldDoFocusFlag){oldDoFocusFlag=false;setTimeout(alert("Old Script Error!!\ncustom/query_info.jsp,custom/result_info.jsp Please delete the following part.\n<script>Tag(Header fix and Focus) , BODY onLoad and oncontextmenu Attribute"),100)}}function doBlur(a){}$(function(){setEvent('textarea,select,input[type="text"]',"focusout",function(){convert(this)})});function convert(b){var c,a;c=b.value;a=b.className;if(c!=null&&a!=null){if(a.match(/XL/)&&!(a.match(/XLU/))){b.value=c.toLowerCase()}else{if((a.match(/XU/)&&!(a.match(/XUL/)))||a.match(/PN2/)){b.value=c.toUpperCase()}}}return true}var colMap;var notFireCols;var jH_evElm;$(function(){if(!(typeof(EC_NAME)=="undefined")){jH_evElm=$(".h_evElm");makeColMapping();setEvent('textarea,select,input[type="text"]',"change",function(){makeColumn(this)},".h_evCol",true,addEvColCls);setEvent("input[type=checkbox],input[type=radio]","click",function(){makeColumn(this)},".h_evCol",true)}});function makeColMapping(){var b,a,e,d,c;if(colMap){return}colMap=new Object();for(b=0;b<EC_EVCOL.length;b++){e=EC_EVCOL[b].split(",");for(a=0;a<e.length;a++){d=e[a];if(d.charAt(0)=="_"){d=d.substring(1);if(notFireCols){notFireCols+=","}notFireCols+=d}c=colMap[d];if(!c){c=new Array()}c[c.length]=EC_NAME[b];colMap[d]=c}}}function addEvColCls(){for(var a in colMap){$("#"+a+",[id^="+a+"__]").addClass("h_evCol")}}function makeColumn(e){var k,l,g,j,b,h,d,c,a,f;if(jH_evElm&&isEndInitEvent()){jH_evElm=null}k=$(e);l=k.attr("id");g=l.split("__")[0];j=colMap[g];if(!j){return}if(!isEndInitEvent()&¬FireCols&¬FireCols.indexOf(g)>=0){return}for(b=0;b<j.length;b++){h=(l==g?"":"__"+l.split("__")[1]);d=j[b]+h;c=d.split("__")[0];a=isEndInitEvent()?$(".h_evElm[h_evCid="+d+"]"):jH_evElm.filter("[h_evCid="+d+"]");f=a.attr("h_evWrtbl");eventColumn(k,a,d,c,h,f)}}function eventColumn(jEvCol,jTag,cid,cname,suffix,writable){var evVal,url,param,_pos1,_pos2,_repClm,_rep,_clm,noVal,columnFocus,jCol,val,renderer,editor,ATTRS,optAttrs,i,optAtt,vtype,isAdd;var callback;if(!jTag||jTag.length==0){alert("[SYSTEM_ERROR] : jTag is null. The element of the replacement object doesn't exist. ["+cname+"]");return}if(!isEndInitEvent()){evVal=jEvCol.get(0).value;if(!evVal||evVal==null||evVal==""){return}}try{url=eval("EC_"+cname+"_URL")}catch(e){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. (variable undefinition). ["+cname+"]");return}if(!url||url==""){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. ["+cname+"]");return}param="";try{param=(writable?eval("EC_"+cname+"_EDITPARAM"):eval("EC_"+cname+"_RENDPARAM"))}catch(e){}if(param!=null&¶m!=""){url+="?";_pos1=0;_pos2=0;while((_pos1=param.indexOf("{@",_pos2))!=-1){_pos2=param.indexOf("}",_pos1);_clm=param.substring(_pos1+2,_pos2);if(_clm.indexOf(".")<0){_repClm="{@"+_clm+"}";var rtnNull=function(){console.log("noDifined:");console.log(arguments[0]);return null};_rep=suffix==""?$("#"+_clm)[0]?$("#"+_clm).get(0).value:rtnNull(_clm):$("#"+_clm+suffix)[0]?$("#"+_clm+suffix).get(0).value:rtnNull(_clm+suffix);_rep=(_rep==null?"":_rep);param=param.replace(_repClm,_rep);url+=_clm+"="+encodeURIComponent(_rep)+"&"}_pos2=_pos1+1}}noVal=function(){_firstOption=jCol.children("option").get(0);if(_firstOption==null||_firstOption.value!=""){return false}return true};columnFocus=function(){jCol.attr("isfocus","true")};if(cid!=null&&cid!=""){jCol=jTag.find("#"+cid)}else{jCol=new Array(0)}if(jCol.length>0&&isEndInitEvent()){jCol.bind("focus",columnFocus)}val="";if(jCol.length>0){if(isEndInitEvent()){val=(jCol.val()==null?"":jCol.val())}else{val=(jTag.attr("h_evVal")==null?"":jTag.attr("h_evVal"))}}renderer="";try{renderer=eval("EC_"+cname+"_RENDERER")}catch(e){}editor="";try{editor=eval("EC_"+cname+"_EDITOR")}catch(e){}ATTRS=["title","style","tabindex","readonly","disabled","onClick","onChange","onBlur","onFocus","ondblClick","onMouseDown","onMouseUp","onMouseMove","onMouseOut","onMouseOver","onSelect","onKeydown","onKeypress","onKeyup","eventCallBack","multiple"];optAttrs="";if(jCol.length>0){for(i=0;i<ATTRS.length;i++){optAtt=jCol.attr(ATTRS[i]);if(optAtt!=null){vtype=typeof(optAtt);isAdd=false;if(vtype=="function"){optAtt=optAtt.toString();isAdd=optAtt.length>0?true:false;optAtt="("+optAtt+")()"}else{if(vtype=="boolean"){isAdd=optAtt}else{isAdd=optAtt.length>0?true:false}}if(isAdd){optAttrs+=ATTRS[i]+"='"+optAtt+"' "}}}}$.ajax({url:url,data:{EC_CID:(cid==null?"":cid),EC_CNAME:(cname==null?"":cname),EC_RENDERER:renderer,EC_EDITOR:editor,EC_PARAM:param,EC_SQL:param,EC_WRITABLE:(writable==null?"":writable),EC_CVALUE:val,EC_NOVALUE:(jCol.length==0?"":noVal()),EC_CLASS:(jCol.length==0?"":jCol.attr("class")),EC_SIZE:(jCol.length==0?"":jCol.attr("size")),EC_MAXLENGTH:(jCol.length==0?"":jCol.attr("maxlength")),EC_OPTATTRS:optAttrs,EC_PNAME:jEvCol.attr("id")==null?"":jEvCol.attr("id").split("__")[0],EC_PVALUE:jEvCol.get(0).value==null?"":jEvCol.get(0).value,EC_USESLBL:(suffix==null||suffix=="")?"false":"true"},type:"POST",dataType:"html",async:isEndInitEvent(),error:function(r,s,e){if(url.indexOf(".htm")<0){alert("EventColumnError:"+r+":"+s+":"+e+":"+cname)}},success:function(data,status){var jNewCol=$(data);if(jCol.length>0){if(isEndInitEvent()){jCol.unbind("focus",columnFocus)}bindOldEvents(jNewCol.get(0),jQuery.data(jCol.clone(true).get(0),"events"))}jTag.empty().append(jNewCol);if(jCol.length>0){jTag.find("input,select,textarea").attr("name",cid).attr("id",cid);if(isEndInitEvent()){if(jCol.attr("isfocus")){jNewCol.get(0).focus();if($.browser.msie){jNewCol.get(0).focus()}}}if(!isEndInitEvent()){jNewCol.change()}if(jCol.attr("eventCallback")){callback=function(){eval(jCol.attr("eventCallback")+"(arguments);")};callback(cid,jNewCol.val(),jCol.get(0).value)}}if(suffix!=null&&suffix!=""){if(isEndInitEvent()){$("table#viewTable").resizeView()}}}})}function bindOldEvents(d,a){var c,b;for(c in a){for(b in a[c]){jQuery.event.add(d,c,a[c][b],a[c][b].data)}}}var isShowTip=false;$(function(){if(USE_REAL_TIME_CHECK){setEvent('textarea:not([realTimeChk="false"]),select:not([realTimeChk="false"]),input[type="text"]:not([realTimeChk="false"])',"focusout",function(){var b=RegExp(/jsp/);var a=location.pathname.match(b);check(this,RegExp.leftContext+"jsp/common/realtimecheck.jsp")});$("table#viewTable").parent().parent().scroll(function(){if(isShowTip){isShowTip=false;$(".tipErr").remove()}})}});function check(f,b){var c,d,h,g,e,j,a,i;c=f.name;if(typeof jQuery!="undefined"&&c.indexOf("h_")!=0){d=f.value;if(f.rtOption!="null"&&f.rtOption!="undefined"){i=f.getAttribute("rtOption")}h=c.split("__");g=(2==h.length);e="command=RENEW&checkType="+(g?"ENTRY":"NEW")+(g?"&h_rowSel="+h[1]:"")+"&column="+h[0]+"&"+c+"="+encodeURIComponent(d)+(i?"&"+i:"");j={dataType:"html",type:"POST",url:b,data:e};j.error=function(){};j.success=function(k){a=$(f).data("tipId");$("#"+a).remove();if($.trim(k).indexOf("row_error")>=0){showCheckTip(f,k);isShowTip=true}};$.ajax(j)}return true}function showCheckTip(a,c){var j,i,k,g,e,h,f,d,b;j=$(a);i=j.offset();if(i.top>=30){e="<div class='tipErr'><div id='tipArrowBottom'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+(-11-h[0].offsetHeight)}else{e="<div class='tipErr'><div id='tipArrowTop'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+11+h[0].offsetHeight}b=(new Date()).getTime();$(a).data("tipId",b);h.css({left:f+"px",top:d+"px"}).attr("id",b).click(function(){$(this).remove()}).show()}$(function(){bindEvents()});$.fn.simpleColorPickerOg=function(a){var c={colorsPerLine:8,colors:["#000000","#444444","#666666","#999999","#cccccc","#eeeeee","#f3f3f3","#ffffff","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#0000ff","#9900ff","#ff00ff","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79","#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47","#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4C1130"],showEffect:"",hideEffect:"",onChangeColor:false};var b=$.extend(c,a);return this.each(function(){var g=$(this);var l="";var j=g.attr("id").replace(/-/g,"")+"_";for(var f=0;f<b.colors.length;f++){var m=b.colors[f];var k="";if(f%b.colorsPerLine==0){k="clear: both; "}if(f>0&&k&&$.browser&&$.browser.msie&&$.browser.version<=7){k="";l+='<li style="float: none; clear: both; overflow: hidden; background-color: #fff; display: block; height: 1px; line-height: 1px; font-size: 1px; margin-bottom: -2px;"></li>'}l+='<li id="'+j+"color-"+f+'" class="color-box" style="'+k+"background-color: "+m+'" title="'+m+'"></li>'}k="clear: both; ";l+='<li id="'+j+'color-default" class="color-box" style="width:80px; text-align:center; '+k+'background-color:white;" title="clear">clear</li>';var h=$('<div id="'+j+'color-picker" class="color-picker" style="position: absolute; left: 0px; top: 0px;"><ul>'+l+'</ul><div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("li.color-box").click(function(){var i=isNaN(this.id.substr(this.id.indexOf("-")+1))?"":b.colors[this.id.substr(this.id.indexOf("-")+1)];if(!g.is("input")){g.val(i);g.blur()}if($.isFunction(c.onChangeColor)){c.onChangeColor.call(g,i)}d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){g=$(this);i.stopPropagation();if(!g.is("input")){e(h)}});g.change(function(i){if(g.val()!=g.css("background-color")){g.css("background-color",g.val()).css("color",g.val())}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.simpleColorPickerOg){$("input.colorPicker").simpleColorPickerOg({onChangeColor:function(a){$(this).val(a).css("background-color",a).css("color",a).change()}})}});jQuery.fn.ogClockpicker=function(options,callback){var org_settings={starthour:6,endhour:20,showminutes:"true",minutedivisions:4,military:true,event:"click",layout:"vertical",valuefield:null,useBgiframe:false,hoursopacity:1,minutesopacity:1,second:""};if(options){jQuery.extend(org_settings,options)}var callback=callback||function(){},v=(org_settings.layout=="vertical");errorcheck(org_settings);jQuery(this)[org_settings.event](function(e){var self=this,$self=jQuery(this),$body=jQuery("body");var settings=jQuery.extend(true,{},org_settings);if($self.attr("valuefield")){settings.valuefield=$self.attr("valuefield")}if($self.attr("starthour")){settings.starthour=parseInt($self.attr("starthour"))}if($self.attr("endhour")){settings.endhour=parseInt($self.attr("endhour"))}if($self.attr("minutedivisions")){settings.minutedivisions=parseInt($self.attr("minutedivisions"))}if($self.attr("military")){settings.military=$self.attr("military")}if($self.attr("showminutes")){settings.showminutes=$self.attr("showminutes")}if($self.attr("usesecond")=="true"){settings.second="00"}if($self.attr("layout")){settings.layout=$self.attr("layout");org_settings.layout=settings.layout;v=(settings.layout=="vertical")}errorcheck(settings);if(!settings.valuefield){$self.unbind("keydown").bind("keydown",keyhandler)}else{var inputfield=jQuery("[name="+settings.valuefield+"]");inputfield.unbind("keydown").bind("keydown",keyhandler)[0].focus();inputfield.bind("click",function(){inputfield.unbind("keydown")})}jQuery("#CP_hourcont,#CP_minutecont").remove();var $hourcont=jQuery("<div id='CP_hourcont' class='CP' />").appendTo($body);!settings.useBgiframe?$hourcont.css("opacity",settings.hoursopacity):null;binder($hourcont);var $hourcol=[];for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){$hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo($body))}if(settings.showminutes=="true"){var $mc=jQuery("<div id='CP_minutecont' class='CP' />").appendTo($body);!settings.useBgiframe?$mc.css("opacity",settings.minutesopacity):null;binder($mc)}if(!v){$hourcont.css("width","auto");if(settings.showminutes=="true"){$mc.css("width","auto")}}else{for(i=0;i<$hourcol.length;i++){$hourcol[i].addClass("floatleft")}}renderhours();putcontainer();function renderhours(){var c=1;var numberC=0;for(var h=settings.starthour;h<=settings.endhour;h++){if(h%12==0){c=1}var displayhours=((!settings.military&&h>12)?h-12:h);var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}var $hd=jQuery("<div class='CP_hour' id='hr_"+h+"_"+c+"' value='"+valuehouers+"' >"+displayhours+set_tt(h)+"</div>");if(settings.military){$hd.width(20)}binder($hd);if(!v){$hd.css("float","left")}$hourcol[numberC].append($hd);if((h+1)%12==0){numberC++}c++}for(var j=0;j<$hourcol.length;j++){if(v){if(j!=0&&j%2==0){$hourcol[j].css("margin-left",$mc.width()+4+"px")}}else{$hourcont.append("<div style='clear:left' />");if(j!=0&&j%2==0){$hourcol[j].css("margin-top","19px")}}$hourcont.append($hourcol[j])}}function renderminutes(h){var realhours=h;var displayhours=(!settings.military&&h>12)?h-12:h;var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}$mc.empty();var n=60/settings.minutedivisions,tt=set_tt(realhours),counter=1;for(var m=0;m<60;m=m+n){$md=jQuery("<div class='CP_minute' id='"+realhours+"_"+m+"' value='"+valuehouers+((m<10)?"0":"")+m+"'>"+displayhours+":"+((m<10)?"0":"")+m+tt+"</div>");if(!v){$md.css("float","left");if(settings.minutedivisions>6&&counter==settings.minutedivisions/2+1){$mc.append("<div style='clear:left' />")}}$mc.append($md);binder($md);counter++}}function set_tt(realhours){if(!settings.military){return(realhours>=12)?" PM":" AM"}else{return""}}function putcontainer(){if(e.type!="focus"){$hourcont[0].style.left=e.pageX-5+"px";$hourcont[0].style.top=e.pageY-(Math.floor($hourcont.height()/2))+"px";rectify($hourcont)}else{$self.after($hourcont)}$hourcont.slideDown("fast");if(settings.useBgiframe){bgi($hourcont)}}function rectify($obj){var ph=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var pw=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;var t=parseInt($obj[0].style.top);var l=parseInt($obj[0].style.left);var st=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;if(t<=st&&!$obj.is("#CP_minutecont")){$obj.css("top",st+10+"px")}else{if(t+$obj.height()-st>ph){$obj.css("top",st+ph-$obj.height()-10+"px")}}if(l<=0){$obj.css("left","10px")}}function bgi(ob){if(typeof jQuery.fn.bgIframe=="function"){ob.bgIframe()}else{alert("bgIframe plugin not loaded.")}}function binder($obj){if($obj.attr("id")=="CP_hourcont"){$obj.mouseout(function(e){hourcont_out(e)})}else{if($obj.attr("id")=="CP_minutecont"){$obj.mouseout(function(e){minutecont_out(e)})}else{if($obj.attr("class")=="CP_hour"){$obj.mouseover(function(e){hourdiv_over($obj,e)});$obj.mouseout(function(){hourdiv_out($obj)});$obj.click(function(){hourdiv_click($obj)})}else{if($obj.attr("class")=="CP_minute"){$obj.mouseover(function(){minutediv_over($obj)});$obj.mouseout(function(){minutediv_out($obj)});$obj.click(function(){minutediv_click($obj)})}}}}}function hourcont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function minutecont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function hourdiv_over($obj,e){var h=$obj.attr("id").split("_")[1],i=$obj.attr("id").split("_")[2],l,t,nn;$obj.addClass("CP_over");nn=Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2);if(settings.showminutes=="true"){$mc.hide();renderminutes(h);if(v){t=e.type=="mouseover"?e.pageY-15:$hourcont.offset().top+2+($obj.height()*i);l=$hourcont.offset().left+$hourcol[0].width()*2*nn+$mc.width()*(nn-1)+4*nn-2}else{l=(e.type=="mouseover")?e.pageX-10:$hourcont.offset().left+($obj.width()-5)*i;t=$hourcont.offset().top+($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn+$mc.height()*(nn-1)+2*nn-1}$mc.css("left",l+"px").css("top",t+"px");rectify($mc);$mc.show();if(settings.useBgiframe){bgi($mc)}}return false}function hourdiv_out($obj){$obj.removeClass("CP_over");return false}function hourdiv_click($obj){var h=$obj.attr("id").split("_")[1],tt=set_tt(h),str=$obj.attr("value");if(str.indexOf(" ")!=-1){var cleanstr=str.substring(0,str.indexOf(" "))}else{var cleanstr=str}$obj.text(cleanstr+"00"+settings.second);setval($obj);cleardivs()}function minutediv_over($obj){$obj.addClass("CP_over");return false}function minutediv_out($obj){$obj.removeClass("CP_over");return false}function minutediv_click($obj){$obj.text($obj.attr("value")+settings.second);setval($obj);cleardivs()}function setval($obj){if(!settings.valuefield){self.value=$obj.text()}else{jQuery("input[name="+settings.valuefield+"]").val($obj.text()).change()}callback.apply($self,[$obj.text()]);$self.unbind("keydown",keyhandler)}function cleardivs(){if(settings.showminutes=="true"){$mc.hide()}$hourcont.slideUp("fast");$self.unbind("keydown",keyhandler)}function keyhandler(e){var $obj=$("div.CP_over").size()?$("div.CP_over"):$("div.CP_hour:first"),divtype=$obj.is(".CP_hour")?"hour":"minute",hi=(divtype=="hour")?$obj[0].id.split("_")[2]:0,h=(divtype=="minute")?$obj[0].id.split("_")[0]:$obj[0].id.split("_")[1];if(divtype=="minute"){if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){var curloc="m1"}else{if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){var curloc="m2"}else{var curloc="m3"}}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var curloc="h1"}else{var curloc="h2"}}function divprev($obj){if($obj.prev().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.prev(), e)")}else{return false}}function divnext($obj){if($obj.next().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.next(), e)")}else{return false}}function hourtohour($obj){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1)}var ctx="#hourcol"+next;$newobj=jQuery(".CP_hour[id$=_"+hi+"]",ctx);if($newobj.size()){hourdiv_out($obj);hourdiv_over($newobj,e)}else{return false}}function hourtominute($obj){hourdiv_out($obj);minutediv_over($(".CP_minute:first"))}function minutetohour($obj,where){minutediv_out($obj);if(where<0){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)-12)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)+12)}}var ctx="#hourcol"+next;var $newobj=jQuery(".CP_hour[id^=hr_"+h+"]",ctx);hourdiv_over($newobj,e)}switch(e.keyCode){case 37:if(v){switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}else{divprev($obj)}break;case 38:if(v){divprev($obj)}else{switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}break;case 39:if(v){switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}else{divnext($obj)}break;case 40:if(v){divnext($obj)}else{switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}break;case 13:eval(divtype+"div_click($obj)");break;default:return true}return false}return false});function errorcheck(settings){if(settings.starthour>=settings.endhour){alert("Error - start hour must be less than end hour.");return false}else{if(60%settings.minutedivisions!=0){alert("Error - param minutedivisions must divide evenly into 60.");return false}}}return this};$(function(){if($.fn.ogClockpicker){$(document).ready(function(){$(".clockpick").ogClockpicker()})}});function likeComp(c){var b=c.substring(6);var d=$("#"+c).attr("aimaiType");var a=$("#"+b).val();a=a.replace(/^%+|%+$/g,"");if(a!=""){switch(d){case"1":a=a+"%";break;case"2":a="%"+a;break;case"3":a="%"+a+"%";break}}$("#"+b).val(a)}$(function(){$("form").submit(function(){$("[id^='AIMAI_']").each(function(){likeComp(this.id)})})});$.fn.aimaiPickerOg=function(a){var c={texts:[" V "," V*","*V ","*V*"],titls:["完全一致","前方一致","後方一致","前後曖昧"]};var b=$.extend(c,a);return this.each(function(){var g=$(this);var j="PIC_"+g.attr("id").replace(/-/g,"")+"_";var l="";for(var f=0;f<b.texts.length;f++){var m=b.texts[f];var k=b.titls[f];l+='<span id="'+j+"text-"+f+'" class="text-box"" title="'+k+'">('+m+") </span>"}var h=$('<div id="'+j+'aimai-picker" class="aimai-picker" style="position: absolute; left: 0px; top: 0px;">'+l+'<div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("span.text-box").click(function(){var i=this.id.substr(this.id.indexOf("-")+1);g.attr("aimaiType",i);g.attr("title",b.titls[i]);g.text(b.texts[i]);g.blur();d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){i.stopPropagation();if(!g.is("input")){e(h)}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.aimaiPickerOg){$(".aimaiClm").aimaiPickerOg()}});(function(){$.fn.glDatePicker=function(options){var pluginName="glDatePicker";var instance=this.data(pluginName);if(!instance){return this.each(function(){return $(this).data(pluginName,new glDatePicker(this,options))})}return(options===true)?instance:this};$.fn.glDatePicker.defaults={cssName:"default",zIndex:1000,borderSize:1,calendarOffset:{x:0,y:1},showAlways:false,hideOnClick:true,allowMonthSelect:true,allowYearSelect:true,todayDate:new Date(),selectedDate:null,prevArrow:"\u25c4",nextArrow:"\u25ba",selectableDates:null,selectableDateRange:null,specialDates:null,selectableMonths:null,selectableYears:null,selectableDOW:null,monthNames:null,dowNames:null,dowOffset:(HYBS_CAL_START_MON==true?1:0),onClick:(function(el,cell,date,data){var tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){var _targetId=el.attr("targetId");if(_targetId!=null){tgt=$("#"+_targetId)}}var year=date.getFullYear();var month=date.getMonth()+1;var day=date.getDate();if(month<10){month="0"+month}if(day<10){day="0"+day}var oldval=tgt.val();var str=year+""+month+""+day;tgt.val(str);if(oldval!=str){tgt.change()}}),onHover:function(el,cell,date,data){},onShow:function(calendar){calendar.show()},onHide:function(calendar){calendar.hide()},firstDate:null};var glDatePicker=(function(){function glDatePicker(element,userOptions){var self=this;self.el=$(element);var el=self.el;self.options=$.extend(true,{},$.fn.glDatePicker.defaults,userOptions);var options=self.options;var _tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){if(el.attr("targetId")){_tgt=$("#"+el.attr("targetId"))}}var _inputDate=_tgt.val();if(_inputDate!=null&&_inputDate.length>=8){_inputDate=_inputDate.replace(/\u002f/g,"");try{_inputDate=_inputDate.substr(0,4)+"/"+_inputDate.substr(4,2)+"/"+_inputDate.substr(6,2)}catch(e){_inputDate=null}}else{_inputDate=null}self.calendar=$($.find("[gldp-el="+el.attr("gldp-id")+" ]"));options.selectedDate=(options.selectedDate||new Date(_inputDate||options.todayDate))||options.todayDate;options.firstDate=(new Date((options.firstDate||options.selectedDate)))._first();if(!(el.attr("gldp-id")||"").length){el.attr("gldp-id","gldp-"+Math.round(Math.random()*10000000000))}el.addClass("gldp-el").bind("click",function(e){self.show(e)});if(self.calendar.length&&!options.showAlways){self.calendar.hide()}$(document).bind("mouseup",function(e){var target=e.target;var calendar=self.calendar;if(!el.is(target)&&!calendar.is(target)&&calendar.has(target).length===0&&calendar.is(":visible")){self.hide()}})}glDatePicker.prototype={show:function(){this.render();$.each($(".gldp-el").not(this.el),function(i,o){if(o.length){o.options.onHide(o.calendar)}});this.options.onShow(this.calendar)},hide:function(){if(this.options&&!this.options.showAlways){this.options.onHide(this.calendar)}},render:function(renderCalback){var self=this;var el=self.el;var options=self.options;var calendar=self.calendar;var coreClass=" core border ";var cssName="gldp-"+options.cssName;var todayVal=options.todayDate._val();var todayTime=todayVal.time;var maxRow=6;var maxCol=7;var borderSize=options.borderSize+"px";var getSelectableList=function(min,max,userList){var resultList=[];for(var i=min;i<=max;i++){resultList.push(i)}if(userList){var newList=[];$.each(userList,function(i,v){if(v>=min&&v<=max&&newList._indexOf(v)<0){newList.push(v)}});resultList=newList.length?newList:resultList}resultList.sort();return resultList};var selectableMonths=getSelectableList(0,11,options.selectableMonths);var selectableYears=getSelectableList(todayVal.year-5,todayVal.year+5,options.selectableYears);var selectableDOW=getSelectableList(0,6,options.selectableDOW);var dowNames=options.dowNames||["日","月","火","水","木","金","土"];var monthNames=options.monthNames||["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];var containerSize=window.innerHeight?window.innerHeight:180;if(containerSize<180){containerSize=(containerSize>135?containerSize:135)}else{containerSize=180}var containerWidth=options.conainerWidth||containerSize;var containerHeight=containerWidth;var getCellSize=function(_size,_count){return(_size/_count)+((options.borderSize/_count)*(_count-1))-1};var cellWidth=getCellSize(containerWidth,maxCol);var cellHeight=getCellSize(containerHeight,maxRow+2);if(!calendar.length){self.calendar=calendar=$("<div/>").attr("gldp-el",el.attr("gldp-id")).data("is",true).css({display:(options.showAlways?undefined:"none"),zIndex:options.zIndex,width:((cellWidth+1)*maxCol)+"px"});$("body").append(calendar)}else{if(!eval(calendar.data("is"))){containerWidth=calendar.outerWidth();containerHeight=calendar.outerHeight();cellWidth=getCellSize(containerWidth,maxCol);cellHeight=getCellSize(containerHeight,maxRow+2)}self.calendar.css({width:((cellWidth+1)*maxCol)+"px"})}if(!el.is(":visible")){calendar.hide()}calendar.removeClass().addClass(cssName).children().remove();var onResize=function(){var elPos=el.offset();calPosTop=(elPos.top+el.outerHeight()+options.calendarOffset.y)-20;calPosLeft=(elPos.left+options.calendarOffset.x);if(calPosTop>$(window).height()-150){calPosTop-=130}if(calPosLeft>$(window).width()-150){calPosLeft-=150}if(calPosTop<0){calPosTop=0}if(calPosLeft<0){calPosLeft=0}calendar.css({top:calPosTop+"px",left:calPosLeft+"px"})};$(window).resize(onResize);onResize();var cellCSS={width:cellWidth+"px",height:cellHeight+"px",lineHeight:cellHeight+"px"};var setFirstDate=function(_date){if(_date){options.firstDate=_date;self.render()}};var getFirstDate=function(_offset){var _date=new Date(options.firstDate);_offset=_offset||0;while(true){_date.setMonth(_date.getMonth()+_offset);_date.setDate(Math.min(1,_date._max()));if(_offset==0){break}var dateVal=_date._val();var dateMonth=dateVal.month;var dateYear=dateVal.year;if(selectableMonths._indexOf(dateMonth)!=-1){if(selectableYears._indexOf(dateYear)!=-1){break}else{if(dateYear<selectableYears[0]||dateYear>selectableYears[selectableYears.length-1]){return null}}}}return _date};var prevFirstDate=getFirstDate(-1);var nextFirstDate=getFirstDate(1);var firstDate=(options.firstDate=getFirstDate());var firstDateVal=firstDate._val();var firstDateMonth=firstDateVal.month;var firstDateYear=firstDateVal.year;var startDate=new Date(firstDate);var dowOffset=Math.abs(Math.min(6,Math.max(0,options.dowOffset)));var startOffset=startDate.getDay()-dowOffset;startOffset=startOffset<1?-7-startOffset:-startOffset;dowNames=(dowNames.concat(dowNames)).slice(dowOffset,dowOffset+7);startDate._add(startOffset);var showPrev=(prevFirstDate);var showNext=(nextFirstDate);var monyearClass=coreClass+"monyear ";var prevCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{borderWidth:borderSize+" 0 0 "+borderSize})).append($("<a/>").addClass("prev-arrow"+(showPrev?"":"-off")).html(options.prevArrow)).mousedown(function(){return false}).click(function(e){if(options.prevArrow!=""&&showPrev){e.stopPropagation();setFirstDate(prevFirstDate)}});var titleCellCount=maxCol-2;var titleWidth=(cellWidth*titleCellCount)-(titleCellCount*options.borderSize)+(options.borderSize);var titleCell=$("<div/>").addClass(monyearClass+"title").css($.extend({},cellCSS,{width:titleWidth+"px",borderTopWidth:borderSize,marginLeft:"-"+(borderSize)}));var nextCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{marginLeft:"-"+(borderSize),borderWidth:borderSize+" "+borderSize+" 0 0"})).append($("<a/>").addClass("next-arrow"+(showNext?"":"-off")).html(options.nextArrow)).mousedown(function(){return false}).click(function(e){if(options.nextArrow!=""&&showNext){e.stopPropagation();setFirstDate(nextFirstDate)}});calendar.append(prevCell).append(titleCell).append(nextCell);for(var row=0,cellIndex=0;row<maxRow+1;row++){for(var col=0;col<maxCol;col++,cellIndex++){var cellDate=new Date(startDate);var cellClass="day";var cellZIndex=options.zIndex+(cellIndex);var cell=$("<div/>");if(!row){cellClass="dow";cell.html(dowNames[col]);cellDate=null}else{cellDate._add(col+((row-1)*maxCol));var cellDateVal=cellDate._val();var cellDateTime=cellDateVal.time;var specialData=null;var isSelectable=true;var getRepeatDate=function(v,date){if(v.repeatYear===true){date.setYear(cellDateVal.year)}if(v.repeatMonth===true){date.setMonth(cellDateVal.month)}return date._val()};cell.html(cellDateVal.date);if(options.selectableDateRange){isSelectable=false;$.each(options.selectableDateRange,function(i,v){var dateFrom=v.from;var dateTo=(v.to||null);dateTo=dateTo||new Date(v.from.getFullYear(),v.from.getMonth(),v.from._max());dateFrom=getRepeatDate(v,dateFrom);dateTo=getRepeatDate(v,dateTo);if(cellDateTime>=dateFrom.time&&cellDateTime<=dateTo.time){isSelectable=true;return true}})}if(options.selectableDates){if((options.selectableDateRange&&!isSelectable)||(isSelectable&&!options.selectableDateRange)){isSelectable=false}$.each(options.selectableDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){return(isSelectable=true)}})}if(!isSelectable||selectableYears._indexOf(cellDateVal.year)<0||selectableMonths._indexOf(cellDateVal.month)<0||selectableDOW._indexOf(cellDateVal.day)<0){cellClass="noday"}else{cellClass=(["sun","mon","tue","wed","thu","fri","sat"])[cellDateVal.day];if(firstDateMonth!=cellDateVal.month){cellClass+=" outday"}if(todayTime==cellDateTime){cellClass="today";cellZIndex+=50}if(options.selectedDate._time()==cellDateTime){cellClass="selected";cellZIndex+=51}if(options.specialDates){$.each(options.specialDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){cellClass=(v.cssClass||"special");cellZIndex+=52;specialData=v.data}})}cell.mousedown(function(){return false}).hover(function(e){e.stopPropagation();var hoverData=$(this).data("data");options.onHover(el,cell,hoverData.date,hoverData.data)}).click(function(e){e.stopPropagation();var clickedData=$(this).data("data");options.selectedDate=options.firstDate=clickedData.date;self.render(function(){if(!options.showAlways&&options.hideOnClick){self.hide()}});options.onClick(el,$(this),clickedData.date,clickedData.data)})}}$.extend(cellCSS,{borderTopWidth:borderSize,borderBottomWidth:borderSize,borderLeftWidth:(row>0||(!row&&!col))?borderSize:0,borderRightWidth:(row>0||(!row&&col==6))?borderSize:0,marginLeft:(col>0)?"-"+(borderSize):0,marginTop:(row>0)?"-"+(borderSize):0,zIndex:cellZIndex});cell.data("data",{date:cellDate,data:specialData}).addClass(coreClass+cellClass).css(cellCSS);calendar.append(cell)}}var toggleYearMonthSelect=function(showYear){var show="inline-block";var hide="none";if(options.allowMonthSelect){monthText.css({display:!showYear?hide:show});monthSelect.css({display:!showYear?show:hide})}if(options.allowYearSelect){yearText.css({display:showYear?hide:show});yearSelect.css({display:showYear?show:hide})}};var onYearMonthSelect=function(){options.firstDate=new Date(yearSelect.val(),monthSelect.val(),1);self.render()};var monthSelect=$("<select/>").hide().change(onYearMonthSelect);var yearSelect=$("<select/>").hide().change(onYearMonthSelect);var monthText=$("<span/>").html(monthNames[firstDateMonth]).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(false)});var yearText=$("<span/>").html(firstDateYear).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(true)});$.each(monthNames,function(i,v){if(options.allowMonthSelect&&selectableMonths._indexOf(i)!=-1){var o=$("<option/>").html(v).attr("value",i);if(i==firstDateMonth){o.attr("selected","selected")}monthSelect.append(o)}});$.each(selectableYears,function(i,v){if(options.allowYearSelect){var o=$("<option/>").html(v).attr("value",v);if(v==firstDateYear){o.attr("selected","selected")}yearSelect.append(o)}});var titleYearMonth=$("<div/>").append(monthText).append(monthSelect).append(yearText).append(yearSelect);titleCell.children().remove();titleCell.append(titleYearMonth);renderCalback=renderCalback||(function(){});renderCalback();var mousewheelevent="onwheel" in document?"wheel":"onmousewheel" in document?"mousewheel":"DOMMouseScroll";calendar.bind(mousewheelevent,function(e){e.preventDefault();var delta=e.originalEvent.deltaY?-(e.originalEvent.deltaY):e.originalEvent.wheelDelta?e.originalEvent.wheelDelta:-(e.originalEvent.detail);if(delta<0){nextCell.click()}else{prevCell.click()}})}};return glDatePicker})();(function(){Date.prototype._clear=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype._time=function(){return this._clear().getTime()};Date.prototype._max=function(){var isLeapYear=(new Date(this.getYear(),1,29).getMonth()==1)?1:0;var days=[31,28+isLeapYear,31,30,31,30,31,31,30,31,30,31];return days[this.getMonth()]};Date.prototype._add=function(days){this.setDate(this.getDate()+days)};Date.prototype._first=function(){var date=new Date(this);date.setDate(1);return date};Date.prototype._val=function(){this._clear();return{year:this.getFullYear(),month:this.getMonth(),date:this.getDate(),time:this.getTime(),day:this.getDay()}};Array.prototype._indexOf=function(value){return $.inArray(value,this)}})()})();$(function(){if($.fn.glDatePicker){$(".calPic").glDatePicker()}});function selectScroll(a){var d=4;if(a.getAttribute("size")){d=a.getAttribute("size")}var e=a.options;for(var c=0;c<e.length;c++){if(e[c].selected){if(e[c].parentNode.tagName.toUpperCase()=="OPTGROUP"){c+=$(e[c].parentNode).prev().length}var b=c*($(a).height()/d);break}}$(a).scrollTop(b)}$(function(){$("select[multiple]").each(function(){selectScroll(this)})}); | |
\ No newline at end of file | ||
1 | +var orgFldCls=null;$(function(){if(USE_FOCUS_HILIGHT){setEvent('textarea,select,input[type="text"]',"focusin",function(){doFocus2(this)});setEvent('textarea,select,input[type="text"]',"focusout",function(){doBlur2(this)})}});function doFocus2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.orgBgColor=a.style.backgroundColor;a.style.backgroundColor="#ffcccc"}else{orgFldCls=a.className;a.className="focusField "+orgFldCls}}}}function doBlur2(a){if(a!=null){if(a.className==null||a.className.indexOf("must")<0){if(a.tagName=="SELECT"){a.style.backgroundColor=a.orgBgColor}else{if(orgFldCls!=null){a.className=orgFldCls}else{a.className="notFocusField"}}}}}oldDoFocusFlag=true;function doFocus(a){if(oldDoFocusFlag){oldDoFocusFlag=false;setTimeout(alert("Old Script Error!!\ncustom/query_info.jsp,custom/result_info.jsp Please delete the following part.\n<script>Tag(Header fix and Focus) , BODY onLoad and oncontextmenu Attribute"),100)}}function doBlur(a){}$(function(){setEvent('textarea,select,input[type="text"]',"focusout",function(){convert(this)})});function convert(b){var c,a;c=b.value;a=b.className;if(c!=null&&a!=null){if(a.match(/XL/)&&!(a.match(/XLU/))){b.value=c.toLowerCase()}else{if((a.match(/XU/)&&!(a.match(/XUL/)))||a.match(/PN2/)){b.value=c.toUpperCase()}}}return true}var colMap;var notFireCols;var jH_evElm;$(function(){if(!(typeof(EC_NAME)=="undefined")){jH_evElm=$(".h_evElm");makeColMapping();setEvent('textarea,select,input[type="text"]',"change",function(){makeColumn(this)},".h_evCol",true,addEvColCls);setEvent("input[type=checkbox],input[type=radio]","click",function(){makeColumn(this)},".h_evCol",true)}});function makeColMapping(){var b,a,e,d,c;if(colMap){return}colMap=new Object();for(b=0;b<EC_EVCOL.length;b++){e=EC_EVCOL[b].split(",");for(a=0;a<e.length;a++){d=e[a];if(d.charAt(0)=="_"){d=d.substring(1);if(notFireCols){notFireCols+=","}notFireCols+=d}c=colMap[d];if(!c){c=new Array()}c[c.length]=EC_NAME[b];colMap[d]=c}}}function addEvColCls(){for(var a in colMap){$("#"+a+",[id^="+a+"__]").addClass("h_evCol")}}function makeColumn(e){var k,l,g,j,b,h,d,c,a,f;if(jH_evElm&&isEndInitEvent()){jH_evElm=null}k=$(e);l=k.attr("id");g=l.split("__")[0];j=colMap[g];if(!j){return}if(!isEndInitEvent()&¬FireCols&¬FireCols.indexOf(g)>=0){return}for(b=0;b<j.length;b++){h=(l==g?"":"__"+l.split("__")[1]);d=j[b]+h;c=d.split("__")[0];a=isEndInitEvent()?$(".h_evElm[h_evCid="+d+"]"):jH_evElm.filter("[h_evCid="+d+"]");f=a.attr("h_evWrtbl");eventColumn(k,a,d,c,h,f)}}function eventColumn(jEvCol,jTag,cid,cname,suffix,writable){var evVal,url,param,_pos1,_pos2,_repClm,_rep,_clm,noVal,columnFocus,jCol,val,renderer,editor,ATTRS,optAttrs,i,optAtt,vtype,isAdd;var callback;var keys,keysList,flgEncrypt;var obj={};if(!jTag||jTag.length==0){alert("[SYSTEM_ERROR] : jTag is null. The element of the replacement object doesn't exist. ["+cname+"]");return}if(!isEndInitEvent()){evVal=jEvCol.get(0).value;if(!evVal||evVal==null||evVal==""){return}}try{url=eval("EC_"+cname+"_URL")}catch(e){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. (variable undefinition). ["+cname+"]");return}if(!url||url==""){alert("[SYSTEM_ERROR] : URL that processes the event is not specified. ["+cname+"]");return}param="";try{param=(writable?eval("EC_"+cname+"_EDITPARAM"):eval("EC_"+cname+"_RENDPARAM"))}catch(e){}try{keys=(writable?eval("EC_"+cname+"_EDITPARAMKEYS"):eval("EC_"+cname+"_RENDPARAMKEYS"))}catch(e){}flgEncrypt=eval("EC_"+cname+"_FLGENCRYPT");if(flgEncrypt==="true"){if(keys){keysList=keys.split(",");for(var i=0;i<keysList.length;i++){var key=keysList[i];var val=suffix==""?$("#"+key).get(0).value:$("#"+key+suffix).get(0).value;obj[key]=val}}}else{if(param!=null&¶m!=""){url+="?";_pos1=0;_pos2=0;while((_pos1=param.indexOf("{@",_pos2))!=-1){_pos2=param.indexOf("}",_pos1);_clm=param.substring(_pos1+2,_pos2);if(_clm.indexOf(".")<0){_repClm="{@"+_clm+"}";var rtnNull=function(){console.log("noDifined:");console.log(arguments[0]);return null};_rep=suffix==""?$("#"+_clm)[0]?$("#"+_clm).get(0).value:rtnNull(_clm):$("#"+_clm+suffix)[0]?$("#"+_clm+suffix).get(0).value:rtnNull(_clm+suffix);_rep=(_rep==null?"":_rep);param=param.replace(_repClm,_rep);url+=_clm+"="+encodeURIComponent(_rep)+"&"}_pos2=_pos1+1}}}noVal=function(){_firstOption=jCol.children("option").get(0);if(_firstOption==null||_firstOption.value!=""){return false}return true};columnFocus=function(){jCol.attr("isfocus","true")};if(cid!=null&&cid!=""){jCol=jTag.find("#"+cid)}else{jCol=new Array(0)}if(jCol.length>0&&isEndInitEvent()){jCol.bind("focus",columnFocus)}val="";if(jCol.length>0){if(isEndInitEvent()){val=(jCol.val()==null?"":jCol.val())}else{val=(jTag.attr("h_evVal")==null?"":jTag.attr("h_evVal"))}}renderer="";try{renderer=eval("EC_"+cname+"_RENDERER")}catch(e){}editor="";try{editor=eval("EC_"+cname+"_EDITOR")}catch(e){}ATTRS=["title","style","tabindex","readonly","disabled","onClick","onChange","onBlur","onFocus","ondblClick","onMouseDown","onMouseUp","onMouseMove","onMouseOut","onMouseOver","onSelect","onKeydown","onKeypress","onKeyup","eventCallBack","multiple"];optAttrs="";if(jCol.length>0){for(i=0;i<ATTRS.length;i++){optAtt=jCol.attr(ATTRS[i]);if(optAtt!=null){vtype=typeof(optAtt);isAdd=false;if(vtype=="function"){optAtt=optAtt.toString();isAdd=optAtt.length>0?true:false;optAtt="("+optAtt+")()"}else{if(vtype=="boolean"){isAdd=optAtt}else{isAdd=optAtt.length>0?true:false}}if(isAdd){optAttrs+=ATTRS[i]+"='"+optAtt+"' "}}}}obj.EC_CID=(cid==null?"":cid);obj.EC_CNAME=(cname==null?"":cname);obj.EC_RENDERER=renderer;obj.EC_EDITOR=editor;obj.EC_PARAM=param;obj.EC_SQL=param;obj.EC_WRITABLE=(writable==null?"":writable);obj.EC_CVALUE=val;obj.EC_NOVALUE=(jCol.length==0?"":noVal());obj.EC_CLASS=(jCol.length==0?"":jCol.attr("class"));obj.EC_SIZE=(jCol.length==0?"":jCol.attr("size"));obj.EC_MAXLENGTH=(jCol.length==0?"":jCol.attr("maxlength"));obj.EC_OPTATTRS=optAttrs;obj.EC_PNAME=jEvCol.attr("id")==null?"":jEvCol.attr("id").split("__")[0];obj.EC_PVALUE=jEvCol.get(0).value==null?"":jEvCol.get(0).value;obj.EC_USESLBL=(suffix==null||suffix=="")?"false":"true";$.ajax({url:url,data:obj,type:"POST",dataType:"html",async:isEndInitEvent(),error:function(r,s,e){if(url.indexOf(".htm")<0){alert("EventColumnError:"+r+":"+s+":"+e+":"+cname)}},success:function(data,status){var jNewCol=$(data);if(jCol.length>0){if(isEndInitEvent()){jCol.unbind("focus",columnFocus)}bindOldEvents(jNewCol.get(0),jQuery.data(jCol.clone(true).get(0),"events"))}jTag.empty().append(jNewCol);if(jCol.length>0){jTag.find("input,select,textarea").attr("name",cid).attr("id",cid);if(isEndInitEvent()){if(jCol.attr("isfocus")){jNewCol.get(0).focus();if($.browser.msie){jNewCol.get(0).focus()}}}if(!isEndInitEvent()){jNewCol.change()}if(jCol.attr("eventCallback")){callback=function(){eval(jCol.attr("eventCallback")+"(arguments);")};callback(cid,jNewCol.val(),jCol.get(0).value)}}if(suffix!=null&&suffix!=""){if(isEndInitEvent()){$("table#viewTable").resizeView()}}}})}function bindOldEvents(d,a){var c,b;for(c in a){for(b in a[c]){jQuery.event.add(d,c,a[c][b],a[c][b].data)}}}var isShowTip=false;$(function(){if(USE_REAL_TIME_CHECK){setEvent('textarea:not([realTimeChk="false"]),select:not([realTimeChk="false"]),input[type="text"]:not([realTimeChk="false"])',"focusout",function(){var b=RegExp(/jsp/);var a=location.pathname.match(b);check(this,RegExp.leftContext+"jsp/common/realtimecheck.jsp")});$("table#viewTable").parent().parent().scroll(function(){if(isShowTip){isShowTip=false;$(".tipErr").remove()}})}});function check(f,b){var c,d,h,g,e,j,a,i;c=f.name;if(typeof jQuery!="undefined"&&c.indexOf("h_")!=0){d=f.value;if(f.rtOption!="null"&&f.rtOption!="undefined"){i=f.getAttribute("rtOption")}h=c.split("__");g=(2==h.length);e="command=RENEW&checkType="+(g?"ENTRY":"NEW")+(g?"&h_rowSel="+h[1]:"")+"&column="+h[0]+"&"+c+"="+encodeURIComponent(d)+(i?"&"+i:"");j={dataType:"html",type:"POST",url:b,data:e};j.error=function(){};j.success=function(k){a=$(f).data("tipId");$("#"+a).remove();if($.trim(k).indexOf("row_error")>=0){showCheckTip(f,k);isShowTip=true}};$.ajax(j)}return true}function showCheckTip(a,c){var j,i,k,g,e,h,f,d,b;j=$(a);i=j.offset();if(i.top>=30){e="<div class='tipErr'><div id='tipArrowBottom'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+(-11-h[0].offsetHeight)}else{e="<div class='tipErr'><div id='tipArrowTop'></div><div>"+c+"</div></div>";h=$(e).appendTo(document.body);f=i.left;d=i.top+11+h[0].offsetHeight}b=(new Date()).getTime();$(a).data("tipId",b);h.css({left:f+"px",top:d+"px"}).attr("id",b).click(function(){$(this).remove()}).show()}$(function(){bindEvents()});$.fn.simpleColorPickerOg=function(a){var c={colorsPerLine:8,colors:["#000000","#444444","#666666","#999999","#cccccc","#eeeeee","#f3f3f3","#ffffff","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#0000ff","#9900ff","#ff00ff","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79","#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47","#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4C1130"],showEffect:"",hideEffect:"",onChangeColor:false};var b=$.extend(c,a);return this.each(function(){var g=$(this);var l="";var j=g.attr("id").replace(/-/g,"")+"_";for(var f=0;f<b.colors.length;f++){var m=b.colors[f];var k="";if(f%b.colorsPerLine==0){k="clear: both; "}if(f>0&&k&&$.browser&&$.browser.msie&&$.browser.version<=7){k="";l+='<li style="float: none; clear: both; overflow: hidden; background-color: #fff; display: block; height: 1px; line-height: 1px; font-size: 1px; margin-bottom: -2px;"></li>'}l+='<li id="'+j+"color-"+f+'" class="color-box" style="'+k+"background-color: "+m+'" title="'+m+'"></li>'}k="clear: both; ";l+='<li id="'+j+'color-default" class="color-box" style="width:80px; text-align:center; '+k+'background-color:white;" title="clear">clear</li>';var h=$('<div id="'+j+'color-picker" class="color-picker" style="position: absolute; left: 0px; top: 0px;"><ul>'+l+'</ul><div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("li.color-box").click(function(){var i=isNaN(this.id.substr(this.id.indexOf("-")+1))?"":b.colors[this.id.substr(this.id.indexOf("-")+1)];if(!g.is("input")){g.val(i);g.blur()}if($.isFunction(c.onChangeColor)){c.onChangeColor.call(g,i)}d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){g=$(this);i.stopPropagation();if(!g.is("input")){e(h)}});g.change(function(i){if(g.val()!=g.css("background-color")){g.css("background-color",g.val()).css("color",g.val())}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.simpleColorPickerOg){$("input.colorPicker").simpleColorPickerOg({onChangeColor:function(a){$(this).val(a).css("background-color",a).css("color",a).change()}})}});jQuery.fn.ogClockpicker=function(options,callback){var org_settings={starthour:6,endhour:20,showminutes:"true",minutedivisions:4,military:true,event:"click",layout:"vertical",valuefield:null,useBgiframe:false,hoursopacity:1,minutesopacity:1,second:""};if(options){jQuery.extend(org_settings,options)}var callback=callback||function(){},v=(org_settings.layout=="vertical");errorcheck(org_settings);jQuery(this)[org_settings.event](function(e){var self=this,$self=jQuery(this),$body=jQuery("body");var settings=jQuery.extend(true,{},org_settings);if($self.attr("valuefield")){settings.valuefield=$self.attr("valuefield")}if($self.attr("starthour")){settings.starthour=parseInt($self.attr("starthour"))}if($self.attr("endhour")){settings.endhour=parseInt($self.attr("endhour"))}if($self.attr("minutedivisions")){settings.minutedivisions=parseInt($self.attr("minutedivisions"))}if($self.attr("military")){settings.military=$self.attr("military")}if($self.attr("showminutes")){settings.showminutes=$self.attr("showminutes")}if($self.attr("usesecond")=="true"){settings.second="00"}if($self.attr("layout")){settings.layout=$self.attr("layout");org_settings.layout=settings.layout;v=(settings.layout=="vertical")}errorcheck(settings);if(!settings.valuefield){$self.unbind("keydown").bind("keydown",keyhandler)}else{var inputfield=jQuery("[name="+settings.valuefield+"]");inputfield.unbind("keydown").bind("keydown",keyhandler)[0].focus();inputfield.bind("click",function(){inputfield.unbind("keydown")})}jQuery("#CP_hourcont,#CP_minutecont").remove();var $hourcont=jQuery("<div id='CP_hourcont' class='CP' />").appendTo($body);!settings.useBgiframe?$hourcont.css("opacity",settings.hoursopacity):null;binder($hourcont);var $hourcol=[];for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){$hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo($body))}if(settings.showminutes=="true"){var $mc=jQuery("<div id='CP_minutecont' class='CP' />").appendTo($body);!settings.useBgiframe?$mc.css("opacity",settings.minutesopacity):null;binder($mc)}if(!v){$hourcont.css("width","auto");if(settings.showminutes=="true"){$mc.css("width","auto")}}else{for(i=0;i<$hourcol.length;i++){$hourcol[i].addClass("floatleft")}}renderhours();putcontainer();function renderhours(){var c=1;var numberC=0;for(var h=settings.starthour;h<=settings.endhour;h++){if(h%12==0){c=1}var displayhours=((!settings.military&&h>12)?h-12:h);var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}var $hd=jQuery("<div class='CP_hour' id='hr_"+h+"_"+c+"' value='"+valuehouers+"' >"+displayhours+set_tt(h)+"</div>");if(settings.military){$hd.width(20)}binder($hd);if(!v){$hd.css("float","left")}$hourcol[numberC].append($hd);if((h+1)%12==0){numberC++}c++}for(var j=0;j<$hourcol.length;j++){if(v){if(j!=0&&j%2==0){$hourcol[j].css("margin-left",$mc.width()+4+"px")}}else{$hourcont.append("<div style='clear:left' />");if(j!=0&&j%2==0){$hourcol[j].css("margin-top","19px")}}$hourcont.append($hourcol[j])}}function renderminutes(h){var realhours=h;var displayhours=(!settings.military&&h>12)?h-12:h;var valuehouers=h;if(!settings.military&&h==0){}else{if(!settings.military&&h==12){displayhours="0"}}if(settings.military&&h<10){displayhours="0"+displayhours}if(h<10){valuehouers="0"+valuehouers}$mc.empty();var n=60/settings.minutedivisions,tt=set_tt(realhours),counter=1;for(var m=0;m<60;m=m+n){$md=jQuery("<div class='CP_minute' id='"+realhours+"_"+m+"' value='"+valuehouers+((m<10)?"0":"")+m+"'>"+displayhours+":"+((m<10)?"0":"")+m+tt+"</div>");if(!v){$md.css("float","left");if(settings.minutedivisions>6&&counter==settings.minutedivisions/2+1){$mc.append("<div style='clear:left' />")}}$mc.append($md);binder($md);counter++}}function set_tt(realhours){if(!settings.military){return(realhours>=12)?" PM":" AM"}else{return""}}function putcontainer(){if(e.type!="focus"){$hourcont[0].style.left=e.pageX-5+"px";$hourcont[0].style.top=e.pageY-(Math.floor($hourcont.height()/2))+"px";rectify($hourcont)}else{$self.after($hourcont)}$hourcont.slideDown("fast");if(settings.useBgiframe){bgi($hourcont)}}function rectify($obj){var ph=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var pw=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;var t=parseInt($obj[0].style.top);var l=parseInt($obj[0].style.left);var st=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;if(t<=st&&!$obj.is("#CP_minutecont")){$obj.css("top",st+10+"px")}else{if(t+$obj.height()-st>ph){$obj.css("top",st+ph-$obj.height()-10+"px")}}if(l<=0){$obj.css("left","10px")}}function bgi(ob){if(typeof jQuery.fn.bgIframe=="function"){ob.bgIframe()}else{alert("bgIframe plugin not loaded.")}}function binder($obj){if($obj.attr("id")=="CP_hourcont"){$obj.mouseout(function(e){hourcont_out(e)})}else{if($obj.attr("id")=="CP_minutecont"){$obj.mouseout(function(e){minutecont_out(e)})}else{if($obj.attr("class")=="CP_hour"){$obj.mouseover(function(e){hourdiv_over($obj,e)});$obj.mouseout(function(){hourdiv_out($obj)});$obj.click(function(){hourdiv_click($obj)})}else{if($obj.attr("class")=="CP_minute"){$obj.mouseover(function(){minutediv_over($obj)});$obj.mouseout(function(){minutediv_out($obj)});$obj.click(function(){minutediv_click($obj)})}}}}}function hourcont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function minutecont_out(e){try{var t=(e.toElement)?e.toElement:e.relatedTarget;if(!(jQuery(t).is("div[class^=CP], iframe"))){cleardivs()}}catch(e){cleardivs()}}function hourdiv_over($obj,e){var h=$obj.attr("id").split("_")[1],i=$obj.attr("id").split("_")[2],l,t,nn;$obj.addClass("CP_over");nn=Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2);if(settings.showminutes=="true"){$mc.hide();renderminutes(h);if(v){t=e.type=="mouseover"?e.pageY-15:$hourcont.offset().top+2+($obj.height()*i);l=$hourcont.offset().left+$hourcol[0].width()*2*nn+$mc.width()*(nn-1)+4*nn-2}else{l=(e.type=="mouseover")?e.pageX-10:$hourcont.offset().left+($obj.width()-5)*i;t=$hourcont.offset().top+($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn+$mc.height()*(nn-1)+2*nn-1}$mc.css("left",l+"px").css("top",t+"px");rectify($mc);$mc.show();if(settings.useBgiframe){bgi($mc)}}return false}function hourdiv_out($obj){$obj.removeClass("CP_over");return false}function hourdiv_click($obj){var h=$obj.attr("id").split("_")[1],tt=set_tt(h),str=$obj.attr("value");if(str.indexOf(" ")!=-1){var cleanstr=str.substring(0,str.indexOf(" "))}else{var cleanstr=str}$obj.text(cleanstr+"00"+settings.second);setval($obj);cleardivs()}function minutediv_over($obj){$obj.addClass("CP_over");return false}function minutediv_out($obj){$obj.removeClass("CP_over");return false}function minutediv_click($obj){$obj.text($obj.attr("value")+settings.second);setval($obj);cleardivs()}function setval($obj){if(!settings.valuefield){self.value=$obj.text()}else{jQuery("input[name="+settings.valuefield+"]").val($obj.text()).change()}callback.apply($self,[$obj.text()]);$self.unbind("keydown",keyhandler)}function cleardivs(){if(settings.showminutes=="true"){$mc.hide()}$hourcont.slideUp("fast");$self.unbind("keydown",keyhandler)}function keyhandler(e){var $obj=$("div.CP_over").size()?$("div.CP_over"):$("div.CP_hour:first"),divtype=$obj.is(".CP_hour")?"hour":"minute",hi=(divtype=="hour")?$obj[0].id.split("_")[2]:0,h=(divtype=="minute")?$obj[0].id.split("_")[0]:$obj[0].id.split("_")[1];if(divtype=="minute"){if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){var curloc="m1"}else{if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){var curloc="m2"}else{var curloc="m3"}}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var curloc="h1"}else{var curloc="h2"}}function divprev($obj){if($obj.prev().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.prev(), e)")}else{return false}}function divnext($obj){if($obj.next().size()){eval(divtype+"div_out($obj)");eval(divtype+"div_over($obj.next(), e)")}else{return false}}function hourtohour($obj){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1)}var ctx="#hourcol"+next;$newobj=jQuery(".CP_hour[id$=_"+hi+"]",ctx);if($newobj.size()){hourdiv_out($obj);hourdiv_over($newobj,e)}else{return false}}function hourtominute($obj){hourdiv_out($obj);minutediv_over($(".CP_minute:first"))}function minutetohour($obj,where){minutediv_out($obj);if(where<0){if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)-12)}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}}else{if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12)))}else{var next=String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where);h=String(Number(h)+12)}}var ctx="#hourcol"+next;var $newobj=jQuery(".CP_hour[id^=hr_"+h+"]",ctx);hourdiv_over($newobj,e)}switch(e.keyCode){case 37:if(v){switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}else{divprev($obj)}break;case 38:if(v){divprev($obj)}else{switch(curloc){case"m1":return false;break;case"m2":minutetohour($obj,-1);break;case"m3":minutetohour($obj,-1);break;case"h1":hourtominute($obj);break;case"h2":hourtohour($obj);break}}break;case 39:if(v){switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}else{divnext($obj)}break;case 40:if(v){divnext($obj)}else{switch(curloc){case"m1":minutetohour($obj,1);break;case"m2":return false;break;case"m3":minutetohour($obj,1);break;case"h1":hourtohour($obj);break;case"h2":hourtominute($obj);break}}break;case 13:eval(divtype+"div_click($obj)");break;default:return true}return false}return false});function errorcheck(settings){if(settings.starthour>=settings.endhour){alert("Error - start hour must be less than end hour.");return false}else{if(60%settings.minutedivisions!=0){alert("Error - param minutedivisions must divide evenly into 60.");return false}}}return this};$(function(){if($.fn.ogClockpicker){$(document).ready(function(){$(".clockpick").ogClockpicker()})}});function likeComp(c){var b=c.substring(6);var d=$("#"+c).attr("aimaiType");var a=$("#"+b).val();a=a.replace(/^%+|%+$/g,"");if(a!=""){switch(d){case"1":a=a+"%";break;case"2":a="%"+a;break;case"3":a="%"+a+"%";break}}$("#"+b).val(a)}$(function(){$("form").submit(function(){$("[id^='AIMAI_']").each(function(){likeComp(this.id)})})});$.fn.aimaiPickerOg=function(a){var c={texts:[" V "," V*","*V ","*V*"],titls:["完全一致","前方一致","後方一致","前後曖昧"]};var b=$.extend(c,a);return this.each(function(){var g=$(this);var j="PIC_"+g.attr("id").replace(/-/g,"")+"_";var l="";for(var f=0;f<b.texts.length;f++){var m=b.texts[f];var k=b.titls[f];l+='<span id="'+j+"text-"+f+'" class="text-box"" title="'+k+'">('+m+") </span>"}var h=$('<div id="'+j+'aimai-picker" class="aimai-picker" style="position: absolute; left: 0px; top: 0px;">'+l+'<div style="clear: both;"></div></div>');$("body").append(h);h.hide();h.find("span.text-box").click(function(){var i=this.id.substr(this.id.indexOf("-")+1);g.attr("aimaiType",i);g.attr("title",b.titls[i]);g.text(b.texts[i]);g.blur();d(h)});$("body").live("click",function(){d(h)});h.click(function(i){i.stopPropagation()});var e=function(i){var p=g.offset();var o=p.left+g.outerWidth()-i.outerWidth();if(o<p.left){o=p.left}i.css({left:o,top:(p.top+g.outerHeight())});n(i)};g.click(function(i){i.stopPropagation();if(!g.is("input")){e(h)}});g.focus(function(){e(h)});function d(i){if(b.hideEffect=="fade"){i.fadeOut()}else{if(b.hideEffect=="slide"){i.slideUp()}else{i.hide()}}}function n(i){if(b.showEffect=="fade"){i.fadeIn()}else{if(b.showEffect=="slide"){i.slideDown()}else{i.show()}}}})};$(function(){if($.fn.aimaiPickerOg){$(".aimaiClm").aimaiPickerOg()}});(function(){$.fn.glDatePicker=function(options){var pluginName="glDatePicker";var instance=this.data(pluginName);if(!instance){return this.each(function(){return $(this).data(pluginName,new glDatePicker(this,options))})}return(options===true)?instance:this};$.fn.glDatePicker.defaults={cssName:"default",zIndex:1000,borderSize:1,calendarOffset:{x:0,y:1},showAlways:false,hideOnClick:true,allowMonthSelect:true,allowYearSelect:true,todayDate:new Date(),selectedDate:null,prevArrow:"\u25c4",nextArrow:"\u25ba",selectableDates:null,selectableDateRange:null,specialDates:null,selectableMonths:null,selectableYears:null,selectableDOW:null,monthNames:null,dowNames:null,dowOffset:(HYBS_CAL_START_MON==true?1:0),onClick:(function(el,cell,date,data){var tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){var _targetId=el.attr("targetId");if(_targetId!=null){tgt=$("#"+_targetId)}}var year=date.getFullYear();var month=date.getMonth()+1;var day=date.getDate();if(month<10){month="0"+month}if(day<10){day="0"+day}var oldval=tgt.val();var str=year+""+month+""+day;tgt.val(str);if(oldval!=str){tgt.change()}}),onHover:function(el,cell,date,data){},onShow:function(calendar){calendar.show()},onHide:function(calendar){calendar.hide()},firstDate:null};var glDatePicker=(function(){function glDatePicker(element,userOptions){var self=this;self.el=$(element);var el=self.el;self.options=$.extend(true,{},$.fn.glDatePicker.defaults,userOptions);var options=self.options;var _tgt=el;if(el[0].tagName.toUpperCase()!="INPUT"){if(el.attr("targetId")){_tgt=$("#"+el.attr("targetId"))}}var _inputDate=_tgt.val();if(_inputDate!=null&&_inputDate.length>=8){_inputDate=_inputDate.replace(/\u002f/g,"");try{_inputDate=_inputDate.substr(0,4)+"/"+_inputDate.substr(4,2)+"/"+_inputDate.substr(6,2)}catch(e){_inputDate=null}}else{_inputDate=null}self.calendar=$($.find("[gldp-el="+el.attr("gldp-id")+" ]"));options.selectedDate=(options.selectedDate||new Date(_inputDate||options.todayDate))||options.todayDate;options.firstDate=(new Date((options.firstDate||options.selectedDate)))._first();if(!(el.attr("gldp-id")||"").length){el.attr("gldp-id","gldp-"+Math.round(Math.random()*10000000000))}el.addClass("gldp-el").bind("click",function(e){self.show(e)});if(self.calendar.length&&!options.showAlways){self.calendar.hide()}$(document).bind("mouseup",function(e){var target=e.target;var calendar=self.calendar;if(!el.is(target)&&!calendar.is(target)&&calendar.has(target).length===0&&calendar.is(":visible")){self.hide()}})}glDatePicker.prototype={show:function(){this.render();$.each($(".gldp-el").not(this.el),function(i,o){if(o.length){o.options.onHide(o.calendar)}});this.options.onShow(this.calendar)},hide:function(){if(this.options&&!this.options.showAlways){this.options.onHide(this.calendar)}},render:function(renderCalback){var self=this;var el=self.el;var options=self.options;var calendar=self.calendar;var coreClass=" core border ";var cssName="gldp-"+options.cssName;var todayVal=options.todayDate._val();var todayTime=todayVal.time;var maxRow=6;var maxCol=7;var borderSize=options.borderSize+"px";var getSelectableList=function(min,max,userList){var resultList=[];for(var i=min;i<=max;i++){resultList.push(i)}if(userList){var newList=[];$.each(userList,function(i,v){if(v>=min&&v<=max&&newList._indexOf(v)<0){newList.push(v)}});resultList=newList.length?newList:resultList}resultList.sort();return resultList};var selectableMonths=getSelectableList(0,11,options.selectableMonths);var selectableYears=getSelectableList(todayVal.year-5,todayVal.year+5,options.selectableYears);var selectableDOW=getSelectableList(0,6,options.selectableDOW);var dowNames=options.dowNames||["日","月","火","水","木","金","土"];var monthNames=options.monthNames||["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];var containerSize=window.innerHeight?window.innerHeight:180;if(containerSize<180){containerSize=(containerSize>135?containerSize:135)}else{containerSize=180}var containerWidth=options.conainerWidth||containerSize;var containerHeight=containerWidth;var getCellSize=function(_size,_count){return(_size/_count)+((options.borderSize/_count)*(_count-1))-1};var cellWidth=getCellSize(containerWidth,maxCol);var cellHeight=getCellSize(containerHeight,maxRow+2);if(!calendar.length){self.calendar=calendar=$("<div/>").attr("gldp-el",el.attr("gldp-id")).data("is",true).css({display:(options.showAlways?undefined:"none"),zIndex:options.zIndex,width:((cellWidth+1)*maxCol)+"px"});$("body").append(calendar)}else{if(!eval(calendar.data("is"))){containerWidth=calendar.outerWidth();containerHeight=calendar.outerHeight();cellWidth=getCellSize(containerWidth,maxCol);cellHeight=getCellSize(containerHeight,maxRow+2)}self.calendar.css({width:((cellWidth+1)*maxCol)+"px"})}if(!el.is(":visible")){calendar.hide()}calendar.removeClass().addClass(cssName).children().remove();var onResize=function(){var elPos=el.offset();calPosTop=(elPos.top+el.outerHeight()+options.calendarOffset.y)-20;calPosLeft=(elPos.left+options.calendarOffset.x);if(calPosTop>$(window).height()-150){calPosTop-=130}if(calPosLeft>$(window).width()-150){calPosLeft-=150}if(calPosTop<0){calPosTop=0}if(calPosLeft<0){calPosLeft=0}calendar.css({top:calPosTop+"px",left:calPosLeft+"px"})};$(window).resize(onResize);onResize();var cellCSS={width:cellWidth+"px",height:cellHeight+"px",lineHeight:cellHeight+"px"};var setFirstDate=function(_date){if(_date){options.firstDate=_date;self.render()}};var getFirstDate=function(_offset){var _date=new Date(options.firstDate);_offset=_offset||0;while(true){_date.setMonth(_date.getMonth()+_offset);_date.setDate(Math.min(1,_date._max()));if(_offset==0){break}var dateVal=_date._val();var dateMonth=dateVal.month;var dateYear=dateVal.year;if(selectableMonths._indexOf(dateMonth)!=-1){if(selectableYears._indexOf(dateYear)!=-1){break}else{if(dateYear<selectableYears[0]||dateYear>selectableYears[selectableYears.length-1]){return null}}}}return _date};var prevFirstDate=getFirstDate(-1);var nextFirstDate=getFirstDate(1);var firstDate=(options.firstDate=getFirstDate());var firstDateVal=firstDate._val();var firstDateMonth=firstDateVal.month;var firstDateYear=firstDateVal.year;var startDate=new Date(firstDate);var dowOffset=Math.abs(Math.min(6,Math.max(0,options.dowOffset)));var startOffset=startDate.getDay()-dowOffset;startOffset=startOffset<1?-7-startOffset:-startOffset;dowNames=(dowNames.concat(dowNames)).slice(dowOffset,dowOffset+7);startDate._add(startOffset);var showPrev=(prevFirstDate);var showNext=(nextFirstDate);var monyearClass=coreClass+"monyear ";var prevCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{borderWidth:borderSize+" 0 0 "+borderSize})).append($("<a/>").addClass("prev-arrow"+(showPrev?"":"-off")).html(options.prevArrow)).mousedown(function(){return false}).click(function(e){if(options.prevArrow!=""&&showPrev){e.stopPropagation();setFirstDate(prevFirstDate)}});var titleCellCount=maxCol-2;var titleWidth=(cellWidth*titleCellCount)-(titleCellCount*options.borderSize)+(options.borderSize);var titleCell=$("<div/>").addClass(monyearClass+"title").css($.extend({},cellCSS,{width:titleWidth+"px",borderTopWidth:borderSize,marginLeft:"-"+(borderSize)}));var nextCell=$("<div/>").addClass(monyearClass).css($.extend({},cellCSS,{marginLeft:"-"+(borderSize),borderWidth:borderSize+" "+borderSize+" 0 0"})).append($("<a/>").addClass("next-arrow"+(showNext?"":"-off")).html(options.nextArrow)).mousedown(function(){return false}).click(function(e){if(options.nextArrow!=""&&showNext){e.stopPropagation();setFirstDate(nextFirstDate)}});calendar.append(prevCell).append(titleCell).append(nextCell);for(var row=0,cellIndex=0;row<maxRow+1;row++){for(var col=0;col<maxCol;col++,cellIndex++){var cellDate=new Date(startDate);var cellClass="day";var cellZIndex=options.zIndex+(cellIndex);var cell=$("<div/>");if(!row){cellClass="dow";cell.html(dowNames[col]);cellDate=null}else{cellDate._add(col+((row-1)*maxCol));var cellDateVal=cellDate._val();var cellDateTime=cellDateVal.time;var specialData=null;var isSelectable=true;var getRepeatDate=function(v,date){if(v.repeatYear===true){date.setYear(cellDateVal.year)}if(v.repeatMonth===true){date.setMonth(cellDateVal.month)}return date._val()};cell.html(cellDateVal.date);if(options.selectableDateRange){isSelectable=false;$.each(options.selectableDateRange,function(i,v){var dateFrom=v.from;var dateTo=(v.to||null);dateTo=dateTo||new Date(v.from.getFullYear(),v.from.getMonth(),v.from._max());dateFrom=getRepeatDate(v,dateFrom);dateTo=getRepeatDate(v,dateTo);if(cellDateTime>=dateFrom.time&&cellDateTime<=dateTo.time){isSelectable=true;return true}})}if(options.selectableDates){if((options.selectableDateRange&&!isSelectable)||(isSelectable&&!options.selectableDateRange)){isSelectable=false}$.each(options.selectableDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){return(isSelectable=true)}})}if(!isSelectable||selectableYears._indexOf(cellDateVal.year)<0||selectableMonths._indexOf(cellDateVal.month)<0||selectableDOW._indexOf(cellDateVal.day)<0){cellClass="noday"}else{cellClass=(["sun","mon","tue","wed","thu","fri","sat"])[cellDateVal.day];if(firstDateMonth!=cellDateVal.month){cellClass+=" outday"}if(todayTime==cellDateTime){cellClass="today";cellZIndex+=50}if(options.selectedDate._time()==cellDateTime){cellClass="selected";cellZIndex+=51}if(options.specialDates){$.each(options.specialDates,function(i,v){var vDate=getRepeatDate(v,v.date);if(vDate.time==cellDateTime){cellClass=(v.cssClass||"special");cellZIndex+=52;specialData=v.data}})}cell.mousedown(function(){return false}).hover(function(e){e.stopPropagation();var hoverData=$(this).data("data");options.onHover(el,cell,hoverData.date,hoverData.data)}).click(function(e){e.stopPropagation();var clickedData=$(this).data("data");options.selectedDate=options.firstDate=clickedData.date;self.render(function(){if(!options.showAlways&&options.hideOnClick){self.hide()}});options.onClick(el,$(this),clickedData.date,clickedData.data)})}}$.extend(cellCSS,{borderTopWidth:borderSize,borderBottomWidth:borderSize,borderLeftWidth:(row>0||(!row&&!col))?borderSize:0,borderRightWidth:(row>0||(!row&&col==6))?borderSize:0,marginLeft:(col>0)?"-"+(borderSize):0,marginTop:(row>0)?"-"+(borderSize):0,zIndex:cellZIndex});cell.data("data",{date:cellDate,data:specialData}).addClass(coreClass+cellClass).css(cellCSS);calendar.append(cell)}}var toggleYearMonthSelect=function(showYear){var show="inline-block";var hide="none";if(options.allowMonthSelect){monthText.css({display:!showYear?hide:show});monthSelect.css({display:!showYear?show:hide})}if(options.allowYearSelect){yearText.css({display:showYear?hide:show});yearSelect.css({display:showYear?show:hide})}};var onYearMonthSelect=function(){options.firstDate=new Date(yearSelect.val(),monthSelect.val(),1);self.render()};var monthSelect=$("<select/>").hide().change(onYearMonthSelect);var yearSelect=$("<select/>").hide().change(onYearMonthSelect);var monthText=$("<span/>").html(monthNames[firstDateMonth]).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(false)});var yearText=$("<span/>").html(firstDateYear).mousedown(function(){return false}).click(function(e){e.stopPropagation();toggleYearMonthSelect(true)});$.each(monthNames,function(i,v){if(options.allowMonthSelect&&selectableMonths._indexOf(i)!=-1){var o=$("<option/>").html(v).attr("value",i);if(i==firstDateMonth){o.attr("selected","selected")}monthSelect.append(o)}});$.each(selectableYears,function(i,v){if(options.allowYearSelect){var o=$("<option/>").html(v).attr("value",v);if(v==firstDateYear){o.attr("selected","selected")}yearSelect.append(o)}});var titleYearMonth=$("<div/>").append(monthText).append(monthSelect).append(yearText).append(yearSelect);titleCell.children().remove();titleCell.append(titleYearMonth);renderCalback=renderCalback||(function(){});renderCalback();var mousewheelevent="onwheel" in document?"wheel":"onmousewheel" in document?"mousewheel":"DOMMouseScroll";calendar.bind(mousewheelevent,function(e){e.preventDefault();var delta=e.originalEvent.deltaY?-(e.originalEvent.deltaY):e.originalEvent.wheelDelta?e.originalEvent.wheelDelta:-(e.originalEvent.detail);if(delta<0){nextCell.click()}else{prevCell.click()}})}};return glDatePicker})();(function(){Date.prototype._clear=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype._time=function(){return this._clear().getTime()};Date.prototype._max=function(){var isLeapYear=(new Date(this.getYear(),1,29).getMonth()==1)?1:0;var days=[31,28+isLeapYear,31,30,31,30,31,31,30,31,30,31];return days[this.getMonth()]};Date.prototype._add=function(days){this.setDate(this.getDate()+days)};Date.prototype._first=function(){var date=new Date(this);date.setDate(1);return date};Date.prototype._val=function(){this._clear();return{year:this.getFullYear(),month:this.getMonth(),date:this.getDate(),time:this.getTime(),day:this.getDay()}};Array.prototype._indexOf=function(value){return $.inArray(value,this)}})()})();$(function(){if($.fn.glDatePicker){$(".calPic").glDatePicker()}});function selectScroll(a){var d=4;if(a.getAttribute("size")){d=a.getAttribute("size")}var e=a.options;for(var c=0;c<e.length;c++){if(e[c].selected){if(e[c].parentNode.tagName.toUpperCase()=="OPTGROUP"){c+=$(e[c].parentNode).prev().length}var b=c*($(a).height()/d);break}}$(a).scrollTop(b)}$(function(){$("select[multiple]").each(function(){selectScroll(this)})}); | |
\ No newline at end of file |
@@ -2196,6 +2196,22 @@ | ||
2196 | 2196 | * @og.paramLevel 1:設定確認 |
2197 | 2197 | */ |
2198 | 2198 | public static final String EVENT_COLUMN_URL = "common/eventColumnMaker.jsp" ; |
2199 | + | |
2200 | + /** | |
2201 | + * eventColumn利用時のセキュリティ向上対応を行います。 | |
2202 | + * | |
2203 | + * trueにした場合は暗号化処理を入れます。 | |
2204 | + * trueの場合はvalueタグでデコードする必要があります。 | |
2205 | + * 初期値は互換性のあるfalseです。 | |
2206 | + * | |
2207 | + * 初期値:false | |
2208 | + * EVENT_COLUMN_URL = "false" | |
2209 | + * | |
2210 | + * @og.rev 5.10.4.0 (2018/10/05) 新規作成 | |
2211 | + * | |
2212 | + * @og.paramLevel 1:設定確認 | |
2213 | + */ | |
2214 | + public static final String EVENT_SQL_ENCRYPT = "false" ; | |
2199 | 2215 | |
2200 | 2216 | /** |
2201 | 2217 | * TableUpdateParamで使用される固定カラムを処理するクラスを指定します。 |
@@ -15,9 +15,13 @@ | ||
15 | 15 | */ |
16 | 16 | package org.opengion.hayabusa.db; |
17 | 17 | |
18 | +import java.util.regex.Matcher; | |
19 | +import java.util.regex.Pattern; | |
20 | + | |
18 | 21 | import org.opengion.hayabusa.common.HybsSystem; |
19 | 22 | import org.opengion.fukurou.util.StringFormat; |
20 | 23 | import org.opengion.fukurou.util.StringUtil; |
24 | +import org.opengion.fukurou.security.HybsCryptography; | |
21 | 25 | |
22 | 26 | /** |
23 | 27 | * 動的プルダウンなどで利用されるイベントカラムの各種情報を保持するための |
@@ -50,10 +54,17 @@ | ||
50 | 54 | final String editor; // 子カラムのエディター |
51 | 55 | final String rendParam; // 子カラムの表示パラメーター |
52 | 56 | final String editParam; // 子カラムの編集パラメーター |
57 | + // 5.10.4.0 (2018/10/05) | |
58 | + final Boolean flgEncrypt; | |
59 | + final Pattern trgPattern = Pattern.compile("(?<=\\{@)[^.]+?(?=\\})"); | |
60 | + HybsCryptography hc = null; | |
53 | 61 | |
54 | 62 | /** |
55 | 63 | * 初期情報を含んだ新規オブジェクトを作成します。 |
64 | + * このコンストラクタではflgEncryptをfalseとして扱う。 | |
56 | 65 | * |
66 | + * @og.rev 5.10.4.0 (2018/10/05) 暗号化処理追加 | |
67 | + * | |
57 | 68 | * @param name 内容を置き換えるカラム(子カラム) |
58 | 69 | * @param evCol イベントカラム(親カラム・カンマ区切り) |
59 | 70 | * @param eventUrl イベント発行時の処理URL |
@@ -72,6 +83,11 @@ | ||
72 | 83 | this.editor = editor; |
73 | 84 | this.rendParam = rendParam; |
74 | 85 | this.editParam = editParam; |
86 | + // 5.10.4.0 (2018/10/05) 暗号化対応 | |
87 | + this.flgEncrypt = HybsSystem.sysBool("EVENT_SQL_ENCRYPT"); | |
88 | + if(flgEncrypt) { | |
89 | + this.hc = new HybsCryptography(); | |
90 | + } | |
75 | 91 | } |
76 | 92 | |
77 | 93 | /** |
@@ -116,6 +132,7 @@ | ||
116 | 132 | * 子カラムの表示パラメーターを返します。 |
117 | 133 | * |
118 | 134 | * @og.rev 5.9.0.1 (2015/09/11) アンダースコア対応 |
135 | + * @og.rev 5.10.4.0 (2018/10/05) 暗号化処理追加 | |
119 | 136 | * |
120 | 137 | * @return 子カラムの表示パラメーター |
121 | 138 | */ |
@@ -125,7 +142,13 @@ | ||
125 | 142 | // ,"{@" + evCol.replace( ",", "}:{@" ) + "}" |
126 | 143 | ,"{@" + evColReplace(evCol).replace( ",", "}:{@" ) + "}" |
127 | 144 | ,name ); |
128 | - return sf.format(); | |
145 | + // 5.10.4.0 (2018/10/05) | |
146 | +// return sf.format(); | |
147 | + if(flgEncrypt) { | |
148 | + return hc.encrypt(sf.format()); | |
149 | + }else { | |
150 | + return sf.format(); | |
151 | + } | |
129 | 152 | } |
130 | 153 | |
131 | 154 | /** |
@@ -132,6 +155,7 @@ | ||
132 | 155 | * 子カラムの編集パラメーターを返します。 |
133 | 156 | * |
134 | 157 | * @og.rev 5.9.0.1 (2015/09/11) アンダースコア対応 |
158 | + * @og.rev 5.10.4.0 (2018/10/05) 暗号化処理追加 | |
135 | 159 | * |
136 | 160 | * @return 子カラムの編集パラメーター |
137 | 161 | */ |
@@ -141,7 +165,13 @@ | ||
141 | 165 | // ,"{@" + evCol.replace( ",", "}:{@" ) + "}" |
142 | 166 | ,"{@" + evColReplace(evCol).replace( ",", "}:{@" ) + "}" |
143 | 167 | ,name ); |
144 | - return sf.format(); | |
168 | + // 5.10.4.0 (2018/10/05) | |
169 | +// return sf.format(); | |
170 | + if(flgEncrypt) { | |
171 | + return hc.encrypt(sf.format()); | |
172 | + }else { | |
173 | + return sf.format(); | |
174 | + } | |
145 | 175 | } |
146 | 176 | |
147 | 177 | /** |
@@ -170,4 +200,85 @@ | ||
170 | 200 | |
171 | 201 | return org.opengion.fukurou.util.StringUtil.array2csv(to); |
172 | 202 | } |
203 | + | |
204 | + /** | |
205 | + * 文字列から{@XXX}のXXXを抜き出して、CSVに変換する。 | |
206 | + * | |
207 | + * @og.rev 5.10.4.0 (2018/10/05) 新規作成 | |
208 | + * | |
209 | + * @param trg 変換対象文字列 | |
210 | + * @return CSV文字列 | |
211 | + */ | |
212 | + private String getTrgCsv(String trg) { | |
213 | + if(trg == null || trg.length() == 0) { | |
214 | + return ""; | |
215 | + } | |
216 | + | |
217 | + Matcher m = trgPattern.matcher(trg); | |
218 | + StringBuilder rtn = new StringBuilder(); | |
219 | + while(m.find()) { | |
220 | + if(rtn.length() != 0) { | |
221 | + rtn.append(","); | |
222 | + } | |
223 | + rtn.append(m.group()); | |
224 | + } | |
225 | + | |
226 | + return rtn.toString(); | |
227 | + } | |
228 | + | |
229 | + /** | |
230 | + * レンデラーパラメータのキーリストを渡します。 | |
231 | + * 複合化後の値設定に利用します。 | |
232 | + * | |
233 | + * @og.rev 5.10.4.0 (2018/10/05) 新規作成 | |
234 | + * | |
235 | + * @return レンデラーパラメータのキーリスト | |
236 | + */ | |
237 | + public String getRendParamKeys() { | |
238 | + // 暗号化しない、またはrendParamが空の場合は、空文字を返す | |
239 | + if(!flgEncrypt || | |
240 | + (rendParam == null || rendParam.length() == 0)) | |
241 | + { return ""; } | |
242 | + | |
243 | + StringFormat sf = new StringFormat( | |
244 | + rendParam | |
245 | + ,"{@" + evColReplace(evCol).replace( ",", "}:{@" ) + "}" | |
246 | + ,name ); | |
247 | + | |
248 | + return getTrgCsv(sf.format()); | |
249 | + } | |
250 | + | |
251 | + /** | |
252 | + * エディターパラメータのキーリストを渡します。 | |
253 | + * 複合化後の値設定に利用します。 | |
254 | + * | |
255 | + * @og.rev 5.10.4.0 (2018/10/05) 新規作成 | |
256 | + * | |
257 | + * @return エディターパラメータのキーリスト | |
258 | + */ | |
259 | + public String getEditParamKeys() { | |
260 | + // 暗号化しない、またはrendParamが空の場合は、空文字を返す | |
261 | + if(!flgEncrypt || | |
262 | + (editParam == null || editParam.length() == 0)) | |
263 | + { return ""; } | |
264 | + | |
265 | + StringFormat sf = new StringFormat( | |
266 | + editParam | |
267 | + ,"{@" + evColReplace(evCol).replace( ",", "}:{@" ) + "}" | |
268 | + ,name ); | |
269 | + | |
270 | + return getTrgCsv(sf.format()); | |
271 | + } | |
272 | + | |
273 | + /** | |
274 | + * 暗号化フラグを渡します。 | |
275 | + * | |
276 | + * @og.rev 5.10.4.0 (2018/10/05) 新規作成 | |
277 | + * | |
278 | + * @return 暗号化フラグ | |
279 | + */ | |
280 | + public Boolean isFlgEncrypt() { | |
281 | + return flgEncrypt; | |
282 | + } | |
283 | + | |
173 | 284 | } |
@@ -82,6 +82,7 @@ | ||
82 | 82 | * caseNull 【TAG】指定の値が、null/ゼロ文字列 の場合は、このタグは使用されます(初期値:true) |
83 | 83 | * toVal 【TAG】部分文字列置換の 置換え後の部分文字列(to)を指定します |
84 | 84 | * fromVal 【TAG】部分文字列置換の 置換え前の部分文字列(from)を指定します |
85 | + * cryptKey 【TAG】暗号化と複合化で利用する、暗号化キーを指定します。 | |
85 | 86 | * debug 【TAG】デバッグ情報を出力するかどうか[true/false]を指定します(初期値:false) |
86 | 87 | * > ... Body ... |
87 | 88 | * </og:value> |
@@ -209,12 +210,16 @@ | ||
209 | 210 | public static final String ACT_CASE = "CASE" ; // 5.7.7.2 (2014/06/20) |
210 | 211 | /** action 引数に渡す事の出来る アクション MD5 {@value} */ |
211 | 212 | public static final String ACT_MD5 = "MD5" ; // 5.9.6.3 (2016/03/18) |
213 | + /** action 引数に渡す事の出来る アクション ACT_CRYPT_ENC {@value} */ | |
214 | + public static final String ACT_CRYPT_ENC = "CRYPT_ENC"; // 5.10.4.0 (2018/10/05) | |
215 | + /** action 引数に渡す事の出来る アクション ACT_CRYPT_DEC {@value} */ | |
216 | + public static final String ACT_CRYPT_DEC = "CRYPT_DEC"; // 5.10.4.0 (2018/10/05) | |
212 | 217 | |
213 | 218 | /** action 引数に渡す事の出来る アクション リスト */ |
214 | 219 | private static final String[] ACTION_LIST = new String[] { |
215 | 220 | ACT_UPPER , ACT_LOWER , ACT_MESSAGE , ACT_APPEND , ACT_ALL_APPEND , ACT_MAP , ACT_ALL_MAP , ACT_LIST, ACT_ALL_LIST , |
216 | - ACT_DAY_WEEK , ACT_MERGE , ACT_FIRST , ACT_ROW_APPEND , ACT_REPLACE , ACT_SUBSTR , ACT_SPLIT , ACT_MAX_MIN , ACT_ALL_MAX_MIN , | |
217 | - ACT_EXEC , ACT_CASE, ACT_MD5 | |
221 | + ACT_DAY_WEEK , ACT_MERGE , ACT_FIRST , ACT_ROW_APPEND , ACT_REPLACE , ACT_SUBSTR , ACT_SPLIT , ACT_MAX_MIN , ACT_ALL_MAX_MIN , | |
222 | + ACT_EXEC , ACT_CASE, ACT_MD5, ACT_CRYPT_ENC, ACT_CRYPT_DEC | |
218 | 223 | }; |
219 | 224 | |
220 | 225 | private String tableId = HybsSystem.TBL_MDL_KEY; |
@@ -239,7 +244,7 @@ | ||
239 | 244 | private String toVal = null; // 5.2.2.0 (2010/11/01) |
240 | 245 | |
241 | 246 | private boolean tmpSelectedAll = false; // 5.6.4.3 (2013/05/24) action="ALL_xxx"を tmpSelectedAll="true" で内部処理します。 |
242 | - | |
247 | + private String cryptKey = null; // 5.10.4.0 (2018/10/05) 暗号化キー | |
243 | 248 | /** |
244 | 249 | * Taglibの開始タグが見つかったときに処理する doStartTag() を オーバーライドします。 |
245 | 250 | * |
@@ -392,6 +397,7 @@ | ||
392 | 397 | * @og.rev 5.2.2.0 (2010/11/01) fromVal , toVal 属性 追加 |
393 | 398 | * @og.rev 5.6.4.3 (2013/05/24) parameter 属性は、未使用なので削除 |
394 | 399 | * @og.rev 5.6.4.3 (2013/05/24) tmpSelectedAll 属性追加。action="ALL_xxx"を tmpSelectedAll="true" に置き換えます。 |
400 | + * @og.rev 5.10.4.0 (2018/10/03) CRYPT追加 | |
395 | 401 | * |
396 | 402 | */ |
397 | 403 | @Override |
@@ -414,6 +420,7 @@ | ||
414 | 420 | xssCheck = HybsSystem.sysBool( "USE_XSS_CHECK" ); // 5.1.7.0 (2010/06/01) XSS解除対応 |
415 | 421 | fromVal = null; // 5.2.2.0 (2010/11/01) |
416 | 422 | toVal = null; // 5.2.2.0 (2010/11/01) |
423 | + cryptKey = null; // 5.10.4.0 (2018/10/05) | |
417 | 424 | } |
418 | 425 | |
419 | 426 | /** |
@@ -486,6 +493,7 @@ | ||
486 | 493 | * @og.rev 5.6.6.1 (2013/07/12) value が null の場合は、無視します。 |
487 | 494 | * @og.rev 5.7.7.2 (2014/06/20) EXEC と CASE アクションを追加 |
488 | 495 | * @og.rev 5.9.6.3 (2016/02/18) MD5追加 |
496 | + * @og.rev 5.10.4.0 (2018/10/05) CRYPT追加 | |
489 | 497 | * |
490 | 498 | * @param action コマンド(public static final 宣言されている文字列) |
491 | 499 | * @param value 旧の値 |
@@ -585,6 +593,14 @@ | ||
585 | 593 | else if( ACT_MD5.equals( action ) ){ |
586 | 594 | rtn = HybsCryptography.getMD5( value ); |
587 | 595 | } |
596 | + // 5.10.4.0 (2018/10/05) | |
597 | + else if( ACT_CRYPT_ENC.equals( action ) ) { | |
598 | + HybsCryptography hc = new HybsCryptography(cryptKey); | |
599 | + rtn = hc.encrypt( value ); | |
600 | + }else if( ACT_CRYPT_DEC.equals( action ) ) { | |
601 | + HybsCryptography hc = new HybsCryptography(cryptKey); | |
602 | + rtn = hc.decrypt( value ); | |
603 | + } | |
588 | 604 | |
589 | 605 | return rtn; |
590 | 606 | } |
@@ -1494,6 +1510,21 @@ | ||
1494 | 1510 | } |
1495 | 1511 | |
1496 | 1512 | /** |
1513 | + * 【TAG】暗号化、複合化に利用する暗号化キーを指定します。 | |
1514 | + * | |
1515 | + * @og.tag | |
1516 | + * 暗号化キーをしています。 | |
1517 | + * 未設定の場合は、エンジンで用意されているキーを利用します。 | |
1518 | + * 暗号化キーは8の倍数の文字数が推奨されています。 | |
1519 | + * | |
1520 | + * @og.rev 5.10.4.0 (2018/10/05) 新規追加 | |
1521 | + * @param cKey | |
1522 | + */ | |
1523 | + public void setCryptKey( final String cKey ) { | |
1524 | + cryptKey = nval( getRequestParameter( cKey ), cryptKey); | |
1525 | + } | |
1526 | + | |
1527 | + /** | |
1497 | 1528 | * シリアライズ用のカスタムシリアライズ書き込みメソッド |
1498 | 1529 | * |
1499 | 1530 | * @og.rev 4.0.0.0 (2006/09/31) 新規追加 |
@@ -1,2560 +1,2601 @@ | ||
1 | -/************************************************************************************/ | |
2 | -/* 旧 focusHilight.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
3 | -/* */ | |
4 | -/* フォーカスが当っているアクティブフィールドの色を変更します */ | |
5 | -/* 色はfocusFieldクラスで指定しています */ | |
6 | -/* */ | |
7 | -/* @og.rev 4.3.5.0 (2009/02/01) JavaScript分離・イベントにJQuery利用 */ | |
8 | -/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
9 | -/* @og.rev 5.5.9.0 (2010/12/03) IE9対応。selectはstyleを直接変更する */ | |
10 | -/* @og.rev 5.6.4.2 (2013/05/17) エラー表示の alertメッセージ修正 */ | |
11 | -/* Revision: $Id$ */ | |
12 | -/************************************************************************************/ | |
13 | - | |
14 | -var orgFldCls = null; | |
15 | - | |
16 | -$(function(){ | |
17 | - // 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる | |
18 | -// $('textarea,select,input[type="text"]').focusin( function(){ doFocus2( this ); } ); | |
19 | -// $('textarea,select,input[type="text"]').focusout( function(){ doBlur2( this ); } ); | |
20 | - if(USE_FOCUS_HILIGHT){ //5.4.5.0 flag add | |
21 | - setEvent( "textarea,select,input[type=\"text\"]", "focusin", function(){ doFocus2( this ); } ); | |
22 | - setEvent( "textarea,select,input[type=\"text\"]", "focusout", function(){ doBlur2( this ); } ); | |
23 | - } | |
24 | -}); | |
25 | - | |
26 | -function doFocus2( obj ) { | |
27 | - // 入力中のフォームの色 | |
28 | - if( obj != null ) { | |
29 | - if( obj.className == null || obj.className.indexOf( "must" ) < 0 ) { | |
30 | - // 4.3.2.2 (2008/09/16) 入力中のフォームの色をcustom.cssに指定するように変更 | |
31 | - // 5.5.9.0 (2012/12/03) selectタグの場合は直接背景色変更 | |
32 | - if( obj.tagName == "SELECT" ){ // 5.5.9.1(2012/12/07) 小文字を大文字に | |
33 | - obj.orgBgColor = obj.style.backgroundColor; | |
34 | - obj.style.backgroundColor = '#ffcccc'; | |
35 | - } | |
36 | - else{ | |
37 | - orgFldCls = obj.className; | |
38 | - obj.className = 'focusField ' + orgFldCls; | |
39 | - } | |
40 | - } | |
41 | - } | |
42 | -} | |
43 | - | |
44 | -function doBlur2( obj ) { | |
45 | - if( obj != null ) { | |
46 | - if( obj.className == null || obj.className.indexOf( "must" ) < 0 ) { | |
47 | - // 元のフォームの色 | |
48 | - // 5.5.9.0 (2012/12/03) selectタグの場合は直接背景色変更 | |
49 | - if( obj.tagName == "SELECT" ){ | |
50 | - obj.style.backgroundColor = obj.orgBgColor; | |
51 | - } | |
52 | - else{ | |
53 | - if( orgFldCls != null ) { | |
54 | - obj.className = orgFldCls; | |
55 | - } | |
56 | - else { | |
57 | - obj.className = 'notFocusField'; | |
58 | - } | |
59 | - } | |
60 | - } | |
61 | - } | |
62 | -} | |
63 | - | |
64 | -/* 旧関数を呼び出した場合はアラートを出す(旧の*_inof.jsp対策) */ | |
65 | -oldDoFocusFlag = true; | |
66 | -function doFocus( obj ) { | |
67 | - if(oldDoFocusFlag){ | |
68 | - oldDoFocusFlag = false; | |
69 | -// setTimeout(alert("custom/query_info.jsp及びcustom/result_info.jspで次の部分を削除して下さい。\n<script>タグ(ヘッダ固定とフォーカス)、BODYのonLoadとoncontextmenu属性"),100); | |
70 | - setTimeout(alert("Old Script Error!!\ncustom/query_info.jsp,custom/result_info.jsp Please delete the following part.\n<script>Tag(Header fix and Focus) , BODY onLoad and oncontextmenu Attribute"),100); | |
71 | - } | |
72 | -} | |
73 | -/*エラー対策の空関数 */ | |
74 | -function doBlur( obj ) {} | |
75 | - | |
76 | -/************************************************************************************/ | |
77 | -/* 旧 autoConvert.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
78 | -/* */ | |
79 | -/* 入力値自動変換機能 4.3.0.0 (2008/07/25) 追加 */ | |
80 | -/* dbType XL及びXUについて、大文字・小文字の自動変換を行います */ | |
81 | -/* */ | |
82 | -/* @og.rev 4.3.5.0 (2009/02/01) JavaScript分離(inputFocusより) */ | |
83 | -/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
84 | -/* @og.rev 5.9.5.0 (2016/02/05) PN2も大文字化の対象とする */ | |
85 | -/* Revision: $Id$ */ | |
86 | -/************************************************************************************/ | |
87 | -$(function(){ | |
88 | - // 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる | |
89 | -// $('textarea,select,input[type="text"]').focusout( function(){ convert( this ); } ); | |
90 | - setEvent( "textarea,select,input[type=\"text\"]", "focusout", function(){ convert( this ); } ); | |
91 | -}); | |
92 | - | |
93 | -function convert( obj ) { | |
94 | - var val , cls ; | |
95 | - | |
96 | - val = obj.value; | |
97 | - cls = obj.className; | |
98 | - if( val != null && cls != null ) { | |
99 | - if( cls.match( /XL/ ) && !(cls.match( /XLU/ )) ) { | |
100 | - obj.value = val.toLowerCase(); | |
101 | - } | |
102 | -// else if( cls.match( /XU/ ) && !(cls.match( /XUL/ )) ) { | |
103 | - else if( (cls.match( /XU/ ) && !(cls.match( /XUL/ ))) || cls.match( /PN2/ ) ) { // 5.9.5.0 | |
104 | - obj.value = val.toUpperCase(); | |
105 | - } | |
106 | - } | |
107 | - return true; | |
108 | -} | |
109 | - | |
110 | -/************************************************************************************/ | |
111 | -/* 旧 eventColumn.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
112 | -/* */ | |
113 | -/* 動的プルダウンを実行するためのJavaScriptです。 */ | |
114 | -/* */ | |
115 | -/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
116 | -/* Revision: $Id$ */ | |
117 | -/************************************************************************************/ | |
118 | -var colMap; | |
119 | -var notFireCols; | |
120 | -var jH_evElm; | |
121 | - | |
122 | -$(function(){ | |
123 | - if( ! ( typeof( EC_NAME ) == "undefined" ) ) { | |
124 | - // 初期化処理だけは、予め要素オブジェクトを取得しておき、ここから子カラムを取得する。 | |
125 | - jH_evElm = $( ".h_evElm" ); | |
126 | - | |
127 | - makeColMapping(); | |
128 | - | |
129 | - setEvent( "textarea,select,input[type=\"text\"]", "change", function(){ makeColumn( this ); }, ".h_evCol", true, addEvColCls ); | |
130 | - setEvent( "input[type=checkbox],input[type=radio]", "click", function(){ makeColumn( this ); }, ".h_evCol", true ); | |
131 | - } | |
132 | -}); | |
133 | - | |
134 | -/** | |
135 | - * 親カラムをキーにしたイベントカラムの一覧を作成します。 | |
136 | - * | |
137 | - * 親カラムを連想配列のキーとして、子カラムの一覧を配列として保持します。 | |
138 | - * | |
139 | - * @og.rev 5.2.0.0 (2010/09/01) 新規作成 | |
140 | - * | |
141 | -**/ | |
142 | -function makeColMapping() { | |
143 | - var i , j , evCols , evc , cCols ; | |
144 | - | |
145 | - if( colMap ){ return; } | |
146 | - | |
147 | - colMap = new Object(); | |
148 | - for( i=0; i<EC_EVCOL.length; i++ ) { | |
149 | - evCols = EC_EVCOL[i].split(","); | |
150 | - for( j=0; j<evCols.length; j++ ) { | |
151 | - evc = evCols[j]; | |
152 | - if( evc.charAt(0) == "_" ) { | |
153 | - evc = evc.substring(1); | |
154 | - if( notFireCols ) { notFireCols += ","; } | |
155 | - notFireCols += evc; | |
156 | - } | |
157 | - cCols = colMap[evc]; | |
158 | - if( !cCols ) { cCols = new Array(); } | |
159 | - cCols[cCols.length] = EC_NAME[i]; | |
160 | - colMap[evc] = cCols; | |
161 | - } | |
162 | - } | |
163 | -} | |
164 | - | |
165 | -/** | |
166 | - * 親カラムに対してクラスを付加します。 | |
167 | - * | |
168 | - * @og.rev 5.2.0.0 (2010/09/01) 新規作成 | |
169 | - * | |
170 | -**/ | |
171 | -function addEvColCls() { | |
172 | - for( var evCol in colMap ) { | |
173 | - $("#"+evCol+",[id^="+evCol+"__]").addClass("h_evCol"); | |
174 | - } | |
175 | -} | |
176 | - | |
177 | -/** | |
178 | - * イベントカラムが設定されたタグ(spanタグ)を検索し、親カラムにイベントを登録します。 | |
179 | - * | |
180 | - * @og.rev 5.1.7.0 (2010/06/01) 新規作成(動的プルダウン実装見直し) | |
181 | - * | |
182 | - * @param evCol イベントが発生した親カラムのオブジェクト | |
183 | -**/ | |
184 | -function makeColumn( evCol ) { | |
185 | - var jEvCol , evColId , evColName , cColNameArr , i , suffix , cid , cname , jTag , writable ; | |
186 | - | |
187 | - if( jH_evElm && isEndInitEvent() ) { jH_evElm = null; } | |
188 | - | |
189 | - jEvCol = $( evCol ); | |
190 | - evColId = jEvCol.attr("id"); | |
191 | - evColName = evColId.split("__")[0]; | |
192 | - | |
193 | - cColNameArr = colMap[evColName]; | |
194 | - if( !cColNameArr ) { return; } | |
195 | - | |
196 | - // イベントカラムでカラム名の頭文字が'_'で始まっている場合、初回イベント発行を行わない。 | |
197 | - if( !isEndInitEvent() && notFireCols && notFireCols.indexOf( evColName ) >= 0 ) { return; } | |
198 | - | |
199 | - for( i=0; i<cColNameArr.length; i++ ) { | |
200 | - suffix = ( evColId == evColName ? "" : "__" + evColId.split("__")[1] ); | |
201 | - cid = cColNameArr[i]+suffix; | |
202 | - cname = cid.split("__")[0]; | |
203 | - jTag = isEndInitEvent() ? $( ".h_evElm[h_evCid="+cid+"]" ) : jH_evElm.filter( "[h_evCid="+cid+"]" ); | |
204 | - writable = jTag.attr("h_evWrtbl"); | |
205 | - eventColumn( jEvCol, jTag, cid, cname, suffix, writable ); | |
206 | - } | |
207 | -} | |
208 | - | |
209 | -/** | |
210 | - * Ajax動的カラム変更用の共通JavaScript | |
211 | - * | |
212 | - * カラムにeventColumnをセットした時に親側にID指定でChangeイベントとして登録されます。 | |
213 | - * ※イベント処理用のJSP用に送られるパラメーターに関しては、jsp/common/eventColumnMaker.jspの | |
214 | - * コメントを参照して下さい。 | |
215 | - * | |
216 | - * @og.rev 5.1.7.0 (2010/06/01) 動的プルダウン実装見直し | |
217 | - * @og.rev 5.5.4.0 (2012/07/02) suffixが存在すればSLABEL利用を標準にする。eventCallbackの動作追加 | |
218 | - * @og.rev 5.6.2.0 (2013/03/01) jQueryのval()がリセット後のプルダウンから取得できないのでvlaueで取る | |
219 | - * @og.rev 5.6.4.2 (2013/05/17) エラー表示の alertメッセージに、発生元が分かるように、 cname を追加します。 | |
220 | - * @og.rev 5.9.4.6 (2016/01/29) multiple対応 | |
221 | - * @og.rev 5.9.28.1 (2018/01/19) {@xxx}が存在しない場合でも処理が流れるように対応 | |
222 | - * | |
223 | - * @param jEvCol イベントが発生した親カラムのjQueryオブジェクト | |
224 | - * @param jTag 置き換え要素をラップしたspanタグのjQueryオブジェクト | |
225 | - * @param cid 変更対象の子要素(inputタグなど)のID | |
226 | - * @param cname 子のカラム名 | |
227 | - * @param suffix __ + 行番号(一覧表示の場合のみ) | |
228 | - * @param writable 書き込み可能かどうか | |
229 | -**/ | |
230 | -function eventColumn( jEvCol, jTag, cid, cname, suffix, writable ){ | |
231 | - var evVal , url , param , _pos1 , _pos2 , _repClm, _rep, _clm , noVal , columnFocus , jCol , val , renderer , editor , ATTRS , optAttrs , i , optAtt , vtype , isAdd ; | |
232 | - var callback; // 5.5.4.0 (2012/07/02) | |
233 | - | |
234 | - if( !jTag || jTag.length == 0 ) { | |
235 | -// alert( "[SYSTEM_ERROR] : イベントカラムで置き換え対象の要素が存在しません" ); | |
236 | - alert( "[SYSTEM_ERROR] : jTag is null. The element of the replacement object doesn't exist. [" + cname + "]" ); // 5.6.4.2 (2013/05/17) cname 追加 | |
237 | - return; | |
238 | - } | |
239 | - | |
240 | -// if( cid == null || cid == "" || cname == null || cname == "" ) { | |
241 | -// alert( "[SYSTEM_ERROR] : 子要素のIDまたはNAMEがセットされていません" ); | |
242 | -// return; | |
243 | -// } | |
244 | - | |
245 | - if( !isEndInitEvent() ) { | |
246 | -// evVal = jEvCol.val(); | |
247 | - evVal = jEvCol.get(0).value; //2013/03/01 | |
248 | - if( !evVal || evVal == null || evVal == "" ) { return; } | |
249 | - } | |
250 | - | |
251 | - try { | |
252 | - url = eval( "EC_" + cname + "_URL" ); | |
253 | - } | |
254 | - catch( e ) { | |
255 | -// alert( "[SYSTEM_ERROR] : イベントを処理するURLが指定されていません。(変数未定義)" ); | |
256 | - alert( "[SYSTEM_ERROR] : URL that processes the event is not specified. (variable undefinition). [" + cname + "]" ); // 5.6.4.2 (2013/05/17) cname 追加 | |
257 | - return; | |
258 | - } | |
259 | - if( !url || url == "" ) { | |
260 | -// alert( "[SYSTEM_ERROR] : イベントを処理するURLが指定されていません。" ); | |
261 | - alert( "[SYSTEM_ERROR] : URL that processes the event is not specified. [" + cname + "]" ); // 5.6.4.2 (2013/05/17) cname 追加 | |
262 | - return; | |
263 | - } | |
264 | - | |
265 | - // SQL文をパースして{@xxx}をxxxのvalue値に変更する。一覧での利用では同一行のカラムになる。 | |
266 | - //(リクエスト変数はテキストボックスやhiddenで一度受ける必要がある) | |
267 | - // 又、パースして得られたvalue値をJSPのリクエスト変数としてURLの後ろに付ける | |
268 | - // 5.9.28.1 なお、存在しない場合はnullで返すようにする。 | |
269 | - param = ""; | |
270 | - try { param = ( writable ? eval( "EC_" + cname + "_EDITPARAM" ) : eval( "EC_" + cname + "_RENDPARAM" ) ); } catch( e ) {} | |
271 | - if( param != null && param != "" ) { | |
272 | - url += "?"; | |
273 | - _pos1 = 0; | |
274 | - _pos2 = 0; | |
275 | - while( (_pos1 = param.indexOf("{@",_pos2)) != -1){ | |
276 | - _pos2 = param.indexOf("}",_pos1); | |
277 | - _clm = param.substring(_pos1+2,_pos2); | |
278 | - if( _clm.indexOf(".") < 0 ) { | |
279 | - _repClm = "{@"+_clm+"}"; | |
280 | -// _rep = suffix == "" ? $('#'+_clm).val() : $('#'+_clm+suffix).val(); | |
281 | -// _rep = suffix == "" ? $('#'+_clm).get(0).value : $('#'+_clm+suffix).get(0).value; // 2013/03/01 | |
282 | - var rtnNull = function(){ console.log("noDifined:"); console.log(arguments[0]); return null; }; | |
283 | - _rep = suffix == "" ? $('#'+_clm)[0] ? $('#'+_clm).get(0).value : rtnNull(_clm) | |
284 | - : $('#'+_clm+suffix)[0] ? $('#'+_clm+suffix).get(0).value : rtnNull(_clm+suffix); // 5.9.28.1 (2018/01/19) | |
285 | - _rep = ( _rep == null ? "" : _rep ); | |
286 | - param = param.replace(_repClm,_rep); | |
287 | - url += _clm + "=" + encodeURIComponent(_rep) +"&"; | |
288 | - } | |
289 | - _pos2 = _pos1+1; // 4.3.6.2 (2009/04/15) | |
290 | - } | |
291 | - } | |
292 | - | |
293 | - // 子がSelectタグの場合、最上部に空のoptionが存在すればEC_NOVALUEをtrueで送る | |
294 | - noVal = function(){ | |
295 | - _firstOption = jCol.children('option').get(0); | |
296 | - if( _firstOption == null || _firstOption.value != "" ){ return false; } | |
297 | - return true; | |
298 | - }; | |
299 | - | |
300 | - // 4.3.6.5 (2009/05/08) must,mustAnyを引数でJSPに送る。 | |
301 | -// var mustOrMustAny = function(){ | |
302 | -// var _haveClasses = jCol.attr("class"); | |
303 | -// if( _haveClasses && _haveClasses.indexOf("must") >= 0 ){ | |
304 | -// if( _haveClasses.indexOf("mustAny") >= 0 ) { return "mustAny"; } | |
305 | -// else { return "must"; } | |
306 | -// return ""; | |
307 | -// } | |
308 | -// } | |
309 | - | |
310 | - columnFocus = function() { | |
311 | - jCol.attr("isfocus","true"); | |
312 | - }; | |
313 | - | |
314 | -// var jCol; | |
315 | - if( cid != null && cid != "" ) { | |
316 | - jCol = jTag.find( "#"+cid ); | |
317 | - } | |
318 | - else { | |
319 | - jCol = new Array(0); | |
320 | - } | |
321 | - | |
322 | - if( jCol.length > 0 && isEndInitEvent() ) { | |
323 | - jCol.bind("focus",columnFocus); | |
324 | - } | |
325 | - | |
326 | - val = ""; | |
327 | - if( jCol.length > 0 ) { | |
328 | - if( isEndInitEvent() ) { val = ( jCol.val() == null ? "" : jCol.val() ); } | |
329 | - else { val = ( jTag.attr( "h_evVal" ) == null ? "" : jTag.attr( "h_evVal" ) ); } | |
330 | - } | |
331 | - | |
332 | - renderer = ""; | |
333 | - try { renderer = eval( "EC_" + cname + "_RENDERER" ); } catch( e ) {} | |
334 | - | |
335 | - editor = ""; | |
336 | - try { editor = eval( "EC_" + cname + "_EDITOR" ); } catch( e ) {} | |
337 | - | |
338 | - // 5.2.0.0 (2010/09/01) 属性値が正しく引き継がれないバグを修正 | |
339 | - ATTRS = [ "title", "style", "tabindex", "readonly", "disabled" | |
340 | - , "onClick", "onChange", "onBlur", "onFocus", "ondblClick", "onMouseDown", "onMouseUp" | |
341 | - , "onMouseMove", "onMouseOut", "onMouseOver", "onSelect", "onKeydown", "onKeypress", "onKeyup" | |
342 | - , "eventCallBack" // 5.5.4.0 (2012/07/02) | |
343 | - , "multiple" // 5.9.4.5 (2016/01/29) | |
344 | - ]; | |
345 | - optAttrs = ""; | |
346 | - if( jCol.length > 0 ) { | |
347 | - for( i=0; i<ATTRS.length; i++ ) { | |
348 | - optAtt = jCol.attr(ATTRS[i]); | |
349 | - if( optAtt != null ) { | |
350 | - vtype = typeof( optAtt ); | |
351 | - isAdd = false; | |
352 | - if( vtype == "function" ) { | |
353 | - optAtt = optAtt.toString(); | |
354 | - isAdd = optAtt.length > 0 ? true : false; | |
355 | - // 関数の場合は、文字列表現として"function anonymous(){...}"という関数定義が返るため、 | |
356 | - // ( FUNCTION )(); 形式で関数を実行するように変更 | |
357 | - optAtt = "(" + optAtt + ")()"; | |
358 | - } | |
359 | - else if( vtype == "boolean" ) { | |
360 | - isAdd = optAtt; | |
361 | - } | |
362 | - else { | |
363 | - isAdd = optAtt.length > 0 ? true : false; | |
364 | - } | |
365 | - | |
366 | - if( isAdd ) { | |
367 | - optAttrs += ATTRS[i] + "='" + optAtt + "' "; | |
368 | - } | |
369 | - } | |
370 | - } | |
371 | - } | |
372 | - | |
373 | - // JSPを呼び出して処理する | |
374 | - $.ajax({ | |
375 | - url: url, | |
376 | - data: { | |
377 | - "EC_CID" : ( cid == null ? "" : cid ), | |
378 | - "EC_CNAME" : ( cname == null ? "" : cname ), | |
379 | - "EC_RENDERER" :renderer, | |
380 | - "EC_EDITOR" : editor, | |
381 | - "EC_PARAM" : param, | |
382 | - "EC_SQL" : param, | |
383 | - "EC_WRITABLE" : ( writable == null ? "" : writable ), | |
384 | - "EC_CVALUE" : val, | |
385 | - "EC_NOVALUE" : ( jCol.length == 0 ? "" : noVal() ), | |
386 | -// "EC_MUST" : ( jCol.length == 0 ? "" : mustOrMustAny() ), | |
387 | - "EC_CLASS" : ( jCol.length == 0 ? "" : jCol.attr("class") ), | |
388 | - "EC_SIZE" : ( jCol.length == 0 ? "" : jCol.attr("size") ), | |
389 | - "EC_MAXLENGTH" : ( jCol.length == 0 ? "" : jCol.attr("maxlength") ), | |
390 | - "EC_OPTATTRS" : optAttrs, | |
391 | - "EC_PNAME" : jEvCol.attr("id") == null ? "" : jEvCol.attr("id").split("__")[0], | |
392 | -// "EC_PVALUE" : jEvCol.val() == null ? "" : jEvCol.val(), | |
393 | - "EC_PVALUE" : jEvCol.get(0).value == null ? "" : jEvCol.get(0).value, // 5.6.2.0 (2013/03/01) | |
394 | - "EC_USESLBL" : (suffix == null || suffix == "") ? "false" : "true" // 5.5.4.0 (2012/07/02) | |
395 | - }, | |
396 | - type: 'POST', | |
397 | - dataType: 'html', | |
398 | - async : isEndInitEvent(), | |
399 | - error: function(r,s,e){ | |
400 | - // 5.6.4.2 (2013/05/17) 紙芝居作成時は、url が存在しないエラーが発生するので、無視する。(htm呼び出し時は無視) | |
401 | - if( url.indexOf( ".htm" ) < 0 ) { | |
402 | - alert('EventColumnError:'+r+':'+s+':'+e+':'+cname); | |
403 | - } | |
404 | - }, | |
405 | - success: function(data,status){ | |
406 | - var jNewCol = $(data); | |
407 | - | |
408 | - if( jCol.length > 0 ) { | |
409 | - if( isEndInitEvent() ) { | |
410 | - jCol.unbind("focus",columnFocus); | |
411 | - } | |
412 | - bindOldEvents( jNewCol.get(0), jQuery.data( jCol.clone(true).get(0),"events" ) ); | |
413 | - } | |
414 | - | |
415 | - jTag.empty().append( jNewCol ); | |
416 | - | |
417 | - if( jCol.length > 0 ) { | |
418 | - jTag.find("input,select,textarea").attr( "name", cid ).attr( "id", cid ); | |
419 | - | |
420 | - if( isEndInitEvent() ) { | |
421 | - // 置き換え先の要素にフォーカスが当たっていた場合は、フォーカスを復活 | |
422 | - if( jCol.attr("isfocus") ) { | |
423 | -// jNewCol.focus(); | |
424 | - jNewCol.get(0).focus(); | |
425 | - // IEの場合、置き換え先の要素がテキストボックスの場合は、もう1度フォーカスする必要がある。 | |
426 | - if( $.browser.msie ) { | |
427 | - jNewCol.get(0).focus(); | |
428 | - } | |
429 | - } | |
430 | - } | |
431 | - // 初回読み込み時に置き換えられた要素はchangeイベントを発行 | |
432 | - if( !isEndInitEvent() ) { | |
433 | - jNewCol.change(); | |
434 | - } | |
435 | - // 5.5.4.0 (2012/07/02) callBack処理 | |
436 | - // 置き換え先にeventCallback属性が存在した場合にevalして関数評価した上で、子idと値を引数に渡す。 | |
437 | - if( jCol.attr("eventCallback") ){ | |
438 | - callback = function(){ eval(jCol.attr("eventCallback") + "(arguments);") }; | |
439 | -// callback(cid,jNewCol.val(),jCol.val()); | |
440 | - callback(cid,jNewCol.val(),jCol.get(0).value); // 2013/03/01 | |
441 | - } | |
442 | - } | |
443 | - | |
444 | - // ヘッダー固定再計算 | |
445 | - if( suffix != null && suffix != "" ) { | |
446 | - if( isEndInitEvent() ) { | |
447 | - $('table#viewTable').resizeView(); | |
448 | - } | |
449 | - } | |
450 | - } | |
451 | - }); | |
452 | -} | |
453 | - | |
454 | -function bindOldEvents( newCol, oldEvents ) { | |
455 | - var type , handler ; | |
456 | - for ( type in oldEvents ) { | |
457 | - for ( handler in oldEvents[type] ) { | |
458 | - jQuery.event.add( newCol, type, oldEvents[type][handler], oldEvents[type][handler].data ); | |
459 | - } | |
460 | - } | |
461 | -} | |
462 | - | |
463 | -/********************************************************************************************/ | |
464 | -/* 旧 TimeCheck.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
465 | -/* */ | |
466 | -/* 入力欄の簡易チェック(リアルタイム) */ | |
467 | -/* DBTYPE に応じた簡易チェックを行います。あくまで簡易的なチェックです。 */ | |
468 | -/* 大文字小文字などは、JavaScriptで変換できる為、チェックは行いません。 */ | |
469 | -/* */ | |
470 | -/* @og.rev 4.3.3.0 (2008/10/01) サーバーサイドのリアルタイムチェック対応 */ | |
471 | -/* @og.rev 4.3.5.0 (2009/02/01) JavaScript分離(inputFocusより) */ | |
472 | -/* @og.rev 4.3.6.6 (2009/05/15) bodyに追加し、いつも上に表示 */ | |
473 | -/* @og.rev 5.2.0.0 (2010/09/01) ヘッダー固定でスクロールした場合は、エラーメッセージを消す。*/ | |
474 | -/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
475 | -/* @og.rev 5.2.1.0 (2010/10/01) h_ で始まる内部設定フィールドはチェックしない。 */ | |
476 | -/* @og.rev 5.3.7.0 (2011/07/01) 入力項目が上方にある場合は、下にチェックチップを表示する。 */ | |
477 | -/* @og.rev 5.4.4.0 (2012/02/01) rtOption対応 */ | |
478 | -/* @og.rev 5.9.0.0 (2015/09/04) ../common/*** の相対パスを絶対パスに変更(6.3.6.1) */ | |
479 | -/* @og.rev 5.9.32.2 (2018/05/18) :not(.noRealTime) | |
480 | -/* Revision: $Id$ */ | |
481 | -/********************************************************************************************/ | |
482 | -var isShowTip = false; | |
483 | - | |
484 | -$(function(){ | |
485 | - // 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる | |
486 | -// $('textarea,select,input[type="text"]').focusout( function(){ check( this, '../common/realtimecheck.jsp' ); } ); | |
487 | - if(USE_REAL_TIME_CHECK){ //5.4.5.0 flag add | |
488 | -// setEvent( "textarea,select,input[type=\"text\"]", "focusout", function(){ check( this, '../common/realtimecheck.jsp' ); } ); | |
489 | -// setEvent( "textarea,select,input[type=\"text\"]" , "focusout" , | |
490 | - // setEvent( "textarea:not(.noRealTime),select:not(.noRealTime),input[type=\"text\"]:not(.noRealTime)" , "focusout" , | |
491 | - setEvent( "textarea:not([realTimeChk=\"false\"]),select:not([realTimeChk=\"false\"]),input[type=\"text\"]:not([realTimeChk=\"false\"])" , "focusout" , | |
492 | - // 6.3.6.1 (2015/08/28) ../common/*** の相対パスを絶対パスに変更 | |
493 | -// function(){ check( this, '../common/realtimecheck.jsp' ); } ); | |
494 | - function(){ | |
495 | - var obj=RegExp( /jsp/ ); | |
496 | - var tmp = location.pathname.match( obj ); | |
497 | - // RegExp.leftContext : 最期に一致した文字列より前の文字列を取得(/gf/) | |
498 | - check( this, RegExp.leftContext + 'jsp/common/realtimecheck.jsp' ); | |
499 | - } ); | |
500 | - | |
501 | - // 5.2.0.0 (2010/09/01) ヘッダー固定でスクロールした場合は、エラーメッセージを消す。 | |
502 | - $('table#viewTable').parent().parent().scroll( function () { | |
503 | - if( isShowTip ) { isShowTip = false; $(".tipErr").remove(); } | |
504 | - }); | |
505 | - } | |
506 | -}); | |
507 | - | |
508 | -function check( obj, sUrl ) { | |
509 | - var sFullFN , val , arrFName , bTMCheck , sParam , ajaxSettings , tipId, rtoption ; | |
510 | - | |
511 | - sFullFN = obj.name; | |
512 | -// var cls = obj.className; | |
513 | -// var msg = null; | |
514 | - | |
515 | - if (typeof jQuery != "undefined" && sFullFN.indexOf( "h_" ) != 0 ) { | |
516 | - val = obj.value; | |
517 | - if( obj.rtOption != "null" && obj.rtOption != "undefined"){ | |
518 | - //rtoption = obj.rtOption; // 5.4.4.0 | |
519 | - rtoption = obj.getAttribute("rtOption"); // 5.9.24.2 | |
520 | - } | |
521 | - arrFName = sFullFN.split('__'); | |
522 | - bTMCheck = (2 == arrFName.length); | |
523 | -// var sParam = "command=RTCHECK&checkType=" + ( bTMCheck ? "ENTRY" : "NEW" ); | |
524 | - sParam = "command=RENEW&checkType=" + ( bTMCheck ? "ENTRY" : "NEW" ) // 4.3.4.0 (2008/12/01) | |
525 | - + ( bTMCheck ? "&h_rowSel=" + arrFName[1] : "" ) | |
526 | -// + "&column=" + arrFName[0] + "&" + sFullFN + "=" + val; | |
527 | -// + "&column=" + arrFName[0] + "&" + sFullFN + "=" + encodeURI( val ); // 4.3.4.0 (2008/12/01) | |
528 | - + "&column=" + arrFName[0] + "&" + sFullFN + "=" + encodeURIComponent( val ) // 5.2.0.0 (2010/09/01) | |
529 | - + (rtoption ? "&" + rtoption : ""); // 5.4.4.0 (2012/02/01) | |
530 | - ajaxSettings = { | |
531 | - dataType : 'html', | |
532 | - type : 'POST', | |
533 | - url : sUrl, | |
534 | - data : sParam | |
535 | - }; | |
536 | - | |
537 | - ajaxSettings.error = function() {}; | |
538 | - ajaxSettings.success = function(data) { | |
539 | - //Remove old msg | |
540 | -// var sOutId = getTipId(obj); | |
541 | -// $("#" + sOutId).remove(); | |
542 | - tipId = $(obj).data( "tipId" ); | |
543 | - $("#" + tipId).remove(); | |
544 | - | |
545 | - if( $.trim(data).indexOf("row_error") >= 0 ) { | |
546 | - showCheckTip( obj, data ); | |
547 | - isShowTip = true; | |
548 | - } | |
549 | - }; | |
550 | - $.ajax(ajaxSettings); | |
551 | - } | |
552 | - | |
553 | - return true; | |
554 | -} | |
555 | - | |
556 | -/* Revised From jTip Plug-in of jQuery */ | |
557 | -function showCheckTip( oEditOut, content ) { | |
558 | -// var jEditOut , hEditOffset , sJtDiv , jJtDiv , clickElementx , clickElementy , tipId ; | |
559 | - var jEditOut , hEditOffset , iTipOffset , sArrowId , sJtDiv , jJtDiv , clickElementx , clickElementy , tipId ; | |
560 | - | |
561 | - jEditOut = $(oEditOut); | |
562 | - hEditOffset = jEditOut.offset(); | |
563 | - | |
564 | - // 5.3.7.0 (2011/07/01) 上に表示する場合 | |
565 | - if( hEditOffset.top >= 30 ) { | |
566 | - sJtDiv = "<div class='tipErr'><div id='tipArrowBottom'></div><div>" + content + "</div></div>"; | |
567 | - jJtDiv = $(sJtDiv).appendTo(document.body); | |
568 | - //set x position | |
569 | - clickElementx = hEditOffset.left; | |
570 | - //set y position | |
571 | - clickElementy = hEditOffset.top + (-11 - jJtDiv[0].offsetHeight); | |
572 | - } | |
573 | - // 5.3.7.0 (2011/07/01) 下に表示する場合 | |
574 | - else { | |
575 | - sJtDiv = "<div class='tipErr'><div id='tipArrowTop'></div><div>" + content + "</div></div>"; | |
576 | - jJtDiv = $(sJtDiv).appendTo(document.body); | |
577 | - //set x position | |
578 | - clickElementx = hEditOffset.left; | |
579 | - //set y position | |
580 | - clickElementy = hEditOffset.top + 11 + jJtDiv[0].offsetHeight; | |
581 | - } | |
582 | - | |
583 | - tipId = (new Date()).getTime(); | |
584 | - $(oEditOut).data( "tipId", tipId ); | |
585 | - | |
586 | - jJtDiv.css( { left: clickElementx+"px", top: clickElementy+"px" } ) | |
587 | - .attr( 'id', tipId ) | |
588 | - .click( function() { $(this).remove(); } ) | |
589 | - .show(); | |
590 | -} | |
591 | - | |
592 | -//function getTipId(oEdit) { | |
593 | -// return "JT" + $.data(oEdit); | |
594 | -//} | |
595 | - | |
596 | -/********************************************************************************************/ | |
597 | -/* 旧 bindEvents.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
598 | -/* */ | |
599 | -/* 各JavaScriptで登録されたイベント(主にカラムに割り当てられたイベント)を */ | |
600 | -/* 実際のイベントハンドラにバインドします。 */ | |
601 | -/* */ | |
602 | -/* @og.rev 5.2.0.0 (2010/09/01) 新規作成 */ | |
603 | -/* Revision: $Id$ */ | |
604 | -/********************************************************************************************/ | |
605 | -$(function(){ | |
606 | - bindEvents(); | |
607 | -}); | |
608 | - | |
609 | - | |
610 | -/********************************************************************************************/ | |
611 | -/* カラーピッカー 5.5.4.0 (2012/07/02) */ | |
612 | -/* */ | |
613 | -/* カラーピッカーです。 */ | |
614 | -/* input.colorPickerに対して実行させます */ | |
615 | -/* */ | |
616 | -/* @og.rev 5.5.4.0 (2012/07/02) 新規作成 */ | |
617 | -/* @og.rev 5.5.6.1 (2013/01/11) 名称変更(Og付加) */ | |
618 | -/* @og.rev 5.9.4.0 (2016/01/08) clear対応 */ | |
619 | -/* @og.rev 5.9.8.3 (2016/05/20) bulk対応 */ | |
620 | -/* Revision: $Id$ */ | |
621 | -/********************************************************************************************/ | |
622 | -$.fn.simpleColorPickerOg = function(options) { | |
623 | - var defaults = { | |
624 | - colorsPerLine: 8, | |
625 | - colors: ['#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#f3f3f3', '#ffffff' | |
626 | - , '#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#0000ff', '#9900ff', '#ff00ff' | |
627 | - , '#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d0e0e3', '#cfe2f3', '#d9d2e9', '#ead1dc' | |
628 | - , '#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#9fc5e8', '#b4a7d6', '#d5a6bd' | |
629 | - , '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6fa8dc', '#8e7cc3', '#c27ba0' | |
630 | - , '#cc0000', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3d85c6', '#674ea7', '#a64d79' | |
631 | - , '#990000', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#0b5394', '#351c75', '#741b47' | |
632 | - , '#660000', '#783f04', '#7f6000', '#274e13', '#0c343d', '#073763', '#20124d', '#4C1130'], | |
633 | - showEffect: '', | |
634 | - hideEffect: '', | |
635 | - onChangeColor: false | |
636 | - }; | |
637 | - | |
638 | - var opts = $.extend(defaults, options); | |
639 | - | |
640 | - return this.each(function() { | |
641 | - var txt = $(this); | |
642 | - | |
643 | - var colorsMarkup = ''; | |
644 | - | |
645 | - var prefix = txt.attr('id').replace(/-/g, '') + '_'; | |
646 | - | |
647 | - for(var i = 0; i < opts.colors.length; i++){ | |
648 | - var item = opts.colors[i]; | |
649 | - | |
650 | - var breakLine = ''; | |
651 | - if (i % opts.colorsPerLine == 0) | |
652 | - breakLine = 'clear: both; '; | |
653 | - | |
654 | - if (i > 0 && breakLine && $.browser && $.browser.msie && $.browser.version <= 7) { | |
655 | - breakLine = ''; | |
656 | - colorsMarkup += '<li style="float: none; clear: both; overflow: hidden; background-color: #fff; display: block; height: 1px; line-height: 1px; font-size: 1px; margin-bottom: -2px;"></li>'; | |
657 | - } | |
658 | - | |
659 | - colorsMarkup += '<li id="' + prefix + 'color-' + i + '" class="color-box" style="' + breakLine + 'background-color: ' + item + '" title="' + item + '"></li>'; | |
660 | - } | |
661 | - breakLine = 'clear: both; '; | |
662 | - // 5.9.4.0 clear | |
663 | - colorsMarkup += '<li id="' + prefix + 'color-default' + '" class="color-box" style="width:80px; text-align:center; ' + breakLine + 'background-color:white;" title="clear">clear</li>'; | |
664 | - | |
665 | - | |
666 | - var box = $('<div id="' + prefix + 'color-picker" class="color-picker" style="position: absolute; left: 0px; top: 0px;"><ul>' + colorsMarkup + '</ul><div style="clear: both;"></div></div>'); | |
667 | - | |
668 | - $('body').append(box); | |
669 | - box.hide(); | |
670 | - | |
671 | - box.find('li.color-box').click(function() { | |
672 | - var sel_val = isNaN(this.id.substr(this.id.indexOf('-') + 1)) ? "": opts.colors[this.id.substr(this.id.indexOf('-') + 1)]; // 5.9.4.0 | |
673 | - | |
674 | - if (!txt.is('input')) { | |
675 | -// txt.val(opts.colors[this.id.substr(this.id.indexOf('-') + 1)]); | |
676 | - txt.val(sel_val); | |
677 | - txt.blur(); | |
678 | - } | |
679 | - if ($.isFunction(defaults.onChangeColor)) { | |
680 | -// defaults.onChangeColor.call(txt, opts.colors[this.id.substr(this.id.indexOf('-') + 1)]); | |
681 | - defaults.onChangeColor.call(txt, sel_val); | |
682 | - } | |
683 | - hideBox(box); | |
684 | - }); | |
685 | - | |
686 | - $('body').live('click', function() { | |
687 | - hideBox(box); | |
688 | - }); | |
689 | - | |
690 | - box.click(function(event) { | |
691 | - event.stopPropagation(); | |
692 | - }); | |
693 | - | |
694 | - var positionAndShowBox = function(box) { | |
695 | - var pos = txt.offset(); | |
696 | - var left = pos.left + txt.outerWidth() - box.outerWidth(); | |
697 | - if (left < pos.left) left = pos.left; | |
698 | - box.css({ left: left, top: (pos.top + txt.outerHeight()) }); | |
699 | - showBox(box); | |
700 | - } | |
701 | - | |
702 | - txt.click(function(event) { | |
703 | - txt = $(this); // 5.9.8.3 (2016/05/20) クリックした際にthisを再セットする(Bulk対応) | |
704 | - event.stopPropagation(); | |
705 | - if (!txt.is('input')) { | |
706 | - // element is not an input so probably a link or div which requires the color box to be shown | |
707 | - positionAndShowBox(box); | |
708 | - } | |
709 | - }); | |
710 | - | |
711 | - // 5.9.8.3 (2016/05/20) 外部から変更された場合に、色を変更する。 | |
712 | - txt.change( function(event){ | |
713 | - if( txt.val() != txt.css('background-color')){ | |
714 | - txt.css('background-color', txt.val()) .css('color',txt.val()); | |
715 | - } | |
716 | - }); | |
717 | - | |
718 | - txt.focus(function() { | |
719 | - positionAndShowBox(box); | |
720 | - }); | |
721 | - | |
722 | - function hideBox(box) { | |
723 | - if (opts.hideEffect == 'fade') | |
724 | - box.fadeOut(); | |
725 | - else if (opts.hideEffect == 'slide') | |
726 | - box.slideUp(); | |
727 | - else | |
728 | - box.hide(); | |
729 | - } | |
730 | - | |
731 | - function showBox(box) { | |
732 | - if (opts.showEffect == 'fade') | |
733 | - box.fadeIn(); | |
734 | - else if (opts.showEffect == 'slide') | |
735 | - box.slideDown(); | |
736 | - else | |
737 | - box.show(); | |
738 | - } | |
739 | - }); | |
740 | -}; | |
741 | - | |
742 | -// カラーピッカーの対象はinput.colorPicker | |
743 | -$(function(){ | |
744 | - // 5.5.6.1 (2013/01/11) jQueryの上書き時エラー対策にif文挿入(上書きされると動作しない) | |
745 | - // 5.9.4.0 (2016/01/08) backgroundではなくbackground-colorにする | |
746 | - // 5.9.8.3 (2016/05/20) change追加 | |
747 | - if($.fn.simpleColorPickerOg){ | |
748 | -// $('input.colorPicker').simpleColorPickerOg({ onChangeColor: function(color) { $(this).val(color).css('background-color', color) .css('color',color); } }); | |
749 | - $('input.colorPicker').simpleColorPickerOg({ onChangeColor: function(color) { $(this).val(color).css('background-color', color) .css('color',color).change(); } }); | |
750 | - } | |
751 | -}); | |
752 | - | |
753 | -/******************************************************************************************** | |
754 | -時間ピッカー 5.6.5.2 (2013/06/21) | |
755 | -ClockPick, by Josh Nathanson | |
756 | -Version 1.2.9 and Masakazu Takahasi Modified | |
757 | -Complete documentation at http://www.jnathanson.com/index.cfm?page=jquery/clockpick/ClockPick | |
758 | - | |
759 | -以下を、対象タグの属性値から取得可能なように改造 | |
760 | -param options[starthour] int starting hour (use military int) | |
761 | -param options[endhour] int ending hour (use military int) | |
762 | -param options[minutedivisions] int number of divisions, i.e. 4 = :00, :15, :30, :45 | |
763 | -param options[military] string use 24hr time if true(true/false) | |
764 | -param options[valuefield] string field to insert time value, if not same as click field(name of input field) | |
765 | -param options[showminutes] bool show minutes | |
766 | -param options[second] bool add second(00) //5.9.12.3 | |
767 | -param options[layout] string vertical or horizon //5.9.17.2 | |
768 | - | |
769 | -又、対象単位に設定値を持てるように対応。 | |
770 | -@og.rev 5.9.8.3 (2016/05/20) 標準をAMPMではなく24時間表記に変更、ピッカー選択時にchangeイベント発生させる | |
771 | -@og.rev 5.9.12.3 (2015/09/23) 返す値に秒(00固定)を追加出来るようにする(useSecond) | |
772 | -@og.rev 5.9.15.1 (2016/12/09) 数値変換不具合対応 | |
773 | -@og.rev 5.9.17.2 (2017/02/15) layout指定追加 | |
774 | -@og.rev 5.9.**.* (2017/12/19) 選択時間を幅広く取れるように変更、及び方向キー対応 | |
775 | -********************************************************************************************/ | |
776 | - | |
777 | -jQuery.fn.ogClockpicker = function(options, callback) { | |
778 | - // 5.9.12.3 (2016/09/23) | |
779 | - var org_settings = { | |
780 | - starthour : 6, | |
781 | - endhour : 20, | |
782 | - showminutes : "true", | |
783 | - minutedivisions : 4, | |
784 | - military : true, | |
785 | - event : 'click', | |
786 | - layout : 'vertical', | |
787 | - valuefield : null, | |
788 | - useBgiframe : false, | |
789 | - hoursopacity : 1, | |
790 | - minutesopacity : 1, | |
791 | - second : "" | |
792 | - }; | |
793 | - | |
794 | - if(options) { | |
795 | - jQuery.extend(org_settings, options); | |
796 | - }; | |
797 | - | |
798 | - var callback = callback || function() { }, | |
799 | - v = (org_settings.layout == 'vertical'); // boolean for vertical, shorten footprint | |
800 | - errorcheck(org_settings); | |
801 | - | |
802 | - | |
803 | - jQuery(this)[org_settings.event](function(e) { | |
804 | - var self = this, | |
805 | - $self = jQuery( this ), | |
806 | - $body = jQuery( "body" ); | |
807 | - var settings = jQuery.extend(true,{},org_settings); // OpenGion deep copy | |
808 | - | |
809 | - // OpenGion 属性対応 | |
810 | - if( $self.attr('valuefield') ){ | |
811 | - settings.valuefield = $self.attr('valuefield'); | |
812 | - } | |
813 | - if( $self.attr('starthour') ){ | |
814 | - //settings.starthour = $self.attr('starthour'); | |
815 | - settings.starthour = parseInt($self.attr('starthour')); // 5.9.15.1 (2016/12/09) | |
816 | - } | |
817 | - if( $self.attr('endhour') ){ | |
818 | - //settings.endhour = $self.attr('endhour'); | |
819 | - settings.endhour = parseInt($self.attr('endhour')); // 5.9.15.1 (2016/12/09) | |
820 | - } | |
821 | - if( $self.attr('minutedivisions') ){ | |
822 | - // settings.minutedivisions = $self.attr('minutedivisions'); | |
823 | - settings.minutedivisions = parseInt($self.attr('minutedivisions')); | |
824 | - } | |
825 | - if( $self.attr('military') ){ | |
826 | - settings.military = $self.attr('military'); | |
827 | - } | |
828 | - if( $self.attr('showminutes') ){ | |
829 | - settings.showminutes = $self.attr('showminutes'); | |
830 | - } | |
831 | - if( $self.attr('usesecond') == "true" ){ // 5.9.12.3 (2016/09/23) | |
832 | - settings.second = "00"; | |
833 | - } | |
834 | - if( $self.attr('layout') ){ // 5.9.17.2 (2017/02/17) | |
835 | - settings.layout = $self.attr('layout'); | |
836 | - org_settings.layout = settings.layout; // overwrite | |
837 | - v = (settings.layout == 'vertical'); | |
838 | - } | |
839 | - | |
840 | - errorcheck(settings); | |
841 | - | |
842 | - | |
843 | - | |
844 | - if ( !settings.valuefield ) { | |
845 | - $self.unbind( "keydown" ).bind( "keydown", keyhandler ); | |
846 | - | |
847 | - } | |
848 | - else { | |
849 | - var inputfield = jQuery("[name=" + settings.valuefield + "]"); | |
850 | - inputfield | |
851 | - .unbind( "keydown" ) | |
852 | - .bind( "keydown", keyhandler)[0] | |
853 | - .focus(); | |
854 | - inputfield | |
855 | - .bind("click", function() { inputfield.unbind("keydown"); } ); | |
856 | - } | |
857 | - // clear any malingerers | |
858 | - jQuery("#CP_hourcont,#CP_minutecont").remove(); | |
859 | - | |
860 | - // append hourcont to body | |
861 | - // add class "CP" for mouseout recognition, although there is only | |
862 | - // one hourcont on the screen at a time | |
863 | - var $hourcont = jQuery("<div id='CP_hourcont' class='CP' />").appendTo( $body ); | |
864 | - !settings.useBgiframe ? $hourcont.css("opacity",settings.hoursopacity) : null; | |
865 | - binder( $hourcont ); | |
866 | - | |
867 | - //多数に対応させるため配列に代入 5.9.27.3 (2017/12/22) | |
868 | - var $hourcol = []; | |
869 | - for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){ | |
870 | - $hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo( $body )); | |
871 | - } | |
872 | - | |
873 | - // if showminutes, append minutes cont to body | |
874 | - | |
875 | - if (settings.showminutes == "true") { | |
876 | - var $mc = jQuery("<div id='CP_minutecont' class='CP' />").appendTo( $body ); | |
877 | - !settings.useBgiframe ? $mc.css("opacity",settings.minutesopacity) : null; | |
878 | - binder($mc); | |
879 | - } | |
880 | - if ( !v ) { | |
881 | - $hourcont.css("width","auto"); | |
882 | - if (settings.showminutes == "true") { | |
883 | - $mc.css("width","auto"); | |
884 | - } | |
885 | - } | |
886 | - else { | |
887 | - for (i=0;i<$hourcol.length;i++){ | |
888 | - $hourcol[i].addClass('floatleft'); | |
889 | - } | |
890 | - } | |
891 | - | |
892 | - // all the action right here | |
893 | - // fill in the hours container (minutes rendered in hour mouseover) | |
894 | - // then make hour container visible | |
895 | - renderhours(); | |
896 | - putcontainer(); | |
897 | - | |
898 | - /*----------------------helper functions below-------------------------*/ | |
899 | - | |
900 | - function renderhours() { | |
901 | - // fill in the $hourcont div | |
902 | - var c = 1; | |
903 | - var numberC = 0; | |
904 | - // counter as index 2 of hr id, gives us index | |
905 | - // in group of hourdivs for calculating where to put minutecont on keydown | |
906 | - for (var h=settings.starthour; h<=settings.endhour; h++) { | |
907 | - | |
908 | - if(h%12==0) { c = 1; } // reset counter for col 2 | |
909 | - | |
910 | - var displayhours = ((!settings.military && h > 12) ? h - 12 : h); | |
911 | - var valuehouers = h; // opengion | |
912 | - // rectify zero hour | |
913 | - if (!settings.military && h == 0) { | |
914 | - //displayhours = '12'; // 日本向けに0時で表示 | |
915 | - } | |
916 | - else if (!settings.military && h == 12) { | |
917 | - displayhours = '0'; // 日本向けに0時で表示 | |
918 | - } | |
919 | - if ( settings.military && h < 10 ) { | |
920 | - displayhours = '0' + displayhours; | |
921 | - } | |
922 | - if ( h < 10 ){ | |
923 | - valuehouers = '0'+valuehouers; | |
924 | - } | |
925 | - | |
926 | - var $hd = jQuery("<div class='CP_hour' id='hr_" + h + "_" + c + "' " + "value='" +valuehouers+ "' >" + displayhours + set_tt(h) + "</div>"); | |
927 | - // shrink width a bit if military | |
928 | - if (settings.military) { $hd.width(20); } | |
929 | - binder($hd); | |
930 | - if (!v) { | |
931 | - $hd.css("float","left"); | |
932 | - } | |
933 | - $hourcol[numberC].append($hd); | |
934 | - if((h+1)%12==0){ | |
935 | - numberC++; | |
936 | - } | |
937 | - c++; | |
938 | - } | |
939 | - | |
940 | - // 5.9.27.3 (2017/12/22) | |
941 | - for(var j=0; j<$hourcol.length;j++){ | |
942 | - if(v){ | |
943 | - if(j!=0&&j%2==0){ | |
944 | - $hourcol[j].css("margin-left",$mc.width()+4 + 'px'); | |
945 | - } | |
946 | - }else{ | |
947 | - $hourcont.append("<div style='clear:left' />"); | |
948 | - if(j!=0&&j%2==0){ | |
949 | - //$mc.height()が0になってまう?? | |
950 | - $hourcol[j].css("margin-top","19px"); | |
951 | - } | |
952 | - } | |
953 | - $hourcont.append($hourcol[j]); | |
954 | - } | |
955 | - | |
956 | - } | |
957 | - | |
958 | - function renderminutes( h ) { | |
959 | - var realhours = h; | |
960 | - var displayhours = (!settings.military && h > 12) ? h - 12 : h; | |
961 | - var valuehouers = h; // opengion | |
962 | - if (!settings.military && h == 0) { | |
963 | - //displayhours = '12'; // 日本向けに0時で表示 | |
964 | - } | |
965 | - else if (!settings.military && h == 12) { | |
966 | - displayhours = '0'; // 日本向けに0時で表示 | |
967 | - } | |
968 | - if ( settings.military && h < 10 ) { | |
969 | - displayhours = '0' + displayhours; | |
970 | - } | |
971 | - if ( h < 10 ){ | |
972 | - valuehouers = '0'+valuehouers; | |
973 | - } | |
974 | - | |
975 | - $mc.empty(); | |
976 | - var n = 60 / settings.minutedivisions, | |
977 | - tt = set_tt(realhours), | |
978 | - counter = 1; | |
979 | - | |
980 | - for(var m=0;m<60;m=m+n) { | |
981 | - $md = jQuery("<div class='CP_minute' id='" + realhours + "_" + m + "' value='" + valuehouers + ((m<10) ? "0" : "") + m +"'>" | |
982 | - + displayhours + ":" + ((m<10) ? "0" : "") + m + tt | |
983 | - + "</div>"); | |
984 | - if ( !v ) { | |
985 | - $md.css("float","left"); | |
986 | - if (settings.minutedivisions > 6 | |
987 | - && counter == settings.minutedivisions / 2 + 1) { | |
988 | - // long horizontal, kick in extra row after half | |
989 | - $mc.append("<div style='clear:left' />"); | |
990 | - } | |
991 | - } | |
992 | - $mc.append($md); | |
993 | - binder($md); | |
994 | - counter++; | |
995 | - } | |
996 | - } | |
997 | - | |
998 | - function set_tt(realhours) { | |
999 | - if (!settings.military) { | |
1000 | - return (realhours >= 12) ? ' PM' : ' AM'; | |
1001 | - } | |
1002 | - else { | |
1003 | - return ''; | |
1004 | - } | |
1005 | - } | |
1006 | - | |
1007 | - function putcontainer() { | |
1008 | - if ( e.type != 'focus') { | |
1009 | - $hourcont[0].style.left = e.pageX - 5 + 'px'; | |
1010 | - $hourcont[0].style.top = e.pageY - (Math.floor($hourcont.height() / 2)) + 'px'; | |
1011 | - rectify($hourcont); | |
1012 | - } | |
1013 | - else { | |
1014 | - $self.after($hourcont); | |
1015 | - } | |
1016 | - $hourcont.slideDown('fast'); | |
1017 | - | |
1018 | - if ( settings.useBgiframe ) | |
1019 | - bgi( $hourcont ); | |
1020 | - } | |
1021 | - | |
1022 | - function rectify($obj) { | |
1023 | - // if a div is off the screen, move it accordingly | |
1024 | - var ph = document.documentElement.clientHeight | |
1025 | - ? document.documentElement.clientHeight | |
1026 | - : document.body.clientHeight; | |
1027 | - var pw = document.documentElement.clientWidth | |
1028 | - ? document.documentElement.clientWidth | |
1029 | - : document.body.clientWidth; | |
1030 | - var t = parseInt( $obj[0].style.top ); | |
1031 | - var l = parseInt( $obj[0].style.left ); | |
1032 | - var st = document.documentElement.scrollTop | |
1033 | - ? document.documentElement.scrollTop | |
1034 | - : document.body.scrollTop; | |
1035 | - // run off top | |
1036 | - if ( t <= st && !$obj.is("#CP_minutecont") ) { | |
1037 | - $obj.css("top",st+10+'px'); | |
1038 | - } | |
1039 | - else if (t + $obj.height() - st > ph) { | |
1040 | - $obj.css("top",st + ph - $obj.height() - 10 + 'px'); | |
1041 | - } | |
1042 | - if ( l <= 0 ) { | |
1043 | - $obj.css("left", '10px'); | |
1044 | - } | |
1045 | - } | |
1046 | - | |
1047 | - function bgi( ob ) { | |
1048 | - if ( typeof jQuery.fn.bgIframe == 'function' ) | |
1049 | - ob.bgIframe(); | |
1050 | - else | |
1051 | - alert('bgIframe plugin not loaded.'); | |
1052 | - } | |
1053 | - | |
1054 | - function binder($obj) { | |
1055 | - // all the binding is done here | |
1056 | - // event handlers have been abstracted out, | |
1057 | - // so they can handle mouse or key events | |
1058 | - | |
1059 | - // bindings for hc (hours container) | |
1060 | - if($obj.attr("id") == 'CP_hourcont') { | |
1061 | - $obj.mouseout(function(e) { hourcont_out(e) }); | |
1062 | - } | |
1063 | - | |
1064 | - // bindings for mc (minute container) | |
1065 | - else if ($obj.attr("id") == 'CP_minutecont') { | |
1066 | - $obj.mouseout(function(e) { minutecont_out(e) }); | |
1067 | - } | |
1068 | - | |
1069 | - // bindings for $hd (hour divs) | |
1070 | - else if ($obj.attr("class") == 'CP_hour') { | |
1071 | - $obj.mouseover(function(e) { hourdiv_over($obj, e) }); | |
1072 | - $obj.mouseout(function() { hourdiv_out($obj) }); | |
1073 | - $obj.click(function() { hourdiv_click($obj) }); | |
1074 | - } | |
1075 | - | |
1076 | - // bindings for $md (minute divs) | |
1077 | - else if ($obj.attr("class") == 'CP_minute') { | |
1078 | - $obj.mouseover(function() { minutediv_over($obj) }); | |
1079 | - $obj.mouseout(function() { minutediv_out($obj) }); | |
1080 | - $obj.click(function() { minutediv_click($obj) }); | |
1081 | - } | |
1082 | - }; | |
1083 | - | |
1084 | - function hourcont_out(e) { | |
1085 | - /* | |
1086 | - this tells divs to clear only if rolling all the way | |
1087 | - out of hourcont. | |
1088 | - relatedTarget "looks ahead" to see where the mouse | |
1089 | - has moved to on mouseOut. | |
1090 | - IE uses the more sensible "toElement". | |
1091 | - try/catch for Mozilla bug on relatedTarget-input field. | |
1092 | - */ | |
1093 | - try { | |
1094 | - var t = (e.toElement) ? e.toElement : e.relatedTarget; | |
1095 | - if (!(jQuery(t).is("div[class^=CP], iframe"))) { | |
1096 | - // Safari incorrect mouseover/mouseout | |
1097 | - //if (!jQuery.browser.safari) { | |
1098 | - cleardivs(); | |
1099 | - //} | |
1100 | - } | |
1101 | - } | |
1102 | - catch(e) { | |
1103 | - cleardivs(); | |
1104 | - } | |
1105 | - } | |
1106 | - | |
1107 | - function minutecont_out(e) { | |
1108 | - try { | |
1109 | - var t = (e.toElement) ? e.toElement : e.relatedTarget; | |
1110 | - if (!(jQuery(t).is("div[class^=CP], iframe"))) { | |
1111 | - cleardivs(); | |
1112 | - } | |
1113 | - } | |
1114 | - catch(e) { | |
1115 | - cleardivs(); | |
1116 | - } | |
1117 | - } | |
1118 | - | |
1119 | - function hourdiv_over($obj, e) { | |
1120 | - var h = $obj.attr("id").split('_')[1], | |
1121 | - i = $obj.attr("id").split('_')[2], | |
1122 | - l, | |
1123 | - t, | |
1124 | - nn; | |
1125 | - $obj.addClass("CP_over"); | |
1126 | - | |
1127 | - //何個目の要素を見ているか計算して、分表示を配置するための独立変数nnを算出 5.9.27.3 (2017/12/22) | |
1128 | - nn = Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2); | |
1129 | - | |
1130 | - if ( settings.showminutes == "true") { | |
1131 | - $mc.hide(); | |
1132 | - renderminutes(h); | |
1133 | - // set position & show minutes container | |
1134 | - if (v) { | |
1135 | - t = e.type == 'mouseover' | |
1136 | - ? e.pageY - 15 | |
1137 | - : $hourcont.offset().top + 2 + ($obj.height() * i); | |
1138 | - l = $hourcont.offset().left + $hourcol[0].width()*2*nn + $mc.width()*(nn-1) + 4*nn-2; // 5.9.27.3 (2017/12/22) | |
1139 | - } | |
1140 | - else { | |
1141 | - l = (e.type == 'mouseover') | |
1142 | - ? e.pageX - 10 | |
1143 | - : $hourcont.offset().left + ($obj.width()-5) * i; | |
1144 | - //$hourcol[0].height()は出ないため全体から各要素を引いて導出 | |
1145 | - t = $hourcont.offset().top + ($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn + $mc.height()*(nn-1) + 2*nn-1; // (2017/12/19) | |
1146 | - } | |
1147 | - $mc.css("left",l+'px').css("top",t+'px'); | |
1148 | - rectify( $mc ); | |
1149 | - $mc.show(); | |
1150 | - | |
1151 | - if ( settings.useBgiframe ) | |
1152 | - bgi( $mc ); | |
1153 | - } | |
1154 | - return false; | |
1155 | - } | |
1156 | - | |
1157 | - | |
1158 | - | |
1159 | - function hourdiv_out($obj) { | |
1160 | - $obj.removeClass("CP_over"); | |
1161 | - return false; | |
1162 | - } | |
1163 | - | |
1164 | - function hourdiv_click($obj) { | |
1165 | - var h = $obj.attr("id").split('_')[1], | |
1166 | - tt = set_tt(h), | |
1167 | - str = $obj.attr('value'); | |
1168 | - if(str.indexOf(' ') != -1) { | |
1169 | - var cleanstr = str.substring(0,str.indexOf(' ')); | |
1170 | - } | |
1171 | - else { | |
1172 | - var cleanstr = str; | |
1173 | - } | |
1174 | - | |
1175 | - | |
1176 | - //$obj.text(cleanstr + ':00' + tt); | |
1177 | - //$obj.text(cleanstr + '00'); | |
1178 | - $obj.text(cleanstr + '00' + settings.second ); // 5.9.12.3 (2016/09/23) | |
1179 | - setval($obj); | |
1180 | - cleardivs(); | |
1181 | - } | |
1182 | - | |
1183 | - function minutediv_over($obj) { | |
1184 | - $obj.addClass("CP_over"); | |
1185 | - return false; | |
1186 | - } | |
1187 | - | |
1188 | - function minutediv_out($obj) { | |
1189 | - $obj.removeClass("CP_over"); | |
1190 | - return false; | |
1191 | - } | |
1192 | - | |
1193 | - function minutediv_click($obj) { | |
1194 | - //$obj.text( $obj.attr('value')); | |
1195 | - $obj.text( $obj.attr('value') + settings.second); // 5.9.12.3 (2016/09/23) | |
1196 | - setval($obj); | |
1197 | - cleardivs(); | |
1198 | - } | |
1199 | - | |
1200 | - function setval($obj) { // takes either hour or minute obj | |
1201 | - if(!settings.valuefield) { | |
1202 | - self.value = $obj.text(); | |
1203 | - } | |
1204 | - else { | |
1205 | - //jQuery("input[name=" + settings.valuefield + "]").val($obj.text()); | |
1206 | - jQuery("input[name=" + settings.valuefield + "]").val($obj.text()).change(); // 5.9.8.3 (2016/05/17) | |
1207 | - } | |
1208 | - callback.apply( $self, [ $obj.text() ]); | |
1209 | - // unbind keydown handler, otherwise it will double-bind if | |
1210 | - // field is activated more than once | |
1211 | - $self.unbind( "keydown", keyhandler ); | |
1212 | - } | |
1213 | - | |
1214 | - function cleardivs() { | |
1215 | - if ( settings.showminutes == "true") { | |
1216 | - $mc.hide(); | |
1217 | - } | |
1218 | - $hourcont.slideUp('fast'); | |
1219 | - $self.unbind( "keydown", keyhandler ); | |
1220 | - } | |
1221 | - | |
1222 | - // keyboard handling | |
1223 | - | |
1224 | - function keyhandler( e ) { | |
1225 | - | |
1226 | - // $obj is current active div | |
1227 | - var $obj = $("div.CP_over").size() ? $("div.CP_over") : $("div.CP_hour:first"), | |
1228 | - divtype = $obj.is(".CP_hour") ? 'hour' : 'minute', | |
1229 | - hi = (divtype == 'hour') ? $obj[0].id.split('_')[2] : 0, // hour index | |
1230 | - h = (divtype == 'minute') ? $obj[0].id.split('_')[0] : $obj[0].id.split('_')[1]; // real hour | |
1231 | - // 5.9.27.3 (2017/12/22) | |
1232 | - if (divtype == 'minute') { | |
1233 | - if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){ | |
1234 | - var curloc = 'm1'; | |
1235 | - }else if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){ | |
1236 | - var curloc = 'm2'; | |
1237 | - }else{ | |
1238 | - var curloc = 'm3'; | |
1239 | - } | |
1240 | - }else{ | |
1241 | - if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1242 | - var curloc = 'h1'; | |
1243 | - }else{ | |
1244 | - var curloc = 'h2'; | |
1245 | - } | |
1246 | - } | |
1247 | - function divprev($obj) { | |
1248 | - if ($obj.prev().size()) { | |
1249 | - eval(divtype + 'div_out($obj)'); | |
1250 | - eval(divtype + 'div_over($obj.prev(), e)'); | |
1251 | - } | |
1252 | - else { return false; } | |
1253 | - } | |
1254 | - | |
1255 | - function divnext($obj) { | |
1256 | - if ($obj.next().size()) { | |
1257 | - eval(divtype + 'div_out($obj)'); | |
1258 | - eval(divtype + 'div_over($obj.next(), e)'); | |
1259 | - } | |
1260 | - else { return false; } | |
1261 | - } | |
1262 | - | |
1263 | - function hourtohour($obj) { | |
1264 | - // 5.9.27.3 (2017/12/22) | |
1265 | - if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1266 | - var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1); | |
1267 | - }else{ | |
1268 | - var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1); | |
1269 | - } | |
1270 | - var ctx = '#hourcol'+next; | |
1271 | - $newobj = jQuery(".CP_hour[id$=_" + hi + "]", ctx ); | |
1272 | - if ($newobj.size()) { | |
1273 | - hourdiv_out($obj); | |
1274 | - hourdiv_over($newobj, e); | |
1275 | - } | |
1276 | - else { return false; } | |
1277 | - } | |
1278 | - | |
1279 | - function hourtominute($obj) { | |
1280 | - hourdiv_out($obj); | |
1281 | - minutediv_over($(".CP_minute:first")); | |
1282 | - } | |
1283 | - | |
1284 | - function minutetohour($obj,where) { | |
1285 | - minutediv_out($obj); | |
1286 | - // 5.9.27.3 (2017/12/22) | |
1287 | - if(where<0){ | |
1288 | - if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1289 | - var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where); | |
1290 | - h = String(Number(h)-12); | |
1291 | - }else{ | |
1292 | - var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))); | |
1293 | - } | |
1294 | - }else{ | |
1295 | - if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1296 | - var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))); | |
1297 | - }else{ | |
1298 | - var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where); | |
1299 | - h = String(Number(h)+12); | |
1300 | - } | |
1301 | - } | |
1302 | - var ctx = '#hourcol'+next; | |
1303 | - var $newobj = jQuery(".CP_hour[id^=hr_" + h + "]", ctx); | |
1304 | - // extract hour from minutediv, then find hourdiv with that hour | |
1305 | - hourdiv_over($newobj, e); | |
1306 | - } | |
1307 | - | |
1308 | - switch (e.keyCode) { | |
1309 | - case 37: // left arrow | |
1310 | - if (v) { | |
1311 | - switch (curloc) { | |
1312 | - case 'm1': | |
1313 | - return false; | |
1314 | - break; | |
1315 | - case 'm2': | |
1316 | - minutetohour($obj,-1); | |
1317 | - break; | |
1318 | - case 'm3': | |
1319 | - minutetohour($obj,-1); // 5.9.27.3 (2017/12/22) | |
1320 | - break; | |
1321 | - case 'h1': | |
1322 | - hourtominute($obj); | |
1323 | - break; | |
1324 | - case 'h2': | |
1325 | - hourtohour($obj); | |
1326 | - break; | |
1327 | - } | |
1328 | - } | |
1329 | - else { | |
1330 | - divprev($obj); | |
1331 | - } | |
1332 | - break; | |
1333 | - | |
1334 | - case 38: // up arrow | |
1335 | - if(v) { | |
1336 | - divprev($obj); | |
1337 | - } | |
1338 | - else { | |
1339 | - switch (curloc) { | |
1340 | - case 'm1': | |
1341 | - return false; | |
1342 | - break; | |
1343 | - case 'm2': | |
1344 | - minutetohour($obj,-1); | |
1345 | - break; | |
1346 | - case 'm3': | |
1347 | - minutetohour($obj,-1); // 5.9.27.3 (2017/12/22) | |
1348 | - break; | |
1349 | - case 'h1': | |
1350 | - hourtominute($obj); | |
1351 | - break; | |
1352 | - case 'h2': | |
1353 | - hourtohour($obj); | |
1354 | - break; | |
1355 | - } | |
1356 | - } | |
1357 | - break; | |
1358 | - case 39: // right arrow | |
1359 | - if (v) { | |
1360 | - switch (curloc) { | |
1361 | - case 'm1': | |
1362 | - minutetohour($obj,1); | |
1363 | - break; | |
1364 | - case 'm2': | |
1365 | - return false; | |
1366 | - break; | |
1367 | - case 'm3': | |
1368 | - minutetohour($obj,1); // 5.9.27.3 (2017/12/22) | |
1369 | - break; | |
1370 | - case 'h1': | |
1371 | - hourtohour($obj); | |
1372 | - break; | |
1373 | - case 'h2': | |
1374 | - hourtominute($obj); | |
1375 | - break; | |
1376 | - } | |
1377 | - } | |
1378 | - else { | |
1379 | - divnext($obj); | |
1380 | - } | |
1381 | - break; | |
1382 | - | |
1383 | - case 40: // down arrow | |
1384 | - if(v) { | |
1385 | - divnext($obj); | |
1386 | - } | |
1387 | - else { | |
1388 | - switch (curloc) { | |
1389 | - case 'm1': | |
1390 | - minutetohour($obj,1); | |
1391 | - break; | |
1392 | - case 'm2': | |
1393 | - return false; | |
1394 | - break; | |
1395 | - case 'm3': | |
1396 | - minutetohour($obj,1); // 5.9.27.3 (2017/12/22) | |
1397 | - break; | |
1398 | - case 'h1': | |
1399 | - hourtohour($obj); | |
1400 | - break; | |
1401 | - case 'h2': | |
1402 | - hourtominute($obj); | |
1403 | - break; | |
1404 | - } | |
1405 | - } | |
1406 | - break; | |
1407 | - | |
1408 | - case 13: // return | |
1409 | - eval(divtype + 'div_click($obj)'); | |
1410 | - break; | |
1411 | - | |
1412 | - default: | |
1413 | - return true; | |
1414 | - } | |
1415 | - | |
1416 | - return false; | |
1417 | - | |
1418 | - } | |
1419 | - | |
1420 | - return false; | |
1421 | - }); | |
1422 | - | |
1423 | - function errorcheck(settings) { | |
1424 | - if (settings.starthour >= settings.endhour) { | |
1425 | - alert('Error - start hour must be less than end hour.'); | |
1426 | - return false; | |
1427 | - } | |
1428 | - else if (60 % settings.minutedivisions != 0) { | |
1429 | - alert('Error - param minutedivisions must divide evenly into 60.'); | |
1430 | - return false; | |
1431 | - } | |
1432 | - } | |
1433 | - | |
1434 | - return this; | |
1435 | - | |
1436 | -} | |
1437 | - | |
1438 | -$(function(){ | |
1439 | - if($.fn.ogClockpicker){ | |
1440 | - $(document).ready(function(){ $(".clockpick").ogClockpicker(); }); | |
1441 | - } | |
1442 | -}); | |
1443 | - | |
1444 | - | |
1445 | - | |
1446 | -/********************************************************************************************/ | |
1447 | -/* 曖昧ピッカー */ | |
1448 | -/* */ | |
1449 | -/* AIMAI_xxxのid属性を持つタグを見つけて、xxxのvalue値の%付加を行います。 */ | |
1450 | -/* openGion的には、カラムタグに、aimai属性を設定することで、関連するタグを出力します。 */ | |
1451 | -/* 0/null : 何もなし(処理的には1,2,3以外とする) */ | |
1452 | -/* 1 : 前方一致% */ | |
1453 | -/* 2 : %後方一致 */ | |
1454 | -/* 3 : %前後曖昧% */ | |
1455 | -/* */ | |
1456 | -/* @og.rev 5.8.4.1 (2015/02/21) 新規作成(6.2.0.0) */ | |
1457 | -/********************************************************************************************/ | |
1458 | -function likeComp( _tgtName ){ | |
1459 | - var _orgTagName = _tgtName.substring(6); // 'AIMAI_' の文字数 | |
1460 | - var _likePtn = $("#" + _tgtName ).attr('aimaiType'); | |
1461 | - var _orgTagValue = $("#" + _orgTagName ).val(); | |
1462 | - _orgTagValue = _orgTagValue.replace(/^%+|%+$/g, ""); | |
1463 | - | |
1464 | - if( _orgTagValue != "" ){ | |
1465 | - switch( _likePtn ){ | |
1466 | - case "1": _orgTagValue = _orgTagValue + "%"; break; | |
1467 | - case "2": _orgTagValue = "%" + _orgTagValue; break; | |
1468 | - case "3": _orgTagValue = "%" + _orgTagValue + "%"; break; | |
1469 | - } | |
1470 | - } | |
1471 | - | |
1472 | - $("#" + _orgTagName ).val( _orgTagValue ); | |
1473 | -} | |
1474 | - | |
1475 | -/* onSubmit時に自動実行 */ | |
1476 | -$(function(){ | |
1477 | - $("form").submit(function() { | |
1478 | - $("[id^='AIMAI_']").each( function(){likeComp(this.id);} ); | |
1479 | - }); | |
1480 | -}); | |
1481 | - | |
1482 | -/********************************************************************************************/ | |
1483 | -/* 曖昧ピッカー */ | |
1484 | -/* jQueryのプラグイン */ | |
1485 | -/* */ | |
1486 | -/* @og.rev 5.8.4.1 (2015/02/21) 新規作成(6.2.0.0) */ | |
1487 | -/********************************************************************************************/ | |
1488 | -$.fn.aimaiPickerOg = function(options) { | |
1489 | - // この文字列が順に0,1,2,3という扱いにいなる。 | |
1490 | - var defaults = { | |
1491 | - texts: [' V ' , ' V*' , '*V ' , '*V*'], // 桁数を合わせる。 | |
1492 | - titls: ['完全一致', '前方一致', '後方一致', '前後曖昧'] // 日本語はリソース化しなければ… | |
1493 | - }; | |
1494 | - | |
1495 | - var opts = $.extend(defaults, options); | |
1496 | - | |
1497 | - return this.each(function() { | |
1498 | - var txt = $(this); | |
1499 | - var prefix = 'PIC_' + txt.attr('id').replace(/-/g, '') + '_'; | |
1500 | - | |
1501 | - var textsMarkUp = ''; | |
1502 | - // ここでピッカーの中身のタグを作成 | |
1503 | - for(var i = 0; i < opts.texts.length; i++){ | |
1504 | - var item = opts.texts[i]; | |
1505 | - var titl = opts.titls[i]; | |
1506 | - textsMarkUp += '<span id="' | |
1507 | - + prefix + 'text-' + i | |
1508 | - + '" class="text-box"' | |
1509 | - + '" title="' + titl + '">' | |
1510 | - + '(' + item + ') </span>'; | |
1511 | - } | |
1512 | - | |
1513 | - // ピッカーそのものを作成 | |
1514 | - var box = $('<div id="' | |
1515 | - + prefix | |
1516 | - + 'aimai-picker" class="aimai-picker" style="position: absolute; left: 0px; top: 0px;">' | |
1517 | - + textsMarkUp | |
1518 | - + '<div style="clear: both;"></div></div>'); | |
1519 | - | |
1520 | - $('body').append(box); | |
1521 | - box.hide(); | |
1522 | - | |
1523 | - // ピッカークリック時の挙動 | |
1524 | - box.find('span.text-box').click(function() { | |
1525 | - var indx = this.id.substr(this.id.indexOf('-') + 1); | |
1526 | - txt.attr( 'aimaiType',indx ); | |
1527 | - txt.attr( 'title',opts.titls[indx] ); | |
1528 | - txt.text( opts.texts[indx] ); | |
1529 | - txt.blur(); | |
1530 | - hideBox(box); | |
1531 | - }); | |
1532 | - | |
1533 | - // 以下、ボックス制御。気にしなくて良い | |
1534 | - $('body').live('click', function() { | |
1535 | - hideBox(box); | |
1536 | - }); | |
1537 | - | |
1538 | - box.click(function(event) { | |
1539 | - event.stopPropagation(); | |
1540 | - }); | |
1541 | - | |
1542 | - var positionAndShowBox = function(box) { | |
1543 | - var pos = txt.offset(); | |
1544 | - var left = pos.left + txt.outerWidth() - box.outerWidth(); | |
1545 | - if (left < pos.left) left = pos.left; | |
1546 | - box.css({ left: left, top: (pos.top + txt.outerHeight()) }); | |
1547 | - showBox(box); | |
1548 | - } | |
1549 | - | |
1550 | - txt.click(function(event) { | |
1551 | - event.stopPropagation(); | |
1552 | - if (!txt.is('input')) { | |
1553 | - positionAndShowBox(box); | |
1554 | - } | |
1555 | - }); | |
1556 | - | |
1557 | - txt.focus(function() { | |
1558 | - positionAndShowBox(box); | |
1559 | - }); | |
1560 | - | |
1561 | - function hideBox(box) { | |
1562 | - if (opts.hideEffect == 'fade') | |
1563 | - box.fadeOut(); | |
1564 | - else if (opts.hideEffect == 'slide') | |
1565 | - box.slideUp(); | |
1566 | - else | |
1567 | - box.hide(); | |
1568 | - } | |
1569 | - | |
1570 | - function showBox(box) { | |
1571 | - if (opts.showEffect == 'fade') | |
1572 | - box.fadeIn(); | |
1573 | - else if (opts.showEffect == 'slide') | |
1574 | - box.slideDown(); | |
1575 | - else | |
1576 | - box.show(); | |
1577 | - } | |
1578 | - }); | |
1579 | -}; | |
1580 | - | |
1581 | -/* aimaiPicker自動セット */ | |
1582 | -$(function(){ | |
1583 | - if($.fn.aimaiPickerOg){ | |
1584 | - $('.aimaiClm').aimaiPickerOg(); | |
1585 | - } | |
1586 | -}); | |
1587 | - | |
1588 | - | |
1589 | -/* | |
1590 | - * glDatePicker v2.0 | |
1591 | - * http://glad.github.com/glDatePicker/ | |
1592 | - * カレンダーピッカー | |
1593 | - * | |
1594 | - * Copyright (c) 2013 Gautam Lad. All rights reserved. | |
1595 | - * Released under the MIT license. | |
1596 | - * | |
1597 | - * OpenGion Modified | |
1598 | - * 横幅、高さはwindowの高さに依存(option指定可)で、表示位置調整 | |
1599 | - * アイコンクリック起動対応 | |
1600 | - * 返り値をyyyymmdd形式に変更 | |
1601 | - * 月曜開始の条件追加 | |
1602 | - * | |
1603 | - * 利用方法 | |
1604 | - * $(".calPic").glDatePicker(); のようにプラグインを適用するとclass="calPic"がピッカー起動対象です。 | |
1605 | - * @og.rev 5.8.9.0 (2015/08/07) | |
1606 | - * @og.rev 5.9.4.3 (2016/01/15) IE7対応 | |
1607 | - * @og.rev 5.9.5.0 (2016/02/05) マウスホイール対応 | |
1608 | - * @og.rev 5.9.6.1 (2016/03/02) サイズをウインドウの高さによって135-180で可変とする | |
1609 | - * @og.rev 5.9.10.1 (2016/07/02) draggableはエラーが出るのでやめる | |
1610 | - * @og.rev 5.9.11.0 (2016/08/05) カレンダーの事前作成をやめる | |
1611 | - * @og.rev 5.9.13.1 (2016/10/21) 初期値セット対応 | |
1612 | - * @og.rev 5.9.22.2 (2017/07/21) changeイベントを発生させる、初期値セット不具合対応 | |
1613 | - */ | |
1614 | - ;(function() { | |
1615 | - $.fn.glDatePicker = function(options) { | |
1616 | - var pluginName = 'glDatePicker'; | |
1617 | - | |
1618 | - // Find the plugin attached to the element | |
1619 | - var instance = this.data(pluginName); | |
1620 | - | |
1621 | - // If the instance wasn't found, create it... | |
1622 | - if(!instance) { | |
1623 | - // Return the element being bound to | |
1624 | - return this.each(function() { | |
1625 | - return $(this).data(pluginName, new glDatePicker(this, options)); | |
1626 | - }); | |
1627 | - } | |
1628 | - | |
1629 | - // ...otherwise if the user passes true to the plugin (on the second call), | |
1630 | - // then return the instance of the plugin itself | |
1631 | - return (options === true) ? instance : this; | |
1632 | - }; | |
1633 | - | |
1634 | - // Default options | |
1635 | - $.fn.glDatePicker.defaults = | |
1636 | - { | |
1637 | - // Style to use for the calendar. This name must match the name used in | |
1638 | - // the stylesheet, using the class naming convention "gldp-cssName". | |
1639 | - cssName: 'default', | |
1640 | - | |
1641 | - // The z-index for the calendar control. | |
1642 | - zIndex: 1000, | |
1643 | - | |
1644 | - // Thickness of border (in pixels) | |
1645 | - borderSize: 1, | |
1646 | - | |
1647 | - // The number of pixels to offset the calendar's position on the page. | |
1648 | - calendarOffset: { x: 0, y: 1 }, | |
1649 | - | |
1650 | - // Set to true if you want the calendar to be visible at all times. | |
1651 | - // NOTE: If your target element is hidden, the calendar will be hidden as well. | |
1652 | - showAlways: false, | |
1653 | - | |
1654 | - // Hide the calendar when a date is selected (only if showAlways is set to false). | |
1655 | - hideOnClick: true, | |
1656 | - | |
1657 | - // Allow selection of months by clicking on the month in the title. | |
1658 | - allowMonthSelect: true, | |
1659 | - | |
1660 | - // Allow selection of years by clicking on the year in the title. | |
1661 | - allowYearSelect: true, | |
1662 | - | |
1663 | - // The date that will be treated as 'today'. | |
1664 | - todayDate: new Date(), | |
1665 | - | |
1666 | - // The date that will appear selected when the calendar renders. | |
1667 | - // By default it will be set to todayDate. | |
1668 | - selectedDate: null, | |
1669 | - | |
1670 | - // Arrows used for the Previous and Next month buttons on the title. | |
1671 | - // Set these to blank to hide the arrows completely. | |
1672 | - prevArrow: '\u25c4', | |
1673 | - nextArrow: '\u25ba', | |
1674 | - | |
1675 | - // A collection of dates that can be selectable by the user. | |
1676 | - // The dates can be a one-time selection or made repeatable by setting | |
1677 | - // the repeatYear or repeatMonth flag to true. | |
1678 | - // By default repeatYear and repeatMonth are false. | |
1679 | - // | |
1680 | - // This example creates 4-individual dates that can be selected; | |
1681 | - // The first date will repeat every year, the second date will repeat every | |
1682 | - // month and year, the third date will repeat every month and the fourth date | |
1683 | - // will only be selectable one-time and not repeat: | |
1684 | - // | |
1685 | - // selectableDates: [ | |
1686 | - // { date: new Date(0, 8, 5), repeatYear: true }, | |
1687 | - // { date: new Date(0, 0, 14), repeatMonth: true, repeatYear: true }, | |
1688 | - // { date: new Date(2013, 0, 24), repeatMonth: true }, | |
1689 | - // { date: new Date(2013, 11, 25) }, | |
1690 | - // ] | |
1691 | - selectableDates: null, | |
1692 | - | |
1693 | - // A collection of date ranges that are selectable by the user. | |
1694 | - // The ranges can be made to repeat by setting repeatYear to true | |
1695 | - // (repeatMonth is not supported). | |
1696 | - // | |
1697 | - // This example will create 3-sets of selectable date ranges with | |
1698 | - // specific from and to ranges. The 4th and 5th ranges don't specify | |
1699 | - // the "to" date in which case the "to" date will be the maximum days for | |
1700 | - // the month specified in "from". The 4th and 5th ranges also repeat every year: | |
1701 | - // | |
1702 | - // selectableDateRange: [ | |
1703 | - // { from: new Date(2013, 1, 1), to: newDate (2013, 2, 1) }, | |
1704 | - // { from: new Date(2013, 4, 1), to: newDate (2013, 8, 1) }, | |
1705 | - // { from: new Date(2013, 7, 10), to: newDate (2013, 9, 10) }, | |
1706 | - // { from: new Date(0, 8, 10), repeatYear: true } | |
1707 | - // { from: new Date(0, 9, 1), repeatYear: true } | |
1708 | - // ] | |
1709 | - selectableDateRange: null, | |
1710 | - | |
1711 | - // Mark certain dates as special dates. Similar to selectableDates, this | |
1712 | - // property supports both repeatYear and repeatMonth flags. | |
1713 | - // Each special date can be styled using custom style names and can have | |
1714 | - // data attached to it that will be returned in the onClick callback. | |
1715 | - // The data field can be any custom (JSON style) object. | |
1716 | - // | |
1717 | - // This example creates two (repeatable by year) dates with special data in them. | |
1718 | - // The first date also assigns a special class (which you will have to define). | |
1719 | - // specialDates: [ | |
1720 | - // { | |
1721 | - // date: new Date(0, 8, 5), | |
1722 | - // data: { message: 'Happy Birthday!' }, | |
1723 | - // repeatYear: true, | |
1724 | - // cssClass: 'special-bday' | |
1725 | - // }, | |
1726 | - // { | |
1727 | - // date: new Date(2013, 0, 8), | |
1728 | - // data: { message: 'Meeting every day 8 of the month' }, | |
1729 | - // repeatMonth: true | |
1730 | - // } | |
1731 | - // ] | |
1732 | - specialDates: null, | |
1733 | - | |
1734 | - // List of months that can be selectable, including when the user clicks | |
1735 | - // on the title to select from the dropdown. | |
1736 | - // This example only makes two months visible; September and December: | |
1737 | - // selectableMonths: [8, 11] | |
1738 | - selectableMonths : null, | |
1739 | - | |
1740 | - // List of selectable years. If not provided, will default to 5-years | |
1741 | - // back and forward. | |
1742 | - // This example only allows selection of dates that have year 2012, 2013, 2015 | |
1743 | - // selectableYears: [2012, 2013, 2015] | |
1744 | - selectableYears: null, | |
1745 | - | |
1746 | - // List of selectable days of the week. 0 is Sunday, 1 is Monday, and so on. | |
1747 | - // This example allows only Sunday, Tuesday, Thursday: | |
1748 | - // selectableDOW: [0, 2, 4] | |
1749 | - selectableDOW : null, | |
1750 | - | |
1751 | - // Names of the month that will be shown in the title. | |
1752 | - // Will default to long-form names: | |
1753 | - // January, February, March, April, May, June, July, | |
1754 | - // August, September, October, November, December | |
1755 | - monthNames: null, | |
1756 | - | |
1757 | - // Names of the days of the Week that will be shown below the title. | |
1758 | - // Will default to short-form names: | |
1759 | - // Sun, Mon, Tue, Wed, Thu, Fri, Sat | |
1760 | - dowNames: null, | |
1761 | - | |
1762 | - // The day of the week to start the calendar on. 0 is Sunday, 1 is Monday and so on. | |
1763 | - // HYBS_CALSTART_MON次第とする | |
1764 | - //dowOffset: 0, | |
1765 | - dowOffset: (HYBS_CAL_START_MON==true ? 1 : 0), | |
1766 | - | |
1767 | - // Callback that will trigger when the user clicks a selectable date. | |
1768 | - // Parameters that are passed to the callback: | |
1769 | - // el : The input element the date picker is bound to | |
1770 | - // cell : The cell on the calendar that triggered this event | |
1771 | - // date : The date associated with the cell | |
1772 | - // data : Special data associated with the cell (if available, otherwise, null) | |
1773 | - onClick: (function(el, cell, date, data) { | |
1774 | - //el.val(date.toLocaleDateString()); | |
1775 | - | |
1776 | - // openGion アイコン起動が出来るようにしておく | |
1777 | - var tgt = el; | |
1778 | - if ( el[0].tagName.toUpperCase() != 'INPUT' ){ | |
1779 | - var _targetId = el.attr('targetId'); | |
1780 | - if( _targetId != null ){ | |
1781 | - tgt = $('#'+_targetId); | |
1782 | - } | |
1783 | - } | |
1784 | - | |
1785 | - var year = date.getFullYear(); | |
1786 | - var month = date.getMonth() + 1; | |
1787 | - var day = date.getDate(); | |
1788 | - if ( month < 10 ) { | |
1789 | - month = '0' + month; | |
1790 | - } | |
1791 | - if ( day < 10 ) { | |
1792 | - day = '0' + day; | |
1793 | - } | |
1794 | - var oldval = tgt.val(); | |
1795 | - // var str = year + month + day; | |
1796 | - var str = year + "" + month + "" + day; // 5.9.1.2 (2015/10/23) | |
1797 | - tgt.val(str); // opneGion:yyyymmdd形式 | |
1798 | - if( oldval != str ){ // changeイベントを発生させる 5.9.22.2 (2017/07/21) | |
1799 | - tgt.change(); | |
1800 | - } | |
1801 | - }), | |
1802 | - | |
1803 | - // Callback that will trigger when the user hovers over a selectable date. | |
1804 | - // This callback receives the same set of parameters as onClick. | |
1805 | - onHover: function(el, cell, date, data) {}, | |
1806 | - | |
1807 | - // Callback that will trigger when the calendar needs to show. | |
1808 | - // You can use this callback to animate the opening of the calendar. | |
1809 | - onShow: function(calendar) { | |
1810 | - calendar.show(); | |
1811 | - }, | |
1812 | - | |
1813 | - // Callback that will trigger when the calendar needs to hide. | |
1814 | - // You can use this callback to animate the hiding of the calendar. | |
1815 | - onHide: function(calendar) { calendar.hide(); }, | |
1816 | - | |
1817 | - // First date of the month. | |
1818 | - firstDate: null | |
1819 | - }; | |
1820 | - | |
1821 | - // Our plugin object | |
1822 | - var glDatePicker = (function() { | |
1823 | - // Main entry point. Initialize the plugin | |
1824 | - function glDatePicker(element, userOptions) { | |
1825 | - // Grab handle to this | |
1826 | - var self = this; | |
1827 | - | |
1828 | - // Save bound element to el | |
1829 | - self.el = $(element); | |
1830 | - var el = self.el; | |
1831 | - | |
1832 | - // Merge user options into default options | |
1833 | - self.options = $.extend(true, {}, $.fn.glDatePicker.defaults, userOptions); | |
1834 | - var options = self.options; | |
1835 | - | |
1836 | - // 5.9.13.1 (2016/10/21)ボックスへの入力値を初期値にする | |
1837 | - var _tgt = el; | |
1838 | - if ( el[0].tagName.toUpperCase() != 'INPUT' ){ | |
1839 | - if( el.attr('targetId') ){ | |
1840 | - _tgt = $('#'+el.attr('targetId')); | |
1841 | - } | |
1842 | - } | |
1843 | - var _inputDate = _tgt.val(); | |
1844 | - if( _inputDate != null && _inputDate.length >= 8 ){ | |
1845 | - | |
1846 | - _inputDate = _inputDate.replace(/\u002f/g , "" ) ; | |
1847 | - try{ | |
1848 | - _inputDate = _inputDate.substr(0,4) +"/"+ _inputDate.substr(4,2) + "/" + _inputDate.substr(6,2); | |
1849 | - }catch(e){ _inputDate=null; } | |
1850 | - } | |
1851 | - else{ // 5.9.22.2 (2017/07/21) 初期値問題に対応 | |
1852 | - _inputDate=null; | |
1853 | - } | |
1854 | - | |
1855 | - // Find the calendar element if the user provided one | |
1856 | - self.calendar = $($.find('[gldp-el=' + el.attr('gldp-id') + ' ]')); | |
1857 | - | |
1858 | - // Default first date to selected | |
1859 | - options.selectedDate = (options.selectedDate || new Date(_inputDate || options.todayDate) ) || options.todayDate ; | |
1860 | - | |
1861 | - options.firstDate = (new Date((options.firstDate || options.selectedDate )))._first(); | |
1862 | - | |
1863 | - if(!(el.attr('gldp-id') || '').length) { | |
1864 | - el.attr('gldp-id', 'gldp-' + Math.round(Math.random() * 1e10)) | |
1865 | - } | |
1866 | - | |
1867 | - // Show the plugin on focus | |
1868 | - el | |
1869 | - .addClass('gldp-el') | |
1870 | - .bind('click', function(e) { self.show(e); }); | |
1871 | - //.bind('focus', function(e) { self.show(e); }); // opneGion:focusでは起動させない | |
1872 | - | |
1873 | - // If the user is defining the container and it exists, hide it on initial creation. | |
1874 | - // The update function will handle showing if it's showAlways = true | |
1875 | - if(self.calendar.length && !options.showAlways) { | |
1876 | - self.calendar.hide(); | |
1877 | - } | |
1878 | - | |
1879 | - // Hide the plugin on mouse up outside of the plugin | |
1880 | - $(document).bind('mouseup', function(e) { | |
1881 | - var target = e.target; | |
1882 | - var calendar = self.calendar; | |
1883 | - | |
1884 | - if(!el.is(target) && !calendar.is(target) && calendar.has(target).length === 0 && calendar.is(':visible')) { | |
1885 | - self.hide(); | |
1886 | - } | |
1887 | - }); | |
1888 | - | |
1889 | -// 5.9.10.1 (2016/07/02) Del | |
1890 | -// if(typeof $(self).draggable == "function"){ | |
1891 | -// $(self).draggable({ | |
1892 | -// opacity : 0.5 | |
1893 | -// ,cursor : 'move' | |
1894 | -// }); | |
1895 | -// } | |
1896 | - | |
1897 | - // Render calendar | |
1898 | - //self.render(); // 5.9.11.0 一覧で遅いのでここで予め作る事はしない | |
1899 | - }; | |
1900 | - | |
1901 | - // Public methods | |
1902 | - glDatePicker.prototype = | |
1903 | - { | |
1904 | - show: function() { | |
1905 | - this.render();// 5.9.6.1 (2016/03/04) | |
1906 | - // Hide others and show this calendar | |
1907 | - $.each($('.gldp-el').not(this.el), function(i, o) { | |
1908 | - if(o.length) { o.options.onHide(o.calendar) ; } | |
1909 | - }); | |
1910 | - | |
1911 | - // Show this calendar | |
1912 | - this.options.onShow(this.calendar); | |
1913 | - }, | |
1914 | - | |
1915 | - hide: function() { | |
1916 | - if(this.options && !this.options.showAlways) { | |
1917 | - this.options.onHide(this.calendar); | |
1918 | - } | |
1919 | - }, | |
1920 | - | |
1921 | - // Render the calendar | |
1922 | - render: function(renderCalback) { | |
1923 | - var self = this; | |
1924 | - var el = self.el; | |
1925 | - var options = self.options; | |
1926 | - var calendar = self.calendar; | |
1927 | - | |
1928 | - // Build a core class (with border) that every element would have | |
1929 | - var coreClass = ' core border '; | |
1930 | - var cssName = 'gldp-' + options.cssName; | |
1931 | - | |
1932 | - // Get today | |
1933 | - var todayVal = options.todayDate._val(); | |
1934 | - var todayTime = todayVal.time; | |
1935 | - | |
1936 | - // Constants | |
1937 | - var maxRow = 6; | |
1938 | - var maxCol = 7; | |
1939 | - var borderSize = options.borderSize + 'px'; | |
1940 | - | |
1941 | - // Helper function to build selectable list | |
1942 | - var getSelectableList = function(min, max, userList) { | |
1943 | - // Build a default list using min/max | |
1944 | - var resultList = []; | |
1945 | - for(var i = min; i <= max; i++) { resultList.push(i); } | |
1946 | - | |
1947 | - // If user provided a collection, sanitize list by ensuring it's within range and unique | |
1948 | - if(userList) { | |
1949 | - var newList = []; | |
1950 | - $.each(userList, function(i, v) { | |
1951 | - if(v >= min && v <= max && newList._indexOf(v) < 0) { | |
1952 | - newList.push(v); | |
1953 | - } | |
1954 | - }); | |
1955 | - | |
1956 | - resultList = newList.length ? newList : resultList; | |
1957 | - }; | |
1958 | - | |
1959 | - // Sort the values before returning it | |
1960 | - resultList.sort(); | |
1961 | - | |
1962 | - return resultList; | |
1963 | - }; | |
1964 | - | |
1965 | - // Selectable (constants) | |
1966 | - var selectableMonths = getSelectableList(0, 11, options.selectableMonths); | |
1967 | - var selectableYears = getSelectableList(todayVal.year - 5, todayVal.year + 5, options.selectableYears); | |
1968 | - var selectableDOW = getSelectableList(0, 6, options.selectableDOW); | |
1969 | - var dowNames = options.dowNames || ['日','月','火','水','木','金','土']; | |
1970 | - var monthNames = options.monthNames || ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']; | |
1971 | - | |
1972 | - // Create cell width based on el size | |
1973 | - //var containerWidth = el.outerWidth(); | |
1974 | - // 5.9.6.1 (2016/03/04) 可変 | |
1975 | - var containerSize = window.innerHeight ? window.innerHeight : 180; | |
1976 | - if( containerSize < 180 ){ containerSize = (containerSize > 135 ? containerSize : 135); } | |
1977 | - else{ containerSize = 180; } | |
1978 | - | |
1979 | - var containerWidth = options.conainerWidth || containerSize; // opneGion:180を基準として、130までは可変 | |
1980 | - var containerHeight = containerWidth; | |
1981 | - | |
1982 | - // Create cell size based on container size | |
1983 | - var getCellSize = function(_size, _count) { | |
1984 | -// return (_size / _count) + ((options.borderSize / _count) * (_count - 1)); | |
1985 | - return (_size / _count) + ((options.borderSize / _count) * (_count - 1)) - 1; // 5.9.4.3 | |
1986 | - }; | |
1987 | - var cellWidth = getCellSize(containerWidth, maxCol); | |
1988 | - var cellHeight = getCellSize(containerHeight, maxRow + 2); | |
1989 | - | |
1990 | - // If calendar doesn't exist, create it and re-assign it to self | |
1991 | - if(!calendar.length) { | |
1992 | - self.calendar = calendar = $('<div/>') | |
1993 | - .attr('gldp-el', el.attr('gldp-id')) | |
1994 | - .data('is', true) | |
1995 | - .css( | |
1996 | - { | |
1997 | - display: (options.showAlways ? undefined : 'none'), | |
1998 | - zIndex: options.zIndex, | |
1999 | - //width: (cellWidth * maxCol) + 'px' | |
2000 | - width: ((cellWidth+1) * maxCol) + 'px' // 5.9.4.3 | |
2001 | - }); | |
2002 | - | |
2003 | - $('body').append(calendar); | |
2004 | - } | |
2005 | - else { | |
2006 | - if(!eval(calendar.data('is'))) { | |
2007 | - containerWidth = calendar.outerWidth(); | |
2008 | - containerHeight = calendar.outerHeight(); | |
2009 | - | |
2010 | - cellWidth = getCellSize(containerWidth, maxCol); | |
2011 | - cellHeight = getCellSize(containerHeight, maxRow + 2); | |
2012 | - } | |
2013 | - // 5.9.6.1 (2016/03/04) | |
2014 | - self.calendar.css( | |
2015 | - { | |
2016 | - width: ((cellWidth+1) * maxCol) + 'px' | |
2017 | - } | |
2018 | - ) | |
2019 | - } | |
2020 | - | |
2021 | - // Hide calendar if the target element isn't visible | |
2022 | - if(!el.is(':visible')) { calendar.hide(); } | |
2023 | - | |
2024 | - // Add core classes and remove calendar's children | |
2025 | - calendar | |
2026 | - .removeClass() | |
2027 | - .addClass(cssName) | |
2028 | - .children().remove(); | |
2029 | - | |
2030 | - // Bind to resize event to position calendar | |
2031 | - var onResize = function() { | |
2032 | - var elPos = el.offset(); | |
2033 | - | |
2034 | - // ポジションは上、右にスペースが無い場合は修正する | |
2035 | - calPosTop = (elPos.top + el.outerHeight() + options.calendarOffset.y) -20; | |
2036 | - calPosLeft = (elPos.left + options.calendarOffset.x); | |
2037 | - | |
2038 | - if( calPosTop > $(window).height() - 150 ){ calPosTop -= 130; } | |
2039 | - if( calPosLeft > $(window).width() -150 ) { calPosLeft -= 150; } | |
2040 | - | |
2041 | - if( calPosTop < 0 ){ calPosTop = 0; } | |
2042 | - if( calPosLeft < 0 ){ calPosLeft = 0; } | |
2043 | - | |
2044 | - calendar.css( | |
2045 | - { | |
2046 | - top: calPosTop + 'px', | |
2047 | - left: calPosLeft + 'px' | |
2048 | - }); | |
2049 | - }; | |
2050 | - $(window).resize(onResize); | |
2051 | - onResize(); | |
2052 | - | |
2053 | - // Create variables for cells | |
2054 | - var cellCSS = | |
2055 | - { | |
2056 | - width: cellWidth + 'px', | |
2057 | - height: cellHeight + 'px', | |
2058 | - lineHeight: cellHeight + 'px' | |
2059 | - }; | |
2060 | - | |
2061 | - // Helper function to setDate | |
2062 | - var setFirstDate = function(_date) { | |
2063 | - if(_date) { | |
2064 | - // Get first date | |
2065 | - options.firstDate = _date; | |
2066 | - | |
2067 | - // Update the calendar | |
2068 | - self.render(); | |
2069 | - } | |
2070 | - }; | |
2071 | - | |
2072 | - var getFirstDate = function(_offset) { | |
2073 | - // Create start date as the first date of the month | |
2074 | - var _date = new Date(options.firstDate); | |
2075 | - | |
2076 | - // Default to no offset | |
2077 | - _offset = _offset || 0; | |
2078 | - | |
2079 | - // Find out which months are selectable | |
2080 | - while(true) { | |
2081 | - // Adjust date for month offset | |
2082 | - _date.setMonth(_date.getMonth() + _offset); | |
2083 | - _date.setDate(Math.min(1, _date._max())); | |
2084 | - | |
2085 | - // If not an offset, break out of the loop | |
2086 | - if(_offset == 0) { break; } | |
2087 | - | |
2088 | - // Get _date's value | |
2089 | - var dateVal = _date._val(); | |
2090 | - | |
2091 | - // Get local vars | |
2092 | - var dateMonth = dateVal.month; | |
2093 | - var dateYear = dateVal.year; | |
2094 | - | |
2095 | - // Find the month first | |
2096 | - if(selectableMonths._indexOf(dateMonth) != -1) { | |
2097 | - // If year is in our collection, break... | |
2098 | - if(selectableYears._indexOf(dateYear) != -1) { | |
2099 | - break; | |
2100 | - } | |
2101 | - else { | |
2102 | - // ...otherwise, if it's out of bounds, exit loop | |
2103 | - if(dateYear < selectableYears[0] || dateYear > selectableYears[selectableYears.length - 1]) { | |
2104 | - return null; | |
2105 | - } | |
2106 | - } | |
2107 | - } | |
2108 | - } | |
2109 | - | |
2110 | - return _date; | |
2111 | - }; | |
2112 | - | |
2113 | - // Get the previous, next first dates | |
2114 | - var prevFirstDate = getFirstDate(-1); | |
2115 | - var nextFirstDate = getFirstDate(1); | |
2116 | - | |
2117 | - // Get the first date for the current month being rendered | |
2118 | - var firstDate = (options.firstDate = getFirstDate()); | |
2119 | - var firstDateVal = firstDate._val(); | |
2120 | - var firstDateMonth = firstDateVal.month; | |
2121 | - var firstDateYear = firstDateVal.year; | |
2122 | - | |
2123 | - // Get the start date in the calendar | |
2124 | - var startDate = new Date(firstDate); | |
2125 | - | |
2126 | - // Sanitize days of the week offset | |
2127 | - var dowOffset = Math.abs(Math.min(6, Math.max(0, options.dowOffset))); | |
2128 | - | |
2129 | - // Offset weekdays | |
2130 | - var startOffset = startDate.getDay() - dowOffset; | |
2131 | - startOffset = startOffset < 1 ? -7 - startOffset : -startOffset; | |
2132 | - dowNames = (dowNames.concat(dowNames)) | |
2133 | - .slice(dowOffset, dowOffset + 7); | |
2134 | - | |
2135 | - // Offset the start date | |
2136 | - startDate._add(startOffset); | |
2137 | - | |
2138 | - // Gather flags for prev/next arrows | |
2139 | - var showPrev = (prevFirstDate); | |
2140 | - var showNext = (nextFirstDate); | |
2141 | - | |
2142 | - // Create the arrows and title | |
2143 | - var monyearClass = coreClass + 'monyear '; | |
2144 | - | |
2145 | - var prevCell = $('<div/>') | |
2146 | - .addClass(monyearClass) | |
2147 | - .css( | |
2148 | - $.extend({}, cellCSS, | |
2149 | - { | |
2150 | - borderWidth: borderSize + ' 0 0 ' + borderSize | |
2151 | - }) | |
2152 | - ) | |
2153 | - .append( | |
2154 | - $('<a/>') | |
2155 | - .addClass('prev-arrow' + (showPrev ? '' : '-off')) | |
2156 | - .html(options.prevArrow) | |
2157 | - ) | |
2158 | - .mousedown(function() { return false; }) | |
2159 | - .click(function(e) { | |
2160 | - if(options.prevArrow != '' && showPrev) { | |
2161 | - e.stopPropagation(); | |
2162 | - setFirstDate(prevFirstDate); | |
2163 | - } | |
2164 | - }); | |
2165 | - | |
2166 | - var titleCellCount = maxCol - 2; | |
2167 | - var titleWidth = (cellWidth * titleCellCount) - (titleCellCount * options.borderSize) + (options.borderSize); | |
2168 | - var titleCell = $('<div/>') | |
2169 | - .addClass(monyearClass + 'title') | |
2170 | - .css( | |
2171 | - $.extend({}, cellCSS, | |
2172 | - { | |
2173 | - width: titleWidth + 'px', | |
2174 | - borderTopWidth: borderSize, | |
2175 | - marginLeft: '-' + (borderSize) | |
2176 | - }) | |
2177 | - ); | |
2178 | - | |
2179 | - var nextCell = $('<div/>') | |
2180 | - .addClass(monyearClass) | |
2181 | - .css( | |
2182 | - $.extend({}, cellCSS, | |
2183 | - { | |
2184 | - marginLeft: '-' + (borderSize), | |
2185 | - borderWidth: borderSize + ' ' + borderSize + ' 0 0' | |
2186 | - }) | |
2187 | - ) | |
2188 | - .append( | |
2189 | - $('<a/>') | |
2190 | - .addClass('next-arrow' + (showNext ? '' : '-off')) | |
2191 | - .html(options.nextArrow) | |
2192 | - ) | |
2193 | - .mousedown(function() { return false; }) | |
2194 | - .click(function(e) { | |
2195 | - if(options.nextArrow != '' && showNext) { | |
2196 | - e.stopPropagation(); | |
2197 | - setFirstDate(nextFirstDate); | |
2198 | - } | |
2199 | - }); | |
2200 | - | |
2201 | - // Add cells for prev/title/next | |
2202 | - calendar | |
2203 | - .append(prevCell) | |
2204 | - .append(titleCell) | |
2205 | - .append(nextCell); | |
2206 | - | |
2207 | - // Add all the cells to the calendar | |
2208 | - for(var row = 0, cellIndex = 0; row < maxRow + 1; row++) { | |
2209 | - for(var col = 0; col < maxCol; col++, cellIndex++) { | |
2210 | - var cellDate = new Date(startDate); | |
2211 | - var cellClass = 'day'; | |
2212 | - var cellZIndex = options.zIndex + (cellIndex); | |
2213 | - var cell = $('<div/>') | |
2214 | - | |
2215 | - if(!row) { | |
2216 | - cellClass = 'dow'; | |
2217 | - cell.html(dowNames[col]); | |
2218 | - cellDate = null; | |
2219 | - } | |
2220 | - else { | |
2221 | - // Get the new date for this cell | |
2222 | - cellDate._add(col + ((row - 1) * maxCol)); | |
2223 | - | |
2224 | - // Get value for this date | |
2225 | - var cellDateVal = cellDate._val(); | |
2226 | - var cellDateTime = cellDateVal.time; | |
2227 | - | |
2228 | - // Variable to hold special data | |
2229 | - var specialData = null; | |
2230 | - | |
2231 | - // Determine if this date is selectable | |
2232 | - var isSelectable = true; | |
2233 | - | |
2234 | - // Helper function to get repeat friendly date against current date | |
2235 | - var getRepeatDate = function(v, date) { | |
2236 | - // If repeating, set the date's year and month accordingly | |
2237 | - if(v.repeatYear === true) { date.setYear(cellDateVal.year); } | |
2238 | - if(v.repeatMonth === true) { date.setMonth(cellDateVal.month); } | |
2239 | - | |
2240 | - return date._val(); | |
2241 | - }; | |
2242 | - | |
2243 | - // Assign date for the cell | |
2244 | - cell.html(cellDateVal.date); | |
2245 | - | |
2246 | - // If we have selectable date ranges | |
2247 | - if(options.selectableDateRange) { | |
2248 | - isSelectable = false; | |
2249 | - $.each(options.selectableDateRange, function(i, v) { | |
2250 | - var dateFrom = v.from; | |
2251 | - var dateTo = (v.to || null); | |
2252 | - | |
2253 | - // If to is not specified, default to max days in the from month | |
2254 | - dateTo = dateTo || new Date(v.from.getFullYear(), v.from.getMonth(), v.from._max()); | |
2255 | - | |
2256 | - // If repeating year, set the from and two to the current date's year | |
2257 | - dateFrom = getRepeatDate(v, dateFrom); | |
2258 | - dateTo = getRepeatDate(v, dateTo); | |
2259 | - | |
2260 | - // Test to see if this date is selectable | |
2261 | - if(cellDateTime >= dateFrom.time && cellDateTime <= dateTo.time) { | |
2262 | - isSelectable = true; | |
2263 | - return true; | |
2264 | - } | |
2265 | - }); | |
2266 | - } | |
2267 | - | |
2268 | - // Handle date ranges and collections | |
2269 | - if(options.selectableDates) { | |
2270 | - if((options.selectableDateRange && !isSelectable) || (isSelectable && !options.selectableDateRange)) { | |
2271 | - isSelectable = false; | |
2272 | - } | |
2273 | - $.each(options.selectableDates, function(i, v) { | |
2274 | - var vDate = getRepeatDate(v, v.date); | |
2275 | - | |
2276 | - if(vDate.time == cellDateTime) { | |
2277 | - return (isSelectable = true); | |
2278 | - } | |
2279 | - }); | |
2280 | - } | |
2281 | - | |
2282 | - // If not active or if not within selectableMonths, set to noday otherwise evaluate accordingly | |
2283 | - if(!isSelectable || | |
2284 | - selectableYears._indexOf(cellDateVal.year) < 0 || | |
2285 | - selectableMonths._indexOf(cellDateVal.month) < 0 || | |
2286 | - selectableDOW._indexOf(cellDateVal.day) < 0) { | |
2287 | - cellClass = 'noday'; | |
2288 | - } | |
2289 | - else { | |
2290 | - // Handle active dates and weekends | |
2291 | - cellClass = ([ 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ])[cellDateVal.day]; | |
2292 | - | |
2293 | - // Handle today or selected dates | |
2294 | - if(firstDateMonth != cellDateVal.month) { cellClass += ' outday'; } | |
2295 | - if(todayTime == cellDateTime) { cellClass = 'today'; cellZIndex += 50; } | |
2296 | - if(options.selectedDate._time() == cellDateTime) { cellClass = 'selected'; cellZIndex += 51; } | |
2297 | - | |
2298 | - // Handle special dates | |
2299 | - if(options.specialDates) { | |
2300 | - $.each(options.specialDates, function(i, v) { | |
2301 | - var vDate = getRepeatDate(v, v.date); | |
2302 | - | |
2303 | - if(vDate.time == cellDateTime) { | |
2304 | - cellClass = (v.cssClass || 'special'); | |
2305 | - cellZIndex += 52; | |
2306 | - specialData = v.data; | |
2307 | - } | |
2308 | - }); | |
2309 | - } | |
2310 | - | |
2311 | - cell | |
2312 | - .mousedown(function() { return false; }) | |
2313 | - .hover(function(e) { | |
2314 | - e.stopPropagation(); | |
2315 | - | |
2316 | - // Get the data from this cell | |
2317 | - var hoverData = $(this).data('data'); | |
2318 | - | |
2319 | - // Call callback | |
2320 | - options.onHover(el, cell, hoverData.date, hoverData.data); | |
2321 | - }) | |
2322 | - .click(function(e) { | |
2323 | - e.stopPropagation(); | |
2324 | - | |
2325 | - // Get the data from this cell | |
2326 | - var clickedData = $(this).data('data'); | |
2327 | - | |
2328 | - // Save date to selected and first | |
2329 | - options.selectedDate = options.firstDate = clickedData.date; | |
2330 | - | |
2331 | - // Update calendar (and auto-hide if necessary) | |
2332 | - self.render(function() { | |
2333 | - if(!options.showAlways && options.hideOnClick) { | |
2334 | - self.hide(); | |
2335 | - } | |
2336 | - }); | |
2337 | - | |
2338 | - // Call callback | |
2339 | - options.onClick(el, $(this), clickedData.date, clickedData.data); | |
2340 | - }); | |
2341 | - } | |
2342 | - } | |
2343 | - | |
2344 | - // Update the css for the cell | |
2345 | - $.extend(cellCSS, | |
2346 | - { | |
2347 | - borderTopWidth: borderSize, | |
2348 | - borderBottomWidth: borderSize, | |
2349 | - borderLeftWidth: (row > 0 || (!row && !col)) ? borderSize : 0, | |
2350 | - borderRightWidth: (row > 0 || (!row && col == 6)) ? borderSize : 0, | |
2351 | - marginLeft: (col > 0) ? '-' + (borderSize) : 0, | |
2352 | - marginTop: (row > 0) ? '-' + (borderSize) : 0, | |
2353 | - zIndex: cellZIndex | |
2354 | - }); | |
2355 | - | |
2356 | - // Assign other properties to the cell | |
2357 | - cell | |
2358 | - .data('data', { date: cellDate, data: specialData}) | |
2359 | - .addClass(coreClass + cellClass) | |
2360 | - .css(cellCSS); | |
2361 | - | |
2362 | - // Add cell to calendar | |
2363 | - calendar.append(cell); | |
2364 | - } | |
2365 | - } | |
2366 | - | |
2367 | - // Render the month / year title | |
2368 | - | |
2369 | - // Helper function for toggling select and text | |
2370 | - var toggleYearMonthSelect = function(showYear) { | |
2371 | - var show = 'inline-block'; | |
2372 | - var hide = 'none'; | |
2373 | - | |
2374 | - if(options.allowMonthSelect) { | |
2375 | - monthText.css({ display: !showYear ? hide : show }); | |
2376 | - monthSelect.css({ display: !showYear ? show : hide }); | |
2377 | - } | |
2378 | - | |
2379 | - if(options.allowYearSelect) { | |
2380 | - yearText.css({ display: showYear ? hide : show }); | |
2381 | - yearSelect.css({ display: showYear ? show : hide }); | |
2382 | - } | |
2383 | - }; | |
2384 | - | |
2385 | - // Helper function when select is updated | |
2386 | - var onYearMonthSelect = function() { | |
2387 | - options.firstDate = new Date(yearSelect.val(), monthSelect.val(), 1); | |
2388 | - self.render(); | |
2389 | - }; | |
2390 | - | |
2391 | - // Build month selector | |
2392 | - var monthSelect = $('<select/>') | |
2393 | - .hide() | |
2394 | - .change(onYearMonthSelect); | |
2395 | - | |
2396 | - // Build year selector | |
2397 | - var yearSelect = $('<select/>') | |
2398 | - .hide() | |
2399 | - .change(onYearMonthSelect); | |
2400 | - | |
2401 | - // Build month label | |
2402 | - var monthText = $('<span/>') | |
2403 | - .html(monthNames[firstDateMonth]) | |
2404 | - .mousedown(function() { return false; }) | |
2405 | - .click(function(e) { | |
2406 | - e.stopPropagation(); | |
2407 | - toggleYearMonthSelect(false); | |
2408 | - }); | |
2409 | - | |
2410 | - // Build year label | |
2411 | - var yearText = $('<span/>') | |
2412 | - .html(firstDateYear) | |
2413 | - .mousedown(function() { return false; }) | |
2414 | - .click(function(e) { | |
2415 | - e.stopPropagation(); | |
2416 | - toggleYearMonthSelect(true); | |
2417 | - }); | |
2418 | - | |
2419 | - // Populate month select | |
2420 | - $.each(monthNames, function(i, v) { | |
2421 | - if(options.allowMonthSelect && selectableMonths._indexOf(i) != -1) { | |
2422 | - var o = $('<option/>').html(v).attr('value', i); | |
2423 | - if(i == firstDateMonth) { o.attr('selected', 'selected');} | |
2424 | - monthSelect.append(o); | |
2425 | - } | |
2426 | - }); | |
2427 | - | |
2428 | - // Populate year select | |
2429 | - $.each(selectableYears, function(i, v) { | |
2430 | - if(options.allowYearSelect) { | |
2431 | - var o = $('<option/>').html(v).attr('value', v); | |
2432 | - if(v == firstDateYear) { o.attr('selected', 'selected'); } | |
2433 | - yearSelect.append(o); | |
2434 | - } | |
2435 | - }); | |
2436 | - | |
2437 | - var titleYearMonth = $('<div/>') | |
2438 | - .append(monthText) | |
2439 | - .append(monthSelect) | |
2440 | - .append(yearText) | |
2441 | - .append(yearSelect); | |
2442 | - | |
2443 | - // Add to title | |
2444 | - titleCell.children().remove(); | |
2445 | - titleCell.append(titleYearMonth); | |
2446 | - | |
2447 | - // Run the callback signaling end of the render | |
2448 | - renderCalback = renderCalback || (function() {}); | |
2449 | - renderCalback(); | |
2450 | - | |
2451 | - // マウスホイールの回転 5.9.5.0 | |
2452 | - var mousewheelevent = 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'; | |
2453 | - calendar.bind(mousewheelevent,function(e){ | |
2454 | - e.preventDefault(); | |
2455 | - var delta = e.originalEvent.deltaY ? -(e.originalEvent.deltaY) : e.originalEvent.wheelDelta ? e.originalEvent.wheelDelta : -(e.originalEvent.detail); | |
2456 | - if (delta < 0){ | |
2457 | - // マウスホイールを下に | |
2458 | - nextCell.click(); | |
2459 | - } else { | |
2460 | - // マウスホイールを上に | |
2461 | - prevCell.click(); | |
2462 | - } | |
2463 | - }); | |
2464 | - | |
2465 | - } | |
2466 | - | |
2467 | - }; | |
2468 | - | |
2469 | - | |
2470 | - // Return the plugin | |
2471 | - return glDatePicker; | |
2472 | - })(); | |
2473 | - | |
2474 | - // One time initialization of useful prototypes | |
2475 | - (function() { | |
2476 | - Date.prototype._clear = function() { | |
2477 | - this.setHours(0); | |
2478 | - this.setMinutes(0); | |
2479 | - this.setSeconds(0); | |
2480 | - this.setMilliseconds(0); | |
2481 | - | |
2482 | - return this; | |
2483 | - }; | |
2484 | - | |
2485 | - Date.prototype._time = function() { | |
2486 | - return this._clear().getTime(); | |
2487 | - }; | |
2488 | - | |
2489 | - Date.prototype._max = function() { | |
2490 | - var isLeapYear = (new Date(this.getYear(), 1, 29).getMonth() == 1) ? 1 : 0; | |
2491 | - var days = [31, 28 + isLeapYear, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | |
2492 | - | |
2493 | - return days[this.getMonth()]; | |
2494 | - }; | |
2495 | - | |
2496 | - Date.prototype._add = function(days) { | |
2497 | - this.setDate(this.getDate() + days); | |
2498 | - }; | |
2499 | - | |
2500 | - Date.prototype._first = function() { | |
2501 | - var date = new Date(this); | |
2502 | - date.setDate(1); | |
2503 | - | |
2504 | - return date; | |
2505 | - }; | |
2506 | - | |
2507 | - Date.prototype._val = function() { | |
2508 | - this._clear(); | |
2509 | - | |
2510 | - return { | |
2511 | - year: this.getFullYear(), | |
2512 | - month: this.getMonth(), | |
2513 | - date: this.getDate(), | |
2514 | - time: this.getTime(), | |
2515 | - day: this.getDay() | |
2516 | - }; | |
2517 | - }; | |
2518 | - | |
2519 | - Array.prototype._indexOf = function(value) { | |
2520 | - return $.inArray(value, this); | |
2521 | - } | |
2522 | - })(); | |
2523 | -})(); | |
2524 | - | |
2525 | -/* 日付ピッカー自動セット */ | |
2526 | -$(function(){ | |
2527 | - if($.fn.glDatePicker){ | |
2528 | - $(".calPic").glDatePicker(); | |
2529 | - } | |
2530 | -}); | |
2531 | - | |
2532 | - | |
2533 | -/* | |
2534 | - * multipleのリストボックスで、初期選択されていた場合にその位置にスクロールします。 | |
2535 | - * optionの高さが取れなかったので、sizeから割り出しています。 | |
2536 | - * | |
2537 | - * @og.rev 5.9.4.5 (2016/01/29) 新規作成 | |
2538 | - */ | |
2539 | -function selectScroll(_tgt){ | |
2540 | - var size = 4; | |
2541 | - if( _tgt.getAttribute('size') ){ size= _tgt.getAttribute('size');} | |
2542 | - var _child = _tgt.options; | |
2543 | - for(var i=0; i<_child.length; i++){ | |
2544 | - if(_child[i].selected){ | |
2545 | - // 親がグループの場合のみ | |
2546 | - if( _child[i].parentNode.tagName.toUpperCase() == 'OPTGROUP'){ | |
2547 | - i += $(_child[i].parentNode).prev().length; | |
2548 | - | |
2549 | - } | |
2550 | - var firstSelected = i * ($(_tgt).height()/size); | |
2551 | - break; | |
2552 | - } | |
2553 | - } | |
2554 | - $(_tgt).scrollTop(firstSelected); | |
2555 | - } | |
2556 | - | |
2557 | -// マルチのセレクトに対して画面ロード時に実行する | |
2558 | -$(function(){ | |
2559 | - $('select[multiple]').each(function(){ selectScroll(this); }); | |
1 | +/************************************************************************************/ | |
2 | +/* 旧 focusHilight.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
3 | +/* */ | |
4 | +/* フォーカスが当っているアクティブフィールドの色を変更します */ | |
5 | +/* 色はfocusFieldクラスで指定しています */ | |
6 | +/* */ | |
7 | +/* @og.rev 4.3.5.0 (2009/02/01) JavaScript分離・イベントにJQuery利用 */ | |
8 | +/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
9 | +/* @og.rev 5.5.9.0 (2010/12/03) IE9対応。selectはstyleを直接変更する */ | |
10 | +/* @og.rev 5.6.4.2 (2013/05/17) エラー表示の alertメッセージ修正 */ | |
11 | +/* Revision: $Id$ */ | |
12 | +/************************************************************************************/ | |
13 | + | |
14 | +var orgFldCls = null; | |
15 | + | |
16 | +$(function(){ | |
17 | + // 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる | |
18 | +// $('textarea,select,input[type="text"]').focusin( function(){ doFocus2( this ); } ); | |
19 | +// $('textarea,select,input[type="text"]').focusout( function(){ doBlur2( this ); } ); | |
20 | + if(USE_FOCUS_HILIGHT){ //5.4.5.0 flag add | |
21 | + setEvent( "textarea,select,input[type=\"text\"]", "focusin", function(){ doFocus2( this ); } ); | |
22 | + setEvent( "textarea,select,input[type=\"text\"]", "focusout", function(){ doBlur2( this ); } ); | |
23 | + } | |
24 | +}); | |
25 | + | |
26 | +function doFocus2( obj ) { | |
27 | + // 入力中のフォームの色 | |
28 | + if( obj != null ) { | |
29 | + if( obj.className == null || obj.className.indexOf( "must" ) < 0 ) { | |
30 | + // 4.3.2.2 (2008/09/16) 入力中のフォームの色をcustom.cssに指定するように変更 | |
31 | + // 5.5.9.0 (2012/12/03) selectタグの場合は直接背景色変更 | |
32 | + if( obj.tagName == "SELECT" ){ // 5.5.9.1(2012/12/07) 小文字を大文字に | |
33 | + obj.orgBgColor = obj.style.backgroundColor; | |
34 | + obj.style.backgroundColor = '#ffcccc'; | |
35 | + } | |
36 | + else{ | |
37 | + orgFldCls = obj.className; | |
38 | + obj.className = 'focusField ' + orgFldCls; | |
39 | + } | |
40 | + } | |
41 | + } | |
42 | +} | |
43 | + | |
44 | +function doBlur2( obj ) { | |
45 | + if( obj != null ) { | |
46 | + if( obj.className == null || obj.className.indexOf( "must" ) < 0 ) { | |
47 | + // 元のフォームの色 | |
48 | + // 5.5.9.0 (2012/12/03) selectタグの場合は直接背景色変更 | |
49 | + if( obj.tagName == "SELECT" ){ | |
50 | + obj.style.backgroundColor = obj.orgBgColor; | |
51 | + } | |
52 | + else{ | |
53 | + if( orgFldCls != null ) { | |
54 | + obj.className = orgFldCls; | |
55 | + } | |
56 | + else { | |
57 | + obj.className = 'notFocusField'; | |
58 | + } | |
59 | + } | |
60 | + } | |
61 | + } | |
62 | +} | |
63 | + | |
64 | +/* 旧関数を呼び出した場合はアラートを出す(旧の*_inof.jsp対策) */ | |
65 | +oldDoFocusFlag = true; | |
66 | +function doFocus( obj ) { | |
67 | + if(oldDoFocusFlag){ | |
68 | + oldDoFocusFlag = false; | |
69 | +// setTimeout(alert("custom/query_info.jsp及びcustom/result_info.jspで次の部分を削除して下さい。\n<script>タグ(ヘッダ固定とフォーカス)、BODYのonLoadとoncontextmenu属性"),100); | |
70 | + setTimeout(alert("Old Script Error!!\ncustom/query_info.jsp,custom/result_info.jsp Please delete the following part.\n<script>Tag(Header fix and Focus) , BODY onLoad and oncontextmenu Attribute"),100); | |
71 | + } | |
72 | +} | |
73 | +/*エラー対策の空関数 */ | |
74 | +function doBlur( obj ) {} | |
75 | + | |
76 | +/************************************************************************************/ | |
77 | +/* 旧 autoConvert.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
78 | +/* */ | |
79 | +/* 入力値自動変換機能 4.3.0.0 (2008/07/25) 追加 */ | |
80 | +/* dbType XL及びXUについて、大文字・小文字の自動変換を行います */ | |
81 | +/* */ | |
82 | +/* @og.rev 4.3.5.0 (2009/02/01) JavaScript分離(inputFocusより) */ | |
83 | +/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
84 | +/* @og.rev 5.9.5.0 (2016/02/05) PN2も大文字化の対象とする */ | |
85 | +/* Revision: $Id$ */ | |
86 | +/************************************************************************************/ | |
87 | +$(function(){ | |
88 | + // 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる | |
89 | +// $('textarea,select,input[type="text"]').focusout( function(){ convert( this ); } ); | |
90 | + setEvent( "textarea,select,input[type=\"text\"]", "focusout", function(){ convert( this ); } ); | |
91 | +}); | |
92 | + | |
93 | +function convert( obj ) { | |
94 | + var val , cls ; | |
95 | + | |
96 | + val = obj.value; | |
97 | + cls = obj.className; | |
98 | + if( val != null && cls != null ) { | |
99 | + if( cls.match( /XL/ ) && !(cls.match( /XLU/ )) ) { | |
100 | + obj.value = val.toLowerCase(); | |
101 | + } | |
102 | +// else if( cls.match( /XU/ ) && !(cls.match( /XUL/ )) ) { | |
103 | + else if( (cls.match( /XU/ ) && !(cls.match( /XUL/ ))) || cls.match( /PN2/ ) ) { // 5.9.5.0 | |
104 | + obj.value = val.toUpperCase(); | |
105 | + } | |
106 | + } | |
107 | + return true; | |
108 | +} | |
109 | + | |
110 | +/************************************************************************************/ | |
111 | +/* 旧 eventColumn.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
112 | +/* */ | |
113 | +/* 動的プルダウンを実行するためのJavaScriptです。 */ | |
114 | +/* */ | |
115 | +/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
116 | +/* Revision: $Id$ */ | |
117 | +/************************************************************************************/ | |
118 | +var colMap; | |
119 | +var notFireCols; | |
120 | +var jH_evElm; | |
121 | + | |
122 | +$(function(){ | |
123 | + if( ! ( typeof( EC_NAME ) == "undefined" ) ) { | |
124 | + // 初期化処理だけは、予め要素オブジェクトを取得しておき、ここから子カラムを取得する。 | |
125 | + jH_evElm = $( ".h_evElm" ); | |
126 | + | |
127 | + makeColMapping(); | |
128 | + | |
129 | + setEvent( "textarea,select,input[type=\"text\"]", "change", function(){ makeColumn( this ); }, ".h_evCol", true, addEvColCls ); | |
130 | + setEvent( "input[type=checkbox],input[type=radio]", "click", function(){ makeColumn( this ); }, ".h_evCol", true ); | |
131 | + } | |
132 | +}); | |
133 | + | |
134 | +/** | |
135 | + * 親カラムをキーにしたイベントカラムの一覧を作成します。 | |
136 | + * | |
137 | + * 親カラムを連想配列のキーとして、子カラムの一覧を配列として保持します。 | |
138 | + * | |
139 | + * @og.rev 5.2.0.0 (2010/09/01) 新規作成 | |
140 | + * | |
141 | +**/ | |
142 | +function makeColMapping() { | |
143 | + var i , j , evCols , evc , cCols ; | |
144 | + | |
145 | + if( colMap ){ return; } | |
146 | + | |
147 | + colMap = new Object(); | |
148 | + for( i=0; i<EC_EVCOL.length; i++ ) { | |
149 | + evCols = EC_EVCOL[i].split(","); | |
150 | + for( j=0; j<evCols.length; j++ ) { | |
151 | + evc = evCols[j]; | |
152 | + if( evc.charAt(0) == "_" ) { | |
153 | + evc = evc.substring(1); | |
154 | + if( notFireCols ) { notFireCols += ","; } | |
155 | + notFireCols += evc; | |
156 | + } | |
157 | + cCols = colMap[evc]; | |
158 | + if( !cCols ) { cCols = new Array(); } | |
159 | + cCols[cCols.length] = EC_NAME[i]; | |
160 | + colMap[evc] = cCols; | |
161 | + } | |
162 | + } | |
163 | +} | |
164 | + | |
165 | +/** | |
166 | + * 親カラムに対してクラスを付加します。 | |
167 | + * | |
168 | + * @og.rev 5.2.0.0 (2010/09/01) 新規作成 | |
169 | + * | |
170 | +**/ | |
171 | +function addEvColCls() { | |
172 | + for( var evCol in colMap ) { | |
173 | + $("#"+evCol+",[id^="+evCol+"__]").addClass("h_evCol"); | |
174 | + } | |
175 | +} | |
176 | + | |
177 | +/** | |
178 | + * イベントカラムが設定されたタグ(spanタグ)を検索し、親カラムにイベントを登録します。 | |
179 | + * | |
180 | + * @og.rev 5.1.7.0 (2010/06/01) 新規作成(動的プルダウン実装見直し) | |
181 | + * | |
182 | + * @param evCol イベントが発生した親カラムのオブジェクト | |
183 | +**/ | |
184 | +function makeColumn( evCol ) { | |
185 | + var jEvCol , evColId , evColName , cColNameArr , i , suffix , cid , cname , jTag , writable ; | |
186 | + | |
187 | + if( jH_evElm && isEndInitEvent() ) { jH_evElm = null; } | |
188 | + | |
189 | + jEvCol = $( evCol ); | |
190 | + evColId = jEvCol.attr("id"); | |
191 | + evColName = evColId.split("__")[0]; | |
192 | + | |
193 | + cColNameArr = colMap[evColName]; | |
194 | + if( !cColNameArr ) { return; } | |
195 | + | |
196 | + // イベントカラムでカラム名の頭文字が'_'で始まっている場合、初回イベント発行を行わない。 | |
197 | + if( !isEndInitEvent() && notFireCols && notFireCols.indexOf( evColName ) >= 0 ) { return; } | |
198 | + | |
199 | + for( i=0; i<cColNameArr.length; i++ ) { | |
200 | + suffix = ( evColId == evColName ? "" : "__" + evColId.split("__")[1] ); | |
201 | + cid = cColNameArr[i]+suffix; | |
202 | + cname = cid.split("__")[0]; | |
203 | + jTag = isEndInitEvent() ? $( ".h_evElm[h_evCid="+cid+"]" ) : jH_evElm.filter( "[h_evCid="+cid+"]" ); | |
204 | + writable = jTag.attr("h_evWrtbl"); | |
205 | + eventColumn( jEvCol, jTag, cid, cname, suffix, writable ); | |
206 | + } | |
207 | +} | |
208 | + | |
209 | +/** | |
210 | + * Ajax動的カラム変更用の共通JavaScript | |
211 | + * | |
212 | + * カラムにeventColumnをセットした時に親側にID指定でChangeイベントとして登録されます。 | |
213 | + * ※イベント処理用のJSP用に送られるパラメーターに関しては、jsp/common/eventColumnMaker.jspの | |
214 | + * コメントを参照して下さい。 | |
215 | + * | |
216 | + * @og.rev 5.1.7.0 (2010/06/01) 動的プルダウン実装見直し | |
217 | + * @og.rev 5.5.4.0 (2012/07/02) suffixが存在すればSLABEL利用を標準にする。eventCallbackの動作追加 | |
218 | + * @og.rev 5.6.2.0 (2013/03/01) jQueryのval()がリセット後のプルダウンから取得できないのでvlaueで取る | |
219 | + * @og.rev 5.6.4.2 (2013/05/17) エラー表示の alertメッセージに、発生元が分かるように、 cname を追加します。 | |
220 | + * @og.rev 5.9.4.6 (2016/01/29) multiple対応 | |
221 | + * @og.rev 5.9.28.1 (2018/01/19) {@xxx}が存在しない場合でも処理が流れるように対応 | |
222 | + * @og.rev 5.10.4.0 (2018/10/05) eventColumnのparam暗号化対応 | |
223 | + * | |
224 | + * @param jEvCol イベントが発生した親カラムのjQueryオブジェクト | |
225 | + * @param jTag 置き換え要素をラップしたspanタグのjQueryオブジェクト | |
226 | + * @param cid 変更対象の子要素(inputタグなど)のID | |
227 | + * @param cname 子のカラム名 | |
228 | + * @param suffix __ + 行番号(一覧表示の場合のみ) | |
229 | + * @param writable 書き込み可能かどうか | |
230 | +**/ | |
231 | +function eventColumn( jEvCol, jTag, cid, cname, suffix, writable ){ | |
232 | + var evVal , url , param , _pos1 , _pos2 , _repClm, _rep, _clm , noVal , columnFocus , jCol , val , renderer , editor , ATTRS , optAttrs , i , optAtt , vtype , isAdd ; | |
233 | + var callback; // 5.5.4.0 (2012/07/02) | |
234 | + var keys, keysList, flgEncrypt; // 5.10.4.0 (2018/10/05) | |
235 | + var obj = {}; // 5.10.4.0 (2018/10/05) | |
236 | + | |
237 | + if( !jTag || jTag.length == 0 ) { | |
238 | +// alert( "[SYSTEM_ERROR] : イベントカラムで置き換え対象の要素が存在しません" ); | |
239 | + alert( "[SYSTEM_ERROR] : jTag is null. The element of the replacement object doesn't exist. [" + cname + "]" ); // 5.6.4.2 (2013/05/17) cname 追加 | |
240 | + return; | |
241 | + } | |
242 | + | |
243 | +// if( cid == null || cid == "" || cname == null || cname == "" ) { | |
244 | +// alert( "[SYSTEM_ERROR] : 子要素のIDまたはNAMEがセットされていません" ); | |
245 | +// return; | |
246 | +// } | |
247 | + | |
248 | + if( !isEndInitEvent() ) { | |
249 | +// evVal = jEvCol.val(); | |
250 | + evVal = jEvCol.get(0).value; //2013/03/01 | |
251 | + if( !evVal || evVal == null || evVal == "" ) { return; } | |
252 | + } | |
253 | + | |
254 | + try { | |
255 | + url = eval( "EC_" + cname + "_URL" ); | |
256 | + } | |
257 | + catch( e ) { | |
258 | +// alert( "[SYSTEM_ERROR] : イベントを処理するURLが指定されていません。(変数未定義)" ); | |
259 | + alert( "[SYSTEM_ERROR] : URL that processes the event is not specified. (variable undefinition). [" + cname + "]" ); // 5.6.4.2 (2013/05/17) cname 追加 | |
260 | + return; | |
261 | + } | |
262 | + if( !url || url == "" ) { | |
263 | +// alert( "[SYSTEM_ERROR] : イベントを処理するURLが指定されていません。" ); | |
264 | + alert( "[SYSTEM_ERROR] : URL that processes the event is not specified. [" + cname + "]" ); // 5.6.4.2 (2013/05/17) cname 追加 | |
265 | + return; | |
266 | + } | |
267 | + | |
268 | + // SQL文をパースして{@xxx}をxxxのvalue値に変更する。一覧での利用では同一行のカラムになる。 | |
269 | + //(リクエスト変数はテキストボックスやhiddenで一度受ける必要がある) | |
270 | + // 又、パースして得られたvalue値をJSPのリクエスト変数としてURLの後ろに付ける | |
271 | + // 5.9.28.1 なお、存在しない場合はnullで返すようにする。 | |
272 | + param = ""; | |
273 | + try { param = ( writable ? eval( "EC_" + cname + "_EDITPARAM" ) : eval( "EC_" + cname + "_RENDPARAM" ) ); } catch( e ) {} | |
274 | + | |
275 | + // 5.10.4.0 (2018/10/05) | |
276 | + try{ keys = ( writable ? eval( "EC_" + cname + "_EDITPARAMKEYS") : eval( "EC_" + cname + "_RENDPARAMKEYS" ) ); } catch( e ){} | |
277 | + flgEncrypt = eval( "EC_" + cname + "_FLGENCRYPT"); | |
278 | + | |
279 | + // sqlの暗号化が行われている場合(値の変換はajaxの受信側で行う) | |
280 | + if(flgEncrypt === 'true'){ | |
281 | + if(keys){ | |
282 | + keysList = keys.split(','); | |
283 | + for(var i = 0; i < keysList.length; i++){ | |
284 | + var key = keysList[i]; | |
285 | + var val = suffix == "" ? $('#' + key).get(0).value : $('#'+key+suffix).get(0).value; | |
286 | + obj[key] = val; | |
287 | + } | |
288 | + } | |
289 | + // sqlの暗号化が行われていない場合 | |
290 | + }else{ | |
291 | + if( param != null && param != "" ) { | |
292 | + url += "?"; | |
293 | + _pos1 = 0; | |
294 | + _pos2 = 0; | |
295 | + while( (_pos1 = param.indexOf("{@",_pos2)) != -1){ | |
296 | + _pos2 = param.indexOf("}",_pos1); | |
297 | + _clm = param.substring(_pos1+2,_pos2); | |
298 | + if( _clm.indexOf(".") < 0 ) { | |
299 | + _repClm = "{@"+_clm+"}"; | |
300 | + // _rep = suffix == "" ? $('#'+_clm).val() : $('#'+_clm+suffix).val(); | |
301 | + // _rep = suffix == "" ? $('#'+_clm).get(0).value : $('#'+_clm+suffix).get(0).value; // 2013/03/01 | |
302 | + var rtnNull = function(){ console.log("noDifined:"); console.log(arguments[0]); return null; }; | |
303 | + _rep = suffix == "" ? $('#'+_clm)[0] ? $('#'+_clm).get(0).value : rtnNull(_clm) | |
304 | + : $('#'+_clm+suffix)[0] ? $('#'+_clm+suffix).get(0).value : rtnNull(_clm+suffix); // 5.9.28.1 (2018/01/19) | |
305 | + _rep = ( _rep == null ? "" : _rep ); | |
306 | + param = param.replace(_repClm,_rep); | |
307 | + url += _clm + "=" + encodeURIComponent(_rep) +"&"; | |
308 | + } | |
309 | + _pos2 = _pos1+1; // 4.3.6.2 (2009/04/15) | |
310 | + } | |
311 | + } | |
312 | + } | |
313 | + | |
314 | + // 子がSelectタグの場合、最上部に空のoptionが存在すればEC_NOVALUEをtrueで送る | |
315 | + noVal = function(){ | |
316 | + _firstOption = jCol.children('option').get(0); | |
317 | + if( _firstOption == null || _firstOption.value != "" ){ return false; } | |
318 | + return true; | |
319 | + }; | |
320 | + | |
321 | + // 4.3.6.5 (2009/05/08) must,mustAnyを引数でJSPに送る。 | |
322 | +// var mustOrMustAny = function(){ | |
323 | +// var _haveClasses = jCol.attr("class"); | |
324 | +// if( _haveClasses && _haveClasses.indexOf("must") >= 0 ){ | |
325 | +// if( _haveClasses.indexOf("mustAny") >= 0 ) { return "mustAny"; } | |
326 | +// else { return "must"; } | |
327 | +// return ""; | |
328 | +// } | |
329 | +// } | |
330 | + | |
331 | + columnFocus = function() { | |
332 | + jCol.attr("isfocus","true"); | |
333 | + }; | |
334 | + | |
335 | +// var jCol; | |
336 | + if( cid != null && cid != "" ) { | |
337 | + jCol = jTag.find( "#"+cid ); | |
338 | + } | |
339 | + else { | |
340 | + jCol = new Array(0); | |
341 | + } | |
342 | + | |
343 | + if( jCol.length > 0 && isEndInitEvent() ) { | |
344 | + jCol.bind("focus",columnFocus); | |
345 | + } | |
346 | + | |
347 | + val = ""; | |
348 | + if( jCol.length > 0 ) { | |
349 | + if( isEndInitEvent() ) { val = ( jCol.val() == null ? "" : jCol.val() ); } | |
350 | + else { val = ( jTag.attr( "h_evVal" ) == null ? "" : jTag.attr( "h_evVal" ) ); } | |
351 | + } | |
352 | + | |
353 | + renderer = ""; | |
354 | + try { renderer = eval( "EC_" + cname + "_RENDERER" ); } catch( e ) {} | |
355 | + | |
356 | + editor = ""; | |
357 | + try { editor = eval( "EC_" + cname + "_EDITOR" ); } catch( e ) {} | |
358 | + | |
359 | + // 5.2.0.0 (2010/09/01) 属性値が正しく引き継がれないバグを修正 | |
360 | + ATTRS = [ "title", "style", "tabindex", "readonly", "disabled" | |
361 | + , "onClick", "onChange", "onBlur", "onFocus", "ondblClick", "onMouseDown", "onMouseUp" | |
362 | + , "onMouseMove", "onMouseOut", "onMouseOver", "onSelect", "onKeydown", "onKeypress", "onKeyup" | |
363 | + , "eventCallBack" // 5.5.4.0 (2012/07/02) | |
364 | + , "multiple" // 5.9.4.5 (2016/01/29) | |
365 | + ]; | |
366 | + optAttrs = ""; | |
367 | + if( jCol.length > 0 ) { | |
368 | + for( i=0; i<ATTRS.length; i++ ) { | |
369 | + optAtt = jCol.attr(ATTRS[i]); | |
370 | + if( optAtt != null ) { | |
371 | + vtype = typeof( optAtt ); | |
372 | + isAdd = false; | |
373 | + if( vtype == "function" ) { | |
374 | + optAtt = optAtt.toString(); | |
375 | + isAdd = optAtt.length > 0 ? true : false; | |
376 | + // 関数の場合は、文字列表現として"function anonymous(){...}"という関数定義が返るため、 | |
377 | + // ( FUNCTION )(); 形式で関数を実行するように変更 | |
378 | + optAtt = "(" + optAtt + ")()"; | |
379 | + } | |
380 | + else if( vtype == "boolean" ) { | |
381 | + isAdd = optAtt; | |
382 | + } | |
383 | + else { | |
384 | + isAdd = optAtt.length > 0 ? true : false; | |
385 | + } | |
386 | + | |
387 | + if( isAdd ) { | |
388 | + optAttrs += ATTRS[i] + "='" + optAtt + "' "; | |
389 | + } | |
390 | + } | |
391 | + } | |
392 | + } | |
393 | + | |
394 | + // 5.10.4.0 (2018/10/05) ADD objにEC_XXXの情報を設定する | |
395 | + obj.EC_CID = ( cid == null ? "" : cid ); | |
396 | + obj.EC_CNAME = ( cname == null ? "" : cname ); | |
397 | + obj.EC_RENDERER =renderer; | |
398 | + obj.EC_EDITOR = editor; | |
399 | + obj.EC_PARAM = param; | |
400 | + obj.EC_SQL = param; | |
401 | + obj.EC_WRITABLE = ( writable == null ? "" : writable ); | |
402 | + obj.EC_CVALUE = val; | |
403 | + obj.EC_NOVALUE = ( jCol.length == 0 ? "" : noVal() ); | |
404 | + obj.EC_CLASS = ( jCol.length == 0 ? "" : jCol.attr("class") ); | |
405 | + obj.EC_SIZE = ( jCol.length == 0 ? "" : jCol.attr("size") ); | |
406 | + obj.EC_MAXLENGTH = ( jCol.length == 0 ? "" : jCol.attr("maxlength") ); | |
407 | + obj.EC_OPTATTRS = optAttrs; | |
408 | + obj.EC_PNAME = jEvCol.attr("id") == null ? "" : jEvCol.attr("id").split("__")[0]; | |
409 | + obj.EC_PVALUE = jEvCol.get(0).value == null ? "" : jEvCol.get(0).value; // 5.6.2.0 (2013/03/01) | |
410 | + obj.EC_USESLBL = (suffix == null || suffix == "") ? "false" : "true"; // 5.5.4.0 (2012/07/02) | |
411 | + | |
412 | + // JSPを呼び出して処理する | |
413 | + // 5.10.4.0 (2018/10/05) MODIFY dataの渡す方法を変更 | |
414 | + $.ajax({ | |
415 | + url: url, | |
416 | +// data: { | |
417 | +// "EC_CID" : ( cid == null ? "" : cid ), | |
418 | +// "EC_CNAME" : ( cname == null ? "" : cname ), | |
419 | +// "EC_RENDERER" :renderer, | |
420 | +// "EC_EDITOR" : editor, | |
421 | +// "EC_PARAM" : param, | |
422 | +// "EC_SQL" : param, | |
423 | +// "EC_WRITABLE" : ( writable == null ? "" : writable ), | |
424 | +// "EC_CVALUE" : val, | |
425 | +// "EC_NOVALUE" : ( jCol.length == 0 ? "" : noVal() ), | |
426 | +//// "EC_MUST" : ( jCol.length == 0 ? "" : mustOrMustAny() ), | |
427 | +// "EC_CLASS" : ( jCol.length == 0 ? "" : jCol.attr("class") ), | |
428 | +// "EC_SIZE" : ( jCol.length == 0 ? "" : jCol.attr("size") ), | |
429 | +// "EC_MAXLENGTH" : ( jCol.length == 0 ? "" : jCol.attr("maxlength") ), | |
430 | +// "EC_OPTATTRS" : optAttrs, | |
431 | +// "EC_PNAME" : jEvCol.attr("id") == null ? "" : jEvCol.attr("id").split("__")[0], | |
432 | +//// "EC_PVALUE" : jEvCol.val() == null ? "" : jEvCol.val(), | |
433 | +// "EC_PVALUE" : jEvCol.get(0).value == null ? "" : jEvCol.get(0).value, // 5.6.2.0 (2013/03/01) | |
434 | +// "EC_USESLBL" : (suffix == null || suffix == "") ? "false" : "true" // 5.5.4.0 (2012/07/02) | |
435 | +// }, | |
436 | + data: obj, | |
437 | + type: 'POST', | |
438 | + dataType: 'html', | |
439 | + async : isEndInitEvent(), | |
440 | + error: function(r,s,e){ | |
441 | + // 5.6.4.2 (2013/05/17) 紙芝居作成時は、url が存在しないエラーが発生するので、無視する。(htm呼び出し時は無視) | |
442 | + if( url.indexOf( ".htm" ) < 0 ) { | |
443 | + alert('EventColumnError:'+r+':'+s+':'+e+':'+cname); | |
444 | + } | |
445 | + }, | |
446 | + success: function(data,status){ | |
447 | + var jNewCol = $(data); | |
448 | + | |
449 | + if( jCol.length > 0 ) { | |
450 | + if( isEndInitEvent() ) { | |
451 | + jCol.unbind("focus",columnFocus); | |
452 | + } | |
453 | + bindOldEvents( jNewCol.get(0), jQuery.data( jCol.clone(true).get(0),"events" ) ); | |
454 | + } | |
455 | + | |
456 | + jTag.empty().append( jNewCol ); | |
457 | + | |
458 | + if( jCol.length > 0 ) { | |
459 | + jTag.find("input,select,textarea").attr( "name", cid ).attr( "id", cid ); | |
460 | + | |
461 | + if( isEndInitEvent() ) { | |
462 | + // 置き換え先の要素にフォーカスが当たっていた場合は、フォーカスを復活 | |
463 | + if( jCol.attr("isfocus") ) { | |
464 | +// jNewCol.focus(); | |
465 | + jNewCol.get(0).focus(); | |
466 | + // IEの場合、置き換え先の要素がテキストボックスの場合は、もう1度フォーカスする必要がある。 | |
467 | + if( $.browser.msie ) { | |
468 | + jNewCol.get(0).focus(); | |
469 | + } | |
470 | + } | |
471 | + } | |
472 | + // 初回読み込み時に置き換えられた要素はchangeイベントを発行 | |
473 | + if( !isEndInitEvent() ) { | |
474 | + jNewCol.change(); | |
475 | + } | |
476 | + // 5.5.4.0 (2012/07/02) callBack処理 | |
477 | + // 置き換え先にeventCallback属性が存在した場合にevalして関数評価した上で、子idと値を引数に渡す。 | |
478 | + if( jCol.attr("eventCallback") ){ | |
479 | + callback = function(){ eval(jCol.attr("eventCallback") + "(arguments);") }; | |
480 | +// callback(cid,jNewCol.val(),jCol.val()); | |
481 | + callback(cid,jNewCol.val(),jCol.get(0).value); // 2013/03/01 | |
482 | + } | |
483 | + } | |
484 | + | |
485 | + // ヘッダー固定再計算 | |
486 | + if( suffix != null && suffix != "" ) { | |
487 | + if( isEndInitEvent() ) { | |
488 | + $('table#viewTable').resizeView(); | |
489 | + } | |
490 | + } | |
491 | + } | |
492 | + }); | |
493 | +} | |
494 | + | |
495 | +function bindOldEvents( newCol, oldEvents ) { | |
496 | + var type , handler ; | |
497 | + for ( type in oldEvents ) { | |
498 | + for ( handler in oldEvents[type] ) { | |
499 | + jQuery.event.add( newCol, type, oldEvents[type][handler], oldEvents[type][handler].data ); | |
500 | + } | |
501 | + } | |
502 | +} | |
503 | + | |
504 | +/********************************************************************************************/ | |
505 | +/* 旧 TimeCheck.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
506 | +/* */ | |
507 | +/* 入力欄の簡易チェック(リアルタイム) */ | |
508 | +/* DBTYPE に応じた簡易チェックを行います。あくまで簡易的なチェックです。 */ | |
509 | +/* 大文字小文字などは、JavaScriptで変換できる為、チェックは行いません。 */ | |
510 | +/* */ | |
511 | +/* @og.rev 4.3.3.0 (2008/10/01) サーバーサイドのリアルタイムチェック対応 */ | |
512 | +/* @og.rev 4.3.5.0 (2009/02/01) JavaScript分離(inputFocusより) */ | |
513 | +/* @og.rev 4.3.6.6 (2009/05/15) bodyに追加し、いつも上に表示 */ | |
514 | +/* @og.rev 5.2.0.0 (2010/09/01) ヘッダー固定でスクロールした場合は、エラーメッセージを消す。*/ | |
515 | +/* @og.rev 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる */ | |
516 | +/* @og.rev 5.2.1.0 (2010/10/01) h_ で始まる内部設定フィールドはチェックしない。 */ | |
517 | +/* @og.rev 5.3.7.0 (2011/07/01) 入力項目が上方にある場合は、下にチェックチップを表示する。 */ | |
518 | +/* @og.rev 5.4.4.0 (2012/02/01) rtOption対応 */ | |
519 | +/* @og.rev 5.9.0.0 (2015/09/04) ../common/*** の相対パスを絶対パスに変更(6.3.6.1) */ | |
520 | +/* @og.rev 5.9.32.2 (2018/05/18) :not(.noRealTime) | |
521 | +/* Revision: $Id$ */ | |
522 | +/********************************************************************************************/ | |
523 | +var isShowTip = false; | |
524 | + | |
525 | +$(function(){ | |
526 | + // 5.2.0.0 (2010/09/01) Javaスクリプトで登録したイベントを発動させる | |
527 | +// $('textarea,select,input[type="text"]').focusout( function(){ check( this, '../common/realtimecheck.jsp' ); } ); | |
528 | + if(USE_REAL_TIME_CHECK){ //5.4.5.0 flag add | |
529 | +// setEvent( "textarea,select,input[type=\"text\"]", "focusout", function(){ check( this, '../common/realtimecheck.jsp' ); } ); | |
530 | +// setEvent( "textarea,select,input[type=\"text\"]" , "focusout" , | |
531 | + // setEvent( "textarea:not(.noRealTime),select:not(.noRealTime),input[type=\"text\"]:not(.noRealTime)" , "focusout" , | |
532 | + setEvent( "textarea:not([realTimeChk=\"false\"]),select:not([realTimeChk=\"false\"]),input[type=\"text\"]:not([realTimeChk=\"false\"])" , "focusout" , | |
533 | + // 6.3.6.1 (2015/08/28) ../common/*** の相対パスを絶対パスに変更 | |
534 | +// function(){ check( this, '../common/realtimecheck.jsp' ); } ); | |
535 | + function(){ | |
536 | + var obj=RegExp( /jsp/ ); | |
537 | + var tmp = location.pathname.match( obj ); | |
538 | + // RegExp.leftContext : 最期に一致した文字列より前の文字列を取得(/gf/) | |
539 | + check( this, RegExp.leftContext + 'jsp/common/realtimecheck.jsp' ); | |
540 | + } ); | |
541 | + | |
542 | + // 5.2.0.0 (2010/09/01) ヘッダー固定でスクロールした場合は、エラーメッセージを消す。 | |
543 | + $('table#viewTable').parent().parent().scroll( function () { | |
544 | + if( isShowTip ) { isShowTip = false; $(".tipErr").remove(); } | |
545 | + }); | |
546 | + } | |
547 | +}); | |
548 | + | |
549 | +function check( obj, sUrl ) { | |
550 | + var sFullFN , val , arrFName , bTMCheck , sParam , ajaxSettings , tipId, rtoption ; | |
551 | + | |
552 | + sFullFN = obj.name; | |
553 | +// var cls = obj.className; | |
554 | +// var msg = null; | |
555 | + | |
556 | + if (typeof jQuery != "undefined" && sFullFN.indexOf( "h_" ) != 0 ) { | |
557 | + val = obj.value; | |
558 | + if( obj.rtOption != "null" && obj.rtOption != "undefined"){ | |
559 | + //rtoption = obj.rtOption; // 5.4.4.0 | |
560 | + rtoption = obj.getAttribute("rtOption"); // 5.9.24.2 | |
561 | + } | |
562 | + arrFName = sFullFN.split('__'); | |
563 | + bTMCheck = (2 == arrFName.length); | |
564 | +// var sParam = "command=RTCHECK&checkType=" + ( bTMCheck ? "ENTRY" : "NEW" ); | |
565 | + sParam = "command=RENEW&checkType=" + ( bTMCheck ? "ENTRY" : "NEW" ) // 4.3.4.0 (2008/12/01) | |
566 | + + ( bTMCheck ? "&h_rowSel=" + arrFName[1] : "" ) | |
567 | +// + "&column=" + arrFName[0] + "&" + sFullFN + "=" + val; | |
568 | +// + "&column=" + arrFName[0] + "&" + sFullFN + "=" + encodeURI( val ); // 4.3.4.0 (2008/12/01) | |
569 | + + "&column=" + arrFName[0] + "&" + sFullFN + "=" + encodeURIComponent( val ) // 5.2.0.0 (2010/09/01) | |
570 | + + (rtoption ? "&" + rtoption : ""); // 5.4.4.0 (2012/02/01) | |
571 | + ajaxSettings = { | |
572 | + dataType : 'html', | |
573 | + type : 'POST', | |
574 | + url : sUrl, | |
575 | + data : sParam | |
576 | + }; | |
577 | + | |
578 | + ajaxSettings.error = function() {}; | |
579 | + ajaxSettings.success = function(data) { | |
580 | + //Remove old msg | |
581 | +// var sOutId = getTipId(obj); | |
582 | +// $("#" + sOutId).remove(); | |
583 | + tipId = $(obj).data( "tipId" ); | |
584 | + $("#" + tipId).remove(); | |
585 | + | |
586 | + if( $.trim(data).indexOf("row_error") >= 0 ) { | |
587 | + showCheckTip( obj, data ); | |
588 | + isShowTip = true; | |
589 | + } | |
590 | + }; | |
591 | + $.ajax(ajaxSettings); | |
592 | + } | |
593 | + | |
594 | + return true; | |
595 | +} | |
596 | + | |
597 | +/* Revised From jTip Plug-in of jQuery */ | |
598 | +function showCheckTip( oEditOut, content ) { | |
599 | +// var jEditOut , hEditOffset , sJtDiv , jJtDiv , clickElementx , clickElementy , tipId ; | |
600 | + var jEditOut , hEditOffset , iTipOffset , sArrowId , sJtDiv , jJtDiv , clickElementx , clickElementy , tipId ; | |
601 | + | |
602 | + jEditOut = $(oEditOut); | |
603 | + hEditOffset = jEditOut.offset(); | |
604 | + | |
605 | + // 5.3.7.0 (2011/07/01) 上に表示する場合 | |
606 | + if( hEditOffset.top >= 30 ) { | |
607 | + sJtDiv = "<div class='tipErr'><div id='tipArrowBottom'></div><div>" + content + "</div></div>"; | |
608 | + jJtDiv = $(sJtDiv).appendTo(document.body); | |
609 | + //set x position | |
610 | + clickElementx = hEditOffset.left; | |
611 | + //set y position | |
612 | + clickElementy = hEditOffset.top + (-11 - jJtDiv[0].offsetHeight); | |
613 | + } | |
614 | + // 5.3.7.0 (2011/07/01) 下に表示する場合 | |
615 | + else { | |
616 | + sJtDiv = "<div class='tipErr'><div id='tipArrowTop'></div><div>" + content + "</div></div>"; | |
617 | + jJtDiv = $(sJtDiv).appendTo(document.body); | |
618 | + //set x position | |
619 | + clickElementx = hEditOffset.left; | |
620 | + //set y position | |
621 | + clickElementy = hEditOffset.top + 11 + jJtDiv[0].offsetHeight; | |
622 | + } | |
623 | + | |
624 | + tipId = (new Date()).getTime(); | |
625 | + $(oEditOut).data( "tipId", tipId ); | |
626 | + | |
627 | + jJtDiv.css( { left: clickElementx+"px", top: clickElementy+"px" } ) | |
628 | + .attr( 'id', tipId ) | |
629 | + .click( function() { $(this).remove(); } ) | |
630 | + .show(); | |
631 | +} | |
632 | + | |
633 | +//function getTipId(oEdit) { | |
634 | +// return "JT" + $.data(oEdit); | |
635 | +//} | |
636 | + | |
637 | +/********************************************************************************************/ | |
638 | +/* 旧 bindEvents.js の内容を移植 5.2.1.0 (2010/10/01) */ | |
639 | +/* */ | |
640 | +/* 各JavaScriptで登録されたイベント(主にカラムに割り当てられたイベント)を */ | |
641 | +/* 実際のイベントハンドラにバインドします。 */ | |
642 | +/* */ | |
643 | +/* @og.rev 5.2.0.0 (2010/09/01) 新規作成 */ | |
644 | +/* Revision: $Id$ */ | |
645 | +/********************************************************************************************/ | |
646 | +$(function(){ | |
647 | + bindEvents(); | |
648 | +}); | |
649 | + | |
650 | + | |
651 | +/********************************************************************************************/ | |
652 | +/* カラーピッカー 5.5.4.0 (2012/07/02) */ | |
653 | +/* */ | |
654 | +/* カラーピッカーです。 */ | |
655 | +/* input.colorPickerに対して実行させます */ | |
656 | +/* */ | |
657 | +/* @og.rev 5.5.4.0 (2012/07/02) 新規作成 */ | |
658 | +/* @og.rev 5.5.6.1 (2013/01/11) 名称変更(Og付加) */ | |
659 | +/* @og.rev 5.9.4.0 (2016/01/08) clear対応 */ | |
660 | +/* @og.rev 5.9.8.3 (2016/05/20) bulk対応 */ | |
661 | +/* Revision: $Id$ */ | |
662 | +/********************************************************************************************/ | |
663 | +$.fn.simpleColorPickerOg = function(options) { | |
664 | + var defaults = { | |
665 | + colorsPerLine: 8, | |
666 | + colors: ['#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#f3f3f3', '#ffffff' | |
667 | + , '#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#0000ff', '#9900ff', '#ff00ff' | |
668 | + , '#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d0e0e3', '#cfe2f3', '#d9d2e9', '#ead1dc' | |
669 | + , '#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#9fc5e8', '#b4a7d6', '#d5a6bd' | |
670 | + , '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6fa8dc', '#8e7cc3', '#c27ba0' | |
671 | + , '#cc0000', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3d85c6', '#674ea7', '#a64d79' | |
672 | + , '#990000', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#0b5394', '#351c75', '#741b47' | |
673 | + , '#660000', '#783f04', '#7f6000', '#274e13', '#0c343d', '#073763', '#20124d', '#4C1130'], | |
674 | + showEffect: '', | |
675 | + hideEffect: '', | |
676 | + onChangeColor: false | |
677 | + }; | |
678 | + | |
679 | + var opts = $.extend(defaults, options); | |
680 | + | |
681 | + return this.each(function() { | |
682 | + var txt = $(this); | |
683 | + | |
684 | + var colorsMarkup = ''; | |
685 | + | |
686 | + var prefix = txt.attr('id').replace(/-/g, '') + '_'; | |
687 | + | |
688 | + for(var i = 0; i < opts.colors.length; i++){ | |
689 | + var item = opts.colors[i]; | |
690 | + | |
691 | + var breakLine = ''; | |
692 | + if (i % opts.colorsPerLine == 0) | |
693 | + breakLine = 'clear: both; '; | |
694 | + | |
695 | + if (i > 0 && breakLine && $.browser && $.browser.msie && $.browser.version <= 7) { | |
696 | + breakLine = ''; | |
697 | + colorsMarkup += '<li style="float: none; clear: both; overflow: hidden; background-color: #fff; display: block; height: 1px; line-height: 1px; font-size: 1px; margin-bottom: -2px;"></li>'; | |
698 | + } | |
699 | + | |
700 | + colorsMarkup += '<li id="' + prefix + 'color-' + i + '" class="color-box" style="' + breakLine + 'background-color: ' + item + '" title="' + item + '"></li>'; | |
701 | + } | |
702 | + breakLine = 'clear: both; '; | |
703 | + // 5.9.4.0 clear | |
704 | + colorsMarkup += '<li id="' + prefix + 'color-default' + '" class="color-box" style="width:80px; text-align:center; ' + breakLine + 'background-color:white;" title="clear">clear</li>'; | |
705 | + | |
706 | + | |
707 | + var box = $('<div id="' + prefix + 'color-picker" class="color-picker" style="position: absolute; left: 0px; top: 0px;"><ul>' + colorsMarkup + '</ul><div style="clear: both;"></div></div>'); | |
708 | + | |
709 | + $('body').append(box); | |
710 | + box.hide(); | |
711 | + | |
712 | + box.find('li.color-box').click(function() { | |
713 | + var sel_val = isNaN(this.id.substr(this.id.indexOf('-') + 1)) ? "": opts.colors[this.id.substr(this.id.indexOf('-') + 1)]; // 5.9.4.0 | |
714 | + | |
715 | + if (!txt.is('input')) { | |
716 | +// txt.val(opts.colors[this.id.substr(this.id.indexOf('-') + 1)]); | |
717 | + txt.val(sel_val); | |
718 | + txt.blur(); | |
719 | + } | |
720 | + if ($.isFunction(defaults.onChangeColor)) { | |
721 | +// defaults.onChangeColor.call(txt, opts.colors[this.id.substr(this.id.indexOf('-') + 1)]); | |
722 | + defaults.onChangeColor.call(txt, sel_val); | |
723 | + } | |
724 | + hideBox(box); | |
725 | + }); | |
726 | + | |
727 | + $('body').live('click', function() { | |
728 | + hideBox(box); | |
729 | + }); | |
730 | + | |
731 | + box.click(function(event) { | |
732 | + event.stopPropagation(); | |
733 | + }); | |
734 | + | |
735 | + var positionAndShowBox = function(box) { | |
736 | + var pos = txt.offset(); | |
737 | + var left = pos.left + txt.outerWidth() - box.outerWidth(); | |
738 | + if (left < pos.left) left = pos.left; | |
739 | + box.css({ left: left, top: (pos.top + txt.outerHeight()) }); | |
740 | + showBox(box); | |
741 | + } | |
742 | + | |
743 | + txt.click(function(event) { | |
744 | + txt = $(this); // 5.9.8.3 (2016/05/20) クリックした際にthisを再セットする(Bulk対応) | |
745 | + event.stopPropagation(); | |
746 | + if (!txt.is('input')) { | |
747 | + // element is not an input so probably a link or div which requires the color box to be shown | |
748 | + positionAndShowBox(box); | |
749 | + } | |
750 | + }); | |
751 | + | |
752 | + // 5.9.8.3 (2016/05/20) 外部から変更された場合に、色を変更する。 | |
753 | + txt.change( function(event){ | |
754 | + if( txt.val() != txt.css('background-color')){ | |
755 | + txt.css('background-color', txt.val()) .css('color',txt.val()); | |
756 | + } | |
757 | + }); | |
758 | + | |
759 | + txt.focus(function() { | |
760 | + positionAndShowBox(box); | |
761 | + }); | |
762 | + | |
763 | + function hideBox(box) { | |
764 | + if (opts.hideEffect == 'fade') | |
765 | + box.fadeOut(); | |
766 | + else if (opts.hideEffect == 'slide') | |
767 | + box.slideUp(); | |
768 | + else | |
769 | + box.hide(); | |
770 | + } | |
771 | + | |
772 | + function showBox(box) { | |
773 | + if (opts.showEffect == 'fade') | |
774 | + box.fadeIn(); | |
775 | + else if (opts.showEffect == 'slide') | |
776 | + box.slideDown(); | |
777 | + else | |
778 | + box.show(); | |
779 | + } | |
780 | + }); | |
781 | +}; | |
782 | + | |
783 | +// カラーピッカーの対象はinput.colorPicker | |
784 | +$(function(){ | |
785 | + // 5.5.6.1 (2013/01/11) jQueryの上書き時エラー対策にif文挿入(上書きされると動作しない) | |
786 | + // 5.9.4.0 (2016/01/08) backgroundではなくbackground-colorにする | |
787 | + // 5.9.8.3 (2016/05/20) change追加 | |
788 | + if($.fn.simpleColorPickerOg){ | |
789 | +// $('input.colorPicker').simpleColorPickerOg({ onChangeColor: function(color) { $(this).val(color).css('background-color', color) .css('color',color); } }); | |
790 | + $('input.colorPicker').simpleColorPickerOg({ onChangeColor: function(color) { $(this).val(color).css('background-color', color) .css('color',color).change(); } }); | |
791 | + } | |
792 | +}); | |
793 | + | |
794 | +/******************************************************************************************** | |
795 | +時間ピッカー 5.6.5.2 (2013/06/21) | |
796 | +ClockPick, by Josh Nathanson | |
797 | +Version 1.2.9 and Masakazu Takahasi Modified | |
798 | +Complete documentation at http://www.jnathanson.com/index.cfm?page=jquery/clockpick/ClockPick | |
799 | + | |
800 | +以下を、対象タグの属性値から取得可能なように改造 | |
801 | +param options[starthour] int starting hour (use military int) | |
802 | +param options[endhour] int ending hour (use military int) | |
803 | +param options[minutedivisions] int number of divisions, i.e. 4 = :00, :15, :30, :45 | |
804 | +param options[military] string use 24hr time if true(true/false) | |
805 | +param options[valuefield] string field to insert time value, if not same as click field(name of input field) | |
806 | +param options[showminutes] bool show minutes | |
807 | +param options[second] bool add second(00) //5.9.12.3 | |
808 | +param options[layout] string vertical or horizon //5.9.17.2 | |
809 | + | |
810 | +又、対象単位に設定値を持てるように対応。 | |
811 | +@og.rev 5.9.8.3 (2016/05/20) 標準をAMPMではなく24時間表記に変更、ピッカー選択時にchangeイベント発生させる | |
812 | +@og.rev 5.9.12.3 (2015/09/23) 返す値に秒(00固定)を追加出来るようにする(useSecond) | |
813 | +@og.rev 5.9.15.1 (2016/12/09) 数値変換不具合対応 | |
814 | +@og.rev 5.9.17.2 (2017/02/15) layout指定追加 | |
815 | +@og.rev 5.9.**.* (2017/12/19) 選択時間を幅広く取れるように変更、及び方向キー対応 | |
816 | +********************************************************************************************/ | |
817 | + | |
818 | +jQuery.fn.ogClockpicker = function(options, callback) { | |
819 | + // 5.9.12.3 (2016/09/23) | |
820 | + var org_settings = { | |
821 | + starthour : 6, | |
822 | + endhour : 20, | |
823 | + showminutes : "true", | |
824 | + minutedivisions : 4, | |
825 | + military : true, | |
826 | + event : 'click', | |
827 | + layout : 'vertical', | |
828 | + valuefield : null, | |
829 | + useBgiframe : false, | |
830 | + hoursopacity : 1, | |
831 | + minutesopacity : 1, | |
832 | + second : "" | |
833 | + }; | |
834 | + | |
835 | + if(options) { | |
836 | + jQuery.extend(org_settings, options); | |
837 | + }; | |
838 | + | |
839 | + var callback = callback || function() { }, | |
840 | + v = (org_settings.layout == 'vertical'); // boolean for vertical, shorten footprint | |
841 | + errorcheck(org_settings); | |
842 | + | |
843 | + | |
844 | + jQuery(this)[org_settings.event](function(e) { | |
845 | + var self = this, | |
846 | + $self = jQuery( this ), | |
847 | + $body = jQuery( "body" ); | |
848 | + var settings = jQuery.extend(true,{},org_settings); // OpenGion deep copy | |
849 | + | |
850 | + // OpenGion 属性対応 | |
851 | + if( $self.attr('valuefield') ){ | |
852 | + settings.valuefield = $self.attr('valuefield'); | |
853 | + } | |
854 | + if( $self.attr('starthour') ){ | |
855 | + //settings.starthour = $self.attr('starthour'); | |
856 | + settings.starthour = parseInt($self.attr('starthour')); // 5.9.15.1 (2016/12/09) | |
857 | + } | |
858 | + if( $self.attr('endhour') ){ | |
859 | + //settings.endhour = $self.attr('endhour'); | |
860 | + settings.endhour = parseInt($self.attr('endhour')); // 5.9.15.1 (2016/12/09) | |
861 | + } | |
862 | + if( $self.attr('minutedivisions') ){ | |
863 | + // settings.minutedivisions = $self.attr('minutedivisions'); | |
864 | + settings.minutedivisions = parseInt($self.attr('minutedivisions')); | |
865 | + } | |
866 | + if( $self.attr('military') ){ | |
867 | + settings.military = $self.attr('military'); | |
868 | + } | |
869 | + if( $self.attr('showminutes') ){ | |
870 | + settings.showminutes = $self.attr('showminutes'); | |
871 | + } | |
872 | + if( $self.attr('usesecond') == "true" ){ // 5.9.12.3 (2016/09/23) | |
873 | + settings.second = "00"; | |
874 | + } | |
875 | + if( $self.attr('layout') ){ // 5.9.17.2 (2017/02/17) | |
876 | + settings.layout = $self.attr('layout'); | |
877 | + org_settings.layout = settings.layout; // overwrite | |
878 | + v = (settings.layout == 'vertical'); | |
879 | + } | |
880 | + | |
881 | + errorcheck(settings); | |
882 | + | |
883 | + | |
884 | + | |
885 | + if ( !settings.valuefield ) { | |
886 | + $self.unbind( "keydown" ).bind( "keydown", keyhandler ); | |
887 | + | |
888 | + } | |
889 | + else { | |
890 | + var inputfield = jQuery("[name=" + settings.valuefield + "]"); | |
891 | + inputfield | |
892 | + .unbind( "keydown" ) | |
893 | + .bind( "keydown", keyhandler)[0] | |
894 | + .focus(); | |
895 | + inputfield | |
896 | + .bind("click", function() { inputfield.unbind("keydown"); } ); | |
897 | + } | |
898 | + // clear any malingerers | |
899 | + jQuery("#CP_hourcont,#CP_minutecont").remove(); | |
900 | + | |
901 | + // append hourcont to body | |
902 | + // add class "CP" for mouseout recognition, although there is only | |
903 | + // one hourcont on the screen at a time | |
904 | + var $hourcont = jQuery("<div id='CP_hourcont' class='CP' />").appendTo( $body ); | |
905 | + !settings.useBgiframe ? $hourcont.css("opacity",settings.hoursopacity) : null; | |
906 | + binder( $hourcont ); | |
907 | + | |
908 | + //多数に対応させるため配列に代入 5.9.27.3 (2017/12/22) | |
909 | + var $hourcol = []; | |
910 | + for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){ | |
911 | + $hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo( $body )); | |
912 | + } | |
913 | + | |
914 | + // if showminutes, append minutes cont to body | |
915 | + | |
916 | + if (settings.showminutes == "true") { | |
917 | + var $mc = jQuery("<div id='CP_minutecont' class='CP' />").appendTo( $body ); | |
918 | + !settings.useBgiframe ? $mc.css("opacity",settings.minutesopacity) : null; | |
919 | + binder($mc); | |
920 | + } | |
921 | + if ( !v ) { | |
922 | + $hourcont.css("width","auto"); | |
923 | + if (settings.showminutes == "true") { | |
924 | + $mc.css("width","auto"); | |
925 | + } | |
926 | + } | |
927 | + else { | |
928 | + for (i=0;i<$hourcol.length;i++){ | |
929 | + $hourcol[i].addClass('floatleft'); | |
930 | + } | |
931 | + } | |
932 | + | |
933 | + // all the action right here | |
934 | + // fill in the hours container (minutes rendered in hour mouseover) | |
935 | + // then make hour container visible | |
936 | + renderhours(); | |
937 | + putcontainer(); | |
938 | + | |
939 | + /*----------------------helper functions below-------------------------*/ | |
940 | + | |
941 | + function renderhours() { | |
942 | + // fill in the $hourcont div | |
943 | + var c = 1; | |
944 | + var numberC = 0; | |
945 | + // counter as index 2 of hr id, gives us index | |
946 | + // in group of hourdivs for calculating where to put minutecont on keydown | |
947 | + for (var h=settings.starthour; h<=settings.endhour; h++) { | |
948 | + | |
949 | + if(h%12==0) { c = 1; } // reset counter for col 2 | |
950 | + | |
951 | + var displayhours = ((!settings.military && h > 12) ? h - 12 : h); | |
952 | + var valuehouers = h; // opengion | |
953 | + // rectify zero hour | |
954 | + if (!settings.military && h == 0) { | |
955 | + //displayhours = '12'; // 日本向けに0時で表示 | |
956 | + } | |
957 | + else if (!settings.military && h == 12) { | |
958 | + displayhours = '0'; // 日本向けに0時で表示 | |
959 | + } | |
960 | + if ( settings.military && h < 10 ) { | |
961 | + displayhours = '0' + displayhours; | |
962 | + } | |
963 | + if ( h < 10 ){ | |
964 | + valuehouers = '0'+valuehouers; | |
965 | + } | |
966 | + | |
967 | + var $hd = jQuery("<div class='CP_hour' id='hr_" + h + "_" + c + "' " + "value='" +valuehouers+ "' >" + displayhours + set_tt(h) + "</div>"); | |
968 | + // shrink width a bit if military | |
969 | + if (settings.military) { $hd.width(20); } | |
970 | + binder($hd); | |
971 | + if (!v) { | |
972 | + $hd.css("float","left"); | |
973 | + } | |
974 | + $hourcol[numberC].append($hd); | |
975 | + if((h+1)%12==0){ | |
976 | + numberC++; | |
977 | + } | |
978 | + c++; | |
979 | + } | |
980 | + | |
981 | + // 5.9.27.3 (2017/12/22) | |
982 | + for(var j=0; j<$hourcol.length;j++){ | |
983 | + if(v){ | |
984 | + if(j!=0&&j%2==0){ | |
985 | + $hourcol[j].css("margin-left",$mc.width()+4 + 'px'); | |
986 | + } | |
987 | + }else{ | |
988 | + $hourcont.append("<div style='clear:left' />"); | |
989 | + if(j!=0&&j%2==0){ | |
990 | + //$mc.height()が0になってまう?? | |
991 | + $hourcol[j].css("margin-top","19px"); | |
992 | + } | |
993 | + } | |
994 | + $hourcont.append($hourcol[j]); | |
995 | + } | |
996 | + | |
997 | + } | |
998 | + | |
999 | + function renderminutes( h ) { | |
1000 | + var realhours = h; | |
1001 | + var displayhours = (!settings.military && h > 12) ? h - 12 : h; | |
1002 | + var valuehouers = h; // opengion | |
1003 | + if (!settings.military && h == 0) { | |
1004 | + //displayhours = '12'; // 日本向けに0時で表示 | |
1005 | + } | |
1006 | + else if (!settings.military && h == 12) { | |
1007 | + displayhours = '0'; // 日本向けに0時で表示 | |
1008 | + } | |
1009 | + if ( settings.military && h < 10 ) { | |
1010 | + displayhours = '0' + displayhours; | |
1011 | + } | |
1012 | + if ( h < 10 ){ | |
1013 | + valuehouers = '0'+valuehouers; | |
1014 | + } | |
1015 | + | |
1016 | + $mc.empty(); | |
1017 | + var n = 60 / settings.minutedivisions, | |
1018 | + tt = set_tt(realhours), | |
1019 | + counter = 1; | |
1020 | + | |
1021 | + for(var m=0;m<60;m=m+n) { | |
1022 | + $md = jQuery("<div class='CP_minute' id='" + realhours + "_" + m + "' value='" + valuehouers + ((m<10) ? "0" : "") + m +"'>" | |
1023 | + + displayhours + ":" + ((m<10) ? "0" : "") + m + tt | |
1024 | + + "</div>"); | |
1025 | + if ( !v ) { | |
1026 | + $md.css("float","left"); | |
1027 | + if (settings.minutedivisions > 6 | |
1028 | + && counter == settings.minutedivisions / 2 + 1) { | |
1029 | + // long horizontal, kick in extra row after half | |
1030 | + $mc.append("<div style='clear:left' />"); | |
1031 | + } | |
1032 | + } | |
1033 | + $mc.append($md); | |
1034 | + binder($md); | |
1035 | + counter++; | |
1036 | + } | |
1037 | + } | |
1038 | + | |
1039 | + function set_tt(realhours) { | |
1040 | + if (!settings.military) { | |
1041 | + return (realhours >= 12) ? ' PM' : ' AM'; | |
1042 | + } | |
1043 | + else { | |
1044 | + return ''; | |
1045 | + } | |
1046 | + } | |
1047 | + | |
1048 | + function putcontainer() { | |
1049 | + if ( e.type != 'focus') { | |
1050 | + $hourcont[0].style.left = e.pageX - 5 + 'px'; | |
1051 | + $hourcont[0].style.top = e.pageY - (Math.floor($hourcont.height() / 2)) + 'px'; | |
1052 | + rectify($hourcont); | |
1053 | + } | |
1054 | + else { | |
1055 | + $self.after($hourcont); | |
1056 | + } | |
1057 | + $hourcont.slideDown('fast'); | |
1058 | + | |
1059 | + if ( settings.useBgiframe ) | |
1060 | + bgi( $hourcont ); | |
1061 | + } | |
1062 | + | |
1063 | + function rectify($obj) { | |
1064 | + // if a div is off the screen, move it accordingly | |
1065 | + var ph = document.documentElement.clientHeight | |
1066 | + ? document.documentElement.clientHeight | |
1067 | + : document.body.clientHeight; | |
1068 | + var pw = document.documentElement.clientWidth | |
1069 | + ? document.documentElement.clientWidth | |
1070 | + : document.body.clientWidth; | |
1071 | + var t = parseInt( $obj[0].style.top ); | |
1072 | + var l = parseInt( $obj[0].style.left ); | |
1073 | + var st = document.documentElement.scrollTop | |
1074 | + ? document.documentElement.scrollTop | |
1075 | + : document.body.scrollTop; | |
1076 | + // run off top | |
1077 | + if ( t <= st && !$obj.is("#CP_minutecont") ) { | |
1078 | + $obj.css("top",st+10+'px'); | |
1079 | + } | |
1080 | + else if (t + $obj.height() - st > ph) { | |
1081 | + $obj.css("top",st + ph - $obj.height() - 10 + 'px'); | |
1082 | + } | |
1083 | + if ( l <= 0 ) { | |
1084 | + $obj.css("left", '10px'); | |
1085 | + } | |
1086 | + } | |
1087 | + | |
1088 | + function bgi( ob ) { | |
1089 | + if ( typeof jQuery.fn.bgIframe == 'function' ) | |
1090 | + ob.bgIframe(); | |
1091 | + else | |
1092 | + alert('bgIframe plugin not loaded.'); | |
1093 | + } | |
1094 | + | |
1095 | + function binder($obj) { | |
1096 | + // all the binding is done here | |
1097 | + // event handlers have been abstracted out, | |
1098 | + // so they can handle mouse or key events | |
1099 | + | |
1100 | + // bindings for hc (hours container) | |
1101 | + if($obj.attr("id") == 'CP_hourcont') { | |
1102 | + $obj.mouseout(function(e) { hourcont_out(e) }); | |
1103 | + } | |
1104 | + | |
1105 | + // bindings for mc (minute container) | |
1106 | + else if ($obj.attr("id") == 'CP_minutecont') { | |
1107 | + $obj.mouseout(function(e) { minutecont_out(e) }); | |
1108 | + } | |
1109 | + | |
1110 | + // bindings for $hd (hour divs) | |
1111 | + else if ($obj.attr("class") == 'CP_hour') { | |
1112 | + $obj.mouseover(function(e) { hourdiv_over($obj, e) }); | |
1113 | + $obj.mouseout(function() { hourdiv_out($obj) }); | |
1114 | + $obj.click(function() { hourdiv_click($obj) }); | |
1115 | + } | |
1116 | + | |
1117 | + // bindings for $md (minute divs) | |
1118 | + else if ($obj.attr("class") == 'CP_minute') { | |
1119 | + $obj.mouseover(function() { minutediv_over($obj) }); | |
1120 | + $obj.mouseout(function() { minutediv_out($obj) }); | |
1121 | + $obj.click(function() { minutediv_click($obj) }); | |
1122 | + } | |
1123 | + }; | |
1124 | + | |
1125 | + function hourcont_out(e) { | |
1126 | + /* | |
1127 | + this tells divs to clear only if rolling all the way | |
1128 | + out of hourcont. | |
1129 | + relatedTarget "looks ahead" to see where the mouse | |
1130 | + has moved to on mouseOut. | |
1131 | + IE uses the more sensible "toElement". | |
1132 | + try/catch for Mozilla bug on relatedTarget-input field. | |
1133 | + */ | |
1134 | + try { | |
1135 | + var t = (e.toElement) ? e.toElement : e.relatedTarget; | |
1136 | + if (!(jQuery(t).is("div[class^=CP], iframe"))) { | |
1137 | + // Safari incorrect mouseover/mouseout | |
1138 | + //if (!jQuery.browser.safari) { | |
1139 | + cleardivs(); | |
1140 | + //} | |
1141 | + } | |
1142 | + } | |
1143 | + catch(e) { | |
1144 | + cleardivs(); | |
1145 | + } | |
1146 | + } | |
1147 | + | |
1148 | + function minutecont_out(e) { | |
1149 | + try { | |
1150 | + var t = (e.toElement) ? e.toElement : e.relatedTarget; | |
1151 | + if (!(jQuery(t).is("div[class^=CP], iframe"))) { | |
1152 | + cleardivs(); | |
1153 | + } | |
1154 | + } | |
1155 | + catch(e) { | |
1156 | + cleardivs(); | |
1157 | + } | |
1158 | + } | |
1159 | + | |
1160 | + function hourdiv_over($obj, e) { | |
1161 | + var h = $obj.attr("id").split('_')[1], | |
1162 | + i = $obj.attr("id").split('_')[2], | |
1163 | + l, | |
1164 | + t, | |
1165 | + nn; | |
1166 | + $obj.addClass("CP_over"); | |
1167 | + | |
1168 | + //何個目の要素を見ているか計算して、分表示を配置するための独立変数nnを算出 5.9.27.3 (2017/12/22) | |
1169 | + nn = Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2); | |
1170 | + | |
1171 | + if ( settings.showminutes == "true") { | |
1172 | + $mc.hide(); | |
1173 | + renderminutes(h); | |
1174 | + // set position & show minutes container | |
1175 | + if (v) { | |
1176 | + t = e.type == 'mouseover' | |
1177 | + ? e.pageY - 15 | |
1178 | + : $hourcont.offset().top + 2 + ($obj.height() * i); | |
1179 | + l = $hourcont.offset().left + $hourcol[0].width()*2*nn + $mc.width()*(nn-1) + 4*nn-2; // 5.9.27.3 (2017/12/22) | |
1180 | + } | |
1181 | + else { | |
1182 | + l = (e.type == 'mouseover') | |
1183 | + ? e.pageX - 10 | |
1184 | + : $hourcont.offset().left + ($obj.width()-5) * i; | |
1185 | + //$hourcol[0].height()は出ないため全体から各要素を引いて導出 | |
1186 | + t = $hourcont.offset().top + ($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn + $mc.height()*(nn-1) + 2*nn-1; // (2017/12/19) | |
1187 | + } | |
1188 | + $mc.css("left",l+'px').css("top",t+'px'); | |
1189 | + rectify( $mc ); | |
1190 | + $mc.show(); | |
1191 | + | |
1192 | + if ( settings.useBgiframe ) | |
1193 | + bgi( $mc ); | |
1194 | + } | |
1195 | + return false; | |
1196 | + } | |
1197 | + | |
1198 | + | |
1199 | + | |
1200 | + function hourdiv_out($obj) { | |
1201 | + $obj.removeClass("CP_over"); | |
1202 | + return false; | |
1203 | + } | |
1204 | + | |
1205 | + function hourdiv_click($obj) { | |
1206 | + var h = $obj.attr("id").split('_')[1], | |
1207 | + tt = set_tt(h), | |
1208 | + str = $obj.attr('value'); | |
1209 | + if(str.indexOf(' ') != -1) { | |
1210 | + var cleanstr = str.substring(0,str.indexOf(' ')); | |
1211 | + } | |
1212 | + else { | |
1213 | + var cleanstr = str; | |
1214 | + } | |
1215 | + | |
1216 | + | |
1217 | + //$obj.text(cleanstr + ':00' + tt); | |
1218 | + //$obj.text(cleanstr + '00'); | |
1219 | + $obj.text(cleanstr + '00' + settings.second ); // 5.9.12.3 (2016/09/23) | |
1220 | + setval($obj); | |
1221 | + cleardivs(); | |
1222 | + } | |
1223 | + | |
1224 | + function minutediv_over($obj) { | |
1225 | + $obj.addClass("CP_over"); | |
1226 | + return false; | |
1227 | + } | |
1228 | + | |
1229 | + function minutediv_out($obj) { | |
1230 | + $obj.removeClass("CP_over"); | |
1231 | + return false; | |
1232 | + } | |
1233 | + | |
1234 | + function minutediv_click($obj) { | |
1235 | + //$obj.text( $obj.attr('value')); | |
1236 | + $obj.text( $obj.attr('value') + settings.second); // 5.9.12.3 (2016/09/23) | |
1237 | + setval($obj); | |
1238 | + cleardivs(); | |
1239 | + } | |
1240 | + | |
1241 | + function setval($obj) { // takes either hour or minute obj | |
1242 | + if(!settings.valuefield) { | |
1243 | + self.value = $obj.text(); | |
1244 | + } | |
1245 | + else { | |
1246 | + //jQuery("input[name=" + settings.valuefield + "]").val($obj.text()); | |
1247 | + jQuery("input[name=" + settings.valuefield + "]").val($obj.text()).change(); // 5.9.8.3 (2016/05/17) | |
1248 | + } | |
1249 | + callback.apply( $self, [ $obj.text() ]); | |
1250 | + // unbind keydown handler, otherwise it will double-bind if | |
1251 | + // field is activated more than once | |
1252 | + $self.unbind( "keydown", keyhandler ); | |
1253 | + } | |
1254 | + | |
1255 | + function cleardivs() { | |
1256 | + if ( settings.showminutes == "true") { | |
1257 | + $mc.hide(); | |
1258 | + } | |
1259 | + $hourcont.slideUp('fast'); | |
1260 | + $self.unbind( "keydown", keyhandler ); | |
1261 | + } | |
1262 | + | |
1263 | + // keyboard handling | |
1264 | + | |
1265 | + function keyhandler( e ) { | |
1266 | + | |
1267 | + // $obj is current active div | |
1268 | + var $obj = $("div.CP_over").size() ? $("div.CP_over") : $("div.CP_hour:first"), | |
1269 | + divtype = $obj.is(".CP_hour") ? 'hour' : 'minute', | |
1270 | + hi = (divtype == 'hour') ? $obj[0].id.split('_')[2] : 0, // hour index | |
1271 | + h = (divtype == 'minute') ? $obj[0].id.split('_')[0] : $obj[0].id.split('_')[1]; // real hour | |
1272 | + // 5.9.27.3 (2017/12/22) | |
1273 | + if (divtype == 'minute') { | |
1274 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){ | |
1275 | + var curloc = 'm1'; | |
1276 | + }else if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){ | |
1277 | + var curloc = 'm2'; | |
1278 | + }else{ | |
1279 | + var curloc = 'm3'; | |
1280 | + } | |
1281 | + }else{ | |
1282 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1283 | + var curloc = 'h1'; | |
1284 | + }else{ | |
1285 | + var curloc = 'h2'; | |
1286 | + } | |
1287 | + } | |
1288 | + function divprev($obj) { | |
1289 | + if ($obj.prev().size()) { | |
1290 | + eval(divtype + 'div_out($obj)'); | |
1291 | + eval(divtype + 'div_over($obj.prev(), e)'); | |
1292 | + } | |
1293 | + else { return false; } | |
1294 | + } | |
1295 | + | |
1296 | + function divnext($obj) { | |
1297 | + if ($obj.next().size()) { | |
1298 | + eval(divtype + 'div_out($obj)'); | |
1299 | + eval(divtype + 'div_over($obj.next(), e)'); | |
1300 | + } | |
1301 | + else { return false; } | |
1302 | + } | |
1303 | + | |
1304 | + function hourtohour($obj) { | |
1305 | + // 5.9.27.3 (2017/12/22) | |
1306 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1307 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1); | |
1308 | + }else{ | |
1309 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1); | |
1310 | + } | |
1311 | + var ctx = '#hourcol'+next; | |
1312 | + $newobj = jQuery(".CP_hour[id$=_" + hi + "]", ctx ); | |
1313 | + if ($newobj.size()) { | |
1314 | + hourdiv_out($obj); | |
1315 | + hourdiv_over($newobj, e); | |
1316 | + } | |
1317 | + else { return false; } | |
1318 | + } | |
1319 | + | |
1320 | + function hourtominute($obj) { | |
1321 | + hourdiv_out($obj); | |
1322 | + minutediv_over($(".CP_minute:first")); | |
1323 | + } | |
1324 | + | |
1325 | + function minutetohour($obj,where) { | |
1326 | + minutediv_out($obj); | |
1327 | + // 5.9.27.3 (2017/12/22) | |
1328 | + if(where<0){ | |
1329 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1330 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where); | |
1331 | + h = String(Number(h)-12); | |
1332 | + }else{ | |
1333 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))); | |
1334 | + } | |
1335 | + }else{ | |
1336 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1337 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))); | |
1338 | + }else{ | |
1339 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where); | |
1340 | + h = String(Number(h)+12); | |
1341 | + } | |
1342 | + } | |
1343 | + var ctx = '#hourcol'+next; | |
1344 | + var $newobj = jQuery(".CP_hour[id^=hr_" + h + "]", ctx); | |
1345 | + // extract hour from minutediv, then find hourdiv with that hour | |
1346 | + hourdiv_over($newobj, e); | |
1347 | + } | |
1348 | + | |
1349 | + switch (e.keyCode) { | |
1350 | + case 37: // left arrow | |
1351 | + if (v) { | |
1352 | + switch (curloc) { | |
1353 | + case 'm1': | |
1354 | + return false; | |
1355 | + break; | |
1356 | + case 'm2': | |
1357 | + minutetohour($obj,-1); | |
1358 | + break; | |
1359 | + case 'm3': | |
1360 | + minutetohour($obj,-1); // 5.9.27.3 (2017/12/22) | |
1361 | + break; | |
1362 | + case 'h1': | |
1363 | + hourtominute($obj); | |
1364 | + break; | |
1365 | + case 'h2': | |
1366 | + hourtohour($obj); | |
1367 | + break; | |
1368 | + } | |
1369 | + } | |
1370 | + else { | |
1371 | + divprev($obj); | |
1372 | + } | |
1373 | + break; | |
1374 | + | |
1375 | + case 38: // up arrow | |
1376 | + if(v) { | |
1377 | + divprev($obj); | |
1378 | + } | |
1379 | + else { | |
1380 | + switch (curloc) { | |
1381 | + case 'm1': | |
1382 | + return false; | |
1383 | + break; | |
1384 | + case 'm2': | |
1385 | + minutetohour($obj,-1); | |
1386 | + break; | |
1387 | + case 'm3': | |
1388 | + minutetohour($obj,-1); // 5.9.27.3 (2017/12/22) | |
1389 | + break; | |
1390 | + case 'h1': | |
1391 | + hourtominute($obj); | |
1392 | + break; | |
1393 | + case 'h2': | |
1394 | + hourtohour($obj); | |
1395 | + break; | |
1396 | + } | |
1397 | + } | |
1398 | + break; | |
1399 | + case 39: // right arrow | |
1400 | + if (v) { | |
1401 | + switch (curloc) { | |
1402 | + case 'm1': | |
1403 | + minutetohour($obj,1); | |
1404 | + break; | |
1405 | + case 'm2': | |
1406 | + return false; | |
1407 | + break; | |
1408 | + case 'm3': | |
1409 | + minutetohour($obj,1); // 5.9.27.3 (2017/12/22) | |
1410 | + break; | |
1411 | + case 'h1': | |
1412 | + hourtohour($obj); | |
1413 | + break; | |
1414 | + case 'h2': | |
1415 | + hourtominute($obj); | |
1416 | + break; | |
1417 | + } | |
1418 | + } | |
1419 | + else { | |
1420 | + divnext($obj); | |
1421 | + } | |
1422 | + break; | |
1423 | + | |
1424 | + case 40: // down arrow | |
1425 | + if(v) { | |
1426 | + divnext($obj); | |
1427 | + } | |
1428 | + else { | |
1429 | + switch (curloc) { | |
1430 | + case 'm1': | |
1431 | + minutetohour($obj,1); | |
1432 | + break; | |
1433 | + case 'm2': | |
1434 | + return false; | |
1435 | + break; | |
1436 | + case 'm3': | |
1437 | + minutetohour($obj,1); // 5.9.27.3 (2017/12/22) | |
1438 | + break; | |
1439 | + case 'h1': | |
1440 | + hourtohour($obj); | |
1441 | + break; | |
1442 | + case 'h2': | |
1443 | + hourtominute($obj); | |
1444 | + break; | |
1445 | + } | |
1446 | + } | |
1447 | + break; | |
1448 | + | |
1449 | + case 13: // return | |
1450 | + eval(divtype + 'div_click($obj)'); | |
1451 | + break; | |
1452 | + | |
1453 | + default: | |
1454 | + return true; | |
1455 | + } | |
1456 | + | |
1457 | + return false; | |
1458 | + | |
1459 | + } | |
1460 | + | |
1461 | + return false; | |
1462 | + }); | |
1463 | + | |
1464 | + function errorcheck(settings) { | |
1465 | + if (settings.starthour >= settings.endhour) { | |
1466 | + alert('Error - start hour must be less than end hour.'); | |
1467 | + return false; | |
1468 | + } | |
1469 | + else if (60 % settings.minutedivisions != 0) { | |
1470 | + alert('Error - param minutedivisions must divide evenly into 60.'); | |
1471 | + return false; | |
1472 | + } | |
1473 | + } | |
1474 | + | |
1475 | + return this; | |
1476 | + | |
1477 | +} | |
1478 | + | |
1479 | +$(function(){ | |
1480 | + if($.fn.ogClockpicker){ | |
1481 | + $(document).ready(function(){ $(".clockpick").ogClockpicker(); }); | |
1482 | + } | |
1483 | +}); | |
1484 | + | |
1485 | + | |
1486 | + | |
1487 | +/********************************************************************************************/ | |
1488 | +/* 曖昧ピッカー */ | |
1489 | +/* */ | |
1490 | +/* AIMAI_xxxのid属性を持つタグを見つけて、xxxのvalue値の%付加を行います。 */ | |
1491 | +/* openGion的には、カラムタグに、aimai属性を設定することで、関連するタグを出力します。 */ | |
1492 | +/* 0/null : 何もなし(処理的には1,2,3以外とする) */ | |
1493 | +/* 1 : 前方一致% */ | |
1494 | +/* 2 : %後方一致 */ | |
1495 | +/* 3 : %前後曖昧% */ | |
1496 | +/* */ | |
1497 | +/* @og.rev 5.8.4.1 (2015/02/21) 新規作成(6.2.0.0) */ | |
1498 | +/********************************************************************************************/ | |
1499 | +function likeComp( _tgtName ){ | |
1500 | + var _orgTagName = _tgtName.substring(6); // 'AIMAI_' の文字数 | |
1501 | + var _likePtn = $("#" + _tgtName ).attr('aimaiType'); | |
1502 | + var _orgTagValue = $("#" + _orgTagName ).val(); | |
1503 | + _orgTagValue = _orgTagValue.replace(/^%+|%+$/g, ""); | |
1504 | + | |
1505 | + if( _orgTagValue != "" ){ | |
1506 | + switch( _likePtn ){ | |
1507 | + case "1": _orgTagValue = _orgTagValue + "%"; break; | |
1508 | + case "2": _orgTagValue = "%" + _orgTagValue; break; | |
1509 | + case "3": _orgTagValue = "%" + _orgTagValue + "%"; break; | |
1510 | + } | |
1511 | + } | |
1512 | + | |
1513 | + $("#" + _orgTagName ).val( _orgTagValue ); | |
1514 | +} | |
1515 | + | |
1516 | +/* onSubmit時に自動実行 */ | |
1517 | +$(function(){ | |
1518 | + $("form").submit(function() { | |
1519 | + $("[id^='AIMAI_']").each( function(){likeComp(this.id);} ); | |
1520 | + }); | |
1521 | +}); | |
1522 | + | |
1523 | +/********************************************************************************************/ | |
1524 | +/* 曖昧ピッカー */ | |
1525 | +/* jQueryのプラグイン */ | |
1526 | +/* */ | |
1527 | +/* @og.rev 5.8.4.1 (2015/02/21) 新規作成(6.2.0.0) */ | |
1528 | +/********************************************************************************************/ | |
1529 | +$.fn.aimaiPickerOg = function(options) { | |
1530 | + // この文字列が順に0,1,2,3という扱いにいなる。 | |
1531 | + var defaults = { | |
1532 | + texts: [' V ' , ' V*' , '*V ' , '*V*'], // 桁数を合わせる。 | |
1533 | + titls: ['完全一致', '前方一致', '後方一致', '前後曖昧'] // 日本語はリソース化しなければ… | |
1534 | + }; | |
1535 | + | |
1536 | + var opts = $.extend(defaults, options); | |
1537 | + | |
1538 | + return this.each(function() { | |
1539 | + var txt = $(this); | |
1540 | + var prefix = 'PIC_' + txt.attr('id').replace(/-/g, '') + '_'; | |
1541 | + | |
1542 | + var textsMarkUp = ''; | |
1543 | + // ここでピッカーの中身のタグを作成 | |
1544 | + for(var i = 0; i < opts.texts.length; i++){ | |
1545 | + var item = opts.texts[i]; | |
1546 | + var titl = opts.titls[i]; | |
1547 | + textsMarkUp += '<span id="' | |
1548 | + + prefix + 'text-' + i | |
1549 | + + '" class="text-box"' | |
1550 | + + '" title="' + titl + '">' | |
1551 | + + '(' + item + ') </span>'; | |
1552 | + } | |
1553 | + | |
1554 | + // ピッカーそのものを作成 | |
1555 | + var box = $('<div id="' | |
1556 | + + prefix | |
1557 | + + 'aimai-picker" class="aimai-picker" style="position: absolute; left: 0px; top: 0px;">' | |
1558 | + + textsMarkUp | |
1559 | + + '<div style="clear: both;"></div></div>'); | |
1560 | + | |
1561 | + $('body').append(box); | |
1562 | + box.hide(); | |
1563 | + | |
1564 | + // ピッカークリック時の挙動 | |
1565 | + box.find('span.text-box').click(function() { | |
1566 | + var indx = this.id.substr(this.id.indexOf('-') + 1); | |
1567 | + txt.attr( 'aimaiType',indx ); | |
1568 | + txt.attr( 'title',opts.titls[indx] ); | |
1569 | + txt.text( opts.texts[indx] ); | |
1570 | + txt.blur(); | |
1571 | + hideBox(box); | |
1572 | + }); | |
1573 | + | |
1574 | + // 以下、ボックス制御。気にしなくて良い | |
1575 | + $('body').live('click', function() { | |
1576 | + hideBox(box); | |
1577 | + }); | |
1578 | + | |
1579 | + box.click(function(event) { | |
1580 | + event.stopPropagation(); | |
1581 | + }); | |
1582 | + | |
1583 | + var positionAndShowBox = function(box) { | |
1584 | + var pos = txt.offset(); | |
1585 | + var left = pos.left + txt.outerWidth() - box.outerWidth(); | |
1586 | + if (left < pos.left) left = pos.left; | |
1587 | + box.css({ left: left, top: (pos.top + txt.outerHeight()) }); | |
1588 | + showBox(box); | |
1589 | + } | |
1590 | + | |
1591 | + txt.click(function(event) { | |
1592 | + event.stopPropagation(); | |
1593 | + if (!txt.is('input')) { | |
1594 | + positionAndShowBox(box); | |
1595 | + } | |
1596 | + }); | |
1597 | + | |
1598 | + txt.focus(function() { | |
1599 | + positionAndShowBox(box); | |
1600 | + }); | |
1601 | + | |
1602 | + function hideBox(box) { | |
1603 | + if (opts.hideEffect == 'fade') | |
1604 | + box.fadeOut(); | |
1605 | + else if (opts.hideEffect == 'slide') | |
1606 | + box.slideUp(); | |
1607 | + else | |
1608 | + box.hide(); | |
1609 | + } | |
1610 | + | |
1611 | + function showBox(box) { | |
1612 | + if (opts.showEffect == 'fade') | |
1613 | + box.fadeIn(); | |
1614 | + else if (opts.showEffect == 'slide') | |
1615 | + box.slideDown(); | |
1616 | + else | |
1617 | + box.show(); | |
1618 | + } | |
1619 | + }); | |
1620 | +}; | |
1621 | + | |
1622 | +/* aimaiPicker自動セット */ | |
1623 | +$(function(){ | |
1624 | + if($.fn.aimaiPickerOg){ | |
1625 | + $('.aimaiClm').aimaiPickerOg(); | |
1626 | + } | |
1627 | +}); | |
1628 | + | |
1629 | + | |
1630 | +/* | |
1631 | + * glDatePicker v2.0 | |
1632 | + * http://glad.github.com/glDatePicker/ | |
1633 | + * カレンダーピッカー | |
1634 | + * | |
1635 | + * Copyright (c) 2013 Gautam Lad. All rights reserved. | |
1636 | + * Released under the MIT license. | |
1637 | + * | |
1638 | + * OpenGion Modified | |
1639 | + * 横幅、高さはwindowの高さに依存(option指定可)で、表示位置調整 | |
1640 | + * アイコンクリック起動対応 | |
1641 | + * 返り値をyyyymmdd形式に変更 | |
1642 | + * 月曜開始の条件追加 | |
1643 | + * | |
1644 | + * 利用方法 | |
1645 | + * $(".calPic").glDatePicker(); のようにプラグインを適用するとclass="calPic"がピッカー起動対象です。 | |
1646 | + * @og.rev 5.8.9.0 (2015/08/07) | |
1647 | + * @og.rev 5.9.4.3 (2016/01/15) IE7対応 | |
1648 | + * @og.rev 5.9.5.0 (2016/02/05) マウスホイール対応 | |
1649 | + * @og.rev 5.9.6.1 (2016/03/02) サイズをウインドウの高さによって135-180で可変とする | |
1650 | + * @og.rev 5.9.10.1 (2016/07/02) draggableはエラーが出るのでやめる | |
1651 | + * @og.rev 5.9.11.0 (2016/08/05) カレンダーの事前作成をやめる | |
1652 | + * @og.rev 5.9.13.1 (2016/10/21) 初期値セット対応 | |
1653 | + * @og.rev 5.9.22.2 (2017/07/21) changeイベントを発生させる、初期値セット不具合対応 | |
1654 | + */ | |
1655 | + ;(function() { | |
1656 | + $.fn.glDatePicker = function(options) { | |
1657 | + var pluginName = 'glDatePicker'; | |
1658 | + | |
1659 | + // Find the plugin attached to the element | |
1660 | + var instance = this.data(pluginName); | |
1661 | + | |
1662 | + // If the instance wasn't found, create it... | |
1663 | + if(!instance) { | |
1664 | + // Return the element being bound to | |
1665 | + return this.each(function() { | |
1666 | + return $(this).data(pluginName, new glDatePicker(this, options)); | |
1667 | + }); | |
1668 | + } | |
1669 | + | |
1670 | + // ...otherwise if the user passes true to the plugin (on the second call), | |
1671 | + // then return the instance of the plugin itself | |
1672 | + return (options === true) ? instance : this; | |
1673 | + }; | |
1674 | + | |
1675 | + // Default options | |
1676 | + $.fn.glDatePicker.defaults = | |
1677 | + { | |
1678 | + // Style to use for the calendar. This name must match the name used in | |
1679 | + // the stylesheet, using the class naming convention "gldp-cssName". | |
1680 | + cssName: 'default', | |
1681 | + | |
1682 | + // The z-index for the calendar control. | |
1683 | + zIndex: 1000, | |
1684 | + | |
1685 | + // Thickness of border (in pixels) | |
1686 | + borderSize: 1, | |
1687 | + | |
1688 | + // The number of pixels to offset the calendar's position on the page. | |
1689 | + calendarOffset: { x: 0, y: 1 }, | |
1690 | + | |
1691 | + // Set to true if you want the calendar to be visible at all times. | |
1692 | + // NOTE: If your target element is hidden, the calendar will be hidden as well. | |
1693 | + showAlways: false, | |
1694 | + | |
1695 | + // Hide the calendar when a date is selected (only if showAlways is set to false). | |
1696 | + hideOnClick: true, | |
1697 | + | |
1698 | + // Allow selection of months by clicking on the month in the title. | |
1699 | + allowMonthSelect: true, | |
1700 | + | |
1701 | + // Allow selection of years by clicking on the year in the title. | |
1702 | + allowYearSelect: true, | |
1703 | + | |
1704 | + // The date that will be treated as 'today'. | |
1705 | + todayDate: new Date(), | |
1706 | + | |
1707 | + // The date that will appear selected when the calendar renders. | |
1708 | + // By default it will be set to todayDate. | |
1709 | + selectedDate: null, | |
1710 | + | |
1711 | + // Arrows used for the Previous and Next month buttons on the title. | |
1712 | + // Set these to blank to hide the arrows completely. | |
1713 | + prevArrow: '\u25c4', | |
1714 | + nextArrow: '\u25ba', | |
1715 | + | |
1716 | + // A collection of dates that can be selectable by the user. | |
1717 | + // The dates can be a one-time selection or made repeatable by setting | |
1718 | + // the repeatYear or repeatMonth flag to true. | |
1719 | + // By default repeatYear and repeatMonth are false. | |
1720 | + // | |
1721 | + // This example creates 4-individual dates that can be selected; | |
1722 | + // The first date will repeat every year, the second date will repeat every | |
1723 | + // month and year, the third date will repeat every month and the fourth date | |
1724 | + // will only be selectable one-time and not repeat: | |
1725 | + // | |
1726 | + // selectableDates: [ | |
1727 | + // { date: new Date(0, 8, 5), repeatYear: true }, | |
1728 | + // { date: new Date(0, 0, 14), repeatMonth: true, repeatYear: true }, | |
1729 | + // { date: new Date(2013, 0, 24), repeatMonth: true }, | |
1730 | + // { date: new Date(2013, 11, 25) }, | |
1731 | + // ] | |
1732 | + selectableDates: null, | |
1733 | + | |
1734 | + // A collection of date ranges that are selectable by the user. | |
1735 | + // The ranges can be made to repeat by setting repeatYear to true | |
1736 | + // (repeatMonth is not supported). | |
1737 | + // | |
1738 | + // This example will create 3-sets of selectable date ranges with | |
1739 | + // specific from and to ranges. The 4th and 5th ranges don't specify | |
1740 | + // the "to" date in which case the "to" date will be the maximum days for | |
1741 | + // the month specified in "from". The 4th and 5th ranges also repeat every year: | |
1742 | + // | |
1743 | + // selectableDateRange: [ | |
1744 | + // { from: new Date(2013, 1, 1), to: newDate (2013, 2, 1) }, | |
1745 | + // { from: new Date(2013, 4, 1), to: newDate (2013, 8, 1) }, | |
1746 | + // { from: new Date(2013, 7, 10), to: newDate (2013, 9, 10) }, | |
1747 | + // { from: new Date(0, 8, 10), repeatYear: true } | |
1748 | + // { from: new Date(0, 9, 1), repeatYear: true } | |
1749 | + // ] | |
1750 | + selectableDateRange: null, | |
1751 | + | |
1752 | + // Mark certain dates as special dates. Similar to selectableDates, this | |
1753 | + // property supports both repeatYear and repeatMonth flags. | |
1754 | + // Each special date can be styled using custom style names and can have | |
1755 | + // data attached to it that will be returned in the onClick callback. | |
1756 | + // The data field can be any custom (JSON style) object. | |
1757 | + // | |
1758 | + // This example creates two (repeatable by year) dates with special data in them. | |
1759 | + // The first date also assigns a special class (which you will have to define). | |
1760 | + // specialDates: [ | |
1761 | + // { | |
1762 | + // date: new Date(0, 8, 5), | |
1763 | + // data: { message: 'Happy Birthday!' }, | |
1764 | + // repeatYear: true, | |
1765 | + // cssClass: 'special-bday' | |
1766 | + // }, | |
1767 | + // { | |
1768 | + // date: new Date(2013, 0, 8), | |
1769 | + // data: { message: 'Meeting every day 8 of the month' }, | |
1770 | + // repeatMonth: true | |
1771 | + // } | |
1772 | + // ] | |
1773 | + specialDates: null, | |
1774 | + | |
1775 | + // List of months that can be selectable, including when the user clicks | |
1776 | + // on the title to select from the dropdown. | |
1777 | + // This example only makes two months visible; September and December: | |
1778 | + // selectableMonths: [8, 11] | |
1779 | + selectableMonths : null, | |
1780 | + | |
1781 | + // List of selectable years. If not provided, will default to 5-years | |
1782 | + // back and forward. | |
1783 | + // This example only allows selection of dates that have year 2012, 2013, 2015 | |
1784 | + // selectableYears: [2012, 2013, 2015] | |
1785 | + selectableYears: null, | |
1786 | + | |
1787 | + // List of selectable days of the week. 0 is Sunday, 1 is Monday, and so on. | |
1788 | + // This example allows only Sunday, Tuesday, Thursday: | |
1789 | + // selectableDOW: [0, 2, 4] | |
1790 | + selectableDOW : null, | |
1791 | + | |
1792 | + // Names of the month that will be shown in the title. | |
1793 | + // Will default to long-form names: | |
1794 | + // January, February, March, April, May, June, July, | |
1795 | + // August, September, October, November, December | |
1796 | + monthNames: null, | |
1797 | + | |
1798 | + // Names of the days of the Week that will be shown below the title. | |
1799 | + // Will default to short-form names: | |
1800 | + // Sun, Mon, Tue, Wed, Thu, Fri, Sat | |
1801 | + dowNames: null, | |
1802 | + | |
1803 | + // The day of the week to start the calendar on. 0 is Sunday, 1 is Monday and so on. | |
1804 | + // HYBS_CALSTART_MON次第とする | |
1805 | + //dowOffset: 0, | |
1806 | + dowOffset: (HYBS_CAL_START_MON==true ? 1 : 0), | |
1807 | + | |
1808 | + // Callback that will trigger when the user clicks a selectable date. | |
1809 | + // Parameters that are passed to the callback: | |
1810 | + // el : The input element the date picker is bound to | |
1811 | + // cell : The cell on the calendar that triggered this event | |
1812 | + // date : The date associated with the cell | |
1813 | + // data : Special data associated with the cell (if available, otherwise, null) | |
1814 | + onClick: (function(el, cell, date, data) { | |
1815 | + //el.val(date.toLocaleDateString()); | |
1816 | + | |
1817 | + // openGion アイコン起動が出来るようにしておく | |
1818 | + var tgt = el; | |
1819 | + if ( el[0].tagName.toUpperCase() != 'INPUT' ){ | |
1820 | + var _targetId = el.attr('targetId'); | |
1821 | + if( _targetId != null ){ | |
1822 | + tgt = $('#'+_targetId); | |
1823 | + } | |
1824 | + } | |
1825 | + | |
1826 | + var year = date.getFullYear(); | |
1827 | + var month = date.getMonth() + 1; | |
1828 | + var day = date.getDate(); | |
1829 | + if ( month < 10 ) { | |
1830 | + month = '0' + month; | |
1831 | + } | |
1832 | + if ( day < 10 ) { | |
1833 | + day = '0' + day; | |
1834 | + } | |
1835 | + var oldval = tgt.val(); | |
1836 | + // var str = year + month + day; | |
1837 | + var str = year + "" + month + "" + day; // 5.9.1.2 (2015/10/23) | |
1838 | + tgt.val(str); // opneGion:yyyymmdd形式 | |
1839 | + if( oldval != str ){ // changeイベントを発生させる 5.9.22.2 (2017/07/21) | |
1840 | + tgt.change(); | |
1841 | + } | |
1842 | + }), | |
1843 | + | |
1844 | + // Callback that will trigger when the user hovers over a selectable date. | |
1845 | + // This callback receives the same set of parameters as onClick. | |
1846 | + onHover: function(el, cell, date, data) {}, | |
1847 | + | |
1848 | + // Callback that will trigger when the calendar needs to show. | |
1849 | + // You can use this callback to animate the opening of the calendar. | |
1850 | + onShow: function(calendar) { | |
1851 | + calendar.show(); | |
1852 | + }, | |
1853 | + | |
1854 | + // Callback that will trigger when the calendar needs to hide. | |
1855 | + // You can use this callback to animate the hiding of the calendar. | |
1856 | + onHide: function(calendar) { calendar.hide(); }, | |
1857 | + | |
1858 | + // First date of the month. | |
1859 | + firstDate: null | |
1860 | + }; | |
1861 | + | |
1862 | + // Our plugin object | |
1863 | + var glDatePicker = (function() { | |
1864 | + // Main entry point. Initialize the plugin | |
1865 | + function glDatePicker(element, userOptions) { | |
1866 | + // Grab handle to this | |
1867 | + var self = this; | |
1868 | + | |
1869 | + // Save bound element to el | |
1870 | + self.el = $(element); | |
1871 | + var el = self.el; | |
1872 | + | |
1873 | + // Merge user options into default options | |
1874 | + self.options = $.extend(true, {}, $.fn.glDatePicker.defaults, userOptions); | |
1875 | + var options = self.options; | |
1876 | + | |
1877 | + // 5.9.13.1 (2016/10/21)ボックスへの入力値を初期値にする | |
1878 | + var _tgt = el; | |
1879 | + if ( el[0].tagName.toUpperCase() != 'INPUT' ){ | |
1880 | + if( el.attr('targetId') ){ | |
1881 | + _tgt = $('#'+el.attr('targetId')); | |
1882 | + } | |
1883 | + } | |
1884 | + var _inputDate = _tgt.val(); | |
1885 | + if( _inputDate != null && _inputDate.length >= 8 ){ | |
1886 | + | |
1887 | + _inputDate = _inputDate.replace(/\u002f/g , "" ) ; | |
1888 | + try{ | |
1889 | + _inputDate = _inputDate.substr(0,4) +"/"+ _inputDate.substr(4,2) + "/" + _inputDate.substr(6,2); | |
1890 | + }catch(e){ _inputDate=null; } | |
1891 | + } | |
1892 | + else{ // 5.9.22.2 (2017/07/21) 初期値問題に対応 | |
1893 | + _inputDate=null; | |
1894 | + } | |
1895 | + | |
1896 | + // Find the calendar element if the user provided one | |
1897 | + self.calendar = $($.find('[gldp-el=' + el.attr('gldp-id') + ' ]')); | |
1898 | + | |
1899 | + // Default first date to selected | |
1900 | + options.selectedDate = (options.selectedDate || new Date(_inputDate || options.todayDate) ) || options.todayDate ; | |
1901 | + | |
1902 | + options.firstDate = (new Date((options.firstDate || options.selectedDate )))._first(); | |
1903 | + | |
1904 | + if(!(el.attr('gldp-id') || '').length) { | |
1905 | + el.attr('gldp-id', 'gldp-' + Math.round(Math.random() * 1e10)) | |
1906 | + } | |
1907 | + | |
1908 | + // Show the plugin on focus | |
1909 | + el | |
1910 | + .addClass('gldp-el') | |
1911 | + .bind('click', function(e) { self.show(e); }); | |
1912 | + //.bind('focus', function(e) { self.show(e); }); // opneGion:focusでは起動させない | |
1913 | + | |
1914 | + // If the user is defining the container and it exists, hide it on initial creation. | |
1915 | + // The update function will handle showing if it's showAlways = true | |
1916 | + if(self.calendar.length && !options.showAlways) { | |
1917 | + self.calendar.hide(); | |
1918 | + } | |
1919 | + | |
1920 | + // Hide the plugin on mouse up outside of the plugin | |
1921 | + $(document).bind('mouseup', function(e) { | |
1922 | + var target = e.target; | |
1923 | + var calendar = self.calendar; | |
1924 | + | |
1925 | + if(!el.is(target) && !calendar.is(target) && calendar.has(target).length === 0 && calendar.is(':visible')) { | |
1926 | + self.hide(); | |
1927 | + } | |
1928 | + }); | |
1929 | + | |
1930 | +// 5.9.10.1 (2016/07/02) Del | |
1931 | +// if(typeof $(self).draggable == "function"){ | |
1932 | +// $(self).draggable({ | |
1933 | +// opacity : 0.5 | |
1934 | +// ,cursor : 'move' | |
1935 | +// }); | |
1936 | +// } | |
1937 | + | |
1938 | + // Render calendar | |
1939 | + //self.render(); // 5.9.11.0 一覧で遅いのでここで予め作る事はしない | |
1940 | + }; | |
1941 | + | |
1942 | + // Public methods | |
1943 | + glDatePicker.prototype = | |
1944 | + { | |
1945 | + show: function() { | |
1946 | + this.render();// 5.9.6.1 (2016/03/04) | |
1947 | + // Hide others and show this calendar | |
1948 | + $.each($('.gldp-el').not(this.el), function(i, o) { | |
1949 | + if(o.length) { o.options.onHide(o.calendar) ; } | |
1950 | + }); | |
1951 | + | |
1952 | + // Show this calendar | |
1953 | + this.options.onShow(this.calendar); | |
1954 | + }, | |
1955 | + | |
1956 | + hide: function() { | |
1957 | + if(this.options && !this.options.showAlways) { | |
1958 | + this.options.onHide(this.calendar); | |
1959 | + } | |
1960 | + }, | |
1961 | + | |
1962 | + // Render the calendar | |
1963 | + render: function(renderCalback) { | |
1964 | + var self = this; | |
1965 | + var el = self.el; | |
1966 | + var options = self.options; | |
1967 | + var calendar = self.calendar; | |
1968 | + | |
1969 | + // Build a core class (with border) that every element would have | |
1970 | + var coreClass = ' core border '; | |
1971 | + var cssName = 'gldp-' + options.cssName; | |
1972 | + | |
1973 | + // Get today | |
1974 | + var todayVal = options.todayDate._val(); | |
1975 | + var todayTime = todayVal.time; | |
1976 | + | |
1977 | + // Constants | |
1978 | + var maxRow = 6; | |
1979 | + var maxCol = 7; | |
1980 | + var borderSize = options.borderSize + 'px'; | |
1981 | + | |
1982 | + // Helper function to build selectable list | |
1983 | + var getSelectableList = function(min, max, userList) { | |
1984 | + // Build a default list using min/max | |
1985 | + var resultList = []; | |
1986 | + for(var i = min; i <= max; i++) { resultList.push(i); } | |
1987 | + | |
1988 | + // If user provided a collection, sanitize list by ensuring it's within range and unique | |
1989 | + if(userList) { | |
1990 | + var newList = []; | |
1991 | + $.each(userList, function(i, v) { | |
1992 | + if(v >= min && v <= max && newList._indexOf(v) < 0) { | |
1993 | + newList.push(v); | |
1994 | + } | |
1995 | + }); | |
1996 | + | |
1997 | + resultList = newList.length ? newList : resultList; | |
1998 | + }; | |
1999 | + | |
2000 | + // Sort the values before returning it | |
2001 | + resultList.sort(); | |
2002 | + | |
2003 | + return resultList; | |
2004 | + }; | |
2005 | + | |
2006 | + // Selectable (constants) | |
2007 | + var selectableMonths = getSelectableList(0, 11, options.selectableMonths); | |
2008 | + var selectableYears = getSelectableList(todayVal.year - 5, todayVal.year + 5, options.selectableYears); | |
2009 | + var selectableDOW = getSelectableList(0, 6, options.selectableDOW); | |
2010 | + var dowNames = options.dowNames || ['日','月','火','水','木','金','土']; | |
2011 | + var monthNames = options.monthNames || ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']; | |
2012 | + | |
2013 | + // Create cell width based on el size | |
2014 | + //var containerWidth = el.outerWidth(); | |
2015 | + // 5.9.6.1 (2016/03/04) 可変 | |
2016 | + var containerSize = window.innerHeight ? window.innerHeight : 180; | |
2017 | + if( containerSize < 180 ){ containerSize = (containerSize > 135 ? containerSize : 135); } | |
2018 | + else{ containerSize = 180; } | |
2019 | + | |
2020 | + var containerWidth = options.conainerWidth || containerSize; // opneGion:180を基準として、130までは可変 | |
2021 | + var containerHeight = containerWidth; | |
2022 | + | |
2023 | + // Create cell size based on container size | |
2024 | + var getCellSize = function(_size, _count) { | |
2025 | +// return (_size / _count) + ((options.borderSize / _count) * (_count - 1)); | |
2026 | + return (_size / _count) + ((options.borderSize / _count) * (_count - 1)) - 1; // 5.9.4.3 | |
2027 | + }; | |
2028 | + var cellWidth = getCellSize(containerWidth, maxCol); | |
2029 | + var cellHeight = getCellSize(containerHeight, maxRow + 2); | |
2030 | + | |
2031 | + // If calendar doesn't exist, create it and re-assign it to self | |
2032 | + if(!calendar.length) { | |
2033 | + self.calendar = calendar = $('<div/>') | |
2034 | + .attr('gldp-el', el.attr('gldp-id')) | |
2035 | + .data('is', true) | |
2036 | + .css( | |
2037 | + { | |
2038 | + display: (options.showAlways ? undefined : 'none'), | |
2039 | + zIndex: options.zIndex, | |
2040 | + //width: (cellWidth * maxCol) + 'px' | |
2041 | + width: ((cellWidth+1) * maxCol) + 'px' // 5.9.4.3 | |
2042 | + }); | |
2043 | + | |
2044 | + $('body').append(calendar); | |
2045 | + } | |
2046 | + else { | |
2047 | + if(!eval(calendar.data('is'))) { | |
2048 | + containerWidth = calendar.outerWidth(); | |
2049 | + containerHeight = calendar.outerHeight(); | |
2050 | + | |
2051 | + cellWidth = getCellSize(containerWidth, maxCol); | |
2052 | + cellHeight = getCellSize(containerHeight, maxRow + 2); | |
2053 | + } | |
2054 | + // 5.9.6.1 (2016/03/04) | |
2055 | + self.calendar.css( | |
2056 | + { | |
2057 | + width: ((cellWidth+1) * maxCol) + 'px' | |
2058 | + } | |
2059 | + ) | |
2060 | + } | |
2061 | + | |
2062 | + // Hide calendar if the target element isn't visible | |
2063 | + if(!el.is(':visible')) { calendar.hide(); } | |
2064 | + | |
2065 | + // Add core classes and remove calendar's children | |
2066 | + calendar | |
2067 | + .removeClass() | |
2068 | + .addClass(cssName) | |
2069 | + .children().remove(); | |
2070 | + | |
2071 | + // Bind to resize event to position calendar | |
2072 | + var onResize = function() { | |
2073 | + var elPos = el.offset(); | |
2074 | + | |
2075 | + // ポジションは上、右にスペースが無い場合は修正する | |
2076 | + calPosTop = (elPos.top + el.outerHeight() + options.calendarOffset.y) -20; | |
2077 | + calPosLeft = (elPos.left + options.calendarOffset.x); | |
2078 | + | |
2079 | + if( calPosTop > $(window).height() - 150 ){ calPosTop -= 130; } | |
2080 | + if( calPosLeft > $(window).width() -150 ) { calPosLeft -= 150; } | |
2081 | + | |
2082 | + if( calPosTop < 0 ){ calPosTop = 0; } | |
2083 | + if( calPosLeft < 0 ){ calPosLeft = 0; } | |
2084 | + | |
2085 | + calendar.css( | |
2086 | + { | |
2087 | + top: calPosTop + 'px', | |
2088 | + left: calPosLeft + 'px' | |
2089 | + }); | |
2090 | + }; | |
2091 | + $(window).resize(onResize); | |
2092 | + onResize(); | |
2093 | + | |
2094 | + // Create variables for cells | |
2095 | + var cellCSS = | |
2096 | + { | |
2097 | + width: cellWidth + 'px', | |
2098 | + height: cellHeight + 'px', | |
2099 | + lineHeight: cellHeight + 'px' | |
2100 | + }; | |
2101 | + | |
2102 | + // Helper function to setDate | |
2103 | + var setFirstDate = function(_date) { | |
2104 | + if(_date) { | |
2105 | + // Get first date | |
2106 | + options.firstDate = _date; | |
2107 | + | |
2108 | + // Update the calendar | |
2109 | + self.render(); | |
2110 | + } | |
2111 | + }; | |
2112 | + | |
2113 | + var getFirstDate = function(_offset) { | |
2114 | + // Create start date as the first date of the month | |
2115 | + var _date = new Date(options.firstDate); | |
2116 | + | |
2117 | + // Default to no offset | |
2118 | + _offset = _offset || 0; | |
2119 | + | |
2120 | + // Find out which months are selectable | |
2121 | + while(true) { | |
2122 | + // Adjust date for month offset | |
2123 | + _date.setMonth(_date.getMonth() + _offset); | |
2124 | + _date.setDate(Math.min(1, _date._max())); | |
2125 | + | |
2126 | + // If not an offset, break out of the loop | |
2127 | + if(_offset == 0) { break; } | |
2128 | + | |
2129 | + // Get _date's value | |
2130 | + var dateVal = _date._val(); | |
2131 | + | |
2132 | + // Get local vars | |
2133 | + var dateMonth = dateVal.month; | |
2134 | + var dateYear = dateVal.year; | |
2135 | + | |
2136 | + // Find the month first | |
2137 | + if(selectableMonths._indexOf(dateMonth) != -1) { | |
2138 | + // If year is in our collection, break... | |
2139 | + if(selectableYears._indexOf(dateYear) != -1) { | |
2140 | + break; | |
2141 | + } | |
2142 | + else { | |
2143 | + // ...otherwise, if it's out of bounds, exit loop | |
2144 | + if(dateYear < selectableYears[0] || dateYear > selectableYears[selectableYears.length - 1]) { | |
2145 | + return null; | |
2146 | + } | |
2147 | + } | |
2148 | + } | |
2149 | + } | |
2150 | + | |
2151 | + return _date; | |
2152 | + }; | |
2153 | + | |
2154 | + // Get the previous, next first dates | |
2155 | + var prevFirstDate = getFirstDate(-1); | |
2156 | + var nextFirstDate = getFirstDate(1); | |
2157 | + | |
2158 | + // Get the first date for the current month being rendered | |
2159 | + var firstDate = (options.firstDate = getFirstDate()); | |
2160 | + var firstDateVal = firstDate._val(); | |
2161 | + var firstDateMonth = firstDateVal.month; | |
2162 | + var firstDateYear = firstDateVal.year; | |
2163 | + | |
2164 | + // Get the start date in the calendar | |
2165 | + var startDate = new Date(firstDate); | |
2166 | + | |
2167 | + // Sanitize days of the week offset | |
2168 | + var dowOffset = Math.abs(Math.min(6, Math.max(0, options.dowOffset))); | |
2169 | + | |
2170 | + // Offset weekdays | |
2171 | + var startOffset = startDate.getDay() - dowOffset; | |
2172 | + startOffset = startOffset < 1 ? -7 - startOffset : -startOffset; | |
2173 | + dowNames = (dowNames.concat(dowNames)) | |
2174 | + .slice(dowOffset, dowOffset + 7); | |
2175 | + | |
2176 | + // Offset the start date | |
2177 | + startDate._add(startOffset); | |
2178 | + | |
2179 | + // Gather flags for prev/next arrows | |
2180 | + var showPrev = (prevFirstDate); | |
2181 | + var showNext = (nextFirstDate); | |
2182 | + | |
2183 | + // Create the arrows and title | |
2184 | + var monyearClass = coreClass + 'monyear '; | |
2185 | + | |
2186 | + var prevCell = $('<div/>') | |
2187 | + .addClass(monyearClass) | |
2188 | + .css( | |
2189 | + $.extend({}, cellCSS, | |
2190 | + { | |
2191 | + borderWidth: borderSize + ' 0 0 ' + borderSize | |
2192 | + }) | |
2193 | + ) | |
2194 | + .append( | |
2195 | + $('<a/>') | |
2196 | + .addClass('prev-arrow' + (showPrev ? '' : '-off')) | |
2197 | + .html(options.prevArrow) | |
2198 | + ) | |
2199 | + .mousedown(function() { return false; }) | |
2200 | + .click(function(e) { | |
2201 | + if(options.prevArrow != '' && showPrev) { | |
2202 | + e.stopPropagation(); | |
2203 | + setFirstDate(prevFirstDate); | |
2204 | + } | |
2205 | + }); | |
2206 | + | |
2207 | + var titleCellCount = maxCol - 2; | |
2208 | + var titleWidth = (cellWidth * titleCellCount) - (titleCellCount * options.borderSize) + (options.borderSize); | |
2209 | + var titleCell = $('<div/>') | |
2210 | + .addClass(monyearClass + 'title') | |
2211 | + .css( | |
2212 | + $.extend({}, cellCSS, | |
2213 | + { | |
2214 | + width: titleWidth + 'px', | |
2215 | + borderTopWidth: borderSize, | |
2216 | + marginLeft: '-' + (borderSize) | |
2217 | + }) | |
2218 | + ); | |
2219 | + | |
2220 | + var nextCell = $('<div/>') | |
2221 | + .addClass(monyearClass) | |
2222 | + .css( | |
2223 | + $.extend({}, cellCSS, | |
2224 | + { | |
2225 | + marginLeft: '-' + (borderSize), | |
2226 | + borderWidth: borderSize + ' ' + borderSize + ' 0 0' | |
2227 | + }) | |
2228 | + ) | |
2229 | + .append( | |
2230 | + $('<a/>') | |
2231 | + .addClass('next-arrow' + (showNext ? '' : '-off')) | |
2232 | + .html(options.nextArrow) | |
2233 | + ) | |
2234 | + .mousedown(function() { return false; }) | |
2235 | + .click(function(e) { | |
2236 | + if(options.nextArrow != '' && showNext) { | |
2237 | + e.stopPropagation(); | |
2238 | + setFirstDate(nextFirstDate); | |
2239 | + } | |
2240 | + }); | |
2241 | + | |
2242 | + // Add cells for prev/title/next | |
2243 | + calendar | |
2244 | + .append(prevCell) | |
2245 | + .append(titleCell) | |
2246 | + .append(nextCell); | |
2247 | + | |
2248 | + // Add all the cells to the calendar | |
2249 | + for(var row = 0, cellIndex = 0; row < maxRow + 1; row++) { | |
2250 | + for(var col = 0; col < maxCol; col++, cellIndex++) { | |
2251 | + var cellDate = new Date(startDate); | |
2252 | + var cellClass = 'day'; | |
2253 | + var cellZIndex = options.zIndex + (cellIndex); | |
2254 | + var cell = $('<div/>') | |
2255 | + | |
2256 | + if(!row) { | |
2257 | + cellClass = 'dow'; | |
2258 | + cell.html(dowNames[col]); | |
2259 | + cellDate = null; | |
2260 | + } | |
2261 | + else { | |
2262 | + // Get the new date for this cell | |
2263 | + cellDate._add(col + ((row - 1) * maxCol)); | |
2264 | + | |
2265 | + // Get value for this date | |
2266 | + var cellDateVal = cellDate._val(); | |
2267 | + var cellDateTime = cellDateVal.time; | |
2268 | + | |
2269 | + // Variable to hold special data | |
2270 | + var specialData = null; | |
2271 | + | |
2272 | + // Determine if this date is selectable | |
2273 | + var isSelectable = true; | |
2274 | + | |
2275 | + // Helper function to get repeat friendly date against current date | |
2276 | + var getRepeatDate = function(v, date) { | |
2277 | + // If repeating, set the date's year and month accordingly | |
2278 | + if(v.repeatYear === true) { date.setYear(cellDateVal.year); } | |
2279 | + if(v.repeatMonth === true) { date.setMonth(cellDateVal.month); } | |
2280 | + | |
2281 | + return date._val(); | |
2282 | + }; | |
2283 | + | |
2284 | + // Assign date for the cell | |
2285 | + cell.html(cellDateVal.date); | |
2286 | + | |
2287 | + // If we have selectable date ranges | |
2288 | + if(options.selectableDateRange) { | |
2289 | + isSelectable = false; | |
2290 | + $.each(options.selectableDateRange, function(i, v) { | |
2291 | + var dateFrom = v.from; | |
2292 | + var dateTo = (v.to || null); | |
2293 | + | |
2294 | + // If to is not specified, default to max days in the from month | |
2295 | + dateTo = dateTo || new Date(v.from.getFullYear(), v.from.getMonth(), v.from._max()); | |
2296 | + | |
2297 | + // If repeating year, set the from and two to the current date's year | |
2298 | + dateFrom = getRepeatDate(v, dateFrom); | |
2299 | + dateTo = getRepeatDate(v, dateTo); | |
2300 | + | |
2301 | + // Test to see if this date is selectable | |
2302 | + if(cellDateTime >= dateFrom.time && cellDateTime <= dateTo.time) { | |
2303 | + isSelectable = true; | |
2304 | + return true; | |
2305 | + } | |
2306 | + }); | |
2307 | + } | |
2308 | + | |
2309 | + // Handle date ranges and collections | |
2310 | + if(options.selectableDates) { | |
2311 | + if((options.selectableDateRange && !isSelectable) || (isSelectable && !options.selectableDateRange)) { | |
2312 | + isSelectable = false; | |
2313 | + } | |
2314 | + $.each(options.selectableDates, function(i, v) { | |
2315 | + var vDate = getRepeatDate(v, v.date); | |
2316 | + | |
2317 | + if(vDate.time == cellDateTime) { | |
2318 | + return (isSelectable = true); | |
2319 | + } | |
2320 | + }); | |
2321 | + } | |
2322 | + | |
2323 | + // If not active or if not within selectableMonths, set to noday otherwise evaluate accordingly | |
2324 | + if(!isSelectable || | |
2325 | + selectableYears._indexOf(cellDateVal.year) < 0 || | |
2326 | + selectableMonths._indexOf(cellDateVal.month) < 0 || | |
2327 | + selectableDOW._indexOf(cellDateVal.day) < 0) { | |
2328 | + cellClass = 'noday'; | |
2329 | + } | |
2330 | + else { | |
2331 | + // Handle active dates and weekends | |
2332 | + cellClass = ([ 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ])[cellDateVal.day]; | |
2333 | + | |
2334 | + // Handle today or selected dates | |
2335 | + if(firstDateMonth != cellDateVal.month) { cellClass += ' outday'; } | |
2336 | + if(todayTime == cellDateTime) { cellClass = 'today'; cellZIndex += 50; } | |
2337 | + if(options.selectedDate._time() == cellDateTime) { cellClass = 'selected'; cellZIndex += 51; } | |
2338 | + | |
2339 | + // Handle special dates | |
2340 | + if(options.specialDates) { | |
2341 | + $.each(options.specialDates, function(i, v) { | |
2342 | + var vDate = getRepeatDate(v, v.date); | |
2343 | + | |
2344 | + if(vDate.time == cellDateTime) { | |
2345 | + cellClass = (v.cssClass || 'special'); | |
2346 | + cellZIndex += 52; | |
2347 | + specialData = v.data; | |
2348 | + } | |
2349 | + }); | |
2350 | + } | |
2351 | + | |
2352 | + cell | |
2353 | + .mousedown(function() { return false; }) | |
2354 | + .hover(function(e) { | |
2355 | + e.stopPropagation(); | |
2356 | + | |
2357 | + // Get the data from this cell | |
2358 | + var hoverData = $(this).data('data'); | |
2359 | + | |
2360 | + // Call callback | |
2361 | + options.onHover(el, cell, hoverData.date, hoverData.data); | |
2362 | + }) | |
2363 | + .click(function(e) { | |
2364 | + e.stopPropagation(); | |
2365 | + | |
2366 | + // Get the data from this cell | |
2367 | + var clickedData = $(this).data('data'); | |
2368 | + | |
2369 | + // Save date to selected and first | |
2370 | + options.selectedDate = options.firstDate = clickedData.date; | |
2371 | + | |
2372 | + // Update calendar (and auto-hide if necessary) | |
2373 | + self.render(function() { | |
2374 | + if(!options.showAlways && options.hideOnClick) { | |
2375 | + self.hide(); | |
2376 | + } | |
2377 | + }); | |
2378 | + | |
2379 | + // Call callback | |
2380 | + options.onClick(el, $(this), clickedData.date, clickedData.data); | |
2381 | + }); | |
2382 | + } | |
2383 | + } | |
2384 | + | |
2385 | + // Update the css for the cell | |
2386 | + $.extend(cellCSS, | |
2387 | + { | |
2388 | + borderTopWidth: borderSize, | |
2389 | + borderBottomWidth: borderSize, | |
2390 | + borderLeftWidth: (row > 0 || (!row && !col)) ? borderSize : 0, | |
2391 | + borderRightWidth: (row > 0 || (!row && col == 6)) ? borderSize : 0, | |
2392 | + marginLeft: (col > 0) ? '-' + (borderSize) : 0, | |
2393 | + marginTop: (row > 0) ? '-' + (borderSize) : 0, | |
2394 | + zIndex: cellZIndex | |
2395 | + }); | |
2396 | + | |
2397 | + // Assign other properties to the cell | |
2398 | + cell | |
2399 | + .data('data', { date: cellDate, data: specialData}) | |
2400 | + .addClass(coreClass + cellClass) | |
2401 | + .css(cellCSS); | |
2402 | + | |
2403 | + // Add cell to calendar | |
2404 | + calendar.append(cell); | |
2405 | + } | |
2406 | + } | |
2407 | + | |
2408 | + // Render the month / year title | |
2409 | + | |
2410 | + // Helper function for toggling select and text | |
2411 | + var toggleYearMonthSelect = function(showYear) { | |
2412 | + var show = 'inline-block'; | |
2413 | + var hide = 'none'; | |
2414 | + | |
2415 | + if(options.allowMonthSelect) { | |
2416 | + monthText.css({ display: !showYear ? hide : show }); | |
2417 | + monthSelect.css({ display: !showYear ? show : hide }); | |
2418 | + } | |
2419 | + | |
2420 | + if(options.allowYearSelect) { | |
2421 | + yearText.css({ display: showYear ? hide : show }); | |
2422 | + yearSelect.css({ display: showYear ? show : hide }); | |
2423 | + } | |
2424 | + }; | |
2425 | + | |
2426 | + // Helper function when select is updated | |
2427 | + var onYearMonthSelect = function() { | |
2428 | + options.firstDate = new Date(yearSelect.val(), monthSelect.val(), 1); | |
2429 | + self.render(); | |
2430 | + }; | |
2431 | + | |
2432 | + // Build month selector | |
2433 | + var monthSelect = $('<select/>') | |
2434 | + .hide() | |
2435 | + .change(onYearMonthSelect); | |
2436 | + | |
2437 | + // Build year selector | |
2438 | + var yearSelect = $('<select/>') | |
2439 | + .hide() | |
2440 | + .change(onYearMonthSelect); | |
2441 | + | |
2442 | + // Build month label | |
2443 | + var monthText = $('<span/>') | |
2444 | + .html(monthNames[firstDateMonth]) | |
2445 | + .mousedown(function() { return false; }) | |
2446 | + .click(function(e) { | |
2447 | + e.stopPropagation(); | |
2448 | + toggleYearMonthSelect(false); | |
2449 | + }); | |
2450 | + | |
2451 | + // Build year label | |
2452 | + var yearText = $('<span/>') | |
2453 | + .html(firstDateYear) | |
2454 | + .mousedown(function() { return false; }) | |
2455 | + .click(function(e) { | |
2456 | + e.stopPropagation(); | |
2457 | + toggleYearMonthSelect(true); | |
2458 | + }); | |
2459 | + | |
2460 | + // Populate month select | |
2461 | + $.each(monthNames, function(i, v) { | |
2462 | + if(options.allowMonthSelect && selectableMonths._indexOf(i) != -1) { | |
2463 | + var o = $('<option/>').html(v).attr('value', i); | |
2464 | + if(i == firstDateMonth) { o.attr('selected', 'selected');} | |
2465 | + monthSelect.append(o); | |
2466 | + } | |
2467 | + }); | |
2468 | + | |
2469 | + // Populate year select | |
2470 | + $.each(selectableYears, function(i, v) { | |
2471 | + if(options.allowYearSelect) { | |
2472 | + var o = $('<option/>').html(v).attr('value', v); | |
2473 | + if(v == firstDateYear) { o.attr('selected', 'selected'); } | |
2474 | + yearSelect.append(o); | |
2475 | + } | |
2476 | + }); | |
2477 | + | |
2478 | + var titleYearMonth = $('<div/>') | |
2479 | + .append(monthText) | |
2480 | + .append(monthSelect) | |
2481 | + .append(yearText) | |
2482 | + .append(yearSelect); | |
2483 | + | |
2484 | + // Add to title | |
2485 | + titleCell.children().remove(); | |
2486 | + titleCell.append(titleYearMonth); | |
2487 | + | |
2488 | + // Run the callback signaling end of the render | |
2489 | + renderCalback = renderCalback || (function() {}); | |
2490 | + renderCalback(); | |
2491 | + | |
2492 | + // マウスホイールの回転 5.9.5.0 | |
2493 | + var mousewheelevent = 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'; | |
2494 | + calendar.bind(mousewheelevent,function(e){ | |
2495 | + e.preventDefault(); | |
2496 | + var delta = e.originalEvent.deltaY ? -(e.originalEvent.deltaY) : e.originalEvent.wheelDelta ? e.originalEvent.wheelDelta : -(e.originalEvent.detail); | |
2497 | + if (delta < 0){ | |
2498 | + // マウスホイールを下に | |
2499 | + nextCell.click(); | |
2500 | + } else { | |
2501 | + // マウスホイールを上に | |
2502 | + prevCell.click(); | |
2503 | + } | |
2504 | + }); | |
2505 | + | |
2506 | + } | |
2507 | + | |
2508 | + }; | |
2509 | + | |
2510 | + | |
2511 | + // Return the plugin | |
2512 | + return glDatePicker; | |
2513 | + })(); | |
2514 | + | |
2515 | + // One time initialization of useful prototypes | |
2516 | + (function() { | |
2517 | + Date.prototype._clear = function() { | |
2518 | + this.setHours(0); | |
2519 | + this.setMinutes(0); | |
2520 | + this.setSeconds(0); | |
2521 | + this.setMilliseconds(0); | |
2522 | + | |
2523 | + return this; | |
2524 | + }; | |
2525 | + | |
2526 | + Date.prototype._time = function() { | |
2527 | + return this._clear().getTime(); | |
2528 | + }; | |
2529 | + | |
2530 | + Date.prototype._max = function() { | |
2531 | + var isLeapYear = (new Date(this.getYear(), 1, 29).getMonth() == 1) ? 1 : 0; | |
2532 | + var days = [31, 28 + isLeapYear, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | |
2533 | + | |
2534 | + return days[this.getMonth()]; | |
2535 | + }; | |
2536 | + | |
2537 | + Date.prototype._add = function(days) { | |
2538 | + this.setDate(this.getDate() + days); | |
2539 | + }; | |
2540 | + | |
2541 | + Date.prototype._first = function() { | |
2542 | + var date = new Date(this); | |
2543 | + date.setDate(1); | |
2544 | + | |
2545 | + return date; | |
2546 | + }; | |
2547 | + | |
2548 | + Date.prototype._val = function() { | |
2549 | + this._clear(); | |
2550 | + | |
2551 | + return { | |
2552 | + year: this.getFullYear(), | |
2553 | + month: this.getMonth(), | |
2554 | + date: this.getDate(), | |
2555 | + time: this.getTime(), | |
2556 | + day: this.getDay() | |
2557 | + }; | |
2558 | + }; | |
2559 | + | |
2560 | + Array.prototype._indexOf = function(value) { | |
2561 | + return $.inArray(value, this); | |
2562 | + } | |
2563 | + })(); | |
2564 | +})(); | |
2565 | + | |
2566 | +/* 日付ピッカー自動セット */ | |
2567 | +$(function(){ | |
2568 | + if($.fn.glDatePicker){ | |
2569 | + $(".calPic").glDatePicker(); | |
2570 | + } | |
2571 | +}); | |
2572 | + | |
2573 | + | |
2574 | +/* | |
2575 | + * multipleのリストボックスで、初期選択されていた場合にその位置にスクロールします。 | |
2576 | + * optionの高さが取れなかったので、sizeから割り出しています。 | |
2577 | + * | |
2578 | + * @og.rev 5.9.4.5 (2016/01/29) 新規作成 | |
2579 | + */ | |
2580 | +function selectScroll(_tgt){ | |
2581 | + var size = 4; | |
2582 | + if( _tgt.getAttribute('size') ){ size= _tgt.getAttribute('size');} | |
2583 | + var _child = _tgt.options; | |
2584 | + for(var i=0; i<_child.length; i++){ | |
2585 | + if(_child[i].selected){ | |
2586 | + // 親がグループの場合のみ | |
2587 | + if( _child[i].parentNode.tagName.toUpperCase() == 'OPTGROUP'){ | |
2588 | + i += $(_child[i].parentNode).prev().length; | |
2589 | + | |
2590 | + } | |
2591 | + var firstSelected = i * ($(_tgt).height()/size); | |
2592 | + break; | |
2593 | + } | |
2594 | + } | |
2595 | + $(_tgt).scrollTop(firstSelected); | |
2596 | + } | |
2597 | + | |
2598 | +// マルチのセレクトに対して画面ロード時に実行する | |
2599 | +$(function(){ | |
2600 | + $('select[multiple]').each(function(){ selectScroll(this); }); | |
2560 | 2601 | }); |
\ No newline at end of file |