mirror of
https://github.com/php/web-doc-editor.git
synced 2026-03-25 17:52:18 +01:00
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
Ext.namespace('ui','ui.cmp');
|
|
|
|
ui.cmp.PreviewFile = Ext.extend(Ext.Window,
|
|
{
|
|
id : 'winPreviewFile',
|
|
layout : 'fit',
|
|
title : _('Preview'),
|
|
iconCls : 'iconView',
|
|
closable : true,
|
|
closeAction: 'close',
|
|
maximized : true,
|
|
modal : true,
|
|
buttons : [{
|
|
text : _('Close'),
|
|
handler : function()
|
|
{
|
|
this.ownerCt.ownerCt.close();
|
|
}
|
|
}],
|
|
|
|
initComponent : function()
|
|
{
|
|
var win = this;
|
|
|
|
ui.cmp.PreviewFile.superclass.initComponent.call(this);
|
|
|
|
XHR({
|
|
params : {
|
|
task : 'previewFile',
|
|
path : this.path
|
|
},
|
|
success : function(r)
|
|
{
|
|
var o = Ext.util.JSON.decode(r.responseText), frame;
|
|
|
|
// We add a random string to the URL to not display the file cache
|
|
o.url = o.url + '?' + Math.random();
|
|
|
|
frame = new Ext.ux.IFrameComponent({ id: 'frame-previewFile', url: o.url });
|
|
|
|
win.add(
|
|
frame
|
|
);
|
|
win.show();
|
|
|
|
},
|
|
failure : function()
|
|
{
|
|
}
|
|
});
|
|
|
|
}
|
|
}); |