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