Files
crm.clientright.ru/test/templates_c/v7/9767fe433bd5f8db9a3fb50e9c5cd526eb4b38d6.file.Header.tpl.php
Fedor 7e3f0dcede Исправление путей к папкам проектов в Nextcloud + создание файлов из CRM
🔧 Исправления:
- Исправлены пути к папкам проектов: теперь /Documents/Project/{Name}_{Id}
- Исправлена функция openProjectFolder() во всех JS файлах
- Добавлены кнопки создания Word/Excel/PowerPoint из CRM (10 модулей)
- Создание файлов напрямую в S3 с автоиндексацией через Redis
- Исправлена ошибка 'Class Redis not found' (использован Predis)

📁 Изменённые файлы:
- layouts/v7/lib/nextcloud-editor.js
- crm_extensions/nextcloud_editor/js/nextcloud-editor.js
- layouts/v7/lib/nextcloud-editor-v3.js
- crm_extensions/file_storage/api/create_nextcloud_file.php
- layouts/v7/modules/*/DetailViewHeaderTitle.tpl (10 модулей)
- layouts/v7/modules/Documents/*.tpl (кнопки редактирования)

🎯 Результат:
- Кнопка 'Папка в Nextcloud' открывает правильную папку
- Создание файлов работает молниеносно (прямо в S3)
- Redis события публикуются корректно
- OnlyOffice открывается для редактирования

Проект 391552 теперь открывается по правильному пути!
2025-11-01 12:22:12 +03:00

82 lines
14 KiB
PHP
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.

<?php /* Smarty version Smarty-3.1.7, created on 2025-11-01 12:18:42
compiled from "/var/www/fastuser/data/www/crm.clientright.ru/includes/runtime/../../layouts/v7/modules/Vtiger/Header.tpl" */ ?>
<?php /*%%SmartyHeaderCode:20869985226905d07245d1a8-40888058%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'file_dependency' =>
array (
'9767fe433bd5f8db9a3fb50e9c5cd526eb4b38d6' =>
array (
0 => '/var/www/fastuser/data/www/crm.clientright.ru/includes/runtime/../../layouts/v7/modules/Vtiger/Header.tpl',
1 => 1761324931,
2 => 'file',
),
),
'nocache_hash' => '20869985226905d07245d1a8-40888058',
'function' =>
array (
),
'variables' =>
array (
'PAGETITLE' => 0,
'QUALIFIED_MODULE' => 0,
'INVENTORY_MODULES' => 0,
'SELECTED_MENU_CATEGORY' => 0,
'V7_THEME_PATH' => 0,
'STYLES' => 0,
'cssModel' => 0,
'MODULE' => 0,
'VIEW' => 0,
'PARENT_MODULE' => 0,
'NOTIFIER_URL' => 0,
'EXTENSION_MODULE' => 0,
'EXTENSION_VIEW' => 0,
'CURRENT_USER_MODEL' => 0,
'USER_CURRENCY_SYMBOL' => 0,
'LANGUAGE' => 0,
'LOCALE' => 0,
),
'has_nocache_code' => false,
'version' => 'Smarty-3.1.7',
'unifunc' => 'content_6905d07247656',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6905d07247656')) {function content_6905d07247656($_smarty_tpl) {?>
<!DOCTYPE html><html><head><title><?php echo vtranslate($_smarty_tpl->tpl_vars['PAGETITLE']->value,$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</title><link rel="SHORTCUT ICON" href="layouts/v7/skins/images/favicon.ico"><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link type='text/css' rel='stylesheet' href='layouts/v7/lib/todc/css/bootstrap.min.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/todc/css/docs.min.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/todc/css/todc-bootstrap.min.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/font-awesome/css/font-awesome.min.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/jquery/select2/select2.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/select2-bootstrap/select2-bootstrap.css'><link type='text/css' rel='stylesheet' href='libraries/bootstrap/js/eternicode-bootstrap-datepicker/css/datepicker3.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/jquery/jquery-ui-1.11.3.custom/jquery-ui.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/vt-icons/style.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/animate/animate.min.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/jquery/malihu-custom-scrollbar/jquery.mCustomScrollbar.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/jquery/jquery.qtip.custom/jquery.qtip.css'><link type='text/css' rel='stylesheet' href='layouts/v7/lib/jquery/daterangepicker/daterangepicker.css'><link type='text/css' rel='stylesheet' href='libraries/jquery/pnotify/jquery.pnotify.default.css'><input type="hidden" id="inventoryModules" value=<?php echo ZEND_JSON::encode($_smarty_tpl->tpl_vars['INVENTORY_MODULES']->value);?>
><?php $_smarty_tpl->tpl_vars['V7_THEME_PATH'] = new Smarty_variable(Vtiger_Theme::getv7AppStylePath($_smarty_tpl->tpl_vars['SELECTED_MENU_CATEGORY']->value), null, 0);?><?php if (strpos($_smarty_tpl->tpl_vars['V7_THEME_PATH']->value,".less")!==false){?><link type="text/css" rel="stylesheet/less" href="<?php echo vresource_url($_smarty_tpl->tpl_vars['V7_THEME_PATH']->value);?>
" media="screen" /><?php }else{ ?><link type="text/css" rel="stylesheet" href="<?php echo vresource_url($_smarty_tpl->tpl_vars['V7_THEME_PATH']->value);?>
" media="screen" /><?php }?><?php $_smarty_tpl->tpl_vars['cssModel'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['cssModel']->_loop = false;
$_smarty_tpl->tpl_vars['index'] = new Smarty_Variable;
$_from = $_smarty_tpl->tpl_vars['STYLES']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['cssModel']->key => $_smarty_tpl->tpl_vars['cssModel']->value){
$_smarty_tpl->tpl_vars['cssModel']->_loop = true;
$_smarty_tpl->tpl_vars['index']->value = $_smarty_tpl->tpl_vars['cssModel']->key;
?><link type="text/css" rel="<?php echo $_smarty_tpl->tpl_vars['cssModel']->value->getRel();?>
" href="<?php echo vresource_url($_smarty_tpl->tpl_vars['cssModel']->value->getHref());?>
" media="<?php echo $_smarty_tpl->tpl_vars['cssModel']->value->getMedia();?>
" /><?php } ?><style type="text/css">@media print {.noprint { display:none; }}</style><script type="text/javascript">var __pageCreationTime = (new Date()).getTime();</script><script src="<?php echo vresource_url('layouts/v7/lib/jquery/jquery.min.js');?>
"></script><script src="<?php echo vresource_url('layouts/v7/lib/jquery/jquery-migrate-1.0.0.js');?>
"></script><!-- Подключаем функцию редактирования в Nextcloud --><script src="<?php echo vresource_url('layouts/v7/lib/nextcloud-editor.js');?>
"></script><script type="text/javascript">var _META = { 'module': "<?php echo $_smarty_tpl->tpl_vars['MODULE']->value;?>
", view: "<?php echo $_smarty_tpl->tpl_vars['VIEW']->value;?>
", 'parent': "<?php echo $_smarty_tpl->tpl_vars['PARENT_MODULE']->value;?>
", 'notifier':"<?php echo $_smarty_tpl->tpl_vars['NOTIFIER_URL']->value;?>
", 'app':"<?php echo $_smarty_tpl->tpl_vars['SELECTED_MENU_CATEGORY']->value;?>
" };<?php if ($_smarty_tpl->tpl_vars['EXTENSION_MODULE']->value){?>var _EXTENSIONMETA = { 'module': "<?php echo $_smarty_tpl->tpl_vars['EXTENSION_MODULE']->value;?>
", view: "<?php echo $_smarty_tpl->tpl_vars['EXTENSION_VIEW']->value;?>
"};<?php }?>var _USERMETA;<?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value){?>_USERMETA = { 'id' : "<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('id');?>
", 'menustatus' : "<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('leftpanelhide');?>
",'currency' : "<?php echo $_smarty_tpl->tpl_vars['USER_CURRENCY_SYMBOL']->value;?>
", 'currencySymbolPlacement' : "<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('currency_symbol_placement');?>
",'currencyGroupingPattern' : "<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('currency_grouping_pattern');?>
", 'truncateTrailingZeros' : "<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('truncate_trailing_zeros');?>
"};<?php }?></script><?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value){?><link rel="stylesheet" href="layouts/v7/resources/css/ai-drawer.css?v=2.1"><script src="layouts/v7/resources/js/ai-drawer-simple.js?v=6.1"></script><script src="ai_drawer_improvements.js"></script><script type="text/javascript">// Функция для удаления документа из детального просмотраwindow.deleteDocumentFromDetail = function(documentId) {if (typeof Documents_Index_Js !== 'undefined') {var documentsInstance = Documents_Index_Js.getInstance();documentsInstance.deleteDocumentFromDetail(documentId);} else {console.error('Documents_Index_Js not found');alert('Ошибка: модуль Documents не загружен');}};// Функция для удаления документа из виджетаwindow.deleteDocumentFromWidget = function(documentId, element) {console.log('deleteDocumentFromWidget called with ID:', documentId);// Подтверждение удаленияvar message = 'Вы уверены, что хотите удалить этот документ?';if(confirm(message)) {console.log('User confirmed document deletion from widget');var postData = {'module' : 'Documents','action' : 'DeleteAjax','record' : documentId}console.log('Sending delete request:', postData);// Используем jQuery AJAX вместо app.request.postjQuery.ajax({url: 'index.php',type: 'POST',data: postData,success: function(data) {console.log('Delete response:', data);console.log('Deletion successful, removing from widget');// Удаляем элемент из виджетаvar listItem = element.closest('li');listItem.fadeOut(300, function(){listItem.remove();});// Показываем уведомление об успехеalert('Документ успешно удален');},error: function(xhr, status, error) {console.log('Deletion failed:', error);alert('Ошибка при удалении документа');}});} else {console.log('User cancelled document deletion from widget');}};// Функция для отвязки документа из виджетаwindow.unlinkDocumentFromWidget = function(documentId, element) {console.log('unlinkDocumentFromWidget called with ID:', documentId);// Подтверждение отвязкиvar message = 'Вы уверены, что хотите отвязать этот документ от контакта?';if(confirm(message)) {console.log('User confirmed document unlinking from widget');// Получаем информацию о текущем контактеvar parentId = jQuery('#recordId').val();// Получаем модуль из URL или используем Contacts по умолчаниюvar parentModule = 'Contacts'; // По умолчанию для контактовvar currentUrl = window.location.href;if(currentUrl.indexOf('module=') > -1) {var moduleMatch = currentUrl.match(/module=([^&]+)/);if(moduleMatch) {parentModule = moduleMatch[1];}}if(parentId && parentModule) {var postData = {'module' : parentModule,'action' : 'UnlinkRelation','record' : parentId,'relatedModule' : 'Documents','relatedRecord' : documentId}console.log('Sending unlink request:', postData);// Используем jQuery AJAX вместо app.request.postjQuery.ajax({url: 'index.php',type: 'POST',data: postData,success: function(data) {console.log('Unlink response:', data);console.log('Unlinking successful, removing from widget');// Удаляем элемент из виджетаvar listItem = element.closest('li');listItem.fadeOut(300, function(){listItem.remove();});// Показываем уведомление об успехеalert('Документ успешно отвязан от контакта');},error: function(xhr, status, error) {console.log('Unlinking failed:', error);alert('Ошибка при отвязке документа');}});} else {console.error('Parent ID or module not found');alert('Ошибка: не удалось определить контакт');}} else {console.log('User cancelled document unlinking from widget');}};// Тестовая функция для отладки</script><script type="text/javascript">// Инициализация нового AI Drawer только для авторизованных пользователейdocument.addEventListener('DOMContentLoaded', function() {try {console.log('AI Drawer: Initializing new version');// Инициализируем новый AI Drawerif (typeof AIDrawer !== 'undefined') {window.aiDrawerInstance = new AIDrawer();console.log('AI Drawer: New version initialized successfully');// Отслеживаем смену URL для обновления историиlet currentURL = window.location.href;const urlObserver = setInterval(function() {if (window.location.href !== currentURL) {currentURL = window.location.href;console.log('AI Drawer: URL changed, refreshing history');if (window.aiDrawerInstance && typeof window.aiDrawerInstance.refreshPreloadedHistory === 'function') {// Обновляем историю с небольшой задержкой чтобы страница успела загрузитьсяsetTimeout(() => {window.aiDrawerInstance.refreshPreloadedHistory();}, 1000);}}}, 1000);// Также слушаем события навигацииwindow.addEventListener('popstate', function() {console.log('AI Drawer: Popstate event, refreshing history');if (window.aiDrawerInstance && typeof window.aiDrawerInstance.refreshPreloadedHistory === 'function') {setTimeout(() => {window.aiDrawerInstance.refreshPreloadedHistory();}, 1000);}});} else {console.error('AI Drawer: AIDrawer class not found');}} catch (error) {console.error('AI Drawer: Initialization error:', error);}});</script><?php }?><!-- Простая функция Nextcloud Editor --><!-- File Sync: Long Polling синхронизация файлов --></head><body data-skinpath="<?php echo Vtiger_Theme::getBaseThemePath();?>
" data-language="<?php echo $_smarty_tpl->tpl_vars['LANGUAGE']->value;?>
"<?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value){?> data-user-decimalseparator="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('currency_decimal_separator');?>
" data-user-dateformat="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('date_format');?>
"data-user-groupingseparator="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('currency_grouping_separator');?>
" data-user-numberofdecimals="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('no_of_currency_decimals');?>
" data-user-hourformat="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('hour_format');?>
"data-user-calendar-reminder-interval="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->getCurrentUserActivityReminderInSeconds();?>
"<?php }?>><?php if ($_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value){?><input type="hidden" id="start_day" value="<?php echo $_smarty_tpl->tpl_vars['CURRENT_USER_MODEL']->value->get('dayoftheweek');?>
" /><?php }?><input type="hidden" name="locale" value='<?php echo json_encode($_smarty_tpl->tpl_vars['LOCALE']->value);?>
'><div id="page"><div id="pjaxContainer" class="hide noprint"></div><div id="messageBar" class="hide"></div><?php }} ?>