Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB

  1. // kate: space-indent on; indent-width 4; replace-tabs on;
  2. Ext.namespace('Ext.ux');
  3. Ext.ux.IFrameComponent = Ext.extend(Ext.BoxComponent, {
  4. // http://www.extjs.com/forum/showthread.php?p=54416#post54416
  5. onRender : function(ct, position){
  6. this.el = ct.createChild({tag: 'iframe', id: 'iframe-'+ this.id, frameBorder: 0, src: this.url});
  7. }
  8. });
  9. Ext.ux.ButtonIframeWindow = function( config ){
  10. Ext.apply( this, config );
  11. Ext.apply( this, {
  12. scope: this,
  13. enableToggle: true,
  14. toggleHandler: function(button, state){
  15. if( !this.wnd ){
  16. this.wnd = new Ext.Window({
  17. title: this.windowTitle || this.text,
  18. layout: 'fit',
  19. items: new Ext.ux.IFrameComponent({ url: this.url }),
  20. width: window.viewsize.width - 200,
  21. height: window.viewsize.height - 100,
  22. scope: this,
  23. buttons: [{
  24. text: gettext('Open in new window'),
  25. scope: this,
  26. handler: function(){
  27. window.open( this.url );
  28. this.toggle( false );
  29. }
  30. }],
  31. listeners: {
  32. beforeclose: function(){
  33. this.ownerButton.toggle( false, false );
  34. this.ownerButton.wnd = null;
  35. }
  36. },
  37. });
  38. this.wnd.ownerButton = this;
  39. }
  40. if( state ){
  41. this.wnd.show();
  42. mypos = this.getPosition();
  43. mysize = this.getSize();
  44. winsize = this.wnd.getSize();
  45. this.wnd.setPosition(
  46. (window.viewsize.width - winsize.width) / 2,
  47. mypos[1] - winsize.height
  48. );
  49. }
  50. else
  51. this.wnd.hide();
  52. }
  53. });
  54. Ext.ux.ButtonIframeWindow.superclass.constructor.call( this );
  55. }
  56. Ext.extend( Ext.ux.ButtonIframeWindow, Ext.Button, {
  57. } );
  58. Ext.reg( 'buttonIframeWindow', Ext.ux.ButtonIframeWindow );