]>
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:showBlockElement(\"fadd_login_container\",
86 \"fadd_login_prompt\")'>".__('Click here if this feed requires authentication.')."</a></div>";
88 print "<div id='fadd_login_container'>
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 align='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>";
109 if ($id == "search") {
111 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
112 print "<div class=\"infoBoxContents\">";
114 print "<form id='search_form' onsubmit='return false'>";
116 #$active_feed_id = db_escape_string($_GET["param"]);
118 $params = split(":", db_escape_string($_GET["param"]));
120 $active_feed_id = sprintf("%d", $params[0]);
121 $is_cat = $params[1] == "true";
123 print "<table width='100%'><tr><td>".__('Search:')."</td><td>";
125 print "<input name=\"query\" class=\"iedit\"
126 onkeypress=\"return filterCR(event, search)\"
127 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
128 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
132 print "<tr><td>".__('Where:')."</td><td>";
134 print "<select name=\"search_mode\">
135 <option value=\"all_feeds\">".__('All feeds')."</option>";
137 $feed_title = getFeedTitle($link, $active_feed_id);
140 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
142 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
145 if ($active_feed_id && !$is_cat) {
146 print "<option selected value=\"this_feed\">$feed_title</option>";
148 print "<option disabled>".__('This feed')."</option>";
152 $cat_preselected = "selected";
155 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
156 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
158 //print "<option disabled>".__('This category')."</option>";
161 print "</select></td></tr>";
163 print "<tr><td>".__('Match on:')."</td><td>";
165 $search_fields = array(
166 "title" => __("Title"),
167 "content" => __("Content"),
168 "both" => __("Title or content"));
170 print_select_hash("match_on", 3, $search_fields);
172 print "</td></tr></table>";
176 print "<div align=\"right\">
177 <input type=\"submit\"
178 class=\"button\" onclick=\"javascript:search()\"
179 id=\"search_submit_btn\" disabled=\"true\"
180 value=\"".__('Search')."\">
181 <input class=\"button\"
182 type=\"submit\" onclick=\"javascript:searchCancel()\"
183 value=\"".__('Cancel')."\"></div>";
191 if ($id == "quickAddLabel") {
192 print "<div id=\"infoBoxTitle\">".__('Create label')."</div>";
193 print "<div class=\"infoBoxContents\">";
195 print "<form id=\"label_edit_form\" onsubmit='return false'>";
197 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
198 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
200 print "<table width='100%'>";
202 print "<tr><td>".__('Caption:')."</td>
203 <td><input onkeypress=\"return filterCR(event, addLabel)\"
204 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
205 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
206 name=\"description\" class=\"iedit\">";
210 print "<tr><td colspan=\"2\">
211 <p>".__('SQL Expression:')."</p>";
213 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
214 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
216 print "</td></tr></table>";
220 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
222 print "<div align='right'>";
224 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
227 print "<input type=\"submit\"
228 id=\"infobox_submit\"
230 class=\"button\" onclick=\"return addLabel()\"
231 value=\"".__('Create')."\"> ";
233 print "<input class=\"button\"
234 type=\"submit\" onclick=\"return labelEditCancel()\"
235 value=\"".__('Cancel')."\">";
240 if ($id == "quickAddFilter") {
242 $active_feed_id = db_escape_string($_GET["param"]);
244 print "<div id=\"infoBoxTitle\">".__('Create filter')."</div>";
245 print "<div class=\"infoBoxContents\">";
247 print "<form id=\"filter_add_form\" onsubmit='return false'>";
249 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
250 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
251 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
253 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
255 $result = db_query($link, "SELECT id,description
256 FROM ttrss_filter_types ORDER BY description");
258 $filter_types = array();
260 while ($line = db_fetch_assoc($result)) {
261 //array_push($filter_types, $line["description"]);
262 $filter_types[$line["id"]] = __($line["description"]);
265 print "<table width='100%'>";
267 print "<tr><td>".__('Match:')."</td>
268 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
269 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
270 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
271 name=\"reg_exp\" class=\"iedit\">";
273 print "</td></tr><tr><td>".__('On field:')."</td><td>";
275 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
278 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
280 print_feed_select($link, "feed_id", $active_feed_id);
284 print "<tr><td>".__('Action:')."</td>";
286 print "<td colspan='2'><select name=\"action_id\"
287 onchange=\"filterDlgCheckAction(this)\">";
289 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
292 while ($line = db_fetch_assoc($result)) {
293 printf("<option value='%d'>%s</option>", $line["id"], __($line["description"]));
300 print "<tr><td>".__('Params:')."</td>";
302 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
304 print "<tr><td valign='top'>".__('Options:')."</td><td>";
306 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
307 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
313 print "<div align='right'>";
315 print "<input type=\"submit\"
316 id=\"infobox_submit\"
317 class=\"button\" onclick=\"return addFilter()\"
318 disabled=\"true\" value=\"".__('Create')."\"> ";
320 print "<input class=\"button\"
321 type=\"submit\" onclick=\"return closeInfoBox()\"
322 value=\"".__('Cancel')."\">";
326 // print "</td></tr></table>";
331 if ($id == "feedUpdateErrors") {
333 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
334 print "<div class=\"infoBoxContents\">";
336 print __("These feeds have not been updated because of errors:");
338 $result = db_query($link, "SELECT id,title,feed_url,last_error
339 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
341 print "<ul class='feedErrorsList'>";
343 while ($line = db_fetch_assoc($result)) {
344 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
345 "<em>" . $line["last_error"] . "</em>";
351 print "<div align='center'>";
353 print "<input class=\"button\"
354 type=\"submit\" onclick=\"return closeInfoBox()\"
355 value=\"".__('Close')."\">";
362 if ($id == "editArticleTags") {
364 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
365 print "<div class=\"infoBoxContents\">";
367 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
369 print __("Tags for this article (separated by commas):")."<br>";
371 $tags = get_article_tags($link, $param);
373 $tags_str = join(", ", $tags);
375 print "<table width='100%'>";
377 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
379 print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
380 name='tags_str'>$tags_str</textarea>
381 <div class=\"autocomplete\" id=\"tags_choices\"
382 style=\"display:none\"></div>
385 /* print "<tr><td>".__('Add existing tag:')."</td>";
387 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
388 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
390 $found_tags = array();
392 array_push($found_tags, '');
394 while ($line = db_fetch_assoc($result)) {
395 array_push($found_tags, truncate_string($line["tag_name"], 20));
398 print "<td align='right'>";
400 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
410 print "<div align='right'>";
412 print "<input class=\"button\"
413 type=\"submit\" onclick=\"return editTagsSave()\"
414 value=\"".__('Save')."\"> ";
416 print "<input class=\"button\"
417 type=\"submit\" onclick=\"return closeInfoBox()\"
418 value=\"".__('Cancel')."\">";
426 if ($id == "printTagCloud") {
427 print "<div id=\"infoBoxTitle\">".__('Tag cloud')."</div>";
428 print "<div class=\"infoBoxContents\">";
430 print __("Showing most popular tags ")." (<a
431 href='javascript:toggleTags(true)'>".__('browse more')."</a>):<br/>";
433 print "<div class=\"tagCloudContainer\">";
435 printTagCloud($link);
439 print "<div align='center'>";
440 print "<input class=\"button\"
441 type=\"submit\" onclick=\"return closeInfoBox()\"
442 value=\"".__('Close')."\">";
450 print "<div id='infoBoxTitle'>Internal Error</div>
451 <div id='infoBoxContents'>
452 <p>Unknown dialog <b>$id</b></p>