Files
crm.clientright.ru/layouts/v7/modules/Documents/FilePreview.tpl
Fedor 9245768987 🚀 CRM Files Migration & Real-time Features
 Features:
- Migrated ALL files to new S3 structure (Projects, Contacts, Accounts, HelpDesk, Invoice, etc.)
- Added Nextcloud folder buttons to ALL modules
- Fixed Nextcloud editor integration
- WebSocket server for real-time updates
- Redis Pub/Sub integration
- File path manager for organized storage
- Redis caching for performance (Functions.php)

📁 New Structure:
Documents/Project/ProjectName_ID/file_docID.ext
Documents/Contacts/FirstName_LastName_ID/file_docID.ext
Documents/Accounts/AccountName_ID/file_docID.ext

🔧 Technical:
- FilePathManager for standardized paths
- S3StorageService integration
- WebSocket server (Node.js + Docker)
- Redis cache for getBasicModuleInfo()
- Predis library for Redis connectivity

📝 Scripts:
- Migration scripts for all modules
- Test pages for WebSocket/SSE/Polling
- Documentation (MIGRATION_*.md, REDIS_*.md)

🎯 Result: 15,000+ files migrated successfully!
2025-10-24 19:59:28 +03:00

100 lines
6.7 KiB
Smarty
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************}
{strip}
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="filePreview container-fluid">
<div class="modal-header row">
<div class="filename {if $FILE_PREVIEW_NOT_SUPPORTED neq 'yes'} col-lg-7 {else} col-lg-7 {/if}">
<h3 style="margin-top:0px;"><b>{$FILE_NAME}</b></h3>
</div>
{if $FILE_PREVIEW_NOT_SUPPORTED neq 'yes'}
<div class="col-lg-4">
<a class="btn btn-default btn-small pull-right" href="{$DOWNLOAD_URL}">{vtranslate('LBL_DOWNLOAD_FILE',$MODULE_NAME)}</a>
</div>
{/if}
<div class="col-lg-1">
<button data-dismiss="modal" class="close pull-right" title="close">
<span aria-hidden="true" class='fa fa-close'></span></button>
{* Кнопка редактирования - показываем для ВСЕХ файлов *}
<div class="col-lg-2">
<button type="button" class="btn btn-success btn-small pull-right" onclick="console.log('🔍 DEBUG: RECORD_ID={$RECORD_ID}, FULL_FILE_NAME={$FULL_FILE_NAME|escape:'javascript'}, FILE_NAME={$FILE_NAME|escape:'javascript'}'); console.log('🔍 DEBUG: FULL_FILE_NAME length:', '{$FULL_FILE_NAME|escape:'javascript'}'.length); openNextcloudEditor('{$RECORD_ID}', '{$FULL_FILE_NAME|escape:'javascript'}')" style="margin-right: 5px;" title="Редактировать в Nextcloud">
<i class="fa fa-edit"></i> Редактировать
</button>
</div>
</div>
</div>
<div class="modal-body row" style="height:550px;">
{if $FILE_PREVIEW_NOT_SUPPORTED eq 'yes'}
<div class="well" style="height:100%;">
<center>
<b>{vtranslate('LBL_PREVIEW_NOT_AVAILABLE',$MODULE_NAME)}</b>
<br><br><br>
<a class="btn btn-default btn-large" href="{$DOWNLOAD_URL}">{vtranslate('LBL_DOWNLOAD_FILE',$MODULE_NAME)}</a>
<br><br><br><br>
<div class='span11 offset1 alert-info' style="padding:10px">
<span class='span offset1 alert-info'>
<i class="icon-info-sign"></i>
{vtranslate('LBL_PREVIEW_SUPPORTED_FILES',$MODULE_NAME)}
</span>
</div>
<br>
</center>
</div>
{else}
{if $BASIC_FILE_TYPE eq 'yes'}
<div style="overflow:auto;height:100%;">
<pre>
{htmlentities($FILE_CONTENTS)}
</pre>
</div>
{else if $OPENDOCUMENT_FILE_TYPE eq 'yes'}
<iframe id="viewer" src="libraries/jquery/Viewer.js/#../../../{$DOWNLOAD_URL}" width="100%" height="100%" allowfullscreen webkitallowfullscreen></iframe>
{else if $PDF_FILE_TYPE eq 'yes'}
{* SalesPlatform.ru begin *}
{* <iframe id='viewer' src="libraries/jquery/pdfjs/web/viewer.html?file={$SITE_URL}/{$FILE_PATH}" height="100%" width="100%"></iframe> *}
<iframe id='viewer' src="libraries/jquery/pdfjs/web/viewer.html?file={urlencode($SITE_URL)}/{urlencode($DOWNLOAD_URL)}" height="100%" width="100%"></iframe>
{* SalesPlatform.ru ned *}
{else if $IMAGE_FILE_TYPE eq 'yes'}
<div style="overflow:auto;height:100%;width:100%;float:left;background-image: url({$DOWNLOAD_URL});background-color: #EEEEEE;background-position: center 25%;background-repeat: no-repeat;display: block; background-size: contain;"></div>
{else if $AUDIO_FILE_TYPE eq 'yes'}
<div style="overflow:auto;height:100%;width:100%;float:left;background-color: #EEEEEE;background-position: center 25%;background-repeat: no-repeat;display: block;text-align: center;">
<div style="display: inline-block;margin-top : 10%;">
<audio controls>
<source src="{$SITE_URL}/{$DOWNLOAD_URL}" type="{$FILE_TYPE}">
</audio>
</div>
</div>
{else if $VIDEO_FILE_TYPE eq 'yes'}
<div style="overflow:auto;height:100%;">
<link href="libraries/jquery/video-js/video-js.css" rel="stylesheet">
<script src="libraries/jquery/video-js/video.js"></script>
<video class="video-js vjs-default-skin" controls preload="auto" {literal}data-setup="{'techOrder': ['flash', 'html5']}" {/literal}width="100%" height="100%">
<source src="{$SITE_URL}/{$DOWNLOAD_URL}" type='{$FILE_TYPE}' />
</video>
</div>
{/if}
{/if}
</div>
</div>
</div>
</div>
{/strip}
<script>
// Fallback функция если глобальная не загрузилась
if (typeof window.testEditButton !== 'function') {
window.testEditButton = function(recordId, fileName) {
console.log("🔥 ЛОКАЛЬНАЯ КНОПКА НАЖАТА!", recordId, fileName);
alert("🔥 ЛОКАЛЬНАЯ КНОПКА РАБОТАЕТ!\n\nRecord ID: " + recordId + "\nFile Name: " + fileName);
};
console.log("✅ Создана локальная версия testEditButton в FilePreview");
}
</script>