From 79641f53120c469bc0bf1c4f2f216fb6f1623eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Tue, 16 Oct 2007 13:48:11 +0000 Subject: #173188 by chx: update aggregator menu items when an aggregator category is changed --- modules/aggregator/aggregator.module | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'modules/aggregator/aggregator.module') diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 6015d3b6e..f64536930 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -353,15 +353,27 @@ function aggregator_block($op = 'list', $delta = 0, $edit = array()) { * Add/edit/delete aggregator categories. */ function aggregator_save_category($edit) { - if (!empty($edit['cid']) && !empty($edit['title'])) { - db_query("UPDATE {aggregator_category} SET title = '%s', description = '%s' WHERE cid = %d", $edit['title'], $edit['description'], $edit['cid']); - } - else if (!empty($edit['cid'])) { - db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']); + $link_path = 'aggregator/categories/'; + if (!empty($edit['cid'])) { + $link_path .= $edit['cid']; + if (!empty($edit['title'])) { + db_query("UPDATE {aggregator_category} SET title = '%s', description = '%s' WHERE cid = %d", $edit['title'], $edit['description'], $edit['cid']); + $op = 'update'; + } + else { + db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']); + $edit['title'] = ''; + $op = 'delete'; + } } else if (!empty($edit['title'])) { // A single unique id for bundles and feeds, to use in blocks db_query("INSERT INTO {aggregator_category} (title, description, block) VALUES ('%s', '%s', 5)", $edit['title'], $edit['description']); + $link_path .= db_last_insert_id('aggregator', 'cid'); + $op = 'insert'; + } + if (isset($op)) { + menu_link_maintain('aggregator', $op, $link_path, $edit['title']); } } -- cgit v1.2.3