зеркало из https://github.com/mozilla/pjs.git
195 строки
4.6 KiB
XML
195 строки
4.6 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="pm.css" type="text/css"?>
|
|
|
|
<window
|
|
width="640"
|
|
height="480"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
<html:div flex="100%">
|
|
|
|
<html:script>
|
|
var Account = Components.classes["@mozilla.org/profile/Account-services;1"].createInstance();
|
|
Account = Account.QueryInterface(Components.interfaces.nsIAccountServices);
|
|
dump("Account = " + Account + "\n");
|
|
|
|
nameGlobal = new Array();
|
|
nameArray = new Array();
|
|
var count = 0;
|
|
var dataCount = 0;
|
|
|
|
function TestMe()
|
|
{
|
|
var field1 = document.getElementById('phone');
|
|
SetPhonebookValue(field1.id,field1.value);
|
|
|
|
var field2 = document.getElementById('loginname');
|
|
SetPhonebookValue(field2.id,field2.value);
|
|
var field3 = document.getElementById('loginpass');
|
|
SetPhonebookValue(field3.id,field3.value);
|
|
var field4 = document.getElementById('passagain');
|
|
SetPhonebookValue(field4.id,field4.value);
|
|
// var field5 = document.getElementById('domainname');
|
|
// SetPhonebookValue(field5.id,field5.value);
|
|
// var field6 = document.getElementById('dnsp');
|
|
// SetPhonebookValue(field6.id,field6.value);
|
|
// var field7 = document.getElementById('dnss');
|
|
// SetPhonebookValue(field7.id,field7.value);
|
|
// var field8 = document.getElementById('callwait');
|
|
// if (field8.value ==TRUE)
|
|
// SetPhonebookValue(field8.id,field8.value);
|
|
// var field9 = document.getElementById('tone');
|
|
// SetPhonebookValue(field9.id,field9.value);
|
|
|
|
Finish();
|
|
|
|
}
|
|
|
|
|
|
function SetPhonebookValue(name, value)
|
|
{
|
|
dump("Inside SetPhonebookValue\n");
|
|
var found = false;
|
|
for (i = 0; i !=dataCount; i++) {
|
|
if (nameArray[i] == name) {
|
|
dump("Name exists: "+nameGlobal[i]+"\n");
|
|
nameGlobal[i] = name+"="+value+"%";
|
|
dump("New values: "+name+" "+value+"\n");
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
if (!found) {
|
|
dump("Name does not exist\n");
|
|
nameGlobal[dataCount] = name+"="+value+"%";
|
|
dump("Name Value: "+name+" "+value+"\n");
|
|
|
|
nameArray[dataCount] = name;
|
|
dataCount++;
|
|
}
|
|
}
|
|
|
|
function Finish()
|
|
{
|
|
var data = "";
|
|
var i = 0;
|
|
dump("before for loop\n");
|
|
for (i = 0; i !=dataCount; i++) {
|
|
data = data+nameGlobal[i];
|
|
}
|
|
dump("DATA IS: "+data+"\n");
|
|
// Account.SetDialerConfig(data);
|
|
dump ("this is before getting account \n");
|
|
|
|
}
|
|
|
|
function loadElements()
|
|
{
|
|
|
|
var AccountList = "";
|
|
AccountList = Account.GetAcctConfig();
|
|
dump ("this is after getting account \n");
|
|
AccountList = AccountList.split(",");
|
|
dump("Got account list of '" + AccountList + "'\n");
|
|
|
|
for (var i=0; i < AccountList.length; i++)
|
|
{
|
|
var pvals = AccountList[i];
|
|
addOptions1(pvals,i+1);
|
|
}
|
|
|
|
var ModemList = "";
|
|
ModemList = Account.GetModemConfig();
|
|
dump ("this is after getting Modem \n");
|
|
ModemList = ModemList.split(",");
|
|
dump("Got Modem list of '" + ModemList + "'\n");
|
|
|
|
for (var i=0; i < ModemList.length; i++)
|
|
{
|
|
var pvals = ModemList[i];
|
|
addOptions2(pvals,i+10);
|
|
}
|
|
|
|
var dunlist = "";
|
|
dunlist = Account.CheckForDun();
|
|
dump ("dun has been checked \n");
|
|
dump ("dun is "+dunlist+"\n");
|
|
if (dunlist == "01")
|
|
{
|
|
var rad = document.getElementById("dun2");
|
|
rad.checked = true;
|
|
}
|
|
}
|
|
|
|
// -------------------------------------------- begin Hack for OnLoad handling
|
|
setTimeout("loadElements()", 0);
|
|
// -------------------------------------------- end Hack for OnLoad handling
|
|
|
|
|
|
function addOptions1(oname, iname)
|
|
{
|
|
var sel = document.getElementById("x");
|
|
dump( "sel="+sel+"\n" );
|
|
|
|
var elem = document.createElement( "html:option" );
|
|
dump( "elem="+elem+"\n" );
|
|
|
|
elem.id =iname;
|
|
dump ("elem id="+elem.id+"\n");
|
|
|
|
var text = document.createTextNode( oname );
|
|
dump( "text="+text+"\n" );
|
|
|
|
var rc = elem.appendChild( text );
|
|
dump( "rc="+rc+"\n" );
|
|
|
|
var newsel = sel.appendChild( elem );
|
|
dump( "newsel="+newsel+"\n" );
|
|
}
|
|
function addOptions2(oname, iname)
|
|
{
|
|
var sel = document.getElementById("y");
|
|
dump( "sel="+sel+"\n" );
|
|
|
|
var elem = document.createElement( "html:option" );
|
|
dump( "elem="+elem+"\n" );
|
|
|
|
elem.id =iname;
|
|
dump ("elem id="+elem.id+"\n");
|
|
|
|
var text = document.createTextNode( oname );
|
|
dump( "text="+text+"\n" );
|
|
|
|
var rc = elem.appendChild( text );
|
|
dump( "rc="+rc+"\n" );
|
|
|
|
var newsel = sel.appendChild( elem );
|
|
dump( "newsel="+newsel+"\n" );
|
|
}
|
|
|
|
</html:script>
|
|
|
|
|
|
<html:br/>
|
|
<html:input type="radio" name="dun" id="dun1" value="lan"/>LAN
|
|
<html:input type="radio" name="dun" id="dun2" value="modem"/>Modem<html:br/><html:br/>
|
|
|
|
<html:select id="x">
|
|
<html:option></html:option>
|
|
</html:select>
|
|
|
|
<html:select id="y">
|
|
<html:option></html:option>
|
|
</html:select>
|
|
<html:br/>
|
|
|
|
<button value="Create Account" class="push" />
|
|
|
|
|
|
</html:div>
|
|
</window>
|