backend.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. class Backend extends Handler {
  3. function loading() {
  4. header("Content-type: text/html");
  5. print __("Loading, please wait...") . " " .
  6. "<img src='images/indicator_tiny.gif'>";
  7. }
  8. function digestTest() {
  9. header("Content-type: text/html");
  10. $rv = Digest::prepare_headlines_digest($_SESSION['uid'], 1, 1000);
  11. $rv[3] = "<pre>" . $rv[3] . "</pre>";
  12. print_r($rv);
  13. }
  14. private function display_main_help() {
  15. $info = get_hotkeys_info();
  16. $imap = get_hotkeys_map();
  17. $omap = array();
  18. foreach ($imap[1] as $sequence => $action) {
  19. if (!isset($omap[$action])) $omap[$action] = array();
  20. array_push($omap[$action], $sequence);
  21. }
  22. print_notice("<a target=\"_blank\" href=\"http://tt-rss.org/wiki/InterfaceTips\">".
  23. __("Other interface tips are available in the Tiny Tiny RSS wiki.") .
  24. "</a>");
  25. print "<ul class='helpKbList' id='helpKbList'>";
  26. print "<h2>" . __("Keyboard Shortcuts") . "</h2>";
  27. foreach ($info as $section => $hotkeys) {
  28. print "<li><h3>" . $section . "</h3></li>";
  29. foreach ($hotkeys as $action => $description) {
  30. if (is_array($omap[$action])) {
  31. foreach ($omap[$action] as $sequence) {
  32. if (strpos($sequence, "|") !== FALSE) {
  33. $sequence = substr($sequence,
  34. strpos($sequence, "|")+1,
  35. strlen($sequence));
  36. } else {
  37. $keys = explode(" ", $sequence);
  38. for ($i = 0; $i < count($keys); $i++) {
  39. if (strlen($keys[$i]) > 1) {
  40. $tmp = '';
  41. foreach (str_split($keys[$i]) as $c) {
  42. switch ($c) {
  43. case '*':
  44. $tmp .= __('Shift') . '+';
  45. break;
  46. case '^':
  47. $tmp .= __('Ctrl') . '+';
  48. break;
  49. default:
  50. $tmp .= $c;
  51. }
  52. }
  53. $keys[$i] = $tmp;
  54. }
  55. }
  56. $sequence = join(" ", $keys);
  57. }
  58. print "<li>";
  59. print "<span class='hksequence'>$sequence</span>";
  60. print $description;
  61. print "</li>";
  62. }
  63. }
  64. }
  65. }
  66. print "</ul>";
  67. }
  68. function help() {
  69. $topic = basename(clean($_REQUEST["topic"]));
  70. switch ($topic) {
  71. case "main":
  72. $this->display_main_help();
  73. break;
  74. case "prefs":
  75. //$this->display_prefs_help();
  76. break;
  77. default:
  78. print "<p>".__("Help topic not found.")."</p>";
  79. }
  80. print "<div align='center'>";
  81. print "<button dojoType=\"dijit.form.Button\"
  82. onclick=\"return dijit.byId('helpDlg').hide()\">".
  83. __('Close this window')."</button>";
  84. print "</div>";
  85. /* if (file_exists("help/$topic.php")) {
  86. include("help/$topic.php");
  87. } else {
  88. print "<p>".__("Help topic not found.")."</p>";
  89. } */
  90. /* print "<div align='center'>
  91. <button onclick=\"javascript:window.close()\">".
  92. __('Close this window')."</button></div>"; */
  93. }
  94. }