Don't use an alert for displaying app-mgmt-errors
Rather display a dominant div and mark the problematic app in the applist. Fix #305
This commit is contained in:
parent
c741a25eaa
commit
9f4bd7cb47
4 changed files with 45 additions and 11 deletions
|
@ -141,7 +141,7 @@ class OC_Installer{
|
|||
// check if shipped tag is set which is only allowed for apps that are shipped with ownCloud
|
||||
if(isset($info['shipped']) and ($info['shipped']=='true')) {
|
||||
OC_Helper::rmdirr($extractDir);
|
||||
throw new \Exception($l->t("App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps"));
|
||||
throw new \Exception($l->t("App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps"));
|
||||
}
|
||||
|
||||
// check if the ocs version is the same as the version in info.xml/version
|
||||
|
|
|
@ -61,7 +61,7 @@ select.quota.active { background: #fff; }
|
|||
.ie8 table.hascontrols tbody tr{border-collapse:collapse;border: 1px solid #ddd !important;}
|
||||
|
||||
/* APPS */
|
||||
.appinfo { margin: 1em; }
|
||||
.appinfo { margin: 1em 40px; }
|
||||
h3 { font-size: 1.4em; font-weight: bold; }
|
||||
ul.applist a {
|
||||
height: 2.2em;
|
||||
|
@ -72,6 +72,12 @@ ul.applist .app-external {
|
|||
}
|
||||
li { color:#888; }
|
||||
li.active { color:#000; }
|
||||
#leftcontent .appwarning {
|
||||
background: #fcc;
|
||||
}
|
||||
#leftcontent .appwarning:hover {
|
||||
background: #fbb;
|
||||
}
|
||||
small.externalapp { color:#FFF; background-color:#BBB; font-weight:bold; font-size: 0.6em; margin: 0; padding: 0.1em 0.2em; border-radius: 4px;}
|
||||
small.externalapp.list { float: right; }
|
||||
small.recommendedapp { color:#FFF; background-color:#888; font-weight:bold; font-size: 0.6em; margin: 0; padding: 0.1em 0.2em; border-radius: 4px;}
|
||||
|
@ -86,6 +92,14 @@ span.version { margin-left:1em; margin-right:1em; color:#555; }
|
|||
|
||||
.appslink { text-decoration: underline; }
|
||||
.score { color:#666; font-weight:bold; font-size:0.8em; }
|
||||
.errormsg {
|
||||
margin: 20px;
|
||||
padding: 5px;
|
||||
background: #fdd;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* LOG */
|
||||
#log { white-space:normal; }
|
||||
|
|
|
@ -27,7 +27,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
}
|
||||
page.find('small.externalapp').attr('style', 'visibility:visible');
|
||||
page.find('span.author').text(app.author);
|
||||
page.find('span.licence').text(app.licence);
|
||||
page.find('span.licence').text(app.license);
|
||||
|
||||
if (app.update !== false) {
|
||||
page.find('input.update').show();
|
||||
|
@ -50,6 +50,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
page.find('p.appslink').hide();
|
||||
page.find('span.score').hide();
|
||||
}
|
||||
if (typeof($('#leftcontent li[data-id="'+app.id+'"]').data('errormsg')) !== "undefined") {
|
||||
page.find(".errormsg").show();
|
||||
page.find(".errormsg").text($('#leftcontent li[data-id="'+app.id+'"]').data('errormsg'));
|
||||
} else {
|
||||
page.find(".errormsg").hide();
|
||||
}
|
||||
},
|
||||
enableApp:function(appid, active, element) {
|
||||
console.log('enableApp:', appid, active, element);
|
||||
|
@ -62,40 +68,48 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:appid},function(result) {
|
||||
if(!result || result.status !== 'success') {
|
||||
if (result.data && result.data.message) {
|
||||
OC.dialogs.alert(result.data.message, t('core', 'Error'));
|
||||
OC.Settings.Apps.showErrorMessage(result.data.message);
|
||||
$('#leftcontent li[data-id="'+appid+'"]').data('errormsg', result.data.message);
|
||||
} else {
|
||||
OC.dialogs.alert(t('settings', 'Error while disabling app'), t('core', 'Error'));
|
||||
OC.Settings.Apps.showErrorMessage(t('settings', 'Error while disabling app'));
|
||||
$('#leftcontent li[data-id="'+appid+'"]').data('errormsg', t('settings', 'Error while disabling app'));
|
||||
}
|
||||
element.val(t('settings','Disable'));
|
||||
$('#leftcontent li[data-id="'+appid+'"]').addClass('appwarning');
|
||||
}
|
||||
else {
|
||||
element.data('active',false);
|
||||
OC.Settings.Apps.removeNavigation(appid);
|
||||
$('#leftcontent li[data-id="'+appid+'"]').removeClass('active');
|
||||
element.val(t('settings','Enable'));
|
||||
}
|
||||
},'json');
|
||||
$('#leftcontent li[data-id="'+appid+'"]').removeClass('active');
|
||||
} else {
|
||||
$.post(OC.filePath('settings','ajax','enableapp.php'),{appid:appid},function(result) {
|
||||
if(!result || result.status !== 'success') {
|
||||
if (result.data && result.data.message) {
|
||||
OC.dialogs.alert(result.data.message, t('core', 'Error'));
|
||||
OC.Settings.Apps.showErrorMessage(result.data.message);
|
||||
$('#leftcontent li[data-id="'+appid+'"]').data('errormsg', result.data.message);
|
||||
} else {
|
||||
OC.dialogs.alert(t('settings', 'Error while enabling app'), t('core', 'Error'));
|
||||
OC.Settings.Apps.showErrorMessage(t('settings', 'Error while enabling app'));
|
||||
$('#leftcontent li[data-id="'+appid+'"]').data('errormsg', t('settings', 'Error while disabling app'));
|
||||
}
|
||||
element.val(t('settings','Enable'));
|
||||
$('#leftcontent li[data-id="'+appid+'"]').addClass('appwarning');
|
||||
} else {
|
||||
OC.Settings.Apps.addNavigation(appid);
|
||||
element.data('active',true);
|
||||
$('#leftcontent li[data-id="'+appid+'"]').addClass('active');
|
||||
element.val(t('settings','Disable'));
|
||||
}
|
||||
},'json')
|
||||
.fail(function() {
|
||||
OC.dialogs.alert(t('settings', 'Error while enabling app'), t('core', 'Error'));
|
||||
OC.Settings.Apps.showErrorMessage(t('settings', 'Error while enabling app'));
|
||||
$('#leftcontent li[data-id="'+appid+'"]').data('errormsg', t('settings', 'Error while enabling app'));
|
||||
element.data('active',false);
|
||||
OC.Settings.Apps.removeNavigation(appid);
|
||||
element.val(t('settings','Enable'));
|
||||
});
|
||||
$('#leftcontent li[data-id="'+appid+'"]').addClass('active');
|
||||
}
|
||||
},
|
||||
updateApp:function(appid, element) {
|
||||
|
@ -103,7 +117,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
element.val(t('settings','Updating....'));
|
||||
$.post(OC.filePath('settings','ajax','updateapp.php'),{appid:appid},function(result) {
|
||||
if(!result || result.status !== 'success') {
|
||||
OC.dialogs.alert(t('settings','Error while updating app'),t('settings','Error'));
|
||||
OC.Settings.Apps.showErrorMessage(t('settings','Error while updating app'),t('settings','Error'));
|
||||
element.val(t('settings','Update'));
|
||||
}
|
||||
else {
|
||||
element.val(t('settings','Updated'));
|
||||
|
@ -175,6 +190,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
showErrorMessage: function(message) {
|
||||
$('#rightcontent .errormsg').show();
|
||||
$('#rightcontent .errormsg').text(message);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -41,5 +41,6 @@
|
|||
print_unescaped($l->t('<span class="licence"></span>-licensed by <span class="author"></span>'));?></p>
|
||||
<input class="enable hidden" type="submit" />
|
||||
<input class="update hidden" type="submit" value="<?php p($l->t('Update')); ?>" />
|
||||
<div class="errormsg hidden"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue