<% /*
    $Revision$
    $Id$

    File:           model_cad_label.inc

    Description:    Vanuit CodeCharge gegenereerd model voor cad_label

    Context:

    Notes:
*/
%>
<%

function model_cad_label()
{
    this.records_name = "graphiclabels";
    this.record_name = "graphiclabel";
    this.table = "cad_label";
    this.primary = "cad_label_key";
    this.autfunction = "WEB_CADMGT";
    this.record_title = L("cad_label");
    this.records_title = L("cad_label_m");


    this.fields = {
        "id": {
            "dbs": "cad_label_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "cad_s_cad_label_key"
        },
        "name": {
            "dbs": "cad_label_omschrijving",
            "label": L("cad_label_omschrijving"),
            "typ": "varchar",
            "required": true,
            "translate": true
        },
        "viewname": {
            "dbs": "cad_label_view",
            "label": L("cad_label_view"),
            "typ": "varchar",
            "required": true,
            "filter": "like"
        },
        "description": {
            "dbs": "cad_label_opmerking",
            "label": L("cad_label_opmerking"),
            "typ": "memo",
            "translate": true,
            "filter": "like"
        },
        "size": {
            "dbs": "cad_label_size",
            "label": L("cad_label_size"),
            "typ": "number",
            "defaultvalue": "800",
            "multiedit": true
        },
        "rotation": {
            "dbs": "cad_label_rotation",
            "label": L("cad_label_rotation"),
            "typ": "number",
            "defaultvalue": "0",
            "multiedit": true
        },
        "visible": {
            "dbs": "cad_label_visible",
            "label": L("cad_label_visible"),
            "typ": "check0",
            "defaultvalue": 1,
            "multiedit": true
        },
        "authorization": {
            "dbs": "fac_functie_key",
            "label": L("fac_functie_key"),
            "typ": "key",
            "foreign": "fac_functie",
            "LOVinit": "",
            "multiedit": true
        },
        "labeltype": {
            "dbs": "cad_label_type",
            "label": L("cad_label_type"),
            "typ": "number",
            "defaultvalue": 1,
            "bits": [
                {
                    "name": "waar",
                    "label": L("cad_label_type_waar"),
                    "typ": "radio",
                    "mask": 27,
                    "radios": [
                        {
                            "mask": 1,
                            "label": L("cad_label_type_bi_rui")
                        },
                        {
                            "mask": 9,
                            "label": L("cad_label_type_bi_wp")
                        },
                        {
                            "mask": 17,
                            "label": L("cad_label_type_bi_obj")
                        },
                        {
                            "mask": 2,
                            "label": L("cad_label_type_bu_ts")
                        },
                        {
                            "mask": 18,
                            "label": L("cad_label_type_bu_obj")
                        }
                    ]
                },
                {
                    "name": "situatie",
                    "label": L("cad_label_type_situatie"),
                    "typ": "radio",
                    "mask": 4,
                    "radios": [
                        {
                            "mask": 0,
                            "label": L("cad_label_type_si_act")
                        },
                        {
                            "mask": 4,
                            "label": L("cad_label_type_si_sce")
                        }
                    ]
                }
            ]
        }
    };


    this.hook_pre_edit = function (obj, fld)
    {
        var labeltype = obj.labeltype;
        var situatie = (labeltype & 4 ? "scenario" : "actueel");

    %>
    <script type="text/javascript">
      var module = "CAD";
    </script>
    <%
    }


    var ext_sql = "(SELECT BITAND(cad_label_type, 27) waar"
                + "      , BITAND(cad_label_type,  4) situatie"
                + "      , cad_label_key"
                + "   FROM cad_label) plaats ";


    this.REST_GET    = generic_REST_GET(this, {
        "GET": {
            "tables": [ext_sql],
            "wheres": ["cad_label.cad_label_key = plaats.cad_label_key"]
        }
    });
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);
}
%>