123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- 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 = '<input type=Checkbox name=infoid value=' + sValue + ' checked>';
- 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 = '<a href=javascript:changeToResInst()>��������Դ����</a>';
- 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 = '<a href="javascript:addNodeToOption()" >' + nodeName
- + '</a>';
- 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("<input type=hidden name=usr value = " + usr + ">")
- }
- 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<document.addAuth.authList.options.length; i++) {
- // document.addAuth.authList.options[i].selected=true;
- // }
- addAuth.submit();
- }
- function checkall() {
- var flag = document.getElementById("checkFlag");
- var temp = document.getElementById("checkText");
- for (var i = 0; i < document.addAuth.length; i++) {
- e = document.addAuth.item(i);
- if (e.name == "infoid") {
- if (flag.checked == true) {
- temp.innerText = "ѡ������";
- e.checked = true;
- } else {
- temp.innerText = "ѡ������";
- e.checked = false;
- }
- }
- }
- }
|