3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
7 FeedWindow = function() {
8 this.feedUrl = new Ext.form.ComboBox({
10 fieldLabel: 'Enter the URL of the feed to add',
11 emptyText: 'http://example.com/blog/feed',
13 validationEvent: false,
14 validateOnBlur: false,
21 valid: this.syncShadow,
22 invalid: this.syncShadow,
25 tpl: new Ext.XTemplate(
26 '<tpl for="."><div class="x-combo-list-item">',
27 '<em>{url}</em><strong>{text}</strong>',
28 '<div class="x-clear"></div>',
30 store: new Ext.data.ArrayStore({
31 fields: ['url', 'text'],
32 data : this.defaultFeeds
36 this.form = new Ext.FormPanel({
40 bodyStyle:'background:transparent;padding:10px;'
43 FeedWindow.superclass.constructor.call(this, {
58 handler: this.onFeedAdd,
62 handler: this.hide.createDelegate(this, [])
68 this.addEvents({add:true});
71 Ext.extend(FeedWindow, Ext.Window, {
73 ['http://www.divergingpath.com/rss.cfm?mode=full', 'Aaron Conran\'s Blog'],
74 ['http://feeds.yuiblog.com/YahooUserInterfaceBlog', 'Yahoo! UI Blog'],
75 ['http://feeds.feedburner.com/jquery/', 'jQuery Blog'],
76 ['http://sports.yahoo.com/nba/rss.xml', 'NBA News'],
77 ['http://feeds.dzone.com/dzone/frontpage', 'DZone.com']
82 this.feedUrl.setValue('');
84 FeedWindow.superclass.show.apply(this, arguments);
87 onFeedAdd: function() {
88 this.el.mask('Validating Feed...', 'x-mask-loading');
89 var url = this.feedUrl.getValue();
91 url: 'feed-proxy.php',
93 success: this.validateFeed,
94 failure: this.markInvalid,
100 markInvalid : function(){
101 this.feedUrl.markInvalid('The URL specified is not a valid RSS2 feed.');
105 validateFeed : function(response, options){
106 var dq = Ext.DomQuery;
107 var url = options.feedUrl;
110 var xml = response.responseXML;
111 var channel = xml.getElementsByTagName('channel')[0];
113 var text = dq.selectValue('title', channel, url);
114 var description = dq.selectValue('description', channel, 'No description available.');
118 return this.fireEvent('validfeed', {
121 description: description