Files
crm.clientright.ru/simple_test.html

81 lines
3.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Простой тест Nextcloud</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
.btn { padding: 10px 20px; margin: 10px; background: #007bff; color: white; border: none; cursor: pointer; }
.btn:hover { background: #0056b3; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.modal-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 20px; border-radius: 5px; }
.close { float: right; cursor: pointer; }
</style>
</head>
<body>
<h2>Простой тест открытия документа 395695</h2>
<button class="btn" onclick="showOptions()">Показать варианты открытия</button>
<div id="modal" class="modal">
<div class="modal-content">
<span class="close" onclick="closeModal()">&times;</span>
<h3>Варианты открытия файла zayavlenie_proekt.docx</h3>
<div style="margin: 20px 0;">
<button class="btn" onclick="openOption('files')">📁 Files App (показать файл)</button>
<button class="btn" onclick="openOption('download')">⬇️ Скачать файл</button>
<button class="btn" onclick="openOption('view')">👁️ Просмотр (если поддерживается)</button>
</div>
<div style="margin: 20px 0;">
<h4>Прямые ссылки:</h4>
<p><a href="https://office.clientright.ru/apps/files/?dir=/crm/crm2/CRM_Active_Files/Documents/395695&openfile=zayavlenie_proekt.docx" target="_blank">Files App</a></p>
<p><a href="https://office.clientright.ru/remote.php/dav/files/admin/crm/crm2/CRM_Active_Files/Documents/395695/zayavlenie_proekt.docx" target="_blank">Прямое скачивание</a></p>
</div>
</div>
</div>
<script>
function showOptions() {
document.getElementById('modal').style.display = 'block';
}
function closeModal() {
document.getElementById('modal').style.display = 'none';
}
function openOption(type) {
const recordId = 395695;
const fileName = 'zayavlenie_proekt.docx';
const baseUrl = 'https://office.clientright.ru';
let url;
switch(type) {
case 'files':
url = `${baseUrl}/apps/files/?dir=/crm/crm2/CRM_Active_Files/Documents/${recordId}&openfile=${encodeURIComponent(fileName)}`;
break;
case 'download':
url = `${baseUrl}/remote.php/dav/files/admin/crm/crm2/CRM_Active_Files/Documents/${recordId}/${encodeURIComponent(fileName)}`;
break;
case 'view':
url = `${baseUrl}/apps/files/?dir=/crm/crm2/CRM_Active_Files/Documents/${recordId}&openfile=${encodeURIComponent(fileName)}&view=1`;
break;
}
window.open(url, 'nextcloud_editor', 'width=1200,height=800');
closeModal();
}
// Закрытие модального окна при клике вне его
window.onclick = function(event) {
const modal = document.getElementById('modal');
if (event.target == modal) {
closeModal();
}
}
</script>
</body>
</html>