]>
git.wh0rd.org - tt-rss.git/blob - modules/popup-dialog.php
a9f1e2d71c3e36fe246dc08aeacbbf163ab7108c
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=\"subop\" value=\"add\">";
68 print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
70 print "<div class=\"dlgSec\">".__("Feed")."</div>";
71 print "<div class=\"dlgSecCont\">";
73 print __("URL:") . " ";
75 print "<input size=\"40\" onblur=\"javascript:enableHotkeys()\"
76 onkeypress=\"return filterCR(event, subscribeToFeed)\"
77 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
78 onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
79 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
83 if (get_pref($link, 'ENABLE_FEED_CATS')) {
84 print __('Place in category:') . " ";
85 print_feed_cat_select($link, "cat_id");
91 /* print "<tr><td colspan='2'><div class='insensitive'>";
93 print __("Some feeds require authentication. If you subscribe to such
94 feed, you will have to enter your login and password in Feed Editor");
96 print "</div></td></tr>"; */
98 /* print "<div id='fadd_login_prompt'><br/>
99 <a href='javascript:appearBlockElement(\"fadd_login_container\",
100 \"fadd_login_prompt\")'>".__('Click here if this feed requires authentication.')."</a></div>"; */
102 print "<div id='fadd_login_container' style='display:none'>
104 <div class=\"dlgSec\">".__("Authentication")."</div>
105 <div class=\"dlgSecCont\">".
107 __('Login:') . " <input name='auth_login' size=\"20\"
108 onfocus=\"javascript:disableHotkeys()\"
109 onfocus=\"javascript:disableHotkeys()\"
110 onkeypress=\"return filterCR(event, subscribeToFeed)\"> ".
111 __('Password:') . "<input type='password'
112 name='auth_pass' size=\"20\"
113 onfocus=\"javascript:disableHotkeys()\"
114 onfocus=\"javascript:disableHotkeys()\"
115 onkeypress=\"return filterCR(event, subscribeToFeed)\">
119 print "<div style=\"clear : both\">
120 <input type=\"checkbox\" id=\"fadd_login_check\"
121 onclick='checkboxToggleElement(this, \"fadd_login_container\")'>
122 <label for=\"fadd_login_check\">".
123 __('This feed requires authentication.')."</div>";
127 print "<div class=\"dlgButtons\">
128 <input class=\"button\"
129 id=\"fadd_submit_btn\" disabled=\"true\"
130 type=\"submit\" onclick=\"return subscribeToFeed()\" value=\"".__('Subscribe')."\">
131 <input class=\"button\"
132 type=\"submit\" onclick=\"return closeInfoBox()\"
133 value=\"".__('Cancel')."\"></div>";
138 if ($id == "search") {
140 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
141 print "<div class=\"infoBoxContents\">";
143 print "<form id='search_form' onsubmit='return false'>";
145 #$active_feed_id = db_escape_string($_GET["param"]);
147 $params = split(":", db_escape_string($_GET["param"]));
149 $active_feed_id = sprintf("%d", $params[0]);
150 $is_cat = $params[1] == "true";
152 print "<div class=\"dlgSec\">".__('Search')."</div>";
154 print "<div class=\"dlgSecCont\">";
156 print "<input name=\"query\" size=\"30\" type=\"search\"
157 onkeypress=\"return filterCR(event, search)\"
158 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
159 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
162 print " " . __('match on:')." ";
164 $search_fields = array(
165 "title" => __("Title"),
166 "content" => __("Content"),
167 "both" => __("Title or content"));
169 print_select_hash("match_on", 3, $search_fields);
172 print "<br/>".__('Limit search to:')." ";
174 print "<select name=\"search_mode\">
175 <option value=\"all_feeds\">".__('All feeds')."</option>";
177 $feed_title = getFeedTitle($link, $active_feed_id);
180 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
182 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
185 if ($active_feed_id && !$is_cat) {
186 print "<option selected value=\"this_feed\">$feed_title</option>";
188 print "<option disabled>".__('This feed')."</option>";
192 $cat_preselected = "selected";
195 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
196 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
198 //print "<option disabled>".__('This category')."</option>";
207 print "<div class=\"dlgButtons\">
208 <input type=\"submit\"
209 class=\"button\" onclick=\"javascript:search()\"
210 id=\"search_submit_btn\" disabled=\"true\"
211 value=\"".__('Search')."\">
212 <input class=\"button\"
213 type=\"submit\" onclick=\"javascript:searchCancel()\"
214 value=\"".__('Cancel')."\"></div>";
222 if ($id == "quickAddLabel") {
223 print "<div id=\"infoBoxTitle\">".__('Create Label')."</div>";
224 print "<div class=\"infoBoxContents\">";
226 print "<form id=\"label_edit_form\" onsubmit='return false'>";
228 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
229 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
231 print "<div class=\"dlgSec\">".__("Caption")."</div>";
233 print "<div class=\"dlgSecCont\">";
235 print "<input onkeypress=\"return filterCR(event, labelEditSave)\"
236 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
237 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
238 name=\"description\" size=\"30\" value=\"$description\">";
241 print "<div class=\"dlgSec\">".__("Match SQL")."</div>";
243 print "<div class=\"dlgSecCont\">";
245 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
246 rows=\"6\" name=\"sql_exp\" class=\"labelSQL\" cols=\"50\">$sql_exp</textarea>";
252 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
254 print "<div class=\"dlgButtons\">";
256 print "<div style='float : left'>";
257 print "<input type=\"submit\"
258 class=\"button\" onclick=\"return displayHelpInfobox(1)\"
259 value=\"".__('Help')."\"> ";
262 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
265 print "<input type=\"submit\"
266 id=\"infobox_submit\"
268 class=\"button\" onclick=\"return addLabel()\"
269 value=\"".__('Create')."\"> ";
271 print "<input class=\"button\"
272 type=\"submit\" onclick=\"return labelEditCancel()\"
273 value=\"".__('Cancel')."\">";
278 if ($id == "quickAddFilter") {
280 $active_feed_id = db_escape_string($_GET["param"]);
282 print "<div id=\"infoBoxTitle\">".__('Create Filter')."</div>";
283 print "<div class=\"infoBoxContents\">";
285 print "<form id=\"filter_add_form\" onsubmit='return false'>";
287 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
288 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
289 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
291 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
293 $result = db_query($link, "SELECT id,description
294 FROM ttrss_filter_types ORDER BY description");
296 $filter_types = array();
298 while ($line = db_fetch_assoc($result)) {
299 //array_push($filter_types, $line["description"]);
300 $filter_types[$line["id"]] = __($line["description"]);
303 /* print "<table width='100%'>";
305 print "<tr><td>".__('Match:')."</td>
306 <td><input onkeypress=\"return filterCR(event, createFilter)\"
307 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
308 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
309 name=\"reg_exp\" class=\"iedit\">";
311 print "</td></tr><tr><td>".__('On field:')."</td><td>";
313 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
316 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
318 print_feed_select($link, "feed_id", $active_feed_id);
322 print "<tr><td>".__('Action:')."</td>";
324 print "<td colspan='2'><select name=\"action_id\"
325 onchange=\"filterDlgCheckAction(this)\">";
327 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
330 while ($line = db_fetch_assoc($result)) {
331 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
338 print "<tr><td>".__('Params:')."</td>";
340 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
342 print "<tr><td valign='top'>".__('Options:')."</td><td>";
344 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
345 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
351 print "<div class=\"dlgSec\">".__("Match")."</div>";
353 print "<div class=\"dlgSecCont\">";
355 print "<input onkeypress=\"return filterCR(event, filterEditSave)\"
356 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
357 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
358 name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">";
360 print " " . __("on field") . " ";
361 print_select_hash("filter_type", 1, $filter_types);
365 print __("in") . " ";
366 print_feed_select($link, "feed_id", $active_feed_id);
370 print "<div class=\"dlgSec\">".__("Perform Action")."</div>";
372 print "<div class=\"dlgSecCont\">";
374 print "<select name=\"action_id\"
375 onchange=\"filterDlgCheckAction(this)\">";
377 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
380 while ($line = db_fetch_assoc($result)) {
381 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
386 print " " . __("with params") . " ";
388 print "<input disabled size=\"20\"
389 name=\"action_param\">";
393 print "<div class=\"dlgSec\">".__("Options")."</div>";
394 print "<div class=\"dlgSecCont\">";
396 print "<div style=\"line-height : 100%\">";
398 print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">
399 <label for=\"enabled\">".__('Enabled')."</label><br/>";
401 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
402 <label for=\"inverse\">".__('Inverse match')."</label>";
409 print "<div class=\"dlgButtons\">";
411 print "<input type=\"submit\"
412 id=\"infobox_submit\"
413 class=\"button\" onclick=\"return createFilter()\"
414 disabled=\"true\" value=\"".__('Create')."\"> ";
416 print "<input class=\"button\"
417 type=\"submit\" onclick=\"return closeInfoBox()\"
418 value=\"".__('Cancel')."\">";
422 // print "</td></tr></table>";
427 if ($id == "feedUpdateErrors") {
429 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
430 print "<div class=\"infoBoxContents\">";
432 print __("These feeds have not been updated because of errors:");
434 $result = db_query($link, "SELECT id,title,feed_url,last_error
435 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
437 print "<ul class='feedErrorsList'>";
439 while ($line = db_fetch_assoc($result)) {
440 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
441 "<em>" . $line["last_error"] . "</em>";
447 print "<div align='center'>";
449 print "<input class=\"button\"
450 type=\"submit\" onclick=\"return closeInfoBox()\"
451 value=\"".__('Close')."\">";
458 if ($id == "editArticleTags") {
460 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
461 print "<div class=\"infoBoxContents\">";
463 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
465 print __("Tags for this article (separated by commas):")."<br>";
467 $tags = get_article_tags($link, $param);
469 $tags_str = join(", ", $tags);
471 print "<table width='100%'>";
473 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
475 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
476 name='tags_str'>$tags_str</textarea>
477 <div class=\"autocomplete\" id=\"tags_choices\"
478 style=\"display:none\"></div>
481 /* print "<tr><td>".__('Add existing tag:')."</td>";
483 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
484 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
486 $found_tags = array();
488 array_push($found_tags, '');
490 while ($line = db_fetch_assoc($result)) {
491 array_push($found_tags, truncate_string($line["tag_name"], 20));
494 print "<td align='right'>";
496 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
506 print "<div align='right'>";
508 print "<input class=\"button\"
509 type=\"submit\" onclick=\"return editTagsSave()\"
510 value=\"".__('Save')."\"> ";
512 print "<input class=\"button\"
513 type=\"submit\" onclick=\"return closeInfoBox()\"
514 value=\"".__('Cancel')."\">";
522 if ($id == "printTagCloud") {
523 print "<div id=\"infoBoxTitle\">".__('Tag cloud')."</div>";
524 print "<div class=\"infoBoxContents\">";
526 print __("Showing most popular tags ")." (<a
527 href='javascript:toggleTags(true)'>".__('browse more')."</a>):<br/>";
529 print "<div class=\"tagCloudContainer\">";
531 printTagCloud($link);
535 print "<div align='center'>";
536 print "<input class=\"button\"
537 type=\"submit\" onclick=\"return closeInfoBox()\"
538 value=\"".__('Close this window')."\">";
546 print "<div id='infoBoxTitle'>Internal Error</div>
547 <div id='infoBoxContents'>
548 <p>Unknown dialog <b>$id</b></p>