function profile() { } profile.editFio = function() { //alert("start"); var newName=new Array(); newName[1]=""; newName[2]=""; newName[3]=""; newName[4]=""; //alert(newName[1]); $("#surnameUser").html(newName[1]); $("#nameUser").html(newName[2]); $("#midnameUser").html(newName[3]); $("#commentUser").html(newName[4]); //alert("new"); //alert($("#saveFio").val()); $("#saveFio").html("Сохранить"); //$("#saveFio").unbind('click','pupils.editFio();'); //$("#saveFio").bind('click','alert("новая обработка");'); //$("#saveFio").click(function(){alert('новая обработка');}); $("#saveFio").each(function() { this.onclick = function() {$("#saveFioText").val("1");document.forms[0].submit();}}); //alert($("#saveFioText").val()); $(".CONTENT_2").html(''); //alert("test"); $(".greenArrow").html(''); } profile.editSchoolText = function() { newName=""; $("#nameSchool").html(newName); $("#saveSchool").val("Сохранить"); $("#saveSchool").each(function() { this.onclick = function() {$("#saveSchoolText").val("1");document.formRight.submit();}}); } profile.editRonoText = function() { var newName=""; var newPhone=""; var newAddress=""; var newComment=""; //alert(newAddress); $("#nameSchool").html(newName); $("#phoneSchool").html(newPhone); $("#addressSchool").html(newAddress); $("#commentSchool").html(newComment); $("#saveRono").val("Сохранить"); $("#saveRono").each(function() { this.onclick = function() {$("#saveRonoText").val("1");document.formRight.submit();}}); } profile.editContact = function() { var newPhone=new Array(); newPhone[1]=""; newPhone[2]=""; newPhone[3]=""; var newMail=""; $("#cell_country_code").html(newPhone[1]); $("#cell_operator_code").html(newPhone[2]); $("#cell_user_code").html(newPhone[3]); $("#email").html(newMail); $("#optin").removeAttr("disabled"); $("#saveContact").val("Сохранить"); $("#saveContact").each(function() { this.onclick = function() {$("#saveContactText").val("1");document.formRight.submit();}}); } profile.editGroups = function() { var newName=new Array(); newName[1]=""; newName[2]=""; newName[3]=""; var i,nameVal; for (i=1;i<11;i++) { nameVal="#name_"+i; newName=""; $(nameVal).html(newName); } $("#saveGroups").val("Сохранить"); $("#saveGroups").each(function() { this.onclick = function() {$("#saveGroupsText").val("1");document.formRight.submit();}}); } profile.editLogin = function() { var newLogin=""; var newPass=""; $("#login").html(newLogin); $("#pass").html(newPass); var text="Старый пароль: "+ "Новый пароль: "+ "Подтверждение пароля: "+ " "+ ""; $('table[id="passTable"] tr:gt(1)').remove(); $('table[id="passTable"]').append(text); /*$('tr[id="loginBlock"]').append("Старый пароль: "); alert($('tr[id="loginBlock"]').html());*/ $("#saveLogin").val("Сохранить"); $("#saveLogin").each(function() { this.onclick = function() {$("#saveLoginText").val("1");document.formRight.submit();}}); } profile.checkMail = function() { var mail=$("#email_input").val(); if(mail!="" && !mail.match(/^[\w]+[\w\.\-_]*@[\w]+[\w\-_\.]*\.[\w]{2,4}$/i) ) { alert( 'Введите корректный электронный адрес! \r\n Адрес <' + mail + '> не является корректным' ); $("#saveContact").attr("disabled","disabled"); $("#saveContact").attr("class","btn_disabled"); } else { $("#saveContact").removeAttr("disabled"); $("#saveContact").attr("class","btn"); } } profile.deleteUser = function() { //alert('start'); var idUser=$("#elem_id").val(); //alert(idUser); $.post("json/user/userDelete.php", { type: "application/x-www-form-urlencoded", idUser:idUser, pref:"dnv" }, function(resText){ //alert(resText); $("#isDelete").html('Пользователь удален'); }); } profile.changeClass = function() { //alert('start'); var idUser=$("#elem_id").val(); var idClass=$("#classes").val(); var comment=$("#comment").val(); //alert(idUser); $.post("json/user/userChangeClass.php", { type: "application/x-www-form-urlencoded", idUser:idUser, idClass:idClass, comment:comment, pref:"dnv" }, function(resText){ //alert(resText); $("#isChange").html('Ученик переведен'); }); } profile.headmanSet = function() { //alert('start'); var idUser=$("#elem_id").val(); $.post("json/user/headmanSet.php", { type: "application/x-www-form-urlencoded", idUser:idUser, pref:"dnv" }, function(resText){ //alert(resText); $("#isChange").html('Ученик назначен старостой.'); }); } profile.headmanDelete = function() { var idUser=$("#elem_id").val(); //alert(idUser); $.post("json/user/headmanDelete.php", { type: "application/x-www-form-urlencoded", idUser:idUser, pref:"dnv" }, function(resText){ //alert(resText); $("#isChange").html('В классе нет старосты.'); }); }