PageSourceSearch

https://www.carotenoidspalma2026.org/js/event_detail/upload.js

js carotenoidspalma2026.org collected 2026-10-08 18:54:51 UTC 22,028 bytes, 40 lines download raw bytes

1SYM.UPLOAD=$.extend(SYM.UPLOAD||{},function(){const CONST={DOM:{BTN_AUTHOR_DELETION:'#delete_author_number',TEMPLATE_BTN_AUTHOR_DELETION:'#button-author-deletion',PAPER_ID:'#paper_id',EVENT_ID:'#event_id',AUTHOR_DELETION_ADVICE:'#author-deletion-advice',AUTHOR_DELETION_MESSAGE_SUCCESS:'#author-deletion-message-success',AUTHOR_DELETION_MESSAGE_ERROR:'#author-deletion-message-error',},SERVICE_URLS:{REMOVE_AUTHOR:'/file_manager/ajax_remove_author/{event_id}'},SERVICE:{removeAuthorService:function(payload){const url=noCache(CONST.SERVICE_URLS.REMOVE_AUTHOR.replace('{event_id}',payload.event_id));const formData=new FormData();for(const name in payload){formData.append(name,payload[name]);}
2return fetch(url,{method:'POST',body:formData}).then(response=>response.json()).then((response)=>response).catch((error)=>{return(error);});}}}
3const UTIL={capitalizeFirst:function(s){if(typeof s!=='string'||s.length===0)return s;try{var first=s.charAt(0);return first.toLocaleUpperCase()+s.slice(1);}catch(e){return s;}}};const METHODS={handler:{authorRemoveClick:async function(event){event.preventDefault();const $currentAuthor=$(this).closest('li.author_form');const authorKey=$currentAuthor.attr('data-key');const authorId=$('#form_upload_author_id_'+authorKey).val();const paperId=$(CONST.DOM.PAPER_ID).val();const eventId=$(CONST.DOM.EVENT_ID).val();const confirmText=$(CONST.DOM.AUTHOR_DELETION_ADVICE).text();const result=await METHODS.private.showModalPromise(confirmText);if(result){if(!authorId){if($(this).attr('id').includes('delete_author_new_number')){$currentAuthor.remove();return;}}
4if(!paperId||!eventId){return;}
5const payload={author_id:authorId,event_id:eventId,paper_id:paperId};try{const result=await CONST.SERVICE.removeAuthorService(payload);if(result){const success=result.stat==='Ok';METHODS.private.showAuthorDeleteMsg($currentAuthor,success);}}catch(e){console.log("Error trying to delete an author",e);METHODS.private.showAuthorDeleteMsg($currentAuthor,false);}}}},private:{showModalPromise:async function(message){return new Promise(function(resolve){msgbox_confirm(message,'',async function(confirm){return resolve(confirm);});})},showAuthorDeleteMsg:function($element,success=true){const identifier=success?CONST.DOM.AUTHOR_DELETION_MESSAGE_SUCCESS:CONST.DOM.AUTHOR_DELETION_MESSAGE_ERROR;const message=$(identifier).html();$element.after(message);if(success){$element.fadeOut(100,function(){$element.remove();});}
6setTimeout(function(){$('#response-message').fadeOut(500,function(){$(this).remove();});},5000);}}}
7return{upload_in_process:false,author_inputs_size:0,prev_selected_category:$("#paper_category").length?$("#paper_category")[0].selectedIndex:0,form_setup:function(){if($('#form_upload').length){var headings_author=['Autor nulo',msg.PRIMER+' '+msg.AUTHOR,msg.SEGUNDO+' '+msg.AUTHOR,msg.TERCER+' '+msg.AUTHOR,msg.CUARTO+' '+msg.AUTHOR,msg.QUINTO+' '+msg.AUTHOR,msg.SEXTO+' '+msg.AUTHOR,msg.SEPTIMO+' '+msg.AUTHOR,msg.OCTAVO+' '+msg.AUTHOR,msg.NOVENO+' '+msg.AUTHOR,msg.DECIMO+' '+msg.AUTHOR];SYM.UPLOAD.add_filiation_button_bind();SYM.UPLOAD.author_inputs_size=$('#form_upload li.author').length;var count_author=1;var value_one=$('#form_upload #form_upload_author_filiation_one_'+count_author).val();var value_two=$('#form_upload #form_upload_author_filiation_two_'+count_author).val();var value_three=$('#form_upload #form_upload_author_filiation_three_'+count_author).val();$('#form_upload li.author_name').each(function(index,element){value_one=$('#form_upload #form_upload_author_filiation_one_'+count_author).val();value_two=$('#form_upload #form_upload_author_filiation_two_'+count_author).val();value_three=$('#form_upload #form_upload_author_filiation_three_'+count_author).val();var authorTitle=UTIL.capitalizeFirst(msg.AUTHOR)+' '+count_author+':';$('h2.author_number_'+count_author).html(authorTitle);if(count_author>1){const btnReplace='delete_author_number_'+count_author;var deleteBtn=$(CONST.DOM.TEMPLATE_BTN_AUTHOR_DELETION).html().replace('delete_author_number',btnReplace);if(!deleteBtn.includes('data-disabled')){$('h2.author_number_'+count_author).append(deleteBtn);$('#'+btnReplace).on('click',METHODS.handler.authorRemoveClick);}
8$(`#form_upload_author_name_${count_author},#form_upload_author_email_${count_author}`).addClass('required');}
9count_author++;});$('select.readonly option:not(:selected)').attr('disabled',true);$('input[name=document_type]').click(function(e){if($(this).attr('readOnly')!=null&&$(this).attr('readOnly').toLowerCase()=='readonly'){e.preventDefault();return false;}});$('.btn_print_lopd').unbind('click').click(function(e){e.preventDefault();window.open($(this).data('url'));return false;});$('#form_upload').off('click').off('submit');$('#form_upload').yav({'errorMessage':msg.ERRORMESSAGE,'errorPosition':'after','errorDiv':'form_upload_status',custom:{ckeditor_max_word_count:ckeditor_max_word_count,required_if_valid_author_insert:required_if_valid_author_insert,required_one_if_valid_author_insert:required_one_if_valid_author_insert,email_rfc:function(return_value){return email_rfc(return_value);}},'onError':function(the_form){SYM.UPLOAD.block_upload_form(false);return false;},'onOk':function(the_form){const author_terms_accepted=($("#checkbox_author_terms").length==0||($("#checkbox_author_terms").length>0&&$("#checkbox_author_terms").is(':checked')));if(author_terms_accepted){$('.error',the_form).remove();$.post(noCache(the_form.action),$(the_form).serialize(),function(response){var data=response;if(data.stat=='OK'){if($('#mode').val()=='add'){$('#form_upload_description_1').val('');$('#form_upload')[0].reset();if($("#form_upload_description_1").length){CKEDITOR.instances.form_upload_description_1.setData('');}
10if($("#form_upload_abstract_text").length){CKEDITOR.instances.form_upload_abstract_text.setData('');}
11$('li.author_name:not(.author)').remove();$('li.author_email:not(.author)').remove();}else{if(typeof $('.input_file')!=='undefined'&&$('.input_file').length>0)$('.file_holder p a:visible').html($('.input_file').val());if($('.file_holder p a').length>1){var href=$('.file_holder p a.link_abstract').attr('href');if(href!=null){$('.file_holder p a.link_abstract').attr('href',href.replace(/[\d]+/,data.update_id));}}}
12var success=$('<p></p>').addClass('ok');$(the_form).prepend(success.html(data.msg));$('html, body').animate({scrollTop:$("#form_upload").offset().top},1000);SYM.reset_plupload_input();setTimeout(function(){window.location.href=window.location.href.substr(0,window.location.href.indexOf('?'));},3000);}else{var error=$('<p></p>').addClass('error');$(the_form).prepend(error.html(data.msg));if(typeof data.form_errors_array!='undefined'){for(var prop in data.form_errors_array){var error_msg=prop.indexOf('_file')>0?msg.ERROR_UPLOADED:msg.REQUIRED_FIELD;prop=prop.replace('_file','');$('<p class="error">'+error_msg+'</p>').insertBefore('#'+prop);if($('#'+prop).hasClass('input_file')){$('#'+prop).val('');}}}
13$('html, body').animate({scrollTop:$("#form_upload").offset().top},1000);}
14SYM.UPLOAD.block_upload_form(false);});}else{var error=$('<p></p>').addClass('error');$(the_form).prepend(error.html(msg.DOCUMENTATION_ACCEPT_TERMS));SYM.UPLOAD.block_upload_form(false);SYM.UPLOAD.scroll_to_error();}
15return false;}},{DATE_FORMAT:msg.yavdateformat});var uploader_settings={},max_file_size=parseInt($('#paper_filesize').val());if(max_file_size>0){uploader_settings.max_file_size=max_file_size+'mb';}
16if($('#form_upload_abstract_text').length){load_rich_editor('form_upload_abstract_text',{toolbar:'Basic',language:_LANGUAGE,width:'550px',readOnly:$('#form_upload_abstract_text').hasClass('disabled')});CKEDITOR.instances.form_upload_abstract_text.on('key',SYM.UPLOAD.abstract_limit_count_updater);CKEDITOR.instances.form_upload_abstract_text.on('afterPaste',function(evt){var count=SYM.UPLOAD.abstract_remaining_words_count(evt.editor.getData());$('.abstract_word_count').html(count);},CKEDITOR.instances.form_upload_abstract_text.element.$);CKEDITOR.config.forcePasteAsPlainText=true;SYM.UPLOAD.abstract_limit_count_updater();}
17if($('textarea#form_upload_description_1.upl_description').length){load_rich_editor('form_upload_description_1',{toolbar:'Basic',language:_LANGUAGE,width:'550px',readOnly:$('#form_upload_description_1').hasClass('disabled')});}
18var inter=setInterval(function(){if($('#cke_form_upload_description_1').length){$('#form_upload_description_1').detach().insertAfter('#cke_form_upload_description_1');clearInterval(inter);}},1000);$('#form_upload li.author_form').each(function(c,el){SYM.UPLOAD.author_custom_form_setup(el);});$('#add_author').unbind('click').click(function(e){if($('#form_upload li.author').length==0){e.preventDefault();return false;}
19var author=$('#form_upload li.author_form:first').clone(),current_id=parseInt($('#form_upload li.author_form').length),next_id=(current_id+1),id_regex=/_1$/,id_replace='_'+next_id,field_id_regex=/field_([\d]+)_1(_.+|\[\])?$/,field_id_replace='field_$1_'+next_id+'$2';$(author).attr('data-key',next_id);$(author).find('h2').addClass('current_identifier_'+next_id);if(next_id===0){author.find('h2').html(UTIL.capitalizeFirst(msg.NULL_AUTHOR));}else{author.find('h2').html(UTIL.capitalizeFirst(msg.AUTHOR)+' '+next_id+':');}
20$('li',author).each(function(c,el){if($(el).hasClass('author_filiation')||$(el).hasClass('author_add_filiation')){$(el).attr('class',$(el).attr('class').replace(id_regex,id_replace));if($('div',el).attr('id')!=null)$('div',el).attr('id',$('div',el).attr('id').replace(id_regex,id_replace));if($(el).hasClass('author_filiation')&&!$(el).hasClass('author_filiation_one'))$(el).addClass('hidden');if($(el).hasClass('author_filiation_original')){$(el).removeClass('author_filiation_original');$(el).addClass('author_filiation_'+next_id);}}
21var attributes=['id','name','data-field','for','value'];$('input, textarea, div, button, label, select',el).each(function(x,element){for(var i=0;i<attributes.length;i++){let currentAttributeValue=$(element).attr(attributes[i]);if(currentAttributeValue!=null&&currentAttributeValue.match(id_regex)){let replacement=currentAttributeValue.replace(id_regex,id_replace);$(element).attr(attributes[i],replacement);}
22else if(currentAttributeValue!=null&&currentAttributeValue.match(field_id_regex)){let otherReplacement=currentAttributeValue.replace(field_id_regex,field_id_replace);$(element).attr(attributes[i],otherReplacement);}}
23if(typeof $(element).val()!="undefined"){if($(element).attr('type')!='radio'&&$(element).attr('type')!='checkbox'){$(element).val('');}else{$(element).removeAttr('checked');}}});if($('.btn_add_filiation',el).length){$('.btn_add_filiation',el).attr('id',$('.btn_add_filiation',el).attr('id').replace(id_regex,id_replace));$('.btn_add_filiation',el).attr('data-id',next_id);}
24if($(el).hasClass('custom_author_form')){$('li',el).each(function(p,li){$('input',li).each(function(x,ili){if($(ili).hasClass('hasDatepicker'))$(ili).removeClass('hasDatepicker');});});$('div.plupload',el).remove();}
25$('a.a_download',el).remove();});$(author).insertAfter($('#form_upload li.author_form:last'));$('#add_filiation_'+next_id).parent().show();if(next_id>1){const newButtonId='delete_author_new_number_'+next_id;var newDeleteAuthorBtn=$(CONST.DOM.TEMPLATE_BTN_AUTHOR_DELETION).text().replace('delete_author_number',newButtonId);if(!newDeleteAuthorBtn.includes("data-disabled")){$('h2.current_identifier_'+next_id).append(newDeleteAuthorBtn).ready(function(){$('#'+newButtonId).off('click').on('click',METHODS.handler.authorRemoveClick);});}}
26SYM.UPLOAD.author_custom_form_setup($('#form_upload li.author_form:last'));return false;});$('#upload_button').unbind('click').click(function(e){e.preventDefault();if(SYM.UPLOAD.upload_in_process){console.log('Upload blocked as "in process"');return false;}
27SYM.UPLOAD.block_upload_form(true);if($('#form_upload_description_1').length){$('#form_upload_description_1').val(CKEDITOR.instances.form_upload_description_1.getData());}
28if($('#form_upload_abstract_text').length){$('#form_upload_abstract_text').val(CKEDITOR.instances.form_upload_abstract_text.getData());}
29$('p.error').remove();var emails=[],nonUnique=false,error=$('<p></p>').addClass('error');$('.author_email').each(function(c,el){var mail=$('input.email_rfc',el).val(),name=$('#form_upload_author_name_'+(c+1)).val();if(mail!=''||name!=''){if((mail=='')||(emails.indexOf(mail)!=-1)){$(error.html(msg.EMAILS_ARE_MANDATORY_AND_MUST_BE_DIFFERENT)).insertAfter(el);nonUnique=true;}else{emails.push(mail);}}});if(nonUnique){SYM.UPLOAD.block_upload_form(false);SYM.UPLOAD.scroll_to_error();return false;}
30if($('#upload').hasClass('required')&&$('#upload').val().length==0){var error=$('<p></p>').addClass('error');$(error.html(msg.FILE_REQUIRED)).insertBefore('.file_holder');SYM.UPLOAD.block_upload_form(false);SYM.UPLOAD.scroll_to_error();return false;}
31var required_files_submitted=true;$('.input_file.required','#form_upload').each(function(c,el){if(required_files_submitted){var parent=$(el).parent(),file=$('input[type=hidden]:first',parent).val();if(file.length==0){$(el).val('');required_files_submitted=false;var error=$('<p></p>').addClass('error');$(error.html(msg.FILE_REQUIRED)).insertAfter(el);}}});if(!required_files_submitted){SYM.UPLOAD.block_upload_form(false);SYM.UPLOAD.scroll_to_error();return;}
32$('#form_upload').submit();});}},add_filiation_button_bind:function(parent){var selector=(typeof parent=='undefined')?$('.btn_add_filiation'):$('.btn_add_filiation',parent);selector.unbind('click').click(function(e){e.preventDefault();var filiation_order_id=$(this).data('id');
32if(filiation_order_id>=1){$('.author_filiation_'+filiation_order_id).each(function(index,element){if($(element).hasClass('hidden')){$(element).fadeIn();$(element).removeClass('hidden');if($(element).hasClass('author_filiation_three')){$('#add_filiation_'+filiation_order_id).parent().hide();}
33return false;}});}else{$('.author_filiation_original').each(function(index,element){if($(element).hasClass('hidden')){$(element).fadeIn();$(element).removeClass('hidden');if($(element).hasClass('author_filiation_three')){$(element).parent().find('.btn_add_filiation').parent().hide();}
34return false;}});}
35return false;});},load_category_paper_types:function(event_id,category_id){if(!event_id)return false;var url=noCache('/event_detail/get_event_category_papers_types/'+event_id+'/'+category_id);$.getJSON(url,{},function(response){if(response){if(response.stat=='OK'){var paper_type_selector=$('#paper_type');var document_type_li=paper_type_selector.parents('.document_type_li');document_type_li.removeClass('hidden');paper_type_selector.html('');response.data.forEach(function(element){paper_type_selector.append($('<option></option>').text(element.name).attr('value',element.id));});if(response.data.length>1){document_type_li.show();}else{document_type_li.hide();}}else{msgbox_alert(msg[response.msg]);}}else{msgbox_alert(msg.SERVER_ERROR);}});},category_setup:function(){var author_form=$('#form_category_0').html();if($('#mode').val()=='add'){$('li.custom_author_form').html(author_form);SYM.UPLOAD.author_custom_form_setup($('li.custom_author_form:first').parent());}
36$('#paper_category').change(function(){var context=this;var perform_change_category=function(){var category_description=$('#category_'+$(this).val()).html();if(category_description&&category_description.trim()!==''&&category_description!==null){$('.li_category_description').removeClass('hidden');$('.li_category_description label').removeClass('hidden');$('.category_description').getNiceScroll().remove();$('.category_description').html(category_description);$('.category_description').niceScroll();}else{$('.li_category_description').addClass('hidden');$('.li_category_description label').addClass('hidden');}
37var category_form=$('#form_category_'+$(this).val()).html();$('li.custom_category_form').html(category_form);SYM.UPLOAD.custom_form_setup();SYM.UPLOAD.load_category_paper_types($('#event_id').val(),$('#paper_category').val());}.bind(context);var num_custom_fields=$($(this).find("option")[SYM.UPLOAD.prev_selected_category]).data('numfields');if($('#mode').val()!='add'&&num_custom_fields>0){msgbox_confirm(msg.YOU_SURE,msg['CUSTOM_FIELDS_WILL_BE_REMOVED'],function(result){if(result==true){SYM.UPLOAD.prev_selected_category=context.selectedIndex;perform_change_category();}else{context.selectedIndex=SYM.UPLOAD.prev_selected_category;}});}else{SYM.UPLOAD.prev_selected_category=context.selectedIndex;perform_change_category();}});if($('#mode').val()=='add')$('#paper_category').change();},custom_form_setup:function(){SYM.pluploader_init_multi({unique_names:true},function(err,up){if(err){console.error(err);return;}
38up.bind('FilesQueued',function(up,file,response){up.start();});});$.datepicker.setDefaults(msg.datepicker);$('input:text.date_picker','li.custom_category_form').datepicker();$('.reset_radio_group').unbind('click').click(function(){$('input[type=radio]',$(this).parent()).removeAttr('checked');});},author_custom_form_setup:function(elem){SYM.pluploader_init_multi({unique_names:true},function(err,up){if(err){console.error(err);return;}
39up.bind('FilesQueued',function(up,file,response){up.start();});});$.datepicker.setDefaults(msg.datepicker);$('input:text.date_picker',elem).datepicker();SYM.UPLOAD.add_filiation_button_bind(elem);$('.reset_radio_group').unbind('click').click(function(){$('input[type=radio]',$(this).parent()).removeAttr('checked');});},comment_form_setup:function(){if($('#comment_body').length){load_rich_editor('comment_body',{toolbar:'Basic',language:_LANGUAGE,width:'525px',height:'100px'});$('#form_comment').click(function(){$('#comment_body').val(CKEDITOR.instances.comment_body.getData());});$('#form_comment').yav({'errorMessage':msg.ERRORMESSAGE,'errorPosition':'after','errorDiv':'form_upload_status','onOk':function(the_form){$('.error',the_form).remove();$.post(noCache(the_form.action),{'paper_id':$('#paper_id').val(),'comment_body':CKEDITOR.instances.comment_body.getData(),'is_private':1},function(response){var data=response;if(data.stat=='OK'){msgbox_success(_msg('SUCCESS','OK'));var li=$('li.paper_comment:first').clone();$('.paper_comment_author',li).html($('#owner_name').val());$('.paper_comment_body',li).html(CKEDITOR.instances.comment_body.getData());$('#comments').prepend(li.removeClass('hidden'));$('<span></span>').addClass('paper_comment_date').html(SYM.format_date(new Date(),'dd-MM-yyyy HH:ii')).appendTo('.paper_comment_author:first');CKEDITOR.instances.comment_body.setData('');}else{var error=$('<p></p>').addClass('error');$(the_form).prepend(error.html(msg[data.msg]));}});return false;}});}},abstract_limit_count_updater:function(){var text=CKEDITOR.instances.form_upload_abstract_text.getData(),count=SYM.UPLOAD.abstract_remaining_words_count(text);$('.abstract_word_count').html(count);},abstract_remaining_words_count:function(text){var count=parseInt($('.abstract_word_count_limit').html()),word_count=0;text=text.replace(/<(?:.|\n)*?>/gm,'').replace(/&nbsp;/gm,' ').replace(/\s+/gm,' ').trim();word_count=text.split(' ').filter(function(el){return el.trim().length;});if(word_count.length&&word_count[0]!=''){count=count-word_count.length;}
40return count;},flexbox_setup:function(input_str_number,input_int_number,default_value){return;},btn_add_document:function(){$('.btn_add_document').click(function(){$(this).hide();$('.event_section').fadeIn(300);$('#form_upload').fadeIn(300);$('#paper_category').change();});},open_detail_abstract:function(){$('.open_detail_abstract').click(function(e){e.preventDefault();$(this).parent().parent().css('border-bottom','none');var abstract_id=$(this).data('id');$('.td_detail_abstract_'+abstract_id).toggle();return false;});SYM.pluploader_init_alt({alternative:'paperupdate',unique_names:true});$('a.paper_upload_update').unbind('click').click(function(e){e.preventDefault();$('#paperupdate_id').val($(this).attr('data-paper_id'));msgbox($('#upload_update_overlay'));$('#upload_update_overlay').removeClass('hidden');$('#msgbox_confirm_no','#upload_update_overlay').click(function(){SYM.reset_plupload_alt_input({alternative:'paperupdate',unique_names:true});$('#upload_update_overlay').addClass('hidden');msgbox_close('all');});$('#msgbox_confirm_yes','#upload_update_overlay').unbind('click').click(function(){$('p.error','#filelist_paperupdate').remove();$('p.ok','#filelist_paperupdate').remove();if($('#field_paperupdate_file').val()!=''){$.post(noCache('/file_manager/upload_paper'),{upload_type:'paper',mode:'update',update_file_only:true,field_paperupload_file:$('#field_paperupdate_file').val(),paper_id:$('#paperupdate_id').val(),event_id:$('#event_id').val()},function(response){if(response.stat=='OK'){$('#filelist_paperupdate').append('<p class="ok">'+msg.SUCCESFUL_OPERATION_MSG+'</p>');SYM.reset_plupload_alt_input({alternative:'paperupdate',unique_names:true});setTimeout(function(){$('#upload_update_overlay').addClass('hidden');msgbox_close('all');},2000);location.href=location.href;}else{$('#filelist_paperupdate').append('<p class="error">'+response.msg+'</p>');if(typeof response.form_errors_array!='undefined'){for(var prop in response.form_errors_array){prop=prop.replace('_file','');$('<p class="error">'+msg.REQUIRED_FIELD+'</p>').insertBefore('#'+prop);}}}});}else{$('#filelist_paperupdate').append('<p class="error">'+msg.REQUIRED_FIELD+'</p>');}});});},block_upload_form:function(block){if(block){SYM.UPLOAD.upload_in_process=true;$('#upload_button').html("<img src='/imgs/common/ajax_load.gif'/>"+msg.LOADING+"...");}else{SYM.UPLOAD.upload_in_process=false;$('#upload_button').html("<img src='/imgs/common/arrow_right.png'/>"+msg.CONTINUE);}},scroll_to_error:function(){$('html, body').animate({scrollTop:$("p.error:first").offset().top-100},1000);}};}());$.fn.ready(function(){$('.category_description').niceScroll();try{SYM.UPLOAD.form_setup();SYM.UPLOAD.category_setup();SYM.UPLOAD.comment_form_setup();SYM.UPLOAD.btn_add_document();SYM.UPLOAD.open_detail_abstract();}catch(error){console.log(error);}});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.