summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlib/app.php11
-rw-r--r--settings/ajax/disableapp.php2
-rw-r--r--settings/ajax/enableapp.php8
-rw-r--r--settings/js/apps.js12
4 files changed, 24 insertions, 9 deletions
diff --git a/lib/app.php b/lib/app.php
index 1c81fbd4242..807d8955d8f 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -139,13 +139,18 @@ class OC_App{
if(!is_numeric($app)){
OC_Installer::installShippedApp($app);
}else{
- $download=OC_OCSClient::getApplicationDownload($app,1);
- if(isset($download['downloadlink']) and $download['downloadlink']<>'') {
+ $download=OC_OCSClient::getApplicationDownload($app,1);
+ if(isset($download['downloadlink']) and $download['downloadlink']!='') {
$app=OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink']));
}
}
}
- OC_Appconfig::setValue( $app, 'enabled', 'yes' );
+ if($app!==false){
+ OC_Appconfig::setValue( $app, 'enabled', 'yes' );
+ return true;
+ }else{
+ return false;
+ }
}
/**
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
index 06dd3c2ac6b..53e9be379e1 100644
--- a/settings/ajax/disableapp.php
+++ b/settings/ajax/disableapp.php
@@ -6,4 +6,4 @@ OC_JSON::setContentTypeHeader();
OC_App::disable($_POST['appid']);
-?>
+OC_JSON::success();
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php
index 639df2aecc0..cb116ebe4e8 100644
--- a/settings/ajax/enableapp.php
+++ b/settings/ajax/enableapp.php
@@ -5,6 +5,8 @@ require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
OC_JSON::setContentTypeHeader();
-OC_App::enable($_POST['appid']);
-
-?>
+if(OC_App::enable($_POST['appid'])){
+ OC_JSON::success();
+}else{
+ OC_JSON::error();
+}
diff --git a/settings/js/apps.js b/settings/js/apps.js
index e2f882c6fec..0f9181a2c75 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -28,10 +28,18 @@ $(document).ready(function(){
var active=$(this).data('active');
if(app){
if(active){
- $.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app});
+ $.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app},function(result){
+ if(!result || result.status!='succes'){
+ OC.dialogs.alert('Error','Error while enabling app');
+ }
+ },'json');
$('#leftcontent li[data-id="'+app+'"]').removeClass('active');
}else{
- $.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app});
+ $.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app},function(result){
+ if(!result || result.status!='succes'){
+ OC.dialogs.alert('Error','Error while disabling app');
+ }
+ },'json');
$('#leftcontent li[data-id="'+app+'"]').addClass('active');
}
active=!active;