Import legacy nurinda.co.id website

This commit is contained in:
dirga committed 2026-10-01 14:27:19 +07:00
1 parent 3f59bb9038
commit 6e21646ac4
13389 files changed
+3246690

No files matched your search

@@ -0,0 +1,357 @@
.main-media-sync-page a:focus {
box-shadow: none;
color: inherit;
}
.main-media-sync-page .media-sync-global-errors {
padding-top: 10px;
padding-bottom: 10px;
}
.main-media-sync-page .media-sync-global-errors.hidden {
display: none;
}
.main-media-sync-page .notice pre {
display: inline;
margin: 0;
}
.main-media-sync-page .notice-files-imported {
display: none;
}
.main-media-sync-page .notice-files-imported.is-visible {
display: block;
}
.main-media-sync-page .media-sync-button-holder {
margin: 25px 0;
}
.main-media-sync-page .media-sync-button-holder .import-spinner {
float: none;
}
.main-media-sync-page .import-options {
margin: 25px 0;
}
.main-media-sync-page .import-options .description {
color: #999;
}
.main-media-sync-page .import-option-date-type {
margin: 10px 0;
}
.main-media-sync-page .import-option-date-type .import-option-date-type-item {
margin: 10px 0;
}
.main-media-sync-page .import-option-date-type .import-option-date-type-item label {
display: block;
margin: 0 0 5px;
}
.main-media-sync-page .import-option-date-type .import-option-date-type-item .description {
margin: 5px 0 5px 25px;
}
.main-media-sync-page .import-options .media-sync-dry-run-holder {
display: block;
padding: 0 0 25px;
}
.main-media-sync-page .import-options .media-sync-dry-run-holder label {
display: inline-block;
vertical-align: top;
margin-top: -1px;
}
.main-media-sync-page .import-option-batch-size {
margin: 10px 0;
}
.main-media-sync-page .media-sync-scan-files-message {
display: block;
margin: 15px 0;
}
/* Progress Bar */
.main-media-sync-page .media-sync-progress-holder {
display: none;
background: #ddd;
}
.main-media-sync-page .media-sync-progress-holder .media-sync-progress {
display: block;
width: 0;
height: 15px;
background: #0073aa;
-moz-transition: width .3s ease-in-out;
-webkit-transition: width .3s ease-in-out;
-o-transition: width .3s ease-in-out;
transition: width .3s ease-in-out;
}
.main-media-sync-page .media-sync-progress-holder.is-visible {
display: block;
}
/* Counters and other texts */
.main-media-sync-page .media-sync-state {
display: block;
padding: 5px 0 0;
}
.main-media-sync-page .media-sync-state .media-sync-state-number {
font-size: 16px;
font-weight: 500;
}
.main-media-sync-page .media-sync-state .media-sync-state-text {
font-size: 15px;
}
.main-media-sync-page .media-sync-state.media-sync-state-note {
color: #999;
padding: 10px 0 5px;
}
.main-media-sync-page .wp-filter {
margin-bottom: 10px;
}
.main-media-sync-page .wp-filter .filter-items {
padding: 11px 0;
}
/* Raw debug results */
.main-media-sync-page .media-sync-html-response-holder {
/*background-color: var(--color-dark);*/
/*color: var(--color-light);*/
border: 1px dotted #ccd0d4;
font-family: monospace;
padding: 8px 12px;
margin: 1em 0;
}
.main-media-sync-page .media-sync-html-response-title {
margin: 0.5em 0;
}
.main-media-sync-page .media-sync-html-response-item-error {
color: var(--color-danger);
}
/* Table Holder */
.main-media-sync-page .media-sync-table-holder {
position: relative;
}
.main-media-sync-page .media-sync-table-holder .table-spinner {
display: none;
}
.main-media-sync-page .media-sync-table-holder.is-loading .table-spinner {
display: block;
position: absolute;
top: 50%;
left: 50%;
width: 30px;
height: 30px;
line-height: 30px;
background-position: 50% 50%;
vertical-align: middle;
z-index: 2;
margin: -15px 0 0 -15px;
}
.main-media-sync-page .media-sync-table-holder.is-loading:after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(250, 250, 250, 0.8);
z-index: 1;
}
/* Table Row */
.main-media-sync-page tr.media-sync-list-file.is-first-level-no {
float: left;
height: 0;
opacity: 0;
visibility: collapse;
}
.main-media-sync-page tr.media-sync-list-file.is-first-level-no.is-expanded {
float: none;
height: auto;
opacity: 1;
visibility: visible;
}
/* Highlight row that was imported successfully */
.main-media-sync-page tr.media-sync-list-file.highlight-success td,
.main-media-sync-page tr.media-sync-list-file.highlight-success th {
background: #fff7b7;
}
/* Highlight row that was imported with error */
.main-media-sync-page tr.media-sync-list-file.highlight-error td,
.main-media-sync-page tr.media-sync-list-file.highlight-error th {
background: #fb9e9e;
}
.main-media-sync-page tr.media-sync-list-file div.error {
margin: 10px 0;
padding-top: 5px;
padding-bottom: 5px;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-toggle-row {
font-size: 26px;
cursor: pointer;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-toggle-row:before {
content: "\f139";
display: block;
margin: -2px 0 0 -5px;
}
.main-media-sync-page tr.media-sync-list-file.with-expanded-children .media-sync-toggle-row:before {
content: "\f140";
}
.main-media-sync-page tr.media-sync-list-file .dashicons-category {
position: relative;
z-index: 1;
margin-top: -1px;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-file-name {
display: inline-block;
min-width: 18px;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-num-items {
color: #999;
font-size: 12px;
margin-left: 5px;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-parents {
margin-right: 2px;
}
.main-media-sync-page tr.media-sync-list-file.is-file .media-sync-parents {
margin-right: 16px;
}
.main-media-sync-page tr.media-sync-list-file.is-file.toggle-arrows-yes .media-sync-parents {
margin-right: 10px;
}
.main-media-sync-page tr.media-sync-list-file.is-file.is-in-db-yes .media-sync-file-name {
opacity: 0.3;
}
.main-media-sync-page .widefat tbody td,
.main-media-sync-page .widefat tbody th {
border-bottom: 1px solid #f9f9f9;
padding-top: 8px;
padding-bottom: 7px;
}
.main-media-sync-page tr.media-sync-list-file.is-file td,
.main-media-sync-page tr.media-sync-list-file.is-file th {
padding-bottom: 8px;
}
.main-media-sync-page tr.media-sync-list-file.is-in-db-yes .media-sync-already-in-db {
display: none;
}
.main-media-sync-page tr.media-sync-list-file.is-in-db-yes:hover .media-sync-already-in-db {
display: inline;
}
.main-media-sync-page tr.media-sync-list-file.is-in-db-yes:hover td,
.main-media-sync-page tr.media-sync-list-file.is-in-db-yes:hover th {
padding-bottom: 7px;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-parent {
display: block;
float: left;
position: relative;
width: 18px;
height: 18px;
text-align: center;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-parent.is-first-yes i,
.main-media-sync-page tr.media-sync-list-file .media-sync-parent.is-last-yes i,
.main-media-sync-page tr.media-sync-list-file .media-sync-parent.is-last-yes:after {
content: "";
position: absolute;
display: block;
left: 9px;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-parent.is-first-yes i,
.main-media-sync-page tr.media-sync-list-file .media-sync-parent.is-last-yes i {
bottom: 9px;
height: 35px;
border-left: 1px dotted #555;
}
.main-media-sync-page tr.media-sync-list-file .media-sync-parent.is-last-yes:after {
top: 50%;
width: 17px;
border-bottom: 1px dotted #555;
}
.main-media-sync-page tr.media-sync-list-file.toggle-arrows-yes .media-sync-parent.is-first-yes i,
.main-media-sync-page tr.media-sync-list-file.toggle-arrows-yes .media-sync-parent.is-last-yes i,
.main-media-sync-page tr.media-sync-list-file.toggle-arrows-yes .media-sync-parent.is-last-yes:after {
border: none;
}
.main-media-sync-page .media-sync-no-results {
font-size: 14px;
padding: 20px 5px;
margin: 0;
}
.main-media-sync-page .widefat tfoot td.check-column,
.main-media-sync-page .widefat thead td.check-column {
padding-top: 2px;
}
.main-media-sync-page .widefat tbody th.check-column {
padding-top: 9px;
}
.media-sync-debugging-stats {
border: 1px dotted #ccd0d4;
padding: 8px 12px;
margin: 15px 0;
}
.media-sync-debugging-stats .media-sync-debugging-title {
margin-bottom: 6px;
}
.media-sync-page-settings .media-sync-options-install-add-on-message {
padding: 20px 0 5px;
}
.media-sync-page-settings .form-table input[type=text] {
width: 100%;
max-width: 400px;
}
.media-sync-page-settings .import-option-date-type-item {
margin: 0 0 10px;
}
.media-sync-page-settings .import-option-date-type-item .description {
margin: 0;
}
.media-sync-settings-button-holder {
display: flex;
align-items: center;
margin: 25px 0;
}
.media-sync-settings-button-holder p.submit {
display: inline;
margin: 0;
padding: 0;
}
.media-sync-settings-button-holder .spinner {
float: none;
margin: 0 10px;
}
@@ -0,0 +1,228 @@
jQuery(document).ready(function($) {
try {
var plugin = $('.main-media-sync-page');
var files = plugin.find('.media-sync-list-files');
plugin.find('.js-import-selected').on('click', function (e) {
e.preventDefault();
var btn = $(this);
var form = files.find('form');
var isDebug = !!form.find('input[name="is_debug"]').val();
var dryRun = !!form.find('input[name="dry_run"]').prop('checked');
var filePostDate = form.find('input[name="file_post_date"]:checked').val();
var batchSize = parseInt(form.find('input[name="batch_size"]').val());
var selectedItems = form.find('.is-file.is-in-db-no input[type="checkbox"]:checked');
var items = selectedItems && selectedItems.length ? selectedItems.map(function (index, checkbox) {
return {
'file': $(checkbox).val(),
'row_id': $(checkbox).attr('data-row-id')
};
}).get() : [];
var total = items.length;
var batch;
var batchCount = 0;
var counter = 0;
function setActiveStatus(isActive) {
if(isActive) {
// Disable submit button while request is being executed
btn.prop('disabled', true);
// Activate loading icon
plugin.find('.import-spinner').addClass('is-active');
} else {
// Enable submit button
btn.prop('disabled', false);
// Deactivate loading icon
plugin.find('.import-spinner').removeClass('is-active');
}
}
function outputError(errorMessage = null, error = null, isItemError = false) {
console.error("[Media Sync] [Import] " + errorMessage, (error ? error : ''));
if(!isItemError) {
var errors = "[Media Sync] " + errorMessage + (error ? "\nE:\n" + error : '');
plugin.find('.js-media-sync-error-placeholder').removeClass('hidden').html(errors);
setActiveStatus(false);
}
}
if (total <= 0) {
outputError('No files selected.');
return false;
}
if (!(typeof batchSize === 'number' && batchSize > 0)) {
outputError('Batch Size needs to be positive number.');
return false;
}
// Reset stuff
plugin.find('.media-sync-progress').css('width', 0);
plugin.find('.notice-files-imported').removeClass('is-visible');
plugin.find('.js-media-sync-html-responses').html('');
plugin.find('.js-media-sync-error-placeholder').addClass('hidden').html('');
// Clear highlighted rows
files.find('.media-sync-list-file.highlight-success').removeClass('highlight-success');
files.find('.media-sync-list-file.highlight-error').removeClass('highlight-error');
// Clear file errors
files.find('.media-sync-file-error').remove();
// Show progress bar
plugin.find('.media-sync-progress-holder').addClass('is-visible');
function runAjax() {
// Take new batch
batch = items.splice(0, batchSize);
// Exit if there is nothing left in batch
if (!(batch.length > 0)) {
setActiveStatus(false);
return true;
}
batchCount++;
return $.ajax({
url: ajax_data.ajax_url + '?mediaSyncBatch=' + batchCount,
data: {
'action': 'media_sync_import_files',
'security': ajax_data.security,
'dry_run': dryRun,
'file_post_date': filePostDate,
'media_items': batch
},
dataType: isDebug ? 'html' : 'json',
method: 'POST'
}).done(function (data) {
try {
if(!data) {
outputError('No response received');
return false;
}
if (isDebug) {
plugin.find('.js-media-sync-html-responses').append(data);
} else {
var error = data.hasOwnProperty('error') && data.error ? data.error : null;
var errorMessage = data.hasOwnProperty('errorMessage') && data.errorMessage ? data.errorMessage : null;
if(error || errorMessage) {
outputError('[Backend error] ' + errorMessage, error);
return false;
}
if(!(data.hasOwnProperty('results') && data.results && data.results.length > 0)) {
setActiveStatus(false);
return false;
}
$.each(data.results, function (index, item) {
var itemError = item.hasOwnProperty('error') && item.error ? item.error : null;
var itemErrorMessage = item.hasOwnProperty('errorMessage') && item.errorMessage ? item.errorMessage : null;
if(itemError || itemErrorMessage) {
outputError('[Item error] ' + itemErrorMessage, itemError, true);
}
if (item.hasOwnProperty('row_id') && item.row_id) {
var statusClass = 'error';
if (item.inserted === true) {
counter++;
statusClass = 'success';
console.log("[Media Sync] [" + counter + "] " + (dryRun ? "DRY RUN: " : "Successfully imported: ") + item.row_id);
} else {
// If we didn't already output the error
if(!itemError && !itemErrorMessage) {
console.error("[Media Sync] Error importing: " + item.row_id);
}
}
try {
var fileRow = files.find('[id="' + item.row_id + '"]');
if(itemError || itemErrorMessage) {
var errors = (itemErrorMessage ? itemErrorMessage : '') + (itemError ? '\nE:\n' + itemError : '');
fileRow.find('.column-primary').append('<div class="error media-sync-file-error">' + errors + '</div>');
}
// Highlight imported or failed row
fileRow.addClass('highlight-' + statusClass);
} catch (highlightError) {
console.log('[Media Sync] Could not highlight imported row.', highlightError);
}
}
});
var animatedCounter = counter;
// Not really correct progress indicator, it's just animated
jQuery({Counter: animatedCounter}).animate({Counter: counter}, {
duration: 1000,
easing: 'linear',
step: function () {
// Update "imported" count
files.find('.js-media-sync-imported-count').html(Math.ceil(this.Counter));
},
complete: function () {
// Update "imported" count again (sometimes it doesn't set correct value above)
files.find('.js-media-sync-imported-count').html(counter);
}
});
// Update progress bar
plugin.find('.media-sync-progress').css('width', ((counter / total) * 100) + '%');
// If all items are imported successfully (last item)
if (counter === total) {
setActiveStatus(false);
// Show success message
plugin.find('.notice-files-imported').addClass('is-visible');
}
}
// Run again to go through all batches
// It's a recursive call to avoid stacking too many "pending" ajax calls,
// but async/await or Promise would be much better
runAjax();
} catch(e) {
outputError('Error processing results', e);
return false;
}
}).fail(function (jqXHR, textStatus, errorThrown) {
plugin.find('.js-media-sync-html-responses').append(jqXHR.responseText);
outputError('[AJAX error] ' + textStatus, errorThrown);
return false;
});
}
setActiveStatus(true);
// Run recursively (to avoid stacking too many "pending" ajax calls)
runAjax();
});
} catch (e) {
console.error('[Media Sync]', e);
alert("[Media Sync]\n" + e);
}
});
@@ -0,0 +1,107 @@
jQuery(document).ready(function($) {
var files = $('.main-media-sync-page .media-sync-list-files');
var tableHolder = files.find('.media-sync-table-holder');
// When directory checkbox is changed (direct click or running recursively with .trigger())
files.find('.media-sync-list-file.is-dir .js-checkbox').on('change', function (event, type) {
// Show loading overlay
if(type !== "recursive" && !tableHolder.hasClass('is-loading')) {
tableHolder.addClass('is-loading');
}
// Find parent row
var row = $(this).closest('.media-sync-list-file');
// Checked or not
var checked = !!$(this).prop('checked');
// Fake delay to allow loading to show up immediately (before this)
setTimeout(function () {
var childrenCheckboxes = row.siblings('[data-parent-id="' + row.prop('id') + '"]').find('.js-checkbox');
if (childrenCheckboxes && childrenCheckboxes.length > 0) {
$.each(childrenCheckboxes, function (index, checkbox) {
// If not disabled
if (!$(checkbox).prop('disabled')) {
// Check / un-check and trigger "change" event to run for inner folders
$(checkbox).prop('checked', checked).trigger('change', ['recursive']);
}
});
}
// Update "selected items" counter
files.find('.js-media-sync-selected-count').html(files.find('.is-file.is-in-db-no input[type="checkbox"]:checked').length);
// Hide loading overlay
if(type !== "recursive" && tableHolder.hasClass('is-loading')) {
tableHolder.removeClass('is-loading');
}
}, 0);
});
// Handle "select all" checkboxes events
var selectAllCheckboxes = files.find('.check-column-all input[type="checkbox"]');
// Cancel other stuff added to this element and click event (from WP), because it's quite slow with all of that
selectAllCheckboxes.on('click', function(e) {
e.stopPropagation();
});
selectAllCheckboxes.on('change', function(e) {
e.stopPropagation();
// Checked or not
var checked = !!$(this).prop('checked');
// Check other "select all" checkbox (there is one at the top and one at the bottom)
selectAllCheckboxes.prop('checked', checked);
// Check / un-check all first level items and trigger "change" event to run for inner folders
$.each(files.find('.media-sync-list-file.level-1 .js-checkbox'), function (index, checkbox) {
$(checkbox).prop('checked', checked).trigger('change');
});
});
// Update "selected items" counter when selecting individual files
files.find('.media-sync-list-file.is-file .js-checkbox').on('change', function () {
// Update "selected items" counter
files.find('.js-media-sync-selected-count').html(files.find('.is-file.is-in-db-no input[type="checkbox"]:checked').length);
});
// Expand / Collapse folders
files.find('.media-sync-list-file.is-dir .js-toggle-row').on('click', function () {
// Find parent row
var row = $(this).closest('.media-sync-list-file');
// If it's expanded or not
var expanded = row.hasClass('with-expanded-children');
if (expanded) {
row.removeClass('with-expanded-children');
} else {
row.addClass('with-expanded-children');
}
// Each child row
$.each(row.siblings('[data-parent-id="' + row.prop('id') + '"]'), function () {
// If child is dir with expanded children
if ($(this).hasClass('is-dir') && $(this).hasClass('with-expanded-children')) {
// Trigger click to collapse inner children
$(this).find('.js-toggle-row').trigger('click');
}
if (expanded) {
$(this).removeClass('is-expanded');
} else {
$(this).addClass('is-expanded');
}
});
});
});