actuality bug fix

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy 2013-02-14 21:24:22 +01:00
parent 7a3ee63d15
commit f0f9635e8b
4 changed files with 42 additions and 36 deletions

View File

@ -543,25 +543,28 @@ MaterioSearchApiAjax = function(){
}; };
function addNextpage(json, container_class){ function addNextpage(json, container_class){
var $newcontent = $(json.return), // trace('json',json);
$newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'), if(json){
$newpager = $('ul.pager', $newcontent); var $newcontent = $(json.return),
$newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'),
$newpager = $('ul.pager', $newcontent);
$(container_class, _$content).append($newitems); $(container_class, _$content).append($newitems);
$('ul.pager', _$content).replaceWith($newpager.hide()); $('ul.pager', _$content).replaceWith($newpager.hide());
// TODO: animation, this should be on theme side // TODO: animation, this should be on theme side
$(container_class, _$content).children('.just-added').each(function(i){ $(container_class, _$content).children('.just-added').each(function(i){
var $this = $(this); var $this = $(this);
setTimeout(function(){ setTimeout(function(){
$this.removeClass('just-added'); $this.removeClass('just-added');
}, 150*i); }, 150*i);
}); });
$.event.trigger({ $.event.trigger({
type : 'resultscompleted', type : 'resultscompleted',
container : $(container_class, _$content) container : $(container_class, _$content)
}); });
}
_isloadingresults = false; _isloadingresults = false;
}; };

View File

@ -206,25 +206,28 @@ MaterioSearchApiAjax = function(){
}; };
function addNextpage(json, container_class){ function addNextpage(json, container_class){
var $newcontent = $(json.return), // trace('json',json);
$newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'), if(json){
$newpager = $('ul.pager', $newcontent); var $newcontent = $(json.return),
$newitems = $(container_class, $newcontent).children('article'), //.addClass('just-added'),
$newpager = $('ul.pager', $newcontent);
$(container_class, _$content).append($newitems); $(container_class, _$content).append($newitems);
$('ul.pager', _$content).replaceWith($newpager.hide()); $('ul.pager', _$content).replaceWith($newpager.hide());
// TODO: animation, this should be on theme side // TODO: animation, this should be on theme side
$(container_class, _$content).children('.just-added').each(function(i){ $(container_class, _$content).children('.just-added').each(function(i){
var $this = $(this); var $this = $(this);
setTimeout(function(){ setTimeout(function(){
$this.removeClass('just-added'); $this.removeClass('just-added');
}, 150*i); }, 150*i);
}); });
$.event.trigger({ $.event.trigger({
type : 'resultscompleted', type : 'resultscompleted',
container : $(container_class, _$content) container : $(container_class, _$content)
}); });
}
_isloadingresults = false; _isloadingresults = false;
}; };

View File

@ -323,7 +323,7 @@ function materio_search_api_results_search(){
function materio_search_api_actuality(){ function materio_search_api_actuality(){
global $user; global $user;
if(!user_access('use materio search api')){ if(isset($user->roles[1])){
$date_limit = strtotime('-6 month'); $date_limit = strtotime('-6 month');
// dsm(date('d m y', $date_limit)); // dsm(date('d m y', $date_limit));
} }
@ -341,7 +341,7 @@ function materio_search_api_actuality(){
->propertyOrderBy('created', 'DESC') ->propertyOrderBy('created', 'DESC')
->range($offset,$limit); ->range($offset,$limit);
if(!user_access('use materio search api')){ if(isset($user->roles[1])){
$query->propertyCondition('created', $date_limit, '>'); $query->propertyCondition('created', $date_limit, '>');
} }
@ -354,7 +354,7 @@ function materio_search_api_actuality(){
->propertyCondition('status', 1) ->propertyCondition('status', 1)
->entityCondition('bundle', array('breve')); ->entityCondition('bundle', array('breve'));
// dsm($count, 'count'); // dsm($count, 'count');
if(!user_access('use materio search api')){ if(isset($user->roles[1])){
$count_query->propertyCondition('created', $date_limit, '>'); $count_query->propertyCondition('created', $date_limit, '>');
} }
$count = $count_query->count()->execute(); $count = $count_query->count()->execute();

View File

@ -52,7 +52,7 @@ function materio_search_api_ajax_menu() {
'access arguments' => array('use materio search api viewmode selection'), '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', 'page callback' => 'materio_search_api_ajax_actuality',
'access callback' => TRUE, 'access callback' => TRUE,
'page arguments' => array(2), 'page arguments' => array(2),