userSettings.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* $Id: userSettings.js 2937 2007-04-20 18:42:51Z b4rt $ */
  2. /**
  3. * validateUser
  4. */
  5. function validateUser(_USERIDREQUIRED, _PASSWORDLENGTH, _PASSWORDNOTMATCH, _PLEASECHECKFOLLOWING) {
  6. var msg = ""
  7. if (theForm.user_id.value == "") {
  8. msg = msg + "* " + _USERIDREQUIRED + "\n";
  9. theForm.user_id.focus();
  10. }
  11. if (theForm.pass1.value != "" || theForm.pass2.value != "") {
  12. if (theForm.pass1.value.length <= 5 || theForm.pass2.value.length <= 5) {
  13. msg = msg + "* " + _PASSWORDLENGTH + "\n";
  14. theForm.pass1.focus();
  15. }
  16. if (theForm.pass1.value != theForm.pass2.value) {
  17. msg = msg + "* " + _PASSWORDNOTMATCH + "\n";
  18. theForm.pass1.value = "";
  19. theForm.pass2.value = "";
  20. theForm.pass1.focus();
  21. }
  22. }
  23. if (msg != "") {
  24. alert(_PLEASECHECKFOLLOWING + ":\n\n" + msg);
  25. return false;
  26. } else {
  27. return true;
  28. }
  29. }
  30. /**
  31. * validateProfile
  32. */
  33. function validateProfile(isCreate, _USERIDREQUIRED, _PASSWORDLENGTH, _PASSWORDNOTMATCH, _PLEASECHECKFOLLOWING) {
  34. var msg = ""
  35. if (isCreate == 1) {
  36. if (theForm.newUser.value == "") {
  37. msg = msg + "* " + _USERIDREQUIRED + "\n";
  38. theForm.newUser.focus();
  39. }
  40. }
  41. if (theForm.pass1.value != "" || theForm.pass2.value != "") {
  42. if (theForm.pass1.value.length <= 5 || theForm.pass2.value.length <= 5) {
  43. msg = msg + "* " + _PASSWORDLENGTH + "\n";
  44. theForm.pass1.focus();
  45. }
  46. if (theForm.pass1.value != theForm.pass2.value) {
  47. msg = msg + "* " + _PASSWORDNOTMATCH + "\n";
  48. theForm.pass1.value = "";
  49. theForm.pass2.value = "";
  50. theForm.pass1.focus();
  51. }
  52. } else {
  53. if (isCreate == 1) {
  54. msg = msg + "* " + _PASSWORDLENGTH + "\n";
  55. theForm.pass1.focus();
  56. }
  57. }
  58. if (msg != "") {
  59. alert(_PLEASECHECKFOLLOWING + ":\n\n" + msg);
  60. return false;
  61. } else {
  62. return true;
  63. }
  64. }
  65. /**
  66. * validateSettings
  67. */
  68. function validateSettings() {
  69. var msg = "";
  70. if (isUnsignedNumber(document.settingsForm.page_refresh.value) == false ) {
  71. msg = msg + "* Page Refresh Interval must be a valid number.\n";
  72. document.settingsForm.page_refresh.focus();
  73. }
  74. if (isUnsignedNumber(document.settingsForm.index_ajax_update.value) == false ) {
  75. msg = msg + "* AJAX Update Interval must be a valid number.\n";
  76. document.settingsForm.index_ajax_update.focus();
  77. }
  78. if (isUnsignedNumber(document.settingsForm.transferStatsUpdate.value) == false) {
  79. msg = msg + "* Download-Details Update Interval must be a valid number.\n";
  80. document.settingsForm.transferStatsUpdate.focus();
  81. }
  82. if (isUnsignedNumber(document.settingsForm.servermon_update.value) == false) {
  83. msg = msg + "* Server Monitor Update Interval must be a valid number.\n";
  84. document.settingsForm.servermon_update.focus();
  85. }
  86. if (msg != "") {
  87. alert("Please check the following:\n\n" + msg);
  88. return false;
  89. } else {
  90. return true;
  91. }
  92. }