Adding facility for platform-specific help panel datasources b=254992 r=doron

This commit is contained in:
neil%parkwaycc.co.uk 2005-04-04 23:35:30 +00:00
Родитель bc75ef1532
Коммит 8dbb4da35c
6 изменённых файлов: 61 добавлений и 30 удалений

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

@ -44,8 +44,8 @@ var helpBrowser;
var helpExternal; var helpExternal;
var helpSearchPanel; var helpSearchPanel;
var emptySearch; var emptySearch;
var emptySearchText var emptySearchText = "No search items found.";
var emptySearchLink var emptySearchLink = "about:blank";
var helpTocPanel; var helpTocPanel;
var helpIndexPanel; var helpIndexPanel;
var helpGlossaryPanel; var helpGlossaryPanel;
@ -59,6 +59,7 @@ const RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Comp
const RDF_ROOT = RDF.GetResource("urn:root"); const RDF_ROOT = RDF.GetResource("urn:root");
const NC_PANELLIST = RDF.GetResource(NC + "panellist"); const NC_PANELLIST = RDF.GetResource(NC + "panellist");
const NC_PANELID = RDF.GetResource(NC + "panelid"); const NC_PANELID = RDF.GetResource(NC + "panelid");
const NC_PLATFORM = RDF.GetResource(NC + "platform");
const NC_EMPTY_SEARCH_TEXT = RDF.GetResource(NC + "emptysearchtext"); const NC_EMPTY_SEARCH_TEXT = RDF.GetResource(NC + "emptysearchtext");
const NC_EMPTY_SEARCH_LINK = RDF.GetResource(NC + "emptysearchlink"); const NC_EMPTY_SEARCH_LINK = RDF.GetResource(NC + "emptysearchlink");
const NC_DATASOURCES = RDF.GetResource(NC + "datasources"); const NC_DATASOURCES = RDF.GetResource(NC + "datasources");
@ -87,6 +88,9 @@ const defaultHelpFile = "chrome://help/locale/mozillahelp.rdf";
var defaultTopic = "welcome"; var defaultTopic = "welcome";
var searchDatasources = "rdf:null"; var searchDatasources = "rdf:null";
var searchDS = null; var searchDS = null;
var platform = /mac/i.test(navigator.platform) ? "mac" :
/win/i.test(navigator.platform) ? "win" :
/os\/2/i.test(navigator.platform) ? "os/2" : "unix";
const NSRESULT_RDF_SYNTAX_ERROR = 0x804e03f7; const NSRESULT_RDF_SYNTAX_ERROR = 0x804e03f7;
@ -212,24 +216,27 @@ function loadHelpRDF() {
var panelDefs = helpFileDS.GetTarget(RDF_ROOT, NC_PANELLIST, true); var panelDefs = helpFileDS.GetTarget(RDF_ROOT, NC_PANELLIST, true);
RDFContainer.Init(helpFileDS, panelDefs); RDFContainer.Init(helpFileDS, panelDefs);
var iterator = RDFContainer.GetElements(); var iterator = RDFContainer.GetElements();
while (iterator.hasMoreElements()) { while (iterator.hasMoreElements()) {
var panelDef = iterator.getNext(); var panelDef = iterator.getNext();
var panelID = getAttribute(helpFileDS, panelDef, NC_PANELID, null); if (getAttribute(helpFileDS, panelDef, NC_PLATFORM, platform) != platform)
continue; // ignore datasources for other platforms.
var datasources = getAttribute(helpFileDS, panelDef, NC_DATASOURCES, "rdf:none"); var panelID = getAttribute(helpFileDS, panelDef, NC_PANELID, null);
var datasources = getAttribute(helpFileDS, panelDef, NC_DATASOURCES, "rdf:null");
datasources = normalizeLinks(helpBaseURI, datasources); datasources = normalizeLinks(helpBaseURI, datasources);
// cache additional datsources to augment search datasources. // cache additional datsources to augment search datasources.
if (panelID == "search") { if (panelID == "search") {
emptySearchText = getAttribute(helpFileDS, panelDef, NC_EMPTY_SEARCH_TEXT, "No search items found."); emptySearchText = getAttribute(helpFileDS, panelDef, NC_EMPTY_SEARCH_TEXT, emptySearchText);
emptySearchLink = getAttribute(helpFileDS, panelDef, NC_EMPTY_SEARCH_LINK, "about:blank"); emptySearchLink = getAttribute(helpFileDS, panelDef, NC_EMPTY_SEARCH_LINK, emptySearchLink);
searchDatasources = datasources; searchDatasources += " " + datasources;
datasources = "rdf:null"; // but don't try to display them yet! continue; // but don't try to display them yet!
} }
// cache toc datasources for use by ID lookup. // cache toc datasources for use by ID lookup.
var tree = document.getElementById("help-" + panelID + "-panel"); var tree = document.getElementById("help-" + panelID + "-panel");
loadDatabasesBlocking(datasources); loadDatabasesBlocking(datasources);
tree.setAttribute("datasources", datasources); tree.setAttribute("datasources", tree.getAttribute("datasources") + " " + datasources);
} }
} }
catch (e) { catch (e) {

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

@ -155,8 +155,7 @@
</template> </template>
<treecols> <treecols>
<treecol id="GlossaryNameColumn" flex="1" <treecol id="GlossaryNameColumn" flex="1"
hideheader="true" hideheader="true"/>
primary="true"/>
</treecols> </treecols>
</tree> </tree>
@ -248,7 +247,7 @@
<treecols> <treecols>
<treecol id="ResultsColumn" flex="1" <treecol id="ResultsColumn" flex="1"
hideheader="true" primary="true" hideheader="true"
sortActive="true" sortActive="true"
sortDirection="ascending" sortDirection="ascending"
sort="?name"/> sort="?name"/>

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

@ -9,6 +9,7 @@ help.jar:
en-US.jar: en-US.jar:
locale/en-US/help/mozillahelp.rdf (locale/en-US/mozillahelp.rdf) locale/en-US/help/mozillahelp.rdf (locale/en-US/mozillahelp.rdf)
locale/en-US/help/help-win.rdf (locale/en-US/help-win.rdf)
locale/en-US/help/help-glossary.rdf (locale/en-US/help-glossary.rdf) locale/en-US/help/help-glossary.rdf (locale/en-US/help-glossary.rdf)
* locale/en-US/help/contents.rdf (locale/en-US/contents.rdf) * locale/en-US/help/contents.rdf (locale/en-US/contents.rdf)
locale/en-US/help/developer_tools.xhtml (locale/en-US/developer_tools.xhtml) locale/en-US/help/developer_tools.xhtml (locale/en-US/developer_tools.xhtml)

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

@ -1828,16 +1828,6 @@
</nc:subheadings> </nc:subheadings>
</rdf:Description> </rdf:Description>
<rdf:Description about="help-indexAZ.rdf#q">
<nc:subheadings>
<rdf:Seq><rdf:li>
<rdf:Description ID="Quick_Launch"
nc:name="Quick Launch"
nc:link="nav_help.xhtml#using_quick_launch"/>
</rdf:li></rdf:Seq>
</nc:subheadings>
</rdf:Description>
<rdf:Description about="help-indexAZ.rdf#r"> <rdf:Description about="help-indexAZ.rdf#r">
<nc:subheadings> <nc:subheadings>
<rdf:Seq><rdf:li> <rdf:Seq><rdf:li>
@ -1934,11 +1924,6 @@
<rdf:Description ID="SSL" <rdf:Description ID="SSL"
nc:name="SSL" nc:name="SSL"
nc:link="ssl_help.xhtml#edit_ciphers"/> nc:link="ssl_help.xhtml#edit_ciphers"/>
</rdf:li>
<rdf:li>
<rdf:Description ID="System"
nc:name="System Preferences"
nc:link="cs_nav_prefs_advanced.xhtml#system"/>
</rdf:li></rdf:Seq> </rdf:li></rdf:Seq>
</nc:subheadings> </nc:subheadings>
</rdf:Description> </rdf:Description>

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

@ -131,7 +131,6 @@ nc:link="chrome://help/locale/nav_help.xhtml#plugins_and_downloads"/> </rdf:li>
<rdf:li> <rdf:Description ID="nav-doc-cache" nc:name="Changing Cache Settings" nc:link="nav_help.xhtml#changing_cache_settings"/> </rdf:li> <rdf:li> <rdf:Description ID="nav-doc-cache" nc:name="Changing Cache Settings" nc:link="nav_help.xhtml#changing_cache_settings"/> </rdf:li>
<rdf:li> <rdf:Description ID="nav-doc-smartup" nc:name="Getting the Latest Software Automatically" nc:link="nav_help.xhtml#getting_the_latest_software_automatically"/> </rdf:li> <rdf:li> <rdf:Description ID="nav-doc-smartup" nc:name="Getting the Latest Software Automatically" nc:link="nav_help.xhtml#getting_the_latest_software_automatically"/> </rdf:li>
<rdf:li> <rdf:Description ID="nav-doc-mousewheel" nc:name="Using a Mouse Wheel" nc:link="nav_help.xhtml#using_a_mouse_wheel"/> </rdf:li> <rdf:li> <rdf:Description ID="nav-doc-mousewheel" nc:name="Using a Mouse Wheel" nc:link="nav_help.xhtml#using_a_mouse_wheel"/> </rdf:li>
<rdf:li> <rdf:Description ID="nav-doc-quicklaunch" nc:name="Using Quick Launch" nc:link="nav_help.xhtml#using_quick_launch"/> </rdf:li>
</rdf:Seq> </rdf:Seq>
</nc:subheadings> </nc:subheadings>
</rdf:Description> </rdf:Description>
@ -804,7 +803,6 @@ nc:link="chrome://help/locale/nav_help.xhtml#plugins_and_downloads"/> </rdf:li>
<rdf:li><rdf:Description ID="advanced_pref_installation" nc:name="Software Installation" nc:link="cs_nav_prefs_advanced.xhtml#software_installation"/> </rdf:li> <rdf:li><rdf:Description ID="advanced_pref_installation" nc:name="Software Installation" nc:link="cs_nav_prefs_advanced.xhtml#software_installation"/> </rdf:li>
<rdf:li><rdf:Description ID="advanced_pref_mouse_wheel" nc:name="Mouse Wheel" nc:link="cs_nav_prefs_advanced.xhtml#mouse_wheel"/> </rdf:li> <rdf:li><rdf:Description ID="advanced_pref_mouse_wheel" nc:name="Mouse Wheel" nc:link="cs_nav_prefs_advanced.xhtml#mouse_wheel"/> </rdf:li>
<rdf:li><rdf:Description ID="advanced_pref_dom_inspector" nc:name="DOM Inspector" nc:link="cs_nav_prefs_advanced.xhtml#dom_inspector"/> </rdf:li> <rdf:li><rdf:Description ID="advanced_pref_dom_inspector" nc:name="DOM Inspector" nc:link="cs_nav_prefs_advanced.xhtml#dom_inspector"/> </rdf:li>
<rdf:li><rdf:Description ID="advanced_pref_system" nc:name="System" nc:link="cs_nav_prefs_advanced.xhtml#system"/> </rdf:li>
</rdf:Seq> </rdf:Seq>
</nc:subheadings> </nc:subheadings>
</rdf:Description> </rdf:Description>

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

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#">
<rdf:Description about="help-toc.rdf#nav-doc-ses">
<nc:subheadings>
<rdf:Seq>
<rdf:li> <rdf:Description ID="nav-doc-quicklaunch" nc:name="Using Quick Launch" nc:link="nav_help.xhtml#using_quick_launch"/> </rdf:li>
</rdf:Seq>
</nc:subheadings>
</rdf:Description>
<rdf:Description about="help-toc.rdf#advanced_pref_advanced">
<nc:subheadings>
<rdf:Seq>
<rdf:li><rdf:Description ID="advanced_pref_system" nc:name="System" nc:link="cs_nav_prefs_advanced.xhtml#system"/> </rdf:li>
</rdf:Seq>
</nc:subheadings>
</rdf:Description>
<rdf:Description about="help-indexAZ.rdf#q">
<nc:subheadings>
<rdf:Seq><rdf:li>
<rdf:Description ID="Quick_Launch"
nc:name="Quick Launch"
nc:link="nav_help.xhtml#using_quick_launch"/>
</rdf:li></rdf:Seq>
</nc:subheadings>
</rdf:Description>
<rdf:Description about="help-indexAZ.rdf#s">
<nc:subheadings>
<rdf:Seq><rdf:li>
<rdf:Description ID="System"
nc:name="System Preferences"
nc:link="cs_nav_prefs_advanced.xhtml#system"/>
</rdf:li></rdf:Seq>
</nc:subheadings>
</rdf:Description>
</rdf:RDF>