mirror of
https://github.com/php/web-doc-editor.git
synced 2026-03-24 09:12:07 +01:00
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
178 lines
4.9 KiB
JavaScript
178 lines
4.9 KiB
JavaScript
Ext.namespace('ui','ui.cmp','ui.cmp._CommitLogManager');
|
|
|
|
ui.cmp._CommitLogManager.store = new Ext.data.Store({
|
|
proxy : new Ext.data.HttpProxy({
|
|
url : './do/getCommitLogMessage'
|
|
}),
|
|
reader : new Ext.data.JsonReader({
|
|
root : 'Items',
|
|
totalProperty : 'nbItems',
|
|
idProperty : 'id',
|
|
fields : [
|
|
{name : 'id'},
|
|
{name : 'text'}
|
|
]
|
|
})
|
|
});
|
|
|
|
ui.cmp._CommitLogManager.editor = new Ext.ux.grid.RowEditor({
|
|
saveText : _('Update'),
|
|
cancelText : _('Cancel'),
|
|
listeners : {
|
|
afteredit: function(editor, changes, record)
|
|
{
|
|
XHR({
|
|
params : {
|
|
task : 'saveLogMessage',
|
|
messID : record.data.id,
|
|
mess : record.data.text
|
|
},
|
|
success : function()
|
|
{
|
|
record.commit();
|
|
// Notify
|
|
PhDOE.notify('info', _('Message updated'), _('Log Message was updated successfully !'));
|
|
},
|
|
failure : function()
|
|
{
|
|
PhDOE.winForbidden();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
ui.cmp._CommitLogManager.cm = new Ext.grid.ColumnModel([
|
|
new Ext.grid.RowNumberer(),
|
|
{
|
|
id : 'log_msg',
|
|
header : _('Log message'),
|
|
dataIndex : 'text',
|
|
editor : {
|
|
xtype : 'textarea'
|
|
},
|
|
renderer : function(value)
|
|
{
|
|
return value.split("\n").join("<br/>");
|
|
}
|
|
}
|
|
]);
|
|
|
|
ui.cmp._CommitLogManager.sm = new Ext.grid.RowSelectionModel({
|
|
singleSelect: true
|
|
});
|
|
|
|
// config - { rowIdx }
|
|
ui.cmp._CommitLogManager.menu = Ext.extend(Ext.menu.Menu,
|
|
{
|
|
setRowIdx: function(rowIdx) {
|
|
this.rowIdx = rowIdx;
|
|
},
|
|
|
|
initComponent : function()
|
|
{
|
|
Ext.apply(this,{
|
|
|
|
items : [{
|
|
scope : this,
|
|
text : _('Delete this Log Message'),
|
|
iconCls : 'iconTrash',
|
|
handler : function()
|
|
{
|
|
XHR({
|
|
scope : this,
|
|
params : {
|
|
task : 'deleteLogMessage',
|
|
messID : ui.cmp._CommitLogManager.store.getAt(this.rowIdx).data.id
|
|
},
|
|
success : function()
|
|
{
|
|
ui.cmp._CommitLogManager.store.remove(ui.cmp._CommitLogManager.store.getAt(this.rowIdx));
|
|
|
|
// Notify
|
|
PhDOE.notify('info', _('Message deleted'), _('Log Message was deleted successfully !'));
|
|
|
|
},
|
|
failure : function()
|
|
{
|
|
PhDOE.winForbidden();
|
|
}
|
|
});
|
|
}
|
|
}]
|
|
});
|
|
ui.cmp._CommitLogManager.menu.superclass.initComponent.call(this);
|
|
}
|
|
});
|
|
|
|
ui.cmp._CommitLogManager.grid = Ext.extend(Ext.grid.GridPanel,
|
|
{
|
|
loadMask : true,
|
|
autoExpandColumn : 'log_msg',
|
|
cm : ui.cmp._CommitLogManager.cm,
|
|
sm : ui.cmp._CommitLogManager.sm,
|
|
store : ui.cmp._CommitLogManager.store,
|
|
plugins : [ui.cmp._CommitLogManager.editor],
|
|
viewConfig : {
|
|
emptyText : '<div class="x-grid-empty" style="text-align:center;">'+_('No log message currently')+'</div>'
|
|
},
|
|
listeners : {
|
|
render : function(grid)
|
|
{
|
|
grid.store.load();
|
|
}
|
|
},
|
|
|
|
onRowContextMenu: function(grid, rowIndex, e) {
|
|
|
|
e.stopEvent();
|
|
this.getSelectionModel().selectRow(rowIndex);
|
|
|
|
if( ! this.menu ) {
|
|
this.menu = new ui.cmp._CommitLogManager.menu();
|
|
}
|
|
this.menu.setRowIdx(rowIndex);
|
|
this.menu.showAt(e.getXY());
|
|
|
|
},
|
|
|
|
initComponent: function(config)
|
|
{
|
|
ui.cmp._CommitLogManager.grid.superclass.initComponent.call(this);
|
|
Ext.apply(this, config);
|
|
|
|
this.on('rowcontextmenu', this.onRowContextMenu, this);
|
|
}
|
|
});
|
|
|
|
ui.cmp.CommitLogManager = Ext.extend(Ext.Window,
|
|
{
|
|
id : 'commit-log-win',
|
|
title : _('Manage Log Message'),
|
|
iconCls : 'iconWinManageLog',
|
|
width : 650,
|
|
height : 350,
|
|
layout : 'fit',
|
|
resizable : false,
|
|
modal : true,
|
|
autoScroll : true,
|
|
closeAction: 'hide',
|
|
store : ui.cmp._CommitLogManager.store,
|
|
buttons : [{
|
|
text : _('Close'),
|
|
handler : function()
|
|
{
|
|
Ext.getCmp('commit-log-win').hide();
|
|
}
|
|
}],
|
|
|
|
initComponent : function()
|
|
{
|
|
Ext.apply(this,
|
|
{
|
|
items : [new ui.cmp._CommitLogManager.grid()]
|
|
});
|
|
ui.cmp.CommitLogManager.superclass.initComponent.call(this);
|
|
}
|
|
});
|