]>
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 | ||
073ca0e6 AD |
211 | print "<td colspan='2'><select name=\"action_id\" |
212 | onchange=\"filterDlgCheckAction(this)\">"; | |
ef8be8ea AD |
213 | |
214 | $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions | |
215 | ORDER BY name"); | |
216 | ||
217 | while ($line = db_fetch_assoc($result)) { | |
218 | printf("<option value='%d'>%s</option>", $line["id"], $line["description"]); | |
219 | } | |
220 | ||
221 | print "</select>"; | |
222 | ||
073ca0e6 AD |
223 | print "</td></tr>"; |
224 | ||
225 | print "<tr><td>Params:</td>"; | |
226 | ||
227 | print "<td><input disabled class='iedit' name='action_param'></td></tr>"; | |
228 | ||
229 | print "</table>"; | |
ef8be8ea AD |
230 | |
231 | print "</form>"; | |
232 | ||
233 | print "<div align='right'>"; | |
234 | ||
235 | print "<input type=\"submit\" | |
236 | id=\"infobox_submit\" | |
237 | class=\"button\" onclick=\"return qaddFilter()\" | |
238 | disabled=\"true\" value=\"Create\"> "; | |
239 | ||
240 | print "<input class=\"button\" | |
241 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
242 | value=\"Cancel\">"; | |
243 | ||
244 | print "</div>"; | |
245 | ||
246 | // print "</td></tr></table>"; | |
247 | ||
248 | } | |
249 | ||
a3656a41 AD |
250 | if ($id == "feedUpdateErrors") { |
251 | ||
252 | print "<div id=\"infoBoxTitle\">Update Errors</div>"; | |
253 | print "<div class=\"infoBoxContents\">"; | |
254 | ||
255 | print "These feeds have not been updated because of errors:"; | |
256 | ||
257 | $result = db_query($link, "SELECT id,title,feed_url,last_error | |
258 | FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); | |
259 | ||
e8dd519b | 260 | print "<ul class='feedErrorsList'>"; |
a3656a41 AD |
261 | |
262 | while ($line = db_fetch_assoc($result)) { | |
263 | print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " . | |
264 | "<em>" . $line["last_error"] . "</em>"; | |
265 | } | |
266 | ||
267 | print "</ul>"; | |
268 | print "</div>"; | |
269 | ||
270 | print "<div align='center'>"; | |
271 | ||
272 | print "<input class=\"button\" | |
273 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
274 | value=\"Close\">"; | |
275 | ||
276 | print "</div>"; | |
277 | ||
278 | } | |
279 | ||
0b126ac2 AD |
280 | if ($id == "editArticleTags") { |
281 | ||
282 | print "<div id=\"infoBoxTitle\">Edit Tags</div>"; | |
283 | print "<div class=\"infoBoxContents\">"; | |
284 | ||
285 | print "<form id=\"tag_edit_form\">"; | |
286 | ||
287 | print "Tags for this article (separated by commas):<br>"; | |
288 | ||
289 | $tags = get_article_tags($link, $param); | |
290 | ||
291 | $tags_str = join(", ", $tags); | |
292 | ||
d62a3b63 AD |
293 | print "<table width='100%'>"; |
294 | ||
295 | print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>"; | |
296 | ||
297 | print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>"; | |
298 | ||
299 | print "<tr><td>Add existing tag:</td>"; | |
0b126ac2 | 300 | |
d62a3b63 AD |
301 | $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags |
302 | WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name"); | |
303 | ||
304 | $found_tags = array(); | |
305 | ||
306 | array_push($found_tags, ''); | |
307 | ||
308 | while ($line = db_fetch_assoc($result)) { | |
309 | array_push($found_tags, $line["tag_name"]); | |
310 | } | |
311 | ||
312 | print "<td align='right'>"; | |
313 | ||
314 | print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\""); | |
315 | ||
316 | print "</td>"; | |
317 | ||
318 | print "</tr>"; | |
319 | ||
320 | print "</table>"; | |
0b126ac2 AD |
321 | |
322 | print "</form>"; | |
323 | ||
324 | print "<div align='right'>"; | |
325 | ||
326 | print "<input class=\"button\" | |
327 | type=\"submit\" onclick=\"return editTagsSave()\" | |
328 | value=\"Save\"> "; | |
329 | ||
330 | print "<input class=\"button\" | |
331 | type=\"submit\" onclick=\"return closeInfoBox()\" | |
332 | value=\"Cancel\">"; | |
333 | ||
334 | ||
335 | print "</div>"; | |
336 | ||
337 | } | |
338 | ||
ef8be8ea AD |
339 | print "</div>"; |
340 | } | |
341 | ?> |