Ext.override(Ext.form.HtmlEditor, {
	getValue : function() {
		if (this.sourceEditMode) {
			this.pushValue();
		} else {
			this.syncValue();
		}
		return Ext.form.HtmlEditor.superclass.getValue.call(this);
	}
});

MyDesktop.QuienesSomos = Ext.extend(Ext.app.Module, {
    id: 'quienes-somos-module',
    init : function(){
        this.launcher = {
            text: 'Quienes somos',
            iconCls:'usuario',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('quienessomos-win');
        if(!win){
            win = desktop.createWindow({
                id: 'quienessomos-win',
                title:'Quienes somos',
                width:610,
                height:411,
                iconCls: 'user',
                maximizable: false,
                shim:false,
                animCollapse:false,
                constrainHeader:true,
                items: new Ext.form.FormPanel({
                    id: 'quienes-somos-panel',
                    labelAlign: 'top',
                    frame:true,
                    bodyStyle:'padding:5px 5px 0',
                    width: 600,
                    items: [{
                                id: 'quienes-somos-texto',
                                fieldLabel: 'Texto que se va a mostrar en la sección quienes somos',
                                xtype: 'htmleditor',
                                anchor:'98%',
                                name: 'nombre',
                                autoWidth: true,
                                height: 300,
                                allowBlank:false
                    }],
                    buttons: [{
                        text: 'Guardar',
                        type: 'submit',
                                handler: function(){
                                    var fp = Ext.getCmp('quienes-somos-panel');
                                    if(fp.getForm().isValid()){
                                        fp.getForm().submit({
                                            url: 'frontend_dev.php/quienesSomos/save',
                                            waitMsg: 'Guardando...',
                                            //params: "texto=" + Ext.getCmp('quienes-somos-texto').getValue(),
                                            success: function(fp, o){
                                                    Ext.MessageBox.alert('Guardar', o.result.Guardar);
                                            }
                                        });
                                    }
                                }
                    },{
                        text: 'Cerrar',
                        handler: function(){
                            win.close();
                        }
                    }]
                })
            });
        }
        win.show();
        Ext.Ajax.request({
            url: 'index.php/quienesSomos',
            success: 	function(respuesta){
                Ext.getCmp('quienes-somos-texto').setValue(respuesta.responseText);
            }
        });
        //Ext.getCmp('quienes-somos-texto').setValue("asd");
        Ext.getCmp('quienes-somos-texto').getValue();
    }
});