var xMenu;var login_count=1;var timer_x=0;var timer_y=0;var timer_z;var topno=0;var utl='';var usrid='',usrname='',empno='',ver_type='',mdls='';var dateDiff=0;var dragX=0;var dragY=0;var menuTimer;var curdate=new Date();var msgtext="1. 以瀏覽器為使用者介面,透過 Internet 即可操作使用. "+"2. 客戶端不需安裝本系統之應用程式,執行速度最快. "+"3. 各功能操作皆在同一畫面,無須不斷換頁,簡化網頁上的操作流程. ";msgtext+=msgtext;timer_z=msgtext.length;var DataObj=new Object();DataObj.mdl='';DataObj.page=0;DataObj.str='';DataObj.back='';DataObj.atn=0;DataObj.no='';DataObj.gro_no='';DataObj.emp_serno='';DataObj.wm=null;DataObj.srcObj=null;DataObj.fields='';DataObj.rs=null;DataObj.rs1=null;DataObj.v1=null;DataObj.v2=null;DataObj.v3=null;makeFrame('msg',0,0,300,50,'none',1000);makeFrame('fmenu',0,0,10,10,'none',1001);makeFrame('fwait',0,0,10,10,'none',1002);function init(){window.onresize=myResize;window.onunload=myUnload;setDateDiff();setUpdate();setUtl();showUserCount();myResize();setInterval("showStatustext()",300);setInterval("showTime()",1000);setInterval("showUserCount()",180000);doc("main").src="?path=html/login";}function myResize(){doc("tb_main").style.width=document.body.clientWidth;doc("tb_main").style.height=document.body.clientHeight;doc("dv_title").style.left=document.body.clientWidth-doc("dv_title").offsetWidth-10;doc("dv_update").style.top=document.body.clientHeight-doc("dv_update").offsetHeight-4;doc("dv_update").style.left=document.body.clientWidth-156;}function myUnload(){var s;s="delete from acslog WHERE DATEDIFF('n',ActiveTime, Now)>6 or SessionID='"+getCookie("session")+"'";delCookie('login');delCookie('serno');delCookie('session');delCookie('uid');delCookie('usrname');execSQL(s);};function setDateDiff(){var s,d1,d2,n1,n2,rs=new XmlRS();s="?path=fun/time";rs.Open(s);d1=new Date();n1=Math.abs(Date.parse(d1));d2=new Date();d2.setFullYear(rs.Fields("year"),getIntValue(rs.Fields("month"))-1,rs.Fields("day"));d2.setHours(rs.Fields("h"),rs.Fields("n"),rs.Fields("s"));n2=Math.abs(Date.parse(d2));dateDiff=n2-n1;}function setUpdate(){var s;rsTmp.OpenSys("select max(updtime) as t from jscript");s=rsTmp.Fields(0).value;doc("dv_update").innerHTML='[@'+s.substr(0,4)+'.'+s.substr(4,2)+'.'+s.substr(6,2)+' '+s.substr(8,2)+':'+s.substr(10,2)+']';}function setUtl(){var s,s1,i,j;rsTmp.OpenSys("select Content"+((IE)?"":"1")+" from JScript where Code='utility'");utl=rsTmp.Fields(0).value;s="select ser_no,type,cmp_name,cmp_key from Syssn";rsTmp.OpenSys(s);if(rsTmp.EOF) return;doc("cmp_name").innerHTML=rsTmp.Fields("cmp_name").value;s1=rsTmp.Fields("cmp_key").value;s=String.fromCharCode(parseInt('0x'+s1.substr(2,2))-80)+String.fromCharCode(parseInt('0x'+s1.substr(4,2))-130)+String.fromCharCode(parseInt('0x'+s1.substr(6,2))-180);topno=parseFloat(s);s=rsTmp.Fields("type").value;var rsCmd=new XmlRS();rsCmd.Open("./?path=utl/dec&text="+s,0);ver_type=rsCmd.Fields("Response");mdls="'Y','chkpoint','Z','chgpasswd','setuser','security','Z10','params','bpoint','bgroup','workshift','examtime','Z20','tvdevice'";var aMdl=new Array("pointchl/RS232_VOD_PUB_PA","eboard1/RS232_VOD","eboard2/RS232_VOD","broadcast/RS232_VOD","pboardcast/PUB","pboard_sch/PUB","paboard/PA","englisten/ENG","X/RS232_VOD_PUB","eboard_def/RS232_VOD","voddir/VOD_PUB","vodfile/VOD_PUB","pboard/PUB","pboard_def/PUB","pboard_msg/PUB","volume/RS232_VOD_PUB_PA","dvdplayer/RS232_VOD","tvremote/RS232_VOD","client/VOD","log/RS232_VOD","channel/RS232_VOD","belltime/PAP");sMdl=ver_type.split("_");if((ver_type=="DEMO") || (ver_type=="")) return;var a,ss;for(i=0;i=0){mdls+=",'"+a[0]+"'";break;}}}};function showUserCount(){var s=getCookie("session");if(s!=""){s="update acslog set "+"ActiveTime='"+doc("timer").innerHTML.replace(/\./g,"/")+"' "+"where SessionID='"+s+"'";execSQL(s);}s="SELECT COUNT(*) as no FROM acslog WHERE DATEDIFF('n', ActiveTime, Now) < 6";rsTmp.Open(s);doc("users").innerHTML=rsTmp.Fields("no").value;};function showStatustext(){window.status=msgtext.substring(timer_x,timer_x+timer_z);timer_x++;if(timer_x==timer_z) timer_x=0;}function showTime(){var y,m,d,h,n,s;curdate=new Date();curdate.setTime(Math.abs(Date.parse(curdate))+dateDiff);y=curdate.getFullYear();m=curdate.getMonth()+1;if(m<10) m="0"+m;d=curdate.getDate();if(d<10) d="0"+d;h=curdate.getHours();if(h<10) h="0"+h;n=curdate.getMinutes();if(n<10) n="0"+n;s=curdate.getSeconds();if(s<10) s="0"+s;doc("timer").innerHTML=y+DATE_SEPARATOR+m+DATE_SEPARATOR+d+" "+h+":"+n+":"+s;}function showusers(){closeMenu();myParent=window;showDialog('?path=html/showusers',window);}function logout(){if(!window.confirm('您確定要登出本系統嗎?')) return;delCookie('login');delCookie('serno');setTimeout("location.href='default.asp?path=html/defaultn'",200);}function mymousedown(){var s=window.location+"";if((s.indexOf("localhost")<0) && (GetCookies("empno")!="admin")){if((event.srcElement.tagName.toLowerCase()!="input") &&(event.srcElement.tagName.toLowerCase()!="textarea")){if(event.button==2) alert("本網頁請使用左鍵操作!");}}}function dragStart(e,obj){if(e.clientX==0) return;dragX=e.clientX-obj.offsetLeft;dragY=e.clientY-obj.offsetTop;}function dragging(e,obj){}function dragEnd(e,obj){if(e.clientX==0) return;obj.style.left=e.clientX-dragX;obj.style.top=e.clientY-dragY;}function setDialogSize(obj){var dlg=document.all.fm_dialog;dlg.style.width=obj.offsetWidth+20;dlg.style.height=obj.offsetHeight+25;dlg.style.top=(document.body.clientHeight-dlg.offsetHeight)/2;dlg.style.left=(document.body.clientWidth-dlg.offsetWidth)/2;}function hideDialog(){document.all.dlgFilter.style.display='none';var fm=document.all.fm_dialog;fm.style.width=0;fm.style.height=0;fm.style.top=0;fm.style.left=0;fm.style.display='none';}function hideSearch(){document.all.srhFilter.style.display='none';var fm=document.all.fm_search;fm.style.width=0;fm.style.height=0;fm.style.top=0;fm.style.left=0;fm.style.display='none';fm.src="about:blank";}function loadMenu(){var i,s,s1,no;s="select a.*,b.sys_mdl_code,b.sys_mdl_upcode,b.sys_mdl_cname,b.sys_mdl_asp "+"from permission a,sys_mdl b "+"where a.per_pro_code=b.sys_mdl_code "+"and emp_no='"+empno+"' "+"and b.sys_mdl_use=1 and a.per_run=1 ";if(ver_type==""){s+="and b.sys_mdl_code='0'";}else if(ver_type!="DEMO"){s+="and (b.sys_mdl_asp in ("+mdls+") or b.sys_mdl_code in ("+mdls+"))";}s+="order by b.sys_mdl_upcode,a.per_pro_code";xMenu=new DataSet();xMenu.Open(s,0);s='|';for(i=0;i1){s+=' onmouseover="this.className=\'t_m_v\';closeMenu()"'+' onmouseout="this.className=\'t_m_o\'"'+' onclick="openFrame(\''+no+'\''+',\''+s1+'\''+',\''+xMenu.Fields("sys_mdl_cname").value+'\')"';}else{s+=' onmouseover="this.className=\'t_m_v\';openMenu(event,\''+no+'\',0)"'+' onmouseout="this.className=\'t_m_o\'"'+' onclick="openMenu(event,\''+no+'\',1)"';}s+='>'+xMenu.Fields("sys_mdl_cname").value+'|';}else{break;}xMenu.MoveNext();}doc('menu').innerHTML=s;}function makeMenu(v,vMenu){var s,s1,i,node,upno,no,isF=false;var fontSize=13;s='
'+''+'
 '+'
';xMenu.MoveFirst();for(i=0;i
';}else{s+='
'+s1+'
';}}else{if(isF) break;}xMenu.MoveNext();}s+='
';doc('dv_menu').innerHTML=s;}function openMenu(e,v,isOpen){clearTimeout(menuTimer);var obj,oMenu=doc('fmenu');if((!isOpen) && (oMenu.style.display=="none")) return;if(v) makeMenu(v);oMenu.style.display="";obj=myTarget(e);var coord=getCoord(obj);if((coord.x+doc('dv_menu').offsetWidth)>document.body.clientWidth) coord.x=document.body.clientWidth-doc('dv_menu').offsetWidth-4;oMenu.style.left=coord.x;oMenu.style.top=coord.y+obj.offsetHeight+3;oMenu.style.width=doc('dv_menu').offsetWidth;oMenu.style.height=doc('dv_menu').offsetHeight;oMenu.contentWindow.document.write(''+doc('dv_menu').innerHTML+'');oMenu.contentWindow.document.close();oMenu.style.height=oMenu.contentWindow.document.body.clientHeight;oMenu.style.display="";doc('dv_menu').innerHTML='';if(IE){oMenu.ondeactivate=closeMenu;}else{oMenu.contentWindow.onblur=closeMenu;}oMenu.contentWindow.focus();}function closeMenu(){doc('fmenu').style.display='none';menuTimer=setTimeout("doc('fmenu').style.display='none'",50);}function openFrame(code,vHtml,vname){closeMenu();doc("main").src="?path=html/"+vHtml+"&fmno="+code;}function loading(){document.all.img_loader.style.visibility="visible";}function uploading(){document.all.img_loader.style.visibility="hidden";}function getPubPoint(){return(getPointHtml(true,null,null,"CtrlKind='PUB'"));}function getPointList(isch,vTime,vDate,vFilter){var s;if(ver_type.indexOf('RS232')>=0) s="IIF(ISNULL(CtrlKind),'',CtrlKind)<>'PUB'";return(getPointHtml(isch,vTime,vDate,s));}function getPointHtml(isch,vTime,vDate,vFilter){var rsG=new DataSet();var rsP=new DataSet();var rsW=new DataSet();var s,s1,a,i,htm='';var ch,sno,week,isF=false;rsG.Open("select * from BGroup where names<>'' order by Sno");s="select "+((topno>0)?"top "+topno+" ":"")+" a.*,b.ChColor,b.Name as ChName from BPoint a "+"left join Channel b on a.Ch1=b.ID "+"where a.Bad<>1 "+"and (IIF(ISNULL(a.TV1),0,a.TV1)<>0 or IIF(ISNULL(a.TV2),0,a.TV2)<>0) "+"and IIF(ISNULL(CtrlKind),'',CtrlKind)<>'DVR' "+((vFilter==null) ? "" : "and "+vFilter+" ");if(usrid!="admin") s+="and a.Sno in (select bpoint from UserPoint where emp_no='"+usrid+"' and isuse) ";s+="order by GroupName,a.Sno";rsP.Open(s);s="select top 1 * from workshift "+"where stime<'"+((vTime==null)?myTime():vTime)+"' "+"order by sno desc";rsW.Open(s);sno=(rsW.RecordCount==0)?"A":rsW.Fields("sno").value.substr(0,1);var d=(vDate==null) ? new Date() : strToDate(vDate);week=d.getDay();htm='';while(!rsG.EOF){s1='';a=rsG.Fields('Names').value.split(",");for(i=0;i0) rsP.MoveFirst();while(!rsP.EOF){if(((rsP.Fields('Type').value!='2') && (rsP.Fields('Name').value==a[i])) ||((rsP.Fields('Type').value=='2') && (rsP.Fields('N'+week+sno).value==a[i]))){s1+='';}rsP.MoveNext();}}if(s1!=''){htm+=''+''+s1;}rsG.MoveNext();}if(isF){htm=htm.replace(/##h##/g,'height:68;');htm=htm.replace(/##br##/g,'
');}else{htm=htm.replace(/##h##/g,'');htm=htm.replace(/##br##/g,'');}htm+='
'+'
'+'
';return(htm);}function getChannelList(notPC,vType){var s,htm,rsC=new DataSet();s="select * from Channel where ID<>null ";if(vType!=null) s+="and Type in ("+vType+") ";if(notPC) s+="and Type<>'PC' ";if(ver_type!='DEMO'){if(ver_type.indexOf('PUB')<0) s+="and not Type like 'PUB%' ";if(ver_type.indexOf('VOD')<0) s+="and not Type like 'VOD%' ";}s+="order by ID";rsC.Open(s);htm='';if(vType==null){htm+=''+'';}while(!rsC.EOF){htm+=''+'';rsC.MoveNext();}htm+='
'+'off-關機
'+''+rsC.Fields('ID').value+'-'+''+rsC.Fields('Name').value+''+'
';return(htm);}