]>
git.wh0rd.org - tt-rss.git/blob - modules/popup-dialog.php
4aa498cbfdb6f3b75fa90d41be3c27019f91d35a
2 function module_popup_dialog($link) {
4 $param = db_escape_string($_GET["param"]);
6 if ($id == "explainError") {
8 print "<div id=\"infoBoxTitle\">".__('Notice')."</div>";
9 print "<div class=\"infoBoxContents\">";
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.");
18 $msg = check_for_update($link, false);
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.");
31 print "<div align='center'>";
33 print "<input class=\"button\"
34 type=\"submit\" onclick=\"return closeInfoBox()\"
35 value=\"".__('Close this window')."\">";
42 if ($id == "quickAddFeed") {
44 print "<div id=\"infoBoxTitle\">".__('Subscribe to feed')."</div>";
45 print "<div class=\"infoBoxContents\">";
47 print "<form id='feed_add_form' onsubmit='return false'>";
49 print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
50 /* print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; */
51 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
52 print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">";
54 print "<table width='100%'>
55 <tr><td>Feed URL:</td><td>
56 <input class=\"iedit\" onblur=\"javascript:enableHotkeys()\"
57 onkeypress=\"return filterCR(event, qaddFeed)\"
58 onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
59 onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
60 onfocus=\"javascript:disableHotkeys()\" name=\"feed_url\"></td></tr>";
62 if (get_pref($link, 'ENABLE_FEED_CATS')) {
63 print "<tr><td>".__('Category:')."</td><td>";
64 print_feed_cat_select($link, "cat_id");
68 /* print "<tr><td colspan='2'><div class='insensitive'>";
70 print __("Some feeds require authentication. If you subscribe to such
71 feed, you will have to enter your login and password in Feed Editor");
73 print "</div></td></tr>"; */
77 print "<div id='fadd_login_prompt'><br/>
78 <a href='javascript:showBlockElement(\"fadd_login_container\",
79 \"fadd_login_prompt\")'>Click here if this feed requires authentication.</a></div>";
81 print "<div id='fadd_login_container'>
83 <tr><td>Login:</td><td><input name='auth_login' class='iedit'></td></tr>
84 <tr><td>Password:</td><td><input type='password'
85 name='auth_pass' class='iedit'></td></tr>
91 print "<div align='right'>
92 <input class=\"button\"
93 id=\"fadd_submit_btn\" disabled=\"true\"
94 type=\"submit\" onclick=\"return qaddFeed()\" value=\"".__('Subscribe')."\">
95 <input class=\"button\"
96 type=\"submit\" onclick=\"return closeInfoBox()\"
97 value=\"".__('Cancel')."\"></div>";
102 if ($id == "search") {
104 print "<div id=\"infoBoxTitle\">".__('Search')."</div>";
105 print "<div class=\"infoBoxContents\">";
107 print "<form id='search_form' onsubmit='return false'>";
109 #$active_feed_id = db_escape_string($_GET["param"]);
111 $params = split(":", db_escape_string($_GET["param"]));
113 $active_feed_id = sprintf("%d", $params[0]);
114 $is_cat = $params[1] == "true";
116 print "<table width='100%'><tr><td>".__('Search:')."</td><td>";
118 print "<input name=\"query\" class=\"iedit\"
119 onkeypress=\"return filterCR(event, search)\"
120 onchange=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
121 onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
125 print "<tr><td>".__('Where:')."</td><td>";
127 print "<select name=\"search_mode\">
128 <option value=\"all_feeds\">".__('All feeds')."</option>";
130 $feed_title = getFeedTitle($link, $active_feed_id);
133 $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
135 $feed_cat_title = getCategoryTitle($link, $active_feed_id);
138 if ($active_feed_id && !$is_cat) {
139 print "<option selected value=\"this_feed\">$feed_title</option>";
141 print "<option disabled>".__('This feed')."</option>";
145 $cat_preselected = "selected";
148 if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 ||
$is_cat)) {
149 print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
151 print "<option disabled>".__('This category')."</option>";
154 print "</select></td></tr>";
156 print "<tr><td>".__('Match on:')."</td><td>";
158 $search_fields = array(
159 "title" => __("Title"),
160 "content" => __("Content"),
161 "both" => __("Title or content"));
163 print_select_hash("match_on", 3, $search_fields);
165 print "</td></tr></table>";
169 print "<div align=\"right\">
170 <input type=\"submit\"
171 class=\"button\" onclick=\"javascript:search()\"
172 id=\"search_submit_btn\" disabled=\"true\"
173 value=\"".__('Search')."\">
174 <input class=\"button\"
175 type=\"submit\" onclick=\"javascript:searchCancel()\"
176 value=\"".__('Cancel')."\"></div>";
184 if ($id == "quickAddLabel") {
185 print "<div id=\"infoBoxTitle\">".__('Create label')."</div>";
186 print "<div class=\"infoBoxContents\">";
188 print "<form id=\"label_edit_form\" onsubmit='return false'>";
190 print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
191 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
193 print "<table width='100%'>";
195 print "<tr><td>".__('Caption:')."</td>
196 <td><input onkeypress=\"return filterCR(event, addLabel)\"
197 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
198 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
199 name=\"description\" class=\"iedit\">";
203 print "<tr><td colspan=\"2\">
204 <p>".__('SQL Expression:')."</p>";
206 print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
207 rows=\"4\" name=\"sql_exp\" class=\"iedit\"></textarea>";
209 print "</td></tr></table>";
213 print "<div style=\"display : none\" id=\"label_test_result\"></div>";
215 print "<div align='right'>";
217 print "<input type=\"submit\" onclick=\"labelTest()\" value=\"".__('Test')."\">
220 print "<input type=\"submit\"
221 id=\"infobox_submit\"
223 class=\"button\" onclick=\"return addLabel()\"
224 value=\"".__('Create')."\"> ";
226 print "<input class=\"button\"
227 type=\"submit\" onclick=\"return labelEditCancel()\"
228 value=\"".__('Cancel')."\">";
233 if ($id == "quickAddFilter") {
235 $active_feed_id = db_escape_string($_GET["param"]);
237 print "<div id=\"infoBoxTitle\">".__('Create filter')."</div>";
238 print "<div class=\"infoBoxContents\">";
240 print "<form id=\"filter_add_form\" onsubmit='return false'>";
242 print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">";
243 print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
244 print "<input type=\"hidden\" name=\"subop\" value=\"add\">";
246 // print "<div class=\"notice\"><b>Note:</b> filter will only apply to new articles.</div>";
248 $result = db_query($link, "SELECT id,description
249 FROM ttrss_filter_types ORDER BY description");
251 $filter_types = array();
253 while ($line = db_fetch_assoc($result)) {
254 //array_push($filter_types, $line["description"]);
255 $filter_types[$line["id"]] = $line["description"];
258 print "<table width='100%'>";
260 print "<tr><td>".__('Match:')."</td>
261 <td><input onkeypress=\"return filterCR(event, qaddFilter)\"
262 onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
263 onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
264 name=\"reg_exp\" class=\"iedit\">";
266 print "</td></tr><tr><td>".__('On field:')."</td><td>";
268 print_select_hash("filter_type", 1, $filter_types, "class=\"_iedit\"");
271 print "<tr><td>".__('Feed:')."</td><td colspan='2'>";
273 print_feed_select($link, "feed_id", $active_feed_id);
277 print "<tr><td>".__('Action:')."</td>";
279 print "<td colspan='2'><select name=\"action_id\"
280 onchange=\"filterDlgCheckAction(this)\">";
282 $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
285 while ($line = db_fetch_assoc($result)) {
286 printf("<option value='%d'>%s</option>", $line["id"], $line["description"]);
293 print "<tr><td>".__('Params:')."</td>";
295 print "<td><input disabled class='iedit' name='action_param'></td></tr>";
297 print "<tr><td valign='top'>".__('Options:')."</td><td>";
299 print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\">
300 <label for=\"inverse\">".__('Inverse match')."</label></td></tr>";
306 print "<div align='right'>";
308 print "<input type=\"submit\"
309 id=\"infobox_submit\"
310 class=\"button\" onclick=\"return addFilter()\"
311 disabled=\"true\" value=\"".__('Create')."\"> ";
313 print "<input class=\"button\"
314 type=\"submit\" onclick=\"return closeInfoBox()\"
315 value=\"".__('Cancel')."\">";
319 // print "</td></tr></table>";
324 if ($id == "feedUpdateErrors") {
326 print "<div id=\"infoBoxTitle\">".__('Update Errors')."</div>";
327 print "<div class=\"infoBoxContents\">";
329 print __("These feeds have not been updated because of errors:");
331 $result = db_query($link, "SELECT id,title,feed_url,last_error
332 FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
334 print "<ul class='feedErrorsList'>";
336 while ($line = db_fetch_assoc($result)) {
337 print "<li><b>" . $line["title"] . "</b> (" . $line["feed_url"] . "): " .
338 "<em>" . $line["last_error"] . "</em>";
344 print "<div align='center'>";
346 print "<input class=\"button\"
347 type=\"submit\" onclick=\"return closeInfoBox()\"
348 value=\"".__('Close')."\">";
355 if ($id == "editArticleTags") {
357 print "<div id=\"infoBoxTitle\">".__('Edit Tags')."</div>";
358 print "<div class=\"infoBoxContents\">";
360 print "<form id=\"tag_edit_form\" onsubmit='return false'>";
362 print __("Tags for this article (separated by commas):")."<br>";
364 $tags = get_article_tags($link, $param);
366 $tags_str = join(", ", $tags);
368 print "<table width='100%'>";
370 print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
372 print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
374 print "<tr><td>".__('Add existing tag:')."</td>";
376 $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags
377 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name");
379 $found_tags = array();
381 array_push($found_tags, '');
383 while ($line = db_fetch_assoc($result)) {
384 array_push($found_tags, truncate_string($line["tag_name"], 20));
387 print "<td align='right'>";
389 print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
399 print "<div align='right'>";
401 print "<input class=\"button\"
402 type=\"submit\" onclick=\"return editTagsSave()\"
403 value=\"".__('Save')."\"> ";
405 print "<input class=\"button\"
406 type=\"submit\" onclick=\"return closeInfoBox()\"
407 value=\"".__('Cancel')."\">";
415 if ($id == "printTagCloud") {
416 print "<div id=\"infoBoxTitle\">".__('Tag Cloud')."</div>";
417 print "<div class=\"infoBoxContents\">";
419 print "Showing most popular tags for the last month (<a
420 href='javascript:toggleTags(true)'>browse all</a>):<br/>";
422 print "<div class=\"tagCloudContainer\">";
424 printTagCloud($link);
428 print "<div align='center'>";
429 print "<input class=\"button\"
430 type=\"submit\" onclick=\"return closeInfoBox()\"
431 value=\"".__('Close')."\">";
439 print "<div id='infoBoxTitle'>Internal Error</div>
440 <div id='infoBoxContents'>
441 <p>Unknown dialog <b>$id</b></p>