backend.php 2.7 KB

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