[DE mobile] Edits Document Info

This commit is contained in:
SergeyEzhin 2020-12-09 00:01:01 +03:00
parent 41bb73eb3e
commit a90055197d
4 changed files with 117 additions and 24 deletions

View file

@ -52,7 +52,12 @@
"textDownloadAs": "Download As",
"notcriticalErrorTitle": "Warning",
"textDownloadTxt": "If you continue saving in this format all features except the text will be lost. Are you sure you want to continue?",
"textDownloadRtf": "If you continue saving in this format some of the formatting might be lost. Are you sure you want to continue?"
"textDownloadRtf": "If you continue saving in this format some of the formatting might be lost. Are you sure you want to continue?",
"textLocation": "Location",
"textTitle": "Title",
"textSubject": "Subject",
"textComment": "Comment",
"textCreated": "Created"
},
"Collaboration": {
"textEditUser": "Users who are editing the file:"

View file

@ -94,7 +94,8 @@ class MainController extends Component {
const storeDocumentInfo = this.props.storeDocumentInfo;
storeDocumentInfo.setDataDoc(data.doc);
storeDocumentInfo.setDataDoc(this.document);
// console.log(this.document);
// Common.SharedSettings.set('document', data.doc);
@ -255,25 +256,27 @@ class MainController extends Component {
const storeDocumentInfo = this.props.storeDocumentInfo;
this.api.asc_registerCallback("asc_onGetDocInfoStart", () => {
console.log("Start");
storeDocumentInfo.switchIsLoaded(false);
// console.log("Start");
storeDocumentInfo.switchIsLoaded(false);
});
this.api.asc_registerCallback("asc_onGetDocInfoStop", () => {
console.log("Stop");
storeDocumentInfo.switchIsLoaded(true);
// console.log("Stop");
storeDocumentInfo.switchIsLoaded(true);
});
this.api.asc_registerCallback("asc_onDocInfo", (obj) => {
storeDocumentInfo.changeCount(obj);
storeDocumentInfo.changeCount(obj);
});
this.api.asc_registerCallback('asc_onGetDocInfoEnd', () => {
console.log('End');
storeDocumentInfo.switchIsLoaded(true);
// console.log('End');
storeDocumentInfo.switchIsLoaded(true);
});
// me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onApiDocumentName, me));
this.api.asc_registerCallback('asc_onDocumentName', (name) => {
// console.log(name);
});
}

View file

@ -9,6 +9,10 @@ class DocumentInfoController extends Component {
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() {
@ -58,6 +62,26 @@ class DocumentInfoController extends Component {
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(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'});
}
}
componentDidMount() {
const api = Common.EditorApi.get();
api.startGetDocInfo();
@ -69,7 +93,11 @@ class DocumentInfoController extends Component {
getAppProps={this.getAppProps}
getModified={this.getModified}
getModifiedBy={this.getModifiedBy}
getCreators={this.getCreators}
getCreators={this.getCreators}
getCreated={this.getCreated}
title={this.title}
subject={this.subject}
description={this.description}
/>
);
}

View file

@ -20,24 +20,45 @@ const PageDocumentInfo = (props) => {
wordsCount,
} = storeInfo.infoObj;
const dataDoc = JSON.parse(JSON.stringify(storeInfo.dataDoc));
// console.log(dataDoc);
const isLoaded = storeInfo.isLoaded;
// console.log(pageCount, paragraphCount, symbolsCount, symbolsWSCount, wordsCount);
return (
<Page>
<Navbar title={_t.textDocumentInfo} backLink={_t.textBack} />
<BlockTitle>{_t.textDocumentTitle}</BlockTitle>
<List>
<ListItem title={dataDoc.title}></ListItem>
</List>
<BlockTitle>{_t.textOwner}</BlockTitle>
<List>
<ListItem title={dataDoc.info.author}></ListItem>
</List>
<BlockTitle>{_t.textUploaded}</BlockTitle>
<List>
<ListItem title={dataDoc.info.created}></ListItem>
</List>
{dataDoc.title ? (
<Fragment>
<BlockTitle>{_t.textDocumentTitle}</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}
<BlockTitle>{_t.textStatistic}</BlockTitle>
<List>
<ListItem title="Pages" after={isLoaded ? String(pageCount) : _t.textLoading}></ListItem>
@ -46,18 +67,54 @@ const PageDocumentInfo = (props) => {
<ListItem title="Symbols" after={isLoaded ? String(symbolsCount) : _t.textLoading}></ListItem>
<ListItem title="Spaces" after={isLoaded ? String(symbolsWSCount) : _t.textLoading}></ListItem>
</List>
{dataModified && dataModifiedBy ? (
{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>