Beginning of UI rewrite - convert UI to XBL to allow for listboxes for entering stuff

This commit is contained in:
mkaply%us.ibm.com 2006-03-30 22:30:07 +00:00
parent 3d7b664959
commit 59e62db11c
11 changed files with 538 additions and 314 deletions

View File

@ -8,8 +8,12 @@ cckwizard.jar:
content/cckwizard/config.xul (resources/content/cckwizard/config.xul)
content/cckwizard/pref.xul (resources/content/cckwizard/pref.xul)
content/cckwizard/reg.xul (resources/content/cckwizard/reg.xul)
content/cckwizard/searchplugin.xul (resources/content/cckwizard/searchplugin.xul)
content/cckwizard/searchengine.xul (resources/content/cckwizard/searchengine.xul)
content/cckwizard/plugin.xul (resources/content/cckwizard/plugin.xul)
content/cckwizard/bookmark.xul (resources/content/cckwizard/bookmark.xul)
content/cckwizard/showconfig.xul (resources/content/cckwizard/showconfig.xul)
content/cckwizard/ccklist.css (resources/content/cckwizard/ccklist.css)
content/cckwizard/ccklist.xml (resources/content/cckwizard/ccklist.xml)
content/cckwizard/srcfiles/cck-browser-overlay.xul.in (resources/content/cckwizard/srcfiles/cck-browser-overlay.xul.in)
content/cckwizard/srcfiles/cck.dtd.in (resources/content/cckwizard/srcfiles/cck.dtd.in)
content/cckwizard/srcfiles/cck.js.in (resources/content/cckwizard/srcfiles/cck.js.in)

View File

@ -5,7 +5,7 @@
<!ENTITY beforeYouBegin.description "Decide which customizations you want to make and create/collect the customized files, such as:
<html:ul>
<html:li>Custom animation files for browser's animated logo</html:li>
<html:li>Search plugins</html:li>
<html:li>Search engines (SRC files and the corresponding images)</html:li>
<html:li>Browser plug-ins</html:li>
</html:ul>">
@ -93,13 +93,20 @@
<!ENTITY installAllowedSites.label "Install Allowed Sites:">
<!ENTITY customizeBrowserPlugins.label "Customize Browser Plug-ins">
<!ENTITY browserPlugins.description "You may select up to five browser plug-ins to be preinstalled.">
<!ENTITY browserPlugins.description "Use the buttons below to add browser plug-ins.">
<!ENTITY plugins.label "Browser Plug-ins">
<!ENTITY plugins.description "Please select a browser plug-
in and the platform it is written for.">
<!ENTITY customizeSearchEngines.label "Customize Search Engines">
<!ENTITY searchEngines.description "Use the buttons below to add search engines.">
<!ENTITY engines.label "Search Engines">
<!ENTITY engines.description "Please select a .src file and the corresponding image.">
<!ENTITY customizeSearchPlugins.label "Customize Search Plugins">
<!ENTITY searchPlugins.description "Use the buttons below to add search plugins.">
<!ENTITY engine.label "SRC File">
<!ENTITY engineIcon.label "Image File:">
<!ENTITY file.label "File:">
<!ENTITY icon.label "Icon:">
@ -126,6 +133,7 @@
<!ENTITY bookmark.label "Bookmark">
<!ENTITY bookmark.description "Enter a Bookmark">
<!ENTITY bookmarkTitle.label "Title:">
<!ENTITY bookmarkURL.label "URL:">

View File

@ -0,0 +1,61 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
#if 0
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Client Customization Kit (CCK).
-
- The Initial Developer of the Original Code is IBM Corp.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
#endif
- ***** END LICENSE BLOCK ***** -->
<!DOCTYPE prefwindow SYSTEM "chrome://cckwizard/locale/cckWizard.dtd">
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<dialog id="createbookmark" title="&bookmark.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
ondialogaccept="return OnBookmarkOK()"
onload="OnBookmarkLoad();"
width="500"
height="200"
>
<script src="chrome://cckwizard/content/cckwizard.js"/>
<vbox>
<label>&bookmark.description;</label>
<label>&bookmarkTitle.label;</label>
<textbox flex="1" id="bookmarkname" onchange="bookmarkCheckOKButton();" onkeyup="bookmarkCheckOKButton();"/>
<label>&bookmarkURL.label;</label>
<textbox flex="1" id="bookmarkurl" onchange="bookmarkCheckOKButton();" onkeyup="bookmarkCheckOKButton();"/>
</vbox>
</dialog>

View File

@ -0,0 +1,4 @@
box.ccklist {
-moz-binding: url('chrome://cckwizard/content/ccklist.xml#ccklist');
}

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<!DOCTYPE wizard SYSTEM "chrome://cckwizard/locale/cckWizard.dtd">
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="ccklist">
<content>
<xul:hbox flex="1">
<xul:vbox flex="1">
<xul:listbox flex="1">
</xul:listbox>
</xul:vbox>
<xul:vbox>
<xul:button label="&newButton.label;" accesskey="&newButton.accesskey;" type="new"/>
<xul:button label="&editButton.label;" accesskey="&editButton.accesskey;" type="edit"/>
<xul:button label="&deleteButton.label;" accesskey="&deleteButton.accesskey;" type="delete"/>
<xul:spacer flex="1"/>
</xul:vbox>
</xul:hbox>
</content>
<implementation>
<constructor>
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("disabled","true");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","true");
</constructor>
<method name="clear">
<body>
<![CDATA[
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
while(listbox.getRowCount() != 0) {
listbox.removeItemAt(0);
}
]]>
</body>
</method>
<method name="getRowCount">
<body>
<![CDATA[
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
return listbox.getRowCount();
]]>
</body>
</method>
<method name="getItemAtIndex">
<parameter name="index"/>
<body>
<![CDATA[
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
return listbox.getItemAtIndex(index);
]]>
</body>
</method>
<method name="appendItem">
<parameter name="label"/>
<parameter name="value"/>
<body>
<![CDATA[
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
return listbox.appendItem(label, value);
]]>
</body>
</method>
<property name="selectedItem"
onget="return document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0].selectedItem;"
onset="document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0].selectedItem = val;"/>
</implementation>
<handlers>
<handler event="select">
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("disabled","false");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","false");
</handler>
<handler event="dblclick">
if (event.originalTarget.tagName == "richlistitem")
eval(this.getAttribute("edit"));
</handler>
<handler event="command">
if (event.originalTarget.type == "delete") {
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
listbox.removeItemAt(listbox.selectedIndex);
return;
}
eval(this.getAttribute(event.originalTarget.type));
</handler>
</handlers>
</binding>
</bindings>

View File

@ -4,7 +4,7 @@
<menupopup id="menu_ToolsPopup">
<menuitem label="CCK Wizard" insertafter="devToolsSeparator"
oncommand="window.openDialog('chrome://cckwizard/content/cckwizard.xul','cckwizard','chrome');"
oncommand="window.openDialog('chrome://cckwizard/content/cckwizard.xul','cckwizard','chrome,centerscreen');"
onclick="checkForMiddleClick(this, event);"/>
</menupopup>
</overlay>

View File

@ -35,8 +35,6 @@
var currentconfigname;
var currentconfigpath;
var haveplugins = false;
var havesearchplugins = false;
var configarray = new Array();
var gPrefBranch = Components.classes["@mozilla.org/preferences-service;1"]
@ -122,13 +120,13 @@ function initimage(labelname, imagename)
function CreateConfig()
{
window.openDialog("chrome://cckwizard/content/config.xul","createconfig","chrome,modal");
window.openDialog("chrome://cckwizard/content/config.xul","createconfig","chrome,centerscreen,modal");
updateconfiglist();
}
function CopyConfig()
{
window.openDialog("chrome://cckwizard/content/config.xul","copyconfig","chrome,modal");
window.openDialog("chrome://cckwizard/content/config.xul","copyconfig","chrome,centerscreen,modal");
updateconfiglist();
}
@ -170,6 +168,7 @@ function OpenCCKWizard()
function ShowMain()
{
document.getElementById('example-window').canRewind = false;
updateconfiglist();
}
@ -246,6 +245,8 @@ function saveconfig()
function CloseCCKWizard()
{
if (document.getElementById('example-window').pageIndex == 0)
return;
var saveOnExit;
try {
saveOnExit = gPrefBranch.getBoolPref("cck.save_on_exit");
@ -295,25 +296,19 @@ function ClearAll()
elements[i].checked = false;
} else if (elements[i].id == "prefList") {
listbox = this.opener.document.getElementById('prefList');
var children = listbox.childNodes;
for (var j = children.length; j > 0; j--)
{
listbox.removeChild(children[j-1]);
}
listbox.clear();
} else if (elements[i].id == "browserPluginList") {
listbox = this.opener.document.getElementById('browserPluginList');
listbox.clear();
} else if (elements[i].id == "tbFolder.bookmarkList") {
listbox = this.opener.document.getElementById('tbFolder.bookmarkList');
listbox.clear();
} else if (elements[i].id == "regList") {
listbox = this.opener.document.getElementById('regList');
var children = listbox.childNodes;
for (var j = children.length; j > 0; j--)
{
listbox.removeChild(children[j-1]);
}
} else if (elements[i].id == "searchPluginList") {
listbox = this.opener.document.getElementById('searchPluginList');
var children = listbox.childNodes;
for (var j = children.length; j > 0; j--)
{
listbox.removeChild(children[j-1]);
}
listbox = this.opener.document.getElementById('regList');
listbox.clear();
} else if (elements[i].id == "searchEngineList") {
listbox = this.opener.document.getElementById('searchEngineList');
listbox.clear();
}
}
}
@ -346,17 +341,12 @@ function configCheckOKButton()
function onNewPreference()
{
window.openDialog("chrome://cckwizard/content/pref.xul","newpref","chrome,modal");
window.openDialog("chrome://cckwizard/content/pref.xul","newpref","chrome,centerscreen,modal");
}
function onEditPreference()
{
window.openDialog("chrome://cckwizard/content/pref.xul","editpref","chrome,modal");
}
function onDeletePreference()
{
listbox = document.getElementById('prefList');
listbox.removeItemAt(listbox.selectedIndex);
window.openDialog("chrome://cckwizard/content/pref.xul","editpref","chrome,centerscreen,modal");
}
function OnPrefLoad()
@ -390,31 +380,116 @@ function OnPrefOK()
}
}
function enablePrefButtons() {
listbox = document.getElementById('prefList');
if (listbox.selectedItem) {
document.getElementById('editPrefButton').disabled = false;
document.getElementById('deletePrefButton').disabled = false;
} else {
document.getElementById('editPrefButton').disabled = true;
document.getElementById('deletePrefButton').disabled = true;
}
function getPageId()
{
temp = document.getElementById('example-window');
if (!temp)
temp = this.opener.document.getElementById('example-window');
return temp.currentPage.id;
}
function onNewBookmark()
{
window.openDialog("chrome://cckwizard/content/bookmark.xul","newbookmark","chrome,centerscreen,modal");
}
function onEditBookmark()
{
window.openDialog("chrome://cckwizard/content/bookmark.xul","editbookmark","chrome,centerscreen,modal");
}
function OnBookmarkLoad()
{
listbox = this.opener.document.getElementById(getPageId() +'.bookmarkList');
if (window.name == 'editbookmark') {
document.getElementById('bookmarkname').value = listbox.selectedItem.label;
document.getElementById('bookmarkurl').value = listbox.selectedItem.value;
}
bookmarkCheckOKButton();
}
function bookmarkCheckOKButton()
{
if ((document.getElementById("bookmarkname").value) && (document.getElementById("bookmarkurl").value)) {
document.documentElement.getButton("accept").setAttribute( "disabled", "false" );
} else {
document.documentElement.getButton("accept").setAttribute( "disabled", "true" );
}
}
function OnBookmarkOK()
{
listbox = this.opener.document.getElementById(getPageId() +'.bookmarkList');
if (window.name == 'newbookmark') {
listbox.appendItem(document.getElementById('bookmarkname').value, document.getElementById('bookmarkurl').value);
} else {
listbox.selectedItem.label = document.getElementById('bookmarkname').value;
listbox.selectedItem.value = document.getElementById('bookmarkurl').value;
}
}
function enableBookmarkButtons() {
listbox = document.getElementById(getPageId() +'.bookmarkList');
if (listbox.selectedItem) {
document.getElementById(getPageId() +'editBookmarkButton').disabled = false;
document.getElementById(getPageId() +'deleteBookmarkButton').disabled = false;
} else {
document.getElementById(getPageId() +'editBookmarkButton').disabled = true;
document.getElementById(getPageId() +'deleteBookmarkButton').disabled = true;
}
}
function onNewBrowserPlugin()
{
window.openDialog("chrome://cckwizard/content/plugin.xul","newplugin","chrome,centerscreen,modal");
}
function onEditBrowserPlugin()
{
window.openDialog("chrome://cckwizard/content/plugin.xul","editplugin","chrome,centerscreen,modal");
}
function OnPluginLoad()
{
listbox = this.opener.document.getElementById('browserPluginList');
if (window.name == 'editplugin') {
document.getElementById('pluginpath').value = listbox.selectedItem.label;
document.getElementById('plugintype').value = listbox.selectedItem.value;
}
pluginCheckOKButton();
}
function pluginCheckOKButton()
{
// if (document.getElementById("pluginpath").value) {
document.documentElement.getButton("accept").setAttribute( "disabled", "false" );
// } else {
// document.documentElement.getButton("accept").setAttribute( "disabled", "true" );
// }
}
function OnBrowserPluginOK()
{
listbox = this.opener.document.getElementById('browserPluginList');
if (window.name == 'newplugin') {
listitem = listbox.appendItem(document.getElementById('pluginpath').value, document.getElementById('plugintype').value);
} else {
listbox.selectedItem.label = document.getElementById('pluginpath').value;
listbox.selectedItem.value = document.getElementById('plugintype').selectedItem.value;
}
}
function onNewRegKey()
{
window.openDialog("chrome://cckwizard/content/reg.xul","newreg","chrome,modal");
window.openDialog("chrome://cckwizard/content/reg.xul","newreg","chrome,centerscreen,modal");
}
function onEditRegKey()
{
window.openDialog("chrome://cckwizard/content/reg.xul","editreg","chrome,modal");
}
function onDeleteRegKey()
{
listbox = document.getElementById('regList');
listbox.removeItemAt(listbox.selectedIndex);
window.openDialog("chrome://cckwizard/content/reg.xul","editreg","chrome,centerscreen,modal");
}
function OnRegLoad()
@ -460,48 +535,29 @@ function OnRegOK()
}
}
function enableRegButtons() {
listbox = document.getElementById('regList');
if (listbox.selectedItem) {
document.getElementById('editRegButton').disabled = false;
document.getElementById('deleteRegButton').disabled = false;
} else {
document.getElementById('editRegButton').disabled = true;
document.getElementById('deleteRegButton').disabled = true;
function onNewSearchEngine()
{
window.openDialog("chrome://cckwizard/content/searchengine.xul","newsearchengine","chrome,centerscreen,modal");
}
function onEditSearchEngine()
{
window.openDialog("chrome://cckwizard/content/searchengine.xul","editsearchengine","chrome,centerscreen,modal");
}
function OnSearchEngineLoad()
{
listbox = this.opener.document.getElementById('searchEngineList');
if (window.name == 'editsearchengine') {
document.getElementById('searchengine').value = listbox.selectedItem.label;
document.getElementById('searchengineicon').value = listbox.selectedItem.value;
document.getElementById('icon').src = listbox.selectedItem.value;
}
}
function onNewSearchPlugin()
{
window.openDialog("chrome://cckwizard/content/searchplugin.xul","newsearchplugin","chrome,modal");
}
function onEditSearchPlugin()
{
window.openDialog("chrome://cckwizard/content/searchplugin.xul","editsearchplugin","chrome,modal");
}
function onDeleteSearchPlugin()
{
listbox = document.getElementById('searchPluginList');
listboxitem = listbox.selectedItem;
listbox.removeChild(listboxitem);
}
function OnSearchPluginLoad()
{
listbox = this.opener.document.getElementById('searchPluginList');
listboxitem = listbox.selectedItem;
if (window.name == 'editsearchplugin') {
document.getElementById('searchplugin').value = listboxitem.childNodes[1].value;
document.getElementById('searchpluginicon').value = listboxitem.childNodes[0].value;
document.getElementById('icon').src = listboxitem.childNodes[0].src;
}
searchPluginCheckOKButton();
searchEngineCheckOKButton();
}
function searchPluginCheckOKButton()
function searchEngineCheckOKButton()
{
// if ((document.getElementById("prefname").value) && (document.getElementById("prefvalue").value)) {
// document.documentElement.getButton("accept").setAttribute( "disabled", "false" );
@ -510,38 +566,25 @@ function searchPluginCheckOKButton()
// }
}
function OnSearchPluginOK()
function OnSearchEngineOK()
{
listbox = this.opener.document.getElementById('searchPluginList');
if (window.name == 'newsearchplugin') {
item = this.opener.document.createElement("richlistitem");
image = this.opener.document.createElement("image");
label = this.opener.document.createElement("label");
image.setAttribute("src", document.getElementById('icon').src);
image.value = document.getElementById('searchpluginicon').value;
label.setAttribute("value", document.getElementById('searchplugin').value);
item.appendChild(image);
item.appendChild(label);
listbox.appendChild(item);
listbox = this.opener.document.getElementById('searchEngineList');
var listitem;
if (window.name == 'newsearchengine') {
listitem = listbox.appendItem(document.getElementById('searchengine').value, document.getElementById('searchengineicon').value);
listitem.setAttribute("class", "listitem-iconic");
} else {
listboxitem = listbox.selectedItem;
listboxitem.childNodes[1].value = document.getElementById('searchplugin').value;
listboxitem.childNodes[0].src = document.getElementById('icon').src;
listboxitem.childNodes[0].value = document.getElementById('searchpluginicon').value;
}
}
function enableSearchPluginButtons() {
listbox = document.getElementById('searchPluginList');
if (listbox.selectedItem) {
document.getElementById('editSearchPluginButton').disabled = false;
document.getElementById('deleteSearchPluginButton').disabled = false;
} else {
document.getElementById('editSearchPluginButton').disabled = true;
document.getElementById('deleteSearchPluginButton').disabled = true;
listitem = listbox.selectedItem;
listbox.selectedItem.label = document.getElementById('searchengine').value;
listbox.selectedItem.value = document.getElementById('searchengineicon').value;
}
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
sourcefile.initWithPath(document.getElementById('searchengineicon').value);
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var imgfile = ioServ.newFileURI(sourcefile);
listitem.setAttribute("image", imgfile.spec);
}
@ -637,11 +680,18 @@ function CreateCCK()
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
} catch(ex) {}
haveplugins = CCKCopyFile(document.getElementById("BrowserPluginPath1").value, destdir);
haveplugins |= CCKCopyFile(document.getElementById("BrowserPluginPath2").value, destdir);
haveplugins |= CCKCopyFile(document.getElementById("BrowserPluginPath3").value, destdir);
haveplugins |= CCKCopyFile(document.getElementById("BrowserPluginPath4").value, destdir);
haveplugins |=CCKCopyFile(document.getElementById("BrowserPluginPath5").value, destdir);
listbox = document.getElementById('browserPluginList');
for (var i=0; i < listbox.getRowCount(); i++) {
listitem = listbox.getItemAtIndex(i);
var pluginsubdir = destdir.clone();
if (listitem.value)
pluginsubdir.append(listitem.value);
try {
pluginsubdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
} catch(ex) {}
CCKCopyFile(listitem.label, pluginsubdir);
}
destdir.initWithPath(currentconfigpath);
destdir.append("xpi");
@ -651,14 +701,12 @@ function CreateCCK()
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
} catch(ex) {}
listbox = document.getElementById('searchPluginList');
listbox = document.getElementById('searchEngineList');
if (listbox.getRowCount() > 0)
havesearchplugins = true;
for (var i=0; i < listbox.getRowCount(); i++) {
listitem = listbox.getItemAtIndex(i);
CCKCopyFile(listitem.childNodes[0].value, destdir);
CCKCopyFile(listitem.childNodes[1].value, destdir);
CCKCopyFile(listitem.label, destdir);
CCKCopyFile(listitem.value, destdir);
}
destdir.initWithPath(currentconfigpath);
@ -1070,22 +1118,17 @@ function CCKWriteProperties(destdir)
cos.writeString(str);
/* Add toolbar/bookmark stuff at end */
str = document.getElementById('ToolbarFolder1').value;
if (str && str.length) {
str = "ToolbarFolder1=" + str + "\n";
cos.writeString(str);
for (var i=1; i <= 5; i++) {
str = document.getElementById("ToolbarFolder1.BookmarkTitle" + i).value;
if (str && str.length) {
str = "ToolbarFolder1.BookmarkTitle" + i + "=" + str + "\n";
cos.writeString(str);
}
str = document.getElementById("ToolbarFolder1.BookmarkURL" + i).value;
if (str && str.length) {
str = "ToolbarFolder1.BookmarkURL" + i + "=" + str + "\n";
cos.writeString(str);
}
listbox = document.getElementById('tbFolder.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
str = "ToolbarFolder1.BookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
cos.writeString(str);
var str = "ToolbarFolder1.BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
cos.writeString(str);
}
}
@ -1412,12 +1455,12 @@ function CCKWriteInstallJS(destdir, useinstallrdfdir)
str = str.replace(/%id%/g, document.getElementById("id").value);
str = str.replace(/%name%/g, document.getElementById("name").value);
if (haveplugins)
if (document.getElementById('browserPluginList').getRowCount() > 0)
str = str.replace(/%plugins%/g, 'addDirectory("", "%version%", "plugins", cckextensiondir, "plugins", true);');
else
str = str.replace(/%plugins%/g, '');
if (havesearchplugins)
if (document.getElementById('searchEngineList').getRowCount() > 0)
str = str.replace(/%searchplugins%/g, 'addDirectory("", "%version%", "searchplugins", cckextensiondir, "searchplugins", true);');
else
str = str.replace(/%searchplugins%/g, '');
@ -1472,7 +1515,7 @@ function CCKCopyFile(source, destination)
function ShowConfigInfo()
{
window.openDialog("chrome://cckwizard/content/showconfig.xul","showconfig","chrome,modal");
window.openDialog("chrome://cckwizard/content/showconfig.xul","showconfig","chrome,centerscreen,modal");
}
function InitConfigInfo()
@ -1542,6 +1585,28 @@ function CCKWriteConfigFile(destdir)
var line = "PreferenceValue" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
} else if (elements[i].id == "browserPluginList") {
listbox = document.getElementById('browserPluginList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "BrowserPluginPath" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
if (listitem.value) {
var line = "BrowserPluginType" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
}
} else if (elements[i].id == "tbFolder.bookmarkList") {
listbox = document.getElementById('tbFolder.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "ToolbarFolder1.BookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
if (listitem.value) {
var line = "ToolbarFolder1.BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
}
} else if (elements[i].id == "regList") {
listbox = document.getElementById('regList');
for (var j=0; j < listbox.getRowCount(); j++) {
@ -1559,13 +1624,13 @@ function CCKWriteConfigFile(destdir)
var line = "Type" + (j+1) + "=" + listitem.type + "\n";
fos.write(line, line.length);
}
} else if (elements[i].id == "searchPluginList") {
listbox = document.getElementById('searchPluginList');
} else if (elements[i].id == "searchEngineList") {
listbox = document.getElementById('searchEngineList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "SearchPlugin" + (j+1) + "=" + listitem.childNodes[1].value + "\n";
var line = "SearchEngine" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
var line = "SearchPluginIcon" + (j+1) + "=" + listitem.childNodes[0].value + "\n";
var line = "SearchEngineIcon" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
}
@ -1608,29 +1673,45 @@ function CCKReadConfigFile(srcdir)
// handle prefs
listbox = document.getElementById('prefList');
var children = listbox.childNodes;
for (var i = children.length; i > 0; i--)
{
listbox.removeChild(children[i-1]);
}
listbox.clear();
var i = 1;
while( prefname = configarray['PreferenceName' + i]) {
listbox.appendItem(prefname, configarray['PreferenceValue' + i]);
i++;
}
// handle plugins
listbox = document.getElementById('browserPluginList');
listbox.clear();
var i = 1;
while( pluginname = configarray['BrowserPluginPath' + i]) {
if (configarray['BrowserPluginType' + i]) {
listbox.appendItem(pluginname, configarray['BrowserPluginType' + i]);
} else {
listbox.appendItem(pluginname, null);
}
i++;
}
// handle toolbar folder with bookmarks
listbox = document.getElementById('tbFolder.bookmarkList');
listbox.clear();
var i = 1;
while( pluginname = configarray['ToolbarFolder1.BookmarkTitle' + i]) {
listbox.appendItem(pluginname, configarray['ToolbarFolder1.BookmarkURL' + i]);
i++;
}
// handle registry items
listbox = document.getElementById('regList');
var children = listbox.childNodes;
for (var i = children.length; i > 0; i--)
{
listbox.removeChild(children[i-1]);
}
listbox.clear();
var i = 1;
while( regname = configarray['RegName' + i]) {
@ -1646,36 +1727,29 @@ function CCKReadConfigFile(srcdir)
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
// handle searchplugins
listbox = document.getElementById('searchPluginList');
var children = listbox.childNodes;
for (var i = children.length; i > 0; i--)
{
listbox.removeChild(children[i-1]);
}
// handle searchengines
listbox = document.getElementById('searchEngineList');
listbox.clear();
var i = 1;
while(searchpluginname = configarray['SearchPlugin' + i]) {
item = document.createElement("richlistitem");
image = document.createElement("image");
label = document.createElement("label");
image.value = configarray['SearchPluginIcon' + i];
label.setAttribute("value", searchpluginname);
try {
sourcefile.initWithPath(configarray['SearchPluginIcon' + i]);
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var foo = ioServ.newFileURI(sourcefile);
image.setAttribute("src", foo.spec);
} catch (e) {
image.setAttribute("src", "");
/* I changed the name from SearchPlugin to SearchEngine. */
/* This code is to support old config files */
var searchname = "SearchEngine";
if (configarray['SearchPlugin1']) {
searchname = "SearchPlugin";
}
item.appendChild(image);
item.appendChild(label);
listbox.appendChild(item);
var i = 1;
while(searchenginename = configarray[searchname + i]) {
listitem = listbox.appendItem(searchenginename, configarray[searchname + 'Icon' + i]);
listitem.setAttribute("class", "listitem-iconic");
try {
sourcefile.initWithPath(configarray[searchname + 'Icon' + i]);
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var imgfile = ioServ.newFileURI(sourcefile);
listitem.setAttribute("image", imgfile.spec);
} catch (e) {
}
i++;
}

View File

@ -41,6 +41,7 @@
<!DOCTYPE wizard SYSTEM "chrome://cckwizard/locale/cckWizard.dtd">
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://cckwizard/content/ccklist.css" type="text/css"?>
<wizard id="example-window" title="&cckWizard.title;"
height="480"
@ -51,6 +52,8 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://cckwizard/content/cckwizard.js"/>
<script type="application/x-javascript"
src="chrome://global/content/dialogOverlay.js" />
<wizardpage onpageshow="document.getElementById('example-window').canAdvance = true;">
<description>&cckWizard.description;</description>
@ -263,58 +266,25 @@
</groupbox>
</wizardpage>
<wizardpage label="&customizeBrowserPlugins.label;" onpageadvanced="return ValidateFile('BrowserPluginPath1','BrowserPluginPath2','BrowserPluginPath3','BrowserPluginPath4','BrowserPluginPath5');">
<description>&browserPlugins.description;</description>
<hbox>
<textbox id="BrowserPluginPath1" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('BrowserPluginPath1');"/>
</hbox>
<hbox>
<textbox id="BrowserPluginPath2" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('BrowserPluginPath2');"/>
</hbox>
<hbox>
<textbox id="BrowserPluginPath3" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('BrowserPluginPath3');"/>
</hbox>
<hbox>
<textbox id="BrowserPluginPath4" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('BrowserPluginPath4');"/>
</hbox>
<hbox>
<textbox id="BrowserPluginPath5" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('BrowserPluginPath5');"/>
</hbox>
</wizardpage>
<wizardpage label="&customizeSearchPlugins.label;" onpageshow="enableSearchPluginButtons();">
<description>&searchPlugins.description;</description>
<groupbox>
<hbox flex="1">
<vbox flex="1">
<richlistbox id="searchPluginList" flex="1" rows="5" onselect="enableSearchPluginButtons();" ondblclick="onEditSearchPlugin();">
</richlistbox>
</vbox>
<vbox>
<button id="newSearchPluginButton" label="&newButton.label;" accesskey="&newButton.accesskey;"
oncommand="onNewSearchPlugin();"/>
<button id="editSearchPluginButton" label="&editButton.label;" accesskey="&editButton.accesskey;"
oncommand="onEditSearchPlugin();"/>
<button id="deleteSearchPluginButton" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
oncommand="onDeleteSearchPlugin();"/>
<spacer flex="1"/>
</vbox>
</hbox>
<wizardpage label="&customizeBrowserPlugins.label;">
<groupbox>
<caption label="&plugins.label;"/>
<description>&browserPlugins.description;</description>
<box class="ccklist" id="browserPluginList" new="onNewBrowserPlugin();" edit="onEditBrowserPlugin();"/>
</groupbox>
</wizardpage>
<wizardpage label="&customizeSearchEngines.label;">
<groupbox>
<description>&searchEngines.description;</description>
<box class="ccklist" id="searchEngineList" new="onNewSearchEngine();" edit="onEditSearchEngine();"/>
</groupbox>
</wizardpage>
<wizardpage label="&customizeToolbarOne.label;">
<wizardpage id="tbFolder" label="&customizeToolbarOne.label;">
<groupbox>
<caption label="&addToolbarFolder.caption;"/>
<description>&addToolbarFolder.description;</description>
@ -322,41 +292,7 @@
<label>&folderTitle.label;</label>
<textbox id="ToolbarFolder1"/>
</hbox>
<label value="&bookmark.label; 1"/>
<hbox align="center">
<label control="ToolbarFolder1.BookmarkTitle2">&bookmarkTitle.label;</label>
<textbox id="ToolbarFolder1.BookmarkTitle1" flex="1"/>
<label control="ToolbarFolder1.BookmarkURL1">&bookmarkURL.label;</label>
<textbox id="ToolbarFolder1.BookmarkURL1" flex="1"/>
</hbox>
<label value="&bookmark.label; 2"/>
<hbox align="center">
<label control="ToolbarFolder1.BookmarkTitle2">&bookmarkTitle.label;</label>
<textbox id="ToolbarFolder1.BookmarkTitle2" flex="1"/>
<label control="ToolbarFolder1.BookmarkURL2">&bookmarkURL.label;</label>
<textbox id="ToolbarFolder1.BookmarkURL2" flex="1"/>
</hbox>
<label value="&bookmark.label; 3"/>
<hbox align="center">
<label control="ToolbarFolder1.BookmarkTitle3">&bookmarkTitle.label;</label>
<textbox id="ToolbarFolder1.BookmarkTitle3" flex="1"/>
<label control="ToolbarFolder1.BookmarkURL3">&bookmarkURL.label;</label>
<textbox id="ToolbarFolder1.BookmarkURL3" flex="1"/>
</hbox>
<label value="&bookmark.label; 4"/>
<hbox align="center">
<label control="ToolbarFolder1.BookmarkTitle4">&bookmarkTitle.label;</label>
<textbox id="ToolbarFolder1.BookmarkTitle4" flex="1"/>
<label control="ToolbarFolder1.BookmarkURL4">&bookmarkURL.label;</label>
<textbox id="ToolbarFolder1.BookmarkURL4" flex="1"/>
</hbox>
<label value="&bookmark.label; 5"/>
<hbox align="center">
<label control="ToolbarFolder1.BookmarkTitle5">&bookmarkTitle.label;</label>
<textbox id="ToolbarFolder1.BookmarkTitle5" flex="1"/>
<label control="ToolbarFolder1.BookmarkURL5">&bookmarkURL.label;</label>
<textbox id="ToolbarFolder1.BookmarkURL5" flex="1"/>
</hbox>
<box class="ccklist" id="tbFolder.bookmarkList" new="onNewBookmark();" edit="onEditBookmark();"/>
</groupbox>
</wizardpage>
@ -490,51 +426,21 @@
</groupbox>
</wizardpage>
<wizardpage label="&customizePrefs.label;" onpageshow="enablePrefButtons();">
<wizardpage label="&customizePrefs.label;">
<groupbox>
<caption label="&prefs.label;"/>
<description>&prefs.description;</description>
<hbox flex="1">
<vbox flex="1">
<listbox id="prefList" flex="1" rows="5" onselect="enablePrefButtons();" ondblclick="onEditPreference();">
</listbox>
</vbox>
<vbox>
<button id="newPrefButton" label="&newButton.label;" accesskey="&newButton.accesskey;"
oncommand="onNewPreference();"/>
<button id="editPrefButton" label="&editButton.label;" accesskey="&editButton.accesskey;"
oncommand="onEditPreference();"/>
<button id="deletePrefButton" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
oncommand="onDeletePreference();"/>
<spacer flex="1"/>
</vbox>
</hbox>
</groupbox>
</wizardpage>
<wizardpage label="&customizeRegistry.label;" onpageshow="enableRegButtons();">
<groupbox>
<caption label="&registry.label;"/>
<description>&registry.description;</description>
<hbox flex="1">
<vbox flex="1">
<listbox id="regList" flex="1" rows="5" onselect="enableRegButtons();" ondblclick="onEditRegKey();">
</listbox>
</vbox>
<vbox>
<button id="newRegButton" label="&newButton.label;" accesskey="&newButton.accesskey;"
oncommand="onNewRegKey();"/>
<button id="editRegButton" label="&editButton.label;" accesskey="&editButton.accesskey;"
oncommand="onEditRegKey();"/>
<button id="deleteRegButton" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
oncommand="onDeleteRegKey();"/>
<spacer flex="1"/>
</vbox>
</hbox>
<box flex="1" class="ccklist" id="prefList" new="onNewPreference();" edit="onEditPreference();"/>
</groupbox>
</wizardpage>
<wizardpage label="&customizeRegistry.label;">
<groupbox>
<caption label="&registry.label;"/>
<description>&registry.description;</description>
<box class="ccklist" id="regList" new="onNewRegKey();" edit="onEditRegKey();"/>
</groupbox>
</wizardpage>
<wizardpage label="&customizeCerts.label;" onpageadvanced="return ValidateFile('CertPath1','CertPath2','CertPath3','CertPath4','CertPath5');">>
<description>&customizeCerts.warning;</description>

View File

@ -42,18 +42,29 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<dialog id="createplugin" title="Plugins"
<dialog id="createplugin" title="&plugins.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
ondialogaccept="return OnPluginOK()"
ondialogaccept="return OnBrowserPluginOK()"
onload="OnPluginLoad()"
width="500"
height="200"
>
<script src="chrome://cckwizard/content/cckwizard.js"/>
<vbox>
<label>Plugins</label>
<label>&plugins.description;</label>
<hbox align="center">
<textbox flex="1" id="pluginpath"/>
<button label="&chooseFile.label;" oncommand="chooseimage('pluginpath');"/>
<button label="&chooseFile.label;" oncommand="choosefile('pluginpath');"/>
</hbox>
<hbox align="center">
<menulist flex="1" id="plugintype">
<menupopup>
<menuitem label="Windows" value="WINNT_x86-msvc"/>
<menuitem label="Linux" value="Linux_x86-gcc3"/>
<menuitem label="Macintosh" value="Darwin_ppc-gcc3"/>
</menupopup>
</menulist>
</hbox>
</vbox>
</dialog>

View File

@ -46,11 +46,13 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
ondialogaccept="return OnPrefOK()"
onload="OnPrefLoad()"
onload="OnPrefLoad();centerWindowOnScreen();"
width="500"
height="200"
>
<script src="chrome://cckwizard/content/cckwizard.js"/>
<script type="application/x-javascript"
src="chrome://global/content/dialogOverlay.js" />
<vbox>
<label>&prefs.description;</label>
<label>&prefName.label;</label>

View File

@ -0,0 +1,69 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
#if 0
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Client Customization Kit (CCK).
-
- The Initial Developer of the Original Code is IBM Corp.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
#endif
- ***** END LICENSE BLOCK ***** -->
<!DOCTYPE prefwindow SYSTEM "chrome://cckwizard/locale/cckWizard.dtd">
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<dialog id="createsearchengine" title="&engines.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
ondialogaccept="return OnSearchEngineOK()"
onload="OnSearchEngineLoad()"
width="500"
height="200"
>
<script src="chrome://cckwizard/content/cckwizard.js"/>
<vbox>
<label>&engines.description;</label>
<label>&engine.label;</label>
<hbox align="center">
<textbox flex="1" id="searchengine"/>
<button label="&chooseFile.label;" oncommand="choosefile('searchengine');"/>
</hbox>
<label>&engineIcon.label;</label>
<hbox align="center">
<textbox flex="1" id="searchengineicon"/>
<image id="icon" src='' width='16' height='16'/>
<button label="&chooseFile.label;" oncommand="chooseimage('searchengineicon','icon');"/>
</hbox>
</vbox>
</dialog>