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