From 2f3c5d8afc1b945a643aa94aeafd5138d1f57528 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 24 Feb 2013 18:07:35 -0500 Subject: [PATCH 1/5] when user changes displayName, also update it on expand button --- settings/js/personal.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/settings/js/personal.js b/settings/js/personal.js index d9455b3786..c5a46a1600 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -31,7 +31,7 @@ $(document).ready(function(){ } }); - + $("#displaynamebutton").click( function(){ if ($('#displayName').val() != '' ) { // Serialize the data @@ -42,6 +42,10 @@ $(document).ready(function(){ $.post( 'ajax/changedisplayname.php', post, function(data){ if( data.status == "success" ){ $('#displaynamechanged').show(); + // update displayName on the top right expand button + str_parts = $('#expand').html().split('\t'); + str_parts[5] = $('#displayName').val(); + $('#expand').html(str_parts.join('\t')); } else{ $('#newdisplayname').val(data.data.displayName) From 278a6f5b416693ed2dbeb13b6cc1fb0dafc9d391 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 24 Feb 2013 18:13:25 -0500 Subject: [PATCH 2/5] update oldDisplayName value on displayName change This patch fixes a bug that can be reproduced in following way: 1. change displayName 2. clear text in displayName input click change again Then you will get an error and previous displayName will be restored. Expected behavior should restore the new updated displayName. --- settings/js/personal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/settings/js/personal.js b/settings/js/personal.js index c5a46a1600..8747c49604 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -42,6 +42,7 @@ $(document).ready(function(){ $.post( 'ajax/changedisplayname.php', post, function(data){ if( data.status == "success" ){ $('#displaynamechanged').show(); + $('#oldDisplayName').val($('#displayName').val()); // update displayName on the top right expand button str_parts = $('#expand').html().split('\t'); str_parts[5] = $('#displayName').val(); From c111a3aa248bee2bff22318c2a3d0da32ea0e451 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 25 Feb 2013 15:40:57 -0500 Subject: [PATCH 3/5] add span tag to displayname on expand button --- core/templates/layout.user.php | 2 +- settings/js/personal.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index d0869cb840..03e55594d6 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -34,7 +34,7 @@
    - +
    diff --git a/settings/js/personal.js b/settings/js/personal.js index 8747c49604..4c8b2542b5 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -44,9 +44,7 @@ $(document).ready(function(){ $('#displaynamechanged').show(); $('#oldDisplayName').val($('#displayName').val()); // update displayName on the top right expand button - str_parts = $('#expand').html().split('\t'); - str_parts[5] = $('#displayName').val(); - $('#expand').html(str_parts.join('\t')); + $('#expandDisplayName').html($('#displayName').val()); } else{ $('#newdisplayname').val(data.data.displayName) From 7e3a8c1ddeb7d2ed99546737accc98ad5a19a18e Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 25 Feb 2013 17:18:20 -0500 Subject: [PATCH 4/5] use text method instead of html method --- Gwr | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 Gwr diff --git a/Gwr b/Gwr new file mode 100644 index 0000000000..d0a471e56b --- /dev/null +++ b/Gwr @@ -0,0 +1,116 @@ +/** + * Copyright (c) 2011, Robin Appelman + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + +$(document).ready(function(){ + $("#passwordbutton").click( function(){ + if ($('#pass1').val() != '' && $('#pass2').val() != '') { + // Serialize the data + var post = $( "#passwordform" ).serialize(); + $('#passwordchanged').hide(); + $('#passworderror').hide(); + // Ajax foo + $.post( 'ajax/changepassword.php', post, function(data){ + if( data.status == "success" ){ + $('#pass1').val(''); + $('#pass2').val(''); + $('#passwordchanged').show(); + } + else{ + $('#passworderror').html( data.data.message ); + $('#passworderror').show(); + } + }); + return false; + } else { + $('#passwordchanged').hide(); + $('#passworderror').show(); + return false; + } + + }); + + $("#displaynamebutton").click( function(){ + if ($('#displayName').val() != '' ) { + // Serialize the data + var post = $( "#displaynameform" ).serialize(); + $('#displaynamechanged').hide(); + $('#displaynemerror').hide(); + // Ajax foo + $.post( 'ajax/changedisplayname.php', post, function(data){ + if( data.status == "success" ){ + $('#displaynamechanged').show(); + $('#oldDisplayName').text($('#displayName').val()); + // update displayName on the top right expand button + $('#expandDisplayName').text($('#displayName').val()); + } + else{ + $('#newdisplayname').val(data.data.displayName) + $('#displaynameerror').html( data.data.message ); + $('#displaynameerror').show(); + } + }); + return false; + } else { + $('#displayName').val($('#oldDisplayName').val()); + $('#displaynamechanged').hide(); + $('#displaynameerror').show(); + return false; + } + + }); + + $('#lostpassword #email').blur(function(event){ + if ($(this).val() == this.defaultValue){ + return; + } + event.preventDefault(); + this.defaultValue = $(this).val(); + OC.msg.startSaving('#lostpassword .msg'); + var post = $( "#lostpassword" ).serialize(); + $.post( 'ajax/lostpassword.php', post, function(data){ + OC.msg.finishedSaving('#lostpassword .msg', data); + }); + }); + + $("#languageinput").chosen(); + + $("#languageinput").change( function(){ + // Serialize the data + var post = $( "#languageinput" ).serialize(); + // Ajax foo + $.post( 'ajax/setlanguage.php', post, function(data){ + if( data.status == "success" ){ + location.reload(); + } + else{ + $('#passworderror').html( data.data.message ); + } + }); + return false; + }); +} ); + +OC.msg={ + startSaving:function(selector){ + $(selector) + .html( t('settings', 'Saving...') ) + .removeClass('success') + .removeClass('error') + .stop(true, true) + .show(); + }, + finishedSaving:function(selector, data){ + if( data.status == "success" ){ + $(selector).html( data.data.message ) + .addClass('success') + .stop(true, true) + .delay(3000) + .fadeOut(600); + }else{ + $(selector).html( data.data.message ).addClass('error'); + } + } +}; From 02da5d5d525778a250c000af0e3da7360b4719e5 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 25 Feb 2013 17:22:04 -0500 Subject: [PATCH 5/5] remove Gwr --- Gwr | 116 ------------------------------------------------------------ 1 file changed, 116 deletions(-) delete mode 100644 Gwr diff --git a/Gwr b/Gwr deleted file mode 100644 index d0a471e56b..0000000000 --- a/Gwr +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright (c) 2011, Robin Appelman - * This file is licensed under the Affero General Public License version 3 or later. - * See the COPYING-README file. - */ - -$(document).ready(function(){ - $("#passwordbutton").click( function(){ - if ($('#pass1').val() != '' && $('#pass2').val() != '') { - // Serialize the data - var post = $( "#passwordform" ).serialize(); - $('#passwordchanged').hide(); - $('#passworderror').hide(); - // Ajax foo - $.post( 'ajax/changepassword.php', post, function(data){ - if( data.status == "success" ){ - $('#pass1').val(''); - $('#pass2').val(''); - $('#passwordchanged').show(); - } - else{ - $('#passworderror').html( data.data.message ); - $('#passworderror').show(); - } - }); - return false; - } else { - $('#passwordchanged').hide(); - $('#passworderror').show(); - return false; - } - - }); - - $("#displaynamebutton").click( function(){ - if ($('#displayName').val() != '' ) { - // Serialize the data - var post = $( "#displaynameform" ).serialize(); - $('#displaynamechanged').hide(); - $('#displaynemerror').hide(); - // Ajax foo - $.post( 'ajax/changedisplayname.php', post, function(data){ - if( data.status == "success" ){ - $('#displaynamechanged').show(); - $('#oldDisplayName').text($('#displayName').val()); - // update displayName on the top right expand button - $('#expandDisplayName').text($('#displayName').val()); - } - else{ - $('#newdisplayname').val(data.data.displayName) - $('#displaynameerror').html( data.data.message ); - $('#displaynameerror').show(); - } - }); - return false; - } else { - $('#displayName').val($('#oldDisplayName').val()); - $('#displaynamechanged').hide(); - $('#displaynameerror').show(); - return false; - } - - }); - - $('#lostpassword #email').blur(function(event){ - if ($(this).val() == this.defaultValue){ - return; - } - event.preventDefault(); - this.defaultValue = $(this).val(); - OC.msg.startSaving('#lostpassword .msg'); - var post = $( "#lostpassword" ).serialize(); - $.post( 'ajax/lostpassword.php', post, function(data){ - OC.msg.finishedSaving('#lostpassword .msg', data); - }); - }); - - $("#languageinput").chosen(); - - $("#languageinput").change( function(){ - // Serialize the data - var post = $( "#languageinput" ).serialize(); - // Ajax foo - $.post( 'ajax/setlanguage.php', post, function(data){ - if( data.status == "success" ){ - location.reload(); - } - else{ - $('#passworderror').html( data.data.message ); - } - }); - return false; - }); -} ); - -OC.msg={ - startSaving:function(selector){ - $(selector) - .html( t('settings', 'Saving...') ) - .removeClass('success') - .removeClass('error') - .stop(true, true) - .show(); - }, - finishedSaving:function(selector, data){ - if( data.status == "success" ){ - $(selector).html( data.data.message ) - .addClass('success') - .stop(true, true) - .delay(3000) - .fadeOut(600); - }else{ - $(selector).html( data.data.message ).addClass('error'); - } - } -};