Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

48 righe
1.6 KiB

  1. // Error Console:
  2. var err_console;
  3. var err_list = [];
  4. function errprint(t) {
  5. err_list[err_list.length] = ('<pre style="font-family: Courier, Fixed; font-size: 11px; border-bottom: 1px solid #AAA; overflow: auto; width: 90%;">'+t+'</pre>');
  6. }
  7. function submit_error(e) {
  8. if(isIE) {
  9. var t = 'Explorer: ' + e + '\n' + e.description;
  10. } else {
  11. var t = 'Mozilla: ' + e.toString() + '\n' + e.message + '\nLine Number:' + e.lineNumber;// + '\nStack:' + e.stack;
  12. }
  13. errprint(e + '\nLine Number:' + e.lineNumber + '\nStack:' + e.stack);
  14. }
  15. function setup_err_console() {
  16. err_console = new Dialog(640, 480, 'Error Console')
  17. err_console.make_body([
  18. ['HTML', 'Error List']
  19. ,['Button', 'Clear']
  20. ,['HTML', 'Error Report']
  21. ]);
  22. var span = $a(err_console.widgets['Error Report'], 'span', 'link_type');
  23. span.innerHTML = 'Send Error Report';
  24. span.onclick = function() {
  25. msg = prompt('How / where did you get the error [optional]')
  26. var call_back = function(r, rt){
  27. err_console.hide();
  28. msgprint("Error Report Sent")
  29. }
  30. $c('webnotes.utils.send_error_report', {'err_msg': err_console.rows['Error List'].innerHTML, 'msg': msg}, call_back);
  31. }
  32. err_console.widgets['Clear'].onclick = function() {
  33. err_list = [];
  34. err_console.rows['Error List'].innerHTML = '';
  35. err_console.hide();
  36. }
  37. err_console.onshow = function() {
  38. err_console.rows['Error List'].innerHTML = '<div style="padding: 16px; height: 360px; width: 90%; overflow: auto;">'
  39. + err_list.join('<div style="height: 10px; margin-bottom: 10px; border-bottom: 1px solid #AAA"></div>') + '</div>';
  40. }
  41. }
  42. startup_list.push(setup_err_console);