"
//+ "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 = "
" +
"" +
" |
";
login_html_body += publisher_html_body +
"
|
";
var account_html_body = "
" +
" |
";
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 += "
";
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;
}