update
- added materio_user.module (add permission to view the profile page) - materio_serach_api.pages : limit actu items for anonymous - materio_search_api_ajax.pages & materio_flag.pages : redirect to real page if current page not corresponding on ajax request (solve the view mode block visibility on user edit profile page) - materio_flag : added edit lists functionalities ++ get_list_page_title func Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
@@ -3,10 +3,22 @@
|
||||
|
||||
function materio_search_api_ajax_search($keys, $page = 0){
|
||||
$debug = false;
|
||||
global $user;
|
||||
global $user, $base_url;
|
||||
// TODO: set research path configurable
|
||||
$search_path = "explore";
|
||||
|
||||
# execute search
|
||||
$_GET['page'] = $page;
|
||||
|
||||
$path = $search_path . '/' . $keys ;//. ($page ? '?page='.$page : '');
|
||||
// dsm($menuhandler, 'menuhandler');
|
||||
|
||||
// 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')) {
|
||||
drupal_goto($path, array(), 301);
|
||||
exit ;
|
||||
}
|
||||
|
||||
# content type filter s
|
||||
// $types = $_GET['types'];
|
||||
if(isset($_GET['types'])){
|
||||
@@ -31,16 +43,25 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
||||
|
||||
user_save($user, array("data"=>array('materiosearchapi_bundlesfilter' => $active_types)));
|
||||
|
||||
# execute search
|
||||
$_GET['page'] = $page;
|
||||
if(isset($_GET['current_path'])){
|
||||
// dsm($_GET['current_path'], '$_GET[current_path]');
|
||||
// url() generates the prefix using hook_url_outbound_alter(). Instead of
|
||||
// running the hook_url_outbound_alter() again here, extract the prefix
|
||||
// from url().
|
||||
url('', array('prefix' => &$prefix));
|
||||
|
||||
$path = $search_path . '/' . $keys ;//. ($page ? '?page='.$page : '');
|
||||
// dsm($menuhandler, 'menuhandler');
|
||||
$cur_path = str_replace($base_url.base_path().$prefix, '', $_GET['current_path']);
|
||||
// dsm($cur_path, 'cur_path');
|
||||
|
||||
// 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')) {
|
||||
drupal_goto($path, array(), 301);
|
||||
exit ;
|
||||
$cur_is_search_path = strpos($cur_path, $search_path);
|
||||
// dsm($matches, '$matches');
|
||||
if($cur_is_search_path === false){
|
||||
$rep = array(
|
||||
"redirect" => $base_url.base_path().$prefix.$path,
|
||||
);
|
||||
drupal_json_output($rep);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// get results
|
||||
@@ -116,6 +137,8 @@ function materio_search_api_ajax_viewmode_change($vm){
|
||||
|
||||
|
||||
function materio_search_api_ajax_actuality($page = 0){
|
||||
$debug = false;
|
||||
|
||||
$_GET['page'] = $page;
|
||||
|
||||
$path = 'actuality';
|
||||
@@ -126,6 +149,28 @@ function materio_search_api_ajax_actuality($page = 0){
|
||||
exit ;
|
||||
}
|
||||
|
||||
// if(isset($_GET['current_path'])){
|
||||
// // dsm($_GET['current_path'], '$_GET[current_path]');
|
||||
// // url() generates the prefix using hook_url_outbound_alter(). Instead of
|
||||
// // running the hook_url_outbound_alter() again here, extract the prefix
|
||||
// // from url().
|
||||
// url('', array('prefix' => &$prefix));
|
||||
|
||||
// $cur_path = str_replace($base_url.base_path().$prefix, '', $_GET['current_path']);
|
||||
// // dsm($cur_path, 'cur_path');
|
||||
|
||||
// $cur_is_search_path = strpos($cur_path, $search_path);
|
||||
// // dsm($matches, '$matches');
|
||||
// if($cur_is_search_path === false){
|
||||
// $rep = array(
|
||||
// "redirect" => $base_url.base_path().$prefix.$path,
|
||||
// );
|
||||
// drupal_json_output($rep);
|
||||
// exit;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// get results
|
||||
menu_set_active_item($path);
|
||||
$return = menu_execute_active_handler($path, FALSE);
|
||||
|
||||
Reference in New Issue
Block a user