191 lines
7.9 KiB
Plaintext
191 lines
7.9 KiB
Plaintext
<%@language = "javascript" %>
|
|
<% /*
|
|
$Revision: 2 $
|
|
$Modtime: 22-11-10 10:49 $
|
|
|
|
File: phonebook_js.asp
|
|
Description: Phonebook API
|
|
Levert een JavaScript bestand op.
|
|
Parameters:
|
|
Context:
|
|
Note:
|
|
*/
|
|
|
|
DOCTYPE_Disable = 1;
|
|
|
|
%>
|
|
<!-- #include file="../../cust/install.inc"-->
|
|
<!-- #include file="../shared/check_sso.inc"-->
|
|
<!--#include file="../api/api.inc" -->
|
|
|
|
<%
|
|
var APIname = getQParam("API");
|
|
var APIKEY = getQParam("APIKEY");
|
|
var API = new API_func(APIname, APIKEY);
|
|
|
|
var transitParam = "&fac_id="+Session("customerId"); //+buildTransitParam(["API", "APIKEY"]);
|
|
|
|
var proto = (Request.ServerVariables("SERVER_PORT") == "443")?"https":"http";
|
|
var sitenoroot = proto + "://" + Request.ServerVariables("SERVER_NAME");
|
|
var site = sitenoroot + rooturl;
|
|
%>
|
|
|
|
window.facilitor = window.facilitor || {};
|
|
facilitor.phonebook = facilitor.phonebook || {};
|
|
function setLCL(data) {
|
|
window.LCL.shared = data;
|
|
}
|
|
(function() {
|
|
|
|
function getScript(src) {
|
|
document.write('<' + 'script src="<%=site%>/' + src + '"' +
|
|
' type="text/javascript"><' + '/script>');
|
|
}
|
|
|
|
function getCSS(src) {
|
|
document.write('<' + 'link rel="stylesheet" href="<%=site%>/' + src + '"' +
|
|
' type="text/css">');
|
|
}
|
|
|
|
var loadScriptTime = (new Date).getTime();
|
|
getCSS("appl/localscripts/theme/jquery-ui.css");
|
|
//getCSS("appl/shared/default.css");
|
|
getCSS("appl/shared/suggest/suggest.css");
|
|
getCSS("cust/<%=Session("customerID")%>/cust.css");
|
|
|
|
//getScript("appl/localscripts/jquery.js");
|
|
getScript("appl/localscripts/jquery-1.3.2.min.js");
|
|
getScript("appl/localscripts/fcltmgr.js");
|
|
getScript("appl/localscripts/fcltjquery.js");
|
|
getScript("appl/shared/suggest/suggest.js");
|
|
window.LCL = {};
|
|
getScript("appl/shared/load_lcl.asp?module=" + "shared&callback=setLCL<%=transitParam%>");
|
|
//getScript("appl/api/phonebook.js");
|
|
|
|
window.facilitor.open_phonebook = function(key, naam)
|
|
{
|
|
if (key > 0)
|
|
jQuery.ajax({ type: "GET",
|
|
url: "<%=site%>/appl/api/get_phonebook_info.asp?req_info=prs_perslid&prs_perslid_key=" + key + "<%=transitParam%>",
|
|
dataType: "jsonp",
|
|
success: window.facilitor.show_phonebook
|
|
});
|
|
else
|
|
$("#phonebookdetails").hide()
|
|
}
|
|
|
|
window.facilitor.phonebook_options =
|
|
{ detailWidth : 350,
|
|
toonWerkplekken: true,
|
|
toonFoto: true,
|
|
detailurl: "appl/fac/fac_user_info.asp"
|
|
};
|
|
<%
|
|
for (opt in API.apidata.options)
|
|
{
|
|
if (typeof API.apidata.options[opt] == "string")
|
|
Response.Write("\nwindow.facilitor.phonebook_options['"+opt+"'] = '" + safe.jsstring(API.apidata.options[opt]) + "';");
|
|
else if (typeof API.apidata.options[opt] == "number")
|
|
Response.Write("\nwindow.facilitor.phonebook_options['"+opt+"'] = " + safe.jsfloat(API.apidata.options[opt]) + ";");
|
|
else if (typeof API.apidata.options[opt] == "boolean")
|
|
Response.Write("\nwindow.facilitor.phonebook_options['"+opt+"'] = " + (API.apidata.options[opt]?"true":"false") + ";");
|
|
}
|
|
%>
|
|
|
|
window.facilitor.show_phonebook = function(data, textStatus)
|
|
{
|
|
// Alle styling moet nog via classes
|
|
var closer = "<span onclick='$(\"#phonebookdetails\").hide()' style='float: right; cursor: hand' title='<%=lcl_close_window%>'>x</span>"
|
|
if (window.facilitor.phonebook_options.detailurl)
|
|
{
|
|
var jumpto = window.facilitor.phonebook_options.detailurl;
|
|
jumpto += (jumpto.indexOf("?")>=0)?"&":"?";
|
|
jumpto += "prs_key="+data.prs_perslid_key;
|
|
var link = "<%=site%>/?nomenu=1&noheader=1&ihatetabs=1&JumpTo="+escape(jumpto) + "<%=transitParam%>";
|
|
var ahref = "<a style='color: #0066FF' href='"+link+"' target='_new'>"+data.naam+"</a>"
|
|
}
|
|
else
|
|
ahref=date.naam;
|
|
var trh = "<tr><th colspan='2' style='text-align:left;'>"+ahref+"</a></th><th></th></tr>"
|
|
|
|
var trs = "";//"<tr><td>Naam:</td><td>" + data.naam + "</td></tr>";
|
|
if (window.facilitor.phonebook_options.toonFoto && data.photopath)
|
|
{
|
|
trs += "<tr><td></td><td></td><td rowspan='50'><img src='<%=sitenoroot%>" + data.photopaththumb +"'></td></tr>";
|
|
}
|
|
if (data.prs_perslid_telefoonnr) trs += "<tr><td>Telefoon:</td><td>" + data.prs_perslid_telefoonnr + "</td></tr>";
|
|
if (data.prs_perslid_email) trs += "<tr><td>E-mail:</td><td><a href='mailto:" + data.prs_perslid_email + "'>"+data.prs_perslid_email+"</a></td></tr>";
|
|
if (data.afdeling) trs += "<tr><td>Afdeling:</td><td>" + data.afdeling + "</td></tr>";
|
|
|
|
if (window.facilitor.phonebook_options.toonWerkplekken && data.werkplekken.length)
|
|
{
|
|
var wp;
|
|
var wplabel = "Werkplek:";
|
|
for (wp in data.werkplekken)
|
|
{
|
|
if (!data.werkplekken[wp].prs_werkplek_aanduiding.isVirtueel)
|
|
{
|
|
trs += "<tr><td>"+wplabel+"</td><td>" + data.werkplekken[wp].prs_werkplek_aanduiding + "</td></tr>";
|
|
wplabel = "";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!document.getElementById("phonebookdetails"))
|
|
{
|
|
var dd = document.createElement('div');
|
|
dd.id = "phonebookdetails";
|
|
dd.style.position = "absolute";
|
|
dd.style.top = $("#sName_key_show").position().top+20 + "px";
|
|
dd.style.width = window.facilitor.phonebook_options.detailWidth + "px";
|
|
|
|
var newLeft = $("#sName_key_show").position().left;
|
|
if (newLeft + window.facilitor.phonebook_options.detailWidth > document.body.offsetWidth)
|
|
{ // Wel in beeld houden
|
|
newLeft = document.body.offsetWidth - window.facilitor.phonebook_options.detailWidth
|
|
}
|
|
dd.style.left = newLeft + "px";
|
|
dd.style.backgroundColor = "#fff";
|
|
dd.style.border = "2px solid #FF6600";
|
|
dd.style.padding = "5px";
|
|
document.body.appendChild(dd);
|
|
if (0)$("body").click // even niet, hij is te agressief
|
|
(
|
|
function(e)
|
|
{
|
|
if($(e.target).closest("#phonebookdetails").length==0)
|
|
{
|
|
$("#phonebookdetails").hide();
|
|
}
|
|
}
|
|
);
|
|
}
|
|
var dd = document.getElementById("phonebookdetails");
|
|
dd.innerHTML = ""+closer+"<table width='100%'>"+trh + trs+"</table>";
|
|
dd.style.display = "block";
|
|
|
|
}
|
|
|
|
window.facilitor.phonebook = function (elm, options)
|
|
{
|
|
var opt;
|
|
for (opt in options)
|
|
{
|
|
window.facilitor.phonebook_options[opt] = options[opt];
|
|
}
|
|
$(elm).append('<input id="sName_key_show" sgonChange="window.facilitor.open_phonebook" class="fldpers" value="">')
|
|
$(elm).append('<input type="hidden" id="sName_key" name="sName_key" value="-1">');
|
|
//$(elm).append("<img class='details' src='<%=site%>/appl/Pictures/detail.png' onclick='sgPerson_persoondetails(\"sName_key\")'>");
|
|
|
|
sgPerson = new Suggest({ objectName: "sgPerson",
|
|
queryField: $("#sName_key_show")[0],
|
|
queryUrl: "<%=site%>/appl/shared/suggest/SuggestPerslid.asp?autlevel=-1&filtcode=PHB&perslidKey=-1<%=transitParam%>",
|
|
initKey: -1,
|
|
noJustOne: true,
|
|
keyField: $("#sName_key")[0],
|
|
JSONP: true,
|
|
embedded: true
|
|
});
|
|
};
|
|
})();
|