e0741ae25f490d877851ce62564bcf64551f3628
[web.Reader] / Reader / Feed.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Feed = new Roo.XComponent({
6
7  _strings : {
8   '8287b137f969bcae66ca51f7abf14308' :"Show Previously Read ",
9   'd9cd9f7b44e0493c9604e9f8fb7a6c07' :"Mark All Read",
10   'b78a3223503896721cca1303f776159b' :"Title",
11   'b7436cc90ecf26f15baeead978f09040' :"name of feed",
12   '83ca9a18d9507324a9453c92a7420dd2' :"Report Issue",
13   'eae639a70006feff484a39363c977e24' :"Domain",
14   '44749712dbec183e983dcd78a7736c41' :"Date"
15  },
16
17   part     :  ["Reader", "Feed" ],
18   order    : '-Feed',
19   region   : 'center',
20   parent   : false,
21   name     : "unnamed module",
22   disabled : false, 
23   permname : '', 
24   _tree : function()
25   {
26    var _this = this;
27    var MODULE = this;
28    return {
29    xns : Roo.bootstrap,
30    '|xns' : 'Roo.bootstrap',
31    xtype : 'Body',
32    items  : [
33     {
34      html : _this._strings['b7436cc90ecf26f15baeead978f09040'] /* name of feed */,
35      style : 'font-weight: bold;\nfont-size: 22px;\n \nposition: absolute;\nleft: 100px;\ntop: 10px;\nz-Index: 1000;\ncolor: white;',
36      tag : 'div',
37      xns : Roo.bootstrap,
38      '|xns' : 'Roo.bootstrap',
39      xtype : 'Element'
40     },
41     {
42      brand : '<i class=\"fa fa-chevron-left\"></i> Feeds',
43      brand_href : baseURL + '/Feeds',
44      inverse : true,
45      position : 'fixed-top',
46      xns : Roo.bootstrap,
47      '|xns' : 'Roo.bootstrap',
48      xtype : 'NavHeaderbar',
49      items  : [
50       {
51        align : 'right',
52        xns : Roo.bootstrap,
53        '|xns' : 'Roo.bootstrap',
54        xtype : 'NavGroup',
55        items  : [
56         {
57          html : _this._strings['d9cd9f7b44e0493c9604e9f8fb7a6c07'] /* Mark All Read */,
58          xns : Roo.bootstrap,
59          '|xns' : 'Roo.bootstrap',
60          xtype : 'NavItem'
61         },
62         {
63          html : _this._strings['8287b137f969bcae66ca51f7abf14308'] /* Show Previously Read  */,
64          xns : Roo.bootstrap,
65          '|xns' : 'Roo.bootstrap',
66          xtype : 'NavItem'
67         },
68         {
69          html : _this._strings['83ca9a18d9507324a9453c92a7420dd2'] /* Report Issue */,
70          xns : Roo.bootstrap,
71          '|xns' : 'Roo.bootstrap',
72          xtype : 'NavItem'
73         }
74        ]
75       }
76      ]
77     },
78     {
79      hover : true,
80      responsive : true,
81      RowSelection : true,
82      striped : true,
83      style : 'margin-top:50px',
84      thead : false,
85      xns : Roo.bootstrap,
86      '|xns' : 'Roo.bootstrap',
87      xtype : 'Table',
88      listeners : {
89       render : function (_self)
90        {
91            _this.table = this;
92            this.store.load({});
93        },
94       rowclick : function (_self, el, rowIndex, e)
95        {
96            var rec = this.store.getAt(rowIndex);
97            Roo.log(rec);
98        }
99      },
100      store : {
101       remoteSort : true,
102       xns : Roo.data,
103       '|xns' : 'Roo.data',
104       xtype : 'Store',
105       listeners : {
106        beforeload : function (_self, o)
107         {
108             o.params = o.params || {};
109             o.params.feed = 83;
110         }
111       },
112       proxy : {
113        method : 'GET',
114        url : baseURL + '/Api/Reader_read',
115        xns : Roo.data,
116        '|xns' : 'Roo.data',
117        xtype : 'HttpProxy'
118       },
119       reader : {
120        fields : [
121                "id",
122                    "article_id",
123                    "has_read",
124                    "article_id_id" ,
125                    "article_id_published_dt" ,
126                    "article_id_headline" ,
127                    "article_id_body" ,
128                    "article_id_real_url" ,
129                    'article_id_body_txt'
130                ],
131        xns : Roo.data,
132        '|xns' : 'Roo.data',
133        xtype : 'JsonReader'
134       }
135      },
136      cm : [
137       {
138        dataIndex : 'article_id_headline',
139        renderer : function(v,x,r) {
140           
141           return String.format(
142                    '<h3>{0}</h3><small>{1}</small><i class="rss-list-body">{2}</i>' + 
143                        '{3}<i class="fa fa-chevron-right"></i>',
144                r.data.article_id_headline,
145                r.data.article_id_published_dt,
146                r.data.article_id_body_txt,
147                r.data.has_read * 1 ? '<span class="badge">Read</span>' : ''
148            );
149                    
150         
151         },
152        xns : Roo.grid,
153        '|xns' : 'Roo.grid',
154        xtype : 'ColumnModel'
155       }
156      ]
157     },
158     {
159      hidden : false,
160      loadArticle : function(pos) { 
161          
162      
163          if (pos < 0) {
164              Roo.MessageBox.alert("error", "show article got < 0");
165          }
166              
167          //    Roo.select('.hover-nav').show();
168          _this.table.hide(); // hopefully...
169          this.show();
170          
171          var rec = _this.store.getAt(pos);
172          if (typeof(rec.data.rss_body) == 'undefined') {
173      
174                  
175              new Pman.Request({
176                  method: 'GET',
177                  mask : 'Fetching Article',
178                  url : baseURL + '/FeedBody/' + id,
179                  success : function(res) {
180                      rec.data.rss_body = res.responseText;
181                      _this.article_ctr.showArticle(pos);
182                      
183                    
184                  }
185              });
186              return;
187              
188          }
189      
190          abody.update(rec.data.rss_body || "Body has not been loaded",false, function() {
191              //Roo.log("body loaded");
192              (function() { 
193                  var w = Roo.lib.Dom.getViewportWidth();
194      
195                  // resize the images... 
196                  Roo.select('img', true).each(function(im) {
197                      if (im.getWidth() > w) {
198                          var sf = w/im.getWidth()  
199                          im.setSize(w, im.getHeight() * sf);
200                      }
201                      
202                          
203                  });
204              }).defer(100);
205                  
206          });
207          // hide the summary...
208          
209          
210          
211          
212          
213          Roo.get(document.body).unmask();
214          
215          Roo.select('.rss-art-count').first().update((this.pos +1) +'/' + this.articles.elements.length);
216         
217          // flag it as read...
218          
219          Roo.Ajax.request({
220              method: 'GET',
221              url : baseURL + '/FeedBody/' + id,
222              params : { flag_read : 1 }, 
223              success : function(res) { },
224              scope : this
225          });
226          
227          Roo.select('.rss-list-article-' +id +
228                     ' .count').first().dom.innerHTML =  'Read';
229      
230          Roo.select('.rss-list-article-' +id).addClass('rss-list-article-read-status-1');
231          
232          Roo.select('.rss-list-article-' +id +
233                     ' .count').show();
234          
235          Roo.select('.rss-list-article-' +id +
236                     ' .count').first().dom.innerHTML =  'Read';
237      
238          Roo.select('.rss-list-article-' +id +
239                     ' .chevron').first().hide();
240          
241         
242              //Roo.select('header h2').first().dom.innerHTML = this.feed_title + ' - ' +
243              //        art.select('.rss-title').first().dom.innerH
244      },
245      xns : Roo.bootstrap,
246      '|xns' : 'Roo.bootstrap',
247      xtype : 'Element',
248      listeners : {
249       render : function (_self)
250        {
251          _this.articleCtr = this;
252        }
253      },
254      items  : [
255       {
256        cls : 'breadcrumb',
257        tag : 'ol',
258        xns : Roo.bootstrap,
259        '|xns' : 'Roo.bootstrap',
260        xtype : 'Element',
261        items  : [
262         {
263          html : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
264          tag : 'li',
265          xns : Roo.bootstrap,
266          '|xns' : 'Roo.bootstrap',
267          xtype : 'Element',
268          listeners : {
269           render : function (_self)
270            {
271              _this.articleDate  = this;
272            }
273          }
274         },
275         {
276          html : _this._strings['eae639a70006feff484a39363c977e24'] /* Domain */,
277          tag : 'li',
278          xns : Roo.bootstrap,
279          '|xns' : 'Roo.bootstrap',
280          xtype : 'Element',
281          listeners : {
282           render : function (_self)
283            {
284              _this.articleURL  = this;
285            }
286          }
287         },
288         {
289          cls : 'active',
290          html : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
291          tag : 'li',
292          xns : Roo.bootstrap,
293          '|xns' : 'Roo.bootstrap',
294          xtype : 'Element',
295          listeners : {
296           render : function (_self)
297            {
298            _this.articleTitle = this;
299            }
300          }
301         }
302        ]
303       }
304      ]
305     }
306    ]
307   };  }
308 });