| @@ -8,14 +8,8 @@ | ||
| 8 | 8 | const $pagination = $('.mxchat-kb-pagination'); |
| 9 | 9 | const $processButton = $('#mxchat-kb-process-selected'); |
| 10 | 10 | const $selectAll = $('#mxchat-kb-select-all'); |
| 11 | 11 | const $selectionCount = $('.mxchat-kb-selection-count'); |
| 12 | - const $acfPdfExtractCheckbox = $('#mxchat-kb-acf-pdf-extract'); | |
| 13 | - | |
| 14 | - // Restore last-used ACF→PDF extract preference from the server-localized default. | |
| 15 | - if (typeof mxchatSelector !== 'undefined' && mxchatSelector.acfPdfExtractDefault) { | |
| 16 | - $acfPdfExtractCheckbox.prop('checked', true); | |
| 17 | - } | |
| 18 | 12 | |
| 19 | 13 | // Filter elements |
| 20 | 14 | const $searchInput = $('#mxchat-kb-content-search');1 |
| 21 | 15 | const $typeFilter = $('#mxchat-kb-content-type-filter'); |
| @@ -54,9 +48,9 @@ | ||
| 54 | 48 | $('.mxchat-import-box').removeClass('active'); |
| 55 | 49 | $box.addClass('active'); |
| 56 | 50 | |
| 57 | 51 | // Hide all input areas |
| 58 | - $('#mxchat-url-input-area, #mxchat-content-input-area, #mxchat-pdf-upload-area').hide(); | |
| 52 | + $('#mxchat-url-input-area, #mxchat-content-input-area').hide(); | |
| 59 | 53 | |
| 60 | 54 | // Hide sitemap-specific sections (but NOT for sitemap option - let detection logic handle it) |
| 61 | 55 | if (option !== 'sitemap') { |
| 62 | 56 | $('#mxchat-detected-sitemaps, #mxchat-no-sitemaps, #mxchat-sitemaps-loading').hide(); |
| @@ -63,15 +57,15 @@ | ||
| 63 | 57 | } |
| 64 | 58 | |
| 65 | 59 | // Handle different import options |
| 66 | 60 | switch (option) { |
| 67 | - case 'pdf-url': | |
| 61 | + case 'pdf': | |
| 68 | 62 | case 'sitemap': |
| 69 | 63 | case 'url': |
| 70 | 64 | // Show URL input area with appropriate placeholder |
| 71 | 65 | $('#mxchat-url-input-area').show(); |
| 72 | 66 | $('#sitemap_url').attr('placeholder', $box.data('placeholder')); |
| 73 | - $('#import_type').val(option === 'pdf-url' ? 'pdf' : option); | |
| 67 | + $('#import_type').val(option); | |
| 74 | 68 | |
| 75 | 69 | // UPDATED: Add or update bot_id hidden field for URL forms |
| 76 | 70 | updateBotIdInForm('#mxchat-url-form'); |
| 77 | 71 | |
| @@ -76,9 +70,9 @@ | ||
| 76 | 70 | updateBotIdInForm('#mxchat-url-form'); |
| 77 | 71 | |
| 78 | 72 | // Update the description text based on the import type |
| 79 | 73 | let descriptionText = ''; |
| 80 | - if (option === 'pdf-url') { | |
| 74 | + if (option === 'pdf') { | |
| 81 | 75 | descriptionText = 'Import a PDF document by entering its URL above. PDFs are processed via cron job. If processing does not start, you can manually process batch 5 pages at a time.'; |
| 82 | 76 | } else if (option === 'sitemap') { |
| 83 | 77 | descriptionText = 'Enter a content-specific sub-sitemap URL, not the sitemap index. Sitemaps are processed via cron job. If processing does not start, you can manually process batch 5 pages at a time.'; |
| 84 | 78 | // Re-show sitemap sections if they were previously loaded |
| @@ -103,16 +97,8 @@ | ||
| 103 | 97 | |
| 104 | 98 | // UPDATED: Add or update bot_id hidden field for content forms |
| 105 | 99 | updateBotIdInForm('#mxchat-content-form'); |
| 106 | 100 | break; |
| 107 | - | |
| 108 | - case 'pdf-upload': | |
| 109 | - // Show PDF file upload area | |
| 110 | - $('#mxchat-pdf-upload-area').show(); | |
| 111 | - | |
| 112 | - // Add or update bot_id hidden field for PDF upload form | |
| 113 | - updateBotIdInForm('#mxchat-pdf-upload-form'); | |
| 114 | - break; | |
| 115 | 101 | } |
| 116 | 102 | }); |
| 117 | 103 | |
| 118 | 104 | // Helper function to add/update bot_id hidden field in forms |
| @@ -506,15 +492,13 @@ | ||
| 506 | 492 | .text((isUpdate ? 'Updating' : 'Processing') + ' ' + (index + 1) + ' of ' + totalToProcess + '...'); |
| 507 | 493 | $progressModal.find('.mxchat-kb-progress-fill').css('width', percent + '%'); |
| 508 | 494 | |
| 509 | 495 | // UPDATED: Prepare AJAX data with bot_id |
| 510 | - const extractAcfPdfs = $acfPdfExtractCheckbox.prop('checked') ? 1 : 0; | |
| 511 | 496 | const ajaxData = { |
| 512 | 497 | action: 'mxchat_process_selected_content', |
| 513 | 498 | nonce: mxchatSelector.nonce, |
| 514 | 499 | post_ids: [postId], |
| 515 | - is_update: isUpdate, | |
| 516 | - extract_acf_pdfs: extractAcfPdfs | |
| 500 | + is_update: isUpdate | |
| 517 | 501 | }; |
| 518 | 502 | |
| 519 | 503 | // Add bot_id if multi-bot is active and not default |
| 520 | 504 | if (currentBotId && currentBotId !== 'default') { |
| @@ -542,15 +526,10 @@ | ||
| 542 | 526 | title: response.data.title || ('ID: ' + postId) |
| 543 | 527 | }); |
| 544 | 528 | } |
| 545 | 529 | |
| 546 | - let successText = 'Successfully ' + (isUpdate ? 'updated' : 'processed') + ': ' + response.data.title; | |
| 547 | - const pdfCount = parseInt(response.data.pdf_extracted_count, 10) || 0; | |
| 548 | - if (pdfCount > 0) { | |
| 549 | - const suffixTpl = (mxchatSelector.i18n && mxchatSelector.i18n.pdfExtractedSuffix) || ' (%d PDF(s) extracted)'; | |
| 550 | - successText += suffixTpl.replace('%d', pdfCount); | |
| 551 | - } | |
| 552 | - $progressModal.find('.mxchat-kb-current-item').text(successText); | |
| 530 | + $progressModal.find('.mxchat-kb-current-item') | |
| 531 | + .text('Successfully ' + (isUpdate ? 'updated' : 'processed') + ': ' + response.data.title); | |
| 553 | 532 | } else { |
| 554 | 533 | failed++; |
| 555 | 534 | results.failed.push({ |
| 556 | 535 | id: postId, |