{
    "type": "Ext.app.Controller",
    "reference": {
        "name": "items",
        "type": "array"
    },
    "codeClass": null,
    "userConfig": {
        "designer|userClassName": "control"
    },
    "designerId": "c0576711-93b6-460a-8840-b5cd01acc05c",
    "cn": [
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "controlSearchTriggerField",
                "selector": "#controlSearchTriggerField"
            },
            "designerId": "7d2978b7-fa6e-4c64-b317-bf23a319b291"
        },
        {
            "type": "fixedfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "application"
                ],
                "fn": "init",
                "implHandler": [
                    "this.control({\r",
                    "\t'#controlSearchTriggerField' : {\r",
                    "\t\tspecialkey: function(field, e) {\r",
                    "\t\t\tif (e.getKey() == e.ENTER)\r",
                    "\t\t\t\tthis.filterControlSearch();\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#controlGrid':{\r",
                    "\t\tselectionchange:function(component, selection){\r",
                    "\t\t\tif(selection.length > 0)\r",
                    "\t\t\t\tthis.selectionChanged(selection[0]);\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#downloadControlBtn':{\r",
                    "\t\tclick: function(btn){\r",
                    "\t\t\tthis.download('control_pdf');\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#downloadDefinitionBtn':{\r",
                    "\t\tclick: function(btn){\r",
                    "\t\t\tthis.download('definition_pdf');\r",
                    "\t\t}\r",
                    "\t},\r",
                    "\t'#downloadControlxlsxBtn':{\r",
                    "\t\tclick: function(btn){\r",
                    "\t\t\tthis.download('control_with_check');\r",
                    "\t\t}\r",
                    "\t}\r",
                    "});"
                ]
            },
            "designerId": "a9a46572-91ff-4013-b35d-2b6f938a632e"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "fn": "filterControlSearch",
                "implHandler": [
                    "var filter = Ext.util.Format.trim(this.getControlSearchTriggerField().getValue());\r",
                    "this.getControlGrid().getStore().proxy.extraParams.query = filter;\r",
                    "this.getControlGrid().getStore().load({\r",
                    "\tcallback: function() {\r",
                    "\t\tthis.getControlSearchTriggerField().focus();\r",
                    "\t},\r",
                    "\tscope: this\r",
                    "});"
                ]
            },
            "designerId": "b3c648c0-02f0-4503-93e0-bf7cdd10ec8e"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "controlGrid",
                "selector": "#controlGrid"
            },
            "designerId": "acaf3e0e-bcb8-40ff-94f8-d0983445e553"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "selected"
                ],
                "fn": "selectionChanged",
                "implHandler": [
                    "this.showDetails(selected);\r",
                    "\r",
                    "this.getDownloadDefinitionBtn().enable();\r",
                    "this.getDownloadControlBtn().enable();\r",
                    ""
                ]
            },
            "designerId": "39a34c2c-3197-4c2e-be9c-442c317287ca"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "type"
                ],
                "fn": "download",
                "implHandler": [
                    "var controlid = 0;\r",
                    "if(this.getControlGrid().getSelectionModel().selected.getAt(0)){\r",
                    "var controlid = this.getControlGrid().getSelectionModel().selected.getAt(0).get('id');\r",
                    "}\r",
                    "\r",
                    "var iframe = document.getElementById(\"hiddenIFrameCurrent\"+controlid);\r",
                    "if(iframe === null) {\r",
                    "    iframe = document.createElement('iframe');\r",
                    "    iframe.id = \"hiddenIFrameCurrent\"+controlid;\r",
                    "    iframe.style.display = 'none';\r",
                    "    document.body.appendChild(iframe);\r",
                    "}\r",
                    "iframe.src = '../../service/download.php' + document.location.search + '&type='+type+'&controlid='+controlid;"
                ]
            },
            "designerId": "8ffe09f5-0bef-4e47-a2a7-2a8ab276e8c6"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "downloadDefinitionBtn",
                "selector": "#downloadDefinitionBtn"
            },
            "designerId": "920c068d-054e-40d0-af91-46c2d9efd700"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "downloadControlBtn",
                "selector": "#downloadControlBtn"
            },
            "designerId": "3194784f-a7d1-4c1b-b386-9ca68ab98282"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "downloadControlxlsxBtn",
                "selector": "#downloadControlxlsxBtn"
            },
            "designerId": "c5adedba-2429-4aed-95b9-1d500ac59627"
        },
        {
            "type": "basicfunction",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "designer|params": [
                    "record"
                ],
                "fn": "showDetails",
                "implHandler": [
                    "var url = \"../display_details/display_details.php\";\r",
                    "\r",
                    "var params = Ext.Object.fromQueryString(document.location.search);\r",
                    "params.id = record.get('id');\r",
                    "params.type = 'control';\r",
                    "\r",
                    "var par = Ext.Object.toQueryString(params);\r",
                    "\r",
                    "this.getDetailsContainer().update('<iframe src=\"'+url+\"?\"+par+'\" width=\"100%\" height=\"100%\" frameborder=\"0\" style=\"border-color: white;\"></iframe>');\r",
                    ""
                ]
            },
            "designerId": "abb0503e-47f8-4efc-b32d-5fdb3fc805a0"
        },
        {
            "type": "controllerref",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "ref": "detailsContainer",
                "selector": "#detailsContainer"
            },
            "designerId": "123163e9-e715-43df-8f9b-9fb76abebb22"
        }
    ]
}