/********************************************* FORM CHECKER OBJECT CREAT *********************************************/ /*** COMMON ***/ /*** isNotEnterKey() {{{ ***/ function isNotEnterKey(event) { if (navigator.appName.indexOf("Microsoft") != -1) event = window.event; if (event.keyCode==13) { //alert('enter!'); return false; } else { return true; } } /*** }}} ***/ function changeLanguage(lang) {//{{{ // set cookie $.cookie('language', lang, {expires: 365, domain:'dnsever.com', path:'/'}); langPage = lang; if (lang == 'en') { langPage = 'www'; } return langPage; }//}}} function selectLanguage(lang, parameter) {//{{{ var langPage = changeLanguage(lang); // redirect url = "https://%s.dnsever.com"; url = url.replace('%s', langPage); if (parameter) { url += parameter; } document.location.href = url; }//}}} /*** selectDomain() {{{ ***/ /********************************************* * when changed domain select box , set 'viewzone' to selected_menu *********************************************/ function selectDomain() { setSelectedMenu('viewzone'); var thisForm = document.form; var skey = thisForm.skey.value; var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; goURL = "/start.html?user_domain=" + userDomain + "&selected_menu=viewzone&dig_again=1" + "&skey=" + skey; document.location.href = goURL; return; } /*** }}} ***/ /*** selectDomainInList() {{{ ***/ /********************************************* * check body/show_domain_list.html *********************************************/ function selectDomainInList(domain) { setSelectedMenu('viewzone'); var thisForm = document.form; var skey = thisForm.skey.value; goURL = "/start.html?user_domain=" + domain + "&selected_menu=viewzone&dig_again=1" + "&skey=" + skey; document.location.href = goURL; return; } /*** }}} ***/ /*** setSelectedMenu() {{{ ***/ /********************************************* * set menuStr to selected_menu * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function setSelectedMenu(menuStr) { document.form.selected_menu.value = menuStr; } /*** }}} ***/ /*** goServiceMenu() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goServiceMenu(selectedMenu) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; goURL = "/myservice.html?selected_menu=" + selectedMenu + "&skey=" + skey; document.location.href = goURL; return; //return true; } /*** }}} ***/ /*** goServiceMenuWithArgument() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goServiceMenuWithArgument(selectedMenu, subArgument) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; if (thisForm.user_domain) { var selectedIndex = thisForm.user_domain.selectedIndex; } goURL = "/myservice.html?&selected_menu=" + selectedMenu + "&skey=" + skey + subArgument; document.location.href = goURL; return true; } /*** }}} ***/ /*** goMenu() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goMenu(selectedMenu) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; if (thisForm.user_domain) { var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; } else { var userDomain = ''; } if (selectedMenu == 'addzone' || selectedMenu == 'addptrzone' || selectedMenu == 'addsubzone' || selectedMenu == 'home' || selectedMenu == 'showdomainlist') userDomain = ''; goURL = "/start.html?user_domain=" + userDomain + "&selected_menu=" + selectedMenu + "&skey=" + skey; document.location.href = goURL; return; //return true; } /*** }}} ***/ /*** goMenuWithZone() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goMenuWithZone(selectedMenu, zone) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; goURL = "/start.html?user_domain=" + zone + "&selected_menu=" + selectedMenu + "&skey=" + skey; document.location.href = goURL; return true; } /*** }}} ***/ /*** goMenuWithArgument() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goMenuWithArgument(selectedMenu, subArgument) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; if (thisForm.user_domain) { var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; } else { var userDomain = ''; } goURL = "/start.html?user_domain=" + userDomain + "&selected_menu=" + selectedMenu + "&skey=" + skey + subArgument; document.location.href = goURL; return true; } /*** }}} ***/ /*** goRegister() {{{ ***/ /********************************************* * go menu *********************************************/ function goRegister() { var thisForm = document.form; for (var i=0; i < thisForm.pref_language.length; i++) { if (thisForm.pref_language[i].checked) { var lang = thisForm.pref_language[i].value; } } if (lang == null || lang == "") { alert(LANG['EmptyLanguage']); return false; } var langPage = changeLanguage(lang); url = "https://%s.dnsever.com/index.html?selected_menu=registeremail"; url = url.replace('%s', langPage); document.location.href = url; } /*** }}} ***/ /*** goRegisterAgree() {{{ ***/ /********************************************* * go menu *********************************************/ function goRegisterAgree() { var thisForm = document.form; for (var i=0; i < thisForm.pref_language.length; i++) { if (thisForm.pref_language[i].checked) { var lang = thisForm.pref_language[i].value; } } if (lang == null || lang == "") { alert(LANG['EmptyLanguage']); return false; } var langPage = changeLanguage(lang); url = "https://%s.dnsever.com/index.html?selected_menu=registeragree"; url = url.replace('%s', langPage); document.location.href = url; } /*** }}} ***/ /*** goLoginPage() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goLoginPage() { // clear cookie $.cookie('PHPSESSID', null, {domain:'dnsever.com', path:'/'}); goURL = "/index.html"; document.location.href = goURL; return; } /*** }}} ***/ /*** goIndexMenu() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goIndexMenu(selectedMenu) { var thisForm = document.form; var lang = thisForm.lang.value; goURL = "/index.html?selected_menu=" + selectedMenu; document.location.href = goURL; return; } /*** }}} ***/ /*** goIndexMenuWithArgument() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx * @param string subArgument ex) &name=micheol&id=xman , must need & *********************************************/ function goIndexMenuWithArgument(selectedMenu, subArgument) { var thisForm = document.form; var lang = thisForm.lang.value; goURL = "/index.html?selected_menu=" + selectedMenu + subArgument; document.location.href = goURL; return; } /*** }}} ***/ /*** goIndexMenuWithArgument_check() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx * @param string subArgument ex) &name=micheol&id=xman , must need & *********************************************/ function goIndexMenuWithArgument_check(selectedMenu, subArgument) { var thisForm = document.form; var lang = thisForm.lang.value; var isAgree = (($('#chk_privacy_protect3:checked').val() == 'on') && $('#chk_privacy_protect1:checked').val() == 'on') ; if (isAgree) { goURL = "/index.html?selected_menu=" + selectedMenu + subArgument; document.location.href = goURL; return; } else { alert(LANG['NotAgreeTerms']); return; } } /*** }}} ***/ /*** goMyInfoMenu() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goMyInfoMenu(selectedMenu) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; goURL = "/myinfo.html?selected_menu=" + selectedMenu + "&skey=" + skey; document.location.href = goURL; return; } /*** }}} ***/ /*** goCommonMenu() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ function goCommonMenu(selectedMenu) { var thisForm = document.form; var skey = thisForm.skey.value; var lang = thisForm.lang.value; if (thisForm.user_domain) { var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; } else { var userDomain = ''; } if (selectedMenu == 'addzone' || selectedMenu == 'addptrzone' || selectedMenu == 'addsubzone' || selectedMenu == 'home') userDomain = ''; var action = $('form').attr('action'); if ( action.match('myinfo.html$') == 'myinfo.html' || action.match('myservice.html$') == 'myservice.html' || action.match('partner/egloos') == 'partner/egloos' ) { action = '/index.html'; } if (location.pathname.match(/charge.html|bill.html/)) { action = '/index.html'; } goURL = action + "?user_domain=" + userDomain + "&selected_menu=" + selectedMenu + "&skey=" + skey; document.location.href = goURL; return; //return true; } /*** }}} ***/ /*** setCommand() {{{ ***/ /********************************************* @param string command ex)change_a, add_a, delete_a *********************************************/ function setCommand(command) { var thisForm = document.forms[0]; if (command == null) { return false; } thisForm.command.value = command; return true; } /*** }}} ***/ /*** isSelectedCheckBox() {{{ ***/ function isSelectedCheckBox(checkBoxName) { var checkBox = document.forms[0].elements[checkBoxName]; var length = checkBox.length; var checkNumber = 0; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) checkNumber++; } if (checkNumber == 0) return false; else return true; } /*** }}} ***/ /*** isSelectedRadioButton() {{{ ***/ function isSelectedRadioButton(radioButtonName) { radioButton = document.form.elements[radioButtonName]; var length = radioButton.length; if (!length) { return radioButton.checked; } else { for (var i = 0; i < length; i++) { if(radioButton[i].checked == true) { return true; } } } return false; } /*** }}} ***/ /*** openHelpWindow() {{{ ***/ /********************************************* * open help window * *********************************************/ var helpWindow = null; function openHelpWindow(pageURL) { if (helpWindow != null) { helpWindow.close(); } helpWindow = window.open(pageURL, "dnseverhelp"); helpWindow.focus(); } /*** }}} ***/ /*** openBoardWindow() {{{ ***/ /********************************************* * open help window * *********************************************/ var boardWindow = null; function openBoardWindow(pageURL) { var windowWidth = 800; var windowHeight = 600; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (boardWindow != null) { boardWindow.close(); } boardWindow = window.open(pageURL, "dnseverboard", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=yes, status=no, scrollbars=yes"); boardWindow.focus(); } /*** }}} ***/ /*** openConfirmWindow() {{{ ***/ /********************************************* * open confirm window * *********************************************/ var confirmWindow = null; function openConfirmWindow(thisForm) { var windowWidth = 570; var windowHeight = 430; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (confirmWindow != null) { confirmWindow.close(); } var command = document.forms[0].command.value; confirmWindow = window.open("/confirm.html?command="+command, "confirmWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); confirmWindow.focus(); } /*** }}} ***/ /*** openBillInfoWindow() {{{ ***/ /********************************************* * open confirm window * *********************************************/ var billInfoWindow = null; function openBillInfoWindow(id) { var windowWidth = 915; var windowHeight = 530; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (billInfoWindow != null) { billInfoWindow.close(); } confirmWindow = window.open("/bill_info.html?order_id=" + id, "billInfo", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); confirmWindow.focus(); } /*** }}} ***/ /*** createBillInfo() {{{ ***/ /********************************************* * create bill info * *********************************************/ function createBillInfo(orderId) { var result =true; var thisForm = document.forms[0]; result = check_company_form(thisForm); if(!result) { return false; } var requestData = { orderId: orderId, companyName: $('input[name=companyName]').val(), registrationNumberLeft: $('input[name=registration_number_left]').val(), registrationNumberMiddle: $('input[name=registration_number_middle]').val(), registrationNumberRight: $('input[name=registration_number_right]').val(), representative: $('input[name=representative]').val(), companyLocation: $('input[name=company_location]').val(), companyType: $('input[name=company_type]').val(), companyCategory: $('input[name=company_category]').val(), companyContact1Name: $('input[name=contact1_name]').val(), companyContact1Email: $('input[name=contact1_email]').val(), companyContact1Phone: $('input[name=contact1_phone]').val(), companyContact2Name: $('input[name=contact2_name]').val(), companyContact2Email: $('input[name=contact2_email]').val(), companyContact2Phone: $('input[name=contact2_phone]').val(), companyUpdate: $('#company_update:checked').val() }; var request = $.ajax({ url: "/ajax/create_tax_invoice.php", type: "POST", data: requestData }); request.always(function(msg) { if (msg == 'true') { $('#billTaxForm').detach(); $('#billBtnArea').detach(); $('.billTaxChecker.form tr').each(function() { if ($(this).hasClass('billTaxCheckerHead') != true) { $(this).detach(); } }); $('#taxInvoiceMessage').html(LANG['tax_invoice_begin'] + ''); } }); } /*** }}} ***/ /*** submitChangeBill() {{{ ***/ function submitChangeBill(id) { var thisForm = document.forms[0]; var result =true; result = check_company_form(thisForm); if(!result) { return false; } if (confirm(LANG['save_confirm'])) { thisForm.command.value = "billinfo"; thisForm.selected_menu.value = "billinfo"; thisForm.action.value = "change_bill"; thisForm.id.value = id; thisForm.submit(); return; } else { return false; } } /*** }}} ***/ /*** destroyOrder() {{{ ***/ function destroyOrder(id) { if (confirm(LANG['cancel_confirm'])) { var request = $.ajax({ url: "/ajax/cancel_order.php", type: "POST", data: { orderId: $('#orderId').val() } }); request.always(function() { goServiceMenu('showpayment'); }); } } /*** }}} ***/ /*** destroyOrderForAdmin() {{{ ***/ function destroyOrderForAdmin(id) { if (confirm(LANG['cancel_card_confirm'])) { var request = $.ajax({ url: "/ajax/cancel_order.php", type: "POST", data: { admin: 1, orderId: $('#orderId').val(), customerId: $('#customerId').val() } }); request.always(function() { window.location.reload(); }); } } /*** }}} ***/ /*** openConfirmWindow_old() XXX {{{ ***/ /********************************************* * open confirm window * *********************************************/ var confirmWindow = null; function openConfirmWindow_old() { var windowWidth = 500; var windowHeight = 350; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (confirmWindow != null) { confirmWindow.close(); } confirmWindow = window.open("/confirm.html", "confirmWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); confirmWindow.focus(); } /*** }}} ***/ /*** openPaymentWindow() ***///{{{ var paymentWindow = null; function openPaymentWindow(domain) { var windowWidth = 570; var windowHeight = 530; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (paymentWindow != null) { paymentWindow.close(); } var command = document.form.command.value; paymentWindow = window.open("/payment.html?domain="+domain, "paymentWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); paymentWindow.focus(); }//}}} /*** openTaxInvoiceWindow() {{{ ***/ var taxInvoiceWindow = null; function openTaxInvoiceWindow(orderId) { var windowWidth = 800; var windowHeight = 535; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (taxInvoiceWindow != null) { taxInvoiceWindow.close(); } var command = document.form.command.value; taxInvoiceWindow = window.open("/request_tax_invoice.html?order_id="+orderId, "taxInvoiceWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); taxInvoiceWindow.focus(); } /*** }}} ***/ /*** openCheckSubDomainWindow() {{{ ***/ /********************************************* * open confirm window * *********************************************/ var checkSubDomain = null; function openCheckSubDomain(command) { var thisForm = document.form; result = eval('check_'+command+'_form(thisForm)'); if (result == false) return false; //SET COMMAND setCommand(command); var windowWidth = 400; var windowHeight = 300; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (checkSubDomain != null) { checkSubDomain.close(); } //var command = document.form.command.value; var userID = document.form.user_id.value; var subDomain = document.form.new_sub_domain.value; var zone = document.form.zone.value; checkSubDomain = window.open("/check_sub_domain.html?command="+command+"&user_id="+userID +"&new_sub_domain="+subDomain+"&zone="+zone, "checkSubDomain", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=yes, status=no, scrollbars=no"); checkSubDomain.focus(); } /*** }}} ***/ /*** openIDTestWindow() {{{ ***/ /********************************************* * open IDTest window * *********************************************/ var IDTestWindow = null; function openIDTestWindow() { var thisForm = document.form; var newID = thisForm.user_id.value; var windowWidth = 300; var windowHeight = 200; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (IDTestWindow != null) { IDTestWindow.close(); } /*** Form Checking ID ***/ var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(newID); if (res == true) { alert(LANG['EmptyID']); thisForm.user_id.focus(); return false; } IDTestWindow = window.open("/id_test.html?id=" + newID, "IDTestWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=no"); IDTestWindow.focus(); } /*** }}} ***/ /*** openPunycodeWindow() {{{ ***/ /********************************************* * open punycode window * *********************************************/ var punycodeWindow = null; function openPunycodeWindow() { var thisForm = document.form; //var newZone = thisForm.new_zone.value; //var newID = thisForm.user_id.value; var windowWidth = 300; var windowHeight = 200; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (punycodeWindow != null) { punycodeWindow.close(); } //?new_zone=" + newZone, punycodeWindow = window.open("/punycode.html", "punycodeWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=no"); punycodeWindow.focus(); } /*** }}} ***/ /*** openViewBillWindow() {{{ ***/ /********************************************* * open punycode window * *********************************************/ var pointUsedListPopupWindow = null; function openPointUsedListWindow() { var thisForm = document.form; var windowWidth = 1000; var windowHeight = 500; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (pointUsedListPopupWindow != null) { pointUsedListPopupWindow.close(); } var url = "/point_popup.html"; var instantKey = $('input[name=instantKey]').val(); if (instantKey) { url += '&instantKey=' + instantKey; } pointUsedListPopupWindow = window.open(url, "pointUsedListPopupWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); pointUsedListPopupWindow.focus(); } /*** }}} ***/ /*** openStanadardBillWindow() {{{ ***/ /********************************************* * open punycode window * *********************************************/ var standardBillPopupWindow = null; function openStandardBillWindow(billNumber) { var thisForm = document.form; var windowWidth = 1000; var windowHeight = 500; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (standardBillPopupWindow != null) { standardBillPopupWindow.close(); } var url = "/standard_popup.html?billNumber=" + billNumber; var instantKey = $('input[name=instantKey]').val(); if (instantKey) { url += '&instantKey=' + instantKey; } standardBillPopupWindow = window.open(url, "standardBillPopupWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); standardBillPopupWindow.focus(); } /*** }}} ***/ /*** openFindPostNumberWindow() {{{ ***/ /********************************************* * open FindPostNumber window * *********************************************/ var FindPostNumberWindow = null; function openFindPostNumberWindow() { var windowWidth = 500; var windowHeight = 250; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (FindPostNumberWindow != null) { FindPostNumberWindow.close(); } FindPostNumberWindow = window.open("/postman/search_post_number.html", "FindPostNumberWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=no"); FindPostNumberWindow.focus(); } /*** }}} ***/ /*** openWhoisWindow() {{{ ***/ /********************************************* * open IDTest window * *********************************************/ var WhoisWindow = null; function openWhoisWindow(whoisDomain) { var thisForm = document.form; var skey = thisForm.skey.value; var windowWidth = 700; var windowHeight = 600; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (WhoisWindow != null) { WhoisWindow.close(); } WhoisWindow = window.open("/whois.html?whois_domain=" + whoisDomain + "&skey=" + skey, "WhoisWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=yes, status=no, scrollbars=yes"); WhoisWindow.focus(); } /*** }}} ***/ /*** openTransferWaitWindow() {{{ ***/ /********************************************* * open IDTest window * *********************************************/ var transferWindow = null; function openTransferWaitWindow() { var windowWidth = 700; var windowHeight = 450; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (transferWindow != null) { transferWindow.close(); } var command = document.form.command.value; transferWindow = window.open("transfer_wait_popup.html", "transferWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=no"); transferWindow.focus(); } /*** }}} ***/ /*** openDomainListWindow() {{{ ***/ /********************************************* * open domain list window * *********************************************/ var domainListWindow = null; function openDomainListWindow(thisForm) { var windowWidth = 900; var windowHeight = 430; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (domainListWindow != null) { domainListWindow.close(); } domainListWindow = window.open("/domain_list.html", "domainListWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); domainListWindow.focus(); } /*** }}} ***/ /*** confirmSubmit() {{{ ***/ function confirmSubmit(command) { var thisForm = document.form; var result; if ($('#selected_menu').length > 0) { setSelectedMenu($('#selected_menu').data('selectedmenu')); } //FORM CHECK // if command is 'add_zone' // call check_add_zone_form(thisForm) function result = eval('check_'+command+'_form(thisForm)'); if (result == false) return false; //SET COMMAND if (command == 'pay_cart_item_for_subdomain') { command = 'pay_cart_item'; } setCommand(command); var isPopupNeed = checkIsPopupNeed(command, thisForm); if (isPopupNeed == true) { openConfirmWindow(); } else if(command == 'change_webforward_meta'){ thisForm.submit(); alert("변경사항에 대한 저장이 완료되었습니다."); } else { thisForm.submit(); } return true; } /*** }}} ***/ function addWebforwardingCartItem() { $('input[name=product_type]').val('web_forward'); confirmSubmit('add_bulk_cart_item'); } function payWebforwardingCartItem() { payService('web_forward'); } function addSubDomainCartItem() { $('input[name=product_type]').val('subdomain'); confirmSubmit('add_bulk_cart_item'); } function paySubDomainCartItem() { payService('subdomain'); } function addService(type) { $('input[name=product_type]').val(type); if ($('#standardType').length > 0) { if (($('#standardType').val() - $('input[name="check[]"].domain').length) > 0) { confirmSubmit('add_service'); } } else { confirmSubmit('add_bulk_cart_item'); } } function addServiceForServicePage(type) { $('input[name=product_type]').val(type); if ($('#standardType').length > 0) { if (($('#standardType').val() - $('input[name="check[]"].domain').length) > 0) { form.action = 'start.html'; confirmSubmit('add_service'); } } else { form.action = 'start.html'; confirmSubmit('add_bulk_cart_item'); } } function payService(type) { $('input[name=product_type]').val(type); confirmSubmit('pay_bulk_cart_item'); } /*** goChangeMetatag() {{{ ***/ var WFMetaTagWindow = null; function goChangeMetatag(num) { var windowWidth = 660; var windowHeight = 700; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (WFMetaTagWindow != null) { WFMetaTagWindow.close(); } WFMetaTagWindow = window.open("WF/edit_WF_meta.html?num="+num, "ddnsactive", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=yes, status=no, scrollbars=yes"); WFMetaTagWindow.focus(); } /*** }}} ***/ function checkIsPopupNeed(command, thisForm) {//{{{ if ( command == "add_a" || command == "add_webforward" || command == "add_cname" || command == "add_webparking" ) { var existWWW = thisForm.exist_www.value; var existNonWWW = thisForm.exist_non_www.value; if (command == 'add_cname') { var subDomain = thisForm.alias.value; thisForm.alias.value = thisForm.alias.value.toLowerCase(); } else { var subDomain = thisForm.subname.value; thisForm.subname.value = thisForm.subname.value.toLowerCase(); } if ((existWWW == 'n' && existNonWWW == 'n') && (trim(subDomain) == '' || trim(subDomain) == 'www')) { return true; } else { return false; } } else if ( command == "add_ptr_cname" || command == "add_ptr" || command == "add_mx" || command == "add_mailforward" || command == "add_txt" || command == "add_srv" || command == "add_aaaa" || command == "add_ns" || command == "add_multiple_record" || command == "pay_direct_webforward" || command == "add_bulk_cart_item" || command == "add_cart_item" || command == "del_cart_item" || command == "del_cart_dns" || command == "pay_cart_item" || command == "pay_cart_item_for_subdomain" || command == "pay_bulk_cart_item" || command == "cart" || command == "paymentbegin" || command == "change_webforward_meta" || command == "paymentaddquery" || command == "confirmemail" || command == "skipemail" || command == "paymentbill" || command == "delete_paymethod" || command == "change_primary" || command == "add_zone_check_payment" || command == "add_zone_choose_service" || command == "add_service" || command == "purchase_secure_domain" ) { return false; } else { return true; } }//}}} /*** checkAllForShowDomain() {{{ ***/ function checkAllForShowDomain(withNext, check) { var checkbox = document.form.elements['check[]']; var length = checkbox.length; var checkValue; if (checkbox[0].checked == true) { checkValue = true; } else { checkValue = false; } for (i = 1; i < length; i++) { if (checkbox[i].disabled == true) { continue; } checkbox[i].checked = checkValue; if ($(checkbox[i]).parent().attr('rowspan') == 3) { checkedColorRow(checkbox[i], 3); } else if ($(checkbox[i]).parent().attr('rowspan') == 2) { checkedColorRow(checkbox[i], true); } else { checkedColorRow(checkbox[i], false); } } // $(checkbox[length-1].parentNode.parentNode).next().removeClass('check) } /*** }}} ***/ /*** checkAll() {{{ ***/ function checkAll(withNext) { var checkbox = document.form.elements['check[]']; var length = checkbox.length; var checkValue; if (checkbox[0].checked == true) { checkValue = true; } else { checkValue = false; } for (i = 1; i < length; i++) { if (checkbox[i].disabled == true) continue; checkbox[i].checked = checkValue; checkedColorRow(checkbox[i], withNext); } } /*** }}} ***/ /*** checkedColorRow() {{{ ***/ function checkedColorRow(pTarget, withNext) { var pTR = pTarget.parentNode.parentNode; if(pTR.nodeName.toLowerCase() != 'tr') { return; } var newClassName = 'checkedtr'; if(pTarget.checked == true) { $(pTR).addClass(newClassName); if (withNext == true) { $(pTR).next().addClass(newClassName); } else if (withNext == 3) { $(pTR).next().addClass(newClassName); $(pTR).next().next().addClass(newClassName); } } else { $(pTR).removeClass(newClassName); if (withNext == true) { $(pTR).next().removeClass(newClassName); } else if (withNext == 3) { $(pTR).next().removeClass(newClassName); $(pTR).next().next().removeClass(newClassName); } } } /*** }}} ***/ function changeColorRow(pTR, withNext, value) { var pTarget = $(pTR).find('[type="checkbox"][name="check[]"]'); var newClassName = 'checkedtr' if ($(pTR).prop('tagName').toLowerCase() != 'tr') { return; } if (value == 'on') { $(pTarget).prop('checked','checked'); $(pTR).css("background-color",""); $(pTR).addClass(newClassName); if (withNext == true) { $(pTR).next().addClass(newClassName); } if (withNext == "prev") { $(pTR).prev().addClass(newClassName); } } else { $(pTarget).prop("checked",""); $(pTR).removeClass(newClassName); if (withNext == true) { $(pTR).next().removeClass(newClassName); } if (withNext == "prev") { $(pTR).prev().removeClass(newClassName); } } } /*** checkedColorRowDDNS() {{{ ***/ function checkedColorRowDDNS (num, pTarget, withNext) { var selector = '.'+$(pTarget).data('host').toString().replace(/\./g, '\\.').replace(/\@/g, '\\@'); var pTR = $(selector).parent().parent(); var oldnoteNum = 'old_note_' + num; var oldnote = $('#' + oldnoteNum); var check = 0; var value = $(pTarget).prop('checked'); var checkboxes = $(selector); checkboxes.each(function() { $(this).prop('checked', value); }); check = $(pTR.find('[type="checkbox"][name="use_ddns_' + num + '"]:checked')).length; if (($(oldnote).val() == 'DDNS' && check == 0) || ($(oldnote).val() == 'A' && check == 1)) { changeColorRow(pTR, withNext, 'on'); } else { changeColorRow(pTR, withNext, 'off'); } } /*** checkedColorRowCheckbox() {{{ ***/ function checkedColorRowCheckbox (num,pTarget, withNext) { var pTR = pTarget.parentNode.parentNode; var oldIPNum = 'old_ip_' + num; var oldIP = $('#' + oldIPNum); var oldMemo = $('#' + 'old_memo_' + num); if ($(oldIP).val() != $('#ip_'+num).val() || $(oldMemo).val() != $('#memo_'+num).val() ) { changeColorRow(pTR, withNext, 'on'); } else { changeColorRow(pTR, withNext, 'off'); } } /*** checkedColorRowText() {{{ ***/ function checkedColorRowText (num,pTarget, withNext) { var pTR = pTarget.parentNode.parentNode; var oldIPNum = 'old_ip_' + num; var oldIP = $('#' + oldIPNum); var oldMemo = $('#' + 'old_memo_' + num); if ($(oldIP).val() != $('#ip_'+num).val() || $(oldMemo).val() != $('#memo_'+num).val() ) { changeColorRow(pTR, withNext, 'on'); } else { changeColorRow(pTR, withNext, 'off'); } } /*** }}} ***/ /*** checkedColorRowForWF() {{{ ***/ function checkedColorRowForWF (num,pTarget, withNext) { var pTR = pTarget.parentNode.parentNode; var urlnum = 'old_to_url_' + num; var oldurl = $('#' + urlnum); var oldtitle = $('#' + 'old_forward_title_' + num); var check = ($('#cloaked_check_'+num).prop('checked')) ? 't' : 'f'; var newClassName = 'checkedtr'; if (pTR.nodeName.toLowerCase() != 'tr') { return; } pTarget = $('#check_'+num); if ($(oldurl).val() != $('#to_url_'+num).val() || $(oldtitle).val() != $('#forward_title_'+num).val() || check != $('#old_cloaked_check_'+num).val() ) { $(pTR).addClass(newClassName); if (withNext == true) { $(pTR).next().addClass(newClassName); $(pTarget).prop('checked','checked'); } if (withNext == "prev") { $(pTR).prev().addClass(newClassName); $(pTarget).prop('checked','checked'); } } else { $(pTarget).prop("checked",""); $(pTR).removeClass(newClassName); if (withNext == true) { $(pTR).next().removeClass(newClassName); } if (withNext == "prev") { $(pTR).prev().removeClass(newClassName); } } } /*** }}} ***/ /*** checkedColorRowForWP() {{{ ***/ function checkedColorRowForWP (num, pTarget, withNext) { if (pTarget.type == 'radio') { var pTR = pTarget.parentNode.parentNode.parentNode; } else { var pTR = pTarget.parentNode.parentNode; } var oldmail = 'old_master_email_' + num; var oldemail = $('#' + oldmail); var check = ($('#show_email_check_'+num).prop('checked')) ? 't' : 'f'; var parking = ($('#old_parking_check_'+num)); if ($(oldemail).val() != $('#master_email_'+num).val() || $(parking).val() != $('input[name=parking_check_'+num+']:radio:checked').val() || check != $('#old_show_email_check_'+num).val() ) { changeColorRow(pTR, withNext, 'on'); } else { changeColorRow(pTR, withNext, 'off'); } } /*** }}} ***/ /*** checkedColorRowForTTL() {{{ ***/ function checkedColorRowForTTL (num,pTarget, withNext) { var pTR = pTarget.parentNode.parentNode; var oldttl = ($('#old_ttl_'+num)); var newClassName = 'checkedtr'; if (pTR.nodeName.toLowerCase() != 'tr') { return; } pTarget = $('#check_'+num); if ($(oldttl).val() != $('select[name=ttl_'+num+']').val()) { $(pTR).addClass(newClassName); if (withNext == true) { $(pTR).next().addClass(newClassName); } if (withNext == "prev") { $(pTR).prev().addClass(newClassName); } $(pTarget).prop('checked','checked'); } else { $(pTarget).prop("checked",""); $(pTR).removeClass(newClassName); if (withNext == true) { $(pTR).next().removeClass(newClassName); } if (withNext == "prev") { $(pTR).prev().removeClass(newClassName); } } } /*** }}} ***/ /*** checkAllNamed(target) {{{ ***/ function checkAllNamed(target) { var $table = $('#' + target); var checkValue = $table.find('#checkAll:checked').val(); var items = $table.find("input[type='checkbox']:enabled"); if (checkValue == 'check_all') { items.parent().parent().addClass('checkedtr'); items.prop("checked", true); } else { items.parent().parent().removeClass('checkedtr'); items.prop("checked", false); } } /*** }}} ***/ /*** changeInputCnameList(form) {{{ ***/ function changeInputCnameList(form) { if(form.cname_list.value != "direct") { form.direct_cname.value = form.cname_list.value; // form.direct_cname.style.display = "none"; document.getElementById( "direct_cname_div" ).style.display = "none"; } else { form.direct_cname.value = ""; //form.direct_cname.style.display = "inline"; document.getElementById( "direct_cname_div" ).style.display = "inline"; } } /*** }}} ***/ /*** directInputCNAME() {{{ ***/ function directInputCNAME() { var cname = document.form.cname.value; var windowWidth = 300; var windowHeight = 200; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (cname == "direct") window.open("/direct_input.html?type=cname","directInput","width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top ); } /*** }}} ***/ /*** showMailForwardMsg() {{{ ***/ function showMailForwardMsg(subArgs, type) { var windowWidth = 570; var windowHeight = 550; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (type == "false") { subArgs = encodeURI(subArgs); window.open("/confirm/show_false_mf_msg.html" + subArgs,"showFalseMsg","width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top ); } else if (type == "reject") window.open("/confirm/show_reject_mf_msg.html" + subArgs,"showRejectMsg","width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top ); } /*** }}} ***/ /*** openErrorWindow() {{{ ***/ /********************************************* * when MX, NS Record doesn't have A Record *********************************************/ var errorWindow = null; function openErrorWindow(type, hostname, record) { var windowWidth = 500; var windowHeight = 500; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (errorWindow != null) { errorWindow.close(); } errorWindow = window.open("body/error_window.html?type="+type+"&hostname="+hostname+"&record="+record, "errorWindow", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=yes, status=no, scrollbars=no"); errorWindow.focus(); } /*** }}} ***/ /*** sprintf() {{{ ***/ /********************************************* * this Function is Like PHP's printf * http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/ *********************************************/ function sprintf() { if (!arguments || arguments.length < 1 || !RegExp) { return; } var str = arguments[0]; var re = /([^%]*)%(\'.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; var a = b = [], numSubstitutions = 0, numMatches = 0; while (a = re.exec(str)) { var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4]; var pPrecision = a[5], pType = a[6], rightPart = a[7]; //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision); numMatches++; if (pType == '%') { subst = '%'; } else { numSubstitutions++; if (numSubstitutions >= arguments.length) { alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).'); } var param = arguments[numSubstitutions]; var pad = ''; if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1); else if (pPad) pad = pPad; var justifyRight = true; if (pJustify && pJustify === "-") justifyRight = false; var minLength = -1; if (pMinLength) minLength = parseInt(pMinLength); var precision = -1; if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1)); var subst = param; if (pType == 'b') subst = parseInt(param).toString(2); else if (pType == 'c') subst = String.fromCharCode(parseInt(param)); else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0; else if (pType == 'u') subst = Math.abs(param); else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param); else if (pType == 'o') subst = parseInt(param).toString(8); else if (pType == 's') subst = param; else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase(); else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase(); } str = leftpart + subst + rightPart; } return str; } /*** }}} ***/ /*** openSubDomainListWindow() {{{ ***/ /********************************************* * open confirm window * *********************************************/ var subDomainList = null; function openSubDomainListWindow() { var windowWidth = 700; var windowHeight = 350; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (subDomainList != null) { subDomainList.close(); } subDomainList = window.open("/sub_domain_list.html", "subDomainList", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=yes, status=no, scrollbars=no"); subDomainList.focus(); } /*** }}} ***/ /*** nextSubmit() {{{ ***/ function nextSubmit(command) { var thisForm = document.form; var result; var selector = command.replace(/([A-Z])/g, '_$1').toLowerCase(); // trim $(thisForm).find('input.trim').each(function(key, element) { $(element).val($.trim($(element).val())); }); $(thisForm).find('textarea.trim').each(function(key, element) { $(element).val($.trim($(element).val())); }); //FORM CHECK // if command is 'add_zone' // call check_add_zone_form(thisForm) function result = eval('check_' + selector + '_form(thisForm)'); if (result == false) return false; //SET COMMAND setCommand(command); thisForm.submit(); return true; } /*** }}} ***/ /*** goSubmit() {{{ ***/ function goSubmit(command) { var thisForm = document.form; var result; //SET COMMAND setCommand(command); thisForm.submit(); return true; } /*** }}} ***/ /*** goMenuSubmit() {{{ ***/ function goMenuSubmit(menu, command) { var thisForm = document.form; var result; //SET COMMAND setSelectedMenu(menu); setCommand(command); thisForm.submit(); return true; } /*** }}} ***/ function check_paymentaddquery_form(aForm) { setSelectedMenu('paymentaddquery'); return true; } /*** CHECK FORM : Call from confirmSubmit() ***/ /*** check_add_zone_form() {{{ ***/ function check_add_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var newZone = trim(thisForm.new_zone.value); newZone = toPuny(newZone); var res; res = formChecker.isEmpty(newZone); if (res == true) { alert(LANG['EmptyDomain']); thisForm.new_zone.focus(); return false; } res = formChecker.isZone(newZone); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_zone.focus(); return false; } if (thisForm.security_code) { res = formChecker.isEmpty(thisForm.security_code.value); if (res == true) { alert(LANG['EmptyCaptcha']); thisForm.security_code.focus(); return false; } } return true; } /*** }}} ***/ /*** CHECK FORM : Call from confirmSubmit() ***/ /*** check_add_zone_choose_service_form() {{{ ***/ function check_add_zone_choose_service_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var newZone = trim(thisForm.new_zone.value); newZone = toPuny(newZone); var res; res = formChecker.isEmpty(newZone); if (res == true) { alert(LANG['EmptyDomain']); thisForm.new_zone.focus(); return false; } res = formChecker.isZone(newZone); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_zone.focus(); return false; } if (thisForm.security_code) { res = formChecker.isEmpty(thisForm.security_code.value); if (res == true) { alert(LANG['EmptyCaptcha']); thisForm.security_code.focus(); return false; } } thisForm.selected_menu.value = 'add_zone_choose_service'; return true; } /*** }}} ***/ /*** check_add_bulk_zone_form() {{{ ***/ function check_add_bulk_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(thisForm.new_bulk_zone.value); if (res == true) { alert(LANG['EmptyDomain']); thisForm.new_bulk_zone.focus(); return false; } return true; } /*** }}} ***/ /*** check_paymentbill_form() {{{ ***/ function check_paymentbill_form(aForm) { if ($('input[type=checkbox][name=billingNumber\\[\\]]').length) { if ($('input.billingNumber:checked').length == 0) { alert("납부하실 청구서를 선택해주세요."); return false; } } var price = 0; $('input.totalPrice[type=hidden]').each(function() { price += Number($(this).val()); }); if ($('#emoney').text().replace(',','') < price) { if ($('input[name=balanceLeft]').length > 0) { alert(LANG['not_enough_balance']); } else { alert(LANG['not_enough_money']); } return false; } if ($('input[name=agree]').length) { var agree = $('input[name=agree]:checked').val(); if (!agree) { alert(LANG['not_agreed']); $('input[name=agree]').focus(); return false; } } document.form.selected_menu.value = 'paymentbill'; return true; } /*** }}} ***/ /*** check_submit_bulk_zone_chooser_service_form() {{{ ***/ function check_submit_bulk_zone_choose_service_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); if (thisForm.security_code) { res = formChecker.isEmpty(thisForm.security_code.value); if (res == true) { alert(LANG['EmptyCaptcha']); thisForm.security_code.focus(); return false; } } thisForm.selected_menu.value = 'add_zone_choose_service'; return true; } /*** }}} ***/ /*** check_submit_bulk_zone_form() {{{ ***/ function check_submit_bulk_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); if (thisForm.security_code) { res = formChecker.isEmpty(thisForm.security_code.value); if (res == true) { alert(LANG['EmptyCaptcha']); thisForm.security_code.focus(); return false; } } return true; } /*** }}} ***/ /*** check_delete_zone_form() {{{ ***/ function check_delete_zone_form(aForm) { return true; } /*** }}} ***/ /*** check_delete_bulk_zone_form() {{{ ***/ function check_delete_bulk_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteDomain']); return false; } return true; } /*** }}} ***/ /*** check_add_sub_zone_form() {{{ ***/ function check_add_sub_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var newSubDomain = trim(thisForm.new_sub_domain.value); var newZone = newSubDomain + '.' + trim(thisForm.zone.value); var res; res = formChecker.isEmpty(newSubDomain); if (res == true) { alert(LANG['EmptySubDomain']); thisForm.new_sub_domain.focus(); return false; } res = formChecker.isEmpty(thisForm.zone.value); if (res == true) { alert(LANG['ChooseDomain']); thisForm.zone.focus(); return false; } res = formChecker.isValidSubDomain(newSubDomain); if (res == true) { alert(LANG['InvalidDomain']); thisForm.new_sub_domain.focus(); return false; } res = formChecker.isDomain(newZone); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_sub_domain.focus(); return false; } return true; } /*** }}} ***/ /*** check_delete_sub_zone_form() {{{ ***/ function check_delete_sub_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteDomain']); return false; } return true; } /*** }}} ***/ /*** check_add_a_form() {{{ ***/ function check_add_a_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var newIP = thisForm.new_ip; newIP.value = trim(newIP.value); if (subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; var res; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } res = ValueChecker.checkA(newIP, newIP.value); if (res == false) return false; newIP.value = normailzeIP(newIP.value); return true; } /*** }}} ***/ /*** check_change_a_form() {{{ ***/ function check_change_a_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } // IP validation check var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { //get ip var ip = thisForm.elements['ip_'+i]; var ipvalue = trim(ip.value); res = ValueChecker.checkA(ip, ipvalue); if (res == false) return false; ip.value = normailzeIP(ip.value); } } return true; } /*** }}} ***/ /*** check_delete_a_form() {{{ ***/ function check_delete_a_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_www_alt_form() {{{ ***/ function check_www_alt_form(aForm) { return true; } /*** }}} ***/ /*** check_add_mx_form() {{{ ***/ function check_add_mx_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subdomain_for_mx.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var domain; if (trim(subDomain) == '') domain = userDomain; else domain = subDomain + '.' + userDomain; var newMX = thisForm.new_mx; newMX.value = trim(newMX.value); newMX.value = rtrimDot(newMX.value); var newMXRank = thisForm.new_mx_rank; newMXRank.value = trim(newMXRank.value); var res; res = formChecker.isEmpty(domain); if (res == true) { alert(LANG['EmptyDomain']); thisForm.subdomain_for_mx.focus(); return false; } res = formChecker.isDomain(domain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subdomain_for_mx.focus(); return false; } res = ValueChecker.checkMX(newMX, newMX.value); if (res == false) return false; res = ValueChecker.checkMXRank(newMXRank, newMXRank.value); if (res == false) return false; return true; } /*** }}} ***/ /*** check_change_mx_form() {{{ ***/ function check_change_mx_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var newMX = thisForm.elements['mx_' + i]; newMX.value = trim(newMX.value); newMX.value = rtrimDot(newMX.value) var newMXRank = thisForm.elements['mx_rank_' + i]; newMXRank.value = trim(newMXRank.value); res = ValueChecker.checkMX(newMX, newMX.value); if (res == false) return false; res = ValueChecker.checkMXRank(newMXRank, newMXRank.value); if (res == false) return false; } } return true; } /*** }}} ***/ /*** check_delete_mx_form() {{{ ***/ function check_delete_mx_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_cname_form() {{{ ***/ function check_add_cname_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selectedCNAMEIndex = thisForm.cname_list.selectedIndex; var selectedDomainIndex = thisForm.user_domain.selectedIndex; var alias = trim(thisForm.alias.value); var userDomain = thisForm.user_domain.options[selectedDomainIndex].value; if (alias) { var aliasDomain = alias + '.' + userDomain; } else { var aliasDomain = userDomain; } var res; res = formChecker.isDomain(aliasDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.alias.focus(); return false; } cname = thisForm.direct_cname; cname.value = rtrimDot(cname.value); cname.value = trim(cname.value); if ( thisForm.cname_list.value == "") { alert(LANG['SelectActualDomain']); thisForm.cname_list.focus(); return false; } return ValueChecker.checkCNAME(cname, cname.value); } /*** }}} ***/ /*** check_change_cname_form() {{{ ***/ function check_change_cname_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var cname = thisForm.elements['cname_'+i]; cname.value = rtrimDot(cname.value); cname.value = trim(cname.value); res = ValueChecker.checkCNAME(cname, cname.value); if (res == false) return false; // memo length check TODO } } return true; } /*** }}} ***/ /*** check_delete_cname_form() {{{ ***/ function check_delete_cname_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_webforward_form() {{{ ***/ function check_add_webforward_form(aForm) { var thisForm = aForm; var selectedIndex = thisForm.user_domain.selectedIndex; var subDomain = trim(thisForm.subname.value); var userDomain = thisForm.user_domain.options[selectedIndex].value; setSelectedMenu('editwebforward'); return check_webforward_form_common(aForm, subDomain, userDomain); } /*** }}} ***/ /*** check_change_webforward_form() {{{ ***/ function check_change_webforward_form(aForm) { var thisForm = aForm; var userDomain = thisForm.user_domain.value; var subDomain = thisForm.sub_domain.value; return check_webforward_form_common(aForm, subDomain, userDomain); } /*** }}} ***/ /*** check_webforward_form_common() {{{ ***/ function check_webforward_form_common(aForm, subDomain, userDomain) { var thisForm = aForm; var formChecker = new FormChecker(); var toURL = thisForm.to_url; toURL.value = trim(toURL.value); if (trim(subDomain) == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; var res; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } if(toURL.value.search("://") == -1) { alert(LANG['InvalidURLMalformed'] + LANG['InvalidURLNoProtocol']); thisForm.to_url.focus(); return false; } toURL.value = formChecker.proofreadCase(toURL.value); if (!ValueChecker.checkWebForward(toURL, toURL.value)) { return false; } if ($('#favicon_use:checked').val()) { var $favicon = $('#favicon'); var value = $favicon.val(); if (formChecker.isEmpty(value)) { alert(LANG['EmptyURL']); $favicon.focus(); return false; } if (!formChecker.isURL(value)) { alert(LANG['InvalidURL']); $favicon.focus(); return false; } } return true; } /*** }}} ***/ /*** check_change_webforward_meta_form() {{{ ***/ function check_change_webforward_meta_form(aForm) { if ((aForm.elements['keyword'].value.length > 255)) { alert (LANG['InvalidKeywordLength']); return false; } if ((aForm.elements['viewport'].value.length > 255)) { alert (LANG['InvalidViewportLength']); return false; } if ((aForm.elements['description'].value.length > 255 )) { alert (LANG['InvalidDescriptionLength']); return false; } if ((aForm.elements['content2'].value.length >255)) { alert (LANG['InvalidContentTypeLength']); return false; } return true; } /*** }}} ***/ /*** check_delete_webforward_form() {{{ ***/ function check_delete_webforward_form(aForm) { setSelectedMenu('editwebforward'); selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_cart_item_form() {{{ ***/ function check_add_cart_item_form (aForm) { var thisForm = aForm; var formChecker = new FormChecker(); $('#checkall').removeAttr('name'); setSelectedMenu('add_cart_item'); return true; } /*** }}} ***/ /*** check_add_bulk_cart_item_form() {{{ ***/ function check_add_bulk_cart_item_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { var type = $('input[name=product_type]').val(); if (type == 'web_forward') { alert(LANG['choose_webforwarding_domain']); } else { alert(LANG['choose_service_domain']); } return false; } else { $('#checkall').removeAttr('name'); setSelectedMenu('add_bulk_cart_item'); return true; } } /*** }}} ***/ /*** check_del_cart_item_form() {{{ ***/ function check_del_cart_item_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); setSelectedMenu('del_cart_item'); return true; } /*** }}} ***/ /*** check_del_cart_dns_form() {{{ ***/ function check_del_cart_dns_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); setSelectedMenu('del_cart_dns'); return true; } /*** }}} ***/ /*** check_pay_bulk_cart_item_form() {{{ ***/ function check_pay_bulk_cart_item_form (aForm) { var existItem = check_add_bulk_cart_item_form(aForm); if (existItem) { setSelectedMenu('pay_bulk_cart_item'); return true; } else { return false; } } /*** }}} ***/ /*** check_pay_cart_item_form() {{{ ***/ function check_pay_cart_item_form (aForm) { check_add_cart_item_form(aForm); setSelectedMenu('pay_cart_item'); setCommand('pay_cart_item'); return true; } /*** }}} ***/ /*** check_pay_cart_item_for_subdomain_form() {{{ ***/ function check_pay_cart_item_for_subdomain_form (aForm) { aForm.product_type.value = 'subdomain'; check_pay_cart_item_form(aForm); return true; } /*** }}} ***/ /*** check_del_payment_form() {{{ ***/ function check_paymentbegin_form(aForm) { setSelectedMenu('paymentbegin'); return true; } /*** }}} ***/ /*** check_add_service_form() {{{ ***/ function check_add_service_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); setSelectedMenu('add_service'); return true; } /*** }}} ***/ /*** check_delete_paymethod_form() {{{ ***/ function check_delete_paymethod_form(aForm) { var selected = isSelectedRadioButton('check'); if (selected == false) { alert(LANG['select_delete_paymethod']); return false; } if (!confirm(LANG['confirm_delete'])) { return false; } return true; } /*** }}} ***/ /*** check_change_primary_form() {{{ ***/ function check_change_primary_form(aForm) { var selected = isSelectedRadioButton('check'); if (selected == false) { alert(LANG['select_change_primary']); return false; } return true; } /*** }}} ***/ /*** email change ***/ /*** check_confirmemail_form() {{{ ***/ function check_confirmemail_form() { setSelectedMenu('confirmemail'); } /*** }}} ***/ /*** check_skipemail_form() {{{ ***/ function check_skipemail_form() { setSelectedMenu('confirmemail'); } /*** }}} ***/ function changeCheckbox(checkboxStatus) { if (checkboxStatus == true || checkboxStatus == false) { $('#checkAll.cart').attr('checked', checkboxStatus); $('input[type="checkbox"][id!="checkAll"].cartCheckbox').each(function(token) { $(this).attr('checked', checkboxStatus); $(this).parent().parent().addClass('checkedtr'); }); } else { // undefined $('#checkAll.cart').attr('checked', false); $('input[type="checkbox"][id!="checkAll"].cartCheckbox').each(function(token) { $(this).attr('checked', false); $(this).parent().parent().removeClass('checkedtr'); }); } } function changeCartProduct(cartId, productId) { var request = $.ajax({ url: "/ajax/change_cart_product.php", type: "POST", data: { cartId: cartId, productId: productId } }); request.always(function(msg) { location.href = '/start.html?selected_menu=cart'; }); } /*** extendTerm() {{{ ***/ function extendTerm(domain, type) { if (!type) { type = 'web_forward'; } $('input[name=zone_for_cart]').val(domain); $('input[name=product_type]').val(type); confirmSubmit('pay_cart_item'); } /*** }}} ***/ /*** extendTermWithProductId() {{{ ***/ function extendTermWithProductId(domain, id) { var href = '/start.html?selected_menu=add_cart_item&command=add_cart_item&zone_for_cart=' + domain + '&product_id=' + id; var $where = this.parent.$('#where'); if ($where.length > 0) { href += '&where=' + $where.val(); } parent.document.location.href = href; } /** }}} ***/ /*** upgradeWithProductId() {{{ ***/ function upgradeWithProductId(domain, id) { var href = '/start.html?selected_menu=add_cart_item&command=pay_cart_item&zone_for_cart=' + domain + '&product_id=' + id; var $where = this.parent.$('#where'); if ($where.length > 0) { href += '&where=' + $where.val(); } parent.document.location.href = href; } /** }}} ***/ /*** extendTermAndGoCart() {{{ ***/ function extendTermAndGoCart(domain, type) { if (!type) { type = 'web_forward'; } $('input[name=zone_for_cart]').val(domain); $('input[name=product_type]').val(type); confirmSubmit('add_cart_item'); } /** }}} ***/ /*** extendTermAndGoCartForServicePage() {{{ ***/ function extendTermAndGoCartForServicePage(domain, type) { if (!type) { type = 'web_forward'; } form.action = 'start.html'; $('input[name=zone_for_cart]').val(domain); $('input[name=product_type]').val(type); confirmSubmit('add_cart_item'); } /*** extendTermAndGoCart() {{{ ***/ function extendTermAndGoCart(domain, type) { if (!type) { type = 'web_forward'; } $('input[name=zone_for_cart]').val(domain); $('input[name=product_type]').val(type); confirmSubmit('add_cart_item'); } /*** }}} ***/ /*** extendTermFail() {{{ ***/ function extendTermFail() { alert(LANG['extend_term_fail']); } /*** }}} ***/ /*** delSubDomain() {{{ ***/ function delSubDomain(element) { $('input[type=checkbox]').attr('checked', false); $('tr').removeClass('checkedtr'); var tr = $(element).parent().parent().parent().parent(); tr.find('input[type=checkbox]').attr('checked', 'checked'); tr.addClass('checkedtr'); confirmSubmit('delete_bulk_zone') } /*** }}} ***/ /*** check_pay_direct_webforward_form() {{{ ***/ function check_pay_direct_webforward_form(aForm) { return true; } /*** }}} ***/ /*** check_company_form() {{{ ***/ function check_company_form(aForm) { var formChecker = new FormChecker(); var divider = true; $(aForm).find('label.frmchk').each(function () { if (divider == false) { return false; } var targetString = $(this).attr('for'); var targetText = $(this).html(); var target= $('#' + $(this).attr('for')); //isEmpty and length check if (targetString == 'registrationNumberLeft') { if ($.trim($('#registrationNumberLeft').val()).length != 3 || $.trim($('#registrationNumberMiddle').val()).length != 2 || $.trim($('#registrationNumberRight').val()).length != 5) { alert('사업자등록번호를 정확히 입력해 주십시오.'); $('#registrationNumberLeft').focus(); divider = false; return false; } } else if (targetString == 'contact1Email') { var contact1List = ['contact1Name', 'contact1Email', 'contact1Phone']; $(aForm).find('label[for="contact1Email"]').parent().parent().find('input').each(function () { if (formChecker.isEmpty($.trim($(this).val()))) { alert($(this).data('description') + '를 입력해 주십시오.'); $(this).focus(); divider = false; return false; } else if ($(this).attr('id') == 'contact1Email') { res = ValueChecker.checkWebParkingEmail(this, $.trim(this.value || '')); if (res == false) { divider = false; return false; } } if (formChecker.htmlspecialchecker($.trim($(this).val()))) { alert('올바른 ' + $(this).data('description') + '를 입력해 주십시오. \n기호나 특수문자는 사용하실수 없습니다.'); target.focus(); divider = false; return false; } }); } else if (targetString == 'contact2Email') { var $contact2Email = $('#contact2Email'); var contact2Email = $contact2Email[0]; if ($contact2Email.val().length > 0) { res = ValueChecker.checkWebParkingEmail(contact2Email, $.trim(contact2Email.value || '')); if (res == false) { divider = false; return false; } if (formChecker.htmlspecialchecker($.trim($contact2Email.val()))) { alert('올바른 ' + $contact2Email.data('description') + '를 입력해 주십시오. \n기호나 특수문자는 사용하실수 없습니다.'); target.focus(); divider = false; return false; } } } else if (targetString == 'secondaryRegistrationNumber') { if ($.trim($(target).val()).length > 0) { if (formChecker.isEmpty($.trim(target.val()))) { alert($(this).html() + '를 입력해 주십시오.'); target.focus(); divider = false; return false; } if (isNaN($.trim(target.val()))) { alert('올바른 종사업자번호를 입력해 주십시오. \n기호나 특수문자는 사용하실수 없습니다.'); target.focus(); divider = false; return false; } } } else { if (formChecker.isEmpty($.trim(target.val()))) { alert($(this).html() + '를 입력해 주십시오.'); target.focus(); divider = false; return false; } } //htmlspecialchecker if (formChecker.htmlspecialchecker($.trim(target.val())) && divider) { alert('올바른 ' + targetText + '를 입력해 주십시오. \n기호나 특수문자는 사용하실수 없습니다.'); target.focus(); divider = false; return false; } //isNaN if (target.hasClass('nan') && divider) { if (isNaN($.trim(target.val()))) { alert('올바른 사업자 등록번호를 입력해 주십시오. \n기호나 특수문자는 사용하실수 없습니다.'); target.focus(); divider = false; return false; } } }); if (divider) { return true; } else { return false; } } /*** }}} ***/ /*** check_add_webparking_form() {{{ ***/ function check_add_webparking_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var masterEmail = thisForm.master_email; masterEmail.value = trim(masterEmail.value); if (trim(subDomain) == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; var res; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } if (masterEmail.value) { res = ValueChecker.checkWebParkingEmail(masterEmail, masterEmail.value); if (res == false) return false; } return true; } /*** }}} ***/ /*** check_change_webparking_form() {{{ ***/ function check_change_webparking_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var masterEmail = thisForm.elements['master_email_'+i]; if (masterEmail.value) { res = ValueChecker.checkWebParkingEmail(masterEmail, masterEmail.value); if (res == false) return false; } } } return true; } /*** }}} ***/ /*** check_delete_webparking_form() {{{ ***/ function check_delete_webparking_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_mailforward_form() {{{ ***/ function check_add_mailforward_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var fromAddr = trim(thisForm.from_addr.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; //var newDomain = subDomain + '.' + userDomain; var toAddr = trim(thisForm.to_addr.value); if ( (trim(fromAddr) == '') || (trim(fromAddr) == '*')) newMail = userDomain; else newMail = fromAddr + '@' + userDomain; var res; /* res = formChecker.isEmpty(subDomain); if (res == true) { alert(LANG['EmptyDomain']); thisForm.subname.focus(); return false; } */ res = formChecker.isEmpty(toAddr); if (res == true) { alert(LANG['EmptyEmail']); thisForm.to_addr.focus(); return false; } res = formChecker.isValidEmail(toAddr); if (res == false) { alert(LANG['InvalidEmail']); thisForm.to_addr.focus(); return false; } res = formChecker.isValidMailForward(userDomain, toAddr); if (res == true) { alert(LANG['InvalidMailForward']); thisForm.to_addr.focus(); return false; } if (newMail != userDomain) { res = formChecker.isValidEmail(newMail); if (res == false) { alert(LANG['InvalidEmail']); thisForm.from_addr.focus(); return false; } } return true; } /*** }}} ***/ /*** check_delete_mailforward_form() {{{ ***/ function check_delete_mailforward_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteEmail']); return false; } return true; } /*** }}} ***/ /*** check_change_mailforward_form() {{{ ***/ function check_change_mailforward_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeEmail']); return false; } // IP validation check var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { //get fromURL var fromAddr = thisForm.elements['from_addr_'+i]; var fromAddr_value = trim(fromAddr.value); //get toURL var toAddr = thisForm.elements['to_addr_'+i]; var toAddr_value = trim(toAddr.value); //form check if (formChecker.isEmpty(toAddr_value) == true) { alert(LANG['EmptyEmail']); toAddr.focus(); return false; } if (formChecker.isValidEmail(toAddr_value) == false) { alert(LANG['InvalidEmail']); toAddr.focus(); return false; } if (formChecker.isValidMailForward(userDomain, toAddr_value) == true) { alert(LANG['InvalidMailForward']); thisForm.to_addr.focus(); return false; } } } return true; } /*** }}} ***/ /*** check_add_auth_mail_form() {{{ ***/ function check_add_auth_mail_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var authMail = trim(thisForm.auth_mail.value); var selectedIndex = thisForm.user_domain.selectedIndex; //var newDomain = subDomain + '.' + userDomain; var userName = trim(thisForm.user_name.value); var res; /* res = formChecker.isEmpty(subDomain); if (res == true) { alert(LANG['EmptyDomain']); thisForm.subname.focus(); return false; } */ res = formChecker.isEmpty(authMail); if (res == true) { alert(LANG['EmptyEmail']); thisForm.auth_mail.focus(); return false; } res = formChecker.isValidEmail(authMail); if (res == false) { alert(LANG['InvalidEmail']); thisForm.auth_mail.focus(); return false; } return true; } /*** }}} ***/ /*** check_delete_auth_mail_form() {{{ ***/ function check_delete_auth_mail_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteEmail']); return false; } return true; } /*** }}} ***/ /*** check_change_soa_form() {{{ ***/ function check_change_soa_form(aForm) { var thisForm = aForm; if ((thisForm.old_soa_refresh.value == thisForm.soa_refresh.value) && (thisForm.old_soa_retry.value == thisForm.soa_retry.value) && (thisForm.old_soa_expire.value == thisForm.soa_expire.value) && (thisForm.old_soa_minimum.value == thisForm.soa_minimum.value)) { alert(LANG['SameSOAValues']); return false; } return true; } /*** }}} ***/ /*** check_change_ttl_form() {{{ ***/ function check_change_ttl_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeHostname']); return false; } return true; } /*** }}} ***/ /*** check_change_properties_form() {{{ ***/ function check_change_properties_form(aForm) { return true; } /*** }}} ***/ /*** check_add_txt_form() {{{ ***/ function check_add_txt_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectIndex].value; var newTXT = thisForm.new_txt.value; if (subDomain == '*' || subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; var res; res = formChecker.isTxtDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } return ValueChecker.checkTXT(thisForm.new_txt, newTXT); // return true; } /*** }}} ***/ /*** check_change_txt_form() {{{ ***/ function check_change_txt_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; var res; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var txt = thisForm.elements['txt_'+i]; res = ValueChecker.checkTXT(txt, txt.value); if (res == false) return false; } } return true; } /*** }}} ***/ /*** check_delete_txt_form() {{{ ***/ function check_delete_txt_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_srv_form() {{{ ***/ function check_add_srv_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var serviceName = trim(thisForm.service_name.value); var protocolName = trim(thisForm.protocol_name.value); var subDomain = trim(thisForm.subname.value); var selectIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectIndex].value; var priority = trim(thisForm.new_priority.value); var weight = trim(thisForm.new_weight.value); var port = trim(thisForm.new_port.value); var target = trim(thisForm.new_target.value); if (subDomain == '*' || subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; var res; if (serviceName == 'direct_input_service') { var userServiceName = thisForm.user_service_name.value; if (userServiceName && userServiceName.substring(0,1) != '_') { alert(LANG['InvalidServiceName']); thisForm.user_service_name.focus(); return false; } } if (protocolName == 'direct_input_protocol') { var userProtocolName = thisForm.user_protocol_name.value; if (userProtocolName && userProtocolName.substring(0,1) != '_') { alert(LANG['InvalidProtocolName']); thisForm.user_protocol_name.focus(); return false; } } res = formChecker.isSrvDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } res = formChecker.isEmpty(priority); if (res == true) { alert(LANG['EmptyPriority']); thisForm.new_priority.focus(); return false; } res = formChecker.isNaturalNumber(priority); if (res == false) { alert(LANG['InvalidPriority']); thisForm.new_priority.focus(); return false; } res = formChecker.isWithinRange(priority, 0, 65535); if (res == false) { alert(LANG['InvalidPriority']); thisForm.new_priority.focus(); return false; } res = formChecker.isEmpty(weight); if (res == true) { alert(LANG['EmptyWeight']); thisForm.new_weight.focus(); return false; } res = formChecker.isNaturalNumber(weight); if (res == false) { alert(LANG['InvalidWeight']); thisForm.new_weight.focus(); return false; } res = formChecker.isWithinRange(weight, 0, 65535); if (res == false) { alert(LANG['InvalidWeight']); thisForm.new_weight.focus(); return false; } res = formChecker.isEmpty(port); if (res == true) { alert(LANG['EmptyPort']); thisForm.new_port.focus(); return false; } res = formChecker.isNaturalNumber(port); if (res == false) { alert(LANG['InvalidPort']); thisForm.new_port.focus(); return false; } res = formChecker.isWithinRange(port, 0, 65535); if (res == false) { alert(LANG['InvalidPort']); thisForm.new_port.focus(); return false; } res = formChecker.isEmpty(target); if (res == true) { alert(LANG['EmptyDomain']); thisForm.new_target.focus(); return false; } if (target != '.') { if (target.lastIndexOf('.') == (target.length -1)) { target = target.substring(0, target.length -1); thisForm.new_target.value = target; } res = formChecker.isDomain(target); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_target.focus(); return false; } } return true; } /*** }}} ***/ /*** check_delete_srv_form() {{{ ***/ function check_delete_srv_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_aaaa_form() {{{ ***/ function check_add_aaaa_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var ipv6 = thisForm.new_ipv6; ipv6.value = trim(ipv6.value); if (subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } return ValueChecker.checkAAAA(ipv6, ipv6.value); } /*** }}} ***/ /*** check_change_aaaa_form() {{{ ***/ function check_change_aaaa_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } // IP validation check var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { //get ipv6 var ipv6 = thisForm.elements['ipv6_'+i]; res = ValueChecker.checkAAAA(ipv6, ipv6.value); if (res == false) return false; } } return true; } /*** }}} ***/ /*** check_delete_aaaa_form() {{{ ***/ function check_delete_aaaa_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_ns_form() {{{ ***/ function check_add_ns_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; if (subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; var res; var newNS = thisForm.new_ns; newNS.value = trim(newNS.value); newNS.value = rtrimDot(newNS.value); if (subDomain == '*' || subDomain[0] == '*') { alert(LANG['InvalidWildcardNS']); thisForm.subname.focus(); return false; } res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } return ValueChecker.checkNS(newNS, newNS.value); } /*** }}} ***/ /*** check_change_ns_form() {{{ ***/ function check_change_ns_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } // validation check var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var ns = thisForm.elements['ns_'+i]; ns.value = trim(ns.value); ns.value = rtrimDot(ns.value); res = ValueChecker.checkNS(ns, ns.value); if (res == false) return false; } } return true; } /*** }}} ***/ /*** check_delete_ns_form() {{{ ***/ function check_delete_ns_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_ptr_way1_form() {{{ ***/ function check_add_ptr_way1_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var newPTRZone = trim(thisForm.new_ptr_zone.value)+'.in-addr.arpa'; var res; res = formChecker.isEmpty(newPTRZone); if (res == true) { alert(LANG['EmptyDomain']); thisForm.new_ptr_zone.focus(); return false; } res = formChecker.isPTRZone(newPTRZone); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_ptr_zone.focus(); return false; } if (thisForm.input_way[0].checked) { thisForm.detailWay1Type.value = 'input_network'; } else { thisForm.detailWay1Type.value = 'input_ptr_zone'; } return true; } /*** }}} ***/ /*** check_add_ptr_way2_form() {{{ ***/ function check_add_ptr_way2_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var networkStart = trim(thisForm.network_start_1.value); for (var x=2; x<5; x++) { networkStart += '.'+ eval('trim(thisForm.network_start_'+x+'.value)'); } var networkEnd = trim(thisForm.network_end_1.value); for (var x=2; x<5; x++) { networkEnd += '.'+ eval('trim(thisForm.network_end_'+x+'.value)'); } var networkSubnet = trim(thisForm.network_subnet.value); var res; res = formChecker.isEmpty(networkStart); if (res == true) { alert(LANG['EmptyNetworkStart']); thisForm.network_start_4.focus(); return false; } res = formChecker.isValidIP(networkStart); if (res == false) { alert(LANG['InvalidIP']); thisForm.network_start_4.focus(); return false; } res = formChecker.isEmpty(networkEnd); if (res == true) { alert(LANG['EmptyNetworkEnd']); thisForm.network_start_4.focus(); return false; } res = formChecker.isValidIP(networkEnd); if (res == false) { alert(LANG['InvalidIP']); thisForm.network_start_4.focus(); return false; } res = formChecker.isEmpty(networkSubnet); if (res == true) { alert(LANG['EmptyNetworkSubnet']); thisForm.network_subnet.focus(); return false; } res = formChecker.isValidSubnet(networkSubnet); if (res == false) { alert(LANG['InvalidSubnet']); thisForm.network_subnet.focus(); return false; } thisForm.network_start.value = networkStart; thisForm.network_end.value = networkEnd; return true; } /*** }}} ***/ /*** check_add_ptr_zone_form() {{{ ***/ function check_add_ptr_zone_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var newZone = trim(thisForm.new_zone.value); var res; res = formChecker.isEmpty(newZone); if (res == true) { alert(LANG['EmptyDomain']); return false; } res = formChecker.isPTRZone(newZone); if (res == false) { alert(LANG['InvalidDomain']); return false; } return true; } /*** }}} ***/ /*** check_add_ptr_form() {{{ ***/ function check_add_ptr_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var hostName = trim(thisForm.new_hostname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var ip = trim(thisForm.new_ip.value); var ipArray = ip.split('.'); var i=0; var res; res = formChecker.isEmpty(ip); if (res == true) { alert(LANG['EmptyIP']); thisForm.new_ip.focus(); return false; } res = formChecker.isEmpty(hostName); if (res == true) { alert(LANG['EmptyHostname']); thisForm.new_hostname.focus(); return false; } for (i=0; i < ipArray.length; i++) { if (isNaN(ipArray[i])) { alert(LANG['PTRIPRange']); thisForm.new_ip.focus(); return false; } if ((ipArray[i] < 0) || (ipArray[i] > 255)) { alert(LANG['PTRIPRange']); thisForm.new_ip.focus(); return false; } } newIP = ip + '.' + userDomain; res = formChecker.isPTRZone(newIP); if (res == false) { alert(LANG['InvalidPTRZone']); thisForm.new_ip.focus(); return false; } res = formChecker.isDomain(hostName); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_hostname.focus(); return false; } return true; } /*** }}} ***/ /*** check_change_ptr_form() {{{ ***/ function check_change_ptr_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { //get hostName var hostName = thisForm.elements['hostName_'+i]; //form check var hostNameValue = trim(hostName.value); //alert(test); if (formChecker.isEmpty(hostNameValue) == true) { alert(LANG['EmptyHostname']); hostName.focus(); return false; } if (formChecker.isDomain(hostNameValue) == false) { alert(LANG['InvalidDomain']); hostName.focus(); return false; } } } return true; } /*** }}} ***/ /*** check_delete_ptr_form() {{{ ***/ function check_delete_ptr_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_ptr_cname_form() {{{ ***/ function check_add_ptr_cname_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selectedCNAMEIndex = thisForm.cname_list.selectedIndex; var selectedDomainIndex = thisForm.user_domain.selectedIndex; var alias = trim(thisForm.alias.value); var userDomain = thisForm.user_domain.options[selectedDomainIndex].value; var aliasDomain = alias + '.' + userDomain; var res; var cname = thisForm.direct_cname; cname.value = trim(cname.value); cname.value = rtrimDot(cname.value); res = formChecker.isPTRZone(aliasDomain); if (res == false) { alert(LANG['InvalidPTRZone']); thisForm.alias.focus(); return false; } if ( thisForm.cname_list.value == "") { alert(LANG['SelectActualDomain']); thisForm.cname_list.focus(); return false; } return ValueChecker.checkCNAME(cname, cname.value); } /*** }}} ***/ /*** check_change_ptr_cname_form() {{{ ***/ function check_change_ptr_cname_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var cname = thisForm.elements['cname_'+i]; cname.value = rtrimDot(cname.value); cname.value = trim(cname.value); res = ValueChecker.checkCNAME(cname, cname.value); if (res == false) return false; // memo length check TODO } } return true; } /*** }}} ***/ /*** check_delete_ptr_cname_form() {{{ ***/ function check_delete_ptr_cname_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_add_ptr_ns_form() {{{ ***/ function check_add_ptr_ns_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var ns = trim(thisForm.new_ns.value); if (subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; //var newDomain = subDomain + '.' + userDomain; var res; res = formChecker.isEmpty(ns); if (res == true) { alert(LANG['EmptyNS']); thisForm.new_ns.focus(); return false; } // res1 = formChecker.isValidIP(ns); res = formChecker.isDomain(ns); if (res == false) { alert(LANG['InvalidNS']); thisForm.new_ns.focus(); return false; } res = formChecker.isPTRZone(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } return true; } /*** }}} ***/ /*** check_change_ptr_ns_form() {{{ ***/ function check_change_ptr_ns_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectChangeRecord']); return false; } // validation check var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { //get ip var ns = thisForm.elements['ns_'+i]; //form check var nsvalue = trim(ns.value); //alert(test); if (formChecker.isEmpty(nsvalue) == true) { alert(LANG['EmptyNS']); ns.focus(); return false; } if (formChecker.isDomain(nsvalue) == false) { alert(LANG['InvalidNS']); ns.focus(); return false; } } } return true; } /*** }}} ***/ /*** check_delete_ptr_ns_form() {{{ ***/ function check_delete_ptr_ns_form(aForm) { selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectDeleteRecord']); return false; } return true; } /*** }}} ***/ /*** check_transfer_method_select_form() {{{ ***/ function check_transfer_method_select_form(aForm) { var thisForm = aForm; var selected = isSelectedRadioButton('transfermethod'); if (selected == false) { alert(LANG['SelectTransferMethod']); return false; } setSelectedMenu('transferzonerequest'); return true; } /*** }}} ***/ /*** check_transfer_request_form() {{{ ***/ function check_transfer_request_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var targetDomain = trim(thisForm.reqDomain.value); targetDomain = toPuny(targetDomain); var res; res = formChecker.isEmpty(targetDomain); if (res == true) { alert(LANG['EmptyDomain']); thisForm.new_zone.focus(); return false; } res = formChecker.isZone(targetDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.new_zone.focus(); return false; } return true; } /*** }}} ***/ /*** check_transfer_request_email_form() {{{ ***/ function check_transfer_request_email_form(aForm) { var selected = isSelectedRadioButton('targetEmail'); if (selected == false) { alert(LANG['SelectEmail']); return false; } return true; } /*** }}} ***/ /*** check_transfer_grant_select_form() {{{ ***/ function check_transfer_grant_select_form(aForm) { var selected = isSelectedCheckBox('targetDomain[]'); if (selected == false) { alert(LANG['SelectGrantTransfer']); return false; } document.form.selected_menu.value = 'transferzonegrant'; document.form.user_domain.value = ''; return true; } /*** }}} ***/ /*** check_transfer_grant_user_form() {{{ ***/ function check_transfer_grant_user_form(aForm) { var result; var formChecker = new FormChecker(); result = formChecker.isValidID(form.targetID.value); if (result == false) { alert(LANG['InvalidID']); form.targetID.focus(); return false; } if (form.targetID.value != form.targetID_again.value) { alert(LANG['FailIDConfirm']); form.targetID.focus(); return false; } return true; } /*** }}} ***/ /*** check_transfer_grant_verify_form() {{{ ***/ function check_transfer_confirm_form(aForm) { var result; var formChecker = new FormChecker(); result = formChecker.isEmpty(form.check_password.value); if (result == true) { alert(LANG['EmptyPassword']); form.check_password.focus(); return false; } result = formChecker.isValidPassword(form.check_password.value); if (result == false) { alert(LANG['InvalidPassword']); form.check_password.focus(); return false; } return true; } /*** }}} ***/ /*** check_transfer_accept_form() {{{ ***/ function check_transfer_accept_form(aForm) { if ($('#messageBoxDisplay_default')[0].contentWindow.$("#messageBox :checked").size() == 0) { alert(LANG['SelectAcceptTransfer']); return false; } var clone = $('#messageBoxDisplay_default')[0].contentWindow.$("#messageBox :input").clone(); $("form").append(clone); clone.hide(); return true; } /*** }}} ***/ /*** check_transfer_reject_form() {{{ ***/ function check_transfer_reject_form(aForm) { if ($('#messageBoxDisplay_default')[0].contentWindow.$("#messageBox :checked").size() == 0) { alert(LANG['SelectRejectTransfer']); return false; } $("form").append($('#messageBoxDisplay_default')[0].contentWindow.$("#messageBox :input").clone()); return true; } /*** }}} ***/ /*** check_transfer_cancel_form() {{{ ***/ function check_transfer_cancel_form(aForm) { selected = isSelectedCheckBox('transfer_check[]'); if (selected == false) { alert(LANG['SelectCancelTransfer']); return false; } return true; } /*** }}} ***/ /*** check_transfer_grant_cancel_form() {{{ ***/ function check_transfer_grant_cancel_form(aForm) { return true; } /*** }}} ***/ // external /*** check_external_confirm_form() {{{ ***/ function check_external_confirm_form(aForm) { return true; } /*** }}} ***/ // webmail /*** check_webmail_register_form() {{{ ***/ function check_webmail_register_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); if ($('#subName').val() == "") { alert(LANG['webmail_subName_empty']); $('#subName').focus(); return false; } if ($('#subName').val() == "www") { alert(LANG['webmail_subName_is_www']); $('#subName').focus(); return false; } if ($('#accountId').val() == "") { alert(LANG['EmptyID']); $('#accountId').focus(); return false; } var email = $('#accountId').val() + '@' + $('#currentDomain').val(); if (formChecker.isValidEmail(email) == false) { alert(LANG['webmail_ID_invalid']); $('#accountId').focus(); return false; } if ($('#accountPassword').val() == "") { alert(LANG['EmptyPassword']); $('#accountPassword').focus(); return false; } if (formChecker.isValidPassword($('#accountPassword').val()) == false) { alert(LANG['InvalidPassword']); $('#accountPassword').focus(); return false; } if ($('#accountPasswordConfirm').val() == "") { alert(LANG['EmptyPasswordConfirm']); $('#accountPasswordConfirm').focus(); return false; } if ($('#accountPassword').val() != $('#accountPasswordConfirm').val()) { alert(LANG['FailPasswordConfirm']); $('#accountPassword').focus(); return false; } if ($('#webmailHostSubEmail').val() == "") { alert(LANG['EmptyEmail']); $('#webmailHostSubEmail').focus(); return false; } if (formChecker.isValidEmail($('#webmailHostSubEmail').val()) == false) { alert(LANG['InvalidEmail']); $('#webmailHostSubEmail').focus(); return false; } // domain check by regular expression if ($('#webmailHostSubEmail').val().match('@' + $('#currentDomain').val())) { alert(LANG['webmail_subEmail_domain_is_same']); $('#webmailHostSubEmail').focus(); return false; } if ($('#webmailHostSubEmailConfirm').val() == "") { alert(LANG['EmptyEmail']); $('#webmailHostSubEmailConfirm').focus(); return false; } if ($('#webmailHostSubEmail').val() != $('#webmailHostSubEmailConfirm').val()) { alert(LANG['InvalidEmailVerify']); $('#webmailHostSubEmail').focus(); return false; } if ($('#agree').attr('checked') == false) { alert(LANG['webmail_terms_agree_not_checked']); $('#agree').focus(); return false; } setSelectedMenu('webmailRegisterConfirm'); return true; } /*** }}} ***/ /*** check_webmail_register_confirm_form() {{{ ***/ function check_webmail_register_confirm_form(aForm) { return true; } /*** }}} ***/ /*** check_change_webmail_form() {{{ ***/ function check_change_webmail_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; if (subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } return true; } /*** }}} ***/ /*** check_cancel_webmail_form() {{{ ***/ function check_cancel_webmail_form(aForm) { /* var thisForm = aForm; var formChecker = new FormChecker(); var subDomain = trim(thisForm.subname.value); var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; if (subDomain == '') newDomain = userDomain; else newDomain = subDomain + '.' + userDomain; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.subname.focus(); return false; } */ return true; } /*** }}} ***/ /*** check functions for PORT_SCAN ***/ /*** check_port_scan_form() {{{ ***/ function check_port_scan_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['SelectPortNum']); return false; } var checkBox = thisForm.elements['check[]']; var length = checkBox.length; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { if (checkBox[i].value == 'self') { if(!isNaN(thisForm.self_port_num.value) && thisForm.self_port_num.value){ if (thisForm.self_port_num.value < 0 || thisForm.self_port_num.value > 65535) { alert(LANG['InvalidPortNum']); thisForm.self_port_num.focus(); return false; } } else { alert(LANG['InvalidPortNum']); thisForm.self_port_num.focus(); return false; } } } } return true; } /*** }}} ***/ /*** Template support ***/ /*** start_template() {{{ ***/ function start_template() { var thisForm = document.form; var formChecker = new FormChecker(); var recordType = thisForm.recordType; var recordData = thisForm.recordData; var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['ChooseDomain']); return false; } var checkBox = document.form.elements['check[]']; var length = checkBox.length; var checkNumber = 0; for (i = 1; i < length; i++) { var is_ptr = document.getElementById("is_ptr_" + i); if (checkBox[i].checked == true && is_ptr != null && is_ptr.value == 'y') { alert(LANG['UnavailablePTR']); checkBox[i].focus(); return false; } } if (!$('#chooseTemplate').find('input:checked').val()) { alert(LANG['selectTemplate']); return false; } setSelectedMenu('applytemplate'); thisForm.submit(); } /*** }}} ***/ /*** start_template_one() {{{ ***/ function start_template_one() { var thisForm = document.form; if (!$('#chooseTemplate').find('input:checked').val()) { alert(LANG['selectTemplate']); return false; } setSelectedMenu('applytemplate'); thisForm.submit(); } /*** }}} ***/ /*** check_confirm_template_form() {{{ ***/ // TODO DDNS 페지에 따라 제거해야할 사항이 있는지 확인 필요함 function check_confirm_template_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var recordType = thisForm.recordType; var recordData = thisForm.recordData; var selected; selected = isSelectedCheckBox('check[]'); if (selected == false) { alert(LANG['ChooseRecord']); return false; } var checkBox = document.form.elements['check[]']; var length = checkBox.length; var res; var multipleA = false; var multipleCNAME = false; for (i = 1; i < length; i++) { if (checkBox[i].checked == true) { var host = thisForm.elements['host_' + i]; var type = thisForm.elements['type_' + i]; var data = thisForm.elements['data_' + i]; host.value = host.value.toLowerCase(); // check hostname // we don't need to care about domains' validities here... // TODO if (host.value == '') newDomain = 'domain.com'; else newDomain = host.value + '.' + 'domain.com'; res = formChecker.isDomain(newDomain); if (res == false) { alert(LANG['InvalidDomain']); host.focus(); return false; } // remove trailing dots (except TXT) if (type.value != 'TXT') { data.value = rtrimDot(data.value); data.value = trim(data.value); } checkMultiple = thisForm.elements['host_multiple_' + i]; // check data if (type.value == "A") { res = ValueChecker.checkA(data, data.value); if (checkMultiple && checkMultiple.value == 'true' && (host.value == '' || host.value == 'www')) { multipleA = true; } if (res == false) return false; } else if (type.value == "DDNS") { res = ValueChecker.checkDDNS(data, data.value); if (res == false) return false; } else if (type.value == "MX") { res = ValueChecker.checkMX(data, data.value); if (res == false) return false; data = thisForm.elements['data2_' + i]; res = ValueChecker.checkMXRank(data, data.value); if (res == false) return false; } else if (type.value == "CNAME") { res = ValueChecker.checkCNAME(data, data.value); if (checkMultiple && checkMultiple.value == 'true' && (host.value == '' || host.value == 'www')) { multipleCNAME = true; } if (res == false) return false; } else if (type.value == "TXT") { res = ValueChecker.checkTXT(data, data.value); if (res == false) return false; } else { alert("Unknown Type"); return false; } } } setSelectedMenu('confirmtemplate'); if (multipleA == true || multipleCNAME) { document.form.command.value = 'confirm_template'; openConfirmWindow(); return false; } return true; } /*** }}} ***/ /*** partner ***/ function goPartnerMenu(selectedMenu, arg) {//{{{ var thisForm = document.form; var domain = thisForm.domain.value; var ip = thisForm.ip.value; var otp = thisForm.otp.value; var url = thisForm.url.value; goURL = "/partner/egloos/start.html?domain=" + domain + "&selected_menu=" + selectedMenu + "&otp=" + otp + "&ip=" + ip + "&url=" + url; if (arg) { goURL += arg; } document.location.href = goURL; return; //return true; }//}}} function submitPartnerLogin(loginForm) {//{{{ var result = ValueChecker.checkLogin(loginForm); if (result == false) return false; loginForm.selected_menu.value="login"; loginForm.command.value="login"; loginForm.action.value="start.html"; loginForm.submit(); }//}}} function submitPartnerRegister() {//{{{ var thisForm = document.form; var result = check_register_user_form(thisForm, false); if (result == false) return; thisForm.command.value = "register"; thisForm.submit(); return; }//}}} /*** temp password ***/ function submitTempPassword() {//{{{ var thisForm = document.form; var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(thisForm.new_password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.new_password.focus(); return false; } res = formChecker.isEmpty(thisForm.new_password_confirm.value); if (res == true) { alert(LANG['EmptyPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } res = formChecker.isValidPassword(thisForm.new_password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.new_password.focus(); return false; } if (thisForm.new_password.value != thisForm.new_password_confirm.value) { alert(LANG['FailPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } thisForm.command.value = "change"; thisForm.submit(); return; }//}}} /*** login & logout ***/ /*** submitLogin() {{{ ***/ function submitLogin(loginForm) { var result = ValueChecker.checkLogin(loginForm); if (result == false) return false; loginForm.selected_menu.value="login"; loginForm.action.value="index.html"; return true; } /*** }}} ***/ /*** submitLogout() {{{ ***/ function submitLogout() { var thisForm = document.form; thisForm.action = 'logout.php'; thisForm.submit(); return; } /*** }}} ***/ /*** submitRegister() {{{ ***/ function submitRegister() { var thisForm = document.form; var result = check_register_user_form(thisForm, true); if (result == false) return; thisForm.selected_menu.value = "confirmregister"; thisForm.submit(); return; } /*** }}} ***/ /*** submitUnregister() {{{ ***/ function submitUnregister() { var thisForm = document.form; var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(thisForm.password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.password.focus(); return false; } res = formChecker.isValidPassword(thisForm.password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.password.focus(); return false; } if (confirm(LANG['ConfirmUnregister'])) { thisForm.command.value = "unregister"; thisForm.submit(); } return; } /*** }}} ***/ /*** submitAuthMailCheck() {{{ ***/ function submitAuthMailCheck(checkForm) { checkForm.selected_menu.value="authmailcheck"; checkForm.action.value="index.html"; return true; } /*** }}} ***/ /*** submitEditMyInfo() {{{ ***/ function submitEditMyInfo() { var thisForm = document.form; var result; result = check_edit_myinfo_form(thisForm); if (result == false) return; thisForm.command.value = "edit_myinfo"; if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** submitEditMyTTL() {{{ ***/ function submitEditMyTTL() { var thisForm = document.form; var formChecker = new FormChecker(); var result; if (result == false) return; thisForm.command.value = "edit_my_ttl"; res = formChecker.isValidAuthcode(thisForm.authcode.value); if (res == false) { alert(LANG['InvalidAuthCode']); thisForm.authcode.focus(); return false; } if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** submitChangeProperties() {{{ ***/ function submitChangeProperties() { var thisForm = document.form; var result; setSelectedMenu($('#selected_menu').data('selectedmenu')); var msg = thisForm.zone_memo.value; if (msg.length > 65000) { alert(LANG['InvalidZoneMemo']); thisForm.zone_memo.focus(); return false; } thisForm.command.value = "change_properties"; if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** submitChangePassword() {{{ ***/ function submitChangePassword() { var thisForm = document.form; var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(thisForm.old_password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.old_password.focus(); return false; } res = formChecker.isEmpty(thisForm.new_password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.new_password.focus(); return false; } res = formChecker.isEmpty(thisForm.new_password_confirm.value); if (res == true) { alert(LANG['EmptyPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } res = formChecker.isValidPassword(thisForm.old_password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.old_password.focus(); return false; } res = formChecker.isValidPassword(thisForm.new_password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.new_password.focus(); return false; } if (thisForm.new_password.value != thisForm.new_password_confirm.value) { alert(LANG['FailPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } thisForm.command.value = "change_password"; if (confirm(LANG['ConfirmChangePassword'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** submitChangeEmail() {{{ ***/ function submitChangeEmail() { var thisForm = document.form; var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(thisForm.password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.password.focus(); return false; } res = formChecker.isEmpty(thisForm.new_email.value); if (res == true) { alert(LANG['EmptyEmail']); thisForm.new_email.focus(); return false; } res = formChecker.isValidEmail(thisForm.new_email.value); if (res == false) { alert(LANG['InvalidEmail']); thisForm.new_email.focus(); return false; } if (thisForm.new_email.value != thisForm.new_email_verify.value) { alert(LANG['InvalidEmailVerify']); thisForm.new_email.focus(); return false; } thisForm.command.value = "change_email"; if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** submitDeleteCompany() {{{ ***/ function submitDeleteCompany(target) { var thisForm = document.form; var formChecker = new FormChecker(); $(target).parent().parent().find('input[type="hidden"]').attr('disabled',false); if (confirm(LANG['confirm_delete'])) { setCommand('companyinfo'); thisForm.selected_menu.value = "companyinfo"; thisForm.action.value = "delete"; thisForm.submit(); return; } else { return false; } } /*** }}} ***/ /*** submitAddCompany() {{{ ***/ function submitAddCompany() { var thisForm = document.form; var formChecker = new FormChecker(); var result = true; result = check_company_form(thisForm); var registrationNumber = $('input[name=registration_number_left]').val() + '-' + $('input[name=registration_number_middle]').val() + '-' + $('input[name=registration_number_right]').val(); var secondaryRegistrationNumber = ''; if ($('#secondaryRegistrationNumber').length > 0) { secondaryRegistrationNumber = $('#secondaryRegistrationNumber').val(); } if(!result) { return false; } checkAvailableRegNum(function(checkResult) { if (checkResult == true) { thisForm.command.value = "companyinfo"; thisForm.selected_menu.value = "companyinfo"; thisForm.action.value = "new_save"; thisForm.submit(); } }); } /*** }}} ***/ /*** checkAvailableRegNum() {{{ ***/ function checkAvailableRegNum(callback) { var thisForm = document.form; var formChecker = new FormChecker(); var result = true; result = check_company_form(thisForm); var registrationNumber = $('input[name=registration_number_left]').val() + '-' + $('input[name=registration_number_middle]').val() + '-' + $('input[name=registration_number_right]').val(); var secondaryRegistrationNumber = ''; if ($('#secondaryRegistrationNumber').length > 0) { secondaryRegistrationNumber = $.trim($('#secondaryRegistrationNumber').val()); } if(!result) { return false; } var request = $.ajax({ url: "/ajax/is_avail_registration_number.php", type: "POST", data: { registrationNumber: registrationNumber, secondaryRegistrationNumber: secondaryRegistrationNumber } }); request.always(function(msg) { if (msg != 'true') { var message = registrationNumber; if ($('#secondaryRegistrationNumber').length > 0 && $.trim($('#secondaryRegistrationNumber').val()).length > 0) { message += ', ' + secondaryRegistrationNumber; } message += '은(는) 이미 등록된 사업자등록번호 입니다.'; callback(false); alert(message); return false; } else { callback(true); return true; } }); } /*** }}} ***/ /*** checkAvailableRegNumWithId() {{{ ***/ function checkAvailableRegNumWithId(callback) { var thisForm = document.form; var formChecker = new FormChecker(); var result = true; result = check_company_form(thisForm); var registrationNumber = $('input[name=registration_number_left]').val() + '-' + $('input[name=registration_number_middle]').val() + '-' + $('input[name=registration_number_right]').val(); var secondaryRegistrationNumber = ''; if ($('#secondaryRegistrationNumber').length > 0) { secondaryRegistrationNumber = $.trim($('#secondaryRegistrationNumber').val()); } if(!result) { return false; } var request = $.ajax({ url: "/ajax/is_avail_registration_number_with_id.php", type: "POST", data: { companyId: $('#companyId').val(), registrationNumber: registrationNumber, secondaryRegistrationNumber: secondaryRegistrationNumber } }); request.always(function(msg) { if (msg != 'true') { var message = registrationNumber; if ($('#secondaryRegistrationNumber').length > 0 && $.trim($('#secondaryRegistrationNumber').val()).length > 0) { message += ', ' + secondaryRegistrationNumber; } message += '은(는) 이미 등록된 사업자등록번호 입니다.'; callback(false); alert(message); return false; } else { callback(true); return true; } }); } /*** }}} ***/ /*** submitChangeCompany() {{{ ***/ function submitChangeCompany() { var thisForm = document.form; var formChecker = new FormChecker(); var result = true; result = check_company_form(thisForm); var registrationNumber = $('input[name=registration_number_left]').val() + '-' + $('input[name=registration_number_middle]').val() + '-' + $('input[name=registration_number_right]').val(); var secondaryRegistrationNumber = ''; if ($('#secondaryRegistrationNumber').length > 0) { secondaryRegistrationNumber = $('#secondaryRegistrationNumber').val(); } if(!result) { return false; } checkAvailableRegNumWithId(function(checkResult) { if (checkResult == true) { if (confirm('변경된 내용을 저장하시겠습니까?')) { setCommand('companyinfo'); thisForm.selected_menu.value = "companyinfo"; thisForm.selected_menu.value = "companyinfo"; thisForm.action.value = "edit_save"; thisForm.submit(); return; } else { return false; } } }); } /*** }}} ***/ /*** submitChangeQuestion() {{{ ***/ function submitChangeQuestion() { var thisForm = document.form; var formChecker = new FormChecker(); var res; var selectedQuestionIndex = thisForm.riddle_question_select.selectedIndex; var selectedValue = thisForm.riddle_question_select.options[selectedQuestionIndex].value; if (selectedValue == 0) { alert(LANG['SelectRiddleQuestion']); thisForm.riddle_question.focus(); return false; } else if (selectedValue == 'direct') { if (thisForm.riddle_question_direct.value == '') { alert(LANG['SelectRiddleQuestion']); return false; } else { thisForm.riddle_question.value = thisForm.riddle_question_direct.value; } } else { thisForm.riddle_question.value = selectedValue; } res = formChecker.isEmpty(thisForm.riddle_answer.value); if (res == true) { alert(LANG['EmptyRiddleAnswer']); thisForm.riddle_answer.focus(); return false; } res = formChecker.isEmpty(thisForm.password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.password.focus(); return false; } thisForm.command.value = "change_question"; if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** submitChangeLanguage() {{{ ***/ function submitChangeLanguage() { var thisForm = document.form; var formChecker = new FormChecker(); var res; thisForm.command.value = "change_language"; for (var i=0; i < thisForm.pref_language.length; i++) { if (thisForm.pref_language[i].checked) { var lang = thisForm.pref_language[i].value; } } if (lang == null || lang == "") { alert(LANG['EmptyLanguage']); return false; } if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** submitEnterMyInfo() {{{ ***/ function submitEnterMyInfo() { var thisForm = document.form; var formChecker = new FormChecker(); var res; res = formChecker.isEmpty(thisForm.check_password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.check_password.focus(); return false; } res = formChecker.isValidPassword(thisForm.check_password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.check_password.focus(); return false; } thisForm.command.value = "enter_myinfo"; thisForm.submit(); return true; } /*** }}} ***/ /*** submitFindID() {{{ ***/ function submitFindID(type) { var thisForm = document.form; var result; result = checkFindIDForm(thisForm, type); if (result == true) { thisForm.selected_menu.value = 'findid'; thisForm.command.value = type; thisForm.submit(); } else { return false; } } /*** }}} ***/ /*** checkFindIDForm() {{{ ***/ function checkFindIDForm(aForm, type) { var res; var formChecker = new FormChecker(); var thisForm = aForm; if (type == 'email') { res = formChecker.isEmpty(trim(thisForm.email.value)); if (res == true) { alert(LANG['EmptyEmail']); thisForm.email.focus(); return false; } res = formChecker.isValidEmail(trim(thisForm.email.value)); if (res == false) { alert(LANG['InvalidEmail']); thisForm.email.focus(); return false; } } else if (type == 'domain') { var domain = trim(thisForm.domain.value); domain = toPuny(domain); res = formChecker.isEmpty(domain); if (res == true) { alert(LANG['EmptyDomain']); thisForm.domain.focus(); return false; } res = formChecker.isZone(domain); if (res == false) { alert(LANG['InvalidDomain']); thisForm.domain.focus(); return false; } } else return false; return true; } /*** }}} ***/ /*** submitFindPassword() {{{ ***/ function submitFindPassword() { var result; var formChecker = new FormChecker(); var thisForm = document.form; thisForm.selected_menu.value = 'findpwd'; //or find_password thisForm.submit(); return; } /*** }}} ***/ /*** submitResetPassword() {{{ ***/ function submitResetPassword() { var thisForm = document.form; var result; result = check_reset_user_form(thisForm); if (result == false) return; thisForm.selected_menu.value = "resetpwd"; thisForm.submit(); return; } /*** }}} ***/ /*** submitResendAuthMail() {{{ ***/ function submitResendAuthMail() { var thisForm = document.form; thisForm.action = 'index.html';//'auth_mail_resend.html'; thisForm.selected_menu.value='authmailresend'; thisForm.submit(); } /*** }}} ***/ /*** submitChangeAndResendAuthMail() {{{ ***/ function submitChangeAndResendAuthMail() { var thisForm = document.form; var formChecker = new FormChecker(); var result; if (thisForm.new_email1.value == '') { thisForm.new_email1.focus(); alert(LANG['EmptyEmail']); return; } if (thisForm.new_email2.value == '') { thisForm.new_email2.focus(); alert(LANG['EmptyEmail']); return; } if (formChecker.isValidEmail(thisForm.new_email1.value) == false) { thisForm.new_email1.focus(); alert(LANG['InvalidEmail']); return; } if (formChecker.isValidEmail(thisForm.new_email2.value) == false) { thisForm.new_email2.focus(); alert(LANG['InvalidEmail']); return; } if (thisForm.new_email1.value != thisForm.new_email2.value) { alert(LANG['InvalidEmailVerify']); return; } thisForm.selected_menu.value = 'changeemail'; thisForm.submit(); } /*** }}} ***/ /*** check_register_user_form() {{{ ***/ function check_register_user_form(aForm, checkCaptcha) { var thisForm = aForm; var formChecker = new FormChecker(); var res; /*** check empty {{{ ***/ res = formChecker.isEmpty(thisForm.user_id.value); if (res == true) { alert(LANG['EmptyID']); thisForm.user_id.focus(); return false; } res = formChecker.isEmpty(thisForm.id_checked.value); if (res == true) { alert(LANG['IDNotChecked']); thisForm.user_id.focus(); return false; } res = formChecker.isEmpty(thisForm.password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.password.focus(); return false; } res = formChecker.isEmpty(thisForm.password_confirm.value); if (res == true) { alert(LANG['EmptyPasswordConfirm']); thisForm.password_confirm.focus(); return false; } res = formChecker.isEmpty(thisForm.user_name.value); if (res == true) { alert(LANG['EmptyName']); thisForm.user_name.focus(); return false; } res = formChecker.isEmpty(thisForm.email.value); if (res == true) { alert(LANG['EmptyEmail']); thisForm.email.focus(); return false; } /* useMultiLanguage var selectedLanguageIndex = thisForm.pref_language.selectedIndex; var selectedValue = thisForm.pref_language.options[selectedLanguageIndex].value; if (selectedValue == 0) { alert(LANG['SelectLanguage']); thisForm.pref_language.focus(); return false; } */ var selectedQuestionIndex = thisForm.riddle_question_select.selectedIndex; var selectedValue = thisForm.riddle_question_select.options[selectedQuestionIndex].value; if (selectedValue == 0) { alert(LANG['SelectRiddleQuestion']); thisForm.riddle_question.focus(); return false; } else if (selectedValue == 'direct') { if (thisForm.riddle_question_direct.value == '') { alert(LANG['SelectRiddleQuestion']); return false; } else { thisForm.riddle_question.value = thisForm.riddle_question_direct.value; } } else { thisForm.riddle_question.value = selectedValue; } res = formChecker.isEmpty(thisForm.riddle_answer.value); if (res == true) { alert(LANG['EmptyRiddleAnswer']); thisForm.riddle_answer.focus(); return false; } if (checkCaptcha == true) { res = formChecker.isEmpty(thisForm.security_code.value); if (res == true) { alert(LANG['EmptyCaptcha']); thisForm.security_code.focus(); return false; } } /*** }}} ***/ /*** check validation {{{ ***/ res = formChecker.isValidID(thisForm.user_id.value); if (res == false) { alert(LANG['InvalidID']); thisForm.user_id.focus(); return false; } res = formChecker.isValidPassword(thisForm.password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.password.focus(); return false; } if (thisForm.password.value != thisForm.password_confirm.value) { alert(LANG['FailPasswordConfirm']); thisForm.password_confirm.focus(); return false; } res = formChecker.isValidEmail(trim(thisForm.email.value)); if (res == false) { alert(LANG['InvalidEmail']); thisForm.email.focus(); return false; } if (trim(thisForm.email.value) != trim(thisForm.emailVerify.value)) { alert(LANG['InvalidEmailVerify']); thisForm.email.focus(); return false; } /*** }}} ***/ return true; } /*** }}} ***/ /*** check_edit_myinfo_form() {{{ ***/ function check_edit_myinfo_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var res; /*** check empty {{{ ***/ res = formChecker.isEmpty(thisForm.user_id.value); if (res == true) { alert(LANG['EmptyID']); thisForm.user_id.focus(); return false; } res = formChecker.isEmpty(thisForm.password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.password.focus(); return false; } res = formChecker.isEmpty(thisForm.user_name.value); if (res == true) { alert(LANG['EmptyName']); thisForm.user_name.focus(); return false; } /* useMultiLanguage var selectedLanguageIndex = thisForm.pref_language.selectedIndex; var selectedValue = thisForm.pref_language.options[selectedLanguageIndex].value; if (selectedValue == 0) { alert(LANG['SelectLanguage']); thisForm.pref_language.focus(); return false; } */ /*** }}} ***/ /*** check validation {{{ ***/ res = formChecker.isValidID(thisForm.user_id.value); if (res == false) { alert(LANG['InvalidID']); thisForm.user_id.focus(); return false; } res = formChecker.isValidPassword(thisForm.password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.password.focus(); return false; } /*** }}} ***/ return true; } /*** }}} ***/ /*** check_reset_user_form() {{{ ***/ function check_reset_user_form(aForm) { var thisForm = aForm; var formChecker = new FormChecker(); var res; /*** check empty {{{ ***/ res = formChecker.isEmpty(thisForm.new_password.value); if (res == true) { alert(LANG['EmptyPassword']); thisForm.new_password.focus(); return false; } res = formChecker.isEmpty(thisForm.new_password_confirm.value); if (res == true) { alert(LANG['EmptyPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } /*** }}} ***/ /*** check validation {{{ ***/ res = formChecker.isValidPassword(thisForm.new_password.value); if (res == false) { alert(LANG['InvalidPassword']); thisForm.new_password.focus(); return false; } if (thisForm.new_password.value != thisForm.new_password_confirm.value) { alert(LANG['FailPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } if (thisForm.new_password.value != thisForm.new_password_confirm.value) { alert(LANG['FailPasswordConfirm']); thisForm.new_password_confirm.focus(); return false; } /*** }}} ***/ return true; } /*** }}} ***/ ///*** XXX changeManageMode() {{{ ***/ ///********************************************* //* @param string manageMode easy or advanced //*********************************************/ //function changeManageMode(manageMode) //{ // var thisForm = document.form; // // var selectedIndex = thisForm.user_domain.selectedIndex; // var userDomain = thisForm.user_domain.options[selectedIndex].value; // var selectedMenu = thisForm.selected_menu.value; // // goURL = "/www/start.html?manage_mode=" + manageMode + "&user_domain=" + userDomain + "&selected_menu=" + selectedMenu; // document.location.href = goURL; // //document.form.submit(); // return; //} ///*** }}} ***/ /*** AuthMail ***/ /*** addAuthMailInSelectbox() {{{ ***/ function addAuthMailInSelectbox() { var to_addr = document.form.to_addr.value; if (to_addr == "add") goMenu('editauthmail'); return true; } /*** }}} ***/ /*** Edit DDNS ***/ /*** authCodeSubmit() {{{ ***/ function authCodeSubmit(command) { var thisForm = document.form; var formChecker = new FormChecker(); if (command == 'show_auth_code') { if (thisForm.mode.value == 'client') { result = formChecker.isEmpty(thisForm.security_code.value); if (result == true) { alert(LANG['EmptyCaptcha']); thisForm.security_code.focus(); return false; } result = formChecker.isEmpty(thisForm.user_id.value); if (result == true) { alert(LANG['EmptyID']); thisForm.user_id.focus(); return false; } } result = formChecker.isEmpty(thisForm.input_real_pass.value); if (result == true) { alert(LANG['EmptyPassword']); thisForm.input_real_pass.focus(); return false; } } if (command == 'edit_auth_code') { res = formChecker.isValidAuthcode(thisForm.new_auth_code.value); if (res == false) { alert(LANG['InvalidAuthCode']); thisForm.command.value = 'show_auth_code2'; thisForm.new_auth_code.focus(); return false; } } //SET COMMAND thisForm.command.value = command; thisForm.submit(); return; } /*** }}} ***/ /*** openerGoMenu() {{{ ***/ /********************************************* * go menu TODO,FIXME different action in IE 6, 5 * * @param string menuStr viewzone, edit_a, edit_mx *********************************************/ var pageFocus; function openerGoMenu(selectedMenu, pageFocus) { var thisForm = document.form; var openerForm = opener.document.form; var userDomain = openerForm.user_domain.value; var skey = openerForm.skey.value; goURL = "/start.html?user_domain=" + userDomain + "&selected_menu=" + selectedMenu + "&skey="+skey; if (pageFocus) goURL += "#"+pageFocus; opener.document.location.href = goURL; return true; } /*** }}} ***/ /*** Edit Webforward meta tag ***/ /*** editMetaTag() {{{ ***/ var editWebforwadMetaTagConfWindow = null; function editMetaTag(userdomain, subdomain, ip, menu) { var thisForm = document.form; var windowWidth = 890; var windowHeight = 830; var left = (screen.width/2) - (windowWidth/2); var top = (screen.height/2) - (windowHeight/2); if (editWebforwadMetaTagConfWindow != null) { editWebforwadMetaTagConfWindow.close(); } editWebforwadMetaTagConfWindow = window.open("/WF/edit_WF_meta.html?user_domain="+userdomain+"&sub_domain="+subdomain, "editmetatag", "width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + ", location=no, toolbar=no, resizable=no, status=no, scrollbars=yes"); editWebforwadMetaTagConfWindow.focus(); } /*** }}} ***/ /*** submitChangeMetaTag() {{{ ***/ function submitChangeMetaTag() { var thisForm = document.form; var result; var formChecker = new FormChecker(); thisForm.command.value = "change_meta_conf"; if (confirm(LANG['ConfirmEdit'])) { thisForm.submit(); } return; } /*** }}} ***/ /*** Edit SRV ***/ /*** makeSRVNewRecord() {{{ ***/ /********************************************* * User input record element, then make record string * * need form value * - service_name * - protocol_name * - subname * - new_priority * - new_weight * - new_port * - new_target *********************************************/ function makeSRVNewRecord() { var thisForm = document.form; var recordString = ''; var serviceName = thisForm.service_name.value; var protocolName = thisForm.protocol_name.value; var subName = thisForm.subname.value; var selectedIndex = thisForm.user_domain.selectedIndex; var userDomain = thisForm.user_domain.options[selectedIndex].value; var priority = thisForm.new_priority.value; var weight = thisForm.new_weight.value; var port = thisForm.new_port.value; var target = thisForm.new_target.value; if (serviceName) { if (serviceName == 'direct_input_service') { document.getElementById( "user_service_name_div" ).style.display = ""; if (thisForm.user_service_name.value) { if (thisForm.user_service_name.value.substring(0,1) != '_') { thisForm.user_service_name.value = '_' + thisForm.user_service_name.value; } recordString += thisForm.user_service_name.value + '.'; } } else { document.getElementById( "user_service_name_div" ).style.display = "none"; recordString += thisForm.service_name.value + '.'; } } if (protocolName) { if (protocolName == 'direct_input_protocol') { document.getElementById( "user_protocol_name_div" ).style.display = ""; if (thisForm.user_protocol_name.value) { if (thisForm.user_protocol_name.value.substring(0,1) != '_') { thisForm.user_protocol_name.value = '_' + thisForm.user_protocol_name.value; } recordString += thisForm.user_protocol_name.value + '.'; } } else { document.getElementById( "user_protocol_name_div" ).style.display = "none"; recordString += thisForm.protocol_name.value + '.'; } //recordString += protocolName + '.'; } if (subName == '') { recordString += userDomain + '.'; } else { recordString += subName + '.' + userDomain + '.'; } recordString += ' IN SRV'; if (priority) recordString += ' ' + priority; if (weight) recordString += ' ' + weight; if (port) recordString += ' ' + port; if (target) { if (target.lastIndexOf('.') == (target.length -1)) { recordString += ' ' + target; } else { recordString += ' ' + target + '.'; } } $('.new_record').text(recordString); return; } /*** }}} ***/ /*** Domain Search ***/ function enterForSearch(myfield, e) {//{{{ var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { search(); return false; } else return true; }//}}} /*** meta tag preview ***/ function meta_result(num) {//{{{ if(num==3) { //$('#encoding').val().replace("/ /g",""); if($('#encoding').val() == "custom") { $('#text_'+num).removeAttr("disabled"); } else { $('#text_3').val(''); $('#text_'+num).attr("disabled","disabled"); if ($('#encoding').val() != "") { $('#result_'+num).text(""); $('#result_'+num).append("
"); return; } } } if($('#text_'+num).val()!="" && num != 3) { $('#result_'+num).text(""); $('#result_'+num).append("
"); } else if ($('#text_'+num).val()!="" && num == 3){ $('#result_'+num).text(""); $('#result_'+num).append("
"); } else { $('#result_'+num).text(""); } }//}}} function htmlspecialchars(str) { if (str === undefined) return ""; return str.replace(/[<>"&]/g, function(match){ return (match == "<") ? "<" : (match == ">") ? ">" : (match == '"') ? """ : (match == "&") ? "&" : ""; }); } var zIndex = 900; var isOpenMessageBox = {}; function openMessageBox(token) { var $window = $(window); var $body = $('body'); var $token = $(token); var id = $token.data('id') || 'default'; var href = $token.data('href'); var width = $token.data('width'); var height = $token.data('height') || 0; var delay = $token.data('delay') || 0; var lock = $token.data('lock') || 'default'; var style = ['width:' + width + 'px']; if (height) { style.push('height: ' + height + 'px'); } var iframeStyle = 'style="' + style.join(';') + '"'; var resize = function() { resizeMessageBox(width, height, id); }; var close = function(e) { if (e.keyCode == 27 && lock != 'lock') { closeMessageBox(id); } return false; }; if (isOpenMessageBox[id]) { return; } isOpenMessageBox[id] = { resize: resize, close: close }; $window.keydown(close); $window.scroll(resize); $window.resize(resize); zIndex++; $body.append('
'); zIndex++; $body.append('
'); $body.css('overflow', 'hidden'); var $messageBox = $body.find('#messageBox_' + id); var $messageBoxOverlay = $body.find('#messageBoxOverlay_' + id); $messageBox.hide(); $messageBox.append('