Files
web-doc-editor/js/ui/cmp/CheckEntities.js
Peter Kokot f06fee3640 Sync final newlines
This patch adds some missing newlines and trims multiple final newlines
into a single newline.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-02 03:44:40 +02:00

193 lines
6.0 KiB
JavaScript

Ext.namespace('ui','ui.cmp','ui.cmp._CheckEntities');
//------------------------------------------------------------------------------
// CheckDoc Internals
// CheckDoc Grid datastore
ui.cmp._CheckEntities.ds = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : './do/getCheckEntitiesData'
}),
reader : new Ext.data.JsonReader({
root : 'Items',
totalProperty : 'nbItems',
idProperty : 'id',
fields : [
{name : 'id'},
{name : 'entities'},
{name : 'url'},
{name : 'result'},
{name : 'date', type : 'date', dateFormat : 'Y-m-d H:i:s'}
]
})
});
ui.cmp._CheckEntities.ds.setDefaultSort('entities', 'asc');
ui.cmp._CheckEntities.rendererEntities = function(value, metadata)
{
return '&' + value + ';';
};
// CheckDoc Grid columns definition
ui.cmp._CheckEntities.columns = [
new Ext.grid.RowNumberer(),
{
id : 'entities',
header : _('Entities'),
sortable : true,
dataIndex : 'entities',
width : 30,
renderer : ui.cmp._CheckEntities.rendererEntities
}, {
header : _('Url'),
sortable : true,
dataIndex : 'url'
}, {
header : _('Result'),
width : 30,
sortable : true,
dataIndex : 'result'
}, {
header : _('Date'),
width : 30,
sortable : true,
dataIndex : 'date',
renderer : Ext.util.Format.dateRenderer(_('Y-m-d, H:i'))
}
];
//------------------------------------------------------------------------------
// CheckDoc Grid
ui.cmp.CheckEntities = Ext.extend(Ext.grid.GridPanel,
{
id : 'check-entities-grid',
loadMask : true,
bodyBorder : false,
store : ui.cmp._CheckEntities.ds,
columns : ui.cmp._CheckEntities.columns,
autoExpandColumn : 'url',
sm : new Ext.grid.RowSelectionModel({ singleSelect : true }),
view : new Ext.grid.GridView({ forceFit : true }),
onRender: function(ct, position)
{
ui.cmp.CheckEntities.superclass.onRender.call(this, ct, position);
this.store.load.defer(20, this.store);
},
openTab: function(rowIndex)
{
var storeRecord = this.store.getAt(rowIndex),
url = storeRecord.data.url,
urlMd5 = Ext.util.md5(url),
tabId = 'tab-check-entities-'+urlMd5,
tab = Ext.getCmp(tabId);
if( ! tab )
{
Ext.getCmp('main-panel').add({
id : tabId,
xtype : 'panel',
title : Ext.util.Format.ellipsis(url,20),
tabTip : url,
iconCls : 'iconCheckEntities',
closable : true,
layout : 'fit',
items: [ new Ext.ux.IFrameComponent({ id: 'frame-'+tabId, url: url }) ]
});
}
Ext.getCmp('main-panel').setActiveTab(tabId);
},
onRowdblclick: function(grid, rowIndex)
{
this.openTab(rowIndex);
},
onContextClick: function(grid, rowIndex, e)
{
if(!this.menu) {
this.menu = new Ext.menu.Menu({
id : 'submenu-checkentities',
items : [{
scope : this,
text : '<b>'+_('Open in a new Tab')+'</b>',
iconCls : 'iconOpenInTab',
handler : function()
{
this.openTab(this.ctxRowIndex);
this.menu.hide();
}
}]
});
}
this.getSelectionModel().selectRow(rowIndex);
e.stopEvent();
if( this.ctxRowIndex ) {
this.ctxRowIndex = null;
}
this.ctxRowIndex = rowIndex;
this.menu.showAt(e.getXY());
},
initComponent: function(config)
{
this.tbar = [{
xtype : 'label',
text : _('Status: ')
}, {
xtype : 'combo',
typeAhead : true,
triggerAction : 'all',
lazyRender :true,
mode : 'local',
store : new Ext.data.ArrayStore({
id : 0,
fields : [
'myId',
'displayText'
],
data: [
['all', _('All status')],
['FTP_CONNECT', 'FTP_CONNECT'],
['FTP_LOGIN', 'FTP_LOGIN'],
['FTP_NO_FILE', 'FTP_NO_FILE'],
['HTTP_CONNECT', 'HTTP_CONNECT'],
['HTTP_INTERNAL_ERROR', 'HTTP_INTERNAL_ERROR'],
['HTTP_NOT_FOUND', 'HTTP_NOT_FOUND'],
['HTTP_MOVED', 'HTTP_MOVED'],
['HTTP_WRONG_HEADER', 'HTTP_WRONG_HEADER'],
['SUCCESS', 'SUCCESS'],
['UNKNOWN_HOST', 'UNKNOWN_HOST']
]
}),
value : 'all',
valueField : 'myId',
displayField : 'displayText',
editable : false,
listeners: {
select: function(c, record) {
var val = record.id;
if( val === 'all' ) {
Ext.getCmp('check-entities-grid').store.clearFilter();
} else {
Ext.getCmp('check-entities-grid').store.filter('result', record.id);
}
}
}
}];
ui.cmp.CheckEntities.superclass.initComponent.call(this);
Ext.apply(this, config);
this.on('rowcontextmenu', this.onContextClick, this);
this.on('rowdblclick', this.onRowdblclick, this);
}
});