var clientData = new Object();
var userData = new Object();
var jsonData = new Object();
var TokenID = null, UserInformation = null, IPClientID = null, UniqueID = null, ClientID = null, ClientURL = '';
var AuthenticatedUserInformation, multitenancyData, MultitenancyInformation, ToolbarRequestObject, ToolbarInformation;
var url, ipAddress, macIpAddress;
var AuthenticatedUserObject = new Object();
var ConnectToolbarData = new Object();
ConnectToolbarData.Multitenancy = new Object();
ConnectToolbarData.UserInformation = new Object();
ConnectToolbarData.RemoteHostInformation = new Object();
var remoteHostInformationXml = null;
var UserFeatures = new Object();
UserFeatures.hasDMS = "true";
UserFeatures.hasPP = "true";
UserFeatures.hasZL = "true";
var HomeUrl, Turl ,typedUrl, profileClicked = false, mainUrl, redirect = true, isPublicUrl = 0;
var lastseenAt;
if (typeof IsCommonLogin === "undefined") {
IsCommonLogin = 0;
}
/*********************/
//var historycount = 0;
// var history_obj = new Array();
var his_Array = new Array();
var app_Object = new Object();
app_Object.count = 0;
app_Object.isMainEntry = false;
app_Object.historyObject = new Array();
var isHistoryRedirect = false;
var isBackPressed = false;
var isAppAppended = false;
var isredirectquerystring = "&isredirect";
/*********************/
function bindfunction() {
$.fn.on = function (types, selector, data, fn, /*INTERNAL*/one) {
var type, origFn;
// Types can be a map of types/handlers
if (typeof types === "object") {
// ( types-Object, selector, data )
if (typeof selector !== "string") {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for (type in types) {
this.on(type, selector, data, types[type], one);
}
return this;
}
if (data == null && fn == null) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if (fn == null) {
if (typeof selector === "string") {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if (fn === false) {
fn = returnFalse;
} else if (!fn) {
return this;
}
if (one === 1) {
origFn = fn;
fn = function (event) {
// Can use an empty set, since event contains the info
jQuery().off(event);
return origFn.apply(this, arguments);
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
}
return this.each(function () {
jQuery.event.add(this, types, fn, data, selector);
});
};
}
// invoke
bindfunction();
// $.support.cors = true;
///Created by : Haritha
/// Purpose :
function ConnectToolbarRequest() {
// if broswer veersion is less that i.e 9 then redirect it someother page
if (navigator.appName == "Microsoft Internet Explorer") {
if (navigator.userAgent.indexOf('MSIE ') > 0) {
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(navigator.userAgent) != null)
rv = parseFloat(RegExp.$1);
if (rv < 10) {
window.parent.location.href = browserDetectURL;
}
}
}
// history management related calls are present in this method
ConnectToolbarHistoryManagement();
if (parent.set_ExceptionServiceHostUrl != undefined) {
parent.set_ExceptionServiceHostUrl(svcExceptionHandling);
}
if (parent.ResourceFileHandler != undefined && parent.ResourceFileHandler.set_serviceHostBaseURL != undefined) {
parent.ResourceFileHandler.set_serviceHostBaseURL(svcResourceFile);
}
try {
$("#productContainer").empty();
$("#LogoContainer").empty();
$("#logoimagecontainer").empty();
$("#divSisDropdown").empty();
Turl = typedUrl = url = window.location.href;
// parsing the url to capture tokeniD and UniqueID
if (url.split('?').length > 1) {
url = url.replace(/&/g, ',');
if (url.split('?')[1].split(',').length > 0) {
var urlparam = url.split('?')[1].split(',');
if (urlparam.length > 0) {
for (i = 0; i < urlparam.length; i++) {
if (urlparam[i].split('=')[0] == "TokenID") {
TokenID = urlparam[i].split('=')[1];
if (navigator.cookieEnabled) {
sessionStorage.TokenID = TokenID;
isSessionActive();
}
}
if (urlparam[i].split('=')[0] == "UniqueID") {
UniqueID = urlparam[i].split('=')[1];
}
if (urlparam[i].split('=')[0] == "MP") {
profileClicked = true;
}
if (urlparam[i].split('=')[0] == "login_for") {
ClientURL = urlparam[i].split('=')[1];
var regexp = new RegExp('#([^\\s]*)');
ClientURL = ClientURL.replace(regexp, '');
//alert(ClientURL);
//if(ClientURL.indexOf('#') > 0)
// ClientURL = ClientURL.substring(0, str.indexOf('#') - 1);
}
}
}
}
}
if (ClientURL.length > 0)
Turl = typedUrl = url = ClientURL;
// method to validate tokenid , fetch multitenancy and store all of them in sessions
ConnectToolbarSessionData();
}
catch (exception) {
var customMsg = "error in ConnectToolbarRequest";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha - 7/6/2015
/// Purpose : method to validate tokenid , fetch multitenancy and store all of them in sessions
function ConnectToolbarSessionData() {
// if token id is null update it from the session storage
if (TokenID == null || TokenID == undefined || TokenID == "") {
if (navigator.cookieEnabled) {
if (sessionStorage.TokenID != undefined && sessionStorage.TokenID != null && sessionStorage.TokenID != "" && IsCommonLogin == 0) {
TokenID = sessionStorage.TokenID;
}
}
}
// check if the sessionStorage i.e cookie is enabled
if (navigator.cookieEnabled) {
// if multitenancy infromation is not avaible in the browser, check if the TokenID exists validate and fetch the multitenancy else call multitenancy
if (sessionStorage.Multitenancy == undefined || sessionStorage.Multitenancy == "undefined" || sessionStorage.Multitenancy == "" || sessionStorage.Multitenancy == null) {
// check for tokenID
if (TokenID != null && TokenID != "" && TokenID != undefined) {
// validate TokenID which will validate and return multitenancy information
ValidateTokenID();
}
else {
// fetch client information
GetMultiTenancyXml(url);
}
}
else {
var xml = sessionStorage.Multitenancy;
$(xml).find('client').each(function () {
ClientID = $(this).attr("id");
mainUrl = $(this).attr("mainUrl");
});
isPublicUrl = $(xml).find('ClientMappings').attr('ispublic');
clientData.ClientID = ClientID;
AuthenticatedUserObject.UserMultitenacyXml = xml;
AuthenticatedUserObject.MultitenancyTokenID = sessionStorage.MultitenancyTokenID;
ipAddress = $(xml).find('IPAddress').attr("Address");
macIpAddress = $(xml).find('MacAddress').attr("Address");
BindInformation();
}
} else {
GetMultiTenancyXml(url);
}
}
function ConnectToolbarHistoryManagement()
{
var typedUrlHash = window.location.href;
var isredirectparamexist = false;
if (typedUrlHash.split('?').length > 1) {
typedUrlHash = typedUrlHash.replace(/&/g, ',');
if (typedUrlHash.split('?')[1].split(',').length > 0) {
var urlparam = typedUrlHash.split('?')[1].split(',');
if (urlparam.indexOf("isredirect") > -1)
isredirectparamexist = true;
}
}
if (isredirectparamexist == true) {
if (sessionStorage["history_array"] === undefined) {
history_obj = new Array();
app_Object.historyObject = new Array(); app_Object.historyObject.push(new Object());
app_Object.count = 1;
his_Array = new Array();
}
else {
his_Array = $.parseJSON(sessionStorage["history_array"]);
app_Object.historyObject = new Array(); app_Object.historyObject.push(new Object());
app_Object.count = 1;
}
// window.location.hash = "?begin";
}
else if (sessionStorage["history_array"] === undefined) {
//history_obj = new Array();
app_Object.historyObject = new Array(); app_Object.historyObject.push(new Object());
app_Object.count = 1;
his_Array = new Array();
}
else {
his_Array = $.parseJSON(sessionStorage["history_array"]);
app_Object = his_Array[his_Array.length - 1];
his_Array.pop();
sessionStorage["history_array"] = JSON.stringify(his_Array);
// app_Object.count = app_Object.historyObject.length;
}
if (navigator.userAgent.indexOf("MSIE") > 0 || navigator.userAgent.indexOf("Trident") > 0) {
$(window).on('hashchange', function () {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '' || hash === '#') {
onBackPressed();
}
}
});
}
}
///Created by : Haritha
/// Purpose :
function GetMultiTenancyXml(url) {
jsonData.multitenancyObj = new Object();
jsonData.multitenancyObj.TypedUrl = url;
multitenancyData = JSON.stringify(jsonData);
var multitenacyService;
if (window.XMLHttpRequest) {
multitenacyService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
multitenacyService = new ActiveXObject("Microsoft.XMLHTTP");
}
multitenacyService.open('POST', svcMultitenancy + '/svcMultitenancy.svc/FetchMultiTenancyXml', true);
multitenacyService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
multitenacyService.send(multitenancyData);
multitenacyService.onload = function () {
if (multitenacyService.readyState == 4) {
if (multitenacyService.status == 200) {
MultitenancySuccess(multitenacyService.responseText);
}
}
else {
var customMsg = "error in multitenancy";
ExceptionLogging(multitenacyService.responseText, customMsg);
}
};
}
///Created by : Haritha
/// Purpose :
function MultitenancySuccess(msg) {
try {
var xml = JSON.parse(msg);
// if some Error is returned check then call the toolbar service to paint : haritha 1/9/2014
if (xml.FetchMultiTenancyXmlResult.RCode != "MTS000000000I0001" && xml.FetchMultiTenancyXmlResult.RCode == null) {
if (xml.FetchMultiTenancyXmlResult.RData != "" && xml.FetchMultiTenancyXmlResult.RData != null) {
if (xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml != "") {
if (navigator.cookieEnabled) {
sessionStorage.Multitenancy = xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml;
sessionStorage.MultitenancyTokenID = xml.FetchMultiTenancyXmlResult.RData.PreLoginToken;
}
AuthenticatedUserObject.UserMultitenacyXml = xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml;
AuthenticatedUserObject.MultitenancyTokenID = xml.FetchMultiTenancyXmlResult.RData.PreLoginToken;
ipAddress = $(xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml).find('IPAddress').attr("Address");
macIpAddress = $(xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml).find('MacAddress').attr("Address");
$(xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml).find('client').each(function () {
ClientID = $(this).attr("id");
mainUrl = $(this).attr("mainUrl");
});
isPublicUrl = $(xml.FetchMultiTenancyXmlResult.RData.MutitenancyXml).find('ClientMappings').attr('ispublic');
clientData.ClientID = ClientID;
BindInformation();
}
}
}
else if (xml.FetchMultiTenancyXmlResult.RCode == "MTS000000000I0001") {
var resourceText = ResourceFileHandler.get_ResourceValueV3(xml.FetchMultiTenancyXmlResult.RCode, { et: 'Framework', ec: 'CT' });
if (typeof showErrorForCT == 'function') {
showErrorForCT(resourceText);
}
}
//clientData.SiteLevelUrl = jsonData.multitenancyObj.TypedUrl;
}
catch (exception) {
var customMsg = "MultitenancySuccess";
ExceptionLogging(exception, customMsg);
}
}
function BindInformation() {
try {
if (isPublicUrl == "1") { redirect = false; } else { redirect = true; }
if (redirect) {
if (mainUrl.replace("http://", "") != typedUrl.replace("http://", "").split("/")[0]) {
if (typedUrl.indexOf("ParentRegistration.aspx") == -1 && typedUrl.indexOf("EmailVerification.aspx") == -1) {
if (TokenID == null || TokenID == undefined || TokenID == "") {
window.parent.location.href = "http://" + mainUrl.replace("http://", "");
}
else {
ToolbarRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(clientData) + '}';
if (TokenID != null) {
ValidateTokenID();
}
else {
GetAuthenticatedInformation();
GetToolBarInformation();
}
}
}
else {
ToolbarRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(clientData) + '}';
if (TokenID != null) {
ValidateTokenID();
}
else {
GetAuthenticatedInformation();
GetToolBarInformation();
}
}
}
else {
ToolbarRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(clientData) + '}';
if (TokenID != null) {
ValidateTokenID();
}
else {
GetAuthenticatedInformation();
GetToolBarInformation();
}
}
}
else {
ToolbarRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(clientData) + '}';
if (TokenID != null) {
ValidateTokenID();
}
else {
GetAuthenticatedInformation();
GetToolBarInformation();
}
}
}
catch (exception) {
var customMsg = "error in BindInformation";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose :
function ValidateTokenID() {
clientData.TokenID = TokenID;
if (sessionStorage.lastseenAt != null && sessionStorage.lastseenAt != undefined) {
lastseenAt = sessionStorage.lastseenAt;
}
else {
isSessionActive();
lastseenAt = sessionStorage.lastseenAt;
}
bindRemoteHostInformation();
clientData.IPAddress = ipAddress;
clientData.MacAddress = macIpAddress;
clientData.BrowserName = ConnectToolbarData.RemoteHostInformation.BroswerName;
clientData.BrowserVersion = ConnectToolbarData.RemoteHostInformation.BrowserVersion;
clientData.OS = ConnectToolbarData.RemoteHostInformation.OS;
clientData.OSVersion = ConnectToolbarData.RemoteHostInformation.OSVersion;
clientData.TimeZone = ConnectToolbarData.RemoteHostInformation.TimeZone;
clientData.TimeZoneName = ConnectToolbarData.RemoteHostInformation.TimeZoneName;
AuthData = '{"authenticationRequestObject":' + JSON.stringify(clientData) + ',"lastSeenAt":' + JSON.stringify(lastseenAt) + '}';
var ValidateTokenService;
if (window.XMLHttpRequest) {
ValidateTokenService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
ValidateTokenService = new ActiveXObject("Microsoft.XMLHTTP");
}
ValidateTokenService.open('POST', svcIPAuthentication + '/svcIPAuthentication.svc/ValidateAutheticationSession', true);
ValidateTokenService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
ValidateTokenService.send(AuthData);
ValidateTokenService.onload = function () {
if (ValidateTokenService.readyState == 4) {
if (ValidateTokenService.status == 200) {
var msg = JSON.parse(ValidateTokenService.responseText)
if (msg.ValidateAutheticationSessionResult.RData != null) {
if (navigator.cookieEnabled) {
sessionStorage.Multitenancy = msg.ValidateAutheticationSessionResult.RData.MultitenancyXml;
}
$(msg.ValidateAutheticationSessionResult.RData.MultitenancyXml).find('client').each(function () {
ClientID = $(this).attr("id");
mainUrl = $(this).attr("mainUrl");
});
isPublicUrl = $(msg.ValidateAutheticationSessionResult.RData.MultitenancyXml).find('ClientMappings').attr('ispublic');
clientData.ClientID = ClientID;
AuthenticatedUserObject.UserMultitenacyXml = msg.ValidateAutheticationSessionResult.RData.MultitenancyXml;
ipAddress = $(msg.ValidateAutheticationSessionResult.RData.MultitenancyXml).find('IPAddress').attr("Address");
macIpAddress = $(msg.ValidateAutheticationSessionResult.RData.MultitenancyXml).find('MacAddress').attr("Address");
}
if (msg.ValidateAutheticationSessionResult.RCode == "false") {
GetAuthenticatedInformation();
if (typeof OnLogoutComplete == 'function') {
OnLogoutComplete();
}
TokenID = null;
UniqueID = null;
if (navigator.cookieEnabled) {
sessionStorage.removeItem("TokenID");
sessionStorage.removeItem("history_array");
}
location.reload(true);
window.parent.location.href = url.split('?')[0];
}
else {
if (TokenID != null) {
$("#uploadNotificationIcon").show();
}
if (msg.ValidateAutheticationSessionResult.RData != null) {
ConfiguringUserPermissions(msg.ValidateAutheticationSessionResult.RData.UserFeatureXml);
AuthenticatedUserObject.UserInformation = fetchXML(msg.ValidateAutheticationSessionResult.RData.UserDetails);
GetAuthenticatedInformation();
if (typeof OnAuthenticate == 'function') {
isAppAppended = true;
window.location.hash = "?App";
OnAuthenticate();
}
PaintUserInformation(msg.ValidateAutheticationSessionResult.RData.UserDetails);
}
}
ToolbarRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(clientData) + '}';
GetToolBarInformation();
}
}
else {
var customMsg = "error in validation";
ExceptionLogging(ValidateTokenService.responseText, customMsg);
}
};
}
///Created by : Haritha
/// Purpose :
function GetToolBarInformation() {
var ToolBarService;
if (window.XMLHttpRequest) {
ToolBarService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
ToolBarService = new ActiveXObject("Microsoft.XMLHTTP");
}
ToolBarService.open('POST', svcToolbar + '/svcToolbar.svc/PaintClientData', true);
ToolBarService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
ToolBarService.send(ToolbarRequestObject);
ToolBarService.onload = function () {
if (ToolBarService.readyState == 4) {
if (ToolBarService.status == 200) {
var msg = JSON.parse(ToolBarService.responseText)
ToolbarInformation = msg;
setUserName(msg);
}
}
else {
var customMsg = "error in ToolbarInformation";
ExceptionLogging(ToolBarService.responseText, customMsg);
}
};
}
$(document).keypress(function (e) {
if (e.which === 13) {
if (e.target.id == "txtusername" || e.target.id == "txtpassword") {
AuthenticateUser();
}
}
isSessionActive();
});
$(document).click(function (e) {
if (e.target.id != "divSchoolSelect") {
$("#divSchoolList").css("display", "none");
}
if (e.target.id != "divSamoSelect") {
$("#divSamoSiteList").css("display", "none");
}
if (e.target.id == "imgUser") {
ShowMyProfile();
}
if (!$(e.target).hasClass("nt_item")) {
hideNotificationPopup();
}
isSessionActive();
});
function isSessionActive() {
var newdate = new Date();
try{
var timezoneOffset = newdate.getTimezoneOffset()
var timezoneOffsetStr = ((timezoneOffset < 0 ? '+' : '-') + timeZoneSplit(parseInt(Math.abs(timezoneOffset / 60)), 2) + timeZoneSplit(Math.abs(timezoneOffset % 60), 2));
var refreshtime = newdate.getMonth() + 1 + '/' + newdate.getDate() + '/' + newdate.getFullYear() + ' ' + newdate.getHours() + ':' + newdate.getMinutes() + ':' + newdate.getSeconds() + ' ' + timezoneOffsetStr;
sessionStorage.lastseenAt = refreshtime;
}
catch (exception){
var customMsg = "error in isSessionActive";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose :
function setUserName(eventargs) {
try {
for (i = 0; i < eventargs.PaintClientDataResult.RData.count; i++) {
clientData.IPClientID = eventargs.PaintClientDataResult.RData.data[0].IPClientID;
if (eventargs.PaintClientDataResult.RData.data[i].Ispublic || TokenID != null) {
if ($("#logoimagecontainer").length == 0) {
$("#LogoContainer").append("
");
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "VMS") {
if ($("#productContainer").length == 0) {
$("#iddropdownplus").append("");
}
eventargs.PaintClientDataResult.RData.data[i].SiteLevelUrl = eventargs.PaintClientDataResult.RData.data[i].SiteLevelUrl.replace('/Default.aspx', '');
$("#productContainer").append(" ");
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "DMS" && UserFeatures.hasDMS == "true") {
if ($("#productContainer").length == 0) {
$("#iddropdownplus").append("");
}
$("#productContainer").append(" ");
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "Connect") {
if ($("#productContainer").length == 0) {
$("#iddropdownplus").append("");
}
//$("#productContainer").append(" ");
$("#productContainer").append(" ");
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "Zipline" && UserFeatures.hasZL == "true") {
if ($("#productContainer").length == 0) {
$("#iddropdownplus").append("");
}
$("#productContainer").append(" ");
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "PP" && UserFeatures.hasPP == "true") {
if ($("#productContainer").length == 0) {
$("#iddropdownplus").append("");
}
$("#productContainer").append(" ");
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "Samo") {
//if ($("#LogoContainer").length == 0) {
// $("#ClientMappings").append("");
//}
var SamoProduct = new Object();
SamoProduct.ClientID = eventargs.PaintClientDataResult.RData.data[i].ClientID;
SamoProduct.ProductName = eventargs.PaintClientDataResult.RData.data[i].ProductName;
SamoProduct.SiteLevelUrl = eventargs.PaintClientDataResult.RData.data[i].SiteLevelUrl;
GetSamoSiteInformation(SamoProduct);
if ($("#divSamoDropdown").length == 0) {
if ($(".logo_text_container").length == 0) {
$("#ClientMappings").append("
");
}
}
}
if (eventargs.PaintClientDataResult.RData.data[i].ClientFeature == "SiS") {
var SisProduct = new Object();
SisProduct.ClientID = eventargs.PaintClientDataResult.RData.data[i].ClientID;
SisProduct.SamoClientID = SamoProduct.ClientID;
SisRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(SisProduct) + '}';
GetSchoolInformation();
if ($("#divSisDropdown").length == 0) {
$("#iddropdownplus").append("");
}
}
}
if (IsCommonLogin == 0) {
if ($("#divSignIN").length == 0) {
$("#ClientMappings").append("");
}
}
}
if (IsCommonLogin == 0) {
if (TokenID != null) {
$("#UserInformationDiv").css("display", "inline-block");
$('#divLogin').css("display", "none");
$('#divSignIN').css("display", "none");
}
else {
$("#UserInformationDiv").css("display", "none");
$('#divLogin').css("display", "none");
$('#divSignIN').css("display", "inline-block");
if (document.getElementById("imgSignin") != null) {
// document.getElementById("imgSignin").src = '../Images/icon_24x24_SignIn.png';
}
}
}
else{
if (TokenID == null || TokenID == "" || TokenID == undefined) {
var x = localStorage.getItem("RememberMeToken_" + ClientID);
if (x != null && x != undefined) {
if (ClientID == x.split('_')[1]) {
document.getElementById("txtusername").value = x.split('_')[2];
document.getElementById("btnhelp").checked = true;
}
}
else {
document.getElementById("txtusername").value = "";
document.getElementById("btnhelp").checked = false;
}
}
}
}
catch (exception) {
var customMsg = "error in setUserName";
ExceptionLogging(exception, customMsg);
}
}
function GetSamoSiteInformation(samoProduct) {
var SamoRequestObject = '{"connectToolbarRequestObject":' + JSON.stringify(samoProduct) + '}';
var SamoSiteService;
if (window.XMLHttpRequest) {
SamoSiteService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
SamoSiteService = new ActiveXObject("Microsoft.XMLHTTP");
}
SamoSiteService.open('POST', svcToolbar + '/svcToolbar.svc/PaintSamoinformation', true);
SamoSiteService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
SamoSiteService.send(SamoRequestObject);
SamoSiteService.onload = function () {
if (SamoSiteService.readyState == 4) {
if (SamoSiteService.status == 200) {
var eventargs = JSON.parse(SamoSiteService.responseText)
if (eventargs.PaintSamoinformationResult.RData != null) {
if (eventargs.PaintSamoinformationResult.RData.count > 0) {
$("#divSamoDropdown").empty();
if (eventargs.PaintSamoinformationResult.RData.count == 1) {
for (i = 0; i < eventargs.PaintSamoinformationResult.RData.count; i++) {
HomeUrl = eventargs.PaintSamoinformationResult.RData.data[i].SiteUrl;
$("#divSamoDropdown").append("");
}
}
else if (eventargs.PaintSamoinformationResult.RData.count > 1) {
if (window.frameElement != null) {
$("#divSamoDropdown").append("
");
$("#divSamoSiteList1").append(" ");
for (i = 0; i < eventargs.PaintSamoinformationResult.RData.count; i++) {
$("#SamoDropDown1").append("" + eventargs.PaintSamoinformationResult.RData.data[i].ProductName + " ");
}
}
else {
// $("#divSamoDropdown").append("Select a Site ");
$("#divSamoDropdown").append("
");
$("#divSamoDropdown").append("
");
$("#divSamoDropdown").append("
");
$("#divSamoSiteList").append("");
HomeUrl = eventargs.PaintSamoinformationResult.RData.data[0].SiteUrl;
for (i = 0; i < eventargs.PaintSamoinformationResult.RData.count; i++) {
$("#divSamoDropdown").css("display", "inline-block");
if (i == 0) {
$("#divDefautSite").append("");
}
$("#SamoDropDown").append("" + eventargs.PaintSamoinformationResult.RData.data[i].ProductName + " ");
}
}
}
}
else {
$("#divSisDropdown").css("display", "none");
}
}
else {
$("#divSisDropdown").css("display", "none");
}
}
}
else {
var customMsg = "error in GetSamoSiteInformation";
ExceptionLogging(SamoSiteService.responseText, customMsg);
}
};
}
///Created by : Haritha
/// Purpose :
function GetSchoolInformation() {
var SchoolService;
if (window.XMLHttpRequest) {
SchoolService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
SchoolService = new ActiveXObject("Microsoft.XMLHTTP");
}
SchoolService.open('POST', svcToolbar + '/svcToolbar.svc/PaintSisinformation', true);
SchoolService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
SchoolService.send(SisRequestObject);
SchoolService.onload = function () {
if (SchoolService.readyState == 4) {
if (SchoolService.status == 200) {
var eventargs = JSON.parse(SchoolService.responseText);
$("#divSisDropdown").empty();
if (window.frameElement != null) {
$("#divSisDropdown").append("
");
$("#divSchoolSelect").append("schools ");
if (eventargs.PaintSisinformationResult.RData != null) {
if (eventargs.PaintSisinformationResult.RData.count > 0) {
for (i = 0; i < eventargs.PaintSisinformationResult.RData.count; i++) {
$("#divSisDropdown").css("display", "block");
//$("#SisDropDown").append("" + eventargs.PaintSisinformationResult.RData.data[i].ProductName + " ");
$("#divSchoolList1").append("" + eventargs.PaintSisinformationResult.RData.data[i].ProductName + " ");
}
}
else {
$("#divSisDropdown").css("display", "none");
}
}
else {
$("#divSisDropdown").css("display", "none");
}
}
else {
$("#divSisDropdown").append("Schools
");
$("#divSisDropdown").append("
");
$("#divSchoolList").append("");
if (eventargs.PaintSisinformationResult.RData != null) {
if (eventargs.PaintSisinformationResult.RData.count > 0) {
for (i = 0; i < eventargs.PaintSisinformationResult.RData.count; i++) {
$("#divSisDropdown").css("display", "block");
//$("#SisDropDown").append("" + eventargs.PaintSisinformationResult.RData.data[i].ProductName + " ");
//$("#SisDropDown").append("" + eventargs.PaintSisinformationResult.RData.data[i].ProductName + " ");
$("#SisDropDown").append("" + eventargs.PaintSisinformationResult.RData.data[i].ProductName + " ");
}
}
else {
$("#divSisDropdown").css("display", "none");
}
}
else {
$("#divSisDropdown").css("display", "none");
}
}
// $("#divSisDropdown").append("Select a School ");
}
}
else {
var customMsg = "error in GetSchoolInformation";
ExceptionLogging(SchoolService.responseText, customMsg);
}
};
}
function showSchools() {
if (document.getElementById("divSchoolList").style.display == "none") {
$("#divSchoolList").css("display", "block");
}
else if (document.getElementById("divSchoolList").style.display == "block") {
$("#divSchoolList").css("display", "none");
}
}
function ShowSamoDropdown() {
if (document.getElementById("divSamoSiteList").style.display == "none") {
$("#divSamoSiteList").css("display", "block");
}
else if (document.getElementById("divSamoSiteList").style.display == "block") {
$("#divSamoSiteList").css("display", "none");
}
}
function SchoolDropDownChange() {
NodeClick($("#divSchoolList1").val());
}
function SamoDropDownChange() {
NodeClick($("#SamoDropDown1").val());
}
function homeButtonClick() {
NodeClick(HomeUrl);
}
///Created by : Haritha
/// Purpose :
function NodeClick(args) {
try {
isBackPressed = false;
if (window.location.href.indexOf(args) > 0)
return;
his_Array.push(app_Object);
sessionStorage["history_array"] = JSON.stringify(his_Array);
isHistoryRedirect = true;
if (args.indexOf('http://') > -1) {
if (TokenID != null) {
window.parent.location.href = args + "?TokenID=" + TokenID + "&UniqueID=" + UniqueID + isredirectquerystring;
//window.parent.location.href = args + "?TokenID=" + TokenID + "&UniqueID=" + UniqueID;
}
else {
window.parent.location.href = args;
}
}
else {
if (TokenID != null) {
window.parent.location.href = 'http://' + args + "?TokenID=" + TokenID + "&UniqueID=" + UniqueID + isredirectquerystring;
// window.parent.location.href = 'http://' + args + "?TokenID=" + TokenID + "&UniqueID=" + UniqueID;
}
else {
window.parent.location.href = 'http://' + args;
}
}
}
catch (exception) {
var customMsg = "error in NodeClick";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose : showing login area on Sign in
function ShowLoginInfo() {
try {
if (IsCommonLogin == 0)
window.parent.location.href = SecureSiteURL;
else {
if (document.getElementById("divLogin").style.display == "none") {
$('#divLogin').css("display", "inline");
$("#txtusername").focus();
}
else if (document.getElementById("divLogin").style.display == "inline") {
$('#divLogin').css("display", "none");
}
if ($("#ClientMappings").hasClass("expandheight")) {
$("#ClientMappings").removeClass("expandheight");
$("#iddropdownplus").addClass("hidden-phone");
}
if (TokenID == null || TokenID == "" || TokenID == undefined) {
var x = localStorage.getItem("RememberMeToken_" + ClientID);
if (x != null && x != undefined) {
if (ClientID == x.split('_')[1]) {
document.getElementById("txtusername").value = x.split('_')[2];
document.getElementById("btnhelp").checked = true;
}
}
else {
document.getElementById("txtusername").value = "";
document.getElementById("btnhelp").checked = false;
}
}
}
}
catch (exception) {
var customMsg = "error in ShowLoginInfo";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose : Calling method which perform Authentication request
function AuthenticateUser() {
try {
if (ValidateUserData()) {
GetuserData();
AuthData = '{"authenticationRequestObject":' + JSON.stringify(userData) + '}';
GetUserInformation();
}
}
catch (exception) {
var customMsg = "error in AuthenticateUser";
ExceptionLogging(exception, customMsg);
}
}
function ValidateUserData() {
if (document.getElementById("txtusername").value == "") {
$('#lblError').css("display", "inline-block");
document.getElementById("lblError").innerHTML = ResourceFileHandler.get_ResourceValueV3("CT00000MAINPI0005", { et: 'Framework', ec: 'CT' });;
$("#txtusername").focus();
return false;
}
if (document.getElementById("txtpassword").value == "") {
$('#lblError').css("display", "inline-block");
document.getElementById("lblError").innerHTML = ResourceFileHandler.get_ResourceValueV3("CT00000MAINPI0004", { et: 'Framework', ec: 'CT' });;
$("#txtpassword").focus();
return false;
}
return true;
}
///Created by : Haritha
/// Purpose : Binding user information required to perform Authentication
function GetuserData() {
try {
userData.UserName = document.getElementById("txtusername").value.trim();
userData.Password = document.getElementById("txtpassword").value.trim();
userData.ClientID = clientData.IPClientID;
userData.SamoClientID = ConnectToolbarData.Multitenancy.SamoClientID;
userData.RemoteHostInformationXml = remoteHostInformationXml;
userData.PreLogintoken = sessionStorage.MultitenancyTokenID;
}
catch (exception) {
var customMsg = "error in GetuserData";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose : Ajax call to Authenticate the User
function GetUserInformation() {
document.getElementById("btnSignIn").style.display = "none";
document.getElementById("txtusername").disabled = "disabled";
document.getElementById("txtpassword").disabled = "disabled";
document.getElementById("btncreateParent").disabled = "disabled";
document.getElementById("btnhelp").disabled = "disabled";
document.getElementById("rememberme").disabled = "disabled";
document.getElementById("loaddiv").style.display = "inline-block";
var UserInfoService;
if (window.XMLHttpRequest) {
UserInfoService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
UserInfoService = new ActiveXObject("Microsoft.XMLHTTP");
}
UserInfoService.open('POST', svcIPAuthentication + '/svcIPAuthentication.svc/GetUserInformation', true);
UserInfoService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
UserInfoService.send(AuthData);
UserInfoService.onload = function () {
if (UserInfoService.readyState == 4) {
if (UserInfoService.status == 200) {
document.getElementById("btnSignIn").style.display = "Inline-block";
document.getElementById("loaddiv").style.display = "none";
var msg = JSON.parse(UserInfoService.responseText)
LoginSuccess(msg);
}
else {
document.getElementById("btnSignIn").style.display = "Inline-block";
document.getElementById("loaddiv").style.display = "none";
}
document.getElementById("txtusername").disabled = false;
document.getElementById("txtpassword").disabled = false;
document.getElementById("btncreateParent").disabled = false;
document.getElementById("btnhelp").disabled = false;
document.getElementById("rememberme").disabled = false;
}
else {
document.getElementById("btnSignIn").style.display = "Inline-block";
document.getElementById("loaddiv").style.display = "none";
document.getElementById("txtusername").disabled = false;
document.getElementById("txtpassword").disabled = false;
document.getElementById("btncreateParent").disabled = false;
document.getElementById("btnhelp").disabled = false;
document.getElementById("rememberme").disabled = false;
var customMsg = "error in GetUserInformation";
ExceptionLogging(UserInfoService.responseText, customMsg);
}
};
}
///Created by : Haritha
/// Purpose : Onsucess method of Authentication Service, Cretaing Object, repainting the toolbar, painting User information
function LoginSuccess(msg) {
try {
if (msg.GetUserInformationResult.RData != null) {
if (msg.GetUserInformationResult.RData.TokenID != null || msg.GetUserInformationResult.RData.TokenID != "") {
if (navigator.cookieEnabled) {
sessionStorage.TokenID = msg.GetUserInformationResult.RData.TokenID;
}
var TokenRegID = new RegExp("^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$");
if (TokenRegID.test(msg.GetUserInformationResult.RData.TokenID)) {
ConfiguringUserPermissions(msg.GetUserInformationResult.RData.UserfeaturesXml);
$("#productContainer").empty();
$("#LogoContainer").empty();
$("#logoimagecontainer").empty();
$("#divSisDropdown").empty();
TokenID = msg.GetUserInformationResult.RData.TokenID;
Remeberme();
UserInformation = msg.GetUserInformationResult.RData.UserInformation;
AuthenticatedUserObject.UserInformation = fetchXML(UserInformation);
GetAuthenticatedInformation();
if (ConnectToolbarData.Multitenancy.ConnectUrl != "" && ConnectToolbarData.Multitenancy.ConnectUrl != null) {
UniqueID = ConnectToolbarData.UserInformation.UniqueID;
if (ConnectToolbarData.Multitenancy.ConnectUrl.replace("http://", "").toLowerCase() != typedUrl.replace("http://", "").split('/')[0].toLowerCase()) {
if (ConnectToolbarData.UserInformation.IsFirstLogin == "true") {
ShowMyProfile();
}
else {
if (typeof firstLogin == 'function') {
app_Object.isMainEntry = true;
isAppAppended = true;
window.location.hash = "?App";
app_Object.count = 1;
firstLogin();
}
if (typeof OnAuthenticate == 'function') {
app_Object.isMainEntry = true;
isAppAppended = true;
window.location.hash = "?App";
app_Object.count = 1;
OnAuthenticate();
}
PaintUserInformation(UserInformation);
// GetToolBarInformation();
setUserName(ToolbarInformation);
if (TokenID != null)
$("#uploadNotificationIcon").show();
$('#divLogin').css("display", "none");
$('#divSignIN').css("display", "none");
$('#lblError').css("display", "none");
}
}
else {
if (typeof firstLogin == 'function') {
app_Object.isMainEntry = true;
isAppAppended = true;
window.location.hash = "?App";
app_Object.count = 1;
firstLogin();
}
if (typeof OnAuthenticate == 'function') {
OnAuthenticate();
}
isAppAppended = true;
window.location.hash = "?App";
app_Object.isMainEntry = true;
app_Object.count = 1;
PaintUserInformation(UserInformation);
// GetToolBarInformation();
setUserName(ToolbarInformation);
if (TokenID != null)
$("#uploadNotificationIcon").show();
$('#divLogin').css("display", "none");
$('#divSignIN').css("display", "none");
$('#lblError').css("display", "none");
}
}
else {
if (typeof firstLogin == 'function') {
isAppAppended = true;
window.location.hash = "?App";
app_Object.isMainEntry = true;
app_Object.count = 1;
firstLogin();
}
if (typeof OnAuthenticate == 'function') {
isAppAppended = true;
window.location.hash = "?App";
app_Object.isMainEntry = true;
app_Object.count = 1;
OnAuthenticate();
}
PaintUserInformation(UserInformation);
// GetToolBarInformation();
setUserName(ToolbarInformation);
if (TokenID != null)
$("#uploadNotificationIcon").show();
$('#divLogin').css("display", "none");
$('#divSignIN').css("display", "none");
$('#lblError').css("display", "none");
}
}
else {
if (msg.GetUserInformationResult.RCode == "CT00000MAINPL0001") {
var resourceText = "There was Error Loading your settings .Please Contact your Administrator";
// var resourceText = ResourceFileHandler.get_ResourceValueV3(msg.GetUserInformationResult.RCode, { et: 'Framework', ec: 'CT' });
if (typeof showErrorForCT == 'function') {
showErrorForCT(resourceText);
}
}
else {
if (navigator.cookieEnabled) {
sessionStorage.removeItem("TokenID");
sessionStorage.removeItem("history_array");
}
TokenID = null;
$('#lblError').css("display", "inline-block");
document.getElementById("lblError") = "Invalid username and password";
// document.getElementById("lblError").innerHTML = ResourceFileHandler.get_ResourceValueV3("CT00000MAINPE0001", { et: 'Framework', ec: 'CT' });
document.getElementById("txtusername").value = "";
document.getElementById("txtpassword").value = "";
$("#txtusername").focus();
}
}
}
}
else {
if (msg.GetUserInformationResult.RCode == "CT00000MAINPL0001") {
var resourceText = "There was Error Loading your settings .Please Contact your Administrator";
// var resourceText = ResourceFileHandler.get_ResourceValueV3(msg.GetUserInformationResult.RCode, { et: 'Framework', ec: 'CT' });
if (typeof showErrorForCT == 'function') {
showErrorForCT(resourceText);
}
}
else {
if (navigator.cookieEnabled) {
sessionStorage.removeItem("TokenID");
sessionStorage.removeItem("history_array");
}
TokenID = null;
$('#lblError').css("display", "inline-block");
document.getElementById("lblError").innerHTML = "Invalid username and password";
// document.getElementById("lblError").innerHTML = ResourceFileHandler.get_ResourceValueV3("CT00000MAINPE0001", { et: 'Framework', ec: 'CT' });
document.getElementById("txtusername").value = "";
document.getElementById("txtpassword").value = "";
$("#txtusername").focus();
}
}
}
catch (exception) {
var customMsg = "error in LoginSuccess";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose : Onsucess Method to paint the user information
function PaintUserInformation(UserXml) {
try {
// AuthenticatedUserInformation = jQuery.parseXML(UserXml);
AuthenticatedUserInformation = fetchXML(UserXml);
$(AuthenticatedUserInformation).find('UserInfo').each(function () {
$("#displayName").html($(this).attr("DisplayName"));
if ($(this).attr("UserPhoto") != "" && $(this).attr("UserPhoto") != null) {
// document.getElementById("imgUser").src = $(this).attr("UserPhoto");
$(".userdetails_image").css('background-image', 'url(' + $(this).attr("UserPhoto") + ')');
}
UniqueID = $(this).attr("uniqueID");
$("#UserInformationDiv").css("display", "block");
});
}
catch (exception) {
var customMsg = "error in PaintUserInformation";
ExceptionLogging(exception, customMsg);
}
}
///Created by : Haritha
/// Purpose : setting tokenID as null and Updating Logout session in database while painting the toolbar again
function LogoutUser() {
try {
var isLogOutConfirmed;
if (typeof OnLogoutInitiated == 'function') {
isLogOutConfirmed = OnLogoutInitiated();
if (isLogOutConfirmed) {
// document.getElementById("imgUser").src = "";
$(".userdetails_image").css('background-image', '');
UpdateLoginToken();
}
else {
isAppAppended = true;
window.location.hash = "?App";
}
}
else {
$(".userdetails_image").css('background-image', '');
//document.getElementById("imgUser").src = "";
UpdateLoginToken();
}
}
catch (exception) {
var customMsg = "error in LogoutUser";
ExceptionLogging(exception, customMsg);
}
}
function ForceLogout() {
$(".userdetails_image").css('background-image', '');
UpdateLoginToken();
}
///Created by : Haritha
/// Purpose : on Logout it will call a service to update the Logout status in database
function UpdateLoginToken() {
clientData.TokenID = TokenID;
clientData.UniqueID = UniqueID;
clientData.ClientID = ConnectToolbarData.Multitenancy.ClientID;
AuthData = '{"authenticationRequestObject":' + JSON.stringify(clientData) + '}';
var UpdateLoginTokenService;
if (window.XMLHttpRequest) {
UpdateLoginTokenService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
UpdateLoginTokenService = new ActiveXObject("Microsoft.XMLHTTP");
}
UpdateLoginTokenService.open('POST', svcIPAuthentication + '/svcIPAuthentication.svc/LogoutUser', true);
UpdateLoginTokenService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
UpdateLoginTokenService.send(AuthData);
UpdateLoginTokenService.onload = function () {
if (UpdateLoginTokenService.readyState == 4) {
if (UpdateLoginTokenService.status == 200) {
var msg = JSON.parse(UpdateLoginTokenService.responseText)
if (msg.LogoutUserResult.RData) {
TokenID = null;
if (navigator.cookieEnabled) {
app_Object.count = 0;
sessionStorage.removeItem("Multitenancy");
sessionStorage.removeItem("TokenID");
sessionStorage.removeItem("history_array");
}
document.getElementById("imgUser").src = "";
$("#productContainer").empty();
$("#LogoContainer").empty();
$("#logoimagecontainer").empty();
$("#divSisDropdown").empty();
UserFeatures.hasDMS = "true";
UserFeatures.hasPP = "true";
UserFeatures.hasZL = "true";
setUserName(ToolbarInformation);
GetAuthenticatedInformation();
$('#divLogin').css("display", "none");
$('#divSignIN').css("display", "block");
$("#UserInformationDiv").css("display", "none");
//document.getElementById("txtusername").value = "";
//document.getElementById("txtpassword").value = "";
if (TokenID == null) {
$("#uploadNotificationIcon").hide();
$(" #uploadNtificationCount").hide();
} if (typeof OnLogoutComplete == 'function') {
OnLogoutComplete();
}
else {
NodeClick(url.split('?')[0]);
}
}
}
}
else {
var customMsg = "error in UpdateLoginToken";
ExceptionLogging(UpdateLoginTokenService.responseText, customMsg);
}
};
}
///Created by : Haritha
/// Purpose : Building multitenancy Object and UserInformation Object along with TokenID
function GetAuthenticatedInformation() {
try {
ConnectToolbarData.TokenID = TokenID;
bindRemoteHostInformation();
if ($(AuthenticatedUserObject).length > 0) {
ConnectToolbarData.Multitenancy.Xml = AuthenticatedUserObject.UserMultitenacyXml;
ConnectToolbarData.Multitenancy.MultitenancyTokenID = AuthenticatedUserObject.MultitenancyTokenID;
ConnectToolbarData.Multitenancy.ZLClientDirectUIFiles = $(AuthenticatedUserObject.UserMultitenacyXml).find('CDN').attr('zldirectclientuifiles')//$(this).attr("ZLClientDirectUIFiles");
ConnectToolbarData.Multitenancy.CPClientDirectUIFiles = $(AuthenticatedUserObject.UserMultitenacyXml).find('CDN').attr('cpdirectclientuifiles'); //$(this).attr("ZLClientDirectUIFiles");
$(AuthenticatedUserObject.UserMultitenacyXml).find('Client').each(function () {
ConnectToolbarData.Multitenancy.ClientID = $(this).attr("ID");
ConnectToolbarData.Multitenancy.CopyrightText = $(this).attr("CopyrightText");
ConnectToolbarData.Multitenancy.CompanyID = $(this).find('Company').attr('ID');
ConnectToolbarData.Multitenancy.VerticalID = $(this).find('Vertical').attr('ID');
ConnectToolbarData.Multitenancy.MarketID = $(this).find('Market').attr('ID');
ConnectToolbarData.Multitenancy.ClientLogo = $(this).find('Logo').attr('URL');
ConnectToolbarData.Multitenancy.VerticalLogo = $(this).find('Vertical').attr('Logo');
ConnectToolbarData.Multitenancy.ClientFolder = $(this).attr('ClientFolder');
ConnectToolbarData.Multitenancy.UploadToClientSpecificFolder = $(this).attr("UploadToClientSpecificFolder");
ConnectToolbarData.Multitenancy.DomainName = $(this).attr("DomainName");
});
var clientInstitutions = [];
$(AuthenticatedUserObject.UserMultitenacyXml).find('Institutions').each(function () {
if ($(this).find('Institution').length > 0) {
$(this).find('Institution').each(function () {
clientInstitutions.push($(this).attr('ID'));
});
}
});
ConnectToolbarData.Multitenancy.Institutions = clientInstitutions;
$(AuthenticatedUserObject.UserMultitenacyXml).find('Site').each(function () {
ConnectToolbarData.Multitenancy.SiteID = $(this).attr("ID");
ConnectToolbarData.Multitenancy.SiteLevelID = $(this).find('SiteLevel').attr('ID');
});
$(AuthenticatedUserObject.UserInformation).find('UserInfo').each(function () {
ConnectToolbarData.UserInformation.UserID = $(this).attr("userID");
ConnectToolbarData.UserInformation.UniqueID = $(this).attr("uniqueID");
ConnectToolbarData.UserInformation.Title = $(this).attr("Title");
ConnectToolbarData.UserInformation.FirstName = $(this).attr("FirstName");
ConnectToolbarData.UserInformation.LastName = $(this).attr("LastName");
ConnectToolbarData.UserInformation.DisplayName = $(this).attr("DisplayName");
ConnectToolbarData.UserInformation.Gender = $(this).attr("Gender");
ConnectToolbarData.UserInformation.Phone1 = $(this).attr("Phone1");
ConnectToolbarData.UserInformation.EmailID1 = $(this).attr("EmailID1");
ConnectToolbarData.UserInformation.Designation = $(this).attr("Designation");
ConnectToolbarData.UserInformation.IsFirstLogin = $(this).attr("loginStatus");
ConnectToolbarData.UserInformation.ProfileState = $(this).attr("ProfileState");
ConnectToolbarData.UserInformation.UserUniqueNumberAtsource = $(this).attr("userUniqueNumberAtsource");
var DefaultuserphotoSrc = $(".userdetails_image").css('background-image');
if ($(this).attr("UserPhoto") != null && $(this).attr("UserPhoto") != undefined && $(this).attr("UserPhoto") != "") {
ConnectToolbarData.UserInformation.UserPhoto = $(this).attr("UserPhoto");
}
else {
if (navigator.userAgent.indexOf("Trident") > 0 || navigator.userAgent.indexOf("Firefox") > 1) {
ConnectToolbarData.UserInformation.UserPhoto = "http://" + $(".userdetails_image").css('background-image').slice(4, DefaultuserphotoSrc.length - 2).split("//")[1];
}
else {
ConnectToolbarData.UserInformation.UserPhoto = "http://" + $(".userdetails_image").css('background-image').slice(4, -1).split("//")[1];
}
}
if (navigator.userAgent.indexOf("Trident") > 0 || navigator.userAgent.indexOf("Firefox") > 1) {
ConnectToolbarData.UserInformation.DefaultUserPhoto = "http://" + $(".userdetails_image").css('background-image').slice(4, DefaultuserphotoSrc.length - 2).split("//")[1];
}
else {
ConnectToolbarData.UserInformation.DefaultUserPhoto = "http://" + $(".userdetails_image").css('background-image').slice(4, -1).split("//")[1];
}
var UserTypeIds = [];
if ($(this).find('UserType').length > 0) {
var clientusertype = [];
var marketusertype = [];
$(this).find('UserType').each(function () {
clientusertype.push($(this).attr('ClientUserType'));
});
$(this).find('UserType').each(function () {
marketusertype.push($(this).attr('MarketUserTypeCode'));
UserTypeIds.push({ ClientuserTypeID: $(this).attr('ClientUserTypeID'), MarketUserTypeID: $(this).attr('MarketUserTypeID'), MarketUserTypeCode: $(this).attr('MarketUserTypeCode') });
});
}
ConnectToolbarData.UserInformation.UserTypeIDs = UserTypeIds;
ConnectToolbarData.UserInformation.ClientUserType = clientusertype;
ConnectToolbarData.UserInformation.MarketUserType = marketusertype;
var userSchools = [];
if ($(this).find('UserSchool').length > 0) {
$(this).find('UserSchool').each(function () {
userSchools.push({ schoolID: $(this).attr('SchoolID'), institutionID: $(this).attr('InstitutionID') });
});
}
ConnectToolbarData.UserInformation.SchoolID = userSchools;
ConnectToolbarData.UserInformation.InstitutionID = $(this).find('UserSchool').attr('InstitutionID');
ConnectToolbarData.UserInformation.AuthenticationSourceType = $(this).attr('AuthenticationSourceType');
if (profileClicked) {
ConnectToolbarData.UserInformation.ShowMyprofile = "true";
}
ConnectToolbarData.UserInformation.IsGmailIntegrated = "0";
$(this).find('GmailInformation').each(function () {
ConnectToolbarData.UserInformation.IsGmailIntegrated = $(this).attr('isGmailIntegrated');
ConnectToolbarData.UserInformation.AccessTokenID = $(this).attr('AccessTokenID');
ConnectToolbarData.UserInformation.GmailIntegratedEmailID = $(this).attr('EmailID');
});
});
$(AuthenticatedUserObject.UserMultitenacyXml).find('ClientMappings').each(function () {
ConnectToolbarData.Multitenancy.SamoClientID = $(this).attr('SamoClientID');
ConnectToolbarData.Multitenancy.ConnectUrl = $(this).attr('ConnectUrl');
ConnectToolbarData.Multitenancy.IsConnectEnabled = $(this).attr('IsConnectEnabled');
ConnectToolbarData.Multitenancy.TypedUrl = Turl.split('?')[0];
});
}
if (typeof $(".userdetails_image").css('background-image') !== "undefined") {
if (navigator.userAgent.indexOf("Trident") > 0 || navigator.userAgent.indexOf("Firefox") > 1) {
var DefaultuserphotoSrc = $(".userdetails_image").css('background-image');
ConnectToolbarData.DefaultUserPhoto = "http://" + $(".userdetails_image").css('background-image').slice(4, DefaultuserphotoSrc.length - 2).split("//")[1];
}
else {
ConnectToolbarData.DefaultUserPhoto = "http://" + $(".userdetails_image").css('background-image').slice(4, -1).split("//")[1];
}
}
if (typeof InitFrameWork == 'function') {
InitFrameWork();
}
}
catch (exception) {
var customMsg = "error in GetAuthenticatedInformation";
ExceptionLogging(exception, customMsg);
}
}
function bindRemoteHostInformation() {
try {
var nAgt = navigator.userAgent;
var BrowserName = navigator.appName;
var FullVersion = '' + parseFloat(navigator.appVersion);
var MajorVersion = parseInt(navigator.appVersion, 10);
var nameOffset, verOffset, ix;
if ((verOffset = nAgt.indexOf("OPR")) != -1) {
BrowserName = "Opera";
FullVersion = nAgt.substring(verOffset + 4);
if ((verOffset = nAgt.indexOf("Version")) != -1)
FullVersion = nAgt.substring(verOffset + 8);
}
else if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
BrowserName = "Microsoft Internet Explorer";
FullVersion = nAgt.substring(verOffset + 5);
}
else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
BrowserName = "Chrome";
FullVersion = nAgt.substring(verOffset + 7);
}
else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
BrowserName = "Safari";
FullVersion = nAgt.substring(verOffset + 7);
if ((verOffset = nAgt.indexOf("Version")) != -1)
FullVersion = nAgt.substring(verOffset + 8);
}
else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
BrowserName = "Firefox";
FullVersion = nAgt.substring(verOffset + 8);
}
else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
BrowserName = nAgt.substring(nameOffset, verOffset);
FullVersion = nAgt.substring(verOffset + 1);
if (BrowserName.toLowerCase() == BrowserName.toUpperCase()) {
BrowserName = navigator.appName;
}
}
if ((ix = FullVersion.indexOf(";")) != -1)
FullVersion = FullVersion.substring(0, ix);
if ((ix = FullVersion.indexOf(" ")) != -1)
FullVersion = FullVersion.substring(0, ix);
MajorVersion = parseInt('' + FullVersion, 10);
if (isNaN(MajorVersion)) {
FullVersion = '' + parseFloat(navigator.appVersion);
MajorVersion = parseInt(navigator.appVersion, 10);
}
var os = null;
// var clientStrings = [{ name: 'Windows', pattern: /(Windows|Win)/ },
// { name: 'Android', pattern: /Android/ },
// { name: 'Linux', pattern: /(Linux|X11)/ },
// { name: 'iOS', pattern: /(iPhone|iPad|iPod)/ },
// { name: 'UNIX', pattern: /UNIX/ },
// ];
var OSStrings = [{ name: "Windows 3.11", pattern: /(Win16)/ },
{ name: "Windows 95", pattern: /(Windows 95)|(Win95)|(Windows_95)/ },
{ name: "Windows 98", pattern: /(Windows 98)|(Win98)/ },
{ name: "Windows 2000", pattern: /(Windows NT 5.0)|(Windows 2000)/ },
{ name: "Windows XP", pattern: /(Windows NT 5.1)|(Windows XP)/ },
{ name: "Windows Server 2003", pattern: /(Windows NT 5.2)/ },
{ name: "Windows Vista", pattern: /(Windows NT 6.0)/ },
{ name: "Windows 7", pattern: /(Windows NT 6.1)/ },
{ name: "Windows 8", pattern: /(Windows NT 6.2)/ },
{ name: "Windows NT 4.0", pattern: /(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)/ },
{ name: "Windows ME", pattern: /(Windows ME)/ },
{ name: 'Android', pattern: /Android/ },
{ name: 'Linux', pattern: /(Linux|X11)/ },
{ name: 'iOS', pattern: /(iPhone|iPad|iPod)/ },
{ name: 'UNIX', pattern: /UNIX/ },
{ name: 'Mac',pattern:/(Mac OS X)/ },
];
for (var id in OSStrings) {
var cs = OSStrings[id];
if (cs.pattern.test(nAgt)) {
os = cs.name;
break;
}
}
var osVersion = null;
if (/Windows/.test(os)) {
osVersion = /Windows (.*)/.exec(os)[1];
}
switch (os) {
case 'Mac OS X':
osVersion = /Mac OS X (10[\.\_\d]+)/.exec(nAgt)[1];
break;
case 'Android':
osVersion = /Android ([\.\_\d]+)/.exec(nAgt)[1];
break;
case 'iOS':
osVersion = /OS (\d+)_(\d+)_?(\d+)?/.exec(navigator.appVersion);
osVersion = osVersion[1] + '.' + osVersion[2] + '.' + (osVersion[3] | 0);
break;
}
if (os == null) {
os = "Device";
}
if (osVersion == null) {
osVersion = "0.0";
}
var offset = new Date().getTimezoneOffset()
offset = "UTC" + ((offset < 0 ? '+' : '-') +
timeZoneSplit(parseInt(Math.abs(offset / 60)), 2) +
timeZoneSplit(Math.abs(offset % 60), 2))
ConnectToolbarData.RemoteHostInformation.BroswerName = BrowserName;
ConnectToolbarData.RemoteHostInformation.BrowserVersion = FullVersion;
ConnectToolbarData.RemoteHostInformation.OS = os;
ConnectToolbarData.RemoteHostInformation.OSVersion = osVersion;
ConnectToolbarData.RemoteHostInformation.TimeZone = offset;
ConnectToolbarData.RemoteHostInformation.TimeZoneName = GetTimezoneName();
ConnectToolbarData.RemoteHostInformation.IPAddress = ipAddress;
ConnectToolbarData.RemoteHostInformation.MacAddress = macIpAddress;
if (ipAddress == undefined) {
remoteHostInformationXml = " ";
}
else {
remoteHostInformationXml = " ";
}
}
catch (exception) {
var customMsg = "error in bindRemoteHostInformation";
ExceptionLogging(exception, customMsg);
}
}
function GetTimezoneName() {
var timeSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));
var summerOffset = -1 * timeSummer.getTimezoneOffset();
var timeWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));
var winterOffset = -1 * timeWinter.getTimezoneOffset();
var timeZoneHiddenField;
if (-720 == summerOffset && -720 == winterOffset) { timeZoneHiddenField = 'Dateline Standard Time'; }
else if (-660 == summerOffset && -660 == winterOffset) { timeZoneHiddenField = 'UTC-11'; }
else if (-420 == summerOffset && -480 == winterOffset) { timeZoneHiddenField = 'Pacific Standard Time'; }
else if (-420 == summerOffset && -420 == winterOffset) { timeZoneHiddenField = 'US Mountain Standard Time'; }
else if (-360 == summerOffset && -420 == winterOffset) { timeZoneHiddenField = 'Mountain Standard Time'; }
else if (-360 == summerOffset && -360 == winterOffset) { timeZoneHiddenField = 'Central America Standard Time'; }
else if (-300 == summerOffset && -360 == winterOffset) { timeZoneHiddenField = 'Central Standard Time'; }
else if (-240 == summerOffset && -300 == winterOffset) { timeZoneHiddenField = 'Eastern Standard Time'; }
else if (-120 == summerOffset && -180 == winterOffset) { timeZoneHiddenField = 'America/Godthab'; }
else if (60 == summerOffset && 0 == winterOffset) { timeZoneHiddenField = 'GMT Standard Time'; }
else if (330 == summerOffset && 330 == winterOffset) { timeZoneHiddenField = 'India Standard Time'; }
else if (660 == summerOffset && 660 == winterOffset) { timeZoneHiddenField = 'West Pacific Standard Time'; }
else if (690 == summerOffset && 690 == winterOffset) { timeZoneHiddenField = 'Central Pacific Standard Time'; }
else { timeZoneHiddenField = 'US/Pacific'; }
return timeZoneHiddenField;
}
function timeZoneSplit(number, length) {
try {
var str = "" + number
while (str.length < length) {
str = '0' + str
}
return str;
}
catch (exception) {
var customMsg = "error in timeZoneSplit";
ExceptionLogging(exception, customMsg);
}
}
function ExceptionLogging(exception, customMessage) {
var data = new parent.UIExceptionModel;
data.Action = "TextAndDataBase";
data.CustomMessage = customMessage;
parent.logException(exception, data);
}
function ConfiguringUserPermissions(args) {
if ($(args).find('userfeatures').attr('PPFeature') == "PP") {
UserFeatures.hasPP = "true";
}
else {
UserFeatures.hasPP = "false";
}
if ($(args).find('userfeatures').attr('DMSFeature') == "DMS") {
UserFeatures.hasDMS = "true";
}
else {
UserFeatures.hasDMS = "false";
}
if ($(args).find('userfeatures').attr('ZLFeature') == "Zipline") {
UserFeatures.hasZL = "true";
}
else {
UserFeatures.hasZL = "false";
}
}
function ShowHelpScreen() {
if ($("#popupdiv").length == 0) {
$("#overlay-back").append("");
}
$('#popupdiv, #overlay-back').show();
showHelpInfo('Teacher');
}
function closeHelpInformation() {
$('#popupdiv, #overlay-back').hide();
}
function showHelpInfo(userType) {
$("#helpinformation").empty();
$("#logininformation").empty();
showHelpInfoService(userType);
if (userType == "Teacher") {
$("#divTeachers").removeClass("disabled");
$("#divParents").addClass("disabled");
$("#divStudents").addClass("disabled");
}
else if (userType == "Student") {
$("#divStudents").removeClass("disabled");
$("#divParents").addClass("disabled");
$("#divTeachers").addClass("disabled");
}
else if (userType == "Parent") {
$("#divParents").removeClass("disabled");
$("#divTeachers").addClass("disabled");
$("#divStudents").addClass("disabled");
}
}
function validateConnectEmail(email)
{
var re = /\S+@\S+\.\S+/;
return re.test(email);
}
function SendEmail(args) {
var emailID = null;
if (args == 'teacher') {
emailID = document.getElementById("helpdefaultEmailID").value;
}
else if (args == 'parent') {
emailID = document.getElementById("helpdefaultEmailID").value;
}
if ((emailID != null) && validateConnectEmail(emailID)) {
var params = '{"clientID":"' + ConnectToolbarData.Multitenancy.ClientID + '","type":"' + args + '","emailID":"' + document.getElementById("helpdefaultEmailID").value + '"}';
var showTeachersInfoService;
if (window.XMLHttpRequest) {
showTeachersInfoService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
showTeachersInfoService = new ActiveXObject("Microsoft.XMLHTTP");
}
showTeachersInfoService.open('POST', svcToolbar + '/svcToolbar.svc/SendEmail', true);
showTeachersInfoService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
showTeachersInfoService.send(params);
showTeachersInfoService.onload = function () {
if (showTeachersInfoService.readyState == 4) {
if (showTeachersInfoService.status == 200) {
var msg = JSON.parse(showTeachersInfoService.responseText)
//if (msg.SendEmailResult.RCode == "ZLMMGUSADEDTV0042") {
// $("#SendEmailResultAlert").remove();
// $("#logininformation").prepend("Please enter a valid Email Address ");
//}
//else if (msg.SendEmailResult.RCode == "ZLMMGUSADEDTL0019") {
$("#SendEmailResultAlert").remove();
$("#logininformation").empty();
$("#logininformation").prepend("Please check your email for a message regarding your user account. Allow 30 minutes for the email to be delivered. If you don’t receive an email within 30 minutes, contact the administrator for your site. ");
// }
}
}
else {
var customMsg = "error in Sending Email";
ExceptionLogging(showTeachersInfoService.responseText, customMsg);
$("#SendEmailResultAlert").remove();
$("#logininformation").prepend("The email cannot be sent at this time. ");
}
}
}
else {
$("#SendEmailResultAlert").remove();
$("#logininformation").prepend("Please enter a valid Email Address ");
}
}
function showHelpInfoService(userType) {
$("#helpinformation").empty();
$("#logininformation").empty();
var params = '{"clientID":"' + ConnectToolbarData.Multitenancy.ClientID + '","userType":"' + userType + '"}';
var showTeachersInfoService;
if (window.XMLHttpRequest) {
showTeachersInfoService = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
showTeachersInfoService = new ActiveXObject("Microsoft.XMLHTTP");
}
showTeachersInfoService.open('POST', svcToolbar + '/svcToolbar.svc/FetchConfigurationMessage', true);
showTeachersInfoService.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
showTeachersInfoService.send(params);
showTeachersInfoService.onload = function () {
if (showTeachersInfoService.readyState == 4) {
if (showTeachersInfoService.status == 200) {
var msg = JSON.parse(showTeachersInfoService.responseText)
if (msg.FetchConfigurationMessageResult.RData != null) {
if (msg.FetchConfigurationMessageResult.RData.count > 0) {
for (var i = 0; i < msg.FetchConfigurationMessageResult.RData.count; i++) {
if (msg.FetchConfigurationMessageResult.RData.data[i].WelcomeText != "" || msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "") {
if (msg.FetchConfigurationMessageResult.RData.data[i].WelcomeText != "")
$("#helpinformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].WelcomeText + "
");
else
$("#helpinformation").append("Staff sign in using the Username and Password created when building out your teacher profile. If this is your first time signing in, please use your email address as the Username and the temporary password sent to your email address.
");
if (msg.FetchConfigurationMessageResult.RData.data[0].ProductName == "IP") {
if (userType == "Teacher") {
if (msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "")
$("#logininformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText + "
");
else
$("#logininformation").append("" + parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0002', { et: 'Framework', ec: 'CT' }) + "
");
}
else if (userType == "Parent") {
if (msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "")
$("#logininformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText + "
");
else
$("#logininformation").append("" + parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0003', { et: 'Framework', ec: 'CT' }) + "
");
}
else {
if (msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "")
$("#logininformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText + "
");
else
$("#logininformation").append("If Students are having trouble signing in, please contect your teacher to have them reset your username and/or password back to its default setting.
");
}
}
else {
if (userType == "Teacher") {
if (msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "")
$("#logininformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText + "
");
else
$("#logininformation").append("Your username and password is administered by a network administrator at your school or district.If you are having problems signing in, please contact your network administrator.
");
}
else if (userType == "Parent") {
if (msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "")
$("#logininformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText + "
");
else
$("#logininformation").append("" + parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0003', { et: 'Framework', ec: 'CT' }) + "
");
}
else {
if (msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText != "")
$("#logininformation").append("" + msg.FetchConfigurationMessageResult.RData.data[i].PasswordPromptText + "
");
else
$("#logininformation").append("Your username and password is administered by a network administrator at your school or district.If you are having problems signing in, please contact your network administrator.
");
}
}
}
else {
if (msg.FetchConfigurationMessageResult.RData.data[0].ProductName != "IP") {
if (userType == "Teacher") {
$("#helpinformation").append("Staff sign in using the Network Credentials assigned to you by your network administrator.This is usually the same Username and Password that you would use to access a computer on the school/district network and/or for access to your district assigned email account.
");
$("#logininformation").append("Your username and password is administered by a network administrator at your school or district.If you are having problems signing in ,please contact your network administrator.
");
}
else if (userType == "Parent") {
$("#helpinformation").append("Staff sign in using the Network Credentials assigned to you by your network administrator.This is usually the same Username and Password that you would use to access a computer on the school/district network and/or for access to your district assigned email account.
");
$("#logininformation").append("Your username and password is administered by a network administrator at your school or district.If you are having problems signing in ,please contact your network administrator.
");
}
else {
$("#helpinformation").append("Students sign in using the Network Credentials assigned to you by your network administrator.This is usually the same Username and Password that you would use to access a computer on the school/district network and/or for access to your district assigned email account.
");
$("#logininformation").append("Your username and password is administered by a network administrator at your school or district.If you are having problems signing in ,please contact your network administrator.
");
}
}
else {
if (userType == "Teacher") {
$("#helpinformation").append("Staff sign in using the Username and Password created when building out your teacher profile. If this is your first time signing in, please use your email address as the Username and the temporary password sent to your email address.
");
$("#logininformation").append("" + parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0002', { et: 'Framework', ec: 'CT' }) + "
");
}
else if (userType == "Parent") {
$("#helpinformation").append("Parents sign in using the Username and Password created when building out your parent profile. If this is your first time signing in, please select 'Create Parent Account' below and enter the parent activation code provided to you by the school or district.
");
$("#logininformation").append("" + parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0003', { et: 'Framework', ec: 'CT' }) + "
");
}
else {
$("#helpinformation").append("Students sign in using the Username and Password created when building out your student profile. If this is your first time signing in: Your Username is (your student #) @ (your district's domain). For example: 12345678@emeraldcityschools.com Your Password is the combination of:2 digit birth month (number), 2 digit birth day (number), First Initial (lowercase), lastInitial (lowercase). For Example:John Doe was born on july 1st: his password would be 0701jd
");
$("#logininformation").append("If Students are having trouble signing in, please contect your teacher to have them reset your username and/or password back to its default setting.
");
}
}
}
}
}
}
else if (msg.FetchConfigurationMessageResult.RData == null) {
$("#helpinformation").append(parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0001', { et: 'Framework', ec: 'CT' }));
$("#logininformation").append(parent.ResourceFileHandler.get_ResourceValueV3('CT00000MAINPI0001', { et: 'Framework', ec: 'CT' }));
}
}
}
else {
var customMsg = "error in showTeachersInfo";
ExceptionLogging(showTeachersInfoService.responseText, customMsg);
}
};
}
function ParentRegistration() {
window.location.href = " http://" + ConnectToolbarData.Multitenancy.ConnectUrl.replace("http://", "") + "/ParentRegistration.aspx";
}
function UpdateUserPhoto(imageUrl) {
ConnectToolbarData.UserInformation.UserPhoto = imageUrl;
$(".userdetails_image").css('background', 'url(' + imageUrl + ') center no-repeat');
$(".userdetails_image").css('background-size', 'cover');
if (typeof MyProfileUpdate == 'function') {
MyProfileUpdate();
}
}
function ShowMyProfile() {
if (ConnectToolbarData.Multitenancy.ConnectUrl.replace("http://", "").toLowerCase() == typedUrl.replace("http://", "").split('/')[0].toLowerCase()) {
if (typeof ViewMyProfile == 'function') {
ViewMyProfile();
}
}
else {
his_Array.push(app_Object);
sessionStorage["history_array"] = JSON.stringify(his_Array);
window.parent.location.href = "http://" + ConnectToolbarData.Multitenancy.ConnectUrl.replace("http://", "") + "/Portal.aspx?TokenID=" + TokenID + "&UniqueID=" + UniqueID + "&MP=Profile" + isredirectquerystring;
}
}
function showhidefeatures(e) {
if (e.classList[0] == "ct_tailbottom") {
if ($("#ClientMappings").hasClass("expandheight")) {
$("#ClientMappings").removeClass("expandheight");
$('#divLogin').css("display", "none");
$("#iddropdownplus").addClass("hidden-phone");
if (typeof ToolbarFrameworkheaderAdjustment == 'function') {
ToolbarFrameworkheaderAdjustment();
}
}
else {
$("#iddropdownplus").removeClass("hidden-phone");
$('#divLogin').css("display", "none");
$("#ClientMappings").addClass("expandheight");
if (typeof ToolbarFrameworkfooterAdjustment == 'function') {
ToolbarFrameworkfooterAdjustment();
}
}
}
}
function fetchXML(userXml) {
var xml, tmp;
if (window.DOMParser) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString(userXml, "text/xml");
} else { // IE
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = "false";
xml.loadXML(userXml);
}
return xml;
}
//method which will be called by the framework to save their history
function update_History(his_Object) {
app_Object.count++;
app_Object.historyObject.push(his_Object);
}
if (document.addEventListener) { // For all major browsers, except IE 8 and earlier
window.addEventListener("beforeunload", function (e) {
if (sessionStorage["TokenID"] !== undefined && sessionStorage["TokenID"] !== null) {
if (typeof page_unload == 'function') {
page_unload();
}
}
if (isHistoryRedirect == false) {
if (isBackPressed != true)
his_Array.push(app_Object);
sessionStorage["history_array"] = JSON.stringify(his_Array);
}
});
} else if (document.attachEvent) {
window.attachEvent("beforeunload", function (e) {
if (sessionStorage["TokenID"] !== undefined && sessionStorage["TokenID"] !== null) {
if (typeof page_unload == 'function') {
page_unload();
}
}
if (isHistoryRedirect == false) {
if (isBackPressed != true)
his_Array.push(app_Object);
sessionStorage["history_array"] = JSON.stringify(his_Array);
}
});
}
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '' || hash === '#?redirect') {
onBackPressed();
}
}
});
}
//this method is triggered when the back is pressed .this is the handler of the onpopstate event.
function onBackPressed() {
if (sessionStorage["TokenID"] !== undefined && sessionStorage["TokenID"] !== null) {
if (app_Object.count > 0) {
app_Object.count--;
isBackPressed = true;
}
if (app_Object.count > 0) {
isAppAppended = true;
window.location.hash = "?App";
if (typeof HandleBack == 'function') {
HandleBack(app_Object.count, app_Object.historyObject.pop());
}
isBackPressed = true;
}
else {
if (app_Object.isMainEntry == true) {
app_Object.count++;
$("#btnConnectLogout").trigger("click");
isBackPressed = false;
}
else {
if (isAppAppended == true)
window.history.back();
}
}
}
}
//this method will return the current history object of the page
// function get_currentUI() {
// if (app_Object.historyObject.length > 0)
// return app_Object.historyObject[app_Object.historyObject.length - 1];
// else
// return "";
// }
/*upload notification code start*/
function binduploadNotificationClick() {
$("#uploadNotificationIcon").unbind("click");
$("#uploadNotificationIcon").click(function () {
$("#uploadNtificationCount").html("").hide();
$("#uploadNotification").children().removeClass("countincluded").addClass("countincluded");
$("#uploadNotificationTop").toggle();
$("#uploadNotification").toggle();
});
}
function updateUploadCount() {
/*code to update the count in notification start*/
if ($("#uploadNotification").children().length > 0) {
var alreadycount = $("#uploadNotification").children(".countincluded").length;
var completeCount = $("#uploadNotification").children().length;
$("#uploadNtificationCount").html(completeCount - alreadycount);
$("#uploadNtificationCount").show();
} /*code to update the count in notification end*/
}
//this method is used to hide the notification popup window
function hideNotificationPopup() {
$("#uploadNotificationTop").hide();
$("#uploadNotification").hide();
}
//this method is used to show the notification popup window
function showNotificationpopUp() {
$("#uploadNotificationTop").show();
$("#uploadNotification").show();
}
/*upload notification code end*/
$(window).click(function (e) {
if (e.target.getAttribute("href") == "#" || $(e.target).parent().attr("href") == "#")
e.preventDefault();
});
function Remeberme() {
if (document.getElementById("btnhelp").checked) {
if (TokenID != null) {
if (document.getElementById("txtusername").value != "" && (document.getElementById("txtpassword").value != "")) {
localStorage.setItem("RememberMeToken_" + ClientID, TokenID + "_" + ClientID + "_" + document.getElementById("txtusername").value);
}
}
}
else {
localStorage.removeItem("RememberMeToken_" + ClientID);
document.getElementById("txtusername").value = "";
}
}
function a11yClick(event){
if(event.type === 'click'){
return true;
}
else if(event.type === 'keypress'){
var code = event.charCode || event.keyCode;
if((code === 32)|| (code === 13)){
return true;
}
}
else{
return false;
}
}