Обновленные файлы: - crm_extensions/nextcloud_api.php (2 места) - modules/Documents/actions/NcPrepareEdit.php - crm_extensions/nextcloud_editor/js/nextcloud-editor.js - crm_extensions/file_storage/api/get_edit_urls.php - crm_extensions/file_storage/api/simple_edit.php - crm_extensions/README.md - NEXTCLOUD_EDIT_BUTTON_IMPLEMENTATION.md - crm_extensions/docs/NEXTCLOUD_EDITOR.md - test_syntax_check.html - crm_extensions/tests/test_edit_button.html Все ссылки теперь указывают на новый сервер office.clientright.ru Backup файлы и тестовые директории не изменены
135 lines
6.0 KiB
HTML
135 lines
6.0 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>🧪 Тест кнопки редактирования</title>
|
||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
||
<style>
|
||
body { padding: 20px; background: #f5f5f5; }
|
||
.test-panel { background: white; padding: 20px; border-radius: 10px; margin-bottom: 20px; }
|
||
.mock-preview { border: 2px dashed #ccc; padding: 20px; text-align: center; background: #f9f9f9; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="test-panel">
|
||
<h1>🧪 Тест кнопки редактирования документов</h1>
|
||
<p>Проверяем отображение и работу кнопки "Редактировать"</p>
|
||
|
||
<div class="mock-preview">
|
||
<h3><b>test_document.docx</b></h3>
|
||
<div style="margin: 20px 0;">
|
||
<!-- Имитируем структуру FilePreview -->
|
||
<a class="btn btn-default btn-small pull-right" href="#" style="margin-left: 5px;">
|
||
Скачать файл
|
||
</a>
|
||
|
||
<!-- Наша кнопка редактирования -->
|
||
<button class="btn btn-primary btn-small pull-right"
|
||
onclick="openNextcloudEditor('12345', 'test_document.docx')"
|
||
style="margin-right: 5px;"
|
||
title="Редактировать в Nextcloud">
|
||
<i class="fa fa-edit"></i> Редактировать
|
||
</button>
|
||
|
||
<div style="clear: both;"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="alert alert-info" style="margin-top: 20px;">
|
||
<strong>Инструкция:</strong>
|
||
<ol>
|
||
<li>Нажмите кнопку "Редактировать" выше</li>
|
||
<li>Должно появиться модальное окно или сообщение</li>
|
||
<li>Проверьте консоль браузера на ошибки</li>
|
||
</ol>
|
||
</div>
|
||
|
||
<div id="log-output" style="background: #000; color: #0f0; padding: 15px; border-radius: 5px; font-family: monospace; margin-top: 20px; min-height: 200px;"></div>
|
||
</div>
|
||
|
||
<!-- Подключаем наш JavaScript -->
|
||
<script src="/crm_extensions/nextcloud_editor/js/nextcloud-editor.js"></script>
|
||
|
||
<!-- Имитируем vTiger app объект -->
|
||
<script>
|
||
// Создаём заглушку для app объекта vTiger
|
||
window.app = {
|
||
helper: {
|
||
showProgress: function(message) {
|
||
addLog('PROGRESS: ' + (message || 'Loading...'));
|
||
return {
|
||
hide: function() {
|
||
addLog('PROGRESS: Hidden');
|
||
}
|
||
};
|
||
},
|
||
showSuccessNotification: function(options) {
|
||
addLog('SUCCESS: ' + options.message);
|
||
alert('✅ ' + options.message);
|
||
},
|
||
showErrorNotification: function(options) {
|
||
addLog('ERROR: ' + options.message);
|
||
alert('❌ ' + options.message);
|
||
}
|
||
},
|
||
request: {
|
||
post: function(options) {
|
||
addLog('POST REQUEST: ' + options.url);
|
||
addLog('POST DATA: ' + JSON.stringify(options.data));
|
||
|
||
// Имитируем успешный ответ
|
||
return {
|
||
then: function(successCallback) {
|
||
setTimeout(function() {
|
||
successCallback({
|
||
success: true,
|
||
result: {
|
||
success: true,
|
||
edit_url: 'https://office.clientright.ru/s/test123/edit',
|
||
share_url: 'https://office.clientright.ru/s/test123'
|
||
}
|
||
});
|
||
}, 1000);
|
||
|
||
return {
|
||
fail: function(errorCallback) {
|
||
// Обработчик ошибок
|
||
}
|
||
};
|
||
}
|
||
};
|
||
}
|
||
}
|
||
};
|
||
|
||
// Логирование
|
||
const logOutput = document.getElementById('log-output');
|
||
|
||
function addLog(message) {
|
||
const timestamp = new Date().toLocaleTimeString();
|
||
logOutput.textContent += `[${timestamp}] ${message}\n`;
|
||
logOutput.scrollTop = logOutput.scrollHeight;
|
||
}
|
||
|
||
// Перехватываем console.log
|
||
const originalLog = console.log;
|
||
console.log = function(...args) {
|
||
originalLog.apply(console, args);
|
||
addLog('CONSOLE: ' + args.join(' '));
|
||
};
|
||
|
||
// Инициализация
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
addLog('=== ТЕСТ КНОПКИ РЕДАКТИРОВАНИЯ ===');
|
||
addLog('Страница загружена');
|
||
addLog('JavaScript файл подключен');
|
||
addLog('Готов к тестированию кнопки');
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|