Commit 829c491e authored by theo lem's avatar theo lem
Browse files

Fixing "Share" tab

parent f28a0514
......@@ -15,6 +15,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Automatic deletion of forms in quarantine after a period of time.
* Views : /suspicious, displays unpublished forms from above.
* Views : /quarantine, displays forms in quarantine.
* Number of forms / user limit
### Fixed
* Empty "Share" tab on forms (#106)
## [1.0.1] 2020/07/15
......
......@@ -34,13 +34,14 @@ function framaforms_menu () {
'access arguments' => array('access content'),
'file' => 'includes/framaforms.pages.inc',
);
$items['content/share'] = array(
$items['node/%/share'] = array(
'title' => t('Partager'),
'description' => t('Page de redirection lors de l\'expiration d\'un formulaire.'),
'description' => t('Instructions to share the form.'),
'page callback' => 'get_share_content',
'type' => MENU_NORMAL_ITEM,
'access arguments' => array('access content'),
'type' => MENU_LOCAL_TASK, // render as tab
'access callback' => 'user_is_logged_in',
'file' => 'includes/framaforms.pages.inc',
'weight' => 1000,
);
return $items;
}
......@@ -63,11 +64,11 @@ function framaforms_menu_alter (&$items) {
function framaforms_check_users_forms () {
global $user; // the current user
// if the user is not logged in, deny access
if($user->uid === 0){
if($user->uid === '0'){
return FALSE;
}
// If the user is admin, grant access (admin is master here)
if($user->uid === 1){
if($user->uid === '1'){
return TRUE;
}
// Get the user's total number of forms
......
......@@ -136,8 +136,8 @@ function get_expiration_content () {
}
/**
* Content callback for the 'share' page.
* Originally written by pyg.
* Content callback for the 'share' tab.
* Originally written by pyg for Framasoft.
*
* @return void
*/
......
......@@ -1999,11 +1999,11 @@ print "<h3>Nombre total de formulaires : $result</h3>";
$handler->display->display_options['header']['area']['table'] = 'views';
$handler->display->display_options['header']['area']['field'] = 'area';
$handler->display->display_options['header']['area']['label'] = 'date/auteur';
$handler->display->display_options['header']['area']['content'] = '<?php
//print_r(arg());
$sub_msg = webform_get_submission(arg(1), arg(3));
echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
//print_r($sub_msg);
$handler->display->display_options['header']['area']['content'] = '<?php
//print_r(arg());
$sub_msg = webform_get_submission(arg(1), arg(3));
echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
//print_r($sub_msg);
?>';
$handler->display->display_options['header']['area']['format'] = 'php_code';
/* Entête: Global : Zone de texte */
......@@ -2012,7 +2012,7 @@ echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
$handler->display->display_options['header']['area_1']['field'] = 'area';
$handler->display->display_options['header']['area_1']['label'] = 'Titre/retour/separateur';
$handler->display->display_options['header']['area_1']['empty'] = TRUE;
$handler->display->display_options['header']['area_1']['content'] = '<h1>%1</h1>
$handler->display->display_options['header']['area_1']['content'] = '<h1>%1</h1>
<hr/>';
$handler->display->display_options['header']['area_1']['format'] = 'wysiwyg_user';
$handler->display->display_options['header']['area_1']['tokenize'] = TRUE;
......@@ -2020,7 +2020,7 @@ echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
$handler->display->display_options['footer']['area']['id'] = 'area';
$handler->display->display_options['footer']['area']['table'] = 'views';
$handler->display->display_options['footer']['area']['field'] = 'area';
$handler->display->display_options['footer']['area']['content'] = '<hr/>
$handler->display->display_options['footer']['area']['content'] = '<hr/>
<small><a href="/node/!1/public-results">Retour aux résultats</a></small>';
$handler->display->display_options['footer']['area']['format'] = 'wysiwyg_user';
$handler->display->display_options['footer']['area']['tokenize'] = TRUE;
......@@ -2123,16 +2123,16 @@ echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
t('suivant ›'),
t('dernier »'),
t('date/auteur'),
t('<?php
//print_r(arg());
$sub_msg = webform_get_submission(arg(1), arg(3));
echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
//print_r($sub_msg);
t('<?php
//print_r(arg());
$sub_msg = webform_get_submission(arg(1), arg(3));
echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
//print_r($sub_msg);
?>'),
t('Titre/retour/separateur'),
t('<h1>%1</h1>
t('<h1>%1</h1>
<hr/>'),
t('<hr/>
t('<hr/>
<small><a href="/node/!1/public-results">Retour aux résultats</a></small>'),
t('There are no submissions for this form. <a href="/node/!1">View this form</a>.'),
t('Webform Submission User'),
......@@ -2144,109 +2144,6 @@ echo "Soumis le ". format_date($sub_msg->submitted) ." (".$sub_msg->name .")";
);
$export['public_submission'] = $view;
$view = new view();
$view->name = 'share';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'share';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Partager';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'plus';
$handler->display->display_options['access']['type'] = 'views_access_callback';
$handler->display->display_options['access']['views_access_callback'] = 'framaforms_user_has_access';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Appliquer';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Réinitialiser';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Trier par';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Éléments par page';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = '- Tout -';
$handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Décalage';
$handler->display->display_options['pager']['options']['tags']['first'] = '« premier';
$handler->display->display_options['pager']['options']['tags']['previous'] = '‹ précédent';
$handler->display->display_options['pager']['options']['tags']['next'] = 'suivant ›';
$handler->display->display_options['pager']['options']['tags']['last'] = 'dernier »';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Champ: Contenu : Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['element_label_colon'] = FALSE;
/* Critère de tri: Contenu : Date de publication */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Critère de filtrage: Contenu : Published status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Critère de filtrage: Contenu : Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'page' => 'page',
);
/* Critère de filtrage: Contenu : Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['value']['value'] = '12363';
$handler->display->display_options['filters']['nid']['expose']['operator_id'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['label'] = 'Nid';
$handler->display->display_options['filters']['nid']['expose']['operator'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['identifier'] = 'nid';
$handler->display->display_options['filters']['nid']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'node/%/share';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Partager';
$handler->display->display_options['menu']['weight'] = '15';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
$translatables['share'] = array(
t('Master'),
t('Partager'),
t('plus'),
t('Appliquer'),
t('Réinitialiser'),
t('Trier par'),
t('Asc'),
t('Desc'),
t('Éléments par page'),
t('- Tout -'),
t('Décalage'),
t('« premier'),
t('‹ précédent'),
t('suivant ›'),
t('dernier »'),
t('Nid'),
t('Page'),
);
$export['share'] = $view;
$view = new view();
$view->name = 'templates';
$view->description = '';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment