/** * upload-settings.js * * handles settings for Advanced uploader. */ function removeButton (button) { num = button.id.match(/del_dest_(.*)/)[1]; jQuery('#adv_file_upload_destination_'+num).remove(); } function addButton( label, dest, library ) { index_field = jQuery('#index'); var index = index_field.val(); createBoxes(index, label, dest, library ).appendTo('#adv_file_upload_destinations'); index++; index_field.val(index); } function createBoxes( index, label, dest, library, current ) { label = (typeof label === 'undefined') ? '' : label; dest = (typeof dest === 'undefined') ? adv_upload_base_dir : dest; library = (typeof library === 'undefined') ? true: library; library = (library == 1) ? true: library; var boxes = jQuery('
',{ id:'adv_file_upload_destination_'+index, style:'overflow:hidden;' }); if( !current ) boxes.append(jQuery('',{ class: 'adv_file_upload_destination_index', type:'hidden', value:index, })); boxes.append(jQuery('',{ id:'adv_file_upload_destination_label_'+index, name:'adv_file_upload_destination['+index+'][label]', type:'text', value:label, disabled:current, style:'float:left;width:135px;' })); boxes.append(jQuery('',{ id:'adv_file_upload_destination_destination_'+index, name:'adv_file_upload_destination['+index+'][dest]', type:'text', value:dest, disabled:current, style:'float:left;width:285px;' })); boxes.append(jQuery('',{ id:'adv_file_upload_destination_library_'+index, name:'adv_file_upload_destination['+index+'][library]', type:'checkbox', checked:library, value:1, disabled:current, style:'float:left;margin:5px;' })); boxes.append(jQuery('',{ id:'del_dest_'+index, name:'del_dest', type:'button', style:'width:2.5em;float:right;', class:'button button-primary', value:'-', disabled:current, onClick:'removeButton(this)' })); return boxes; } function scanButton( button ) { var dlg = jQuery('