aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-07 16:15:59 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-07 16:15:59 +0000
commit6e2444215584ab49313bb244199e85be7af0bb80 (patch)
tree14adb045425166c1a3a61967a80c71727b28e18e /mod
parent68f2c92868ddf477568c1dcbe6c58bc2f3375d33 (diff)
downloadelgg-6e2444215584ab49313bb244199e85be7af0bb80.tar.gz
elgg-6e2444215584ab49313bb244199e85be7af0bb80.tar.bz2
Wrong jquery editable lib.
git-svn-id: http://code.elgg.org/elgg/trunk@5653 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/profile/vendor/jq.editable.min.js10
-rw-r--r--mod/profile/vendor/jquery.jeditable.mini.js38
-rw-r--r--mod/profile/views/default/profile/editdefaultprofileitems.php2
3 files changed, 39 insertions, 11 deletions
diff --git a/mod/profile/vendor/jq.editable.min.js b/mod/profile/vendor/jq.editable.min.js
deleted file mode 100644
index 28bf89d3a..000000000
--- a/mod/profile/vendor/jq.editable.min.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Editable 1.3.3
- *
- * Copyright (c) 2009 Arash Karimzadeh (arashkarimzadeh.com)
- * Licensed under the MIT (MIT-LICENSE.txt)
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Date: Mar 02 2009
- */
-(function($){$.fn.editable=function(options){var defaults={onEdit:null,onSubmit:null,onCancel:null,editClass:null,submit:null,cancel:null,type:"text",submitBy:"blur",editBy:"click",options:null};if(options=="disable"){return this.unbind(this.data("editable.options").editBy,this.data("editable.options").toEditable)}if(options=="enable"){return this.bind(this.data("editable.options").editBy,this.data("editable.options").toEditable)}if(options=="destroy"){return this.unbind(this.data("editable.options").editBy,this.data("editable.options").toEditable).data("editable.previous",null).data("editable.current",null).data("editable.options",null)}var options=$.extend(defaults,options);options.toEditable=function(){$this=$(this);$this.data("editable.current",$this.html());opts=$this.data("editable.options");$.editableFactory[opts.type].toEditable($this.empty(),opts);$this.data("editable.previous",$this.data("editable.current")).children().focus().addClass(opts.editClass);if(opts.submit){$("<button/>").appendTo($this).html(opts.submit).one("mouseup",function(){opts.toNonEditable($(this).parent(),true)})}else{$this.one(opts.submitBy,function(){opts.toNonEditable($(this),true)}).children().one(opts.submitBy,function(){opts.toNonEditable($(this).parent(),true)})}if(opts.cancel){$("<button/>").appendTo($this).html(opts.cancel).one("mouseup",function(){opts.toNonEditable($(this).parent(),false)})}if($.isFunction(opts.onEdit)){opts.onEdit.apply($this,[{current:$this.data("editable.current"),previous:$this.data("editable.previous")}])}};options.toNonEditable=function($this,change){opts=$this.data("editable.options");$this.one(opts.editBy,opts.toEditable).data("editable.current",change?$.editableFactory[opts.type].getValue($this,opts):$this.data("editable.current")).html(opts.type=="password"?"*****":$this.data("editable.current"));var func=null;if($.isFunction(opts.onSubmit)&&change==true){func=opts.onSubmit}else{if($.isFunction(opts.onCancel)&&change==false){func=opts.onCancel}}if(func!=null){func.apply($this,[{current:$this.data("editable.current"),previous:$this.data("editable.previous")}])}};this.data("editable.options",options);return this.one(options.editBy,options.toEditable)};$.editableFactory={text:{toEditable:function($this,options){$("<input/>").appendTo($this).val($this.data("editable.current"))},getValue:function($this,options){return $this.children().val()}},password:{toEditable:function($this,options){$this.data("editable.current",$this.data("editable.password"));$this.data("editable.previous",$this.data("editable.password"));$('<input type="password"/>').appendTo($this).val($this.data("editable.current"))},getValue:function($this,options){$this.data("editable.password",$this.children().val());return $this.children().val()}},textarea:{toEditable:function($this,options){$("<textarea/>").appendTo($this).val($this.data("editable.current"))},getValue:function($this,options){return $this.children().val()}},select:{toEditable:function($this,options){$select=$("<select/>").appendTo($this);$.each(options.options,function(key,value){$("<option/>").appendTo($select).html(value).attr("value",key)});$select.children().each(function(){var opt=$(this);if(opt.text()==$this.data("editable.current")){return opt.attr("selected","selected").text()}})},getValue:function($this,options){var item=null;$("select",$this).children().each(function(){if($(this).attr("selected")){return item=$(this).text()}});return item}}}})(jQuery); \ No newline at end of file
diff --git a/mod/profile/vendor/jquery.jeditable.mini.js b/mod/profile/vendor/jquery.jeditable.mini.js
new file mode 100644
index 000000000..6c867383a
--- /dev/null
+++ b/mod/profile/vendor/jquery.jeditable.mini.js
@@ -0,0 +1,38 @@
+// http://www.appelsiini.net/projects/jeditable
+(function($){$.fn.editable=function(target,options){if('disable'==target){$(this).data('disabled.editable',true);return;}
+if('enable'==target){$(this).data('disabled.editable',false);return;}
+if('destroy'==target){$(this).unbind($(this).data('event.editable')).removeData('disabled.editable').removeData('event.editable');return;}
+var settings=$.extend({},$.fn.editable.defaults,{target:target},options);var plugin=$.editable.types[settings.type].plugin||function(){};var submit=$.editable.types[settings.type].submit||function(){};var buttons=$.editable.types[settings.type].buttons||$.editable.types['defaults'].buttons;var content=$.editable.types[settings.type].content||$.editable.types['defaults'].content;var element=$.editable.types[settings.type].element||$.editable.types['defaults'].element;var reset=$.editable.types[settings.type].reset||$.editable.types['defaults'].reset;var callback=settings.callback||function(){};var onedit=settings.onedit||function(){};var onsubmit=settings.onsubmit||function(){};var onreset=settings.onreset||function(){};var onerror=settings.onerror||reset;if(settings.tooltip){$(this).attr('title',settings.tooltip);}
+settings.autowidth='auto'==settings.width;settings.autoheight='auto'==settings.height;return this.each(function(){var self=this;var savedwidth=$(self).width();var savedheight=$(self).height();$(this).data('event.editable',settings.event);if(!$.trim($(this).html())){$(this).html(settings.placeholder);}
+$(this).bind(settings.event,function(e){if(true===$(this).data('disabled.editable')){return;}
+if(self.editing){return;}
+if(false===onedit.apply(this,[settings,self])){return;}
+e.preventDefault();e.stopPropagation();if(settings.tooltip){$(self).removeAttr('title');}
+if(0==$(self).width()){settings.width=savedwidth;settings.height=savedheight;}else{if(settings.width!='none'){settings.width=settings.autowidth?$(self).width():settings.width;}
+if(settings.height!='none'){settings.height=settings.autoheight?$(self).height():settings.height;}}
+if($(this).html().toLowerCase().replace(/(;|")/g,'')==settings.placeholder.toLowerCase().replace(/(;|")/g,'')){$(this).html('');}
+self.editing=true;self.revert=$(self).html();$(self).html('');var form=$('<form />');if(settings.cssclass){if('inherit'==settings.cssclass){form.attr('class',$(self).attr('class'));}else{form.attr('class',settings.cssclass);}}
+if(settings.style){if('inherit'==settings.style){form.attr('style',$(self).attr('style'));form.css('display',$(self).css('display'));}else{form.attr('style',settings.style);}}
+var input=element.apply(form,[settings,self]);var input_content;if(settings.loadurl){var t=setTimeout(function(){input.disabled=true;content.apply(form,[settings.loadtext,settings,self]);},100);var loaddata={};loaddata[settings.id]=self.id;if($.isFunction(settings.loaddata)){$.extend(loaddata,settings.loaddata.apply(self,[self.revert,settings]));}else{$.extend(loaddata,settings.loaddata);}
+$.ajax({type:settings.loadtype,url:settings.loadurl,data:loaddata,async:false,success:function(result){window.clearTimeout(t);input_content=result;input.disabled=false;}});}else if(settings.data){input_content=settings.data;if($.isFunction(settings.data)){input_content=settings.data.apply(self,[self.revert,settings]);}}else{input_content=self.revert;}
+content.apply(form,[input_content,settings,self]);input.attr('name',settings.name);buttons.apply(form,[settings,self]);$(self).append(form);plugin.apply(form,[settings,self]);$(':input:visible:enabled:first',form).focus();if(settings.select){input.select();}
+input.keydown(function(e){if(e.keyCode==27){e.preventDefault();reset.apply(form,[settings,self]);}});var t;if('cancel'==settings.onblur){input.blur(function(e){t=setTimeout(function(){reset.apply(form,[settings,self]);},500);});}else if('submit'==settings.onblur){input.blur(function(e){t=setTimeout(function(){form.submit();},200);});}else if($.isFunction(settings.onblur)){input.blur(function(e){settings.onblur.apply(self,[input.val(),settings]);});}else{input.blur(function(e){});}
+form.submit(function(e){if(t){clearTimeout(t);}
+e.preventDefault();if(false!==onsubmit.apply(form,[settings,self])){if(false!==submit.apply(form,[settings,self])){if($.isFunction(settings.target)){var str=settings.target.apply(self,[input.val(),settings]);$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}else{var submitdata={};submitdata[settings.name]=input.val();submitdata[settings.id]=self.id;if($.isFunction(settings.submitdata)){$.extend(submitdata,settings.submitdata.apply(self,[self.revert,settings]));}else{$.extend(submitdata,settings.submitdata);}
+if('PUT'==settings.method){submitdata['_method']='put';}
+$(self).html(settings.indicator);var ajaxoptions={type:'POST',data:submitdata,dataType:'html',url:settings.target,success:function(result,status){if(ajaxoptions.dataType=='html'){$(self).html(result);}
+self.editing=false;callback.apply(self,[result,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}},error:function(xhr,status,error){onerror.apply(form,[settings,self,xhr]);}};$.extend(ajaxoptions,settings.ajaxoptions);$.ajax(ajaxoptions);}}}
+$(self).attr('title',settings.tooltip);return false;});});this.reset=function(form){if(this.editing){if(false!==onreset.apply(form,[settings,self])){$(self).html(self.revert);self.editing=false;if(!$.trim($(self).html())){$(self).html(settings.placeholder);}
+if(settings.tooltip){$(self).attr('title',settings.tooltip);}}}};});};$.editable={types:{defaults:{element:function(settings,original){var input=$('<input type="hidden"></input>');$(this).append(input);return(input);},content:function(string,settings,original){$(':input:first',this).val(string);},reset:function(settings,original){original.reset(this);},buttons:function(settings,original){var form=this;if(settings.submit){if(settings.submit.match(/>$/)){var submit=$(settings.submit).click(function(){if(submit.attr("type")!="submit"){form.submit();}});}else{var submit=$('<button type="submit" />');submit.html(settings.submit);}
+$(this).append(submit);}
+if(settings.cancel){if(settings.cancel.match(/>$/)){var cancel=$(settings.cancel);}else{var cancel=$('<button type="cancel" />');cancel.html(settings.cancel);}
+$(this).append(cancel);$(cancel).click(function(event){if($.isFunction($.editable.types[settings.type].reset)){var reset=$.editable.types[settings.type].reset;}else{var reset=$.editable.types['defaults'].reset;}
+reset.apply(form,[settings,original]);return false;});}}},text:{element:function(settings,original){var input=$('<input />');if(settings.width!='none'){input.width(settings.width);}
+if(settings.height!='none'){input.height(settings.height);}
+input.attr('autocomplete','off');$(this).append(input);return(input);}},textarea:{element:function(settings,original){var textarea=$('<textarea />');if(settings.rows){textarea.attr('rows',settings.rows);}else if(settings.height!="none"){textarea.height(settings.height);}
+if(settings.cols){textarea.attr('cols',settings.cols);}else if(settings.width!="none"){textarea.width(settings.width);}
+$(this).append(textarea);return(textarea);}},select:{element:function(settings,original){var select=$('<select />');$(this).append(select);return(select);},content:function(data,settings,original){if(String==data.constructor){eval('var json = '+data);}else{var json=data;}
+for(var key in json){if(!json.hasOwnProperty(key)){continue;}
+if('selected'==key){continue;}
+var option=$('<option />').val(key).append(json[key]);$('select',this).append(option);}
+$('select',this).children().each(function(){if($(this).val()==json['selected']||$(this).text()==$.trim(original.revert)){$(this).attr('selected','selected');}});}}},addInputType:function(name,input){$.editable.types[name]=input;}};$.fn.editable.defaults={name:'value',id:'id',type:'text',width:'auto',height:'auto',event:'click.editable',onblur:'cancel',loadtype:'GET',loadtext:'Loading...',placeholder:'Click to edit',loaddata:{},submitdata:{},ajaxoptions:{}};})(jQuery);
diff --git a/mod/profile/views/default/profile/editdefaultprofileitems.php b/mod/profile/views/default/profile/editdefaultprofileitems.php
index cfd15247a..17d1f4f8f 100644
--- a/mod/profile/views/default/profile/editdefaultprofileitems.php
+++ b/mod/profile/views/default/profile/editdefaultprofileitems.php
@@ -1,4 +1,4 @@
-<script language="javascript" type="text/javascript" src="<?php echo $vars['url']?>mod/profile/vendor/jq.editable.min.js"></script>
+<script language="javascript" type="text/javascript" src="<?php echo $vars['url']?>mod/profile/vendor/jquery.jeditable.mini.js"></script>
<script language="javascript" type="text/javascript">
var reorderURL = '<?php echo elgg_add_action_tokens_to_url($vars['url'] . 'action/profile/editdefault/reorder', FALSE); ?>';
function sortCallback(event, ui) {