function get_client_os() { switch (navigator.platform.toLowerCase()) { case "win32": case "win64": case "windows": return "win"; case "mac68k": case "macppc": return "mac"; case "linux i686": return "nix"; default: return "wce"; return "sbi"; } } function get_client_agent() { var agent = navigator.userAgent.toLowerCase(); if (agent.indexOf("opera") > -1) return "opera"; if (agent.indexOf("chrome") > -1) return "chrome"; if (agent.indexOf("konqueror") > -1) return "konqueror"; if (agent.indexOf("safari") > -1) return "safari"; if (agent.indexOf("msie") > -1) return "ie"; else return "mozilla"; } function get_client_agent_version() { var agent = navigator.userAgent.toLowerCase(); } function get_client_language() { if (navigator.appName == 'Netscape') detect_lang = navigator.language; else detect_lang = navigator.browserLanguage; if (detect_lang.toLowerCase().indexOf('cn') > -1) _lang = "zh-CN"; else if (detect_lang.toLowerCase().indexOf('tw') > -1) _lang = "zh-TW"; else _lang = "en"; return _lang; } function showWait(str) { window.status = str; if (get_client_agent() == "mozilla"){ _msg = "
"; _msg += str; _msg += "
"; $("msgtd").innerHTML = _msg; } else $("msgtd").innerHTML = str; $("acttd").width = '1px'; $("acttd").style.display = 'none'; $("msgtd").width = '100%'; $("msgtd").style.display = 'block'; } function closeWait() { window.status = ''; $("msgtd").width = '1px'; $("msgtd").style.display = 'none'; $("acttd").width = '100%'; $("acttd").style.display = 'block'; } function download_finished(obj) { try { if (obj.version != null) { closeWait(); return; } } catch (err) { } //download_failed(); activex_install_fail(); } function activex_install_fail() { //install_activeX_failed(); /*var html = "
" + "
" //+ get_string(istar_lang, "t3") + "

" + get_string(istar_lang, "t4") + "
" + get_string(istar_lang, "t5") + "

" + get_string(istar_lang, "t6") + "

" + get_string(istar_lang, "t35") + "

" + get_string(istar_lang, "t7") + "
";*/ /* for windows mozilla */ showWait(txt_download_failed); if (get_client_agent() == "mozilla") _ie_ff = get_string(istar_lang, "t42"); else if(get_client_agent() == "chrome") _ie_ff = get_string(istar_lang, "t44"); else _ie_ff = get_string(istar_lang, "t41"); /*var html = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
" + get_string(istar_lang, "t33") + "
" + "" + "" + "" + "
" + "
" + get_string(istar_lang, "t40") + "

" + _ie_ff + get_string(istar_lang, "t43") + "

" + "
";*/ if ((get_client_agent() == "mozilla") || (get_client_agent() == "chrome")) _ie_chrome = get_string(istar_lang, "t43"); else _ie_chrome = get_string(istar_lang, "t45"); var html = "" + "" + "

" + get_string(istar_lang, "t33") + "

" + get_string(istar_lang, "t40") + "

" + _ie_ff + _ie_chrome + "

" + "
"; // $("acttd").innerHTML = html; $("msgtd").innerHTML = html; } function pick_publisher() { var publisher; var xx = location.pathname.split("/"); if (xx[1] == "_") publisher = "localhost"; else publisher = unescape(xx[1]); return publisher; } var xmlHttp; function createXMLHttpRequest() { if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } } var first = true; function handleStateChange() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { if (first) { first = false; parseResult(); } } else if (xmlHttp.status == 503) { showWait(txt_notsupported); } } } function mozilla_resize() { // $("acttd").style.width = "100%"; // $("acttd").style.height = "100%"; } function firefox_plugin(object, _package, param) { var _head = ""; html += " >"; //alert(html); $("acttd").innerHTML = html; return true; } function activex_install(code) { var result = xmlHttp.responseXML; var object = result.getElementsByTagName("object")[0]; var _package = result.getElementsByTagName("package")[0]; var param = result.getElementsByTagName("param")[0]; var _agent = window.navigator.userAgent.toLowerCase(); //if(((_agent.indexOf('firefox') >= 0) && ((_agent.indexOf("firefox/4.0") >= 0) || (_agent.indexOf("firefox/6.0") >= 0))) || (_agent.indexOf("chrome") >= 0) || (_agent.indexOf("safari") >= 0) || (_agent.indexOf("opera") >= 0)) if((_agent.indexOf('firefox') >= 0) || (_agent.indexOf("chrome") >= 0) || (_agent.indexOf("safari") >= 0) || (_agent.indexOf("opera") >= 0)) { if (get_client_agent() == "opera") $("istar_x").style.display = 'none'; return firefox_plugin(object, _package, param); } var _pic = "./img/uuddownload.jpg"; /*if(istar_lang == "zh-CN") _pic = "./img/uudlogo_adv_CN.gif"; else if(istar_lang == "zh-TW") _pic = "./img/uudlogo_adv_TW.gif"; else _pic = "./img/uudlogo_adv_EN.gif";*/ if (get_client_agent() == "mozilla") var _head = "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n"; if (istar_lang != null) { html += "\n"; } try { var v = param.getElementsByTagName("realms")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } try { var v = param.getElementsByTagName("secimage")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } try { var v = param.getElementsByTagName("cert")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } try { var v = param.getElementsByTagName("relays")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } try { var v = param.getElementsByTagName("account")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } try { var v = param.getElementsByTagName("displaypublisher")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } try { var v = param.getElementsByTagName("dnshostlist")[0].firstChild.nodeValue; html += "\n"; } catch (err) { } html += "\n"; /* for windows mozilla */ if (get_client_agent() == "mozilla") { html += "\n"; html += "\n"; html += "\n"; html += "\n"; if (code != 0) { $("app_div").innerHTML = ""; //$("msg_div").innerHTML = "Package is invalid."; // change to mul languages By Add 2010.01.11 $("msg_div").innerHTML = get_string(istar_lang, "ff_error_cab_verify"); return; } window.captureEvents(Event.RESIZE); window.onresize = mozilla_resize; } /* for windows mozilla */ //html += "" + txt_download_failed + ""; html += ""; $("acttd").innerHTML = html; } function activex_install_64() { var result = xmlHttp.responseXML; var object = result.getElementsByTagName("object")[0]; var param = result.getElementsByTagName("param")[0]; var _pic = "./img/uuddownload.jpg"; var _head = "" + "\n" + "\n" + "\n"; html += ""; $("acttd").innerHTML = html; } // firefox xpinstall error code // By Add 2010.01.11 function firefox_xpinstall_error(code) { $("app_div").innerHTML = ""; _err_msg = "
"; if(code == 0) // success to install _err_msg += get_string(istar_lang, "ff_upgrade_success"); else if((code == 1) || (code == 5))// package is invalid _err_msg += get_string(istar_lang, "ff_error_cab_verify"); else if(code == 2) // failt to decode the package _err_msg += get_string(istar_lang, "ff_eror_extract_cab"); else if(code == 3) // need to reboot as to complete the upgrade _err_msg += get_string(istar_lang, "ff_upgrade_reboot_need"); else if(code == 4){ // fail to elegant _err_msg = "
"; _err_msg += get_string(istar_lang, "ff_elevation_fail"); } else if(code == 9) // Extract files _err_msg += get_string(istar_lang, "ff_extract_files"); _err_msg += "
"; $("msg_div").innerHTML = _err_msg; } function parseResult() { var result = xmlHttp.responseXML; var object = result.getElementsByTagName("object")[0]; var _package = result.getElementsByTagName("package")[0]; var param = result.getElementsByTagName("param")[0]; closeWait(); switch (get_client_os()) { case "win": if (get_client_agent() == "ie") { //if(window.navigator.platform == 'Win64') // activex_install_64(); //else activex_install(0); break; } /* for windows mozilla */ _dotver = object.getElementsByTagName("version")[0].firstChild.nodeValue; _hexver = istarframe_version(plugin_name); _istarmobilehexver = istarframe_version(istarmobile_pluginname); $("acttd").style.width = "100%"; $("acttd").style.height = "100%"; if (_hexver==null || _istarmobilehexver==null || dot_2_hex(_dotver)>_hexver) { var _path = object.getElementsByTagName("codebase")[0].firstChild.nodeValue.replace(/ipkg/, 'iplg'); if (get_client_agent() == "mozilla") { istarframe_install(_path + '/win32-x86.cab'); activex_install_fail(); } else if (get_client_agent() == "chrome") { //_path = object.getElementsByTagName("codebase")[0].firstChild.nodeValue.replace(/ipkg/, 'ipcg'); // var installPath = _path + '/win32-x86.crx'; _path = "./download/win32-x86.crx"; showChromeInfoBar(_path); activex_install_fail(); // location.replace(installPath); } } else { html = "_hexver) { var _path = object.getElementsByTagName("codebase")[0].firstChild.nodeValue.replace(/ipkg/, 'iplg'); istarframe_install(_path + '/linux-x86.cab'); } else { var html = "" + "
" + "
"; $("acttd").innerHTML = html; } break; } } function loadSvcContent(url) { showWait(txt_downloading); try { createXMLHttpRequest(); xmlHttp.onreadystatechange = handleStateChange; xmlHttp.open("GET", url, true); xmlHttp.send(null); } catch (err) { download_failed(); } } /* script for mozilla */ var plugin_name = "ISTAR Plug-in"; var istarmobile_pluginname = "ISTARMobileTool Plug-in"; function istarframe_version(_pluginname) { if (navigator.plugins) { var plugin = navigator.plugins[_pluginname]; if (plugin) return plugin.description; } return null; } function dot_2_hex(dot) { var _hex = ""; var _dv = dot.split("."); for (i=0; i<_dv.length; i++) { _number = parseInt(_dv[i]); _string = "0" + _number.toString(16); _hex += _string.substr(-2, 2); } return _hex; } function xpinstall_callback(url, status) { if(status ==0) navigator.plugins.refresh(true); else $("msg_div").innerHTML = "click here to install."; } function istarframe_install(_pkg_path) { //xpi={'plugins/XISTARPlugin' : _pkg_path + '/istarframe.xpi'}; xpi={'plugins/XUUSpeedPlugin' : _pkg_path}; return InstallTrigger.install(xpi, xpinstall_callback); } function istarapp_install(code) { $("app_div").innerHTML = ""; if (code == 0) { $("msg_div").innerHTML = "Install package succeed."; istar_connect(xmlHttp.responseText); } else $("msg_div").innerHTML = "Package is invalid."; } function download_process(dsize, tsize) { if (tsize > 0) { _dp = "" + (dsize/tsize) * 100; //$("msg_div").innerHTML = _ss.substr(0, 5) + "%"; //_ss = "
" /*_ss = "
" + "
" + "

" //+ "downloaded "+ _dp.substr(0, 5) +"%"; // change to mul languages + get_string(istar_lang, "ff_download_per") + _dp.substr(0, 5) +"%";*/ //_ss = "

" _ss = "
" + "
" + "

" //+ "downloaded "+ _dp.substr(0, 5) +"%"; // change to mul languages + get_string(istar_lang, "ff_download_per") + _dp.substr(0, 5) +"%"; $("msg_div").innerHTML = _ss; } } function $(){ return document.getElementById(arguments[0]); } function login_commit(account_required) { $("user").disabled = true; $("pass").disabled = true; $("realm").disabled = true; $("btn_login").disabled = true; $("btn_reset").disabled = true; if (account_required == 1) { $("account_name").disabled = true; $("account_pass").disabled = true; $("account_save").disabled = true; $("istar_x").call("login", $("user").value, $("realm").value, $("pass").value, $("account_name").value, $("account_pass").value, $("account_save").checked?"1":"0"); } else $("istar_x").call("login", $("user").value, $("realm").value, $("pass").value); $("msg_div").innerHTML = "Authenticating..."; $("app_div").innerHTML = ""; document.body.style.cursor = 'wait'; } function login_reset(account_required) { $("user").value = ""; $("pass").value = ""; if (account_required == 1) { $("account_name").value = ""; $("account_pass").value = ""; $("account_save").checked = false; } } /* param : realms: realm list account_required: account login default_realm: default realm account_save: save account option account_name: account name account_pass: account pass */ function show_login(realms, account_required) { var login_html_header = "" + ""; var login_html_foot = "
"; var login_html_body = " " + " User Login" + " " + " "; var publisher_html_body = "" + ""; publisher_html_body += " " + " " + " " + " "; var realm_info = " " + " " + " " + " "; publisher_html_body += realm_info; publisher_html_body += " " + " " + " " + " " + " " + " " + " " + " "; publisher_html_body += "
Publisher:
Realm:
Username:
Password:
" + ""; login_html_body += publisher_html_body + " "; var account_html_body = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "
VeriWire Account:
VeriWire Password:
" + " " + " " + "
"; if (account_required == 1) login_html_body += account_html_body; login_html_body += " " + " " + " " + " " + " " + " " + " " + "  " + " " + " " + " "; $("msg_div").innerHTML = ""; $("app_div").innerHTML = login_html_header + login_html_body + login_html_foot; if (arguments.length == 3) { var params = arguments[2]; switch (params.length) { case 4: if (account_required && params[1]==1) $('account_pass').value = params[3]; case 3: if (account_required && params[1]==1) $('account_name').value = params[2]; case 2: if (account_required) $('account_save').checked = params[1]; case 1: for (var i=0; i<$('realm').options.length; i++) { if ($('realm').options[i].value != params[0]) continue; $('realm').options[i].selected = true; break; } break; } } } function show_applist(appid, appname, path, param, icon) { document.body.style.cursor = 'default'; $("msg_div").innerHTML = ""; var appitem = "

" + "" + "
" + appname + "" + "" + "" + "" + "
"; $("app_div").innerHTML += appitem; } function show_error(code) { document.body.style.cursor = 'default'; $("app_div").innerHTML = ""; switch (-code) { case 402: $("msg_div").innerHTML = "No applications"; break; case 403: $("msg_div").innerHTML = "Authentication failed"; break; case 0x20001001: $("msg_div").innerHTML = "System exception [incompatible session parameters]"; break; case 0x20001001: $("msg_div").innerHTML = "System exception [cb_transport]"; break; case 0x20001002: $("msg_div").innerHTML = "Session negotiation timed out"; break; case 0x20001003: $("msg_div").innerHTML = "cb_final_recv"; break; case 0x20001004: $("msg_div").innerHTML = "Failed to connect to VeriWire network"; break; case 0x20001005: $("msg_div").innerHTML = "System exception [create_sslctx]"; break; case 0x20000007: $("msg_div").innerHTML = "Session terminated by the same account logged in at a different location"; break; case 0x20010001: $("msg_div").innerHTML = "VeriWire subscriber authentication failed"; break; default: $("msg_div").innerHTML = "Lost connection. code = " + code; break; } } function _resume_cursor(_id) { $('icon_'+_id).style.cursor = 'pointer'; document.body.style.cursor = 'default'; } function launch_app(appid) { $('icon_'+appid).style.cursor = 'wait'; document.body.style.cursor = 'wait'; $("istar_x").call("launch", appid); window.setTimeout(_resume_cursor, 5000, appid); } function istar_connect(rappxml) { $("istar_x").call("connect", location.host, pick_publisher(), rappxml); } function set_app_info(appid) { var _path = $("path_text").value; $("path_"+appid).value = _path; var _param = $("param_text").value; $("param_"+appid).value = _param; var _icon = $("icon_text").value; $("icon_"+appid).value = _icon; $("istar_x").call("setapp", appid, _path, _param, _icon); } var g_drag = false; var g_diffx = 0; var g_diffy = 0; function handle_drag_start(e) { g_drag = true; var obj = $("menu_div"); g_diffx = e.pageX - obj.offsetLeft; g_diffy = e.pageY - obj.offsetTop; } function handle_drag(e) { if (g_drag == false) return; var obj = $("menu_div"); obj.style.left = e.pageX - g_diffx; obj.style.top = e.pageY - g_diffy; } function handle_drag_stop(e) { g_drag = false; } function create_config_div(appid) { var divhtml = ""; divhtml += "" + "" + "" + "" + "" + "" + "" + "
" + "
Config
" + "
" + "X" + "
Application:"+ $('name_'+appid).value +"
Local Client:" + "" + "" + "
Icon:" + "" + "" + "
Parameter:
" + "" + "  " + "
"; return divhtml; } function show_menu(appid, x, y) { var menu_width = 400; var menu_height = 200; var objdiv = document.createElement("DIV"); objdiv.id = "menu_div"; objdiv.style.width = menu_width; objdiv.style.height = menu_height; objdiv.style.position = 'absolute'; objdiv.style.background = '#C5C5B8'; objdiv.style.border = 'solid 1px #000'; if (x + menu_width > document.body.clientWidth) objdiv.style.left = x-menu_width; else objdiv.style.left = x; if (y + menu_height > document.body.clientHeight) objdiv.style.top = y-menu_height; else objdiv.style.top = y; objdiv.onmousemove = handle_drag; objdiv.onmouseup = handle_drag_stop; objdiv.innerHTML = create_config_div(appid); document.body.appendChild(objdiv); $('path_text').value = $('path_'+appid).value; $('param_text').value = $('param_'+appid).value; } function hide_menu() { var obj = $("menu_div"); if (obj == undefined) return; obj.parentNode.removeChild(obj); } function config_app(appid, e) { hide_menu(); show_menu(appid, e.pageX, e.pageY); return false; } var selected_app; function select_app(obj) { if (selected_app!=undefined && obj!=selected_app) selected_app.parentNode.childNodes[2].style.background = '#FFFFFF'; selected_app = obj; obj.parentNode.childNodes[2].style.background = '#acacac'; return; } /* ajax for rvsweb proxy */ function ajax(method, url, data, onload_call, onsend_call) { var _httpobj; var _httpurl; function createXMLHttpRequest() { var _xmlhttp = null; if (window.ActiveXObject) { _xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { _xmlhttp = new XMLHttpRequest(); } return _xmlhttp; } function handleStateChange() { if (_httpobj.readyState != 4) return; onload_call(_httpobj, _httpurl); } try { _httpurl = url; _httpobj = createXMLHttpRequest(); if (onload_call != null) _httpobj.onreadystatechange = handleStateChange; _httpobj.open(method, url, false); if (onsend_call != null) onsend_call(_httpobj, _httpurl); _httpobj.send(data); } catch (e) { return false; } return true; } function rvsweb_login(_u, _p, _r) { var _as = location.pathname.split("/"); if (_as[1] == "_") re_url = "/" + _as[1] + "/rweb/?login"; else re_url = "/" + _as[1] + "/_/rweb/?login"; var _data = "realm="+_r+"&user="+_u+"&pass="+_p; ajax('POST', re_url, _data, null, null); } function rvsweb_launch(_appid, _url) { var chips = _url.match(/^(\/|https?:\/\/)/i); var re_url = ''; if (chips == null) re_url = "/_P_HTTP/" + _url; else if (chips[0] == "https://") re_url += "/_P_HTTPS/" + _url.substring(chips[0].length); else re_url = "/_P_HTTP/" + _url.substring(chips[0].length); var _as = location.pathname.split("/"); if (_as[1] == "_") re_url = "/" + _as[1] + "/rweb/" + _appid + re_url; else re_url = "/" + _as[1] + "/_/rweb/" + _appid + re_url; window.open(re_url); } function istar_unload (bunload) { istar_checkunload = bunload; }