summaryrefslogtreecommitdiffstats
path: root/settings/js/apps.js
diff options
context:
space:
mode:
Diffstat (limited to 'settings/js/apps.js')
-rw-r--r--settings/js/apps.js55
1 files changed, 40 insertions, 15 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index cf8cd91bd40..d9817aff6b6 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -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,44 +50,64 @@ 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(".warning").show();
+ page.find(".warning").text($('#leftcontent li[data-id="'+app.id+'"]').data('errormsg'));
+ } else {
+ page.find(".warning").hide();
+ }
},
enableApp:function(appid, active, element) {
console.log('enableApp:', appid, active, element);
var appitem=$('#leftcontent li[data-id="'+appid+'"]');
- var appData = appitem.data('app');
- appData.active = !active;
- appitem.data('app', appData);
element.val(t('settings','Please wait....'));
if(active) {
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:appid},function(result) {
if(!result || result.status !== 'success') {
- OC.dialogs.alert('Error while disabling app', t('core', 'Error'));
+ if (result.data && result.data.message) {
+ OC.Settings.Apps.showErrorMessage(result.data.message);
+ appitem.data('errormsg', result.data.message);
+ } else {
+ OC.Settings.Apps.showErrorMessage(t('settings', 'Error while disabling app'));
+ appitem.data('errormsg', t('settings', 'Error while disabling app'));
+ }
+ element.val(t('settings','Disable'));
+ appitem.addClass('appwarning');
}
else {
- element.data('active',false);
+ appitem.data('active',false);
OC.Settings.Apps.removeNavigation(appid);
+ appitem.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') {
- OC.dialogs.alert('Error while enabling app', t('core', 'Error'));
- }
- else {
+ if (result.data && result.data.message) {
+ OC.Settings.Apps.showErrorMessage(result.data.message);
+ appitem.data('errormsg', result.data.message);
+ } else {
+ OC.Settings.Apps.showErrorMessage(t('settings', 'Error while enabling app'));
+ appitem.data('errormsg', t('settings', 'Error while disabling app'));
+ }
+ element.val(t('settings','Enable'));
+ appitem.addClass('appwarning');
+ } else {
OC.Settings.Apps.addNavigation(appid);
- element.data('active',true);
+ appitem.data('active',true);
+ appitem.addClass('active');
element.val(t('settings','Disable'));
}
},'json')
.fail(function() {
- OC.dialogs.alert('Error while enabling app', t('core', 'Error'));
- element.data('active',false);
+ OC.Settings.Apps.showErrorMessage(t('settings', 'Error while enabling app'));
+ appitem.data('errormsg', t('settings', 'Error while enabling app'));
+ appitem.data('active',false);
+ appitem.addClass('appwarning');
OC.Settings.Apps.removeNavigation(appid);
element.val(t('settings','Enable'));
});
- $('#leftcontent li[data-id="'+appid+'"]').addClass('active');
}
},
updateApp:function(appid, element) {
@@ -95,7 +115,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'));
@@ -167,6 +188,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
}
});
+ },
+ showErrorMessage: function(message) {
+ $('.appinfo .warning').show();
+ $('.appinfo .warning').text(message);
}
};