function addOption(sText, sValue) {
var def = false;
var sel = false;
var hasValue = false;
for (var i = 0; i < document.addAuth.authList.options.length; i++) {
if (document.addAuth.authList.options[i].value == sValue) {
hasValue = true;
alert("�����Ѿ����");
break;
}
}
if (!hasValue) {
var ilength = document.addAuth.authList.length;
var optionName = new Option(sText, sValue, def, sel);
document.addAuth.authList.options[ilength] = optionName;
document.addAuth.authList.options[ilength].selected = false;
}
}
function addToOption(td1Text, td2Text, td3Text, sValue) {
if (checkIfExist(sValue)) {
alert("�����Ѿ����");
return;
}
var al = document.getElementById("authLists");
var newLine = al.insertRow();
al.className = 'listrow';
var cb = '';
addNewCell(newLine, cb);
addNewCell(newLine, '');
addNewCell(newLine, td1Text);
addNewCell(newLine, '');
addNewCell(newLine, td2Text);
addNewCell(newLine, '');
addNewCell(newLine, td3Text);
var newLine2 = al.insertRow();
addLineCell(newLine2);
}
function checkIfExist(cname) {
for (i = 0; i < document.addAuth.elements.length; i++) {
if (document.addAuth.elements[i].value == cname) {
return true;
}
}
return false;
}
function addNewCell(trLine, tdText) {
var newCell = trLine.insertCell();
newCell.innerHTML = tdText;
}
function addLineCell(trLine, tdText) {
var newCell = trLine.insertCell();
newCell.className = 'listline';
newCell.height = 1;
newCell.colSpan = 7;
}
function addNodeToOption() {
var sText = document.addAuth.city.value
+ getSpace(document.addAuth.city.value, 20) + "����"
+ getSpace("����", 23) + "����";
// addOption(sText,document.addAuth.cityCode.value + '*ALL*ALL');
addToOption(document.addAuth.city.value, '����', '����',
document.addAuth.cityCode.value + '*ALL*ALL');
}
function addResTypeToOption(resTypeCode, resTypeName) {
if (document.addAuth.city.value != null
&& document.addAuth.city.value != "") {
var sText = document.addAuth.city.value
+ getSpace(document.addAuth.city.value, 20)
+ replaceToSpace(resTypeName) + getSpace(resTypeName, 23)
+ "����";
// addOption(sText,document.addAuth.cityCode.value + '*' + resTypeCode +
// '*ALL');
addToOption(document.addAuth.city.value, replaceToSpace(resTypeName),
'����', document.addAuth.cityCode.value + '*' + resTypeCode
+ '*ALL');
} else
alert("��ѡ��ڵ�");
}
function addResInstToOption(resInstID, resInstName) {
for (var i = 0; i < document.addAuth.resSubType.options.length; i++) {
if (document.addAuth.resSubType.options[i].selected) {
var tempText = document.addAuth.resSubType.options[i].text;
break;
}
}
var sText = document.addAuth.city.value
+ getSpace(document.addAuth.city.value, 20) + tempText
+ getSpace(document.addAuth.resSubType.value, 21)
+ replaceToSpace(resInstName);
// addOption(sText,document.addAuth.cityCode.value + '*' +
// document.addAuth.resSubType.value + '*' + resInstID);
addToOption(document.addAuth.city.value, tempText,
replaceToSpace(resInstName), document.addAuth.cityCode.value + '*'
+ document.addAuth.resSubType.value + '*' + resInstID);
}
function replaceToSpace(str) {
while (str.indexOf('$') != -1) {
str = str.replace('$', " ");
}
return str;
}
function addViewPreCheckToAuthList(nodeName, resType, resInst, auth) {
var sText = nodeName + getSpace(nodeName, 20) + resType
+ getSpace(resType, 23) + resInst;
// addOption(sText,auth);
addToOption(nodeName, resType, resInst, auth);
}
function addToAuthList(nodeName, fatherNodeName, isLeaf, nodeCode) {
if (document.addAuth.city.value == '-1') {
isLeaf = isLeaf == 1 ? '��' : '��';
addToOption(nodeName, fatherNodeName, isLeaf, nodeCode);
} else {
if (isLeaf == '1') {
resInst.innerHTML = '��������Դ����';
if (document.addAuth.city.value != nodeName) {
resList.innerHTML = '';
document.addAuth.resType.options[0].selected = true;
document.addAuth.resSubType.options[0].selected = true;
}
} else {
resInst.innerHTML = '';
changeToResType();
}
city.innerHTML = '' + nodeName
+ '';
document.addAuth.city.value = nodeName;
document.addAuth.cityCode.value = nodeCode;
}
}
function addPreCheckToAuthList(nodeName, resType, resInst, auth) {
var sText = nodeName + getSpace(nodeName, 10) + resType
+ getSpace(resType, 10) + resInst;
// addOption(sText,auth);
addToOption(nodeName, resType, resInst, auth);
}
function getSpace(firstWord, distance) {
var spaceStr = "";
var singleCharacters = 0;
var doubleCharacters = 0;
for (var i = 0; i < firstWord.length; i++) {
var temp = firstWord.charAt(i);
if ((temp > "0" && temp < "9") || (temp > "a" && temp < "z")
|| (temp > "A" && temp < "Z") || (temp == "_")) {
singleCharacters++;
spaceStr += " ";
}
if (temp == " ")
spaceStr += " ";
}
for (var i = 0; i < distance - firstWord.length - singleCharacters; i++) {
spaceStr += " ";
}
if (firstWord.length > 6 && singleCharacters <= 4)
spaceStr += " ";
// if(doubleCharacters.length >= 6 || singleCharacters > 8)
// spaceStr += " ";
return spaceStr;
}
function deleteOptions() {
for (var i = 0; i < document.addAuth.authList.options.length; i++) {
if (document.addAuth.authList.options[i].selected) {
document.addAuth.authList.options[i] = null;
i--;
}
}
}
function setUser(usr) {
document.write("")
}
function doubleSelectItem(resClassName, resClassCode, resTypeName, resTypeCode) {
this.resClassName = resClassName;
this.resClassCode = resClassCode;
this.resTypeName = resTypeName;
this.resTypeCode = resTypeCode;
}
function selectChanged() {
with (document.addAuth.resType) {
var resClassSelected = options[selectedIndex].text;
}
for (i = 0; i < resTypeList.length; i++) {
if (resTypeList[i].resClassName == resClassSelected) {
resTypeNames = (resTypeList[i].resTypeName).split("|");
resTypeCodes = (resTypeList[i].resTypeCode).split("|");
for (j = 0; j < resTypeNames.length; j++) {
with (document.addAuth.resSubType) {
length = resTypeNames.length;
options[j].text = resTypeNames[j];
options[j].value = resTypeCodes[j];
}
}
break;
}
}
document.addAuth.resSubType.options[0].selected = true;
}
function loadResDetail() {
with (document.addAuth.resType) {
var resClassSelected = options[selectedIndex].value;
}
// if (this.res.style.display != 'block'){
// this.res.style.display = "block";
document.frames["hiddenframe"].location.replace(resClassSelected
+ "List.jsp?nodeCode=" + document.addAuth.cityCode.value
+ "&resSubType=" + document.addAuth.resSubType.value);
// }
}
function addAll() {
// for (i=0; i