зеркало из https://github.com/mozilla/pjs.git
Added Remote Admin function.
This commit is contained in:
Родитель
57d7914b4c
Коммит
b3bb255a0f
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<PREFSGROUP uiname="Netscape Preferences">
|
||||
<PREF uiname="Open Browser on Startup" prefname="general.startup.browser" type="bool" lockable="true" description="When the application starts, open a browser window.">
|
||||
<VALUE>true</VALUE>
|
||||
<LOCKED>false</LOCKED>
|
||||
</PREF>
|
||||
</PREFSGROUP>
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0"?>
|
||||
<PREFSGROUP uiname="Netscape Preferences">
|
||||
<PREFSGROUP uiname="Group 1">
|
||||
<PREF uiname="Autoload What's Related" prefname="browser.related.autoload" type="int" 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" 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" 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" lockable="true" description="Show Go button on browser toolbar.">
|
||||
<VALUE>true</VALUE>
|
||||
<LOCKED>false</LOCKED>
|
||||
</PREF>
|
||||
</PREFSGROUP>
|
||||
</PREFSGROUP>
|
|
@ -0,0 +1,142 @@
|
|||
<!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> 02 Jan 2002<br>
|
||||
Original <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 <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>
|
||||
<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>
|
||||
<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>
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 26 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 28 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 17 KiB |
|
@ -0,0 +1,240 @@
|
|||
<!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>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 elements <tt>INSTALLATIONFILE </tt>and <tt>PREFFILE.</tt> Changed <tt>processPrefsTree()</tt> number of params. 02 Jan 2002<br>
|
||||
Removed <tt>choose </tt>attribute. <strike>13 Dec 2001</strike><br>
|
||||
Original version. <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 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 user, and is used
|
||||
by the install builder to write preferences in the install image. A SCRIPT.IB
|
||||
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 <a href="PrefsTree.htm">PrefsTree.htm</a>
|
||||
|
||||
<h2>Who This Document is For</h2>
|
||||
<h2></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>
|
||||
<h2>Conventions</h2>
|
||||
For XML item tags, we use ALL CAPS. For attribute names, we use lower case.
|
||||
“true” and “false” 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><CHOICES></tt>, which are difficult to represent as attributes, so these are elements.<br>
|
||||
<h2>General Structure</h2>
|
||||
<h3>Example 1</h3>
|
||||
The simplest file that may exist consists of one group containing one pref. <br>
|
||||
<br>
|
||||
<code><?xml version="1.0"?><br>
|
||||
<PREFSGROUP uiname="Netscape Preferences"><br>
|
||||
<PREF uiname="Open Browser on Startup" prefname="general.startup.browser"
|
||||
type="bool" lockable="true" description="When the application starts, open
|
||||
a browser window."><br>
|
||||
<VALUE>true</VALUE><br>
|
||||
<LOCKED>false</LOCKED><br> </PREF><br>
|
||||
</PREFSGROUP></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">
|
||||
|
||||
<h3>Example 2</h3>
|
||||
The more complicated example below shows the top level group, with two sub groups, each with two preferences.<br>
|
||||
<br>
|
||||
<code><?xml version="1.0"?><br>
|
||||
|
||||
<PREFSGROUP uiname="Netscape Preferences"><br>
|
||||
<PREFSGROUP uiname="Group 1"><br>
|
||||
<PREF uiname="Autoload What's Related" prefname="browser.related.autoload"
|
||||
type="int" lockable="true" description="A good description
|
||||
of this pref goes here."><br>
|
||||
<CHOICES><br>
|
||||
<CHOICE uiname="Always" value="0"/><br>
|
||||
<CHOICE uiname="After First Use" value="1"/><br>
|
||||
<CHOICE uiname="Never" value="2"/><br>
|
||||
</CHOICES><br>
|
||||
<VALUE>0</VALUE><br>
|
||||
<LOCKED>false</LOCKED><br> </PREF><br>
|
||||
<PREF uiname="Start Page" prefname="browser.startup.page"
|
||||
type="int" lockable="true" description="Display this page when
|
||||
Navigator starts up."><br>
|
||||
<CHOICES><br>
|
||||
<CHOICE uiname="Blank Page" value="0"/><br>
|
||||
<CHOICE uiname="Home Page" value="1"/><br>
|
||||
<CHOICE uiname="Last Page Visited" value="2"/><br>
|
||||
</CHOICES><br>
|
||||
<VALUE>0</VALUE><br>
|
||||
<LOCKED>false</LOCKED><br> </PREF><br>
|
||||
</PREFSGROUP><br>
|
||||
<PREFSGROUP uiname="Group 2"><br>
|
||||
<PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks"
|
||||
type="bool" lockable="true" description="Show Booksmarks button on browser
|
||||
toolbar."><br>
|
||||
<VALUE>true</VALUE><br>
|
||||
<LOCKED>false</LOCKED><br> </PREF><br>
|
||||
<PREF uiname="Go" prefname="browser.toolbars.showbutton.go"
|
||||
type="bool" lockable="true" description="Show Go button on browser toolbar."><br>
|
||||
<VALUE>true</VALUE><br>
|
||||
<LOCKED>false</LOCKED><br> </PREF><br>
|
||||
</PREFSGROUP><br>
|
||||
</PREFSGROUP><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>
|
||||
<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><PREF></tt>s from there.<br>
|
||||
|
||||
<h3><PREFSGROUP></h3>
|
||||
Each <tt><PREFSGROUP></tt> element will make a new level of hierarchy in the tree control. A <tt><PREFSGROUP></tt> may contain <tt><PREF></tt>s or other <tt><PREFSGROUP></tt> or both, but must not be empty. The first element in the file must be a <tt><PREFSGROUP></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. <br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><PREF></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><PREFSGROUP></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.<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 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 “true” or “false”
|
||||
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 </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 </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.<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.<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><CHOICES></h3>
|
||||
This element can optionally appear in <tt><PREF></tt> element if the values are to be translated into easy to understand multiple choice options. It contains more than one <tt><CHOICE></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><CHOICE></tt> elements which are contained in the <tt><CHOICES></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><PREF></tt>. See <b>Example 2</b>, and <tt><CHOICE></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><CHOICE></h3>
|
||||
This element appears in <tt><CHOICES></tt> elements to describe one item of a multiple choice. Each <tt><CHOICE></tt> element in a <tt><CHOICES></tt> element for a <tt><PREF></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><CHOICE></tt> is saved as the pref's value. See <b>Example 2,</b> and <tt><CHOICES></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><VALUE></tt> element for the <tt><PREF></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><PREF></tt> element.<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3><VALUE></h3>One and only one must appear in a <tt><PREF></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><LOCKED></h3>One and only one must appear in a <tt><PREF></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><PREF lockable="true"></tt>.<br>
|
||||
<br>
|
||||
</body></html>
|
|
@ -824,6 +824,18 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
}
|
||||
|
||||
}
|
||||
else if (strcmp(pcmd, "ValidateRemoteAdmin") == 0)
|
||||
{
|
||||
// if checkbox is set, then there must be a URL.
|
||||
CString useRemoteAdmin = GetGlobal("RemoteAdmin");
|
||||
CString remoteAdminURL = GetGlobal("RemoteAdminURL");
|
||||
|
||||
if ((useRemoteAdmin == "1") && (remoteAdminURL.IsEmpty()))
|
||||
{
|
||||
AfxMessageBox("Specify the remote admin URL. This is where the browser will retrieve 'autoconfig.jsc'.", MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (strcmp(pcmd, "CopyFile") == 0)
|
||||
{
|
||||
// VerifySet checks to see if the first parameter has any value
|
||||
|
|
166
cck/ib/ib.cpp
166
cck/ib/ib.cpp
|
@ -367,7 +367,7 @@ void AddPref(CString xpifile, CString entity, CString newvalue, BOOL bUseQuotes,
|
|||
}
|
||||
|
||||
CString Quote = bUseQuotes? quotes : "";
|
||||
CString FuncName = bLockPref? "lockpref(" : "pref(";
|
||||
CString FuncName = bLockPref? "lock_pref(" : "pref(";
|
||||
tf<< FuncName << entity << ", " << Quote << newvalue << Quote << ");\n";
|
||||
|
||||
pf.close();
|
||||
|
@ -667,7 +667,7 @@ int ModifyHashedPref(CString HashedPrefsFile, CString PrefName, CString NewPrefV
|
|||
else
|
||||
{
|
||||
// Create a plain text prefs with only a comment.
|
||||
CreateNewFile(PlainTextPrefsFile, "/* protected prefs */\n");
|
||||
CreateNewFile(PlainTextPrefsFile, "/* prefs configured in NADK */\n");
|
||||
}
|
||||
|
||||
// Modify the pref.
|
||||
|
@ -686,8 +686,10 @@ int ModifyHashedPref(CString HashedPrefsFile, CString PrefName, CString NewPrefV
|
|||
}
|
||||
else if (PrefType.CompareNoCase("bool") == 0)
|
||||
{
|
||||
if (NewPrefValue.IsEmpty())
|
||||
NewPrefValue = "FALSE";
|
||||
if (NewPrefValue.IsEmpty() || NewPrefValue == "0" || (NewPrefValue.CompareNoCase("false") == 0))
|
||||
NewPrefValue = "false";
|
||||
else
|
||||
NewPrefValue = "true";
|
||||
|
||||
if (!ModifyJS2(PlainTextPrefsFile, PrefName, NewPrefValue, bLockPref))
|
||||
return FALSE;
|
||||
|
@ -759,6 +761,38 @@ void endElement(void *userData, const char *name)
|
|||
}
|
||||
|
||||
|
||||
// Converts the strPrefFile (netscp6.cfg) to a plain text file (autoconfig.jsc) in the output directory, then sets the
|
||||
// autoadmin.global_config_url in strPrefFile to strURL.
|
||||
BOOL ConvertToRemoteAdmin(CString strURL, CString strPrefFile, CString strRemoteAdminFile)
|
||||
{
|
||||
ASSERT(!strURL.IsEmpty() && !strPrefFile.IsEmpty() && !strRemoteAdminFile.IsEmpty());
|
||||
if (strURL.IsEmpty() || strPrefFile.IsEmpty() || strRemoteAdminFile.IsEmpty())
|
||||
return FALSE;
|
||||
|
||||
ASSERT(strPrefFile.Find(".cfg") > 0);
|
||||
if (strPrefFile.Find(".cfg") <= 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
// Convert the strPrefFile to plain text remote admin file.
|
||||
CString strPlainTextFile = outputPath + "\\" + strRemoteAdminFile;
|
||||
|
||||
if (!UnHash(strPrefFile, strPlainTextFile))
|
||||
return FALSE;
|
||||
|
||||
// Delete the original pref file and replace it with a file with only remote admin entries.
|
||||
DeleteFile(strPrefFile);
|
||||
ModifyHashedPref(strPrefFile, "autoadmin.global_config_url", strURL, "string", TRUE);
|
||||
|
||||
CString strAppendEmail = GetGlobal("RemoteAdminAppendEmail");
|
||||
ModifyHashedPref(strPrefFile, "autoadmin.append_emailaddr", strAppendEmail, "bool", TRUE);
|
||||
|
||||
CString strFailover = GetGlobal("RemoteAdminFailover");
|
||||
ModifyHashedPref(strPrefFile, "autoadmin.offline_failover", strFailover, "bool", TRUE);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// This function can easily be rewriten to parse the XML file by hand if it
|
||||
// needs to be ported to a non-MS OS. The XML is pretty simple.
|
||||
|
@ -804,7 +838,7 @@ BOOL ProcessPrefsTree(CString strPrefsTreeFile, CString strPrefFile, CString str
|
|||
// copy the file into the buffer.
|
||||
size_t len = fread(buffer,1,lSize,pFile);
|
||||
|
||||
/*** the whole file is loaded in the buffer. ***/
|
||||
// the whole file is loaded in the buffer.
|
||||
|
||||
int done = 0;
|
||||
if (!XML_Parse(parser, buffer, len, done))
|
||||
|
@ -818,87 +852,8 @@ BOOL ProcessPrefsTree(CString strPrefsTreeFile, CString strPrefFile, CString str
|
|||
}
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* //SCM
|
||||
// Create XML DOM instance.
|
||||
IXMLDOMDocumentPtr prefXMLTree;
|
||||
HRESULT hr = prefXMLTree.CreateInstance(__uuidof(DOMDocument));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AfxMessageBox("Error creating MS XML DOM.", MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Load the prefs metadata. This is a representation of the prefs tree as
|
||||
// it should appear in the tree control.
|
||||
if (prefXMLTree)
|
||||
{
|
||||
CString strPrefsFileURL;
|
||||
strPrefsFileURL.Format("FILE://%s", strPrefsTreeFile);
|
||||
|
||||
if (!prefXMLTree->load(strPrefsFileURL.GetBuffer(0)))
|
||||
{
|
||||
CString strError;
|
||||
strError.Format("Error loading preferences metadata %s.", strPrefsFileURL);
|
||||
AfxMessageBox(strError, MB_OK);
|
||||
prefXMLTree = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
if (prefXMLTree->parseError->errorCode != 0)
|
||||
{
|
||||
CString strError;
|
||||
strError.Format("Bad XML in %s.", strPrefsFileURL);
|
||||
AfxMessageBox(strError, MB_OK);
|
||||
prefXMLTree = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Go through the list of prefs in the xml and write to prefs file for each one.
|
||||
IXMLDOMNodeListPtr prefsList = prefXMLTree->getElementsByTagName("PREF");
|
||||
for(int i = 0; i < prefsList->length; i++)
|
||||
{
|
||||
IXMLDOMElementPtr element = prefsList->Getitem(i);
|
||||
|
||||
CString strPrefName = GetAttribute(element, "prefname");
|
||||
CString strPrefType = GetAttribute(element, "type");
|
||||
CString strPrefValue = GetElementValue(element, "VALUE");
|
||||
CString strLocked = GetElementValue(element, "LOCKED");
|
||||
CString strInstallFile = GetElementValue(element, "INSTALLATIONFILE");
|
||||
CString strPrefFile = GetElementValue(element, "PREFFILE");
|
||||
|
||||
if (strPrefName.IsEmpty() ||
|
||||
strPrefType.IsEmpty() ||
|
||||
strInstallFile.IsEmpty() ||
|
||||
strPrefFile.IsEmpty() )
|
||||
continue;
|
||||
|
||||
ExtractXPIFile(strInstallFile, strPrefFile);
|
||||
|
||||
BOOL bLocked = (strLocked == "true");
|
||||
|
||||
// Should go into a hashed file if prefs file is .cfg.
|
||||
if (strPrefFile.Find(".cfg") > 0)
|
||||
{
|
||||
// hashed
|
||||
ModifyHashedPref(strPrefFile, strPrefName, strPrefValue, strPrefType, bLocked);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// not hashed
|
||||
if ((strPrefType == "int") || (strPrefType == "bool") || (strPrefType == "choose"))
|
||||
ModifyJS2(strPrefFile, strPrefName, strPrefValue, bLocked);
|
||||
|
||||
else // string
|
||||
ModifyJS(strPrefFile, strPrefName, strPrefValue, bLocked);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
free(buffer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1112,6 +1067,45 @@ int interpret(char *cmd)
|
|||
char *prefFile = strtok(NULL, ",)");
|
||||
CString fileWithPath = configPath + "\\" + prefsTreeFile;
|
||||
ProcessPrefsTree(fileWithPath, prefFile, installFile);
|
||||
}
|
||||
else if (strcmp(cmdname, "convertToRemoteAdmin") == 0)
|
||||
{
|
||||
char *vConvert = strtok(NULL, ",)"); // if set, then do the convert to remote admin
|
||||
if (vConvert[0] == '%')
|
||||
{
|
||||
vConvert++;
|
||||
char *t = strchr(vConvert, '%');
|
||||
if (!t)
|
||||
return TRUE;
|
||||
*t = '\0';
|
||||
char *bConvert = (char *)(LPCTSTR) GetGlobal(vConvert);
|
||||
|
||||
// The convert checkbox was not checked. No need to continue.
|
||||
if (strcmp(bConvert, "1") != 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *url = strtok(NULL, ",)");
|
||||
if (url[0] == '%')
|
||||
{
|
||||
url++;
|
||||
char *t = strchr(url, '%');
|
||||
if (!t)
|
||||
return TRUE;
|
||||
*t = '\0';
|
||||
url = (char *)(LPCTSTR) GetGlobal(url);
|
||||
if (!url)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *prefFile = strtok(NULL, ",)");
|
||||
char *remoteAdminFile = strtok(NULL, ",)");
|
||||
|
||||
if (!prefFile || !remoteAdminFile)
|
||||
return TRUE;
|
||||
|
||||
ConvertToRemoteAdmin(url, prefFile, remoteAdminFile);
|
||||
|
||||
}
|
||||
else
|
||||
return FALSE;//*** We have to handle this condition better.
|
||||
|
|
|
@ -28,7 +28,7 @@ CPrefElement::CPrefElement()
|
|||
}
|
||||
|
||||
CPrefElement::CPrefElement(CString strPrefName, CString strPrefDesc, CString strPrefType)
|
||||
: m_bPrefOpen(FALSE), m_iChoices(0), m_strPrefName(strPrefName), m_strDescription(strPrefDesc), m_strType(strPrefType)
|
||||
: m_bPrefOpen(FALSE), m_iChoices(0), m_strPrefName(strPrefName), m_strUIName(strPrefName), m_strDescription(strPrefDesc), m_strType(strPrefType)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче