| | |
| | | $('#nutzerLoeschen').click(um_del_user); |
| | | $('#nutzerNeu').click(um_new_user); |
| | | $('#nutzerLoeschen').prop( "disabled", true ); |
| | | $('#neueRolle').click(um_new_role); |
| | | um_clear_user_form(); |
| | | um_apicall_get_user_list(); |
| | | } |
| | |
| | | } |
| | | |
| | | function um_del_user() { |
| | | var users = []; |
| | | /*var users = []; |
| | | $('#nutzerliste :selected').each(function(i, selected){ |
| | | users[i] = $(selected).text(); |
| | | }); |
| | | });*/ |
| | | |
| | | //alert('delete user ' + users[0]); |
| | | var antwort = confirm("Wollen Sie den Nutzer " + users[0] + " loeschen?"); |
| | | if (antwort == true) { |
| | | var user = new User(users[0], '-', '-', '-', '-'); |
| | | um_apicall_del_user(self.serialisieren(user)); |
| | | } |
| | | var userId = um_get_first_selected_user_id(); |
| | | if(userId !== 'none') { |
| | | var antwort = confirm("Wollen Sie den Nutzer " + usersId + " loeschen?"); |
| | | if (antwort === true) { |
| | | var user = new User(userId, '-', '-', '-', '-'); |
| | | um_apicall_del_user(self.serialisieren(user)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | function um_new_user() { |
| | | alert('show form to enter new user'); |
| | | } |
| | | |
| | | /* ----------- role functions ------------ */ |
| | | |
| | | function um_new_role() { |
| | | var userId = um_get_first_selected_user_id(); |
| | | if(userId === 'none') { |
| | | alert('Es wurde kein Benutzer ausgewaehlt.'); |
| | | } else { |
| | | var answer = prompt("Name der Rolle", ""); |
| | | if (answer === null) { |
| | | alert("Es wurde Cancel betaetigt."); |
| | | } else if(answer !== "") { |
| | | alert("Rolle fuer Benutzer " + userId + " anlegen: " + answer); |
| | | } else { |
| | | alert("OK betaetigt, aber Keine Rolle angegeben."); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* ----------- ui interaction ------------ */ |
| | |
| | | $('#kennwortw').val(''); |
| | | } |
| | | |
| | | function um_get_first_selected_user_id() { |
| | | var userId = 'none'; |
| | | var userIds = []; |
| | | $('#nutzerliste :selected').each(function(i, selected){ |
| | | userIds[i] = $(selected).text(); |
| | | }); |
| | | if(userIds.length > 0) { |
| | | userId = userIds[0]; |
| | | } |
| | | return userId; |
| | | } |
| | | |
| | | /* ---- api calls ----- */ |
| | | |
| | | function um_apicall_create_user(user) { |