diff options
author | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 01:53:40 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 01:53:40 +0100 |
commit | d1edc360d9bd7d97c35d25b54dadec61004cd869 (patch) | |
tree | 7344744268280ccbdc194746a7b40dfc90a33260 /core | |
parent | 3844fb0e4ce093bb3c2e67d20f85f61b7723efdc (diff) | |
parent | 8f8985c3e53862e2ca6446f296d4835a9577faac (diff) | |
download | nextcloud-server-d1edc360d9bd7d97c35d25b54dadec61004cd869.tar.gz nextcloud-server-d1edc360d9bd7d97c35d25b54dadec61004cd869.zip |
merge master into filesystem
Diffstat (limited to 'core')
-rwxr-xr-x | core/js/jquery.infieldlabel.js | 140 | ||||
-rw-r--r-- | core/js/setup.js | 4 | ||||
-rw-r--r-- | core/lostpassword/index.php | 2 |
3 files changed, 144 insertions, 2 deletions
diff --git a/core/js/jquery.infieldlabel.js b/core/js/jquery.infieldlabel.js new file mode 100755 index 00000000000..f6a67b66ce1 --- /dev/null +++ b/core/js/jquery.infieldlabel.js @@ -0,0 +1,140 @@ +/* + * In-Field Label jQuery Plugin + * http://fuelyourcoding.com/scripts/infield.html + * + * Copyright (c) 2009 Doug Neiner + * Dual licensed under the MIT and GPL licenses. + * Uses the same license as jQuery, see: + * http://docs.jquery.com/License + * + * @version 0.1 + */ +(function($){ + + $.InFieldLabels = function(label,field, options){ + // To avoid scope issues, use 'base' instead of 'this' + // to reference this class from internal events and functions. + var base = this; + + // Access to jQuery and DOM versions of each element + base.$label = $(label); + base.label = label; + + base.$field = $(field); + base.field = field; + + base.$label.data("InFieldLabels", base); + base.showing = true; + + base.init = function(){ + // Merge supplied options with default options + base.options = $.extend({},$.InFieldLabels.defaultOptions, options); + + // Check if the field is already filled in + if(base.$field.val() != ""){ + base.$label.hide(); + base.showing = false; + }; + + base.$field.focus(function(){ + base.fadeOnFocus(); + }).blur(function(){ + base.checkForEmpty(true); + }).bind('keydown.infieldlabel',function(e){ + // Use of a namespace (.infieldlabel) allows us to + // unbind just this method later + base.hideOnChange(e); + }).change(function(e){ + base.checkForEmpty(); + }).bind('onPropertyChange', function(){ + base.checkForEmpty(); + }); + }; + + // If the label is currently showing + // then fade it down to the amount + // specified in the settings + base.fadeOnFocus = function(){ + if(base.showing){ + base.setOpacity(base.options.fadeOpacity); + }; + }; + + base.setOpacity = function(opacity){ + base.$label.stop().animate({ opacity: opacity }, base.options.fadeDuration); + base.showing = (opacity > 0.0); + }; + + // Checks for empty as a fail safe + // set blur to true when passing from + // the blur event + base.checkForEmpty = function(blur){ + if(base.$field.val() == ""){ + base.prepForShow(); + base.setOpacity( blur ? 1.0 : base.options.fadeOpacity ); + } else { + base.setOpacity(0.0); + }; + }; + + base.prepForShow = function(e){ + if(!base.showing) { + // Prepare for a animate in... + base.$label.css({opacity: 0.0}).show(); + + // Reattach the keydown event + base.$field.bind('keydown.infieldlabel',function(e){ + base.hideOnChange(e); + }); + }; + }; + + base.hideOnChange = function(e){ + if( + (e.keyCode == 16) || // Skip Shift + (e.keyCode == 9) // Skip Tab + ) return; + + if(base.showing){ + base.$label.hide(); + base.showing = false; + }; + + // Remove keydown event to save on CPU processing + base.$field.unbind('keydown.infieldlabel'); + }; + + // Run the initialization method + base.init(); + }; + + $.InFieldLabels.defaultOptions = { + fadeOpacity: 0.5, // Once a field has focus, how transparent should the label be + fadeDuration: 300 // How long should it take to animate from 1.0 opacity to the fadeOpacity + }; + + + $.fn.inFieldLabels = function(options){ + return this.each(function(){ + // Find input or textarea based on for= attribute + // The for attribute on the label must contain the ID + // of the input or textarea element + var for_attr = $(this).attr('for'); + if( !for_attr ) return; // Nothing to attach, since the for field wasn't used + + + // Find the referenced input or textarea element + var $field = $( + "input#" + for_attr + "[type='text']," + + "input#" + for_attr + "[type='password']," + + "textarea#" + for_attr + ); + + if( $field.length == 0) return; // Again, nothing to attach + + // Only create object for input[text], input[password], or textarea + (new $.InFieldLabels(this, $field[0], options)); + }); + }; + +})(jQuery);
\ No newline at end of file diff --git a/core/js/setup.js b/core/js/setup.js index b765d41ba35..94097785e42 100644 --- a/core/js/setup.js +++ b/core/js/setup.js @@ -7,7 +7,9 @@ $(document).ready(function() { $('#dbhost').hide(); $('#dbhostlabel').hide(); } - + $('#adminlogin').change(function(){ + $('#adminlogin').val($.trim($('#adminlogin').val())); + }); $('#sqlite').click(function() { $('#use_other_db').slideUp(250); $('#dbhost').hide(250); diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php index de0d393ec78..ede94dab2d7 100644 --- a/core/lostpassword/index.php +++ b/core/lostpassword/index.php @@ -14,7 +14,7 @@ if (isset($_POST['user'])) { if (OC_User::userExists($_POST['user'])) { $token = sha1($_POST['user']+uniqId()); OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token); - $email = OC_Preferences::getValue($_POST['user'], 'lostpassword', 'email', ''); + $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', ''); if (!empty($email)) { $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token; $tmpl = new OC_Template('core/lostpassword', 'email'); |