From f207e56b2d56614531be3d51db5c7fedf5750491 Mon Sep 17 00:00:00 2001 From: bachy Date: Fri, 8 Mar 2013 10:17:19 +0100 Subject: [PATCH] bookmarks change view mode Signed-off-by: bachy --- materio_flag.module | 7 +++++-- materio_flag.pages.inc | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/materio_flag.module b/materio_flag.module index d2cc41a6..3680bc5f 100644 --- a/materio_flag.module +++ b/materio_flag.module @@ -99,14 +99,17 @@ function materio_flag_menu() { $items['materioflag/ajax/list/%'] = $base+array( 'page callback' => 'materio_flag_ajax_list', - 'access arguments' => array('create flag lists'), - 'access callback' => 'user_access', + 'access callback' => 'materio_access_ajax_flags', 'page arguments' => array(3, 4), ); return $items; } +function materio_access_ajax_flags(){ + return ( user_access('create flag lists') || user_access('flag bookmarks') ); +} + /** * Implements hook_menu_alter(). */ diff --git a/materio_flag.pages.inc b/materio_flag.pages.inc index 23eed09b..901ada28 100644 --- a/materio_flag.pages.inc +++ b/materio_flag.pages.inc @@ -422,10 +422,13 @@ function materio_flag_ajax_list($fid, $page = 0){ $debug = false; $_GET['page'] = $page; - - $list_path = 'lists'; - - $path = $list_path.'/'.$fid; + if($fid = 1){ + $list_path = $path = 'bookmarks'; + }else{ + $list_path = 'lists'; + $path = $list_path.'/'.$fid; + } + // check if request is ajax, if not rediret to search_api_page page with right keys if (!$debug && (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')) { @@ -459,7 +462,7 @@ function materio_flag_ajax_list($fid, $page = 0){ menu_set_active_item($path); $return = menu_execute_active_handler($path, FALSE); - // dsm($return, '$return'); + dsm($return, '$return'); if (is_int($return)) { switch ($return) {