sync
[Pman.Admin] / Pman.Tab.AdminEnum.bjs
index 9493980..bc8818a 100644 (file)
@@ -7,12 +7,14 @@
  "modOrder" : "500",
  "strings" : {
   "2df80d5febcde0c10a66818488622b7c" : "Pulldown Options",
+  "13348442cc6a27032d2b4aa28b75a5d3" : "Search",
   "d1228f5476d15142b1358ae4b5fa2454" : "Order #",
   "fdff10eac021dfbb69e9c38204237fdc" : "Add new pulldown list",
   "1206eb8aea05be4625371c9c12818785" : "Pulldown",
   "801ab24683a4a8c433c6eb40c48bcd9d" : "Download",
   "7af54708cf5a4286cf0cfa58ff5148a8" : "Internal #",
   "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
+  "1a87a3d29199e3435b8fb314624c008f" : "Merge Option",
   "b48968e1c912da07df5e8d6d246291ec" : "Display Name",
   "510bc6e58593b2b8002c9fe0c21f3fde" : "Displaying core_enum{0} - {1} of {2}",
   "1ba4d808fc7b27a7f60ce2ff75a8af3a" : "No core_enum found",
   "d9ec74f5aa29ceef6bf7b45f7fec5d0f" : "Add Value",
   "b9c49611cfda3259a2b837b39489e650" : "Add Image",
   "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
+  "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
   "49ee3087348e8d44e1feda1917443987" : "Name",
-  "7215ee9c7d9dc229d2921a40e899ec5f" : " "
+  "d41d8cd98f00b204e9800998ecf8427e" : " "
+ },
+ "named_strings" : {
+  "search_fieldLabel" : "13348442cc6a27032d2b4aa28b75a5d3"
  },
  "items" : [
   {
@@ -80,7 +86,7 @@
            },
            "xtype" : "Store",
            "remoteSort" : true,
-           "$ sortInfo" : "{ field : 'etype', direction: 'ASC' }",
+           "$ sortInfo" : "{ field : 'display_name', direction: 'ASC' }",
            "$ xns" : "Roo.data",
            "* prop" : "dataSource",
            "items" : [
        "listeners" : {
         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
        },
-       "region" : "center",
        "fitToframe" : true,
        "background" : false,
+       "region" : "center",
        "title" : "Pulldown Options",
        "xtype" : "GridPanel",
        "$ xns" : "Roo",
           "keypress" : "function (e)\n{\n    if(e.keyCode == 13){\n        _this.grid.footer.onClick('first');\n    }\n}",
           "beforeedit" : "function (e)\n{\n    if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){\n        return false;\n    }\n}",
           "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-          "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        var rec = _this.grid.ds.getAt(rowIndex);\n            \n        if (di == 'active') {\n            \n            rec.set('active', rec.data.active ? 0 : 1);\n            rec.commit();\n            return;\n        }\n        if (di == 'id' ) {\n            rec.set('sel', rec.data.sel ? 0 : 1);\n        }\n         \n\n         \n        \n}",
+          "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        var rec = _this.grid.ds.getAt(rowIndex);\n            \n        if (di == 'active') {\n            \n            rec.set('active', rec.data.active ? 0 : 1);\n            rec.commit();\n            return;\n        }\n        if (di == 'id' ) {\n            \n            if (!e.ctrlKey && !e.shiftKey) { // shift or control not pressed -clear selection.\n            \n                this.dataSource.each(function(rr) {\n                    rr.selected = 0;\n                    rr.set('sel', 0);\n                });\n            }\n            \n            if (this.last_selected && e.shiftKey) {\n                // the highlight all the lines between the one last selected, and this one.\n                var s = this.dataSource.indexOf(this.last_selected);\n                var e = this.dataSource.indexOf(rec);\n                var ss = Math.min(s,e);\n                var ee = Math.max(s,e) +1;\n                for(var i = ss; i < ee; i++) {\n                    var rr = this.dataSource.getAt(i);\n                    rr.selected = 1;\n                    rr.set('sel', 1);\n                }\n                this.last_selected = rec;\n                return;\n\n            }\n            \n            rec.selected = rec.selected ? 0 : 1;\n            this.last_selected = rec.selected ? rec : false;\n            rec.set('sel', rec.data.sel ? 0 : 1);\n        }\n         \n\n         \n        \n}",
           "afteredit" : "function (e)\n{\n   e.record.commit();     \n}"
          },
          "autoExpandColumn" : "display_name",
            "items" : [
             {
              "listeners" : {
-              "|click" : "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    \n    \n    var s =     _this.egrid.getSelectionModel().getSelectedCell();\n    \n\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n    }\n    \n    var d = _this.egrid.dataSource.getAt(s[0]);\n \n\n    var ds = _this.grid.getDataSource();\n\n    var add = ds.reader.newRow({    \n             id: 0, \n             display_name : '', \n             name : '', \n             etype: d.data.name, \n             active: 1, \n             seqid: 0\n      });\n     var r = ds.data.length;\n    ds.insert(r  , add);  \n    _this.grid.startEditing(r, 1); // name... \n}\n"
+              "|click" : "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    \n    \n    var s =     _this.egrid.getSelectionModel().getSelectedCell();\n    \n\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n    }\n    \n    var d = _this.egrid.dataSource.getAt(s[0]);\n \n\n    var ds = _this.grid.getDataSource();\n\n    var add = ds.reader.newRow({    \n             id: 0, \n             display_name : '', \n             name : '', \n             etype: d.data.name, \n             active: 1, \n             seqid: 0\n      });\n\n    ds.insert(0  , add);  \n    \n    _this.grid.startEditing(0, _this.grid.colModel.findColumnIndex('name')); // name... \n}\n"
              },
              "text" : "Add Value",
              "xtype" : "Button",
              "cls" : "x-btn-text-icon",
-             "$ icon" : "baseURL + '/Pman/templates/images/search.gif'",
+             "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
              "$ xns" : "Roo.Toolbar"
             },
             {
              "listeners" : {
-              "|click" : "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    var et = _this.etypeCombo.getValue();\n    \n    if (!et) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n        return;\n    }\n    var sc = _this.grid.getSelectionModel().getSelectedCell();\n    Roo.log(sc);\n    var ds = _this.grid.ds.getAt(sc[0]);\n    if (!ds) {\n        Roo.MessageBox.alert(\"Error\", \"Select enum\");\n        return;\n    }\n    \n    Roo.log(ds);\n    Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){\n        _this.grid.footer.onClick('first');\n    });\n    \n}\n"
+              "|click" : "function()\n{\n    \n    // if we do not have a selected type... - what should we show..?\n    /*\n    var et = _this.etypeCombo.getValue();\n    \n    if (!et) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n        return;\n    }\n    */\n    \n    var sc = _this.egrid.getSelectionModel().getSelectedCell();\n    \n    if (!sc) {\n        Roo.MessageBox.alert(\"Error\", \"Select a pulldown\");\n        return;\n    }\n    \n    var ds = _this.egrid.ds.getAt(sc[0]);\n    \n    if (!ds) {\n        Roo.MessageBox.alert(\"Error\", \"Select enum\");\n        return;\n    }\n    \n    Roo.log(ds);\n    Pman.Dialog.AdminEnumImages.show({onid:ds.data.id}, function(){\n        _this.grid.footer.onClick('first');\n    });\n    \n}\n"
              },
              "text" : "Add Image",
              "xtype" : "Button",
              "xtype" : "Button",
              "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
              "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Fill",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    var ids = [];\n    _this.grid.dataSource.each(function(rr) {\n        if (rr.selected) {\n            ids.push(rr.data.id);\n        }\n    });   \n    if (!ids.length) {\n        Roo.MessageBox.alert(\"Error\", \"Select rows by clicking on the Internal# column\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\", \n        \"Confirm Deletion of selected rows (some rows can not be deleted if they are referenced elsewhere\", \n        function(res) {\n            if(res != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                method : 'POST',\n                url : baseURL + '/Roo/Core_enum',\n                params : {\n                    _delete  : ids.join(',')\n                },\n                success : function() {\n                    _this.grid.footer.onClick('refresh');\n                }\n            });\n        }\n    );\n    \n    \n}\n\n        "
+             },
+             "text" : "Delete",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Separator",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n\n    var s = _this.grid.getSelectionModel().getSelectedCell();\n\n    if (!s.length)  {\n        Roo.MessageBox.alert(\"Error\", \"Select a Row\");\n        return;\n    }\n    \n    var d = _this.grid.ds.getAt(s[0]);\n    console.log(Pman.Dialog);\n    Pman.Dialog.AdminEnumMerge.show(d.data, function() {\n        _this.grid.footer.onClick('refresh');\n    }); \n    \n}\n"
+             },
+             "text" : "Merge Option",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+             "$ xns" : "Roo.Toolbar"
             }
            ]
           },
            "xtype" : "ColumnModel",
            "width" : 75,
            "header" : "Internal #",
-           "$ renderer" : "function(v,x,r) { \n    var fmt = '{0}';\n    if (r.data.sel) {\n        fmt = '<span style=\"color:orange;font-weight:bold;\">{0}</span>';\n    }\n    return String.format(fmt, v); }",
+           "$ renderer" : "function(v,x,r) { \n    var fmt = '{0}';\n    if (r.selected) {\n        fmt = '<span style=\"color:orange;font-weight:bold;\">{0}</span>';\n    }\n    return String.format(fmt, v); }",
            "$ xns" : "Roo.grid",
            "Boolean sortable" : true,
            "* prop" : "colModel[]",