Fix categories delete fallback when there is no app specific ajax categories delete function
This commit is contained in:
parent
815649dbd7
commit
bc81179163
|
@ -17,7 +17,7 @@ function debug($msg) {
|
||||||
|
|
||||||
require_once('../../../lib/base.php');
|
require_once('../../../lib/base.php');
|
||||||
OC_JSON::checkLoggedIn();
|
OC_JSON::checkLoggedIn();
|
||||||
$app = isset($_GET['app'])?$_GET['app']:null;
|
$app = isset($_POST['app'])?$_POST['app']:null;
|
||||||
$categories = isset($_POST['categories'])?$_POST['categories']:null;
|
$categories = isset($_POST['categories'])?$_POST['categories']:null;
|
||||||
if(is_null($app)) {
|
if(is_null($app)) {
|
||||||
bailOut(OC_Contacts_App::$l10n->t('Application name not provided.'));
|
bailOut(OC_Contacts_App::$l10n->t('Application name not provided.'));
|
||||||
|
|
|
@ -53,25 +53,21 @@ OCCategories={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
_processDeleteResult:function(jsondata, status, xhr){
|
||||||
|
if(jsondata.status == 'success'){
|
||||||
|
OCCategories._update(jsondata.data.categories);
|
||||||
|
} else {
|
||||||
|
OC.dialogs.alert(jsondata.data.message, 'Error');
|
||||||
|
}
|
||||||
|
},
|
||||||
doDelete:function(){
|
doDelete:function(){
|
||||||
var categories = $('#categorylist').find('input[type="checkbox"]').serialize();
|
var categories = $('#categorylist').find('input[type="checkbox"]').serialize();
|
||||||
categories += '&app=' + OCCategories.app;
|
categories += '&app=' + OCCategories.app;
|
||||||
console.log('OCCategories.delete: ' + categories);
|
console.log('OCCategories.delete: ' + categories);
|
||||||
$.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'),categories,function(jsondata, status, xhr){
|
$.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'), categories, OCCategories._processDeleteResult)
|
||||||
if (status == 'error' && xhr.status == 404) {
|
.error(function(xhr){
|
||||||
$.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'),categories,function(jsondata, status, xhr){
|
if (xhr.status == 404) {
|
||||||
if(jsondata.status == 'success'){
|
$.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'), categories, OCCategories._processDeleteResult);
|
||||||
OCCategories._update(jsondata.data.categories);
|
|
||||||
} else {
|
|
||||||
OC.dialogs.alert(jsondata.data.message, 'Error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(jsondata.status == 'success'){
|
|
||||||
OCCategories._update(jsondata.data.categories);
|
|
||||||
} else {
|
|
||||||
OC.dialogs.alert(jsondata.data.message, 'Error');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue