a86bf2a5186a6eab9840de950a0ed69ba7e38e98
[web.Reader] / Reader / Feed.bjs
1 {
2  "name" : "Feed",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/web.Reader/Reader/Feed.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "strings" : {
9   "2efe14eb257ad32579ef6080d295c3af" : "<i class=\"fa fa-chevron-left\"></i> Name of feed",
10   "40c829f4b6cdd8753135704af571192f" : "articleURL",
11   "8287b137f969bcae66ca51f7abf14308" : "Show Previously Read ",
12   "d9cd9f7b44e0493c9604e9f8fb7a6c07" : "Mark All Read",
13   "b78a3223503896721cca1303f776159b" : "Title",
14   "b7436cc90ecf26f15baeead978f09040" : "name of feed",
15   "83ca9a18d9507324a9453c92a7420dd2" : "Report Issue",
16   "44749712dbec183e983dcd78a7736c41" : "Date"
17  },
18  "items" : [
19   {
20    "xtype" : "Body",
21    "$ xns" : "Roo.bootstrap",
22    "items" : [
23     {
24      "listeners" : {
25       "click" : "function (_self, e)\n{\n   if (_this.table.el.hasClass('hidden')) { \n        _this.table.show(); // hopefully...\n        _this.articleCtr.show();\n    }\n}"
26      },
27      "String tag" : "div",
28      "Boolean preventDefault" : true,
29      "xtype" : "Link",
30      "$ xns" : "Roo.bootstrap",
31      "String html" : "name of feed",
32      "String style" : "font-weight: bold;\nfont-size: 22px;\n \nposition: static;\nleft: 100px;\ntop: 10px;\nz-Index: 2000;\ncolor: white;"
33     },
34     {
35      "String position" : "fixed-top",
36      "xtype" : "NavHeaderbar",
37      "Boolean inverse" : true,
38      "$ xns" : "Roo.bootstrap",
39      "items" : [
40       {
41        "xtype" : "NavGroup",
42        "String align" : "right",
43        "$ xns" : "Roo.bootstrap",
44        "items" : [
45         {
46          "xtype" : "NavItem",
47          "$ xns" : "Roo.bootstrap",
48          "String html" : "Mark All Read"
49         },
50         {
51          "xtype" : "NavItem",
52          "$ xns" : "Roo.bootstrap",
53          "String html" : "Show Previously Read "
54         },
55         {
56          "xtype" : "NavItem",
57          "$ xns" : "Roo.bootstrap",
58          "String html" : "Report Issue"
59         }
60        ]
61       },
62       {
63        "listeners" : {
64         "click" : "function (_self, e)\n{\n   if (_this.table.el.hasClass('hidden')) { \n        _this.table.show(); // hopefully...\n        _this.articleCtr.show();\n    }\n}"
65        },
66        "String href" : "#",
67        "Boolean preventDefault" : true,
68        "xtype" : "Link",
69        "$ xns" : "Roo.bootstrap",
70        "String html" : "<i class=\"fa fa-chevron-left\"></i> Name of feed"
71       }
72      ]
73     },
74     {
75      "listeners" : {
76       "render" : "function (_self)\n{\n    _this.table = this;\n    this.store.load({});\n}",
77       "rowclick" : "function (_self, el, rowIndex, e)\n{\n    //var rec = this.store.getAt(rowIndex);\n   \n    _this.articleCtr.load(rowIndex);\n}"
78      },
79      "id" : "table",
80      "boolean striped" : true,
81      "boolean hover" : true,
82      "boolean responsive" : true,
83      "xtype" : "Table",
84      "Boolean thead" : false,
85      "$ xns" : "Roo.bootstrap",
86      "String style" : "margin-top:50px",
87      "Boolean RowSelection" : true,
88      "items" : [
89       {
90        "listeners" : {
91         "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.feed = 83;\n}"
92        },
93        "xtype" : "Store",
94        "boolean remoteSort" : true,
95        "$ xns" : "Roo.data",
96        "* prop" : "store",
97        "items" : [
98         {
99          "xtype" : "HttpProxy",
100          "$ xns" : "Roo.data",
101          "String method" : "GET",
102          "* prop" : "proxy",
103          "$ String url" : "baseURL + '/Api/Reader_read'"
104         },
105         {
106          "$ Array fields" : "[\n        \"id\",\n            \"article_id\",\n            \"has_read\",\n            \"article_id_id\" ,\n            \"article_id_published_dt\" ,\n            \"article_id_headline\" ,\n            \"article_id_body\" ,\n            \"article_id_real_url\" ,\n            'article_id_body_txt'\n        ]\n    ",
107          "xtype" : "JsonReader",
108          "$ xns" : "Roo.data",
109          "* prop" : "reader"
110         }
111        ]
112       },
113       {
114        "String dataIndex" : "article_id_headline",
115        "$ Function renderer" : "function(v,x,r) {\n   \n   return String.format(\n            '<h3>{0}</h3><small>{1}</small><i class=\"rss-list-body\">{2}</i>' + \n                '{3}<i class=\"fa fa-chevron-right\"></i>',\n        r.data.article_id_headline,\n        r.data.article_id_published_dt,\n        r.data.article_id_body_txt,\n        r.data.has_read * 1 ? '<span class=\"badge\">Read</span>' : ''\n    );\n            \n \n }",
116        "xtype" : "ColumnModel",
117        "$ xns" : "Roo.grid",
118        "* prop" : "cm[]"
119       }
120      ]
121     },
122     {
123      "listeners" : {
124       "render" : "function (_self)\n{\n  _this.articleCtr = this;\n}"
125      },
126      "id" : "articleCtr",
127      "| function load" : "function(pos) { \n    \n\n    if (pos < 0) {\n        Roo.MessageBox.alert(\"error\", \"show article got < 0\");\n    }\n        \n    //    Roo.select('.hover-nav').show();\n    _this.table.hide(); // hopefully...\n    this.show();\n    \n    var rec = _this.table.store.getAt(pos);\n    if (typeof(rec.data.rss_body) == 'undefined') {\n\n            \n        new Pman.Request({\n            method: 'GET',\n            mask : 'Fetching Article',\n            params : {as_json : 1} ,\n            url : baseURL + '/FeedBody/' + rec.data.id,\n            success : function(res) {\n                Roo.log(res);\n                rec.data.rss_body = res.data;\n                _this.articleCtr.load(pos);\n                \n              \n            }\n        });\n        return;\n        \n    }\n    \n    _this.articleDate.el.update(rec.data.article_id_published_dt.split(' ')[0]);\n\n    _this.articleURL.el.update(String.format('<a href=\"{0}\">{1}</a>',\n            rec.data.article_id_real_url,\n            rec.data.article_id_real_url.split('/')[2] // hopefull will not break.!\n     ));\n     _this.articleTitle.el.update(String.format('{0}', rec.data.article_id_headline));\n    \n    _this.articleBody.el.update(rec.data.rss_body || \"Body has not been loaded\",false, function() {\n        //Roo.log(\"body loaded\");\n        (function() { \n            var w = Roo.lib.Dom.getViewportWidth();\n\n            // resize the images... \n            _this.articleBody.el.select('img', true).each(function(im) {\n                if (im.getWidth() > w) {\n                    var sf = w/im.getWidth()  \n                    im.setSize(w, im.getHeight() * sf);\n                }\n                \n                    \n            });\n        }).defer(100);\n            \n    });\n    // hide the summary...\n    \n    \n    \n    \n    \n    //Roo.get(document.body).unmask();\n    \n    //Roo.select('.rss-art-count').first().update((this.pos +1) +'/' + this.articles.elements.length);\n   \n    // flag it as read...\n    \n    new Pman.Request({\n        method: 'GET',\n        url : baseURL + '/FeedBody/' + rec.data.id,\n        params : { flag_read : 1 }, \n        success : function(res) { }\n    });\n    rec.set('has_read', 1);\n        \n    //Roo.select('.rss-list-article-' +id +\n    //           ' .count').show();\n    \n    //Roo.select('.rss-list-article-' +id +\n    //           ' .count').first().dom.innerHTML =  'Read';\n\n    //Roo.select('.rss-list-article-' +id +\n    //           ' .chevron').first().hide();\n    \n   \n        //Roo.select('header h2').first().dom.innerHTML = this.feed_title + ' - ' +\n        //        art.select('.rss-title').first().dom.innerH\n}",
128      "xtype" : "Element",
129      "$ xns" : "Roo.bootstrap",
130      "Boolean hidden" : false,
131      "items" : [
132       {
133        "String tag" : "ol",
134        "String cls" : "breadcrumb",
135        "xtype" : "Element",
136        "$ xns" : "Roo.bootstrap",
137        "String style" : "margin-top:50px;",
138        "items" : [
139         {
140          "listeners" : {
141           "render" : "function (_self)\n{\n  _this.articleDate  = this;\n}"
142          },
143          "String tag" : "li",
144          "xtype" : "Element",
145          "$ xns" : "Roo.bootstrap",
146          "String html" : "Date"
147         },
148         {
149          "listeners" : {
150           "render" : "function (_self)\n{\n  _this.articleURL  = this;\n}"
151          },
152          "String tag" : "li",
153          "xtype" : "Element",
154          "$ xns" : "Roo.bootstrap",
155          "String html" : "articleURL"
156         },
157         {
158          "listeners" : {
159           "render" : "function (_self)\n{\n_this.articleTitle = this;\n}"
160          },
161          "String tag" : "li",
162          "String cls" : "active",
163          "xtype" : "Element",
164          "$ xns" : "Roo.bootstrap",
165          "String html" : "Title"
166         }
167        ]
168       },
169       {
170        "listeners" : {
171         "render" : "function (_self)\n{\n  _this.articleBody = this;\n}"
172        },
173        "xtype" : "Container",
174        "$ xns" : "Roo.bootstrap"
175       }
176      ]
177     }
178    ]
179   }
180  ]
181 }