Skip to content

Commit 4105758

Browse files
author
Barry de Graaff
committed
fix nextcloud ZBUG-3313 ZESC-2239
1 parent 581bbfe commit 4105758

File tree

11 files changed

+95
-26
lines changed

11 files changed

+95
-26
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "zimbra-zimlet-nextcloud",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"license": "Network Edition License",
66
"description": "Nextcloud integration for Zimbra",
77
"main": "build/index.js",

package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
npm install
44
zimlet build
5-
zimlet package -v 1.1.0 --zimbraXVersion ">=2.0.0" -n "zimbra-zimlet-nextcloud" --desc "Nextcloud integration for Zimbra" -l "Nextcloud Zimlet"
5+
zimlet package -v 1.2.0 --zimbraXVersion ">=2.0.0" -n "zimbra-zimlet-nextcloud" --desc "Nextcloud integration for Zimbra" -l "Nextcloud Zimlet"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createElement } from 'preact';
2+
3+
export default function createAttacherDom(context) {
4+
console.log('ergerthgerth');
5+
return props => (
6+
<div id="nextcloudAttacherDOM"></div>
7+
);
8+
}

src/components/more-menu/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ export default class MoreMenu extends Component {
113113
<tr><td>{this._props.folderCurrent}: </td><td style="width:80%"><input readonly class="zimbra-client_text-input_input" style="width:100%" id="nextcloudFolder"></input></td></tr>
114114
</table>
115115
<div onClick={this.DAVItemListClick} id="nextcloudPropfind" style="width:100%; padding-left:10px; max-height:500px; overflow-y: scroll; overflow-x:hidden"></div>
116+
<button type="button" onClick={this.handleSave} class="blocks_button_button blocks_button_primary blocks_button_regular zimbra-client_sidebar-primary-button_button">OK</button>
116117
</div>
117-
<footer class="zimbra-client_modal-dialog_footer" id="nextcloudDialogButtons"><button type="button" onClick={this.handleSave} class="blocks_button_button blocks_button_primary blocks_button_regular zimbra-client_sidebar-primary-button_button">OK</button></footer>
118118
</div>
119119
</ModalDialog>
120120
);
121121

122122
const { dispatch } = this.zimletContext.store;
123-
dispatch(this.zimletContext.zimletRedux.actions.zimlets.addModal({ id: 'addEventModal', modal: this.modal }));
123+
dispatch(this.zimletContext.zimletRedux.actions.zimlets.addModal({ id: 'saveToNextcloudModal', modal: this.modal }));
124124
this.doPropFind("/");
125125
}
126126

@@ -156,7 +156,7 @@ export default class MoreMenu extends Component {
156156

157157
handleClose = e => {
158158
const { dispatch } = this.zimletContext.store;
159-
dispatch(this.zimletContext.zimletRedux.actions.zimlets.addModal({ id: 'addEventModal' }));
159+
dispatch(this.zimletContext.zimletRedux.actions.zimlets.addModal({ id: 'saveToNextcloudModal' }));
160160

161161
//only available in attachment-single-action
162162
try {

src/components/nextcloud-attacher/index.js

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createElement, Component, render } from 'preact';
22
import { Text, withText } from 'preact-i18n';
33
import { withIntl } from '../../enhancers';
4-
import { ActionMenuGroup, ActionMenuItem, NestedActionMenuItem } from '@zimbra-client/components';
4+
import { ModalDialog, ActionMenuGroup, ActionMenuItem, NestedActionMenuItem } from '@zimbra-client/components';
55
import style from './style';
66
import { getOCSPath, getDAVPath, getName, getTimeDate, getSize, sanitizeFileName, getParentPath } from '../../utils';
77
import RenderPropfind from '../render-propfind';
@@ -24,6 +24,9 @@ import RenderPropfind from '../render-propfind';
2424
shareLinkPassword: 'nextcloud-zimlet-modern.shareLinkPassword',
2525
expirationDate: 'nextcloud-zimlet-modern.expirationDate',
2626
plainTextShareLink: 'nextcloud-zimlet-modern.plainTextShareLink',
27+
attachFromNextcloud: 'nextcloud-zimlet-modern.attachFromNextcloud',
28+
attachedOK: 'nextcloud-zimlet-modern.attachedOK',
29+
linkInserted: 'nextcloud-zimlet-modern.linkInserted'
2730
})
2831
export default class NextcloudAttacher extends Component {
2932
constructor(props) {
@@ -89,6 +92,7 @@ export default class NextcloudAttacher extends Component {
8992
if(!editor.isPlainText())
9093
{
9194
editor.insertLinksAtCaret([OCSResponse]);
95+
this.alert(this.props.linkInserted);
9296
}
9397
else
9498
{
@@ -112,6 +116,7 @@ export default class NextcloudAttacher extends Component {
112116
else if (attachType == "attach") {
113117
editor.addAttachments([file], false);
114118
}
119+
this.alert(this.props.attachedOK);
115120
}
116121
} else {
117122
this.alert(this.props.AttachFailure);
@@ -122,20 +127,52 @@ export default class NextcloudAttacher extends Component {
122127
}
123128

124129
showDialog = (editor, attachType) => {
125-
let display = window.parent.document.getElementsByClassName("zimbra-client_composer_right");
126-
let dialog = <div><div id="shareLinkOptions" style="margin:5px;margin-bottom:15px"><input id="linkSharePassword" placeholder={this.props.shareLinkPassword} value=""></input> {this.props.expirationDate} : <input type="date" id="expirationDate" name="expirationDate" value=""></input></div><div onClick={e => this.DAVItemListClick(e, editor, attachType)} id="nextcloudPropfind" style="width:100%; padding-left:10px; overflow:scroll; height:100%"></div></div>
127-
display[0].style.minWidth = "600px";
128-
render(dialog, display[0]);
129-
if (attachType == "attachAsLink") {
130-
window.parent.document.getElementById("shareLinkOptions").style.display = "block";
131-
window.parent.document.getElementById("expirationDate").min = (new Date(Date.now() + 1 * 24 * 60 * 60 * 1000)).toISOString().slice(0,10);
132-
}
133-
else{
134-
window.parent.document.getElementById("shareLinkOptions").style.display = "none";
130+
const minDate = (new Date(Date.now() + 1 * 24 * 60 * 60 * 1000)).toISOString().slice(0,10);
131+
132+
switch (attachType) {
133+
case 'attach':
134+
this.modalTitle = this.props.attachFromNextcloud;
135+
this.displayShareLinkOptions = "none";
136+
break;
137+
case 'attachInline':
138+
this.modalTitle = this.props.attachInline
139+
this.displayShareLinkOptions = "none";
140+
break;
141+
case 'attachAsLink':
142+
this.modalTitle = this.props.attachAsLink;
143+
this.displayShareLinkOptions = "block";
144+
break;
135145
}
146+
147+
this.modal = (
148+
<ModalDialog
149+
class={style.modalDialog}
150+
contentClass={style.modalContent}
151+
innerClass={style.inner}
152+
onClose={this.handleClose}
153+
cancelButton={false}
154+
header={false}
155+
footer={false}
156+
>
157+
<div class="zimbra-client_modal-dialog_inner"><header class="zimbra-client_modal-dialog_header"><h2>{this.modalTitle}</h2><button onClick={this.handleClose} aria-label="Close" class="zimbra-client_close-button_close zimbra-client_modal-dialog_actionButton"><span role="img" class="zimbra-icon zimbra-icon-close blocks_icon_md"></span></button></header>
158+
<div class="zimbra-client_modal-dialog_content zimbra-client_language-modal_languageModalContent"><div style={{display:this.displayShareLinkOptions}}><div style="margin:5px;margin-bottom:15px"><input id="linkSharePassword" placeholder={this.props.shareLinkPassword} value=""></input> {this.props.expirationDate} : <input type="date" min={minDate} id="expirationDate" name="expirationDate" value=""></input></div></div><div onClick={e => this.DAVItemListClick(e, editor, attachType)} id="nextcloudPropfind" style="width:100%; padding-left:10px; overflow:scroll; max-height:400px"></div>
159+
<button type="button" onClick={this.handleClose} class="blocks_button_button blocks_button_primary blocks_button_regular zimbra-client_sidebar-primary-button_button">OK</button>
160+
</div>
161+
</div>
162+
</ModalDialog>
163+
);
164+
165+
const { dispatch } = this.zimletContext.store;
166+
dispatch(this.zimletContext.zimletRedux.actions.zimlets.addModal({ id: 'attachFromNextcloudModal', modal: this.modal }));
167+
136168
this.doPropFind("/");
137169
}
138170

171+
handleClose = e => {
172+
const { dispatch } = this.zimletContext.store;
173+
dispatch(this.zimletContext.zimletRedux.actions.zimlets.addModal({ id: 'attachFromNextcloudModal' }));
174+
}
175+
139176
doPropFind = (path) => {
140177
let fakeEmailData = {}
141178
fakeEmailData.nextcloudAction = "propfind";

src/components/nextcloud-attacher/style.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525

2626
.spinner {
2727
margin-left: 10px;
28-
}
28+
}

src/intl/ca.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
"attachAsLink": "Adjunta com a enllaç",
2020
"shareLinkPassword": "Contrasenya per a l'enllaç compartit",
2121
"expirationDate": "Data de caducitat de l'enllaç compartit",
22-
"plainTextShareLink": "Copieu i enganxeu l'enllaç per compartir al vostre correu electrònic"
23-
}
22+
"plainTextShareLink": "Copieu i enganxeu l'enllaç per compartir al vostre correu electrònic",
23+
"attachFromNextcloud": "Attach from Nextcloud",
24+
"attachedOK":"Document attached!",
25+
"linkInserted":"Link inserted!"
26+
},
27+
"zimlet": {
28+
"description": "Nextcloud integration for Zimbra",
29+
"label": "Nextcloud"
30+
}
2431
}

src/intl/de.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
"attachAsLink": "Als Link anhängen",
2020
"shareLinkPassword": "Passwort für geteilten Link",
2121
"expirationDate": "Ablaufdatum für geteilten Link",
22-
"plainTextShareLink": "Geteilten Link kopieren und in Ihre Mail einfügen"
23-
}
22+
"plainTextShareLink": "Geteilten Link kopieren und in Ihre Mail einfügen",
23+
"attachFromNextcloud": "Anhängen von Nextcloud",
24+
"attachedOK":"Dokument beigefügt!",
25+
"linkInserted":"Link eingefügt!"
26+
},
27+
"zimlet": {
28+
"description": "Nextcloud integration for Zimbra",
29+
"label": "Nextcloud"
30+
}
2431
}

src/intl/en_US.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
"attachAsLink" : "Attach as link",
2020
"shareLinkPassword": "Password for shared link",
2121
"expirationDate": "Expiration date for shared link",
22-
"plainTextShareLink":"Copy and paste the share link to your email"
22+
"plainTextShareLink":"Copy and paste the share link to your email",
23+
"attachFromNextcloud": "Attach from Nextcloud",
24+
"attachedOK":"Document attached!",
25+
"linkInserted":"Link inserted!"
2326
},
2427
"zimlet": {
2528
"description": "Nextcloud integration for Zimbra",

0 commit comments

Comments
 (0)