VCategories: Check if any categories are selected before json call. Add Close button. Remove log calls.
This commit is contained in:
parent
e61e40c23d
commit
8d1754041e
|
@ -1,6 +1,5 @@
|
||||||
OCCategories={
|
OCCategories={
|
||||||
edit:function(){
|
edit:function(){
|
||||||
console.log('OCCategories.edit');
|
|
||||||
if(OCCategories.app == undefined) {
|
if(OCCategories.app == undefined) {
|
||||||
OC.dialogs.alert('OCCategories.app is not set!');
|
OC.dialogs.alert('OCCategories.app is not set!');
|
||||||
return;
|
return;
|
||||||
|
@ -18,6 +17,9 @@ OCCategories={
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 350, minHeight:200, width: 250, minWidth: 200,
|
height: 350, minHeight:200, width: 250, minWidth: 200,
|
||||||
buttons: {
|
buttons: {
|
||||||
|
'Close': function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
},
|
||||||
'Delete':function() {
|
'Delete':function() {
|
||||||
OCCategories.doDelete();
|
OCCategories.doDelete();
|
||||||
},
|
},
|
||||||
|
@ -61,9 +63,12 @@ OCCategories={
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doDelete:function(){
|
doDelete:function(){
|
||||||
var categories = $('#categorylist').find('input[type="checkbox"]').serialize();
|
var categories = $('#categorylist').find('input:checkbox').serialize();
|
||||||
|
if(categories == '' || categories == undefined) {
|
||||||
|
OC.dialogs.alert(t('core', 'No categories selected for deletion.'), t('core', 'Error'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
categories += '&app=' + OCCategories.app;
|
categories += '&app=' + OCCategories.app;
|
||||||
console.log('OCCategories.delete: ' + categories);
|
|
||||||
$.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'), categories, OCCategories._processDeleteResult)
|
$.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'), categories, OCCategories._processDeleteResult)
|
||||||
.error(function(xhr){
|
.error(function(xhr){
|
||||||
if (xhr.status == 404) {
|
if (xhr.status == 404) {
|
||||||
|
@ -72,7 +77,6 @@ OCCategories={
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
add:function(category){
|
add:function(category){
|
||||||
console.log('OCCategories.add ' + category);
|
|
||||||
$.getJSON(OC.filePath('core', 'ajax', 'vcategories/add.php'),{'category':category, 'app':OCCategories.app},function(jsondata){
|
$.getJSON(OC.filePath('core', 'ajax', 'vcategories/add.php'),{'category':category, 'app':OCCategories.app},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
OCCategories._update(jsondata.data.categories);
|
OCCategories._update(jsondata.data.categories);
|
||||||
|
@ -83,7 +87,6 @@ OCCategories={
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
rescan:function(){
|
rescan:function(){
|
||||||
console.log('Categories.rescan');
|
|
||||||
$.getJSON(OC.filePath(OCCategories.app, 'ajax', 'categories/rescan.php'),function(jsondata, status, xhr){
|
$.getJSON(OC.filePath(OCCategories.app, 'ajax', 'categories/rescan.php'),function(jsondata, status, xhr){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
OCCategories._update(jsondata.data.categories);
|
OCCategories._update(jsondata.data.categories);
|
||||||
|
|
Loading…
Reference in New Issue