Hybrid View

  1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default Call Ext.extend function from FeedWindow.superclass.constructor.call

    Call Ext.extend function from FeedWindow.superclass.constructor.call


    Hi,
    I am trying to call a method in the Ext.extend from FeedWindow.superclass.constructor.call().
    I tried to call using this.markInvalid, Ext.markInvalid etc and all caused errors.
    I am a novice to extJS and JS OOPs. Can anyone help me to resolve this issue and call those functions.

    The code I have are,
    -----------------------------

    Code:
         FeedWindow.superclass.constructor.call(this, {
            title: 'Add Feed',
            iconCls: 'feed-icon',
            id: 'add-feed-win',
            autoHeight: true,
            width: 500,
            resizable: false,
            plain:true,
            modal: true,
            y: 100,
            autoScroll: true,
            closeAction: 'hide',
            height: 'auto',
            items: this.form,
            buttons:[{
                text: 'Add Feed!',
                handler: function() {
                    this.form.getForm().submit({
                        url: $baseUrl+'feed-proxy.php',
                        success: function(){
                            this.validateFeed;
                        },
                        failure: function(){
                            this.markInvalid,
                        }
                    });
                },
                scope: this
            },{
                text: 'Cancel',
                handler: this.hide.createDelegate(this, [])
            }],        
        });
    --------------------------------------------------
    Code:
     Ext.extend(FeedWindow, Ext.Window, {
        defaultFeeds : [
            ['http://www.divergingpath.com/rss.cfm?mode=full', 'Aaron Conran\'s Blog'],
            ['http://feeds.yuiblog.com/YahooUserInterfaceBlog',  'Yahoo! UI Blog'],
            ['http://feeds.feedburner.com/jquery/', 'jQuery Blog'],
            ['http://sports.yahoo.com/nba/rss.xml', 'NBA News'],
            ['http://feeds.dzone.com/dzone/frontpage', 'DZone.com']
        ],
    
        show : function(){
            if(this.rendered){
                this.feedUrl.setValue('');
            }
            FeedWindow.superclass.show.apply(this, arguments);
        },
    
        markInvalid : function(){
            this.feedUrl.markInvalid('The URL specified is not a valid RSS2 feed.');
            this.el.unmask();
        },
    
        validateFeed : function(response, options){
            var dq = Ext.DomQuery;
            var url = options.feedUrl;
    
            try{
                var xml = response.responseXML;
                var channel = xml.getElementsByTagName('channel')[0];
                var text;// = dq.selectValue('title', channel, url);
                    
                    // Add feed list in feed panel from the database
                    Ext.Ajax.request({
                        url : $baseUrl+'feed_panel.php' ,
                        params : { action : 'newfeed', newUrl : url },
                        method: 'POST',
                        scope: this,
                        success: function ( result, request ) {                      
                            var stringData = result.responseText;                        
                            if(channel){
                                // var description = dq.selectValue('description', channel, 'No description available.');
                                this.el.unmask();
                                this.hide();
                                return this.fireEvent('validfeed', {
                                    url: url,
                                    text: result.responseText,
                                });
                            }        
                            
                        },
                        failure: function ( result, request) { 
                            Ext.MessageBox.alert('Failed', result.responseText); 
                        } 
                    });                
    
            }catch(e){
                this.markInvalid();
            }
            
        }
    });
    ----------------------------------------------------------

    Thanks in advance

  2. #2
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    A few points

    1. You hadn't defined a FeedWindow to extend.
    2. You should really use a namespace.
    3. You had some extra comma's,some invalid method calls (this.markInvalid instead of this.markInvalid()), missing semi-colon etc.

    Try the code below, it will now extend and the window will open.

    Obviously you have more work to do though.. (for instance the this.form.getForm().submit() will error as you don't have a form etc).

    I don't know what editor you're using but something like Aptana would have highlighted the errors for you.

    Anyway, hope this helps:

    PHP Code:
    Ext.namespace("myNS");
    myNS.FeedWindow = function(){
    myNS.FeedWindow.superclass.constructor.call(this, {
        
    title'Add Feed',
        
    iconCls'feed-icon',
        
    id'add-feed-win',
        
    autoHeighttrue,
        
    width500,
        
    resizablefalse,
        
    plaintrue,
        
    modaltrue,
        
    y100,
        
    autoScrolltrue,
        
    closeAction'hide',
        
    height'auto',
        
    itemsthis.form,
        
    buttons: [{
        
    text'Add Feed!',
        
    handler: function(){
            
    this.form.getForm().submit({
            
    url$baseUrl 'feed-proxy.php',
            
    success: function(){
                
    this.validateFeed();
            },
            
    failure: function(){
                
    this.markInvalid();
            }
            });
        },
        
    scopethis
        
    }, {
        
    text'Cancel',
        
    handlerthis.hide.createDelegate(this, [])
        }]
    });
    };

    Ext.extend(myNS.FeedWindowExt.Window, {
    defaultFeeds: [['http://www.divergingpath.com/rss.cfm?mode=full''Aaron Conran\'s Blog'], ['http://feeds.yuiblog.com/YahooUserInterfaceBlog''Yahoo! UI Blog'], ['http://feeds.feedburner.com/jquery/''jQuery Blog'], ['http://sports.yahoo.com/nba/rss.xml''NBA News'], ['http://feeds.dzone.com/dzone/frontpage''DZone.com']],

    show: function(){
        if (
    this.rendered) {
        
    this.feedUrl.setValue('');
        }
        
    myNS.FeedWindow.superclass.show.apply(thisarguments);
    },

    markInvalid: function(){
        
    this.feedUrl.markInvalid('The URL specified is not a valid RSS2 feed.');
        
    this.el.unmask();
    },

    validateFeed: function(responseoptions){
        var 
    dq Ext.DomQuery;
        var 
    url options.feedUrl;

        try {
        var 
    xml response.responseXML;
        var 
    channel xml.getElementsByTagName('channel')[0];
        var 
    text;// = dq.selectValue('title', channel, url);
        // Add feed list in feed panel from the database
        
    Ext.Ajax.request({
            
    url$baseUrl 'feed_panel.php',
            
    params: {
            
    action'newfeed',
            
    newUrlurl
            
    },
            
    method'POST',
            
    scopethis,
            
    success: function(resultrequest){
            var 
    stringData result.responseText;
            if (
    channel) {
                
    // var description = dq.selectValue('description', channel, 'No description available.');
                
    this.el.unmask();
                
    this.hide();
                return 
    this.fireEvent('validfeed', {
                
    urlurl,
                
    textresult.responseText
                
    });
            }

            },
            
    failure: function(resultrequest){
            
    Ext.MessageBox.alert('Failed'result.responseText);
            }
        });

        } 
        catch (
    e) {
        
    this.markInvalid();
        }

    }
    });

    Ext.onReady(function(){
    var 
    fw = new myNS.FeedWindow();
            
    fw.show();
    }, 
    this); 

  3. #3
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Here's what you would have seen with your original code if you were using the Aptana IDE with validation turned on full:




  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    hello Dan,
    Thank you very much for your great support.
    I modified the code you sent and run it. The code I used is
    Code:
    Ext.namespace("myNS");
    myNS.FeedWindow = function(){
        this.form = new Ext.FormPanel({
            labelWidth: 75,
            labelAlign:'top',
            autoHeight: true,
            method: 'POST',
            fileUpload: true,
            //url: $baseUrl+'upload.php',
            //url: $baseUrl+'feed-proxy.php',
            border:false,
            bodyStyle:'background:transparent;padding:2px',
            width: 483,
            //height: 'auto',
            id: 'uploadform',
    		items: {
                xtype:'tabpanel',
                activeTab: 0,
                defaults:{autoHeight:true, bodyStyle:'padding:10px'}, 
                bodyStyle:'background:transparent',
                items:[{
                    title:'Add feed',
                    bodyStyle:'background:transparent;padding:10px',
                    layout:'form',
    			    width: 450,
                    items: [this.feedUrl = new Ext.form.ComboBox({
    			    	width: 450,
    			        id: 'feed',
    			        fieldLabel: 'Enter the URL of the feed to add',
    			        emptyText: 'http://example.com/blog/feed',
    			        validationEvent: false,
    			        validateOnBlur: false,
    			        msgTarget: 'under',
    			        triggerAction: 'all',
    			        displayField: 'url',
    			        mode: 'local',
    			        labelAlign:'top',
    			
    			        listeners:{
    			            valid: this.syncShadow,
    			            invalid: this.syncShadow,
    			            scope: this
    			        },
    			        tpl: new Ext.XTemplate(
    			                '<tpl for="."><div class="x-combo-list-item">',
    			                '<em>{url}</em><strong>{text}</strong>',
    			                '<div class="x-clear"></div>',
    			                '</div></tpl>'),
    					store: new Ext.data.SimpleStore({
    			            fields: ['url', 'text'],
    			            data : this.defaultFeeds
    			        })
    			    }),
    			    this.addpublish = new Ext.form.Checkbox({
                        id: 'add-publish',
    			    	fieldLabel: 'Automatically publish feeds (optional)',
                    	items: {
    						width: 20,
    	                	name: 'add-publish',
    	                    value: '1'	
                        }
                    }),
                    this.thisfeedtag = new Ext.form.TextField({
                        id: 'add-feedtag',
                    	fieldLabel: 'Tag feeds (optional)',
                        height: 'auto',
    	                width: 450,
                    	items: {
                        	labelAlign:'top',
    	                	width: 450,
                        	name: 'add-feedtag',
    	                    value: ''
                    	}
                    }),this.acthidden = new Ext.form.TextField({
    				   	id: 'action',
    				   	value: 'feed_add',
                    	inputType: 'hidden',
                    	items: {
                        	name: 'action',
    	                }
                    })]
                },{
                    title:'Upload OPML Files',
                    layout:'form',
                    bodyStyle:'background:transparent;padding:10px',
                    labelAlign:'left',
                    defaultType: 'field',
                    items: [this.opmlfeedUrl = new Ext.form.TextField({
                        id: 'opml-url',
                    	fieldLabel: 'Address of OPML file on the internet',
                    	width: 350,
                        items: {
                        	labelAlign:'top',
    	                	width: 350,
                        	name: 'opml-url',
    	                }
                    }),this.opmlbrowse = new Ext.form.TextField({
    				   	id: 'opml-upload',
                    	fieldLabel: 'Upload an OPML file from your computer',
                    	width: 350,
    				   	inputType: 'file',
                    	items: {
                        	labelAlign:'top',
    	                	width: 350,
    	                	opmlupload: 'opml-upload',
                        	name: 'opmlupload',
    	                    value: ''	
                        }
                    }),this.opmlfeedpublish = new Ext.form.Checkbox({
                        id: 'opml-publish',
                    	itemsAlign: 'left',
                    	fieldLabel: 'Automatically publish feeds (optional)',
                    	items: {
                        	labelAlign:'right',
    	                	name: 'opml-publish',
    	                    value: ''	
                        }
                    }),this.opmlfeedtag = new Ext.form.TextField({
                        id: 'opml-feedtag',
                    	fieldLabel: 'Tag feeds (optional)',
    					width: 350,
                    	items: {
                        	labelAlign:'top',
    	                	width: 350,
                        	name: 'opml-feedtag',
    	                    value: ''	
                        }
                    })]
                }]
            }
    
        });
    myNS.FeedWindow.superclass.constructor.call(this, {
    
        title: 'Add Feed',
    
        iconCls: 'feed-icon',
    
        id: 'add-feed-win',
    
        autoHeight: true,
    
        width: 500,
    
        resizable: false,
    
        plain: true,
    
        modal: true,
    
        y: 100,
    
        autoScroll: true,
    
        closeAction: 'hide',
    
        height: 'auto',
    
        items: this.form,
    
        buttons: [{
    
        text: 'Add Feed!',
    
        handler: function(){
    
            this.form.getForm().submit({
    
            url: $baseUrl + 'feed-proxy.php',
    
            success: function(){
    
                this.validateFeed();
    
            },
    
            failure: function(){
    
                this.markInvalid();
    
            }
    
            });
    
        },
    
        scope: this
    
        }, {
    
        text: 'Cancel',
    
        handler: this.hide.createDelegate(this, [])
    
        }]
    
    });
    
    };
    
    
    
    Ext.extend(myNS.FeedWindow, Ext.Window, {
    
    defaultFeeds: [['http://www.divergingpath.com/rss.cfm?mode=full', 'Aaron Conran\'s Blog'], ['http://feeds.yuiblog.com/YahooUserInterfaceBlog', 'Yahoo! UI Blog'], ['http://feeds.feedburner.com/jquery/', 'jQuery Blog'], ['http://sports.yahoo.com/nba/rss.xml', 'NBA News'], ['http://feeds.dzone.com/dzone/frontpage', 'DZone.com']],
    
    
    
    show: function(){
    
        if (this.rendered) {
    
        this.feedUrl.setValue('');
    
        }
    
        myNS.FeedWindow.superclass.show.apply(this, arguments);
    
    },
    
    
    
    markInvalid: function(){
    
        this.feedUrl.markInvalid('The URL specified is not a valid RSS2 feed.');
    
        this.el.unmask();
    
    },
    
    
    
    validateFeed: function(response, options){
    
        var dq = Ext.DomQuery;
    
        var url = options.feedUrl;
    
    
    
        try {
    
        var xml = response.responseXML;
    
        var channel = xml.getElementsByTagName('channel')[0];
    
        var text;// = dq.selectValue('title', channel, url);
    
        // Add feed list in feed panel from the database
    
        Ext.Ajax.request({
    
            url: $baseUrl + 'feed_panel.php',
    
            params: {
    
            action: 'newfeed',
    
            newUrl: url
    
            },
    
            method: 'POST',
    
            scope: this,
    
            success: function(result, request){
    
            var stringData = result.responseText;
    
            if (channel) {
    
                // var description = dq.selectValue('description', channel, 'No description available.');
    
                this.el.unmask();
    
                this.hide();
    
                return this.fireEvent('validfeed', {
    
                url: url,
    
                text: result.responseText
    
                });
    
            }
    
    
    
            },
    
            failure: function(result, request){
    
            Ext.MessageBox.alert('Failed', result.responseText);
    
            }
    
        });
    
    
    
        } 
    
        catch (e) {
    
        this.markInvalid();
    
        }
    
    
    
    }
    
    });
    
    
    
    Ext.onReady(function(){
    
    var fw = new myNS.FeedWindow();
    
            fw.show();
    
    }, this);
    But I get the following error
    ---------
    this.validateFeed is not a function
    [Break on this error] this.validateFeed();
    ---------
    Can you help me on it?

  5. #5
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    I am downloading Aptana now. Will install it now and try.
    Thanks a lot

  6. #6
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    You had a couple of extra comma's which kill IE - don't know which browser you are testing in?

    I also don't know what operation you performed to get the error, and obviously don't have your full environment (obvioulsy PHP seeing your $baseUrl reference) so can't test this properly, but with the extra comma's removed the only error I get when attempting to add feed is $baseUrl is undefined.

    .......However looking further at your code (I perhaps should have looked closer first time, but simply focused on correcting the errors), your call to Ext.extend doesn't look right - The 3rd param is for overrides, but you have methods such as validateFeed defined here.

    Window doesn't have a validateFeed method so you aren't overriding it - you should pull this up into your myNS.FeedWindow (similarly with defaultFeeds etc that aren't members of Window).

    Hope this helps.

  7. #7
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    Hello Dan,
    I am using FF for testing along with PHP on windows. I will correct the JS errors once it works well on FF.
    What I am trying to do is modifying the feedviewer sample in extJS examples
    http://extjs.com/playpen/ext-2.0-dev...ewer/view.html
    I need to add a bulk upload option with the add feed option. It is my current situation of development.

    Regards,

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi