merge sandbox with prod
This commit is contained in:
commit
5835745cc2
@ -1,5 +1,5 @@
|
||||
// @codekit-prepend "gui.js"
|
||||
// @koala-prepend "gui_ck_fw/gui.js"
|
||||
// @koala-prepend "gui.js"
|
||||
|
||||
|
||||
(function($) {
|
||||
@ -126,11 +126,12 @@ MaterioFlag = function(){
|
||||
var type = 'lists';
|
||||
}
|
||||
|
||||
|
||||
if(type != undefined){
|
||||
var id = '#block-materio-flag-materio-flag-my'+type;
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/refresh/block/'+type;
|
||||
$.getJSON(url, function(json){
|
||||
//trace('MaterioFlag :: block refreshed '+type, json);
|
||||
// trace('MaterioFlag :: block refreshed '+type, json);
|
||||
|
||||
$(id).replaceWith(json.block);
|
||||
$('#block-materio-flag-materio-flag-mylists-nav').replaceWith(json.block_nav);
|
||||
@ -162,6 +163,7 @@ MaterioFlag = function(){
|
||||
.addClass('ajax-processed');
|
||||
}
|
||||
|
||||
|
||||
$('a.flag-lists-create:not(.ajax-processed)', container)
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax-processed');
|
||||
@ -700,6 +702,8 @@ MaterioFlag = function(){
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
14
js/materio_flag.min.js
vendored
14
js/materio_flag.min.js
vendored
@ -9,8 +9,8 @@
|
||||
function trace(s,o){
|
||||
if(window.console && window.console.debug){
|
||||
arguments.length === 2 ? window.console.debug(s,o) : window.console.debug(s);
|
||||
}else if(window.console && window.console.log){
|
||||
arguments.length === 2 ? window.console.log(s,o) : window.console.log(s);
|
||||
}else if(console && console.log){
|
||||
arguments.length === 2 ? console.log(s,o) : console.log(s);
|
||||
}
|
||||
};
|
||||
|
||||
@ -30,7 +30,7 @@ function loadjscssfile(filename, filetype){
|
||||
}
|
||||
if (typeof fileref!="undefined")
|
||||
document.getElementsByTagName("head")[0].appendChild(fileref)
|
||||
}
|
||||
};
|
||||
|
||||
// ------ TIMEOUT
|
||||
|
||||
@ -369,7 +369,7 @@ function getElementAngle(x1, y1, x2, y2) {
|
||||
|
||||
|
||||
// @codekit-prepend "gui.js"
|
||||
// @koala-prepend "gui_ck_fw/gui.js"
|
||||
// @koala-prepend "gui.js"
|
||||
|
||||
|
||||
(function($) {
|
||||
@ -496,11 +496,12 @@ MaterioFlag = function(){
|
||||
var type = 'lists';
|
||||
}
|
||||
|
||||
|
||||
if(type != undefined){
|
||||
var id = '#block-materio-flag-materio-flag-my'+type;
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/refresh/block/'+type;
|
||||
$.getJSON(url, function(json){
|
||||
//trace('MaterioFlag :: block refreshed '+type, json);
|
||||
// trace('MaterioFlag :: block refreshed '+type, json);
|
||||
|
||||
$(id).replaceWith(json.block);
|
||||
$('#block-materio-flag-materio-flag-mylists-nav').replaceWith(json.block_nav);
|
||||
@ -532,6 +533,7 @@ MaterioFlag = function(){
|
||||
.addClass('ajax-processed');
|
||||
}
|
||||
|
||||
|
||||
$('a.flag-lists-create:not(.ajax-processed)', container)
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax-processed');
|
||||
@ -1070,6 +1072,8 @@ MaterioFlag = function(){
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
@ -83,6 +83,11 @@ MaterioUser = function(){
|
||||
|
||||
$("#user-register-form #edit-submit, #user-register-form #edit-submit--2", $modal).click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// disable submit button to avoid duplicate user creation
|
||||
// console.log('click', this);
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
@ -120,12 +125,21 @@ MaterioUser = function(){
|
||||
};
|
||||
|
||||
function onUserLoginRegisterSubmit($form, data, destination){
|
||||
// console.log('data', data);
|
||||
cleanModalErrors();
|
||||
if(data.errors != null){
|
||||
for(field in data.errors){
|
||||
$('input[name='+field+']', $form).addClass('error');
|
||||
$form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
||||
}
|
||||
|
||||
(function($form){
|
||||
setTimeout(function(){
|
||||
console.log('enabled');
|
||||
$('input[type=submit]', $form).removeAttr('disabled');
|
||||
}, 0.5*1000);
|
||||
})($form);
|
||||
|
||||
}else{
|
||||
// trace('destination = '+destination);
|
||||
window.location.pathname = destination;
|
||||
|
14
js/materio_user.min.js
vendored
14
js/materio_user.min.js
vendored
@ -453,6 +453,11 @@ MaterioUser = function(){
|
||||
|
||||
$("#user-register-form #edit-submit, #user-register-form #edit-submit--2", $modal).click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// disable submit button to avoid duplicate user creation
|
||||
// console.log('click', this);
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
@ -490,12 +495,21 @@ MaterioUser = function(){
|
||||
};
|
||||
|
||||
function onUserLoginRegisterSubmit($form, data, destination){
|
||||
// console.log('data', data);
|
||||
cleanModalErrors();
|
||||
if(data.errors != null){
|
||||
for(field in data.errors){
|
||||
$('input[name='+field+']', $form).addClass('error');
|
||||
$form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
||||
}
|
||||
|
||||
(function($form){
|
||||
setTimeout(function(){
|
||||
console.log('enabled');
|
||||
$('input[type=submit]', $form).removeAttr('disabled');
|
||||
}, 0.5*1000);
|
||||
})($form);
|
||||
|
||||
}else{
|
||||
// trace('destination = '+destination);
|
||||
window.location.pathname = destination;
|
||||
|
@ -14,9 +14,98 @@ function materio_admin_permission() {
|
||||
'title' => t('access default UC roles expiration list'),
|
||||
'description' => t('access default UC roles expiration list.'),
|
||||
),
|
||||
'access duplicate mails list' => array(
|
||||
'title' => t('access duplicate mails list'),
|
||||
'description' => t('access duplicate mails list.'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function materio_admin_menu() {
|
||||
|
||||
$items['admin/users/duplicatemails'] = array(
|
||||
'title' => "Duplicate mails",
|
||||
'page callback' => 'materio_duplicatemails',
|
||||
'access callback' => 'user_access',
|
||||
'access arguments' => array('access duplicate mails list'),
|
||||
'type' => MENU_LOCAL_TASK
|
||||
);
|
||||
|
||||
|
||||
|
||||
if(module_exists('simplenews')){
|
||||
$cats = simplenews_category_list();
|
||||
// dsm($cats, 'cats');
|
||||
foreach ($cats as $tid => $name) {
|
||||
// $items['node/%node/simplenews'] = array(
|
||||
// 'title' => 'Newsletter',
|
||||
// 'type' => MENU_LOCAL_TASK,
|
||||
// 'access callback' => 'simplenews_node_tab_access',
|
||||
// 'access arguments' => array(1),
|
||||
// 'page callback' => 'simplenews_node_tab_page',
|
||||
// 'page arguments' => array(1),
|
||||
// 'context' => MENU_LOCAL_TASK,
|
||||
// 'file' => 'includes/simplenews.admin.inc',
|
||||
// 'weight' => 2,
|
||||
// );
|
||||
$items['node/add/simplenews/'.$tid] = array(
|
||||
'title' => $name,
|
||||
'title callback' => 'check_plain',
|
||||
'page callback' => 'node_add',
|
||||
'page arguments' => array('simplenews'),
|
||||
'access callback' => 'node_access',
|
||||
'access arguments' => array('create', 'simplenews'),
|
||||
'file path' => drupal_get_path('module', 'node'),
|
||||
'file' => 'node.pages.inc',
|
||||
);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
function materio_duplicatemails(){
|
||||
$mails = db_query('SELECT mail FROM {users} GROUP BY mail HAVING count(mail) > 1')->fetchCol();
|
||||
|
||||
// Bail out early if there are no duplicates.
|
||||
if (!$mails) {
|
||||
return t('All accounts have unique email addresses.');
|
||||
}
|
||||
|
||||
// Grab all the user data for accounts with addresses identified as
|
||||
// duplicates. This is a little convoluted, but it lets us grab all the user
|
||||
// data in one shot.
|
||||
$uids = db_select('users', 'u')
|
||||
->fields('u', array('uid'))
|
||||
->condition('mail', $mails, 'IN')
|
||||
->orderBy('access', 'DESC')
|
||||
->execute()
|
||||
->fetchCol();
|
||||
$duplicate_users = user_load_multiple($uids);
|
||||
$duplicate_mails = array();
|
||||
foreach ($duplicate_users as $duplicate_user) {
|
||||
$duplicate_mails[$duplicate_user->mail][] = $duplicate_user;
|
||||
}
|
||||
|
||||
// Turn the data we've got into markup.
|
||||
$output = t('Accounts with duplicate email address:') . '<br />';
|
||||
$output = "<ul>";
|
||||
foreach ($duplicate_mails as $mail => $users) {
|
||||
$output .= "<li> <strong>$mail</strong> : <br />";
|
||||
$accounts = array();
|
||||
foreach ($users as $duplicate_user) {
|
||||
$accounts[] = l($duplicate_user->name, "user/{$duplicate_user->uid}") . ' ('. date('Y-m-d', $duplicate_user->access) .')';
|
||||
}
|
||||
$output .= implode(', ', $accounts);
|
||||
|
||||
$output .= '</li>';
|
||||
}
|
||||
$output .= "</ul>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu_alter().
|
||||
*/
|
||||
@ -35,4 +124,89 @@ function materio_admin_menu_alter(&$items){
|
||||
|
||||
# deactivate default home page
|
||||
$items['node']['access callback'] = FALSE;
|
||||
|
||||
// if(isset($items['admin/content/add/simplenews'])){
|
||||
// delete($items['admin/content/add/simplenews']);
|
||||
// $cats = simplenews_category_list();
|
||||
// dsm($cats, 'cats');
|
||||
// foreach ($cats as $tid => $name) {
|
||||
// $items['admin/content/add/simplenews/'.$tid]
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu_local_tasks_alter().
|
||||
*/
|
||||
function materio_admin_menu_local_tasks_alter(&$data, $router_item, $root_path) {
|
||||
|
||||
if ($root_path == 'admin/people/simplenews') {
|
||||
$item = menu_get_item('admin/content/simplenews');
|
||||
if ($item['access']) {
|
||||
$item['title'] = 'Go to '.$item['title'];
|
||||
$data['actions']['output'][] = array(
|
||||
'#theme' => 'menu_local_task',
|
||||
'#link' => $item,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($root_path == 'admin/content/simplenews') {
|
||||
|
||||
$cats = simplenews_category_list();
|
||||
foreach ($cats as $tid => $name) {
|
||||
$item = menu_get_item('node/add/simplenews/'.$tid);
|
||||
$item['title'] = 'Add new '.$name;
|
||||
if ($item['access']) {
|
||||
$data['actions']['output'][] = array(
|
||||
'#theme' => 'menu_local_task',
|
||||
'#link' => $item,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$item = menu_get_item('admin/people/simplenews');
|
||||
if ($item['access']) {
|
||||
$item['title'] = 'Go to '.$item['title'];
|
||||
$data['actions']['output'][] = array(
|
||||
'#theme' => 'menu_local_task',
|
||||
'#link' => $item,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_alter().
|
||||
*/
|
||||
function materio_admin_form_simplenews_node_form_alter(&$form, &$form_state, $form_id) {
|
||||
// dsm($form_id, '$form_id');
|
||||
// dsm($form_state, '$form_state');
|
||||
// dsm($form, '$form');
|
||||
// dsm($_GET, 'GET');
|
||||
|
||||
if(!$form['nid']['#value']){
|
||||
$cats = simplenews_category_list();
|
||||
$cats_tids = array_keys($cats);
|
||||
$q = parse_url($_GET['q']);
|
||||
$cat = array_pop(explode('/', $q['path']));
|
||||
// dsm($cat, 'cat');
|
||||
if(in_array($cat, $cats_tids)){
|
||||
// prepopulate type of news
|
||||
$form['field_simplenews_term']['und']['#default_value'] = $cat;
|
||||
$form['field_simplenews_term']['und']['#disabled'] = true;
|
||||
|
||||
// change default template regarding type of news
|
||||
$form['body']['und'][0]['#default_value'] = materio_admin_getSimplenewsNodeBodyTemplate($cat);
|
||||
}
|
||||
}else{
|
||||
$form['field_simplenews_term']['und']['#disabled'] = true;
|
||||
}
|
||||
|
||||
$form['body']['und'][0]['#rows'] = 50;
|
||||
|
||||
}
|
||||
|
||||
function materio_admin_getSimplenewsNodeBodyTemplate($cat){
|
||||
return file_get_contents(drupal_get_path('module', 'materio_admin').'/templates/simplenews_'.$cat.'_node.html');
|
||||
}
|
23
materio_display.info
Normal file
23
materio_display.info
Normal file
@ -0,0 +1,23 @@
|
||||
name = Materio Display
|
||||
description = "Materio display module (permissions, ...)"
|
||||
|
||||
; 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_ctools_automodal.module
|
||||
|
||||
; Module dependencies
|
||||
; dependencies[] = user
|
||||
|
||||
; Configuration page
|
||||
; configure = admin/config/materiobasemod
|
||||
|
||||
; For further information about configuration options, see
|
||||
; - http://drupal.org/node/542202
|
58
materio_display.module
Normal file
58
materio_display.module
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
// function materio_user_init() {
|
||||
// drupal_add_js(drupal_get_path('module', 'materio_user').'/js/materio_user.min.js');
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
function materio_display_permission() {
|
||||
return array(
|
||||
'view full materiau description' => array(
|
||||
'title' => t('view full materiau description'),
|
||||
'description' => t('view full materiau description'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess().
|
||||
*/
|
||||
function materio_display_preprocess_field(&$vars, $hook) {
|
||||
// dsm($vars);
|
||||
$element = $vars['element'];
|
||||
|
||||
if($element['#field_name'] == 'field_description'){
|
||||
dsm($vars);
|
||||
if(!user_access('view full materiau description')){
|
||||
$value = $element['#items'][0]['value'];
|
||||
|
||||
switch ($element['#view_mode']) {
|
||||
case 'cardbig':
|
||||
case 'cardfull':
|
||||
$limit = 210;
|
||||
break;
|
||||
default:
|
||||
$limit = 130;
|
||||
break;
|
||||
}
|
||||
$summary = truncate_utf8($value, $limit, TRUE, TRUE);
|
||||
|
||||
$summary .= '<div class="upgrade"><p>'
|
||||
. t("In order to access full description, information about manufacturers and more, you need to upgrade your account.")
|
||||
. l(t("Pricing"), 'node/11187')
|
||||
. '</p></div>';
|
||||
|
||||
// dsm($summary);
|
||||
$vars['items'][0]['#markup'] = $summary;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,7 @@ function materio_flag_refresh_block($flag){
|
||||
if(!isset($block_name))
|
||||
return;
|
||||
|
||||
$rep = array();
|
||||
$rep = array("flag"=>$flag);
|
||||
|
||||
$block = block_load('materio_flag', $block_name);
|
||||
$block_content = _block_render_blocks(array($block));
|
||||
@ -27,13 +27,13 @@ function materio_flag_refresh_block($flag){
|
||||
$block_rendered = drupal_render($build);
|
||||
$rep['block'] = $block_rendered;
|
||||
|
||||
if(isset($block_nav_name))
|
||||
if(isset($block_nav_name)){
|
||||
$block = block_load('materio_flag', $block_nav_name);
|
||||
$block_content = _block_render_blocks(array($block));
|
||||
$build = _block_get_renderable_array($block_content);
|
||||
$block_rendered = drupal_render($build);
|
||||
$rep['block_nav'] = $block_rendered;
|
||||
|
||||
}
|
||||
|
||||
drupal_json_output($rep);
|
||||
}
|
||||
|
@ -99,6 +99,11 @@ function materio_search_api_access_search(){
|
||||
return user_access('use materio search api for breves') || user_access('use materio search api');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* - - - - - - - - - - - - SOLR - - - - - - - - - - - -
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_search_api_data_type_info().
|
||||
*
|
||||
@ -107,11 +112,18 @@ function materio_search_api_access_search(){
|
||||
function materio_search_api_search_api_data_type_info() {
|
||||
return array(
|
||||
'edge_n2_kw_text' => array(
|
||||
'name' => t('Fulltext (partial)'),
|
||||
'name' => t('Fulltext (partial matching)'),
|
||||
'fallback' => 'text',
|
||||
'prefix' => 'tem',
|
||||
'always multiValued' => TRUE,
|
||||
),
|
||||
'edge_n2_kw_mapped_text' => array(
|
||||
'name' => t('Fulltext without accents (partial matching)'),
|
||||
'fallback' => 'text',
|
||||
'prefix' => 'temmap',
|
||||
'always multiValued' => TRUE,
|
||||
),
|
||||
);
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,20 +137,30 @@ function materio_search_api_search_api_solr_dynamic_field_info() {
|
||||
'prefix' => 'tem',
|
||||
'always multiValued' => TRUE,
|
||||
),
|
||||
'edge_n2_kw_mapped_text' => array(
|
||||
'prefix' => 'temmap',
|
||||
'always multiValued' => TRUE,
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hook_entity_property_info_alter().
|
||||
*
|
||||
* define own fields
|
||||
* - main taxonomy terms, the purpose is to be able to attribute differente boost on serach api depending on term order
|
||||
* - companies infos (address) : retrieve for materiau content type the companie info from the tode node
|
||||
*
|
||||
*/
|
||||
function materio_search_api_entity_property_info_alter(&$info){
|
||||
// dsm($info, 'hook_entity_property_info_alter | info');
|
||||
// watchdog('materio solr', 'materio_search_api_entity_property_info_alter', array());
|
||||
$properties = &$info['node']['properties'];
|
||||
$node_props = &$info['node']['properties'];
|
||||
|
||||
for ($i=1; $i <= 5 ; $i++) {
|
||||
$properties['materio_search_api_onthologie_term_'.$i.'_text'] = array(
|
||||
$node_props['materio_search_api_onthologie_term_'.$i.'_text'] = array(
|
||||
'type'=>'text',
|
||||
'label'=> t('Main onthologie term '.$i. ' as text (+ synonyms)'),
|
||||
// 'query callback'=>'entity_metadata_table_query',
|
||||
@ -146,28 +168,42 @@ function materio_search_api_entity_property_info_alter(&$info){
|
||||
);
|
||||
}
|
||||
|
||||
$properties['materio_search_api_onthologie_term_others_text'] = array(
|
||||
$node_props['materio_search_api_onthologie_term_others_text'] = array(
|
||||
'type'=>'list<text>',
|
||||
'label'=> t('Others onthologie terms as text (+ synonyms)'),
|
||||
// 'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_taxonomy_terms_others_text',
|
||||
);
|
||||
|
||||
$properties['materio_search_api_taglibres_text'] = array(
|
||||
$node_props['materio_search_api_taglibres_text'] = array(
|
||||
'type'=>'list<text>',
|
||||
'label'=> t('Tag libres terms as text (+ synonyms)'),
|
||||
// 'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_taglibres_terms_text',
|
||||
);
|
||||
|
||||
$company_term_props = &$info['taxonomy_term']['bundles']['company']['properties'];
|
||||
|
||||
$company_term_props['country'] = array(
|
||||
'label' => t("Country"),
|
||||
'description' => t("Company's Country get from tode node."),
|
||||
'type' => 'text',
|
||||
'getter callback' => 'company_term_property_country_get_props',
|
||||
|
||||
$node_materiau_props = &$info['node']['bundles']['materiau']['properties'];
|
||||
|
||||
$node_materiau_props['materio_search_api_node_propertie_companie'] = array(
|
||||
'type'=>'list<text>',
|
||||
'label'=> t('Manufacturers and distributors companies localised (dont addresse)'),
|
||||
// 'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_node_propertie_companie',
|
||||
);
|
||||
|
||||
|
||||
|
||||
$term_props = &$info['taxonomy_term']['properties'];
|
||||
|
||||
$term_props['materio_search_api_term_property_dup_name'] = array(
|
||||
'label' => t("Term name field dup"),
|
||||
'description' => t("Duplicate the term name field to apply different filter in solr (remove accents for instance)"),
|
||||
'type' => 'text',
|
||||
'getter callback' => 'materio_search_api_term_property_dup_name',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function materio_search_api_get_onthologie_term_1_text($item){
|
||||
@ -251,20 +287,35 @@ function materio_search_api_get_taxo_term_field_text($item, $field_name, $delta)
|
||||
return null;
|
||||
}
|
||||
|
||||
function materio_search_api_get_node_propertie_companie($item){
|
||||
// dsm($item, '$item');
|
||||
$lang = "fr";//$item->language;
|
||||
|
||||
function company_term_property_country_get_props($term){
|
||||
// dsm($term, 'company_term_property_country_get_props : term');
|
||||
if( $node = company_get_tode_node($term) ){
|
||||
// $field_values = field_get_items('node',$node,'field_public_address');
|
||||
// dsm($field_values, 'field_values');
|
||||
$languages = language_list();
|
||||
global $language;
|
||||
$language = $languages[$lang];
|
||||
|
||||
$output = rip_tags(render(field_view_field('node',$node,'field_public_address')));
|
||||
// dsm($output, 'output');
|
||||
|
||||
return $output;
|
||||
$cies = array();
|
||||
$cie_fields = array("field_company_fab", "field_company_distrib");
|
||||
foreach ($cie_fields as $cie_field_name) {
|
||||
$delta = 0;
|
||||
while( isset($item->{$cie_field_name}['und'][$delta]) ){
|
||||
$tid = $item->{$cie_field_name}['und'][$delta]['tid'];
|
||||
$cie_term = taxonomy_term_load($tid);
|
||||
if($cie_node = company_get_tode_node($cie_term)){
|
||||
$cie_node->language = $lang;
|
||||
$cie_view = node_view($cie_node, "full", $lang);
|
||||
$cie_rendered = rip_tags(drupal_render($cie_view));
|
||||
// dsm($cie_rendered, 'cie_rendered');
|
||||
$cies[] = $cie_rendered;
|
||||
}
|
||||
$delta++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
return $cies;
|
||||
}
|
||||
|
||||
function company_get_tode_node($term){
|
||||
if(module_exists('tode'))
|
||||
if( $entitys = tode_get_nids_from_term($term))
|
||||
@ -274,6 +325,7 @@ function company_get_tode_node($term){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function rip_tags($string) {
|
||||
// ----- remove HTML TAGs -----
|
||||
$string = preg_replace ('/<[^>]*>/', ' ', $string);
|
||||
@ -298,6 +350,20 @@ function rip_tags($string) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
function materio_search_api_term_property_dup_name($term){
|
||||
$lang = $term->language;
|
||||
return $term->name_field[$lang][0]['value'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* - - -- - - - - - - blocks - - - - - - - - - - -
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_block_info().
|
||||
*/
|
||||
@ -337,7 +403,16 @@ function materio_search_api_block_view($delta = '') {
|
||||
}
|
||||
break;
|
||||
case 'materio_search_api_viewmode':
|
||||
if (user_access('use materio search api viewmode selection')) {
|
||||
// restrict display on node page for materiau and breve
|
||||
$block_is_visible = true;
|
||||
$q = parse_url($_GET['q']);
|
||||
$parts = explode('/', $q['path']);
|
||||
if($parts[0] == "node"){
|
||||
$node = node_load($parts[1]);
|
||||
$block_is_visible = in_array($node->type, array('materiau','breve')) ? true : false;
|
||||
}
|
||||
|
||||
if (user_access('use materio search api viewmode selection') && $block_is_visible) {
|
||||
$block['subject'] = t('View mode');
|
||||
$block['content'] = theme('materio_search_api_select_viewmode_block', array());
|
||||
}
|
||||
@ -688,43 +763,64 @@ function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
|
||||
*
|
||||
* @see materio-search-api-results.tpl.php
|
||||
*/
|
||||
function template_preprocess_materio_search_api_results(array &$variables) {
|
||||
// dsm($variables, '$variables');
|
||||
$results = $variables['results'];
|
||||
$keys = $variables['keys'];
|
||||
function template_preprocess_materio_search_api_results(array &$vars) {
|
||||
// dsm($vars, '$vars');
|
||||
$results = $vars['results'];
|
||||
$keys = $vars['keys'];
|
||||
|
||||
// $variables['items'] = $variables['index']->loadItems(array_keys($variables['results']['results']));
|
||||
$variables['result_count'] = $results['result count'];
|
||||
$variables['sec'] = round($results['performance']['complete'], 3);
|
||||
// $vars['items'] = $vars['index']->loadItems(array_keys($vars['results']['results']));
|
||||
$vars['result_count'] = $results['result count'];
|
||||
$vars['sec'] = round($results['performance']['complete'], 3);
|
||||
|
||||
$vars['keywords'] = implode(', ', $vars['keys']);
|
||||
|
||||
if(isset($results['breves count'])){
|
||||
$variables['search_performance'] = format_plural(
|
||||
$vars['perfascard'] = true;
|
||||
$vars['search_performance'] = format_plural(
|
||||
$results['breves count'],
|
||||
'The search found 1 news ',
|
||||
'The search found @count news '
|
||||
);
|
||||
$variables['search_performance'] .= format_plural(
|
||||
$variables['result_count'] - $results['breves count'],
|
||||
$vars['search_performance'] .= format_plural(
|
||||
$vars['result_count'] - $results['breves count'],
|
||||
'with 1 associated matter.',
|
||||
'with @count associated matters.'
|
||||
);
|
||||
$variables['search_performance'] .= format_plural(
|
||||
$vars['search_performance'] .= format_plural(
|
||||
$results['could results']['result count'],
|
||||
' You could find 1 result with a ',
|
||||
' You could find <strong>@count results</strong> with a '
|
||||
' You could have found 1 result with a ',
|
||||
' You could have found <strong>@count results</strong> with a '
|
||||
);
|
||||
$variables['search_performance'] .= l(t('full access to materiO\'.'), 'node/11187');
|
||||
$vars['search_performance'] .= l(t('full access to materiO\'.'), 'node/11187');
|
||||
|
||||
$vars['search_performance'] .= l(t('Pricing'), 'node/11187', array("attributes"=>array("class"=>array('button'))));
|
||||
|
||||
}else{
|
||||
$variables['search_performance'] = format_plural(
|
||||
// $results['result count'],
|
||||
$variables['result_count'],
|
||||
'The search found 1 result.',
|
||||
'The search found @count results.'
|
||||
$vars['perfascard'] = false;
|
||||
|
||||
// $vars['search_performance'] = format_plural(
|
||||
// // $results['result count'],
|
||||
// $vars['result_count'],
|
||||
// 'The search found 1 result ',
|
||||
// 'The search found @count results '
|
||||
// )
|
||||
|
||||
$vars['search_performance'] = t('The search found @count result(s) with keywords @keys.', array(
|
||||
"@count"=>$vars['result_count'],
|
||||
"@keys"=>$vars['keywords'])
|
||||
);
|
||||
|
||||
// TODO indicate how many materials and how many news
|
||||
// $vars['search_performance'] = t('The search found @count result(s) with keywords @keys. @mat materials and @new news.', array(
|
||||
// "@count"=>$vars['result_count'],
|
||||
// "@keys"=>$vars['keywords'],
|
||||
// "@mat"=>4,
|
||||
// "@new"=>7)
|
||||
// );
|
||||
|
||||
}
|
||||
|
||||
//dsm($variables, 'variables');
|
||||
//dsm($vars, '$vars');
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,11 +229,17 @@ function materio_search_api_ajax_actuality($page = 0){
|
||||
|
||||
function materio_search_api_ajax_node($nid){
|
||||
global $user;
|
||||
$viewmode = isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full');
|
||||
|
||||
$viewmode = isset($_GET['viewmode']) ? $_GET['viewmode'] : (isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full'));
|
||||
|
||||
$rep = array(
|
||||
"get" => $_GET,
|
||||
"viewmode" => $viewmode
|
||||
);
|
||||
|
||||
if($nodeview = node_view(node_load($nid),$viewmode)){
|
||||
$rep = array(
|
||||
'nid'=>$nid,
|
||||
$rep = $rep+array(
|
||||
'nid' => $nid,
|
||||
'node' => drupal_render($nodeview),
|
||||
);
|
||||
drupal_json_output($rep);
|
||||
|
@ -267,6 +267,8 @@ function materio_user_webform_client_11186_validate($form, &$form_state){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,6 +497,7 @@ function materio_user_help($path, $arg) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_block_view_alter().
|
||||
*/
|
||||
@ -506,6 +509,7 @@ function materio_user_block_view_alter(&$data, $block) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define constants
|
||||
*/
|
||||
|
@ -38,9 +38,19 @@
|
||||
<?php //if (!empty($result_count)) : ?>
|
||||
<div class="materiobase-results <?php print ' view-mode-' . $variables['view_mode'];?>">
|
||||
<?php if ($result_count) : ?>
|
||||
<p class="search-performance"><?php print render($search_performance); ?></p>
|
||||
<?php if(!$perfascard): ?>
|
||||
<p class="search-performance"><?php print render($search_performance); ?></P>
|
||||
<?php endif; ?>
|
||||
<?php //print render($spellcheck); ?>
|
||||
<div class="search-results">
|
||||
<?php if($perfascard): ?>
|
||||
<article class="search-performance <?php print ' view-mode-' . $variables['view_mode'];?>">
|
||||
<div class="inner">
|
||||
|
||||
<p><?php print render($search_performance); ?></P>
|
||||
</div>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
<?php //dsm($items, '$items'); ?>
|
||||
<?php
|
||||
// TODO: use cache system to gain in speed, view http://drupal.org/node/930760
|
||||
|
1
templates/simplenews_6274_node.html
Normal file
1
templates/simplenews_6274_node.html
Normal file
@ -0,0 +1 @@
|
||||
<p>TODO</p>
|
65
templates/simplenews_6374_node.html
Normal file
65
templates/simplenews_6374_node.html
Normal file
@ -0,0 +1,65 @@
|
||||
<table style="margin: 0; border-collapse: collapse;" width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff; padding:0 0 5px 0;" align="left">
|
||||
<table style="margin: 0; border-collapse: collapse;" width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff; padding: 0;" align="left">
|
||||
<img src="/sites/default/files/uploaderuneimage.png" width="600" height="400">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="margin: 0 0 0 10px; border-collapse: collapse; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top; padding: 5px 0;" width="580">
|
||||
<table style="border-collapse: collapse; width: 565px; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff;" width="565" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 5px 0 5px 5px; line-height: normal; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff;">
|
||||
<p style="color: #444444; text-align: left; ;margin: 0 0 10px; line-height: 1.3em;">
|
||||
<span style="color: #444444; font-family: arial, helvetica, sans-serif;">
|
||||
<strong>
|
||||
ZE DAILY MATERIO'
|
||||
</strong>
|
||||
</span>
|
||||
</p>
|
||||
<p style="color: #444444; ;margin: 0 0 10px; line-height: 1.3em;">
|
||||
<strong>
|
||||
le titre en fr
|
||||
</strong>
|
||||
<br>
|
||||
Toute une série de matières recyclées sous vos pieds, car ces tapis sont tissés avec des chambres à air usagées, des papiers de bonbons minutieusement filés, de vieux journaux et magazines tressés ou d'autres matières recyclées surprenantes. Certains tapis de cette gamme peuvent même aller à l'extérieur.
|
||||
</p>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<p style="color: #444444; ;margin: 0 0 10px; line-height: 1.3em;">
|
||||
<span style="color: #696969;">
|
||||
<em>
|
||||
<strong>
|
||||
The english title
|
||||
</strong>
|
||||
</em>
|
||||
</span>
|
||||
<br>
|
||||
<span style="color: #808080;">
|
||||
<em>
|
||||
A wide range of beautiful carpets made out of surprising recycled materials: recycled candy wrappers, recycled tires and bike tubes, different recycled fibers and recycled newspaper! Some of them can even be used outside.
|
||||
</em>
|
||||
</span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
65
templates/simplenews_6585_node.html
Normal file
65
templates/simplenews_6585_node.html
Normal file
@ -0,0 +1,65 @@
|
||||
<table style="margin: 0; border-collapse: collapse;" width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff; padding:0 0 5px 0;" align="left">
|
||||
<table style="margin: 0; border-collapse: collapse;" width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff; padding: 0;" align="left">
|
||||
<img src="/sites/default/files/uploaderuneimage.png" width="600" height="400">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="margin: 0 0 0 10px; border-collapse: collapse; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: top; padding: 5px 0;" width="580">
|
||||
<table style="border-collapse: collapse; width: 565px; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff;" width="565" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 5px 0 5px 5px; line-height: normal; color: #444444; font-family: arial; font-size: 12px; background-color: #ffffff;">
|
||||
<p style="color: #444444; text-align: left; ;margin: 0 0 10px; line-height: 1.3em;">
|
||||
<span style="color: #444444; font-family: arial, helvetica, sans-serif;">
|
||||
<strong>
|
||||
ZE DAILY MATERIO'
|
||||
</strong>
|
||||
</span>
|
||||
</p>
|
||||
<p style="color: #444444; ;margin: 0 0 10px; line-height: 1.3em;">
|
||||
<strong>
|
||||
le titre en fr
|
||||
</strong>
|
||||
<br>
|
||||
Toute une série de matières recyclées sous vos pieds, car ces tapis sont tissés avec des chambres à air usagées, des papiers de bonbons minutieusement filés, de vieux journaux et magazines tressés ou d'autres matières recyclées surprenantes. Certains tapis de cette gamme peuvent même aller à l'extérieur.
|
||||
</p>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<p style="color: #444444; ;margin: 0 0 10px; line-height: 1.3em;">
|
||||
<span style="color: #696969;">
|
||||
<em>
|
||||
<strong>
|
||||
The english title
|
||||
</strong>
|
||||
</em>
|
||||
</span>
|
||||
<br>
|
||||
<span style="color: #808080;">
|
||||
<em>
|
||||
A wide range of beautiful carpets made out of surprising recycled materials: recycled candy wrappers, recycled tires and bike tubes, different recycled fibers and recycled newspaper! Some of them can even be used outside.
|
||||
</em>
|
||||
</span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
Loading…
x
Reference in New Issue
Block a user