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

    File:           mrk_show_bericht.asp
    Description:    Show scherm voor marktplaats berichten
    Parameters:     mrk_key

    Context:
    Note:
*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/kenmerk_common.inc" -->
<!-- #include file="../Shared/persoonselector.inc" -->
<!-- #include file="mrk.inc" -->

<%
FCLTHeader.Requires({ plugins: ["suggest", "jQuery"],
                      js: ["date.js", "../MRK/mrk_show_bericht.js", "num2curr.js"]
                    });

var urole = getQParamSafe("urole");

// Om nog even compatible te blijven zodat alles nog even blijft werken. Moet er straks uit, natuurlijk.
var fronto = urole == "fo";
var backo  = urole == "bo";
var minfo  = urole == "mi";
var frontend = (!fronto & !backo & !minfo);

var mrk_key = getQParamInt("mrk_key");

var mrk_bericht = mrk.bericht_info(mrk_key); // Globale variabele met alle mrk_bericht informatie

var this_mrk = mrk.func_enabled_mrkbericht(mrk_key); // Wat heb ik zoal aan rechten
user.auth_required_or_abort(this_mrk.canReadAny);
%>

<html>
  <head>
<%
    FCLTHeader.Generate();
%>
    <script  type="text/javascript" >
      var mrk_key = <%=mrk_key%>;
      var urole = "<%=urole%>";

      jQuery(document).ready(function()
                             {
                               $('textarea').autogrow();
                               FcltMgr.resized(window);
                             });
    </script>
  </head>


  <body id="showbody">
<%  var buttons = [];
    if (this_mrk.canChange)
      buttons.push({title: L("lcl_change"),  icon: "wijzigen.png", action:"mrk_change()" });

    if (this_mrk.canDelete)
      buttons.push({title: L("lcl_delete"),  icon: "delete.png",  action:"mrk_delete()"});

    buttons.push({ icon: "print.png", title: L("lcl_print"),          action: 'mrk_print()' });

    IFRAMER_HEADER(L("lcl_mrk_frame_algemeen"), buttons);
%>
    <div id="show">
      <form name="u2" onSubmit="return false;">
<%
        BLOCK_START("mrkInfo", L("lcl_mrk_marktplaats_bericht") + " " + mrk_key);
        ROFIELDTR("fld", L("lcl_mrk_categorie"), mrk_bericht.categorie != null? mrk_bericht.categorie : ""); // Categorie (Discipline)
        ROFIELDTR("fld", L("lcl_mrk_onderwerp"), mrk_bericht.onderwerp != null? mrk_bericht.onderwerp : ""); // Onderwerp (Titel)
        // Adverteerder (prs_perslid)
        FCLTpersoonselector("person",
                            "sgPerson",
                            { perslidKey: mrk_bericht.adverteerder_key,
                              label: L("lcl_mrk_adverteerder"),
                              moreinfo: true,
                              readonly: true
                            });
        ROFIELDTR("fldmrkprijs", L("lcl_mrk_prijs") + " " + S("currency_pref").replace(" ", "") + S("currency_suff").replace(" ", ""), safe.curr(mrk_bericht && mrk_bericht.prijs? mrk_bericht.prijs : "0")); // Prijs

        // Opmerking
        ROTEXTAREATR("fldtxt",
                     L("lcl_txt"),
                     (this_mrk != -1)? mrk_bericht.omschrijving : "",
                     {id: "omschrijving"});
        BLOCK_END();

        var vSubFolder = subfolderKey("M", mrk_key);
        var vAttachPath = mrk.bericht_attachPath(vSubFolder);
        var vBestandnaam = mrk.bericht_foto(vAttachPath);

        if (vBestandnaam != "")
        { // Foto upload
            BLOCK_START("mrkFoto", L("lcl_image"));
                var imagePathFile = mrk.bericht_imageFile(vSubFolder, vBestandnaam);
                %><tr><td class='label'><label><%=L("lcl_mrk_foto")%></label></td>
                      <td><img title='<%=safe.htmlattr(vBestandnaam)%>'
                               onclick='window.open("<%=safe.jsstring(imagePathFile)%>")'
                               class='photo' src='<%=safe.htmlattr(imagePathFile)%>'></td>
                  </tr>
                <%
            BLOCK_END();
        }
%>
      </form>
    </div>
  </body>
</html>
