More improvements in the error handling.
This commit is contained in:
parent
b48ae81a99
commit
ea47464459
@ -120,6 +120,8 @@ class DocumentController extends Controller {
|
|||||||
throw new ResponseException($this->l10n->t('Collabora Online: Malformed URL "%s".', array($wopiRemote)), $admin_check);
|
throw new ResponseException($this->l10n->t('Collabora Online: Malformed URL "%s".', array($wopiRemote)), $admin_check);
|
||||||
case '6':
|
case '6':
|
||||||
throw new ResponseException($this->l10n->t('Collabora Online: Cannot resolve the host "%s".', array($wopiRemote)), $admin_check);
|
throw new ResponseException($this->l10n->t('Collabora Online: Cannot resolve the host "%s".', array($wopiRemote)), $admin_check);
|
||||||
|
case '7':
|
||||||
|
throw new ResponseException($this->l10n->t('Collabora Online: Cannot connect to the host "%s".', array($wopiRemote)), $admin_check);
|
||||||
case '60':
|
case '60':
|
||||||
throw new ResponseException($this->l10n->t('Collabora Online: SSL certificate is not installed.'), $this->l10n->t('Please ask your administrator to add CollaboraCloudSuiteCA_ca-chain.cert.pem to the ownCloud\'s ca-bundle.crt, for example "cat /etc/loolwsd/CollaboraCloudSuiteCA_ca-chain.cert.pem >> owncloud/resources/config/ca-bundle.crt" . The exact error message was: ') . $error_message);
|
throw new ResponseException($this->l10n->t('Collabora Online: SSL certificate is not installed.'), $this->l10n->t('Please ask your administrator to add CollaboraCloudSuiteCA_ca-chain.cert.pem to the ownCloud\'s ca-bundle.crt, for example "cat /etc/loolwsd/CollaboraCloudSuiteCA_ca-chain.cert.pem >> owncloud/resources/config/ca-bundle.crt" . The exact error message was: ') . $error_message);
|
||||||
}
|
}
|
||||||
@ -144,7 +146,7 @@ class DocumentController extends Controller {
|
|||||||
*/
|
*/
|
||||||
public function index(){
|
public function index(){
|
||||||
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
||||||
if (($parts = parse_url($wopiRemote))) {
|
if (($parts = parse_url($wopiRemote)) && isset($parts['scheme']) && isset($parts['host'])) {
|
||||||
$webSocketProtocol = "ws://";
|
$webSocketProtocol = "ws://";
|
||||||
if ($parts['scheme'] == "https") {
|
if ($parts['scheme'] == "https") {
|
||||||
$webSocketProtocol = "wss://";
|
$webSocketProtocol = "wss://";
|
||||||
@ -152,7 +154,7 @@ class DocumentController extends Controller {
|
|||||||
$webSocket = sprintf(
|
$webSocket = sprintf(
|
||||||
"%s%s%s",
|
"%s%s%s",
|
||||||
$webSocketProtocol,
|
$webSocketProtocol,
|
||||||
isset($parts['host']) ? $parts['host'] : "",
|
$parts['host'],
|
||||||
isset($parts['port']) ? ":" . $parts['port'] : "");
|
isset($parts['port']) ? ":" . $parts['port'] : "");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -411,12 +413,21 @@ class DocumentController extends Controller {
|
|||||||
|
|
||||||
if ($discovery_parsed === false) {
|
if ($discovery_parsed === false) {
|
||||||
$this->cache->remove('discovery.xml');
|
$this->cache->remove('discovery.xml');
|
||||||
|
$wopiRemote = $this->settings->getAppValue('richdocuments', 'wopi_url');
|
||||||
|
|
||||||
return responseError($this->l10n->t('Collabora Online: discovery.xml from "%s" is not a well-formed XML string.', array($wopiRemote)), $this->l10n->t('Please contact the "%s" administrator.', array($wopiRemote)));
|
return array(
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $this->l10n->t('Collabora Online: discovery.xml from "%s" is not a well-formed XML string.', array($wopiRemote)),
|
||||||
|
'hint' => $this->l10n->t('Please contact the "%s" administrator.', array($wopiRemote))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ResponseException $e) {
|
catch (ResponseException $e) {
|
||||||
return $this->responseError($e->getMessage(), $e->getHint());
|
return array(
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
'hint' => $e->getHint()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileIds = array();
|
$fileIds = array();
|
||||||
|
@ -5,7 +5,9 @@ $.widget('oc.documentGrid', {
|
|||||||
context : '.documentslist',
|
context : '.documentslist',
|
||||||
documents : {},
|
documents : {},
|
||||||
sessions : {},
|
sessions : {},
|
||||||
members : {}
|
members : {},
|
||||||
|
errorMessage : '',
|
||||||
|
errorHint : ''
|
||||||
},
|
},
|
||||||
|
|
||||||
_create : function (){
|
_create : function (){
|
||||||
@ -80,10 +82,25 @@ $.widget('oc.documentGrid', {
|
|||||||
var that = this;
|
var that = this;
|
||||||
var def = new $.Deferred();
|
var def = new $.Deferred();
|
||||||
$.getJSON(OC.generateUrl('apps/richdocuments/ajax/documents/list'))
|
$.getJSON(OC.generateUrl('apps/richdocuments/ajax/documents/list'))
|
||||||
.done(function (data) {
|
.done(function (result) {
|
||||||
that.options.documents = data.documents;
|
if (!result || result.status === 'error') {
|
||||||
that.options.sessions = data.sessions;
|
documentsMain.loadError = true;
|
||||||
that.options.members = data.members;
|
if (result && result.message) {
|
||||||
|
that.options.errorMessage = result.message;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
that.options.errorMessage = t('richdocuments', 'Failed to load the document, please contact your administrator.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result && result.hint) {
|
||||||
|
that.options.errorHint = result.hint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
that.options.documents = result.documents;
|
||||||
|
that.options.sessions = result.sessions;
|
||||||
|
that.options.members = result.members;
|
||||||
|
}
|
||||||
def.resolve();
|
def.resolve();
|
||||||
})
|
})
|
||||||
.fail(function(data){
|
.fail(function(data){
|
||||||
@ -102,6 +119,15 @@ $.widget('oc.documentGrid', {
|
|||||||
|
|
||||||
$(this.options.context + ' .document:not(.template,.progress)').remove();
|
$(this.options.context + ' .document:not(.template,.progress)').remove();
|
||||||
|
|
||||||
|
if (documentsMain.loadError) {
|
||||||
|
$(this.options.context).after('<div id="errormessage">'
|
||||||
|
+ '<p>' + this.options.errorMessage + '</p><p>'
|
||||||
|
+ this.options.errorHint
|
||||||
|
+ '</p></div>'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$.each(documents, function(i, document){
|
$.each(documents, function(i, document){
|
||||||
hasDocuments = true;
|
hasDocuments = true;
|
||||||
that.add(document);
|
that.add(document);
|
||||||
@ -155,6 +181,7 @@ var documentsMain = {
|
|||||||
fileName: null,
|
fileName: null,
|
||||||
baseName: null,
|
baseName: null,
|
||||||
canShare : false,
|
canShare : false,
|
||||||
|
loadError : false,
|
||||||
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>',
|
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>',
|
||||||
|
|
||||||
UI : {
|
UI : {
|
||||||
@ -310,7 +337,7 @@ var documentsMain = {
|
|||||||
|
|
||||||
documentsMain.show();
|
documentsMain.show();
|
||||||
|
|
||||||
if (fileId){
|
if (fileId && !documentMain.loadError) {
|
||||||
documentsMain.overlay.documentOverlay('show');
|
documentsMain.overlay.documentOverlay('show');
|
||||||
documentsMain.prepareSession();
|
documentsMain.prepareSession();
|
||||||
documentsMain.joinSession(fileId);
|
documentsMain.joinSession(fileId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user