').addClass('modal-content').append(json.block);
-
+
var id,label, description;
$('input.form-text', $modal).each(function(i) {
id = $(this).attr('id');
@@ -453,11 +453,16 @@ 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',
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/register/submit",
- data: $('#user-register-form', $modal).serialize(),
+ data: $('#user-register-form', $modal).serialize(),
success: function(data) { onUserLoginRegisterSubmit($('#user-register-form'), data, destination);},
error: function(jqXHR, textStatus, errorThrown) { trace('error : '+textStatus+' | '+errorThrown); }
});
@@ -470,14 +475,14 @@ MaterioUser = function(){
type: 'POST',
dataType:'json',
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/login/submit",
- data: $('#user-login', $modal).serialize(),
+ data: $('#user-login', $modal).serialize(),
success: function(data){ onUserLoginRegisterSubmit($('#user-login'), data, destination); },
error: function(jqXHR, textStatus, errorThrown) { trace('error : '+textStatus+' | '+errorThrown); }
});
return false;
});
- // google analytics
+ // google analytics
// $.event.trigger({
// type : "record-stat",
// categorie : 'Search',
@@ -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($('
').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;
@@ -513,5 +527,5 @@ MaterioUser = function(){
$(document).ready(function() {
var materiouser = new MaterioUser();
});
-
+
})(jQuery);
\ No newline at end of file
diff --git a/materio_admin.module b/materio_admin.module
index 8364ae3b..d9e7f436 100644
--- a/materio_admin.module
+++ b/materio_admin.module
@@ -1,4 +1,4 @@
- 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:') . '
';
+ $output = "
";
+ foreach ($duplicate_mails as $mail => $users) {
+ $output .= "- $mail :
";
+ $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 .= ' ';
+ }
+ $output .= "
";
+ return $output;
+}
+
/**
* Implements hook_menu_alter().
*/
@@ -27,12 +116,97 @@ function materio_admin_menu_alter(&$items){
$items['admin/people']['access arguments'] = array('access default users list');
// dsm($items['admin/people']);
}
-
+
if(isset($items['admin/people/expiration'])){
$items['admin/people/expiration']['access arguments'] = array('access default UC roles expiration list');
// dsm($items['admin/people/expiration']);
}
-
+
# 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');
+}
\ No newline at end of file
diff --git a/materio_display.info b/materio_display.info
new file mode 100644
index 00000000..7fb5b0d1
--- /dev/null
+++ b/materio_display.info
@@ -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
diff --git a/materio_display.module b/materio_display.module
new file mode 100644
index 00000000..34526572
--- /dev/null
+++ b/materio_display.module
@@ -0,0 +1,58 @@
+ 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 .= '
'
+ . t("In order to access full description, information about manufacturers and more, you need to upgrade your account.")
+ . l(t("Pricing"), 'node/11187')
+ . '
';
+
+ // dsm($summary);
+ $vars['items'][0]['#markup'] = $summary;
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/materio_flag.module b/materio_flag.module
index c0db18d4..3da5f9fe 100755
--- a/materio_flag.module
+++ b/materio_flag.module
@@ -5,7 +5,7 @@
* The Flag bookmark module.
*
* This module creates a default Flag when enabled.
- *
+ *
*/
/**
@@ -55,14 +55,14 @@ function materio_flag_menu() {
'page callback' => 'materio_flag_createlist_form',
'page arguments' => array(3),
);
-
+
$items['materioflag/editlistform/%/%'] = $base+array(
'access arguments' => array('create flag lists'),
'access callback' => 'user_access',
'page callback' => 'materio_flag_editlist_form',
'page arguments' => array(2,3),
);
-
+
$items['materioflag/editlist/%/%'] = $base+array(
'access arguments' => array('create flag lists'),
'access callback' => 'user_access',
@@ -83,7 +83,7 @@ function materio_flag_menu() {
'page callback' => 'materio_flag_nodelinks',
// 'page arguments' => array(3),
);
-
+
$items['lists/%'] = $base+array(
'access arguments' => array('view flag lists'),
'access callback' => 'user_access',
@@ -121,7 +121,7 @@ function materio_flag_menu_alter(&$items) {
* Implements hook_block_info().
*/
function materio_flag_block_info() {
-
+
$blocks['materio_flag_mybookmarks'] = array(
'info' => t('My bookmarks'),
'cache' => DRUPAL_NO_CACHE
@@ -160,7 +160,7 @@ function materio_flag_block_view($delta = '') {
}
// TODO: put this title generation on a theme function
$subject = '
'.t('My bookmarks (@len) ', array("@len"=>count($userbookmarks))).'';
- $block['subject'] = $subject . l('
', 'bookmarks', array('html'=>true, 'attributes' => array('class' => array('open-list')),)); //
+ $block['subject'] = $subject . l('
', 'bookmarks', array('html'=>true, 'attributes' => array('class' => array('open-list')),)); //
$block['content'] = theme('materio_flag_mybookmarks_block', array("bookmarks"=>$userbookmarks, "viewmode"=>"bookmark"));
}else{
$block['subject'] = t('My bookmarks');
@@ -175,7 +175,7 @@ function materio_flag_block_view($delta = '') {
// $userflags = flag_get_user_flags('node');
// dsm($userflags, 'userflags');
// dsm($flags, 'flags');
-
+
foreach ($flags as $name => $flag) {
$flag->path = url('lists/'.$flag->fid);
$flaged_content = flag_lists_get_flagged_content($flag->fid, $user->uid);
@@ -222,7 +222,7 @@ function materio_flag_block_view($delta = '') {
// if($flags){
// $block['subject'] = t('My !listname'.'s', array('!listname'=>variable_get('flag_lists_name', 'list')));
$block['subject'] = t('My '.variable_get('flag_lists_name', 'list').'s');
-
+
$block['content'] = theme('materio_flag_mylists_nav_block', array("flags"=>$flags));
// $block['content'] = theme('flag_lists_user_page', array('uid' => $user->uid));
// }
@@ -255,7 +255,7 @@ function materio_flag_entity_info_alter(&$entity_info) {
function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
if($type == 'node'){
if(user_access('create flag lists') && $view_mode != 'print'){
-
+
$entity->content['flaglistslinks'] = materio_flag_get_entity_links($entity, $type, $view_mode);
drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
@@ -268,12 +268,12 @@ function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
foreach ($flags as $flag) {
// dsm($flag, 'flag');
if ( ($flag->module == 'flag_lists' && _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0)) || $flag->is_flagged($entity->nid) ) {
- $entity->flags[] = $flag;
+ $entity->flags[] = $flag;
}
}
}
}
-
+
}
}
}
@@ -290,10 +290,10 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
$links = array();
# if flag name is provided we are on flaglists content list (block mylists)
if($view_mode == 'bookmark'){
- // TODO: define view mode in settings
+ // TODO: define view mode in settings
// if (isset($entity->flag_names) && $flags = flag_lists_get_user_flags($entity->type, $user)) {
// // dsm($flags, 'flags');
- // // TODO: limit flag link by current flag list
+ // // TODO: limit flag link by current flag list
// foreach ($flags as $flag) {
// //dsm($flag->name, 'flag');
// if(in_array($flag->name, $entity->flag_names)){
@@ -301,7 +301,7 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
// $action = _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0) ? 'unflag' : 'flag';
// } else {
// $action = $flag->is_flagged($entity->nid) ? 'unflag' : 'flag';
- // }
+ // }
// $flag->module = 'materio_flag';
// $link = $flag->theme($action, $entity->nid);
@@ -349,12 +349,12 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
}
}
-
+
// dsm($items, 'items '.$entity->title);
#create new list
$link = l(
- '
' . t('New @name', array('@name' => t(variable_get('flag_lists_name', 'list')))) . '',
+ '
' . t('New @name', array('@name' => t(variable_get('flag_lists_name', 'list')))) . '',
'flag-lists/add/' . $entity->type,
array(
'attributes' => array(
@@ -366,7 +366,7 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
'html' => TRUE,
)
);
-
+
$create = array(
'data' => $link,
'class' => array('flag-lists-create'),
@@ -375,15 +375,15 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
if(isset($items)){
$ops = array(
- '#node' => $entity,
+ '#node' => $entity,
'#items' => $items,
);
}
-
- if(isset($create)){
+
+ if(isset($create)){
$ops['#create'] = $create;
}
-
+
if(isset($ops)){
// dsm($ops, 'ops');
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag.min.js');
@@ -397,19 +397,19 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
function _materio_flag_get_listpagetitle($flag){
$cont = '
';
$cont .= '
'.check_plain($flag->title).'';
-
+
if(flag_lists_is_owner('edit', $flag->fid)){
-
- $cont .= l('
',
- 'flags/lists/edit/'.$flag->fid,
+
+ $cont .= l('
',
+ 'flags/lists/edit/'.$flag->fid,
array(
'html'=>true,
'attributes'=>array('class'=>array('edit-list', $flag->name)),
)
- );
+ );
}
-
-
+
+
return $cont;
}
@@ -468,11 +468,11 @@ function template_preprocess_materio_flag_mylists_nav_block(&$vars){
/**
* theme_materio_flag_mylists_entity_links()
- *
+ *
* see theme_flag_lists_list()
*/
function theme_materio_flag_mylists_entity_links($vars){
-
+
// $node = $vars['node'];
$items = $vars['items'];
@@ -480,13 +480,13 @@ function theme_materio_flag_mylists_entity_links($vars){
if(isset($vars['create']))
$items[] = $vars['create'];
-
+
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
diff --git a/materio_flag.pages.inc b/materio_flag.pages.inc
index 65112aab..1546c401 100755
--- a/materio_flag.pages.inc
+++ b/materio_flag.pages.inc
@@ -2,10 +2,10 @@
/**
* materio_flag_refresh_blocks($flag)
- *
+ *
*/
function materio_flag_refresh_block($flag){
-
+
switch ($flag) {
case 'bookmarks':
$block_name = 'materio_flag_mybookmarks';
@@ -18,8 +18,8 @@ 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,20 +27,20 @@ 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);
}
/**
* materio_flag_createlist($type)
- *
+ *
*/
function materio_flag_createlist_form($type){
$debug = false;
@@ -55,7 +55,7 @@ function materio_flag_createlist_form($type){
// menu_set_active_item($path);
// $return = menu_execute_active_handler($path, FALSE);
-
+
// if (is_int($return)) {
// switch ($return) {
// case MENU_NOT_FOUND :
@@ -69,7 +69,7 @@ function materio_flag_createlist_form($type){
// break;
// }
// } elseif (isset($return)) {
-
+
// $form_state['build_info']['args'] = array(NULL, 'breve');
// $f = drupal_get_form('flag_lists_form', $form_state);
// dsm($f);
@@ -86,11 +86,11 @@ function materio_flag_createlist_form($type){
);
$form['listname'] = array(
- '#type' => 'textfield',
+ '#type' => 'textfield',
'#title' => t('Create new @name', array('@name'=>variable_get('flag_lists_name', 'list'))),
- '#default_value' => '',
- // '#size' => 100,
- '#maxlength' => 255,
+ '#default_value' => '',
+ // '#size' => 100,
+ '#maxlength' => 255,
'#name' => 'flag-lists-name',
'#description' => t('A short, descriptive title for this Folder list. Limit to 255 characters.'),
);
@@ -111,21 +111,21 @@ function materio_flag_createlist_form($type){
'#value' => t('cancel'),
'#name' => 'cancel',
);
-
+
// dsm($form, 'form');
- $return = drupal_render($form);
+ $return = drupal_render($form);
$rep = array(
'rendered_form'=>$return,
);
-
+
if ($debug) {
dsm($rep, 'rep');
return "debug display";
}else{
- drupal_json_output($rep);
+ drupal_json_output($rep);
}
}
@@ -172,7 +172,7 @@ function materio_flag_editlist_form($type, $fid){
'#value' => $fid,
'#name' => 'fid',
);
-
+
$form['name'] = array(
'#type' => 'hidden',
'#value' => $name,
@@ -180,11 +180,11 @@ function materio_flag_editlist_form($type, $fid){
);
$form['listtitle'] = array(
- '#type' => 'textfield',
+ '#type' => 'textfield',
'#title' => t('Edit this '.variable_get('flag_lists_name', 'list')),
- '#value' => $flag->title,
- // '#size' => 100,
- '#maxlength' => 255,
+ '#value' => $flag->title,
+ // '#size' => 100,
+ '#maxlength' => 255,
'#name' => 'flag-lists-title',
'#description' => t('A short, descriptive title for this Folder list. Limit to 255 characters.'),
);
@@ -211,10 +211,10 @@ function materio_flag_editlist_form($type, $fid){
'#value' => t('cancel'),
'#name' => 'cancel',
);
-
+
// dsm($form, 'form');
- $return = drupal_render($form);
+ $return = drupal_render($form);
$rep = array(
'rendered_form'=>$return,
@@ -225,12 +225,12 @@ function materio_flag_editlist_form($type, $fid){
'message' => t('you do not have rights to edit this '.variable_get('flag_lists_name', 'list')),
);
}
-
+
if ($debug) {
dsm($rep, 'rep');
return "debug display";
}else{
- drupal_json_output($rep);
+ drupal_json_output($rep);
}
}
@@ -270,7 +270,7 @@ function materio_flag_edit_list($fid, $name, $title){
}
- drupal_json_output($rep);
+ drupal_json_output($rep);
}
function materio_flag_delete_list($fid){
@@ -299,15 +299,15 @@ function materio_flag_delete_list($fid){
}
$flag = flag_lists_get_flag($name);
-
- flag_lists_fl_delete($flag);
+
+ flag_lists_fl_delete($flag);
$rep = array(
'status' => 'saved',
);
}
- drupal_json_output($rep);
+ drupal_json_output($rep);
}
function materio_flag_nodelinks(){
@@ -324,19 +324,19 @@ function materio_flag_nodelinks(){
"status" => 1,
"nids" => $nids,
'links' => $links,
- );
+ );
}else{
$rep['status'] = 0;
}
- drupal_json_output($rep);
+ drupal_json_output($rep);
}
function materio_flag_user_bookmarks(){
global $user;
-
+
drupal_set_title(t('My bookmarks'), PASS_THROUGH);
-
+
$flaged = flag_get_user_flags('node');
// dsm($flaged, 'flaged');
@@ -363,7 +363,7 @@ function materio_flag_user_bookmarks(){
}
}
}
-
+
$ret['#items'] = $items;
$ret['#theme'] = 'materio_flag_mylists_list';
$ret['#view_mode'] = $viewmode;
@@ -397,12 +397,12 @@ function materio_flag_user_lists($fid){
$count = count($flaged_content);
$max = $offset+$limit > $count ? $count : $offset+$limit;
- for ($i=$offset; $i < $max; $i++) {
+ 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;
@@ -425,9 +425,9 @@ function materio_flag_ajax_list($fid, $page = 0){
$list_path = $path = 'bookmarks';
}else{
$list_path = 'lists';
- $path = $list_path.'/'.$fid;
+ $path = $list_path.'/'.$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')) {
@@ -462,7 +462,7 @@ function materio_flag_ajax_list($fid, $page = 0){
$return = menu_execute_active_handler($path, FALSE);
dsm($return, '$return');
-
+
if (is_int($return)) {
switch ($return) {
case MENU_NOT_FOUND :
@@ -480,18 +480,18 @@ function materio_flag_ajax_list($fid, $page = 0){
if (is_array($return)) {
$rendered = drupal_render($return);
}
-
+
$rep = array(
'rendered' => $rendered,
'path' => $path,
'title' => drupal_get_title(),
);
-
+
if ($debug) {
dsm($rep, 'rep');
return "debug display";
}else{
- drupal_json_output($rep);
+ drupal_json_output($rep);
}
}
}
\ No newline at end of file
diff --git a/materio_search_api.module b/materio_search_api.module
index ad24f4ce..967e04a3 100755
--- a/materio_search_api.module
+++ b/materio_search_api.module
@@ -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'];
-
- for ($i=1; $i <= 5 ; $i++) {
- $properties['materio_search_api_onthologie_term_'.$i.'_text'] = array(
+ $node_props = &$info['node']['properties'];
+
+ for ($i=1; $i <= 5 ; $i++) {
+ $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
',
'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',
'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',
+ '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){
@@ -216,7 +252,7 @@ function materio_search_api_get_taglibres_terms_text($item){
function materio_search_api_get_taxo_term_field_text($item, $field_name, $delta){
// dsm($item, 'item');
// dsm($delta, 'delta');
-
+
if(isset($item->{$field_name}['und'][$delta])){
// print '** item **'."\n";
// print_r($item);
@@ -246,25 +282,40 @@ function materio_search_api_get_taxo_term_field_text($item, $field_name, $delta)
return implode(" ", $keywords);
}
-
+
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');
-
- $output = rip_tags(render(field_view_field('node',$node,'field_public_address')));
- // dsm($output, 'output');
-
- return $output;
+ $languages = language_list();
+ global $language;
+ $language = $languages[$lang];
+
+ $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,19 +325,20 @@ function company_get_tode_node($term){
return false;
}
-function rip_tags($string) {
- // ----- remove HTML TAGs -----
- $string = preg_replace ('/<[^>]*>/', ' ', $string);
-
- // ----- remove control characters -----
+
+function rip_tags($string) {
+ // ----- remove HTML TAGs -----
+ $string = preg_replace ('/<[^>]*>/', ' ', $string);
+
+ // ----- remove control characters -----
$string = str_replace("\r", '', $string); // --- replace with empty space
$string = str_replace("\n", ' ', $string); // --- replace with space
$string = str_replace("\t", ' ', $string); // --- replace with space
-
+
// $string = str_replace(" ", ' ', $string); // --- replace with space
// $string = str_replace("'", '\'', $string); // --- replace with space
- // ----- remove multiple spaces -----
+ // ----- remove multiple spaces -----
$string = trim(preg_replace('/ {2,}/', ' ', $string));
// ----- remove html entities
@@ -294,10 +346,24 @@ function rip_tags($string) {
foreach ($entities[0] as $entity) {
$string = str_replace($entity, mb_convert_encoding($entity, 'UTF-8', 'HTML-ENTITIES'), $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().
*/
@@ -312,7 +378,7 @@ function materio_search_api_block_info() {
'info' => t('Materio search api view mode selection'),
'cache' => DRUPAL_NO_CACHE
);
-
+
// $blocks['materio_search_api_filters'] = array(
// 'info' => t('Materio search api filters'),
// 'cache' => DRUPAL_NO_CACHE
@@ -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());
}
@@ -360,12 +435,12 @@ function materio_search_api_entity_info_alter(&$entity_info) {
'label' => t('Small cards'),
'custom settings' => TRUE,
);
-
+
$entity_info['node']['view modes']['cardmedium'] = array(
'label' => t('Medium cards'),
'custom settings' => TRUE,
);
-
+
$entity_info['node']['view modes']['cardbig'] = array(
'label' => t('Big cards'),
'custom settings' => TRUE,
@@ -389,7 +464,7 @@ function materio_search_api_node_view_alter(&$build) {
// dsm($viewmode, 'viewmode');
$node = $build['#node'];
if($build['#view_mode'] != $viewmode && $build['#view_mode'] != "bookmark" & in_array($node->type, array('breve', 'materiau'))){
- $build = node_view($node, $viewmode);
+ $build = node_view($node, $viewmode);
}
}
}
@@ -436,7 +511,7 @@ function materio_search_api_search_form($form, &$form_state){
$form['searchfield'] = array(
'#type' => 'textfield',
- '#default_value' => $path == 'explore' ? $keys : $default_value, // TODO: set the search page path global or a variable in settings
+ '#default_value' => $path == 'explore' ? $keys : $default_value, // TODO: set the search page path global or a variable in settings
// '#value' => $keys,
'#autocomplete_path' => 'materiosearchapi/autocomplete/searchapi',
//'#autocomplete_path' => 'materiosearchapi/autocomplete/dbselect',
@@ -446,15 +521,15 @@ function materio_search_api_search_form($form, &$form_state){
);
if(user_access('use materio search api filters')){
-
+
$index = search_api_index_load(variable_get('mainsearchindex', -1));
$indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
-
+
foreach ($indexed_bundles as $bundle) {
$bundles_options[$bundle] = $bundle;
$default_bundles[] = $bundle;
}
-
+
$user_bundles_filter = isset($user->data['materiosearchapi_bundlesfilter']) ? $user->data['materiosearchapi_bundlesfilter'] : $default_bundles;
$form['bundles_filter'] = array(
@@ -464,7 +539,7 @@ function materio_search_api_search_form($form, &$form_state){
// '#attributes' => array('class'=>array('btn-group')),
);
}
-
+
$form['create'] = array(
'#type' => 'image_button',
'#src' => drupal_get_path('module', 'materio_search_api') . '/images/search.png',
@@ -498,7 +573,7 @@ function materio_search_api_search_form_submit($form, &$form_state){
# if user have no access to filters
$index = search_api_index_load(variable_get('mainsearchindex', -1));
$indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
-
+
foreach ($indexed_bundles as $bundle) {
$bundles[] = $bundle;
}
@@ -534,7 +609,7 @@ function _materio_search_api_change_viewmode($vm){
}
/**
-* - - - - - - - - - - - - THEME - - - - - - - - - - - -
+* - - - - - - - - - - - - THEME - - - - - - - - - - - -
*/
/**
@@ -558,7 +633,7 @@ function materio_search_api_theme($existing, $type, $theme, $path) {
// 'path' => drupal_get_path('module', 'materio_search_api').'/templates',
// ),
'materio_search_api_results' => array(
- 'arguments' => array(),
+ 'arguments' => array(),
'template' => 'materio-search-api-results',
'path' => drupal_get_path('module', 'materio_search_api').'/templates',
'variables' => array(
@@ -617,7 +692,7 @@ function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
$entity_infos = entity_get_info();
// dsm($entity_infos, 'entity_infos');
-
+
$content = '';
foreach ($entity_infos['node']['view modes'] as $viewmode => $value) {
if(in_array($viewmode, $availableviewmodes)){
@@ -654,9 +729,9 @@ function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
// // $entity_infos = entity_get_info($index->item_type);
// // dsm($entity_infos, 'entity_infos');
// $indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
-
+
// dsm($indexed_bundles, 'indexed_bundles');
-
+
// $vars['content'] = drupal_get_form('materio_search_api_filters_form', $indexed_bundles);
// }
@@ -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'];
+
+ // $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']);
- // $variables['items'] = $variables['index']->loadItems(array_keys($variables['results']['results']));
- $variables['result_count'] = $results['result count'];
- $variables['sec'] = round($results['performance']['complete'], 3);
-
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
@count results with a '
+ ' You could have found 1 result with a ',
+ ' You could have found
@count results 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');
}
@@ -736,7 +832,7 @@ function template_preprocess_materio_search_api_actuality(&$vars){
}
/**
-* - - - - - - - - - - - - SEARCH API PAGE - - - - - - - - - - - -
+* - - - - - - - - - - - - SEARCH API PAGE - - - - - - - - - - - -
*/
/**
@@ -747,7 +843,7 @@ function materio_search_api_block_view_alter(&$data, $block) {
if ($block->module == 'search_api_page') {
$page = search_api_page_load($block->delta);
$item = menu_get_item();
-
+
if (isset($page->path) && $page->path == $item['path']) {
$keys = arg(count(arg(NULL, $page->path)));
if ($keys) {
diff --git a/materio_search_api.pages.inc b/materio_search_api.pages.inc
index 791ae860..0bf83273 100755
--- a/materio_search_api.pages.inc
+++ b/materio_search_api.pages.inc
@@ -2,22 +2,22 @@
/**
* materiobase_search_autocomplete_dbselect()
- *
+ *
* inspired by taxonomy_autocomplete()
- *
+ *
* OBSOLETE : this fonction use a direct dbselect request to provide results forautocomplete
- *
+ *
*/
function materio_search_api_autocomplete_dbselect($typed = ''){
// If the request has a '/' in the search text, then the menu system will have
// split it into multiple arguments, recover the intended $tags_typed.
$args = func_get_args();
$typed = implode('/', $args);
-
+
/*
TODO riche serach engine + \\ etc gmail like
*/
-
+
if ($typed != '') {
// Part of the criteria for the query come from the field's own settings.
@@ -56,7 +56,7 @@ function materio_search_api_autocomplete_dbselect($typed = ''){
/**
* materio_search_api_autocomplete_searchapi($typed = '')
-*
+*
* GOOD one using searchapi (SOLR)
*/
function materio_search_api_autocomplete_searchapi($typed = ''){
@@ -64,7 +64,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
// split it into multiple arguments, recover the intended $tags_typed.
$args = func_get_args();
$typed = implode('/', $args);
-
+
// dsm($typed, 'typed');
if ($typed != '') {
@@ -78,7 +78,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
global $language;
$index_machine_name = variable_get('autocompletesearchindex_'.$language->language, -1);
$query = search_api_query($index_machine_name);
-
+
// $query_filter = $query->createFilter();
// $query_filter->condition('name', $tosearch);
// $query_filter->condition('type', 'article');
@@ -96,14 +96,14 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
//dsm($item, '$item');
//$term_matches[$item->tid] = check_plain($item->name);
// $term_matches[check_plain($item->name)] = check_plain($item->name);
- // TODO: leave tags with nodes
+ // TODO: leave tags with nodes
$term_matches[ trim(implode(' ', $adv_search_q[0]).' '.$last[1].$item->name)] = check_plain($item->name);
$delta++;
if($delta > 15)
break;
- }
- drupal_json_output($term_matches);
+ }
+ drupal_json_output($term_matches);
}else{
drupal_json_output(array());
}
@@ -111,15 +111,15 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
return;
}
-
+
// dsm($term_matches, 'term_matches');
// return 'debug mode of materio_search_api_autocomplete_searchapi';
}
/**
* materio_search_api_results_search()
-*
-*
+*
+*
*/
function materio_search_api_results_search(){
global $user;
@@ -138,11 +138,11 @@ function materio_search_api_results_search(){
// else{
// $page = 0;
// }
-
+
preg_match_all('/\s?[^\s]+\s?/', $typed, $words);
// dsm($words, "words");
-
+
// $match = array('\\', '+', '-', '&', '|', '!', '(', ')', '{', '}', '[', ']', '^', '~', '*', '?', ':', '"', ';', ' ');
// $replace = array('\\\\', '\\+', '\\-', '\\&', '\\|', '\\!', '\\(', '\\)', '\\{', '\\}', '\\[', '\\]', '\\^', '\\~', '\\*', '\\?', '\\:', '\\"', '\\;', '\\ ');
foreach ($words[0] as $word) {
@@ -197,7 +197,7 @@ function materio_search_api_results_search(){
// dsm($viewmode, 'viewmode');
if ($keys) {
- // TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
+ // TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
try {
$limit = variable_get($viewmode.'_limite', '10');
$offset = pager_find_page() * $limit; //$page*$limit;//
@@ -244,7 +244,7 @@ function materio_search_api_results_search(){
// $results['results'] = $accessible_results;
// $results['result count'] = count($accessible_results);
-
+
if(user_access('use materio search api')){
$items = $index->loadItems(array_keys($results['results']));
@@ -296,7 +296,7 @@ function materio_search_api_results_search(){
if (!empty($results['ignored'])) {
drupal_set_message(
- t('The following search keys are too short or too common and were therefore ignored: "@list".',
+ t('The following search keys are too short or too common and were therefore ignored: "@list".',
array( '@list' => implode(t('", "'), $results['ignored']) ) ),
'warning'
);
@@ -320,7 +320,7 @@ function materio_search_api_actuality(){
global $user;
if(isset($user->roles[1])){
- $date_limit = strtotime('-6 month');
+ $date_limit = strtotime('-6 month');
// dsm(date('d m y', $date_limit));
}
@@ -361,7 +361,7 @@ function materio_search_api_actuality(){
if(isset($result['node'])){
foreach ($result['node'] as $nid => $n) {
$breve = node_load($nid);
-
+
if(!node_access('view', $breve))
continue;
@@ -377,7 +377,7 @@ function materio_search_api_actuality(){
}
}
}
-
+
// drupal_set_title(t('Actualities'));
drupal_set_title(t(''));
diff --git a/materio_search_api_ajax.module b/materio_search_api_ajax.module
index 5e8c1b97..68ded5fe 100755
--- a/materio_search_api_ajax.module
+++ b/materio_search_api_ajax.module
@@ -15,7 +15,7 @@ function materio_search_api_ajax_init() {
if (module_exists('locale')) {
$languages = language_list('enabled');
}
-
+
drupal_add_js(array('materio_search_api_ajax' => array(
'module_path' => drupal_get_path('module', 'materio_search_api_ajax'),
// 'strings'=>array(
@@ -51,7 +51,7 @@ function materio_search_api_ajax_menu() {
'page argument' => array(3),
'access arguments' => array('use materio search api viewmode selection'),
);
-
+
$items['materio_search_api_ajax/actuality'] = $base+array(
'page callback' => 'materio_search_api_ajax_actuality',
'access callback' => TRUE,
diff --git a/materio_search_api_ajax.pages.inc b/materio_search_api_ajax.pages.inc
index 7bcd1d01..525d78bd 100755
--- a/materio_search_api_ajax.pages.inc
+++ b/materio_search_api_ajax.pages.inc
@@ -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);
diff --git a/materio_user.module b/materio_user.module
index 4abe3d1f..82a6e260 100755
--- a/materio_user.module
+++ b/materio_user.module
@@ -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
*/
diff --git a/materio_user.pages.inc b/materio_user.pages.inc
index 5ca522a5..9cc11058 100644
--- a/materio_user.pages.inc
+++ b/materio_user.pages.inc
@@ -1,4 +1,4 @@
-$_POST);
drupal_form_submit($_POST['form_id'], $form_state);
-
+
$return['errors'] = form_get_errors();
if($return['errors'])
unset ($_SESSION['messages']['error']);
diff --git a/templates/materio-search-api-results.tpl.php b/templates/materio-search-api-results.tpl.php
index 0dd3f011..aef05f00 100755
--- a/templates/materio-search-api-results.tpl.php
+++ b/templates/materio-search-api-results.tpl.php
@@ -38,11 +38,21 @@
-
+
+
+
+
+
+
+
+
-
item_type, $items, $variables['view_mode'])); ?>
diff --git a/templates/simplenews_6274_node.html b/templates/simplenews_6274_node.html
new file mode 100644
index 00000000..b731baec
--- /dev/null
+++ b/templates/simplenews_6274_node.html
@@ -0,0 +1 @@
+
TODO
\ No newline at end of file
diff --git a/templates/simplenews_6374_node.html b/templates/simplenews_6374_node.html
new file mode 100644
index 00000000..b66feb88
--- /dev/null
+++ b/templates/simplenews_6374_node.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ZE DAILY MATERIO'
+
+
+
+
+
+ le titre en fr
+
+
+ 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.
+
+
+
+
+
+
+
+
+ The english title
+
+
+
+
+
+
+ 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.
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
diff --git a/templates/simplenews_6585_node.html b/templates/simplenews_6585_node.html
new file mode 100644
index 00000000..b66feb88
--- /dev/null
+++ b/templates/simplenews_6585_node.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ZE DAILY MATERIO'
+
+
+
+
+
+ le titre en fr
+
+
+ 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.
+
+
+
+
+
+
+
+
+ The english title
+
+
+
+
+
+
+ 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.
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+