diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-10-04 17:24:28 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-10-04 17:24:28 +0200 |
commit | f19a236c8e8c06f2a30212970714d66b68218e15 (patch) | |
tree | 2e90398aa999e7feea16b237b21975136137d478 /core/js | |
parent | 12bb1970280914309ffca8ca796fcac80663c4cf (diff) | |
download | nextcloud-server-f19a236c8e8c06f2a30212970714d66b68218e15.tar.gz nextcloud-server-f19a236c8e8c06f2a30212970714d66b68218e15.zip |
Remove obsolete files.
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/oc-vcategories.js | 216 | ||||
-rw-r--r-- | core/js/oc-vcategories.txt | 33 |
2 files changed, 0 insertions, 249 deletions
diff --git a/core/js/oc-vcategories.js b/core/js/oc-vcategories.js deleted file mode 100644 index c297a24680d..00000000000 --- a/core/js/oc-vcategories.js +++ /dev/null @@ -1,216 +0,0 @@ -var OCCategories= { - category_favorites:'_$!<Favorite>!$_', - edit:function(type, cb) { - if(!type && !this.type) { - throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') }; - } - type = type ? type : this.type; - $('body').append('<div id="category_dialog"></div>'); - $('#category_dialog').load( - OC.filePath('core', 'ajax', 'vcategories/edit.php') + '?type=' + type, function(response) { - try { - var jsondata = jQuery.parseJSON(response); - if(response.status == 'error') { - OC.dialogs.alert(response.data.message, t('core', 'Error')); - return; - } - } catch(e) { - var setEnabled = function(d, enable) { - if(enable) { - d.css('cursor', 'default').find('input,button:not(#category_addbutton)') - .prop('disabled', false).css('cursor', 'default'); - } else { - d.css('cursor', 'wait').find('input,button:not(#category_addbutton)') - .prop('disabled', true).css('cursor', 'wait'); - } - }; - var dlg = $('#edit_categories_dialog').dialog({ - modal: true, - height: 350, minHeight:200, width: 250, minWidth: 200, - buttons: { - 'Close': function() { - $(this).dialog('close'); - }, - 'Delete':function() { - var categories = $('#categorylist').find('input:checkbox').serialize(); - setEnabled(dlg, false); - OCCategories.doDelete(categories, function() { - setEnabled(dlg, true); - }); - }, - 'Rescan':function() { - setEnabled(dlg, false); - OCCategories.rescan(function() { - setEnabled(dlg, true); - }); - } - }, - close : function(event, ui) { - $(this).dialog('destroy').remove(); - $('#category_dialog').remove(); - }, - open : function(event, ui) { - $('#category_addinput').on('input',function() { - if($(this).val().length > 0) { - $('#category_addbutton').removeAttr('disabled'); - } - }); - $('#categoryform').submit(function() { - OCCategories.add($('#category_addinput').val()); - $('#category_addinput').val(''); - $('#category_addbutton').attr('disabled', 'disabled'); - return false; - }); - $('#category_addbutton').on('click',function(e) { - e.preventDefault(); - if($('#category_addinput').val().length > 0) { - OCCategories.add($('#category_addinput').val()); - $('#category_addinput').val(''); - } - }); - } - }); - } - }); - }, - _processDeleteResult:function(jsondata) { - if(jsondata.status == 'success') { - OCCategories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, t('core', 'Error')); - } - }, - favorites:function(type, cb) { - if(!type && !this.type) { - throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') }; - } - type = type ? type : this.type; - $.getJSON(OC.filePath('core', 'ajax', 'categories/favorites.php'), {type: type},function(jsondata) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - if(jsondata.status === 'success') { - OCCategories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, t('core', 'Error')); - } - } - }); - }, - addToFavorites:function(id, type, cb) { - if(!type && !this.type) { - throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') }; - } - type = type ? type : this.type; - $.post(OC.filePath('core', 'ajax', 'vcategories/addToFavorites.php'), {id:id, type:type}, function(jsondata) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - if(jsondata.status !== 'success') { - OC.dialogs.alert(jsondata.data.message, t('core', 'Error')); - } - } - }); - }, - removeFromFavorites:function(id, type, cb) { - if(!type && !this.type) { - throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') }; - } - type = type ? type : this.type; - $.post(OC.filePath('core', 'ajax', 'vcategories/removeFromFavorites.php'), {id:id, type:type}, function(jsondata) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - if(jsondata.status !== 'success') { - OC.dialogs.alert(jsondata.data.message, t('core', 'Error')); - } - } - }); - }, - doDelete:function(categories, type, cb) { - if(!type && !this.type) { - throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') }; - } - type = type ? type : this.type; - if(categories == '' || categories == undefined) { - OC.dialogs.alert(t('core', 'No categories selected for deletion.'), t('core', 'Error')); - return false; - } - var self = this; - var q = categories + '&type=' + type; - if(this.app) { - q += '&app=' + this.app; - $.post(OC.filePath(this.app, 'ajax', 'categories/delete.php'), q, function(jsondata) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - self._processDeleteResult(jsondata); - } - }); - } else { - $.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'), q, function(jsondata) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - self._processDeleteResult(jsondata); - } - }); - } - }, - add:function(category, type, cb) { - if(!type && !this.type) { - throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') }; - } - type = type ? type : this.type; - $.post(OC.filePath('core', 'ajax', 'vcategories/add.php'),{'category':category, 'type':type},function(jsondata) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - if(jsondata.status === 'success') { - OCCategories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, t('core', 'Error')); - } - } - }); - }, - rescan:function(app, cb) { - if(!app && !this.app) { - throw { name: 'MissingParameter', message: t('core', 'The app name is not specified.') }; - } - app = app ? app : this.app; - $.getJSON(OC.filePath(app, 'ajax', 'categories/rescan.php'),function(jsondata, status, xhr) { - if(typeof cb == 'function') { - cb(jsondata); - } else { - if(jsondata.status === 'success') { - OCCategories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, t('core', 'Error')); - } - } - }).error(function(xhr){ - if (xhr.status == 404) { - var errormessage = t('core', 'The required file {file} is not installed!', - {file: OC.filePath(app, 'ajax', 'categories/rescan.php')}, t('core', 'Error')); - if(typeof cb == 'function') { - cb({status:'error', data:{message:errormessage}}); - } else { - OC.dialogs.alert(errormessage, t('core', 'Error')); - } - } - }); - }, - _update:function(categories) { - var categorylist = $('#categorylist'); - categorylist.find('li').remove(); - for(var category in categories) { - var item = '<li><input type="checkbox" name="categories" value="' + categories[category] + '" />' + categories[category] + '</li>'; - $(item).appendTo(categorylist); - } - if(typeof OCCategories.changed === 'function') { - OCCategories.changed(categories); - } - } -} - diff --git a/core/js/oc-vcategories.txt b/core/js/oc-vcategories.txt deleted file mode 100644 index 31216f80bd3..00000000000 --- a/core/js/oc-vcategories.txt +++ /dev/null @@ -1,33 +0,0 @@ -Using OCCategories - -This 'class' is meant for any apps that uses OC_VObjects with the CATEGORIES field e.g. -Contacts and Calendar. It provides an editor UI for adding/deleting and rescanning categories -and basic ajax functions for adding and deleting. -To use the mass updating of OC_VObjects that /lib/vcategories.php provides, the app must implement -its own ajax functions in /apps/$(APP)/ajax/categories/rescan.php and /apps/$(APP)/ajax/categories/delete.php -See examples in /apps/contacts/ajax/categories and the inline docs in /lib/vcategories.php. - -In your app make sure you load the script and stylesheet: - -OC_Util::addScript('','oc-vcategories'); -OC_Util::addStyle('','oc-vcategories'); - -Set the app specific values in your javascript file. This is what I've used for the Contacts app: - - OCCategories.app = 'contacts'; - OCCategories.changed = Contacts.UI.Card.categoriesChanged; - -If OCCategories.changed is set that function will be called each time the categories have been changed -in the editor (add/delete/rescan) to allow the app to update the UI accordingly. The only argument to the function -is an array of the updated categories e.g.: - -OCCategories.changed = function(categories) { - for(var category in categories) { - console.log(categories[category]); - } -} - -To show the categories editor call: - - OCCategories.edit() - |