/** * Abstract class for Ext.DataView creation in MODx * * This is primarily used for the media browser * but in untestable cases also in a modx-package-browser-thumbs-view * in the package browser (when a node in the tree has the attribute "templated") * * @class MODx.DataView * @extends Ext.DataView * @constructor * @param {Object} config An object of options. * @xtype modx-dataview */ MODx.DataView = function(config) { config = config || {}; this._loadStore(config); Ext.applyIf(config.listeners || {},{ 'loadexception': {fn:this.onLoadException, scope: this} ,'beforeselect': {fn:function(view){ return view.store.getRange().length > 0;}} ,'contextmenu': {fn:this._showContextMenu, scope: this} }); Ext.applyIf(config,{ store: this.store ,singleSelect: true ,overClass: 'x-view-over' ,emptyText: '
'+_('file_err_filter')+'
' ,closeAction: 'hide' }); MODx.DataView.superclass.constructor.call(this,config); this.config = config; this.cm = new Ext.menu.Menu(); }; Ext.extend(MODx.DataView,Ext.DataView,{ lookup: {} ,onLoadException: function(){ this.getEl().update('
'+_('data_err_load')+'
'); } /** * Add context menu items to the dataview. * @param {Object, Array} items Either an Object config or array of Object configs. */ ,_addContextMenuItem: function(items) { var a = items, l = a.length; for(var i=0;i