// JavaScript Document var uploadDeleteHandler = function(e) { var id = $(this).parent().attr('id'); if($('#dialog').length){ profile_img_uploader_onFocus($(this).parent()); var t = ''; var confirmBtnTxt = ''; var cancelBtnTxt = ''; var contentTxt = ''; switch($(this).parent().attr('id')){ case 'project_profile': switch(Number(global_js_params.lang)){ default: case 1: cancelBtnTxt = 'Cancel'; confirmBtnTxt = 'Confirm'; contentTxt = 'Are you sure to remove the Project Profile Image ?'; t = 'Delete Profile Image'; break; case 2: cancelBtnTxt = '取消'; confirmBtnTxt = '確定'; contentTxt = '您確定要刪除項目相片?'; t = '刪除項目簡介圖片'; break; case 3: cancelBtnTxt = '取消'; confirmBtnTxt = '确定'; contentTxt = '您确定要删除项目相片?'; t = '删除项目图片'; break; } break; case 'project_highlight': switch(Number(global_js_params.lang)){ default: case 1: cancelBtnTxt = 'Cancel'; confirmBtnTxt = 'Confirm'; contentTxt = 'Are you sure to remove the Project Highlight Image ?'; t = 'Delete Highlight Image'; break; case 2: cancelBtnTxt = '取消'; confirmBtnTxt = '確定'; contentTxt = '您確定要刪除項目顯示圖片?'; t = '刪除顯示圖像'; break; case 3: cancelBtnTxt = '取消'; confirmBtnTxt = '确定'; contentTxt = '您确定要删除项目显示图片?'; t = '删除显示图像'; break; } break; case 'org_profile': switch(Number(global_js_params.lang)){ default: case 1: cancelBtnTxt = 'Cancel'; confirmBtnTxt = 'Confirm'; contentTxt = 'Are you sure to remove Profile Image for your Organization ?'; t = 'Delete Profile Image'; break; case 2: cancelBtnTxt = '取消'; confirmBtnTxt = '確定'; contentTxt = '您確定要刪除主辦方相片?'; t = '刪除主辦方圖片'; break; case 3: cancelBtnTxt = '取消'; confirmBtnTxt = '确定'; contentTxt = '您确定要删除主办方相片?'; t = '删除主办方图片'; break; } break; default: case 'account_profile': switch(Number(global_js_params.lang)){ default: case 1: cancelBtnTxt = 'Cancel'; confirmBtnTxt = 'Confirm'; contentTxt = 'Are you sure to remove User Profile Image for your User Account ?'; t = 'Delete Profile Image'; break; case 2: cancelBtnTxt = '取消'; confirmBtnTxt = '確定'; contentTxt = '您確定要刪除帳戶相片'; t = '刪除帳戶相片'; break; case 3: cancelBtnTxt = '取消'; confirmBtnTxt = '确定'; contentTxt = '您确定要删除帐户相片'; t = '删除帐户相片'; break; } break; } $( "#dialog" ).html(contentTxt); $( "#dialog" ).dialog({ resizable: false, open: function(){ $('.ui-widget-overlay').hide().fadeIn(); $('.ui-widget-overlay').bind('click', function() { ajax_show_loading_mask(false); ajax_submitBtn_setInProgress_withLoadingBar($("#continueSubmitBtn"), payout_bank_registration_handler, false); $('#dialog').dialog('close'); }); }, show: { effect: "clip", duration: 200 }, hide: { effect: "clip", duration: 200 }, autoOpen: true, draggable: false, width: 'auto', modal: true, closeOnEscape: false, title: t, buttons: [ { text: confirmBtnTxt, click: function() { $('#'+id+'_file_delete').submit(); $( this ).dialog( "close" ); } }, { text: cancelBtnTxt, click: function() { $( this ).dialog( "close" ); } } ] }); } // if($('#dialog').length){ } function init_img_uploader(_target, _img_size_MB, _required_upload_boo, _default_img){ // Organizer & User Profile, Project // ------- UPlaod ----------------------------- if(_target.length){ var targetHover = function() { profile_img_uploader_onHover(_target); $('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').css("opacity", 0.6); $('#'+_target.attr('id')+' #file_upload_description').stop().css("opacity", 1.0).show(); } var targetHoverOut = function() { $('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').css("opacity", 1.0); if(_required_upload_boo) profile_img_uploader_onBlur(_target, _default_img); } var options_delete = { dataType:'json', beforeSend: function() { //$('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').hide(); _target.unbind(); _target.removeAttr('href'); $('#'+_target.attr('id')+' #file_upload_delete').hide(); $('#'+_target.attr('id')+' #file_upload_delete').unbind(); }, success: function(json_data) { if(json_data.status != 1){ } else { if(typeof _default_img === "undefined"){ $('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').attr("src", $('#'+_target.attr('id')+'_file_delete #fname').val()); } else { $('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').attr("src", local_url+_default_img); } $('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').show(); $('#'+_target.attr('id')+' #file_upload_delete').unbind(); $('#'+_target.attr('id')+' #file_upload_delete').hide(); $('#'+_target.attr('id')+' #file_upload_description').show(); $('#'+_target.attr('id')+'_file_upload #file_upload_file').val(''); } }, complete: function(response) { _target.attr("href", "javascript:void(0);"); _target.hover(targetHover, targetHoverOut); }, error: function() { $('#'+_target.attr('id')+' #file_upload_delete').bind("click", uploadDeleteHandler); $('#'+_target.attr('id')+' #file_upload_delete').show(); $('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').show(); } }; var options_upload = { dataType:'json', beforeSend: function() { //$('#'+_target.attr('id')+' #'+_target.attr('id')+'_img').hide(); _target.unbind(); _target.removeAttr('href'); $('#'+_target.attr('id')+' #file_upload_description').hide(); $('#'+_target.attr('id')+' #upload_processbox').show(); $('#'+_target.attr('id')+' #upload_processbar').width('0%'); //$('#'+_target.attr('id')+' #upload_processtxt').html("0%"); $('#'+_target.attr('id')+' #file_upload_delete').hide(); $('#'+_target.attr('id')+' #file_upload_delete').unbind(); }, uploadProgress: function(event, position, total, percentComplete) { if(percentComplete >= 80 && percentComplete < 100){ percentComplete = 80; } else if(percentComplete == 100){ percentComplete = 90; } $('#'+_target.attr('id')+' #upload_processbar').width(percentComplete+'%'); }, success: function(json_data) { $('#'+_target.attr('id')+' #upload_processbar').width('100%'); //alert(json_data.status); if(json_data.status != 1){ $('#'+_target.attr('id')+'_file_upload #file_upload_file').val(''); //-52, dimension 400 x 400 if(!$('#'+_target.attr('id')+'_err').length){ _target.after('