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