2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 FeedWindow = function() {
\r
10 this.feedUrl = new Ext.form.ComboBox({
\r
12 fieldLabel: 'Enter the URL of the feed to add',
\r
13 emptyText: 'http://example.com/blog/feed',
\r
15 validationEvent: false,
\r
16 validateOnBlur: false,
\r
18 triggerAction: 'all',
\r
19 displayField: 'url',
\r
23 valid: this.syncShadow,
\r
24 invalid: this.syncShadow,
\r
27 tpl: new Ext.XTemplate(
\r
28 '<tpl for="."><div class="x-combo-list-item">',
\r
29 '<em>{url}</em><strong>{text}</strong>',
\r
30 '<div class="x-clear"></div>',
\r
32 store: new Ext.data.SimpleStore({
\r
33 fields: ['url', 'text'],
\r
34 data : this.defaultFeeds
\r
38 this.form = new Ext.FormPanel({
\r
42 bodyStyle:'background:transparent;padding:10px;'
\r
45 FeedWindow.superclass.constructor.call(this, {
\r
47 iconCls: 'feed-icon',
\r
56 closeAction: 'hide',
\r
60 handler: this.onAdd,
\r
64 handler: this.hide.createDelegate(this, [])
\r
70 this.addEvents({add:true});
\r
73 Ext.extend(FeedWindow, Ext.Window, {
\r
75 ['http://www.divergingpath.com/rss.cfm?mode=full', 'Aaron Conran\'s Blog'],
\r
76 ['http://feeds.yuiblog.com/YahooUserInterfaceBlog', 'Yahoo! UI Blog'],
\r
77 ['http://feeds.feedburner.com/jquery/', 'jQuery Blog'],
\r
78 ['http://sports.yahoo.com/nba/rss.xml', 'NBA News'],
\r
79 ['http://feeds.dzone.com/dzone/frontpage', 'DZone.com']
\r
84 this.feedUrl.setValue('');
\r
86 FeedWindow.superclass.show.apply(this, arguments);
\r
90 this.el.mask('Validating Feed...', 'x-mask-loading');
\r
91 var url = this.feedUrl.getValue();
\r
93 url: 'feed-proxy.php',
\r
94 params: {feed: url},
\r
95 success: this.validateFeed,
\r
96 failure: this.markInvalid,
\r
102 markInvalid : function(){
\r
103 this.feedUrl.markInvalid('The URL specified is not a valid RSS2 feed.');
\r
107 validateFeed : function(response, options){
\r
108 var dq = Ext.DomQuery;
\r
109 var url = options.feedUrl;
\r
112 var xml = response.responseXML;
\r
113 var channel = xml.getElementsByTagName('channel')[0];
\r
115 var text = dq.selectValue('title', channel, url);
\r
116 var description = dq.selectValue('description', channel, 'No description available.');
\r
120 return this.fireEvent('validfeed', {
\r
123 description: description
\r
128 this.markInvalid();
\r