186 lines
9.1 KiB
HTML
186 lines
9.1 KiB
HTML
|
|
<!DOCTYPE html>
|
|||
|
|
<html lang="ru">
|
|||
|
|
<head>
|
|||
|
|
<meta charset="UTF-8">
|
|||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|||
|
|
<title>🔍 Отладка кнопки Nextcloud</title>
|
|||
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
|||
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
|
|||
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
|||
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
|||
|
|
</head>
|
|||
|
|
<body>
|
|||
|
|
<div class="container" style="margin-top: 30px;">
|
|||
|
|
<h1><i class="fa fa-bug"></i> Отладка интеграции Nextcloud</h1>
|
|||
|
|
|
|||
|
|
<div class="alert alert-info">
|
|||
|
|
<strong>Цель:</strong> Проверить, работает ли кнопка "Редактировать" и JavaScript
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="panel panel-default">
|
|||
|
|
<div class="panel-heading">
|
|||
|
|
<h3 class="panel-title">Тестовые кнопки</h3>
|
|||
|
|
</div>
|
|||
|
|
<div class="panel-body">
|
|||
|
|
<p><strong>Тестовый файл:</strong> test-document.docx</p>
|
|||
|
|
<p><strong>Record ID:</strong> 392936</p>
|
|||
|
|
|
|||
|
|
<div class="btn-group-vertical" style="width: 100%; margin-bottom: 20px;">
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="testFunction1()">
|
|||
|
|
<i class="fa fa-test"></i> Тест 1: Простая функция
|
|||
|
|
</button>
|
|||
|
|
|
|||
|
|
<button type="button" class="btn btn-success" onclick="testFunction2()">
|
|||
|
|
<i class="fa fa-cog"></i> Тест 2: API вызов
|
|||
|
|
</button>
|
|||
|
|
|
|||
|
|
<button type="button" class="btn btn-warning" onclick="openNextcloudEditor('392936', 'test-document.docx')">
|
|||
|
|
<i class="fa fa-edit"></i> Тест 3: Оригинальная функция
|
|||
|
|
</button>
|
|||
|
|
|
|||
|
|
<button type="button" class="btn btn-info" onclick="testDirectAPI()">
|
|||
|
|
<i class="fa fa-rocket"></i> Тест 4: Прямой API вызов
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<h4>Лог событий:</h4>
|
|||
|
|
<div id="debugLog" style="background: #f5f5f5; padding: 15px; border: 1px solid #ddd; min-height: 200px; font-family: monospace; font-size: 12px; overflow-y: auto;">
|
|||
|
|
<div class="text-muted">Лог будет появляться здесь...</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div style="margin-top: 15px;">
|
|||
|
|
<button class="btn btn-default" onclick="clearLog()">Очистить лог</button>
|
|||
|
|
<button class="btn btn-default" onclick="showConsoleErrors()">Показать ошибки консоли</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- Подключаем наш JavaScript -->
|
|||
|
|
<script src="crm_extensions/nextcloud_editor/js/nextcloud-editor.js"></script>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
// Функции отладки
|
|||
|
|
function log(message) {
|
|||
|
|
var timestamp = new Date().toLocaleTimeString();
|
|||
|
|
var logDiv = document.getElementById('debugLog');
|
|||
|
|
logDiv.innerHTML += '<div style="margin: 2px 0; padding: 2px; border-left: 3px solid #007bff;">[' + timestamp + '] ' + message + '</div>';
|
|||
|
|
logDiv.scrollTop = logDiv.scrollHeight;
|
|||
|
|
console.log('[DEBUG] ' + message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function clearLog() {
|
|||
|
|
document.getElementById('debugLog').innerHTML = '<div class="text-muted">Лог очищен...</div>';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function showConsoleErrors() {
|
|||
|
|
log('=== СОСТОЯНИЕ КОНСОЛИ ===');
|
|||
|
|
log('jQuery доступен: ' + (typeof $ !== 'undefined'));
|
|||
|
|
log('Bootstrap доступен: ' + (typeof $.fn.modal !== 'undefined'));
|
|||
|
|
log('openNextcloudEditor доступен: ' + (typeof openNextcloudEditor !== 'undefined'));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function testFunction1() {
|
|||
|
|
log('✅ Тест 1: Простая функция работает!');
|
|||
|
|
alert('Тест 1 прошёл успешно!');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function testFunction2() {
|
|||
|
|
log('🔄 Тест 2: Начинаем API вызов...');
|
|||
|
|
|
|||
|
|
// Мокаем app объект если его нет
|
|||
|
|
if (typeof app === 'undefined') {
|
|||
|
|
window.app = {
|
|||
|
|
helper: {
|
|||
|
|
showProgress: function(msg) {
|
|||
|
|
log('📋 Progress: ' + msg);
|
|||
|
|
return { hide: function() { log('✅ Progress hidden'); } };
|
|||
|
|
},
|
|||
|
|
hideProgress: function() { log('✅ Progress hidden (global)'); },
|
|||
|
|
showSuccessNotification: function(opts) {
|
|||
|
|
log('✅ Success: ' + opts.message);
|
|||
|
|
alert('✅ ' + opts.message);
|
|||
|
|
},
|
|||
|
|
showErrorNotification: function(opts) {
|
|||
|
|
log('❌ Error: ' + opts.message);
|
|||
|
|
alert('❌ ' + opts.message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
log('📦 Создан мок app объект');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var apiUrl = 'crm_extensions/file_storage/api/test_upload.php?record=392936&filename=test-document.docx';
|
|||
|
|
log('🌐 API URL: ' + apiUrl);
|
|||
|
|
|
|||
|
|
$.get(apiUrl)
|
|||
|
|
.done(function(response) {
|
|||
|
|
log('✅ API ответ получен: ' + JSON.stringify(response).substring(0, 100) + '...');
|
|||
|
|
if (response.success) {
|
|||
|
|
log('🎉 API вернул success=true');
|
|||
|
|
log('📝 Файл: ' + response.file_name);
|
|||
|
|
log('🔗 Edit URL: ' + response.edit_url);
|
|||
|
|
} else {
|
|||
|
|
log('❌ API вернул success=false: ' + response.error);
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
.fail(function(xhr, status, error) {
|
|||
|
|
log('💥 API ошибка: ' + status + ' - ' + error);
|
|||
|
|
log('📄 Response: ' + xhr.responseText.substring(0, 200));
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function testDirectAPI() {
|
|||
|
|
log('🚀 Тест 4: Прямой тест модального окна');
|
|||
|
|
|
|||
|
|
// Создаём тестовое модальное окно
|
|||
|
|
var testModal = `
|
|||
|
|
<div class="modal fade" id="testModal" tabindex="-1" role="dialog">
|
|||
|
|
<div class="modal-dialog" role="document">
|
|||
|
|
<div class="modal-content">
|
|||
|
|
<div class="modal-header">
|
|||
|
|
<h4 class="modal-title">🧪 Тестовое модальное окно</h4>
|
|||
|
|
<button type="button" class="close" data-dismiss="modal">
|
|||
|
|
<span>×</span>
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<p>Это тестовое модальное окно для проверки Bootstrap.</p>
|
|||
|
|
<p>Если вы видите это окно, значит Bootstrap работает правильно!</p>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
`;
|
|||
|
|
|
|||
|
|
$('body').append(testModal);
|
|||
|
|
$('#testModal').modal('show');
|
|||
|
|
log('📱 Тестовое модальное окно показано');
|
|||
|
|
|
|||
|
|
// Удаляем через 5 секунд
|
|||
|
|
setTimeout(function() {
|
|||
|
|
$('#testModal').remove();
|
|||
|
|
log('🗑️ Тестовое модальное окно удалено');
|
|||
|
|
}, 5000);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Перехватываем ошибки JavaScript
|
|||
|
|
window.onerror = function(msg, url, line, col, error) {
|
|||
|
|
log('💥 JavaScript Error: ' + msg + ' at ' + url + ':' + line);
|
|||
|
|
return false;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Логируем загрузку
|
|||
|
|
$(document).ready(function() {
|
|||
|
|
log('🎯 Страница отладки загружена');
|
|||
|
|
log('📦 jQuery версия: ' + $.fn.jquery);
|
|||
|
|
showConsoleErrors();
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
</body>
|
|||
|
|
</html>
|
|||
|
|
|