Merge pull request #469 from ONLYOFFICE/feature/make-form
Feature/make form
This commit is contained in:
commit
626ad87077
@ -797,3 +797,15 @@ export function checkFillFormDraft(fileId) {
|
|||||||
data: { fileId },
|
data: { fileId },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fileCopyAs(fileId, destTitle, destFolderId, enableExternalExt) {
|
||||||
|
return request({
|
||||||
|
method: "post",
|
||||||
|
url: `files/file/${fileId}/copyas`,
|
||||||
|
data: {
|
||||||
|
destTitle,
|
||||||
|
destFolderId,
|
||||||
|
enableExternalExt,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -20,6 +20,16 @@ export default function withContextOptions(WrappedComponent) {
|
|||||||
return this.gotoDocEditor(false);
|
return this.gotoDocEditor(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onClickMakeForm = () => {
|
||||||
|
const { copyAsAction, item, formfillingDocs } = this.props;
|
||||||
|
const { title, id, folderId, fileExst } = item;
|
||||||
|
|
||||||
|
const newTitle =
|
||||||
|
title.substring(0, title.length - fileExst.length) + formfillingDocs[0];
|
||||||
|
|
||||||
|
copyAsAction(id, newTitle, folderId).catch((err) => toastr.error(err));
|
||||||
|
};
|
||||||
|
|
||||||
onOpenLocation = () => {
|
onOpenLocation = () => {
|
||||||
const { item, openLocationAction } = this.props;
|
const { item, openLocationAction } = this.props;
|
||||||
const { parentId, folderId, fileExst } = item;
|
const { parentId, folderId, fileExst } = item;
|
||||||
@ -376,6 +386,14 @@ export default function withContextOptions(WrappedComponent) {
|
|||||||
onClick: this.onClickLinkFillForm,
|
onClick: this.onClickLinkFillForm,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
};
|
};
|
||||||
|
case "make-form":
|
||||||
|
return {
|
||||||
|
key: option,
|
||||||
|
label: t("Common:MakeForm"),
|
||||||
|
icon: "/static/images/form.plus.react.svg",
|
||||||
|
onClick: this.onClickMakeForm,
|
||||||
|
disabled: false,
|
||||||
|
};
|
||||||
case "edit":
|
case "edit":
|
||||||
return {
|
return {
|
||||||
key: option,
|
key: option,
|
||||||
@ -533,45 +551,48 @@ export default function withContextOptions(WrappedComponent) {
|
|||||||
return inject(
|
return inject(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
filesStore,
|
|
||||||
filesActionsStore,
|
|
||||||
auth,
|
auth,
|
||||||
versionHistoryStore,
|
|
||||||
mediaViewerDataStore,
|
|
||||||
dialogsStore,
|
dialogsStore,
|
||||||
|
filesActionsStore,
|
||||||
|
filesStore,
|
||||||
|
mediaViewerDataStore,
|
||||||
treeFoldersStore,
|
treeFoldersStore,
|
||||||
|
uploadDataStore,
|
||||||
|
versionHistoryStore,
|
||||||
},
|
},
|
||||||
{ item }
|
{ item }
|
||||||
) => {
|
) => {
|
||||||
const { openDocEditor, fileActionStore } = filesStore;
|
const { openDocEditor, fileActionStore, formatsStore } = filesStore;
|
||||||
const {
|
const {
|
||||||
openLocationAction,
|
deleteItemAction,
|
||||||
finalizeVersionAction,
|
|
||||||
setFavoriteAction,
|
|
||||||
lockFileAction,
|
|
||||||
downloadAction,
|
downloadAction,
|
||||||
duplicateAction,
|
duplicateAction,
|
||||||
setThirdpartyInfo,
|
finalizeVersionAction,
|
||||||
onSelectItem,
|
lockFileAction,
|
||||||
deleteItemAction,
|
|
||||||
markAsRead,
|
markAsRead,
|
||||||
|
onSelectItem,
|
||||||
|
openLocationAction,
|
||||||
|
setFavoriteAction,
|
||||||
|
setThirdpartyInfo,
|
||||||
unsubscribeAction,
|
unsubscribeAction,
|
||||||
} = filesActionsStore;
|
} = filesActionsStore;
|
||||||
const {
|
const {
|
||||||
setChangeOwnerPanelVisible,
|
setChangeOwnerPanelVisible,
|
||||||
setMoveToPanelVisible,
|
|
||||||
setCopyPanelVisible,
|
setCopyPanelVisible,
|
||||||
setDownloadDialogVisible,
|
|
||||||
setRemoveItem,
|
|
||||||
setDeleteThirdPartyDialogVisible,
|
|
||||||
setSharingPanelVisible,
|
|
||||||
setDeleteDialogVisible,
|
setDeleteDialogVisible,
|
||||||
|
setDeleteThirdPartyDialogVisible,
|
||||||
|
setDownloadDialogVisible,
|
||||||
|
setMoveToPanelVisible,
|
||||||
|
setRemoveItem,
|
||||||
|
setSharingPanelVisible,
|
||||||
setUnsubscribe,
|
setUnsubscribe,
|
||||||
} = dialogsStore;
|
} = dialogsStore;
|
||||||
const { isTabletView, isDesktopClient } = auth.settingsStore;
|
const { isTabletView, isDesktopClient } = auth.settingsStore;
|
||||||
const { setIsVerHistoryPanel, fetchFileVersions } = versionHistoryStore;
|
const { setIsVerHistoryPanel, fetchFileVersions } = versionHistoryStore;
|
||||||
const { setAction, type, extension, id } = fileActionStore;
|
const { setAction, type, extension, id } = fileActionStore;
|
||||||
const { setMediaViewerData } = mediaViewerDataStore;
|
const { setMediaViewerData } = mediaViewerDataStore;
|
||||||
|
const { copyAsAction } = uploadDataStore;
|
||||||
|
const { formfillingDocs } = formatsStore.docserviceStore;
|
||||||
|
|
||||||
const { isRecycleBinFolder, isShare } = treeFoldersStore;
|
const { isRecycleBinFolder, isShare } = treeFoldersStore;
|
||||||
const isShareFolder = isShare(item.rootFolderType);
|
const isShareFolder = isShare(item.rootFolderType);
|
||||||
@ -610,6 +631,8 @@ export default function withContextOptions(WrappedComponent) {
|
|||||||
setDeleteDialogVisible,
|
setDeleteDialogVisible,
|
||||||
setUnsubscribe,
|
setUnsubscribe,
|
||||||
isDesktop: isDesktopClient,
|
isDesktop: isDesktopClient,
|
||||||
|
copyAsAction,
|
||||||
|
formfillingDocs,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)(observer(WithContextOptions));
|
)(observer(WithContextOptions));
|
||||||
|
@ -489,12 +489,15 @@ class FilesStore {
|
|||||||
const shouldFillForm = canFormFillingDocs(item.fileExst);
|
const shouldFillForm = canFormFillingDocs(item.fileExst);
|
||||||
const shouldEdit = !shouldFillForm && canWebEdit(item.fileExst);
|
const shouldEdit = !shouldFillForm && canWebEdit(item.fileExst);
|
||||||
const shouldView = canViewedDocs(item.fileExst);
|
const shouldView = canViewedDocs(item.fileExst);
|
||||||
|
const isMasterForm = item.fileExst === ".docxf";
|
||||||
|
|
||||||
let fileOptions = [
|
let fileOptions = [
|
||||||
//"open",
|
//"open",
|
||||||
"fill-form",
|
"fill-form",
|
||||||
"edit",
|
"edit",
|
||||||
"preview",
|
"preview",
|
||||||
"view",
|
"view",
|
||||||
|
"make-form",
|
||||||
"separator0",
|
"separator0",
|
||||||
"sharing-settings",
|
"sharing-settings",
|
||||||
"external-link",
|
"external-link",
|
||||||
@ -525,6 +528,9 @@ class FilesStore {
|
|||||||
"delete",
|
"delete",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (!isMasterForm)
|
||||||
|
fileOptions = this.removeOptions(fileOptions, ["make-form"]);
|
||||||
|
|
||||||
if (!shouldFillForm)
|
if (!shouldFillForm)
|
||||||
fileOptions = this.removeOptions(fileOptions, ["fill-form"]);
|
fileOptions = this.removeOptions(fileOptions, ["fill-form"]);
|
||||||
|
|
||||||
@ -637,6 +643,7 @@ class FilesStore {
|
|||||||
"view",
|
"view",
|
||||||
"preview",
|
"preview",
|
||||||
"edit",
|
"edit",
|
||||||
|
"make-form",
|
||||||
"link-for-portal-users",
|
"link-for-portal-users",
|
||||||
"sharing-settings",
|
"sharing-settings",
|
||||||
"external-link",
|
"external-link",
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
getFileConversationProgress,
|
getFileConversationProgress,
|
||||||
copyToFolder,
|
copyToFolder,
|
||||||
moveToFolder,
|
moveToFolder,
|
||||||
|
fileCopyAs,
|
||||||
} from "@appserver/common/api/files";
|
} from "@appserver/common/api/files";
|
||||||
|
|
||||||
class UploadDataStore {
|
class UploadDataStore {
|
||||||
@ -919,6 +920,18 @@ class UploadDataStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
copyAsAction = (fileId, title, folderId, enableExternalExt) => {
|
||||||
|
const { fetchFiles, filter } = this.filesStore;
|
||||||
|
|
||||||
|
return fileCopyAs(fileId, title, folderId, enableExternalExt)
|
||||||
|
.then(() => {
|
||||||
|
fetchFiles(folderId, filter, true, true);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
return Promise.reject(err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
itemOperationToFolder = (data) => {
|
itemOperationToFolder = (data) => {
|
||||||
const {
|
const {
|
||||||
destFolderId,
|
destFolderId,
|
||||||
|
3
public/images/form.plus.react.svg
Normal file
3
public/images/form.plus.react.svg
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2C0 0.895431 0.895431 0 2 0H14C15.1046 0 16 0.895431 16 2V7H14H7H2V10H7V16H2C0.895431 16 0 15.1046 0 14V2ZM2 2H14V5H2V2ZM11 9H13V11H15V13H13V15H11V13H9V11H11V9Z" fill="#657077"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 334 B |
@ -52,6 +52,7 @@
|
|||||||
"LoadingDescription": "Please wait...",
|
"LoadingDescription": "Please wait...",
|
||||||
"LoadingProcessing": "Loading...",
|
"LoadingProcessing": "Loading...",
|
||||||
"Mail": "Mail",
|
"Mail": "Mail",
|
||||||
|
"MakeForm": "Make form",
|
||||||
"MeLabel": "Me",
|
"MeLabel": "Me",
|
||||||
"More": "More",
|
"More": "More",
|
||||||
"Next": "Next",
|
"Next": "Next",
|
||||||
|
Loading…
Reference in New Issue
Block a user