]>
Commit | Line | Data |
---|---|---|
3f363052 | 1 | <?php |
9da07c8a | 2 | class Dlg extends Handler_Protected { |
3f363052 | 3 | private $param; |
46da73c2 | 4 | |
17f9d200 JK |
5 | function before($method) { |
6 | if (parent::before($method)) { | |
3f363052 AD |
7 | header("Content-Type: text/xml; charset=utf-8"); |
8 | $this->param = db_escape_string($_REQUEST["param"]); | |
9 | print "<dlg>"; | |
10 | return true; | |
11 | } | |
12 | return false; | |
13 | } | |
46da73c2 | 14 | |
3f363052 AD |
15 | function after() { |
16 | print "</dlg>"; | |
17 | } | |
18 | ||
19 | function importOpml() { | |
20 | header("Content-Type: text/html"); # required for iframe | |
46da73c2 | 21 | |
34aa9e20 AD |
22 | print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>"; |
23 | ||
3f363052 AD |
24 | print "<div class=\"prefFeedOPMLHolder\">"; |
25 | $owner_uid = $_SESSION["uid"]; | |
26 | ||
27 | db_query($this->link, "BEGIN"); | |
28 | ||
d75409bf | 29 | print "<ul class='nomarks'>"; |
3f363052 | 30 | |
d75409bf | 31 | $opml = new Opml($this->link, $_REQUEST); |
3f363052 | 32 | |
d75409bf | 33 | $opml->opml_import($_SESSION["uid"]); |
3f363052 | 34 | |
b77d0c4a AD |
35 | db_query($this->link, "COMMIT"); |
36 | ||
c4c74732 | 37 | print "</ul>"; |
3f363052 AD |
38 | print "</div>"; |
39 | ||
40 | print "<div align='center'>"; | |
41 | print "<button dojoType=\"dijit.form.Button\" | |
34aa9e20 | 42 | onclick=\"dijit.byId('opmlImportDlg').execute()\">". |
3f363052 AD |
43 | __('Close this window')."</button>"; |
44 | print "</div>"; | |
45 | ||
46 | print "</div>"; | |
47 | ||
48 | //return; | |
49 | } | |
50 | ||
51 | function editPrefProfiles() { | |
52 | print "<div dojoType=\"dijit.Toolbar\">"; | |
53 | ||
ddb575c7 AD |
54 | print "<div dojoType=\"dijit.form.DropDownButton\">". |
55 | "<span>" . __('Select')."</span>"; | |
56 | print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; | |
57 | print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\" | |
58 | dojoType=\"dijit.MenuItem\">".__('All')."</div>"; | |
59 | print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\" | |
60 | dojoType=\"dijit.MenuItem\">".__('None')."</div>"; | |
61 | print "</div></div>"; | |
62 | ||
63 | print "<div style=\"float : right\">"; | |
64 | ||
3f363052 AD |
65 | print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\" |
66 | required=\"1\"> | |
67 | <button dojoType=\"dijit.form.Button\" | |
68 | onclick=\"dijit.byId('profileEditDlg').addProfile()\">". | |
69 | __('Create profile')."</button></div>"; | |
70 | ||
ddb575c7 AD |
71 | print "</div>"; |
72 | ||
3f363052 AD |
73 | $result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles |
74 | WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); | |
75 | ||
76 | print "<div class=\"prefFeedCatHolder\">"; | |
77 | ||
78 | print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; | |
79 | ||
80 | print "<table width=\"100%\" class=\"prefFeedProfileList\" | |
81 | cellspacing=\"0\" id=\"prefFeedProfileList\">"; | |
82 | ||
ddb575c7 | 83 | print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd |
3f363052 AD |
84 | |
85 | print "<td width='5%' align='center'><input | |
ddb575c7 | 86 | id='FCATC-0' |
3f363052 AD |
87 | onclick='toggleSelectRow2(this);' |
88 | dojoType=\"dijit.form.CheckBox\" | |
89 | type=\"checkbox\"></td>"; | |
90 | ||
91 | if (!$_SESSION["profile"]) { | |
92 | $is_active = __("(active)"); | |
93 | } else { | |
94 | $is_active = ""; | |
95 | } | |
96 | ||
97 | print "<td><span>" . | |
98 | __("Default profile") . " $is_active</span></td>"; | |
99 | ||
100 | print "</tr>"; | |
101 | ||
102 | $lnum = 1; | |
103 | ||
104 | while ($line = db_fetch_assoc($result)) { | |
105 | ||
106 | $class = ($lnum % 2) ? "even" : "odd"; | |
107 | ||
108 | $profile_id = $line["id"]; | |
109 | $this_row_id = "id=\"FCATR-$profile_id\""; | |
110 | ||
ddb575c7 | 111 | print "<tr class=\"placeholder\" $this_row_id>"; |
3f363052 AD |
112 | |
113 | $edit_title = htmlspecialchars($line["title"]); | |
114 | ||
115 | print "<td width='5%' align='center'><input | |
116 | onclick='toggleSelectRow2(this);' | |
ddb575c7 | 117 | id='FCATC-$profile_id' |
3f363052 AD |
118 | dojoType=\"dijit.form.CheckBox\" |
119 | type=\"checkbox\"></td>"; | |
120 | ||
121 | if ($_SESSION["profile"] == $line["id"]) { | |
122 | $is_active = __("(active)"); | |
123 | } else { | |
124 | $is_active = ""; | |
125 | } | |
126 | ||
127 | print "<td><span dojoType=\"dijit.InlineEditBox\" | |
128 | width=\"300px\" autoSave=\"false\" | |
129 | profile-id=\"$profile_id\">" . $edit_title . | |
130 | "<script type=\"dojo/method\" event=\"onChange\" args=\"item\"> | |
131 | var elem = this; | |
132 | dojo.xhrPost({ | |
133 | url: 'backend.php', | |
134 | content: {op: 'rpc', method: 'saveprofile', | |
135 | value: this.value, | |
136 | id: this.srcNodeRef.getAttribute('profile-id')}, | |
137 | load: function(response) { | |
138 | elem.attr('value', response); | |
139 | } | |
140 | }); | |
141 | </script> | |
142 | </span> $is_active</td>"; | |
143 | ||
144 | print "</tr>"; | |
145 | ||
146 | ++$lnum; | |
147 | } | |
148 | ||
149 | print "</table>"; | |
150 | print "</form>"; | |
151 | print "</div>"; | |
152 | ||
153 | print "<div class='dlgButtons'> | |
154 | <div style='float : left'> | |
155 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">". | |
156 | __('Remove selected profiles')."</button> | |
157 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">". | |
158 | __('Activate profile')."</button> | |
159 | </div>"; | |
160 | ||
161 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">". | |
162 | __('Close this window')."</button>"; | |
163 | print "</div>"; | |
164 | ||
165 | } | |
166 | ||
167 | function pubOPMLUrl() { | |
168 | print "<title>".__('Public OPML URL')."</title>"; | |
169 | print "<content><![CDATA["; | |
170 | ||
50832719 | 171 | $url_path = Opml::opml_publish_url($this->link); |
3f363052 AD |
172 | |
173 | print __("Your Public OPML URL is:"); | |
174 | ||
175 | print "<div class=\"tagCloudContainer\">"; | |
176 | print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>"; | |
177 | print "</div>"; | |
178 | ||
179 | print "<div align='center'>"; | |
180 | ||
181 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">". | |
182 | __('Generate new URL')."</button> "; | |
183 | ||
184 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
185 | __('Close this window')."</button>"; | |
186 | ||
187 | print "</div>"; | |
188 | print "]]></content>"; | |
189 | ||
190 | //return; | |
191 | } | |
192 | ||
193 | function explainError() { | |
194 | print "<title>".__('Notice')."</title>"; | |
195 | print "<content><![CDATA["; | |
196 | ||
197 | print "<div class=\"errorExplained\">"; | |
198 | ||
199 | if ($this->param == 1) { | |
200 | print __("Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner."); | |
201 | ||
202 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
203 | ||
204 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
205 | ||
206 | } | |
207 | ||
208 | if ($this->param == 3) { | |
209 | print __("Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner."); | |
210 | ||
211 | $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); | |
212 | ||
213 | print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); | |
214 | ||
215 | } | |
216 | ||
217 | print "</div>"; | |
218 | ||
219 | print "<div align='center'>"; | |
220 | ||
221 | print "<button onclick=\"return closeInfoBox()\">". | |
222 | __('Close this window')."</button>"; | |
223 | ||
224 | print "</div>"; | |
225 | print "]]></content>"; | |
226 | ||
227 | //return; | |
228 | } | |
229 | ||
230 | function quickAddFeed() { | |
231 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
232 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"addfeed\">"; | |
233 | ||
17525d01 | 234 | print "<div class=\"dlgSec\">".__("Feed or site URL")."</div>"; |
3f363052 AD |
235 | print "<div class=\"dlgSecCont\">"; |
236 | ||
23d2471c AD |
237 | print "<div style='float : right'> |
238 | <img style='display : none' | |
239 | id='feed_add_spinner' src='". | |
240 | theme_image($this->link, 'images/indicator_white.gif')."'></div>"; | |
241 | ||
3f363052 | 242 | print "<input style=\"font-size : 16px; width : 20em;\" |
17525d01 | 243 | placeHolder=\"".__("Feed or site URL")."\" |
3f363052 AD |
244 | dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; |
245 | ||
246 | print "<hr/>"; | |
247 | ||
248 | if (get_pref($this->link, 'ENABLE_FEED_CATS')) { | |
249 | print __('Place in category:') . " "; | |
250 | print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); | |
251 | } | |
252 | ||
253 | print "</div>"; | |
254 | ||
255 | print '<div id="feedDlg_feedsContainer" style="display : none"> | |
256 | ||
257 | <div class="dlgSec">' . __('Available feeds') . '</div> | |
258 | <div class="dlgSecCont">'. | |
259 | '<select id="feedDlg_feedContainerSelect" | |
260 | dojoType="dijit.form.Select" size="3"> | |
261 | <script type="dojo/method" event="onChange" args="value"> | |
262 | dijit.byId("feedDlg_feedUrl").attr("value", value); | |
263 | </script> | |
264 | </select>'. | |
265 | '</div></div>'; | |
266 | ||
267 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
268 | ||
269 | <div class=\"dlgSec\">".__("Authentication")."</div> | |
270 | <div class=\"dlgSecCont\">". | |
271 | ||
272 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" | |
273 | placeHolder=\"".__("Login")."\" | |
274 | style=\"width : 10em;\"> ". | |
275 | " <input | |
276 | placeHolder=\"".__("Password")."\" | |
277 | dojoType=\"dijit.form.TextBox\" type='password' | |
17525d01 | 278 | style=\"width : 10em;\" name='pass'\"> |
3f363052 AD |
279 | </div></div>"; |
280 | ||
281 | ||
282 | print "<div style=\"clear : both\"> | |
aa60999b | 283 | <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" |
3f363052 AD |
284 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> |
285 | <label for=\"feedDlg_loginCheck\">". | |
286 | __('This feed requires authentication.')."</div>"; | |
287 | ||
288 | print "</form>"; | |
289 | ||
290 | print "<div class=\"dlgButtons\"> | |
c39befac AD |
291 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>"; |
292 | ||
293 | if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { | |
294 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>"; | |
295 | } | |
296 | ||
297 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button> | |
3f363052 AD |
298 | </div>"; |
299 | ||
300 | //return; | |
301 | } | |
302 | ||
303 | function feedBrowser() { | |
c39befac AD |
304 | if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; |
305 | ||
3f363052 AD |
306 | $browser_search = db_escape_string($_REQUEST["search"]); |
307 | ||
308 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
309 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">"; | |
310 | ||
311 | print "<div dojoType=\"dijit.Toolbar\"> | |
312 | <div style='float : right'> | |
313 | <img style='display : none' | |
314 | id='feed_browser_spinner' src='". | |
315 | theme_image($this->link, 'images/indicator_white.gif')."'> | |
316 | <input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\" | |
317 | onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\"> | |
318 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button> | |
319 | </div>"; | |
320 | ||
321 | print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\"> | |
322 | <option value='1'>" . __('Popular feeds') . "</option> | |
323 | <option value='2'>" . __('Feed archive') . "</option> | |
324 | </select> "; | |
325 | ||
326 | print __("limit:"); | |
327 | ||
328 | print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; | |
329 | ||
330 | foreach (array(25, 50, 100, 200) as $l) { | |
331 | $issel = ($l == $limit) ? "selected=\"1\"" : ""; | |
332 | print "<option $issel value=\"$l\">$l</option>"; | |
333 | } | |
334 | ||
335 | print "</select> "; | |
336 | ||
337 | print "</div>"; | |
338 | ||
339 | $owner_uid = $_SESSION["uid"]; | |
340 | ||
55c7f092 AD |
341 | require_once "feedbrowser.php"; |
342 | ||
3f363052 AD |
343 | print "<ul class='browseFeedList' id='browseFeedList'>"; |
344 | print make_feed_browser($this->link, $search, 25); | |
345 | print "</ul>"; | |
346 | ||
347 | print "<div align='center'> | |
348 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button> | |
349 | <button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button> | |
350 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button></div>"; | |
351 | ||
352 | } | |
353 | ||
354 | function search() { | |
355 | $this->params = explode(":", db_escape_string($_REQUEST["param"]), 2); | |
356 | ||
357 | $active_feed_id = sprintf("%d", $this->params[0]); | |
358 | $is_cat = $this->params[1] != "false"; | |
359 | ||
360 | print "<div class=\"dlgSec\">".__('Look for')."</div>"; | |
361 | ||
362 | print "<div class=\"dlgSecCont\">"; | |
363 | ||
a8c18025 AD |
364 | print "<input dojoType=\"dijit.form.ValidationTextBox\" |
365 | style=\"font-size : 16px; width : 20em;\" | |
366 | required=\"1\" name=\"query\" type=\"search\" value=''>"; | |
3f363052 AD |
367 | |
368 | print "<hr/>".__('Limit search to:')." "; | |
369 | ||
370 | print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\"> | |
371 | <option value=\"all_feeds\">".__('All feeds')."</option>"; | |
372 | ||
373 | $feed_title = getFeedTitle($this->link, $active_feed_id); | |
374 | ||
375 | if (!$is_cat) { | |
376 | $feed_cat_title = getFeedCatTitle($this->link, $active_feed_id); | |
377 | } else { | |
378 | $feed_cat_title = getCategoryTitle($this->link, $active_feed_id); | |
379 | } | |
380 | ||
381 | if ($active_feed_id && !$is_cat) { | |
382 | print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>"; | |
383 | } else { | |
384 | print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>"; | |
385 | } | |
386 | ||
387 | if ($is_cat) { | |
388 | $cat_preselected = "selected=\"1\""; | |
389 | } | |
390 | ||
391 | if (get_pref($this->link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { | |
392 | print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>"; | |
393 | } else { | |
394 | //print "<option disabled>".__('This category')."</option>"; | |
395 | } | |
396 | ||
397 | print "</select>"; | |
398 | ||
399 | print "</div>"; | |
400 | ||
401 | print "<div class=\"dlgButtons\">"; | |
402 | ||
403 | if (!SPHINX_ENABLED) { | |
404 | print "<div style=\"float : left\"> | |
e8438e8f | 405 | <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/wiki/SearchSyntax\">Search syntax</a> |
3f363052 AD |
406 | </div>"; |
407 | } | |
408 | ||
409 | print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button> | |
410 | <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button> | |
411 | </div>"; | |
412 | } | |
413 | ||
3f363052 AD |
414 | function editArticleTags() { |
415 | ||
416 | print __("Tags for this article (separated by commas):")."<br>"; | |
417 | ||
418 | $tags = get_article_tags($this->link, $this->param); | |
419 | ||
420 | $tags_str = join(", ", $tags); | |
421 | ||
422 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$this->param\">"; | |
423 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
424 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">"; | |
425 | ||
426 | print "<table width='100%'><tr><td>"; | |
427 | ||
428 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4' | |
429 | style='font-size : 12px; width : 100%' id=\"tags_str\" | |
430 | name='tags_str'>$tags_str</textarea> | |
431 | <div class=\"autocomplete\" id=\"tags_choices\" | |
432 | style=\"display:none\"></div>"; | |
433 | ||
434 | print "</td></tr></table>"; | |
435 | ||
436 | print "<div class='dlgButtons'>"; | |
437 | ||
438 | print "<button dojoType=\"dijit.form.Button\" | |
439 | onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> "; | |
440 | print "<button dojoType=\"dijit.form.Button\" | |
441 | onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>"; | |
442 | print "</div>"; | |
443 | ||
444 | } | |
445 | ||
446 | function printTagCloud() { | |
447 | print "<title>".__('Tag Cloud')."</title>"; | |
448 | print "<content><![CDATA["; | |
449 | ||
450 | print "<div class=\"tagCloudContainer\">"; | |
451 | ||
79178062 AD |
452 | // from here: http://www.roscripts.com/Create_tag_cloud-71.html |
453 | ||
454 | $query = "SELECT tag_name, COUNT(post_int_id) AS count | |
455 | FROM ttrss_tags WHERE owner_uid = ".$_SESSION["uid"]." | |
456 | GROUP BY tag_name ORDER BY count DESC LIMIT 50"; | |
457 | ||
458 | $result = db_query($this->link, $query); | |
459 | ||
460 | $tags = array(); | |
461 | ||
462 | while ($line = db_fetch_assoc($result)) { | |
463 | $tags[$line["tag_name"]] = $line["count"]; | |
464 | } | |
465 | ||
466 | if( count($tags) == 0 ){ return; } | |
467 | ||
468 | ksort($tags); | |
469 | ||
470 | $max_size = 32; // max font size in pixels | |
471 | $min_size = 11; // min font size in pixels | |
472 | ||
473 | // largest and smallest array values | |
474 | $max_qty = max(array_values($tags)); | |
475 | $min_qty = min(array_values($tags)); | |
476 | ||
477 | // find the range of values | |
478 | $spread = $max_qty - $min_qty; | |
479 | if ($spread == 0) { // we don't want to divide by zero | |
480 | $spread = 1; | |
481 | } | |
482 | ||
483 | // set the font-size increment | |
484 | $step = ($max_size - $min_size) / ($spread); | |
485 | ||
486 | // loop through the tag array | |
487 | foreach ($tags as $key => $value) { | |
488 | // calculate font-size | |
489 | // find the $value in excess of $min_qty | |
490 | // multiply by the font-size increment ($size) | |
491 | // and add the $min_size set above | |
492 | $size = round($min_size + (($value - $min_qty) * $step)); | |
493 | ||
494 | $key_escaped = str_replace("'", "\\'", $key); | |
495 | ||
496 | echo "<a href=\"javascript:viewfeed('$key_escaped') \" style=\"font-size: " . | |
497 | $size . "px\" title=\"$value articles tagged with " . | |
498 | $key . '">' . $key . '</a> '; | |
499 | } | |
500 | ||
501 | ||
3f363052 AD |
502 | |
503 | print "</div>"; | |
504 | ||
505 | print "<div align='center'>"; | |
506 | print "<button dojoType=\"dijit.form.Button\" | |
507 | onclick=\"return closeInfoBox()\">". | |
508 | __('Close this window')."</button>"; | |
509 | print "</div>"; | |
510 | ||
511 | print "]]></content>"; | |
512 | } | |
513 | ||
514 | function printTagSelect() { | |
46da73c2 | 515 | |
3f363052 AD |
516 | print "<title>" . __('Select item(s) by tags') . "</title>"; |
517 | print "<content><![CDATA["; | |
518 | ||
519 | print __("Match:"). " " . | |
7b28a986 AD |
520 | "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\" id=\"tag_mode_any\">"; |
521 | print "<label for=\"tag_mode_any\">".__("Any")."</label>"; | |
522 | print " "; | |
523 | print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\" id=\"tag_mode_all\">"; | |
524 | print "<label for=\"tag_mode_all\">".__("All tags.")."</input>"; | |
3f363052 AD |
525 | |
526 | print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">"; | |
527 | $result = db_query($this->link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']." | |
528 | AND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC"); | |
529 | ||
530 | while ($row = db_fetch_assoc($result)) { | |
531 | $tmp = htmlspecialchars($row["tag_name"]); | |
532 | print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">$tmp</option>"; | |
533 | } | |
534 | ||
535 | print "</select>"; | |
536 | ||
537 | print "<div align='right'>"; | |
538 | print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags($('all_tags')), | |
539 | get_radio_checked($('tag_mode')));\">" . __('Display entries') . "</button>"; | |
540 | print " "; | |
541 | print "<button dojoType=\"dijit.form.Button\" | |
542 | onclick=\"return closeInfoBox()\">" . | |
543 | __('Close this window') . "</button>"; | |
544 | print "</div>"; | |
545 | ||
546 | print "]]></content>"; | |
547 | } | |
548 | ||
3f363052 | 549 | function generatedFeed() { |
46da73c2 | 550 | |
3f363052 AD |
551 | print "<title>".__('View as RSS')."</title>"; |
552 | print "<content><![CDATA["; | |
553 | ||
554 | $this->params = explode(":", $this->param, 3); | |
555 | $feed_id = db_escape_string($this->params[0]); | |
556 | $is_cat = (bool) $this->params[1]; | |
557 | ||
558 | $key = get_feed_access_key($this->link, $feed_id, $is_cat); | |
559 | ||
560 | $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key; | |
561 | ||
ca6a0741 | 562 | print "<div class=\"dialogNotice\">" . __("You can view this feed as RSS using the following URL:") . "</div>"; |
3f363052 AD |
563 | |
564 | print "<div class=\"tagCloudContainer\">"; | |
565 | print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>"; | |
566 | print "</div>"; | |
567 | ||
568 | print "<div align='center'>"; | |
569 | ||
570 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">". | |
571 | __('Generate new URL')."</button> "; | |
572 | ||
573 | print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">". | |
574 | __('Close this window')."</button>"; | |
575 | ||
576 | print "</div>"; | |
577 | print "]]></content>"; | |
578 | ||
579 | //return; | |
580 | } | |
581 | ||
582 | function newVersion() { | |
46da73c2 | 583 | |
3f363052 AD |
584 | $version_data = check_for_update($this->link); |
585 | $version = $version_data['version']; | |
586 | $id = $version_data['version_id']; | |
587 | ||
ed47e3c4 AD |
588 | if ($version && $id) { |
589 | print "<div class='tagCloudContainer'>"; | |
3f363052 | 590 | |
ed47e3c4 AD |
591 | print T_sprintf("New version of Tiny Tiny RSS is available (%s).", |
592 | "<b>$version</b>"); | |
3f363052 | 593 | |
ed47e3c4 | 594 | print "</div>"; |
3f363052 | 595 | |
ed47e3c4 AD |
596 | $details = "http://tt-rss.org/redmine/versions/$id"; |
597 | $download = "http://tt-rss.org/#Download"; | |
3f363052 | 598 | |
ed47e3c4 | 599 | print "<p align='center'>".__("You can update using built-in updater in the Preferences or by using update.php")."</p>"; |
366f06f7 | 600 | |
ed47e3c4 AD |
601 | print "<div style='text-align : center'>"; |
602 | print "<button dojoType=\"dijit.form.Button\" | |
603 | onclick=\"return window.open('$details')\">".__("Details")."</button>"; | |
604 | print "<button dojoType=\"dijit.form.Button\" | |
605 | onclick=\"return window.open('$download')\">".__("Download")."</button>"; | |
606 | print "<button dojoType=\"dijit.form.Button\" | |
607 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
608 | __('Close this window')."</button>"; | |
609 | ||
610 | } else { | |
611 | print "<div class='tagCloudContainer'>"; | |
612 | ||
613 | print "<p align='center'>".__("Error receiving version information or no new version available.")."</p>"; | |
614 | ||
615 | print "</div>"; | |
616 | ||
617 | print "<div style='text-align : center'>"; | |
618 | print "<button dojoType=\"dijit.form.Button\" | |
619 | onclick=\"return dijit.byId('newVersionDlg').hide()\">". | |
620 | __('Close this window')."</button>"; | |
621 | print "</div>"; | |
622 | ||
623 | } | |
3f363052 AD |
624 | print "</div>"; |
625 | ||
626 | } | |
627 | ||
628 | function customizeCSS() { | |
629 | $value = get_pref($this->link, "USER_STYLESHEET"); | |
630 | ||
631 | $value = str_replace("<br/>", "\n", $value); | |
632 | ||
ca6a0741 | 633 | print "<div class=\"dialogNotice\">"; |
3f363052 | 634 | print T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css"); |
ca6a0741 | 635 | print "</div>"; |
3f363052 AD |
636 | |
637 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
638 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">"; | |
639 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; | |
640 | ||
641 | print "<table width='100%'><tr><td>"; | |
642 | print "<textarea dojoType=\"dijit.form.SimpleTextarea\" | |
643 | style='font-size : 12px; width : 100%; height: 200px;' | |
644 | placeHolder='body#ttrssMain { font-size : 14px; };' | |
645 | name='value'>$value</textarea>"; | |
646 | print "</td></tr></table>"; | |
647 | ||
648 | print "<div class='dlgButtons'>"; | |
649 | print "<button dojoType=\"dijit.form.Button\" | |
650 | onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> "; | |
651 | print "<button dojoType=\"dijit.form.Button\" | |
652 | onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>"; | |
653 | print "</div>"; | |
654 | ||
655 | } | |
656 | ||
3f363052 AD |
657 | function addInstance() { |
658 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">"; | |
659 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">"; | |
660 | ||
661 | print "<div class=\"dlgSec\">".__("Instance")."</div>"; | |
662 | ||
663 | print "<div class=\"dlgSecCont\">"; | |
664 | ||
665 | /* URL */ | |
666 | ||
667 | print __("URL:") . " "; | |
668 | ||
669 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
670 | placeHolder=\"".__("Instance URL")."\" | |
671 | regExp='^(http|https)://.*' | |
672 | style=\"font-size : 16px; width: 20em\" name=\"access_url\">"; | |
673 | ||
674 | print "<hr/>"; | |
675 | ||
676 | $access_key = sha1(uniqid(rand(), true)); | |
677 | ||
678 | /* Access key */ | |
679 | ||
680 | print __("Access key:") . " "; | |
681 | ||
682 | print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" | |
683 | placeHolder=\"".__("Access key")."\" regExp='\w{40}' | |
684 | style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\" | |
685 | value=\"$access_key\">"; | |
686 | ||
687 | print "<p class='insensitive'>" . __("Use one access key for both linked instances."); | |
688 | ||
689 | print "</div>"; | |
690 | ||
691 | print "<div class=\"dlgButtons\"> | |
692 | <div style='float : left'> | |
693 | <button dojoType=\"dijit.form.Button\" | |
694 | onclick=\"return dijit.byId('instanceAddDlg').regenKey()\">". | |
695 | __('Generate new key')."</button> | |
696 | </div> | |
697 | <button dojoType=\"dijit.form.Button\" | |
698 | onclick=\"return dijit.byId('instanceAddDlg').execute()\">". | |
699 | __('Create link')."</button> | |
700 | <button dojoType=\"dijit.form.Button\" | |
701 | onclick=\"return dijit.byId('instanceAddDlg').hide()\"\">". | |
702 | __('Cancel')."</button></div>"; | |
703 | ||
704 | return; | |
705 | } | |
706 | ||
33f0fdd0 AD |
707 | function batchSubscribe() { |
708 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; | |
709 | print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">"; | |
710 | ||
711 | print "<table width='100%'><tr><td> | |
712 | ".__("Add one valid RSS feed per line (no feed detection is done)")." | |
713 | </td><td align='right'>"; | |
714 | if (get_pref($this->link, 'ENABLE_FEED_CATS')) { | |
715 | print __('Place in category:') . " "; | |
716 | print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); | |
717 | } | |
718 | print "</td></tr><tr><td colspan='2'>"; | |
719 | print "<textarea | |
720 | style='font-size : 12px; width : 100%; height: 200px;' | |
721 | placeHolder=\"".__("Feeds to subscribe, One per line")."\" | |
722 | dojoType=\"dijit.form.SimpleTextarea\" required=\"1\" name=\"feeds\"></textarea>"; | |
723 | ||
724 | print "</td></tr><tr><td colspan='2'>"; | |
725 | ||
726 | print "<div id='feedDlg_loginContainer' style='display : none'> | |
727 | " . | |
728 | " <input dojoType=\"dijit.form.TextBox\" name='login'\" | |
729 | placeHolder=\"".__("Login")."\" | |
730 | style=\"width : 10em;\"> ". | |
731 | " <input | |
732 | placeHolder=\"".__("Password")."\" | |
733 | dojoType=\"dijit.form.TextBox\" type='password' | |
734 | style=\"width : 10em;\" name='pass'\">". | |
7ac3f735 | 735 | "</div>"; |
33f0fdd0 AD |
736 | |
737 | print "</td></tr><tr><td colspan='2'>"; | |
738 | ||
739 | print "<div style=\"clear : both\"> | |
740 | <input type=\"checkbox\" name=\"need_auth\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\" | |
741 | onclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'> | |
742 | <label for=\"feedDlg_loginCheck\">". | |
743 | __('Feeds require authentication.')."</div>"; | |
744 | ||
745 | print "</form>"; | |
746 | ||
747 | print "</td></tr></table>"; | |
748 | ||
749 | print "<div class=\"dlgButtons\"> | |
750 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').execute()\">".__('Subscribe')."</button> | |
751 | <button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button> | |
752 | </div>"; | |
753 | } | |
754 | ||
3f363052 AD |
755 | } |
756 | ?> |