Merge branch 'feature/mobile-apps-on-reactjs-pe-presentation-info' into feature/mobile-apps-on-reactjs

This commit is contained in:
JuliaSvinareva 2020-12-15 22:43:01 +03:00
commit f44dd4f04a
7 changed files with 265 additions and 3 deletions

View file

@ -49,7 +49,20 @@
"textShowNotification": "Show Notification",
"textDisableAllMacrosWithNotification": "Disable all macros with notification",
"textEnableAll": "Enable All",
"textEnableAllMacrosWithoutNotification": "Enable all macros without notification"
"textEnableAllMacrosWithoutNotification": "Enable all macros without notification",
"textLocation": "Location",
"textTitle": "Title",
"textSubject": "Subject",
"textComment": "Comment",
"textCreated": "Created",
"textLastModifiedBy": "Last Modified By",
"textLastModified": "Last Modified",
"textApplication": "Application",
"textLoading": "Loading...",
"textAuthor": "Author",
"textPresentationTitle": "Presentation Title",
"textOwner": "Owner",
"textUploaded": "Uploaded"
},
"Add": {
"textSlide": "Slide",

View file

@ -4,7 +4,7 @@ import { inject } from "mobx-react";
import { withTranslation } from 'react-i18next';
import CollaborationController from '../../../../common/mobile/lib/controller/Collaboration.jsx'
@inject("storeFocusObjects", "storeAppOptions")
@inject("storeFocusObjects", "storeAppOptions", "storePresentationInfo")
class MainController extends Component {
constructor(props) {
super(props)
@ -85,6 +85,12 @@ class MainController extends Component {
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
// Presentation Info
const storePresentationInfo = this.props.storePresentationInfo;
storePresentationInfo.setDataDoc(this.document);
// Common.SharedSettings.set('document', data.doc);
// if (data.doc) {

View file

@ -0,0 +1,101 @@
import React, { Component } from "react";
import PresentationInfo from "../../view/settings/PresentationInfo";
class PresentationInfoController extends Component {
constructor(props) {
super(props);
this.docProps = this.getDocProps();
this.getModified = this.getModified();
this.getModifiedBy = this.getModifiedBy();
this.getCreators = this.getCreators();
this.title = this.getTitle();
this.subject = this.getSubject();
this.description = this.getDescription();
this.getCreated = this.getCreated();
}
getDocProps() {
const api = Common.EditorApi.get();
return api.asc_getCoreProps();
}
getAppProps() {
const api = Common.EditorApi.get();
const appProps = api.asc_getAppProps();
if (appProps) {
let appName =
(appProps.asc_getApplication() || "") +
(appProps.asc_getAppVersion() ? " " : "") +
(appProps.asc_getAppVersion() || "");
return appName;
}
}
getModified() {
let valueModified = this.docProps.asc_getModified();
// const _lang = this.props.storeAppOptions.lang;
if (valueModified) {
return (
valueModified.toLocaleString("en", {
year: "numeric",
month: "2-digit",
day: "2-digit",
}) +
" " +
valueModified.toLocaleTimeString("en", { timeStyle: "short" })
);
}
}
getModifiedBy() {
let valueModifiedBy = this.docProps.asc_getLastModifiedBy();
if (valueModifiedBy) {
return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy);
}
}
getCreators() {
return this.docProps.asc_getCreator();
}
getTitle() {
return this.docProps.asc_getTitle();
}
getSubject() {
return this.docProps.asc_getSubject();
}
getDescription() {
return this.docProps.asc_getDescription();
}
getCreated() {
let value = this.docProps.asc_getCreated();
if(value) {
return value.toLocaleString("en", {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString("en", {timeStyle: 'short'});
}
}
render() {
return (
<PresentationInfo
getAppProps={this.getAppProps}
getModified={this.getModified}
getModifiedBy={this.getModifiedBy}
getCreators={this.getCreators}
getCreated={this.getCreated}
title={this.title}
subject={this.subject}
description={this.description}
/>
);
}
}
export default PresentationInfoController;

View file

@ -4,6 +4,7 @@ import {storeAppOptions} from './appOptions';
import {storeFocusObjects} from "./focusObjects";
import {storeUsers} from '../../../../common/mobile/lib/store/users';
import {storeApplicationSettings} from './applicationSettings';
import {storePresentationInfo} from './presentationInfo';
// import {storeTextSettings} from "./textSettings";
// import {storeParagraphSettings} from "./paragraphSettings";
// import {storeShapeSettings} from "./shapeSettings";
@ -16,7 +17,8 @@ export const stores = {
storeFocusObjects: new storeFocusObjects(),
// storeDocumentSettings: new storeDocumentSettings(),
users: new storeUsers(),
storeApplicationSettings: new storeApplicationSettings()
storeApplicationSettings: new storeApplicationSettings(),
storePresentationInfo: new storePresentationInfo()
// storeTextSettings: new storeTextSettings(),
// storeParagraphSettings: new storeParagraphSettings(),
// storeShapeSettings: new storeShapeSettings(),

View file

@ -0,0 +1,10 @@
import { action, observable } from "mobx";
export class storePresentationInfo {
@observable dataDoc;
@action setDataDoc(obj) {
this.dataDoc = obj;
}
}

View file

@ -0,0 +1,125 @@
import React, {Fragment} from "react";
import { observer, inject } from "mobx-react";
import { Page, Navbar, List, ListItem, BlockTitle } from "framework7-react";
import { useTranslation } from "react-i18next";
const PagePresentationInfo = (props) => {
const { t } = useTranslation();
const _t = t("View.Settings", { returnObjects: true });
const storeInfo = props.storePresentationInfo;
const dataApp = props.getAppProps();
const dataModified = props.getModified;
const dataModifiedBy = props.getModifiedBy;
const creators = props.getCreators;
const dataDoc = JSON.parse(JSON.stringify(storeInfo.dataDoc));
return (
<Page>
<Navbar title={_t.textPresentationInfo} backLink={_t.textBack} />
{dataDoc.title ? (
<Fragment>
<BlockTitle>{_t.textPresentationTitle}</BlockTitle>
<List>
<ListItem title={dataDoc.title}></ListItem>
</List>
</Fragment>
) : null}
{dataDoc.info.author || dataDoc.info.owner ? (
<Fragment>
<BlockTitle>{_t.textOwner}</BlockTitle>
<List>
<ListItem title={dataDoc.info.author || dataDoc.info.owner}></ListItem>
</List>
</Fragment>
) : null}
{dataDoc.info.folder ? (
<Fragment>
<BlockTitle>{_t.textLocation}</BlockTitle>
<List>
<ListItem title={dataDoc.info.folder}></ListItem>
</List>
</Fragment>
) : null}
{dataDoc.info.uploaded || dataDoc.info.created ? (
<Fragment>
<BlockTitle>{_t.textUploaded}</BlockTitle>
<List>
<ListItem title={dataDoc.info.uploaded || dataDoc.info.created}></ListItem>
</List>
</Fragment>
) : null}
{props.title ? (
<Fragment>
<BlockTitle>{_t.textTitle}</BlockTitle>
<List>
<ListItem title={props.title}></ListItem>
</List>
</Fragment>
) : null}
{props.subject ? (
<Fragment>
<BlockTitle>{_t.textSubject}</BlockTitle>
<List>
<ListItem title={props.subject}></ListItem>
</List>
</Fragment>
) : null}
{props.description ? (
<Fragment>
<BlockTitle>{_t.textComment}</BlockTitle>
<List>
<ListItem title={props.description}></ListItem>
</List>
</Fragment>
) : null}
{dataModified ? (
<Fragment>
<BlockTitle>{_t.textLastModified}</BlockTitle>
<List>
<ListItem title={dataModified}></ListItem>
</List>
</Fragment>
) : null}
{dataModifiedBy ? (
<Fragment>
<BlockTitle>{_t.textLastModifiedBy}</BlockTitle>
<List>
<ListItem title={dataModifiedBy}></ListItem>
</List>
</Fragment>
) : null}
{props.getCreated ? (
<Fragment>
<BlockTitle>{_t.textCreated}</BlockTitle>
<List>
<ListItem title={props.getCreated}></ListItem>
</List>
</Fragment>
) : null}
{dataApp ? (
<Fragment>
<BlockTitle>{_t.textApplication}</BlockTitle>
<List>
<ListItem title={dataApp}></ListItem>
</List>
</Fragment>
) : null}
{creators ? (
<Fragment>
<BlockTitle>{_t.textAuthor}</BlockTitle>
<List>
{
creators.split(/\s*[,;]\s*/).map(item => {
return <ListItem title={item}></ListItem>
})
}
</List>
</Fragment>
) : null}
</Page>
);
};
const PresentationInfo = inject("storePresentationInfo")(observer(PagePresentationInfo));
export default PresentationInfo;

View file

@ -6,6 +6,7 @@ import {Device} from '../../../../../common/mobile/utils/device';
import ApplicationSettingsController from "../../controller/settings/ApplicationSettings";
import { MacrosSettings } from "./ApplicationSettings";
import DownloadController from "../../controller/settings/Download";
import PresentationInfoController from "../../controller/settings/PresentationInfo";
const routes = [
{
@ -23,6 +24,10 @@ const routes = [
{
path: '/download/',
component: DownloadController
},
{
path: '/presentation-info/',
component: PresentationInfoController
}
/*{
path: '/presentation-settings/',