From 0b5a24d7943c6f8bc275d1160f4060b337a3cf7a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 18 Dec 2010 23:18:43 +0000 Subject: continuing to slash and burn the profile plugin - moving the admin profile fields into core - last major change git-svn-id: http://code.elgg.org/elgg/trunk@7673 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/profile/fields/add.php | 38 ++++++++++ actions/profile/fields/delete.php | 27 +++++++ actions/profile/fields/reorder.php | 12 +++ actions/profile/fields/reset.php | 20 +++++ engine/lib/admin.php | 8 ++ mod/profile/actions/deletedefaultprofileitem.php | 29 ------- mod/profile/actions/editdefault.php | 38 ---------- mod/profile/actions/editfield.php | 15 ---- mod/profile/actions/reorder.php | 12 --- mod/profile/actions/resetdefaultprofile.php | 22 ------ mod/profile/start.php | 15 ---- mod/profile/vendor/jquery.jeditable.mini.js | 38 ---------- .../default/admin/appearance/defaultprofile.php | 47 ------------ mod/profile/views/default/profile/edit.php | 80 -------------------- .../views/default/profile/editdefaultprofile.php | 29 ------- .../default/profile/editdefaultprofileitems.php | 65 ---------------- vendors/jquery/jquery.jeditable.mini.js | 38 ++++++++++ views/default/admin/appearance/profile_fields.php | 21 ++++++ .../admin/appearance/profile_fields/list.php | 88 ++++++++++++++++++++++ views/default/forms/profile/fields/add.php | 29 +++++++ views/default/forms/profile/fields/reset.php | 10 +++ 21 files changed, 291 insertions(+), 390 deletions(-) create mode 100644 actions/profile/fields/add.php create mode 100644 actions/profile/fields/delete.php create mode 100644 actions/profile/fields/reorder.php create mode 100644 actions/profile/fields/reset.php delete mode 100644 mod/profile/actions/deletedefaultprofileitem.php delete mode 100644 mod/profile/actions/editdefault.php delete mode 100644 mod/profile/actions/editfield.php delete mode 100644 mod/profile/actions/reorder.php delete mode 100644 mod/profile/actions/resetdefaultprofile.php delete mode 100644 mod/profile/vendor/jquery.jeditable.mini.js delete mode 100644 mod/profile/views/default/admin/appearance/defaultprofile.php delete mode 100644 mod/profile/views/default/profile/edit.php delete mode 100644 mod/profile/views/default/profile/editdefaultprofile.php delete mode 100644 mod/profile/views/default/profile/editdefaultprofileitems.php create mode 100644 vendors/jquery/jquery.jeditable.mini.js create mode 100644 views/default/admin/appearance/profile_fields.php create mode 100644 views/default/admin/appearance/profile_fields/list.php create mode 100644 views/default/forms/profile/fields/add.php create mode 100644 views/default/forms/profile/fields/reset.php diff --git a/actions/profile/fields/add.php b/actions/profile/fields/add.php new file mode 100644 index 000000000..96e878402 --- /dev/null +++ b/actions/profile/fields/add.php @@ -0,0 +1,38 @@ +path . 'pages/profile/edit.php'; return; - /* - $layout = 'one_column_with_sidebar'; - - if (!$user || !$user->canEdit()) { - register_error(elgg_echo("profile:noaccess")); - forward(); - } - - $content = profile_get_user_edit_content($user, $page); - $content = elgg_view_layout($layout, array('content' => $content)); - * - */ break; default: diff --git a/mod/profile/vendor/jquery.jeditable.mini.js b/mod/profile/vendor/jquery.jeditable.mini.js deleted file mode 100644 index 6c867383a..000000000 --- a/mod/profile/vendor/jquery.jeditable.mini.js +++ /dev/null @@ -1,38 +0,0 @@ -// 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=$('
');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=$('');$(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=$('