added manager user type
This commit is contained in:
@@ -346,49 +346,27 @@ export class ViewManager {
|
||||
* @returns {string} HTML string for the action buttons
|
||||
*/
|
||||
renderFileActions(file, index) {
|
||||
console.log('[ViewManager] Rendering file actions:', { file, index });
|
||||
const actions = [];
|
||||
|
||||
if (file.type === 'folder') {
|
||||
|
||||
// Add details button
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Details" onclick="window.roomManager.modalManager.showDetailsModal('${file.name}', '${file.path || ''}')"
|
||||
style="background-color:var(--primary-opacity-8);color:var(--primary-color);">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</button>
|
||||
`);
|
||||
|
||||
// Add download button if user has permission
|
||||
if (this.roomManager.canDownload) {
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Open" onclick="window.roomManager.navigateToFolder('${file.name}')"
|
||||
<button class="btn btn-sm file-action-btn" title="Download" onclick="window.roomManager.fileManager.downloadFile('${file.name}', '${file.path || ''}')"
|
||||
style="background-color:var(--primary-opacity-8);color:var(--primary-color);">
|
||||
<i class="fas fa-folder-open"></i>
|
||||
<i class="fas fa-download"></i>
|
||||
</button>
|
||||
`);
|
||||
} else {
|
||||
// Check if file type is supported for preview
|
||||
const extension = file.name.split('.').pop().toLowerCase();
|
||||
const supportedTypes = [
|
||||
// Images
|
||||
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp', 'tiff',
|
||||
// Documents
|
||||
'pdf', 'txt', 'md', 'csv', 'py', 'js', 'html', 'css', 'json', 'xml', 'sql', 'sh', 'bat',
|
||||
'docx', 'doc', 'xlsx', 'xls', 'pptx', 'ppt', 'odt', 'odp', 'ods',
|
||||
// Media
|
||||
'mp4', 'webm', 'avi', 'mov', 'wmv', 'flv', 'mkv',
|
||||
'mp3', 'wav', 'ogg', 'm4a', 'flac'
|
||||
];
|
||||
|
||||
if (supportedTypes.includes(extension)) {
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Preview" onclick="window.roomManager.viewManager.previewFile(${index})"
|
||||
style="background-color:var(--primary-opacity-8);color:var(--primary-color);">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
`);
|
||||
}
|
||||
|
||||
if (this.roomManager.canDownload) {
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Download" onclick="window.roomManager.fileManager.downloadFile('${file.name}', '${file.path || ''}')"
|
||||
style="background-color:var(--primary-opacity-8);color:var(--primary-color);">
|
||||
<i class="fas fa-download"></i>
|
||||
</button>
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
// Add rename button if user has permission
|
||||
if (this.roomManager.canRename) {
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Rename" onclick="window.roomManager.modalManager.showRenameModal('${file.name}', '${file.path || ''}')"
|
||||
@@ -398,6 +376,7 @@ export class ViewManager {
|
||||
`);
|
||||
}
|
||||
|
||||
// Add move button if user has permission
|
||||
if (this.roomManager.canMove) {
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Move" onclick="window.roomManager.modalManager.showMoveModal('${file.name}', '${file.path || ''}')"
|
||||
@@ -416,6 +395,7 @@ export class ViewManager {
|
||||
</button>
|
||||
`);
|
||||
|
||||
// Add delete button if user has permission
|
||||
if (this.roomManager.canDelete) {
|
||||
actions.push(`
|
||||
<button class="btn btn-sm file-action-btn" title="Delete" onclick="window.roomManager.modalManager.showDeleteModal('${file.name}', '${file.path || ''}')"
|
||||
|
||||
Reference in New Issue
Block a user