예제 #1
0
 protected function isActualApiDiskVersion()
 {
     $apiDiskVersion = Desktop::getApiDiskVersion();
     if ($apiDiskVersion === 0) {
         //this is browser.
         return true;
     }
     return $apiDiskVersion >= self::MIN_API_DISK_VERSION;
 }
예제 #2
0
 protected function checkPermissions()
 {
     $securityContext = $this->file->getStorage()->getCurrentUserSecurityContext();
     if (!$this->file->canRead($securityContext)) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOWNLOAD_CONTROLLER_ERROR_BAD_RIGHTS'), self::ERROR_BAD_RIGHTS)));
         if (Desktop::getDiskVersion()) {
             $this->sendJsonErrorResponse();
         }
         //general for user we show simple message
         $this->sendResponse(Loc::getMessage('DISK_DOWNLOAD_CONTROLLER_ERROR_BAD_RIGHTS'));
     }
 }
예제 #3
0
 protected function processActionDefault()
 {
     if ($this->request->getPost('installDisk')) {
         \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
         $this->sendJsonSuccessResponse();
     }
     if ($this->request->getPost('uninstallDisk')) {
         \Bitrix\Disk\Desktop::setDesktopDiskUninstalled();
         $this->sendJsonSuccessResponse();
     }
     if ($this->request->getPost('reInstallDisk')) {
         \CUserOptions::setOption('disk', 'DesktopDiskReInstall', true, false, $this->getUser()->getId());
         \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
         $this->sendJsonSuccessResponse();
     }
 }
예제 #4
0
 protected function processActionDefault()
 {
     $pathToAjax = isset($this->arParams['AJAX_PATH']) ? $this->arParams['AJAX_PATH'] : '/bitrix/components/bitrix/disk.bitrix24disk/ajax.php';
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $quota = CDiskQuota::getDiskQuota();
     $this->arResult['showDiskQuota'] = false;
     //$quota !== true; //now without quota
     $this->arResult['diskSpace'] = (double) COption::getOptionInt('main', 'disk_space') * 1024 * 1024;
     $this->arResult['quota'] = $quota;
     $this->arResult['ajaxIndex'] = $pathToAjax;
     $this->arResult['ajaxStorageIndex'] = '/desktop_app/storage.php';
     $this->arResult['isInstalledDisk'] = \Bitrix\Disk\Desktop::isDesktopDiskInstall();
     $this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/disk/path/';
     $this->arResult['isInstalledPull'] = (bool) isModuleInstalled('pull');
     $this->arResult['currentUser'] = array('id' => $this->getUser()->getId(), 'formattedName' => $this->getUser()->getFormattedName());
     Asset::getInstance()->addJs('/bitrix/components/bitrix/disk.bitrix24disk/disk.js');
     $this->includeComponentTemplate();
 }
예제 #5
0
',
	DISK_FILE_VIEW_COPY_INTERNAL_LINK: '<?php 
echo GetMessageJS("DISK_FILE_VIEW_COPY_INTERNAL_LINK");
?>
',
	DISK_FILE_VIEW_EXT_LINK_ON: '<?php 
echo GetMessageJS("DISK_FILE_VIEW_EXT_LINK_ON");
?>
',
	DISK_FILE_VIEW_EXT_LINK_OFF: '<?php 
echo GetMessageJS("DISK_FILE_VIEW_EXT_LINK_OFF");
?>
',



	disk_revision_api: '<?php 
echo (int) \Bitrix\Disk\Configuration::getRevisionApi();
?>
',
	disk_document_service: '<?php 
echo (string) \Bitrix\Disk\UserConfiguration::getDocumentServiceCode();
?>
',
	wd_desktop_disk_is_installed: '<?php 
echo (bool) \Bitrix\Disk\Desktop::isDesktopDiskInstall();
?>
'
});
</script>
예제 #6
0
							</div>
						</div>
					</div>
				</div>

				<div id="disk_info_panel"></div>
				<div class="bx-disk-sidebar-section">
					<?php 
$APPLICATION->IncludeComponent('bitrix:disk.breadcrumbs.tree', '', array_merge($arResult, array('STORAGE' => $arResult['VARIABLES']['STORAGE'], 'PATH_TO_FOLDER_LIST' => CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_DISK'], array('user_id' => $arResult['VARIABLES']['user_id'])), 'PATH_TO_FOLDER_VIEW' => CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_DISK_FILE'], array('user_id' => $arResult['VARIABLES']['user_id'])), 'PATH_TO_FILE_VIEW' => CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_DISK_FILE'], array('user_id' => $arResult['VARIABLES']['user_id'])), 'FOLDER' => $folder, 'RELATIVE_PATH' => $arResult['VARIABLES']['RELATIVE_PATH'], 'RELATIVE_ITEMS' => $arResult['VARIABLES']['RELATIVE_ITEMS'])), $component);
?>


				</div>

				<?php 
if (!Desktop::isDesktopDiskInstall() && Banner::isActive('install_disk')) {
    ?>
					<div class="bx-disk-sidebar-section">
						<a href="javascript: BX.Disk.deactiveBanner('install_disk'); BX.Disk.getDownloadDesktop();"><img src="/bitrix/images/disk/<?php 
    echo $bannerName;
    ?>
" alt=""></a>
					</div>
				<?php 
}
if ($folder->canAdd($arResult['VARIABLES']['STORAGE']->getCurrentUserSecurityContext())) {
    ?>
				<div class="bx-disk-sidebar-section">
					<div class="wduf-uploader">
						<span class="bx-disk wd-fa-add-file-light">
							<span class="wd-fa-add-file-light-text">
예제 #7
0
    private function getGridData($gridId, $showDeleted = false)
    {
        $grid = array('ID' => $gridId);
        $gridOptions = new CGridOptions($grid['ID']);
        $gridSort = $gridOptions->getSorting(array('sort' => array('NAME' => 'ASC'), 'vars' => array('by' => 'by', 'order' => 'order')));
        $filter = array();
        $grid['SORT'] = $gridSort['sort'];
        $grid['SORT_VARS'] = $gridSort['vars'];
        $grid['MODE'] = $this->getViewMode();
        $possibleColumnForSorting = array('UPDATE_TIME' => array('ALIAS' => 'UPDATE_TIME', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_UPDATE_TIME')), 'NAME' => array('ALIAS' => 'NAME', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_NAME')), 'FORMATTED_SIZE' => array('ALIAS' => 'SIZE', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_FORMATTED_SIZE')));
        $byColumn = key($grid['SORT']);
        if (!isset($possibleColumnForSorting[$byColumn]) || strtolower($grid['SORT'][$byColumn]) !== 'desc' && strtolower($grid['SORT'][$byColumn]) !== 'asc') {
            $grid['SORT'] = array();
        }
        $order = $grid['SORT'];
        $byColumn = key($order);
        $sortingColumns = array('TYPE' => array(SORT_NUMERIC, SORT_ASC), $possibleColumnForSorting[$byColumn]['ALIAS'] => strtolower($order[$byColumn]) === 'asc' ? SORT_ASC : SORT_DESC);
        if ($byColumn !== 'NAME') {
            $sortingColumns[$possibleColumnForSorting['NAME']['ALIAS']] = SORT_ASC;
        }
        $securityContext = $this->storage->getCurrentUserSecurityContext();
        $proxyType = $this->storage->getProxyType();
        $isStorageCurrentUser = $proxyType instanceof ProxyType\User && $proxyType->getTitleForCurrentUser() != $proxyType->getTitle();
        $parameters = array('with' => array('CREATE_USER'), 'filter' => array('PARENT_ID' => $this->folder->getRealObjectId(), 'DELETED_TYPE' => ObjectTable::DELETED_TYPE_NONE));
        $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('ID', 'CREATED_BY'));
        $needPagination = $this->needPagination();
        $pageNumber = (int) $this->request->getQuery('pageNumber');
        if ($pageNumber <= 0) {
            $pageNumber = 1;
        }
        if ($needPagination) {
            $parameters['order'] = array();
            foreach ($sortingColumns as $columnName => $columnData) {
                if (is_array($columnData)) {
                    $parameters['order'][$columnName] = in_array(SORT_DESC, $columnData, true) ? 'DESC' : 'ASC';
                } else {
                    $parameters['order'][$columnName] = SORT_DESC === $columnData ? 'DESC' : 'ASC';
                }
            }
            unset($columnName, $columnData);
            $parameters['limit'] = self::COUNT_ON_PAGE + 1;
            // +1 because we want to know about existence next page
            $parameters['offset'] = self::COUNT_ON_PAGE * ($pageNumber - 1);
        }
        $this->folder->preloadOperationsForChildren($securityContext);
        $sharedObjectIds = $this->getUserShareObjectIds();
        $isDesktopDiskInstall = \Bitrix\Disk\Desktop::isDesktopDiskInstall();
        $nowTime = time() + CTimeZone::getOffset();
        $fullFormatWithoutSec = preg_replace('/:s$/', '', CAllDatabase::dateFormatToPHP(CSite::GetDateFormat("FULL")));
        $urlManager = Driver::getInstance()->getUrlManager();
        $rows = array();
        $storageTitle = $proxyType->getTitle();
        $isEnabledShowExtendedRights = $this->storage->isEnabledShowExtendedRights();
        $result = $this->folder->getList($parameters);
        $countObjectsOnPage = 0;
        $needShowNextPagePagination = false;
        while ($row = $result->fetch()) {
            $countObjectsOnPage++;
            if ($needPagination && $countObjectsOnPage > self::COUNT_ON_PAGE) {
                $needShowNextPagePagination = true;
                break;
            }
            $object = BaseObject::buildFromArray($row);
            /** @var File|Folder $object */
            $name = $object->getName();
            $objectId = $object->getId();
            $exportData = array('TYPE' => $object->getType(), 'NAME' => $name, 'ID' => $objectId);
            $relativePath = trim($this->arParams['RELATIVE_PATH'], '/');
            $detailPageFile = CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FILE_VIEW'], array('FILE_ID' => $objectId, 'FILE_PATH' => ltrim($relativePath . '/' . $name, '/')));
            $listingPage = rtrim(CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FOLDER_LIST'], array('PATH' => $relativePath)), '/');
            $isFolder = $object instanceof Folder;
            $actions = $tileActions = $columns = array();
            if ($object->canRead($securityContext)) {
                $exportData['OPEN_URL'] = $urlManager->encodeUrn($isFolder ? $listingPage . '/' . $name . '/' : $detailPageFile);
                $actions[] = array("PSEUDO_NAME" => "open", "DEFAULT" => true, "ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_OPEN'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "')");
                if (!$object->canChangeRights($securityContext) && !$object->canShare($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk.showSharingDetailWithoutEdit({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->canChangeRights($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showSharingDetailWithChangeRights({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->canShare($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showSharingDetailWithSharing({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                }
                if ($isEnabledShowExtendedRights && !$object->isLink() && $object->canChangeRights($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "rights", "ICONCLASS" => "rights", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RIGHTS_SETTINGS'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showRightsOnObjectDetail({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                }
                if (!$isFolder) {
                    $actions[] = array("PSEUDO_NAME" => "download", "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($object) . "')");
                }
                $actions[] = array("PSEUDO_NAME" => "copy", "ICONCLASS" => "copy", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openCopyModalWindow({\n\t\t\t\t\t\tid: {$this->storage->getRootObjectId()},\n\t\t\t\t\t\tname: '" . CUtil::JSEscape($storageTitle) . "'\n\t\t\t\t\t}, {\n\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "'\n\t\t\t\t\t});");
                if ($object->canDelete($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "move", "ICONCLASS" => "move", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MOVE'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openMoveModalWindow({\n\t\t\t\t\t\t\tid: {$this->storage->getRootObjectId()},\n\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($storageTitle) . "'\n\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "'\n\t\t\t\t\t\t});");
                }
                if (!$isStorageCurrentUser && (!isset($sharedObjectIds[$object->getRealObjectId()]) || $sharedObjectIds[$object->getRealObjectId()]['TO_ENTITY'] != Sharing::CODE_USER . $this->getUser()->getId())) {
                    $actions[] = array("PSEUDO_NAME" => "connect", "ICONCLASS" => "connect", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_CONNECT'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].connectObjectToDisk({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "',\n\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});");
                }
                if (!$isFolder) {
                    $actions[] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_GET_EXT_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getExternalLink({$objectId});");
                    $downloadLink = $urlManager->getUrlForShowFile($object, array(), true);
                    $actions[] = array("ICONCLASS" => "show", 'PSEUDO_NAME' => 'internal_link', 'PSEUDO_VALUE' => $downloadLink, "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY_INTERNAL_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getInternalLink('{$downloadLink}');");
                    $actions[] = array("ICONCLASS" => "history", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_HISTORY'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "#tab-history')");
                }
            }
            if ($object->canRename($securityContext)) {
                $actions[] = array("TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RENAME'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].renameInline({$objectId})");
            }
            if ((!empty($sharedObjectIds[$objectId]) || $object->isLink()) && $object->canRead($securityContext)) {
                $tileActions['SHARE_INFO'] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETAIL_SHARE_INFO'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showShareInfoSmallView({\n\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t }\n\t\t\t\t\t})");
            }
            $columnsBizProc = array('BIZPROC' => '');
            $bizprocIcon = array('BIZPROC' => '');
            if ($this->arParams['STATUS_BIZPROC'] && !$isFolder) {
                list($actions, $columnsBizProc, $bizprocIcon) = $this->getBizProcData($object, $securityContext, $actions, $columnsBizProc, $bizprocIcon, $exportData);
            }
            if ($object->canDelete($securityContext)) {
                if ($object->isLink()) {
                    $actions[] = array("PSEUDO_NAME" => "detach", "ICONCLASS" => "detach", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETACH_BUTTON'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDetach({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->getCode() !== Folder::CODE_FOR_UPLOADED_FILES) {
                    $actions[] = array("PSEUDO_NAME" => "delete", "ICONCLASS" => "delete", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MARK_DELETED'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDelete({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t },\n\t\t\t\t\t\t\t\tcanDelete: {$object->canDelete($securityContext)}\n\t\t\t\t\t\t\t})");
                }
            }
            $iconClass = Ui\Icon::getIconClassByObject($object, !empty($sharedObjectIds[$objectId]));
            $dataAttributesForViewer = '';
            if ($isFolder) {
                $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object);
                if ($grid['MODE'] === 'tile') {
                    $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer;
                    $dataAttributesForViewer = '';
                }
                $nameSpecialChars = htmlspecialcharsbx($name);
                $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t";
            } else {
                $externalId = '';
                if ($isDesktopDiskInstall && $isStorageCurrentUser) {
                    $externalId = "st{$this->storage->getId()}|{$this->storage->getRootObjectId()}|f{$objectId}";
                }
                $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object, array('canUpdate' => $object->canUpdate($securityContext), 'relativePath' => $relativePath . '/' . $name, 'externalId' => $externalId));
                if ($grid['MODE'] === 'tile') {
                    $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer;
                    $dataAttributesForViewer = '';
                }
                $nameSpecialChars = htmlspecialcharsbx($name);
                $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t\t<td>{$bizprocIcon['BIZPROC']}</td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t";
            }
            $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $object->getCreatedBy()));
            $timestampCreate = $object->getCreateTime()->toUserTime()->getTimestamp();
            $timestampUpdate = $object->getUpdateTime()->toUserTime()->getTimestamp();
            $columns = array('CREATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampCreate, $nowTime) : formatDate('x', $timestampCreate, $nowTime), 'UPDATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampUpdate, $nowTime) : formatDate('x', $timestampUpdate, $nowTime), 'NAME' => $columnName, 'FORMATTED_SIZE' => $isFolder ? '' : CFile::formatSize($object->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($object->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t");
            if ($this->arParams['STATUS_BIZPROC']) {
                $columns['BIZPROC'] = $columnsBizProc["BIZPROC"];
            }
            $exportData['ICON_CLASS'] = $iconClass;
            if ($grid['MODE'] === 'tile') {
                $exportData['IS_IMAGE'] = $isFolder ? false : \Bitrix\Disk\TypeFile::isImage($object);
                if ($exportData['IS_IMAGE']) {
                    $exportData['SRC_IMAGE'] = $urlManager->getUrlForShowFile($object, array('exact' => 'Y', 'width' => 64, 'height' => 64));
                }
                $exportData['UPDATE_TIME'] = $columns['UPDATE_TIME'];
            }
            $exportData['IS_SHARED'] = !empty($sharedObjectIds[$objectId]);
            $exportData['IS_LINK'] = $object->isLink();
            $tildaExportData = array();
            foreach ($exportData as $exportName => $exportValue) {
                $tildaExportData['~' . $exportName] = $exportValue;
            }
            unset($exportRow);
            $rows[] = array('data' => array_merge($exportData, $tildaExportData), 'columns' => $columns, 'actions' => $actions, 'tileActions' => $tileActions, 'TYPE' => $exportData['TYPE'], 'NAME' => $exportData['NAME'], 'UPDATE_TIME' => $object->getUpdateTime()->getTimestamp(), 'SIZE' => $isFolder ? 0 : $object->getSize());
        }
        unset($object);
        if (!$needPagination) {
            Collection::sortByColumn($rows, $sortingColumns);
        }
        $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'sort' => isset($possibleColumnForSorting['ID']) ? 'ID' : false, 'default' => false), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_NAME'), 'sort' => isset($possibleColumnForSorting['NAME']) ? 'NAME' : false, 'default' => true, 'editable' => array('size' => 45)), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_TIME'), 'sort' => isset($possibleColumnForSorting['CREATE_TIME']) ? 'CREATE_TIME' : false, 'default' => false), array('id' => 'UPDATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_UPDATE_TIME'), 'sort' => isset($possibleColumnForSorting['UPDATE_TIME']) ? 'UPDATE_TIME' : false, 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_USER'), 'sort' => isset($possibleColumnForSorting['CREATE_USER']) ? 'CREATE_USER' : false, 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_FORMATTED_SIZE'), 'sort' => isset($possibleColumnForSorting['FORMATTED_SIZE']) ? 'FORMATTED_SIZE' : false, 'default' => true));
        if ($this->arParams['STATUS_BIZPROC']) {
            $grid['HEADERS'][] = array('id' => 'BIZPROC', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_BIZPROC'), 'default' => false);
        }
        $grid['DATA_FOR_PAGINATION'] = array('ENABLED' => $needPagination);
        if ($needPagination) {
            $grid['DATA_FOR_PAGINATION']['SHOW_NEXT_PAGE'] = $needShowNextPagePagination;
            $grid['DATA_FOR_PAGINATION']['CURRENT_PAGE'] = $pageNumber;
        }
        $grid['COLUMN_FOR_SORTING'] = $possibleColumnForSorting;
        $grid['ROWS'] = $rows;
        $grid['ROWS_COUNT'] = count($rows);
        $grid['FOOTER'] = array();
        if (isModuleInstalled('bitrix24')) {
            list($freeSpace, $diskSize) = $this->getDiskSpace();
            $freeSpace = CFile::formatSize($freeSpace);
            $diskSize = CFile::formatSize($diskSize);
            $grid['FOOTER'] = array(array('custom_html' => '
						<td class="tar" style="width: 100%;">' . Loc::getMessage('DISK_FOLDER_LIST_B24_LABEL_DISK_SPACE', array('#FREE_SPACE#' => '<span>' . $freeSpace, '#DISK_SIZE#' => $diskSize . '</span>')) . '</span></td>
					'), array('custom_html' => '
						<td class="tar"><a class="bx-disk-mp-link-addhdd" href="' . Loc::getMessage('DISK_FOLDER_LIST_B24_URL_DISK_SPACE') . '" target="_blank">+ <span>' . Loc::getMessage('DISK_FOLDER_LIST_B24_APPEND_DISK_SPACE') . '</span></a></td>
					'));
        }
        return $grid;
    }
예제 #8
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if (!CModule::IncludeModule('webdav')) {
    return;
}
global $USER, $APPLICATION;
if (!$USER->IsAuthorized() || !check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] != 'POST') {
    return;
}
CUtil::JSPostUnescape();
if ($_POST['installDisk']) {
    CWebDavTools::setDesktopDiskInstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
if ($_POST['uninstallDisk']) {
    CWebDavTools::setDesktopDiskUninstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \Bitrix\Disk\Desktop::setDesktopDiskUninstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
if ($_POST['reInstallDisk']) {
    CWebDavTools::setDesktopDiskUninstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \CUserOptions::setOption('disk', 'DesktopDiskReInstall', true, false, $USER->getId());
        \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
예제 #9
0
파일: user_disk.php 프로젝트: vim84/b-markt
							</div>
						</div>
					</div>
				</div>

				<div id="disk_info_panel"></div>
				<div class="bx-disk-sidebar-section">
					<?php 
$APPLICATION->IncludeComponent('bitrix:disk.breadcrumbs.tree', '', array_merge($arResult, array('STORAGE' => $arResult['VARIABLES']['STORAGE'], 'PATH_TO_FOLDER_LIST' => CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_DISK'], array('user_id' => $arResult['VARIABLES']['user_id'])), 'PATH_TO_FOLDER_VIEW' => CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_DISK_FILE'], array('user_id' => $arResult['VARIABLES']['user_id'])), 'PATH_TO_FILE_VIEW' => CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_DISK_FILE'], array('user_id' => $arResult['VARIABLES']['user_id'])), 'FOLDER' => $folder, 'RELATIVE_PATH' => $arResult['VARIABLES']['RELATIVE_PATH'], 'RELATIVE_ITEMS' => $arResult['VARIABLES']['RELATIVE_ITEMS'])), $component);
?>


				</div>

				<?php 
if (!Desktop::isDesktopDiskInstall()) {
    ?>
				<div class="bx-disk-sidebar-section">
					<a href="javascript:BX.Disk.getDownloadDesktop();"><img src="/bitrix/images/disk/<?php 
    echo $bannerName;
    ?>
" alt=""></a>
				</div>
				<?php 
}
if ($folder->canAdd($arResult['VARIABLES']['STORAGE']->getCurrentUserSecurityContext())) {
    ?>
				<div class="bx-disk-sidebar-section">
					<div class="wduf-uploader">
						<span class="bx-disk wd-fa-add-file-light">
							<span class="wd-fa-add-file-light-text">
예제 #10
0
 public function executeComponent()
 {
     if (!CModule::IncludeModule('webdav')) {
         return false;
     }
     $isVisual = isset($this->arParams['VISUAL']) ? (bool) $this->arParams['VISUAL'] : true;
     $pathToAjax = isset($this->arParams['AJAX_PATH']) ? $this->arParams['AJAX_PATH'] : '/bitrix/components/bitrix/webdav.disk/ajax.php';
     try {
         if ($isVisual) {
             $diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk');
             $quota = CDiskQuota::GetDiskQuota();
             $this->arResult['showDiskQuota'] = false;
             //$quota !== true; //now without quota
             $this->arResult['diskSpace'] = (double) COption::GetOptionInt('main', 'disk_space') * 1024 * 1024;
             $this->arResult['quota'] = $quota;
             $this->arResult['ajaxIndex'] = $pathToAjax;
             $this->arResult['ajaxStorageIndex'] = '/desktop_app/storage.php';
             if ($diskEnabled) {
                 $this->arResult['isInstalledDisk'] = \Bitrix\Disk\Desktop::isDesktopDiskInstall();
                 $this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/disk/path/';
             } else {
                 $this->arResult['isInstalledDisk'] = (bool) CWebDavTools::isDesktopDiskInstall();
                 $this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/files/lib/';
             }
             $this->arResult['isInstalledPull'] = (bool) IsModuleInstalled('pull');
             $this->arResult['currentUser'] = array('id' => $this->getUser()->getId(), 'formattedName' => $this->getUser()->getFormattedName());
             $this->getApplication()->addHeadScript('/bitrix/components/bitrix/webdav.disk/disk.js');
             $this->includeComponentTemplate();
             return;
         }
         CTimeZone::Disable();
         //decode from utf-8 to site LANG_CHARSET
         CUtil::decodeURIComponent($_POST);
         $this->checkUser()->runAction();
         CTimeZone::Enable();
     } catch (CWebDavBadStorageAfterMigrateException $e) {
         CTimeZone::Enable();
         $this->sendJsonResponse(array('status' => CWebDavDiskDispatcher::STATUS_ERROR, 'message' => 'Could not get Disk\\Storage. Perhaps, it is old client, which does not reconnect. '), 500);
     } catch (CWebDavSymlinkMoveFakeErrorException $e) {
         CTimeZone::Enable();
         $this->sendJsonResponse(array('status' => CWebDavDiskDispatcher::STATUS_ERROR, 'message' => 'This is not really error. Move symlink folders.'));
     } catch (CWebDavAccessDeniedException $e) {
         CTimeZone::Enable();
         $this->sendJsonResponse(array('status' => CWebDavDiskDispatcher::STATUS_ACCESS_DENIED, 'message' => $e->getMessage()));
     } catch (Exception $e) {
         CTimeZone::Enable();
         $response = array('status' => 'error', 'message' => $e->getMessage());
         if ($this->dispatcher) {
             $errors = $this->dispatcher->getErrors();
             if ($errors) {
                 $response['detail'] = $errors;
             }
         }
         $this->sendJsonResponse($response);
     }
     return;
 }