- Timestamp:
- 10/17/2026 01:47:11 PM (12 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mxchat-basic/trunk/includes/admin-transcripts-page.php
r3670236 r3751971 20 20 // Extract page data 21 21 extract($page_data); 22 23 // Read-only view (plan 93999a): a role with the transcripts capability but 24 // not manage_options can read, search and export; every write control below 25 // (delete, translate, the Notifications settings) is left out for it, and 26 // the handlers behind them refuse it with 403 regardless. 27 $mxch_can_manage = current_user_can('manage_options'); 22 28 ?> 23 <div class="mxch-admin-wrapper ">29 <div class="mxch-admin-wrapper<?php echo $mxch_can_manage ? '' : ' mxch-transcripts-readonly'; ?>"> 24 30 <!-- Mobile Header --> 25 31 <header class="mxch-mobile-header"> … … 67 73 </button> 68 74 </div> 75 <?php if ($mxch_can_manage): ?> 69 76 <!-- Settings Section --> 70 77 <div class="mxch-mobile-nav-section"> … … 75 82 </button> 76 83 </div> 77 <?php if (!$is_activated): ?> 84 <?php endif; ?> 85 <?php if (!$mxch_can_manage): ?> 86 <div class="mxch-mobile-menu-footer"> 87 <?php mxchat_render_transcripts_readonly_note(); ?> 88 </div> 89 <?php elseif (!$is_activated): ?> 78 90 <div class="mxch-mobile-menu-footer"> 79 91 <a href="https://mxchat.ai/" target="_blank" class="mxch-mobile-upgrade-btn"> … … 138 150 </div> 139 151 152 <?php if ($mxch_can_manage): ?> 140 153 <!-- Settings Section --> 141 154 <div class="mxch-nav-section"> … … 151 164 </div> 152 165 </div> 166 <?php endif; ?> 153 167 </nav> 154 168 155 <?php if (!$is_activated): ?> 169 <?php if (!$mxch_can_manage): ?> 170 <div class="mxch-sidebar-footer"> 171 <?php mxchat_render_transcripts_readonly_note(); ?> 172 </div> 173 <?php elseif (!$is_activated): ?> 156 174 <div class="mxch-sidebar-footer"> 157 175 <a href="https://mxchat.ai/" target="_blank" class="mxch-sidebar-upgrade-v2"> … … 423 441 <span><?php esc_html_e('Export All Chats', 'mxchat'); ?></span> 424 442 </button> 443 <?php if ($mxch_can_manage): ?> 425 444 <button type="button" class="mxch-quick-action-btn" data-action="settings"> 426 445 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg> 427 446 <span><?php esc_html_e('Notification Settings', 'mxchat'); ?></span> 428 447 </button> 448 <?php endif; ?> 429 449 </div> 430 450 </div> … … 439 459 <!-- Bulk Actions Toolbar --> 440 460 <div class="mxch-bulk-toolbar"> 461 <?php if ($mxch_can_manage): /* selection only drives bulk delete */ ?> 441 462 <label class="mxch-bulk-select-all"> 442 463 <input type="checkbox" id="mxch-select-all"> … … 444 465 </label> 445 466 <span class="mxch-selected-count" id="mxch-selected-count">0</span> 467 <?php endif; ?> 446 468 <div class="mxch-bulk-actions"> 447 469 <button type="button" class="mxch-bulk-btn" id="mxch-sort-btn" title="<?php esc_attr_e('Sort', 'mxchat'); ?>"> … … 449 471 <span><?php esc_html_e('Sort', 'mxchat'); ?></span> 450 472 </button> 473 <?php if ($mxch_can_manage): ?> 451 474 <button type="button" class="mxch-bulk-btn mxch-bulk-delete" id="mxch-delete-selected" disabled title="<?php esc_attr_e('Delete Selected', 'mxchat'); ?>"> 452 475 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> 453 476 </button> 477 <?php endif; ?> 454 478 </div> 455 479 </div> … … 503 527 <div class="mxch-user-meta" id="mxch-user-meta">User ID: 123</div> 504 528 </div> 529 <?php /* plan 705b6c: the chat's token total, filled by the script; hidden when no reply recorded usage */ ?> 530 <div class="mxch-conversation-usage" id="mxch-conversation-usage" hidden> 531 <span class="mxch-conversation-usage-label"><?php esc_html_e('Tokens', 'mxchat'); ?></span> 532 <span class="mxch-conversation-usage-value" id="mxch-conversation-usage-value"></span> 533 </div> 505 534 <button type="button" class="mxch-details-toggle" id="mxch-toggle-details" title="<?php esc_attr_e('Show details', 'mxchat'); ?>"> 506 535 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg> … … 544 573 </div> 545 574 <div class="mxch-details-actions"> 575 <?php if ($mxch_can_manage): ?> 546 576 <button type="button" id="mxch-delete-current" class="mxch-btn mxch-btn-danger mxch-btn-sm"> 547 577 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> 548 578 <?php esc_html_e('Delete Chat', 'mxchat'); ?> 549 579 </button> 580 <?php endif; ?> 550 581 <button type="button" id="mxch-export-current" class="mxch-btn mxch-btn-secondary mxch-btn-sm"> 551 582 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg> 552 583 <?php esc_html_e('Export', 'mxchat'); ?> 553 584 </button> 554 </div> 585 <?php if (!$mxch_can_manage): /* a saved translation still shows; this switches back to the original */ ?> 586 <button type="button" id="mxch-show-original-btn" class="mxch-btn mxch-btn-secondary mxch-btn-sm" style="display: none;"> 587 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg> 588 <?php esc_html_e('Original', 'mxchat'); ?> 589 </button> 590 <?php endif; ?> 591 </div> 592 <?php if ($mxch_can_manage): ?> 555 593 <div class="mxch-translate-section"> 556 594 <div class="mxch-translate-controls"> … … 587 625 </div> 588 626 </div> 627 <?php endif; ?> 589 628 </div> 590 629 … … 597 636 </div> 598 637 638 <?php if ($mxch_can_manage): ?> 599 639 <?php wp_nonce_field('mxchat_delete_chat_history', 'mxchat_delete_chat_nonce'); ?> 600 640 … … 623 663 </div> 624 664 </div> 665 <?php endif; ?> 625 666 </div> 626 667 … … 698 739 </label> 699 740 <span class="mxch-selected-count" id="mxch-leads-selected-count">0</span> 741 <?php if ($mxch_can_manage): /* selection stays for a reader: it feeds "Export selected" */ ?> 700 742 <button type="button" class="mxch-bulk-btn mxch-bulk-delete" id="mxch-leads-delete-selected" disabled title="<?php esc_attr_e('Delete Selected', 'mxchat'); ?>"> 701 743 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> 702 744 <span><?php esc_html_e('Delete', 'mxchat'); ?></span> 703 745 </button> 746 <?php endif; ?> 704 747 </div> 705 748 <div class="mxch-leads-toolbar-right"> … … 772 815 </div> 773 816 817 <?php if ($mxch_can_manage): ?> 774 818 <!-- Delete confirm modal --> 775 819 <div id="mxch-leads-confirm" class="mxch-modal-overlay" style="display:none;"> … … 791 835 792 836 <?php wp_nonce_field('mxchat_delete_leads', 'mxchat_leads_delete_nonce'); ?> 837 <?php endif; ?> 793 838 <?php wp_nonce_field('mxchat_export_leads', 'mxchat_leads_export_nonce'); ?> 794 839 </div> 795 840 841 <?php if ($mxch_can_manage): ?> 796 842 <!-- Notifications Section --> 797 843 <div id="notifications" class="mxch-section"> … … 1001 1047 </div> 1002 1048 </div> 1049 <?php endif; ?> 1003 1050 </main> 1004 1051 </div> … … 1049 1096 <?php 1050 1097 } 1098 1099 /** 1100 * The note a read-only transcripts user sees in the sidebar footer and the 1101 * mobile menu footer, in the slot the upgrade link uses for administrators 1102 * (plan 93999a). It says what they can do and who handles the rest. 1103 */ 1104 function mxchat_render_transcripts_readonly_note() { 1105 ?> 1106 <div class="mxch-readonly-note" role="note"> 1107 <span class="mxch-readonly-note-title"> 1108 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg> 1109 <?php esc_html_e('View only', 'mxchat'); ?> 1110 </span> 1111 <span class="mxch-readonly-note-text"><?php esc_html_e('You can read, search and export chats and leads. Deleting and settings are for administrators.', 'mxchat'); ?></span> 1112 </div> 1113 <?php 1114 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)