diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-10-19 00:06:18 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-10-19 00:06:18 +0200 |
commit | f4fd4a5a529aac331c7453bc1d3372da5c71f05c (patch) | |
tree | 315f6cbae6bf4c643c2c1abb9b472fe80702ea8e /core/ajax | |
parent | 72f2f53e24af0ced5090998eedfd7c13874060f3 (diff) | |
download | nextcloud-server-f4fd4a5a529aac331c7453bc1d3372da5c71f05c.tar.gz nextcloud-server-f4fd4a5a529aac331c7453bc1d3372da5c71f05c.zip |
Updated category ajax files to use type instead of app and add callCheck.
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/vcategories/add.php | 21 | ||||
-rw-r--r-- | core/ajax/vcategories/delete.php | 24 | ||||
-rw-r--r-- | core/ajax/vcategories/edit.php | 15 |
3 files changed, 35 insertions, 25 deletions
diff --git a/core/ajax/vcategories/add.php b/core/ajax/vcategories/add.php index 81fa06dbf19..e97612c28f2 100644 --- a/core/ajax/vcategories/add.php +++ b/core/ajax/vcategories/add.php @@ -15,23 +15,26 @@ function debug($msg) { } require_once '../../../lib/base.php'; -OC_JSON::checkLoggedIn(); -$category = isset($_GET['category'])?strip_tags($_GET['category']):null; -$app = isset($_GET['app'])?$_GET['app']:null; -if(is_null($app)) { - bailOut(OC_Contacts_App::$l10n->t('Application name not provided.')); -} +OCP\JSON::checkLoggedIn(); +OCP\JSON::callCheck(); + +$l = OC_L10N::get('core'); -OC_JSON::checkAppEnabled($app); +$category = isset($_POST['category']) ? strip_tags($_POST['category']) : null; +$type = isset($_POST['type']) ? $_POST['type'] : null; + +if(is_null($type)) { + bailOut($l->t('Category type not provided.')); +} if(is_null($category)) { - bailOut(OC_Contacts_App::$l10n->t('No category to add?')); + bailOut($l->t('No category to add?')); } debug(print_r($category, true)); -$categories = new OC_VCategories($app); +$categories = new OC_VCategories($type); if($categories->hasCategory($category)) { bailOut(OC_Contacts_App::$l10n->t('This category already exists: '.$category)); } else { diff --git a/core/ajax/vcategories/delete.php b/core/ajax/vcategories/delete.php index cd46a25b79d..fd7b71be5d3 100644 --- a/core/ajax/vcategories/delete.php +++ b/core/ajax/vcategories/delete.php @@ -16,21 +16,25 @@ function debug($msg) { } require_once '../../../lib/base.php'; -OC_JSON::checkLoggedIn(); -$app = isset($_POST['app'])?$_POST['app']:null; -$categories = isset($_POST['categories'])?$_POST['categories']:null; -if(is_null($app)) { - bailOut(OC_Contacts_App::$l10n->t('Application name not provided.')); -} -OC_JSON::checkAppEnabled($app); +OCP\JSON::checkLoggedIn(); +OCP\JSON::callCheck(); + +$l = OC_L10N::get('core'); + +$type = isset($_POST['type']) ? $_POST['type'] : null; +$categories = isset($_POST['categories']) ? $_POST['categories'] : null; + +if(is_null($type)) { + bailOut($l->t('Object type not provided.')); +} -debug('The application "'.$app.'" uses the default file. OC_VObjects will not be updated.'); +debug('The application using category type "' . $type . '" uses the default file for deletion. OC_VObjects will not be updated.'); if(is_null($categories)) { - bailOut('No categories selected for deletion.'); + bailOut($l->t('No categories selected for deletion.')); } -$vcategories = new OC_VCategories($app); +$vcategories = new OC_VCategories($type); $vcategories->delete($categories); OC_JSON::success(array('data' => array('categories'=>$vcategories->categories()))); diff --git a/core/ajax/vcategories/edit.php b/core/ajax/vcategories/edit.php index a0e67841c55..4e9c9c17b55 100644 --- a/core/ajax/vcategories/edit.php +++ b/core/ajax/vcategories/edit.php @@ -17,16 +17,19 @@ function debug($msg) { require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); -$app = isset($_GET['app'])?$_GET['app']:null; -if(is_null($app)) { - bailOut('Application name not provided.'); +$l = OC_L10N::get('core'); + +$type = isset($_GET['type']) ? $_GET['type'] : null; + +if(is_null($type)) { + bailOut($l->t('Category type not provided.')); } -OC_JSON::checkAppEnabled($app); -$tmpl = new OC_TEMPLATE("core", "edit_categories_dialog"); +OC_JSON::checkAppEnabled($type); +$tmpl = new OCP\Template("core", "edit_categories_dialog"); -$vcategories = new OC_VCategories($app); +$vcategories = new OC_VCategories($type); $categories = $vcategories->categories(); debug(print_r($categories, true)); $tmpl->assign('categories', $categories); |