Ver código fonte

do not include keyboard help files into index and prefs.php

Andrew Dolgov 12 anos atrás
pai
commit
66be620a87
8 arquivos alterados com 28 adições e 29 exclusões
  1. 5 5
      classes/backend.php
  2. 0 0
      help/main.php
  3. 0 0
      help/prefs.php
  4. 1 3
      index.php
  5. 0 9
      js/functions.js
  6. 14 6
      js/prefs.js
  7. 6 2
      js/tt-rss.js
  8. 2 4
      prefs.php

+ 5 - 5
classes/backend.php

@@ -12,16 +12,16 @@ class Backend extends Handler {
 	}
 
 	function help() {
-		$tid = (int) $_REQUEST["tid"];
+		$topic = basename($_REQUEST["topic"]);
 
-		if (file_exists("help/$tid.php")) {
-			include("help/$tid.php");
+		if (file_exists("help/$topic.php")) {
+			include("help/$topic.php");
 		} else {
 			print "<p>".__("Help topic not found.")."</p>";
 		}
-		print "<div align='center'>
+		/* print "<div align='center'>
 			<button onclick=\"javascript:window.close()\">".
-			__('Close this window')."</button></div>";
+			__('Close this window')."</button></div>"; */
 
 	}
 }

+ 0 - 0
help/3.php → help/main.php


+ 0 - 0
help/4.php → help/prefs.php


+ 1 - 3
index.php

@@ -97,9 +97,7 @@
 		alt="new_version_icon"/>
 </div>
 
-<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
-	<?php include "help/3.php" ?>
-</div>
+<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)"></div>
 
 <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
 <div id="cmdline" style="display : none"></div>

+ 0 - 9
js/functions.js

@@ -634,15 +634,6 @@ function explainError(code) {
 	return displayDlg("explainError", code);
 }
 
-function displayHelpInfobox(topic_id) {
-
-	var url = "backend.php?op=backend&method=help&tid=" + param_escape(topic_id);
-
-	window.open(url, "ttrss_help",
-		"status=0,toolbar=0,location=0,width=450,height=500,scrollbars=1,menubar=0");
-
-}
-
 function loading_set_progress(p) {
 	try {
 		loading_progress += p;

+ 14 - 6
js/prefs.js

@@ -1001,12 +1001,7 @@ function pref_hotkey_handler(e) {
 		if (!hotkey_prefix) {
 
 			if ((keycode == 191 || keychar == '?') && shift_key) { // ?
-				if (!Element.visible("hotkey_help_overlay")) {
-					//Element.show("hotkey_help_overlay");
-					Effect.Appear("hotkey_help_overlay", {duration : 0.3, to: 0.9});
-				} else {
-					Element.hide("hotkey_help_overlay");
-				}
+				showHelp();
 				return false;
 			}
 
@@ -1919,3 +1914,16 @@ function editSelectedInstance() {
 	editInstance(rows[0]);
 }
 
+function showHelp() {
+	try {
+		new Ajax.Request("backend.php", {
+			parameters: "?op=backend&method=help&topic=prefs",
+			onComplete: function(transport) {
+				$("hotkey_help_overlay").innerHTML = transport.responseText;
+				Effect.Appear("hotkey_help_overlay", {duration : 0.3});
+			} });
+
+	} catch (e) {
+		exception_error("showHelp", e);
+	}
+}

+ 6 - 2
js/tt-rss.js

@@ -428,8 +428,12 @@ function quickMenuGo(opid) {
 		}
 
 		if (opid == "qmcHKhelp") {
-			//Element.show("hotkey_help_overlay");
-			Effect.Appear("hotkey_help_overlay", {duration : 0.3});
+			new Ajax.Request("backend.php", {
+				parameters: "?op=backend&method=help&topic=main",
+				onComplete: function(transport) {
+					$("hotkey_help_overlay").innerHTML = transport.responseText;
+					Effect.Appear("hotkey_help_overlay", {duration : 0.3});
+				} });
 		}
 
 		if (opid == "qmcAbout") {

+ 2 - 4
prefs.php

@@ -72,14 +72,12 @@
 	</div>
 </div>
 
-<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
-	<?php include "help/4.php" ?>
-</div>
+<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)"></div>
 
 <img id="piggie" src="images/piggie.png" style="display : none" alt="piggie"/>
 
 <div id="header" dojoType="dijit.layout.ContentPane" region="top">
-	<a href='#' onclick="Effect.Appear('hotkey_help_overlay', {duration: 0.3})"><?php echo __("Keyboard shortcuts") ?></a> |
+	<a href='#' onclick="showHelp()"><?php echo __("Keyboard shortcuts") ?></a> |
 	<a href="#" onclick="gotoMain()"><?php echo __('Exit preferences') ?></a>
 </div>