]>
git.wh0rd.org - tt-rss.git/blob - modules/popup-dialog.php
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.");
18 $msg = check_for_update($link, false);
21 print __("You are running the latest version of Tiny Tiny RSS. The
22 fact that you are seeing this dialog is probably a bug.");
30 print __("TT-RSS has detected that update daemon is taking too long to
31 perform a feed update. This could indicate a problem like crash
32 or a hang. Please check the daemon process or contact instance
38 print "<div align='center'>";
40 print "<input class=\"button\"
41 type=\"submit\" onclick=\"return closeInfoBox()\"
42 value=\"".__('Close this window')."\">";
49 if ($id == "quickAddFeed") {
51 print "<div id=\"infoBoxTitle\">".__('Subscribe to feed')."</div>";
52 print "<div class=\"infoBoxContents\">";
54 print "<form id='feed_add_form' onsubmit='return false'>";
56 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
57 /* print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; */
58 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
59 print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
61 print "<table width='100%'>
62 <tr><td>".__('Feed URL:')."</td><td>
63 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
64 onkeypress=\"return filterCR(event, qaddFeed)\"
65 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
66 onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
67 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
69 if (get_pref($link, 'ENABLE_FEED_CATS')) {
70 print "<tr><td>".__('Category:')."</td><td>";
71 print_feed_cat_select($link, "cat_id");
75 /* print "<tr><td colspan='2'><div class='insensitive'>";
77 print __("Some feeds require authentication. If you subscribe to such
78 feed, you will have to enter your login and password in Feed Editor");
80 print "</div></td></tr>"; */
84 /* print "<div id='fadd_login_prompt'><br/>
85 <a href='javascript:appearBlockElement(\"fadd_login_container\",
86 \"fadd_login_prompt\")'>".__('Click here if this feed requires authentication.')."</a></div>"; */
88 print "<div id='fadd_login_container' style='display:none'>
90 <tr><td>".__('Login:')."</td><td><input name='auth_login' class='iedit'></td></tr>
91 <tr><td>".__('Password:')."</td><td><input type='password'
92 name='auth_pass' class='iedit'></td></tr>
98 print "<div style='float : right'>
99 <input class=\"button\"
100 id=\"fadd_submit_btn\" disabled=\"true\"
101 type=\"submit\" onclick=\"return qaddFeed()\" value=\"".__('Subscribe')."\">
102 <input class=\"button\"
103 type=\"submit\" onclick=\"return closeInfoBox()\"
104 value=\"".__('Cancel')."\"></div>
107 <input type=\"checkbox\" id=\"fadd_login_check\"
108 onclick='checkboxToggleElement(this, \"fadd_login_container\")'>
109 <label for=\"fadd_login_check\">".
110 __('This feed requires authentication.')."</div>";
115 if ($id == "search") {
117 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
118 print "<div class=\"infoBoxContents\">";
120 print "<form id='search_form' onsubmit='return false'>";
122 #$active_feed_id = db_escape_string($_GET["param"]);
124 $params = split(":", db_escape_string($_GET["param"]));
126 $active_feed_id = sprintf("%d", $params[0]);
127 $is_cat = $params[1] == "true";
129 print "<table width='100%'><tr><td>".__('Search:')."</td><td>";
131 print "<input name=\"query\" class=\"iedit\"
132 onkeypress=\"return filterCR(event, search)\"
133 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
134 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
138 print "<tr><td>".__('Where:')."</td><td>";
140 print "<select name=\"search_mode\">
141 <option value=\"all_feeds\">".__('All feeds')."</option>";
143 $feed_title = getFeedTitle($link, $active_feed_id);
146 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
148 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
151 if ($active_feed_id && !$is_cat) {
152 print "<option selected value=\"this_feed\">$feed_title</option>";
154 print "<option disabled>".__('This feed')."</option>";
158 $cat_preselected = "selected";
161 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
162 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
164 //print "<option disabled>".__('This category')."</option>";
167 print "</select></td></tr>";
169 print "<tr><td>".__('Match on:')."</td><td>";
171 $search_fields = array(
172 "title" => __("Title"),
173 "content" => __("Content"),
174 "both" => __("Title or content"));
176 print_select_hash("match_on", 3, $search_fields);
178 print "</td></tr></table>";
182 print "<div align=\"right\">
183 <input type=\"submit\"
184 class=\"button\" onclick=\"javascript:search()\"
185 id=\"search_submit_btn\" disabled=\"true\"
186 value=\"".__('Search')."\">
187 <input class=\"button\"
188 type=\"submit\" onclick=\"javascript:searchCancel()\"
189 value=\"".__('Cancel')."\"></div>";
197 if ($id == "quickAddLabel") {
198 print "<div id=\"infoBoxTitle\">".__('Create label')."</div>";
199 print "<div class=\"infoBoxContents\">";
201 print "<form id=\"label_edit_form\" onsubmit='return false'>";
203 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
204 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
206 print "<table width='100%'>";
208 print "<tr><td>".__('Caption:')."</td>
209 <td><input onkeypress=\"return filterCR(event, addLabel)\"
210 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
211 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
212 name=\"description\" class=\"iedit\">";
216 print "<tr><td colspan=\"2\">
217 <p>".__('SQL Expression:')."</p>";
219 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
220 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
222 print "</td></tr></table>";
226 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
228 print "<div align='right'>";
230 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
233 print "<input type=\"submit\"
234 id=\"infobox_submit\"
236 class=\"button\" onclick=\"return addLabel()\"
237 value=\"".__('Create')."\"> ";
239 print "<input class=\"button\"
240 type=\"submit\" onclick=\"return labelEditCancel()\"
241 value=\"".__('Cancel')."\">";
246 if ($id == "quickAddFilter") {
248 $active_feed_id = db_escape_string($_GET["param"]);
250 print "<div id=\"infoBoxTitle\">".__('Create filter')."</div>";
251 print "<div class=\"infoBoxContents\">";
253 print "<form id=\"filter_add_form\" onsubmit='return false'>";
255 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
256 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
257 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
259 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
261 $result = db_query($link, "SELECT id,description
262 FROM ttrss_filter_types ORDER BY description");
264 $filter_types = array();
266 while ($line = db_fetch_assoc($result)) {
267 //array_push($filter_types, $line["description"]);
268 $filter_types[$line["id"]] = __($line["description"]);
271 print "<table width='100%'>";
273 print "<tr><td>".__('Match:')."</td>
274 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
275 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
276 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
277 name=\"reg_exp\" class=\"iedit\">";
279 print "</td></tr><tr><td>".__('On field:')."</td><td>";
281 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
284 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
286 print_feed_select($link, "feed_id", $active_feed_id);
290 print "<tr><td>".__('Action:')."</td>";
292 print "<td colspan='2'><select name=\"action_id\"
293 onchange=\"filterDlgCheckAction(this)\">";
295 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
298 while ($line = db_fetch_assoc($result)) {
299 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
306 print "<tr><td>".__('Params:')."</td>";
308 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
310 print "<tr><td valign='top'>".__('Options:')."</td><td>";
312 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
313 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
319 print "<div align='right'>";
321 print "<input type=\"submit\"
322 id=\"infobox_submit\"
323 class=\"button\" onclick=\"return addFilter()\"
324 disabled=\"true\" value=\"".__('Create')."\"> ";
326 print "<input class=\"button\"
327 type=\"submit\" onclick=\"return closeInfoBox()\"
328 value=\"".__('Cancel')."\">";
332 // print "</td></tr></table>";
337 if ($id == "feedUpdateErrors") {
339 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
340 print "<div class=\"infoBoxContents\">";
342 print __("These feeds have not been updated because of errors:");
344 $result = db_query($link, "SELECT id,title,feed_url,last_error
345 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
347 print "<ul class='feedErrorsList'>";
349 while ($line = db_fetch_assoc($result)) {
350 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
351 "<em>" . $line["last_error"] . "</em>";
357 print "<div align='center'>";
359 print "<input class=\"button\"
360 type=\"submit\" onclick=\"return closeInfoBox()\"
361 value=\"".__('Close')."\">";
368 if ($id == "editArticleTags") {
370 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
371 print "<div class=\"infoBoxContents\">";
373 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
375 print __("Tags for this article (separated by commas):")."<br>";
377 $tags = get_article_tags($link, $param);
379 $tags_str = join(", ", $tags);
381 print "<table width='100%'>";
383 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
385 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
386 name='tags_str'>$tags_str</textarea>
387 <div class=\"autocomplete\" id=\"tags_choices\"
388 style=\"display:none\"></div>
391 /* print "<tr><td>".__('Add existing tag:')."</td>";
393 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
394 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
396 $found_tags = array();
398 array_push($found_tags, '');
400 while ($line = db_fetch_assoc($result)) {
401 array_push($found_tags, truncate_string($line["tag_name"], 20));
404 print "<td align='right'>";
406 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
416 print "<div align='right'>";
418 print "<input class=\"button\"
419 type=\"submit\" onclick=\"return editTagsSave()\"
420 value=\"".__('Save')."\"> ";
422 print "<input class=\"button\"
423 type=\"submit\" onclick=\"return closeInfoBox()\"
424 value=\"".__('Cancel')."\">";
432 if ($id == "printTagCloud") {
433 print "<div id=\"infoBoxTitle\">".__('Tag cloud')."</div>";
434 print "<div class=\"infoBoxContents\">";
436 print __("Showing most popular tags ")." (<a
437 href='javascript:toggleTags(true)'>".__('browse more')."</a>):<br/>";
439 print "<div class=\"tagCloudContainer\">";
441 printTagCloud($link);
445 print "<div align='center'>";
446 print "<input class=\"button\"
447 type=\"submit\" onclick=\"return closeInfoBox()\"
448 value=\"".__('Close')."\">";
456 print "<div id='infoBoxTitle'>Internal Error</div>
457 <div id='infoBoxContents'>
458 <p>Unknown dialog <b>$id</b></p>