Updated the import tools to new xul tags

This commit is contained in:
tonyr%fbdesigns.com 2000-05-06 18:38:41 +00:00
Родитель 36cc288ddd
Коммит 9bbde92bc9
8 изменённых файлов: 183 добавлений и 161 удалений

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

@ -5,6 +5,8 @@ var recordNum = 0;
var amAtEnd = false;
var addInterface = null;
var dialogResult = null;
var dragStart = false;
var dragData = null;
function OnLoadFieldMapImport()
{
@ -100,30 +102,26 @@ function CreateField( name, index, on, cBoxIndex)
item.setAttribute('field-index', index);
var cCell = document.createElement( 'treecell');
var cBox = document.createElement( 'html:input');
cBox.setAttribute( 'type', "checkbox");
var cBox = document.createElement( 'checkbox');
if (on == true)
cBox.setAttribute( 'checked', "true");
// cBox.onclick = new Function( "return BoxClick( " + cBoxIndex + ")");
cBox.setAttribute( 'value', name);
cCell.appendChild( cBox);
cCell.setAttribute( 'allowevents', "true");
row.appendChild( cCell);
row.appendChild(cell);
/* row.appendChild(cell); */
cell = document.createElement( 'treecell');
cell.setAttribute( "class", "importsampledata");
cell.setAttribute( 'value', " ");
cell.setAttribute( 'noDrag', "true");
// cell.setAttribute( 'style', "border-left: 5px grey ridge; padding-left: 10px;");
row.appendChild( cell);
item.appendChild(row);
// cBox.setAttribute( 'onclick', "return BoxClick( event.target);");
return( item);
}
@ -135,50 +133,71 @@ function AddFieldToList(body, name, index, on)
function BeginDrag( event)
{
top.dragStart = false;
var tree = document.getElementById("fieldList");
if ( event.target == tree )
if ( event.target == tree ) {
return( true); // continue propagating the event
if (!tree)
}
if (!tree) {
return( false);
}
var dragService = Components.classes["component://netscape/widget/dragservice"].getService();
if ( dragService ) dragService = dragService.QueryInterface(Components.interfaces.nsIDragService);
if ( !dragService ) return(false);
if ( !dragService ) {
return(false);
}
var trans = Components.classes["component://netscape/widget/transferable"].createInstance();
if ( trans ) trans = trans.QueryInterface(Components.interfaces.nsITransferable);
if ( !trans ) return(false);
if ( !trans ) {
return(false);
}
var genData = Components.classes["component://netscape/supports-wstring"].createInstance();
if ( genData ) genData = genData.QueryInterface(Components.interfaces.nsISupportsWString);
if (!genData) return(false);
if (!genData) {
return(false);
}
// trans.addDataFlavor( "text/unicode");
trans.addDataFlavor( top.transferType);
trans.addDataFlavor( "text/unicode");
// the index is on the <treeitem> which is two levels above the <treecell> which is
// the target of the event.
if (event.target.getAttribute( 'noDrag') == "true")
if (event.target.getAttribute( 'noDrag') == "true") {
return( false);
}
var index = event.target.parentNode.parentNode.getAttribute("field-index");
if (!index)
index = event.target.parentNode.parentNode.parentNode.getAttribute( "field-index");
if (!index)
return( false);
var indexStr = ("" + index);
genData.data = indexStr;
// trans.setTransferData ( "text/unicode", genData, indexStr.length * 2);
trans.setTransferData ( top.transferType, genData, indexStr.length * 2);
trans.setTransferData ( "text/unicode", genData, indexStr.length * 2);
var transArray = Components.classes["component://netscape/supports-array"].createInstance();
if ( transArray ) transArray = transArray.QueryInterface(Components.interfaces.nsISupportsArray);
if ( !transArray ) return(false);
if ( !transArray ) {
return(false);
}
// put it into the transferable as an |nsISupports|
var genTrans = trans.QueryInterface(Components.interfaces.nsISupports);
transArray.AppendElement(genTrans);
var nsIDragService = Components.interfaces.nsIDragService;
top.dragStart = true;
dragService.invokeDragSession ( transArray, null, nsIDragService.DRAGDROP_ACTION_MOVE);
return( false); // don't propagate the event if a drag has begun
}
@ -194,15 +213,22 @@ function SetRow( row, dstIndex, dstBox, dstField)
row.firstChild.firstChild.firstChild.checked = false;
}
row.firstChild.childNodes[1].setAttribute( "value", dstField);
/* row.firstChild.childNodes[1].setAttribute( "value", dstField); */
row.firstChild.firstChild.firstChild.setAttribute( 'value', dstField);
}
function AssignRow( toRow, fromRow)
{
/*
SetRow( toRow, fromRow.getAttribute( 'field-index'),
fromRow.firstChild.firstChild.firstChild.checked,
fromRow.firstChild.childNodes[1].getAttribute( "value"));
*/
SetRow( toRow, fromRow.getAttribute( 'field-index'),
fromRow.firstChild.firstChild.firstChild.checked,
fromRow.firstChild.firstChild.firstChild.getAttribute( "value"));
}
@ -266,6 +292,7 @@ function DropOnTree( event)
if ( trans ) trans = trans.QueryInterface(Components.interfaces.nsITransferable);
if ( !trans ) return(false);
trans.addDataFlavor( top.transferType);
// trans.addDataFlavor( "text/unicode");
var body = document.getElementById( "fieldBody");
if (!body)
@ -285,7 +312,10 @@ function DropOnTree( event)
if ( !dataObj ) {
continue;
}
var fIndex = parseInt( dataObj.data);
dump( "Source row: " + fIndex + "\n");
// so now what, move the given row to the new position!
// find the source row index
@ -312,7 +342,7 @@ function DropOnTree( event)
var maxIndex = body.childNodes.length - 1;
var dstBox = body.childNodes[srcRow].firstChild.firstChild.firstChild.checked;
var dstField = body.childNodes[srcRow].firstChild.childNodes[1].getAttribute( "value");
var dstField = body.childNodes[srcRow].firstChild.firstChild.firstChild.getAttribute( 'value');
var dstIndex = body.childNodes[srcRow].getAttribute( 'field-index');
dump( "FieldDrag from " + srcRow + " to " + dstRow + "\n");
@ -354,6 +384,9 @@ function DropOnTree( event)
}
catch( ex) {
dump( "Caught drag exception in DropOnTree\n");
dump( ex);
dump( "\n");
}
}
@ -363,6 +396,9 @@ function DropOnTree( event)
function DragOverTree( event)
{
if (!top.dragStart)
return( false);
var validFlavor = false;
var dragSession = null;
var retVal = true;
@ -375,6 +411,7 @@ function DragOverTree( event)
if ( !dragSession ) return(false);
if ( dragSession.isDataFlavorSupported( top.transferType) ) validFlavor = true;
// if ( dragSession.isDataFlavorSupported( "text/unicode") ) validFlavor = true;
if (event.target == document.getElementById( "fieldBody")) return( false);
@ -397,10 +434,12 @@ function ShowSampleData( data)
var fields = data.split( "\n");
for (var i = 0; i < fBody.childNodes.length; i++) {
if (i < fields.length) {
fBody.childNodes[i].firstChild.childNodes[2].setAttribute( 'value', fields[i]);
// fBody.childNodes[i].firstChild.childNodes[2].setAttribute( 'value', fields[i]);
fBody.childNodes[i].firstChild.childNodes[1].setAttribute( 'value', fields[i]);
}
else {
fBody.childNodes[i].firstChild.childNodes[2].setAttribute( 'value', " ");
// fBody.childNodes[i].firstChild.childNodes[2].setAttribute( 'value', " ");
fBody.childNodes[i].firstChild.childNodes[1].setAttribute( 'value', " ");
}
}
@ -434,7 +473,7 @@ function OnPreviousRecord()
top.recordNum--;
top.amAtEnd = false;
if (FetchSampleData()) {
SetDivText( "recordNumber", ("" + top.recordNum));
document.getElementById('recordNumber').setAttribute('value', ("" + top.recordNum));
}
}
@ -448,7 +487,7 @@ function OnNextRecord()
top.recordNum--;
}
else
SetDivText( "recordNumber", ("" + top.recordNum));
document.getElementById('recordNumber').setAttribute('value', ("" + top.recordNum));
}
function FieldImportOKButton()

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

@ -19,7 +19,6 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/fieldMapImport.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
@ -28,66 +27,49 @@ Rights Reserved.
<!DOCTYPE window SYSTEM "chrome://messenger/locale/fieldMapImport.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&fieldMapImport.title;"
class="dialog"
style="padding:0px"
onload="OnLoadFieldMapImport()"
align="vertical">
<html:script src="chrome://global/content/strres.js"/>
<html:script src="chrome://messenger/content/fieldMapImport.js"/>
<!-- <html:script language="JavaScript" src="resource:/res/samples/DumpDOM.js"/> -->
<script src="chrome://global/content/strres.js"/>
<script src="chrome://messenger/content/fieldMapImport.js"/>
<keyset id="keyset"/>
<box align="horizontal">
<spring style="width:3em"/>
<!-- field list -->
<box align="vertical">
<spring style="height:1em"/>
<box align="horizontal">
<html:div flex="35%" id="fieldLabel">&fieldMapImport.fieldListTitle;</html:div>
<!-- <spring flex="35%"/> -->
<html:div flex="65%" id="dataLabel">&fieldMapImport.dataTitle;</html:div>
</box>
<spring style="height:.5em"/>
<box align="vertical" style="border: 1px inset white">
<tree id="fieldList" style="width:32em; height:300px;"
ondragover="return DragOverTree(event);"
ondraggesture="return BeginDrag( event);"
ondragdrop="return DropOnTree( event);">
<treecol style="width:10%"/>
<treecol style="width:25%"/>
<treecol id="dataColumn" style="width:65%"/>
<treechildren id="fieldBody"/>
</tree>
</box>
<spring style="height:1.5em"/>
</box>
<spring style="width:3em"/>
<!-- field list -->
<box id="fieldList-box" align="vertical">
<tree id="fieldList" flex="1"
ondragover="return DragOverTree(event);"
ondraggesture="return BeginDrag( event);"
ondragdrop="return DropOnTree( event);">
<treecol style="width:35%"/>
<treecol id="dataColumn" style="width:65%"/>
<treehead>
<treerow id="headRow">
<treecell id="fieldNameHeader" value="&fieldMapImport.fieldListTitle;"/>
<treecell id="sampleDataHeader" value="&fieldMapImport.dataTitle;"/>
</treerow>
</treehead>
<treechildren id="fieldBody"/>
</tree>
</box>
<spring style="height: .5em"/>
<box align="horizontal">
<spring flex="50%"/>
<titledbutton class="dialog push" id="previous" onclick="OnPreviousRecord()" value="&fieldMapImport.previous;"/>
<button class="dialog" id="previous" oncommand="OnPreviousRecord()" value="&fieldMapImport.previous;"/>
<spring style="width: 2em"/>
<html:div>&fieldMapImport.recordNumber;</html:div>
<text value="&fieldMapImport.recordNumber;"/>
<spring style="width: 1em"/>
<html:div id="recordNumber">0</html:div>
<text id="recordNumber"/>
<spring style="width: 2em"/>
<titledbutton class="dialog push" id="next" onclick="OnNextRecord()" value="&fieldMapImport.next;"/>
<button class="dialog" id="next" oncommand="OnNextRecord()" value="&fieldMapImport.next;"/>
<spring flex="50%"/>
</box>

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

@ -78,21 +78,24 @@ function SetUpImportType()
{
case "mail":
// top.window.title = top.bundle.GetStringFromName('ImportMailDialogTitle');
SetDivText('listLabel', GetBundleString('ImportMailListLabel'));
document.getElementById( "listLabel").setAttribute('value', GetBundleString('ImportMailListLabel'));
//SetDivText('listLabel', GetBundleString('ImportMailListLabel'));
document.getElementById( "mailRadio").checked = true;
document.getElementById( "addressbookRadio").checked = false;
document.getElementById( "settingsRadio").checked = false;
break;
case "addressbook":
// top.window.title = top.bundle.GetStringFromName('ImportAddressBooksDialogTitle');
SetDivText('listLabel', GetBundleString('ImportAddressBooksListLabel'));
document.getElementById( "listLabel").setAttribute('value', GetBundleString('ImportAddressBooksListLabel'));
//SetDivText('listLabel', GetBundleString('ImportAddressBooksListLabel'));
document.getElementById( "addressbookRadio").checked = true;
document.getElementById( "mailRadio").checked = false;
document.getElementById( "settingsRadio").checked = false;
break;
case "settings":
// top.window.title = top.bundle.GetStringFromName('ImportSettingsDialogTitle');
SetDivText('listLabel', GetBundleString('ImportSettingsListLabel'));
document.getElementById( "listLabel").setAttribute('value', GetBundleString('ImportSettingsListLabel'));
//SetDivText('listLabel', GetBundleString('ImportSettingsListLabel'));
document.getElementById( "settingsRadio").checked = true;
document.getElementById( "addressbookRadio").checked = false;
document.getElementById( "mailRadio").checked = false;
@ -325,7 +328,7 @@ function ContinueImport( info) {
if (mailName != null) {
mailName = mailName.QueryInterface( Components.interfaces.nsISupportsWString);
if (mailName != null)
info.progressWindow.SetDivText( 'progressStatus', mailName.data);
info.progressWindow.SetStatusText( mailName.data);
}
}
}

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

@ -19,8 +19,7 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/importDialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/importDialog.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
@ -28,61 +27,38 @@ Rights Reserved.
<!DOCTYPE window SYSTEM "chrome://messenger/locale/importDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="dialog"
style="padding:0px"
onload="OnLoadImportDialog()"
align="vertical"
orient="vertical"
title="&importDialog.windowTitle;">
<html:script src="chrome://global/content/strres.js"/>
<html:script src="chrome://messenger/content/importDialog.js"/>
<!--html:script language="JavaScript" src="resource:/res/samples/DumpDOM.js"/-->
<script src="chrome://global/content/strres.js"/>
<script src="chrome://messenger/content/importDialog.js"/>
<keyset id="keyset"/>
<box align = "vertical">
<spring style="height: 1em"/>
<box align="horizontal">
<spring flex="1"/>
<html:label><html:input type="radio" id="addressbookRadio" onclick="OnAddressType();"/>&importDialog.addressbookTitle;</html:label>
<html:label><html:input type="radio" id="mailRadio" onclick="OnMailType();"/>&importDialog.mailTitle;</html:label>
<html:label><html:input type="radio" id="settingsRadio" onclick="OnSettingsType();"/>&importDialog.settingsTitle;</html:label>
<spring flex="1"/>
</box>
<box id="import-type-radio-box" orient="horizontal">
<spring flex="1"/>
<radio id="addressbookRadio" value="&importDialog.addressbookTitle;" onclick="OnAddressType();"/>
<radio id="mailRadio" value="&importDialog.mailTitle;" onclick="OnMailType();"/>
<radio id="settingsRadio" value="&importDialog.settingsTitle;" onclick="OnSettingsType();"/>
<spring flex="1"/>
</box>
<box align="horizontal">
<spring style="width: 3em"/>
<!-- module list -->
<box id="import-module-list-box" orient="vertical">
<text id="listLabel"/>
<!-- module list -->
<box align="vertical" style="height:170px">
<spring style="height:1em"/>
<html:div id="listLabel">*</html:div>
<spring style="height:.5em"/>
<box align="vertical" style="border: 1px inset white">
<html:div style="width:20em; height:100px">
<tree id="moduleList" style="width:100%; height:100%" onselect="ImportSelectionChanged()">
<treecol style="width:100%"/>
<treechildren id="bucketBody"/>
</tree>
</html:div>
</box>
<spring style="height:1.5em"/>
<box align="vertical" style="height: 3em; background-color:white; border:1px inset white;">
<html:div id="description" style="width:20em; height:100%;"></html:div>
</box>
<spring style="height:2em"/>
<box id="import-module-tree-box" orient="vertical">
<tree id="moduleList" flex="1" onselect="ImportSelectionChanged()">
<treecol style="width:100%"/>
<treechildren id="bucketBody"/>
</tree>
</box>
<spring style="width: 3em"/>
<html id="description"/>
</box>

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

@ -22,6 +22,7 @@
var progressMeter = 0;
var progressInfo = null;
var progressStatus = null;
function OnLoadProgressDialog()
{
@ -30,6 +31,7 @@ function OnLoadProgressDialog()
dump( "*** Loaded progress window\n");
top.progressMeter = document.getElementById( 'progressMeter');
top.progressStatus = document.getElementById( 'progressStatus');
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0])
@ -39,10 +41,10 @@ function OnLoadProgressDialog()
top.window.title = window.arguments[0].windowTitle;
if ( window.arguments[0].progressTitle )
SetDivText( 'progressTitle', window.arguments[0].progressTitle );
document.getElementById( 'progressTitle').setAttribute( "value", window.arguments[0].progressTitle);
if ( window.arguments[0].progressStatus )
SetDivText( 'progressStatus', window.arguments[0].progressStatus );
top.progressStatus.setAttribute( "value", window.arguments[0].progressStatus);
top.progressInfo = window.arguments[0].progressInfo;
}
@ -52,27 +54,16 @@ function OnLoadProgressDialog()
}
function SetStatusText( val)
{
top.progressStatus.setAttribute( "value", val);
}
function SetProgress( val)
{
top.progressMeter.setAttribute( "value", val);
}
function SetDivText(id, text)
{
var div = document.getElementById(id);
if ( div )
{
if ( div.childNodes.length == 0 )
{
var textNode = document.createTextNode(text);
div.appendChild(textNode);
}
else if ( div.childNodes.length == 1 )
div.childNodes[0].nodeValue = text;
}
}
function Continue()
{
top.progressInfo.mainWindow.ContinueImport( top.progressInfo);

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

@ -19,7 +19,7 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/importDialog.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
@ -27,38 +27,21 @@ Rights Reserved.
<!DOCTYPE window SYSTEM "chrome://messenger/locale/importDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="dialog"
style="padding:0px; width:30em;"
onload="OnLoadProgressDialog()"
align="vertical">
orient="vertical">
<html:script src="chrome://global/content/strres.js"/>
<html:script src="chrome://messenger/content/importProgress.js"/>
<!--html:script language="JavaScript" src="resource:/res/samples/DumpDOM.js"/-->
<script src="chrome://global/content/strres.js"/>
<script src="chrome://messenger/content/importProgress.js"/>
<keyset id="keyset"/>
<box align="vertical">
<html:div id="progressTitle">Title</html:div>
<spring style="height:1em"/>
<html:div id="progressStatus" flex="100%">Processing</html:div>
<spring style="height:1em"/>
<box align="horizontal">
<spring style="width: 1em;"/>
<progressmeter id="progressMeter" mode="normal" value="5" flex="100%"/>
<spring style="width: 2em"/>
</box>
<spring style="height: 2em"/>
</box>
<text id="progressTitle" value="Title"/>
<text id="progressStatus" value="Processing" flex="1"/>
<progressmeter id="progressMeter" mode="normal" value="5" flex="1"/>
</window>

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

@ -21,8 +21,19 @@
* Pete Collins, Ben Goodger
*/
@import url(chrome://communicator/skin/);
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to HTML */
@namespace html url("http://www.w3.org/TR/REC-html40"); /* namespace for XUL elements */
treecell.importsampledata {
padding-left: 10px;
border-left: 3px solid #CCCCCC;
}
#fieldList-box {
border: 1px inset white;
width:32em;
height:300px;
margin: 1.5em 3em 1.5em 3em;
}

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

@ -21,4 +21,41 @@
*
*/
@import url(chrome://communicator/skin/);
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to HTML */
@namespace html url("http://www.w3.org/TR/REC-html40"); /* namespace for XUL elements */
#import-type-radio-box {
padding-top: 1em;
}
#import-module-list-box {
padding: 1em 3em 2em 3em;
}
#import-module-tree-box {
height: 8em;
width: 20em;
border: 1px inset white;
margin-top: .5em;
}
#description {
margin: 1.5em 0px 0px 0px;
padding: 0px 2px 0px 2px;
height: 4em;
width: 20em;
background-color:white;
border:1px inset white;
}
#progressStatus {
margin: 1em 0px 0px 0px;
}
#progressMeter {
margin: 1em 2em 2em 1em;
width: 26em;
}