Change to the prefs xml to have version information.

This commit is contained in:
smeredith%netscape.com 2002-05-21 02:22:23 +00:00
parent cb85de7cc8
commit c0e404671c
6 changed files with 693 additions and 532 deletions

View File

@ -1,7 +1,9 @@
<?xml version="1.0"?>
<PREFSGROUP uiname="Netscape Preferences">
<PREF uiname="Open Browser on Startup" prefname="general.startup.browser" type="bool" default="true" lockable="true" description="When the application starts, open a browser window.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
</PREFSGROUP>
<?xml version="1.0" encoding="UTF-8"?>
<METAPREFS clientversion="7.0b1" subversion="0">
<PREFSGROUP uiname="Netscape Preferences">
<PREF uiname="Open Browser on Startup" prefname="general.startup.browser" type="bool" default="true" lockable="true" description="When the application starts, open a browser window.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
</PREFSGROUP>
</METAPREFS>

View File

@ -1,33 +1,35 @@
<?xml version="1.0"?>
<PREFSGROUP uiname="Netscape Preferences">
<PREFSGROUP uiname="Group 1">
<PREF uiname="Autoload What's Related" prefname="browser.related.autoload" type="int" default="0" lockable="true" description="A good description of this pref goes here.">
<CHOICES>
<CHOICE uiname="Always" value="0"/>
<CHOICE uiname="After First Use" value="1"/>
<CHOICE uiname="Never" value="2"/>
</CHOICES>
<VALUE>0</VALUE>
<LOCKED>false</LOCKED>
</PREF>
<PREF uiname="Start Page" prefname="browser.startup.page" type="int" default="0" lockable="true" description="Display this page when Navigator starts up.">
<CHOICES>
<CHOICE uiname="Blank Page" value="0"/>
<CHOICE uiname="Home Page" value="1"/>
<CHOICE uiname="Last Page Visited" value="2"/>
</CHOICES>
<VALUE>0</VALUE>
<LOCKED>false</LOCKED>
</PREF>
<?xml version="1.0" encoding="UTF-8"?>
<METAPREFS clientversion="7.0b1" subversion="0">
<PREFSGROUP uiname="Netscape Preferences">
<PREFSGROUP uiname="Group 1">
<PREF uiname="Autoload What's Related" prefname="browser.related.autoload" type="int" default="0" lockable="true" description="A good description of this pref goes here.">
<CHOICES>
<CHOICE uiname="Always" value="0"/>
<CHOICE uiname="After First Use" value="1"/>
<CHOICE uiname="Never" value="2"/>
</CHOICES>
<VALUE>0</VALUE>
<LOCKED>false</LOCKED>
</PREF>
<PREF uiname="Start Page" prefname="browser.startup.page" type="int" default="0" lockable="true" description="Display this page when Navigator starts up.">
<CHOICES>
<CHOICE uiname="Blank Page" value="0"/>
<CHOICE uiname="Home Page" value="1"/>
<CHOICE uiname="Last Page Visited" value="2"/>
</CHOICES>
<VALUE>0</VALUE>
<LOCKED>false</LOCKED>
</PREF>
</PREFSGROUP>
<PREFSGROUP uiname="Group 2">
<PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks" type="bool" default="true" lockable="true" description="Show Booksmarks button on browser toolbar.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
<PREF uiname="Go" prefname="browser.toolbars.showbutton.go" type="bool" default="true" lockable="true" description="Show Go button on browser toolbar.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
</PREFSGROUP>
</PREFSGROUP>
<PREFSGROUP uiname="Group 2">
<PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks" type="bool" default="true" lockable="true" description="Show Booksmarks button on browser toolbar.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
<PREF uiname="Go" prefname="browser.toolbars.showbutton.go" type="bool" default="true" lockable="true" description="Show Go button on browser toolbar.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
</PREFSGROUP>
</PREFSGROUP>
</METAPREFS>

View File

@ -1,142 +1,208 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="author" content="Steve Meredith"><title>How to Add a PrefsTree Pref Editor Widget to a CCK Wizard Page</title></head><body text="#000000" bgcolor="#ffffcc" link="#0000ff" alink="darkblue" vlink="#cc0000">
<div align="Right">Changed params to <tt>processPrefsTree</tt>&nbsp;&nbsp;&nbsp; 02 Jan 2002<br>
Original&nbsp;&nbsp;&nbsp; <strike>11 Dec 2001</strike><br>
Steve Meredith<br></div>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<meta name="author" content="Steve Meredith">
<title>How to Add a PrefsTree Pref Editor Widget to a CCK Wizard Page</title>
</head>
<body text="#000000" bgcolor="#ffffcc" link="#0000ff" alink="darkblue"
vlink="#cc0000">
<div align="right">Changed params to <tt>processPrefsTree</tt>&nbsp;&nbsp;&nbsp;
02 Jan 2002<br>
Original&nbsp;&nbsp;&nbsp; <strike>11 Dec 2001</strike><br>
Steve Meredith<br>
</div>
<h1>How to Add a PrefsTree Pref Editor Widget to a CCK Wizard Page</h1>
<h2>Introduction</h2>
The Pref Editor is a widget for CCK/Factory, named <i>PrefsTree </i>in .ini
files. It is a tree control which displays prefs in a hierarchy and allows
a user to edit their values. It reads an XML file to determine the structure
of the tree control. The details of the XML file format can be found in the
document&nbsp;<a href="PrefsTreeFileFormat.htm">PrefsTreeFileFormat.htm</a>
. That document, together with this one, describe how to add a pref editor tree control to CCK.
The Pref Editor is a widget for CCK/Factory, named <i>PrefsTree </i>in
.ini files. It is a tree control which displays prefs in a hierarchy and
allows a user to edit their values. It reads an XML file to determine the
structure of the tree control. The details of the XML file format can be
found in the document&nbsp;<a href="PrefsTreeFileFormat.htm">PrefsTreeFileFormat.htm</a>.
That document, together with this one, describe how to add a pref editor
tree control to CCK.
<h2>Example</h2>
The easiest way to understand how to add a PrefsTree pref edit widget is to look at an example.<br>
<br>
<img src="PrefsTreeEx2.jpg" alt="Screen shot example" width="638" height="493">
<br>
<br>
The easiest way to understand how to add a PrefsTree pref edit widget is
to look at an example.<br>
<br>
<img src="PrefsTreeEx2.jpg" alt="Screen shot example" width="638"
height="493">
<br>
<br>
<h3>The INI File</h3>
The .ini file used to insert this pref editor onto this widget page is as follows:<br>
<code><br>
[Local Variables]<br>
Name=PrefsTree<br>
Title=Advanced Preferences<br>
Caption=1st level node<br>
Help=Online;%Root%Help\PrefsTree.html<br><br>
[Navigation Controls]<br>
onEnter=<br>
onNext=<br>
Help=<br><br>
[Image 4200]<br>
Type=Image<br>
Name=prefstree.bmp<br>
Value=<br>
Start_x=0<br>
Start_y=0<br>
Width=425<br>
Height=56<br><br>
[Widget 4201]<br>
Type=GlobalText<br>
Name=Text4201<br>
Value=Browse this tree to find other preferences that you want to customize. Double-click to edit.<br>
Start_x=0<br>
Start_y=32<br>
Width=400<br>
Height=30<br><br>
[Widget 4202]<br>
Type=PrefsTree<br>
Name=AdvancedPrefs<br>
Attrib=MetaPrefs.xml<br>
Value=<br>
Start_x=0<br>
Start_y=45<br>
Width=405<br>
Height=181<br><br></code>
<table cellpadding="2" cellspacing="2" border="1" width="100%" bgcolor="#ffffff">
<tbody><tr><td valign="Top">Above is the section which defines the PrefsTree widget. The <tt>Name</tt> is important if you want to hook up the control to some buttons, as in our example. The <tt>Attrib</tt>
specifies the name of the prefs XML file. This file belongs in the root
with the .exe files. Once edited, a copy of the file gets saved in the working
config directory. This is where install builder picks up its values. The
<tt>Value</tt> is not used.<br></td></tr></tbody>
</table>
<code><br>
[Widget 4203]<br>
Type=Button<br>
Name=Button4203<br>
Value=Open<br>
Start_x=0<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=OpenPrefTreeItem(AdvancedPrefs)<br><br></code>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody><tr><td valign="Top" bgcolor="#ffffff">Above is the section defining the "Open" button. When pressed, it calls <tt>OpenPrefTreeItem()</tt>
for the PrefsTree widget named in the parameter. If a pref is selected,
a dialog is open which allows the user to edit that text. If a group is selected,
then that group is expanded or collapsed, depending on its current state.
You can also use the right-button menu to open a pref for editing.<br></td></tr></tbody>
</table>
<code><br>
[Widget 4204]<br>
Type=Button<br>
Name=Button4204<br>
Value=Find Pref<br>
Start_x=50<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=FindPrefTreeItem(AdvancedPrefs)<br><br></code>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody><tr><td valign="Top" bgcolor="#ffffff">Above is the section defining the "Find Pref" button. When pressed, it calls <tt>FindPrefTreeItem()</tt> for the PrefsTree widget named in the parameter. This function opens a <i>find </i>
dialog which is used to find any text associated with a pref. It searches
the pref name, its description, and its files for the text. You can also
use the right-button menu to open the <i>find </i>dialog.<br></td></tr></tbody>
</table>
<code><br>
[Widget 4205]<br>
Type=Button<br>
Name=Button4205<br>
Value=Find Next<br>
Start_x=100<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=FindNextPrefTreeItem(AdvancedPrefs)<br><br></code>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody><tr><td valign="Top" bgcolor="#ffffff">Above is the section to define the "Find Next" button. When pressed, if calls <tt>FindNextPefTreeItem()</tt>
for the PrefsTree widget named in the parameter. This function selects the
next pref which matches the last text search. It opens a <i>find </i>dialog if "Find Pref" was never used.<br></td></tr></tbody>
</table>
<code><br>
[Widget 4206]<br>
Type=Button<br>
Name=Button4206<br>
Value=Add Pref<br>
Start_x=150<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=AddPrefTreeItem(AdvancedPrefs)</code><br>
The .ini file used to insert this pref editor onto this widget page is
as follows:<br>
<code><br>
[Local Variables]<br>
Name=PrefsTree<br>
Title=Advanced Preferences<br>
Caption=1st level node<br>
Help=Online;%Root%Help\PrefsTree.html<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody><tr><td valign="Top" bgcolor="#ffffff">Above is the section to define the "Add Pref" button. It calls <tt>AddPrefTreeItem()</tt> for the PrefsTree widget named in the parameter. This function opens the <i>add </i>dialog which prompts the user for the name and description of the new pref. It then open the <i>edit </i>dialog which allows the user to set the value of the new pref.<br></td></tr></tbody>
[Navigation Controls]<br>
onEnter=<br>
onNext=<br>
Help=<br>
<br>
[Image 4200]<br>
Type=Image<br>
Name=prefstree.bmp<br>
Value=<br>
Start_x=0<br>
Start_y=0<br>
Width=425<br>
Height=56<br>
<br>
[Widget 4201]<br>
Type=GlobalText<br>
Name=Text4201<br>
Value=Browse this tree to find other preferences that you want to customize.
Double-click to edit.<br>
Start_x=0<br>
Start_y=32<br>
Width=400<br>
Height=30<br>
<br>
[Widget 4202]<br>
Type=PrefsTree<br>
Name=AdvancedPrefs<br>
Attrib=MetaPrefs.xml<br>
Value=<br>
Start_x=0<br>
Start_y=45<br>
Width=405<br>
Height=181<br>
<br>
</code>
<table cellpadding="2" cellspacing="2" border="1" width="100%"
bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top">Above is the section which defines the PrefsTree widget.
The <tt>Name</tt> is important if you want to hook up the control to some
buttons, as in our example. The <tt>Attrib</tt> specifies the name of the
prefs XML file. This file belongs in the root with the .exe files. Once edited,
a copy of the file gets saved in the working config directory. This is where
install builder picks up its values. The <tt>Value</tt> is not used.<br>
</td>
</tr>
</tbody>
</table>
<code><br>
[Widget 4203]<br>
Type=Button<br>
Name=Button4203<br>
Value=Open<br>
Start_x=0<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=OpenPrefTreeItem(AdvancedPrefs)<br>
<br>
</code>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody>
<tr>
<td valign="top" bgcolor="#ffffff">Above is the section defining the
"Open" button. When pressed, it calls <tt>OpenPrefTreeItem()</tt> for the
PrefsTree widget named in the parameter. If a pref is selected, a dialog
is open which allows the user to edit that text. If a group is selected, then
that group is expanded or collapsed, depending on its current state. You
can also use the right-button menu to open a pref for editing.<br>
</td>
</tr>
</tbody>
</table>
<code><br>
[Widget 4204]<br>
Type=Button<br>
Name=Button4204<br>
Value=Find Pref<br>
Start_x=50<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=FindPrefTreeItem(AdvancedPrefs)<br>
<br>
</code>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody>
<tr>
<td valign="top" bgcolor="#ffffff">Above is the section defining the
"Find Pref" button. When pressed, it calls <tt>FindPrefTreeItem()</tt> for
the PrefsTree widget named in the parameter. This function opens a <i>find
</i> dialog which is used to find any text associated with a pref.
It searches the pref name, its description, and its files for the text. You
can also use the right-button menu to open the <i>find </i>dialog.<br>
</td>
</tr>
</tbody>
</table>
<code><br>
[Widget 4205]<br>
Type=Button<br>
Name=Button4205<br>
Value=Find Next<br>
Start_x=100<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=FindNextPrefTreeItem(AdvancedPrefs)<br>
<br>
</code>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody>
<tr>
<td valign="top" bgcolor="#ffffff">Above is the section to define the
"Find Next" button. When pressed, if calls <tt>FindNextPefTreeItem()</tt>
for the PrefsTree widget named in the parameter. This function selects the
next pref which matches the last text search. It opens a <i>find </i>dialog
if "Find Pref" was never used.<br>
</td>
</tr>
</tbody>
</table>
<code><br>
[Widget 4206]<br>
Type=Button<br>
Name=Button4206<br>
Value=Add Pref<br>
Start_x=150<br>
Start_y=232<br>
Width=40<br>
Height=14<br>
onCommand=AddPrefTreeItem(AdvancedPrefs)</code><br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tbody>
<tr>
<td valign="top" bgcolor="#ffffff">Above is the section to define the
"Add Pref" button. It calls <tt>AddPrefTreeItem()</tt> for the PrefsTree
widget named in the parameter. This function opens the <i>add </i>dialog
which prompts the user for the name and description of the new pref. It then
open the <i>edit </i>dialog which allows the user to set the value of the
new pref.<br>
</td>
</tr>
</tbody>
</table>
<h3>SCRIPT.IB</h3>
A SCRIPT.IB entry must be made in order for Install Builder process the .XML file: <tt>processPrefsTree(PrefFile.xml</tt>,browser.xpi,bin/netscp6.cfg<tt>)</tt>
. Spaces are not allowed between the parameters. The first parameter must
be the name of the file as specified in the .ini file. The second param is
the .xpi file that the preference file is in. The first paramater is the
preferences file. If it ends with a .cfg, then it will be hashed.<br>
<br>
</body></html>
A SCRIPT.IB entry must be made in order for Install Builder process the
.XML file: <tt>processPrefsTree(PrefFile.xml</tt>,<tt>browser.xpi,bin/netscp6.cfg)</tt>.
Spaces are not allowed between the parameters. The first parameter must be
the name of the file as specified in the .ini file. The second param is the
.xpi file that the preference file is in. The first paramater is the preferences
file. If it ends with a .cfg, then it will be hashed.<br>
<br>
<br>
</body>
</html>

View File

@ -1,424 +1,484 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<meta name="author" content="Steve Meredith">
<title>Structure of the Pref Editor XML File for the PrefsTree Widget</title>
</head>
<body text="#000000" bgcolor="#ffffcc" link="#0000ff" alink="darkblue" vlink="#cc0000">
<div align="right">Removed <tt>MANAGE </tt>element. Added <tt>REMOTEADMIN
</tt>element and <tt>default </tt>attribute&nbsp;&nbsp;&nbsp; 13 Feb 2002<br>
Mention the XSL stylesheet.&nbsp;&nbsp;&nbsp; 30 Jan 2002<br>
Added <tt>useradded</tt> attribute&nbsp;&nbsp;&nbsp; <strike>28 Jan 2002</strike><br>
Added the <tt>MANAGE </tt>element.&nbsp;&nbsp;&nbsp; <strike>24 Jan 2002</strike><br>
Removed elements <tt>INSTALLATIONFILE </tt>and <tt>PREFFILE. </tt>Changed
<tt>processPrefsTree()</tt> number of params. &nbsp;&nbsp; <strike>02 Jan
2002</strike><br>
Removed <tt>choose </tt>attribute. &nbsp;&nbsp; <strike>13 Dec 2001</strike><br>
Original version. &nbsp;&nbsp; <strike>11 Dec 2001</strike><br>
Steve Meredith<br>
</div>
<body text="#000000" bgcolor="#ffffcc" link="#0000ff" alink="darkblue"
vlink="#cc0000">
<div align="right">Added tag <tt>METAPREFS</tt>. Added UTF-8 indicator to
XML.&nbsp;&nbsp;&nbsp; 18 May 2002<br>
Removed <tt>MANAGE </tt>element. Added <tt>REMOTEADMIN </tt>element and
<tt>default </tt>attribute&nbsp;&nbsp;&nbsp; <strike>13 Feb 2002</strike><br>
Mention the XSL stylesheet.&nbsp;&nbsp;&nbsp; <strike>30 Jan 2002</strike><br>
Added <tt>useradded</tt> attribute&nbsp;&nbsp;&nbsp; <strike>28 Jan 2002</strike><br>
Added the <tt>MANAGE </tt>element.&nbsp;&nbsp;&nbsp; <strike>24 Jan 2002</strike><br>
Removed elements <tt>INSTALLATIONFILE </tt>and <tt>PREFFILE. </tt>Changed
<tt>processPrefsTree()</tt> number of params. &nbsp;&nbsp; <strike>02 Jan
2002</strike><br>
Removed <tt>choose </tt>attribute. &nbsp;&nbsp; <strike>13 Dec 2001</strike><br>
Original version. &nbsp;&nbsp; <strike>11 Dec 2001</strike><br>
Steve Meredith<br>
</div>
<h1>Structure of the Pref Editor XML File for the PrefsTree Widget</h1>
<h2>Introduction</h2>
The<i> Pref Editor</i> is a widget for CCK/Factory, named <i>PrefsTree
</i> in .ini files. It is a tree control which displays prefs in a hierarchy
and allows a user to edit their values. It reads an XML file to determine
the structure of the tree control. This XML file includes information on
The<i> Pref Editor</i> is a widget for CCK/Factory, named <i>PrefsTree
</i> in .ini files. It is a tree control which displays prefs in a hierarchy
and allows a user to edit their values. It reads an XML file to determine
the structure of the tree control. This XML file includes information on
each pref, including its name, its default value, a description of it, etc.
It also includes structure for how these prefs are grouped in the tree control.
The name of the XML file is specified in the .ini section for the PrefsTree
Widget. The default file must be located in the same directory as the <tt>
WIZARDMACHINE.EXE</tt> . When used, a copy of the file is saved in the working
config directory. This copy contains the changes made by the CCK/Factory
The name of the XML file is specified in the .ini section for the PrefsTree
Widget. The default file must be located in the same directory as the <tt>
WIZARDMACHINE.EXE</tt> . When used, a copy of the file is saved in the working
config directory. This copy contains the changes made by the CCK/Factory
user, and is used by the install builder to write preferences in the install
image. A <tt>SCRIPT.IB</tt> entry must be made in order for it process the
.XML file: <tt>processPrefsTree(,browser.xpi,bin/netscp6.cfg</tt><tt>)</tt>
. Note that spaces are not allowed between the parameters. For details on
adding a PrefsTree control to wizard pages, see the document&nbsp;<a href="PrefsTree.htm">
PrefsTree.htm</a><br>
.XML file: <tt>processPrefsTree(MetaPrefs.xml,browser.xpi,bin/netscp6.cfg</tt><tt>)</tt>
. Note that spaces are not allowed between the parameters (CCK limitation).
For details on adding a PrefsTree control to wizard pages, see the document&nbsp;<a
href="PrefsTree.htm"> PrefsTree.htm</a><br>
<h2>Who This Document is For</h2>
You will need to understand the structure of the XML file if you want to
add or remove prefs to the Pref Editor or change how they are grouped. <br>
You will need to understand the structure of the XML file if you want
to add or remove prefs to the Pref Editor or change how they are grouped.
<br>
<h2>A Note on Prefs</h2>
The XML described herein contains elements for prefs and elements to control
how they are grouped in a UI. It was specifically designed for use in this
<i>Pref Editor</i> tree control, but a complete representation of prefs in
XML could be useful in other ways. But for this use, the only prefs which
should be included in this file are prefs which can be set in advance and
saved to a .cfg or .jsc file. Note that this excludes some prefs which might
be found in a profile <tt>prefs.js</tt> , such as those prefs which define
specific mail and news accounts, servers, and identities. These pref names
are generated on the fly by the client. If this XML is to be expanded for
use in other ways, for example as described in <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=17199">
Bugzilla bug 17199</a> , new tags could be added to each pref to indicate
whether or not it could be set in advance and stored in a .cfg file. The
Pref Editor would have to be modified to respect this new information and
only present the appropriate prefs for editting. Otherwise, any new elements
and attributes are ignored as long as the basic structure of the file remains
valid (<tt>&lt;PREF&gt;</tt>s are grouped within <tt>&lt;PREFSGROUP&gt;</tt>
s) and the required attributes and subelements exist.<br>
<br>
The following prefs should not be placed into this XML file for use in
the prefs editor because they are handled outside the prefs editor, and used
to point to the file created by the install builder and prefs editor.<br>
The XML described herein contains elements for prefs and elements to
control how they are grouped in a UI. It was specifically designed for use
in this <i>Pref Editor</i> tree control, but a complete representation of
prefs in XML could be useful in other ways. But for this use, the only prefs
which should be included in this file are prefs which can be set in advance
and saved to a default .js, .cfg or remote .jsc file. Note that this excludes
some prefs which might be found in a profile <tt>prefs.js</tt> , such as those
prefs which define specific mail and news accounts, servers, and identities.
These pref names are generated on the fly by the client. If this XML is to
be expanded for use in other ways, for example as described in <a
href="http://bugzilla.mozilla.org/show_bug.cgi?id=17199"> Bugzilla bug 17199</a>
, new tags could be added to each pref to indicate whether or not it could
be set in advance and stored in a .cfg file. The Pref Editor would have to
be modified to respect this new information and only present the appropriate
prefs for editting. Otherwise, any new elements and attributes are ignored
as long as the basic structure of the file remains valid (<tt>&lt;PREF&gt;</tt>s
are grouped within <tt>&lt;PREFSGROUP&gt;</tt> s) and the required attributes
and subelements exist.<br>
<br>
The following prefs should not be placed into this XML file for use in
the prefs editor because they are handled outside the prefs editor, and
used to point to the file created by the install builder and prefs editor.<br>
<ul>
<li><tt>autoadmin.global_config_url</tt></li>
<li><tt>autoadmin.failover_to_cached</tt></li>
<li><tt>autoadmin.offline_failover</tt></li>
<li><tt>autoadmin.refresh_interval</tt><br>
</li>
<li><tt>autoadmin.global_config_url</tt></li>
<li><tt>autoadmin.failover_to_cached</tt></li>
<li><tt>autoadmin.offline_failover</tt></li>
<li><tt>autoadmin.refresh_interval</tt><br>
</li>
</ul>
<h3>Problem Prefs</h3>
<ul>
<li><tt>browser.search.defaultengine</tt>: This is a string type, but
it looks like it's a URL to a local file (engine://). I can't set this to
a resonable default value as I don't know where Netscape is going to be installed.
</li>
<li><tt> browser.startup.homepage</tt>:&nbsp;&nbsp;&nbsp; <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=109932">
Problem when used with lockPref().</a></li>
<li><tt>network.cookie.p3plevel</tt> has an interaction with <tt>network.cookie.p3p</tt>
. When you change <tt>network.cookie.p3p</tt>,<tt> network.cookie.p3plevel</tt>
should get set to some value. This happens in the pref code in the browser.
There is no way to do this with the Pref Editor right now--prefs are treated
as individual entities. For now I have commented what is supposed to happen
in the description text for these prefs. In the future, perhaps we could define
such relationships in the XML. </li>
<li><tt>browser.search.defaultengine</tt>: This is a string type, but
it looks like it's a URL to a local file (engine://). I can't set this to
a resonable default value as I don't know where Netscape is going to be
installed. </li>
<li><tt> browser.startup.homepage</tt>:&nbsp;&nbsp;&nbsp; <a
href="http://bugzilla.mozilla.org/show_bug.cgi?id=109932"> Problem when used
with lockPref().</a></li>
<li><tt>network.cookie.p3plevel</tt> has an interaction with <tt>network.cookie.p3p</tt>
. When you change <tt>network.cookie.p3p</tt>,<tt> network.cookie.p3plevel</tt>
should get set to some value. This happens in the pref code in the browser.
There is no way to do this with the Pref Editor right now--prefs are treated
as individual entities. For now I have commented what is supposed to happen
in the description text for these prefs. In the future, perhaps we could
define such relationships in the XML. </li>
</ul>
<h2>Conventions</h2>
For XML item tags, we use ALL CAPS. For attribute names, we use lower case.
&#8220;true&#8221; and &#8220;false&#8221; are also written in lower case. Generally, for PREF items,
the attributes are those things about the pref which are fixed, and use elements
for thing the CCK/Factory app will change. The exception is for <tt>&lt;CHOICES&gt;</tt>
, which are difficult to represent as attributes, so these are elements.<br>
For XML item tags, we use ALL CAPS. For attribute names, we use lower
case. &#8220;true&#8221; and &#8220;false&#8221; are also written in lower case. Generally, for PREF
items, the attributes are those things about the pref which are fixed, and
use elements for thing the CCK/Factory app will change. The exception is
for <tt>&lt;CHOICES&gt;</tt> , which are difficult to represent as attributes,
so these are elements.<br>
<h2>General Structure of the XML File</h2>
<h3>XSL Stylesheet</h3>
There may be a reference to an XSL stylesheet at the start of the XML file.
For example, <tt>&lt;?xml-stylesheet type="text/xsl" href="metaprefs.xsl"?&gt;</tt>
. This is not used by the Pref Editor. It is used when the XML file is
There may be a reference to an XSL stylesheet at the start of the XML
file. For example, <tt>&lt;?xml-stylesheet type="text/xsl" href="metaprefs.xsl"?&gt;</tt>
. This is not used by the Pref Editor. It is used when the XML file is
loaded into a Gecko browser (or IE 6) to format the XML into an HTML table
that is easy to read. It is included so that the XML file may be self-documenting
for internal use. The referenced XSL file must also exist in the same directory
for the stylesheet to work.<br>
for internal use. The referenced XSL file must also exist in the same directory
for the stylesheet to work.<br>
<h3>Examples</h3>
The easiest way to understand the format of the XML is to look at some short
examples. <br>
The easiest way to understand the format of the XML is to look at some
short examples. <br>
<h4>Example1</h4>
The simplest file that may exist consists of one group containing one
pref. <br>
<br>
<code>&lt;?xml version="1.0"?&gt;<br>
&lt;PREFSGROUP uiname="Netscape Preferences"&gt;<br>
&nbsp; &lt;PREF uiname="Open Browser on Startup" prefname="general.startup.browser"
type="bool" default="true" lockable="true" description="When the app starts,
open a browser."&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;VALUE&gt;true&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp; &lt;/PREF&gt;<br>
&lt;/PREFSGROUP&gt;</code><br>
<br>
The above file will result in a tree control with one parent, the group,
and one child, the pref. See the example below.<br>
<br>
<img src="PrefsTreeEx1.jpg" alt="Example 1">
The simplest file that may exist consists of one group containing one
pref. <br>
<br>
<code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>
&lt;METAPREFS clientversion="7.01b" subversion="0"&gt;<br>
&nbsp; &lt;PREFSGROUP uiname="Netscape Preferences"&gt;<br>
&nbsp; &nbsp; &lt;PREF uiname="Open Browser on Startup" prefname="general.startup.browser"
type="bool" default="true" lockable="true" description="When the app starts,
open a browser."&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &lt;VALUE&gt;true&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp; &nbsp; &lt;/PREF&gt;<br>
&nbsp; &lt;/PREFSGROUP&gt;<br>
&lt;METAPREFS&gt;</code><br>
<br>
The above file will result in a tree control with one parent, the group,
and one child, the pref. See the example below.<br>
<br>
<img src="PrefsTreeEx1.jpg" alt="Example 1">
<h4>Example 2</h4>
The more complicated example below shows the top level group, with two
sub groups, each with two preferences.<br>
<br>
<code>&lt;?xml version="1.0"?&gt;<br>
&lt;PREFSGROUP uiname="Netscape Preferences"&gt;<br>
&nbsp; &lt;PREFSGROUP uiname="Group 1"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;PREF uiname="Autoload What's Related" prefname="browser.related.autoload"
type="int" default="0" lockable="true" description="A good description of
this pref goes here."&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &lt;CHOICES&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &lt;CHOICE uiname="Always" value="0"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CHOICE uiname="After First
Use" value="1"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CHOICE uiname="Never" value="2"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/CHOICES&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VALUE&gt;0&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/PREF&gt;<br>
&nbsp;&nbsp; &nbsp;&lt;PREF uiname="Start Page" prefname="browser.startup.page"
type="int" lockable="true" default="0" description="Display this page when
Navigator starts up."&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&lt;CHOICES&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&lt;CHOICE uiname="Blank Page" value="0"/&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;CHOICE uiname="Home Page" value="1"/&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;CHOICE uiname="Last Page Visited" value="2"/&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&lt;/CHOICES&gt;<br>
&nbsp; &nbsp; &nbsp; &lt;VALUE&gt;0&lt;/VALUE&gt;<br>
&nbsp; &nbsp; &nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp; &nbsp; &lt;/PREF&gt;<br>
&nbsp; &lt;/PREFSGROUP&gt;<br>
&nbsp; &lt;PREFSGROUP uiname="Group 2"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks"
type="bool" default="true" lockable="true" description="Show Booksmarks button
The more complicated example below shows the top level group, with two
sub groups, each with two preferences.<br>
<br>
<code>&lt;?xml version="1.0" </code><code>encoding="UTF-8"</code><code>?&gt;<br>
</code><code>&lt;METAPREFS clientversion="7.01b" subversion="0"&gt;</code><br>
<code>&nbsp; &lt;PREFSGROUP uiname="Netscape Preferences"&gt;<br>
&nbsp; &nbsp; &lt;PREFSGROUP uiname="Group 1"&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &lt;PREF uiname="Autoload What's Related" prefname="browser.related.autoload"
type="int" default="0" lockable="true" description="A good description of
this pref goes here."&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &lt;CHOICES&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &lt;CHOICE uiname="Always" value="0"/&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CHOICE uiname="After
First Use" value="1"/&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;CHOICE uiname="Never"
value="2"/&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &lt;/CHOICES&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;VALUE&gt;0&lt;/VALUE&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp; &nbsp; &nbsp; &lt;/PREF&gt;<br>
&nbsp;&nbsp; &nbsp; &nbsp;&lt;PREF uiname="Start Page" prefname="browser.startup.page"
type="int" lockable="true" default="0" description="Display this page when
Navigator starts up."&gt;<br>
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;CHOICES&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;CHOICE uiname="Blank Page"
value="0"/&gt;<br>
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;CHOICE uiname="Home Page"
value="1"/&gt;<br>
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &lt;CHOICE uiname="Last Page Visited"
value="2"/&gt;<br>
&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;/CHOICES&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;VALUE&gt;0&lt;/VALUE&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp; &nbsp; &nbsp; &lt;/PREF&gt;<br>
&nbsp; &nbsp; &lt;/PREFSGROUP&gt;<br>
&nbsp; &nbsp; &lt;PREFSGROUP uiname="Group 2"&gt;<br>
&nbsp; &nbsp; &nbsp; &lt;PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks"
type="bool" default="true" lockable="true" description="Show Booksmarks button
on browser toolbar."&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VALUE&gt;true&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/PREF&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;PREF uiname="Go" prefname="browser.toolbars.showbutton.go"
type="bool" default="true" lockable="true" description="Show Go button on
browser toolbar."&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VALUE&gt;true&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/PREF&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &lt;VALUE&gt;true&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/PREF&gt;<br>
&nbsp; &nbsp; &nbsp; &lt;PREF uiname="Go" prefname="browser.toolbars.showbutton.go"
type="bool" default="true" lockable="true" description="Show Go button on
browser toolbar."&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &lt;VALUE&gt;true&lt;/VALUE&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;LOCKED&gt;false&lt;/LOCKED&gt;<br>
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/PREF&gt;<br>
&nbsp; &nbsp; &lt;/PREFSGROUP&gt;<br>
&nbsp; &lt;/PREFSGROUP&gt;<br>
&lt;/PREFSGROUP&gt;<br>
<br>
</code>The above example also demonstrates how to include multiple choice
prefs. These make it easier for the CCK/Factory user to select pref values
without understanding how they are implemented. This XML file results in
the prefs tree structure in the example below.<br>
<br>
<img src="PrefsTreeEx2.jpg" alt="Example 2" width="638" height="493">
<br>
</code><code>&lt;METAPREFS&gt;</code><br>
<code> <br>
</code>The above example also demonstrates how to include multiple choice
prefs. These make it easier for the CCK/Factory user to select pref values
without understanding how they are implemented. This XML file results in
the prefs tree structure in the example below.<br>
<br>
<img src="PrefsTreeEx2.jpg" alt="Example 2" width="638" height="493">
<br>
<h2>Reference</h2>
The structure of the file is important. Not much work as been put into handling
malformed files. If the XML is invalid, you'll get an error that the file
failed to load, an error type, and a line number. If you create valid XML,
but don't follow the rules as defined here, the behaviour is undefined. It's
probably easiest to start with an existing prefs XML file, then cut, paste,
and edit the <tt>&lt;PREF&gt;</tt>s from there.<br>
<h3>&lt;PREFSGROUP&gt;</h3>
Each <tt>&lt;PREFSGROUP&gt;</tt> element will make a new level of hierarchy
in the tree control. A <tt>&lt;PREFSGROUP&gt;</tt> may contain <tt>&lt;PREF&gt;</tt>
s or other <tt>&lt;PREFSGROUP&gt;</tt> or both, but must not be empty. The
first element in the file must be a <tt>&lt;PREFSGROUP&gt;</tt>. These may
be nested arbitrarily deep.<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%" bgcolor="#ffffff">
<tbody>
The structure of the file is important. Not much work as been put into
handling malformed files. If the XML is invalid, you'll get an error that
the file failed to load, an error type, and a line number. If you create valid
XML, but don't follow the rules as defined here, the behaviour is undefined.
It's probably easiest to start with an existing prefs XML file, then cut,
paste, and edit the <tt>&lt;PREF&gt;</tt>s from there.<br>
<h3>&lt;METAPREFS&gt;</h3>
The entire prefs XML is surrounded by one of these tags. It contains a file
version.<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%"
bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top"><b>Attribute</b><br>
</td>
<td><b>Attribute</b><br>
</td>
<td valign="top"><b>Example</b><br>
</td>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top"><tt>clientversion</tt><br>
</td>
<td valign="top"><tt>clientversion="7.01b"</tt><br>
</td>
<td valign="top">This is the version of the client this file is for.
It indicates which version of the browser client the file can be used customize.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>uiname</tt><br>
<td valign="top"><tt>subversion</tt></td>
<td valign="top"><tt>subversion="0"</tt><br>
</td>
<td valign="top"><tt>uiname="Netscape Preferences"</tt><br>
</td>
<td valign="top">This is the name of the group as it appears in the
tree control. By convention, capitalize the words as if this were a title.<br>
<td valign="top">This is to keep track of minor revisions to the XML
within the version.<br>
</td>
</tr>
</tbody>
</table>
<br>
<h3>&lt;PREFSGROUP&gt;</h3>
Each <tt>&lt;PREFSGROUP&gt;</tt> element will make a new level of hierarchy
in the tree control. A <tt>&lt;PREFSGROUP&gt;</tt> may contain <tt>&lt;PREF&gt;</tt>
s or other <tt>&lt;PREFSGROUP&gt;</tt> or both, but must not be empty. The
first element in the file after the surrounding <tt>&lt;METAPREFS&gt;</tt>
tag must be a <tt>&lt;PREFSGROUP&gt;</tt>. These may be nested arbitrarily
deep.<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%"
bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top"><b>Attribute</b><br>
</td>
<td valign="top"><b>Example</b><br>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top"><tt>uiname</tt><br>
</td>
<td valign="top"><tt>uiname="Netscape Preferences"</tt><br>
</td>
<td valign="top">This is the name of the group as it appears in
the tree control. By convention, capitalize the words as if this were a
title.<br>
</td>
</tr>
</tbody>
</table>
<h3>&lt;PREF&gt;</h3>
Each pref element will make a leaf node in the tree control--a pref which
the user can edit.These elements must be contained in some <tt>&lt;PREFSGROUP&gt;</tt>
.<br>
<br>
<table width="100%" border="1" cellspacing="2" cellpadding="2" bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top"><b>Attribute</b><br>
</td>
<td valign="top"><b>Example</b><br>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top"><tt>uiname</tt><br>
</td>
<td valign="top"><code>uiname="Open Browser on Startup"</code><br>
</td>
<td valign="top">This is the name of the pref as is appears in the
tree control. It doesn't have to be the name of the pref--it should be something
easy for the user to understand. By convention, capitalize the words as if
Each pref element will make a leaf node in the tree control--a pref which
the user can edit.These elements must be contained in some <tt>&lt;PREFSGROUP&gt;</tt>
.<br>
<br>
<table width="100%" border="1" cellspacing="2" cellpadding="2"
bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top"><b>Attribute</b><br>
</td>
<td valign="top"><b>Example</b><br>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top"><tt>uiname</tt><br>
</td>
<td valign="top"><code>uiname="Open Browser on Startup"</code><br>
</td>
<td valign="top">This is the name of the pref as is appears in the
tree control. It doesn't have to be the name of the pref--it should be something
easy for the user to understand. By convention, capitalize the words as if
this were a title.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>prefname</tt><br>
</td>
<td valign="top"><code>prefname="general.startup.browser"</code></td>
<td valign="top">This is the real name of the pref as it is used by
the Netscape client products.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>type</tt><br>
</td>
<td valign="top"><code>type="bool"</code><br>
</td>
<td valign="top">Must be one of <b><tt>int</tt></b>, <b><tt>bool</tt></b>
, or <b><tt>string</tt></b>. This determines how the pref will be edited
</td>
</tr>
<tr>
<td valign="top"><tt>prefname</tt><br>
</td>
<td valign="top"><code>prefname="general.startup.browser"</code></td>
<td valign="top">This is the real name of the pref as it is used
by the Netscape client products.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>type</tt><br>
</td>
<td valign="top"><code>type="bool"</code><br>
</td>
<td valign="top">Must be one of <b><tt>int</tt></b>, <b><tt>bool</tt></b>
, or <b><tt>string</tt></b>. This determines how the pref will be edited
in the Pref Editor and how it is written to the prefs file in the install
image.<br>
<br>
<tt><b>bool</b> </tt>Pref Editor user allowed to select &#8220;true&#8221; or
&#8220;false&#8221; from a drop-down. No quotes are used when writing the pref in the
pref file. For example, <tt>pref("general.startup.browser", true);</tt><br>
<br>
<b><tt>int &nbsp;</tt></b>Pref Editor user allowed to enter integers.
No quotes are used when writing the pref in the pref file. For example, <tt>
pref("network.proxy.socks_version", 5);</tt><br>
<br>
<b><tt>string &nbsp;</tt></b>Pref Editor user may enter whatever he
likes. Quotes are used when writing the pref in the pref file. For example,
<tt>pref("general.useragent.vendorComment", "AK-MyISP");</tt><br>
</td>
</tr>
<tr>
<td valign="top"><tt>lockable</tt><br>
</td>
<td valign="top"><code>lockable="true"</code><br>
</td>
<td valign="top">Determines whether or not the Pref Editor user can
change the lock state the pref. This is included in case there are prefs
which, for technical reasons, don't work when locked or locking them does
not have the correct affect. If set to true, the Pref Editor should disable
the "Lock this pref" checkbox.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>description</tt><br>
</td>
<td valign="top"><code>description="When the application starts, open
a browser window."</code><br>
</td>
<td valign="top">This is some text which further describes the pref
to the Pref Editor user. It appears when the user selected the pref for editing.
Any text which helps the user under the pref should go here. There is space
<br>
<tt><b>bool</b> </tt>Pref Editor user allowed to select &#8220;true&#8221; or
&#8220;false&#8221; from a drop-down. No quotes are used when writing the pref in the
pref file. For example, <tt>pref("general.startup.browser", true);</tt><br>
<br>
<b><tt>int &nbsp;</tt></b>Pref Editor user allowed to enter integers.
No quotes are used when writing the pref in the pref file. For example,
<tt> pref("network.proxy.socks_version", 5);</tt><br>
<br>
<b><tt>string &nbsp;</tt></b>Pref Editor user may enter whatever
he likes. Quotes are used when writing the pref in the pref file. For example,
<tt>pref("general.useragent.vendorComment", "AK-MyISP");</tt><br>
</td>
</tr>
<tr>
<td valign="top"><tt>lockable</tt><br>
</td>
<td valign="top"><code>lockable="true"</code><br>
</td>
<td valign="top">Determines whether or not the Pref Editor user
can change the lock state the pref. This is included in case there are
prefs which, for technical reasons, don't work when locked or locking them
does not have the correct affect. If set to true, the Pref Editor should
disable the "Lock this pref" checkbox.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>description</tt><br>
</td>
<td valign="top"><code>description="When the application starts,
open a browser window."</code><br>
</td>
<td valign="top">This is some text which further describes the pref
to the Pref Editor user. It appears when the user selected the pref for editing.
Any text which helps the user under the pref should go here. There is space
in the editor for maybe 125 characters or so. Of course, you can edit the
dialog resource to hold more if this becomes a limitation. Use proper sentences.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>useradded</tt><br>
</td>
<td valign="top"><tt>useradded="true"</tt><br>
</td>
<td valign="top">This pref is added and set to true by the Pref Editor
for all new prefs added by the user via the UI. It is normally not present,
and is assumed to be false if missing. User added prefs are deletable via
the Pref Editor UI.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>default<br>
</tt></td>
<td valign="top"><tt>default="true"</tt><br>
</td>
<td valign="top">The Netscape default value for this pref. That is,
the value that the pref will get in set to in the code or in some default
.js file.<br>
</td>
</tr>
</tbody>
</td>
</tr>
<tr>
<td valign="top"><tt>useradded</tt><br>
</td>
<td valign="top"><tt>useradded="true"</tt><br>
</td>
<td valign="top">This pref is added and set to true by the Pref
Editor for all new prefs added by the user via the UI. It is normally not
present, and is assumed to be false if missing. User added prefs are deletable
via the Pref Editor UI.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>default<br>
</tt></td>
<td valign="top"><tt>default="true"</tt><br>
</td>
<td valign="top">The Netscape default value for this pref. That is,
the value that the pref will get in set to in the code or in some default
.js file.<br>
</td>
</tr>
</tbody>
</table>
<h3>&lt;CHOICES&gt;</h3>
This element can optionally appear in <tt>&lt;PREF&gt;</tt> element if
the values are to be translated into easy to understand multiple choice options.
It contains more than one <tt>&lt;CHOICE&gt;</tt> element. When the user
edits one of these prefs, he gets a list box from which he can select from
those choices described in the <tt>&lt;CHOICE&gt;</tt> elements which are
contained in the <tt>&lt;CHOICES&gt;</tt> element. It will work for any type,
but it is up to the person creating the XML to set the values in the <tt>
value </tt>attribute to the correct type for the enclosing <tt>&lt;PREF&gt;</tt>
. See <b>Example 2</b>, and <tt>&lt;CHOICE&gt;</tt>.<br>
<br>
The example below shows how a multiple choice pref will look like when
the user selects it for editing.<br>
<br>
<img src="PrefsTreeEx3.jpg" alt="Example 3" width="447" height="360">
<br>
This element can optionally appear in <tt>&lt;PREF&gt;</tt> element if
the values are to be translated into easy to understand multiple choice
options. It contains more than one <tt>&lt;CHOICE&gt;</tt> element. When
the user edits one of these prefs, he gets a list box from which he can
select from those choices described in the <tt>&lt;CHOICE&gt;</tt> elements
which are contained in the <tt>&lt;CHOICES&gt;</tt> element. It will work
for any type, but it is up to the person creating the XML to set the values
in the <tt> value </tt>attribute to the correct type for the enclosing <tt>&lt;PREF&gt;</tt>
. See <b>Example 2</b>, and <tt>&lt;CHOICE&gt;</tt>.<br>
<br>
The example below shows how a multiple choice pref will look like when
the user selects it for editing.<br>
<br>
<img src="PrefsTreeEx3.jpg" alt="Example 3" width="447" height="360">
<br>
<h3>&lt;CHOICE&gt;</h3>
This element appears in <tt>&lt;CHOICES&gt;</tt> elements to describe one
item of a multiple choice. Each <tt>&lt;CHOICE&gt;</tt> element in a <tt>
This element appears in <tt>&lt;CHOICES&gt;</tt> elements to describe
one item of a multiple choice. Each <tt>&lt;CHOICE&gt;</tt> element in a <tt>
&lt;CHOICES&gt;</tt> element for a <tt>&lt;PREF&gt;</tt> appears in a list
box when the user edits a pref of this type. When selected, the value of
the <tt>value </tt>attribute for the selected <tt>&lt;CHOICE&gt;</tt> is
saved as the pref's value. See <b>Example 2,</b> and <tt>&lt;CHOICES&gt;</tt>
.<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%" bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top"><b>Attribute</b><br>
</td>
<td valign="top"><b>Example</b><br>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top"><tt>uiname</tt><br>
</td>
<td valign="top"><code>uiname="Blank Page"</code><br>
</td>
<td valign="top">The text of this choice in the list box for this
choice.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>value</tt><br>
</td>
<td valign="top"><code>value="0"</code><br>
</td>
<td valign="top">The value saved in the <tt>&lt;VALUE&gt;</tt> element
for the <tt>&lt;PREF&gt;</tt> when the pref is edit and this choice is selected
in the list box. The type of the value must be correct for the enclosing
.<br>
<br>
<table cellpadding="2" cellspacing="2" border="1" width="100%"
bgcolor="#ffffff">
<tbody>
<tr>
<td valign="top"><b>Attribute</b><br>
</td>
<td valign="top"><b>Example</b><br>
</td>
<td valign="top"><b>Description</b><br>
</td>
</tr>
<tr>
<td valign="top"><tt>uiname</tt><br>
</td>
<td valign="top"><code>uiname="Blank Page"</code><br>
</td>
<td valign="top">The text of this choice in the list box for this
choice.<br>
</td>
</tr>
<tr>
<td valign="top"><tt>value</tt><br>
</td>
<td valign="top"><code>value="0"</code><br>
</td>
<td valign="top">The value saved in the <tt>&lt;VALUE&gt;</tt> element
for the <tt>&lt;PREF&gt;</tt> when the pref is edit and this choice is selected
in the list box. The type of the value must be correct for the enclosing
<tt>&lt;PREF&gt;</tt> element.<br>
</td>
</tr>
</tbody>
</td>
</tr>
</tbody>
</table>
<h3>&lt;VALUE&gt;</h3>
One and only one must appear in a <tt>&lt;PREF&gt;</tt> element. This is
the value of the pref. No quotes, regardless of type. This gets modified
One and only one must appear in a <tt>&lt;PREF&gt;</tt> element. This
is the value of the pref. No quotes, regardless of type. This gets modified
when the user edits the pref. Note that the modified file is saved to the
working config directory.<br>
<h3>&lt;LOCKED&gt;</h3>
One and only one must appear in a <tt>&lt;PREF&gt;</tt> element. This is
<tt>true </tt>or <tt>false, </tt>depending on whether the pref is locked
One and only one must appear in a <tt>&lt;PREF&gt;</tt> element. This
is <tt>true </tt>or <tt>false, </tt>depending on whether the pref is locked
or not. If locked, prefs are written as <tt>lockPref()</tt> instead of <tt>
pref()</tt>. See also <tt>&lt;PREF lockable="true"&gt;</tt>.<br>
<h3>&lt;REMOTEADMIN&gt;</h3>
This pref is added by the pref editor, and is normally absent in a prefs
XML file until it has been processed by the prefs editor. If the <tt>&lt;REMOTEADMIN&gt;</tt>
tag is present, and its value is true, then this pref will be written to
the autoconfig.jsc prefs file when the XML is processed by the install builder
app.<br>
This pref is added by the pref editor, and is normally absent in a prefs
XML file until it has been processed by the prefs editor. If the <tt>&lt;REMOTEADMIN&gt;</tt>
tag is present, and its value is true, then this pref will be written
to the autoconfig.jsc prefs file when the XML is processed by the install
builder app.<br>
<br>
<br>
</body>
</html>

View File

@ -261,6 +261,25 @@ void CPrefEditView::startElement(const char *name, const char **atts)
m_pParsingPrefElement = new CPrefElement;
}
else if (stricmp(name, "METAPREFS") == 0)
{
ASSERT(atts[2]); // there must be a clientversion and subversion attribute
// Process the list of attribute/value pairs.
int i = 0;
while(atts[i])
{
const char* attrName = atts[i++];
const char* attrVal = atts[i++];
if (stricmp(attrName, "clientversion") == 0)
m_strXMLVersion = attrVal;
else if (stricmp(attrName, "subversion") == 0)
m_strXMLSubVersion = attrVal;
}
}
// Pass on all subelements to the pref element object to handle.
if (m_pParsingPrefElement)
m_pParsingPrefElement->startElement(name, atts);
@ -554,10 +573,20 @@ BOOL CPrefEditView::DoSavePrefsTree(CString strFile)
return FALSE;
}
// start the outermost tag
CString strOuter;
strOuter.Format("<METAPREFS clientversion=\"%s\" subversion=\"%s\">\n\n", m_strXMLVersion, m_strXMLSubVersion);
fwrite(strOuter, strOuter.GetLength(), 1, fp);
CTreeCtrl &treeCtrl = GetTreeCtrl();
HTREEITEM hRoot = treeCtrl.GetRootItem();
WriteXMLItem(fp, 1, hRoot);
// close the outermost tag
strOuter = "</METAPREFS>";
fwrite(strOuter, strOuter.GetLength(), 1, fp);
fclose(fp);
return TRUE;
}

View File

@ -78,6 +78,8 @@ protected:
private:
CImageList m_imageList; // padlocks to show which prefs are locked
CString m_strXMLFile; // the XML file used to load the m_pPrefXMLTree, and hence the tree control
CString m_strXMLVersion; // the client version for the XML file
CString m_strXMLSubVersion; // minor version inside the XML file
// Stuff for Find and FindNext.
HTREEITEM m_hNextFind;