|
Ajouter la colonne description pour l'affichage des bugsPosted by Amel
Je récupère un message que j'ai envoyé en privé, je pense ne pas être la seule à avoir ce problème, autant que ça puisse aider !
Voici la suite : j'ai modifié mon fichier config_inc.php, mais ça n'a rien changé à l'affichage (toujours la valeur @description@ dans la colonne). Je suis allée faire un tour dnas le gichier config_defaults_inc.php, et je n'y ai pas trouvé la fameuse variable... j'ai surement loupé quelque chose moi !!
Ah si j'avais lu le commentaire juste au dessus !! description ne fait pas partie des champs possibles...
Alors ma solution consiste à mettre ceci dans le fichier custom_functions_inc.php (créer le fichier si il n'existe pas) : function custom_function_override_print_column_value( $p_column, $p_issue_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { if ( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) { $t_column_start = ''; $t_column_end = ''; $t_column_empty = ''; } else { $t_column_start = '<td>'; $t_column_end = '</td>'; $t_column_empty = ' '; } if ( strpos( $p_column, 'custom_' ) === 0 ) { echo $t_column_start; $t_custom_field = substr( $p_column, 7 ); $t_field_id = custom_field_get_id_from_name( $t_custom_field ); if ( $t_field_id === false ) { echo '@', $t_custom_field, '@'; } else { $t_issue_id = $p_issue_row['id']; $t_project_id = $p_issue_row['project_id']; if ( custom_field_is_linked( $t_field_id, $t_project_id ) ) { $t_def = custom_field_get_definition( $t_field_id ); print_custom_field_value( $t_def, $t_field_id, $t_issue_id ); } else { // field is not linked to project echo $t_column_empty; } } echo $t_column_end; } else { if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { $t_function = 'print_column_' . $p_column; } else { $t_function = 'csv_format_' . $p_column; } if ( function_exists( $t_function ) ) { if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { $t_function( $p_issue_row, $p_columns_target ); } else { if ( $p_column == 'summary' ) { $t_summary = string_attribute( $p_issue_row['summary'] ); $t_description = string_attribute( bug_get_text_field( $p_issue_row['id'], 'description' ) ); echo '<td class="left"><a title="', $t_description, '">', $t_summary, '</a></td>'; } else { $t_function( $p_issue_row[$p_column] ); } } } else { if ( isset( $p_issue_row[$p_column] ) ) { echo $t_column_start . $p_issue_row[$p_column] . $t_column_end; } else { echo $t_column_start . '@' . $p_column . '@' . $t_column_end; } } } } Placez votre souris sur le sujet du bug et attendez quelques secondes, la description du bug apparaît. Vincent Mantis: 1.1.0, 1.1.5, 1.1.1 PHP: 5.0.4 SQL: MySQL 5.0.19 OS: Linux Please complete your signature with your environment informations. Enable skype notification here
Je suis vraiment une débutante en php, j'ai du faire une erreur.
Le fichier custom_functions_inc.php n'existait pas, je l'ai donc créé directement dans le répertoire mantis. Voici le contenu de mon fichier : <?php function custom_function_override_print_column_value( $p_column, $p_issue_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { if ( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) { $t_column_start = ''; $t_column_end = ''; $t_column_empty = ''; } else { $t_column_start = '<td>'; $t_column_end = '</td>'; $t_column_empty = ' '; } if ( strpos( $p_column, 'custom_' ) === 0 ) { echo $t_column_start; $t_custom_field = substr( $p_column, 7 ); $t_field_id = custom_field_get_id_from_name( $t_custom_field ); if ( $t_field_id === false ) { echo '@', $t_custom_field, '@'; } else { $t_issue_id = $p_issue_row['id']; $t_project_id = $p_issue_row['project_id']; if ( custom_field_is_linked( $t_field_id, $t_project_id ) ) { $t_def = custom_field_get_definition( $t_field_id ); print_custom_field_value( $t_def, $t_field_id, $t_issue_id ); } else { // field is not linked to project echo $t_column_empty; } } echo $t_column_end; } else { if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { $t_function = 'print_column_' . $p_column; } else { $t_function = 'csv_format_' . $p_column; } if ( function_exists( $t_function ) ) { if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { $t_function( $p_issue_row, $p_columns_target ); } else { if ( $p_column == 'summary' ) { $t_summary = string_attribute( $p_issue_row['summary'] ); $t_description = string_attribute( bug_get_text_field( $p_issue_row['id'], 'description' ) ); echo '<td class="left"><a title="', $t_description, '">', $t_summary, '</a></td>'; } else { $t_function( $p_issue_row[$p_column] ); } } } else { if ( isset( $p_issue_row[$p_column] ) ) { echo $t_column_start . $p_issue_row[$p_column] . $t_column_end; } else { echo $t_column_start . '@' . $p_column . '@' . $t_column_end; } } } ?> Maintenant, lorsque je charge ma page, j'obtiens l'erreur :
lol, je ne sais pas compter !!
Ca ne marche pourtant pas. C'est peut être du à custom_function_api.php ?? Voilà ce que j'ai mis pour avoir la colonne description : $t_custom_fields = custom_field_get_ids(helper_get_current_project()); $t_columns[] = 'custom_Date découverte'; $t_columns[] = 'custom_Qui ?'; $t_columns[] = 'description'; $t_columns[] = 'severity'; $t_columns[] = 'status'; $t_columns[] = 'custom_Temps passé (en j)'; $t_columns[] = 'summary'; $t_columns[] = 'custom_Date de livraison'; $t_columns[] = 'custom_Clos par le client';
Attention la solution que j'ai donné ne fait pas apparaître une colonne de plus mais permet de faire apparaître la description lorsque la souris passe sur le sujet (laisser la souris quelques secondes pour faire apparaître la description).
Vincent Mantis: 1.1.0, 1.1.5, 1.1.1 PHP: 5.0.4 SQL: MySQL 5.0.19 OS: Linux Please complete your signature with your environment informations. Enable skype notification here
Je me suis trompé, désolé
function custom_function_override_print_column_value( $p_column, $p_issue_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { if ( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) { $t_column_start = ''; $t_column_end = ''; $t_column_empty = ''; } else { $t_column_start = '<td>'; $t_column_end = '</td>'; $t_column_empty = ' '; } if ( strpos( $p_column, 'custom_' ) === 0 ) { echo $t_column_start; $t_custom_field = substr( $p_column, 7 ); $t_field_id = custom_field_get_id_from_name( $t_custom_field ); if ( $t_field_id === false ) { echo '@', $t_custom_field, '@'; } else { $t_issue_id = $p_issue_row['id']; $t_project_id = $p_issue_row['project_id']; if ( custom_field_is_linked( $t_field_id, $t_project_id ) ) { $t_def = custom_field_get_definition( $t_field_id ); print_custom_field_value( $t_def, $t_field_id, $t_issue_id ); } else { // field is not linked to project echo $t_column_empty; } } echo $t_column_end; } else { if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { $t_function = 'print_column_' . $p_column; } else { $t_function = 'csv_format_' . $p_column; } if ( function_exists( $t_function ) ) { if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { if ( $p_column == 'summary' ) { $t_summary = string_attribute( $p_issue_row['summary'] ); $t_description = string_attribute( bug_get_text_field( $p_issue_row['id'], 'description' ) ); echo '<td class="left"><a title="', $t_description, '">', $t_summary; if ( VS_PRIVATE == $p_issue_row['view_state'] ) { printf( ' <img src="%s" alt="(%s)" title="%s" />' , $t_icon_path . 'protected.gif' , lang_get( 'private' ) , lang_get( 'private' ) ); } echo '</a></td>'; } else { $t_function( $p_issue_row, $p_columns_target ); } } else { $t_function( $p_issue_row[$p_column] ); } } else { if ( isset( $p_issue_row[$p_column] ) ) { echo $t_column_start . $p_issue_row[$p_column] . $t_column_end; } else { echo $t_column_start . '@' . $p_column . '@' . $t_column_end; } } } } Vincent Mantis: 1.1.0, 1.1.5, 1.1.1 PHP: 5.0.4 SQL: MySQL 5.0.19 OS: Linux Please complete your signature with your environment informations. Enable skype notification here
merci beaucoup, ça marche nickel !!
Pour le détail, quand je passai sur le sujet, j'obtenais la description entourée de '\"', pour enlever cela, j'ai simplement modifier echo '<td class=\"left\"><a title=\"', $t_description, '\">', $t_summary;en echo '<td class=\"left\"><a title=', $t_description, '>', $t_summary;
Bonjour,
Oui bien vu, vous pouvez aussi enlever les \\ pour class="left" EDIT: C'est à cause d'un bug du forum, dans mon message initial les \ n'y sont pas... EDIT2: J'ai corrigé le bug du forum. Vincent Mantis: 1.1.0, 1.1.5, 1.1.1 PHP: 5.0.4 SQL: MySQL 5.0.19 OS: Linux Please complete your signature with your environment informations. Enable skype notification here Edited 2 time(s). Last edit at 05/09/2007 11:15PM by deboutv.
Ok
Donc maintenant la description de mon bug est isible en passant sur le sujet avec ma souris. Le souci, c'est que j'aimerais que la colonne existe et soit rempli pour l'export csv et Excel. J'ai testé quelque chose, qui ne marche pas, mais c vrai que j'aimerais comprendre pourquoi, histoire de mieux savoir comment marche cette appli. Dans columns_api.php, j'ai ajouté la fonction : function print_column_description( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { global $t_icon_path; $t_description = string_attribute( bug_get_text_field( $p_row['id'], 'description' ) ) echo '<td class="left">', $t_description; if ( VS_PRIVATE == $p_row['view_state'] ) { printf( ' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) ); } echo '</td>'; } verdict :
j'suis vraiment idiote !!
Enfin, du coup, ça fonctionne pour le rapport imprimable et pour Excell, mais toujours pas pour l'export csv. Voici l'erreur : <b>Fatal error</b>: Call to undefined function print_column_title_description() in <b>d:\dev\wamp\www\mantis\csv_export.php</b> on line <b>71</b><br />
C'est parce qu'il faut aussi une fonction print_column_title_description avec juste (enfin je pense) :
echo lang_get( 'description' ); Vous devez avoir des exemples dans le fichier core/columns_api.php. Vincent Mantis: 1.1.0, 1.1.5, 1.1.1 PHP: 5.0.4 SQL: MySQL 5.0.19 OS: Linux Please complete your signature with your environment informations. Enable skype notification here
Ok
Ca marche bien, mais j'obtiens alors une autre erreur :
Du coup, j'ai ajouté une fonction dans csv_api.php : function csv_format_description( $p_description ) { return csv_escape_string( $p_description ); } Je n'ai alors plus d'erreur, mais la description ne s'affiche pas (colonne vide, avec l'en-tête) Edited 1 time(s). Last edit at 05/09/2007 10:43AM by Amel.
Excusez moi de m'immiscer dans la conversation, mais j'ai voulu utiliser la fonction que vous avez donnée plus haut et qui permet de voir la descrption du bogue en laissant la souris quelques secondes sur le résumé, mais j'ai un problème. En effet lorsque je laisse la souris quelques secondes il y a bien quelque chose qui s'affiche, mais il s'agit juste du premier mot de la description. Je n'ai pas la description en entier.
De mon côté, je n'arrive pas à résoudre mon pb, et je viens de me rendre compte d'un autre : dans ma liste, même si j'ai bien la colonne decription remplie, le titre de la colonne ne s'affiche plus ! Pour qu'elle s'affiche, il faut que je supprime la fonction
function print_column_title_description( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { echo lang_get( 'description' ); }dans columns_api.php
Ok, laissez-moi un peu de temps pour que je mette en production une solution concernant votre demande. Vincent Mantis: 1.1.0, 1.1.5, 1.1.1 PHP: 5.0.4 SQL: MySQL 5.0.19 OS: Linux Please complete your signature with your environment informations. Enable skype notification here
Sorry, only registered users may post in this forum.
Online Users
Guests:
1
Record Number of Users:
1
on April 02, 2023
Record Number of Guests:
115
on November 09, 2023
Top Users
|