Page title
Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
b1bf1c9387
commit
948913bc82
5
js/materio_page_title-ck.js
Normal file
5
js/materio_page_title-ck.js
Normal file
File diff suppressed because one or more lines are too long
27
js/materio_page_title.js
Normal file
27
js/materio_page_title.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// @codekit-prepend "gui.js"
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
MaterioPageTitle = function(){
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
$(document).bind('materio-page-title-refresh-block', onRefreshBlock);
|
||||||
|
};
|
||||||
|
|
||||||
|
function onRefreshBlock(event){
|
||||||
|
trace('onRefreshBlock', event);
|
||||||
|
// var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_page_title/refresh/block';
|
||||||
|
// $.getJSON(url, function(json){
|
||||||
|
// trace('page title json', json);
|
||||||
|
// $('#block-materio-page-title-materio-page-title').replaceWith(json.block);
|
||||||
|
// });
|
||||||
|
if(typeof event.title !== 'undefined')
|
||||||
|
$('#block-materio-page-title-materio-page-title h1').html(event.title);
|
||||||
|
};
|
||||||
|
|
||||||
|
init();
|
||||||
|
};
|
||||||
|
|
||||||
|
var materiopagetitle = new MaterioPageTitle();
|
||||||
|
|
||||||
|
})(jQuery);
|
File diff suppressed because one or more lines are too long
@ -95,7 +95,7 @@ MaterioSearchApiAjax = function(){
|
|||||||
|
|
||||||
var event = jQuery.Event('new-history-page');
|
var event = jQuery.Event('new-history-page');
|
||||||
event.path = path;
|
event.path = path;
|
||||||
event.title = json.keys;
|
event.title = json.title;
|
||||||
event.content = json.return;
|
event.content = json.return;
|
||||||
$.event.trigger(event);
|
$.event.trigger(event);
|
||||||
|
|
||||||
@ -130,6 +130,7 @@ MaterioSearchApiAjax = function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
function changeContent(json){
|
function changeContent(json){
|
||||||
|
trace('MaterioSearchApiAjax changeContent | json', json);
|
||||||
if(json.return){
|
if(json.return){
|
||||||
$.event.trigger('loaded-content');
|
$.event.trigger('loaded-content');
|
||||||
$('.inner-content',_$content).html(json.return);
|
$('.inner-content',_$content).html(json.return);
|
||||||
@ -142,6 +143,7 @@ MaterioSearchApiAjax = function(){
|
|||||||
function triggerContentChanged(){
|
function triggerContentChanged(){
|
||||||
var event = jQuery.Event('resultschanged');
|
var event = jQuery.Event('resultschanged');
|
||||||
event.container = '#content .search-results, #content .actuality-items';
|
event.container = '#content .search-results, #content .actuality-items';
|
||||||
|
// event.title = json.title;
|
||||||
$.event.trigger(event);
|
$.event.trigger(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -230,8 +232,8 @@ MaterioSearchApiAjax = function(){
|
|||||||
if (json.statut == "saved"){
|
if (json.statut == "saved"){
|
||||||
// loadResults(getSearchKeys());
|
// loadResults(getSearchKeys());
|
||||||
$.event.trigger('view-mode-changed');
|
$.event.trigger('view-mode-changed');
|
||||||
$('.viewmode-link').removeClass('active');
|
$('.viewmode-link, .viewmode-link i').removeClass('active');
|
||||||
$btn.addClass('active');
|
$btn.addClass('active').find('i').addClass('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -207,7 +207,7 @@ 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'){
|
||||||
|
if(user_access('create flag lists')){
|
||||||
$flaglists_links = materio_flag_get_entity_links($entity, $type, $view_mode);
|
$flaglists_links = materio_flag_get_entity_links($entity, $type, $view_mode);
|
||||||
// dsm($flaglists_links, 'flaglists_links');
|
// dsm($flaglists_links, 'flaglists_links');
|
||||||
|
|
||||||
@ -216,6 +216,7 @@ function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
|
|||||||
drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
|
drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
|
||||||
drupal_add_js(drupal_get_path('module', 'flag') . '/theme/flag.js');
|
drupal_add_js(drupal_get_path('module', 'flag') . '/theme/flag.js');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function materio_flag_get_entity_links($entity, $type, $view_mode = null){
|
function materio_flag_get_entity_links($entity, $type, $view_mode = null){
|
||||||
|
@ -151,6 +151,8 @@ function materio_flag_user_lists($fid){
|
|||||||
$flag = flag_lists_get_flag($fid);
|
$flag = flag_lists_get_flag($fid);
|
||||||
// dsm($flag, 'flag');
|
// dsm($flag, 'flag');
|
||||||
|
|
||||||
|
drupal_set_title('<i class="icon-materio-folder"></i>'.check_plain($flag->title), PASS_THROUGH);
|
||||||
|
|
||||||
$flaged_content = flag_lists_get_flagged_content($fid, $user->uid);
|
$flaged_content = flag_lists_get_flagged_content($fid, $user->uid);
|
||||||
// dsm($flaged_content, 'flaged_content');
|
// dsm($flaged_content, 'flaged_content');
|
||||||
|
|
||||||
@ -222,7 +224,7 @@ function materio_flag_ajax_list($fid, $page = 0){
|
|||||||
$rep = array(
|
$rep = array(
|
||||||
'return' => $return,
|
'return' => $return,
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
'title' => 'folder',
|
'title' => drupal_get_title(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
|
23
materio_page_title.info
Normal file
23
materio_page_title.info
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
name = Materio Page Title
|
||||||
|
description = "Provide a block with the current page title, and the ajax api to refresh it"
|
||||||
|
|
||||||
|
; Core version (required)
|
||||||
|
core = 7.x
|
||||||
|
|
||||||
|
; Package name (see http://drupal.org/node/542202 for a list of names)
|
||||||
|
package = Materio
|
||||||
|
|
||||||
|
; PHP version requirement (optional)
|
||||||
|
; php = 5.2
|
||||||
|
|
||||||
|
; Loadable code files
|
||||||
|
files[] = materio_page_title.module
|
||||||
|
|
||||||
|
; Module dependencies
|
||||||
|
; dependencies[] = materio_search_api
|
||||||
|
|
||||||
|
; Configuration page
|
||||||
|
; configure = admin/config/materio_search_api_ajax
|
||||||
|
|
||||||
|
; For further information about configuration options, see
|
||||||
|
; - http://drupal.org/node/542202
|
76
materio_page_title.module
Normal file
76
materio_page_title.module
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_block_info().
|
||||||
|
*/
|
||||||
|
function materio_page_title_block_info() {
|
||||||
|
// This example comes from node.module.
|
||||||
|
/*
|
||||||
|
*$blocks['syndicate'] = array(
|
||||||
|
* 'info' => t('Syndicate'),
|
||||||
|
* 'cache' => DRUPAL_NO_CACHE
|
||||||
|
*);
|
||||||
|
*/
|
||||||
|
$blocks['materio_page_title'] = array(
|
||||||
|
'info' => t('Materio page title'),
|
||||||
|
'cache' => DRUPAL_NO_CACHE
|
||||||
|
);
|
||||||
|
|
||||||
|
return $blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_block_view().
|
||||||
|
*/
|
||||||
|
function materio_page_title_block_view($delta = '') {
|
||||||
|
$block = array();
|
||||||
|
|
||||||
|
switch ($delta) {
|
||||||
|
case 'materio_page_title':
|
||||||
|
$block['subject'] = t('Page title');
|
||||||
|
$block['content'] = theme('materio_page_title', array('title' => drupal_get_title()));
|
||||||
|
drupal_add_js(drupal_get_path('module', 'materio_page_title').'/js/materio_page_title-ck.js');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_theme().
|
||||||
|
*/
|
||||||
|
function materio_page_title_theme($existing, $type, $theme, $path) {
|
||||||
|
return array(
|
||||||
|
'materio_page_title' => array(
|
||||||
|
'variables' => array('title' => NULL,),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function theme_materio_page_title($vars){
|
||||||
|
if($vars['title'])
|
||||||
|
return '<h1 id="materio-page-title" class="page-title">'.$vars['title'].'</h1>';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_menu().
|
||||||
|
*/
|
||||||
|
// function materio_page_title_menu() {
|
||||||
|
// $items = array();
|
||||||
|
|
||||||
|
// $base = array(
|
||||||
|
// 'type' => MENU_CALLBACK,
|
||||||
|
// 'file' => 'materio_page_title.pages.inc',
|
||||||
|
// );
|
||||||
|
|
||||||
|
// $items['materio_page_title/refresh/block'] = $base+array(
|
||||||
|
// 'title' => 'Materio page title refresh block',
|
||||||
|
// 'page callback' => 'materio_page_title_refresh_block',
|
||||||
|
// 'page arguments' => array(),
|
||||||
|
// 'access callback' => TRUE,
|
||||||
|
// );
|
||||||
|
|
||||||
|
// return $items;
|
||||||
|
// }
|
14
materio_page_title.pages.inc
Normal file
14
materio_page_title.pages.inc
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// function materio_page_title_refresh_block(){
|
||||||
|
|
||||||
|
// $block = block_load('materio_page_title', 'materio_page_title');
|
||||||
|
// $block_content = _block_render_blocks(array($block));
|
||||||
|
// $build = _block_get_renderable_array($block_content);
|
||||||
|
// $block_rendered = drupal_render($build);
|
||||||
|
|
||||||
|
// $rep['block'] = $block_rendered;
|
||||||
|
|
||||||
|
// drupal_json_output($rep);
|
||||||
|
// }
|
@ -258,7 +258,7 @@ function materio_search_api_search_form($form, &$form_state){
|
|||||||
'#type'=>'checkboxes',
|
'#type'=>'checkboxes',
|
||||||
'#options' => $bundles_options,
|
'#options' => $bundles_options,
|
||||||
'#default_value' => $user_bundles_filter,
|
'#default_value' => $user_bundles_filter,
|
||||||
'#attributes' => array('class'=>array('btn-group')),
|
// '#attributes' => array('class'=>array('btn-group')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
|
|||||||
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)){
|
||||||
$link = l(
|
$link = l(
|
||||||
'<span class="inner">'.$value['label'].'</span>',
|
'<i class="icon-materio-viewmode-'.$viewmode.($active == $viewmode ? " active" : '').'"></i><span class="inner">'.$value['label'].'</span>',
|
||||||
'materiosearchapi/viewmode/change/'.$viewmode,
|
'materiosearchapi/viewmode/change/'.$viewmode,
|
||||||
array(
|
array(
|
||||||
'query' => drupal_get_destination(),
|
'query' => drupal_get_destination(),
|
||||||
|
@ -144,7 +144,7 @@ function materio_search_api_results_search(){
|
|||||||
foreach ($words[0] as $word) {
|
foreach ($words[0] as $word) {
|
||||||
// $word = preg_replace('/\b-/', '\-', trim($word));
|
// $word = preg_replace('/\b-/', '\-', trim($word));
|
||||||
// dsm($word);
|
// dsm($word);
|
||||||
$keys[] = $word;
|
$keys[] = trim($word);
|
||||||
}
|
}
|
||||||
|
|
||||||
$index_machine_name = variable_get('mainsearchindex', -1);
|
$index_machine_name = variable_get('mainsearchindex', -1);
|
||||||
@ -224,6 +224,7 @@ function materio_search_api_results_search(){
|
|||||||
$ret['results']['#view_mode'] = $viewmode;
|
$ret['results']['#view_mode'] = $viewmode;
|
||||||
$ret['results']['#keys'] = $keys;
|
$ret['results']['#keys'] = $keys;
|
||||||
|
|
||||||
|
drupal_set_title('<i class="icon-materio-search"></i>'.check_plain($typed), PASS_THROUGH);
|
||||||
|
|
||||||
// Load pager.
|
// Load pager.
|
||||||
// if ($results['result count'] > $page->options['per_page']) {
|
// if ($results['result count'] > $page->options['per_page']) {
|
||||||
@ -305,7 +306,7 @@ function materio_search_api_actuality(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drupal_set_title(t('Actualities'));
|
||||||
|
|
||||||
return theme('materio_search_api_actuality', array(
|
return theme('materio_search_api_actuality', array(
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
|
@ -73,6 +73,7 @@ function materio_search_api_ajax_search($keys, $page = 0){
|
|||||||
'search_path'=>$search_path,
|
'search_path'=>$search_path,
|
||||||
'return'=>$return,
|
'return'=>$return,
|
||||||
'active_types'=>$active_types,
|
'active_types'=>$active_types,
|
||||||
|
'title' => drupal_get_title(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
@ -146,6 +147,7 @@ function materio_search_api_ajax_actuality($page = 0){
|
|||||||
|
|
||||||
$rep = array(
|
$rep = array(
|
||||||
'return'=>$return,
|
'return'=>$return,
|
||||||
|
'title' => drupal_get_title(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user