]>
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 == "quickAddFeed") {
8 print "<div id=\"infoBoxTitle\">Subscribe to feed</div>";
9 print "<div class=\"infoBoxContents\">";
11 print "<form id='feed_add_form'>";
13 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
14 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
15 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
17 print "<table width='100%'>
18 <tr><td>Feed URL:</td><td>
19 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
20 onkeypress=\"return filterCR(event, qafAdd)\"
21 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
22 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
24 if (get_pref($link, 'ENABLE_FEED_CATS')) {
25 print "<tr><td>Category:</td><td>";
26 print_feed_cat_select($link, "cat_id");
33 print "<div align='right'>
34 <input class=\"button\"
35 id=\"fadd_submit_btn\" disabled=\"true\"
36 type=\"submit\" onclick=\"return qafAdd()\" value=\"Subscribe\">
37 <input class=\"button\"
38 type=\"submit\" onclick=\"return closeInfoBox()\"
39 value=\"Cancel\"></div>";
42 if ($id == "search") {
44 print "<div id=\"infoBoxTitle\">Search</div>";
45 print "<div class=\"infoBoxContents\">";
47 print "<form id='search_form'>";
49 #$active_feed_id = db_escape_string($_GET["param"]);
51 $params = split(":", db_escape_string($_GET["param"]));
53 $active_feed_id = sprintf("%d", $params[0]);
54 $is_cat = $params[1] == "true";
56 print "<table width='100%'><tr><td>Search:</td><td>";
58 print "<input name=\"query\" class=\"iedit\"
59 onkeypress=\"return filterCR(event, search)\"
60 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
64 print "<tr><td>Where:</td><td>";
66 print "<select name=\"search_mode\">
67 <option value=\"all_feeds\">All feeds</option>";
69 $feed_title = getFeedTitle($link, $active_feed_id);
72 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
74 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
77 if ($active_feed_id && !$is_cat) {
78 print "<option selected value=\"this_feed\">This feed ($feed_title)</option>";
80 print "<option disabled>This feed</option>";
84 $cat_preselected = "selected";
87 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
88 print "<option $cat_preselected value=\"this_cat\">This category ($feed_cat_title)</option>";
90 print "<option disabled>This category</option>";
93 print "</select></td></tr>";
95 print "<tr><td>Match on:</td><td>";
97 $search_fields = array(
99 "content" => "Content",
100 "both" => "Title or content");
102 print_select_hash("match_on", 3, $search_fields);
104 print "</td></tr></table>";
108 print "<div align=\"right\">
109 <input type=\"submit\"
110 class=\"button\" onclick=\"javascript:search()\"
111 id=\"search_submit_btn\" disabled=\"true\"
113 <input class=\"button\"
114 type=\"submit\" onclick=\"javascript:searchCancel()\"
115 value=\"Cancel\"></div>";
121 if ($id == "quickAddLabel") {
122 print "<div id=\"infoBoxTitle\">Create label</div>";
123 print "<div class=\"infoBoxContents\">";
125 print "<form id=\"label_edit_form\">";
127 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
128 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
130 print "<table width='100%'>";
132 print "<tr><td>Caption:</td>
133 <td><input onkeypress=\"return filterCR(event, addLabel)\"
134 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
135 name=\"description\" class=\"iedit\">";
139 print "<tr><td colspan=\"2\">
140 <p>SQL Expression:</p>";
142 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
143 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
145 print "</td></tr></table>";
149 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
151 print "<div align='right'>";
153 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"Test\">
156 print "<input type=\"submit\"
157 id=\"infobox_submit\"
159 class=\"button\" onclick=\"return addLabel()\"
162 print "<input class=\"button\"
163 type=\"submit\" onclick=\"return labelEditCancel()\"
167 if ($id == "quickAddFilter") {
169 $active_feed_id = db_escape_string($_GET["param"]);
171 print "<div id=\"infoBoxTitle\">Create filter</div>";
172 print "<div class=\"infoBoxContents\">";
174 print "<form id=\"filter_add_form\">";
176 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
177 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
178 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
180 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
182 $result = db_query($link, "SELECT id,description
183 FROM ttrss_filter_types ORDER BY description");
185 $filter_types = array();
187 while ($line = db_fetch_assoc($result)) {
188 //array_push($filter_types, $line["description"]);
189 $filter_types[$line["id"]] = $line["description"];
192 print "<table width='100%'>";
194 print "<tr><td>Match:</td>
195 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
196 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
197 name=\"reg_exp\" class=\"iedit\">";
200 print_select_hash("filter_type", 1, $filter_types, "class=\"iedit\"");
203 print "<tr><td>Feed:</td><td colspan='2'>";
205 print_feed_select($link, "feed_id", $active_feed_id);
209 print "<tr><td>Action:</td>";
211 print "<td colspan='2'><select name=\"action_id\"
212 onchange=\"filterDlgCheckAction(this)\">";
214 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
217 while ($line = db_fetch_assoc($result)) {
218 printf("<option value='%d'>%s</option>", $line["id"], $line["description"]);
225 print "<tr><td>Params:</td>";
227 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
233 print "<div align='right'>";
235 print "<input type=\"submit\"
236 id=\"infobox_submit\"
237 class=\"button\" onclick=\"return qaddFilter()\"
238 disabled=\"true\" value=\"Create\"> ";
240 print "<input class=\"button\"
241 type=\"submit\" onclick=\"return closeInfoBox()\"
246 // print "</td></tr></table>";
250 if ($id == "feedUpdateErrors") {
252 print "<div id=\"infoBoxTitle\">Update Errors</div>";
253 print "<div class=\"infoBoxContents\">";
255 print "These feeds have not been updated because of errors:";
257 $result = db_query($link, "SELECT id,title,feed_url,last_error
258 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
260 print "<ul class='feedErrorsList'>";
262 while ($line = db_fetch_assoc($result)) {
263 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
264 "<em>" . $line["last_error"] . "</em>";
270 print "<div align='center'>";
272 print "<input class=\"button\"
273 type=\"submit\" onclick=\"return closeInfoBox()\"
280 if ($id == "editArticleTags") {
282 print "<div id=\"infoBoxTitle\">Edit Tags</div>";
283 print "<div class=\"infoBoxContents\">";
285 print "<form id=\"tag_edit_form\">";
287 print "Tags for this article (separated by commas):<br>";
289 $tags = get_article_tags($link, $param);
291 $tags_str = join(", ", $tags);
293 print "<table width='100%'>";
295 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
297 print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
299 print "<tr><td>Add existing tag:</td>";
301 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
302 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
304 $found_tags = array();
306 array_push($found_tags, '');
308 while ($line = db_fetch_assoc($result)) {
309 array_push($found_tags, $line["tag_name"]);
312 print "<td align='right'>";
314 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
324 print "<div align='right'>";
326 print "<input class=\"button\"
327 type=\"submit\" onclick=\"return editTagsSave()\"
330 print "<input class=\"button\"
331 type=\"submit\" onclick=\"return closeInfoBox()\"