var giVersion = 2;
var giShowSpeed = 0;
var giShowSpeedOptions = 0;
var giHideSpeed = 0;
var giHideSpeedOptions = 0;
var giWaitForStop = 400;
var giMessagingTimerID = 0;
var gbLogonStayOnDocument = true;
var gbSetupViewport = false;
var gbSetFocus = true;
var gbRichEdit = true;
var giKeyPressTimeoutId = 0;
var gbInputDetected = false;
var gbUnloadWarning = false;
var gbSystemAdmin = false;
var gsSetupMethod = '';
var gsSetupName = '';
var giSetupContext = -1;
var goSetupContextXML;
var giOnDemandTimer;
var giObject = -1;
var gsObjectName = '';
var giObjectContext = -1;
var goObjectContextXML;
var goObjectContextJSON;
var gsObjectContextLastSearch = '';
var giObjectSaveId = -1;
var gbOkToSave = true;
var goObjectContext;
var giEditorCounter = 0;
var gsViewportMasterControlXHTML = '';
var gsHomeXHTML = '';
var gsHomeViewportXHTML = '';
var gsUserName = '';
var gsUserEmail = '';
var gsUserNetworkGroups = '';
var gsViewportMasterActionXHTML = '';
var gaReturn = [];
var giUserID = -1;
var giUserContactPersonID = -1;
var gbSetupShow = false;
var giHelpOption = -1;
var giSearchSource_TEXT_INPUT = 1;
var giSearchSource_BROWSE = 2;
var giSearchSource_SELECT = 3;
var giSearchSource_ALL = 4;
var gsApplicationContext = 'start';
var gsLastShowDivID = '';
var gsOnDemandSetupURL = '/ondemand/setup/';
var gaParam;
var gaMasterViewportHistory = ['interfaceMasterHomeShow()']
var giMasterViewportHistoryCurrentIndex = 0
var gsLastDestinationInstructions = '';
var gaMasterObjectViewportHistory = [];
window.onbeforeunload = function()
{
if (gbUnloadWarning)
{
return "You potentially will lose unsaved information if you close. Press Cancel to stop the close."
}
}
$(function()
{
gsUserNetworkGroups = '';
gbSetupShow = false;
$(document).ajaxError(
function(oEvent, oXMLHTTPRequest, oAjaxOptions, oError)
{
alert('Error: ' + oAjaxOptions.url + ' \nException: ' + oError + ' \nReturned: ' + oXMLHTTPRequest.responseText);
}
);
$.ajaxSetup(
{
cache: false
});
if (navigator.platform.indexOf('iPad') != -1 || navigator.platform.indexOf('iPhone') != -1)
{
gbSetFocus = false;
//gbRichEdit = false;
}
/* $.ajax(
{
type: 'GET',
url: '/ondemand/core/?method=CORE_SET_RESPONSE_FORMAT&rf=XML',
dataType: 'text'
}); */
$('td.interfaceViewportControl').live('click', function()
{
interfaceMasterObjectViewportHistory({xhtmlElementID: this.id});
});
$('.interfaceViewportControl').live('mousedown', function()
{
$('td.interfaceViewportControlHighlight').removeClass('interfaceViewportControlHighlight');
});
$('.interfaceViewportControl').live('mouseup', function()
{
$(this).addClass('interfaceViewportControlHighlight');
});
$('.interfaceMasterWatermark').live('focus', function()
{
if ($(this).hasClass('interfaceMasterWatermark'))
{
$(this).val('');
$(this).removeClass('interfaceMasterWatermark');
}
});
$('.inputInterfaceMainSelect').live('focus', function()
{
//alert('1a');
$(this).addClass('interfaceMasterHighlight');
gsLastShowDivID = this.id;
$('#divInterfaceMasterViewportControlOptions').html('');
$('#divInterfaceMasterViewportControlOptions').show();
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(this).offset().top, left: $(this).offset().left + $(this).width() - 10});
$('#divInterfaceMasterViewportControlOptions').html('');
$('#spanInterfaceMainSelectOptions').button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.click(function() {
//alert('1');
interfaceMasterElementOptionsSearch(gsLastShowDivID, 4);
})
.css('width', '14px')
.css('height', '23px')
});
$('.inputInterfaceMainSelect').live('keyup', function()
{
interfaceMasterElementOptionsSearch(gsLastShowDivID, 1, 3);
});
$('.inputInterfaceMainSelect').live('blur', function()
{
$(this).removeClass('interfaceMasterHighlight');
//$('#divInterfaceMasterViewportControlOptions').hide();
});
$('.inputInterfaceMainSelectAddress').live('focus', function()
{
gsLastShowDivID = this.id;
$('#divInterfaceMasterViewportControlOptions').html('');
$('#divInterfaceMasterViewportControlOptions').show();
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(this).offset().top, left: $(this).offset().left + $(this).width() - 10});
$('#divInterfaceMasterViewportControlOptions').html('');
$('#spanInterfaceMainSelectOptions').button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.click(function() {
interfaceMasterAddressSearch(gsLastShowDivID);
})
.css('width', '14px')
.css('height', '23px')
});
$('.inputInterfaceMainSelectAddress').live('blur', function()
{
$('#divInterfaceMasterViewportControlOptions').hide();
});
$('.inputInterfaceMainSelectContact').live('keyup', function()
{
interfaceMasterContactSearch(gsLastShowDivID, 1, 3);
});
$('.inputInterfaceMainSelectContact').live('focus', function()
{
gsLastShowDivID = this.id;
$('#divInterfaceMasterViewportControlOptions').html('');
$('#divInterfaceMasterViewportControlOptions').show();
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(this).offset().top, left: $(this).offset().left + $(this).width() - 10});
$('#divInterfaceMasterViewportControlOptions').html('');
$('#spanInterfaceMainSelectOptions').button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.click(function() {
interfaceMasterContactSearch(gsLastShowDivID, 4);
})
.css('width', '14px')
.css('height', '23px')
});
$('.inputInterfaceMainSelectContact').live('blur', function()
{
//$('#divInterfaceMasterViewportControlOptions').hide();
});
$('.inputInterfaceMainSelectContactEmail').live('focus', function()
{
gsLastShowDivID = this.id;
$('#divInterfaceMasterViewportControlOptions').html('');
$('#divInterfaceMasterViewportControlOptions').show();
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(this).offset().top, left: $(this).offset().left + $(this).width()});
$('#divInterfaceMasterViewportControlOptions').html('');
$('#spanInterfaceMainSelectOptions').button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.click(function() {
interfaceMasterContactEmailSearch(gsLastShowDivID, {
source: 4,
emailOnly: true,
contactBusiness: $('#' + gsLastShowDivID).attr('ondemandcontactbusiness'),
setXHTMLElementID: $(this).attr('ondemandsetelementid')
});
})
.css('width', '14px')
.css('height', '23px')
});
$('.inputInterfaceMainSelectContactEmail').live('keyup', function()
{
if (giKeyPressTimeoutId != 0) {clearTimeout(giKeyPressTimeoutId)};
var sFunction = "interfaceMasterContactEmailSearch(gsLastShowDivID, {" +
"source: 1," +
"emailOnly: true," +
"contactBusiness: " + $(this).attr('ondemandcontactbusiness') + "," +
"setXHTMLElementID: '" + $(this).attr('ondemandsetelementid') + "'});"
giKeyPressTimeoutId = setTimeout(sFunction, giWaitForStop);
});
$('.spanInterfaceMainOptionsClose').live('click', function()
{
$('#divInterfaceMasterViewportControlOptions').slideUp(500);
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', '');
});
$('.interfaceSearchHeaderPage').live('click', function()
{
interfaceAuditSearchShowPage(this.id);
});
$('td.interfaceHomeOptionClose').live('click', function()
{
$('#divInterfaceMasterViewportControlOptions').hide(1000);
$('#divInterfaceMasterViewportControlOptions').html(interfaceHomeOptions());
$('#divInterfaceMasterViewportControlOptions').show(500);
interfaceHomeOptionsBind();
});
$('input.inputInterfaceMainText').live('focus', function()
{
$(this).addClass('interfaceMasterHighlight');
});
$('input.inputInterfaceMainText').live('keyup', function()
{
gbInputDetected = true;
});
$('input.inputInterfaceMainText').live('blur', function()
{
$(this).removeClass('interfaceMasterHighlight');
});
/* $('input.inputInterfaceMainSelect').live('focus', function()
{
$(this).addClass('interfaceMasterHighlight');
});
$('input.inputInterfaceMainSelect').live('blur', function()
{
$(this).removeClass('interfaceMasterHighlight');
}); */
$('input.inputInterfaceMainDate').live('focus', function()
{
$(this).addClass('interfaceMasterHighlight');
});
$('input.inputInterfaceMainDate').live('blur', function()
{
$(this).removeClass('interfaceMasterHighlight');
});
$('.inputInterfaceMainTextMulti').live('focus', function()
{
$(this).addClass('interfaceMasterHighlight');
});
$('.inputInterfaceMainTextMulti').live('blur', function()
{
$(this).removeClass('interfaceMasterHighlight');
});
if (window.location.hash == '#PASSWORDEXPIRED')
{
interfaceMasterLogonChangePasswordShow();
}
else
{
interfaceMasterViewport();
}
})
function interfaceMasterObjectViewportHistory(aParam)
{
var bGet = false;
var iObject = giObject;
var iObjectContext = giObjectContext;
var sXHTMLElementID;
var sFunctionDefault;
if (aParam != undefined)
{
if (aParam.object != undefined) {iObject = aParam.object}
if (aParam.objectContext != undefined) {iObjectContext = aParam.objectContext}
if (aParam.functionDefault != undefined) {sFunctionDefault = aParam.functionDefault}
if (aParam.xhtmlElementID != undefined) {sXHTMLElementID = aParam.xhtmlElementID}
}
$.each(gaMasterObjectViewportHistory, function(index)
{
if ((this.object == iObject) && (this.objectContext ==iObjectContext))
{
if (sFunctionDefault != undefined)
{
sXHTMLElementID = this.xhtmlElementID
}
else
{
gaMasterObjectViewportHistory.splice(index,1)
}
}
});
if (sFunctionDefault == undefined)
{
gaMasterObjectViewportHistory.push(
{
object: iObject,
objectContext: iObjectContext,
xhtmlElementID: sXHTMLElementID
}
)
}
else
{
if (sXHTMLElementID == undefined)
{
eval(sFunctionDefault);
}
else
{
$('.interfaceViewportControl').removeClass('interfaceViewportControlHighlight')
$('#' + sXHTMLElementID).addClass('interfaceViewportControlHighlight')
$('#' + sXHTMLElementID).click()
}
}
}
function interfaceMasterViewportDestination(aParam)
{
var sDestinationInstructions;
var iInstruction = 1;
var iInstructionCount = 1;
var bContinue = true;
var bMove = true;
var bAdd = false;
if (gbInputDetected)
{
bContinue = confirm("You have edited this page. Do you want to continue moving to the new page?")
}
if (bContinue)
{
gbInputDetected = false;
if (aParam != undefined)
{
if (aParam.newDestination != undefined) {sDestinationInstructions = aParam.newDestination}
if (aParam.instruction != undefined) {iInstruction = aParam.instruction}
if (aParam.instructionCount != undefined) {iInstructionCount = aParam.instructionCount}
if (aParam.index != undefined) {giMasterViewportHistoryCurrentIndex = aParam.index}
if (aParam.move != undefined) {bMove = aParam.move}
//if (iInstruction == 1 && sDestinationInstructions != undefined && sDestinationInstructions != gsLastDestinationInstructions)
if (iInstruction == 1 && sDestinationInstructions != undefined)
{
if (sDestinationInstructions == gsLastDestinationInstructions)
{
var aTmp = sDestinationInstructions.split(';');
$.each(aTmp, function(index)
{
if (this == '')
{
aTmp.splice(index,1)
}
});
if (aTmp.length == 1)
{
$.each(gaMasterViewportHistory, function(index)
{
if (this == sDestinationInstructions)
{
gaMasterViewportHistory.splice(index,1)
bAdd = true;
}
});
}
}
else
{
bAdd = true;
}
if (bAdd)
{
gaMasterViewportHistory.push(sDestinationInstructions);
giMasterViewportHistoryCurrentIndex = gaMasterViewportHistory.length - 1;
var sData = 'value=' + encodeURIComponent(gaMasterViewportHistory.slice(-2).toString());
$.ajax(
{
type: 'POST',
url: '/ondemand/core/?method=CORE_PROFILE_MANAGE&advanced=4',
data: sData,
dataType: 'text'
})
}
}
if (iInstruction == 2)
{
giMasterViewportHistoryCurrentIndex = giMasterViewportHistoryCurrentIndex - iInstructionCount;
if (giMasterViewportHistoryCurrentIndex < 0) {giMasterViewportHistoryCurrentIndex = 0}
}
if (iInstruction == 3)
{
giMasterViewportHistoryCurrentIndex = giMasterViewportHistoryCurrentIndex + iInstructionCount;
if (giMasterViewportHistoryCurrentIndex > gaMasterViewportHistory.length - 1) {giMasterViewportHistoryCurrentIndex = gaMasterViewportHistory.length - 1}
}
if (iInstruction == 4)
{
gaMasterViewportHistory.length = 0;
giMasterViewportHistoryCurrentIndex = 0;
}
if (iInstruction == 5)
{
giMasterViewportHistoryCurrentIndex = gaMasterViewportHistory.length - 1;
}
if (iInstruction == 6)
{
giMasterViewportHistoryCurrentIndex = 0;
}
if (iInstruction == 7)
{
//refresh
}
if (iInstruction == 8)
{
$.ajax(
{
type: 'GET',
url: '/ondemand/core/?method=CORE_PROFILE_SEARCH&advanced=4&rf=TEXT',
dataType: 'text',
async: false,
success: function(data) {
if (data == '')
{
//gaMasterViewportHistory.push('interfaceMasterHomeShow()');
}
else
{
gaMasterViewportHistory = data.split(',');
giMasterViewportHistoryCurrentIndex = gaMasterViewportHistory.length - 1
}
}
})
}
$('#spanInterfaceMasterViewportControlBack').button("destroy");
$('#spanInterfaceMasterViewportControlRefresh').button("destroy");
$('#spanInterfaceMasterViewportControlForward').button("destroy");
var bBack = true;
var bForward = true;
if (giMasterViewportHistoryCurrentIndex > 0)
{
//$('#spanInterfaceMasterViewportControlBack')
// .button({icons: {
// primary: "ui-icon-triangle-1-w"}})
bBack = false;
}
else
{
//$('#spanInterfaceMasterViewportControlBack')
// .button({icons: {}})
}
//$('#spanInterfaceMasterViewportControlBack')
//.button("refresh")
if (giMasterViewportHistoryCurrentIndex < gaMasterViewportHistory.length - 1)
{
// $('#spanInterfaceMasterViewportControlForward')
// .button({icons: {
// primary: "ui-icon-triangle-1-e"}})
bForward = false;
}
else
{
// $('#spanInterfaceMasterViewportControlForward')
// .button({icons: {}})
}
// $('#spanInterfaceMasterViewportControlForward')
// .button("refresh")
$('#spanInterfaceMasterViewportControlBack')
.button({
text: false,
icons: {primary: "ui-icon-triangle-1-w"},
disabled: bBack
})
.next()
.button( {
text: false,
icons: {
primary: "ui-icon-arrowrefresh-1-e"
}
})
.next()
.button( {
text: false,
icons: {primary: "ui-icon-triangle-1-e"},
disabled: bForward
})
.parent()
.buttonset();
$('#spanInterfaceMasterViewportControlBack')
.button({disabled: bBack})
$('#spanInterfaceMasterViewportControlForward')
.button({disabled: bForward})
sDestinationInstructions = gaMasterViewportHistory[giMasterViewportHistoryCurrentIndex]
gsLastDestinationInstructions = sDestinationInstructions;
if (bMove)
{
if (sDestinationInstructions != '' && sDestinationInstructions != undefined)
{
eval(sDestinationInstructions)
}
}
}
}
}
function interfaceMasterLogonShow()
{
var aHTML = [];
var h = -1;
aHTML[++h] = '
';
$('#divInterfaceBox').css("z-index", "1");
$('#divInterfaceBox').html(aHTML.join(''));
var sLogonName = $.cookie('mydigitalspaceidlogonname')
if (sLogonName != '' && sLogonName != null)
{
$('#inputInterfaceMasterLogonName').val(sLogonName);
$('#inputInterfaceMasterLogonPassword').focus();
}
else
{
$('#inputInterfaceMasterLogonName').focus();
}
$('#spanInterfaceMasterLogon').button(
{
label: "Logon"
})
.click(function()
{
interfaceMasterLogon();
});
$('#divInterfaceBox').show(giShowSpeed);
$('#aInterfaceMasterLogonSendPassword').click(function()
{
interfaceMasterLogonSendPasswordShow();
});
}
function interfaceMasterLogon()
{
var sReturn;
var sData;
var sLogonName = $('#inputInterfaceMasterLogonName').val();
var sPassword = $('#inputInterfaceMasterLogonPassword').val();
sData = 'logon=' + encodeURIComponent(sLogonName) + '&password=' + encodeURIComponent(sPassword);
$.ajax(
{
type: 'POST',
url: '/directory/ondemand/logon.asp',
data: sData,
dataType: 'text',
async: false,
success: interfaceMasterLogonProcess
})
}
function interfaceMasterLogonProcess(sReturn)
{
if (sReturn.substring(0, 2) == 'OK')
{
var aReturn = sReturn.split('|');
if (aReturn[0] == 'OK')
{
if (unescape(aReturn[1]) == "NO")
{
if (aReturn[2] == "LOGONFAILED")
{
$('#tdInterfaceMasterLogonStatus').html('Logon Name or Password is incorrect.');
}
}
else
{
$('#tdInterfaceMasterLogonStatus').html('Logon successful...');
if ($('#inputInterfaceMasterLogonNameRemember').attr('checked'))
{
$.cookie('mydigitalspaceidlogonname', sLogonName);
}
interfaceControlSecurity();
if (aReturn[3] == "PASSWORDEXPIRED")
{
interfaceMasterLogonChangePasswordShow(aReturn[2]);
}
else
{
if (aReturn[2] == "#" || gbLogonStayOnDocument)
{
document.location.reload();
}
else
{
document.location.href = aReturn[2];
}
}
}
}
}
}
function interfaceMasterLogonChangePasswordShow(aParam)
{
var aHTML = [];
var h = -1;
var sXHTMLElementID = 'divInterfaceBox';
if (aParam != undefined)
{
if (aParam.xhtmlElementID != undefined) {sXHTMLElementID = aParam.xhtmlElementID}
}
aHTML[++h] = '';
//$('#' + sXHTMLElementID).css("z-index", "1");
$('#' + sXHTMLElementID).html(aHTML.join(''));
$('#inputInterfaceMasterLogonCurrentPassword').focus();
$('#spanInterfaceMasterLogonChangePassword').button(
{
label: "Change Password"
})
.click(function()
{
interfaceMasterLogonChangePassword();
});
$('#' + sXHTMLElementID).show(giShowSpeed);
}
function interfaceMasterLogonChangePassword()
{
var sNewPassword = $('#inputInterfaceMasterLogonNewPassword').val();
var sNewPasswordConfirm = $('#inputInterfaceMasterLogonNewPasswordConfirm').val();
if (sNewPassword != sNewPasswordConfirm)
{
$('#tdInterfaceMasterLogonChangePasswordStatus').html('New passwords do not match.');
}
else if (sNewPassword == '')
{
$('#tdInterfaceMasterLogonChangePasswordStatus').html('New password can not be blank.');
}
else
{
$('#tdInterfaceMasterLogonChangePasswordStatus').html('Updating password...');
var sCurrentPassword = $('#inputInterfaceMasterLogonCurrentPassword').val();
var sParam = 'method=SITE_USER_CHANGE_PASSWORD&expiredays=36500' +
'&site=' + msOnDemandSiteId +
'¤tpassword=' + sCurrentPassword +
'&newpassword=' + sNewPassword +
'&newpasswordconfirm=' + sNewPasswordConfirm;
$.ajax(
{
type: 'POST',
url: '/directory/ondemand/site.asp?' + sParam,
dataType: 'text',
async: false,
success: interfaceMasterLogonChangePasswordProcess
})
}
}
function interfaceMasterLogonChangePasswordProcess(sReturn)
{
if (sReturn.substring(0, 2) == 'OK')
{
var aReturn = sReturn.split('|');
if (aReturn[1] == 'ER')
{
if (aReturn[2] == 'PASSWORD_LESS_THAN_6_CHAR.')
{
$('#tdInterfaceMasterLogonChangePasswordStatus').html('New password needs to be at least 6 characters.');
}
else
{
$('#tdInterfaceMasterLogonChangePasswordStatus').html('Incorrect current password.');
}
}
else
{
$('#tdInterfaceMasterLogonChangePasswordStatus').html('Password changed!');
if (aReturn[2] == "#" || gbLogonStayOnDocument)
{
window.location.hash = '';
document.location.reload();
}
else
{
document.location.href = aReturn[2];
}
}
}
else
{
alert('You need to be logged on to change your password!');
}
}
function interfaceMasterLogonSendPasswordShow()
{
var aHTML = [];
var h = -1;
aHTML[++h] = '';
$('#divInterfaceBox').css("z-index", "1");
$('#divInterfaceBox').html(aHTML.join(''));
$('#inputInterfaceMasterLogonSendPassword').focus();
$('#spanInterfaceMasterLogonSendPassword').button(
{
label: "Send Password"
})
.click(function()
{
interfaceMasterLogonSendPassword();
});
$('#divInterfaceMasterLogon').show(giShowSpeed);
}
function interfaceMasterLogonSendPassword()
{
if ($('#inputInterfaceMasterLogonSendPassword').val() == '')
{
$('#tdInterfaceMasterLogonSendPasswordStatus').html('Logon name is blank, please enter logon name.');
}
else
{
$('#tdInterfaceMasterLogonSendPasswordStatus').html('Sending password...');
var sCurrentPassword = $('#inputInterfaceMasterLogonCurrentPassword').val();
var sParam = 'method=SITE_SEND_PASSWORD&site=' + msOnDemandSiteId +
'&logon=' + $('#inputInterfaceMasterLogonSendPassword').val();
$.ajax(
{
type: 'POST',
url: '/directory/ondemand/site.asp?' + sParam,
dataType: 'text',
async: false,
success: interfaceMasterLogonSendPasswordProcess
})
}
}
function interfaceMasterLogonSendPasswordProcess(sReturn)
{
var aValues = sReturn.split('|');
if (aValues[1] == 'OK')
{
$('#tdInterfaceMasterLogonSendPasswordStatus').html('Your password has been emailed to you.');
}
else
{
$('#tdInterfaceMasterLogonSendPasswordStatus').html('Can not find this logon name!');
}
}
function interfaceMasterLogoff()
{
$.ajax(
{
type: 'GET',
async: false,
url: '/directory/ondemand/logoff.asp',
dataType: 'text'
})
gbUnloadWarning = false;
document.location.reload();
}
function interfaceMasterViewportUserControlShow(oElement)
{
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height(), left: $(oElement).offset().left });
$('#divInterfaceMasterViewportControlOptions').html(interfaceControlUserOptions());
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
interfaceControlUserOptionsBind();
}
function interfaceMasterViewport()
{
var sParam = 'method=CORE_GET_USER_NAME';
$.ajax(
{
type: 'GET',
url: '/directory/ondemand/object.asp?' + sParam,
dataType: 'text',
async: false,
cache: false,
success: function(data, textStatus, XMLHttpRequest)
{
sReturn = data;
var aValues = sReturn.split('|');
if( aValues[0] == 'ER')
{
interfaceMasterLogonShow();
}
else
{
interfaceMasterViewportShow(sReturn);
}
}
})
}
function interfaceMasterViewportShow(asReturn)
{
var aHTML = [];
var h = -1;
var aValues = asReturn.split('|');
gsUserName = aValues[1];
gsUserID = aValues[7];
gsUserContactPersonID = aValues[11];
gsUserEmail = aValues[12];
gbSystemAdmin = (aValues[20] == '1')
interfaceControlSecurity();
gbUnloadWarning = true;
aHTML[++h] = '';
$('#tdInterfaceMasterHeaderColumn2').html('
' + aValues[3] + '')
if (aValues[0] == 'OK')
{
//aHTML[++h] = '
';
//aHTML[++h] = '
' + aValues[3] + '
';
}
else
{
//aHTML[++h] = '
[Space Name]
';
//aHTML[++h] = '
[User Name]
';
}
//aHTML[++h] = '
';
aHTML[++h] = '
';
aHTML[++h] = '
' +
' ' +
' ' +
'
';
aHTML[++h] = '
' +
' ' +
' ' +
' ' +
'
';
aHTML[++h] = '
' +
' ' +
'
';
aHTML[++h] = '
' +
'' +
'
';
aHTML[++h] = '
';
aHTML[++h] = '
' +
'New' +
'
';
aHTML[++h] = '
' +
'' +
' ' +
'
';
aHTML[++h] = '
';
if (gbSetupShow)
{
aHTML[++h] = '
' +
'' +
'' +
'
';
}
aHTML[++h] = '
' +
' ' +
'
';
aHTML[++h] = '
';
aHTML[++h] = '
';
aHTML[++h] = '
';
aHTML[++h] = '
';
aHTML[++h] = '
';
$('#divInterfaceMasterViewportControl').html(aHTML.join(''));
$('#spanInterfaceMasterViewportControlHome')
.button({
text: false,
icons: {
primary: "ui-icon-home"
}})
.click(function(event)
{
interfaceMasterHomeShow();
})
.next()
.button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.click(function() {
interfaceMasterHomeOptionsShow(this);
})
.css('width', '12px')
.parent()
.buttonset();
$('#spanInterfaceMasterViewportControlBack')
.button({
text: false,
icons: {}
})
.click(function(event)
{
interfaceMasterViewportDestination({instruction: 2});
})
.css('width', '19px')
.next()
.button( {
text: false,
icons: {
primary: "ui-icon-arrowrefresh-1-e"
}
})
.click(function() {
interfaceMasterViewportDestination({instruction: 7});
})
.css('width', '25px')
.css('margin-left', '2px')
.next()
.button( {
text: false,
icons: {}
})
.click(function() {
interfaceMasterViewportDestination({instruction: 3});
})
.css('width', '19px')
.css('margin-left', '2px')
.parent()
.buttonset();
$('#divInterfaceMasterViewportControlSet')
.button(
{
icons:
{
primary: "ui-icon-grip-dotted-vertical",
secondary: "ui-icon-triangle-1-s"
},
label: gsViewportDefault
})
.click(function()
{
interfaceMasterViewportControlShow(this);
})
.css('text-align', 'left');
$('#spanInterfaceMasterViewportControlNew')
.button({
label: "New"
})
.next()
.button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.css('width', '12px')
.parent()
.buttonset();
$('#spanInterfaceMasterViewportControlAction')
.button({
label: "Save"
})
.next()
.button( {
text: false,
icons: {
primary: "ui-icon-triangle-1-s"
}
})
.css('width', '12px')
.css('margin-left', '2px')
.parent()
.buttonset();
$('#spanInterfaceMasterViewportControlDashboard')
.button({
text: false,
icons: {
primary: "ui-icon-calculator"
}})
.click(function()
{
interfaceMasterDashboardShow(this);
});
$('#spanInterfaceMasterViewportControlSetupSwitch')
.button({
text: false,
label: 'Setup your system. Once finished click on this icon again.',
icons: {
primary: "ui-icon-wrench"
}})
.css('font-size', '0.75em')
.click(function()
{
interfaceMasterViewportSetup(this);
});
$('#spanInterfaceMasterViewportControlHelpHome')
.button({
text: false,
icons: {
primary: "ui-icon-help"
}})
.click(function()
{
interfaceMasterHelpShow(this);
});
$('#spanInterfaceMasterViewportLogonName').click(function(event)
{
interfaceControlUserOptionsShow(this);
})
$('#divInterfaceMasterViewportControlBrowse').html(interfaceMasterViewportBrowse());
$("#divInterfaceMasterViewport").touchwipe({
wipeLeft: function() {interfaceMasterViewportDestination({instruction: 3});},
wipeRight: function() {interfaceMasterViewportDestination({instruction: 2});},
min_move_x: 35,
min_move_y: 35,
preventDefaultEvents: true
});
interfaceControlSetMasterViewport();
if (gbReturnToLast)
{
interfaceMasterViewportDestination({instruction: 8})
}
else
{
interfaceMasterHomeShow();
}
$('#inputInterfaceMasterViewportControlSearch').focus();
}
function interfaceMasterReset()
{
$('#inputInterfaceMasterViewportControlSearch').unbind('keyup');
$('#inputInterfaceMasterViewportControlSearch').unbind('click');
$('#spanInterfaceMasterViewportControlSearch').unbind('click');
$('#spanInterfaceMasterViewportControlSearchOptions').unbind('click');
$('#spanInterfaceMasterViewportControlNew').unbind('click');
$('#spanInterfaceMasterViewportControlNewOptions').unbind('click');
$('#spanInterfaceMasterViewportControlAction').unbind('click');
$('#spanInterfaceMasterViewportControlActionOptions').unbind('click');
$('#spanInterfaceMasterViewportControlSetup').unbind('click');
$('#spanInterfaceMasterViewportControlSetupOptions').unbind('click');
$('#spanInterfaceMasterViewportControlHelp').unbind('click');
$('#spanInterfaceMasterViewportControlHelpOptions').unbind('click');
$('td.interfaceViewportMasterControlBrowse').unbind('click');
$('td.interfaceViewportMasterControlBrowseAll').unbind('click');
$('#divInterfaceMasterViewportControlActionStatus').text('');
if (giMessagingTimerID != 0) {clearInterval(giMessagingTimerID)};
gbInputDetected = false;
gsViewportMasterActionXHTML = '';
}
function interfaceMasterOptionsSource(sSource)
{
if (sSource == undefined) {sSource = ''}
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', sSource);
}
function interfaceMasterHomeShow()
{
// if (gsHomeViewportXHTML == '')
// {
// gsHomeViewportXHTML = interfaceHomeViewport();
// }
// $('#divInterfaceViewportControl').html(gsHomeViewportXHTML)
interfaceHomeViewport();
if (gsHomeXHTML == '')
{
gsHomeXHTML = interfaceHome();
}
$('#divInterfaceMain').html(gsHomeXHTML)
interfaceHomeShow();
}
function interfaceMasterHomeOptionsShow(oElement)
{
var aHTML = [];
var h = -1;
if ($('#divInterfaceMasterViewportControlOptions').attr('onDemandSource') == oElement.id)
{
$('#divInterfaceMasterViewportControlOptions').hide(giHideSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', '');
}
else
{
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', oElement.id);
$('#divInterfaceMasterViewportControlOptions').html(" ");
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height(), left: $(oElement).offset().left });
$('#divInterfaceMasterViewportControlOptions').html(interfaceHomeOptions());
interfaceHomeOptionsBind();
}
}
function interfaceMasterViewportControlShow(oElement)
{
var aHTML = [];
var h = -1;
if ($('#divInterfaceMasterViewportControlOptions').attr('onDemandSource') == oElement.id)
{
$('#divInterfaceMasterViewportControlOptions').hide(giHideSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', '');
}
else
{
if (gsViewportMasterControlXHTML == '')
{
gsViewportMasterControlXHTML = interfaceControlOptions();
}
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', oElement.id);
$('#divInterfaceMasterViewportControlOptions').html(" ");
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height(), left: $(oElement).offset().left });
$('#divInterfaceMasterViewportControlOptions').html(gsViewportMasterControlXHTML);
interfaceControlOptionsBind();
}
}
function interfaceMasterAttachments(aParam)
{
var sXHTMLElementID;
var iObject = giObject;
var iObjectContext = giObjectContext;
var bShowAdd = gbShowAdd;
var iAttachmentType = '';
var oActions = {add: true};
if (aParam != undefined)
{
if (aParam.object != undefined) {iObject = aParam.object}
if (aParam.objectContext != undefined) {iObjectContext = aParam.objectContext}
if (aParam.objectName != undefined) {sObjectName = aParam.objectName}
if (aParam.showAdd != undefined) {bShowAdd = aParam.showAdd}
if (aParam.attachmentType != undefined ) {iAttachmentType = aParam.attachmentType}
if (aParam.xhtmlElementID != undefined ) {sXHTMLElementID = aParam.xhtmlElementID}
if (aParam.actions != undefined) {oActions = aParam.actions}
}
if (oActions.add)
{
var aHTML = [];
var h = -1;
aHTML[++h] = '' +
'' +
'' +
gsLoadingXHTML +
' | ' +
'' +
' | ' +
'
' +
'
';
$('#' + sXHTMLElementID).html(aHTML.join(''));
var aHTML = [];
var h = -1;
aHTML[++h] = '';
aHTML[++h] = '' +
'Add' +
' |
';
aHTML[++h] = '
';
$('#tdInterfaceMainAttachmentsColumn2').html(aHTML.join(''));
$('#spanInterfaceMainAttachmentsAdd').button(
{
label: "Add"
})
.click(function() {
interfaceMasterAttachmentsAdd(aParam);
})
sXHTMLElementID = 'tdInterfaceMainAttachmentsColumn1';
}
if (iObjectContext != -1)
{
var sParam = 'method=CORE_ATTACHMENT_SEARCH' +
'&object=' + iObject +
'&objectcontext=' + iObjectContext +
'&type=' + iAttachmentType;
$.ajax(
{
type: 'GET',
url: '/ondemand/core/?rf=XML&' + sParam,
dataType: 'xml',
success: function(data) {interfaceMasterAttachmentsShow(data, sXHTMLElementID)}
});
}
}
function interfaceMasterAttachmentsShowRow(oRow)
{
var aHTML = [];
var h = -1;
aHTML[++h] = '';
aHTML[++h] = '' +
'' + onDemandXMLGetData(oRow, "filename") + ' | ';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "modifieddate") + ' | ';
aHTML[++h] = ' | ';
aHTML[++h] = '
';
return aHTML.join('');
}
function interfaceMasterAttachmentsShow(oXML, sXHTMLElementID)
{
var aHTML = [];
var h = -1;
oRoot = oXML.getElementsByTagName("ondemand").item(0);
if (oRoot.childNodes.length == 0)
{
aHTML[++h] = '';
aHTML[++h] = ''
aHTML[++h] = '';
aHTML[++h] = 'No attachments. | ';
aHTML[++h] = '
';
$('#' + sXHTMLElementID).html(aHTML.join(''));
$('#' + sXHTMLElementID).show(giShowSpeed);
}
else
{
aHTML[++h] = '';
aHTML[++h] = ''
aHTML[++h] = '';
aHTML[++h] = 'Filename | ';
aHTML[++h] = 'Date | ';
aHTML[++h] = ' | ';
aHTML[++h] = '
';
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
aHTML[++h] = interfaceMasterAttachmentsShowRow(oRow);
}
aHTML[++h] = '
';
interfaceMasterPaginationList(
{
xhtmlElementID: sXHTMLElementID,
xhtmlContext: 'Attachment',
xhtml: aHTML.join(''),
showMore: ($(oRoot).attr('morerows') == "true"),
columns: 'subject-actiondate',
more: $(oRoot).attr('moreid'),
rows: giReturnRows,
functionSearch: interfaceMasterActions,
functionShowRow: interfaceMasterAttachmentsShowRow,
functionOpen: 'interfaceActionMasterViewport({showHome: false});interfaceActionSearch(this.id)',
functionNewPage: 'interfaceMasterAttachmentsShowBind()'
});
interfaceMasterAttachmentsShowBind();
}
}
function interfaceMasterAttachmentsShowBind()
{
$('.interfaceMainRowOptionsDeleteAttachment').button({
text: false,
icons: {
primary: "ui-icon-close"
}
})
.click(function() {
interfaceMasterAttachmentsRemove(this.id)
})
.css('width', '15px')
.css('height', '20px')
}
function interfaceMasterAttachmentsRemove(sXHTMLElementId)
{
var aSearch = sXHTMLElementId.split('-');
var sElementId = aSearch[0];
var sSearchContext = aSearch[1];
var sParam = 'method=CORE_ATTACHMENT_MANAGE&remove=1';
var sData = 'id=' + sSearchContext;
$.ajax(
{
type: 'POST',
url: '/ondemand/core/?' + sParam,
data: sData,
dataType: 'text',
success: function(data){$('#' + sXHTMLElementId).parent().fadeOut(500)}
});
}
function interfaceMasterAttachmentsAdd(aParam)
{
$('#tdInterfaceMainAttachmentsColumn1').html(interfaceMasterAttachmentsUpload(aParam));
$('#spanInterfaceMainUpload').button(
{
label: "Upload"
})
.click(function() {
interfaceMasterAttachmentsUploadProcess();
})
}
function interfaceMasterAttachmentsUploadProcess(aParam)
{
gaParam = {};
if (aParam != undefined) {gaParam = aParam};
$('#spanInterfaceMainUploadStatus').html('Uploading..');
var oForm = document.frmonDemandFileUpload;
//OnDemandTimerCount = 0;
oForm.submit();
interfaceMasterAttachmentsAddStatus();
giOnDemandTimer = setInterval('interfaceMasterAttachmentsAddStatus()', 1000);
}
function interfaceMasterAttachmentsAddStatus()
{
var oDivStatus = document.getElementById('divonDemandFileUploadStatus');
var oFrame = document.getElementById('ifonDemandUpload');
var sStatus;
var sCurrentState;
var fFunctionPostUpdate = interfaceMasterAttachments;
if (gaParam != undefined)
{
if (gaParam.functionPostUpdate != undefined) {fFunctionPostUpdate = gaParam.functionPostUpdate}
}
if (oFrame.readyState)
{
//IE
sCurrentState = oFrame.readyState;
}
else
{
//FF
if (oFrame.contentDocument.body.innerHTML == 'OK')
{
sCurrentState = 'complete';
}
else
{
sCurrentState = oFrame.contentDocument.body.innerHTML;
}
}
if (sCurrentState == 'complete')
{
clearInterval(giOnDemandTimer);
if (oDivStatus != null)
{
oDivStatus.setAttribute("class", "");
oDivStatus.style.display = 'none';
}
$('#spanInterfaceMainUploadStatus').html('File Upload Complete...');
//$('#tdInterfaceMainAttachmentsColumn1').slideUp(1000);
fFunctionPostUpdate();
}
}
function interfaceMasterAttachmentsUpload(aParam)
{
var aHTML = [];
var h = -1;
var iMaxFiles = 1
var iObject = giObject
var lObjectContext = giObjectContext
var sLabel = 'Select File';
var sObjectName = '';
var iAttachmentType = '';
var bShowUpload = true;
if (aParam != undefined)
{
if (aParam.maxFiles != undefined) {iMaxFiles = aParam.maxFiles}
if (aParam.object != undefined || iObject == '') {iObject = aParam.object}
if (aParam.objectName != undefined) {sObjectName = aParam.objectName}
if (aParam.objectContext != undefined ) {lObjectContext = aParam.objectContext}
if (aParam.label != undefined) {sLabel = aParam.label}
if (aParam.attachmentType != undefined) {iAttachmentType = aParam.attachmentType}
if (aParam.showUpload != undefined) {bShowUpload = aParam.showUpload}
}
aHTML[++h] = '';
return aHTML.join('');
}
function interfaceMasterViewportBrowse()
{
var aHTML = [];
var h = -1;
aHTML[++h] = '';
aHTML[++h] = '' +
'# | ' +
'A | ' +
'B | ' +
'C | ' +
'D | ' +
'E | ' +
'F | ' +
'G | ' +
'H | ' +
'I | ' +
'J | ' +
'K | ' +
'L | ' +
'M | ' +
'N | ' +
'O | ' +
'P | ' +
'Q | ' +
'R | ' +
'S | ' +
'T | ' +
'U | ' +
'V | ' +
'W | ' +
'X | ' +
'Y | ' +
'Z | ' +
'ALL | ' +
'
'
aHTML[++h] = '
'
return aHTML.join('');
}
function interfaceMasterViewportSetup()
{
var aHTML = [];
var h = -1;
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', '');
$('#divInterfaceMasterViewportControlSet').unbind('click');
if (gbSetupViewport)
{
gbSetupViewport = false;
$('#divInterfaceMasterViewportControlSet')
.button(
{
icons:
{
primary: "ui-icon-grip-dotted-vertical",
secondary: "ui-icon-triangle-1-s"
},
label: gsViewportDefault
})
.click(function()
{
interfaceMasterViewportControlShow(this);
});
interfaceControlSetMasterViewport();
interfaceMasterHomeShow();
interfaceMasterStatus("")
}
else
{
gbSetupViewport = true;
$('#divInterfaceMasterViewportControlSet')
.button(
{
label: gsSetupViewportDefault
})
.click(function()
{
interfaceMasterViewportControlSetupShow(this);
});
$('.divInterfaceViewportMain').html(interfaceControlSetupOptions);
interfaceControlSetSetupMasterViewport();
interfaceMasterStatus("Click icon again to return.")
}
}
function interfaceMasterViewportControlSetupShow(oElement)
{
var aHTML = [];
var h = -1;
if ($('#divInterfaceMasterViewportControlOptions').attr('onDemandSource') == oElement.id)
{
$('#divInterfaceMasterViewportControlOptions').hide(giHideSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', '');
}
else
{
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', oElement.id);
$('#divInterfaceMasterViewportControlOptions').html(" ");
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height(), left: $(oElement).offset().left });
$('#divInterfaceMasterViewportControlOptions').html(interfaceControlSetupOptions());
interfaceControlSetupOptionsBind();
}
}
function interfaceMasterHelpShow()
{
if (interfaceHelpURL() != '')
{
window.open(interfaceHelpURL());
}
else
{
$('#divInterfaceMain').html(interfaceHelp());
}
}
function interfaceMasterMainViewportShow(asDivID, bRefresh)
{
if (bRefresh == undefined) {bRefresh = false}
$('#divInterfaceMasterViewportControlOptions').hide();
$('.divInterfaceViewportMain').hide();
$(asDivID).show(giShowSpeed);
gsLastShowDivID = asDivID;
if ($(asDivID).html() == '' || bRefresh)
{
$(asDivID).attr('onDemandLoading', '1');
$(asDivID).html(gsLoadingXHTML);
}
}
function interfaceMasterMainViewportHideLoading(asDivID)
{
if (asDivID == undefined) {asDivID = gsLastShowDivID};
$(asDivID).removeClass("loading");
}
function interfaceMasterStatus(asStatus)
{
$('#divInterfaceMasterViewportControlActionStatus').html('');
}
function interfaceMasterError()
{
$('#divInterfaceMasterViewportControlActionStatus').text('Error');
}
function interfaceMasterElementEditStart(sElementId)
{
var aSearch = sElementId.split('-');
var sActionElementId = '#' + aSearch[0] + '-options-' + aSearch[2];
if (1==0)
{
$('td.interfaceActionsOptions').button('destroy');
$(sActionElementId).button(
{
icons:
{
primary: "ui-icon-disk"
}
});
}
var sHTML = $('#' + sElementId).html();
var sElementInputId = sElementId.replace('td', 'input');
sHTML = ''
$('#' + sElementId).html(sHTML);
$('#' + sElementInputId).focus();
$('#' + sElementInputId).blur(function(event)
{
interfaceMasterElementEditStop(sElementId);
});
}
function interfaceMasterElementEditStop(sElementId)
{
interfaceMasterElementEditSave(sElementId);
var aSearch = sElementId.split('-');
var sHTML = $('#' + sElementId.replace('td', 'input')).val();
$('#' + sElementId).html(sHTML);
}
function interfaceMasterElementEditSave(sElementId)
{
var aSearch = sElementId.split('-');
var sMethod = aSearch[0];
sMethod = sMethod.replace('td', '');
sMethod = sMethod.toUpperCase();
sMethod = sMethod + '_MANAGE';
var sParam = 'method=' + sMethod + '&select=' + aSearch[2];
sParam += '&' + aSearch[1] + '=' + $('#' + sElementId.replace('td', 'input')).val();
$.ajax(
{
type: 'GET',
url: '/directory/ondemand/object.asp?' + sParam,
dataType: 'text',
success: interfaceMasterStatus('Saved')
});
}
function interfaceMasterOptionsSetPosition(sElementId, iOffsetTop, iOffsetLeft)
{
var oElement = $('#' + sElementId)
if (iOffsetTop == undefined) {iOffsetTop = 5}
if (iOffsetLeft == undefined) {iOffsetLeft = 0}
$('#divInterfaceMasterViewportControlOptions').html('');
$('#divInterfaceMasterViewportControlOptions').show();
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height() + iOffsetTop, left: $(oElement).offset().left + iOffsetLeft});
}
function interfaceMasterOptionsPosition(aParam)
{
var sXHTMLElementID = '';
var iLeftOffset = 0;
var iTopOffset = 7;
if (aParam != undefined)
{
if (aParam.xhtmlElementID != undefined) {sXHTMLElementID = aParam.xhtmlElementID}
if (aParam.leftOffset != undefined) {iLeftOffset = aParam.leftOffset}
if (aParam.topOffset != undefined) {iTopOffset = aParam.topOffset}
}
var oElement = $('#' + sXHTMLElementID)
$('#divInterfaceMasterViewportControlOptions').html('');
$('#divInterfaceMasterViewportControlOptions').show();
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height() + iTopOffset, left: $(oElement).offset().left + iLeftOffset});
}
function interfaceMasterElementOptionsSearch(sXHTMLElementId, iSource, iMinimumLength, sMethod, sSearchText)
{
var aSearch = sXHTMLElementId.split('-');
var sElementId = aSearch[0];
var lElementSearchContext = aSearch[1];
var sURL = '';
var sItemColumns = '';
if (iSource == undefined)
{
iSource = giSearchSource_TEXT_INPUT;
}
if (sElementId != '')
{
var sMethod = $('#' + sElementId).attr("onDemandMethod")
sItemColumns = $('#' + sElementId).attr("onDemandColumns")
}
if (lElementSearchContext != undefined)
{
$('#' + gsLastShowDivID).val($('#' + sXHTMLElementId).html())
$('#' + gsLastShowDivID).attr("onDemandID", lElementSearchContext)
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
interfaceMasterOptionsSetPosition(sXHTMLElementId);
var iMaximumColumns = 1;
if (iMinimumLength == undefined)
{
iMinimumLength = 1;
}
if (sSearchText == undefined) {sSearchText = ''};
if (sSearchText == '' && iSource == giSearchSource_TEXT_INPUT)
{
sSearchText = $('#' + sElementId).val();
}
if (sSearchText.length >= iMinimumLength || iSource == giSearchSource_ALL)
{
if (sMethod.indexOf("/") == -1)
{
var sParam = gsOnDemandSetupURL + '?rf=XML&method=' + sMethod +
'&xhtmlcontext=' + sElementId;
}
else
{
var sParam = sMethod +
'&xhtmlcontext=' + sElementId;
}
if (sSearchText != '')
{
sParam = sParam + '&quicksearch=' + sSearchText;
}
$.ajax(
{
type: 'GET',
url: sParam,
dataType: 'xml',
async: true,
success: function (data, textStatus)
{ interfaceMasterElementOptionsSearchShow(data, sItemColumns) }
});
}
};
}
function interfaceMasterElementOptionsSearchShow(oXML, sItemColumns)
{
var iColumn = 0;
var aHTML = [];
var h = -1;
var iMaximumColumns = 1;
sItemColumns = (sItemColumns == undefined)?'':sItemColumns;
var aColumns = sItemColumns.split('-');
var oRoot = oXML.getElementsByTagName('ondemand').item(0);
if (oRoot.childNodes.length == 0)
{
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
var oRow = oRoot.childNodes.item(0);
aHTML[++h] = '';
aHTML[++h] = ''
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
iColumn = iColumn + 1;
if (iColumn == 1)
{
aHTML[++h] = '';
}
if (sItemColumns.length == 0)
{
aHTML[++h] = '' + onDemandXMLGetData(oRow, "title") + ' | ';
}
else
{
aHTML[++h] = ''
for (var i = 0; i < aColumns.length; i++)
{
switch (aColumns[i])
{
case 'space':
aHTML[++h] = ' ';
break;
case 'comma':
aHTML[++h] = ',';
break;
case 'pipe':
aHTML[++h] = '|';
break;
default:
aHTML[++h] = onDemandXMLGetData(oRow, aColumns[i]);
}
}
aHTML[++h] = ' | ';
}
if (iColumn == iMaximumColumns)
{
aHTML[++h] = '
'
iColumn = 0;
}
}
aHTML[++h] = '
';
$('#divInterfaceMasterViewportControlOptions').html(aHTML.join(''));
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('td.interfaceSearch').click(function(event)
{
$('#divInterfaceMasterViewportControlOptions').hide(200);
interfaceMasterElementOptionsSearch(event.target.id);
});
}
}
function interfaceMasterSendEmail(lContactPerson, sSubject, sMessage)
{
var sParam = 'method=MESSENGER_SEND_EMAIL';
$.ajax(
{
type: 'POST',
url: '/messenger/?' + sParam,
dataType: 'text',
success: interfaceMasterStatus('Email sent.')
});
}
function interfaceMasterSearchStart(sElementId)
{
sElementId = 'divInterfaceMasterViewportControlSearchStatus';
$('#' + sElementId).show();
$('#' + sElementId).html(gsLoadingSmallXHTML);
}
function interfaceMasterSearchStop(sElementId)
{
sElementId = 'divInterfaceMasterViewportControlSearchStatus';
$('#' + sElementId).hide()
$('#' + sElementId).html('');
}
function interfaceMasterSave(sParam, sData, sSuccessMessage)
{
if (sParam == undefined) {sParam = ''};
if (sData != '' && sData.indexOf('&') == 0) {sData = sData.substr(1)};
$.ajax(
{
type: 'POST',
url: sParam + '&rf=JSON',
data: sData,
dataType: 'text',
async: false,
success: function(data) { interfaceMasterSaveSuccess(data, sSuccessMessage)}
});
}
function interfaceMasterSaveSuccess(data, sSuccessMessage)
{
oResponse = eval('(' + data + ')');
if (oResponse.status == 'OK')
{
interfaceMasterStatus(sSuccessMessage);
giObjectSaveId = oResponse.id;
}
else
{
interfaceMasterStatus(oResponse.error.errornotes);
giObjectSaveId = -1;
return '';
}
}
function interfaceMasterValidateJSON(oResponse)
{
}
function interfaceMasterJSONGetData(aoJSON, asElement, aiRow)
{
aoJSON = (aoJSON == undefined)?'':aoJSON;
asElement = (asElement == undefined)?'':asElement;
aiRow = (aiRow == undefined)?0:aiRow;
if (aoJSON.length == 0) return '';
if (asElement == '' || aiRow < 0) return '';
if (aoJSON.data.rows.length > 0)
{ return eval( 'aoJSON.data.rows[' + aiRow + '].' + asElement); }
else
{ return '';}
}
function interfaceMasterTF2OnOff(bValue)
{
if (bValue == undefined) {bValue = false}
if (bValue)
{
return '1';
}
else
{
return '0';
}
}
function interfaceMasterOnOff2TF(sValue)
{
if (sValue == undefined) {sValue = '0'}
if (sValue == '1')
{
return true;
}
else
{
return false;
}
}
function interfaceMasterTF2YN(bValue)
{
if (bValue == undefined) {bValue = false}
if (bValue)
{
return 'Y';
}
else
{
return 'N';
}
}
function interfaceMasterYN2TF(sValue)
{
if (sValue == undefined) {sValue = 'N'}
if (sValue == 'Y')
{
return true;
}
else
{
return false;
}
}
function interfaceMasterFormatSave(sValue)
{
if (sValue == undefined || sValue == 'undefined') { sValue = ''; }
return encodeURIComponent(sValue)
}
function interfaceMasterAddressSearch(sXHTMLElementId, aParam)
{
var aSearch = sXHTMLElementId.split('-');
var sElementId = aSearch[0];
var lElementSearchContext = aSearch[1];
if (lElementSearchContext != undefined)
{
$('#' + gsLastShowDivID).val(aSearch[2])
$('#' + gsLastShowDivID.replace('Suburb', 'State')).val(aSearch[3])
$('#' + gsLastShowDivID.replace('Suburb', 'PostCode')).val(aSearch[4])
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
var sParam = '/ondemand/core/?method=CORE_ADDRESS_SEARCH&rf=XML';
var sData = '';
interfaceMasterOptionsSetPosition(sXHTMLElementId)
//sData += '&postpcde=' + encodeURIComponent((aParam.postcode==undefined?'':aParam.postcode));
sData += 'suburblike=' + encodeURIComponent($('#' + gsLastShowDivID).val());
$.ajax(
{
type: 'POST',
url: sParam,
data: sData,
dataType: 'xml',
success: interfaceMasterAddressSearchShow
});
}
}
function interfaceMasterAddressSearchShow(oXML)
{
var iColumn = 0;
var aHTML = [];
var h = -1;
var iMaximumColumns = 1;
var oRoot = oXML.getElementsByTagName('ondemand').item(0);
if (oRoot.childNodes.length == 0)
{
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
var oRow = oRoot.childNodes.item(0);
aHTML[++h] = '';
aHTML[++h] = ''
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
aHTML[++h] = '';
aHTML[++h] = '' +
onDemandXMLGetData(oRow, "suburb") + ' | ';
aHTML[++h] = '' +
onDemandXMLGetData(oRow, "state") + ' | ';
aHTML[++h] = '' +
onDemandXMLGetData(oRow, "postcode") + ' | ';
aHTML[++h] = '
'
}
aHTML[++h] = '
';
$('#divInterfaceMasterViewportControlOptions').html(aHTML.join(''));
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('td.interfaceSearch').click(function(event)
{
$('#divInterfaceMasterViewportControlOptions').hide(200);
interfaceMasterAddressSearch(event.target.id);
});
}
}
function interfaceMasterContactSearch(sXHTMLElementId, iSource, iMinimumLength, sMethod, sSearchText)
{
var aSearch = sXHTMLElementId.split('-');
var sElementId = aSearch[0];
var lElementSearchContext = aSearch[1];
var sURL = '';
if (iSource == undefined)
{
iSource = giSearchSource_TEXT_INPUT;
}
if (sElementId != '')
{
var sMethod = $('#' + sElementId).attr("onDemandMethod")
var sParentElementId = $('#' + sElementId).attr("onDemandParent")
}
if (lElementSearchContext != undefined)
{
$('#' + sElementId).attr("onDemandID", aSearch[1])
$('#' + sElementId).val(aSearch[2] + ' ' + aSearch[3])
$('#' + sParentElementId).attr("onDemandID", aSearch[4])
$('#' + sParentElementId).val(aSearch[5])
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
interfaceMasterOptionsSetPosition(sXHTMLElementId);
var iMaximumColumns = 1;
if (iMinimumLength == undefined)
{
iMinimumLength = 1;
}
if (sSearchText == undefined) {sSearchText = ''};
if (sSearchText == '' && iSource == giSearchSource_TEXT_INPUT)
{
sSearchText = $('#' + sElementId).val();
}
if (sSearchText.length >= iMinimumLength || iSource == giSearchSource_ALL)
{
var oAdvancedSearch = new AdvancedSearch();
oAdvancedSearch.endPoint = 'contact';
oAdvancedSearch.method = 'CONTACT_PERSON_SEARCH';
oAdvancedSearch.addField( 'firstname,surname,contactbusinesstext,contactbusiness');
oAdvancedSearch.addFilter('quicksearch', 'STRING_IS_LIKE', sSearchText);
if (sParentElementId != undefined)
{
var sParentSearchText = $('#' + sParentElementId).val();
var sParentSearchId = $('#' + sParentElementId).attr("onDemandID");
}
if (sParentSearchId != undefined)
{
oAdvancedSearch.addFilter('contactbusiness', 'EQUAL_TO', sParentSearchId);
}
else if (sParentSearchText != undefined)
{
oAdvancedSearch.addFilter('contactbusinesstext', 'STRING_STARTS_WITH', sParentSearchText);
}
oAdvancedSearch.rf = 'XML';
oAdvancedSearch.getResults(function (data) {interfaceMasterContactSearchShow(data, sElementId)})
}
};
}
function interfaceMasterContactSearchShow(oXML, sElementId)
{
var iColumn = 0;
var aHTML = [];
var h = -1;
var iMaximumColumns = 1;
var oRoot = oXML.getElementsByTagName('ondemand').item(0);
if (oRoot.childNodes.length == 0)
{
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
var oRow = oRoot.childNodes.item(0);
aHTML[++h] = '';
aHTML[++h] = ''
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
aHTML[++h] = '';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "firstname") +
' ' + onDemandXMLGetData(oRow, "surname") +
' | ';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "contactbusinesstext") +
' | ';
aHTML[++h] = '
'
}
aHTML[++h] = '
';
$('#divInterfaceMasterViewportControlOptions').html(aHTML.join(''));
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('td.interfaceSearch').click(function(event)
{
$('#divInterfaceMasterViewportControlOptions').hide(200);
interfaceMasterContactSearch(event.target.id);
});
}
}
function interfaceMasterContactEmailSearch(sXHTMLElementId, aParam)
{
var iSource = giSearchSource_TEXT_INPUT;
var iMinimumLength = 1;
var sMethod;
var sSearchText;
var iMaximumColumns = 1;
var bEmailOnly = false;
var sParentSearchId;
var sSetXHTMLElementId;
if (aParam != undefined)
{
if (aParam.source != undefined) {iSource = aParam.source}
if (aParam.minimumLength != undefined) {iMinimumLength = aParam.minimumLength}
if (aParam.method != undefined) {sMethod = aParam.method}
if (aParam.searchText != undefined) {sSearchText = aParam.searchText}
if (aParam.maximumColumns != undefined) {iMaximumColumns = aParam.maximumColumns}
if (aParam.emailOnly != undefined) {bEmailOnly = aParam.emailOnly}
if (aParam.contactBusiness != undefined) {sParentSearchId = aParam.contactBusiness}
if (aParam.setXHTMLElementID != undefined) {sSetXHTMLElementId = aParam.setXHTMLElementID}
}
var aSearch = sXHTMLElementId.split('---');
var sElementId = aSearch[0];
var lElementSearchContext = aSearch[1];
if (sElementId != '')
{
var sMethod = $('#' + sElementId).attr("onDemandMethod")
var sParentElementId = $('#' + sElementId).attr("onDemandParent")
}
if (lElementSearchContext != undefined)
{
if (sSetXHTMLElementId == undefined) {sSetXHTMLElementId = sElementId}
var lOnDemandID = $('#' + sSetXHTMLElementId).attr("onDemandID")
if (lOnDemandID == undefined)
{
lOnDemandID = aSearch[1];
}
else
{
lOnDemandID += '-' + aSearch[1]
}
$('#' + sSetXHTMLElementId).attr("onDemandID", lOnDemandID)
var sValue = $('#' + sSetXHTMLElementId).val()
if (bEmailOnly)
{
if (sValue == '')
{
sValue = aSearch[6]
}
else
{
sValue += ';' + aSearch[6]
}
$('#' + sSetXHTMLElementId).val(sValue)
}
else
{
$('#' + sSetXHTMLElementId).val(aSearch[2] + ' ' + aSearch[3])
}
$('#' + sParentElementId).attr("onDemandID", aSearch[4])
$('#' + sParentElementId).val(aSearch[5])
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
interfaceMasterOptionsSetPosition(sXHTMLElementId);
if (sSearchText == undefined) {sSearchText = ''};
if (sSearchText == '' && iSource == giSearchSource_TEXT_INPUT)
{
sSearchText = $('#' + sElementId).val();
}
if (sSearchText.length >= iMinimumLength || iSource == giSearchSource_ALL)
{
var oAdvancedSearch = new AdvancedSearch();
oAdvancedSearch.endPoint = 'contact';
oAdvancedSearch.rows = 10;
oAdvancedSearch.method = 'CONTACT_PERSON_SEARCH';
oAdvancedSearch.addField( 'firstname,surname,contactbusinesstext,contactbusiness,email');
oAdvancedSearch.addFilter('quicksearch', 'STRING_IS_LIKE', sSearchText);
if (sParentElementId != undefined)
{
var sParentSearchText = $('#' + sParentElementId).val();
sParentSearchId = $('#' + sParentElementId).attr("onDemandID");
}
if (sParentSearchId != undefined)
{
oAdvancedSearch.addFilter('contactbusiness', 'EQUAL_TO', sParentSearchId);
}
else if (sParentSearchText != undefined)
{
oAdvancedSearch.addFilter('contactbusinesstext', 'STRING_STARTS_WITH', sParentSearchText);
}
if (bEmailOnly)
{
oAdvancedSearch.addFilter('email', 'IS_NOT_NULL', sParentSearchText);
oAdvancedSearch.addFilter('email', 'STRING_IS_LIKE', '@');
}
oAdvancedSearch.rf = 'XML';
oAdvancedSearch.getResults(function (data) {interfaceMasterContactEmailSearchShow(data, sElementId, aParam)})
}
};
}
function interfaceMasterContactEmailSearchShow(oXML, sElementId, aParam)
{
var iColumn = 0;
var aHTML = [];
var h = -1;
var iMaximumColumns = 1;
var oRoot = oXML.getElementsByTagName('ondemand').item(0);
if (oRoot.childNodes.length == 0)
{
$('#divInterfaceMasterViewportControlOptions').hide();
}
else
{
var oRow = oRoot.childNodes.item(0);
aHTML[++h] = '';
aHTML[++h] = ''
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
aHTML[++h] = '';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "firstname")
' | ';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "surname")
' | ';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "email") +
' | ';
aHTML[++h] = '' + onDemandXMLGetData(oRow, "contactbusinesstext") +
' | ';
aHTML[++h] = '
'
}
aHTML[++h] = '
';
$('#divInterfaceMasterViewportControlOptions').html(interfaceMasterPagination(
{
html: aHTML.join(''),
more: ($(oRoot).attr('morerows') == "true"),
headerClass: 'interfaceSearchHeaderLarge',
footerClass: 'interfaceSearchFooterLarge'
})
);
//$('#divInterfaceMasterViewportControlOptions').html(aHTML.join(''));
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('td.interfaceSearch').click(function(event)
{
$('#divInterfaceMasterViewportControlOptions').hide(200);
interfaceMasterContactEmailSearch(event.target.id, aParam);
});
interfaceMasterPaginationBind(
{
columns: 'firstname-surname-email-contactbusinesstext',
idColumns: 'firstname-surname-contactbusiness-contactbusinesstext-email',
more: $(oRoot).attr('moreid'),
bodyClass: 'interfaceSearchLarge',
functionSearch: interfaceMasterContactEmailSearch,
xhtmlElementId: sElementId,
idSeperator: '---'
})
}
}
function interfaceMasterPagination(aParam)
{
var aHTML = [];
var h = -1;
var sHTML = '';
var bMore = false;
if (aParam != undefined)
{
if (aParam.html != undefined) {sHTML = aParam.html}
if (aParam.more != undefined) {bMore = aParam.more}
}
aHTML[++h] = '';
aHTML[++h] = '';
aHTML[++h] = sHTML;
aHTML[++h] = '
';
if (bMore)
{
aHTML[++h] = '';
}
return aHTML.join('');
}
function interfaceMasterPaginationBind(aParam)
{
var fFunctionMore = interfaceMasterPaginationShowMore;
var iMore;
if (aParam != undefined)
{
if (aParam.functionMore != undefined) {fFunctionMore = aParam.functionMore}
if (aParam.more != undefined) {iMore = aParam.more}
}
$('#spanInterfaceSearchHeaderClose').button( {
text: false,
icons: {
primary: "ui-icon-close"
}
})
.click(function() {
$('#divInterfaceMasterViewportControlOptions').slideUp(1000);
$('#divInterfaceMasterViewportControlOptions').html(' ');
})
.css('width', '15px')
.css('height', '16px')
$('#spanInterfaceSearchHeaderMore').button( {
text: false,
icons: {
primary: "ui-icon-play"
}
})
.click(function() {
(aParam != undefined?aParam.more = iMore:aParam = {more: iMore})
fFunctionMore(aParam);
})
.css('width', '15px')
.css('height', '16px')
$('.interfaceSearchFooterPage').click(function(event)
{
interfaceMasterPaginationShowPage(this.id);
});
}
function interfaceMasterPaginationShowMore(aParam, oXML)
{
var sXHTMLElementId = '';
var iMore = -1;
var iStartRow = 10;
var iRows = 10;
var iColumn = 0;
var iMaximumColumns = 1;
var sColumns = "title";
var sIDColumns = '';
var fFunctionSearch;
var fFunctionClass;
var sClass;
var sIdAdditional = '';
var sBodyClass = 'interfaceSearchMedium';
var sIDSeperator = '-';
if (aParam != undefined)
{
if (aParam.more != undefined) {iMore = aParam.more}
if (aParam.startRow != undefined) {iStartRow = aParam.startRow}
if (aParam.rows != undefined) {iRows = aParam.rows}
if (aParam.xhtmlElementId != undefined) {sXHTMLElementId = aParam.xhtmlElementId}
if (aParam.columns != undefined) {sColumns = aParam.columns}
if (aParam.idColumns != undefined) {sIDColumns = aParam.idColumns}
if (aParam.functionSearch != undefined) {fFunctionSearch = aParam.functionSearch}
if (aParam.functionClass != undefined) {fFunctionClass = aParam.functionClass}
if (aParam.idAdditional != undefined) {sIdAdditional = aParam.idAdditional}
if (aParam.bodyClass != undefined) {sBodyClass = aParam.bodyClass}
if (aParam.idSeperator != undefined) {sIDSeperator = aParam.idSeperator}
}
$('#tdInterfaceSearchFooterMoreStatus').html(gsLoadingSmallXHTML);
if (iMore == -1)
{
alert('No more!')
}
else
{
if (oXML == undefined)
{
var sParam = 'method=CORE_SEARCH_MORE';
var sData = 'id=' + iMore +
'&startrow=' + iStartRow +
'&rows=' + iRows;
$.ajax(
{
type: 'GET',
url: '/ondemand/core/core.asp?rf=XML&' + sParam,
data: sData,
dataType: 'xml',
success: function(data){interfaceMasterPaginationShowMore(aParam, data)}
});
}
else
{
var aHTML = [];
var h = -1;
if ($('#divInterfaceMasterSearch-' + iStartRow).length == 0)
{
aHTML[++h] = '';
aHTML[++h] = '
';
aHTML[++h] = ''
var oRoot = oXML.getElementsByTagName('ondemand').item(0);
var iStartRow = parseInt($(oRoot).attr('startrow'));
var iRows = parseInt($(oRoot).attr('rows'));
var bMoreRows = ($(oRoot).attr('morerows') == "true");
if (bMoreRows)
{
$('#spanInterfaceSearchHeaderMore').show();
}
else
{
$('#spanInterfaceSearchHeaderMore').hide();
}
aParam.startRow = iStartRow + iRows;
$('#tdInterfaceSearchFooterMore').unbind('click');
$('#tdInterfaceSearchFooterMore').click(function(event)
{
//$('.InterfaceMasterSearchPage:last').hide();
interfaceAuditSearchAdd(aParam);
});
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
iColumn = iColumn + 1;
if (iColumn == 1)
{
aHTML[++h] = '';
}
var aIDColumns = sIDColumns.split("-");
var sIDData = '';
for (var i = 0; i < aIDColumns.length; i++)
{
sIDData += '-' + onDemandXMLGetData(oRow, aIDColumns[i]);
}
var aColumns = sColumns.split("-");
for (var i = 0; i < aColumns.length; i++)
{
sClass = 'interfaceSearch'
if (fFunctionClass != undefined)
{
sClass = sClass + fFunctionClass(oRow);
}
aHTML[++h] = ''
switch (aColumns[i])
{
case 'space':
aHTML[++h] = ' ';
break;
case 'comma':
aHTML[++h] = ',';
break;
case 'pipe':
aHTML[++h] = '|';
break;
default:
aHTML[++h] = onDemandXMLGetData(oRow, aColumns[i]);
}
aHTML[++h] = ' | ';
}
if (iColumn == iMaximumColumns)
{
aHTML[++h] = '
'
iColumn = 0;
}
}
aHTML[++h] = '
';
aHTML[++h] = '
';
$('.interfaceMasterSearchPage').hide();
$('.interfaceMasterSearchPage:last').after(aHTML.join(''));
$('td.interfaceSearch').click(function(event)
{
$('#divInterfaceMasterViewportControlOptions').html(' ');
$('#divInterfaceMasterViewportControlOptions').hide(giHideSpeedOptions)
fFunctionSearch(event.target.id, {source: 1});
});
//$('#tableInterfaceSearchHeader').attr('onDemandStartRow', iStartRow)
//$('#tableInterfaceSearchHeader').attr('onDemandRows', 20)
$('#tdInterfaceSearchFooterPage').append(
' | ');
$('#tdInterfaceSearchFooterMoreStatus').html(' ');
}
$('.interfaceSearchFooterPage').click(function(event)
{
interfaceMasterPaginationShowPage(this.id);
});
}
}
}
function interfaceMasterPaginationShowPage(sXHTMLElementId)
{
var aElement = sXHTMLElementId.split('-');
$('.interfaceMasterSearchPage').hide();
$('#divInterfaceMasterSearch-' + aElement[1]).show();
}
function interfaceMasterActions(aParam)
{
var sXHTMLElementID;
var iObject = giObject;
var iObjectContext = giObjectContext;
var bShowAdd = gbShowAdd;
var iActionType = '';
var oActions = {add: true};
var iContactBusiness;
var iContactPerson;
var sContactBusinessText;
var sContactPersonText;
if (aParam != undefined)
{
if (aParam.object != undefined) {iObject = aParam.object}
if (aParam.objectContext != undefined) {iObjectContext = aParam.objectContext}
if (aParam.objectName != undefined) {sObjectName = aParam.objectName}
if (aParam.showAdd != undefined) {bShowAdd = aParam.showAdd}
if (aParam.actionType != undefined ) {iActionType = aParam.actionType}
if (aParam.xhtmlElementID != undefined ) {sXHTMLElementID = aParam.xhtmlElementID}
if (aParam.actions != undefined) {oActions = aParam.actions}
if (aParam.contactBusiness != undefined) {iContactBusiness = aParam.contactBusiness}
if (aParam.contactPerson != undefined) {iContactPerson = aParam.contactPerson}
if (aParam.contactBusinessText != undefined) {sContactBusinessText = aParam.contactBusinessText}
if (aParam.contactPersonText != undefined) {sContactPersonText = aParam.contactPersonText}
}
else
{
aParam = {};
}
if (oActions.add)
{
var aHTML = [];
var h = -1;
aHTML[++h] = '' +
'' +
'' +
gsLoadingXHTML +
' | ' +
'' +
' | ' +
'
' +
'
';
$('#' + sXHTMLElementID).html(aHTML.join(''));
var aHTML = [];
var h = -1;
aHTML[++h] = '';
aHTML[++h] = '' +
'Add' +
' |
';
aHTML[++h] = '
';
$('#tdInterfaceMainActionsColumn2').html(aHTML.join(''));
aParam.xhtmlElementID = 'spanInterfaceMainActionsAdd';
aParam.offsetHeight = -30;
aParam.offsetLeft = -305;
$('#spanInterfaceMainActionsAdd').button(
{
label: "Add"
})
.click(function() {
interfaceActionMasterViewport({
showHome: false,
showNew: true,
contactPerson: iContactPerson,
contactBusiness: iContactBusiness,
contactPersonText: sContactPersonText,
contactBusinessText: sContactBusinessText
})
})
sXHTMLElementID = 'tdInterfaceMainActionsColumn1';
}
if (iObjectContext != -1)
{
var sParam = 'method=ACTION_SEARCH&lastfirst=1' +
'&object=' + iObject +
'&objectcontext=' + iObjectContext +
'&type=' + iActionType +
'&contactbusiness=' + iContactBusiness +
'&contactperson=' + iContactPerson;
$.ajax(
{
type: 'GET',
url: '/ondemand/action/?rf=XML&rows=' + giReturnRows + '&' + sParam,
dataType: 'xml',
success: function(data) {interfaceMasterActionsShow(data, sXHTMLElementID, aParam)}
});
/* var oSearch = new AdvancedSearch();
oSearch.endPoint = 'action';
oSearch.method = 'ACTION_SEARCH';
oSearch.addField('actionreference,duedate');
oSearch.rf = 'xml';
oSearch.rows = 50;
oSearch.sort('modifieddate', 'desc');
oSearch.getResults(function(data) {interfaceMasterActionsShow(data, sXHTMLElementID)});*/
}
}
function interfaceMasterActionsShow(oXML, sXHTMLElementID, aParam)
{
var aHTML = [];
var h = -1;
var bDescription = false;
oRoot = oXML.getElementsByTagName("ondemand").item(0);
if (oRoot.childNodes.length == 0)
{
aHTML[++h] = '';
aHTML[++h] = ''
aHTML[++h] = '';
aHTML[++h] = 'No actions. | ';
aHTML[++h] = '
';
$('#' + sXHTMLElementID).html(aHTML.join(''));
$('#' + sXHTMLElementID).show(giShowSpeed);
}
else
{
aHTML[++h] = '';
aHTML[++h] = ''
aHTML[++h] = '';
aHTML[++h] = 'Subject | ';
aHTML[++h] = 'Date | ';
if (bDescription)
{
aHTML[++h] = 'Description | ';
}
aHTML[++h] = ' | ';
aHTML[++h] = '
';
for (var iRow = 0; iRow < oRoot.childNodes.length; iRow++)
{
var oRow = oRoot.childNodes.item(iRow);
aHTML[++h] = '';
aHTML[++h] = '' +
onDemandXMLGetData(oRow, "subject") + ' | ';
aHTML[++h] = '' +
onDemandXMLGetData(oRow, "actiondate") + ' | ';
if (bDescription)
{
aHTML[++h] = '' +
onDemandXMLGetData(oRow, "description") + ' | ';
}
aHTML[++h] = ' | ';
aHTML[++h] = '
'
}
aHTML[++h] = '
';
interfaceMasterPaginationList(
{
xhtmlElementID: sXHTMLElementID,
xhtmlContext: 'Action',
xhtml: aHTML.join(''),
showMore: ($(oRoot).attr('morerows') == "true"),
columns: 'subject-actiondate',
more: $(oRoot).attr('moreid'),
rows: giReturnRows,
functionSearch: interfaceMasterActions,
functionOpen: "interfaceActionMasterViewport({showHome: false});interfaceActionSearch(this.id)"
});
$('.interfaceMainRowOptionsSelect').button( {
text: false,
icons: {
primary: "ui-icon-play"
}
})
.click(function() {
interfaceActionMasterViewport({showHome: false});
interfaceActionSearch(this.id)
})
.css('width', '15px')
.css('height', '20px')
}
}
function interfaceMasterConfirm(aParam)
{
var aHTML = [];
var sTitle = '';
if (aParam != undefined)
{
if (aParam.html != undefined) {aHTML = aParam.html}
if (aParam.title != undefined) {sTitle = aParam.title}
}
$('#divInterfaceDialog').html(aHTML.join(''));
// width: 300,
$('#divInterfaceDialog').dialog(
{
resizable: false,
modal: true,
title: sTitle,
buttons:
{
"Ok": function()
{
$( this ).dialog( "close" );
}
}
});
}
function interfaceMasterActionAddShow(aParam, oXML)
{
var iActionID = -1;
var dStartDate = new Date();
var dEndDate = dStartDate;
var sXHTMLElementID = 'spanInterfaceMainActionsAdd';
var iOffsetHeight = 5;
var iOffsetLeft = 0;
if (aParam != undefined)
{
if (aParam.actionID != undefined) {iActionID = aParam.actionID};
if (aParam.startDate != undefined) {dStartDate = aParam.startDate};
if (aParam.endDate != undefined) {dEndDate = aParam.endDate};
if (aParam.xhtmlElementID != undefined) {sXHTMLElementID = aParam.xhtmlElementID};
if (aParam.offsetHeight != undefined) {iOffsetHeight = aParam.offsetHeight};
if (aParam.offsetLeft != undefined) {iOffsetLeft = aParam.offsetLeft};
}
if ($('#divInterfaceMasterDialog').attr('onDemandSource') == sXHTMLElementID)
{
$('#divInterfaceMasterDialog').hide("slide", { direction: "right" }, 500);
$('#divInterfaceMasterDialog').attr('onDemandSource', '');
}
else
{
$('#divInterfaceMasterDialog').attr('onDemandSource', sXHTMLElementID);
if (iActionID != -1 && oXML == undefined)
{
sParam = 'method=ACTION_SEARCH&rf=XML&contactperson=ALL&select=' + iActionID;
$.ajax(
{
type: 'GET',
url: '/directory/ondemand/object.asp?' + sParam,
dataType: 'xml',
success: function(data) {interfaceMasterActionAddShow(aParam, data)}
});
}
else
{
var aHTML = [];
var h = -1;
aHTML[++h] = '';
var oElement = $('#' + sXHTMLElementID)
$('#divInterfaceMasterDialog').html('');
$('#divInterfaceMasterDialog').show();
$('#divInterfaceMasterDialog').offset(
{
top: $(oElement).offset().top + $(oElement).height() + iOffsetHeight,
left: $(oElement).offset().left + iOffsetLeft
});
$('#divInterfaceMasterDialog').html(aHTML.join(''));
$('#spanCancel').button(
{
text: false,
icons: {
primary: "ui-icon-close"
}
})
.click(function() {
$('#divInterfaceMasterDialog').slideUp(500);
$('#divInterfaceMasterDialog').html('');
})
.css('width', '20px')
.css('height', '20px')
$('#spanSave').button(
{
text: false,
icons: {
primary: "ui-icon-check"
}
})
.click(function() {
interfaceActionQuickSave({
id: iActionID,
date: $.fullCalendar.formatDate(dStartDate, "dd MMM yyyy") +
' ' + $.fullCalendar.formatDate(dStartDate, "HH:mm"),
endDate: $.fullCalendar.formatDate(dEndDate, "dd MMM yyyy") +
' ' + $.fullCalendar.formatDate(dEndDate, "HH:mm"),
subject: $('#inputActionCalendarAddSubject').val(),
description: $('#inputActionCalendarAddDescription').val(),
priority: ($('#inputActionCalendarAddHighPriority').attr('checked')?3:2),
calendarXHTMLElementID: 'divInterfaceMainCalendar'
});
$('#divInterfaceMasterDialog').slideUp(500);
$('#divInterfaceMasterDialog').html('');
})
.css('width', '30px')
.css('height', '20px')
if (oXML != undefined)
{
var oRoot = oXML.getElementsByTagName('ondemand').item(0);
if (oRoot.childNodes.length != 0)
{
var oRow = oRoot.childNodes.item(0);
$('#inputActionCalendarAddSubject').val(onDemandXMLGetData(oRow, 'subject'));
$('#inputActionCalendarAddDescription').val(onDemandXMLGetData(oRow, 'description'));
//$('#inputInterfaceMainDetailsStatus').attr("onDemandID", onDemandXMLGetData(oRow, 'customerstatus'));
//$('#inputInterfaceMainDetailsStatus').val(onDemandXMLGetData(oRow, 'customerstatustext'));
}
}
}
}
}
function interfaceMasterFormatXHTML(sXHTML)
{
var sTmp = sXHTML;
sTmp = sTmp.replace(/&/g, '&')
sTmp = sTmp.replace(/</g, '<')
sTmp = sTmp.replace(/>/g, '>')
sTmp = sTmp.replace(/-/g, '-')
sTmp = sTmp.replace(/@/g, '@')
sTmp = sTmp.replace(///g, '/')
sTmp = sTmp.replace(/"/g, '"')
sTmp = sTmp.replace(/'/g, '\'')
return sTmp
}
function interfaceMasterViewportActionShow(oElement, sActionXHTML, sFunctionActionBind)
{
var aHTML = [];
var h = -1;
if ($('#divInterfaceMasterViewportControlOptions').attr('onDemandSource') == oElement.id)
{
$('#divInterfaceMasterViewportControlOptions').hide(giHideSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', '');
}
else
{
if (gsViewportMasterControlXHTML == '')
{
gsViewportMasterControlXHTML = interfaceControlOptions();
}
$('#divInterfaceMasterViewportControlOptions').attr('onDemandSource', oElement.id);
$('#divInterfaceMasterViewportControlOptions').html(" ");
$('#divInterfaceMasterViewportControlOptions').show(giShowSpeedOptions);
$('#divInterfaceMasterViewportControlOptions').offset({ top: $(oElement).offset().top + $(oElement).height(), left: $(oElement).offset().left });
$('#divInterfaceMasterViewportControlOptions').html(sActionXHTML);
if (sFunctionActionBind != undefined)
{eval(sFunctionActionBind)}
}
}
function interfaceMasterPaginationList(aParam)
{
var aHTML = [];
var h = -1;
var sXHTMLElementID;
var sHTML = '';
var bMore = false;
var iMore;
var iStartRow = 0;
var iRows = 30;
var bShowList = true;
var sXHTMLContext = '';
if (aParam != undefined)
{
if (aParam.xhtml != undefined) {sHTML = aParam.xhtml}
if (aParam.showMore != undefined) {bMore = aParam.showMore}
if (aParam.more != undefined) {iMore = aParam.more}
if (aParam.startRow != undefined) {iStartRow = aParam.startRow}
if (aParam.rows != undefined) {iRows = aParam.rows}
if (aParam.showList != undefined) {bShowList = aParam.showList}
if (aParam.xhtmlElementID != undefined) {sXHTMLElementID = aParam.xhtmlElementID}
if (aParam.xhtmlContext != undefined) {sXHTMLContext = aParam.xhtmlContext}
}
aParam.xhtmlFirstRow = $('tr:first', sHTML).html();
if (bMore)
{
aHTML[++h] = '';
aHTML[++h] = '';
aHTML[++h] = '';
aHTML[++h] = ' |
';
}
aHTML[++h] = '';
$('#' + sXHTMLElementID).html(aHTML.join(''));
if (bShowList) {$('#' + sXHTMLElementID).show(giShowSpeed)};
if (bMore)
{
var sHTML = '';
$('#td' + sXHTMLContext + 'InterfaceMasterPaginationList-' + (iStartRow)).after(sHTML);
$('#td' + sXHTMLContext + 'InterfaceMasterPaginationList-' + (iStartRow + iRows - 1)).click(function(event)
{
var sID = event.target.id;
var sStart = $('#' + sID).attr('rowStart');
$('#' + sID).html(gsLoadingSmallXHTML);
if (aParam != undefined) {aParam.more = iMore;aParam.startRow = sStart}else{aParam = {more: iMore, startRow: sStart}};
interfaceMasterPaginationListShowMore(aParam);
});
}
$('.interfaceMasterPaginationListPage' + sXHTMLContext).click(function(event)
{
interfaceMasterPaginationListShowPage(this.id, sXHTMLContext);
});
}
function interfaceMasterPaginationListShowMore(aParam, oData)
{
var sXHTMLElementId = '';
var iMore = -1;
var iStartRow = 10;
var iRows = 10;
var iColumn = 0;
var iMaximumColumns = 1;
var sColumns = "title";
var sIDColumns = '';
var sFunctionOpen;
var fFunctionClass;
var sFunctionNewPage;
var sClass;
var sIdAdditional = '';
var sIDSeperator = '-';
var sBodyClass = '';
var sXHTMLlFirstRow;
var sXHTMLContext = '';
var fFunctionShowRow;
var sType = 'XML';
if (aParam != undefined)
{
if (aParam.more != undefined) {iMore = aParam.more}
if (aParam.startRow != undefined) {iStartRow = aParam.startRow}
if (aParam.rows != undefined) {iRows = aParam.rows}
if (aParam.xhtmlElementId != undefined) {sXHTMLElementId = aParam.xhtmlElementId}
if (aParam.columns != undefined) {sColumns = aParam.columns}
if (aParam.idColumns != undefined) {sIDColumns = aParam.idColumns}
if (aParam.functionOpen != undefined) {sFunctionOpen = aParam.functionOpen}
if (aParam.functionClass != undefined) {fFunctionClass = aParam.functionClass}
if (aParam.functionShowRow != undefined) {fFunctionShowRow = aParam.functionShowRow}
if (aParam.idAdditional != undefined) {sIdAdditional = aParam.idAdditional}
if (aParam.bodyClass != undefined) {sBodyClass = aParam.bodyClass}
if (aParam.idSeperator != undefined) {sIDSeperator = aParam.idSeperator}
if (aParam.xhtmlFirstRow != undefined) {sXHTMLlFirstRow = aParam.xhtmlFirstRow}
if (aParam.functionNewPage != undefined) {sFunctionNewPage = aParam.functionNewPage}
if (aParam.xhtmlContext != undefined) {sXHTMLContext = aParam.xhtmlContext}
if (aParam.type != undefined) {sType = aParam.type}
}
sType = sType.toUpperCase();
if (iMore == -1)
{
alert('No more!')
}
else
{
if (oData == undefined)
{
var sParam = 'method=CORE_SEARCH_MORE';
var sData = 'id=' + iMore +
'&startrow=' + iStartRow +
'&rows=' + iRows;
$.ajax(
{
type: 'GET',
url: '/ondemand/core/core.asp?rf=' + sType + '&' + sParam,
data: sData,
dataType: sType.toLowerCase(),
success: function(data){interfaceMasterPaginationListShowMore(aParam, data)}
});
}
else
{
var aHTML = [];
var h = -1;
if ($('#div' + sXHTMLContext + 'InterfaceMasterPaginationList-' + iStartRow).length == 0)
{
aHTML[++h] = '';
$('.interfaceMasterPaginationListPage' + sXHTMLContext).hide();
$('.interfaceMasterPaginationListPage' + sXHTMLContext + ':last').after(aHTML.join(''));
$('.interfaceMainRowOptionsSelect' + sXHTMLContext).unbind('click');
if (sFunctionOpen != undefined)
{
$('.interfaceMainRowOptionsSelect' + sXHTMLContext).button({
text: false,
icons: {
primary: "ui-icon-play"
}
})
.click(function() {
eval(sFunctionOpen);
})
.css('width', '15px')
.css('height', '20px')
}
$('#td' + sXHTMLContext + 'InterfaceMasterPaginationList-' + iStartRow).html(((iStartRow+1)/iRows)+1);
$('td.interfaceMasterPaginationList' + sXHTMLContext).unbind('click');
$('td.interfaceMasterPaginationList' + sXHTMLContext).click(function(event)
{
interfaceMasterPaginationListShowPage(this.id, sXHTMLContext);
});
if (bMoreRows)
{
var sHTML = '';
$('#td' + sXHTMLContext + 'InterfaceMasterPaginationList-' + iStartRow).after(sHTML);
$('#td' + sXHTMLContext + 'InterfaceMasterPaginationList-' + (iStartRow + iRows)).click(function(event)
{
var sID = event.target.id;
var sStart = $('#' + sID).attr('rowStart')
$('#' + sID).html(gsLoadingSmallXHTML);
(aParam != undefined?aParam.more = iMore:aParam = {more: iMore, startRow: sStart})
interfaceMasterPaginationListShowMore(aParam);
});
}
if (sFunctionNewPage != undefined)
{
eval(sFunctionNewPage);
}
}
}
}
}
function interfaceMasterPaginationListShowPage(sXHTMLElementId, sXHTMLContext)
{
var aElement = sXHTMLElementId.split('-');
$('.interfaceMasterPaginationListPage' + sXHTMLContext).hide();
$('#div' + sXHTMLContext + 'InterfaceMasterPaginationList-' + aElement[1]).show();
}