// Current window var gausCurrentWindow = 0; // ---------------------------------- // Gaus Client class // ---------------------------------- function gausClientInterface() { // Background window html content this.WindowContent = new Array(); // Identify user this.WindowContent[10] = '
Процесс идентификацииЗакрыть
\ \
 
 
\ \
Закрыть окно
\
\ '; // Register user this.WindowContent[20] = '
Процесс регистрацииЗакрыть
\ \
 
 
\ \
Закрыть окно
\
\ '; /*
Процесс регистрации
\
Закрыть
\
\
\
Закрыть окно
\
\ */ // Window size this.winWidth = 300; this.winHeight = 300; // Create status view array this.StatusView = new Array(); // Screens for each status this.StatusView[10] = '
\ \ Пожалуйста подождите\
'; // Update process this.StatusView[15] = '
Требуется обновление
'; // Scanning finger this.StatusView[20] = '
\ \ Пожалуйста подождите
\ \ Приложите палец\
'; // Scannign finger in scheme this.StatusView[25] = '
\ \ Пожалуйста подождите
\ \ Приложите палец(%d/%d)\
'; // Scanning finger for register this.StatusView[27] = '
\ \ Пожалуйста подождите
\ \ Приложите палец(%d/%d)\
'; // Processing finger this.StatusView[30] = '
\ \ Пожалуйста подождите
\ \ Приложите палец
\ \ Обработка отпечатка\
'; // Seding data this.StatusView[40] = '
\ \ Пожалуйста подождите
\ \ Приложите палец
\ \ Обработка отпечатка
\ \ Передача данных\
'; // End of process this.StatusView[50] = '
\ \ Пожалуйста подождите
\ \ Приложите палец
\ \ Обработка отпечатка
\ \ Передача данных
\ \ Процесс завершен\
'; // Create error statuses list this.ErrorView = new Array(); // -------------------------------- // Init errors // -------------------------------- // Screens for each status this.ErrorView[0] = '
Ошибка доступа к Gaus.Client%s
'; this.ErrorView[1040] = '
Ошибка : отсутствует считывающее устройство%s
'; this.ErrorView[3010] = '
Ошибка приложения%s
'; // Gaus launcher errors this.ErrorView[7010] = '
Неправильная команда%s
'; this.ErrorView[7020] = '
Ошибка загрузки библиотеки Gaus.Client%s
'; this.ErrorView[7030] = '
Ошибка некорректной библиотеки Gaus.Client%s
'; // -------------------------------- // Scan errors // -------------------------------- // Biometry errors this.ErrorView[3020] = '
Ошибка сенсора%s
'; this.ErrorView[3050] = '
Ошибка : таймаут%s
'; this.ErrorView[3030] = '
Ошибка сканирования отпечатка%s
'; // -------------------------------- // Process errors // -------------------------------- this.ErrorView[3040] = '
Ошибка : плохое качество отпечатка%s
'; // -------------------------------- // Send errors // -------------------------------- // Register finger errors this.ErrorView[-302] = '
Ошибка : пользователь уже зарегистрирован%s
'; this.ErrorView[-304] = '
Ошибка : отпечаток уже зарегистрирован%s
'; this.ErrorView[-588] = '
Ошибка : образцы отпечатков не совпадают%s
'; // Portal errors this.ErrorView[8010] = '
Ошибка : соединение с порталом отсутствует%s
'; this.ErrorView[8020] = '
Ошибка : некоректный ответ портала.%s
'; this.ErrorView[8030] = ''; this.ErrorView[8040] = ''; // Gaus server errors this.ErrorView[2010] = '
Ошибка : нет доступа%s
'; this.ErrorView[2020] = '
Ошибка : неккорректная сессия%s
'; this.ErrorView[2030] = '
Ошибка : доступно критическое обновление%s
'; this.ErrorView[2040] = '
Ошибка : доступна новая версия клиента%s
'; this.ErrorView[2050] = '
Ошибка : нет доступа к сервису%s
'; this.ErrorView[2060] = '
Ошибка : некорректный портал%s
'; this.ErrorView[2070] = '
Ошибка : некорректная инициализация%s
'; this.ErrorView[2080] = '
Ошибка : некорректный ответ сервера%s
'; // Gaus updater errors this.ErrorView[9010] = '
Ошибка : нет доступа к серверу обновлений%s
'; this.ErrorView[9020] = '
Ошибка : некорректный пакет обновлений%s
'; this.ErrorView[9030] = '
Ошибка : сохранение на диск невозможно%s
'; } // ---------------------------------- // Show client window // ---------------------------------- gausClientInterface.prototype.showWindow = function(tn) { // Set curretn window mode this.currentMode = tn; // Store current window gausCurrentWindow = this; // No transparency this.winTrans = 0; // Create transfer tag var s = document.getElementById('gausWindow'); if (s) s.parentNode.removeChild(s); // Create element var s = document.createElement('div'); s.id = 'gausWindow'; s.innerHTML = this.WindowContent[tn]; this.setOpacity(s, this.winTrans); // Place window to screen center s.style.left = (document.body.clientWidth-this.winWidth)/2; s.style.top = (document.body.clientHeight-this.winHeight)/2; // Add element to body if(document.body) document.body.appendChild(s); else alert("Body tag is not defined"); // Set transparency mode this.fadeEffect(1); } // ---------------------------------- // sET LAYER OPACITY // ---------------------------------- gausClientInterface.prototype.reScanFinger = function() { // Check for client mode if(this.currentMode == 10) { gausCurrentRequest.identifyScan(); } else { if(gausCurrentRequest.packetsScanned==3) gausCurrentRequest.packetsScanned = 0; gausCurrentRequest.registerScan(); } } // ---------------------------------- // sET LAYER OPACITY // ---------------------------------- gausClientInterface.prototype.setOpacity = function(comp, op) { // Set opacity comp.style.opacity = op; comp.style.MozOpacity = op; comp.style.KhtmlOpacity = op; comp.style.filter = "alpha(opacity=" + (100*op) + ")"; } // ---------------------------------- // Fade effect // ---------------------------------- gausClientInterface.prototype.fadeEffect = function(dir) { // Get window var s = document.getElementById('gausWindow'); // Create background layer var bg = document.getElementById('gausWindowBG'); // Check for bg if(!bg) { // Create element bg = document.createElement('div'); bg.id = 'gausWindowBG'; bg.className = "guasBackgroundContent"; document.body.appendChild(bg); } // Set bg style this.setOpacity(bg, (this.winTrans/2)); // No window - no effects if(!s) return; // Check direction if(dir==1) this.winTrans += 0.1; else this.winTrans -= 0.1; // Update opacity this.setOpacity(s, (this.winTrans<0?0:(this.winTrans>1?1:this.winTrans))); // Timeout if( (this.winTrans>0)&&(this.winTrans<1) ) { setTimeout("gausCurrentWindow.fadeEffect("+dir+");", 50); } else { // Check for transparency if(this.winTrans<=0) { // Create transfer tag s = document.getElementById('gausWindowBG'); if(s) s.parentNode.removeChild(s); s = document.getElementById('gausWindow'); if(s) s.parentNode.removeChild(s); } } } // ---------------------------------- // Hide client window // ---------------------------------- gausClientInterface.prototype.hideWindow = function() { // Create transfer tag //var s = document.getElementById('gausWindow'); //if (s) s.parentNode.removeChild(s); this.fadeEffect(-1); } // ---------------------------------- // Handle client errors // ---------------------------------- gausClientInterface.prototype.handleError = function(Code) { var link = '[?]'; // Set status document.getElementById("gausError").innerHTML = sprintf(this.ErrorView[Code], " "+link);/**/ if( (Code==3040)||(Code==-304)||(Code==-302)||(Code==-588) ) { document.getElementById("gs_Retry").style.display = "block"; } // Show close button document.getElementById("gs_closeError").style.display = "block";/**/ } // ---------------------------------- // Handle client status // ---------------------------------- gausClientInterface.prototype.handleStatus = function(Code, arg1, arg2, arg3) { // Set status var el = document.getElementById("gausStatus"); if(el) el.innerHTML = sprintf(this.StatusView[Code], (arg1!=undefined?arg1:0), (arg2!=undefined?arg2:0), (arg3!=undefined?arg3:0)); // Reset error code el = document.getElementById("gausError"); if(el) el.innerHTML = ""; // Hide close button document.getElementById("gs_closeError").style.display = "none"; } // This code is in the public domain. Feel free to link back to http://jan.moesen.nu/ function sprintf() { if (!arguments || arguments.length < 1 || !RegExp) { return; } var str = arguments[0]; var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; var a = b = [], numSubstitutions = 0, numMatches = 0; while (a = re.exec(str)) { var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4]; var pPrecision = a[5], pType = a[6], rightPart = a[7]; //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision); numMatches++; if (pType == '%') { subst = '%'; } else { numSubstitutions++; if (numSubstitutions >= arguments.length) { alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).'); } var param = arguments[numSubstitutions]; var pad = ''; if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1); else if (pPad) pad = pPad; var justifyRight = true; if (pJustify && pJustify === "-") justifyRight = false; var minLength = -1; if (pMinLength) minLength = parseInt(pMinLength); var precision = -1; if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1)); var subst = param; if (pType == 'b') subst = parseInt(param).toString(2); else if (pType == 'c') subst = String.fromCharCode(parseInt(param)); else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0; else if (pType == 'u') subst = Math.abs(param); else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param); else if (pType == 'o') subst = parseInt(param).toString(8); else if (pType == 's') subst = param; else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase(); else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase(); } str = leftpart + subst + rightPart; } return str; }