if(!lib)var lib={};log={};lib.trace={};lib.newStack=[];lib.WrappedUp={};lib.trace.Trace=function(){};
lib.trace.Trace.prototype={parseGlob:function(a){a=a.split(" ");for(var b=[],c=[],d=0;d<a.length;d++)if(a[d])a[d][0]==="-"?b.push(a[d].substr(1)):c.push(a[d]);this.pmatch=this.makeRegex(c);this.nmatch=this.makeRegex(b)},load:function(){var a=localStorage.getItem("log.info");this.set(a);this.addHeader(a,"")},makeRegex:function(a){if(a.length==0)return 0;for(var b="https?:\\/\\/[^\\/]*\\/(",c=0;c<a.length;c++)b+="("+a[c].replace("/","\\/").replace("*",".*")+")"+(c===a.length-1?"":"|");b+=")\\.js:";
return RegExp(b)},set:function(a,b){if(a){this.parseGlob(a);b?this.debugTraceOn(true):this.debugTraceOn(false)}else{this.debugTraceOn(false);delete this.nmatch;delete this.pmatch}},setDebug:function(a){if(a){this.debugTraceOn(true);this.set(a,true)}else this.debugTraceOn(false)},debugTraceOn:function(a){log.debug=a?this.logr:function(){}},tracing:function(){return typeof this.pmatch==="object"},log:function(){try{throw Error();}catch(a){if(a.stack){lib.newStack=a.stack.split("\n");if(lib.newStack.length>
4){var b=lib.trace.pattern.exec(lib.newStack[4]);if(b!==null){Position=b[1];if(this.pmatch.test(Position)&&(!this.nmatch||!this.nmatch.test(Position)))return Position}}}}},checkTraceStatus:function(){if(!Trace.tracing())return false;var a=Trace.log();if(a===undefined)return false;return a},logr:function(){var a=Trace.checkTraceStatus();if(a){for(var b=[],c=0;c<arguments.length;c++)b[c]=typeof arguments[c]==="string"?arguments[c]+" ":backendlog.stringify(arguments[c])+" ";b.push(a);backendlog.appendLog(b,
false)}},variable:function(){var a=[],b=Trace.checkTraceStatus();if(b){for(var c=0;c<arguments.length;c+=2){a[c]=arguments[c]+backendlog.stringify(arguments[c+1]);a[c+1]=" "}a.push(b);backendlog.appendLog(a,false)}},func:function(a,b){var c=[],d=Trace.checkTraceStatus();if(d){if(b)for(var e=0;e<b.length;e++){c[e]=backendlog.stringify(b[e]);c[e]+=e==b.length-1?")":", "}c.length===0&&c.push(")");c.unshift(">"+a+"(");c.push(d);backendlog.appendLog(c,true)}},endfunc:function(a,b){var c=Trace.checkTraceStatus();
if(c){var d=["<"+a+(b?" R:"+backendlog.stringify(b):"")];d.push(c);backendlog.appendLog(d,false)}},addHeader:function(a,b){var c="";c=a==""?{log:"*************** Tracing OFF ***************\n"}:{log:"*************** Tracing "+a+" Debugging: "+b+" ***************\n"};$.post("/javascript/log",c)},wrapItUp:function(a){for(var b in eval(a)){Parent=eval(a);if(typeof Parent[b]==="object")this.wrapItUp(a+"."+b);else if(typeof Parent[b]==="function"&&!lib.WrappedUp[Parent[b]]){lib.WrappedUp[a+"."+b]=true;
Parent[b]=Wrapper(a,b)}}}};function Wrapper(a,b,c){c=c||window;var d=eval(a)[b];return function(){for(var e=[],f="(",g=0;g<arguments.length;g++){e.push(arguments[g]);f+=arguments[g]+(g==arguments.length-1?")":",")}return d.apply(c,e)}}var Trace=new lib.trace.Trace;lib.trace.pattern=/(https?.*[0-9])/;log.info=Trace.logr;log.variable=Trace.variable;log.func=Trace.func;log.endfunc=Trace.endfunc;Trace.load();function traceInfo(a){Trace.set(a);Trace.addHeader(a,"");localStorage["log.info"]=a}
function traceDebug(a){Trace.setDebug(a);Trace.addHeader(a,a);localStorage["log.info"]=a;localStorage["log.debug"]=a?true:false}backendlog={};var TempStart="";backendlog.appendLog=function(a,b){var c={log:this.createStack(a,b)};$.post("/javascript/log",c)};backendlog.getModule=function(a){a=a.match(/((((\/[\w]+)+.[js]+:[\d]+)))/)[0];a=/(.*?)\.js(:\d+)/.exec(a);return a[1].substring(1,a[1].length)+a[2]};
backendlog.getStartFunc=function(a){this.startFunction=a.match(/(^([.\s\w]+))/)[0];if(this.startFunction.startsWith("    at Object."))this.startFunction=this.startFunction.slice(14);else if(backendlog.startFunction.startsWith("    at "))this.startFunction=this.startFunction.slice(7);return this.startFunction};
backendlog.createModule=function(a,b,c){var d=[],e="";if(typeof b[0]==="object")d.push(this.stringify(b[0]));else{for(var f=0;f<b.length-1;f++)e+=String(b[f]);d.push(e)}return this.createLine(d,b,a,c)};backendlog.createLine=function(a,b,c,d){for(var e="",f=0;f<a.length;f++){var g=new Date;g=(g.toTimeString().slice(0,8)+":"+g.getMilliseconds()+"   ").slice(0,13)+this.getModule(b[b.length-1]);if(g.length<45)g+=Array(45-g.length).join(" ");g+=Array(c).join(" | ")+(d?" ":" | ")+a[f]+"\n";e+=g}return e};
backendlog.findPresent=function(){for(var a=0;a<lib.newStack.length;a++)if(this.getStartFunc(lib.newStack[a])==TempStart)return a;return-1};
backendlog.createStack=function(a,b){var c=1;if(TempStart=="")TempStart=this.getStartFunc(lib.newStack[4]);if(TempStart==""&&lib.newStack[lib.newStack.length-1].startsWith("    at XMLHttpRequest"))TempStart=this.getStartFunc(lib.newStack[lib.newStack.length-1]);if(this.findPresent()!=-1)c=TempStart=="XMLHttpRequest.jQuery.ajaxTransport.send.callback "?this.findPresent()-8:this.findPresent()-3;else TempStart=this.getStartFunc(lib.newStack[4]);return this.createModule(c,a,b)};
backendlog.replacer=function(a,b,c){if(a!=="__ifWare2015"){a=typeof b;if(b&&(b instanceof Event||b.tagName))return"[DOM]";if(a==="object"&&b!=null)if(b.__ifWare2015)return"self";else{b.__ifWare2015=true;c.push(b)}else if(a==="function")return"[FUNC]";return b}};backendlog.deleter=function(a,b){for(var c in b)delete b[c].__ifWare2015};backendlog.stringify=function(a){var b=[],c=JSON.stringify(a,function(d,e){return backendlog.replacer(d,e,b)});backendlog.deleter(a,b);return c};/*

 Copyright (c) 2015 iNTERFACEWARE Inc.  All rights reserved.
*/
LOG_VAR=function(){var a=/(https?.*[0-9])/;return function(){var b=[],c;a:{try{throw Error();}catch(d){if(d.stack){c=d.stack.split("\n");if(c.length>3){c=a.exec(c[3]);if(c!==null){c=c[1];break a}}}}c=void 0}typeof c!=="undefined"&&b.push(c);for(c=0;c<arguments.length;c++){var e="";if(c>0)e+=", ";e+="? =";b.push(e);b.push(arguments[c])}}}();/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var AJAXusedRequestObjectStack=[],arrayRequest=[],userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf("msie")!=-1)window.attachEvent("onbeforeunload",AJAXbeforeUnload);else document.implementation&&document.implementation.createDocument&&window.addEventListener("beforeunload",AJAXbeforeUnload,false);
function AJAXbeforeUnload(){for(countArray=0;countArray<arrayRequest.length;countArray++)if(arrayRequest[countArray]){arrayRequest[countArray].onreadystatechange=function(){};arrayRequest[countArray].abort()}}function AJAXnewHttpRequest(){return AJAXusedRequestObjectStack.length==0?window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"):AJAXusedRequestObjectStack.pop()}
function AJAXremoveFromArrayRequest(a){if(a)for(var b=0;b<arrayRequest.length;)if(arrayRequest[b]==a)arrayRequest.splice(b,1);else b++}
function AJAXhandleResponse(a,b,c){try{if(a.readyState==4){try{if(a.status==200||a.status==403)b(a.responseText,a.getResponseHeader("Content-Type"),a);else if(c){b="The response from the Iguana server could not be read.";if(a.status&&a.status!=0){b+="<br />Status: "+a.status;if(a.statusText&&a.statusText!="")b+=" - "+a.statusText}c(b,a)}}catch(d){}a.onreadystatechange=function(){};AJAXusedRequestObjectStack.push(a);AJAXremoveFromArrayRequest(a)}}catch(e){if(c&&a){try{c("The response from the Iguana server could not be read.<br />"+
(e.description||e),a)}catch(f){}a.onreadystatechange=function(){};AJAXusedRequestObjectStack.push(a);AJAXremoveFromArrayRequest(a)}}}function AJAXpost(a,b,c,d){try{var e=AJAXnewHttpRequest();arrayRequest[arrayRequest.length]=e;e.open("POST",a,true);e.onreadystatechange=function(){AJAXhandleResponse(e,c,d)};e.send(b)}catch(f){d&&d("AJAX is not supported by the browser.")}}
function AJAXsynchronousPost(a,b,c,d){try{var e=AJAXnewHttpRequest();arrayRequest[arrayRequest.length]=e;e.open("POST",a,false);e.send(b);AJAXhandleResponse(e,c,d)}catch(f){d&&d("AJAX is not supported by the browser.")}}var AJAXrequestsWithIds={};function AJAXabortRequest(a){a.onreadystatechange=function(){};a.abort();AJAXusedRequestObjectStack.push(a);AJAXremoveFromArrayRequest(a)}function AJAXclearRequestId(a){AJAXrequestsWithIds[a]&&delete AJAXrequestsWithIds[a]}
function AJAXabortRequestById(a){if(AJAXrequestsWithIds[a]){AJAXabortRequest(AJAXrequestsWithIds[a]);AJAXclearRequestId(a)}}function AJAXpostWithId(a,b,c,d,e){try{AJAXabortRequestById(c);var f=AJAXnewHttpRequest();arrayRequest[arrayRequest.length]=f;f.open("POST",a,true);f.onreadystatechange=function(){f.readyState==4&&AJAXclearRequestId(c);AJAXhandleResponse(f,d,e)};f.send(b);AJAXrequestsWithIds[c]=f}catch(g){AJAXclearRequestId(c);e&&e("AJAX is not supported by the browser.")}}
if(!window.JSON){window.JSON={};window.JSON.parse=function(a){return eval("("+a+")")}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function AjaxImpl(a,b){function c(k){var p=k.error;k.error=function(t,o,x){if(p)try{if(p(t,o,x))return}catch(z){}o!=="abort"&&o!="notmodified"&&a(o,function(){jQuery.ajax(k)},t)};var n=k.success;k.success=function(t,o,x){if(x.status){var z;try{z=b(t,o,x)}catch(M){}if(z)a(z,function(){jQuery.ajax(k)},x);else n&&n(t,o,x)}else a(null,function(){jQuery.ajax(k)},x)};return jQuery.ajax(k)}function d(k,p,n,t){if(typeof n=="function"){t=n;n=undefined}return k.load(p,n,function(o,x,z){if(t)try{if(t(o,x,z))return}catch(M){}var L=
!z.status||x!="success"&&x!="notmodified";if(L){if(z.status)L=x}else try{L=b(o,x,z)||null}catch(J){L=null}if(L||!z.status)a(L,function(){d(k,p,n,t)},z)})}function e(k){return function(p,n,t,o){return typeof n=="function"?k(p,undefined,n,t):typeof t!="function"?k(p,n,undefined,t):k(p,n,t,o)}}function f(k){return e(function(p,n,t,o){return c({url:p,data:n,type:k,success:t,dataType:o})})}function g(k){return e(function(p,n,t){return c({url:p,data:n,success:t,dataType:k})})}a||(a=function(){});b||(b=
function(){});return{ajax:c,load:d,abort:function(k){if(k)try{k.onreadystatechange=function(){};k.abort()}catch(p){}},get:f(),getJSON:g("json"),getScript:g("script"),post:f("POST")}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function CLSelementHasClass(a,b){var c;return a.className&&RegExp("\\b"+b+"\\b","").test(a.className)}function CLSelementAddClass(a,b){if(a.className!==undefined&&!CLSelementHasClass(a,b))a.className+=" "+b}function CLSelementRemoveClass(a,b){if(a.className!==undefined)a.className=a.className.replace(RegExp("(^|\\s)"+b+"($|\\s)","")," ")};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var VALfieldValidationFunctions=[];function VALvalidateFields(){for(var a=0;a<VALfieldValidationFunctions.length;++a)if(VALfieldValidationFunctions[a]()==false)return false;return true}
function VALregisterTextUrlValidationFunction(a,b,c,d,e){var f=document.getElementById(a);if(f){if(f.onchange!=null){var g=f.onchange;f.onchange=function(){g();VALclearError(b,c)}}else f.onchange=function(){VALclearError(b,c)};VALfieldValidationFunctions[VALfieldValidationFunctions.length]=function(){var k=document.getElementById(a).value;if(d!=null)if(d()==false){VALclearError(b,c);return true}if(k==null||k==""){VALdisplayError(a,b,c,e,"Field cannot be left blank.");return false}if(!/^http(s|):\/\//i.test(k)){VALdisplayError(a,
b,c,e,'URL should start with "http://" or "https://"');return false}return true}}}
function VALregisterIntegerValidationFunction(a,b,c,d,e,f,g,k){f=f==undefined?1:f;g=g==undefined?2147483647:g;var p=document.getElementById(a);if(p){if(p.onchange!=null){var n=p.onchange;p.onchange=function(){n();VALclearError(b,c)}}else p.onchange=function(){VALclearError(b,c)};VALfieldValidationFunctions[VALfieldValidationFunctions.length]=function(){var t=document.getElementById(a).value,o=document.getElementById(a+"_preview"),x="";if(o)x=o.innerHTML;if(d!=null)if(d()==false){VALclearError(b,c);
return true}if(t==null||t==""){VALdisplayError(a,b,c,e,"Field cannot be left blank.");return false}else if(k&&t.search(/\${.*}/g)==0){t=x.replace("Preview: ","").trim();if(t==""||!VALisInteger(t)){VALdisplayError(a,b,c,e,"Environment variable must be set to a valid positive integer.");return false}}else if(VALisInteger(t)){t=parseInt(t);if(t<f){VALdisplayError(a,b,c,e,"Value cannot be less than "+f+".");return false}else if(t>g){VALdisplayError(a,b,c,e,"Value cannot be greater than "+g+".");return false}}else{VALdisplayError(a,
b,c,e,"Value must be a valid positive integer.");return false}return true}}}function VALdisplayError(a,b,c,d,e){a=document.getElementById(a);c=document.getElementById(c);b=document.getElementById(b);c.innerHTML='&nbsp;<img src="/images/icon_error.gif" /> '+e;d!=null&&d();d=a.onfocus;a.onfocus="";a.focus();a.onfocus=d;CLSelementAddClass(b,"error_row")}function VALclearError(a,b){var c=document.getElementById(b),d=document.getElementById(a);c.innerHTML="";CLSelementRemoveClass(d,"error_row")}
function VALisInteger(a){for(var b=0;b<a.length;++b){var c=a.charAt(b);if(!VALisDigit(c))return false}return true}function VALisDigit(a){return a>="0"&&a<="9"};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function COOKIEcreate(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+c*864E5);c="; expires="+d.toGMTString()}else c="";document.cookie=a+"="+b+c+"; path=/"}function COOKIEread(a){a+="=";for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)==0)return d.substring(a.length,d.length)}return null}function COOKIEerase(a){COOKIEcreate(a,"",-1)};/*

 Copyright (c) 2010-2015 iNTERFACEWARE Inc.  All rights reserved.
*/
function PAGescapeQuotes(a){return a.replace(/'/g,"&#39;").replace(/"/,"&quot;")}function PAGencodeAllTheThings(a){return encodeURIComponent(a).replace(/[!'()*]/g,function(b){return"%"+b.charCodeAt(0).toString(16)})}function PAGconvertSpaceEncoding(a){return a.replace(/\+/g,"%20")}function PAGhtmlEscape(a){return a.replace(/;/g,"&#59;").replace(/&(?!#59;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function WINgetWindowWidth(){return window.innerWidth===undefined?document.documentElement.clientWidth:window.innerWidth}function WINgetWindowHeight(){return window.innerHeight===undefined?document.documentElement.clientHeight:window.innerHeight}function WINgetWindowLeft(){var a=document.body.scrollLeft;if(0==a)a=window.pageXOffset?window.pageXOffset:document.body.parentElement?document.body.parentElement.scrollLeft:0;return a}
function WINgetWindowTop(){var a=document.body.scrollTop;if(0==a)a=window.pageYOffset?window.pageYOffset:document.body.parentElement?document.body.parentElement.scrollTop:0;return a}function WINwindowOffsetTop(a){for(var b=0,c=a;c!=null;c=c.offsetParent)if(c.offsetTop!==undefined)b+=c.offsetTop;for(c=a.parentNode;c!=null;c=c.parentNode)if(c.scrollTop!==undefined)b-=c.scrollTop;return b}
function WINwindowOffsetLeft(a){for(var b=0,c=a;c!=null;c=c.offsetParent)if(c.offsetLeft!==undefined)b+=c.offsetLeft;for(c=a.parentNode;c!=null;c=c.parentNode)if(c.scrollLeft!==undefined)b-=c.scrollLeft;return b}function WINgetStyle(a,b){var c=a.style[b];if(!c)if(window.getComputedStyle)c=(c=document.defaultView.getComputedStyle(a,null))?c[b]:null;else if(a.currentStyle)c=a.currentStyle[b];return c};var StartupStatusUpdater=function(){function a(o,x,z){o="<span style='color: red;''>Error getting startup status: <br>"+o.status+" : "+x+" - "+z+"</span>";$("#"+p).html(o)}function b(o){d=e?o.startup_complete&&o.logs_initialized:o.startup_complete;g=o.data;k+=g.length;d?n():setTimeout(c,f);var x=document.getElementById(p);NewData=g.replace(/\r\n/g,"<br/>").replace(/\r/g,"<br/>").replace(/\n/g,"<br/>");x.innerHTML+=NewData;if(NewData.length)x.scrollTop=x.scrollHeight;o.log_init_error_occurred&&t(o.log_init_error_message)}
function c(){$.ajax({url:"startup_status_update",method:"GET",data:{offset:k},success:b,error:a})}var d=false,e=false,f=1E3,g="",k=0,p="",n=null,t=null;this.start=function(){c()};this.init=function(o,x,z,M,L){g=o;p=x;n=z;e=L;t=M}};var LogLockerUpdateDialogController=function(){function a(){if(x==="Password"){$("#password_update_dialog #current_password").val("");$("#password_update_dialog #new_password").val("");$("#password_update_dialog #new_password_confirmation").val("")}else $("#autounlock_update_dialog #password").val("");$(".log_locker_update_dialog").off("keypress")}function b(D,N,O){var P=x+" update error: <br>";if(D.responseJSON.error)P+=D.responseJSON.error.description;else P=P+D.status+N+" : "+O;J.dialog("close");
M.displayError(P)}function c(D){if(x==="Password"){$("#password_update_dialog .validate_error").show();$("#password_update_dialog .validate_error span").html(D)}else{$("#autounlock_update_dialog .validate_error").show();$("#autounlock_update_dialog .validate_error span").html(D)}}function d(){if(x==="Password"){$("#password_update_dialog .validate_error").hide();$("#password_update_dialog .validate_error span").html("")}else{$("#autounlock_update_dialog .validate_error").hide();$("#autounlock_update_dialog .validate_error span").html("")}}
function e(){var D="";D=x==="Password"?"password_update_dialog_submit":"autounlock_update_dialog_submit";$(".log_locker_update_dialog").keypress(function(N){N.which==13&&$("#"+D).click()})}function f(){J.dialog("close");M.displaySuccess("Auto-Unlock successfully "+(L.auto_unlock_enabled?"disabled":"enabled")+"!");M.init()}function g(){var D=$("#autounlock_update_dialog #password").val();D.length<8||D.length>125?c("Password not valid. <br> Must be between 8 and 125 characters in length."):$.ajax({url:"log_locker/update/autounlock",
method:"POST",data:{password:D,enabled:!L.auto_unlock_enabled},success:f,error:b})}function k(){var D=L.auto_unlock_enabled?"Disable":"Enable";J=$("#autounlock_update_dialog").dialog({autoOpen:false,minWidth:500,closeOnEscape:true,beforeClose:a,close:d,modal:true,resizable:false,title:D+" Auto-Unlock"});J.dialog("option","buttons",[{text:D,click:g,id:"autounlock_update_dialog_submit"},{text:"Cancel",click:function(){d();J.dialog("close")}}]);$("#autounlock_update_dialog #autounlock_action").text(D.toLowerCase());
if(L.auto_unlock_enabled){$("#autounlock_enable_message").hide();J.dialog("option","minHeight",140)}else{$("#autounlock_enable_message").show();J.dialog("option","minHeight",160)}e()}function p(){J.dialog("close");M.displaySuccess("Password successfully updated!")}function n(){z={};var D=$("#password_update_dialog #current_password").val(),N=$("#password_update_dialog #new_password").val(),O=$("#password_update_dialog #new_password_confirmation").val();if(D.length<8||D.length>125){c("Current password not valid. <br> Must be between 8 and 125 characters in length.");
return false}if(N.length<8||N.length>125){c("Invalid new password. <br> Must be between 8 and 125 characters in length.");return false}if(N!==O){c("New password and password confirmation do not match!");return false}z.old_password=D;z.new_password=N;z.new_password_confirmation=O;return true}function t(){n()&&$.ajax({url:"log_locker/update/password",method:"POST",data:z,success:p,error:b})}function o(){J=$("#password_update_dialog").dialog({autoOpen:false,minWidth:500,minHeight:300,closeOnEscape:true,
beforeClose:a,modal:true,resizable:false,title:"Update Encryption Locker Password"});J.dialog("option","buttons",[{text:"Change Password",click:t,id:"password_update_dialog_submit"},{text:"Cancel",click:function(){J.dialog("close")}}]);e()}var x="",z=null,M=null,L=null,J=null;return{open:function(D,N,O){d();x=D;M=N;L=O;z=null;M.clearError(true);M.clearSuccess();if(J&&J.dialog("isOpen")){J.dialog("close");J=null}if(x==="Password")o();else x=="Auto-Unlock"?k():error("Invalid log locker update type.");
J.dialog("open")}}}(),LogLockerPageController=function(){function a(){$("#dashboardButtonTable").show();$(document).keypress(function(m){if(m.which==13)window.location=$("#dashboardButtonTable a").attr("href")})}function b(){$("#unlock_button").click(L);$("#create_button").click(L);$(document).keypress(function(m){if(m.which==13)Q=="CreateNew"?$("#create_button").click():$("#unlock_button").click()})}function c(){E={};S={};$("#log_locker_status").text(H.NONE);$("#auto_unlock_enabled").text(K.DISABLED);
$("#log_locker_autounlock_enable").prop("checked",false);$("#log_locker_password_container").show();$("#log_locker_password").val("");$("#log_locker_password_confirmation").val("");$("#log_locker_directory").val("");$("#abs_path_preview").text("")}function d(){var m="";m=A.directory!==""?A.directory:A.working_directory;$("#log_locker_directory").val(m)}function e(){Q="CreateNew";$(".unlock_existing_locker").hide();$(".create_new_locker").show();$(".iguana_toggle .unlock_existing_locker_toggle").removeClass("is_selected");
$(".iguana_toggle .create_new_locker_toggle").addClass("is_selected");c();d()}function f(){Q="UnlockExisting";$(".create_new_locker").hide();$(".unlock_existing_locker").show();$(".iguana_toggle .create_new_locker_toggle").removeClass("is_selected");$(".iguana_toggle .unlock_existing_locker_toggle").addClass("is_selected");c();d();if(A.directory=="")$("#log_locker_status").text(H.NONE);else if(A.exists&&A.locked)$("#log_locker_status").text(H.LOCKED);else A.exists&&!A.locked&&$("#log_locker_status").text(H.LOCKED);
if(A.auto_unlock_enabled){$("#log_locker_password_container").hide();$("#auto_unlock_enabled").text(K.ENABLED)}}function g(m){U=m;var y=m.resolved_directory;y&&$("#abs_path_preview").text('Absolute Path: "'+y+'"');if(Q!="CreateNew"){y=m.auto_unlock_exists;if(m.locker_exists){$("#log_locker_status").html("<span style='font-color: green; font-weight: bold;'>"+H.LOCKED+"</font>");if(y){$("#auto_unlock_enabled").html("<span style='font-color: green; font-weight: bold;'>"+K.ENABLED+"</font>");$("#log_locker_password_container").hide()}}else{$("#log_locker_status").text(H.NONE);
$("#auto_unlock_enabled").text(K.DISABLED);$("#log_locker_password_container").show()}}}function k(m,y,I){$("#abs_path_preview").text("");$("#log_locker_status").text(H.NONE);$("#auto_unlock_enabled").text(K.DISABLED);$("#log_locker_password_container").show();U={};displayError("Error retrieving whether encryption locker exists at current location. <br>"+m.status+" : "+y+" - "+I)}function p(){var m=$("#log_locker_directory").val().trim();$.ajax({url:"log_locker/exists",method:"GET",data:{directory:m},
success:g,error:k})}function n(m){$("#LogInitializingMessage").css("display","none");m=m.replace(/\r\n/g,"<br>").replace(/\n/g,"<br>");$("#LogsInitializingErrorMessage").html(m);$("#LogsInitializingError").css("display","block")}function t(){$("#logInitMsg").text("Log initialization and channel auto-start completed!");a()}function o(m,y,I){var l="<u>Problem encountered during locker initialization</u><br>";if(m.responseJSON.error)l+=m.responseJSON.error.description.replace(/\r\n/g,"<br>").replace(/\n/g,
"<br>");else l=l+m.status+y+" : "+I;B.displayError(l);w=true;b()}function x(m){$("#buttons").hide();B.clearError();var y="";if(m.unlock_success&&m.auto_unlocked)y="Sucessfully auto-unlocked log encryption locker!";else if(m.unlock_success)y="Sucessfully unlocked log encryption locker!";else if(m.locker_created&&m.auto_unlock_enabled)y="Sucessfully created log encryption locker and enabled auto-unlock!";else if(m.locker_created)y="Sucessfully created log encryption locker!";if(m.logs_initializing){$("#locker_table").hide();
$("#status_panel").show();m=new StartupStatusUpdater;m.init("","status_panel",t,n,true);m.start();y+='<br><br> <span id="LogInitializingMessage">Encrypted logs are now initializing and applicable channels are being auto-started...</span>'}else a();B.displaySuccess(y)}function z(){E={};if(!U.locker_exists){B.displayError("A log encryption locker does not exist in the current location. <br>Make sure the directory is correct and the locker status indicates one exists.");return false}var m=$("#log_locker_directory").val().trim();
if(m==""||m==="Not Set"){B.displayError("Locker directory cannot be blank or left in default state.");return false}E.directory=m;m=U.auto_unlock_exists;var y=$("#log_locker_password").val();if(!m){if(y.length<8||y.length>125){B.displayError("Passwords must be between 8 and 125 characters in length. <br> Make sure your password is typed correctly.");return false}E.password=y}return true}function M(){S={};var m=$("#log_locker_directory").val().trim();if(m==""||m==="Not Set"){B.displayError("Locker directory cannot be blank or left in default state.");
return false}S.directory=m;m=$("#log_locker_password").val();var y=$("#log_locker_password_confirmation").val();if(m.length<8||m.length>125){B.displayError("Password must be between 8 and 125 characters in length.");return false}else if(m!==y){B.displayError("Password and password confirmation do not match. Double check and try again.");return false}S.password=m;S.password_confirmation=y;m=$("#log_locker_autounlock_enable:checked").length>0;S.enable_auto_unlock=m;return true}function L(){var m;m=
Q=="CreateNew"?M():z();if(m){$("#unlock_button").off("click");$("#create_button").off("click");$(document).unbind("keypress.key13");B.clearError(true);m={};if(Q=="CreateNew"){m=S;m.action="create"}else{m=E;m.action="unlock"}$.ajax({url:"log_locker/initialize",method:"POST",data:m,success:x,error:o})}}function J(){B.clearError();$(this).hasClass("is_selected")||(Q=="CreateNew"?f():e())}function D(){$("#log_locker_directory").keyup(p);$("#log_locker_directory").blur(p);b();$(".iguana_toggle .toggle_element").click(function(){J(this);
p()});$(".file_browse_button").click(function(){ifware.Settings.FileBrowser.FILfolderBrowse("","log_locker_directory",true)})}function N(){$("#update_locker_password").click(function(){LogLockerUpdateDialogController.open("Password",B,A)});$("#update_auto_unlock").click(function(){LogLockerUpdateDialogController.open("Auto-Unlock",B,A)})}function O(m,y,I){m="Error getting log locker settings: <br>"+m.status+" : "+y+" - "+I;$("#ErrorMessage").html(m)}function P(m){A=m;if(!(A.invalid_license||!A.eligible)){if(A.logs_initialized){$("#log_locker_directory").text(A.directory);
m=A.auto_unlock_enabled?K.ENABLED:K.DISABLED;var y=A.auto_unlock_enabled?"Disable":"Enable";$("#auto_unlock_enabled").text(m);$("#update_auto_unlock a").text(y);N()}else{A.exists?f():e();D();$("#log_locker_directory").blur()}$("#log_locker_password").focus()}}var B=this,A={},H={UNLOCKED:"Exists and Unlocked",LOCKED:"Exists and Locked",NONE:"Doesn't Exist"},K={ENABLED:"Yes",DISABLED:"No"},Q="",E={},S={},U={},w=false;B.clearError=function(m){if(m||!w)$("#ErrorMessage h3").html("")};B.clearSuccess=function(){$("#StatusMessage h3").html("")};
B.displayError=function(m){$("#ErrorMessage h3").html(m)};B.displaySuccess=function(m){$("#StatusMessage h3").html(m)};this.init=function(){$.ajax({url:"log_locker/settings",method:"GET",success:P,error:O})}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function HLPpopUpinitialize(a){$(".helpIcon").each(function(){$(this).click(function(b){b.preventDefault();if($("#helpTooltipDiv").is(":hidden")||document.getElementById("helpTooltipId").value!=this.id){document.getElementById("helpTooltipTitle").innerHTML=this.title;document.getElementById("helpTooltipBody").innerHTML=this.rel;document.getElementById("helpTooltipId").value=this.id;$("#helpTooltipDiv").css("left",b.pageX);$("#helpTooltipDiv").css("top",b.pageY);$("#helpTooltipDiv").fadeIn("slow");
document.getElementById("helpTooltipDiv").style.left=HLPpopUpCalculatePosition(WINgetWindowLeft(),b.clientX,WINgetWindowWidth(),document.getElementById("helpTooltipDiv").offsetWidth)+"px";document.getElementById("helpTooltipDiv").style.top=HLPpopUpCalculatePosition(WINgetWindowTop(),b.clientY,WINgetWindowHeight(),document.getElementById("helpTooltipDiv").offsetHeight)+"px";a&&a(this.id.replace("_Icon",""))}else $("#helpTooltipDiv").fadeOut("slow")})});$("#helpTooltipDiv b").click(function(){$("#helpTooltipDiv").fadeOut("slow")})}
function HLPpopUpCalculatePosition(a,b,c,d){if(b+d>c)b=Math.max(10,a+c-(d+10));return b+a};/*

 Copyright (c) 2010-2015 iNTERFACEWARE Inc.  All rights reserved.
*/
function initIfwareSettings(){var a=clearInterval;clearInterval=function(b){a(b)};$("#main").html("");ifware=window.ifware||{};ifware.Settings=ifware.Settings||{};ifware.SettingsScreen=new SettingsScreen_Class(document.location.hash);ifware.SettingsScreen.init()}
var SettingsScreen_Class=function(a){function b(){$.ajax({dataType:"json",url:p,success:function(o,x,z){n.display(o,x,z);window.setTimeout(function(){},100)},error:n.handleError})}function c(o){n.display(o.responseJSON);var x=o.responseJSON.error?o.responseJSON.error.description:o.status+" - "+o.statusText;$("#scResponseDlg").remove();if(!(o.responseJSON&&o.responseJSON.error.page)){$("body").append($("<div id='scResponseDlg'>  <div class='sc_error'></div><br/>  <div class='sc_output'></div>  <div class='sc_info'></div></div>"));
o=$("#scResponseDlg");var z={};z.Close=function(){$(this).dialog("close")};o.dialog({bgiframe:true,width:600,title:"Error",modal:true,autoOpen:false,buttons:z,close:function(){document.location="/"}});o.find(".sc_error").text(x);o.find(".sc_error").show();o.dialog("open")}}function d(){if(g){var o=g.split("#");if(o.length<2)p=k;else if(document.location.pathname=="/channel"){o.shift();p="/channel/control?"+o.join(encodeURIComponent("#"))}else{o=o[1].split("=");p=o.shift()=="Page"?"/"+o.join("="):
k}}else p=document.location.pathname=="/channel"?"/channel/add":k;b()}function e(o){var x={},z=o.split("#");x.Base=z[0];o=[];if(z[1])o=z[1].split("&");if(o.length>0){x.Queries={};z=o.length;x.Qcount=z;for(i=0;i<z;i++){var M=o[i].split("=");x.Queries[M[0]]=M[1]}}return x}function f(o){g=document.location.hash;if(o&&o.oldURL&&o.newURL){var x=e(o.oldURL);o=e(o.newURL);if(x.Queries&&o.Queries&&x.Queries.Channel&&o.Queries.Channel)if(x.Queries.Channel!=o.Queries.Channel)t=0}if(t>0)t--;else d()}var g=a,
k="/settings_menu",p=k,n=this,t=0;this.init=function(){$("#fileBrowser ul.jQueryFileTree li a").click(function(o){o.stopPropagation()});d();window.onhashchange=f};this.clearHashTally=function(){t=0};this.trimUrl=function(){if(document.location.pathname=="/channel"){var o=/&Tab=newChannel$/;if(document.location.hash.match(o)){document.location.hash=document.location.hash.replace(o,"&Tab=channel");f()}else{t=2;document.location.hash=document.location.hash.replace(/&Tab=.*$/,"")}}};this.display=function(o){if(o.location&&
o.location!=document.location.pathname+document.location.hash)p=document.location=o.location;if(o.body){$("#main").html(o.body);o.title&&$("title").html("Iguana"+(o.server_label?" ("+o.server_label+")":"")+(o.title?" &gt; "+o.title:""))}window.setTimeout(function(){n.trimUrl()},10)};this.handleError=function(o){switch(o.status){case 401:document.location="/login.html?RedirectLocation=/settings?Page="+p.substring(1);break;case 400:c(o);break;case 402:case 403:case 404:document.location="/settings";
break;case 500:c(o)}};this.cancel=function(o){VALfieldValidationFunctions=[];if(o)p=o;b()};this.page=function(){return p}};/*

 Copyright (c) 2010-2015 iNTERFACEWARE Inc.  All rights reserved.
*/
function initSettingsHelpers(){var a=false,b=$("<div class='wait_for_sc'></div>");ifware.Settings.Helpers&&ifware.Settings.Helpers.updateServerNameIntervalId&&window.clearInterval(ifware.Settings.Helpers.updateServerNameIntervalId);ifware.Settings.Helpers={toggleFormRow:function(c,d,e){var f=0;if($("#"+c).prop("checked")){for(f=0;f<d.length;f++)$(d[f]).prop("disabled",false);for(f=0;f<e.length;f++)$(e[f]).show()}else{for(f=0;f<d.length;f++)$(d[f]).prop("disabled",true);for(f=0;f<e.length;f++)$(e[f]).hide()}},
displayCountDown:function(c){$("#divRefreshStatus").html("The page will reload in "+c+" seconds, or ")},setDefaults:function(c){switch(c){case "/web_settings/edit":$("#UsingHttps").prop("checked",false);$("#WebPort").val("6543");$("#SessionTimeout").val("20");case "/rpc_settings/edit":$("#RpcPort").val("6123")}},onTimer:function(c,d,e){if(d>0){d--;ifware.Settings.Helpers.displayCountDown(d);if(d<=0)window.location=c;else{if(typeof e==="undefined")e=function(){return true};e()&&setTimeout(function(){ifware.Settings.Helpers.onTimer(c,
d,e)},1E3)}}},submitForm:function(c){c.preventDefault();if(VALfieldValidationFunctions.length&&!VALvalidateFields())return false;VALfieldValidationFunctions=[];if(!a){a=true;$(".sc_spinner_container").prepend(b);$(".action-button.sc-job").addClass("waiting");var d=$("#"+c.data.form_id);$.ajax({type:"POST",url:c.data.uri,data:d.serialize(),success:function(e,f,g){typeof c.data.success_handler==="function"&&c.data.success_handler();a=false;$(".action-button.sc-job").removeClass("waiting");$(b).detach();
ifware.SettingsScreen.display(e,f,g);window.setTimeout(function(){},100)},error:ifware.SettingsScreen.handleError})}},submitRestartForm:function(){var c=$("#RestartForm");if(c.length){$("#StatusMessage").html("");$("#ErrorMessage").html("");$.ajax({type:"POST",url:"/restart",data:c.serialize(),success:function(){$("#StatusMessage").html('<h3 style="color:green;">Web server restarted.</h3>').show()},error:function(){$("#ErrorMessage").html('<h3 style="color:red;">There was an error restarting the web server.</h3>').show()}})}},
routeTo:function(c){document.location.hash==c&&$(window).trigger("hashchange");document.location.hash=c},downloadVmd:function(c,d,e,f){window.location="/download_vmd?ChannelGuid="+c+"&EditTab="+d+"&ChannelName="+e+"&ChannelType="+f}};return ifware.Settings.Helpers};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
if(PEXLastInput==undefined)var PEXLastInput={};
function updatePath(a,b,c,d,e){if(b){var f=encodeURIComponent(b.value);b=true;if(PEXLastInput[a]!=undefined&&PEXLastInput[a]==f)b=false;if(f==""){b=false;d.style.display="none"}if(b==true){PEXLastInput[a]=f;var g;if(e){a="environment_expand";b="RawText=";g='Preview: "'}else{a="path_expand";b="RawPath=";g='Absolute Path: "'}AJAXpost(a,b+f,function(k){try{var p=JSON.parse(k),n;if(p)n=e?p.expandedText:p.expandedPath;n=n.replace(/;/g,"&#59;");n=n.replace(/&(?!#59;)/g,"&amp;");n=n.replace(/</g,"&lt;");
n=n.replace(/>/g,"&gt;");n=n.replace(/"/g,"&quot;");if(!p||n==undefined||n==unescape(f))d.style.display="none";else{c.innerHTML=g+n+'"';d.style.display=""}}catch(t){d.style.display="none"}})}}}function renderExpansion(a,b,c,d,e){if(b){b=b.replace(/;/g,"&#59;");b=b.replace(/&(?!#59;)/g,"&amp;");b=b.replace(/</g,"&lt;");b=b.replace(/>/g,"&gt;");b=b.replace(/"/g,"&quot;");if(!b||b===unescape(c)){d.html("");e.hide()}else{b=b.trim();d.html("Preview: "+b);e.show()}}else{d.html("");e.hide()}}
function expandFields(a){for(var b=a.length,c=0;c<b;c++)(function(d){var e=$("#"+d);if(e.length!=0){var f=$("#"+d+"_preview"),g=$("#"+d+"_preview_div"),k=encodeURIComponent(e.val());$.ajax({method:"POST",url:"environment_expand",data:"RawText="+k,success:function(p){renderExpansion(d,p.expandedText,k,f,g)},error:function(){g.hide()}})}})(a[c])};/*

 Copyright (c) 2010-2015 iNTERFACEWARE Inc.  All rights reserved.
*/
function setupFileBrowser(a){var b=document.getElementById("fileBrowser-frame"),c=document.getElementById("fileBrowser-popup"),d=document.documentElement,e,f;ifware.Settings.FileBrowser={FILmodalShow:function(){var g=document.documentElement;b.style.top="0px";b.style.left="0px";b.style.height=$(document).height()+"px";b.style.width=g.scrollWidth+"px";b.style.display="";if(b.contentWindow)b.contentWindow.document.body.style.background="gray";c.style.visibility="hidden";c.style.display="";c.style.top=
Math.floor((WINgetWindowHeight()-c.offsetHeight)/2)+d.scrollTop+"px";c.style.left=Math.floor((d.offsetWidth-c.offsetWidth)/2)+d.scrollLeft+"px";c.style.visibility="visible"},FILmodalHide:function(){c.style.display="none";b.style.display="none"},FILgetPath:function(){Path="";if(document.getElementById(e).value!=""){Path=$.ajax({url:"/file_browser_extract_path",global:false,type:"POST",data:{path:document.getElementById(e).value},dataType:"text",async:false}).responseText;try{eval("("+Path+")");Path=
""}catch(g){}}if(Path==""){Path=COOKIEread("Iguana-FileBrowserPath-"+a);if(Path==null||Path=="")Path="./"}return Path},FILselected:function(g){AJAXpost("/file_browser_path","path="+document.getElementById("fileBrowserPath").value+"&folders="+f+"&file="+encodeURIComponent(document.getElementById("fileBrowserFile").value),function(k){if(k!="")if(k=="*File*"){document.getElementById(e).value=document.getElementById("fileBrowserPath").value+document.getElementById("fileBrowserFile").value;ifware.Settings.FileBrowser.FILmodalHide()}else if(g==
"0"&&f=="true"){try{eval("("+k+")");k=""}catch(p){}document.getElementById(e).value=k;ifware.Settings.FileBrowser.FILmodalHide()}else f=="true"?ifware.Settings.FileBrowser.FILfolderBrowse(k):ifware.Settings.FileBrowser.FILbrowse(k)},null)},FILbrowse:function(g,k){if(k!=undefined)e=k;if(g===undefined||g=="")g=ifware.Settings.FileBrowser.FILgetPath();COOKIEcreate("Iguana-FileBrowserPath-"+a,g,365);f="false";document.getElementById("FileTypeSelect").onchange=function(){ifware.Settings.FileBrowser.FILbrowse(g)};
document.getElementById("fileBrowserVolume").onchange=function(){ifware.Settings.FileBrowser.FILbrowse(this.value)};document.getElementById("fileBrowserVolume").value=g;document.getElementById("fileBrowserVolume").style.display=="none"&&ifware.Settings.FileBrowser.FILvolumes();document.getElementById("fileBrowserFileLabel").innerHTML="File:";$("#fileBrowser").fileTree({root:g,script:"file_browser",foldersOnly:f,hidden:true},function(p){document.getElementById("fileBrowserFile").value=p});ifware.Settings.FileBrowser.FILmodalShow();
FILtextboxFile=document.getElementById("fileBrowserFile");FILtextboxFile.value="";FILtextboxFile.focus()},FILfolderBrowse:function(g,k,p){if(k!=undefined)e=k;if(g===undefined||g=="")g=ifware.Settings.FileBrowser.FILgetPath();COOKIEcreate("Iguana-FileBrowserPath-"+a,g,365);f="true";document.getElementById("FileTypeSelect").onchange=function(){ifware.Settings.FileBrowser.FILfolderBrowse(g)};document.getElementById("fileBrowserVolume").onchange=function(){ifware.Settings.FileBrowser.FILfolderBrowse(this.value)};
document.getElementById("fileBrowserVolume").value=g;document.getElementById("fileBrowserFileLabel").innerHTML="Folder:";$("#FileTypeSelectLabel").hide();$("#FileTypeSelect").hide();document.getElementById("fileBrowserVolume").style.display=="none"&&ifware.Settings.FileBrowser.FILvolumes();$("#fileBrowser").fileTree({root:g,script:"file_browser",foldersOnly:f,hidden:true},function(n){document.getElementById("fileBrowserFile").value=n});ifware.Settings.FileBrowser.FILmodalShow();FILtextboxFile=document.getElementById("fileBrowserFile");
if(p)AJAXpost("/file_browser_path","path="+g+"&file=&folders=true",function(n){if(n!=""){try{eval("("+n+")");n=""}catch(t){}FILtextboxFile.value=n}},null);else FILtextboxFile.value=g;FILtextboxFile.focus()},onEnter:function(g){KeyCode=window.event?window.event.keyCode:g.which;KeyCode==13&&ifware.Settings.FileBrowser.FILselected("1");return!(window.event&&window.event.keyCode==13)},FILvolumes:function(){AJAXpost("/file_browser_volumes",null,function(g,k){if(k.match("application/json")){var p=eval(g);
if(p.length>0){options='<option value="./">Select Drive/Volume...</option>';for(var n=0;n<p.length;n++)options+='<option value="'+p[n].drive+'">'+p[n].drive+"</option>";$("select#fileBrowserVolume").html(options)}else $("select#fileBrowserVolume").hide()}},null);$("select#fileBrowserVolume").show()}}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
if(SGSelectGridState==undefined)var SGSelectGridState={};function updateCellData(a,b,c,d){SGSelectGridState[a].Data[c][b]=d}function updateCellVisual(a,b,c,d){var e=SGSelectGridState[a];if(e.DisplayData[c][b]!=d){e.DisplayData[c][b]=d;a=document.getElementById([a,b,"x",c].join(""));if(d=e.Display(d))a.innerHTML=d}}
function processSelected(a,b,c,d){var e=SGSelectGridState[a],f=Math.max(b,e.DraggedFromX),g=Math.max(c,e.DraggedFromY);c=Math.min(c,e.DraggedFromY);var k=e.Data[e.DraggedFromY][e.DraggedFromX];for(b=Math.min(b,e.DraggedFromX);b<=f;b++)for(e=c;e<=g;e++)d(a,b,e,k)}
function selectGridUpdate(a){var b,c,d,e=SGSelectGridState[a];for(b=e.MinX;b<=e.MaxX;b++)for(c=e.MinY;c<=e.MaxY;c++)if(e.DisplayData[c][b]!=e.Data[c][b]){d=e.Display(e.Data[c][b]);e.DisplayData[c][b]=e.Data[c][b];if(d)document.getElementById([a,b,"x",c].join("")).innerHTML=d}e.MinX=Math.min(e.DraggedFromX,e.LastX);e.MaxX=Math.max(e.DraggedFromX,e.LastX);e.MinY=Math.min(e.DraggedFromY,e.LastY);e.MaxY=Math.max(e.DraggedFromY,e.LastY)}
function selectGridSetData(a,b){SGSelectGridState[b].Clicked=0;SGSelectGridState[b].Data=a;selectGridUpdate(b)}function selectGridReleased(a,b,c){var d=SGSelectGridState[c];if(d.Clicked==1){d.MinX=Math.min(a,d.MinX);d.MaxX=Math.max(a,d.MaxX);d.MinY=Math.min(b,d.MinY);d.MaxY=Math.max(b,d.MaxY);processSelected(c,a,b,updateCellData);d.Clicked=0;d.Callback(d)}d.Dragged=0;selectGridUpdate(c)}
function selectGridMouseover(a,b,c){var d=SGSelectGridState[c];if(d.Clicked==1){d.LastX=a;d.LastY=b;if(d.Dragged==0&&(d.DraggedFromX!=a||d.DraggedFromY!=b))d.Dragged=1;d.MinX=Math.min(a,d.MinX);d.MaxX=Math.max(a,d.MaxX);d.MinY=Math.min(b,d.MinY);d.MaxY=Math.max(b,d.MaxY);selectGridUpdate(c);processSelected(c,a,b,updateCellVisual)}}
function selectGridPressed(a,b,c){var d=SGSelectGridState[c];if(d.Clicked==0){d.Clicked=1;d.DraggedFromX=a;d.DraggedFromY=b;var e=d.Toggle(d.Data[b][a]);if(e!=undefined)d.Data[b][a]=e;processSelected(c,a,b,updateCellVisual);d.MinX=a;d.MaxX=a;d.MinY=b;d.MaxY=b}}function selectGridMouseout(a){var b=SGSelectGridState[a];b.Clicked==1&&selectGridReleased(b.LastX,b.LastY,a)}
function selectGrid(a,b,c,d,e,f,g,k,p,n){SGSelectGridState[c]={Clicked:0,DraggedFromX:-1,DraggedFromY:-1,Width:a,Height:b,Dragged:0,Data:d,Toggle:e,Display:f,Callback:g};e=Array(b);var t;for(g=0;g<b;g++){e[g]=Array(a);for(t=0;t<a;t++)e[g][t]=d[g][t]}SGSelectGridState[c].DisplayData=e;d=['<table class="time_filter_table"'];d.push(' id="',c,'" name="',c,'">');d.push(k);for(k=0;k<b;k++){d.push('<tr class="time_filter_row" ');d.push("/>");d.push('<td class="time_filter_cell_day" onmouseover="selectGridMouseout(',
"'",c,"'",')">',p[k]);for(e=0;e<a;e++){d.push('<td class="time_filter_cell" id="',c,e+"x",k,'" ');d.push('onmousedown="selectGridPressed(',e+", ",k,", '",c,"')",'"');d.push('onmouseover="selectGridMouseover(',e,", ",k,", '",c,"')",'"');d.push('onmouseup="selectGridReleased(',e+", ",k,", '",c,"')\">");(g=f(SGSelectGridState[c].Data[k][e]))&&d.push(g)}d.push('<td onmouseover="selectGridMouseout(',"'",c,"'",')"/>')}d.push('<tr class="time_filter_row">');for(e=0;e<a+2;e++)d.push('<td class="time_filter_cell" onmouseover="selectGridMouseout(',
"'",c,"'",')"><div visibility:"hidden">&nbsp;</div>');d.push("</table>");$(n).html(d.join(""))};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var NORM_div;function NORMnormalizeInnerHtml(a){NORM_div||(NORM_div=document.createElement("div"));NORM_div.innerHTML=a;return NORM_div.innerHTML}var NORM_a;function NORMnormalizeHref(a){NORM_a||(NORM_a=document.createElement("a"));NORM_a.href=a;return NORM_a.href}var NORM_img;function NORMnormalizeImg(a){NORM_img||(NORM_img=document.createElement("img"));NORM_img.src=a;return NORM_img.src};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var TOOLactiveTimeout,TOOLopenTimeout,TOOLcloseTimeout,TOOLtooltipText="",TOOLtooltipShowCallback=null,TOOLtooltipElement=null,TOOLtooltipOffset,TOOLmousePositionX=0,TOOLmousePositionY=0,TOOLtooltipHover=undefined,TOOLtooltipOnMouseOut=null,TOOLisInitialized=false,TOOLwindowSizeOffset=10,TOOLpositionOffset=10,TOOLarrowOffset=20,TOOLarrowWidth=10,TOOLborderSize=2;function TOOLisInternetExplorer(){return navigator.appName=="Microsoft Internet Explorer"}
function TOOLhideIframe(){if(TOOLisInternetExplorer()){var a=document.getElementById("iframeTooltip");if(a)a.style.display="none"}}
function TOOLplaceAndDisplayIframe(){if(TOOLisInternetExplorer()){var a=document.getElementById("divTooltip"),b=document.getElementById("divTooltipBody");a.style.zIndex+=1;var c=document.getElementById("iframeTooltip");c.style.position="absolute";c.style.left=a.offsetLeft+"px";c.style.top=a.offsetTop+b.offsetTop+"px";c.style.width=a.offsetWidth+"px";c.style.height=b.offsetHeight+"px";c.style.opacity=0;c.style.filter="alpha(opacity=0)";c.style.display="block"}}
function TOOLinitialize(){document.captureEvents&&document.captureEvents(Event.MOUSEMOVE);document.onmousemove=TOOLmouseMove;if(TOOLtooltipHover===undefined){TOOLtooltipHover=false;$("#divTooltipBody").hover(function(){TOOLtooltipHover=true},function(){TOOLtooltipHover=false;TOOLtooltipOnMouseOut&&TOOLtooltipOnMouseOut()});$("#divTooltipTop").hover(function(){TOOLtooltipHover=true},function(){TOOLtooltipHover=false;TOOLtooltipOnMouseOut&&TOOLtooltipOnMouseOut()})}TOOLisInitialized=true}
function TOOLmouseMove(a){if(!a)a=window.event;TOOLmousePositionX=a.clientX;TOOLmousePositionY=a.clientY}function TOOLcalculatePosition(a,b,c,d){var e=a+TOOLpositionOffset;if(e+d>c-TOOLwindowSizeOffset)e=a-d-TOOLpositionOffset;if(e<TOOLwindowSizeOffset)e=TOOLwindowSizeOffset;return e+b}
function TOOLpositionWithMousePosition(a,b,c){b.style.display="none";c.style.display="none";if(NORMnormalizeInnerHtml(TOOLtooltipText)!=document.getElementById("divTooltipBody").innerHTML){document.getElementById("divTooltipBody").innerHTML=TOOLtooltipText;a.style.left=TOOLcalculatePosition(TOOLmousePositionX,WINgetWindowLeft(),WINgetWindowWidth(),a.offsetWidth)+"px";a.style.top=TOOLcalculatePosition(TOOLmousePositionY,WINgetWindowTop(),WINgetWindowHeight(),a.offsetHeight)+"px"}}
function TOOLpositionLeftWithElement(a,b,c){var d=WINwindowOffsetLeft(TOOLtooltipElement),e=d+TOOLtooltipElement.offsetWidth-TOOLarrowOffset+(TOOLtooltipOffset.Left||0),f=0;if(e+a.offsetWidth>WINgetWindowWidth()-TOOLwindowSizeOffset){e=d-a.offsetWidth+TOOLarrowOffset-TOOLarrowWidth+TOOLtooltipElement.offsetWidth+(TOOLtooltipOffset.Left||0);f=a.offsetWidth-TOOLarrowOffset;b.style.backgroundImage="url(/images/tooltip_arrow_top_left.gif)";c.style.backgroundImage="url(/images/tooltip_arrow_bottom_left.gif)"}else{f=
TOOLarrowOffset;b.style.backgroundImage="url(/images/tooltip_arrow_top_right.gif)";c.style.backgroundImage="url(/images/tooltip_arrow_bottom_right.gif)"}if(e<TOOLwindowSizeOffset){e=TOOLwindowSizeOffset;f=d-TOOLwindowSizeOffset-TOOLarrowWidth}b.style.backgroundPosition=f+"px";c.style.backgroundPosition=f+"px";a.style.left=e+WINgetWindowLeft()+"px"}
function TOOLpositionTopWithElement(a,b,c){var d=WINwindowOffsetTop(TOOLtooltipElement),e=d+TOOLtooltipElement.offsetHeight-TOOLborderSize+(TOOLtooltipOffset.Top||0),f=false,g=false;if(e+a.offsetHeight>WINgetWindowHeight()-TOOLwindowSizeOffset){e=d-a.offsetHeight+TOOLborderSize-(TOOLtooltipOffset.Top||0);g=true}else f=true;if(e<TOOLwindowSizeOffset){e=TOOLwindowSizeOffset;g=f=false}b.style.visibility=f?"visible":"hidden";c.style.visibility=g?"visible":"hidden";a.style.top=e+WINgetWindowTop()+"px"}
function TOOLpositionWithElement(a,b,c){if(""!=TOOLtooltipText){b.style.width="1px";c.style.width="1px";if(NORMnormalizeInnerHtml(TOOLtooltipText)!=document.getElementById("divTooltipBody").innerHTML){document.getElementById("divTooltipBody").innerHTML=TOOLtooltipText;TOOLpositionLeftWithElement(a,b,c);TOOLpositionTopWithElement(a,b,c)}b.style.width=a.offsetWidth+"px";c.style.width=a.offsetWidth+"px"}}
function TOOLtooltipShowAndFade(a,b,c){var d=$("#divTooltip"),e=function(){TOOLtooltipClose();d.fadeTo(0,1)};TOOLtooltipLink(a,null,b);setTimeout(function(){TOOLtooltipElement==b&&d.fadeTo("slow",0,e)},c)}function TOOLtooltipRefresh(a,b){if(!(undefined!=b&&b!==TOOLtooltipElement)){TOOLtooltipText=a;TOOLtooltipShow()}}
function TOOLtooltipCloseIfNotHover(){setTimeout(function(){if(TOOLtooltipHover)TOOLtooltipOnMouseOut=function(){TOOLtooltipClose();TOOLtooltipOnMouseOut=null};else TOOLtooltipClose()},200)}function TOOLisTooltipShowing(){return"hidden"!=WINgetStyle(document.getElementById("divTooltip"),"visibility")}
function TOOLisHoverOverElement(){if(null!=TOOLtooltipElement){for(var a=TOOLtooltipElement,b={x:a.offsetLeft||0,y:a.offsetTop||0},c=0,d=0;a=a.offsetParent;){if(undefined!=a.offsetLeft)b.x+=a.offsetLeft;if(undefined!=a.offsetTop)b.y+=a.offsetTop}for(a=TOOLtooltipElement;a=$(a).parent()[0];){if(undefined!=a.scrollLeft)c+=a.scrollLeft;if(undefined!=a.scrollTop)d+=a.scrollTop}a=b.y-15<TOOLmousePositionY+d&&b.y+TOOLtooltipElement.clientHeight+15>TOOLmousePositionY+d;return b.x-15<TOOLmousePositionX+c&&
b.x+TOOLtooltipElement.clientWidth+15>TOOLmousePositionX+c&&a}}function TOOLtooltipHide(){document.getElementById("divTooltip").style.visibility="hidden";document.getElementById("divTooltipTop").style.visibility="hidden";document.getElementById("divTooltipBottom").style.visibility="hidden";document.getElementById("divTooltipBody").innerHTML="";clearInterval(TOOLcloseTimeout);window.status="";TOOLhideIframe()}
function TOOLtooltipClose(){if(!TOOLisHoverOverElement()&&!TOOLtooltipHover)TOOLtooltipHide();else{clearInterval(TOOLcloseTimeout);TOOLcloseTimeout=setInterval("TOOLtooltipClose()",1E3)}}
function TOOLtooltipShow(){if(TOOLisHoverOverElement()){var a=document.getElementById("divTooltip"),b=document.getElementById("divTooltipTop"),c=document.getElementById("divTooltipBottom");null==TOOLtooltipElement?TOOLpositionWithMousePosition(a,b,c):TOOLpositionWithElement(a,b,c);TOOLplaceAndDisplayIframe();a.style.visibility="visible";TOOLtooltipShowCallback!=null&&TOOLtooltipShowCallback()}}
function TOOLtooltipLink(a,b,c,d){if(null!=c){TOOLisInitialized||TOOLinitialize();if(c===TOOLtooltipElement)if(TOOLisTooltipShowing())TOOLtooltipRefresh(a,c);else{clearTimeout(TOOLactiveTimeout);TOOLtooltipText=a;TOOLactiveTimeout=setTimeout("TOOLtooltipShow();",300)}else{TOOLisTooltipShowing()&&TOOLtooltipHide();clearTimeout(TOOLopenTimeout);clearTimeout(TOOLactiveTimeout);TOOLtooltipText=a;TOOLtooltipShowCallback=b;TOOLtooltipElement=c;TOOLtooltipOffset=d||{Left:0,Top:0};if(undefined===TOOLtooltipShowCallback)TOOLtooltipShowCallback=
null;if(undefined===TOOLtooltipElement)TOOLtooltipElement=null;TOOLactiveTimeout=setTimeout("TOOLtooltipShow();",300)}}}document.write('<div id="divTooltip" class="tooltip"><div id="divTooltipTop" class="tooltip_top"></div><div id="divTooltipBody" class="tooltip_body"></div><div id="divTooltipBottom" class="tooltip_bottom"></div></div><iframe src="/empty.html" id="iframeTooltip" style="display: none;"></iframe>');/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function QRYparse(a){this.q=a.length>1?a.substring(1,a.length):null;this.keyValuePairs=[];if(this.q)for(a=0;a<this.q.split("&").length;a++)this.keyValuePairs[a]=this.q.split("&")[a];this.getKeyValuePairs=function(){return this.keyValuePairs};this.getValue=function(b){for(var c=0;c<this.keyValuePairs.length;c++)if(this.keyValuePairs[c].split("=")[0]==b)return this.keyValuePairs[c].split("=")[1];return false};this.getParameters=function(){for(var b=Array(this.getLength()),c=0;c<this.keyValuePairs.length;c++)b[c]=
this.keyValuePairs[c].split("=")[0];return b};this.getLength=function(){return this.keyValuePairs.length}}function QRYgetValue(a){var b=new QRYparse(window.location.search);return unescape(b.getValue(a))};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var REFrefreshTimeout=null,REFinterval=0,REFcountdown=0,REFrefreshOn=true,REFdisplayTime=null;function REFonTimer(a){var b=false;if(REFrefreshOn)b=REFdoCountdown();b?REFclearTimer():REFrestartTimer(a);return b}function REFrestartTimer(a){REFrefreshTimeout=a===undefined?setTimeout("REFonTimer()",1E3):setTimeout(a,1E3)}function REFclearTimer(){clearTimeout(REFrefreshTimeout)}
function REFdisplayCountdown(){var a="";a=0==REFinterval?"":REFrefreshOn?REFdisplayTime:"Auto-refresh paused.";$("#divRefreshStatus").innerHTML=a}function REFdoCountdown(){if(!(REFcountdown>0))return false;--REFcountdown;REFdisplayCountdown();return REFcountdown<=0?true:false}function REFgetParams(){return"refresh="+REFinterval+"&AutomaticRequest=1"}
function REFrefreshEnable(a){var b=document.getElementById("btnRefreshStop"),c=document.getElementById("btnRefreshStart");REFrefreshOn=a;if(b&&c){if(0==REFinterval){b.style.display="none";c.style.display="none";return}if(a){b.style.display="";c.style.display="none"}else{b.style.display="none";c.style.display=""}}REFdisplayCountdown()}function REFinitialize(a,b){var c=QRYgetValue("refresh");REFinterval=c=="0"?0:parseInt(c);REFinterval=1;REFrefreshOn=true;REFinitializeWithExistingInterval(a,b)}
function REFinitializeWithExistingInterval(a,b){IntervalSelect=1;REFcountdown=REFinterval;if(REFinterval!=0){REFclearTimer();REFrestartTimer(a)}REFdisplayTime=b;REFdisplayCountdown()}function REFsetInterval(a){REFinterval=a;REFrefreshOn=true};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
if(PEXLastInput==undefined)PEXLastInput={};
function updateDate(a,b,c,d){var e=encodeURIComponent(b.value);b=true;if(PEXLastInput[a]!=undefined&&PEXLastInput[a]==e)b=false;if(e==""){b=false;d.style.display="none"}if(b==true){PEXLastInput[a]=e;$.ajax({url:"date_expand",data:"RawText="+e,success:function(f){try{var g;if(f)g=f.expandedText;g=g.replace(/;/g,"&#59;");g=g.replace(/&(?!#59;)/g,"&amp;");g=g.replace(/</g,"&lt;");g=g.replace(/>/g,"&gt;");g=g.replace(/"/g,"&quot;");if(!f||g==undefined||g==unescape(e))d.style.display="none";else{c.innerHTML=
'Preview: "'+g+'"';d.style.display=""}}catch(k){d.style.display="none"}}})}}
function expandDate(a,b){UnexpandedText=encodeURIComponent(a);$.ajax({url:"date_expand",data:"RawText="+UnexpandedText,success:function(c){try{var d="";if(c)d=c.expandedText;d=d.replace(/;/g,"&#59;");d=d.replace(/&(?!#59;)/g,"&amp;");d=d.replace(/</g,"&lt;");d=d.replace(/>/g,"&gt;");d=d.replace(/"/g,"&quot;");b.innerHTML=c&&d!=undefined&&d!=unescape(a)?'Preview: "'+d+'"':'Preview: "'+a+'"'}catch(e){b.innerHTML='Preview: "'+a+'"'}},error:function(){}})};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
if(RTAtable==undefined){var RTAtable={},RTAminimumTextAreaHeight=30;RTAtable.resize=RTAcalibrate}function RTAcalibrate(a){var b=a.scrollHeight;a.style.height=a.scrollHeight+10+"px";RTAtable.forceResize=b!=a.scrollHeight;if(RTAtable.forceResize)a.style.height="0px";a.style.height=Math.max(RTAminimumTextAreaHeight,a.scrollHeight)+"px";RTAtable.resize=RTAresize}
function RTAresizeTimer(a){if(RTAtable[a]==undefined)RTAtable[a]={};if(!RTAtable[a].Timer)RTAtable[a].Timer=setTimeout(function(){RTAtable.resize(a);RTAtable[a].Timer=null},100)}function RTAresize(a){if(RTAtable.forceResize)a.style.height="0px";a.style.height="auto";a.style.height=Math.max(RTAminimumTextAreaHeight,a.scrollHeight)+"px"};function IsMemberOf(a){var b=document.getElementById("groupDropDown").options;for(i=1;i<b.length;++i)if(a==b[i].value)return false;return true}function buildGroups(){var a=document.getElementById("channelGroups");if(document.getElementById("groupDropDown")){for(var b=[],c=0;c<GroupIDs.length;c++)IsMemberOf(GroupIDs[c])&&b.push(GroupIDs[c]);a.value=b.join(",")}else a.value=""}
function generateTooltipText(a,b,c){var d=[];if(a!=""){d.push(a);d.push("<br><br>")}if(c<1){d.push("<b>No channels defined.</b>");return d.join("")}d.push("Contains <b>");d.push(b);d.push("</b> of <b>");d.push(c);c==1?d.push("</b> channel."):d.push("</b> channels.");return d.join("")}
function onDropdownChange(a){if(!(!a||a.value=="noval")){document.getElementById("group_row_"+a.value).style.display="";for(i=a.length-1;i>=1;i--)if(a.options[i].selected){a.remove(i);break}BelongsToCount++;if(BelongsToCount==GroupCount)document.getElementById("groupDropDownRow").style.display="none";a.value="noval"}}
function removeGroup(a,b){var c=document.getElementById("groupDropDown");document.getElementById("group_row_"+a).style.display="none";var d=document.createElement("option");d.text=b;d.value=a;var e=1;if(c.options.length>1)for(i=0;i<Groups.length;++i){if(Groups[i]==b)break;document.getElementById("groupDropDown").options[e].text==Groups[i]&&++e}try{c.options.add(d,e)}catch(f){c.options.add(d,c.selectedIndex)}document.getElementById("groupDropDownRow").style.display="";--BelongsToCount}
function getStyleObject(a){return document.getElementById&&document.getElementById(a)?document.getElementById(a).style:document.all&&document.all(a)?document.all(a).style:document.layers&&document.layers[a]?getObjNN4(document,a):false}
function showDatabaseNote(a,b){var c=document.getElementById(a+"DBTypeHelp");if(b=="MySQL"&&c)c.innerHTML=document.getElementById(a+"_mysql_details").innerHTML;else if(b=="OCI - Oracle"&&c)c.innerHTML=document.getElementById(a+"_oci_details").innerHTML;else if(c)c.innerHTML=document.getElementById(a+"_odbc_details").innerHTML;if(a=="Dst"&&b!="")document.getElementById("RowDestTimeout").style.display=b=="ODBC - MS SQL Server"?"":"none";if(a=="Src"&&b!="")document.getElementById("RowSrcTimeout").style.display=
b=="ODBC - MS SQL Server"?"":"none"}
function showDatabaseNoteSource(a){var b=document.getElementById(a+"DataSourceIdHelp");ShowValue=document.getElementById(a+"DBType").value;if(ShowValue=="MySQL"&&b)b.innerHTML=document.getElementById(a+"_mysql_database").innerHTML;else if(ShowValue=="OCI - Oracle"&&b)b.innerHTML=document.getElementById(a+"_oci_oracle_database").innerHTML;else if(ShowValue=="SQLite"&&b)b.innerHTML=document.getElementById(a+"_sqlite_database").innerHTML;else if(b)b.innerHTML=document.getElementById(a+"_odbc_database").innerHTML}
function initializeHelp(){if(ReadOnlyMode!="1")for(var a=["input","textarea","select"],b=0;b<a.length;b++)$("#channel_configuration_table "+a[b]).each(function(){this.onfocus=function(){showHighlight(this)};this.onmouseover=function(){showHighlight(this)};this.onblur=function(){clearHighlight(this)};this.onmouseout=function(){clearHighlight(this)}})}function clearHighlight(a){$("#channel_configuration_table tr").css("backgroundColor","");$(a).parents("tr.selected").css("backgroundColor","")}
function helpTooltipDivRefresh(a){if(a=="SrcDataSourceId")showDatabaseNoteSource("Src");else if(a=="DstDataSourceId")showDatabaseNoteSource("Dst");else if(a=="SrcDBType")showDatabaseNote("Src",document.getElementById(a).value);else a=="DstDBType"&&showDatabaseNote("Dst",document.getElementById(a).value)}
function DASHonSelectChannel(a){var b=a.options[a.selectedIndex].text;if(b)if(b=="[Add Channel]"&&a.options[a.selectedIndex].value=="AddChannelOption")document.location="/channel";else navigateAway(b)}function navigateAway(a){var b=document.getElementById("editTab").value.match(/^(.*)Tab$/)[1];ifware.SettingsScreen.clearHashTally();document.location="/channel#Channel="+encodeURIComponent(a)+(b?"&Tab="+b:"")}
function runAddEditChannelsPagesSetup(){function a(){clearTimeout(RequestTimeoutId);clearTimeout(StatusTimeoutId)}function b(){a();$("form#channel_data").submit()}SettingsHelpers=initSettingsHelpers();onLoad();var c=$("#channel_guid").val();$("#ChannelSelect").on("change",function(){a();DASHonSelectChannel(this);return false});$("form#channel_data").submit({uri:"/channel/control",form_id:"channel_data"},SettingsHelpers.submitForm);$("a#hrefChannelEditButton").click(function(){VALfieldValidationFunctions=
[];b()});$("#channelSave").click(function(){buildGroups();b()});$("#channelCancel, .channelCancel").click(function(){a();ifware.SettingsScreen.cancel()});$("form#remove_"+c).submit({uri:"/channel/remove",form_id:"remove_"+c},SettingsHelpers.submitForm);$("#export-channel").click(function(d){d.preventDefault();$("#export-channel-form").submit()});$("#hrefRemoveButton").click(function(d){d.preventDefault();if(!confirm("Are you sure you want to remove this channel?"))return false;a();$("form#remove_"+
c).submit()})};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
if(CFLastInput==undefined)var CFLastInput={};function filterChannels(a,b,c,d,e){filter(a,b,c,d,e,"channel_filter")}function filterChannelGroups(a,b,c,d,e){filter(a,b,c,d,e,"channel_group_filter")}
function filter(a,b,c,d,e,f){if(CFLastInput[a]==undefined)CFLastInput[a]={};var g=d.getElementsByTagName("DIV");CFLastInput[a].channel=b;CFLastInput[a].filter=c;$.ajax({url:f,data:"DelimitedList="+b+"&Regex="+c,success:function(k){try{if(k){k.Matched=k.Matched||{};k.Unmatched=k.Unmatched||{};for(var p=0,n=g.length-1;n>=0;--n)if(k.Matched[g[n].id]!=undefined){++p;g[n].style.display="";g[n].innerHTML=k.Matched[g[n].id]}else if(k.Unmatched[g[n].id]!=undefined){g[n].style.display="none";g[n].selected=
false;g[n].innerHTML=k.Unmatched[g[n].id]}else d.removeChild(g[n]);e.innerHTML=p==g.length?"<b>All</b> channels displayed":"<b>"+p+"</b> of <b>"+g.length+"</b> channels displayed"}else{for(n=g.length-1;n>=0;--n){g[n].style.display="none";g[n].selected=false}e.innerHTML="<b>0</b> of <b>"+g.length+"</b> channels displayed"}}catch(t){}},error:function(){}})};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function FRMCHnaturalCompare(a,b){for(var c=a.toLowerCase(),d=b.toLowerCase();c&&d;)if(/^\d/.test(c)&&/^\d/.test(d)){LeftNumber=1*c.match(/^\d+/);c=c.replace(/^\d+/,"");RightNumber=1*d.match(/^\d+/);d=d.replace(/^\d+/,"");if(LeftNumber!=RightNumber)return LeftNumber-RightNumber}else{LeftCharacter=c.charCodeAt(0);c=c.substr(1);RightCharacter=d.charCodeAt(0);d=d.substr(1);if(LeftCharacter!=RightCharacter)return LeftCharacter-RightCharacter}return c<d?-1:c==d?0:+1}
function FRMCHaddToSelect(a,b){ChannelName=SourceChannelIdToName[b];NewOption=new Option(ChannelName,b);for(InsertIndex=0;InsertIndex<a.options.length&&FRMCHnaturalCompare(a.options[InsertIndex].text,NewOption.text)<0;)InsertIndex++;a.options.add(NewOption,InsertIndex);a.style.display="";document.getElementById("AddSourceChannelEmpty").style.display="none"}
function FRMCHhideChannelRow(a){DivName="from_channel_"+a;DivToHide=document.getElementById(DivName);DivToHide.style.display="none";Input=document.getElementById("use_channel_"+a);Input.value="false"}function FRMCHremoveChannel(a){FRMCHhideChannelRow(a);var b=document.getElementById("SrcSelectSourceChannel");FRMCHaddToSelect(b,a)}
function FRMCHshowChannelRow(a){DivName="from_channel_"+a;DivToShow=document.getElementById(DivName);DivToShow.style.display="";Input=document.getElementById("use_channel_"+a);Input.value="true"}
function FRMCHinitialize(a){try{var b=document.createElement("input");b.type="button";if(b.type!="button")throw Error();}catch(c){return}var d=document.getElementById("SrcSelectSourceChannel");for(ChannelKey in SourceChannelIdToName){for(InitialIndex=Found=0;InitialIndex<InitialSourceChannels.length;InitialIndex++)if(InitialSourceChannels[InitialIndex]==ChannelKey){Found=1;break}if(Found==0){FRMCHaddToSelect(d,ChannelKey);FRMCHhideChannelRow(ChannelKey)}else FRMCHshowChannelRow(ChannelKey)}for(ChannelKey in SourceChannelIdToName)if(LogViewLink=
document.getElementById("log_view_from_channel_"+ChannelKey))LogViewLink.href=FRMCHqueuedLogBrowserLink(a,SourceChannelIdToName[ChannelKey]);d.onchange=function(){if(!(d.selectedIndex<1)){FRMCHshowChannelRow(d.options[d.selectedIndex].value);d.removeChild(d.options[d.selectedIndex]);if(d.options.length==1){d.style.display="none";document.getElementById("AddSourceChannelEmpty").style.display=""}}}}
function FRMCHfetchSourceUpdates(a,b){function c(f){return String(f).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function d(f,g,k,p){document.getElementById("queue_date_"+f).innerHTML=c(g);document.getElementById("queue_time_"+f).innerHTML=c(k);document.getElementById("queue_remaining_"+f).innerHTML=c(p)}function e(){$.ajax({url:"/queue_progress",data:{Channel:encodeURIComponent(a),ChannelGuid:b,AutomaticRequest:1},success:function(f){try{if(f.LoggedIn!==
undefined&&!f.LoggedIn)MiniLogin.show("Your Iguana Session has Expired.",e);else if(!f.ErrorDescription){var g={};for(ChannelKey in SourceChannelIdToName)g[ChannelKey]=1;var k=f.Channel.Source,p;for(p in k){var n=k[p],t;a:{f=n;try{if(document.getElementById("from_channel_"+f.Id)){var o="--";if(f.TotalSent<=f.TotalReceived)o=""+(f.TotalReceived-f.TotalSent);d(f.Id,f.Date,f.Time,o);t=true;break a}}catch(x){window.location.search="?Channel="+a+"&editTab="+CurrentTab.id}t=false}if(t)g[n.Id]=null}for(ChannelKey in g)g[ChannelKey]&&
d(ChannelKey,"----/--/--","--:--","--");setTimeout(e,2E3)}}catch(z){}},error:function(){MiniLogin.show("Iguana is not responding",e)}})}e()}function FRMCHqueuedLogBrowserLink(a,b){return"/logs.html?Source="+encodeURIComponent(a)+"&Type=messages&DequeueSourceName="+encodeURIComponent(b)+"&JumpToQueueEnd=true"};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function TOCHaddToSelect(a,b){ChannelName=DestChannelIdToName[b];NewOption=new Option(ChannelName,b);for(InsertIndex=0;InsertIndex<a.options.length&&FRMCHnaturalCompare(a.options[InsertIndex].text,NewOption.text)<0;)InsertIndex++;a.options.add(NewOption,InsertIndex);a.style.display="";document.getElementById("AddDestChannelEmpty").style.display="none"}
function TOCHhideChannelRow(a){DivName="to_channel_"+a;DivToHide=document.getElementById(DivName);DivToHide.style.display="none";Input=document.getElementById("use_to_channel_"+a);Input.value="false"}function TOCHremoveChannel(a){TOCHhideChannelRow(a);var b=document.getElementById("DstSelectDestChannel");TOCHaddToSelect(b,a)}
function TOCHshowChannelRow(a){DivName="to_channel_"+a;DivToShow=document.getElementById(DivName);DivToShow.style.display="";Input=document.getElementById("use_to_channel_"+a);Input.value="true"}
function TOCHinitialize(a){try{var b=document.createElement("input");b.type="button";if(b.type!="button")throw Error();}catch(c){return}var d=document.getElementById("DstSelectDestChannel");for(ChannelKey in DestChannelIdToName){for(InitialIndex=Found=0;InitialIndex<InitialDestinationChannels.length;InitialIndex++)if(InitialDestinationChannels[InitialIndex]==ChannelKey){Found=1;break}if(Found==0){TOCHaddToSelect(d,ChannelKey);TOCHhideChannelRow(ChannelKey)}else TOCHshowChannelRow(ChannelKey)}for(ChannelKey in DestChannelIdToName)if(LogViewLink=
document.getElementById("log_view_to_channel_"+ChannelKey))LogViewLink.href=TOCHqueuedLogBrowserLink(DestChannelIdToName[ChannelKey],a);d.onchange=function(){if(!(d.selectedIndex<1)){TOCHshowChannelRow(d.options[d.selectedIndex].value);d.removeChild(d.options[d.selectedIndex]);if(d.options.length==1){d.style.display="none";document.getElementById("AddDestChannelEmpty").style.display=""}}}}
function TOCHfetchDestUpdates(a,b){function c(f){return String(f).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function d(f,g,k,p){document.getElementById("queue_date_"+f).innerHTML=c(g);document.getElementById("queue_time_"+f).innerHTML=c(k);document.getElementById("queue_remaining_"+f).innerHTML=c(p)}function e(){$.ajax({url:"/queue_progress",data:{SourceChannel:encodeURIComponent(a),SourceChannelGuid:b,AutomaticRequest:1},success:function(f){try{if(f.LoggedIn!==
undefined&&!f.LoggedIn)MiniLogin.show("Your Iguana Session has Expired.",e);else if(!f.ErrorDescription){var g={};for(ChannelKey in DestChannelIdToName)g[ChannelKey]=1;var k=f.Channel.Destination,p;for(p in k){var n=k[p],t;a:{f=n;try{if(document.getElementById("to_channel_"+f.Id)){var o="--";if(f.TotalSent<=f.TotalReceived)o=""+(f.TotalReceived-f.TotalSent);d(f.Id,f.Date,f.Time,o);t=true;break a}}catch(x){window.location.search="?Channel="+a+"&editTab="+CurrentTab.id}t=false}if(t)g[n.Id]=null}for(ChannelKey in g)g[ChannelKey]&&
d(ChannelKey,"----/--/--","--:--","--");setTimeout(e,2E3)}}catch(z){}},error:function(){MiniLogin.show("Iguana is not Responding",e)}})}e()}function TOCHqueuedLogBrowserLink(a,b){return"/logs.html?Source="+encodeURIComponent(a)+"&Type=messages&DequeueSourceName="+encodeURIComponent(b)+"&JumpToQueueEnd=true"};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
if(MSCholder==undefined)var MSCholder={};function MSCregister(a,b,c,d,e){if(MSCholder!=undefined){MSCholder[a]={};MSCholder[a].leftPanel=b;MSCholder[a].rightPanel=c;MSCholder[a].excludedHeight=d;MSCholder[a].excludedWidth=e}}
function MSCsetMode(a,b){if(MSCholder!=undefined){MSCholder[a].Mode=b;if(b=="edit"){MSCholder[a].leftPanel.setAttribute("class","custom_multi_select_edit");MSCholder[a].rightPanel.setAttribute("class","custom_multi_select_edit")}else{MSCholder[a].leftPanel.setAttribute("class","custom_multi_select");MSCholder[a].rightPanel.setAttribute("class","custom_multi_select")}}}function MSCshowSearchTooltip(a){TOOLtooltipLink("Filter list of channels based on their name.",null,a)}
function MSChideSearchTooltip(){TOOLtooltipClose()}function MSCresizeHeight(a){if(!(MSCholder==undefined||!MSCholder[a])){a=MSCholder[a];var b=WINgetWindowHeight()-WINwindowOffsetTop(a.leftPanel)-a.excludedHeight;if(b<75)b=75;a.leftPanel.style.height=b+"px";a.rightPanel.style.height=b+"px"}}
function MSCresizeWidth(a){if(!(MSCholder==undefined||!MSCholder[a])){a=MSCholder[a];var b=(WINgetWindowWidth()-WINwindowOffsetLeft(a.leftPanel)-a.excludedWidth)/2;if(b<100)b=100;a.leftPanel.style.width=b+"px";a.rightPanel.style.width=b+"px"}}function MSCresizeTimeout(a){MSCresizeWidth(unescape(a));MSCresizeHeight(unescape(a))}function MSCresize(a){clearTimeout(MSCholder[a].resizeTimeoutId);MSCholder[a].resizeTimeoutId=setTimeout('MSCresizeTimeout("'+escape(a)+'");',150)}
function MSCtoggle(a,b){if(!(MSCholder==undefined||MSCholder[a].Mode=="view")){var c=document.getElementById(b),d=document.getElementById("span_"+b);if(190<d.offsetWidth)c.style.width=d.offsetWidth+"px";(d=c.attributes.getNamedItem("class"))&&d.value=="MSCselected"?c.setAttribute("class","MSCunselected"):c.setAttribute("class","MSCselected")}}
function MSCsort(a){for(var b=a.getElementsByTagName("DIV"),c=[],d={},e=b.length-1;e>=0;--e){var f=b[e].attributes.getNamedItem("value");if(f&&f.value){c.push(f.value);d[f.value]=b[e]}}c.sort(function(g,k){var p=String(g).toUpperCase(),n=String(k).toUpperCase();if(p>n)return 1;if(p<n)return-1;return 0});for(b=0;b<c.length;++b)a.appendChild(d[c[b]])}
function MSCvalues(a,b){if(MSCholder!=undefined){var c=MSCholder[a],d;if(b=="right")d=c.rightPanel;else if(b=="left")d=c.leftPanel;c=[];d=d.getElementsByTagName("DIV");for(var e=d.length-1;e>=0;--e){c.push(d[e].id);c.push(",")}c[c.length-1]="";return c.join("")}}
function MSCmove(a,b,c){if(!(MSCholder==undefined||!MSCholder[a]||MSCholder[a].Mode=="view")){var d=MSCholder[a];if(c=="right")d=d.rightPanel;else if(c=="left")d=d.leftPanel;else return;var e=b.element||document.getElementById(b.id);d.appendChild(e);var f={right:"left",left:"right"};e.ondblclick=function(){MSCmove(a,{element:e},f[c]);filterTextChanged(f[c])};e.setAttribute("class","MSCunselected");MSCsort(d)}};function DMPRloadHistory(a,b,c){if(!(!a||a=="00000000000000000000000000000000")){var d=$("#"+b+"CommitChoices"),e=$('<div id="SCMloadWheelContainer"><span id="SCMloadWheel" class="SCMloading"></span></div></div>');d.prepend(e);$.ajax({url:"/sc/translator_history",cache:false,data:{translator_guid:a},success:function(f){DMPRdisplayCommits(f,a,b,c)},error:function(f){alert("Error : "+(f.responseJSON.error?f.responseJSON.error.description:f.status+" - "+f.statusText))}})}}
function DMPRdisplayCommits(a,b,c,d){if(a){var e={};b=$('<table class="commitTable commitChoices"><thead><tr><th /><th>Time</th><th>Note</th><th>User</th><th>Commit ID</th></tr></thead><tbody></tbody></table>');for(var f=a.length-1;f>=0;f--){var g=a[f];e[g.commit_id]=g.commit_comment;var k=new Date(g.commit_timestamp*1E3);k=k.toLocaleDateString()+" "+k.toLocaleTimeString();g.commit_id==d&&$("#"+c+"CommitComment").val(g.commit_comment);b.find("tbody").append('<tr><td><input type="radio" name="'+c+
'CommitId" value="'+g.commit_id+'"'+(g.commit_id==d?' checked="checked"':"")+' /></td><td class="date">'+k+'</td><td class="note">'+g.commit_comment+'</td><td class="user">'+g.commit_user+'</td><td class="commit_id">'+g.commit_id+"</td></tr>")}b.find("tbody tr").click(function(){var p=$(this).find("input:radio");p.attr("checked","checked");$("#"+c+"CommitComment").val(e[p.val()])});a=$("#"+c+"CommitChoices");a.find("#SCMloadWheelContainer").remove();a.html(b);a.css("max-height",(0.5*$("body").height()).toString()+
"px")}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function remove_channel_group(a){document.remove_channel_group.group.value=a;showVerifySubmitMessage("Removal Confirmation","Are you sure you want to remove the channel group '"+a+"'?",document.remove_channel_group)}function onRowEntered(a){a.removeClass("dark_row").removeClass("light_row").addClass("dark_row_highlighted")}
function onRowExited(){$("li.channel_group_list_row").removeClass("dark_row_highlighted").addClass("dark_row");$("li.channel_group_list_row:nth-child(even)").removeClass("dark_row").addClass("light_row")}var RawGroupTooltipDescriptionText="%DESCRIPTION%<br><br>",RawGroupTooltipMemberCountText="Contains <strong>%MEMBERCOUNT%</strong> of <strong>%CHANNELCOUNT%</strong> channels.";
$(document).ready(function(){"true"!=$("#current_user_can_admin").val()&&$("#disabled_add_channel_group_button").bind("mouseover",function(){TOOLtooltipLink("You do not have the necessary permissions to add new channel groups.",null,this)}).bind("mouseout",function(){TOOLtooltipClose()}).bind("mouseup",function(){TOOLtooltipClose()});$("li.channel_group_list_row").bind("mouseover",function(){onRowEntered($(this))}).bind("mouseout",function(){onRowExited()});$("li.channel_group_list_row:nth-child(even)").removeClass("dark_row").addClass("light_row");
$("a.channel_group_toggle").bind("click",function(){onListViewToggle("channel_group_list_details_"+$(".group_id",this).val())});$("a.channel_group_remove").bind("click",function(){var a=$(this).find(".channel_group_name").val();remove_channel_group(a)})});/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function sourceExists(a,b,c){var d=encodeURIComponent(b);a=="Channel"||a=="Group"?$.ajax({url:"channel_group_exists",async:false,data:"Type="+a+"&Name="+d,success:function(e){try{e&&c(e.Results.DoesExist,a,b)}catch(f){}},error:function(){}}):c(true,a,b)};var SCMreplaceSampleStr="REPLACE_SAMPLE",SCMappendSampleStr="APPEND_SAMPLE",SCM_BUMP_NOTE="Will stop channel",SCM_POPUP_PARAMS={modal:true,minWidth:450,resizable:false,close:function(){$(this).remove()}};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){for(var c=b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1};function SCMcommitDlgGetConflictingFiles(a,b){SCMcheckConflicts(a,b,SCMcommitDlgUI)}
function handleProjectImportError(a){a=a.responseJSON.error?a.responseJSON.error.description:a.status+" - "+a.statusText;$(document).find("body").append($("<div id='scResponseDlg'><div class='sc_error'></div><br/></div>"));var b=$("#scResponseDlg"),c={};c.Close=function(){$(this).dialog("close")};b.dialog({bgiframe:true,width:400,title:"Error",modal:true,autoOpen:false,buttons:c});b.find(".sc_error").text(a);b.find(".sc_error").show();b.dialog("open");return true}
function SCMclearDependencies(a){$.ajax({url:"/sc/clear_dependencies",method:"POST",data:{translator_guid:a.ifware.ChannelGuid},success:function(b){SCMresponseDlgUI(b,false)},error:handleProjectImportError})}function SCMresponseDlgUI(a,b,c){$("#scResponseDlg").length&&$("#scResponseDlg").remove();typeof c=="function"&&c();return false}function SCMgetMainFileLabel(a){for(var b=0;b<a.length;++b)if(a[b].Type=="Main")return a[b].Label;return""}
function SCMgetProjectList(a,b){for(var c=[],d=0;d<a.length;++d)c.push(a[d][b]);return c}function SCMdialogWaiting(a,b){if(b){$(a).dialog("disable");$(a).siblings(".ui-dialog-buttonpane").prepend('<img class="scSpinner" src="/js/mapper/images/spinner.gif" />')}else{$(a).dialog("enable");$(a).siblings(".ui-dialog-buttonpane").children(".scSpinner").remove()}}
function SCMdialogConfirm(a,b){$("#fossilConfirmDlg").length&&$("#fossilConfirmDlg").remove();$(document).find("body").append($("<div id='fossilConfirmDlg'>"+a+"</div>"));var c={};c.No=function(){$(this).dialog("close")};c.Yes=function(){b();$(this).dialog("close")};var d=$("#fossilConfirmDlg");d.dialog({bgiframe:true,title:"Confirmation Request",width:500,modal:true,autoOpen:false,buttons:c});d.dialog("open")}
function SCMrevertConfirmText(){return"Revert operation might overwrite your changes. Are you sure you want to revert?"}
function SCMactivateUploadedZip(a,b){$.ajax({url:"/sc/import_from_zip",method:"POST",data:{translator_guid:a.ifware.ChannelGuid,uploaded_filename:b,data_import_type:a.ifware.DataImportType},error:handleProjectImportError,success:function(c){if(a.ifware.DataImportType==SCMreplaceSampleStr){a.ifware.setCountOfSample(c.CountOfSampleData);a.ifware.setSampleIndex(1);NISchangeSampleData(a,1)}else a.ifware.DataImportType==SCMappendSampleStr&&a.ifware.setCountOfSample(a.ifware.countOfSample()+c.CountOfSampleData);
NISupdateSampleDataControl(a);NISreloadCurrentFile(a)}})}function SCMuploadFile(a,b,c,d,e){e.handleProjectUpload(b,a,c)}function SCMenableImportBTN(a,b){a.dialog("widget").find('button:contains("Import")').button(b)}
function SCMimportProjectAndData(a,b){function c(){$("#ImportZipFileBrowse",d).val()==""&&$("input[name=import_type]:checked",d).val()=="ImportZippedProject"?SCMenableImportBTN(d,"disable"):SCMenableImportBTN(d,"enable")}$("#importProjectAndData").remove();$(document).find("body").append('<div id="importProjectAndData"><form id="importForm"><table><tr><td valign="top"><input type="radio" name="import_type" value="EmptyProject" id="importProjectAndData_importTypeId" class="ImportBlank"></td><td ><label for="importProjectAndData_importTypeId">Use a blank project</label></td><tr><td valign="top"><input type="radio" id="importProjectAndData_projectList" name="import_type" value="ImportProject" class = "ImportFromProject"></td>    <td><label for="importProjectAndData_projectList">Import from existing projects</label>        <br><select name="projectList"></select>'+(a.ifware.UsesParameter?
'        <br><input id="importProjectAndData_importSampleData" type="checkbox" name="importSampleData" checked="checked">        <label for="importProjectAndData_importSampleData">Import sample data</label>':"")+'<tr><td valign="top"><input type="radio" name="import_type" value="ImportZippedProject" id="importProjectAndData_importZipFile" class = "ImportFromZip"></td>    <td><label for="importProjectAndData_importZipFile">Import project from zip file</label><br><input type="file" id="ImportZipFileBrowse" name="NewFile" value = ""/>      <input type="hidden" name="translator_guid" value="'+
a.ifware.ChannelGuid+'" />  '+(a.ifware.UsesParameter?'<br><input id = "importProjectAndData_includeSampleData" type = "checkbox" name = "includeSampleData" checked="checked">  <label for="importProjectAndData_includeSampleData">Import sample data</label>'+(a.ifware.countOfSample()>0?'   <select name="addSampleTypeList"><option value = "APPEND_SAMPLE">Append</option><option value = "REPLACE_SAMPLE">Replace</option></select>':""):"")+'</td></tr></table></form><div class="importError" style="color: red"></div></div>');
var d=$("#importProjectAndData");NISmainFileSelectedAndEmpty(a)?$('input[class = "ImportBlank"]').prop("checked",true):$('input[class = "ImportFromProject"]').prop("checked",true);$("input[name=import_type]",d).click(function(){c()});$("input[name = NewFile]",d).change(function(){SCMenableImportBTN(d,"enable")});$("select[name = projectList]",d).mousedown(function(){$('input[class = "ImportFromProject"]').prop("checked",true);$(".importError").html("");c()});$("input[name = importSampleData]",d).click(function(){$('input[class = "ImportFromProject"]').prop("checked",
true);c()});$("input[name = NewFile]",d).click(function(){$('input[class = "ImportFromZip"]').prop("checked",true);c()});$("input[name = includeSampleData]",d).click(function(){$('input[class = "ImportFromZip"]').prop("checked",true);c()});$("select[name = addSampleTypeList]",d).mousedown(function(){$('input[class = "ImportFromZip"]').prop("checked",true);c()});var e={};e.Import=function(){if("ImportProject"==$("input[name=import_type]:checked",this).val()){a.ifware.CurrentSourceHash=null;var f=$("select[name=projectList] option:selected",
this).val();f||$(this).dialog("close");SCMdialogWaiting("#importProjectAndData",true);f={translator_guid:a.ifware.ChannelGuid,source_guid:f};if($("input[name=importSampleData]:checked",this).length&&a.ifware.UsesParameter)f.import_sample_data="true";$.ajax({url:"/sc/import_from_project",method:"POST",data:f,error:function(k){SCMdialogWaiting("#importProjectAndData",false);k=k.responseJSON.error?k.responseJSON.error.description:k.status+" - "+k.statusText;$(".importError",d).html(k)},success:function(k){SCMdialogWaiting("#importProjectAndData",
false);a.ifware.setCountOfSample(a.ifware.countOfSample()+k.import_count);NISupdateSampleDataControl(a);NISreloadCurrentFile(a);$(d).dialog("close")}})}else if("ImportZippedProject"==$("input[name=import_type]:checked",this).val()){a.ifware.CurrentSourceHash=null;f=d.find("form");var g=f.find('input[type="file"]');a.ifware.DataImportType=$("input[name=includeSampleData]:checked").length&&a.ifware.UsesParameter?$("select[name=addSampleTypeList] option:selected",this).val()=="APPEND_SAMPLE"||a.ifware.countOfSample()==
0?SCMappendSampleStr:SCMreplaceSampleStr:"";SCMuploadFile(d,f,g,a,b)}else{f="";f=MPRapp?" from "+MPRapp.type:"";f=a.ifware.UsesParameter?"-- The main function is the first function called"+f+".\n-- The Data argument will contain the message to be processed.\nfunction main(Data)\nend":"-- The main function is the first function called"+f+".\nfunction main()\nend";NISsetScriptName(a,a.ifware.MainLuaFile);a.setValue(f);a.clearHistory();SCMclearDependencies(a);$(d).dialog("close")}};e.Cancel=function(){$(this).dialog("close")};
d.dialog({bgiframe:true,title:a.ifware.UsesParameter?"Import Project/Sample Data":"Import Project",resizable:false,modal:true,autoOpen:false,buttons:e,close:function(){a.focus()}});c();d.dialog("open");SCMdialogWaiting("#importProjectAndData",true);$.ajax({url:"/sc/get_all_projects_file_info",method:"POST",data:{translator_guid:a.ifware.ChannelGuid},error:function(f,g,k){d.dialog("close");SCMdialogWaiting("#importProjectAndData",false);handleProjectImportError(f,g,k)},success:function(f){SCMdialogWaiting("#importProjectAndData",
false);f.Projects.sort(function(p,n){var t=(p.Name||p.Guid).toLowerCase(),o=(n.Name||n.Guid).toLowerCase();return t<o?-1:t>o?1:0});for(ProjIndex in f.Projects){var g=f.Projects[ProjIndex],k=$("<option></option>");k.val(g.Guid);k.html(g.Name||g.Guid);$("select[name=projectList]",d).append(k)}f=$("#importProjectAndData table:first").width();d.dialog("option","width",26+f);d.dialog("option","position","center");SCMdialogWaiting("#importProjectAndData",false)}})}
function SCMincludeSampleConfirm(a){$("#IncludeSampleConfirmDlg").remove();$(document).find("body").append('<div id="IncludeSampleConfirmDlg" align="center">Include Sample Messages? </div>');var b={};b.Yes=function(){SCMexportRequest(a,true);$("#IncludeSampleConfirmDlg").dialog("close")};b.No=function(){SCMexportRequest(a,false);$("#IncludeSampleConfirmDlg").dialog("close")};$("#IncludeSampleConfirmDlg").dialog({bgiframe:true,width:300,height:130,title:"Confirm",modal:true,autoOpen:true,buttons:b})}
function SCMexportRequest(a,b){window.open("/sc/export_to_zip?translator_guid="+a+"&sample_data="+b);this.focus()}function SCMpluralLines(a){return a==1?"line":"lines"}function SCMfindLabel(a,b){for(var c=0;c<b.length;c++)if(b[c]==a)return true;return false}
function SCMdisplayError(a,b){$("#scResponseDlg").remove();if(!a)return false;var c="<p> We're sorry, but an unexpected error occurred: </p>                    <p>"+a+"</p> ";$("body").append($("<div id='scResponseDlg'>                       <div class='sc_error'></div><br/>                       <div class='sc_output'></div><div class='sc_info'></div></div>                    "));var d=$("#scResponseDlg"),e={};e.Close=function(){$(this).dialog("close")};d.dialog({bgiframe:true,width:600,title:"Error",
modal:true,autoOpen:false,buttons:e,close:function(){b()}});d.find(".sc_error").html(c);d.find(".sc_error").show();d.dialog("open");return true}function SCMcatchError(a,b){if(!a.ErrorMessage)return false;return SCMdisplayError(a.ErrorMessage,b)}
function SCMupdateLegend(a){var b=$(".toolbar_lines");b.html("");a.summary&&b.html('<span class="label">Lines:</span><span class="lines_info">Added: <span class="lines_added">'+a.summary.added+'</span></span><span class="lines_info">Deleted: <span class="lines_deleted">'+a.summary.deleted+'</span></span><span class="lines_info">Changed: <span class="lines_changed">'+a.summary.changed+"</span></span>")}
function SCMdrawDiffs(a,b){if(b=="condensed"){$("#SCMdiff").html(a.condensed);$("#SCMdiff").addClass("changesOnly")}else{$("#SCMdiff").removeClass("changesOnly");var c=b=="vertical"?" vrt":"";if(a.full){c=$('<div class="diffTank'+c+'" id="diffFromTank"><div class="changeLabel">From</div><div class="diffCling">'+a.full.from+'</div></div><div class="diffDivider'+c+'" /><div class="diffTank'+c+'" id="diffToTank"><div class="changeLabel">To</div><div class="diffCling">'+a.full.to+"</div></div>");$("#SCMdiff").html(c);
var d=$(".diffCling");d.on("scroll",function(){var e=$(this),f=d.not(this);if(e.attr("scrolling")=="false"||e.attr("scrolling")==undefined){f.attr("scrolling","true");f.scrollTop(e.scrollTop());f.scrollLeft(e.scrollLeft())}e.attr("scrolling","false")})}}}function SCMlights(){return["red","yellow","green","gray"]}function SCMinitialDiffs(){return{condensed:"",full:{from:"",to:""},status:"",summary:{added:0,deleted:0,changed:0}}}
function SCMcompare(a,b,c){if(a[c]>b[c])return 1;if(a[c]<b[c])return-1;return 0}function SCMclip(a,b){if(a.length<=b)return a;return a.substr(0,b)+"..."}function SCMchannelConfigNameClip(a,b){var c=/^\Channels\//,d=/-[A-F0-9]{32}\/ChannelConfiguration.xml$/;if(c.test(a))return SCMclip(a.replace(c,"").replace(d,""),b);return SCMtranslatorNameClip(a,b)}
function SCMtranslatorNameClip(a,b){var c=/-(Ack|To|From|Filter|FromHTTP)-[A-Za-z0-9]{14}\//,d=/[A-F0-9]{32}\//;if(c.test(a))a=a.replace(c,"-$1.../");else if(d.test(a))a=a.replace(d,".../");return a.length<=b?a:"..."+a.substring(a.length-b)}function SCMsizeBoxes(a,b){if(!b)return[100,0];if(a<10)return[25,74];var c=a/(a+b)*100;if(c>75)c=75;return[c,99-c]}
function SCMfileClasses(a,b){if(!a.shared_files)return"";var c=" "+Object.keys(a.shared_files).map(function(d){return b[d].Index}).join(" ");if(a.contains_new_file)c+=" NEW";return c}
function SCMdecorate(a,b){$(".c").removeClass("c");$("#"+a).addClass("c");$(".h").removeClass("h");$("div.project."+a).addClass("h");$("div.project").on({mouseenter:function(){$("span.file."+$(this).attr("id")).addClass("h")},mouseleave:function(){$("span.file."+$(this).attr("id")).removeClass("h")}});$(".SCMstageLabel").each(function(){var c=$(this).outerHeight();$(this).next().css("top",c+"px")});$("#SCMstageFilesCollection").scrollTop(b)}
function SCMfixView(a,b,c,d){var e=$("#SCMcommitList"),f=$("#SCMcommitList .scroller");f.height(e.height()-$("#SCMcommitList .fixed").outerHeight()+"px");f.css("top",$("#SCMcommitList .fixed").outerHeight()+"px");$("#SCMcommitList .fixed table").width($("#SCMcommitList .scroller table").width()+"px");f=a.parent();var g=$(".EDT_toolbar_wrapper"),k=f.height();if(f.is("#HistoryBody"))k=f.outerHeight();if(g&&g.length==1)k-=g.outerHeight();a.height(k-e.outerHeight()-$("#SCMreviewControls").outerHeight()+
"px");d.height(b.height()-c.outerHeight()+"px")}function SCMfixDiffView(){var a=$("#SCMreviewPanelAndDiff"),b=$("#SCMdiffTank"),c=$(".diff_toolbar"),d=$("#SCMdiff");SCMfixView(a,b,c,d)}function SCMfixPreviewView(){var a=$("#HistoryBody #SCMreviewPanelAndPreview"),b=$("#HistoryBody #SCMpreviewTank"),c=$("#HistoryBody .preview_toolbar"),d=$("#HistoryBody #SCMpreview");SCMfixView(a,b,c,d)}
function SCMpullStatus(a,b){$.ajax({url:"/dashboard_data",method:"GET",cache:false,data:{include_remote_servers:true},success:function(c){SCMbumpStatus(c,a,b)}})}function SCMbumpStatus(a,b,c){var d=SCMlights();a=a.Channels;for(var e=0;e<a.length;e++){var f=a[e].Channel.Guid,g=d[a[e].Channel.Light];b[f]=g=="green"?true:false;var k=$("input.bumpUpdate[data-cguid="+f+"]");SCMupdateBumpNote(k,f,b,c);$("#BumpStatus_"+f).html('<img src="/images/button-dot'+g+'v4.gif" alt="'+g+'" />')}}
function SCMupdateBumpNote(a,b,c,d){var e=$("td#BumpNote_"+b);a.each(function(){if($(this).prop("checked")&&c[b]){e.html(d);return false}else e.html("")})}
function SCMbumpTickCheck(a,b,c,d,e){a.on("change",function(f){var g=true;f.stopPropagation();f=$(this).attr("data-"+d);a.each(function(){if(!$(this).prop("checked")){g=false;b.prop("checked",false)}});g&&b.prop("checked",true);var k=$("input.bumpUpdate[data-"+d+"='"+f+"']");if(e){SCMpullStatus(e,c);SCMupdateBumpNote(k,f,e,c)}});b.on("change",function(){$(this).prop("checked")?a.prop("checked",true):a.prop("checked",false);a.trigger("change")})}
function SCMcommitKeys(a,b,c){SCMdisableMouse();if(b!=0){var d=$("tr.commitRow.current");$("body").off("keydown.differ");$("body").on("keydown.differ",function(e){if(!(e.ctrlKey||e.metaKey||e.shiftKey)){e.preventDefault();SCMdisableMouse();var f=false;if(e.keyCode==38&&a<b){a++;f=true}else if(e.keyCode==40&&a>0){a--;f=true}f&&c(a,d);return false}});$("body").focus()}}function SCMdisableKeys(){$("body").off("keydown.differ");$("body").focus()}
function SCMscrollCommitList(){var a=$("tr.commitRow.current"),b=a.position();b.top<0&&a[0].scrollIntoView(true);b.top+a.outerHeight()>$(".scroller").height()&&a[0].scrollIntoView(false)}function SCMdisableMouse(){$(".commitTable").removeClass("mouseworthy")}function SCMreEnableMouse(){$(".scroller .commitTable").addClass("mouseworthy")}function SCMlinkText(a){return a.replace(/(https?:\/\/\S*)/,function(b){return'<a href="'+b+'" target="_blank">'+b+"</a>"})}
function SCMclearActiveRequest(a){a&&Object.keys(a).length&&a.hasOwnProperty("abort")&&a.abort()}function SCMcompareFunc(a,b){if(a[0]<b[0])return-1;return 1}
function SCMbuildChannelCollisionTable(a,b,c){var d='<div id="collision_list"><div class="fixed">                   <table class="CollisionTable fixedHead"><thead><tr><th class="CollisionLabel">Channel</th>';if(a)d+='<th class="tick status">Status</th>';d+='<th class="action">Action&nbsp;<br><span class="select-style">                                 <select id="bulk_action" class="dropdown">                                   <option class="dropdown_opt" value="none">No Action</option>                                   <option class="dropdown_opt" value="update_everything">Full Update</option>                                   <option class="dropdown_opt" value="update_translators_only">Update Translators Only</option>                                   <option class="dropdown_opt" value="create_new_channel">'+b+
' As New Channel</option>                                 </select></span>                              </th>                              <th class="newnamecol">New channel name</th>                              <th class="notecol">Notes</th>                    </tr></thead></table></div>                    <div class="scroller"><table class="CollisionTable"><tbody>';d+=SCMbuildChannelCollisionRows(a,b,c);d+="</tbody></table></div></div>";return d}
function SCMbuildChannelCollisionRows(a,b,c){for(var d=Object.keys(c).sort(SCMcompareFunc),e="",f=0;f<d.length;f++){var g=c[d[f]].local_guid;e+='<tr class="CollisionChannel"><td class="CollisionLabel">'+d[f]+"</td>";if(a)e+='<td class="tick status" id="ChannelStatus_'+g+'" /></td>';e+='<td class="action"><span class="select-style"><select class="dropdown" data-cguid="'+g+'" ><option class="dropdown_opt" value="none">No Action</option><option class="dropdown_opt" value="update_everything">Full Update</option><option class="dropdown_opt" value="update_translators_only">Update Translators Only</option><option class="dropdown_opt" value="create_new_channel">'+
b+' As New Channel</option></select></span></td><td class="newnamecol" id="NewName_'+g+'"></td><td class="notecol" id="Note_'+g+'"></td></tr>'}return e}function SCMbuildFileCollisionTable(a,b){return'<table id="bump_file_list" class="bumpTable"><thead><tr><th class="CollisionLabel">Shared file</th><th class="tick control"><input type="checkbox" name="BumpAll" id="BumpAll" />Replace with '+a+'</th><th class="notecol" /></tr></thead><tbody>'+SCMbuildFileCollisionRows(a,b)+"</tbody></table>"}
function SCMbuildFileCollisionRows(a,b){for(var c=Object.keys(b),d="",e=0;e<c.length;e++){d+='<tr class="BumpFile"><td>'+c[e]+'</td><td class="tick"><input type="checkbox" class="bumpUpdate fileBump" data-filepath="'+c[e]+'"></td>';if(e==0)d+='<td id="diffLink" rowspan="'+c.length+'"><span id="showCollidingFileDiffView" class="clickable_link">See what will change</span></td>';d+="</tr>"}return d}
function SCMcheckChannelLights(a,b){$.ajax({url:"/dashboard_data",method:"GET",data:{include_remote_servers:true},success:function(c){SCMupdateLightStatus(c,a,b)}})}function SCMupdateCollisionRestartNote(a,b,c,d){var e=$("table.CollisionTable td#Note_"+b);a.each(function(){if($(this).prop("checked")&&c[b]){e.html(d);return false}else e.html("")})}
function SCMupdateLightStatus(a,b,c){var d=SCMlights();a=a.Channels;for(var e=0;e<a.length;e++){var f=a[e].Channel.Guid,g=d[a[e].Channel.Light];b[f]=g=="green"?true:false;var k=$("input.bumpUpdate[data-cguid="+f+"]");SCMupdateCollisionRestartNote(k,f,b,c);$("#ChannelStatus_"+f).html('<img src="/images/button-dot'+g+'v4.gif" alt="'+g+'" />')}}function SCMupdateCollidingFileApprovals(a,b){a.each(function(){b[$(this).attr("data-filepath")].overwrite=$(this).prop("checked")})}
function SCMremoveInvalidChannelSelectOptions(a){a.NameOnlyCollisionsPresent=false;for(var b in a.ChannelCollisionMap){var c=a.ChannelCollisionMap[b],d=c.local_guid;if(!(c.hasOwnProperty("update_everything")||c.hasOwnProperty("update_translators_only"))){a.NameOnlyCollisionsPresent=true;c="select.dropdown[data-cguid='"+d+"'] option[value='update_translators_only']";$("select.dropdown[data-cguid='"+d+"'] option[value='update_everything']").remove();$(c).remove()}}}
function SCMcheckForNewChannelNameColumnVisibility(a){var b=$("table.CollisionTable th.newnamecol").css("display")=="none",c=a.length;$(a).each(function(){var d=$(this).val(),e="#NewName_"+$(this).attr("data-cguid");if(d!="create_new_channel"){c-=1;$(e).children("input").remove()}else $(e+" input").length||$(e).append("<input type='text'></input>")});if(c&&b){$("table.CollisionTable .newnamecol").css("display","table-cell");$("table.CollisionTable .notecol").css("width","25%")}else if(!c&&!b){$("table.CollisionTable .newnamecol").css("display",
"none");$("table.CollisionTable .notecol").css("width","50%")}}function SCMresetChannelCollisonChoices(a,b){var c=b[a];c.create_new_channel=false;if(c.hasOwnProperty("update_everything"))c.update_everything=false;if(c.hasOwnProperty("update_translators_only"))c.update_translators_only=false;c.new_channel_name=""}
function SCMupdateChannelApprovals(a,b,c){a.each(function(){var d=$(this).attr("data-cguid"),e=$(this).val(),f=c[d];SCMresetChannelCollisonChoices(f,b);if(e!="none"){b[f][e]=true;if(e=="create_new_channel"){d=$("#NewName_"+d+" input").val();b[f].new_channel_name=d}}})}function SCMupdateChannelNotes(a,b,c,d){var e=$("#collision_list td.notecol#Note_"+b);a.each(function(){var f=$(this).val();if((f=="update_everything"||f=="update_translators_only")&&c[b]){e.html(d);return false}else e.html("")})}
function SCMdisplayUpdateWarningMessageIfNeeded(a,b){if(!(!b||$("#collision_list #channel_update_warning_messge").length!=0)){var c;$("#collision_list").append("<p id='channel_update_warning_messge'>Note: <br> Some of the colliding channels match existing channels in name only and don't have the same component types.<br> Because of this you will not be able to "+a+" and update them. You will only be able to "+a+" them as new channels.</p>")}}
function SCMcheckIfContinueButtonNeedsDisabling(a,b){var c=a.length,d=0,e=b.length,f=0;$(a).each(function(){$(this).val()=="none"&&d++});$(b).each(function(){$(this).prop("checked")||f++});var g=$("#confirmation-button-continue");g.length||(g=$("#SCMgo"));if(c>0&&c===d&&e>0&&e==f){g.button("disable");$("#CompleteControls").hide();$("#SCMreviewControls .review-actions").css("padding","20px 20px")}else if(c>0&&c===d&&e===0){g.button("disable");$("#CompleteControls").hide();$("#SCMreviewControls .review-actions").css("padding",
"20px 20px")}else{g.button("enable");$("#SCMreviewControls .review-actions").css("padding","10px 20px");$("#CompleteControls").show()}}
function SCMsetSelectBoxChangeEvents(a,b,c,d,e){b.on("change",function(f){f.stopPropagation();f=$(this);f.val();var g=f.attr("data-"+d);SCMcheckChannelLights(a.StatusMap,SCM_BUMP_NOTE);SCMupdateChannelNotes(f,g,a.StatusMap,SCM_BUMP_NOTE);SCMupdateChannelApprovals(b,a.ChannelCollisionMap,a.LocalGuidsToNameMap);SCMcheckForNewChannelNameColumnVisibility(b)});c.on("change",function(){var f=$(this).val();$(b).each(function(){if($(this).children("option[value="+f+"]").length){$(this).val(f);$(this).trigger("change")}if(f==
"update_everything"||f=="update_translators_only")SCMdisplayUpdateWarningMessageIfNeeded(e,a.NameOnlyCollisionsPresent)})})}function SCMclearNewChannelNameWarnings(a){for(var b=0;b<a.length;b++){var c=$(a[b]).attr("data-cguid");$("#NewName_"+c+" input").css("border","none")}$("#collision_list .NewChannelNameWarning").remove()}
function SCMcheckForExistingName(a,b,c){for(var d in a)if(b===a[d].name){a="#collision_list .ExistingName-"+c;if(!$(a).length){b='<p class="NewChannelNameWarning ExistingName-'+c+'">Channel name "'+b+'" exists already! Choose another name.</p>';$("#collision_list").prepend(b);$(a).css("color","red")}$("#NewName_"+c+" input").css("border","1px solid red");return true}return false}
function SCMemptyNameFound(a){if(!$("#collision_list .EmptyName").length){$("#collision_list").prepend('<p class="NewChannelNameWarning EmptyName">New channel names cannot be empty!</p>');$("#collision_list .EmptyName").css("color","red")}$("#NewName_"+a+" input").css("border","1px solid red")}
function SCMcheckForDuplicateNewName(a,b,c){if(!(!b||b=="")){if(a.hasOwnProperty(b)){$("#NewName_"+c+" input").css("border","1px solid red");$("#NewName_"+a[b]+" input").css("border","1px solid red");a='Channel name "'+b+"\" Can't be added more than once!";if(!$("#collision_list .DuplicateNewName").length||$("#collision_list .DuplicateNewName").length&&$("#collision_list .DuplicateNewName").text()!==a){$("#collision_list").prepend('<p class="NewChannelNameWarning DuplicateNewName">'+a+"</p>");$("#collision_list .DuplicateNewName").css("color",
"red")}return true}else a[b]=c;return false}}function SCMvalidateAndStoreNewChannelNames(a,b,c){for(var d=false,e={},f=0;f<b.length;f++){var g=b[f],k=$(g).attr("data-cguid"),p=$(g).val();g=a.LocalGuidsToNameMap[k];if(p=="create_new_channel"){p=$("#NewName_"+k+" input").val();a.ChannelCollisionMap[g].new_channel_name=p;if(p==""||!p){SCMemptyNameFound(k);d=true}else if(c=="export")d=SCMcheckForExistingName(a.IxportableChannelList,p,k)||d;d=SCMcheckForDuplicateNewName(e,p,k)||d}}return d}
function SCMbuildCollidingFileDiffView(a,b,c,d,e){$("#SCMreview").remove();var f="",g=Object.keys(a.ChannelCollisionMap).length>0;if(g)f='<div id="SCMcommitList"></div>';var k=$('<div id="SCMreview"></div>');k.append(f+'<div id="SCMpanelAndDiff"><div id="SCMpanel"></div><div id="SCMdiffAndControls"><div id="SCMdiffTank"><div class="diff_toolbar"><div class="toolbar_filename"></div><div class="toolbar_lines"></div><div class="toolbar_display"><span class="label">Display:</span><div class="select-style" style="float: right;"><select id="SCMdiffViewSelect"><option value="vertical">Side by Side</option><option value="horizontal">Horizontal</option><option value="condensed">Changes Only</option></select></div><\!--/toolbar_display--\></div><\!--/diff_toolbar--\></div><div id="SCMdiff"></div><\!--/SCMdiffTank--\></div><\!--/SCMdiffAndControls--\></div><\!--/SCMpanelAndDiff--\></div><div id="SCMreviewControls"><div class="review-actions"><span id="CompleteControls"><a id="SCMgo" class="action-button green btn-large">Complete '+
b+'</a> <span style="margin: 0 10px; color: #888888;">or</span> </span><a id="SCMcancel" style="color: #666666; font-size: 14px;">Cancel</a></div><\!--/SCMreviewControls--\></div>');$("body").append(k);c();if(g){$("#collision_list").appendTo($("#SCMreview #SCMcommitList"));$("#SCMreview #SCMcommitList .scroller").css("top","45px")}else{$("#SCMreview #SCMpanelAndDiff").css("top","0");$("#SCMreview #SCMdiff").css("height","100%")}$("#bump_file_list").remove();$("#ApprovalDlg").remove();b=$(window).width()-
30;c=$(window).height()-30;k.css("overflow","hidden");k.dialog({bgiframe:true,width:b,height:c,title:"Confirm overwrites",modal:true,autoOpen:false,resizable:false,close:e});k.dialog("open");addControlsToDiffView(a,d,e)}
function SCMfixCollidingSharedFileView(){var a=$("#SCMreview #SCMcommitList"),b=$("#SCMreview .scroller");b.height(a.height()-$("#SCMreview .fixed").outerHeight()+"px");b.css("top",$("#SCMreview .fixed").outerHeight()-1+"px");$("#SCMreview .fixed table").width($("#SCMreview .scroller table").width()+"px")}
function SCMattachDisableActionsToDiffView(){var a=$("#collision_list .CollisionChannel select.dropdown"),b=$("#SCMpanel .tree input.commitFile");a.on("change",function(){SCMcheckIfContinueButtonNeedsDisabling(a,b)});b.on("change",function(){SCMcheckIfContinueButtonNeedsDisabling(a,b)});SCMcheckIfContinueButtonNeedsDisabling(a,b)}
function addControlsToDiffView(a,b,c){$("#SCMgo").button();$("#SCMreview #SCMdiffViewSelect").change(function(){a.DiffFormat=$(this).val();SCMdoFileDiff(a)});$("#SCMreview #SCMcancel").click(function(){$("#SCMreview").dialog("close");c()});$("#SCMreview #SCMpanelAndDiff").resizable({maxHeight:$("#SCMreview").height()-75,minHeight:10,handles:"n"});$("#SCMreview #SCMpanelAndDiff").on("resize",function(d,e){$("#SCMreview #SCMcommitList").css("height",e.position.top+"px");SCMfixCollidingSharedFileView()});
$("#SCMreview #SCMpanel").resizable({maxWidth:500,minWidth:60,handles:"e"});$("#SCMreview #SCMpanel").on("resize",function(d,e){d.stopPropagation();$("#SCMreview #SCMdiffAndControls").css("left",e.size.width+"px")});b();$("#SCMreview #SCMreviewControls").css("padding","0");$(".review-actions").css("padding","10px 20px")}
function SCMloadCollidingFileDiffViewData(a,b){var c=0,d="",e;for(e in a.FileCollisionMap)if(a.FileCollisionMap.hasOwnProperty(e)){a.IndexMap["File"+c]=e;a.FileCollisionMap[e].index=c;c==0&&SCMsetCurrentFile(a,e);d+=SCMbuildFileRow(a,e,c);c++}var f=a.CollationMap.projects,g=f?Object.keys(f).length:0,k=Object.keys(f);g&&k.sort(function(n,t){return SCMcompare(f[n],f[t],"project_name")});e="";for(var p=0;p<k.length;p++)e+=SCMbuildProjectRow(a,f,k[p]);k=Object.keys(a.FileCollisionMap).length;g=SCMsizeBoxes(k,
g);SCMrefreshFileBox(a,b,c,d,g[0]);SCMrefreshProjectBox(b,e,g[1])}function SCMprojectClasses(a){if(!a.other_projects)return"";return" "+a.other_projects.map(function(b){return"Prj"+b}).join(" ")}
function SCMbuildFileRow(a,b,c){var d="";d='<input class="commitFile" data-filepath="'+b+'" id="commitFile'+c+'" type="checkbox"'+(a.FileCollisionMap[b].overwrite?' checked="checked"':"")+" />";return"<li>"+d+'<label id="File'+c+'" class="file select '+SCMprojectClasses(a.CollationMap.files[b])+(b==a.CurrentFile?" c":"")+'">'+b+"</label></li>"}
function SCMbuildProjectRow(a,b,c){return'<div id="Prj'+c+'" class="project'+SCMfileClasses(b[c],a.FileCollisionMap)+'" data-projectguid="'+c+'"><strong>('+Object.keys(b[c].shared_files).length+")</strong> "+b[c].project_name+'<span class="project-files" id="PrjFil'+c+'" /></div>'}function SCMbuildProjectFileRow(a,b,c){return'<span class="project-file '+a[b].status+' " data-projectguid="'+c+'">'+b+"</span>"}
function SCMsetCurrentFile(a,b){a.CurrentFile=b;a.CurrentIndex="File"+a.FileCollisionMap[b].index;$(".toolbar_filename").html(b)}function SCMdoFileDiff(a){var b=a.Diffs[a.CurrentFile];SCMupdateLegend(b,$("#SCMreviewControls"));b.status&&!b.summary?$("#SCMdiff").html('<div class="noDiff">(<span>'+b.status+"</span>)</div>"):SCMdrawDiffs(b,a.DiffFormat)}
function SCMrefreshFileBox(a,b,c,d){var e=true,f;for(f in a.FileCollisionMap)if(!a.FileCollisionMap[f].overwrite){e=false;break}b=$('<ul class="tree">      <li><label><input type="checkbox" id="commitAll" name="commitAll"'+(e?' checked="checked"':"")+"/>Shared files in this "+b+":</label></li>"+d+"</ul>   ");d=b.find(".commitFile");e=b.find("#commitAll");SCMbumpTickCheck(d,e,"","filepath");d.on("change",function(){SCMupdateCollidingFileApprovals($(this),a.FileCollisionMap)});b.find(".select").click(function(){FileScroll=
$("#SCMstageFilesCollection").scrollTop();SCMsetCurrentFile(a,a.IndexMap[$(this).attr("id")]);SCMdecorate(c,FileScroll);SCMdoFileDiff(a)});$("#SCMreview #SCMpanel ul.tree").remove();$("#SCMreview #SCMpanel").prepend(b)}
function SCMrefreshProjectBox(a,b){if(a==="export")$("div.projects_affected").remove();else if(b){var c=$('<div class="projects_affected"><div class="label">Projects affected:</div><ul>'+b+"</ul></div>");$("#SCMreview div.projects_affected").remove();$("#SCMreview #SCMpanel").append(c)}else $("div.projects_affected").remove()};/*

 Copyright (c) 2010-2016 iNTERFACEWARE Inc.  All rights reserved.
*/
var ImportManager=function(){function a(){h.Popup=$(h.Popup);var j={sc_task:u()+"_channels"};if(h.Cred.auth_user){j.auth_user=h.Cred.auth_user;j.auth_password=h.Cred.auth_password}if(Object.keys(h.ChannelCollisionMap).length>0){var s=$("#collision_list .CollisionChannel select.dropdown");SCMclearNewChannelNameWarnings(s);if(SCMvalidateAndStoreNewChannelNames(h,s,u()))return false;j.channel_collision_confirmations=JSON.stringify(h.ChannelCollisionMap)}if(Object.keys(h.FileCollisionMap).length>0)j.overwrite_shared_file_confirmations=
JSON.stringify(h.FileCollisionMap);if(h.CommitMessage){j.commit_message=h.CommitMessage;var r=s="";switch(h.Task){case "/import_channels":s="Import Channels";j.remote_name=h.CurrentRepo;if(h.CurrentRemote.url)j.remote_location=h.CurrentRemote.url;if(h.IsIfwareRemote)j.is_ifware_remote=true;j.channels_version=h.CurrentChannelVersion;j.channel_import_list=JSON.stringify(q());r="Importing Channels...";break;case "/export_channels":s="Export Channels";j.remote_name=h.CurrentRepo;j.channel_export_list=
JSON.stringify(q());r="Exporting Channels...";break;default:h.Popup.dialog("close");return true}h.Popup.dialog(SCM_POPUP_PARAMS);h.Popup.dialog("option","buttons",{});h.Popup.dialog("option","title",s);h.Popup.html("<p>"+r+" <img src='jqueryFileTree/images/spinner.gif'> </p>");h.Popup.dialog("isOpen")||h.Popup.dialog("open");da();$.ajax({url:h.Task,method:"POST",data:j,success:I,error:function(v,C,R){h.Popup.dialog("close");y(v,C,R,j)}});return true}else B()}function b(){$.ajax({url:"/sc/collate",
method:"POST",data:{file_paths:JSON.stringify(h.FileCollisionMap)},success:function(j){h.CollationMap=j;SCMloadCollidingFileDiffViewData(h,u());SCMattachDisableActionsToDiffView();SCMdoFileDiff(h);SCMfixDiffView();SCMfixCollidingSharedFileView()},error:function(j,s,r){h.Popup.dialog("close");y(j,s,r,Params)}})}function c(j){o();g();$("#import_export_list").html("");var s={};s=j?j:h.CurrentRemote.url?{remote_name:h.CurrentRemote.name,remote_location:h.CurrentRemote.url}:{remote_name:h.CurrentRepo};
if(h.IsIfwareRemote)s.is_ifware_remote=true;if(s.remote_name!=""){Y();if(h.Cred.auth_user){s.auth_user=h.Cred.auth_user;s.auth_password=h.Cred.auth_password}h.CurrentRequest=$.ajax({url:"/sc/view_remote_channels",method:"POST",data:s,success:function(r){ba();P();o();h.AllVersionedChannelsList=r.channel_list;var v;r=0;for(Key in h.AllVersionedChannelsList)r++;v=r;r=false;if(v==0)r=true;else if(v==1){c:{v=1;for(Key in h.AllVersionedChannelsList){if(v==1){v=Key;break c}v++}v=""}h.CurrentChannelList=
Z(h.AllVersionedChannelsList[v]||[],"name");h.CurrentChannelVersion=v;h.CurrentChannelList.length||(r=true)}else{v=[];for(Key in h.AllVersionedChannelsList)v.push(Key);v.sort();m_SortedChannelVersionKeys=v;v=m_SortedChannelVersionKeys[m_SortedChannelVersionKeys.length-1];h.CurrentChannelList=Z(h.AllVersionedChannelsList[v]||[],"name");h.CurrentChannelVersion=v;v="";for(var C=0;C<m_SortedChannelVersionKeys.length;C++){for(var R=m_SortedChannelVersionKeys[C],V=R.split("_"),W="v",T=0;T<V.length;T++){W+=
V[T];if(T!=V.length-1)W+="."}v+="<span class='ChannelVersionSelector'><input type='radio' class='ChannelVersionRadio' name='channelVersionSelector' value='"+R+"'>"+W+"</span>"}$("<div id='ChannelVersionSelect'><span id='ChannelVersionSelectors'>"+v+"</span></div>").insertAfter("#ErrorMessage");$("input[value='"+m_SortedChannelVersionKeys[m_SortedChannelVersionKeys.length-1]+"']").prop("checked",true);x()}if(r){ea("There are no Iguana channels present in this remote repository.");r=false}else r=true;
r&&t()},error:function(r,v,C){m(r,v,C,s)}})}}function d(j){ba();h.CurrentChannelList=Z(j.channel_list||[],"name");if(h.CurrentChannelList.length){$("#import_export_list").html(L(true));$("tr.IxportChannel").click(function(){e($(this))});$("tr.IxportChannel td a, .sampleDataChannel").click(function(r){r.stopPropagation()});l($(".ixportChannel"),true);$('<a class="action-button blue" id="ExportTrigger">Export selected channels</a>').appendTo($("#RepoSelect"));var s=$(".ixportChannel");SCMbumpTickCheck(s,
$("#ixportAll"),"","index");s.on("change",function(){l($(this),true)});s.click(function(r){r.stopPropagation()});j=$(".sampleDataChannel");SCMbumpTickCheck(j,$("#sampleDataAll"),"","index");j.on("change",function(){l(s,true)});$("a#ExportTrigger").click(function(){if($("input:checked").length>0){h.Task="/export_channels";g();A(N);a()}else f("Please select at least one channel for export.")})}else{$("#RepoSelect").remove();ea("There are no valid channels present in Iguana to export.")}}function e(j){j=
j.find(".ixportChannel");j.prop("checked")?j.prop("checked",false):j.prop("checked",true);j.change()}function f(j){$("#ErrorMessage").html("<p class='error' style='margin: 20px 0px; width: 100%; text-align: center'>"+j+"</p").show()}function g(){$("#ErrorMessage").html("").hide()}function k(){h.CurrentRepo=$("#RepoSelector").val()}function p(j){function s(){h.Cred.auth_user=r.val();h.Cred.auth_password=v.val();a()}A(J);var r=$("#repo-username"),v=$("#repo-password");if(j&&(j.auth_user||j.auth_password)){r.val(j.auth_user);
v.val(j.auth_password);$("#AuthNotice").html("The username or password you provided was incorrect.").addClass("error")}h.Popup.dialog(SCM_POPUP_PARAMS);h.Popup.dialog("option","title","Enter Repository Credentials");v.on("change keyup keydown",function(C){(C.keyCode||C.which)==13&&s()});h.Popup.dialog("option","buttons",{Continue:s,Cancel:function(){r.val("");v.val("");h.Cred={};h.CommitMessage=null;$(this).dialog("close")}});$("#repo-username,#repo-password").css("width","95%");h.Popup.dialog("isOpen")||
h.Popup.dialog("open")}function n(j){function s(){h.Cred.auth_user=r.val();a()}A(D);var r=$("#repo-username");if(j&&j.auth_user){r.val(j.auth_user);$("#AuthNotice").html("The SSH username you provided was incorrect.").addClass("error")}h.Popup.dialog(SCM_POPUP_PARAMS);h.Popup.dialog("option","title","Enter SSH Username");r.on("change keyup keydown",function(v){(v.keyCode||v.which)==13&&s()});h.Popup.dialog("option","buttons",{Continue:s,Cancel:function(){r.val("");h.Cred={};h.CommitMessage=null;$(this).dialog("close")}});
$("#repo-username").css("width","95%");h.Popup.dialog("isOpen")||h.Popup.dialog("open")}function t(){$("#import_export_list").empty();$("#import_export_list").html(L(false));$('<a class="action-button blue" id="ImportTrigger">Import selected channels</a>').appendTo($("#ixport_list"));$("tr.IxportChannel").click(function(){e($(this))});$("tr.IxportChannel td a, .sampleDataChannel").click(function(s){s.stopPropagation()});var j=$(".ixportChannel");SCMbumpTickCheck(j,$("#ixportAll"),"","index");j.on("change",
function(){l($(this))});j.click(function(s){s.stopPropagation()});$("a#ImportTrigger").click(function(){if($(".ixportTable tbody input:checked").length>0){h.Task="/import_channels";g();A(N);a()}else f("Please select at least one channel for import.")})}function o(){$("#ChannelVersionSelect").remove()}function x(){$(".ChannelVersionRadio").click(function(){var j=$(this).attr("value");h.CurrentChannelList=Z(h.AllVersionedChannelsList[j]||[],"name");h.CurrentChannelVersion=j;t()})}function z(j){function s(){h.Cred.auth_user=
r.val();h.Cred.auth_password=v.val();h.Popup.dialog("close");c(j)}A(J);var r=$("#repo-username"),v=$("#repo-password");if(j.auth_user||j.auth_password){r.val(j.auth_user);v.val(j.auth_password);$("#AuthNotice").html("The username or password you provided was incorrect.").addClass("error")}h.Popup.dialog(SCM_POPUP_PARAMS);h.Popup.dialog("option","title","Enter Repository Credentials");h.Popup.on("dialogclose",function(){f("This repository requires a username and a password.")});v.on("change keyup keydown",
function(C){(C.keyCode||C.which)==13&&s()});h.Popup.dialog("option","buttons",{Continue:s,Cancel:function(){$(this).dialog("close")}});$("#repo-username,#repo-password").css("width","95%");h.Popup.dialog("isOpen")||h.Popup.dialog("open")}function M(j){function s(){h.Cred.auth_user=r.val();h.Popup.dialog("close");c(j)}A(D);var r=$("#repo-username");if(j.auth_user){r.val(j.auth_user);$("#AuthNotice").html("The username you provided was incorrect.").addClass("error")}h.Popup.dialog(SCM_POPUP_PARAMS);
h.Popup.dialog("option","title","Enter SSH Username");h.Popup.on("dialogclose",function(){f("This repository requires the username associated with your SSH key.")});r.on("change keyup keydown",function(v){(v.keyCode||v.which)==13&&s()});h.Popup.dialog("option","buttons",{Continue:s,Cancel:function(){$(this).dialog("close")}});$("#repo-username").css("width","95%");h.Popup.dialog("isOpen")||h.Popup.dialog("open")}function L(j){var s='<div id="ixport_list">  <table class="ixportTable">     <thead>     <tr>        <th class="ixportLabel">Channel</th>        <th class="notecol">Description</th>        <th class="tick control"><span>'+
(j?"Export":"Import")+'</span><br><input type="checkbox" name="ixportAll" id="ixportAll"></th>';if(j)s+='     <th class="tick control"><span>Include&nbsp;Sample&nbsp;Data</span><br><input type="checkbox" name="sampleDataAll" id="sampleDataAll"></th>';for(var r="",v,C=0;C<h.CurrentChannelList.length;C++){v=h.CurrentChannelList[C].guid in ifware.ExportGuids?"checked":"";r+='<tr class="IxportChannel">  <td class="ixportLabel">'+h.CurrentChannelList[C].name+'</td>  <td class="ixportNote notecol">'+SCMlinkText(h.CurrentChannelList[C].description)+
'</td>  <td class="tick control"><input type="checkbox" '+v+' class="ixportChannel" data-index="'+C+'"></td>';if(j)r+='<td class="tick control"><input type="checkbox" '+v+' class="sampleDataChannel" data-index="'+C+'"></td>';r+="</tr>"}return s+("     </tr>     </thead>     <tbody>"+r+"     </tbody>  </table></div>")}function J(){return $('<p id="AuthNotice">This repository requires authentication.</p>              <label for="repo-username">Username</label><br>              <input type="text" id="repo-username" name="repo-username" /><br>              <label for="repo-password">Password</label><br>              <input id="repo-password" name="repo-username" type="password" /><br>')}
function D(){return $('<p id="AuthNotice">This repository requires the username associated with your SSH key.</p>              <label for="repo-username">Username</label><br>              <input type="text" id="repo-username" name="repo-username" /><br>')}function N(){return $("<p />")}function O(j){var s=$("<p><strong>Welcome to Iguana!</strong> To help you get started, we've created a short tour to introduce you to the product. Are you ready to begin?</p>              <p><button id='demo-start'> Yes, I'd like to see the tour </button></p>              <p><button id='demo-decline'> No thanks, I'm ready to start working </button></p>");
s.find("#demo-start").button().click(function(r){h.Popup.dialog("close");fa.takeTour(r)});s.find("#demo-decline").button().click(function(){if(j)h.Popup.dialog("close");else{ifware.storage.set(ca,"true",365);H("               <p> No problem! You can access the tour at any time, should you change your mind.               Simply open <a href='/settings'> Settings</a> and click &quot;Take the Tour&quot;. </p>            ")}});return s}function P(){$("#ixport-popup").remove()}function B(){function j(){h.CommitMessage=
$("#user_commit_message input").val();var r;if(h.CommitMessage)r=true;else{$("#user_commit_message input").css("border","1px solid red");$("#user_commit_message_error").remove();h.Popup.append("<div id='user_commit_message_error' style='color:red'><p>You must enter a valid commit message to continue!</p></div>")}r&&a()}P();$("body").append("<div id='ixport-popup'></div>");h.Popup=$("#ixport-popup");h.Popup.dialog({modal:true,minWidth:450,resizable:false,buttons:{OK:j,Close:function(){$(this).dialog("close")}},
title:"Enter a Commit Message",close:function(){h.CommitMessage=null;$(this).remove()}});var s="<p>Enter a commit message for the "+u()+"ed channel data.</p><br><div id='user_commit_message'><input type=text></input></div>";h.Popup.append(s);h.Popup.dialog("open");$("#user_commit_message input").on("change keyup keydown",function(r){(r.keyCode||r.which)==13&&j()})}function A(j,s){P();$("body").append("<div id='ixport-popup'><img src='jqueryFileTree/images/spinner.gif' style='display: none;'></div>");
h.Popup=$("#ixport-popup");h.Popup.prepend(j(s));h.Popup.dialog(SCM_POPUP_PARAMS);$(window).resize()}function H(j,s){h.Popup=$(h.Popup);$("#ixport-popup").length>0||A(N);h.Popup.html(j);if(s){h.Popup.append("<p> If you are having trouble resolving this error, please               <a href=mailto:support@interfaceware.com?Subject=Iguana%20Channel%20Demo%20Failed> email us</a>. </p>");h.Popup.dialog("option","title","Error")}h.Popup.dialog("option","buttons",{Close:function(){$(this).dialog("close")}});
h.Popup.dialog("isOpen")||h.Popup.dialog("open")}function K(){for(var j in h.ChannelCollisionMap)h.LocalGuidsToNameMap[h.ChannelCollisionMap[j].local_guid]=j}function Q(j){$("#ApprovalDlg").remove();$("body").append('<div id="ApprovalDlg"><form id="ApprovalForm" /></div>');var s=$("#ApprovalDlg"),r="";r+="<p>Some of the translators in the channels you are attempting to export are set to run from commits with different versions of the following shared file(s):<br></p>";var v="",C=new ga,R;for(R in j.conflicting_files){C.reset();
v+="<span class='conflictedSharedFileHeader'>"+R+"</span>";for(var V in j.conflicting_files[R].versions){v+="<div class='conflictedSharedFileVersionContainer'><span class='conflictedSharedFileLetter'>"+C.getNextLetter()+"</span><span class='conflictedSharedFileVersionBox'>";for(var W in j.conflicting_files[R].versions[V].channels)v+="<div>"+W+"<span style='font-weight: bold'> >> </span> "+j.conflicting_files[R].versions[V].channels[W].component_type+"</div>";v+="</span>";v+="</div>"}}r+=v;r+="<p>You must correct this if you want to export this group of channels at the same time.</p>";
r+="<p>Note: <br> The translator(s) in each grouping are set to run from the same version of the corresponding shared file, with each grouping representing a different version of that file.<br>In order to correct this you must set all translators to run from a commit containing the same version of the conflicting shared file.</p>";s.find("#ApprovalForm").html(r);j=$(window).width()*0.85;r=$(window).height()*0.9;s.dialog({bgiframe:true,width:j,maxHeight:r,title:"Shared File Version Conflicts",modal:true,
autoOpen:false,buttons:{OK:function(){$(this).dialog("close")}},resizable:true,close:F});h.Popup.dialog("close");s.dialog("open")}function E(){for(var j in h.FileCollisionMap)if(h.FileCollisionMap.hasOwnProperty(j)){h.Diffs[j]=h.FileCollisionMap[j].diff;delete h.FileCollisionMap[j].diff}}function S(){var j=Object.keys(h.ChannelCollisionMap).length,s=Object.keys(h.FileCollisionMap).length,r=u(),v="<p>";if(s==1&&j==1)v="The channel you are trying to "+r+" below has the same name as a channel that already exists. It also uses a different version of a shared file that already exists on this "+
(r=="import"?"instance.":"repository.");else if(s==1&&j>1)v="The channels you are trying to "+r+" below have the same names as channels that already exist. They also use a different version of a shared file that already exists on this "+(r=="import"?"instance.":"repository.");else if(s>1&&j==1)v="The channel you are trying to "+r+" below has the same name as a channel that already exists. It also uses a different versions of shared files that exist already on this "+(r=="import"?"instance.":"repository.");
else if(s>1&&j>1)v="The channels you are trying to "+r+" below have the same names as channels that already exist. They also use different versions of shared files that exist already on this "+(r=="import"?"instance.":"repository.");else if(s==1)v="The channel you are trying to "+r+" uses a different version of a shared file that already exists on this "+(r=="import"?"instance.":"repository.");else if(s>1)v="The channel you are trying to "+r+" uses different versions of shared files that exist already on this "+
(r=="import"?"instance.":"repository.");else if(j==1)v="The channel you are trying to "+r+" below has the same name as a channel that already exists on this "+(r=="import"?"instance.":"repository.");else if(j>1)v="The channels you are trying to "+r+" below have the same names as channels that already exist on this "+(r=="import"?"instance.":"repository.");v+="</p><p>Please make a decision on how to proceed.</p>";return v}function U(j){function s(){SCMcheckIfContinueButtonNeedsDisabling(T,aa)}var r=
u();h.ChannelCollisionMap=j[r+"_summary"].channel_collision_confirmations||{};K();h.FileCollisionMap=j[r+"_summary"].overwrite_shared_file_confirmations||{};E();$("#ApprovalDlg").remove();$("body").append('<div id="ApprovalDlg"><form id="ApprovalForm" /></div>');j=$("#ApprovalDlg");var v=[{id:"confirmation-button-continue",text:"Continue",click:function(){a()&&$(this).dialog("close")}},{id:"confirmation-button-cancel",text:"Cancel "+r,click:function(){$(this).dialog("close")}}],C=S(),R=G(),V="";if(Object.keys(h.ChannelCollisionMap).length>
0)V+=SCMbuildChannelCollisionTable(r=="import",R,h.ChannelCollisionMap);var W="";if(Object.keys(h.FileCollisionMap).length>0)W=SCMbuildFileCollisionTable(R,h.FileCollisionMap);j.find("#ApprovalForm").html(C+V+W);C=$(window).width()*0.85;R=$(window).height()*0.9;j.dialog({bgiframe:true,width:C,maxHeight:R,title:"Channel Collison Confirmations",modal:true,autoOpen:false,buttons:v,resizable:true,close:F});var T=$("#collision_list .CollisionChannel select.dropdown"),aa=$("#bump_file_list input.bumpUpdate");
SCMbumpTickCheck(aa,$("#bump_file_list input#BumpAll"),"","filepath");aa.on("change",function(){SCMupdateCollidingFileApprovals($(this),h.FileCollisionMap);SCMcheckIfContinueButtonNeedsDisabling(T,aa)});SCMremoveInvalidChannelSelectOptions(h,T);SCMdisplayUpdateWarningMessageIfNeeded(u(),h.NameOnlyCollisionsPresent);SCMsetSelectBoxChangeEvents(h,T,$("#collision_list select#bulk_action"),"cguid",u());T.on("change",s);s();$("#diffLink").click(function(){T.off("change",s);SCMbuildCollidingFileDiffView(h,
G(),b,w,F)});h.Popup.dialog("close");j.dialog("open");if(document.location.pathname=="/settings"&&r=="import"){SCMpullStatus(h.StatusMap,SCM_BUMP_NOTE);h.StatusInterval=setInterval(function(){SCMcheckChannelLights(h.StatusMap,SCM_BUMP_NOTE)},1E3)}}function w(){$("#SCMgo").click(function(){a()&&$("#SCMreview").dialog("close")})}function m(j,s,r,v){if(s!="abort"){ba();j=j.responseJSON.error?j.responseJSON.error.description:j.status+" - "+j.statusText;switch(j){case "Unsupported URL protocol":j="Invalid URL/Path. Please check the URL/path to the repository and make sure the protocol and address/path are correct.";
break;case "SSH username required.":M(v);return;case "Authentication failed, make sure your credentials are valid and try again.":case "Authentication is required, please provide a valid username and password to continue.":case "Authentication Error.":z(v);return}H("<p> We're sorry, but the request could not be completed. The following error occurred: </p><p>"+j+"</p>",true)}}function y(j,s,r,v){if(s!="abort"){j=j.responseJSON.error?j.responseJSON.error.description:j.status+" - "+j.statusText;switch(j){case "SSH authentication is required, please provide a valid private key path and (if required) passphrase to continue.":j=
"This repository requires an SSH key.";break;case "SSH username required.":n(v);return;case "Authentication failed, make sure your credentials are valid and try again.":case "Authentication is required, please provide a valid username and password to continue.":case "Authentication Error.":p(v);return;case "Must select at least one channel.":f("Please select at least one channel for "+u()+".");return;case "Unsupported URL protocol":j="Unsupported URL protocol. Please check the URL/path to the repository.";
break;case "Your account does not have administrative privileges.":if(location.pathname=="/dashboard.html")j="You must be logged in as administrator to import the demo channels."}H("<p> We're sorry, but the request could not be completed. The following error occurred: </p><p>"+j+"</p>",true)}}function I(j){var s=u();if(j.success){j="<p>Success! The channels have "+s+"ed correctly.</p>";if(s=="import")j+="<p><a href='/'>View the channels.</a></p>";h.CommitMessage=null;H(j)}else s=="export"&&j.export_summary.shared_file_version_conflicts==
true?Q(j.export_summary):U(j)}function l(j,s){j.each(function(){var r=$(this).attr("data-index"),v=parseInt(r),C=$(this).prop("checked");(h.CurrentChannelList[v].selected=C)?$(this).parents("tr.IxportChannel").addClass("selected"):$(this).parents("tr.IxportChannel").removeClass("selected");if(s){r=$(".sampleDataChannel[data-index='"+r+"']");if(C){r.prop("disabled",false);h.CurrentChannelList[v].sample_data=r.prop("checked")}else{r.prop("disabled",true);h.CurrentChannelList[v].sample_data=false}}})}
function q(){for(var j=[],s=0;s<h.CurrentChannelList.length;s++)h.CurrentChannelList[s].selected&&j.push(h.CurrentChannelList[s]);return j}function u(){return h.Task.substring(1,7)}function G(){var j=u();return j.charAt(0).toUpperCase()+j.substr(1).toLowerCase()}function F(){$("#SCMreview").remove();if(h.StatusInterval!=0){clearInterval(h.StatusInterval);h.StatusInterval=0}h.ChannelCollisionMap={};h.FileCollisionMap={};h.CollationMap={};h.StatusMap={};h.IndexMap={};h.LocalGuidsToNameMap={}}function Z(j,
s){return j.map(function(r){return[r[s].toLocaleLowerCase(),r]}).sort(SCMcompareFunc).map(X)}function X(j){return j[1]}function Y(){$("#SCMloadWheelContainer").show()}function ba(){$("#SCMloadWheelContainer").hide()}function da(){$("#import_export_list p.error").remove()}function ea(j){da();$("#import_export_list").prepend("<br><div style='text-align: center'><span><p class='error'>"+j+"</p></span></div>")}var fa=this,ca="DemoNoReminder",h={HasPrompted:false,UserInitiated:false,DiffFormat:"vertical",
Popup:"",IndexMap:{},Diffs:{},StatusInterval:0,Task:"",Initialized:false,Cred:{},CurrentRepo:"",CurrentStatus:"",CommitMessage:null,CurrentRemote:{},IsIfwareRemote:false,CurrentRequest:{},CurrentChannelList:[],AllVersionedChannelsList:[],CurrentChannelVersion:"",StatusMap:{},CollationMap:{},CurrentFile:"",CurrentIndex:0,IxportableList:[],FileCollisionMap:{},LocalGuidsToNameMap:{},ChannelCollisionMap:{},NameOnlyCollisionsPresent:false},ga=function(){var j=null,s=null;this.getNextLetter=function(){if(j===
null||s===null){j=65;s=1}if(j>90){j=65;s++}for(var r=String.fromCharCode(j),v="",C=0;C<s;C++)v+=r;j++;return v};this.reset=function(){s=j=null}};this.statusMap=function(){return h.StatusMap};this.openDemoPopup=function(j){h.UserInitiated=j;A(O,j)};this.checkForDemo=function(j){var s;if(!(s=h.HasPrompted)){a:{if(j=j.Servers){if(j.length>1){j=true;break a}if((j=j[0].DashboardData)&&j.TotalCountOfChannel>0){j=true;break a}}j=false}s=j||ifware.storage.get(ca)}if(!s){h.HasPrompted=true;fa.openDemoPopup()}};
this.takeTour=function(){var j=window.open("http://training.interfaceware.com/iguana-overview/","_blank");ifware.storage.set(ca,"true",365);j.focus()};this.show=function(j,s){SCMclearActiveRequest(h.CurrentRequest);h.CurrentRepo=j;h.CurrentRemote=s||{};h.IsIfwareRemote=false;if(s)h.IsIfwareRemote=true;c()};this.showLocal=function(){$("#import_export_list").html("");Y();k();$("#RepoSelector").on("change",k);$.ajax({url:"/sc/view_local_channels",method:"GET",data:{for_export:true},success:d,error:m})}};
function setupImportManager(){ifware=window.ifware||{};ifware.ImportManager=new ImportManager}setupImportManager();/*

 Copyright (c) 2010-2016 iNTERFACEWARE Inc.  All rights reserved.
*/
var ChannelRestoreManager=function(){function a(){$("#HistoryBody #SCMcommitList").removeClass("SCMloading")}function b(){var q=l.Commits[l.CurrentCommitIndex].commit_comment.match(/Bulk channel deletion performed by user \"(.+)\"./);return q&&q.length>0}function c(q){var u=q.match(/Channel \"(.+)\" deleted./);if(u)return PAGhtmlEscape(u[1]);if(u=q.match(/Channel "(.*)" removed by user ".+" using Channel API./))return PAGhtmlEscape(u[1]);return q}function d(){for(var q in l.ChannelCollisionMap)l.LocalGuidsToNameMap[l.ChannelCollisionMap[q].local_guid]=
q}function e(){SCMcommitKeys(l.CurrentCommitIndex,l.Commits.length-1,function(q){l.CurrentCommitIndex=q;$("tr.commitRow").removeClass("current");$('tr.commitRow[data-index="'+q+'"]').addClass("current");SCMscrollCommitList();m()})}function f(){$("#restore-popup").remove()}function g(q){f();$("body").append("<div id='restore-popup'><img src='jqueryFileTree/images/spinner.gif' style='display: none;'></div>");l.Popup=$("#restore-popup");l.Popup.prepend(q);l.Popup.dialog(SCM_POPUP_PARAMS);$(window).resize()}
function k(q,u){l.Popup=$(l.Popup);$("#restore-popup").length>0||g($("<p />"));l.Popup.html(q);if(u){l.Popup.append("<p> If you are having trouble resolving this error, please               <a href=mailto:support@interfaceware.com?Subject=Iguana%20Channel%20Restoration%20Failure> email us</a>. </p>");l.Popup.dialog("option","title","Error")}l.Popup.dialog("option","buttons",{Close:function(){$(this).dialog("close")}});l.Popup.dialog("isOpen")||l.Popup.dialog("open")}function p(){if(l.StatusInterval!=
0){clearInterval(l.StatusInterval);l.StatusInterval=0}l.ChannelCollisionMap={};l.FileCollisionMap={};I.showDeletedChannels()}function n(){$("#HistoryBody").html('<div id="SCMcommitList"></div>         <div id="SCMreviewPanelAndPreview">            <div id="SCMpanel"></div>            <div id="SCMpreviewAndControls">               <div id="SCMpreviewTank">                  <div class="preview_toolbar">                     <div class="toolbar_filename"></div>                  </div>                  <div id="SCMpreview"></div>               </div>            </div>         </div>         <div id="SCMreviewControls">            <div class="review-actions">               <span id="SCMrestoreButtonContainer">                  <a id="SCMrestore" style="display: inline" class="action-button green btn-large">Restore</a>                  <span style="margin: 0 10px; color: #888888;">or</span>               </span>               <a id="SCMcancel" style="color: #666666; font-size: 14px;">Cancel</a></div>         </div>      ');
SCMfixPreviewView();$("#SCMreviewPanelAndPreview").resizable({maxWidth:"100%",minWidth:"100%",minHeight:300,maxHeight:$("body").height()-350,handles:"n"});var q=$("#HistoryBody #SCMpanel");q.resizable({maxHeight:"100%",minHeight:"100%",minWidth:180,maxWidth:$("body").width()/3,handles:"e"});q.on("resize",function(u,G){u.stopPropagation();$("#HistoryBody #SCMpreviewAndControls").css("left",G.size.width+"px")})}function t(){var q=l.Files[l.CurrentFile];$("#SCMpreviewTank .toolbar_filename").html(SCMchannelConfigNameClip(l.CurrentFile));
$("#SCMpreviewTank #SCMpreview").html(q);$("#SCMpreviewTank #SCMpreview").css("overflow","auto");$("#SCMpreviewTank #SCMpreview .previewTable").css("border","none")}function o(){var q="",u;for(u in l.Files)q+='<li><label class="file'+(u==l.CurrentFile?" c":"")+'"><span class="select">'+u+"</label></li>";return q}function x(){for(var q="",u=0;u<l.Channel_Names.length;u++)q+='<li><label class="file"><span class="select">'+l.Channel_Names[u]+"</label></li>";return q}function z(){var q=$("#SCMpanel");
$("ul.tree").remove();if(l.Channel_Names&&l.Channel_Names.length){var u="Channel";if(l.Channel_Names.length>1)u+="s";u=$('<ul id="restoreChannelNames" class="tree">               <li><label>'+u+":</label></li>"+x()+"</ul>            ");q.append(u)}u=$('<ul class="tree">            <li><label>Files:</label></li>'+o()+"</ul>         ");q.append(u);$("label.file.c")[0].scrollIntoView();u.find("label.file").click(function(){l.CurrentFile=$(this).text();$("label.file").removeClass("c");$(this).addClass("c");
t()});q.scrollLeft(0);q.scrollTop(0)}function M(){if(!l.Channel_Names||l.Channel_Names.length===0)return"<p>Restore bulk deletion channels?</p>";var q="<p>The following bulk deletion channels will be restored:</p>";q+="<ul>";for(var u=0;u<l.Channel_Names.length;u++)q+="<li>"+l.Channel_Names[u]+"</li>";q+="</ul>";return q}function L(){$("#SCMcancel").click(function(){SCMdisableKeys();document.location="/settings"});$("#SCMrestore").click(function(){var q;q=b()?M():'<p>Restore channel "'+c(l.Commits[l.CurrentCommitIndex].commit_comment)+
'"?</p>';g("<p>"+q+"</p>");l.Popup.dialog("option","buttons",{Continue:function(){w()},Cancel:function(){$(this).dialog("close");I.showDeletedChannels()}})})}function J(q){var u=l.Commits[q],G=new Date(u.commit_timestamp*1E3),F=u.commit_id==l.Commits[l.CurrentCommitIndex].commit_id?" current":"";G=G.toLocaleDateString()+" "+G.toLocaleTimeString();return'<tr data-index="'+q+'" class="commitRow'+F+'"><td class="note">'+u.commit_comment+'</td><td class="commit_id">'+u.commit_id+'</td><td class="user">'+
u.commit_user+'</td><td class="date">'+G+"</td></tr>"}function D(q){for(var u='<div class="fixed">                      <table id="commit_list" class="commitTable fixedHead"><thead><tr>                      <th class="note">Channel Deletion Commits</th>                      <th class="commit_id">Commit ID</th>                      <th class="user">Removed By</th>                      <th class="date">Date Removed</th></tr></thead></table>                      </div>                      <div class="scroller"><table class="commitTable"><tbody>',
G=l.Commits.length-1;G>-1;G--)u+=J(G);u+="</tbody></table></div>";q.html(u);$("body").click(function(){SCMreEnableMouse()});$(document).mousemove(function(F){if(window.lastX!==F.clientX||window.lastY!==F.clientY)SCMreEnableMouse();window.lastX=F.clientX;window.lastY=F.clientY});e();$("tr.commitRow").click(function(){var F=$(this);$("tr.commitRow.current").removeClass("current");l.CurrentCommitIndex=F.attr("data-index");F.addClass("current");e();m()});SCMfixPreviewView()}function N(){var q=Object.keys(l.ChannelCollisionMap).length,
u=Object.keys(l.FileCollisionMap).length,G=b(),F="<p>";if(u==1&&q==1)F="The channel you are trying to restore below has the same name as a channel that already exists. It also uses a different version of a shared file that already exists on this instance. ";else if(u==1&&q>1)F="The channels you are trying to restore below have the same names as channels that already exist. They also use a different version of a shared file that already exists on this instance. ";else if(u>1&&q==1)F="The channel you are trying to restore below has the same name as a channel that already exists. It also uses a different versions of shared files that exist already on this instance. ";
else if(u>1&&q>1)F="The channels you are trying to restore below have the same names as channels that already exist. They also use different versions of shared files that exist already on this instance. ";else if(u==1&&G)F="The channels you are trying to restore use a different version of a shared file that already exists on this instance.";else if(u==1)F="The channel you are trying to restore uses a different version of a shared file that already exists on this instance.";else if(u>1&&G)F="The channels you are trying to restore use different versions of shared files that exist already on this instance.";
else if(u>1)F="The channel you are trying to restore uses different versions of shared files that exist already on this instance.";else if(q==1)F="The channel you are trying to restore below has the same name as a channel that already exists.";else if(q>1)F="The channels you are trying to restore below have the same names as already existing channels.";F+="</p><p>Please make a decision on how to proceed.</p>";return F}function O(){if(Object.keys(l.ChannelCollisionMap).length>0){var q=$("#collision_list .CollisionChannel select.dropdown");
SCMclearNewChannelNameWarnings(q);if(SCMvalidateAndStoreNewChannelNames(l,q,"restore"))return true}return false}function P(){for(var q in l.FileCollisionMap)if(l.FileCollisionMap.hasOwnProperty(q)){l.Diffs[q]=l.FileCollisionMap[q].diff;delete l.FileCollisionMap[q].diff}}function B(q){function u(){SCMcheckIfContinueButtonNeedsDisabling(X,Y)}l.ChannelCollisionMap=q.restore_summary.channel_collision_confirmations||{};l.FileCollisionMap=q.restore_summary.overwrite_shared_file_confirmations||{};d();P();
$("#ApprovalDlg").remove();$("body").append('<div id="ApprovalDlg"><form id="ApprovalForm" /></div>');q=$("#ApprovalDlg");var G=N(),F="";if(Object.keys(l.ChannelCollisionMap).length>0)F+=SCMbuildChannelCollisionTable(true,"Restore",l.ChannelCollisionMap);var Z="";if(Object.keys(l.FileCollisionMap).length>0)Z=SCMbuildFileCollisionTable("Restore",l.FileCollisionMap);q.find("#ApprovalForm").html(G+F+Z);G=$(window).width()*0.85;F=$(window).height()*0.9;q.dialog({bgiframe:true,width:G,maxHeight:F,title:"Channel Collison Confirmations",
modal:true,autoOpen:false,buttons:[{id:"confirmation-button-continue",text:"Continue",click:function(){O()||w()}},{id:"confirmation-button-cancel",text:"Cancel Restore",click:function(){e();$(this).dialog("close")}}],resizable:true,close:p});var X=$("#collision_list .CollisionChannel select.dropdown"),Y=$("#bump_file_list input.bumpUpdate");SCMbumpTickCheck(Y,$("#bump_file_list input#BumpAll"),"","filepath");Y.on("change",function(){SCMupdateCollidingFileApprovals($(this),l.FileCollisionMap);SCMcheckIfContinueButtonNeedsDisabling(X,
Y)});SCMremoveInvalidChannelSelectOptions(l,X);SCMdisplayUpdateWarningMessageIfNeeded("restore",l.NameOnlyCollisionsPresent);SCMsetSelectBoxChangeEvents(l,X,$("#collision_list select#bulk_action"),"cguid","restore");X.on("change",u);u();$("#diffLink").click(function(){X.off("change",u);SCMbuildCollidingFileDiffView(l,"Restore",y,A,H)});l.Popup.dialog("close");q.dialog("open");if(document.location.pathname=="/settings"){SCMpullStatus(l.StatusMap,SCM_BUMP_NOTE);l.StatusInterval=setInterval(function(){SCMcheckChannelLights(l.StatusMap,
SCM_BUMP_NOTE)},1E3)}}function A(){$("#SCMgo").click(function(){O()||w()})}function H(){$("#SCMreview").remove();if(l.StatusInterval!=0){clearInterval(l.StatusInterval);l.StatusInterval=0}l.ChannelCollisionMap={};l.FileCollisionMap={};l.CollationMap={};l.StatusMap={};l.IndexMap={};l.LocalGuidsToNameMap={};I.showDeletedChannels()}function K(q,u){if(u!="abort"){l.Popup.dialog("close");var G="<p> We're sorry, but the request could not be completed. The following error occurred: </p><p>"+(q.responseJSON&&
q.responseJSON.error?q.responseJSON.error.description:q.status+" - "+q.statusText)+"</p>";a();k(G,true)}}function Q(q){if(q.success){q=q.result_channels;if(!q||q.length===0)q="<p>The channel(s) has been successfully restored!</p><p><a href='/'>View the channel(s)</a></p>";else if(q.length===1)q='<p>The channel "'+q[0]+"\" has been successfully restored!</p><p><a href='/'>View the channel</a></p>";else{for(var u="<p>The following channel(s) have been successfully restored: </p><ul>",G=0;G<q.length;G++)u+=
"<li>"+q[G]+"</li>";u+="</ul><p><a href='/'>View the channel(s)</a></p>";q=u}e();k(q);$("#ApprovalDlg").remove();p();H()}else{SCMdisableKeys();B(q)}}function E(q){var u=$("#HistoryBody #SCMcommitList");u.html("");l.Commits=q;l.CurrentCommitIndex=l.Commits.length-1;a();if(l.Commits.length){D(u);L();m()}else{$("#HistoryBody #SCMcommitList p.error").remove();$("#HistoryBody #SCMcommitList").prepend("<br><div style='text-align: center'><span><p class='error'>There are no deleted channels under source control that can be restored at this time.</p></span></div>")}}
function S(q){l.Files=q.files;l.Channel_Names=q.channels;$("#HistoryBody #SCMpanel").removeClass("SCMloading");a:{q=Object.keys(l.Files);for(var u=0;u<q.length;u++)if(l.CurrentFile==l.Files[u])break a;l.CurrentFile=q[0]}if(l.Channel_Names.length!==0){z();t()}else{$("#SCMpreviewTank .toolbar_filename").html("Invalid Restore Commit.");$("#SCMpreviewTank #SCMpreview").html("<div id='invalidRestoreCommitMessage'><p>There was an error loading the configuration files in the selected restore commit.</p><p>Unfortunately it will not be possible to restore the channel(s) from this deletion.</p></div>");
$("#SCMrestoreButtonContainer").hide()}$("#HistoryBody #SCMpreview").removeClass("SCMloading")}function U(q){l.CollationMap=q;SCMloadCollidingFileDiffViewData(l,"restore");SCMattachDisableActionsToDiffView();SCMdoFileDiff(l);SCMfixCollidingSharedFileView()}function w(){f();g("<p>Restoring Channel...<img src='jqueryFileTree/images/spinner.gif'> </p>");l.Popup.dialog("option","buttons",{});l.Popup.dialog("option","title","Restore Channel");SCMclearActiveRequest(l.CurrentRequest);var q=b(),u={files:Object.keys(l.Files),
delete_commit_id:l.Commits[l.CurrentCommitIndex].commit_id,bulk_deletion_restore:q};if(!q){q=c(l.Commits[l.CurrentCommitIndex].commit_comment).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"');u.channel_name=q}if(Object.keys(l.ChannelCollisionMap).length)u.channel_collision_confirmations=JSON.stringify(l.ChannelCollisionMap);if(Object.keys(l.FileCollisionMap).length)u.overwrite_shared_file_confirmations=JSON.stringify(l.FileCollisionMap);l.CurrentRequest=$.ajax({url:"/restore_selected_channel",
method:"POST",data:u,traditional:true,success:Q,error:K})}function m(){$("#SCMrestoreButtonContainer").show();$("#HistoryBody #SCMpanel ul.tree").remove();$("#HistoryBody #SCMpanel").addClass("SCMloading");$("#HistoryBody .preview_toolbar .toolbar_filename").html("");$("#HistoryBody #SCMpreview").html("").addClass("SCMloading");SCMclearActiveRequest(l.CurrentRequest);l.CurrentRequest=$.ajax({url:"/sc/deleted_channel_files",data:{delete_commit_id:l.Commits[l.CurrentCommitIndex].commit_id},method:"GET",
success:S,error:K})}function y(){$.ajax({url:"/sc/collate",method:"POST",data:{file_paths:JSON.stringify(l.FileCollisionMap)},success:U,error:function(q,u,G){l.Popup.dialog("close");K(q,u,G,Params)}})}var I=this,l={Files:{},Popup:"",Commits:[],CurrentFile:"",CurrentRequest:{},CurrentCommitIndex:0,IndexMap:{},StatusMap:{},CollationMap:{},FileCollisionMap:{},ChannelCollisionMap:{},DiffFormat:"vertical",Diffs:{},StatusInterval:0,LocalGuidsToNameMap:{},NameOnlyCollisionsPresent:false};this.showDeletedChannels=
function(){n();$("#HistoryBody #SCMcommitList").html("").addClass("SCMloading");SCMclearActiveRequest(l.CurrentRequest);l.CurrentRequest=$.ajax({url:"/sc/view_deleted_channels",method:"GET",data:{},success:E,error:K})}};function setupChannelRestoreManager(){ifware=window.ifware||{};ifware.ChannelRestoreManager=new ChannelRestoreManager}setupChannelRestoreManager();function SCMsettingsReview(){ifware.SettingsReviewer=new SCMsettingsReviewer;ifware.SettingsReviewer.init()}
var SCMsettingsReviewer=function(){function a(){$("#HistoryBody").html('<div id="SCMcommitList"></div>         <div id="SCMreviewPanelAndDiff">         <div id="SCMpanel"></div>         <div id="SCMdiffAndControls">         <div id="SCMdiffTank">         <div class="diff_toolbar">            <div class="toolbar_filename"></div>            <div class="toolbar_lines"></div>            <div class="toolbar_display"><div class="select-style" style="float: right;">               <select id="SCMdiffViewSelect">               <option value="vertical">Side by Side</option>               <option value="horizontal">Horizontal</option>               <option value="condensed">Changes Only</option>               </select>               <select id="SCMcomparisonSelect">               <option value="changes">What changed</option>               <option value="current">Preview revert</option>               </select></div>            </div>          <\!--/diff_toolbar--\></div>         <div id="SCMdiff"></div>         <\!--/SCMdiffTank--\></div>         <\!--/SCMdiffAndControls--\></div>         <\!--/SCMreviewPanelAndDiff--\></div>         <div id="SCMreviewControls">         <div class="review-actions"><a id="SCMrevert" style="display: inline" class="action-button green btn-large">Revert</a> <span style="margin: 0 10px; color: #888888;">or</span> <a id="SCMcancel" style="color: #666666; font-size: 14px;">Cancel</a></div>         <\!--/SCMreviewControls--\></div>      ');SCMfixDiffView();
$(window).resize(function(){$("#SCMreviewPanelAndDiff").resizable("option","maxHeight",$("body").height()-250);$("#SCMpanel").resizable("option","maxWidth",$("body").width()/3);SCMfixDiffView()});$("#SCMreviewPanelAndDiff").resizable({maxWidth:"100%",minWidth:"100%",minHeight:300,maxHeight:$("body").height()-350,handles:"n"});$("#SCMreviewPanelAndDiff").on("resize",function(m,y){$("#SCMcommitList").css("height",y.position.top+"px");SCMfixDiffView()});var w=$("#SCMpanel");w.resizable({maxHeight:"100%",
minHeight:"100%",minWidth:180,maxWidth:$("body").width()/3,handles:"e"});w.on("resize",function(m,y){m.stopPropagation();$("#SCMdiffAndControls").css("left",y.size.width+"px")});$("#view_mode").length||t();b()}function b(){var w={detailed:S},m=$("#SCMcommitList");m.html("").addClass("SCMloading");$.ajax({url:"/sc/config_history",cache:false,data:w,success:function(y){m.html("").removeClass("SCMloading");B=y;H=B.length-1;z(m);o();D();d()},error:function(y,I,l){p(y,I,l)}})}function c(){if(K.length===
0){$("#SCMdiff").html('<div class="noDiff" style="font-weight:bold">No files changed in this commit.</div>');O={};$(".toolbar_filename").html("");$(".toolbar_lines").html("")}else{$(".toolbar_filename").html(SCMchannelConfigNameClip(A,30));var w={file_path:A};w.commit_from=Q=="changes"?B[H].commit_parent_id||"first":"null";w.commit_to=B[H].commit_id;$.ajax({url:"/sc/diff",data:w,success:function(m){O=m.diff;SCMupdateLegend(O,$("#SCMreviewControls"));if(O.status&&!O.summary)$("#SCMdiff").html('<div class="noDiff">(<span>'+
O.status+"</span>)</div>");else{SCMdrawDiffs(O,P);m=B[H];$("#SCMcommitInfo").html("<span>"+m.commit_id+"</span>. ("+(Q=="changes"?"Showing what changed.":"Showing differences with current version.")+")")}},error:function(m,y,I){p(m,y,I)}})}}function d(){$.ajax({url:"/sc/files_from_commit_simple",data:{commit_id:B[H].commit_id},success:function(w){K=w.files;a:{for(w=0;w<K.length;w++)if(A==K[w])break a;A=K[0]}L()},error:function(w,m,y){p(w,m,y)}})}function e(w){var m=w||{};m.sc_task="iguana_revert";
m.revert_to_commit=B[H].commit_id;E.dialog("option","buttons",{Cancel:function(){$(this).dialog("close");N()}});E.html("<p>Reverting...<img src='jqueryFileTree/images/spinner.gif'> </p>");$.ajax({url:"/revert",data:m,success:function(y){g(y)},error:function(y,I,l){k(y,I,l,m)}})}function f(w){var m=Object.keys(w).map(function(y){return"<strong>"+y+" server</strong>"}).join(", ");E.html("This revert operation will restart the following services:<br><br>"+m);E.dialog("option","buttons",{"Approve and continue":function(){for(var y in w)if(w.hasOwnProperty(y))w[y]=
true;y={server_restart_confirmations:JSON.stringify(w)};$(".ui-dialog-buttonpane button").button("disable");e(y)},Cancel:function(){E.dialog("close")}})}function g(w){if(!w.success&&w.server_restart_confirmations)f(w.server_restart_confirmations);else{var m=w.dashboard_url||"/dashboard.html";E.html("<p>Revert Success!</p>");E.dialog("option","buttons",{"Return to dashboard":function(){window.location=m},Close:function(){E.dialog("close");a()}})}}function k(w){w="<p> We're sorry, but the request could not be completed.                     The following error occurred: </p>                    <p>"+
(w.responseJSON.error?w.responseJSON.error.description:w.status+" - "+w.statusText)+"</p> ";$("#history-popup").length>0||n();E.html(w);E.dialog("option","title","Revert Error");E.dialog("option","buttons",{Close:function(){E.dialog("close")}})}function p(w){if(!(w.status&&w.status==403)){ErrorMessage=w.responseJSON.error?w.responseJSON.error.description:w.status+" - "+w.statusText;w="<p> We're sorry, but an unexpected error occurred: </p>                    <p>"+ErrorMessage+"</p> ";$("#history-popup").length>
0||n();E.html(w);E.dialog("option","title","Error");E.dialog("option","close",function(){window.location="/dashboard.html"});E.dialog("option","buttons",{"Return to dashboard":function(){E.dialog("close")}})}}function n(w){$("#history-popup").remove();$("body").append("<div id='history-popup'><img src='jqueryFileTree/images/spinner.gif' style='display: none;'></div>");E=$("#history-popup");E.prepend(w);E.dialog(U);$(window).resize()}function t(){$("#cookie_crumb").append('<span style="position: absolute; right: 25px; top: 6px"><span class="select-style"><select id="view_mode" class="dropdown"><option class="dropdown_opt" value="normal">Normal View</option><option class="dropdown_opt" value="detailed">Detailed View</option></select></span></span>');
$("#view_mode").change(function(){S=$(this).val()==="detailed";a()})}function o(){if(H==B.length-1){$("a#SCMrevert").hide();$(".review-actions span").hide()}else{$("a#SCMrevert").show();$(".review-actions span").show()}}function x(){SCMcommitKeys(H,B.length-1,function(w){H=w;$("tr.commitRow").removeClass("current");$('tr.commitRow[data-index="'+w+'"]').addClass("current");SCMscrollCommitList();o();d()})}function z(w){for(var m='<div class="fixed">                      <table id="commit_list" class="commitTable fixedHead"><thead><tr>                      <th class="note">Note</th><th class="commit_id">Commit ID</th>                      <th class="user">User</th><th class="date">Date</th></tr></thead></table>                      </div>                      <div class="scroller"><table class="commitTable"><tbody>',
y=B.length-1;y>-1;y--)m+=M(y);m+="</tbody></table></div>";w.html(m);$("body").click(function(){SCMreEnableMouse()});$(document).mousemove(function(I){if(window.lastX!==I.clientX||window.lastY!==I.clientY)SCMreEnableMouse();window.lastX=I.clientX;window.lastY=I.clientY});x();$("tr.commitRow").click(function(){var I=$(this);$("tr.commitRow.current").removeClass("current");H=I.attr("data-index");I.addClass("current");x();o();d()});SCMfixDiffView()}function M(w){var m=B[w],y=new Date(m.commit_timestamp*
1E3),I=m.commit_id==B[H].commit_id?" current":"";y=y.toLocaleDateString()+" "+y.toLocaleTimeString();return'<tr data-index="'+w+'" class="commitRow'+I+'"><td class="note">'+PAGhtmlEscape(m.commit_comment)+'</td><td class="commit_id">'+m.commit_id+'</td><td class="user">'+m.commit_user+'</td><td class="date">'+y+"</td></tr>"}function L(){var w=$('<ul class="tree">         <li><label>Changed files:</label></li>'+J()+"</ul>      ");$("ul.tree").remove();var m=$("#SCMpanel");m.append(w);if(K.length){$("label.file.c")[0].scrollIntoView();
w.find(".select").click(function(){A=K[$(this).attr("data-index")];d()})}m.scrollLeft(0);m.scrollTop(0);c()}function J(){for(var w="",m=0;m<K.length;m++)w+='<li><label class="file'+(K[m]==A?" c":"")+'"><span class="select" data-index="'+m+'">'+K[m]+"</label></li>";return w}function D(){$("#SCMdiffViewSelect").change(function(){P=$(this).val();SCMdrawDiffs(O,P)});$("#SCMcomparisonSelect").change(function(){Q=$(this).val();c()});$("#SCMcancel").click(function(){N()});$("#SCMrevert").click(function(){n("Are you sure you want to revert to previous settings?<br><br>All channels will be stopped, some channels may be added or removed, uncommitted translator changes will be lost, any queued messages will be cleared, and the service may need to be restarted.");
E.dialog("option","buttons",{Continue:function(){e()},Cancel:function(){$(this).dialog("close")}})})}function N(){document.location="/settings"}var O=SCMinitialDiffs(),P="vertical",B=[],A="IguanaConfiguration.xml",H=0,K=[],Q="changes",E="",S=false,U={modal:true,width:400,title:"Revert to previous settings",resizable:false,close:function(){$(this).remove()}};this.init=function(){a()};this.exit=function(){N()};this.files=function(){return K};this.file=function(){return A}};/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
function onListViewToggle(a){var b=$("#"+a);a=$("#"+a+"_toggle");if("none"==b.css("display")){b.slideDown("fast");a.attr("src","/images/arrow-expanded.gif")}else{b.slideUp("fast");a.attr("src","/images/arrow-contracted.gif")}}function onDescriptionChange(a){if(a.offsetHeight<a.scrollHeight)if(a.offsetWidth<a.scrollWidth){a.style.overflow="auto";a.style.height=a.scrollHeight+32+"px"}else a.style.height=a.scrollHeight+"px"}
function CalculatePopupPosition(a,b,c,d){if(b+d>c)b=Math.max(10,a+c-(d+10));return b+a}function showErrorMessage(a){$("#result_title").html("Error").removeClass().addClass("error");$("#result_content").text(a);$("#result").removeClass().addClass("error").slideDown("fast")}function showSuccessMessage(a){$("#result_title").html("Success").removeClass().addClass("success");$("#result_content").text(a);$("#result").removeClass().addClass("success").slideDown("fast")}
function showVerifySubmitMessageWithCallback(a,b,c){$("#result_title").html("");$("#result_content").html("");$("#result").attr("title",a);$("#result").removeClass("success");$("#result").removeClass("error");$("#result_title").hide();$("div.result_buttons_system").hide();$("#result_content").text(b);$("#result").dialog({bgiframe:true,width:500,modal:true,buttons:{No:function(){$("#result").dialog("close");$("div.result_buttons_system").show();$("#result_title").show();$("#result").removeAttr("title").addClass("indeterminate");
$("#result").dialog("destroy");c(false)},Yes:function(){$("#result").dialog("close");$("div.result_buttons_system").show();$("#result_title").show();$("#result").removeAttr("title");$("#result").dialog("destroy");c(true)}}});$("#result").dialog("open")}
function showVerifySubmitMessage(a,b,c){$("#result_title").html("");$("#result_content").html("");$("#result").attr("title",a);$("#result").removeClass("success");$("#result").removeClass("error");$("#result_title").hide();$("div.result_buttons_system").hide();$("#result_content").text(b);$("#result").dialog({bgiframe:true,width:500,modal:true,buttons:{No:function(){$("#result").dialog("close");$("div.result_buttons_system").show();$("#result_title").show();$("#result").removeAttr("title");$("#result").dialog("destroy")},
Yes:function(){$("#result").dialog("close");$("div.result_buttons_system").show();$("#result_title").show();$("#result").removeAttr("title");$("#result").dialog("destroy");$(c).submit()}}});$("#result").dialog("open")}
function removeUserFromSystem(a){var b=encodeURIComponent(a);$.ajax({url:"/users",data:"action=removeUser&user="+b,async:false,success:function(c){try{if(c)window.parent.document.location="/settings#Page=users?status_message="+encodeURIComponent("User "+a+" was successfully deleted.")}catch(d){}},error:function(){MiniLogin.show("Iguana is not Responding",function(){removeUserFromSystem(a)})}})}
function showVerifySubmitMessageJson(a,b,c){$("#result").attr("title",a);$("#result").removeClass("success");$("#result").removeClass("error");$("#result_title").hide();$("div.result_buttons_system").hide();$("#result_content").text(b);$("#result").dialog({bgiframe:true,width:500,modal:true,buttons:{No:function(){$("#result").dialog("close");$("div.result_buttons_system").show();$("#result_title").show();$("#result").removeAttr("title")},Yes:function(){$("#result").dialog("close");$("div.result_buttons_system").show();
$("#result_title").show();$("#result").removeAttr("title");removeUserFromSystem(c)}}});$("#result").dialog("open")}
function showRejectSubmitMessage(a,b){$("#result").attr("title",a);$("#result").removeClass("success");$("#result").removeClass("error");$("#result_title").hide();$("div.result_buttons_system").hide();$("#result_content").text(b);$("#result").dialog({bgiframe:true,width:500,modal:true,buttons:{Close:function(){$("#result").dialog("close");$("div.result_buttons_system").show();$("#result_title").show();$("#result").removeAttr("title")}}});$("#result").dialog("open")}
function onHideResult(){$("#result").slideUp("fast")}$(document).ready(function(){$(document).on("click","#result_close",onHideResult)});ifware=ifware||{};ifware.Settings=ifware.Settings||{};
ifware.Settings.Repositories=function(){function a(b){$(".protocol_input#"+b+"_path_input").show();$(".protocol_input").not("#"+b+"_path_input").hide()}return{setupAddOrEditPage:function(){$("input#repo_name").focus();$("input[type=radio]:checked").length==0&&$("input[value=local]").prop("checked",true);a($("input[type=radio]:checked").val());$(".repo_protocol").on("click",function(b){a(b.target.value)});$(".protocol_input input[type=text]").not("#repo_key_path").not("#ssh_username").on("blur",function(b){b=
b.target.value;var c=$("#local_path").val().match(/(\w?:\\|~*\/)/);c=c?c[0]:"";if(c[c.length-1]==="\\")c+="\\";$("#local_path").val(b.replace(/^\w+:\/\//,c));c=RegExp("^(\\w+://|"+c+")");$("#http_path").val(b.replace(c,"http://"));$("#https_path").val(b.replace(c,"https://"));$("#ssh_path").val(b.replace(c,"ssh://"))}).trigger("blur");$("form#add_or_edit_repo").submit({uri:"/repositories/do_add_or_edit",form_id:"add_or_edit_repo"},SettingsHelpers.submitForm);$("a#submit").click(function(b){b.preventDefault();
if(!$("#repo_protocol_ssh").prop("checked")){$("#repo_key_path").val("");$("#ssh_username").val("")}$("form#add_or_edit_repo").submit()});$("form#add_or_edit_repo").keypress(function(b){b.keyCode===13&&$("form#add_or_edit_repo").submit()})},setupListingPage:function(){$(".remove_repo").click(function(b){b.preventDefault();var c=$(this).data("repo_name");showVerifySubmitMessageWithCallback("Delete Repository Confirmation","Really Delete repository "+$(b.target).data("repo_name")+"?",function(d){d&&
$.ajax({url:"/repositories/remove",method:"POST",data:{repo:c},success:function(e){$("#main").html(e.body)},error:function(){}})})})}}}();/*

 Copyright (c) 2010-2011 iNTERFACEWARE Inc.  All rights reserved.
*/
var MiniLogin=function(){function a(){clearTimeout(f);jQuery.ajax({url:"/login_check",method:"POST",data:{Username:$("#login-user").val(),Password:$("#login-pass").val()},dataType:"json",cache:false,success:function(n){if(n)if(n.LoginOkay)if(n.UnlockRequired)window.location="/log_locker_settings.html";else{$("#login-popup").dialog("close");if(g){n=g;g=null;n()}}else $("#login-message").text("Login failed: "+n.ErrorText||"Please try again.");else $("#login-message").text("Login failed: Iguana is not responding.")},
error:function(n,t){if(n.status==403||t=="parsererror"){$("#login-message").text("Iguana is restarting, please wait...");f=setTimeout(a,1E3)}else $("#login-message").text("Login failed: Iguana is not responding.")}})}function b(n,t){if(k)if(g){var o=g;g=function(){try{o()}catch(M){}t()}}else{var x=$("#login-popup");x.length||(x=c());g=function(){t()};var z=$("#login-pass").val(e);$("#login-message").text(n);x.dialog("open");z.focus()}}function c(){$("body").append('         <div id="login-popup" style="display:none">            <table width="100%">            <tr>               <td colspan="2" id="login-message" align="center">            <tr>               <td align="right">Username:               <td><input type="text" id="login-user" readonly class="full_length">            <tr>               <td align="right">Password:               <td><input id="login-pass" type="password" class="full_length">            </table>         </div>      ');
$("#login-user").val(d);$("#login-pass").keydown(function(n){if(n.keyCode==13){n.preventDefault();a()}});return $("#login-popup").dialog({autoOpen:false,closeOnEscape:false,modal:true,open:function(){$(".ui-dialog-titlebar-close").hide()},resizable:false,title:"Iguana Login",buttons:{"Login & Retry":a,Cancel:function(){window.location="/"}}})}var d,e,f,g,k;$(document).ready(function(){$(window).unload(function(){k=false});k=true});var p=AjaxImpl(function(n,t,o){var x;if(o.status==403||n=="parsererror")x=
"Your session has expired.";else if(n!="notmodified")x="Iguana is not responding.";b(x,t)});p.show=b;p.loggedIn=function(){var n=p.ajax({url:"/login_check",method:"POST",dataType:"json",cache:false,async:false});try{if($.parseJSON(n.responseText).LoginOkay)return true}catch(t){}b("Your session has expired.",$.noop);return false};p.init=function(n,t){d=n;e=t};return p}();
