Flag list OK
all ajax OK Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
1d11663ec4
commit
b1bf1c9387
File diff suppressed because one or more lines are too long
@ -3,55 +3,135 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
MaterioFlag = function(){
|
MaterioFlag = function(){
|
||||||
|
var _isLoadingList = false ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init()
|
* init()
|
||||||
*/
|
*/
|
||||||
function init(){
|
function init(){
|
||||||
trace('init MaterioFlag');
|
trace('init MaterioFlag');
|
||||||
$(document).bind('flagGlobalAfterLinkUpdate', onFlaging);
|
$(document)
|
||||||
$(document).bind('resultscompleted', onResultsUpdated);
|
.bind('flagGlobalAfterLinkUpdate', onFlaging)
|
||||||
|
.bind('resultscompleted resultschanged', onResultsUpdated)
|
||||||
|
.bind('init-scroller-pager', onInitScrollerPager)
|
||||||
|
.bind('load-scroller-pager', onLoadScrollerPager)
|
||||||
|
.bind('view-mode-changed', onViewModeChanged)
|
||||||
|
.bind('history-state-change', onHistoryStateChange);
|
||||||
|
|
||||||
ajaxifyLinks();
|
ajaxifyLinks();
|
||||||
|
|
||||||
|
// trigger updated event for direct html loading
|
||||||
|
setTimeout(function(){
|
||||||
|
triggerContentChanged();
|
||||||
|
}, 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
function onFlaging(event){
|
function onFlaging(event){
|
||||||
trace('onFlaging', event);
|
trace('onFlaging', event);
|
||||||
|
refreshBlocks();
|
||||||
|
};
|
||||||
|
|
||||||
|
function refreshBlocks(name){
|
||||||
|
trace('refreshBlocks | name', name);
|
||||||
if($('#block-materio-flag-materio-flag-mybookmarks').length){
|
if($('#block-materio-flag-materio-flag-mybookmarks').length){
|
||||||
$.getJSON('/materioflag/refresh/block/bookmarks', function(json){
|
var type = 'bookmarks';
|
||||||
trace('json', json);
|
}else if($('#block-materio-flag-materio-flag-mylists').length){
|
||||||
$('#block-materio-flag-materio-flag-mybookmarks').replaceWith(json.block);
|
var type = 'lists';
|
||||||
Drupal.flagLink('#block-materio-flag-materio-flag-mybookmarks');
|
}
|
||||||
// TODO: update flags stars on search results after unflaging from block
|
|
||||||
$.event.trigger('mybookmarks-block-updated');
|
if(type != undefined){
|
||||||
});
|
var id = '#block-materio-flag-materio-flag-my'+type;
|
||||||
}
|
$.getJSON(Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/refresh/block/'+type, function(json){
|
||||||
|
trace('block refreshed '+type, json);
|
||||||
if($('#block-materio-flag-materio-flag-mylists').length){
|
$(id).replaceWith(json.block);
|
||||||
$.getJSON('/materioflag/refresh/block/mylists', function(json){
|
|
||||||
trace('json', json);
|
var event = jQuery.Event('my'+type+'-block-updated');
|
||||||
$('#block-materio-flag-materio-flag-mylists').replaceWith(json.block);
|
event.listname = name;
|
||||||
Drupal.flagLink('#block-materio-flag-materio-flag-mylists');
|
$.event.trigger(event);
|
||||||
// TODO: update flags stars on search results after unflaging from block
|
|
||||||
$.event.trigger('mylists-block-updated');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ajaxifyLinks();
|
||||||
};
|
};
|
||||||
|
|
||||||
function onResultsUpdated(event){
|
function onResultsUpdated(event){
|
||||||
trace('onResultsUpdated', event);
|
trace('onResultsUpdated', event);
|
||||||
|
|
||||||
ajaxifyLinks(event.container);
|
ajaxifyLinks(event.container);
|
||||||
};
|
};
|
||||||
|
|
||||||
function ajaxifyLinks(cont){
|
function ajaxifyLinks(container){
|
||||||
trace('ajaxifyLinks');
|
trace('ajaxifyLinks', container);
|
||||||
var container = cont || 'body';
|
|
||||||
$('a.flag-lists-create:not(.ajax)', container)
|
|
||||||
.bind('click', onClickCreatLink)
|
|
||||||
.addClass('ajax');
|
|
||||||
|
|
||||||
|
container = ((container != null) ? container : 'body');
|
||||||
|
|
||||||
|
// trace('typeof Drupal.flagLink', typeof Drupal.flagLink);
|
||||||
|
if (typeof Drupal.flagLink != 'undefined')
|
||||||
|
Drupal.flagLink(container);
|
||||||
|
|
||||||
|
$('a.flag-lists-create:not(.ajax-processed)', container)
|
||||||
|
.bind('click', onClickCreatLink)
|
||||||
|
.addClass('ajax-processed');
|
||||||
|
|
||||||
|
$('a.open-list:not(.ajax-processed)', '#block-materio-flag-materio-flag-mylists')
|
||||||
|
.bind('click', onClickOpenLink)
|
||||||
|
.addClass('ajax-processed');
|
||||||
|
};
|
||||||
|
|
||||||
|
function onClickOpenLink(event){
|
||||||
|
event.preventDefault();
|
||||||
|
var $link = $(event.currentTarget);
|
||||||
|
var fid = $link.attr('href').match(/lists\/([0-9]+)$/);
|
||||||
|
// trace('type', type);
|
||||||
|
loadList(fid[1]);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadList(fid){
|
||||||
|
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/ajax/list/'+fid;
|
||||||
|
|
||||||
|
$.event.trigger('loading-content');
|
||||||
|
|
||||||
|
$.getJSON(url, function(json){
|
||||||
|
trace('json', json);
|
||||||
|
changeContent(json);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function changeContent(json){
|
||||||
|
if(json.return){
|
||||||
|
|
||||||
|
$('.inner-content','#content').html(json.return);
|
||||||
|
|
||||||
|
$.event.trigger('loaded-content');
|
||||||
|
|
||||||
|
// no need of ajaxifylinks because it's triggered with resultschanged
|
||||||
|
// ajaxifyLinks('#content');
|
||||||
|
|
||||||
|
var path = Drupal.settings.basePath + Drupal.settings.pathPrefix + json.path;
|
||||||
|
|
||||||
|
var event = jQuery.Event('new-history-page');
|
||||||
|
event.path = path;
|
||||||
|
event.title = json.title;
|
||||||
|
event.content = json.return;
|
||||||
|
$.event.trigger(event);
|
||||||
|
|
||||||
|
// TODO: change language links for folders
|
||||||
|
// for (language in Drupal.settings.materio_search_api_ajax.languages) {
|
||||||
|
// var l = Drupal.settings.materio_search_api_ajax.languages[language];
|
||||||
|
// $('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||||
|
// };
|
||||||
|
|
||||||
|
triggerContentChanged();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
trace('no results');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function triggerContentChanged(){
|
||||||
|
var event = jQuery.Event('resultschanged');
|
||||||
|
event.container = '#content .flaglist-items';
|
||||||
|
$.event.trigger(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
function onClickCreatLink(event){
|
function onClickCreatLink(event){
|
||||||
@ -59,40 +139,203 @@ MaterioFlag = function(){
|
|||||||
var $link = $(event.currentTarget);
|
var $link = $(event.currentTarget);
|
||||||
var type = $link.attr('href').match(/[^\/]*$/);
|
var type = $link.attr('href').match(/[^\/]*$/);
|
||||||
// trace('type', type);
|
// trace('type', type);
|
||||||
var url = 'materioflag/createlist/form/'+type[0];
|
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/createlist/form/'+type[0];
|
||||||
|
|
||||||
$.getJSON(url, function(json){
|
$.getJSON(url, function(json){
|
||||||
trace('json', json);
|
trace('json', json);
|
||||||
showCreateListForm(json);
|
showCreateListForm(json, $link);
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
function showCreateListForm(json){
|
function showCreateListForm(json, $link){
|
||||||
var $modal = $('<div id="modal"/>').appendTo('body');
|
var $modal = $('<div id="modal" class="modal"/>').appendTo('body');
|
||||||
$modal
|
$modal
|
||||||
.css({
|
.css({
|
||||||
position:'absolute',
|
position:'absolute',
|
||||||
top:'40%', left:'50%',
|
top:'40%', left:'50%',
|
||||||
marginLeft:'-200px', width:'400px',
|
marginLeft:'-150px', width:'300px',
|
||||||
zIndex:"99999"
|
zIndex:"99999"
|
||||||
})
|
})
|
||||||
.append(json.return);
|
.append(json.return)
|
||||||
// .find('#flag-lists-form').bind('submit', function(event) {
|
.find('input[type="submit"]', '#materio-flag-create-list-form').bind('click', function(event) {
|
||||||
// trace('submit',event);
|
event.preventDefault();
|
||||||
// var title = $(this).find('input[name*="title"]').val();
|
switch($(this).attr('name')){
|
||||||
// createList(title);
|
case 'cancel':
|
||||||
// return false;
|
trace('cancel',event);
|
||||||
// });
|
$(this).parents('#modal').remove();
|
||||||
|
break;
|
||||||
|
case 'create':
|
||||||
|
trace('create',event);
|
||||||
|
var title = $(this).parents('form').find('input[name*="flag-lists-name"]').val();
|
||||||
|
var type = $(this).parents('form').find('input[name*="type"]').val();
|
||||||
|
createList($modal, type, title, $link);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
.parents('form').find('input[type="text"]').focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
function createList(title){
|
function createList($modal, type, title, $link){
|
||||||
var url = 'materioflag/createlist/'+title;
|
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'flag-lists/add/'+type+'/js';
|
||||||
$.getJSON(url, function(json){
|
$.getJSON(url, {name:title}, function(data) {
|
||||||
trace('json', json);
|
if (data.error) {
|
||||||
|
trace(data.error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// select.append('<option value="'+data.flag.fid+'">'+data.flag.title+'</option>');
|
||||||
|
// $('input.name', $(this)).val('');
|
||||||
|
// dialog.dialog('close');
|
||||||
|
trace('created list : data', data);
|
||||||
|
|
||||||
|
flagEntityWithList(data.flag.name, $link.attr('nid'), $link.attr('token'));
|
||||||
|
$modal.remove();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function flagEntityWithList(name, nid, token){
|
||||||
|
// var ret;
|
||||||
|
// Send POST request
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+'flag-lists/flag/'+name+'/'+nid,
|
||||||
|
data: { js: true, token: token },
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data2) {
|
||||||
|
trace('node taged with newly created list : data2', data2)
|
||||||
|
if (data2.status) {
|
||||||
|
// success
|
||||||
|
refreshBlocks(name);
|
||||||
|
refreshNodeLinks();
|
||||||
|
}else {
|
||||||
|
// Failure.
|
||||||
|
alert(data2.errorMessage);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xmlhttp) {
|
||||||
|
alert('An HTTP error '+ xmlhttp.status +' occurred.\n'+ element.href);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function refreshNodeLinks(){
|
||||||
|
|
||||||
|
var nids = new Array();
|
||||||
|
$('.flag-lists-entity-links').parents('.node').each(function(index) {
|
||||||
|
nids.push($(this).attr('class').match(/node-([0-9]+)/)[1]);
|
||||||
|
});
|
||||||
|
trace('nids', nids);
|
||||||
|
|
||||||
|
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/nodelinks';
|
||||||
|
$.getJSON(url, {nids:nids.join(";")}, function(data) {
|
||||||
|
trace('data', data);
|
||||||
|
for(nid in data.links){
|
||||||
|
trace('nid', nid);
|
||||||
|
trace('data.links[nid]', data.links[nid]);
|
||||||
|
$('.node-'+nid+' .flag-lists-entity-links').parent('.item-list').replaceWith(data.links[nid]);
|
||||||
|
|
||||||
|
// trace('typeof Drupal.flagLink', typeof Drupal.flagLink);
|
||||||
|
// if (typeof Drupal.flagLink != 'undefined')
|
||||||
|
// Drupal.flagLink($('.node-'+nid+' .flag-lists-entity-links'));
|
||||||
|
|
||||||
|
ajaxifyLinks('.node-'+nid+' .flag-lists-entity-links');
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var event = jQuery.Event('materioflag-nodelinks-updated');
|
||||||
|
event.nids = nids;
|
||||||
|
$.event.trigger(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
function onInitScrollerPager(event){
|
||||||
|
// trace('MaterioFlag :: onInitScrollerPager');
|
||||||
|
if (isList()){
|
||||||
|
// trace('event.pager', event);
|
||||||
|
event.pager.hide();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function onLoadScrollerPager(event){
|
||||||
|
if (isList())
|
||||||
|
loadNextListPage(event.href);
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadNextListPage(href){
|
||||||
|
// trace('loadNextListPage', href);
|
||||||
|
if(!_isLoadingList){
|
||||||
|
var fid = href.match(/lists\/([^\/|\?]+)/);
|
||||||
|
var page = href.match(/\?page=([0-9]+)/);
|
||||||
|
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/ajax/list/'+fid[1]+'/'+page[1];
|
||||||
|
// trace('url', url);
|
||||||
|
loadNextPage(url, $('.materio-flags-list', '#content'), '.flaglist-items');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadNextPage(url, $container, target){
|
||||||
|
trace('loadNextPage');
|
||||||
|
_isLoadingList = true;
|
||||||
|
$container.addClass('loading');
|
||||||
|
$.getJSON(url, function(json){
|
||||||
|
trace('json', json);
|
||||||
|
_isLoadingList = false;
|
||||||
|
$container.removeClass('loading');
|
||||||
|
addNextpage(json, target);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function addNextpage(json, container_class){
|
||||||
|
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());
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: animation, this should be on theme side
|
||||||
|
$(container_class, '#content').children('.just-added').each(function(i){
|
||||||
|
// $(this).delay(5000*i).removeClass('just-added');
|
||||||
|
var $this = $(this);
|
||||||
|
setTimeout(function(){
|
||||||
|
$this.removeClass('just-added');
|
||||||
|
}, 150*i);
|
||||||
|
});
|
||||||
|
|
||||||
|
var event = jQuery.Event('resultscompleted');
|
||||||
|
event.container = $(container_class, '#content');
|
||||||
|
$.event.trigger(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
function onViewModeChanged(event){
|
||||||
|
if (isList())
|
||||||
|
loadList(getFid());
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* history
|
||||||
|
*/
|
||||||
|
function onHistoryStateChange(event){
|
||||||
|
if(isList())
|
||||||
|
triggerContentChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helpers
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getFid(){
|
||||||
|
return $('.materio-flags-list', '#content').attr('fid');;
|
||||||
|
};
|
||||||
|
|
||||||
|
function isList(){
|
||||||
|
return $('.materio-flags-list', '#content').length;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -3,21 +3,16 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
MaterioSearchApiAjax = function(){
|
MaterioSearchApiAjax = function(){
|
||||||
|
var _isloadingresults = false;
|
||||||
var _History = window.History,
|
var _$content = $('#content');
|
||||||
_isloadingresults = false;
|
|
||||||
_$content = $('#content'),
|
|
||||||
isExplore = $('.search-results', _$content).length,
|
|
||||||
isActuality = $('.actuality-items', _$content).length;
|
|
||||||
// TODO: define $content by module settings
|
// TODO: define $content by module settings
|
||||||
/**
|
/**
|
||||||
* init()
|
* init()
|
||||||
*/
|
*/
|
||||||
function init(){
|
function init(){
|
||||||
trace('init module');
|
trace('init MaterioSearchApiAjax');
|
||||||
|
|
||||||
initSearchAjax();
|
initSearchAjax();
|
||||||
initHistoryNav();
|
|
||||||
initViewMode();
|
initViewMode();
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -27,7 +22,6 @@ MaterioSearchApiAjax = function(){
|
|||||||
*/
|
*/
|
||||||
function initSearchAjax(){
|
function initSearchAjax(){
|
||||||
// trace('initSearchAjax');
|
// trace('initSearchAjax');
|
||||||
// $('#edit-searchfield').focus();
|
|
||||||
|
|
||||||
$('#materio-search-api-search-form').bind('submit', function(event) {
|
$('#materio-search-api-search-form').bind('submit', function(event) {
|
||||||
// trace('search submited', event);
|
// trace('search submited', event);
|
||||||
@ -38,34 +32,26 @@ MaterioSearchApiAjax = function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// /!\ AUTOCOMPLETE SELECT EVENT need a patch http://drupal.org/node/365241#comment-5374686
|
// /!\ AUTOCOMPLETE SELECT EVENT need a patch http://drupal.org/node/365241#comment-5374686
|
||||||
$("#edit-searchfield").bind('autocompleteSelect', function(event) {
|
$("#edit-searchfield").bind('autocompleteSelect', function(event) {
|
||||||
$(this).parents('.form').trigger('submit');
|
$(this).parents('.form').trigger('submit');
|
||||||
});
|
});
|
||||||
|
|
||||||
_$content
|
$(document)
|
||||||
.bind('jsp-initialised', function(event, isScrollable){
|
.bind('init-scroller-pager', onInitScrollerPager)
|
||||||
trace('isScrollable = '+isScrollable);
|
.bind('load-scroller-pager', onLoadScrollerPager)
|
||||||
// TODO: better to check scroll-y than isscrollable, load next page before the end of scroll
|
.bind('view-mode-changed', onViewModeChanged)
|
||||||
if(!isScrollable)
|
.bind('history-state-change', onHistoryStateChange);
|
||||||
infinitScrollPager();
|
|
||||||
// TODO: what happend when there is no more page
|
|
||||||
})
|
|
||||||
.bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
|
|
||||||
if(isAtBottom)
|
|
||||||
infinitScrollPager();
|
|
||||||
});
|
|
||||||
|
|
||||||
// trigger updated event for direct html loading
|
// trigger updated event for direct html loading
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
var event = jQuery.Event('resultschanged');
|
var event = jQuery.Event('resultschanged');
|
||||||
|
|
||||||
if(isExplore)
|
if(isExplore())
|
||||||
event.container = $('.search-results', _$content);
|
event.container = '#content .search-results';
|
||||||
|
|
||||||
if(isActuality)
|
if(isActuality())
|
||||||
event.container = $('.actuality-items', _$content);
|
event.container = '#content .actuality-items';
|
||||||
|
|
||||||
$.event.trigger(event);
|
$.event.trigger(event);
|
||||||
}, 10);
|
}, 10);
|
||||||
@ -93,6 +79,7 @@ MaterioSearchApiAjax = function(){
|
|||||||
|
|
||||||
|
|
||||||
if(!_isloadingresults){
|
if(!_isloadingresults){
|
||||||
|
$.event.trigger('loading-content');
|
||||||
_isloadingresults = true;
|
_isloadingresults = true;
|
||||||
$('#materio-search-api-search-form').addClass('loading');
|
$('#materio-search-api-search-form').addClass('loading');
|
||||||
// TODO: record ajax path in a variable from materio_search_api_ajax_init
|
// TODO: record ajax path in a variable from materio_search_api_ajax_init
|
||||||
@ -100,57 +87,75 @@ MaterioSearchApiAjax = function(){
|
|||||||
{'types':types},
|
{'types':types},
|
||||||
function(json){
|
function(json){
|
||||||
trace('json', json);
|
trace('json', json);
|
||||||
$.event.trigger('resultsloaded');
|
$.event.trigger('loaded-content');
|
||||||
_isloadingresults = false;
|
_isloadingresults = false;
|
||||||
$('#materio-search-api-search-form').removeClass('loading');
|
$('#materio-search-api-search-form').removeClass('loading');
|
||||||
updateContent(json);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
function updateContent(json){
|
|
||||||
if(json.return){
|
|
||||||
|
|
||||||
$('.inner-content',_$content).html(json.return);
|
|
||||||
|
|
||||||
var path = Drupal.settings.basePath + Drupal.settings.pathPrefix + json.search_path + '/' + json.keys;
|
var path = Drupal.settings.basePath + Drupal.settings.pathPrefix + json.search_path + '/' + json.keys;
|
||||||
|
|
||||||
_History.pushState({content:json.return}, json.keys, path);
|
var event = jQuery.Event('new-history-page');
|
||||||
$('input[name=location]','#feedback-form').attr('value', path);
|
event.path = path;
|
||||||
|
event.title = json.keys;
|
||||||
|
event.content = json.return;
|
||||||
|
$.event.trigger(event);
|
||||||
|
|
||||||
for (language in Drupal.settings.materio_search_api_ajax.languages) {
|
for (language in Drupal.settings.materio_search_api_ajax.languages) {
|
||||||
var l = Drupal.settings.materio_search_api_ajax.languages[language];
|
var l = Drupal.settings.materio_search_api_ajax.languages[language];
|
||||||
$('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
$('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||||
};
|
};
|
||||||
|
|
||||||
var event = jQuery.Event('resultschanged');
|
changeContent(json);
|
||||||
event.container = $('.search-results', _$content);
|
|
||||||
$.event.trigger(event);
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadActuality(){
|
||||||
|
if(!_isloadingresults){
|
||||||
|
$.event.trigger('loading-content');
|
||||||
|
_isloadingresults = true;
|
||||||
|
$('#materio-search-api-search-form').addClass('loading');
|
||||||
|
|
||||||
|
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_search_api_ajax/actuality';
|
||||||
|
$.getJSON(url,
|
||||||
|
function(json){
|
||||||
|
trace('json', json);
|
||||||
|
$.event.trigger('resultsloaded');
|
||||||
|
_isloadingresults = false;
|
||||||
|
$('#materio-search-api-search-form').removeClass('loading');
|
||||||
|
changeContent(json);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function changeContent(json){
|
||||||
|
if(json.return){
|
||||||
|
$.event.trigger('loaded-content');
|
||||||
|
$('.inner-content',_$content).html(json.return);
|
||||||
|
triggerContentChanged();
|
||||||
}else{
|
}else{
|
||||||
trace('no results');
|
trace('no results');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function triggerContentChanged(){
|
||||||
|
var event = jQuery.Event('resultschanged');
|
||||||
|
event.container = '#content .search-results, #content .actuality-items';
|
||||||
|
$.event.trigger(event);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
function onInitScrollerPager(event){
|
||||||
* infinit scroll
|
if(isActuality() || isExplore())
|
||||||
*/
|
event.pager.hide();
|
||||||
function infinitScrollPager(){
|
};
|
||||||
var $nextpage = $('ul.pager .pager-current', _$content).next(),
|
|
||||||
href = $('a', $nextpage).attr('href');
|
|
||||||
|
|
||||||
if(href){
|
|
||||||
if (isExplore)
|
|
||||||
loadNextResultsPage(href);
|
|
||||||
|
|
||||||
if(isActuality)
|
|
||||||
loadNextActualityPage(href);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function onLoadScrollerPager(event){
|
||||||
|
if (isExplore())
|
||||||
|
loadNextResultsPage(event.href);
|
||||||
|
|
||||||
|
if(isActuality())
|
||||||
|
loadNextActualityPage(event.href);
|
||||||
};
|
};
|
||||||
|
|
||||||
function loadNextResultsPage(href){
|
function loadNextResultsPage(href){
|
||||||
@ -192,8 +197,9 @@ MaterioSearchApiAjax = function(){
|
|||||||
$newpager = $('ul.pager', $newcontent);
|
$newpager = $('ul.pager', $newcontent);
|
||||||
|
|
||||||
$(container_class, _$content).append($newitems);
|
$(container_class, _$content).append($newitems);
|
||||||
$('ul.pager', _$content).replaceWith($newpager);
|
$('ul.pager', _$content).replaceWith($newpager.hide());
|
||||||
|
|
||||||
|
// 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){
|
||||||
// $(this).delay(5000*i).removeClass('just-added');
|
// $(this).delay(5000*i).removeClass('just-added');
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
@ -207,28 +213,14 @@ MaterioSearchApiAjax = function(){
|
|||||||
$.event.trigger(event);
|
$.event.trigger(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* history navigation
|
|
||||||
*/
|
|
||||||
function initHistoryNav(){
|
|
||||||
var state = _History.getState();
|
|
||||||
_History.log('initial:', state.data, state.title, state.url);
|
|
||||||
|
|
||||||
_History.Adapter.bind(window,'statechange',function(){
|
|
||||||
var state = _History.getState();
|
|
||||||
_History.log('statechange:', state.data, state.title, state.url);
|
|
||||||
// TODO: History : empty content if we go back to the homepage
|
|
||||||
$('.inner-content',_$content).html(state.data.content);
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* viewmode
|
* viewmode
|
||||||
*/
|
*/
|
||||||
function initViewMode(){
|
function initViewMode(){
|
||||||
$('.viewmode-link').click(function(event){
|
$('.viewmode-link').click(function(event){
|
||||||
|
event.preventDefault();
|
||||||
changeViewMode($(this).attr('rel'), $(this));
|
changeViewMode($(this).attr('rel'), $(this));
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -236,7 +228,8 @@ MaterioSearchApiAjax = function(){
|
|||||||
$.getJSON(Drupal.settings.basePath+'materio_search_api_ajax/viewmode/change/'+vm, function(json){
|
$.getJSON(Drupal.settings.basePath+'materio_search_api_ajax/viewmode/change/'+vm, function(json){
|
||||||
trace('viewmode json', json);
|
trace('viewmode json', json);
|
||||||
if (json.statut == "saved"){
|
if (json.statut == "saved"){
|
||||||
loadResults(getSearchKeys());
|
// loadResults(getSearchKeys());
|
||||||
|
$.event.trigger('view-mode-changed');
|
||||||
$('.viewmode-link').removeClass('active');
|
$('.viewmode-link').removeClass('active');
|
||||||
$btn.addClass('active');
|
$btn.addClass('active');
|
||||||
}
|
}
|
||||||
@ -244,6 +237,34 @@ MaterioSearchApiAjax = function(){
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onViewModeChanged(event){
|
||||||
|
if (isExplore())
|
||||||
|
loadResults(getSearchKeys());
|
||||||
|
|
||||||
|
if(isActuality())
|
||||||
|
loadActuality();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* history
|
||||||
|
*/
|
||||||
|
function onHistoryStateChange(event){
|
||||||
|
if(isExplore() || isActuality())
|
||||||
|
triggerContentChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* helpers
|
||||||
|
*/
|
||||||
|
function isExplore(){
|
||||||
|
return $('.search-results', '#content').length;
|
||||||
|
};
|
||||||
|
|
||||||
|
function isActuality(){
|
||||||
|
return $('.actuality-items', '#content').length;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ function materio_flag_menu() {
|
|||||||
'page arguments' => array(3),
|
'page arguments' => array(3),
|
||||||
);
|
);
|
||||||
|
|
||||||
$items['materioflag/refresh/block/mylists'] = $base+array(
|
$items['materioflag/refresh/block/lists'] = $base+array(
|
||||||
'access arguments' => array('create flag lists'),
|
'access arguments' => array('create flag lists'),
|
||||||
'page callback' => 'materio_flag_refresh_block',
|
'page callback' => 'materio_flag_refresh_block',
|
||||||
'page arguments' => array(3),
|
'page arguments' => array(3),
|
||||||
@ -57,11 +57,26 @@ function materio_flag_menu() {
|
|||||||
'page arguments' => array(3),
|
'page arguments' => array(3),
|
||||||
);
|
);
|
||||||
|
|
||||||
$items['materioflag/createlist/%'] = $base+array(
|
|
||||||
|
$items['materioflag/nodelinks'] = $base+array(
|
||||||
'access arguments' => array('create flag lists'),
|
'access arguments' => array('create flag lists'),
|
||||||
'access callback' => 'user_access',
|
'access callback' => 'user_access',
|
||||||
'page callback' => 'materio_flag_createlist',
|
'page callback' => 'materio_flag_nodelinks',
|
||||||
'page arguments' => array(2, 3),
|
// 'page arguments' => array(3),
|
||||||
|
);
|
||||||
|
|
||||||
|
$items['lists/%'] = $base+array(
|
||||||
|
'access arguments' => array('create flag lists'),
|
||||||
|
'access callback' => 'user_access',
|
||||||
|
'page callback' => 'materio_flag_user_lists',
|
||||||
|
'page arguments' => array(1),
|
||||||
|
);
|
||||||
|
|
||||||
|
$items['materioflag/ajax/list/%'] = $base+array(
|
||||||
|
'page callback' => 'materio_flag_ajax_list',
|
||||||
|
'access arguments' => array('create flag lists'),
|
||||||
|
'access callback' => 'user_access',
|
||||||
|
'page arguments' => array(3, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
@ -83,6 +98,10 @@ function materio_flag_block_info() {
|
|||||||
'cache' => DRUPAL_NO_CACHE
|
'cache' => DRUPAL_NO_CACHE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$blocks['materio_flag_mylists_nav'] = array(
|
||||||
|
'info' => t('My Materio flag lists navigation'),
|
||||||
|
'cache' => DRUPAL_NO_CACHE
|
||||||
|
);
|
||||||
|
|
||||||
return $blocks;
|
return $blocks;
|
||||||
}
|
}
|
||||||
@ -122,6 +141,7 @@ function materio_flag_block_view($delta = '') {
|
|||||||
// dsm($flags, 'flags');
|
// dsm($flags, 'flags');
|
||||||
|
|
||||||
foreach ($flags as $name => $flag) {
|
foreach ($flags as $name => $flag) {
|
||||||
|
$flag->path = url('lists/'.$flag->fid);
|
||||||
$flaged_content = flag_lists_get_flagged_content($flag->fid, $user->uid);
|
$flaged_content = flag_lists_get_flagged_content($flag->fid, $user->uid);
|
||||||
// dsm($flaged_content, 'flaged_content');
|
// dsm($flaged_content, 'flaged_content');
|
||||||
$fcn = array();
|
$fcn = array();
|
||||||
@ -134,6 +154,7 @@ function materio_flag_block_view($delta = '') {
|
|||||||
$fcn[] = $node;
|
$fcn[] = $node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$lists[$name] = array(
|
$lists[$name] = array(
|
||||||
'list' => $flag,
|
'list' => $flag,
|
||||||
'content' => $fcn,
|
'content' => $fcn,
|
||||||
@ -152,6 +173,19 @@ function materio_flag_block_view($delta = '') {
|
|||||||
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag-ck.js');
|
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag-ck.js');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'materio_flag_mylists_nav':
|
||||||
|
if(user_access('create flag lists')){
|
||||||
|
$flags = flag_lists_get_user_flags(NULL, $user);
|
||||||
|
// foreach ($flags as $name => $flag) {
|
||||||
|
// # code...
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
$block['subject'] = t('My !listname'.'s', array('!listname'=>variable_get('flag_lists_name', 'list')));
|
||||||
|
$block['content'] = theme('materio_flag_mylists_nav_block', array("flags"=>$flags));
|
||||||
|
// $block['content'] = theme('flag_lists_user_page', array('uid' => $user->uid));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
@ -174,7 +208,19 @@ function materio_flag_entity_info_alter(&$entity_info) {
|
|||||||
function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
|
function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
|
||||||
if($type == 'node'){
|
if($type == 'node'){
|
||||||
|
|
||||||
|
$flaglists_links = materio_flag_get_entity_links($entity, $type, $view_mode);
|
||||||
|
// dsm($flaglists_links, 'flaglists_links');
|
||||||
|
|
||||||
|
$entity->content['links']['flaglistslinks'] = array('#markup' => $flaglists_links,"#html"=>true);
|
||||||
|
|
||||||
|
drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
|
||||||
|
drupal_add_js(drupal_get_path('module', 'flag') . '/theme/flag.js');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function materio_flag_get_entity_links($entity, $type, $view_mode = null){
|
||||||
// dsm($entity, 'entity');
|
// dsm($entity, 'entity');
|
||||||
|
|
||||||
// Do we have a list template for this node type, or are we s
|
// Do we have a list template for this node type, or are we s
|
||||||
if (!flag_lists_template_exists($entity->type)) {
|
if (!flag_lists_template_exists($entity->type)) {
|
||||||
return;
|
return;
|
||||||
@ -182,45 +228,46 @@ function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
|
|||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if ($flags = flag_lists_get_user_flags($entity->type, $user)) {
|
|
||||||
// dsm($flags, 'flags');
|
|
||||||
# if flag name is provided we are on flaglists content list (block mylists)
|
# if flag name is provided we are on flaglists content list (block mylists)
|
||||||
if(isset($entity->flag_names)){
|
if($view_mode == 'bookmark'){
|
||||||
// TODO: limit flag link by current flag list
|
// TODO: define view mode in settings
|
||||||
foreach ($flags as $flag) {
|
// if (isset($entity->flag_names) && $flags = flag_lists_get_user_flags($entity->type, $user)) {
|
||||||
//dsm($flag->name, 'flag');
|
// // dsm($flags, 'flags');
|
||||||
if(in_array($flag->name, $entity->flag_names)){
|
// // TODO: limit flag link by current flag list
|
||||||
if ($flag->module == 'flag_lists') {
|
// foreach ($flags as $flag) {
|
||||||
$action = _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0) ? 'unflag' : 'flag';
|
// //dsm($flag->name, 'flag');
|
||||||
} else {
|
// if(in_array($flag->name, $entity->flag_names)){
|
||||||
$action = $flag->is_flagged($entity->nid) ? 'unflag' : 'flag';
|
// if ($flag->module == 'flag_lists') {
|
||||||
}
|
// $action = _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0) ? 'unflag' : 'flag';
|
||||||
$flag->module = 'materio_flag';
|
// } else {
|
||||||
$link = $flag->theme($action, $entity->nid);
|
// $action = $flag->is_flagged($entity->nid) ? 'unflag' : 'flag';
|
||||||
|
// }
|
||||||
|
// $flag->module = 'materio_flag';
|
||||||
|
// $link = $flag->theme($action, $entity->nid);
|
||||||
|
|
||||||
// If it's a list, fix the link.
|
// // If it's a list, fix the link.
|
||||||
if ($flag->module == 'flag_lists') {
|
// if ($flag->module == 'flag_lists') {
|
||||||
flag_lists_fix_link($link, $action);
|
// flag_lists_fix_link($link, $action);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$items[] = array(
|
// $items[] = array(
|
||||||
'data' => $link,
|
// 'data' => $link,
|
||||||
'class' => array('flag-lists-link', $action.'-action'),
|
// 'class' => array('flag-lists-link', $action.'-action'),
|
||||||
);
|
// );
|
||||||
|
|
||||||
// array_splice($entity->flag_names, array_search($flag->name, $entity->flag_names), 1);
|
|
||||||
|
|
||||||
// dsm($entity->flag_names, 'entity->flag_name');
|
|
||||||
|
|
||||||
// break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// // array_splice($entity->flag_names, array_search($flag->name, $entity->flag_names), 1);
|
||||||
|
// // dsm($entity->flag_names, 'entity->flag_name');
|
||||||
|
// // break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
#normal display
|
#normal display
|
||||||
}else{
|
}else{
|
||||||
|
if ($flags = flag_lists_get_user_flags($entity->type, $user)) {
|
||||||
|
// dsm($flags, 'flags');
|
||||||
// Build the list of lists for this node.
|
// Build the list of lists for this node.
|
||||||
foreach ($flags as $flag) {
|
foreach ($flags as $flag) {
|
||||||
|
// dsm($flag, 'flag');
|
||||||
if ($flag->module == 'flag_lists') {
|
if ($flag->module == 'flag_lists') {
|
||||||
$action = _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0) ? 'unflag' : 'flag';
|
$action = _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0) ? 'unflag' : 'flag';
|
||||||
}
|
}
|
||||||
@ -228,10 +275,6 @@ function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
|
|||||||
$action = $flag->is_flagged($entity->nid) ? 'unflag' : 'flag';;
|
$action = $flag->is_flagged($entity->nid) ? 'unflag' : 'flag';;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dsm($flag, 'flag');
|
|
||||||
|
|
||||||
// $flag->module = 'materio_flag';
|
|
||||||
|
|
||||||
$link = $flag->theme($action, $entity->nid);
|
$link = $flag->theme($action, $entity->nid);
|
||||||
|
|
||||||
// If it's a list, fix the link.
|
// If it's a list, fix the link.
|
||||||
@ -244,50 +287,57 @@ function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
|
|||||||
'class' => array('flag-lists-link', $action.'-action'),
|
'class' => array('flag-lists-link', $action.'-action'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#create new list
|
#create new list
|
||||||
$link = l(
|
$link = l(
|
||||||
t('New @name', array('@name' => variable_get('flag_lists_name', t('list')))),
|
'<span>' . t('New @name', array('@name' => variable_get('flag_lists_name', t('list')))) . '</span> <i class="icon-plus"></i>',
|
||||||
'flag-lists/add/' . $entity->type,
|
'flag-lists/add/' . $entity->type,
|
||||||
array(
|
array(
|
||||||
// 'query' => drupal_get_destination(),
|
// 'query' => drupal_get_destination(),
|
||||||
'attributes' => array(
|
'attributes' => array(
|
||||||
'class' => array('flag-lists-create'),
|
'class' => array('flag-lists-create'),
|
||||||
'title' => t('create a new @name and use it.', array('@name'=>variable_get('flag_lists_name', t('list'))))
|
'title' => t('create a new @name and use it.', array('@name'=>variable_get('flag_lists_name', t('list')))),
|
||||||
)
|
'nid' => $entity->nid,
|
||||||
|
'token' => flag_get_token($entity->nid),
|
||||||
|
),
|
||||||
|
'html' => TRUE,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$create = array(
|
$create = array(
|
||||||
'data' => $link,// . '<i class="icon-plus"></i>',
|
'data' => $link,
|
||||||
'class' => array('flag-lists-create'),
|
'class' => array('flag-lists-create'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (!isset($items) || !count($items)) && !isset($create))
|
// if( (!isset($items) || !count($items)) && !isset($create))
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
|
if(isset($items)){
|
||||||
$ops = array(
|
$ops = array(
|
||||||
'node' => $entity,
|
'node' => $entity,
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($create))
|
if(isset($create)){
|
||||||
$ops['create'] = $create;
|
$ops['create'] = $create;
|
||||||
|
// drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
|
||||||
|
// drupal_add_js(drupal_get_path('module', 'flag') . '/theme/flag.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($ops)){
|
||||||
|
// dsm($ops, 'ops');
|
||||||
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag-ck.js');
|
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag-ck.js');
|
||||||
|
|
||||||
$flaglists_links = theme('materio_flag_mylists_entity_links', $ops);
|
return theme('materio_flag_mylists_entity_links', $ops);
|
||||||
|
|
||||||
$entity->content['links']['flaglistslinks'] = array('#markup' => $flaglists_links,"#html"=>true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_theme().
|
* Implements hook_theme().
|
||||||
*/
|
*/
|
||||||
@ -303,18 +353,40 @@ function materio_flag_theme($existing, $type, $theme, $path) {
|
|||||||
'template' => 'materio-flag-mylists-block',
|
'template' => 'materio-flag-mylists-block',
|
||||||
'path' => drupal_get_path('module', 'materio_flag').'/templates',
|
'path' => drupal_get_path('module', 'materio_flag').'/templates',
|
||||||
),
|
),
|
||||||
|
'materio_flag_mylists_nav_block' => array(
|
||||||
|
'arguments' => array(),
|
||||||
|
'template' => 'materio-flag-mylists-nav-block',
|
||||||
|
'path' => drupal_get_path('module', 'materio_flag').'/templates',
|
||||||
|
),
|
||||||
'materio_flag_mylists_entity_links' => array(
|
'materio_flag_mylists_entity_links' => array(
|
||||||
'variables' => array('node' => NULL, 'create' => NULL, 'items' => array()),
|
'variables' => array('node' => NULL, 'create' => NULL, 'items' => array()),
|
||||||
),
|
),
|
||||||
|
'materio_flag_mylists_list' => array(
|
||||||
|
'template' => 'materio-flag-mylists-list',
|
||||||
|
'path' => drupal_get_path('module', 'materio_flag').'/templates',
|
||||||
|
'variables' => array(
|
||||||
|
'count' => 0,
|
||||||
|
'items' => array(),
|
||||||
|
'view_mode' => 'teaser',
|
||||||
|
'pager' => NULL,
|
||||||
|
'fid' => null,
|
||||||
|
'name' => null,
|
||||||
|
'title' => null,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function template_preprocess_materio_flag_mybookmarks_block($vars){
|
function template_preprocess_materio_flag_mybookmarks_block(&$vars){
|
||||||
// dsm($vars, 'vars');
|
// dsm($vars, 'vars');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function template_preprocess_materio_flag_mylists_block($vars){
|
function template_preprocess_materio_flag_mylists_block(&$vars){
|
||||||
|
// dsm($vars, 'vars');
|
||||||
|
}
|
||||||
|
|
||||||
|
function template_preprocess_materio_flag_mylists_nav_block(&$vars){
|
||||||
// dsm($vars, 'vars');
|
// dsm($vars, 'vars');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,3 +408,19 @@ function theme_materio_flag_mylists_entity_links($vars){
|
|||||||
return theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'flag-lists-entity-links')));
|
return theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'flag-lists-entity-links')));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function template_preprocess_materio_flag_mylists_list(&$vars) {
|
||||||
|
|
||||||
|
$vars['list_count'] = format_plural(
|
||||||
|
$vars['count'],
|
||||||
|
'@name @title contains 1 item.', // in @sec seconds
|
||||||
|
'@name @title contains @count items.', // in @sec seconds
|
||||||
|
array(
|
||||||
|
'@name' => $vars['name'],
|
||||||
|
'@title' => $vars['title'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// dsm($vars, '$vars');
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ function materio_flag_refresh_block($flag){
|
|||||||
case 'bookmarks':
|
case 'bookmarks':
|
||||||
$block_name = 'materio_flag_mybookmarks';
|
$block_name = 'materio_flag_mybookmarks';
|
||||||
break;
|
break;
|
||||||
case 'mylists':
|
case 'lists':
|
||||||
$block_name = 'materio_flag_mylists';
|
$block_name = 'materio_flag_mylists';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -62,14 +62,54 @@ function materio_flag_createlist_form($type){
|
|||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// } elseif (isset($return)) {
|
// } elseif (isset($return)) {
|
||||||
$form_state['build_info']['args'] = array(null, $type);
|
|
||||||
// $form = drupal_get_form('flag_lists_form', $form_state);//, NULL, $type
|
|
||||||
$form = drupal_build_form('flag_lists_form', $form_state);
|
|
||||||
dsm($form, 'form');
|
|
||||||
|
|
||||||
// if (is_array($return)) {
|
$form_state['build_info']['args'] = array(NULL, 'breve');
|
||||||
|
// $f = drupal_get_form('flag_lists_form', $form_state);
|
||||||
|
// dsm($f);
|
||||||
|
|
||||||
|
$form = array(
|
||||||
|
'#type' => 'form',
|
||||||
|
'#id' => 'materio-flag-create-list-form',
|
||||||
|
);
|
||||||
|
|
||||||
|
$form['type'] = array(
|
||||||
|
'#type' => 'hidden',
|
||||||
|
'#value' => $type,
|
||||||
|
'#name' => 'type',
|
||||||
|
);
|
||||||
|
|
||||||
|
$form['listname'] = array(
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('Create new @name', array('@name'=>variable_get('flag_lists_name', 'list'))),
|
||||||
|
'#default_value' => '',
|
||||||
|
// '#size' => 100,
|
||||||
|
'#maxlength' => 255,
|
||||||
|
'#name' => 'flag-lists-name',
|
||||||
|
'#description' => t('A short, descriptive title for this Folder list. Limit to 255 characters.'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$form['actions'] = array(
|
||||||
|
'#prefix' => '<div class="actions">',
|
||||||
|
'#suffix' => '</div>',
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$form['actions']['cancel'] = array(
|
||||||
|
'#type' => 'button',
|
||||||
|
'#value' => t('cancel'),
|
||||||
|
'#name' => 'cancel',
|
||||||
|
);
|
||||||
|
|
||||||
|
$form['actions']['create'] = array(
|
||||||
|
'#type' => 'submit',
|
||||||
|
'#value' => t('create'),
|
||||||
|
'#name' => 'create',
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// dsm($form, 'form');
|
||||||
|
|
||||||
$return = drupal_render($form);
|
$return = drupal_render($form);
|
||||||
// }
|
|
||||||
|
|
||||||
$rep = array(
|
$rep = array(
|
||||||
'return'=>$return,
|
'return'=>$return,
|
||||||
@ -81,19 +121,115 @@ function materio_flag_createlist_form($type){
|
|||||||
}else{
|
}else{
|
||||||
drupal_json_output($rep);
|
drupal_json_output($rep);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function materio_flag_nodelinks(){
|
||||||
|
$nids = explode(';', $_REQUEST['nids']);
|
||||||
|
|
||||||
/**
|
if(count($nids)){
|
||||||
* materio_flag_createlist($type, $nid)
|
foreach ($nids as $nid) {
|
||||||
*
|
$node = node_load($nid);
|
||||||
*/
|
$lks = materio_flag_get_entity_links($node, 'node');
|
||||||
function materio_flag_createlist($title, $nid = null){
|
$links[$nid] = $lks;
|
||||||
drupal_get_form('flag_lists_form', $title);
|
}
|
||||||
|
|
||||||
|
$rep = array(
|
||||||
|
"status" => 1,
|
||||||
|
"nids" => $nids,
|
||||||
|
'links' => $links,
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
$rep['status'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
drupal_json_output($rep);
|
||||||
|
}
|
||||||
|
|
||||||
|
function materio_flag_user_lists($fid){
|
||||||
|
global $user;
|
||||||
|
$flag = flag_lists_get_flag($fid);
|
||||||
|
// dsm($flag, 'flag');
|
||||||
|
|
||||||
|
$flaged_content = flag_lists_get_flagged_content($fid, $user->uid);
|
||||||
|
// dsm($flaged_content, 'flaged_content');
|
||||||
|
|
||||||
|
$viewmode = isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full');
|
||||||
|
|
||||||
|
$limit = variable_get($viewmode.'_limite', '10');
|
||||||
|
$offset = pager_find_page() * $limit;
|
||||||
|
$count = count($flaged_content);
|
||||||
|
$max = $offset+$limit > $count ? $count : $offset+$limit;
|
||||||
|
|
||||||
|
for ($i=$offset; $i < $max; $i++) {
|
||||||
|
if($flaged_content[$i]->entity_type == 'node'){
|
||||||
|
$items[] = node_load($flaged_content[$i]->entity_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret['#items'] = $items;
|
||||||
|
$ret['#theme'] = 'materio_flag_mylists_list';
|
||||||
|
$ret['#view_mode'] = $viewmode;
|
||||||
|
$ret['#fid'] = $fid;
|
||||||
|
$ret['#count'] = $count;
|
||||||
|
$ret['#name'] = variable_get('flag_lists_name', 'list');
|
||||||
|
$ret['#title'] = $flag->title;
|
||||||
|
|
||||||
|
pager_default_initialize($count, $limit);
|
||||||
|
$ret['#pager'] = theme('pager');
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function materio_flag_ajax_list($fid, $page = 0){
|
||||||
|
$debug = false;
|
||||||
|
|
||||||
|
$_GET['page'] = $page;
|
||||||
|
|
||||||
|
$path = 'lists/'.$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')) {
|
||||||
|
drupal_goto($path, array('query'=>array('page'=>$page)), 301);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get results
|
||||||
|
menu_set_active_item($path);
|
||||||
|
$return = menu_execute_active_handler($path, FALSE);
|
||||||
|
|
||||||
|
// dsm($return, '$return');
|
||||||
|
|
||||||
|
if (is_int($return)) {
|
||||||
|
switch ($return) {
|
||||||
|
case MENU_NOT_FOUND :
|
||||||
|
drupal_add_http_header('Status', '404 Not Found');
|
||||||
|
break;
|
||||||
|
case MENU_ACCESS_DENIED :
|
||||||
|
drupal_add_http_header('Status', '403 Forbidden');
|
||||||
|
break;
|
||||||
|
case MENU_SITE_OFFLINE :
|
||||||
|
drupal_add_http_header('Status', '503 Service unavailable');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} elseif (isset($return)) {
|
||||||
|
|
||||||
|
if (is_array($return)) {
|
||||||
|
$return = drupal_render($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rep = array(
|
||||||
|
'return' => $return,
|
||||||
|
'path' => $path,
|
||||||
|
'title' => 'folder',
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
dsm($rep, 'rep');
|
||||||
|
return "debug display";
|
||||||
|
}else{
|
||||||
|
drupal_json_output($rep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -227,6 +227,21 @@ function materio_search_api_search_form($form, &$form_state){
|
|||||||
global $user;
|
global $user;
|
||||||
$form = array();
|
$form = array();
|
||||||
|
|
||||||
|
|
||||||
|
$args = arg();
|
||||||
|
$path = array_shift($args);
|
||||||
|
$keys = implode('/', $args);
|
||||||
|
|
||||||
|
$form['searchfield'] = array(
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#default_value' => $path == 'explore' ? $keys : "", // TODO: set the search page path global or a variable in settings
|
||||||
|
// '#value' => $keys,
|
||||||
|
'#autocomplete_path' => 'materiosearchapi/autocomplete/searchapi',
|
||||||
|
//'#autocomplete_path' => 'materiosearchapi/autocomplete/dbselect',
|
||||||
|
'#size' => 30,
|
||||||
|
'#maxlength' => 1024,
|
||||||
|
);
|
||||||
|
|
||||||
if(user_access('use materio search api filters')){
|
if(user_access('use materio search api filters')){
|
||||||
|
|
||||||
$index = search_api_index_load(variable_get('mainsearchindex', -1));
|
$index = search_api_index_load(variable_get('mainsearchindex', -1));
|
||||||
@ -247,20 +262,6 @@ function materio_search_api_search_form($form, &$form_state){
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = arg();
|
|
||||||
$path = array_shift($args);
|
|
||||||
$keys = implode('/', $args);
|
|
||||||
|
|
||||||
$form['searchfield'] = array(
|
|
||||||
'#type' => 'textfield',
|
|
||||||
'#default_value' => $path == 'explore' ? $keys : "", // TODO: set the search page path global or a variable in settings
|
|
||||||
// '#value' => $keys,
|
|
||||||
'#autocomplete_path' => 'materiosearchapi/autocomplete/searchapi',
|
|
||||||
//'#autocomplete_path' => 'materiosearchapi/autocomplete/dbselect',
|
|
||||||
'#size' => 30,
|
|
||||||
'#maxlength' => 1024,
|
|
||||||
);
|
|
||||||
|
|
||||||
$form['create'] = array(
|
$form['create'] = array(
|
||||||
'#type' => 'image_button',
|
'#type' => 'image_button',
|
||||||
'#src' => drupal_get_path('module', 'materio_search_api') . '/images/search.png',
|
'#src' => drupal_get_path('module', 'materio_search_api') . '/images/search.png',
|
||||||
@ -307,22 +308,27 @@ function materio_search_api_search_form_submit($form, &$form_state){
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_form_alter().
|
* viewmode
|
||||||
*
|
|
||||||
* Adds language fields to user forms.
|
|
||||||
*/
|
*/
|
||||||
// TODO: user can choose preferred view mode
|
|
||||||
// function materio_search_api_form_alter(&$form, &$form_state, $form_id) {
|
|
||||||
// if (user_access('use materio search api viewmode selection')) {
|
|
||||||
// if ($form_id == 'user_register_form' || ($form_id == 'user_profile_form' && $form['#user_category'] == 'account')) {
|
|
||||||
// materio_search_api_viewmode_selector_form($form, $form_state, $form['#user']);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function materio_search_api_viewmode_selector_form(&$form, &$form_state, $user) {
|
function _materio_search_api_change_viewmode($vm){
|
||||||
|
// dsm($vm, '_materio_search_api_change_viewmode');
|
||||||
|
|
||||||
// }
|
global $user;
|
||||||
|
// dsm($user, 'user');
|
||||||
|
|
||||||
|
$entity_infos = entity_get_info();
|
||||||
|
// dsm($entity_infos, 'entity_infos');
|
||||||
|
|
||||||
|
if (in_array($vm, variable_get('availableviewmodes', array()))) {
|
||||||
|
user_save($user, array("data"=>array('materiosearchapi_viewmode' => $vm)));
|
||||||
|
$rep = array('statut'=>'saved');
|
||||||
|
}else{
|
||||||
|
$rep = array('statut'=>'viewmode not allowed');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rep;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* - - - - - - - - - - - - THEME - - - - - - - - - - - -
|
* - - - - - - - - - - - - THEME - - - - - - - - - - - -
|
||||||
@ -409,10 +415,29 @@ function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
|
|||||||
$entity_infos = entity_get_info();
|
$entity_infos = entity_get_info();
|
||||||
// dsm($entity_infos, 'entity_infos');
|
// dsm($entity_infos, 'entity_infos');
|
||||||
|
|
||||||
|
// TODO: refaire les boutons view modes pour qu'il fonctionne sans javascript
|
||||||
|
// faire un lien vers l'enregistrement du mode puis un reload de la page courante
|
||||||
$content = '<div class="btn-group btn-group-vertical">';
|
$content = '<div class="btn-group btn-group-vertical">';
|
||||||
foreach ($entity_infos['node']['view modes'] as $viewmode => $value) {
|
foreach ($entity_infos['node']['view modes'] as $viewmode => $value) {
|
||||||
if(in_array($viewmode, $availableviewmodes)){
|
if(in_array($viewmode, $availableviewmodes)){
|
||||||
$content .= '<div class="viewmode-link viewmode-'.$viewmode.($active == $viewmode ? " active" : '').'" rel="'.$viewmode.'"><span class="inner">'.$value['label'].'</span></div>';
|
$link = l(
|
||||||
|
'<span class="inner">'.$value['label'].'</span>',
|
||||||
|
'materiosearchapi/viewmode/change/'.$viewmode,
|
||||||
|
array(
|
||||||
|
'query' => drupal_get_destination(),
|
||||||
|
'html' => true,
|
||||||
|
'attributes' => array(
|
||||||
|
'class' => array(
|
||||||
|
'viewmode-link',
|
||||||
|
'viewmode-'.$viewmode,
|
||||||
|
$active == $viewmode ? " active" : ''
|
||||||
|
),
|
||||||
|
'rel' => $viewmode
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$content .= $link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$content .= '</div>';
|
$content .= '</div>';
|
||||||
@ -497,7 +522,7 @@ function template_preprocess_materio_search_api_actuality(&$vars){
|
|||||||
// $items[] = node_load($nid);
|
// $items[] = node_load($nid);
|
||||||
// }
|
// }
|
||||||
// $vars['items'] = $items;
|
// $vars['items'] = $items;
|
||||||
|
$vars['actualities_infos'] = t('Actualities by materiO\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +119,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function materio_search_api_results_search(){//, $limit = 20, $page = 0
|
function materio_search_api_results_search(){
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
//dsm("materio_search_api_results_search");
|
//dsm("materio_search_api_results_search");
|
||||||
@ -166,8 +166,6 @@ function materio_search_api_results_search(){//, $limit = 20, $page = 0
|
|||||||
|
|
||||||
$query = search_api_query($index_machine_name, array('parse mode'=>'direct'))
|
$query = search_api_query($index_machine_name, array('parse mode'=>'direct'))
|
||||||
->keys(implode(' ', $keys))
|
->keys(implode(' ', $keys))
|
||||||
// TODO: add bundle filter
|
|
||||||
// ->condition('type', 'breve')
|
|
||||||
->range($offset, $limit);
|
->range($offset, $limit);
|
||||||
|
|
||||||
$filter = $query->createFilter('OR');
|
$filter = $query->createFilter('OR');
|
||||||
@ -256,11 +254,14 @@ function materio_search_api_results_search(){//, $limit = 20, $page = 0
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function materio_search_api_actuality(){
|
function materio_search_api_actuality(){
|
||||||
|
global $user;
|
||||||
|
|
||||||
$date = strtotime('-6 month');
|
$date = strtotime('-6 month');
|
||||||
|
|
||||||
|
$viewmode = isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full');
|
||||||
$limit = 10;//variable_get($viewmode.'_limite', '10');
|
$limit = 10;//variable_get($viewmode.'_limite', '10');
|
||||||
$offset = pager_find_page() * $limit;
|
$offset = pager_find_page() * $limit;
|
||||||
|
// dsm($offset);
|
||||||
|
|
||||||
$query = new EntityFieldQuery;
|
$query = new EntityFieldQuery;
|
||||||
$query
|
$query
|
||||||
@ -308,9 +309,20 @@ function materio_search_api_actuality(){
|
|||||||
|
|
||||||
return theme('materio_search_api_actuality', array(
|
return theme('materio_search_api_actuality', array(
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
'view_mode' => 'cardmedium',
|
'view_mode' => $viewmode,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'pager' => theme('pager'),
|
'pager' => theme('pager'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function materio_search_api_viewmode_change($vm){
|
||||||
|
dsm($vm, 'materio_search_api_viewmode_change');
|
||||||
|
$rep = _materio_search_api_change_viewmode($vm);
|
||||||
|
|
||||||
|
//return 'debug mode for materio_search_api_viewmode_change';
|
||||||
|
// drupal_json_output($rep);
|
||||||
|
|
||||||
|
drupal_goto();
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -90,20 +90,21 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
|||||||
function materio_search_api_ajax_viewmode_change($vm){
|
function materio_search_api_ajax_viewmode_change($vm){
|
||||||
// dsm($vm);
|
// dsm($vm);
|
||||||
|
|
||||||
global $user;
|
// global $user;
|
||||||
// dsm($user, 'user');
|
// // dsm($user, 'user');
|
||||||
|
|
||||||
$entity_infos = entity_get_info();
|
// $entity_infos = entity_get_info();
|
||||||
// dsm($entity_infos, 'entity_infos');
|
// // dsm($entity_infos, 'entity_infos');
|
||||||
|
|
||||||
if (in_array($vm, variable_get('availableviewmodes', array()))) {
|
// if (in_array($vm, variable_get('availableviewmodes', array()))) {
|
||||||
user_save($user, array("data"=>array('materiosearchapi_viewmode' => $vm)));
|
// user_save($user, array("data"=>array('materiosearchapi_viewmode' => $vm)));
|
||||||
$rep = array('statut'=>'saved');
|
// $rep = array('statut'=>'saved');
|
||||||
}else{
|
// }else{
|
||||||
$rep = array('statut'=>'viewmode not allowed');
|
// $rep = array('statut'=>'viewmode not allowed');
|
||||||
}
|
// }
|
||||||
|
$_GET['page'] = 0;
|
||||||
|
$rep = _materio_search_api_change_viewmode($vm);
|
||||||
|
|
||||||
//return 'debug mode for materio_search_api_viewmode_change';
|
|
||||||
drupal_json_output($rep);
|
drupal_json_output($rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<section class="mylists">
|
<section class="mylists">
|
||||||
<?php foreach ($lists as $name => $list): ?>
|
<?php foreach ($lists as $name => $list): ?>
|
||||||
<h2 class="listname"><?php print $list['list']->title; ?></h2>
|
<?php //dsm($list, 'list');?>
|
||||||
<div class="flaged"> <?php print render(entity_view('node', $list['content'], $viewmode)); ?> </div>
|
<h2 class="listname <?php print $list['list']->name; ?>">
|
||||||
|
<span><?php print $list['list']->title.' ('.count($list['content']).')'; ?></span>
|
||||||
|
<a class="open-list" href="<?php print $list['list']->path; ?>"><?php print t('open this @name', array('@name'=>variable_get('flag_lists_name', 'list'))) ;?></a>
|
||||||
|
</h2>
|
||||||
|
<div class="flaged <?php print $list['list']->name; ?>"> <?php print render(entity_view('node', $list['content'], $viewmode)); ?> </div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</section>
|
</section>
|
9
templates/materio-flag-mylists-list.tpl.php
Normal file
9
templates/materio-flag-mylists-list.tpl.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php //dsm($variables, '$variables'); ?>
|
||||||
|
<div class="materio-flags-list <?php print ' view-mode-' . $variables['view_mode'];?>" fid="<?php print $variables['fid']; ?>">
|
||||||
|
<div class="flaglist-items">
|
||||||
|
<p class="flaglist-infos"><?php print $list_count; ?></p>
|
||||||
|
<?php print render(entity_view('node', $items, $variables['view_mode'])); ?>
|
||||||
|
</div>
|
||||||
|
<?php print $pager; ?>
|
||||||
|
</div>
|
||||||
|
|
7
templates/materio-flag-mylists-nav-block.tpl.php
Normal file
7
templates/materio-flag-mylists-nav-block.tpl.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<section class="mylists">
|
||||||
|
<ul>
|
||||||
|
<?php foreach ($flags as $name => $flag): ?>
|
||||||
|
<li class="flaglist <?php print $flag->name; ?>"><?php print $flag->title; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</section>
|
@ -3,6 +3,7 @@
|
|||||||
?>
|
?>
|
||||||
<section class="materiobase-actuality">
|
<section class="materiobase-actuality">
|
||||||
<?php if($count): ?>
|
<?php if($count): ?>
|
||||||
|
<p class="actualities-infos"><?php print $actualities_infos; ?></p>
|
||||||
<div class="actuality-items">
|
<div class="actuality-items">
|
||||||
<?php print render(entity_view('node', $items, $view_mode)); ?>
|
<?php print render(entity_view('node', $items, $view_mode)); ?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user