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