]>
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.");
31 print "<div align='center'>";
33 print "<input class=\"button\"
34 type=\"submit\" onclick=\"return closeInfoBox()\"
35 value=\"".__('Close this window')."\">";
41 if ($id == "quickAddFeed") {
43 print "<div id=\"infoBoxTitle\">".__('Subscribe to feed')."</div>";
44 print "<div class=\"infoBoxContents\">";
46 print "<form id='feed_add_form' onsubmit='return false'>";
48 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
49 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
50 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
52 print "<table width='100%'>
53 <tr><td>Feed URL:</td><td>
54 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
55 onkeypress=\"return filterCR(event, qafAdd)\"
56 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
57 onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
58 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
60 if (get_pref($link, 'ENABLE_FEED_CATS')) {
61 print "<tr><td>".__('Category:')."</td><td>";
62 print_feed_cat_select($link, "cat_id");
69 print "<div align='right'>
70 <input class=\"button\"
71 id=\"fadd_submit_btn\" disabled=\"true\"
72 type=\"submit\" onclick=\"return qafAdd()\" value=\"".__('Subscribe')."\">
73 <input class=\"button\"
74 type=\"submit\" onclick=\"return closeInfoBox()\"
75 value=\"".__('Cancel')."\"></div>";
78 if ($id == "search") {
80 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
81 print "<div class=\"infoBoxContents\">";
83 print "<form id='search_form' onsubmit='return false'>";
85 #$active_feed_id = db_escape_string($_GET["param"]);
87 $params = split(":", db_escape_string($_GET["param"]));
89 $active_feed_id = sprintf("%d", $params[0]);
90 $is_cat = $params[1] == "true";
92 print "<table width='100%'><tr><td>".__('Search:')."</td><td>";
94 print "<input name=\"query\" class=\"iedit\"
95 onkeypress=\"return filterCR(event, search)\"
96 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
97 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
101 print "<tr><td>".__('Where:')."</td><td>";
103 print "<select name=\"search_mode\">
104 <option value=\"all_feeds\">".__('All feeds')."</option>";
106 $feed_title = getFeedTitle($link, $active_feed_id);
109 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
111 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
114 if ($active_feed_id && !$is_cat) {
115 print "<option selected value=\"this_feed\">$feed_title</option>";
117 print "<option disabled>".__('This feed')."</option>";
121 $cat_preselected = "selected";
124 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
125 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
127 print "<option disabled>".__('This category')."</option>";
130 print "</select></td></tr>";
132 print "<tr><td>".__('Match on:')."</td><td>";
134 $search_fields = array(
135 "title" => __("Title"),
136 "content" => __("Content"),
137 "both" => __("Title or content"));
139 print_select_hash("match_on", 3, $search_fields);
141 print "</td></tr></table>";
145 print "<div align=\"right\">
146 <input type=\"submit\"
147 class=\"button\" onclick=\"javascript:search()\"
148 id=\"search_submit_btn\" disabled=\"true\"
149 value=\"".__('Search')."\">
150 <input class=\"button\"
151 type=\"submit\" onclick=\"javascript:searchCancel()\"
152 value=\"".__('Cancel')."\"></div>";
158 if ($id == "quickAddLabel") {
159 print "<div id=\"infoBoxTitle\">".__('Create label')."</div>";
160 print "<div class=\"infoBoxContents\">";
162 print "<form id=\"label_edit_form\" onsubmit='return false'>";
164 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
165 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
167 print "<table width='100%'>";
169 print "<tr><td>".__('Caption:')."</td>
170 <td><input onkeypress=\"return filterCR(event, addLabel)\"
171 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
172 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
173 name=\"description\" class=\"iedit\">";
177 print "<tr><td colspan=\"2\">
178 <p>".__('SQL Expression:')."</p>";
180 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
181 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
183 print "</td></tr></table>";
187 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
189 print "<div align='right'>";
191 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
194 print "<input type=\"submit\"
195 id=\"infobox_submit\"
197 class=\"button\" onclick=\"return addLabel()\"
198 value=\"".__('Create')."\"> ";
200 print "<input class=\"button\"
201 type=\"submit\" onclick=\"return labelEditCancel()\"
202 value=\"".__('Cancel')."\">";
205 if ($id == "quickAddFilter") {
207 $active_feed_id = db_escape_string($_GET["param"]);
209 print "<div id=\"infoBoxTitle\">".__('Create filter')."</div>";
210 print "<div class=\"infoBoxContents\">";
212 print "<form id=\"filter_add_form\" onsubmit='return false'>";
214 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
215 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
216 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
218 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
220 $result = db_query($link, "SELECT id,description
221 FROM ttrss_filter_types ORDER BY description");
223 $filter_types = array();
225 while ($line = db_fetch_assoc($result)) {
226 //array_push($filter_types, $line["description"]);
227 $filter_types[$line["id"]] = $line["description"];
230 print "<table width='100%'>";
232 print "<tr><td>".__('Match:')."</td>
233 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
234 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
235 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
236 name=\"reg_exp\" class=\"iedit\">";
238 print "</td></tr><tr><td>".__('On field:')."</td><td>";
240 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
243 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
245 print_feed_select($link, "feed_id", $active_feed_id);
249 print "<tr><td>".__('Action:')."</td>";
251 print "<td colspan='2'><select name=\"action_id\"
252 onchange=\"filterDlgCheckAction(this)\">";
254 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
257 while ($line = db_fetch_assoc($result)) {
258 printf("<option value='%d'>%s</option>", $line["id"], $line["description"]);
265 print "<tr><td>".__('Params:')."</td>";
267 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
269 print "<tr><td valign='top'>".__('Options:')."</td><td>";
271 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
272 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
278 print "<div align='right'>";
280 print "<input type=\"submit\"
281 id=\"infobox_submit\"
282 class=\"button\" onclick=\"return qaddFilter()\"
283 disabled=\"true\" value=\"".__('Create')."\"> ";
285 print "<input class=\"button\"
286 type=\"submit\" onclick=\"return closeInfoBox()\"
287 value=\"".__('Cancel')."\">";
291 // print "</td></tr></table>";
295 if ($id == "feedUpdateErrors") {
297 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
298 print "<div class=\"infoBoxContents\">";
300 print __("These feeds have not been updated because of errors:");
302 $result = db_query($link, "SELECT id,title,feed_url,last_error
303 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
305 print "<ul class='feedErrorsList'>";
307 while ($line = db_fetch_assoc($result)) {
308 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
309 "<em>" . $line["last_error"] . "</em>";
315 print "<div align='center'>";
317 print "<input class=\"button\"
318 type=\"submit\" onclick=\"return closeInfoBox()\"
319 value=\"".__('Close')."\">";
325 if ($id == "editArticleTags") {
327 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
328 print "<div class=\"infoBoxContents\">";
330 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
332 print __("Tags for this article (separated by commas):")."<br>";
334 $tags = get_article_tags($link, $param);
336 $tags_str = join(", ", $tags);
338 print "<table width='100%'>";
340 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
342 print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
344 print "<tr><td>".__('Add existing tag:')."</td>";
346 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
347 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
349 $found_tags = array();
351 array_push($found_tags, '');
353 while ($line = db_fetch_assoc($result)) {
354 array_push($found_tags, truncate_string($line["tag_name"], 20));
357 print "<td align='right'>";
359 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
369 print "<div align='right'>";
371 print "<input class=\"button\"
372 type=\"submit\" onclick=\"return editTagsSave()\"
373 value=\"".__('Save')."\"> ";
375 print "<input class=\"button\"
376 type=\"submit\" onclick=\"return closeInfoBox()\"
377 value=\"".__('Cancel')."\">";