| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <?php
- /**
- * Admin Media Page for QDR Temporary Shared Storage
- *
- * @package QDR_Temporary_Shared_Storage
- */
- // If this file is called directly, abort.
- if (!defined('WPINC')) {
- die;
- }
- // Get current settings
- $settings = QDR_TSS_Settings::instance()->get_settings();
- $db_manager = QDR_TSS_DB_Manager::instance();
- // Get total storage usage
- $total_size = $db_manager->get_total_storage();
- $max_size = $settings['max_upload_size'];
- $usage_percent = ($max_size > 0) ? min(100, ($total_size / $max_size) * 100) : 0;
- ?>
- <div class="wrap qdr-tss-admin">
- <h1><?php esc_html_e('Shared Storage', 'qdr-temporary-shared-storage'); ?></h1>
-
- <div class="qdr-tss-storage-summary">
- <h2><?php esc_html_e('Storage Usage', 'qdr-temporary-shared-storage'); ?></h2>
- <div class="qdr-tss-storage-bar">
- <div class="qdr-tss-storage-used" style="width: <?php echo esc_attr($usage_percent); ?>%"></div>
- </div>
- <p>
- <?php echo esc_html(qdr_tss_format_bytes($total_size)); ?> / <?php echo esc_html(qdr_tss_format_bytes($max_size)); ?>
- (<?php echo number_format($usage_percent, 1); ?>%)
- </p>
- </div>
-
- <div class="qdr-tss-toolbar">
- <div class="qdr-tss-search">
- <input type="text" id="qdr-tss-search-filename" placeholder="<?php esc_attr_e('Search by filename', 'qdr-temporary-shared-storage'); ?>">
- <input type="text" id="qdr-tss-search-reference" placeholder="<?php esc_attr_e('Search by reference', 'qdr-temporary-shared-storage'); ?>">
- <button class="button" id="qdr-tss-search-button">
- <span class="dashicons dashicons-search"></span> <?php esc_html_e('Search', 'qdr-temporary-shared-storage'); ?>
- </button>
- <button class="button" id="qdr-tss-reset-search">
- <span class="dashicons dashicons-dismiss"></span> <?php esc_html_e('Reset', 'qdr-temporary-shared-storage'); ?>
- </button>
- </div>
-
- <div class="qdr-tss-actions">
- <button class="button button-primary" id="qdr-tss-refresh">
- <span class="dashicons dashicons-update"></span> <?php esc_html_e('Refresh', 'qdr-temporary-shared-storage'); ?>
- </button>
- </div>
- </div>
-
- <div class="qdr-tss-table-container">
- <table class="wp-list-table widefat fixed striped qdr-tss-table">
- <thead>
- <tr>
- <th class="column-media-id sortable" data-sort="media_id"><?php esc_html_e('Media ID', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-filename sortable" data-sort="original_file_name"><?php esc_html_e('File Name', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-description"><?php esc_html_e('Description', 'qdr-temporary-shared-storage'); ?></th>
- <th class="column-message"><?php esc_html_e('Message', 'qdr-temporary-shared-storage'); ?></th>
- <th class="column-active-from sortable" data-sort="active_from"><?php esc_html_e('Active From', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-active-to sortable" data-sort="active_to"><?php esc_html_e('Active To', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-reference sortable" data-sort="reference"><?php esc_html_e('Reference', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-upload-date sortable" data-sort="upload_date"><?php esc_html_e('Upload Date', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-download-count sortable" data-sort="download_count"><?php esc_html_e('Downloads', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-last-download sortable" data-sort="last_download"><?php esc_html_e('Last Download', 'qdr-temporary-shared-storage'); ?> <span class="sorting-indicator"></span></th>
- <th class="column-actions"><?php esc_html_e('Actions', 'qdr-temporary-shared-storage'); ?></th>
- </tr>
- </thead>
- <tbody id="qdr-tss-items-list">
- <tr>
- <td colspan="11" class="qdr-tss-loading">
- <span class="spinner is-active"></span> <?php esc_html_e('Loading...', 'qdr-temporary-shared-storage'); ?>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div class="qdr-tss-pagination">
- <div class="qdr-tss-pagination-info"></div>
- <div class="qdr-tss-pagination-controls"></div>
- </div>
- </div>
- <!-- Edit Item Modal -->
- <div id="qdr-tss-edit-modal" class="qdr-tss-modal">
- <div class="qdr-tss-modal-content">
- <span class="qdr-tss-modal-close">×</span>
- <h2><?php esc_html_e('Edit Shared File', 'qdr-temporary-shared-storage'); ?></h2>
-
- <form id="qdr-tss-edit-form">
- <input type="hidden" id="qdr-tss-edit-id" name="id">
-
- <div class="qdr-tss-form-row">
- <label for="qdr-tss-edit-description"><?php esc_html_e('Description', 'qdr-temporary-shared-storage'); ?></label>
- <textarea id="qdr-tss-edit-description" name="description" rows="3"></textarea>
- </div>
-
- <div class="qdr-tss-form-row">
- <label for="qdr-tss-edit-message"><?php esc_html_e('Message', 'qdr-temporary-shared-storage'); ?></label>
- <textarea id="qdr-tss-edit-message" name="message" rows="3"></textarea>
- </div>
-
- <div class="qdr-tss-form-row">
- <label for="qdr-tss-edit-active-from"><?php esc_html_e('Active From', 'qdr-temporary-shared-storage'); ?></label>
- <input type="text" id="qdr-tss-edit-active-from" name="active_from" class="qdr-tss-datepicker" autocomplete="off">
- </div>
-
- <div class="qdr-tss-form-row">
- <label for="qdr-tss-edit-active-to"><?php esc_html_e('Active To', 'qdr-temporary-shared-storage'); ?></label>
- <input type="text" id="qdr-tss-edit-active-to" name="active_to" class="qdr-tss-datepicker" autocomplete="off">
- </div>
-
- <div class="qdr-tss-form-row">
- <label for="qdr-tss-edit-reference"><?php esc_html_e('Reference', 'qdr-temporary-shared-storage'); ?></label>
- <input type="text" id="qdr-tss-edit-reference" name="reference">
- </div>
-
- <div class="qdr-tss-form-actions">
- <button type="submit" class="button button-primary"><?php esc_html_e('Save Changes', 'qdr-temporary-shared-storage'); ?></button>
- <button type="button" class="button qdr-tss-modal-cancel"><?php esc_html_e('Cancel', 'qdr-temporary-shared-storage'); ?></button>
- </div>
- </form>
-
- <div id="qdr-tss-edit-status"></div>
- </div>
- </div>
- <!-- View Details Modal -->
- <div id="qdr-tss-details-modal" class="qdr-tss-modal">
- <div class="qdr-tss-modal-content">
- <span class="qdr-tss-modal-close">×</span>
- <h2><?php esc_html_e('File Details', 'qdr-temporary-shared-storage'); ?></h2>
-
- <div class="qdr-tss-details-content">
- <table class="widefat striped">
- <tr>
- <th><?php esc_html_e('Media ID', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-media-id"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('File Name', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-filename"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Description', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-description"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Message', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-message"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Reference', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-reference"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Active Period', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-active-period"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('File Size', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-filesize"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Download Count', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-download-count"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Last Download', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-last-download"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Permalink', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-permalink"></td>
- </tr>
- <tr>
- <th><?php esc_html_e('Shortcode', 'qdr-temporary-shared-storage'); ?></th>
- <td id="qdr-tss-details-shortcode"></td>
- </tr>
- </table>
- </div>
-
- <div class="qdr-tss-form-actions">
- <button type="button" class="button button-secondary qdr-tss-copy-shortcode"><?php esc_html_e('Copy Shortcode', 'qdr-temporary-shared-storage'); ?></button>
- <button type="button" class="button button-secondary qdr-tss-copy-permalink"><?php esc_html_e('Copy Permalink', 'qdr-temporary-shared-storage'); ?></button>
- <button type="button" class="button qdr-tss-modal-cancel"><?php esc_html_e('Close', 'qdr-temporary-shared-storage'); ?></button>
- </div>
- </div>
- </div>
- <!-- Confirm Delete Modal -->
- <div id="qdr-tss-confirm-delete-modal" class="qdr-tss-modal">
- <div class="qdr-tss-modal-content qdr-tss-modal-sm">
- <span class="qdr-tss-modal-close">×</span>
- <h2><?php esc_html_e('Confirm Delete', 'qdr-temporary-shared-storage'); ?></h2>
-
- <p><?php esc_html_e('Are you sure you want to delete this file? This action cannot be undone.', 'qdr-temporary-shared-storage'); ?></p>
-
- <div class="qdr-tss-form-actions">
- <button type="button" class="button button-primary qdr-tss-confirm-delete-button"><?php esc_html_e('Delete', 'qdr-temporary-shared-storage'); ?></button>
- <button type="button" class="button qdr-tss-modal-cancel"><?php esc_html_e('Cancel', 'qdr-temporary-shared-storage'); ?></button>
- </div>
-
- <input type="hidden" id="qdr-tss-delete-id">
- </div>
- </div>
|