context sensitive help, sr=blake, a=asa, r=sfraser, b=46226

This commit is contained in:
oeschger%netscape.com 2001-06-19 22:35:17 +00:00
Родитель dcc36e4c3b
Коммит 870a09d044
10 изменённых файлов: 188 добавлений и 20 удалений

Просмотреть файл

@ -1,6 +1,12 @@
//-------- global variables
var gBrowser;
// The key object is used to define special context strings that, when appended to
// the url for the help window itself, load specific content. For example, the uri:
// chrome://help/content/help.xul?mail
// loads the document at:
// chrome://help/locale/mail_help.html into the window on initialization.
var key = {
"?mail": "chrome://help/locale/mail_help.html",
"?nav": "chrome://help/locale/nav_help.html",
@ -8,6 +14,38 @@ var key = {
"?sec": "chrome://help/locale/security_help.html",
"?cust": "chrome://help/locale/customize_help.html",
"?comp": "chrome://help/locale/composer_help.html",
"?prefs": "chrome://help/locale/prefs_help.html#prefs_first",
"?mail_prefs_general": "chrome://help/locale/mail_help.html#PREFERENCES_MAILNEWS_MAIN_PANE",
"?mail_prefs_display": "chrome://help/locale/mail_help.html#PREFERENCES_MAILNEWS_DISPLAY",
"?mail_prefs_messages": "chrome://help/locale/mail_help.html#PREFERENCES_MAILNEWS_MESSAGES",
"?mail_prefs_formatting": "chrome://help/locale/mail_help.html#PREFERENCES_MAILNEWS_FORMATTING",
"?mail_prefs_addressing": "chrome://help/locale/mail_help.html#PREFERENCES_MAILNEWS_ADDRESSING",
"?mail_prefs_offline": "chrome://help/locale/mail_help.html#PREFERENCES_MAILNEWS_OFFLINE",
"?composer_prefs_general": "chrome://help/locale/composer_help.html#PREFERENCES_EDITOR_GENERAL",
"?composer_prefs_newpage": "chrome://help/locale/composer_help.html#PREFERENCES_NEWPAGE",
"?appearance_pref": "chrome://help/locale/cs_nav_prefs_appearance.html",
"?appearance_pref_appearance": "chrome://help/locale/cs_nav_prefs_appearance.html#appearance",
"?appearance_pref_fonts": "chrome://help/locale/cs_nav_prefs_appearance.html#fonts",
"?appearance_pref_colors": "chrome://help/locale/cs_nav_prefs_appearance.html#colors",
"?appearance_pref_fonts": "chrome://help/locale/cs_nav_prefs_appearance.html#fonts",
"?appearance_pref_themes": "chrome://help/locale/cs_nav_prefs_appearance.html#themes",
"?navigator_pref": "chrome://help/locale/cs_nav_prefs_navigator.html",
"?navigator_pref_navigator": "chrome://help/locale/cs_nav_prefs_navigator.html#Navigator",
"?navigator_pref_history": "chrome://help/locale/cs_nav_prefs_navigator.html#History",
"?navigator_pref_languages": "chrome://help/locale/cs_nav_prefs_navigator.html#Languages",
"?navigator_pref_helper_applications": "chrome://help/locale/cs_nav_prefs_navigator.html#Helper",
"?navigator_pref_internet_searching": "chrome://help/locale/cs_nav_prefs_navigator.html#Internet",
"?advanced_pref": "chrome://help/locale/cs_nav_prefs_advanced.html",
"?advanced_pref_advanced": "chrome://help/locale/cs_nav_prefs_advanced.html#Advanced",
"?advanced_pref_cache": "chrome://help/locale/cs_nav_prefs_advanced.html#Cache",
"?advanced_pref_software_installation": "chrome://help/locale/cs_nav_prefs_advanced.html#Software_Installation",
"?advanced_pref_software_mouse_wheel": "chrome://help/locale/cs_nav_prefs_advanced.html#Mouse_Wheel",
"?advanced_pref_software_system": "chrome://help/locale/cs_nav_prefs_advanced.html#system",
"?nover_noencrypt": "chrome://help/locale/ssl_page_info_help.html#Not_Verified_Not Encrypted",
"?ver_encrypt": "chrome://help/locale/ssl_page_info_help.html#Verified_Encrypted",
@ -41,15 +79,38 @@ var key = {
"?sec_gen": "chrome://help/locale/privsec_help.html#privsec_help_first",
"?ssl_prefs": "chrome://help/locale/ssl_help.html#ssl_first",
"?validation_prefs": "chrome://help/locale/ssl_help.html#ssl_first",
"?passwords_prefs": "chrome://help/locale/ssl_help.html#ssl_first"
"?validation_prefs": "chrome://help/locale/validation_help.html",
"?passwords_prefs": "chrome://help/locale/passwords_help.html",
"?forms_prefs": "chrome://help/locale/using_priv_help.html#using_forms",
"?cookies_prefs": "chrome://help/locale/using_priv_help.html#using_cookies",
"?images_prefs": "chrome://help/locale/using_priv_help.html#using_images",
"?certs_prefs": "chrome://help/locale/certs_prefs_help.html",
"?im_prefs_general": "chrome://help/locale/im_help.html#im_gen",
"?im_prefs_privacy": "chrome://help/locale/im_help.html#im_privacy",
"?im_prefs_notification": "chrome://help/locale/im_help.html#im_notif",
"?im_prefs_away": "chrome://help/locale/im_help.html#im_awaypref",
"?im_prefs_connection": "chrome://help/locale/im_help.html#im_connect"
}
// This function is called by dialogs that want to display context-sensitive help
function openHelp(uri)
{
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
var topWindow = windowManagerInterface.getMostRecentWindow( "mozilla:help" );
if ( topWindow ) {
topWindow.focus();
} else if (window.opener) {
window.opener.open(uri, "_blank", "chrome,menubar,toolbar,dialog=no,resizable,scrollbars");
} else {
window.open(uri, "_blank", "chrome,menubar,toolbar,dialog=no,resizable,scrollbars");
}
}
function init()
{
// Initialize the Help window
// "window.arguments[0]" is undefined or context string
// move to right end of screen
var width = document.documentElement.getAttribute("width");
@ -61,33 +122,49 @@ function init()
.createInstance(Components.interfaces.nsISHistory);
getWebNavigation().sessionHistory = sessionHistory;
//if ("argument" in window && window.arguments.length >= 1) {
// browser.loadURI(window.arguments[0]);
//} else {
// goHome(); // should be able to do browser.goHome();
//}
if (window.location.search) {
// if this is context-sensitive,
// then window.location.search contains the "key" (from the top of this file)
// that resolves to a particular html document or target
if (key[window.location.search]) {
dump("loading help content: " + key[window.location.search] + "\n");
loadURI(key[window.location.search]);
// selectTOC(key[window.location.search]);
} else {
setContext();
} else {
goHome();
}
}
// select the item in the tree called "Dialog Help" if the window was loaded from a dialog
function setContext() {
var items = document.getElementsByAttribute("helplink", "chrome://help/locale/context_help.html");
if (items.length) {
var tree = document.getElementById("help-toc-tree");
try { tree.selectItem(items[0].parentNode.parentNode); } catch(ex) { dump("can't select in toc: " + ex + "\n"); }
}
}
function selectTOC(link_attr) {
var items = document.getElementsByAttribute("helplink", link_attr);
if (items.length >= 1) {
var parentRow = items[0].parentNode;
var selectableNode = parentRow.parentNode; // helplink is an attribute
// on a treecell, which cannot be selected
var tree = document.getElementById("help-toc-tree");
tree.selectItem(selectableNode);
if (items.length) {
openTwistyTo(items[0]);
var tree = document.getElementById("help-toc-tree");
try { tree.selectItem(items[0].parentNode.parentNode); } catch(ex) { dump("can't select in toc: " + ex + "\n"); }
}
}
// open parent nodes for the selected node
// until you get to the top of the tree
function openTwistyTo(selectedURINode)
{
var parent = selectedURINode.parentNode;
var tree = document.getElementById("help-toc-tree");
if (parent == tree)
return;
parent.setAttribute("open", "true");
openTwistyTo(parent);
}
function getWebNavigation()
{
@ -98,6 +175,7 @@ function loadURI(aURI)
{
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
getWebNavigation().loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE);
dump("help document: " + uRI);
}
function goBack()

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Dialog Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_dialogs.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Dialog Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_dialogs.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Advanced Preferences Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_prefs_advanced.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Advanced Preferences Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_prefs_advanced.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Appearance Preferences Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_prefs_appearance.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Appearance Preferences Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_prefs_appearance.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Navigator Preferences Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_prefs_navigator.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Navigator Preferences Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_prefs_navigator.html</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<html>
<head>
<title>Mozilla Sidebar Help</title>
<link rel="stylesheet" href="chrome://communicator/locale/help/content_style.css" type="text/css">
</head>
<body bgcolor="white">
<p>Context sensitive help: write me!</p>
<p>file: mozilla/extensions/help/resources/locale/en-US/cs_nav_sidebar.html</p>
</body>
</html>