]> git.wh0rd.org - tt-rss.git/blame - modules/popup-dialog.php
add new version indicator on main chrome
[tt-rss.git] / modules / popup-dialog.php
CommitLineData
ef8be8ea
AD
1<?php
2 function module_popup_dialog($link) {
3 $id = $_GET["id"];
0b126ac2 4 $param = db_escape_string($_GET["param"]);
ef8be8ea 5
ef16ae37
AD
6 if ($id == "explainError") {
7
d9fa39f1 8 print "<div id=\"infoBoxTitle\">Notice</div>";
ef16ae37
AD
9 print "<div class=\"infoBoxContents\">";
10
11 if ($param == 1) {
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.");
15 }
16
d9fa39f1
AD
17 if ($param == 2) {
18 print check_for_update($link, false);
19
20 }
21
ef16ae37
AD
22 print "</div>";
23
24 print "<div align='center'>";
25
26 print "<input class=\"button\"
27 type=\"submit\" onclick=\"return closeInfoBox()\"
28 value=\"Close\">";
29
30 print "</div>";
31
32 }
33
ef8be8ea
AD
34 if ($id == "quickAddFeed") {
35
36 print "<div id=\"infoBoxTitle\">Subscribe to feed</div>";
37 print "<div class=\"infoBoxContents\">";
38
39 print "<form id='feed_add_form'>";
40
41 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
42 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
43 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
44
45 print "<table width='100%'>
46 <tr><td>Feed URL:</td><td>
47 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
48 onkeypress=\"return filterCR(event, qafAdd)\"
49 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
50 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
51
52 if (get_pref($link, 'ENABLE_FEED_CATS')) {
53 print "<tr><td>Category:</td><td>";
54 print_feed_cat_select($link, "cat_id");
55 print "</td></tr>";
56 }
57
58 print "</table>";
59 print "</form>";
60
61 print "<div align='right'>
62 <input class=\"button\"
63 id=\"fadd_submit_btn\" disabled=\"true\"
64 type=\"submit\" onclick=\"return qafAdd()\" value=\"Subscribe\">
65 <input class=\"button\"
66 type=\"submit\" onclick=\"return closeInfoBox()\"
67 value=\"Cancel\"></div>";
68 }
69
70 if ($id == "search") {
71
72 print "<div id=\"infoBoxTitle\">Search</div>";
73 print "<div class=\"infoBoxContents\">";
74
75 print "<form id='search_form'>";
76
77 #$active_feed_id = db_escape_string($_GET["param"]);
78
79 $params = split(":", db_escape_string($_GET["param"]));
80
81 $active_feed_id = sprintf("%d", $params[0]);
82 $is_cat = $params[1] == "true";
83
84 print "<table width='100%'><tr><td>Search:</td><td>";
85
86 print "<input name=\"query\" class=\"iedit\"
87 onkeypress=\"return filterCR(event, search)\"
88 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
89 value=\"\">
90 </td></tr>";
91
92 print "<tr><td>Where:</td><td>";
93
94 print "<select name=\"search_mode\">
95 <option value=\"all_feeds\">All feeds</option>";
96
97 $feed_title = getFeedTitle($link, $active_feed_id);
98
99 if (!$is_cat) {
100 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
101 } else {
102 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
103 }
104
105 if ($active_feed_id && !$is_cat) {
106 print "<option selected value=\"this_feed\">This feed ($feed_title)</option>";
107 } else {
108 print "<option disabled>This feed</option>";
109 }
110
111 if ($is_cat) {
112 $cat_preselected = "selected";
113 }
114
115 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
116 print "<option $cat_preselected value=\"this_cat\">This category ($feed_cat_title)</option>";
117 } else {
118 print "<option disabled>This category</option>";
119 }
120
121 print "</select></td></tr>";
122
123 print "<tr><td>Match on:</td><td>";
124
125 $search_fields = array(
126 "title" => "Title",
127 "content" => "Content",
128 "both" => "Title or content");
129
130 print_select_hash("match_on", 3, $search_fields);
131
132 print "</td></tr></table>";
133
134 print "</form>";
135
136 print "<div align=\"right\">
137 <input type=\"submit\"
138 class=\"button\" onclick=\"javascript:search()\"
139 id=\"search_submit_btn\" disabled=\"true\"
140 value=\"Search\">
141 <input class=\"button\"
142 type=\"submit\" onclick=\"javascript:searchCancel()\"
143 value=\"Cancel\"></div>";
144
145 print "</div>";
146
147 }
148
149 if ($id == "quickAddLabel") {
150 print "<div id=\"infoBoxTitle\">Create label</div>";
151 print "<div class=\"infoBoxContents\">";
152
153 print "<form id=\"label_edit_form\">";
154
155 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
156 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
157
158 print "<table width='100%'>";
159
160 print "<tr><td>Caption:</td>
161 <td><input onkeypress=\"return filterCR(event, addLabel)\"
162 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
163 name=\"description\" class=\"iedit\">";
164
165 print "</td></tr>";
166
167 print "<tr><td colspan=\"2\">
168 <p>SQL Expression:</p>";
169
170 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
171 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
172
173 print "</td></tr></table>";
174
175 print "</form>";
176
177 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
178
179 print "<div align='right'>";
180
181 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"Test\">
182 ";
183
184 print "<input type=\"submit\"
185 id=\"infobox_submit\"
186 disabled=\"true\"
187 class=\"button\" onclick=\"return addLabel()\"
188 value=\"Create\"> ";
189
190 print "<input class=\"button\"
191 type=\"submit\" onclick=\"return labelEditCancel()\"
192 value=\"Cancel\">";
193 }
194
195 if ($id == "quickAddFilter") {
196
197 $active_feed_id = db_escape_string($_GET["param"]);
198
199 print "<div id=\"infoBoxTitle\">Create filter</div>";
200 print "<div class=\"infoBoxContents\">";
201
202 print "<form id=\"filter_add_form\">";
203
204 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
205 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
206 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
207
208// print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
209
210 $result = db_query($link, "SELECT id,description
211 FROM ttrss_filter_types ORDER BY description");
212
213 $filter_types = array();
214
215 while ($line = db_fetch_assoc($result)) {
216 //array_push($filter_types, $line["description"]);
217 $filter_types[$line["id"]] = $line["description"];
218 }
219
220 print "<table width='100%'>";
221
222 print "<tr><td>Match:</td>
223 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
224 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
225 name=\"reg_exp\" class=\"iedit\">";
226 print "</td><td>";
227
228 print_select_hash("filter_type", 1, $filter_types, "class=\"iedit\"");
229
230 print "</td></tr>";
231 print "<tr><td>Feed:</td><td colspan='2'>";
232
233 print_feed_select($link, "feed_id", $active_feed_id);
234
235 print "</td></tr>";
236
237 print "<tr><td>Action:</td>";
238
073ca0e6
AD
239 print "<td colspan='2'><select name=\"action_id\"
240 onchange=\"filterDlgCheckAction(this)\">";
ef8be8ea
AD
241
242 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
243 ORDER BY name");
244
245 while ($line = db_fetch_assoc($result)) {
246 printf("<option value='%d'>%s</option>", $line["id"], $line["description"]);
247 }
248
249 print "</select>";
250
073ca0e6
AD
251 print "</td></tr>";
252
253 print "<tr><td>Params:</td>";
254
255 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
256
257 print "</table>";
ef8be8ea
AD
258
259 print "</form>";
260
261 print "<div align='right'>";
262
263 print "<input type=\"submit\"
264 id=\"infobox_submit\"
265 class=\"button\" onclick=\"return qaddFilter()\"
266 disabled=\"true\" value=\"Create\"> ";
267
268 print "<input class=\"button\"
269 type=\"submit\" onclick=\"return closeInfoBox()\"
270 value=\"Cancel\">";
271
272 print "</div>";
273
274// print "</td></tr></table>";
275
276 }
277
a3656a41
AD
278 if ($id == "feedUpdateErrors") {
279
280 print "<div id=\"infoBoxTitle\">Update Errors</div>";
281 print "<div class=\"infoBoxContents\">";
282
283 print "These feeds have not been updated because of errors:";
284
285 $result = db_query($link, "SELECT id,title,feed_url,last_error
286 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
287
e8dd519b 288 print "<ul class='feedErrorsList'>";
a3656a41
AD
289
290 while ($line = db_fetch_assoc($result)) {
291 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
292 "<em>" . $line["last_error"] . "</em>";
293 }
294
295 print "</ul>";
296 print "</div>";
297
298 print "<div align='center'>";
299
300 print "<input class=\"button\"
301 type=\"submit\" onclick=\"return closeInfoBox()\"
302 value=\"Close\">";
303
304 print "</div>";
305
306 }
307
0b126ac2
AD
308 if ($id == "editArticleTags") {
309
310 print "<div id=\"infoBoxTitle\">Edit Tags</div>";
311 print "<div class=\"infoBoxContents\">";
312
313 print "<form id=\"tag_edit_form\">";
314
315 print "Tags for this article (separated by commas):<br>";
316
317 $tags = get_article_tags($link, $param);
318
319 $tags_str = join(", ", $tags);
320
d62a3b63
AD
321 print "<table width='100%'>";
322
323 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
324
325 print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
326
327 print "<tr><td>Add existing tag:</td>";
0b126ac2 328
d62a3b63
AD
329 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
330 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
331
332 $found_tags = array();
333
334 array_push($found_tags, '');
335
336 while ($line = db_fetch_assoc($result)) {
e4609ea9 337 array_push($found_tags, truncate_string($line["tag_name"], 20));
d62a3b63
AD
338 }
339
340 print "<td align='right'>";
341
342 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
343
344 print "</td>";
345
346 print "</tr>";
347
348 print "</table>";
0b126ac2
AD
349
350 print "</form>";
351
352 print "<div align='right'>";
353
354 print "<input class=\"button\"
355 type=\"submit\" onclick=\"return editTagsSave()\"
356 value=\"Save\"> ";
357
358 print "<input class=\"button\"
359 type=\"submit\" onclick=\"return closeInfoBox()\"
360 value=\"Cancel\">";
361
362
363 print "</div>";
364
365 }
366
ef8be8ea
AD
367 print "</div>";
368 }
369?>