]>
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')\" | |
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')) { | |
61 | print "<tr><td>Category:</td><td>"; | |
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\" | |
72 | type=\"submit\" onclick=\"return qafAdd()\" value=\"Subscribe\"> | |
73 | <input class=\"button\" | |
74 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
75 | value=\"Cancel\"></div>"; | |
76 | } | |
77 | ||
78 | if ($id == "search") { | |
79 | ||
80 | print "<div id=\"infoBoxTitle\">Search</div>"; | |
81 | print "<div class=\"infoBoxContents\">"; | |
82 | ||
83 | print "<form id='search_form'>"; | |
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 | ||
92 | print "<table width='100%'><tr><td>Search:</td><td>"; | |
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 | ||
101 | print "<tr><td>Where:</td><td>"; | |
102 | ||
103 | print "<select name=\"search_mode\"> | |
104 | <option value=\"all_feeds\">All feeds</option>"; | |
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) { | |
115 | print "<option selected value=\"this_feed\">This feed ($feed_title)</option>"; | |
116 | } else { | |
117 | print "<option disabled>This feed</option>"; | |
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)) { | |
125 | print "<option $cat_preselected value=\"this_cat\">This category ($feed_cat_title)</option>"; | |
126 | } else { | |
127 | print "<option disabled>This category</option>"; | |
128 | } | |
129 | ||
130 | print "</select></td></tr>"; | |
131 | ||
132 | print "<tr><td>Match on:</td><td>"; | |
133 | ||
134 | $search_fields = array( | |
135 | "title" => "Title", | |
136 | "content" => "Content", | |
137 | "both" => "Title or content"); | |
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\" | |
149 | value=\"Search\"> | |
150 | <input class=\"button\" | |
151 | type=\"submit\" onclick=\"javascript:searchCancel()\" | |
152 | value=\"Cancel\"></div>"; | |
153 | ||
154 | print "</div>"; | |
155 | ||
156 | } | |
157 | ||
158 | if ($id == "quickAddLabel") { | |
159 | print "<div id=\"infoBoxTitle\">Create label</div>"; | |
160 | print "<div class=\"infoBoxContents\">"; | |
161 | ||
162 | print "<form id=\"label_edit_form\">"; | |
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 | ||
169 | print "<tr><td>Caption:</td> | |
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\"> | |
178 | <p>SQL Expression:</p>"; | |
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 | ||
191 | print "<input type=\"submit\" onclick=\"labelTest()\" value=\"Test\"> | |
192 | "; | |
193 | ||
194 | print "<input type=\"submit\" | |
195 | id=\"infobox_submit\" | |
196 | disabled=\"true\" | |
197 | class=\"button\" onclick=\"return addLabel()\" | |
198 | value=\"Create\"> "; | |
199 | ||
200 | print "<input class=\"button\" | |
201 | type=\"submit\" onclick=\"return labelEditCancel()\" | |
202 | value=\"Cancel\">"; | |
203 | } | |
204 | ||
205 | if ($id == "quickAddFilter") { | |
206 | ||
207 | $active_feed_id = db_escape_string($_GET["param"]); | |
208 | ||
209 | print "<div id=\"infoBoxTitle\">Create filter</div>"; | |
210 | print "<div class=\"infoBoxContents\">"; | |
211 | ||
212 | print "<form id=\"filter_add_form\">"; | |
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 | ||
232 | print "<tr><td>Match:</td> | |
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 | ||
238 | print "</td></tr><tr><td>On field:</td><td>"; | |
239 | ||
240 | print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\""); | |
ef8be8ea AD |
241 | |
242 | print "</td></tr>"; | |
243 | print "<tr><td>Feed:</td><td colspan='2'>"; | |
244 | ||
245 | print_feed_select($link, "feed_id", $active_feed_id); | |
246 | ||
247 | print "</td></tr>"; | |
248 | ||
249 | print "<tr><td>Action:</td>"; | |
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 | ||
265 | print "<tr><td>Params:</td>"; | |
266 | ||
267 | print "<td><input disabled class='iedit' name='action_param'></td></tr>"; | |
268 | ||
3f2ff803 AD |
269 | print "<tr><td valign='top'>Options:</td><td>"; |
270 | ||
271 | print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\"> | |
272 | <label for=\"inverse\">Inverse match</label></td></tr>"; | |
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()\" | |
283 | disabled=\"true\" value=\"Create\"> "; | |
284 | ||
285 | print "<input class=\"button\" | |
286 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
287 | value=\"Cancel\">"; | |
288 | ||
289 | print "</div>"; | |
290 | ||
291 | // print "</td></tr></table>"; | |
292 | ||
293 | } | |
294 | ||
a3656a41 AD |
295 | if ($id == "feedUpdateErrors") { |
296 | ||
297 | print "<div id=\"infoBoxTitle\">Update Errors</div>"; | |
298 | print "<div class=\"infoBoxContents\">"; | |
299 | ||
300 | print "These feeds have not been updated because of errors:"; | |
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()\" | |
319 | value=\"Close\">"; | |
320 | ||
321 | print "</div>"; | |
322 | ||
323 | } | |
324 | ||
0b126ac2 AD |
325 | if ($id == "editArticleTags") { |
326 | ||
327 | print "<div id=\"infoBoxTitle\">Edit Tags</div>"; | |
328 | print "<div class=\"infoBoxContents\">"; | |
329 | ||
330 | print "<form id=\"tag_edit_form\">"; | |
331 | ||
332 | print "Tags for this article (separated by commas):<br>"; | |
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 | ||
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()\" | |
373 | value=\"Save\"> "; | |
374 | ||
375 | print "<input class=\"button\" | |
376 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
377 | value=\"Cancel\">"; | |
378 | ||
379 | ||
380 | print "</div>"; | |
381 | ||
382 | } | |
383 | ||
ef8be8ea AD |
384 | print "</div>"; |
385 | } | |
386 | ?> |