diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index fdbffe4a5..f258d1ec6 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -53,7 +53,12 @@ "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?", - "textColorSchemes": "Color Schemes" + "textColorSchemes": "Color Schemes", + "textLocation": "Location", + "textTitle": "Title", + "textSubject": "Subject", + "textComment": "Comment", + "textCreated": "Created" }, "Collaboration": { "textEditUser": "Users who are editing the file:" diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 11a30c8be..57ac867e8 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -94,7 +94,7 @@ class MainController extends Component { const storeDocumentInfo = this.props.storeDocumentInfo; - storeDocumentInfo.setDataDoc(data.doc); + storeDocumentInfo.setDataDoc(this.document); // Common.SharedSettings.set('document', data.doc); @@ -255,35 +255,31 @@ class MainController extends Component { const storeDocumentInfo = this.props.storeDocumentInfo; this.api.asc_registerCallback("asc_onGetDocInfoStart", () => { - // console.log("Start"); - storeDocumentInfo.switchIsLoaded(false); + storeDocumentInfo.switchIsLoaded(false); }); this.api.asc_registerCallback("asc_onGetDocInfoStop", () => { - // console.log("Stop"); - storeDocumentInfo.switchIsLoaded(true); + 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); }); + this.api.asc_registerCallback('asc_onDocumentName', (name) => { + // console.log(name); + }); + // Color Schemes this.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => { - // console.log(arr); storeDocumentSettings.addSchemes(arr); }); - - - // me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onApiDocumentName, me)); - } render() { diff --git a/apps/documenteditor/mobile/src/controller/settings/DocumentInfo.jsx b/apps/documenteditor/mobile/src/controller/settings/DocumentInfo.jsx index 9e004f863..53ceb4ab3 100644 --- a/apps/documenteditor/mobile/src/controller/settings/DocumentInfo.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/DocumentInfo.jsx @@ -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} /> ); } diff --git a/apps/documenteditor/mobile/src/view/settings/DocumentInfo.jsx b/apps/documenteditor/mobile/src/view/settings/DocumentInfo.jsx index 69ac1869b..6a78cb121 100644 --- a/apps/documenteditor/mobile/src/view/settings/DocumentInfo.jsx +++ b/apps/documenteditor/mobile/src/view/settings/DocumentInfo.jsx @@ -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>