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