javascript.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. function clearCache() {
  2. for (var i = 0; i <= document.getElementsByTagName('select').length-1; i++) {
  3. document.getElementsByTagName('select')[i].selectedIndex = 0;
  4. }
  5. for (var i = 0; i <= document.getElementsByTagName('input').length-1; i++) {
  6. if ( document.getElementsByTagName('input')[i].type == 'text' ) {
  7. document.getElementsByTagName('input')[i].value = '';
  8. }
  9. }
  10. }
  11. function filterHelper(control) {
  12. if ( document.filter_form.Modell_1.options[document.filter_form.Modell_1.selectedIndex].text != '' && isNaN(control) ) {
  13. document.filter_form.Modell_3.value = document.filter_form.Modell_1.options[document.filter_form.Modell_1.selectedIndex].text;
  14. document.filter_form.Fgst_3.value = '';
  15. document.filter_form.Optcode_3.value = '';
  16. } else if ( document.filter_form.Modell_1.options[document.filter_form.Modell_1.selectedIndex].text != '' && document.getElementsByName("Modell_2")[0].value != '' ) {
  17. //Wert wird durch searchHelper() schon eingetragen
  18. } else if ( document.filter_form.Modell_1.options[document.filter_form.Modell_1.selectedIndex].text == '' && isNaN(document.getElementsByName("Modell_2")[0]) && isNaN(control) ) {
  19. document.filter_form.Modell_3.value = '';
  20. }
  21. if ( isNaN(document.getElementsByName("Fgst_1")[0]) && isNaN(control) ) {
  22. document.filter_form.Fgst_3.value = '';
  23. } else if ( document.getElementsByName("Fgst_1")[0].value == '' ) {
  24. document.filter_form.Fgst_3.value = '';
  25. }
  26. if ( isNaN(document.getElementsByName("Optcode_1")[0]) && isNaN(control) ) {
  27. document.filter_form.Optcode_3.value = '';
  28. } else if ( document.getElementsByName("Optcode_1")[0].value == '' ) {
  29. document.filter_form.Optcode_3.value = '';
  30. }
  31. }
  32. function searchHelper() {
  33. var reg = /\*/;
  34. document.filter_form.Modell_3.value = '*' + document.getElementsByName("Modell_2")[0].value + '*';
  35. document.filter_form.Fgst_3.value = '*' + document.getElementsByName("Fgst_1")[0].value;
  36. document.filter_form.Optcode_3.value = '*' + document.getElementsByName("Optcode_1")[0].value + '*';
  37. while ( reg.test(document.filter_form.Modell_3.value) == true ) {
  38. document.filter_form.Modell_3.value = document.filter_form.Modell_3.value.replace(/\*/, '%');
  39. }
  40. while ( reg.test(document.filter_form.Fgst_3.value) == true ) {
  41. document.filter_form.Fgst_3.value = document.filter_form.Fgst_3.value.replace(/\*/, '%');
  42. }
  43. while ( reg.test(document.filter_form.Optcode_3.value) == true ) {
  44. document.filter_form.Optcode_3.value = document.filter_form.Optcode_3.value.replace(/\*/, '%');
  45. }
  46. }
  47. function Semaphor(i) {
  48. sem = window.open("semaphor.php", "Semaphor");
  49. sem.focus;
  50. }
  51. function table_resize(){
  52. if(document.getElementsByName('datefrom')[0]){
  53. if(document.getElementsByName('datefrom')[0].value != '' && document.getElementsByName('dateuntil')[0].value != ''){
  54. var field1_exp = document.getElementsByName('datefrom')[0].value.split("-");
  55. var field2_exp = document.getElementsByName('dateuntil')[0].value.split("-");
  56. if(field1_exp.length == 3)
  57. document.getElementsByName('datefrom')[0].value = field1_exp[2]+"."+field1_exp[1]+"."+field1_exp[0];
  58. if(field2_exp.length == 3)
  59. document.getElementsByName('dateuntil')[0].value = field2_exp[2]+"."+field2_exp[1]+"."+field2_exp[0];
  60. }
  61. }
  62. if(document.all['report_content_header_table'] && document.all['report_content_table_table']){
  63. window.status = "Die Darstellung der Tabelle ist von der Auflösung Ihres Desktops abhängig.";
  64. /* document.all['report_content'].style.height = document.all['report_content'].offsetHeight;
  65. document.all['report_content_table'].style.width = document.all['report_content'].offsetWidth;
  66. document.all['report_content_header'].style.width = document.all['report_content'].offsetWidth;
  67. document.all['report_content_header_table'].style.width = "100%";
  68. document.all['report_content_table_table'].style.width = "100%";
  69. alert(document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td").length + ' - ' + document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td").length);
  70. if(document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td").length == document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td").length){
  71. */
  72. /* for(i=0; i < document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td").length; i++){
  73. if(document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].offsetWidth < document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].offsetWidth){
  74. document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].style.width = document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].offsetWidth
  75. document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].style.width = document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].offsetWidth;
  76. }else{
  77. document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].style.width = document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].offsetWidth;
  78. document.all['report_content_table_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].style.width = document.all['report_content_header_table'].getElementsByTagName("tr")[0].getElementsByTagName("td")[i].offsetWidth;
  79. }alert("stop");
  80. }
  81. */
  82. document.all['report_content_table'].style.height = (document.all['report_content'].offsetHeight - document.all['report_content_header'].offsetHeight) - 10;
  83. document.all['report_content_table'].style.top = document.all['report_content_header'].offsetHeight + 5;
  84. /* }else{
  85. alert("Auf dieser Seite wurde ein Fehler in der grafischen Darstellung festgestellt der nicht behoben werden konnte. Bitte wenden Sie sich an den Systemadministrator.");
  86. }
  87. */
  88. }
  89. }
  90. //Alte Funktion für die Bearbeiten Seite NICHT LÖSCHEN (wird noch benötigt für WV Feld)
  91. function dateFormatEdit()
  92. {
  93. var elementValue = new Array;
  94. var ret = true;
  95. for(var i = 0; i < document.phpMyEdit_form.elements.length; i++)
  96. {
  97. if(document.phpMyEdit_form.elements[i].getAttribute("date"))
  98. {
  99. if(document.phpMyEdit_form.elements[i].value != '')
  100. {
  101. elementValue = document.phpMyEdit_form.elements[i].value.split(".");
  102. if(elementValue.length != 3)
  103. {
  104. alert("Der Vorgang kann nicht durchgeführt werden!\nEin von Ihnen eingegebenes Datum kann nicht verabeitet werden.");
  105. document.phpMyEdit_form.elements[i].style.borderColor = "#FF0000";
  106. ret = false;
  107. }
  108. else
  109. {
  110. document.phpMyEdit_form.elements[i].style.borderColor = "#E8EEFF";
  111. }
  112. }
  113. }
  114. if(document.phpMyEdit_form.elements[i].getAttribute("amount"))
  115. {
  116. if(document.phpMyEdit_form.elements[i].value != '')
  117. {
  118. if(document.phpMyEdit_form.elements[i].value.search(/\w/) == -1)
  119. {
  120. alert("Der Vorgang kann nicht durchgeführt werden!\nEin von Ihnen eingegebener Betrag kann nicht verabeitet werden.");
  121. document.phpMyEdit_form.elements[i].style.borderColor = "#FF0000";
  122. ret = false;
  123. }
  124. else
  125. {
  126. document.phpMyEdit_form.elements[i].style.borderColor = "#E8EEFF";
  127. }
  128. }
  129. }
  130. }
  131. if(ret === true)
  132. {
  133. for(var i = 0; i < document.phpMyEdit_form.elements.length; i++)
  134. {
  135. if(document.phpMyEdit_form.elements[i].getAttribute("date"))
  136. {
  137. if(document.phpMyEdit_form.elements[i].value != '')
  138. {
  139. document.phpMyEdit_form.elements[i].style.color = '#FFFFFF';
  140. elementValue = document.phpMyEdit_form.elements[i].value.split(".");
  141. document.phpMyEdit_form.elements[i].value = elementValue[2]+"-"+elementValue[1]+"-"+elementValue[0];
  142. }
  143. }
  144. if(document.phpMyEdit_form.elements[i].getAttribute("amount"))
  145. {
  146. if(document.phpMyEdit_form.elements[i].value != '')
  147. {
  148. document.phpMyEdit_form.elements[i].style.color = '#FFFFFF';
  149. document.phpMyEdit_form.elements[i].value = document.phpMyEdit_form.elements[i].value.replace(/\./, "");
  150. document.phpMyEdit_form.elements[i].value = document.phpMyEdit_form.elements[i].value.replace(/,/, ".");
  151. }
  152. }
  153. }
  154. }
  155. return ret;
  156. }
  157. //Neue Funktion für die Anzeigeseite
  158. function dateFormat(field_name_array)
  159. {
  160. var field_name_array = field_name_array.split(':');
  161. var field_value_array = new Array;
  162. var field_bgcolor_array = new Array;
  163. var ret = true;
  164. for(var i in field_name_array)
  165. {
  166. if(document.getElementsByName(field_name_array[i])[0]){
  167. if(document.getElementsByName(field_name_array[i])[0].value != '')
  168. {
  169. field_value_array[i] = document.getElementsByName(field_name_array[i])[0].value.split(".");
  170. if(field_value_array[i].length != 3)
  171. {
  172. alert('Der Vorgang kann nicht durchgeführt werden! \nEin von Ihnen eingegebenes Datum kann nicht verarbeitet werden. \n\nBestätigen Sie bitte diese Nachricht und ändern Sie das rot makierte Feld.');
  173. document.getElementsByName(field_name_array[i])[0].style.borderColor = '#FF0000';
  174. ret = false;
  175. }else
  176. document.getElementsByName(field_name_array[i])[0].style.borderColor = "#E8EEFF";
  177. }
  178. }
  179. }
  180. if(ret === true)
  181. {
  182. for(var i in field_name_array)
  183. {
  184. if(document.getElementsByName(field_name_array[i])[0]){
  185. if(document.getElementsByName(field_name_array[i])[0].value != '')
  186. {
  187. document.getElementsByName(field_name_array[i])[0].style.color = '#FFFFFF';
  188. //document.getElementsByName(field_name_array[i])[0].value = field_value_array[i][2]+"-"+field_value_array[i][1]+"-"+field_value_array[i][0];
  189. }
  190. }
  191. }
  192. }
  193. return ret;
  194. }