]>
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()\"
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'>";
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 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
59 if (get_pref($link, 'ENABLE_FEED_CATS')) {
60 print "<tr><td>Category:</td><td>";
61 print_feed_cat_select($link, "cat_id");
68 print "<div align='right'>
69 <input class=\"button\"
70 id=\"fadd_submit_btn\" disabled=\"true\"
71 type=\"submit\" onclick=\"return qafAdd()\" value=\"Subscribe\">
72 <input class=\"button\"
73 type=\"submit\" onclick=\"return closeInfoBox()\"
74 value=\"Cancel\"></div>";
77 if ($id == "search") {
79 print "<div id=\"infoBoxTitle\">Search</div>";
80 print "<div class=\"infoBoxContents\">";
82 print "<form id='search_form'>";
84 #$active_feed_id = db_escape_string($_GET["param"]);
86 $params = split(":", db_escape_string($_GET["param"]));
88 $active_feed_id = sprintf("%d", $params[0]);
89 $is_cat = $params[1] == "true";
91 print "<table width='100%'><tr><td>Search:</td><td>";
93 print "<input name=\"query\" class=\"iedit\"
94 onkeypress=\"return filterCR(event, search)\"
95 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
99 print "<tr><td>Where:</td><td>";
101 print "<select name=\"search_mode\">
102 <option value=\"all_feeds\">All feeds</option>";
104 $feed_title = getFeedTitle($link, $active_feed_id);
107 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
109 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
112 if ($active_feed_id && !$is_cat) {
113 print "<option selected value=\"this_feed\">This feed ($feed_title)</option>";
115 print "<option disabled>This feed</option>";
119 $cat_preselected = "selected";
122 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
123 print "<option $cat_preselected value=\"this_cat\">This category ($feed_cat_title)</option>";
125 print "<option disabled>This category</option>";
128 print "</select></td></tr>";
130 print "<tr><td>Match on:</td><td>";
132 $search_fields = array(
134 "content" => "Content",
135 "both" => "Title or content");
137 print_select_hash("match_on", 3, $search_fields);
139 print "</td></tr></table>";
143 print "<div align=\"right\">
144 <input type=\"submit\"
145 class=\"button\" onclick=\"javascript:search()\"
146 id=\"search_submit_btn\" disabled=\"true\"
148 <input class=\"button\"
149 type=\"submit\" onclick=\"javascript:searchCancel()\"
150 value=\"Cancel\"></div>";
156 if ($id == "quickAddLabel") {
157 print "<div id=\"infoBoxTitle\">Create label</div>";
158 print "<div class=\"infoBoxContents\">";
160 print "<form id=\"label_edit_form\">";
162 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
163 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
165 print "<table width='100%'>";
167 print "<tr><td>Caption:</td>
168 <td><input onkeypress=\"return filterCR(event, addLabel)\"
169 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
170 name=\"description\" class=\"iedit\">";
174 print "<tr><td colspan=\"2\">
175 <p>SQL Expression:</p>";
177 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
178 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
180 print "</td></tr></table>";
184 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
186 print "<div align='right'>";
188 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"Test\">
191 print "<input type=\"submit\"
192 id=\"infobox_submit\"
194 class=\"button\" onclick=\"return addLabel()\"
197 print "<input class=\"button\"
198 type=\"submit\" onclick=\"return labelEditCancel()\"
202 if ($id == "quickAddFilter") {
204 $active_feed_id = db_escape_string($_GET["param"]);
206 print "<div id=\"infoBoxTitle\">Create filter</div>";
207 print "<div class=\"infoBoxContents\">";
209 print "<form id=\"filter_add_form\">";
211 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
212 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
213 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
215 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
217 $result = db_query($link, "SELECT id,description
218 FROM ttrss_filter_types ORDER BY description");
220 $filter_types = array();
222 while ($line = db_fetch_assoc($result)) {
223 //array_push($filter_types, $line["description"]);
224 $filter_types[$line["id"]] = $line["description"];
227 print "<table width='100%'>";
229 print "<tr><td>Match:</td>
230 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
231 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
232 name=\"reg_exp\" class=\"iedit\">";
235 print_select_hash("filter_type", 1, $filter_types, "class=\"iedit\"");
238 print "<tr><td>Feed:</td><td colspan='2'>";
240 print_feed_select($link, "feed_id", $active_feed_id);
244 print "<tr><td>Action:</td>";
246 print "<td colspan='2'><select name=\"action_id\"
247 onchange=\"filterDlgCheckAction(this)\">";
249 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
252 while ($line = db_fetch_assoc($result)) {
253 printf("<option value='%d'>%s</option>", $line["id"], $line["description"]);
260 print "<tr><td>Params:</td>";
262 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
268 print "<div align='right'>";
270 print "<input type=\"submit\"
271 id=\"infobox_submit\"
272 class=\"button\" onclick=\"return qaddFilter()\"
273 disabled=\"true\" value=\"Create\"> ";
275 print "<input class=\"button\"
276 type=\"submit\" onclick=\"return closeInfoBox()\"
281 // print "</td></tr></table>";
285 if ($id == "feedUpdateErrors") {
287 print "<div id=\"infoBoxTitle\">Update Errors</div>";
288 print "<div class=\"infoBoxContents\">";
290 print "These feeds have not been updated because of errors:";
292 $result = db_query($link, "SELECT id,title,feed_url,last_error
293 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
295 print "<ul class='feedErrorsList'>";
297 while ($line = db_fetch_assoc($result)) {
298 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
299 "<em>" . $line["last_error"] . "</em>";
305 print "<div align='center'>";
307 print "<input class=\"button\"
308 type=\"submit\" onclick=\"return closeInfoBox()\"
315 if ($id == "editArticleTags") {
317 print "<div id=\"infoBoxTitle\">Edit Tags</div>";
318 print "<div class=\"infoBoxContents\">";
320 print "<form id=\"tag_edit_form\">";
322 print "Tags for this article (separated by commas):<br>";
324 $tags = get_article_tags($link, $param);
326 $tags_str = join(", ", $tags);
328 print "<table width='100%'>";
330 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
332 print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
334 print "<tr><td>Add existing tag:</td>";
336 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
337 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
339 $found_tags = array();
341 array_push($found_tags, '');
343 while ($line = db_fetch_assoc($result)) {
344 array_push($found_tags, truncate_string($line["tag_name"], 20));
347 print "<td align='right'>";
349 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
359 print "<div align='right'>";
361 print "<input class=\"button\"
362 type=\"submit\" onclick=\"return editTagsSave()\"
365 print "<input class=\"button\"
366 type=\"submit\" onclick=\"return closeInfoBox()\"