Ext


Go Back   Ext JS Forums > Ext JS Community Forums (3.0) > Ext: User Extensions and Plugins

Reply
 
Thread Tools
  #11  
Old 11-03-2009, 08:22 AM
vizcano vizcano is offline
Ext User
 
Join Date: Jan 2008
Posts: 181
vizcano is on a distinguished road
Default

Quote:
Originally Posted by vizcano View Post
Is there a way to disable the button until the user clicks in the editable area? Just like the behavior of the standard buttons of the toolbar
I should learn to wait for two minutes before posting anything, cause in many times i get the solution just after have posted my answer...

Just add "disabled:true" to btn button and its done
Reply With Quote
  #12  
Old 11-03-2009, 09:05 AM
vizcano vizcano is offline
Ext User
 
Join Date: Jan 2008
Posts: 181
vizcano is on a distinguished road
Default

Quote:
Originally Posted by vizcano View Post
I should learn to wait for two minutes before posting anything, cause in many times i get the solution just after have posted my answer...

Just add "disabled:true" to btn button and its done
But only works in firefox, anyone could help me?
Reply With Quote
  #13  
Old 11-03-2009, 10:09 AM
Fabyo Fabyo is offline
Ext User
 
Join Date: May 2007
Posts: 72
Fabyo is on a distinguished road
Default

Ext.ux.formHtmlEditor.Picture only works in IE

Reply With Quote
  #14  
Old 11-03-2009, 11:08 AM
vizcano vizcano is offline
Ext User
 
Join Date: Jan 2008
Posts: 181
vizcano is on a distinguished road
Default

Quote:
Originally Posted by Fabyo View Post
Ext.ux.formHtmlEditor.Picture only works in IE

¿? I've got it working in both FF and IE, the only important thing i have changed is the upload method from the flash one to an uploadfile onlybutton...

I just want to know how to disable the button at the toolbar until htmleditor is clicked, like the rest of the htmleditor toolbar items
Reply With Quote
  #15  
Old 11-03-2009, 12:05 PM
Fabyo Fabyo is offline
Ext User
 
Join Date: May 2007
Posts: 72
Fabyo is on a distinguished road
Default

Insert btn.disable() after line 29:

example:

Ext.ux.form.HtmlEditor.Picture.js

onRender:function()
{
    var btn = this.cmp.getToolbar().addButton({
        iconCls: 'x-edit-picture',
        handler: function(){
            this.show();
        },
        scope: this,
        tooltip: {
            title: 'Insert Picture'
        },
        overflowText: 'Picture'
    })
    btn.disable();
},
Reply With Quote
  #16  
Old 11-03-2009, 12:13 PM
vizcano vizcano is offline
Ext User
 
Join Date: Jan 2008
Posts: 181
vizcano is on a distinguished road
Default

Thank u so much
Reply With Quote
  #17  
Old 11-03-2009, 05:51 PM
Stephan Schrade Stephan Schrade is offline
Ext JS Premium Member
 
Join Date: Aug 2008
Posts: 64
Stephan Schrade is on a distinguished road
Default

Thank you very much for this extension.
It works great so far.
But unfortunately the swf upload doesn't work in FF.
How can I perform uploads with other methods?
Any hints?

TIA Stephan
Reply With Quote
  #18  
Old 11-04-2009, 02:51 AM
vizcano vizcano is offline
Ext User
 
Join Date: Jan 2008
Posts: 181
vizcano is on a distinguished road
Default

Well i changed the swf upload to an onlybutton fileuploadfiel, but i'm having some problems now with the new button position,because if i add to class "x-form-file-wrap" a float right property all my fileuploadfields are affected by this change, anyway i post here my solution if it helps

Ext.ux.InsertPictureWindow=Ext.extend(Ext.Window ,{
	xtype:"window",
	title:"Insertar Imagen",
	width:430,
	height:160,
	layout:"fit",
	initComponent: function(){
		this.on_change={
			change:{
				scope:this,fn:function(){this.generate_code();}
			}
		};
		this.buttons=[
		{
			xtype:'progress',
			width:220,hidden:true
		},
		{
			text:'Insertar',scope:this,
			handler:function(){
				if(this.callback){
					this.callback.call(this.scope||this,this.get_code_value());
				}
				this.hide();
			}
		},{
			text:'Cancelar',scope:this,handler:
			function(){
				this.hide();
			}
		}]
		this.items=[
		{
			xtype:'form',border:false,layout:'vbox',
			id : 'attachimg',fileUpload: true,
			layoutConfig:{
				align:"stretch",
				padding:"0"
			},
			defaults:{
				layout:"hbox",border:false,xtype:'panel',
				layoutConfig:{
					padding:"5"
				},
				defaults:{
					margins:'0 5 0 0',
					xtype:"textfield"
				}
			},
			items:[
				{
				items:[
					{
						xtype:"label",
						text:"URL:",
						style:"line-height:22px;",
						width:70
					},
					{
						width:200,name:'src',
						listeners:this.on_change
					},
					{
						xtype:"button",
						text:"Galeria...",scope:this,
						handler:function(){
							if(!this.pic_view)
							{
								this.pic_view = new Ext.ux.PicView({
									url: this.downloadUrl,
									closeAction:'hide',
									scope:this,
									callback:function(o){
										var f=this.findByType('form')[0];
										o.width+='px';o.height+='px';
										f.form.setValues(o);
										this.generate_code();
									}
								});
							}
							this.pic_view.show();
						}
					},{
						xtype:"fileuploadfield",
				        buttonOnly: true,
				        buttonText: 'Examinar...',
				        name:'file',
				        id:'fileup',
				        scope:this,
				        callback:function(o){
								var f=this.findByType('form')[0];
								f.form.findField('src').setValue('?do=filetools.getImage&id='+o);
								this.generate_code();
						},
				        listeners: {
				            'fileselected': function(fb, v){
				            	Ext.getCmp('attachimg').getForm().findField('src').setValue(v);
				            	//subimos archivo
				            	var pbar = Ext.Msg.progress('Espere unos instantes', 'cargando datos', 'actualizando datos . . .');
				            	Ext.getCmp('attachimg').getForm().submit({
							        url: String.format('?do=awejson.request&what={0}&which={1}', 'files', 'setImages'),
							        waitTitle: 'Por favor, espere',
							        waitMsg: 'espere unos instantes ...', 
							        method: 'POST',
							        params: {
							            'mode' : 'new',
							            'label': 'insertado desde editor',
							            'description': 'insertado desde editor'
							        },
					            	reset: false,
					            	failure: function(form, response) {
					            		pbar.hide();
					            		Ext.MessageBox.show({
					            			title: 'Error', 
					            			msg: response.result.message,
					            			buttons: Ext.MessageBox.OK,
					            			icon: Ext.MessageBox.ERROR  // Ext.MessageBox.WARNING
					            		});
					            	},
					            	success: function(form, response) {
								        	pbar.hide();
								    		//this.generate_code();
								        	var callback = this.callback;
											callback.call(this.scope||this,response.result.message);
 	
										}
								        ,scope: this
								    });
				            }   
				        }
				  }
				]
			},
			{
				items:[
					{
						xtype:"label",
						text:"Codigo:",
						style:"line-height:22px;",
						width:70
					},{
						width:320,
						name:'code',
						readOnly:true
					}
				]
			}
			]
		}
		]
		Ext.ux.InsertPictureWindow.superclass.initComponent.call(this);
		this.on('show',function(){
			var f=this.findByType('form')[0];
			f.form.reset();
			this.generate_code();
		},this);
	},
	generate_code:function(){
		var f=this.findByType('form')[0];
		var o = this.get_form_real_values();
		if(typeof(o.src)!='string' || o.src.trim().length<1){
			this.buttons[1].setDisabled(true);return;
		}
		this.buttons[1].setDisabled(false);

		var str='<img src="'+o.src+'"'+' />';

		f.form.setValues({code:str});
	},
	get_form_real_values:function(){
    	var form=this.findByType('form')[0].form;
    	var values = {};
		form.items.each(function(f){
			if('code'!=f.getName())
   				values[f.getName()] = f.getValue();
		});
		return values;
	},
	get_code_value:function(){
		var ret=null;
    	var form=this.findByType('form')[0].form;
		form.items.each(function(f){
			if('code'==f.getName()){
   				var v=f.getValue();
   				if(typeof(v)=='string' && v.trim().length>0)
   					ret=v;
			}
		});
		return ret;
	}
})
Reply With Quote
  #19  
Old 11-06-2009, 07:26 AM
Fabyo Fabyo is offline
Ext User
 
Join Date: May 2007
Posts: 72
Fabyo is on a distinguished road
Default

my example extjs 3.0 online:
http://extjs.com.br/exemplos/htmleditor/

download:
http://extjs.com.br/exemplos/htmledi...HtmlEditor.zip

Firefox OK

using Ext.ux.UploadDialog, chooser.js and DataView-more.js

* Upload image
* Rename image
* Delete image


Reply With Quote
  #20  
Old 11-18-2009, 03:17 PM
Stephan Schrade Stephan Schrade is offline
Ext JS Premium Member
 
Join Date: Aug 2008
Posts: 64
Stephan Schrade is on a distinguished road
Default

Hi Fabyo,
thanks very much.
This works just perfect.

Thanks,
Stephan
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 03:58 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.