/* Begin javascript */ $('.ftp_file_open').click(function(){ window.ftp_dialog = new Dialog('ftp_dialog', { title: 'Lista plików załadowanych', width: 660, close: 'ftp_dialog'}); ajax('https://naswietlarnia.acad.pl/ftp/list/contener/ftp_dialog_content', null, '#ftp_dialog_content'); return false; }); // $('.ftp_file_list .file_open').die(); // $('.file_open').die(); $('.ftp_file_list .file_open').live('click' ,function(){ var checkbox = $(this).parent().parent().find('input.ids'); if(checkbox.attr('disabled')){ return false; } if(checkbox.attr('checked')){ checkbox.attr('checked', false); }else{ checkbox.attr('checked', true); } checkbox.trigger('change'); // if(window.ftp_file_info_dialog === undefined) // window.ftp_file_info_dialog = new Dialog('ftp_file_info_dialog', { title: 'Informacja o pliku', width: 660, close: 'ftp_file_info_dialog'}); // ajax($(this).attr('href'), null, '#ftp_file_info_dialog_content'); return false; }); $('#send_ids').live('click', function(){ // $('.ftp_file_open').val($(this).html()); var id = $(this).attr('id').split('_'); var post = ''; $.each(window.ids, function(i, v){ post += "ids[]=" + v + '&'; }); console.log(post, '1111'); // window.ids = new Array(); window.ids = undefined; $.ajax({ type: "POST", url: 'https://naswietlarnia.acad.pl/ftp/addToOrder', data: 'main_order_id='+ $('#main_order_id').val() +'&order_id='+ $('#model_id').val() +'&order_type='+ $('#order_type').val() + '&files_dir=' + $('#files_dir').val() + '&' + post, dataType: "json", success: function(response){ if (response.status == 'OK'){ console.log(response); LoadToElement('#order_files_list', response.url , '', ''); ftp_dialog.close(); } }, error: function(){ console.log('error'); ftp_dialog.close(); } }); return false; }); $('.remove_from_order').live('click', function(){ if (!confirm('confirm_remove_file_from_order')){ return false; } var id = $(this).attr('id').split('_'); $.ajax({ type: "POST", url: 'https://naswietlarnia.acad.pl/ftp/removeFromOrder/', data: 'id='+ id[1], dataType: "json", success: function(response){ if (response.status == 'OK'){ $('#status_box_id').html('remove_from_order_ok'); LoadToElement('#order_files_list', response.url , '', ''); } }, error: function(){ console.log('error'); ftp_dialog.close(); } }); // ftp_dialog.close(); return false; }); function removeFromOrder(this_el, file_order_id, url, order_id, order_type){ if (!confirm('confirm_remove_file_from_order')){ return false; } $.ajax({ url: 'https://naswietlarnia.acad.pl/ftp/removeFromOrder', data: 'id='+ file_order_id + '&order_id=' + order_id + '&order_type=' + order_type, dataType: "json", success: function(response){ console.log(response); if (response.status == 'OK'){ $('#status_box_id').html('remove_from_order_ok'); if(response.url){ url = response.url; } console.log(url, 'url'); LoadToElement('#order_files_list', url + '/id/' + response.order_id, '', ''); } }, error: function(){ console.log('error'); ftp_dialog.close(); } }); } /* End of javascript */