show error when installing an app has failed

This commit is contained in:
Robin Appelman 2012-04-14 12:57:03 +02:00
parent d3bf013761
commit d8864d4f4b
4 changed files with 24 additions and 9 deletions

View File

@ -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;
}
}
/**

View File

@ -6,4 +6,4 @@ OC_JSON::setContentTypeHeader();
OC_App::disable($_POST['appid']);
?>
OC_JSON::success();

View File

@ -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();
}

View File

@ -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;