]>
Commit | Line | Data |
---|---|---|
3f363052 | 1 | <?php |
9da07c8a | 2 | class Dlg extends Handler_Protected { |
3f363052 | 3 | private $param; |
46da73c2 | 4 | |
17f9d200 JK |
5 | function before($method) { |
6 | if (parent::before($method)) { | |
3f363052 AD |
7 | header("Content-Type: text/xml; charset=utf-8"); |
8 | $this->param = db_escape_string($_REQUEST["param"]); | |
9 | print "<dlg>"; | |
10 | return true; | |
11 | } | |
12 | return false; | |
13 | } | |
46da73c2 | 14 | |
3f363052 AD |
15 | function after() { |
16 | print "</dlg>"; | |
17 | } | |
18 | ||
566faa14 AD |
19 | function exportData() { |
20 | ||
21 | print "<p style='text-align : center' id='export_status_message'>You need to prepare exported data first by clicking the button below.</p>"; | |
22 | ||
23 | print "<div align='center'>"; | |
24 | print "<button dojoType=\"dijit.form.Button\" | |
25 | onclick=\"dijit.byId('dataExportDlg').prepare()\">". | |
26 | __('Prepare data')."</button>"; | |
27 | ||
28 | print "<button dojoType=\"dijit.form.Button\" | |
29 | onclick=\"dijit.byId('dataExportDlg').hide()\">". | |
30 | __('Close this window')."</button>"; | |
31 | ||
32 | print "</div>"; | |
33 | ||
34 | ||
35 | } | |
36 | ||
3f363052 AD |
37 | function importOpml() { |
38 | header("Content-Type: text/html"); # required for iframe | |
46da73c2 | 39 | |
34aa9e20 AD |
40 | print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>"; |
41 | ||
3f363052 AD |
42 | print "<div class=\"prefFeedOPMLHolder\">"; |
43 | $owner_uid = $_SESSION["uid"]; | |
44 | ||
45 | db_query($this->link, "BEGIN"); | |
46 | ||
d75409bf | 47 | print "<ul class='nomarks'>"; |
3f363052 | 48 | |
d75409bf | 49 | $opml = new Opml($this->link, $_REQUEST); |
3f363052 | 50 | |
d75409bf | 51 | $opml->opml_import($_SESSION["uid"]); |
3f363052 | 52 | |
b77d0c4a AD |
53 | db_query($this->link, "COMMIT"); |
54 | ||
c4c74732 | 55 | print "</ul>"; |
3f363052 AD |
56 | print "</div>"; |
57 | ||
58 | print "<div align='center'>"; | |
59 | print "<button dojoType=\"dijit.form.Button\" | |
34aa9e20 | 60 | onclick=\"dijit.byId('opmlImportDlg').execute()\">". |
3f363052 AD |
61 | __('Close this window')."</button>"; |
62 | print "</div>"; | |
63 | ||
64 | print "</div>"; | |
65 | ||
66 | //return; | |
67 | } | |
68 | ||
69 | function editPrefProfiles() { | |
70 | print "<div dojoType=\"dijit.Toolbar\">"; | |
71 | ||
ddb575c7 AD |
72 | print "<div dojoType=\"dijit.form.DropDownButton\">". |
73 | "<span>" . __('Select')."</span>"; | |
74 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; | |
75 | print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\" | |
76 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; | |
77 | print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\" | |
78 | dojoType=\"dijit.MenuItem\">".__('None')."</div>"; | |
79 | print "</div></div>"; | |
80 | ||
81 | print "<div style=\"float : right\">"; | |
82 | ||
3f363052 AD |
83 | print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\" |
84 | required=\"1\"> | |
85 | <button dojoType=\"dijit.form.Button\" | |
86 | onclick=\"dijit.byId('profileEditDlg').addProfile()\">". | |
87 | __('Create profile')."</button></div>"; | |
88 | ||
ddb575c7 AD |
89 | print "</div>"; |
90 | ||
3f363052 AD |
91 | $result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles |
92 | WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); | |
93 | ||
94 | print "<div class=\"prefFeedCatHolder\">"; | |
95 | ||
96 | print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; | |
97 | ||
98 | print "<table width=\"100%\" class=\"prefFeedProfileList\" | |
99 | cellspacing=\"0\" id=\"prefFeedProfileList\">"; | |
100 | ||
ddb575c7 | 101 | print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd |
3f363052 AD |
102 | |
103 | print "<td width='5%' align='center'><input | |
ddb575c7 | 104 | id='FCATC-0' |
3f363052 AD |
105 | onclick='toggleSelectRow2(this);' |
106 | dojoType=\"dijit.form.CheckBox\" | |
107 | type=\"checkbox\"></td>"; | |
108 | ||
109 | if (!$_SESSION["profile"]) { | |
110 | $is_active = __("(active)"); | |
111 | } else { | |
112 | $is_active = ""; | |
113 | } | |
114 | ||
115 | print "<td><span>" . | |
116 | __("Default profile") . " $is_active</span></td>"; | |
117 | ||
118 | print "</tr>"; | |
119 | ||
120 | $lnum = 1; | |
121 | ||
122 | while ($line = db_fetch_assoc($result)) { | |
123 | ||
124 | $class = ($lnum % 2) ? "even" : "odd"; | |
125 | ||
126 | $profile_id = $line["id"]; | |
127 | $this_row_id = "id=\"FCATR-$profile_id\""; | |
128 | ||
ddb575c7 | 129 | print "<tr class=\"placeholder\" $this_row_id>"; |
3f363052 AD |
130 | |
131 | $edit_title = htmlspecialchars($line["title"]); | |
132 | ||
133 | print "<td width='5%' align='center'><input | |
134 | onclick='toggleSelectRow2(this);' | |
ddb575c7 | 135 | id='FCATC-$profile_id' |
3f363052 AD |
136 | dojoType=\"dijit.form.CheckBox\" |
137 | type=\"checkbox\"></td>"; | |
138 | ||
139 | if ($_SESSION["profile"] == $line["id"]) { | |
140 | $is_active = __("(active)"); | |
141 | } else { | |
142 | $is_active = ""; | |
143 | } | |
144 | ||
145 | print "<td><span dojoType=\"dijit.InlineEditBox\" | |
146 | width=\"300px\" autoSave=\"false\" | |
147 | profile-id=\"$profile_id\">" . $edit_title . | |
148 | "<script type=\"dojo/method\" event=\"onChange\" args=\"item\"> | |
149 | var elem = this; | |
150 | dojo.xhrPost({ | |
151 | url: 'backend.php', | |
152 | content: {op: 'rpc', method: 'saveprofile', | |
153 | value: this.value, | |
154 | id: this.srcNodeRef.getAttribute('profile-id')}, | |
155 | load: function(response) { | |
156 | elem.attr('value', response); | |
157 | } | |
158 | }); | |
159 | </script> | |
160 | </span> $is_active</td>"; | |
161 | ||
162 | print "</tr>"; | |
163 | ||
164 | ++$lnum; | |
165 | } | |
166 | ||
167 | print "</table>"; | |
168 | print "</form>"; | |
169 | print "</div>"; | |
170 | ||
171 | print "<div class='dlgButtons'> | |
172 | <div style='float : left'> | |
173 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">". | |
174 | __('Remove selected profiles')."</button> | |
175 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">". | |
176 | __('Activate profile')."</button> | |
177 | </div>"; | |
178 | ||
179 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">". | |
180 | __('Close this window')."</button>"; | |
181 | print "</div>"; | |
182 | ||
183 | } | |
184 | ||
185 | function pubOPMLUrl() { | |
186 | print "<title>".__('Public OPML URL')."</title>"; | |
187 | print "<content><![CDATA["; | |
188 | ||
189 | $url_path = opml_publish_url($this->link); | |
190 | ||
191 | print __("Your Public OPML URL is:"); | |
192 | ||
193 | print "<div class=\"tagCloudContainer\">"; | |
194 | print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>"; | |
195 | print "</div>"; | |
196 | ||
197 | print "<div align='center'>"; | |
198 | ||
199 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">". | |
200 | __('Generate new URL')."</button> "; | |
201 | ||
202 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
203 | __('Close this window')."</button>"; | |
204 | ||
205 | print "</div>"; | |
206 | print "]]></content>"; | |
207 | ||
208 | //return; | |
209 | } | |
210 | ||
211 | function explainError() { | |
212 | print "<title>".__('Notice')."</title>"; | |
213 | print "<content><![CDATA["; | |
214 | ||
215 | print "<div class=\"errorExplained\">"; | |
216 | ||
217 | if ($this->param == 1) { | |
218 | print __("Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner."); | |
219 | ||
220 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
221 | ||
222 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
223 | ||
224 | } | |
225 | ||
226 | if ($this->param == 3) { | |
227 | print __("Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner."); | |
228 | ||
229 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
230 | ||
231 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
232 | ||
233 | } | |
234 | ||
235 | print "</div>"; | |
236 | ||
237 | print "<div align='center'>"; | |
238 | ||
239 | print "<button onclick=\"return closeInfoBox()\">". | |
240 | __('Close this window')."</button>"; | |
241 | ||
242 | print "</div>"; | |
243 | print "]]></content>"; | |
244 | ||
245 | //return; | |
246 | } | |
247 | ||
248 | function quickAddFeed() { | |
249 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
250 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"addfeed\">"; | |
251 | ||
17525d01 | 252 | print "<div class=\"dlgSec\">".__("Feed or site URL")."</div>"; |
3f363052 AD |
253 | print "<div class=\"dlgSecCont\">"; |
254 | ||
23d2471c AD |
255 | print "<div style='float : right'> |
256 | <img style='display : none' | |
257 | id='feed_add_spinner' src='". | |
258 | theme_image($this->link, 'images/indicator_white.gif')."'></div>"; | |
259 | ||
3f363052 | 260 | print "<input style=\"font-size : 16px; width : 20em;\" |
17525d01 | 261 | placeHolder=\"".__("Feed or site URL")."\" |
3f363052 AD |
262 | dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; |
263 | ||
264 | print "<hr/>"; | |
265 | ||
266 | if (get_pref($this->link, 'ENABLE_FEED_CATS')) { | |
267 | print __('Place in category:') . " "; | |
268 | print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); | |
269 | } | |
270 | ||
271 | print "</div>"; | |
272 | ||
273 | print '<div id="feedDlg_feedsContainer" style="display : none"> | |
274 | ||
275 | <div class="dlgSec">' . __('Available feeds') . '</div> | |
276 | <div class="dlgSecCont">'. | |
277 | '<select id="feedDlg_feedContainerSelect" | |
278 | dojoType="dijit.form.Select" size="3"> | |
279 | <script type="dojo/method" event="onChange" args="value"> | |
280 | dijit.byId("feedDlg_feedUrl").attr("value", value); | |
281 | </script> | |
282 | </select>'. | |
283 | '</div></div>'; | |
284 | ||
285 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
286 | ||
287 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
288 | <div class=\"dlgSecCont\">". | |
289 | ||
290 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" | |
291 | placeHolder=\"".__("Login")."\" | |
292 | style=\"width : 10em;\"> ". | |
293 | " <input | |
294 | placeHolder=\"".__("Password")."\" | |
295 | dojoType=\"dijit.form.TextBox\" type='password' | |
17525d01 | 296 | style=\"width : 10em;\" name='pass'\"> |
3f363052 AD |
297 | </div></div>"; |
298 | ||
299 | ||
300 | print "<div style=\"clear : both\"> | |
aa60999b | 301 | <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" |
3f363052 AD |
302 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> |
303 | <label for=\"feedDlg_loginCheck\">". | |
304 | __('This feed requires authentication.')."</div>"; | |
305 | ||
306 | print "</form>"; | |
307 | ||
308 | print "<div class=\"dlgButtons\"> | |
c39befac AD |
309 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>"; |
310 | ||
311 | if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { | |
312 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>"; | |
313 | } | |
314 | ||
315 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button> | |
3f363052 AD |
316 | </div>"; |
317 | ||
318 | //return; | |
319 | } | |
320 | ||
321 | function feedBrowser() { | |
c39befac AD |
322 | if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; |
323 | ||
3f363052 AD |
324 | $browser_search = db_escape_string($_REQUEST["search"]); |
325 | ||
326 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
327 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">"; | |
328 | ||
329 | print "<div dojoType=\"dijit.Toolbar\"> | |
330 | <div style='float : right'> | |
331 | <img style='display : none' | |
332 | id='feed_browser_spinner' src='". | |
333 | theme_image($this->link, 'images/indicator_white.gif')."'> | |
334 | <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\" | |
335 | onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\"> | |
336 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button> | |
337 | </div>"; | |
338 | ||
339 | print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\"> | |
340 | <option value='1'>" . __('Popular feeds') . "</option> | |
341 | <option value='2'>" . __('Feed archive') . "</option> | |
342 | </select> "; | |
343 | ||
344 | print __("limit:"); | |
345 | ||
346 | print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; | |
347 | ||
348 | foreach (array(25, 50, 100, 200) as $l) { | |
349 | $issel = ($l == $limit) ? "selected=\"1\"" : ""; | |
350 | print "<option $issel value=\"$l\">$l</option>"; | |
351 | } | |
352 | ||
353 | print "</select> "; | |
354 | ||
355 | print "</div>"; | |
356 | ||
357 | $owner_uid = $_SESSION["uid"]; | |
358 | ||
359 | print "<ul class='browseFeedList' id='browseFeedList'>"; | |
360 | print make_feed_browser($this->link, $search, 25); | |
361 | print "</ul>"; | |
362 | ||
363 | print "<div align='center'> | |
364 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button> | |
365 | <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button> | |
366 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>"; | |
367 | ||
368 | } | |
369 | ||
370 | function search() { | |
371 | $this->params = explode(":", db_escape_string($_REQUEST["param"]), 2); | |
372 | ||
373 | $active_feed_id = sprintf("%d", $this->params[0]); | |
374 | $is_cat = $this->params[1] != "false"; | |
375 | ||
376 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; | |
377 | ||
378 | print "<div class=\"dlgSecCont\">"; | |
379 | ||
a8c18025 AD |
380 | print "<input dojoType=\"dijit.form.ValidationTextBox\" |
381 | style=\"font-size : 16px; width : 20em;\" | |
382 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
3f363052 AD |
383 | |
384 | print "<hr/>".__('Limit search to:')." "; | |
385 | ||
386 | print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\"> | |
387 | <option value=\"all_feeds\">".__('All feeds')."</option>"; | |
388 | ||
389 | $feed_title = getFeedTitle($this->link, $active_feed_id); | |
390 | ||
391 | if (!$is_cat) { | |
392 | $feed_cat_title = getFeedCatTitle($this->link, $active_feed_id); | |
393 | } else { | |
394 | $feed_cat_title = getCategoryTitle($this->link, $active_feed_id); | |
395 | } | |
396 | ||
397 | if ($active_feed_id && !$is_cat) { | |
398 | print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>"; | |
399 | } else { | |
400 | print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>"; | |
401 | } | |
402 | ||
403 | if ($is_cat) { | |
404 | $cat_preselected = "selected=\"1\""; | |
405 | } | |
406 | ||
407 | if (get_pref($this->link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
408 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; | |
409 | } else { | |
410 | //print "<option disabled>".__('This category')."</option>"; | |
411 | } | |
412 | ||
413 | print "</select>"; | |
414 | ||
415 | print "</div>"; | |
416 | ||
417 | print "<div class=\"dlgButtons\">"; | |
418 | ||
419 | if (!SPHINX_ENABLED) { | |
420 | print "<div style=\"float : left\"> | |
e8438e8f | 421 | <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">Search syntax</a> |
3f363052 AD |
422 | </div>"; |
423 | } | |
424 | ||
425 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button> | |
426 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button> | |
427 | </div>"; | |
428 | } | |
429 | ||
3f363052 AD |
430 | function editArticleTags() { |
431 | ||
432 | print __("Tags for this article (separated by commas):")."<br>"; | |
433 | ||
434 | $tags = get_article_tags($this->link, $this->param); | |
435 | ||
436 | $tags_str = join(", ", $tags); | |
437 | ||
438 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$this->param\">"; | |
439 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
440 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">"; | |
441 | ||
442 | print "<table width='100%'><tr><td>"; | |
443 | ||
444 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4' | |
445 | style='font-size : 12px; width : 100%' id=\"tags_str\" | |
446 | name='tags_str'>$tags_str</textarea> | |
447 | <div class=\"autocomplete\" id=\"tags_choices\" | |
448 | style=\"display:none\"></div>"; | |
449 | ||
450 | print "</td></tr></table>"; | |
451 | ||
452 | print "<div class='dlgButtons'>"; | |
453 | ||
454 | print "<button dojoType=\"dijit.form.Button\" | |
455 | onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> "; | |
456 | print "<button dojoType=\"dijit.form.Button\" | |
457 | onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>"; | |
458 | print "</div>"; | |
459 | ||
460 | } | |
461 | ||
462 | function printTagCloud() { | |
463 | print "<title>".__('Tag Cloud')."</title>"; | |
464 | print "<content><![CDATA["; | |
465 | ||
466 | print "<div class=\"tagCloudContainer\">"; | |
467 | ||
79178062 AD |
468 | // from here: http://www.roscripts.com/Create_tag_cloud-71.html |
469 | ||
470 | $query = "SELECT tag_name, COUNT(post_int_id) AS count | |
471 | FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]." | |
472 | GROUP BY tag_name ORDER BY count DESC LIMIT 50"; | |
473 | ||
474 | $result = db_query($this->link, $query); | |
475 | ||
476 | $tags = array(); | |
477 | ||
478 | while ($line = db_fetch_assoc($result)) { | |
479 | $tags[$line["tag_name"]] = $line["count"]; | |
480 | } | |
481 | ||
482 | if( count($tags) == 0 ){ return; } | |
483 | ||
484 | ksort($tags); | |
485 | ||
486 | $max_size = 32; // max font size in pixels | |
487 | $min_size = 11; // min font size in pixels | |
488 | ||
489 | // largest and smallest array values | |
490 | $max_qty = max(array_values($tags)); | |
491 | $min_qty = min(array_values($tags)); | |
492 | ||
493 | // find the range of values | |
494 | $spread = $max_qty - $min_qty; | |
495 | if ($spread == 0) { // we don't want to divide by zero | |
496 | $spread = 1; | |
497 | } | |
498 | ||
499 | // set the font-size increment | |
500 | $step = ($max_size - $min_size) / ($spread); | |
501 | ||
502 | // loop through the tag array | |
503 | foreach ($tags as $key => $value) { | |
504 | // calculate font-size | |
505 | // find the $value in excess of $min_qty | |
506 | // multiply by the font-size increment ($size) | |
507 | // and add the $min_size set above | |
508 | $size = round($min_size + (($value - $min_qty) * $step)); | |
509 | ||
510 | $key_escaped = str_replace("'", "\\'", $key); | |
511 | ||
512 | echo "<a href=\"javascript:viewfeed('$key_escaped') \" style=\"font-size: " . | |
513 | $size . "px\" title=\"$value articles tagged with " . | |
514 | $key . '">' . $key . '</a> '; | |
515 | } | |
516 | ||
517 | ||
3f363052 AD |
518 | |
519 | print "</div>"; | |
520 | ||
521 | print "<div align='center'>"; | |
522 | print "<button dojoType=\"dijit.form.Button\" | |
523 | onclick=\"return closeInfoBox()\">". | |
524 | __('Close this window')."</button>"; | |
525 | print "</div>"; | |
526 | ||
527 | print "]]></content>"; | |
528 | } | |
529 | ||
530 | function printTagSelect() { | |
46da73c2 | 531 | |
3f363052 AD |
532 | print "<title>" . __('Select item(s) by tags') . "</title>"; |
533 | print "<content><![CDATA["; | |
534 | ||
535 | print __("Match:"). " " . | |
536 | "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\"> Any "; | |
537 | print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\"> All "; | |
538 | print " tags."; | |
539 | ||
540 | print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">"; | |
541 | $result = db_query($this->link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']." | |
542 | AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC"); | |
543 | ||
544 | while ($row = db_fetch_assoc($result)) { | |
545 | $tmp = htmlspecialchars($row["tag_name"]); | |
546 | print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>"; | |
547 | } | |
548 | ||
549 | print "</select>"; | |
550 | ||
551 | print "<div align='right'>"; | |
552 | print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')), | |
553 | get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>"; | |
554 | print " "; | |
555 | print "<button dojoType=\"dijit.form.Button\" | |
556 | onclick=\"return closeInfoBox()\">" . | |
557 | __('Close this window') . "</button>"; | |
558 | print "</div>"; | |
559 | ||
560 | print "]]></content>"; | |
561 | } | |
562 | ||
3f363052 | 563 | function generatedFeed() { |
46da73c2 | 564 | |
3f363052 AD |
565 | print "<title>".__('View as RSS')."</title>"; |
566 | print "<content><![CDATA["; | |
567 | ||
568 | $this->params = explode(":", $this->param, 3); | |
569 | $feed_id = db_escape_string($this->params[0]); | |
570 | $is_cat = (bool) $this->params[1]; | |
571 | ||
572 | $key = get_feed_access_key($this->link, $feed_id, $is_cat); | |
573 | ||
574 | $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key; | |
575 | ||
ca6a0741 | 576 | print "<div class=\"dialogNotice\">" . __("You can view this feed as RSS using the following URL:") . "</div>"; |
3f363052 AD |
577 | |
578 | print "<div class=\"tagCloudContainer\">"; | |
579 | print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>"; | |
580 | print "</div>"; | |
581 | ||
582 | print "<div align='center'>"; | |
583 | ||
584 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">". | |
585 | __('Generate new URL')."</button> "; | |
586 | ||
587 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
588 | __('Close this window')."</button>"; | |
589 | ||
590 | print "</div>"; | |
591 | print "]]></content>"; | |
592 | ||
593 | //return; | |
594 | } | |
595 | ||
596 | function newVersion() { | |
46da73c2 | 597 | |
3f363052 AD |
598 | $version_data = check_for_update($this->link); |
599 | $version = $version_data['version']; | |
600 | $id = $version_data['version_id']; | |
601 | ||
602 | print "<div class='tagCloudContainer'>"; | |
603 | ||
604 | print T_sprintf("New version of Tiny Tiny RSS is available (%s).", | |
605 | "<b>$version</b>"); | |
606 | ||
607 | print "</div>"; | |
608 | ||
e8438e8f | 609 | $details = "http://tt-rss.org/redmine/versions/$id"; |
3f363052 AD |
610 | $download = "http://tt-rss.org/#Download"; |
611 | ||
4c97d1f6 | 612 | print "<p align='center'>".__("You can update using built-in updater in the Preferences or by using update.php")."</p>"; |
366f06f7 | 613 | |
3f363052 AD |
614 | print "<div style='text-align : center'>"; |
615 | print "<button dojoType=\"dijit.form.Button\" | |
616 | onclick=\"return window.open('$details')\">".__("Details")."</button>"; | |
617 | print "<button dojoType=\"dijit.form.Button\" | |
618 | onclick=\"return window.open('$download')\">".__("Download")."</button>"; | |
619 | print "<button dojoType=\"dijit.form.Button\" | |
620 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
621 | __('Close this window')."</button>"; | |
622 | print "</div>"; | |
623 | ||
624 | } | |
625 | ||
626 | function customizeCSS() { | |
627 | $value = get_pref($this->link, "USER_STYLESHEET"); | |
628 | ||
629 | $value = str_replace("<br/>", "\n", $value); | |
630 | ||
ca6a0741 | 631 | print "<div class=\"dialogNotice\">"; |
3f363052 | 632 | print T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css"); |
ca6a0741 | 633 | print "</div>"; |
3f363052 AD |
634 | |
635 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
636 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">"; | |
637 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; | |
638 | ||
639 | print "<table width='100%'><tr><td>"; | |
640 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" | |
641 | style='font-size : 12px; width : 100%; height: 200px;' | |
642 | placeHolder='body#ttrssMain { font-size : 14px; };' | |
643 | name='value'>$value</textarea>"; | |
644 | print "</td></tr></table>"; | |
645 | ||
646 | print "<div class='dlgButtons'>"; | |
647 | print "<button dojoType=\"dijit.form.Button\" | |
648 | onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> "; | |
649 | print "<button dojoType=\"dijit.form.Button\" | |
650 | onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>"; | |
651 | print "</div>"; | |
652 | ||
653 | } | |
654 | ||
3f363052 AD |
655 | function addInstance() { |
656 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">"; | |
657 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">"; | |
658 | ||
659 | print "<div class=\"dlgSec\">".__("Instance")."</div>"; | |
660 | ||
661 | print "<div class=\"dlgSecCont\">"; | |
662 | ||
663 | /* URL */ | |
664 | ||
665 | print __("URL:") . " "; | |
666 | ||
667 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
668 | placeHolder=\"".__("Instance URL")."\" | |
669 | regExp='^(http|https)://.*' | |
670 | style=\"font-size : 16px; width: 20em\" name=\"access_url\">"; | |
671 | ||
672 | print "<hr/>"; | |
673 | ||
674 | $access_key = sha1(uniqid(rand(), true)); | |
675 | ||
676 | /* Access key */ | |
677 | ||
678 | print __("Access key:") . " "; | |
679 | ||
680 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
681 | placeHolder=\"".__("Access key")."\" regExp='\w{40}' | |
682 | style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\" | |
683 | value=\"$access_key\">"; | |
684 | ||
685 | print "<p class='insensitive'>" . __("Use one access key for both linked instances."); | |
686 | ||
687 | print "</div>"; | |
688 | ||
689 | print "<div class=\"dlgButtons\"> | |
690 | <div style='float : left'> | |
691 | <button dojoType=\"dijit.form.Button\" | |
692 | onclick=\"return dijit.byId('instanceAddDlg').regenKey()\">". | |
693 | __('Generate new key')."</button> | |
694 | </div> | |
695 | <button dojoType=\"dijit.form.Button\" | |
696 | onclick=\"return dijit.byId('instanceAddDlg').execute()\">". | |
697 | __('Create link')."</button> | |
698 | <button dojoType=\"dijit.form.Button\" | |
699 | onclick=\"return dijit.byId('instanceAddDlg').hide()\"\">". | |
700 | __('Cancel')."</button></div>"; | |
701 | ||
702 | return; | |
703 | } | |
704 | ||
55f34b81 AD |
705 | function dataImport() { |
706 | header("Content-Type: text/html"); # required for iframe | |
707 | ||
708 | print "<div style='text-align : center'>"; | |
709 | ||
710 | if (is_file($_FILES['export_file']['tmp_name'])) { | |
711 | ||
712 | perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']); | |
713 | ||
714 | } else { | |
715 | print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize | |
716 | in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>"; | |
717 | ||
718 | } | |
719 | ||
720 | print "<button dojoType=\"dijit.form.Button\" | |
721 | onclick=\"dijit.byId('dataImportDlg').hide()\">". | |
722 | __('Close this window')."</button>"; | |
723 | ||
724 | print "</div>"; | |
725 | ||
726 | } | |
727 | ||
33f0fdd0 AD |
728 | function batchSubscribe() { |
729 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
730 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">"; | |
731 | ||
732 | print "<table width='100%'><tr><td> | |
733 | ".__("Add one valid RSS feed per line (no feed detection is done)")." | |
734 | </td><td align='right'>"; | |
735 | if (get_pref($this->link, 'ENABLE_FEED_CATS')) { | |
736 | print __('Place in category:') . " "; | |
737 | print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); | |
738 | } | |
739 | print "</td></tr><tr><td colspan='2'>"; | |
740 | print "<textarea | |
741 | style='font-size : 12px; width : 100%; height: 200px;' | |
742 | placeHolder=\"".__("Feeds to subscribe, One per line")."\" | |
743 | dojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>"; | |
744 | ||
745 | print "</td></tr><tr><td colspan='2'>"; | |
746 | ||
747 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
748 | " . | |
749 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" | |
750 | placeHolder=\"".__("Login")."\" | |
751 | style=\"width : 10em;\"> ". | |
752 | " <input | |
753 | placeHolder=\"".__("Password")."\" | |
754 | dojoType=\"dijit.form.TextBox\" type='password' | |
755 | style=\"width : 10em;\" name='pass'\">". | |
7ac3f735 | 756 | "</div>"; |
33f0fdd0 AD |
757 | |
758 | print "</td></tr><tr><td colspan='2'>"; | |
759 | ||
760 | print "<div style=\"clear : both\"> | |
761 | <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" | |
762 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> | |
763 | <label for=\"feedDlg_loginCheck\">". | |
764 | __('Feeds require authentication.')."</div>"; | |
765 | ||
766 | print "</form>"; | |
767 | ||
768 | print "</td></tr></table>"; | |
769 | ||
770 | print "<div class=\"dlgButtons\"> | |
771 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">".__('Subscribe')."</button> | |
772 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button> | |
773 | </div>"; | |
774 | } | |
775 | ||
3f363052 AD |
776 | } |
777 | ?> |