home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 July / PCpro_2005_07.ISO / files / internet / JanaServer / JanaSetup.exe / admin / pruefen_js / httpserver.js < prev    next >
Encoding:
Text File  |  2005-03-21  |  4.2 KB  |  214 lines

  1. function leeren()
  2. {
  3.     document.formular.edit.value = '';
  4.     document.formular.Item.value = '';
  5. }
  6.  
  7. /**/
  8.  
  9. function feld_disabled()
  10. {
  11.     with (document.formular)
  12.     {
  13.         var c2 = C2.checked;
  14.  
  15.         if (c2 == true)
  16.             T4.disabled = false;
  17.         else
  18.             T4.disabled = true;
  19.     }
  20. }
  21.  
  22. /**/
  23.  
  24. function Abfrage(edi, ite)
  25. {
  26.     var Check = confirm(txt[20][31]);
  27.  
  28.     with (document.formular)
  29.     {
  30.         if ((Check == true) && (pruefen() == true))
  31.         {
  32.             var c2 = C2.checked;
  33.  
  34.             T4.disabled = ((c2 == true) || (T4.value == '')) ? false : true;
  35.  
  36.             edit.value = '' + edi + '';
  37.             Item.value = '' + ite + '';
  38.  
  39.             submit();
  40.         }
  41.         else
  42.         {
  43.             edit.value = '';
  44.             Item.value = '';
  45.         }
  46.     }
  47. }
  48.  
  49. /**/
  50.  
  51. function edit(edi, ite)
  52. {
  53.     with (document.formular)
  54.     {
  55.         if (pruefen() == true)
  56.         {
  57.             var c2 = C2.checked;
  58.  
  59.             T4.disabled = ((c2 == true) || (T4.value == '')) ? false : true;
  60.  
  61.             edit.value = '' + edi + '';
  62.             Item.value = '' + ite + '';
  63.  
  64.             submit();
  65.         }
  66.     }
  67. }
  68.  
  69. /**/
  70.  
  71. function send()
  72. {
  73.     if (pruefen() == true)
  74.     {
  75.         with (document.formular)
  76.         {
  77.             var c2 = C2.checked;
  78.  
  79.             T4.disabled = ((c2 == true) || (T4.value == '')) ? false : true;
  80.  
  81.             submit();
  82.         }
  83.     }
  84. }
  85.  
  86. /**/
  87.  
  88. function pruefen()
  89. {
  90.     var c2 = document.formular.C2;
  91.     var f1 = document.formular.T1.value;
  92.     var f2 = document.formular.T2.value;
  93.     var f3 = document.formular.T3.value;
  94.     var f4 = document.formular.T4.value;
  95.     var pr = new Array(f1, f2);
  96.     var fe = new Array('T1', 'T2');
  97.  
  98.     for (i = 0; i < pr.length; i++)
  99.     {
  100.         var se = document.formular.elements[fe[i]];
  101.  
  102.         if (pr[i].charAt(0) == '"')
  103.         {
  104.             alert(txt[28][28]);
  105.             document.formular.edit.value = '';
  106.             document.formular.Item.value = '';
  107.             se.select();
  108.             se.focus();
  109.             return false;
  110.         }
  111.  
  112.         if (pr[i].charAt(pr[i].length - 1) == '\\')
  113.         {
  114.             alert(pr[i] + '\r\n\r\n' + txt[28][26]);
  115.             document.formular.edit.value = '';
  116.             document.formular.Item.value = '';
  117.             se.select();
  118.             se.focus();
  119.             return false;
  120.         }
  121.  
  122.         if (pr[i].substr(pr[i].length - 2, 2) == '\\"')
  123.         {
  124.             alert(pr[i].substr(0, pr[i].length - 1) + '\r\n\r\n' + txt[28][26]);
  125.             document.formular.edit.value = '';
  126.             document.formular.Item.value = '';
  127.             se.select();
  128.             se.focus();
  129.             return false;
  130.         }
  131.  
  132.         var tea = pr[i].split('\\');
  133.  
  134.         if (pr[i].substr(0, 2) != '\\\\')
  135.         {
  136.             if (/^([c-z])+([:])$/i.test(tea[0]) == false)
  137.             {
  138.                 alert(tea[0] + '\r\n\r\n' + txt[28][22]);
  139.                 document.formular.edit.value = '';
  140.                 document.formular.Item.value = '';
  141.                 se.select();
  142.                 se.focus();
  143.                 return false;
  144.             }
  145.         }
  146.  
  147.         var z = (pr[i].substr(0,2) != '\\\\') ? 1 : 2;
  148.  
  149.         for (k = z; k < tea.length; k++)
  150.         {
  151.             if (tea[k].indexOf(' ') != -1)
  152.             {
  153.                 if (tea[k].indexOf('"') == -1)
  154.                 {
  155.                     alert(txt[29][13] + '\r\n\r\n"' + tea[k] + '"');
  156.                     document.formular.edit.value = '';
  157.                     document.formular.Item.value = '';
  158.                     se.select();
  159.                     se.focus();
  160.                     return false;
  161.                 }
  162.             }
  163.  
  164.             if (tea[k].indexOf('"') != -1)
  165.             {
  166.                 if ((tea[k].charAt(0) != '"') || (tea[k].charAt(tea[k].length - 1) != '"'))
  167.                 {
  168.                     alert(txt[29][14] + '\r\n\r\n"' + tea[k] + '"');
  169.                     document.formular.edit.value = '';
  170.                     document.formular.Item.value = '';
  171.                     se.select();
  172.                     se.focus();
  173.                     return false;
  174.                 }
  175.             }
  176.  
  177.             var x   = (tea[k].charAt(0) != '"') ? 0 : 1;
  178.             var teb = tea[k].slice(x, tea[k].length - x);
  179.  
  180.             if (/^([_a-z0-9- .]+)$/i.test(teb) == false)
  181.             {
  182.                 alert(teb + '\r\n\r\n' + txt[28][23]);
  183.                 document.formular.edit.value = '';
  184.                 document.formular.Item.value = '';
  185.                 se.select();
  186.                 se.focus();
  187.                 return false;
  188.             }
  189.         }
  190.     }
  191.  
  192.     if ((f3.match(/\D/) != null) || (f3 < 10) || (f3 > 1200))
  193.     {
  194.         alert(txt[19][9] + txt[29][9] + ' "\t\r\n' + txt[29][12]);
  195.         document.formular.edit.value = '';
  196.         document.formular.Item.value = '';
  197.         document.formular.T3.select();
  198.         document.formular.T3.focus();
  199.         return false;
  200.     }
  201.  
  202.     if ((c2.checked == true) && (f4 == ''))
  203.     {
  204.         alert(txt[22][8] + txt[29][18] + txt[22][9]);
  205.         document.formular.edit.value = '';
  206.         document.formular.Item.value = '';
  207.         document.formular.T4.select();
  208.         document.formular.T4.focus();
  209.         return false;
  210.     }
  211.  
  212.     if (filter_send() == true)
  213.         return true;
  214. }