Reader/Feed.bjs
[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            _this.articleCtr.load(rowIndex);
99        }
100      },
101      store : {
102       remoteSort : true,
103       xns : Roo.data,
104       '|xns' : 'Roo.data',
105       xtype : 'Store',
106       listeners : {
107        beforeload : function (_self, o)
108         {
109             o.params = o.params || {};
110             o.params.feed = 83;
111         }
112       },
113       proxy : {
114        method : 'GET',
115        url : baseURL + '/Api/Reader_read',
116        xns : Roo.data,
117        '|xns' : 'Roo.data',
118        xtype : 'HttpProxy'
119       },
120       reader : {
121        fields : [
122                "id",
123                    "article_id",
124                    "has_read",
125                    "article_id_id" ,
126                    "article_id_published_dt" ,
127                    "article_id_headline" ,
128                    "article_id_body" ,
129                    "article_id_real_url" ,
130                    'article_id_body_txt'
131                ],
132        xns : Roo.data,
133        '|xns' : 'Roo.data',
134        xtype : 'JsonReader'
135       }
136      },
137      cm : [
138       {
139        dataIndex : 'article_id_headline',
140        renderer : function(v,x,r) {
141           
142           return String.format(
143                    '<h3>{0}</h3><small>{1}</small><i class="rss-list-body">{2}</i>' + 
144                        '{3}<i class="fa fa-chevron-right"></i>',
145                r.data.article_id_headline,
146                r.data.article_id_published_dt,
147                r.data.article_id_body_txt,
148                r.data.has_read * 1 ? '<span class="badge">Read</span>' : ''
149            );
150                    
151         
152         },
153        xns : Roo.grid,
154        '|xns' : 'Roo.grid',
155        xtype : 'ColumnModel'
156       }
157      ]
158     },
159     {
160      hidden : false,
161      loadArticle : function(pos) { 
162          
163      
164          if (pos < 0) {
165              Roo.MessageBox.alert("error", "show article got < 0");
166          }
167              
168          //    Roo.select('.hover-nav').show();
169          _this.table.hide(); // hopefully...
170          this.show();
171          
172          var rec = _this.table.store.getAt(pos);
173          if (typeof(rec.data.rss_body) == 'undefined') {
174      
175                  
176              new Pman.Request({
177                  method: 'GET',
178                  mask : 'Fetching Article',
179                  url : baseURL + '/FeedBody/' + id,
180                  success : function(res) {
181                      rec.data.rss_body = res.responseText;
182                      _this.article_ctr.showArticle(pos);
183                      
184                    
185                  }
186              });
187              return;
188              
189          }
190      
191          _this.articleBody.el.update(rec.data.rss_body || "Body has not been loaded",false, function() {
192              //Roo.log("body loaded");
193              (function() { 
194                  var w = Roo.lib.Dom.getViewportWidth();
195      
196                  // resize the images... 
197                  _this.articleBody.el.select('img', true).each(function(im) {
198                      if (im.getWidth() > w) {
199                          var sf = w/im.getWidth()  
200                          im.setSize(w, im.getHeight() * sf);
201                      }
202                      
203                          
204                  });
205              }).defer(100);
206                  
207          });
208          // hide the summary...
209          
210          
211          
212          
213          
214          //Roo.get(document.body).unmask();
215          
216          //Roo.select('.rss-art-count').first().update((this.pos +1) +'/' + this.articles.elements.length);
217         
218          // flag it as read...
219          
220          new Pman.Request({
221              method: 'GET',
222              url : baseURL + '/FeedBody/' + id,
223              params : { flag_read : 1 }, 
224              success : function(res) { }
225          });
226          rec.set('has_read', 1);
227              
228          //Roo.select('.rss-list-article-' +id +
229          //           ' .count').show();
230          
231          //Roo.select('.rss-list-article-' +id +
232          //           ' .count').first().dom.innerHTML =  'Read';
233      
234          //Roo.select('.rss-list-article-' +id +
235          //           ' .chevron').first().hide();
236          
237         
238              //Roo.select('header h2').first().dom.innerHTML = this.feed_title + ' - ' +
239              //        art.select('.rss-title').first().dom.innerH
240      },
241      xns : Roo.bootstrap,
242      '|xns' : 'Roo.bootstrap',
243      xtype : 'Element',
244      listeners : {
245       render : function (_self)
246        {
247          _this.articleCtr = this;
248        }
249      },
250      items  : [
251       {
252        cls : 'breadcrumb',
253        tag : 'ol',
254        xns : Roo.bootstrap,
255        '|xns' : 'Roo.bootstrap',
256        xtype : 'Element',
257        items  : [
258         {
259          html : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
260          tag : 'li',
261          xns : Roo.bootstrap,
262          '|xns' : 'Roo.bootstrap',
263          xtype : 'Element',
264          listeners : {
265           render : function (_self)
266            {
267              _this.articleDate  = this;
268            }
269          }
270         },
271         {
272          html : _this._strings['eae639a70006feff484a39363c977e24'] /* Domain */,
273          tag : 'li',
274          xns : Roo.bootstrap,
275          '|xns' : 'Roo.bootstrap',
276          xtype : 'Element',
277          listeners : {
278           render : function (_self)
279            {
280              _this.articleURL  = this;
281            }
282          }
283         },
284         {
285          cls : 'active',
286          html : _this._strings['b78a3223503896721cca1303f776159b'] /* Title */,
287          tag : 'li',
288          xns : Roo.bootstrap,
289          '|xns' : 'Roo.bootstrap',
290          xtype : 'Element',
291          listeners : {
292           render : function (_self)
293            {
294            _this.articleTitle = this;
295            }
296          }
297         }
298        ]
299       },
300       {
301        xns : Roo.bootstrap,
302        '|xns' : 'Roo.bootstrap',
303        xtype : 'Container',
304        listeners : {
305         render : function (_self)
306          {
307            _this.articleBody = this;
308          }
309        }
310       }
311      ]
312     }
313    ]
314   };  }
315 });