Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f4b1ce59

Von Sven Schöling vor etwa 7 Jahren hinzugefügt

  • ID f4b1ce59ca07f16bfe47a2fe95df806920bae9e2
  • Vorgänger be6d3645
  • Nachfolger 36e2bf67

js/common.js: show_alert_and_focus auf annotate umgeschrieben

Unterschiede anzeigen:

js/common.js
34 34
}
35 35

  
36 36
function check_right_number_format(input_name) {
37
  if(decpoint && thpoint && thpoint == decpoint) {
38
    return show_alert_and_focus(input_name, wrongNumberFormat);
39
  }
40 37
  var test_val = input_name.value;
41 38
  if(thpoint && thpoint == ','){
42 39
    test_val = test_val.replace(/,/g, '');
......
52 49
  }
53 50
  var forbidden = test_val.match(/[^\s\d\(\)\-\+\*\/\.]/g);
54 51
  if (forbidden && forbidden.length > 0 ){
55
    return show_alert_and_focus(input_name, wrongNumberFormat);
52
    return annotate(input_name, kivi.t8('wrongformat'), kivi.myconfig.numberformat);
56 53
  }
57 54

  
58 55
  try{
59 56
    eval(test_val);
60 57
  }catch(err){
61
    return show_alert_and_focus(input_name, wrongNumberFormat);
58
    return annotate(input_name, kivi.t8('wrongformat'), kivi.myconfig.numberformat);
62 59
  }
63 60

  
61
  return annotate(input_name);
64 62
}
65 63

  
66 64
function check_right_date_format(input_name) {
67 65
  if(input_name.value == "") {
66
    annotate(input_name);
68 67
    return true;
69 68
  }
70 69

  
......
111 110
  if(!(dateFormat.lastIndexOf("y") == 3) && !matching.test(input_name.value)) {
112 111
    matching = new RegExp(dateFormat.replace(/\w/g, '\\d') + '\\d\\d\$', "ig");
113 112
    if(!matching.test(input_name.value)) {
114
      return show_alert_and_focus(input_name, wrongDateFormat);
113
      return annotate(input_name, kivi.t8('Falsches Datumsformat!'), kivi.myconfig.dateformat);
115 114
    }
116 115
  }
117 116
  else {
118 117
    if (dateFormat.lastIndexOf("y") == 3 && !matching.test(input_name.value)) {
119
      return show_alert_and_focus(input_name, wrongDateFormat);
118
      return annotate(input_name, kivi.t8('Falsches Datumsformat!'), kivi.myconfig.dateformat);
120 119
    }
121 120
  }
121
  return annotate(input_name);
122 122
}
123 123

  
124
function show_alert_and_focus(input_name, errorMessage) {
125
  input_name.select();
126
  alert(errorMessage + "\n\r\n\r--> " + input_name.value);
127
  input_name.focus();
128
  return false;
124
function annotate(input_name, error, expected) {
125
  var $e = $(input_name);
126
  if (error) {
127
    $e.addClass('kivi-validator-invalid');
128
    var tooltip = error + ' (' + expected + ')';
129
    if ($e.hasClass('tooltipstered'))
130
      $e.tooltipster('destroy');
131

  
132
    $e.tooltipster({
133
      content: tooltip,
134
      theme: 'tooltipster-light',
135
    });
136
    $e.tooltipster('show');
137
  } else {
138
    $e.removeClass('kivi-validator-invalid');
139
    if ($e.hasClass('tooltipstered'))
140
      $e.tooltipster('destroy');
141
  }
129 142
}
130 143

  
131 144
function get_input_value(input_name) {
js/locale/de.js
56 56
"Edit text block":"Textblock bearbeiten",
57 57
"Enter longdescription":"Langtext eingeben",
58 58
"Error: Name missing":"Fehler: Name fehlt",
59
"Falsches Datumsformat!":"Falsches Datumsformat!",
59 60
"File upload":"Datei Upload",
60 61
"Function block actions":"Funktionsblockaktionen",
61 62
"Generate and print sales delivery orders":"Erzeuge und drucke Lieferscheine",
......
138 139
"sort items":"Positionen sortieren",
139 140
"start upload":"Hochladen beginnt",
140 141
"time and effort based position":"Aufwandsposition",
141
"uploaded":"Hochgeladen"
142
"uploaded":"Hochgeladen",
143
"wrongformat":"Falsches Format"
142 144
});

Auch abrufbar als: Unified diff