diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-16 13:48:11 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-16 13:48:11 +0000 |
commit | 79641f53120c469bc0bf1c4f2f216fb6f1623eaf (patch) | |
tree | 7c7f95b9891f1744f51e9d104fd3d5cac0842867 /modules/aggregator | |
parent | fee294af94151cc90bb6ebaf2709abc6d1f83de5 (diff) | |
download | brdo-79641f53120c469bc0bf1c4f2f216fb6f1623eaf.tar.gz brdo-79641f53120c469bc0bf1c4f2f216fb6f1623eaf.tar.bz2 |
#173188 by chx: update aggregator menu items when an aggregator category is changed
Diffstat (limited to 'modules/aggregator')
-rw-r--r-- | modules/aggregator/aggregator.module | 22 | ||||
-rw-r--r-- | modules/aggregator/aggregator.pages.inc | 1 |
2 files changed, 18 insertions, 5 deletions
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']); } } diff --git a/modules/aggregator/aggregator.pages.inc b/modules/aggregator/aggregator.pages.inc index eae141570..08448de1f 100644 --- a/modules/aggregator/aggregator.pages.inc +++ b/modules/aggregator/aggregator.pages.inc @@ -39,6 +39,7 @@ function aggregator_page_source($arg1, $arg2 = NULL) { * Menu callback; displays all the items aggregated in a particular category. */ function aggregator_page_category($arg1, $arg2 = NULL) { + drupal_set_breadcrumb(array_merge(drupal_get_breadcrumb(), array(l(t('Categories'), 'aggregator/categories')))); // If there are two arguments then we are called as a form, $arg1 is // $form_state and $arg2 is $category. Otherwise, $arg1 is $category. $category = is_array($arg2) ? $arg2 : $arg1; |