HFP-3095 Add error message if unable to contact hub

Fix translation
Update hub registration ui
content-hub
Thomas Marstrander 2020-09-09 13:26:46 +02:00
parent 67bce48842
commit 917a9b6ccb
No known key found for this signature in database
GPG Key ID: 59D7F1EC8B90E9A6
3 changed files with 11 additions and 7 deletions

View File

@ -3677,7 +3677,7 @@ class H5PCore {
'helpChoosingLicense' => $this->h5pF->t('Help me choose a license'), 'helpChoosingLicense' => $this->h5pF->t('Help me choose a license'),
'shareFailed' => $this->h5pF->t('Share failed.'), 'shareFailed' => $this->h5pF->t('Share failed.'),
'editingFailed' => $this->h5pF->t('Editing failed.'), 'editingFailed' => $this->h5pF->t('Editing failed.'),
'shareTryAgain' => $this->h5pF->t('Something went wrong, please try to share agian.'), 'shareTryAgain' => $this->h5pF->t('Something went wrong, please try to share again.'),
'pleaseWait' => $this->h5pF->t('Please wait...'), 'pleaseWait' => $this->h5pF->t('Please wait...'),
'language' => $this->h5pF->t('Language'), 'language' => $this->h5pF->t('Language'),
'level' => $this->h5pF->t('Level'), 'level' => $this->h5pF->t('Level'),
@ -3774,6 +3774,10 @@ class H5PCore {
throw new Exception($this->h5pF->t('Unable to authorize with the H5P Hub. Please check your Hub registration and connection.')); throw new Exception($this->h5pF->t('Unable to authorize with the H5P Hub. Please check your Hub registration and connection.'));
} }
if (isset($response['status']) && $response['status'] !== 200) {
throw new Exception($this->h5pF->t('Connecting to the content hub failed, please try again later.'));
}
$result = json_decode($response['data']); $result = json_decode($response['data']);
if (isset($result->success) && $result->success === TRUE) { if (isset($result->success) && $result->success === TRUE) {
return $result; return $result;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long