<%@ language = "JavaScript" %>
<%
 /*
    $Revision$
    $Id$

    File:           get_phonebook_info.asp
    Description:    Ophalen van allerlei info om client-side data te hebben
    Parameters:     req_info:   "prs_perslid"    --> requires "prs_perslid_key"
    Context:
    Note:           LET OP: Alle data is/moet HTML-safe zijn!

*/ %>
<%
var JSON_Result = true;
%>
<!--#include file="../Shared/common.inc"-->
<!--#include file="../Shared/flexfiles.inc"-->
<!--#include file="../prs/prs.inc" -->
<!-- #include file="../api/api.inc" -->

<%
    var API = new API_func();

    var callback;
    if ( S("fac_allow_jsonp") )
        callback =  getQParam("callback", null);

    var req_info = getQParam("req_info");
    switch (req_info)
    {
        case "prs_perslid":
        {
            var prs_perslid_key = getQParamInt("prs_perslid_key");
            result = prs.prs_perslid(prs_perslid_key, { withWP: true, withWL: true, withPhoto: true });
            if (result.prs_afdeling_key) result.afdeling = new Afdeling(result.prs_afdeling_key).naam();
            break;
        }
    }
    var opt;
    for (opt in result)
    {
        if (typeof result[opt] == "string")
            result[opt] = safe.html(result[opt]);
    }
    // denk eraan: custfunc.API_PHONEBOOK moet alles HTML-safe opleveren@
    if (custfunc.API_PHONEBOOK)
    {
        var extra = custfunc.API_PHONEBOOK(prs_perslid_key, result);
        for (opt in extra)
        {
            result[opt] = extra[opt];
        }

    }

    if (callback)
    {
        Response.ContentType = "application/javascript";
        Response.Write(callback + "(" + JSON.stringify(result) + ")");
    }
    else
        Response.Write(JSON.stringify(result));
%>
<% ASPPAGE_END(); %> 
