diff --git a/products/ASC.Files/Client/public/locales/en/Home.json b/products/ASC.Files/Client/public/locales/en/Home.json index 44bb110d451..0fd68788156 100644 --- a/products/ASC.Files/Client/public/locales/en/Home.json +++ b/products/ASC.Files/Client/public/locales/en/Home.json @@ -80,6 +80,6 @@ "UploadToFolder": "Upload to folder", "ViewList": "List", "ViewTiles": "Tiles", - "NewMasterForm": "New master form", + "NewMasterForm": "New form template", "ViewTiles": "Tiles" } diff --git a/products/ASC.Files/Client/src/HOCs/withContent.js b/products/ASC.Files/Client/src/HOCs/withContent.js index 473515915ac..d1388a16efb 100644 --- a/products/ASC.Files/Client/src/HOCs/withContent.js +++ b/products/ASC.Files/Client/src/HOCs/withContent.js @@ -21,9 +21,13 @@ export default function withContent(WrappedContent) { constructor(props) { super(props); - const { item, fileActionId, fileActionExt } = props; + const { item, fileActionId, fileActionExt, fileActionTemplateId } = props; let titleWithoutExt = getTitleWithoutExst(item); - if (fileActionId === -1 && item.id === fileActionId) { + if ( + fileActionId === -1 && + item.id === fileActionId && + fileActionTemplateId === null + ) { titleWithoutExt = getDefaultFileName(fileActionExt); } @@ -119,16 +123,17 @@ export default function withContent(WrappedContent) { createItem = (e, open) => { const { createFile, - item, - setIsLoading, + createFolder, + fileActionTemplateId, + isDesktop, isLoading, - openDocEditor, isPrivacy, - isDesktop, + item, + openDocEditor, replaceFileStream, - t, setEncryptionAccess, - createFolder, + setIsLoading, + t, } = this.props; const { itemTitle } = this.state; @@ -162,7 +167,11 @@ export default function withContent(WrappedContent) { .finally(() => { return setIsLoading(false); }) - : createFile(item.parentId, `${itemTitle}.${item.fileExst}`) + : createFile( + item.parentId, + `${itemTitle}.${item.fileExst}`, + fileActionTemplateId + ) .then((file) => { if (isPrivacy) { return setEncryptionAccess(file).then((encryptedFile) => { @@ -230,25 +239,26 @@ export default function withContent(WrappedContent) { render() { const { itemTitle } = this.state; const { - item, - fileActionId, + element, fileActionExt, - viewer, - t, + fileActionId, + isDesktop, isTrashFolder, + item, onFilesClick, + t, viewAs, - element, - isDesktop, + viewer, } = this.props; const { - id, - fileExst, - updated, - createdBy, access, + createdBy, + fileExst, fileStatus, href, + icon, + id, + updated, } = item; const titleWithoutExt = getTitleWithoutExst(item); @@ -275,7 +285,7 @@ export default function withContent(WrappedContent) { : { onClick: onFilesClick }; if (!isDesktop && !isTrashFolder) { - linkStyles.href = item.href; + linkStyles.href = href; } const newItems = item.new || fileStatus === 2; @@ -283,7 +293,7 @@ export default function withContent(WrappedContent) { const elementIcon = element ? ( element ) : ( - + ); return isEdit ? ( @@ -319,51 +329,53 @@ export default function withContent(WrappedContent) { ({ filesActionsStore, filesStore, treeFoldersStore, auth }, {}) => { const { editCompleteAction } = filesActionsStore; const { - setIsLoading, + createFile, + createFolder, isLoading, openDocEditor, - updateFile, renameFolder, - createFile, - createFolder, + setIsLoading, + updateFile, viewAs, } = filesStore; const { isRecycleBinFolder, isPrivacyFolder } = treeFoldersStore; const { - type: fileActionType, extension: fileActionExt, id: fileActionId, + templateId: fileActionTemplateId, + type: fileActionType, } = filesStore.fileActionStore; const { replaceFileStream, setEncryptionAccess } = auth; const { culture, - isDesktopClient, folderFormValidation, + isDesktopClient, } = auth.settingsStore; return { - setIsLoading, + createFile, + createFolder, + culture, + editCompleteAction, + fileActionExt, + fileActionId, + fileActionTemplateId, + fileActionType, + folderFormValidation, + homepage: config.homepage, + isDesktop: isDesktopClient, isLoading, + isPrivacy: isPrivacyFolder, isTrashFolder: isRecycleBinFolder, openDocEditor, - updateFile, renameFolder, - fileActionId, - editCompleteAction, - fileActionType, - createFile, - isPrivacy: isPrivacyFolder, - isDesktop: isDesktopClient, replaceFileStream, setEncryptionAccess, - createFolder, - fileActionExt, - culture, - homepage: config.homepage, - viewer: auth.userStore.user, + setIsLoading, + updateFile, viewAs, - folderFormValidation, + viewer: auth.userStore.user, }; } )(observer(WithContent)); diff --git a/products/ASC.Files/Client/src/components/FilesPanels/index.js b/products/ASC.Files/Client/src/components/FilesPanels/index.js index 8f2f6976d27..377f2a8bba0 100644 --- a/products/ASC.Files/Client/src/components/FilesPanels/index.js +++ b/products/ASC.Files/Client/src/components/FilesPanels/index.js @@ -95,6 +95,7 @@ const Panels = (props) => { headerName={t("Translations:CreateMasterFormFromFile")} titleFilesList={t("SelectFile:SelectDOCXFormat")} creationButtonPrimary + withSubfolders={false} /> ), ]; diff --git a/products/ASC.Files/Client/src/components/panels/SelectFileDialog/ModalView.js b/products/ASC.Files/Client/src/components/panels/SelectFileDialog/ModalView.js index 1d0ab5be39b..f2b1c12031b 100644 --- a/products/ASC.Files/Client/src/components/panels/SelectFileDialog/ModalView.js +++ b/products/ASC.Files/Client/src/components/panels/SelectFileDialog/ModalView.js @@ -25,6 +25,7 @@ class SelectFileDialogModalView extends React.Component { isAvailable: true, }; this.folderList = ""; + this.noTreeSwitcher = false; } componentDidMount() { @@ -46,7 +47,10 @@ class SelectFileDialogModalView extends React.Component { case "exceptSortedByTags": try { const foldersTree = await getFoldersTree(); - this.folderList = SelectFolderDialog.convertFolders( + [ + this.folderList, + this.noTreeSwitcher, + ] = SelectFolderDialog.convertFolders( foldersTree, exceptSortedByTagsFolders ); @@ -60,10 +64,10 @@ class SelectFileDialogModalView extends React.Component { case "exceptTrashFolder": try { const foldersTree = await getFoldersTree(); - this.folderList = SelectFolderDialog.convertFolders( - foldersTree, - exceptTrashFolder - ); + [ + this.folderList, + this.noTreeSwitcher, + ] = SelectFolderDialog.convertFolders(foldersTree, exceptTrashFolder); this.onSetSelectedFolder(); } catch (err) { console.error(err); @@ -74,7 +78,10 @@ class SelectFileDialogModalView extends React.Component { case "exceptPrivacyTrashFolders": try { const foldersTree = await getFoldersTree(); - this.folderList = SelectFolderDialog.convertFolders( + [ + this.folderList, + this.noTreeSwitcher, + ] = SelectFolderDialog.convertFolders( foldersTree, exceptPrivacyTrashFolders ); @@ -199,6 +206,7 @@ class SelectFileDialogModalView extends React.Component {
diff --git a/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/AsideView.js b/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/AsideView.js index 23184f0d521..f1273417e41 100644 --- a/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/AsideView.js +++ b/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/AsideView.js @@ -29,6 +29,7 @@ const SelectFolderDialogAsideView = ({ canCreate, isLoading, primaryButtonName, + noTreeSwitcher, }) => { return ( @@ -62,7 +63,7 @@ const SelectFolderDialogAsideView = ({ displayType={DISPLAY_TYPE} showButtons={showButtons} isFooter={!!footer} - folderListLength={folderList?.length} + noTreeSwitcher={noTreeSwitcher} >
{header}
diff --git a/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/ModalView.js b/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/ModalView.js index 5265c569944..b4632430102 100644 --- a/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/ModalView.js +++ b/products/ASC.Files/Client/src/components/panels/SelectFolderDialog/ModalView.js @@ -27,6 +27,7 @@ const SelectFolderDialogModalView = ({ canCreate, isLoading, primaryButtonName, + noTreeSwitcher, }) => { return ( @@ -44,7 +45,7 @@ const SelectFolderDialogModalView = ({
{header}
) : ( ); } @@ -666,11 +669,25 @@ class SelectFolderDialog extends React.Component { static convertFolders = (folders, arrayOfExceptions) => { let newArray = []; + let noSubfoldersCount = 0; + let needHideSwitcher = false; for (let i = 0; i < folders.length; i++) { - !arrayOfExceptions.includes(folders[i].rootFolderType) && + if (!arrayOfExceptions.includes(folders[i].rootFolderType)) { newArray.push(folders[i]); + + if ( + folders[i].foldersCount === 0 || + folders[i].rootFolderType === FolderType.Privacy + ) { + noSubfoldersCount += 1; + } + } + } + + if (newArray.length === noSubfoldersCount) { + needHideSwitcher = true; } - return newArray; + return [newArray, needHideSwitcher]; }; render() { return ( diff --git a/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js b/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js index 78b9cb9250b..411f1ee7981 100644 --- a/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js @@ -535,7 +535,7 @@ class SharingPanelComponent extends React.Component { />