Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/oforms gallery #627

Merged
merged 46 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8c782a7
Web: Files: added OFORMs gallery
gopienkonikita Mar 31, 2022
01ac9e5
Web: Files: fixed activateHotkeys
gopienkonikita Apr 1, 2022
becb37d
Web: Files: added context menu for FormGallery files
gopienkonikita Apr 1, 2022
2cb236c
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 1, 2022
a076a27
Web: Files: added select gallery items, fixed routing
gopienkonikita Apr 4, 2022
3d3d383
Web: Files: fixed FormGallery thumbnails
gopienkonikita Apr 4, 2022
fc83ee5
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 4, 2022
f04d679
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 4, 2022
c51741b
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 5, 2022
b4c2c69
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 5, 2022
342c938
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 7, 2022
90bf5a7
Web: Files: added info panel for OFORMsGallery
gopienkonikita Apr 7, 2022
ee247f5
Web: Files: fixed oforms-gallery styles
gopienkonikita Apr 7, 2022
070b2cb
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 8, 2022
6d7bb27
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 14, 2022
6dbf773
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 18, 2022
e8c46ba
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 19, 2022
34ea668
Web: Files: Gallery: fixed info-panel icon button
gopienkonikita Apr 19, 2022
3380e87
Files: oforms gallery manager
pavelbannov Apr 20, 2022
11163c3
Web: Files: added creating forms from the gallery
gopienkonikita Apr 20, 2022
c9abcba
Web: Files: added creating forms from the gallery
gopienkonikita Apr 20, 2022
9bc8dee
Web: Common: fixed section-container width
gopienkonikita Apr 20, 2022
25449b4
Web: Files: fixed creating forms from the gallery
gopienkonikita Apr 20, 2022
eed752d
Web: Files: fixed creating forms from the gallery
gopienkonikita Apr 20, 2022
c6abeab
Web: Files: fixed info-panel opening
gopienkonikita Apr 20, 2022
04fc130
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
gopienkonikita Apr 20, 2022
9541a9b
refactoring
pavelbannov Apr 20, 2022
48416ec
Web: Files: Fix borders on thumbnails, refactoring
gopienkonikita Apr 21, 2022
20ac091
Merge branch 'feature/oforms-gallery' of github.com:ONLYOFFICE/AppSer…
gopienkonikita Apr 21, 2022
2bf6dec
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
AlexeySafronov Apr 21, 2022
b04f132
Web: Files: fixed gallery styles
gopienkonikita Apr 21, 2022
524a8e4
Merge branch 'feature/oforms-gallery' of github.com:ONLYOFFICE/AppSer…
gopienkonikita Apr 21, 2022
eb96f55
Web: Files: fixed gallery translations for info panel
gopienkonikita Apr 21, 2022
e83f02c
Web: Files: fixed gallery styles
gopienkonikita Apr 21, 2022
50d627e
Web: Files: fixed getOforms
gopienkonikita Apr 21, 2022
fff945c
Web: Files: fixed forms creation
gopienkonikita Apr 21, 2022
e7b4280
Web: Files: fixed getOforms
gopienkonikita Apr 21, 2022
fe0db05
Merge branch 'feature/virtual-rooms-1.2' into feature/oforms-gallery
AlexeySafronov Apr 21, 2022
ebbd473
Web: fixed getOforms language
gopienkonikita Apr 21, 2022
9a204b5
Web: Files: fixed MainButton formActions
gopienkonikita Apr 21, 2022
03c8921
Web: Files: fixed FromGallery loader
gopienkonikita Apr 21, 2022
00b2c03
Web: Files: fixed MainButton options
gopienkonikita Apr 21, 2022
17cdd4b
Web: Files: changed oforms loader
gopienkonikita Apr 21, 2022
8b2114a
Web: Files: fixed FORM_GALLERY_URL
gopienkonikita Apr 21, 2022
a9a528a
Web: Files: createFormFromTemplate replaced with createFile
gopienkonikita Apr 21, 2022
f8088cf
Web: Files: fixed gallery translations, refactoring
gopienkonikita Apr 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions config/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@
},
"files": {
"thirdparty": {
"enable": [ "box", "dropboxv2", "docusign", "google", "onedrive", "sharepoint", "nextcloud", "owncloud", "webdav", "kdrive", "yandex" ]
"enable": [ "box", "dropboxv2", "docusign", "google", "onedrive", "sharepoint", "nextcloud", "owncloud", "webdav", "kdrive", "yandex" ]
},
"docservice": {
"coauthor-docs": [ ".pptx", ".ppsx", ".xlsx", ".csv", ".docx", ".docxf", ".oform", ".txt" ],
"commented-docs": [ ".docx", ".docxf", ".xlsx", ".pptx" ],
"convert-docs": [ ".pptm", ".ppt", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".rtf" ],
"edited-docs": [ ".pptx", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".xlsx", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".csv", ".docx", ".docxf", ".oform", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".txt", ".rtf", ".mht", ".html", ".htm" ],
"encrypted-docs": [ ".docx", ".docxf", ".xlsx", ".pptx", ".oform" ],
"formfilling-docs": [ ".oform" ],
"customfilter-docs": [ ".xlsx" ],
"reviewed-docs": [ ".docx", ".docxf" ],
"viewed-docs": [ ".pptx", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".gslides", ".xlsx", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".gsheet", ".csv", ".docx", ".docxf", ".oform", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".gdoc", ".txt", ".rtf", ".mht", ".html", ".htm", ".epub", ".pdf", ".djvu", ".xps" ],
"coauthor-docs": [ ".pptx", ".ppsx", ".xlsx", ".csv", ".docx", ".docxf", ".oform", ".txt" ],
"commented-docs": [ ".docx", ".docxf", ".xlsx", ".pptx" ],
"convert-docs": [ ".pptm", ".ppt", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".rtf" ],
"edited-docs": [ ".pptx", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".xlsx", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".csv", ".docx", ".docxf", ".oform", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".txt", ".rtf", ".mht", ".html", ".htm" ],
"encrypted-docs": [ ".docx", ".docxf", ".xlsx", ".pptx", ".oform" ],
"formfilling-docs": [ ".oform" ],
"customfilter-docs": [ ".xlsx" ],
"reviewed-docs": [ ".docx", ".docxf" ],
"viewed-docs": [ ".pptx", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".gslides", ".xlsx", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".gsheet", ".csv", ".docx", ".docxf", ".oform", ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".gdoc", ".txt", ".rtf", ".mht", ".html", ".htm", ".epub", ".pdf", ".djvu", ".xps" ],
"secret": {
"value": "",
"header": ""
Expand All @@ -77,15 +77,20 @@
},
"ffmpeg": {
"value": "",
"exts": [ "avi", "mpeg", "mpg", "wmv" ]
"exts": [ "avi", "mpeg", "mpg", "wmv" ]
},
"uploader": {
"chunk-size": 10485760,
"url": "products/files/"
},
"viewed-images": [ ".bmp", ".gif", ".jpeg", ".jpg", ".png", ".ico", ".tif", ".tiff", ".webp" ],
"viewed-media": [ ".aac", ".flac", ".m4a", ".mp3", ".oga", ".ogg", ".wav", ".f4v", ".m4v", ".mov", ".mp4", ".ogv", ".webm" ],
"index": [ ".pptx", ".xlsx", ".docx" ]
"viewed-images": [ ".bmp", ".gif", ".jpeg", ".jpg", ".png", ".ico", ".tif", ".tiff", ".webp" ],
"viewed-media": [ ".aac", ".flac", ".m4a", ".mp3", ".oga", ".ogg", ".wav", ".f4v", ".m4v", ".mov", ".mp4", ".ogv", ".webm" ],
"index": [ ".pptx", ".xlsx", ".docx" ],
"oform": {
"url": "https://oforms.onlyoffice.com/data/reqdata.json",
"period": 60,
"ext": ".oform"
}
},
"web": {
"api": "api/2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/asc-web-common/api/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ export function deleteFolder(folderId, deleteAfter, immediately) {
return request(options);
}

export function createFile(folderId, title, templateId) {
const data = { title, templateId };
export function createFile(folderId, title, templateId, formId) {
const data = { title, templateId, formId };
const options = {
method: "post",
url: `/files/${folderId}/file`,
Expand Down
5 changes: 5 additions & 0 deletions packages/asc-web-common/api/settings/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { request } from "../client";
import axios from "axios";

export function getSettings() {
return request({
Expand Down Expand Up @@ -454,3 +455,7 @@ export function toggleTipsSubscription() {
};
return request(options);
}

export function getOforms(url) {
return axios.get(url);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ const StyledWrapper = styled.div`
}
`;

const TilesLoader = ({ foldersCount, filesCount, sectionWidth, ...rest }) => {
const TilesLoader = ({
foldersCount,
filesCount,
sectionWidth,
withTitle,
...rest
}) => {
const folders = [];
const files = [];

Expand All @@ -59,15 +65,17 @@ const TilesLoader = ({ foldersCount, filesCount, sectionWidth, ...rest }) => {
) : null}
<StyledTilesLoader>{folders}</StyledTilesLoader>

{filesCount > 0 ? (
<RectangleLoader
height="22px"
width="35px"
className="files"
animate
{...rest}
/>
) : null}
{filesCount > 0
? withTitle && (
<RectangleLoader
height="22px"
width="35px"
className="files"
animate
{...rest}
/>
)
: null}
<StyledTilesLoader>{files}</StyledTilesLoader>
</StyledWrapper>
);
Expand All @@ -81,6 +89,7 @@ TilesLoader.propTypes = {
TilesLoader.defaultProps = {
foldersCount: 2,
filesCount: 8,
withTitle: true,
};

export default TilesLoader;
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ const StyledSectionContainer = styled.section`
display: flex;
flex-direction: column;

width: ${(props) =>
props.infoPanelIsVisible ? "calc(100% - 677px)" : "100%"};
max-width: ${(props) =>
props.infoPanelIsVisible ? "calc(100vw - 677px)" : "100vw"};
width: 100%;
max-width: 100%;

@media ${tablet} {
width: 100%;
Expand Down
6 changes: 6 additions & 0 deletions packages/asc-web-common/store/AuthStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ class AuthStore {
setProviders = (providers) => {
this.providers = providers;
};

getOforms = () => {
const culture =
this.userStore.user.cultureName || this.settingsStore.culture;
return api.settings.getOforms(`${this.settingsStore.urlOforms}${culture}`);
};
}

export default new AuthStore();
2 changes: 2 additions & 0 deletions packages/asc-web-common/store/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class SettingsStore {
enabledJoin = false;
urlLicense = "https://gnu.org/licenses/gpl-3.0.html";
urlSupport = "https://helpdesk.onlyoffice.com/";
urlOforms = "https://cmsoforms.onlyoffice.com/api/oforms?populate=*&locale=";

logoUrl = combineUrl(proxyURL, "/static/images/nav.logo.opened.react.svg");
customNames = {
id: "Common",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions products/ASC.Files/Client/public/locales/en/FormGallery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"GalleryEmptyScreenHeader": "Failed to load form templates",
"GalleryEmptyScreenDescription": "Select any form template to see the details",
"EmptyScreenDescription": "Please check your Internet connection and refresh the page or try later",
"TemplateInfo": "Template info",
"FormTemplateInfo": "Form template info"
}
7 changes: 7 additions & 0 deletions products/ASC.Files/Client/public/locales/ru/FormGallery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"GalleryEmptyScreenHeader": "Не удалось загрузить шаблоны форм",
"GalleryEmptyScreenDescription": "Выберите шаблон формы, чтобы просмотреть подробности",
"EmptyScreenDescription": "Проверьте подключение к Интернету и обновите страницу или повторите попытку позже",
"TemplateInfo": "Информация шаблона",
"FormTemplateInfo": "Информация о шаблоне формы"
}
22 changes: 17 additions & 5 deletions products/ASC.Files/Client/src/Files.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Provider as FilesProvider } from "mobx-react";
import { inject, observer } from "mobx-react";
import { Switch } from "react-router-dom";
import { Switch, withRouter } from "react-router-dom";
import config from "../package.json";
import PrivateRoute from "@appserver/common/components/PrivateRoute";
import AppLoader from "@appserver/common/components/AppLoader";
Expand All @@ -28,6 +28,7 @@ import {
ArticleHeaderContent,
ArticleMainButtonContent,
} from "./components/Article";
import FormGallery from "./pages/FormGallery";

const { proxyURL } = AppServerConfig;
const homepage = config.homepage;
Expand All @@ -40,6 +41,10 @@ const HISTORY_URL = combineUrl(PROXY_HOMEPAGE_URL, "/:fileId/history");
const PRIVATE_ROOMS_URL = combineUrl(PROXY_HOMEPAGE_URL, "/private");
const FILTER_URL = combineUrl(PROXY_HOMEPAGE_URL, "/filter");
const MEDIA_VIEW_URL = combineUrl(PROXY_HOMEPAGE_URL, "/#preview");
const FORM_GALLERY_URL = combineUrl(
PROXY_HOMEPAGE_URL,
"/form-gallery/:folderId"
);

if (!window.AppServer) {
window.AppServer = {};
Expand All @@ -56,8 +61,12 @@ window.AppServer.files = {

const Error404 = React.lazy(() => import("studio/Error404"));

const FilesArticle = React.memo(() => {
return (
const FilesArticle = React.memo(({ history }) => {
const isFormGallery = history.location.pathname
.split("/")
.includes("form-gallery");

return !isFormGallery ? (
<Article>
<Article.Header>
<ArticleHeaderContent />
Expand All @@ -69,6 +78,8 @@ const FilesArticle = React.memo(() => {
<ArticleBodyContent />
</Article.Body>
</Article>
) : (
<></>
);
});

Expand All @@ -81,6 +92,7 @@ const FilesSection = React.memo(() => {
<PrivateRoute exact path={HOME_URL} component={Home} />
<PrivateRoute path={FILTER_URL} component={Home} />
<PrivateRoute path={MEDIA_VIEW_URL} component={Home} />
<PrivateRoute path={FORM_GALLERY_URL} component={FormGallery} />
<PrivateRoute component={Error404Route} />
</Switch>
);
Expand Down Expand Up @@ -158,7 +170,7 @@ class FilesContent extends React.Component {
return (
<>
<Panels />
<FilesArticle />
<FilesArticle history={this.props.history} />
<FilesSection />
</>
);
Expand All @@ -182,7 +194,7 @@ const Files = inject(({ auth, filesStore }) => {
auth.setProductVersion(config.version);
},
};
})(withTranslation("Common")(observer(FilesContent)));
})(withTranslation("Common")(observer(withRouter(FilesContent))));

export default () => (
<FilesProvider {...stores}>
Expand Down
43 changes: 40 additions & 3 deletions products/ASC.Files/Client/src/HOCs/withContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ export default function withContent(WrappedContent) {
constructor(props) {
super(props);

const { item, fileActionId, fileActionExt, fileActionTemplateId } = props;
const {
item,
fileActionId,
fileActionExt,
fileActionTemplateId,
fromTemplate,
} = props;
let titleWithoutExt = props.titleWithoutExt;
if (
fileActionId === -1 &&
item.id === fileActionId &&
fileActionTemplateId === null
fileActionTemplateId === null &&
!fromTemplate
) {
titleWithoutExt = getDefaultFileName(fileActionExt);
}
Expand Down Expand Up @@ -188,8 +195,11 @@ export default function withContent(WrappedContent) {
clearActiveOperations,
addActiveItems,
fileCopyAs,
fromTemplate,
gallerySelected,
} = this.props;
const { itemTitle } = this.state;
const { parentId, fileExst } = item;

const isMakeFormFromFile = fileActionTemplateId ? true : false;

Expand Down Expand Up @@ -288,6 +298,29 @@ export default function withContent(WrappedContent) {

clearActiveOperations(fileIds);

return setIsLoading(false);
});
} else if (fromTemplate) {
createFile(
parentId,
`${itemTitle}.${fileExst}`,
undefined,
gallerySelected.id
)
.then((file) => {
createdFileId = file.id;
addActiveItems([file.id]);

return open && openDocEditor(file.id, file.providerKey, tab);
})
.then(() => this.completeAction(itemId))
.catch((e) => toastr.error(e))
.finally(() => {
const fileIds = [+itemId];
createdFileId && fileIds.push(createdFileId);

clearActiveOperations(fileIds);

return setIsLoading(false);
});
} else {
Expand Down Expand Up @@ -465,6 +498,7 @@ export default function withContent(WrappedContent) {
isUpdatingRowItem,
passwordEntryProcess,
addActiveItems,
gallerySelected,
} = filesStore;
const { clearActiveOperations, fileCopyAs } = uploadDataStore;
const { isRecycleBinFolder, isPrivacyFolder } = treeFoldersStore;
Expand All @@ -474,6 +508,7 @@ export default function withContent(WrappedContent) {
id: fileActionId,
templateId: fileActionTemplateId,
type: fileActionType,
fromTemplate,
} = filesStore.fileActionStore;
const { replaceFileStream, setEncryptionAccess } = auth;
const {
Expand All @@ -491,7 +526,7 @@ export default function withContent(WrappedContent) {
const isEdit =
item.id === fileActionId && item.fileExst === fileActionExt;

const titleWithoutExt = getTitleWithoutExst(item);
const titleWithoutExt = getTitleWithoutExst(item, fromTemplate);

return {
createFile,
Expand Down Expand Up @@ -526,6 +561,8 @@ export default function withContent(WrappedContent) {
fileCopyAs,
isEdit,
titleWithoutExt,
fromTemplate,
gallerySelected,
};
}
)(observer(WithContent));
Expand Down
Loading