]> git.wh0rd.org - tt-rss.git/blame - modules/popup-dialog.php
add article forwarding by email (closes #271)
[tt-rss.git] / modules / popup-dialog.php
CommitLineData
ef8be8ea
AD
1<?php
2 function module_popup_dialog($link) {
b4e75b2a
AD
3 $id = $_REQUEST["id"];
4 $param = db_escape_string($_REQUEST["param"]);
ef8be8ea 5
b6a6e262
AD
6 if ($id == "importOpml") {
7 print "<div id=\"infoBoxTitle\">".__('OPML Import')."</div>";
8 print "<div class=\"infoBoxContents\">";
9
10 print "<div class=\"prefFeedCatHolder\">";
11
12 $owner_uid = $_SESSION["uid"];
13
14 db_query($link, "BEGIN");
15
16 /* create Imported feeds category just in case */
17
18 $result = db_query($link, "SELECT id FROM
19 ttrss_feed_categories WHERE title = 'Imported feeds' AND
20 owner_uid = '$owner_uid' LIMIT 1");
21
22 if (db_num_rows($result) == 0) {
23 db_query($link, "INSERT INTO ttrss_feed_categories
24 (title,owner_uid)
25 VALUES ('Imported feeds', '$owner_uid')");
26 }
27
28 db_query($link, "COMMIT");
29
30 /* Handle OPML import by DOMXML/DOMDocument */
31
32 if (function_exists('domxml_open_file')) {
33 print "<ul class='nomarks'>";
34 print "<li>".__("Importing using DOMXML.")."</li>";
eef20159 35 require_once "opml_domxml.php";
b6a6e262
AD
36 opml_import_domxml($link, $owner_uid);
37 print "</ul>";
38 } else if (PHP_VERSION >= 5) {
39 print "<ul class='nomarks'>";
40 print "<li>".__("Importing using DOMDocument.")."</li>";
eef20159 41 require_once "opml_domdoc.php";
b6a6e262
AD
42 opml_import_domdoc($link, $owner_uid);
43 print "</ul>";
44 } else {
45 print_error(__("DOMXML extension is not found. It is required for PHP versions below 5."));
46 }
47
48 print "</div>";
49
50 print "<div align='center'>";
51
f94ba975
AD
52 print "<button onclick=\"return opmlImportDone()\">".
53 __('Close this window')."</button>";
b6a6e262
AD
54
55 print "</div>";
56
57 print "<script type=\"text/javascript\">";
c3b7b797 58 print "parent.opmlImportHandler(this)";
b6a6e262
AD
59 print "</script>";
60
61 print "</div></div>";
62
63 return;
64 }
65
d9084cf2
AD
66 if ($id == "editPrefProfiles") {
67
68 print "<div id=\"infoBoxTitle\">".__('Settings Profiles')."</div>";
69 print "<div class=\"infoBoxContents\">";
70
71 print "<div><input id=\"fadd_profile\"
72 onkeypress=\"return filterCR(event, addPrefProfile)\"
73 size=\"40\">
74 <button onclick=\"javascript:addPrefProfile()\">".
75 __('Create profile')."</button></div>";
76
77 print "<p>";
78
79 $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles
47179c0e 80 WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
d9084cf2
AD
81
82 print __('Select:')."
83 <a href=\"javascript:selectPrefRows('fcat', true)\">".__('All')."</a>,
84 <a href=\"javascript:selectPrefRows('fcat', false)\">".__('None')."</a>";
85
86 print "<div class=\"prefFeedCatHolder\">";
87
88 print "<form id=\"profile_edit_form\" onsubmit=\"return false\">";
89
90 print "<table width=\"100%\" class=\"prefFeedCatList\"
91 cellspacing=\"0\" id=\"prefFeedCatList\">";
92
93 print "<tr class=\"odd\" id=\"FCATR-0\">";
94
95 print "<td width='5%' align='center'><input
96 onclick='toggleSelectPrefRow(this, \"fcat\");'
97 type=\"checkbox\" id=\"FCCHK-0\"></td>";
98
ac9dbf85
AD
99 if (!$_SESSION["profile"]) {
100 $is_active = __("(active)");
101 } else {
102 $is_active = "";
103 }
104
d9084cf2 105 print "<td><span id=\"FCATT-0\">" .
ac9dbf85 106 __("Default profile") . " $is_active</span></td>";
d9084cf2
AD
107
108 print "</tr>";
109
110 $lnum = 1;
111
112 while ($line = db_fetch_assoc($result)) {
113
114 $class = ($lnum % 2) ? "even" : "odd";
115
116 $cat_id = $line["id"];
117 $this_row_id = "id=\"FCATR-$cat_id\"";
118
119 print "<tr class=\"$class\" $this_row_id>";
120
121 $edit_title = htmlspecialchars($line["title"]);
122
123 print "<td width='5%' align='center'><input
124 onclick='toggleSelectPrefRow(this, \"fcat\");'
125 type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>";
126
127 if ($_SESSION["profile"] == $line["id"]) {
128 $is_active = __("(active)");
129 } else {
130 $is_active = "";
131 }
132
133 print "<td><span id=\"FCATT-$cat_id\">" .
134 $edit_title . "</span> $is_active</td>";
135
136 print "</tr>";
137
138 ++$lnum;
139 }
140
141 print "</table>";
142 print "</form>";
143 print "</div>";
144
145 print "<div class='dlgButtons'>
146 <div style='float : left'>
147 <button onclick=\"return removeSelectedPrefProfiles()\">".
148 __('Remove')."</button>
8ab4da5f
AD
149 <button onclick=\"return activatePrefProfile()\">".
150 __('Activate')."</button>
d9084cf2
AD
151 </div>";
152
8ab4da5f
AD
153 print "<button onclick=\"return closeInfoBox()\">".
154 __('Close this window')."</button>";
d9084cf2
AD
155
156 print "</div></div>";
157
158 return;
159 }
160
cf9dc032
AD
161 if ($id == "pubUrl") {
162
163 print "<div id=\"infoBoxTitle\">".__('Published Articles')."</div>";
164 print "<div class=\"infoBoxContents\">";
165
166 $url_path = article_publish_url($link);
167
168 print __("Your Published articles feed URL is:");
169
170 print "<div class=\"tagCloudContainer\">";
171 print "<a id='pub_feed_url' href='$url_path' target='_blank'>$url_path</a>";
172 print "</div>";
173
174 print "<div align='center'>";
175
176 print "<button onclick=\"return pubRegenKey()\">".
177 __('Generate new URL')."</button> ";
178
179 print "<input class=\"button\"
180 type=\"submit\" onclick=\"return closeInfoBox()\"
c8640eda
MK
181 value=\"".__('Close this window')."\">";
182
183 print "</div></div>";
184
185 return;
186 }
187
188 if ($id == "pubOPMLUrl") {
189
190 print "<div id=\"infoBoxTitle\">".__('Public OPML URL')."</div>";
191 print "<div class=\"infoBoxContents\">";
192
193 $url_path = opml_publish_url($link);
194
195 print __("Your Public OPML URL is:");
196
197 print "<div class=\"tagCloudContainer\">";
198 print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>";
199 print "</div>";
200
201 print "<div align='center'>";
202
203 print "<button onclick=\"return opmlRegenKey()\">".
204 __('Generate new URL')."</button> ";
205
206 print "<input class=\"button\"
207 type=\"submit\" onclick=\"return closeInfoBox()\"
cf9dc032
AD
208 value=\"".__('Close this window')."\">";
209
210 print "</div></div>";
211
212 return;
213 }
214
ef16ae37
AD
215 if ($id == "explainError") {
216
cc17c205 217 print "<div id=\"infoBoxTitle\">".__('Notice')."</div>";
ef16ae37
AD
218 print "<div class=\"infoBoxContents\">";
219
73495fd1
AD
220 print "<div class=\"errorExplained\">";
221
ef16ae37 222 if ($param == 1) {
73495fd1 223 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.");
f6854e44 224
1ea20897 225 $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp");
f6854e44
AD
226
227 print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp);
228
ef16ae37
AD
229 }
230
d9fa39f1 231 if ($param == 2) {
73495fd1 232 $msg = check_for_update($link);
4d1d0a45
AD
233
234 if (!$msg) {
73495fd1 235 print __("You are running the latest version of Tiny Tiny RSS. The fact that you are seeing this dialog is probably a bug.");
4d1d0a45
AD
236 } else {
237 print $msg;
238 }
d9fa39f1
AD
239
240 }
241
8e00ae9b 242 if ($param == 3) {
73495fd1 243 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.");
f6854e44 244
1ea20897 245 $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp");
f6854e44
AD
246
247 print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp);
248
8e00ae9b
AD
249 }
250
ef16ae37 251 print "</div>";
73495fd1 252
ef16ae37
AD
253 print "<div align='center'>";
254
255 print "<input class=\"button\"
256 type=\"submit\" onclick=\"return closeInfoBox()\"
cc17c205 257 value=\"".__('Close this window')."\">";
ef16ae37 258
73495fd1 259 print "</div></div>";
ef16ae37 260
5e6f933a 261 return;
ef16ae37
AD
262 }
263
ef8be8ea
AD
264 if ($id == "quickAddFeed") {
265
ecace165 266 print "<div id=\"infoBoxTitle\">".__('Subscribe to Feed')."</div>";
ef8be8ea
AD
267 print "<div class=\"infoBoxContents\">";
268
e6312f6c 269 print "<form id='feed_add_form' onsubmit='return false'>";
ef8be8ea 270
a5819bb3
AD
271 print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
272 print "<input type=\"hidden\" name=\"subop\" value=\"addfeed\">";
273 //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
ef8be8ea 274
ecace165
AD
275 print "<div class=\"dlgSec\">".__("Feed")."</div>";
276 print "<div class=\"dlgSecCont\">";
277
278 print __("URL:") . " ";
279
f88c7814 280 print "<input size=\"40\"
18ab3d7a 281 onkeypress=\"return filterCR(event, subscribeToFeed)\"
31a53903 282 name=\"feed\" id=\"feed_url\">";
ecace165
AD
283
284 print "<br/>";
285
ef8be8ea 286 if (get_pref($link, 'ENABLE_FEED_CATS')) {
ecace165 287 print __('Place in category:') . " ";
a5819bb3 288 print_feed_cat_select($link, "cat");
ef8be8ea
AD
289 }
290
ecace165
AD
291 print "</div>";
292
b9073cd9 293 print "<div id='fadd_login_container' style='display:none'>
ecace165
AD
294
295 <div class=\"dlgSec\">".__("Authentication")."</div>
296 <div class=\"dlgSecCont\">".
297
a5819bb3 298 __('Login:') . " <input name='login' size=\"20\"
ecace165
AD
299 onkeypress=\"return filterCR(event, subscribeToFeed)\"> ".
300 __('Password:') . "<input type='password'
a5819bb3 301 name='pass' size=\"20\"
ecace165
AD
302 onkeypress=\"return filterCR(event, subscribeToFeed)\">
303 </div></div>";
304
305
306 print "<div style=\"clear : both\">
307 <input type=\"checkbox\" id=\"fadd_login_check\"
308 onclick='checkboxToggleElement(this, \"fadd_login_container\")'>
309 <label for=\"fadd_login_check\">".
310 __('This feed requires authentication.')."</div>";
f27de515 311
ef8be8ea
AD
312 print "</form>";
313
ecace165 314 print "<div class=\"dlgButtons\">
f88c7814
AD
315 <button class=\"button\" id=\"fadd_submit_btn\"
316 onclick=\"return subscribeToFeed()\">".__('Subscribe')."</button>
d002edc7 317 <button onclick=\"return displayDlg('feedBrowser')\">".__('More feeds')."</button>
f88c7814 318 <button onclick=\"return closeInfoBox()\">".__('Cancel')."</button></div>";
ecace165 319
5e6f933a 320 return;
ef8be8ea
AD
321 }
322
ef88b1cc
AD
323 if ($id == "feedBrowser") {
324
325 print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>";
326
327 print "<div class=\"infoBoxContents\">";
328
329 $browser_search = db_escape_string($_REQUEST["search"]);
330
331 print "<form onsubmit='return false;' display='inline'
332 name='feed_browser' id='feed_browser'>";
333
334 print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
335 print "<input type=\"hidden\" name=\"subop\" value=\"updateFeedBrowser\">";
336
337 print "
338 <div style='float : right'>
339 <img style='display : none'
883fee8d
AD
340 id='feed_browser_spinner' src='".
341 theme_image($link, 'images/indicator_white.gif')."'>
ef88b1cc
AD
342 <input name=\"search\" size=\"20\" type=\"search\"
343 onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\">
344 <button onclick=\"javascript:updateFeedBrowser()\">".__('Search')."</button>
345 </div>";
346
347 print " <select name=\"mode\" onchange=\"updateFeedBrowser()\">
348 <option value='1'>" . __('Popular feeds') . "</option>
349 <option value='2'>" . __('Feed archive') . "</option>
350 </select> ";
351
352 print __("limit:");
353
354 print " <select name=\"limit\" onchange='updateFeedBrowser()'>";
355
356 foreach (array(25, 50, 100, 200) as $l) {
357 $issel = ($l == $limit) ? "selected" : "";
358 print "<option $issel>$l</option>";
359 }
360
361 print "</select> ";
362
363 print "<p>";
364
365 $owner_uid = $_SESSION["uid"];
366
d9084cf2
AD
367/* print __('Select:')."
368 <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>,
369 <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */
370
ef88b1cc
AD
371 print "<ul class='browseFeedList' id='browseFeedList'>";
372 print_feed_browser($link, $search, 25);
373 print "</ul>";
374
375 print "<div align='center'>
376 <button onclick=\"feedBrowserSubscribe()\">".__('Subscribe')."</button>
d9084cf2 377 <button style='display : none' id='feed_archive_remove' onclick=\"feedArchiveRemove()\">".__('Remove')."</button>
ef88b1cc
AD
378 <button onclick=\"closeInfoBox()\" >".__('Cancel')."</button></div>";
379
380 print "</div>";
381 return;
382 }
383
ef8be8ea
AD
384 if ($id == "search") {
385
cc17c205 386 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
ef8be8ea
AD
387 print "<div class=\"infoBoxContents\">";
388
e6312f6c 389 print "<form id='search_form' onsubmit='return false'>";
ef8be8ea 390
b4e75b2a 391 #$active_feed_id = db_escape_string($_REQUEST["param"]);
ef8be8ea 392
b4e75b2a 393 $params = split(":", db_escape_string($_REQUEST["param"]));
ef8be8ea
AD
394
395 $active_feed_id = sprintf("%d", $params[0]);
396 $is_cat = $params[1] == "true";
397
de85cac2 398 print "<div class=\"dlgSec\">".__('Look for')."</div>";
5bac8c29
AD
399
400 print "<div class=\"dlgSecCont\">";
401
69d582f0
AD
402 print "<input onkeypress=\"return filterCR(event, search)\"
403 name=\"query\" size=\"20\" type=\"search\" value=''>";
5bac8c29 404
b1710666 405 print " " . __('match on')." ";
5bac8c29
AD
406
407 $search_fields = array(
408 "title" => __("Title"),
409 "content" => __("Content"),
410 "both" => __("Title or content"));
411
412 print_select_hash("match_on", 3, $search_fields);
413
414
415 print "<br/>".__('Limit search to:')." ";
ef8be8ea
AD
416
417 print "<select name=\"search_mode\">
cc17c205 418 <option value=\"all_feeds\">".__('All feeds')."</option>";
ef8be8ea
AD
419
420 $feed_title = getFeedTitle($link, $active_feed_id);
421
422 if (!$is_cat) {
423 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
424 } else {
425 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
426 }
427
428 if ($active_feed_id && !$is_cat) {
cc17c205 429 print "<option selected value=\"this_feed\">$feed_title</option>";
ef8be8ea 430 } else {
cc17c205 431 print "<option disabled>".__('This feed')."</option>";
ef8be8ea
AD
432 }
433
434 if ($is_cat) {
435 $cat_preselected = "selected";
436 }
437
438 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
cc17c205 439 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
ef8be8ea 440 } else {
c4b0f96c 441 //print "<option disabled>".__('This category')."</option>";
ef8be8ea
AD
442 }
443
5bac8c29 444 print "</select>";
ef8be8ea 445
5bac8c29 446 print "</div>";
ef8be8ea
AD
447
448 print "</form>";
449
5bac8c29 450 print "<div class=\"dlgButtons\">
d60009cd 451 <button onclick=\"javascript:search()\">".__('Search')."</button>
55132a45 452 <button onclick=\"javascript:closeInfoBox(true)\">".__('Cancel')."</button>
ad491d75 453 </div>";
ef8be8ea
AD
454
455 print "</div>";
456
5e6f933a
AD
457 return;
458
ef8be8ea
AD
459 }
460
ef8be8ea
AD
461 if ($id == "quickAddFilter") {
462
b4e75b2a 463 $active_feed_id = db_escape_string($_REQUEST["param"]);
ef8be8ea 464
ecace165 465 print "<div id=\"infoBoxTitle\">".__('Create Filter')."</div>";
ef8be8ea
AD
466 print "<div class=\"infoBoxContents\">";
467
e6312f6c 468 print "<form id=\"filter_add_form\" onsubmit='return false'>";
ef8be8ea
AD
469
470 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
471 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
472 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
ef8be8ea
AD
473
474 $result = db_query($link, "SELECT id,description
475 FROM ttrss_filter_types ORDER BY description");
476
477 $filter_types = array();
478
479 while ($line = db_fetch_assoc($result)) {
480 //array_push($filter_types, $line["description"]);
89cb787e 481 $filter_types[$line["id"]] = __($line["description"]);
ef8be8ea
AD
482 }
483
10fa6615
AD
484 print "<div class=\"dlgSec\">".__("Match")."</div>";
485
486 print "<div class=\"dlgSecCont\">";
487
d0da85c2 488 print "<span id=\"filter_dlg_date_mod_box\" style=\"display : none\">";
6e278744 489 print __("Date") . " ";
44d0e774
AD
490
491 $filter_params = array(
492 "before" => __("before"),
493 "after" => __("after"));
494
495 print_select_hash("filter_date_modifier", "before", $filter_params);
496
497 print "&nbsp;</span>";
d0da85c2 498
8df90057 499 print "<input onkeypress=\"return filterCR(event, createFilter)\"
ad491d75 500 name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">";
10fa6615 501
6e278744 502 print "<span id=\"filter_dlg_date_chk_box\" style=\"display : none\">";
d0da85c2
AD
503 print "&nbsp;<input class=\"button\"
504 type=\"submit\" onclick=\"return filterDlgCheckDate()\"
6e278744 505 value=\"".__('Check it')."\">";
d0da85c2
AD
506 print "</span>";
507
508 print "<br/> " . __("on field") . " ";
509 print_select_hash("filter_type", 1, $filter_types,
510 'onchange="filterDlgCheckType(this)"');
10fa6615
AD
511
512 print "<br/>";
513
514 print __("in") . " ";
515 print_feed_select($link, "feed_id", $active_feed_id);
516
517 print "</div>";
518
ecace165 519 print "<div class=\"dlgSec\">".__("Perform Action")."</div>";
10fa6615
AD
520
521 print "<div class=\"dlgSecCont\">";
522
523 print "<select name=\"action_id\"
524 onchange=\"filterDlgCheckAction(this)\">";
525
526 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
527 ORDER BY name");
528
529 while ($line = db_fetch_assoc($result)) {
530 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
531 }
532
533 print "</select>";
534
143a4973
AD
535 print "<span id=\"filter_dlg_param_box\" style=\"display : none\">";
536 print " " . __("with parameters:") . " ";
537 print "<input size=\"20\"
074bf20c 538 onkeypress=\"return filterCR(event, createFilter)\"
143a4973 539 name=\"action_param\">";
6427a306
AD
540
541 print_label_select($link, "action_param_label", $action_param);
542
143a4973 543 print "</span>";
10fa6615 544
143a4973 545 print "&nbsp;"; // tiny layout hack
10fa6615
AD
546
547 print "</div>";
548
549 print "<div class=\"dlgSec\">".__("Options")."</div>";
550 print "<div class=\"dlgSecCont\">";
551
ecace165
AD
552 print "<div style=\"line-height : 100%\">";
553
10fa6615
AD
554 print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">
555 <label for=\"enabled\">".__('Enabled')."</label><br/>";
556
557 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
558 <label for=\"inverse\">".__('Inverse match')."</label>";
559
560 print "</div>";
ecace165 561 print "</div>";
10fa6615 562
ef8be8ea
AD
563 print "</form>";
564
10fa6615 565 print "<div class=\"dlgButtons\">";
ef8be8ea 566
ad491d75
AD
567 print "<button onclick=\"return createFilter()\">".
568 __('Create')."</button> ";
ef8be8ea 569
ad491d75
AD
570 print "<button onclick=\"return closeInfoBox()\">".__('Cancel').
571 "</button>";
ef8be8ea
AD
572
573 print "</div>";
574
575// print "</td></tr></table>";
576
5e6f933a 577 return;
ef8be8ea
AD
578 }
579
a3656a41
AD
580 if ($id == "feedUpdateErrors") {
581
cc17c205 582 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
a3656a41
AD
583 print "<div class=\"infoBoxContents\">";
584
cc17c205 585 print __("These feeds have not been updated because of errors:");
a3656a41
AD
586
587 $result = db_query($link, "SELECT id,title,feed_url,last_error
588 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
589
e8dd519b 590 print "<ul class='feedErrorsList'>";
a3656a41
AD
591
592 while ($line = db_fetch_assoc($result)) {
593 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
594 "<em>" . $line["last_error"] . "</em>";
595 }
596
597 print "</ul>";
a3656a41
AD
598
599 print "<div align='center'>";
600
a522a767
AD
601 print "<button onclick=\"return closeInfoBox()\">".
602 __('Close this window')."</button>";
a3656a41
AD
603
604 print "</div>";
605
aa330b93 606 return;
a3656a41
AD
607 }
608
0b126ac2
AD
609 if ($id == "editArticleTags") {
610
cc17c205 611 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
0b126ac2
AD
612 print "<div class=\"infoBoxContents\">";
613
e6312f6c 614 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
0b126ac2 615
cc17c205 616 print __("Tags for this article (separated by commas):")."<br>";
0b126ac2
AD
617
618 $tags = get_article_tags($link, $param);
619
620 $tags_str = join(", ", $tags);
621
d62a3b63
AD
622 print "<table width='100%'>";
623
624 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
625
05fcdf52
AD
626 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
627 name='tags_str'>$tags_str</textarea>
628 <div class=\"autocomplete\" id=\"tags_choices\"
629 style=\"display:none\"></div>
630 </td></tr>";
d62a3b63 631
d62a3b63 632 print "</table>";
0b126ac2
AD
633
634 print "</form>";
635
636 print "<div align='right'>";
637
2ae69126
AD
638 print "<button onclick=\"return editTagsSave()\">".__('Save')."</button> ";
639 print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>";
0b126ac2
AD
640
641 print "</div>";
642
5e6f933a 643 return;
0b126ac2
AD
644 }
645
0979b696 646 if ($id == "printTagCloud") {
d60009cd 647 print "<div id=\"infoBoxTitle\">".__('Tag Cloud')."</div>";
0979b696
AD
648 print "<div class=\"infoBoxContents\">";
649
dcac082b 650 print __("Showing most popular tags ")." (<a
326469fc 651 href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>";
0979b696
AD
652
653 print "<div class=\"tagCloudContainer\">";
654
655 printTagCloud($link);
656
657 print "</div>";
658
659 print "<div align='center'>";
d60009cd
AD
660 print "<button onclick=\"return closeInfoBox()\">".
661 __('Close this window')."</button>";
0979b696
AD
662 print "</div>";
663
664 print "</div>";
665
666 return;
667 }
668
31a53903
AD
669 if ($id == "emailArticle") {
670
671 print "<div id=\"infoBoxTitle\">".__('Forward article by email')."</div>";
87b16a0a
AD
672 print "<div class=\"infoBoxContents\">";
673
31a53903 674 print "<form id=\"article_email_form\" onsubmit='return false'>";
87b16a0a 675
31a53903 676 $secretkey = sha1(make_password(10));
87b16a0a 677
31a53903 678 $_SESSION['email_secretkey'] = $secretkey;
87b16a0a 679
31a53903
AD
680 print "<input type=\"hidden\" name=\"secretkey\" value=\"$secretkey\">";
681 print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
682 print "<input type=\"hidden\" name=\"subop\" value=\"sendEmail\">";
87b16a0a 683
31a53903 684 require_once "lib/MiniTemplator.class.php";
87b16a0a 685
31a53903
AD
686 $tpl = new MiniTemplator;
687 $tpl_t = new MiniTemplator;
87b16a0a 688
31a53903 689 $tpl->readTemplateFromFile("templates/email_article_template.txt");
6a1cd591 690
31a53903
AD
691 $result = db_query($link, "SELECT link, content, title
692 FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
693 id = '$param' AND owner_uid = " . $_SESSION["uid"]);
6a1cd591 694
31a53903
AD
695 $line = db_fetch_assoc($result);
696
697 $subject = htmlspecialchars(__("[Forwarded]") . " " . $line["title"]);
698
699 $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
700
701/* $tpl->setVariable('ARTICLE_EXCERPT',
702 truncate_string(strip_tags($line["content"]), 200)); */
703
704 $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
705
706 $result = db_query($link, "SELECT email FROM ttrss_users WHERE
707 id = " . $_SESSION["uid"]);
708
709 $user_email = htmlspecialchars(db_fetch_result($result, 0, "email"));
710 $user_name = htmlspecialchars($_SESSION["name"]);
711
712 //print "<input type=\"hidden\" name=\"replyto\" value=\"$user_email\">";
713 //print "<input type=\"hidden\" name=\"fromname\" value=\"$user_name\">";
714
715 $_SESSION['email_replyto'] = $user_email;
716 $_SESSION['email_fromname'] = $user_name;
717
718 $tpl->setVariable('USER_NAME', $_SESSION["name"]);
719 $tpl->setVariable('USER_EMAIL', $user_email);
720 $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]);
721
722 $tpl->addBlock('email');
723
724 $content = "";
725 $tpl->generateOutputToString($content);
726
727 print "<table width='100%'><tr><td>";
728
729 print __('From:');
730
731 print "</td><td>";
732
733 print "<input size=\"40\" disabled
734 onkeypress=\"return filterCR(event, false)\"
735 value=\"$user_name <$user_email>\">";
736
737 print "</td></tr><tr><td>";
738
739 print __('To:');
740
741 print "</td><td>";
742
743 print "<input size=\"40\"
744 onkeypress=\"return filterCR(event, false)\"
745 name=\"destination\" id=\"destination\">";
746
747 print "<div class=\"autocomplete\" id=\"destination_choices\"
748 style=\"display:none\"></div>";
749
750 print "</td></tr><tr><td>";
751
752 print __('Subject:');
753
754 print "</td><td>";
755
756 print "<input size=\"60\" class=\"iedit\"
757 onkeypress=\"return filterCR(event, false)\"
758 name=\"subject\" value=\"$subject\" id=\"subject\">";
759
760 print "</td></tr></table>";
761
762 print "<textarea rows='10' class='iedit' style='font-size : small'
763 name='content'>$content</textarea>";
87b16a0a
AD
764
765 print "</form>";
766
31a53903
AD
767 print "<div class='dlgButtons'>";
768
769 print "<button onclick=\"return emailArticleDo()\">".__('Send e-mail')."</button> ";
770 print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>";
87b16a0a
AD
771
772 print "</div>";
773
774 return;
31a53903 775 }
87b16a0a 776
5e6f933a
AD
777 print "<div id='infoBoxTitle'>Internal Error</div>
778 <div id='infoBoxContents'>
779 <p>Unknown dialog <b>$id</b></p>
780 </div></div>";
781
ef8be8ea
AD
782 }
783?>