diff --git a/js/materio_search_api_ajax-ck.js b/js/materio_search_api_ajax-ck.js index cf578822..06f920e0 100644 --- a/js/materio_search_api_ajax-ck.js +++ b/js/materio_search_api_ajax-ck.js @@ -543,25 +543,28 @@ MaterioSearchApiAjax = function(){ }; function addNextpage(json, container_class){ - var $newcontent = $(json.return), - $newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'), - $newpager = $('ul.pager', $newcontent); + // trace('json',json); + if(json){ + var $newcontent = $(json.return), + $newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'), + $newpager = $('ul.pager', $newcontent); - $(container_class, _$content).append($newitems); - $('ul.pager', _$content).replaceWith($newpager.hide()); + $(container_class, _$content).append($newitems); + $('ul.pager', _$content).replaceWith($newpager.hide()); - // TODO: animation, this should be on theme side - $(container_class, _$content).children('.just-added').each(function(i){ - var $this = $(this); - setTimeout(function(){ - $this.removeClass('just-added'); - }, 150*i); - }); + // TODO: animation, this should be on theme side + $(container_class, _$content).children('.just-added').each(function(i){ + var $this = $(this); + setTimeout(function(){ + $this.removeClass('just-added'); + }, 150*i); + }); - $.event.trigger({ - type : 'resultscompleted', - container : $(container_class, _$content) - }); + $.event.trigger({ + type : 'resultscompleted', + container : $(container_class, _$content) + }); + } _isloadingresults = false; }; diff --git a/js/materio_search_api_ajax.js b/js/materio_search_api_ajax.js index eec77c6a..a838aa35 100644 --- a/js/materio_search_api_ajax.js +++ b/js/materio_search_api_ajax.js @@ -206,25 +206,28 @@ MaterioSearchApiAjax = function(){ }; function addNextpage(json, container_class){ - var $newcontent = $(json.return), - $newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'), - $newpager = $('ul.pager', $newcontent); + // trace('json',json); + if(json){ + var $newcontent = $(json.return), + $newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'), + $newpager = $('ul.pager', $newcontent); - $(container_class, _$content).append($newitems); - $('ul.pager', _$content).replaceWith($newpager.hide()); + $(container_class, _$content).append($newitems); + $('ul.pager', _$content).replaceWith($newpager.hide()); - // TODO: animation, this should be on theme side - $(container_class, _$content).children('.just-added').each(function(i){ - var $this = $(this); - setTimeout(function(){ - $this.removeClass('just-added'); - }, 150*i); - }); + // TODO: animation, this should be on theme side + $(container_class, _$content).children('.just-added').each(function(i){ + var $this = $(this); + setTimeout(function(){ + $this.removeClass('just-added'); + }, 150*i); + }); - $.event.trigger({ - type : 'resultscompleted', - container : $(container_class, _$content) - }); + $.event.trigger({ + type : 'resultscompleted', + container : $(container_class, _$content) + }); + } _isloadingresults = false; }; diff --git a/materio_search_api.pages.inc b/materio_search_api.pages.inc index 61faa4b1..6169c603 100644 --- a/materio_search_api.pages.inc +++ b/materio_search_api.pages.inc @@ -323,7 +323,7 @@ function materio_search_api_results_search(){ function materio_search_api_actuality(){ global $user; - if(!user_access('use materio search api')){ + if(isset($user->roles[1])){ $date_limit = strtotime('-6 month'); // dsm(date('d m y', $date_limit)); } @@ -341,7 +341,7 @@ function materio_search_api_actuality(){ ->propertyOrderBy('created', 'DESC') ->range($offset,$limit); - if(!user_access('use materio search api')){ + if(isset($user->roles[1])){ $query->propertyCondition('created', $date_limit, '>'); } @@ -354,7 +354,7 @@ function materio_search_api_actuality(){ ->propertyCondition('status', 1) ->entityCondition('bundle', array('breve')); // dsm($count, 'count'); - if(!user_access('use materio search api')){ + if(isset($user->roles[1])){ $count_query->propertyCondition('created', $date_limit, '>'); } $count = $count_query->count()->execute(); diff --git a/materio_search_api_ajax.module b/materio_search_api_ajax.module index 635b76cc..218af1d3 100644 --- a/materio_search_api_ajax.module +++ b/materio_search_api_ajax.module @@ -52,7 +52,7 @@ function materio_search_api_ajax_menu() { 'access arguments' => array('use materio search api viewmode selection'), ); - $items['materio_search_api_ajax/actuality'] = array( + $items['materio_search_api_ajax/actuality'] = $base+array( 'page callback' => 'materio_search_api_ajax_actuality', 'access callback' => TRUE, 'page arguments' => array(2),