File IvoR.hws changed (mode: 100755) (index 48c53f7..7caf44c) |
... |
... |
EndFunction |
107 |
107 |
Function IvoR:ShowArticle(pos) |
Function IvoR:ShowArticle(pos) |
108 |
108 |
If pos >= 0 |
If pos >= 0 |
109 |
109 |
Local chosen_item = self.items_list[pos] |
Local chosen_item = self.items_list[pos] |
|
110 |
|
mui.Set("item_author", "Contents", chosen_item.author) |
|
111 |
|
mui.Set("item_pubdate", "Contents", chosen_item.pubdate) |
110 |
112 |
mui.Set("item_title", "Contents", tf_Label(chosen_item.title)) |
mui.Set("item_title", "Contents", tf_Label(chosen_item.title)) |
111 |
|
mui.Set("textfield", "Text", tf_TextField(chosen_item.description)) |
|
|
113 |
|
mui.Set("item_link", "Contents", chosen_item.link) |
|
114 |
|
|
|
115 |
|
If StrLen(chosen_item.description) > StrLen(chosen_item.content) |
|
116 |
|
mui.Set("textfield", "Text", tf_TextField(chosen_item.description)) |
|
117 |
|
Else |
|
118 |
|
mui.Set("textfield", "Text", tf_TextField(chosen_item.content)) |
|
119 |
|
EndIf |
112 |
120 |
|
|
113 |
121 |
If Not HaveItem(self.guids, chosen_item.guid) |
If Not HaveItem(self.guids, chosen_item.guid) |
114 |
122 |
mui.DoMethod("articles", "Rename", pos, |
mui.DoMethod("articles", "Rename", pos, |
|
... |
... |
Function IvoR:LoadImage() |
169 |
177 |
self.ImageLoaded = True |
self.ImageLoaded = True |
170 |
178 |
EndFunction |
EndFunction |
171 |
179 |
|
|
172 |
|
Function IvoR:OpenChannel() |
|
|
180 |
|
Function IvoR:OpenLink(muid) |
173 |
181 |
;č Vostuda, ale nemáme to nikde uloženo. Jen na formě =] |
;č Vostuda, ale nemáme to nikde uloženo. Jen na formě =] |
174 |
|
Local url$ = mui.Get("channel_link", "Contents") |
|
|
182 |
|
Local url$ = mui.Get(muid, "Contents") |
175 |
183 |
If url$ Then OpenURL(url$) |
If url$ Then OpenURL(url$) |
176 |
184 |
EndFunction |
EndFunction |
177 |
185 |
|
|
|
... |
... |
Function IvoR:Clear() |
185 |
193 |
|
|
186 |
194 |
mui.DoMethod("articles", "Clear") |
mui.DoMethod("articles", "Clear") |
187 |
195 |
|
|
|
196 |
|
|
|
197 |
|
mui.Set("item_author", "Contents", "") |
|
198 |
|
mui.Set("item_pubdate", "Contents", "") |
188 |
199 |
mui.Set("item_title", "Contents", "") |
mui.Set("item_title", "Contents", "") |
189 |
|
;mui.Set("item_title", "ContextMenu", "(none)") |
|
|
200 |
|
mui.Set("item_link", "Contents", "") |
190 |
201 |
|
|
191 |
202 |
mui.Set("textfield", "Text", "") |
mui.Set("textfield", "Text", "") |
192 |
|
;mui.Set("textfield", "ContextMenu", "(none)") |
|
193 |
203 |
|
|
194 |
204 |
|
|
195 |
205 |
|
|
|
... |
... |
Function IvoR:Clear() |
198 |
208 |
channel_level = True |
channel_level = True |
199 |
209 |
current_element$ = Nil |
current_element$ = Nil |
200 |
210 |
|
|
201 |
|
current_item = {title="", pubdate="", category="", description="", guid=""} |
|
|
211 |
|
current_item = {author="", title="", link="", content="", |
|
212 |
|
pubdate="", category="", description="", guid=""} |
202 |
213 |
EndFunction |
EndFunction |
203 |
214 |
|
|
204 |
215 |
|
|
205 |
216 |
Function StartElement(p, name$, attrs) |
Function StartElement(p, name$, attrs) |
206 |
217 |
current_element$ = name$ |
current_element$ = name$ |
207 |
|
;DebugPrint("starts ", name$) |
|
208 |
|
If name$ = "item" Then channel_level = False |
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
;For i,v In Pairs(attrs) |
|
213 |
|
; If GetType(i) = #STRING Then DebugPrint("-->", i .. "=" .. v) |
|
214 |
|
;Next |
|
215 |
|
|
|
|
218 |
|
If name$ = "item" Or name$ = "entry" Then channel_level = False |
216 |
219 |
EndFunction |
EndFunction |
217 |
220 |
|
|
218 |
221 |
|
|
219 |
222 |
Function EndElement(p, name$) |
Function EndElement(p, name$) |
220 |
|
;DebugPrint("ends ", name$) |
|
221 |
223 |
current_element$ = nil |
current_element$ = nil |
222 |
|
If name$ = "item" |
|
|
224 |
|
If name$ = "item" Or name$ = "entry" |
223 |
225 |
Local preparse = "" |
Local preparse = "" |
224 |
226 |
If HaveItem(IvoR.oldguids, current_item.guid) |
If HaveItem(IvoR.oldguids, current_item.guid) |
225 |
227 |
IvoR.guids[current_item.guid] = 1 |
IvoR.guids[current_item.guid] = 1 |
|
... |
... |
Function EndElement(p, name$) |
233 |
235 |
preparse .. current_item.category) |
preparse .. current_item.category) |
234 |
236 |
InsertItem(IvoR.items_list, current_item) |
InsertItem(IvoR.items_list, current_item) |
235 |
237 |
CheckEvents() |
CheckEvents() |
236 |
|
current_item = {title="", pubdate="", category="", description="", guid=""} |
|
|
238 |
|
current_item = {author="", title="", link="", content="", |
|
239 |
|
pubdate="", category="", description="", guid=""} |
237 |
240 |
EndIf |
EndIf |
238 |
241 |
EndFunction |
EndFunction |
239 |
242 |
|
|
240 |
243 |
|
|
241 |
244 |
|
|
242 |
245 |
Function CharacterData(p, str$) |
Function CharacterData(p, str$) |
243 |
|
;DebugPrint("CD: ", str$) |
|
244 |
246 |
If channel_level |
If channel_level |
245 |
247 |
Switch current_element$ |
Switch current_element$ |
246 |
248 |
Case "title": mui.Set("channel_title", "Contents", tf_Label(str$)) |
Case "title": mui.Set("channel_title", "Contents", tf_Label(str$)) |
247 |
249 |
Case "description": |
Case "description": |
248 |
250 |
mui.Set("channel_description", "Contents", tf_Label(str$)) |
mui.Set("channel_description", "Contents", tf_Label(str$)) |
|
251 |
|
|
|
252 |
|
Case "id": FallThrough |
249 |
253 |
Case "link": |
Case "link": |
250 |
|
IvoR.link = str$ |
|
|
254 |
|
IvoR.link = StripStr(str$) |
251 |
255 |
mui.Set("channel_link", "Contents", StripStr(str$)) |
mui.Set("channel_link", "Contents", StripStr(str$)) |
252 |
256 |
|
|
253 |
257 |
;č url podle RSS specifikace musí být pouze u obrázků. |
;č url podle RSS specifikace musí být pouze u obrázků. |
254 |
|
Case "url": IvoR:DownloadImage(str$) |
|
255 |
|
|
|
|
258 |
|
Case "url": IvoR:DownloadImage(StripStr(str$)) |
|
259 |
|
Case "logo": IvoR:DownloadImage(StripStr(str$)) |
256 |
260 |
|
|
257 |
261 |
EndSwitch |
EndSwitch |
258 |
262 |
|
|
259 |
263 |
Else |
Else |
260 |
264 |
Switch current_element$ |
Switch current_element$ |
261 |
265 |
Case "title": current_item.title = tf_Label(str$) |
Case "title": current_item.title = tf_Label(str$) |
262 |
|
|
|
|
266 |
|
Case "dc:creator": FallThrough |
|
267 |
|
Case "author": current_item.author = StripStr(str$) |
263 |
268 |
;č číselné hodnoty se nějak špatně načítají. |
;č číselné hodnoty se nějak špatně načítají. |
264 |
269 |
;č fakt je nějaký problém v tom serializatoru |
;č fakt je nějaký problém v tom serializatoru |
265 |
|
Case "guid": current_item.guid = "guid:" .. str$ |
|
266 |
|
Case "pubDate": current_item.pubdate = tf_Label(str$) |
|
|
270 |
|
Case "guid": |
|
271 |
|
If current_item.link = "" Then current_item.link = StripStr(str$) |
|
272 |
|
current_item.guid = "guid:" .. str$ |
|
273 |
|
Case "updated": |
|
274 |
|
current_item.guid = "updated:" .. str$ |
|
275 |
|
current_item.pubdate = StripStr(str$) |
|
276 |
|
Case "pubDate": current_item.pubdate = StripStr(str$) |
|
277 |
|
|
|
278 |
|
|
|
279 |
|
Case "summary": FallThrough |
|
280 |
|
Case "atom:summary": FallThrough |
267 |
281 |
Case "description": |
Case "description": |
268 |
|
current_item.description = current_item.description ..str$ |
|
|
282 |
|
current_item.description = current_item.description ..StripStr(str$) |
|
283 |
|
|
|
284 |
|
Case "content": FallThrough |
|
285 |
|
Case "content:encoded": |
|
286 |
|
current_item.content = current_item.content ..StripStr(str$) |
|
287 |
|
|
|
288 |
|
Case "id": FallThrough |
|
289 |
|
Case "link": |
|
290 |
|
current_item.link = StripStr(str$) |
|
291 |
|
|
269 |
292 |
Case "category": |
Case "category": |
270 |
293 |
If current_item.category = "" |
If current_item.category = "" |
271 |
294 |
current_item.category = tf_Label(str$) |
current_item.category = tf_Label(str$) |