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