varga%netscape.com 580d35b1c4 Landing SQL support. Bug 81653.
Not part of build.
a=brendan


git-svn-id: svn://10.0.0.236/trunk@136605 18797224-902f-48f8-a5cc-f745e15eee43
2003-01-18 19:14:51 +00:00

37 lines
1.1 KiB
JavaScript

var sqlService = null;
function getSqlService() {
if (! sqlService)
sqlService = Components.classes["@mozilla.org/sql/service;1"]
.getService(Components.interfaces.mozISqlService);
return sqlService;
}
function getSelectedAlias() {
var tree = document.getElementById("aliasesTree");
return tree.builderView.getResourceAtIndex(tree.currentIndex).Value;
}
function updateButtons() {
var tree = document.getElementById("aliasesTree");
const buttons = ["updateButton", "removeButton"];
for (i = 0; i < buttons.length; i++)
document.getElementById(buttons[i]).disabled = tree.currentIndex < 0;
}
function addAlias() {
window.openDialog("aliasDialog.xul", "addAlias", "chrome,modal=yes,resizable=no,centerscreen");
}
function updateAlias() {
var alias = getSelectedAlias();
window.openDialog("aliasDialog.xul", "updateDatabase", "chrome,modal=yes,resizable=no,centerscreen", alias);
}
function removeAlias() {
var sqlService = getSqlService();
var alias = getSelectedAlias();
sqlkService.removeAlias(alias);
updateButtons();
}