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