| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- VersionX.grid.Plugins = function(config) {
- config = config || {};
- Ext.applyIf(config,{
- url: VersionX.config.connector_url,
- id: 'versionx-grid-plugins',
- baseParams: {
- action: 'mgr/plugins/getlist',
- plugin: (VersionX.inVersion) ? MODx.request['id'] : 0
- },
- params: [],
- viewConfig: {
- forceFit: true,
- enableRowBody: true,
- emptyText: _('versionx.error.noresults')
- },
- fields: [
- {name: 'version_id', type: 'int'},
- {name: 'content_id', type: 'int'},
- {name: 'saved', type: 'string'},
- {name: 'username', type: 'string'},
- {name: 'mode', type: 'string'},
- {name: 'marked', type: 'boolean'},
- {name: 'name', type: 'string'},
- {name: 'category', type: 'int'},
- {name: 'categoryname', type: 'string'}
- ],
- paging: true,
- remoteSort: true,
- columns: [{
- header: _('versionx.version_id'),
- dataIndex: 'version_id',
- sortable: true,
- width: .1
- },{
- header: _('versionx.content_id',{what: _('plugin')}),
- dataIndex: 'content_id',
- sortable: true,
- width: .1
- },{
- header: _('versionx.saved'),
- dataIndex: 'saved',
- sortable: true,
- width: .2
- },{
- header: _('versionx.content_name', {what: _('plugin')}),
- dataIndex: 'name',
- sortable: true,
- width: .4
- },{
- header: _('category'),
- dataIndex: 'categoryname',
- sortable: true,
- width: .2
- },{
- header: _('user'),
- dataIndex: 'username',
- sortable: true,
- width: .2
- },{
- header: _('versionx.mode'),
- dataIndex: 'mode',
- sortable: true,
- width: .1,
- renderer: function (val) { return _('versionx.mode.'+val); }
- },{
- header: _('versionx.marked'),
- dataIndex: 'marked',
- sortable: true,
- width: .1,
- hidden: true
- }]
- ,listeners: {}
- });
- VersionX.grid.Plugins.superclass.constructor.call(this,config);
- };
- Ext.extend(VersionX.grid.Plugins,MODx.grid.Grid,{
- getMenu: function() {
- var r = this.getSelectionModel().getSelected();
- var d = r.data;
- var m = [];
- m.push({
- text: _('versionx.menu.viewdetails'),
- handler: function() {
- var eid = d.version_id;
- var backTo = (VersionX.inVersion) ? '&backTo='+MODx.request['a']+'-'+MODx.request['id'] : '';
- MODx.loadPage('?namespace=versionx&a=plugin&vid='+eid+backTo)
- }
- },'-',{
- text: _('versionx.plugins.revert', {id: d.version_id}),
- handler: function() {
- this.revertVersion(d.version_id, d.content_id)
- },
- scope: this
- });
- return m;
- },
- revertVersion: function(version, content) {
- if (version < 1) { MODx.alert(_('error'), 'Version not properly defined: '+version); }
- MODx.msg.confirm({
- title: _('versionx.plugins.revert.confirm'),
- text: _('versionx.plugins.revert.confirm.text',{id: version}),
- url: VersionX.config.connector_url,
- params: {
- version_id: version,
- content_id: content,
- action: 'mgr/plugins/revert'
- },
- listeners: {
- success: {fn: function() {
- MODx.msg.status({
- message: _('versionx.plugins.reverted'),
- delay: 4
- });
- }, scope: this }
- }
- });
- }
- });
- Ext.reg('versionx-grid-plugins',VersionX.grid.Plugins);
|