]>
git.wh0rd.org - tt-rss.git/blob - modules/popup-dialog.php
baead1c37aa479dc5618aba49b624d952dfbc70c
2 function module_popup_dialog($link) {
4 $param = db_escape_string($_GET["param"]);
6 if ($id == "explainError") {
8 print "<div id=\"infoBoxTitle\">".__('Notice')."</div>";
9 print "<div class=\"infoBoxContents\">";
12 print __("Update daemon is enabled in configuration, but daemon
13 process is not running, which prevents all feeds from updating. Please
14 start the daemon process or contact instance owner.");
16 $stamp = (int)read_stampfile("update_daemon.stamp");
18 print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp);
23 $msg = check_for_update($link, false);
26 print __("You are running the latest version of Tiny Tiny RSS. The
27 fact that you are seeing this dialog is probably a bug.");
35 print __("TT-RSS has detected that update daemon is taking too long to
36 perform a feed update. This could indicate a problem like crash
37 or a hang. Please check the daemon process or contact instance
40 $stamp = (int)read_stampfile("update_daemon.stamp");
42 print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp);
48 print "<div align='center'>";
50 print "<input class=\"button\"
51 type=\"submit\" onclick=\"return closeInfoBox()\"
52 value=\"".__('Close this window')."\">";
59 if ($id == "quickAddFeed") {
61 print "<div id=\"infoBoxTitle\">".__('Subscribe to feed')."</div>";
62 print "<div class=\"infoBoxContents\">";
64 print "<form id='feed_add_form' onsubmit='return false'>";
66 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
67 /* print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; */
68 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
69 print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
71 print "<table width='100%'>
72 <tr><td width='20%'>".__('Feed URL:')."</td><td>
73 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
74 onkeypress=\"return filterCR(event, subscribeToFeed)\"
75 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
76 onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
77 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
79 if (get_pref($link, 'ENABLE_FEED_CATS')) {
80 print "<tr><td>".__('Category:')."</td><td>";
81 print_feed_cat_select($link, "cat_id");
85 /* print "<tr><td colspan='2'><div class='insensitive'>";
87 print __("Some feeds require authentication. If you subscribe to such
88 feed, you will have to enter your login and password in Feed Editor");
90 print "</div></td></tr>"; */
94 /* print "<div id='fadd_login_prompt'><br/>
95 <a href='javascript:appearBlockElement(\"fadd_login_container\",
96 \"fadd_login_prompt\")'>".__('Click here if this feed requires authentication.')."</a></div>"; */
98 print "<div id='fadd_login_container' style='display:none'>
100 <tr><td width='20%'>".__('Login:')."</td><td><input name='auth_login' class='iedit' onfocus=\"javascript:disableHotkeys()\" onfocus=\"javascript:disableHotkeys()\" onkeypress=\"return filterCR(event, subscribeToFeed)\"></td></tr>
101 <tr><td>".__('Password:')."</td><td><input type='password'
102 name='auth_pass' class='iedit' onfocus=\"javascript:disableHotkeys()\" onfocus=\"javascript:disableHotkeys()\" onkeypress=\"return filterCR(event, subscribeToFeed)\"></td></tr>
108 print "<div style='float : right'>
109 <input class=\"button\"
110 id=\"fadd_submit_btn\" disabled=\"true\"
111 type=\"submit\" onclick=\"return subscribeToFeed()\" value=\"".__('Subscribe')."\">
112 <input class=\"button\"
113 type=\"submit\" onclick=\"return closeInfoBox()\"
114 value=\"".__('Cancel')."\"></div>
117 <input type=\"checkbox\" id=\"fadd_login_check\"
118 onclick='checkboxToggleElement(this, \"fadd_login_container\")'>
119 <label for=\"fadd_login_check\">".
120 __('This feed requires authentication.')."</div>";
125 if ($id == "search") {
127 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
128 print "<div class=\"infoBoxContents\">";
130 print "<form id='search_form' onsubmit='return false'>";
132 #$active_feed_id = db_escape_string($_GET["param"]);
134 $params = split(":", db_escape_string($_GET["param"]));
136 $active_feed_id = sprintf("%d", $params[0]);
137 $is_cat = $params[1] == "true";
139 print "<table width='100%'><tr><td>".__('Search:')."</td><td>";
141 print "<input name=\"query\" class=\"iedit\" type=\"search\"
142 onkeypress=\"return filterCR(event, search)\"
143 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
144 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
148 print "<tr><td>".__('Where:')."</td><td>";
150 print "<select name=\"search_mode\">
151 <option value=\"all_feeds\">".__('All feeds')."</option>";
153 $feed_title = getFeedTitle($link, $active_feed_id);
156 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
158 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
161 if ($active_feed_id && !$is_cat) {
162 print "<option selected value=\"this_feed\">$feed_title</option>";
164 print "<option disabled>".__('This feed')."</option>";
168 $cat_preselected = "selected";
171 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
172 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
174 //print "<option disabled>".__('This category')."</option>";
177 print "</select></td></tr>";
179 print "<tr><td>".__('Match on:')."</td><td>";
181 $search_fields = array(
182 "title" => __("Title"),
183 "content" => __("Content"),
184 "both" => __("Title or content"));
186 print_select_hash("match_on", 3, $search_fields);
188 print "</td></tr></table>";
192 print "<div align=\"right\">
193 <input type=\"submit\"
194 class=\"button\" onclick=\"javascript:search()\"
195 id=\"search_submit_btn\" disabled=\"true\"
196 value=\"".__('Search')."\">
197 <input class=\"button\"
198 type=\"submit\" onclick=\"javascript:searchCancel()\"
199 value=\"".__('Cancel')."\"></div>";
207 if ($id == "quickAddLabel") {
208 print "<div id=\"infoBoxTitle\">".__('Create label')."</div>";
209 print "<div class=\"infoBoxContents\">";
211 print "<form id=\"label_edit_form\" onsubmit='return false'>";
213 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
214 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
216 print "<div class=\"dlgSec\">".__("Caption")."</div>";
218 print "<div class=\"dlgSecCont\">";
220 print "<input onkeypress=\"return filterCR(event, labelEditSave)\"
221 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
222 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
223 name=\"description\" size=\"30\" value=\"$description\">";
226 print "<div class=\"dlgSec\">".__("Match SQL")."</div>";
228 print "<div class=\"dlgSecCont\">";
230 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
231 rows=\"6\" name=\"sql_exp\" class=\"labelSQL\" cols=\"50\">$sql_exp</textarea>";
237 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
239 print "<div class=\"dlgButtons\">";
241 print "<div style='float : left'>";
242 print "<input type=\"submit\"
243 class=\"button\" onclick=\"return displayHelpInfobox(1)\"
244 value=\"".__('Help')."\"> ";
247 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
250 print "<input type=\"submit\"
251 id=\"infobox_submit\"
253 class=\"button\" onclick=\"return addLabel()\"
254 value=\"".__('Create')."\"> ";
256 print "<input class=\"button\"
257 type=\"submit\" onclick=\"return labelEditCancel()\"
258 value=\"".__('Cancel')."\">";
263 if ($id == "quickAddFilter") {
265 $active_feed_id = db_escape_string($_GET["param"]);
267 print "<div id=\"infoBoxTitle\">".__('Create filter')."</div>";
268 print "<div class=\"infoBoxContents\">";
270 print "<form id=\"filter_add_form\" onsubmit='return false'>";
272 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
273 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
274 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
276 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
278 $result = db_query($link, "SELECT id,description
279 FROM ttrss_filter_types ORDER BY description");
281 $filter_types = array();
283 while ($line = db_fetch_assoc($result)) {
284 //array_push($filter_types, $line["description"]);
285 $filter_types[$line["id"]] = __($line["description"]);
288 /* print "<table width='100%'>";
290 print "<tr><td>".__('Match:')."</td>
291 <td><input onkeypress=\"return filterCR(event, createFilter)\"
292 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
293 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
294 name=\"reg_exp\" class=\"iedit\">";
296 print "</td></tr><tr><td>".__('On field:')."</td><td>";
298 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
301 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
303 print_feed_select($link, "feed_id", $active_feed_id);
307 print "<tr><td>".__('Action:')."</td>";
309 print "<td colspan='2'><select name=\"action_id\"
310 onchange=\"filterDlgCheckAction(this)\">";
312 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
315 while ($line = db_fetch_assoc($result)) {
316 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
323 print "<tr><td>".__('Params:')."</td>";
325 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
327 print "<tr><td valign='top'>".__('Options:')."</td><td>";
329 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
330 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
336 print "<div class=\"dlgSec\">".__("Match")."</div>";
338 print "<div class=\"dlgSecCont\">";
340 print "<input onkeypress=\"return filterCR(event, filterEditSave)\"
341 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
342 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
343 name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">";
345 print " " . __("on field") . " ";
346 print_select_hash("filter_type", 1, $filter_types);
350 print __("in") . " ";
351 print_feed_select($link, "feed_id", $active_feed_id);
355 print "<div class=\"dlgSec\">".__("Perform action")."</div>";
357 print "<div class=\"dlgSecCont\">";
359 print "<select name=\"action_id\"
360 onchange=\"filterDlgCheckAction(this)\">";
362 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
365 while ($line = db_fetch_assoc($result)) {
366 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
371 print " " . __("with params") . " ";
373 print "<input disabled size=\"20\"
374 name=\"action_param\">";
378 print "<div class=\"dlgSec\">".__("Options")."</div>";
379 print "<div class=\"dlgSecCont\">";
381 print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">
382 <label for=\"enabled\">".__('Enabled')."</label><br/>";
384 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
385 <label for=\"inverse\">".__('Inverse match')."</label>";
391 print "<div class=\"dlgButtons\">";
393 print "<input type=\"submit\"
394 id=\"infobox_submit\"
395 class=\"button\" onclick=\"return createFilter()\"
396 disabled=\"true\" value=\"".__('Create')."\"> ";
398 print "<input class=\"button\"
399 type=\"submit\" onclick=\"return closeInfoBox()\"
400 value=\"".__('Cancel')."\">";
404 // print "</td></tr></table>";
409 if ($id == "feedUpdateErrors") {
411 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
412 print "<div class=\"infoBoxContents\">";
414 print __("These feeds have not been updated because of errors:");
416 $result = db_query($link, "SELECT id,title,feed_url,last_error
417 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
419 print "<ul class='feedErrorsList'>";
421 while ($line = db_fetch_assoc($result)) {
422 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
423 "<em>" . $line["last_error"] . "</em>";
429 print "<div align='center'>";
431 print "<input class=\"button\"
432 type=\"submit\" onclick=\"return closeInfoBox()\"
433 value=\"".__('Close')."\">";
440 if ($id == "editArticleTags") {
442 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
443 print "<div class=\"infoBoxContents\">";
445 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
447 print __("Tags for this article (separated by commas):")."<br>";
449 $tags = get_article_tags($link, $param);
451 $tags_str = join(", ", $tags);
453 print "<table width='100%'>";
455 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
457 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
458 name='tags_str'>$tags_str</textarea>
459 <div class=\"autocomplete\" id=\"tags_choices\"
460 style=\"display:none\"></div>
463 /* print "<tr><td>".__('Add existing tag:')."</td>";
465 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
466 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
468 $found_tags = array();
470 array_push($found_tags, '');
472 while ($line = db_fetch_assoc($result)) {
473 array_push($found_tags, truncate_string($line["tag_name"], 20));
476 print "<td align='right'>";
478 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
488 print "<div align='right'>";
490 print "<input class=\"button\"
491 type=\"submit\" onclick=\"return editTagsSave()\"
492 value=\"".__('Save')."\"> ";
494 print "<input class=\"button\"
495 type=\"submit\" onclick=\"return closeInfoBox()\"
496 value=\"".__('Cancel')."\">";
504 if ($id == "printTagCloud") {
505 print "<div id=\"infoBoxTitle\">".__('Tag cloud')."</div>";
506 print "<div class=\"infoBoxContents\">";
508 print __("Showing most popular tags ")." (<a
509 href='javascript:toggleTags(true)'>".__('browse more')."</a>):<br/>";
511 print "<div class=\"tagCloudContainer\">";
513 printTagCloud($link);
517 print "<div align='center'>";
518 print "<input class=\"button\"
519 type=\"submit\" onclick=\"return closeInfoBox()\"
520 value=\"".__('Close this window')."\">";
528 print "<div id='infoBoxTitle'>Internal Error</div>
529 <div id='infoBoxContents'>
530 <p>Unknown dialog <b>$id</b></p>