View Issue Details

IDProjectCategoryView StatusLast Update
0022323mantisbtfeaturepublic2022-11-28 06:05
Reporteraavagyan Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version2.1.0 
Summary0022323: Missing whole "Attached Files" section
Description

With all the great improvements in new MantisBT 2.x, me and my users (piloting new version with selected users) are confused about not finding "Attached Files" section, as well as central "Upload file" box (only under the 'add note' - something we have disabled in MantisBT 1.2.x). We use MantisBT more like case management system - and we use attachments extensively. People opening the case would like to see the case with all the supporting attachments. Now attachments are mixed-up with notes. It means that one needs to travel over all notes to collect attachments!? Some of our tickets have up to 200 notes and dozens of attachments. With new setup these cases are basically unmanageable - only 'small' tickets are more-or-less OK - while still not convenient.

Can we have config option to re-enable display of attachments displayed in the old way - grouped together and not scattered in "Activity" messed-up with notes?

Thank you,
Avetis

TagsNo tags attached.
Attached Files

Relationships

related to 0021727 closedvboctor Show attachments inline with notes 
related to 0026631 closedvboctor file_get_visible_attachments shows private files that should be invisible to the user 
has duplicate 0023340 closedatrol Missing whole "Attached Files" section 
has duplicate 0029744 closedatrol Want to add a location for attachment 
related to 0028965 closedvboctor Show issue attachments along with issue header information 

Activities

cas

cas

2017-02-07 03:25

reporter   ~0055518

Last edited: 2017-02-22 13:07

In case you need this functionality, do the following:
add in config_inc.php, the following line:

$g_show_attachments     =   ON;

This makes it configurable, not absolutely neeeded but good practice,
Now open up bug_view_inc.php and goto line 727.
This is right after this section:

if( $t_custom_fields_found ) {
    # spacer
    echo '<tr class="spacer"><td colspan="6"></td></tr>';
    echo '<tr class="hidden"></tr>';
}

Just behind this section, add the following code:

# Attachments
if ( ON == config_get('show_attachments') ) {
    echo '<tr ', helper_alternate_class(), '>';
    echo '<td class="category"><a name="attachments" id="attachments" />', lang_get( 'attached_files' ), '</td>';
    echo '<td colspan="5">';
    print_bug_attachments_list( $t_bug_id, null);
    echo '</td></tr>';
} 

Here you are, your list is back in the main screen.

cas

cas

2017-02-07 03:27

reporter   ~0055519

This way it looks a bit funny because of the HTML thing.
In reality both the words 'spacer' and 'attachments' are prefixed with a '#' sign

cas

cas

2017-02-07 03:34

reporter   ~0055520

Last edited: 2017-02-07 05:32

Changed 2 more lines to be in line with new lay-out, so it should read:

if ( ON == config_get('show_attachments') ) {
    echo '<tr ', helper_alternate_class(), '>';
    echo '<th class="bug-attachments category">', lang_get( 'attached_files' ), '</th>';
    echo '<td class="bug-attachments" colspan="5">';
    print_bug_attachments_list( $t_bug_id, null);
    echo '</td></tr>';
}
aavagyan

aavagyan

2017-02-07 05:20

reporter   ~0055521

Thanks a lot! Works nicely.

Users can possibly use file attach under the 'add note' - doesn't seem to be a big problem. The only missing thing is date next to the attached file, but I looked into functions - it is removed in version 2.x so 'hack' needs to be deeper. My users would possible agree to live without date displayed in this box.

Can these changes be made part of next release?

dregad

dregad

2017-02-07 05:39

developer   ~0055523

@cas I edited your notes to add the markdown formatting so the code is displayed raw.

It was the decision of @vboctor to handle attachments upload and display at note level moving forward, so I let him comment on the eventuality of adding back the notion of "issue-level" attachments.

I have to say that I personally do not like the fact that a document uploaded as part of an issue's initial report appears as a separate bug note; this is made worse by the fact that I like to have notes sorted reverse (most recent first), so the initial attachments appear last.

It's worth mentioning that the current data model would not allow us to differentiate a note vs an issue attachment (currently this is an arbitrary link is based on the upload timestamp).

cas

cas

2017-02-07 06:37

reporter   ~0055527

@aavagyan, it makes sense that the date is taken away since that is visible within the note. Can be added but most likely then also will show up within the note which is not desirable.
@dregad, would agree with you, that is why I dived into this since I have the same wish. Not being able to distinguish between note vs issue attachment does not bother me too much. It is still visible within the notes.
@vboctor, I do understand where you are coming from, that is why I made the switch. Why not incorporate with default switch set to OFF? Saves us from hacking each version and more people happy (overal this version 2 is a step in the right direction anyway).

aavagyan

aavagyan

2017-02-07 06:44

reporter   ~0055528

I strongly believe that "ticket" or "issue" or "case" (no matter what is the term used) needs to have the main information, with supporting documentation (files) as "core" informational unit, whereas notes and the rest (e.g. change-sets, time-tracking info, issue log, etc.), can be appended to it as needed. It looks like it can be achieved more or less easily by displaying "File attachments" block. Config option would be even better to satisfy different needs, e.g.:

  • option 1: show attachments only centrally (don't know if central 'upload' is needed or "upload-in-note" is OK);
  • option 2: show attachment centrally, but also as "activity" item;
  • option 3: show attachments only as "activity" item.

Wikipedia:
"Mantis Bug Tracker is a free and open source, web-based bug tracking system. The most common use of MantisBT is to track software defects. However, MantisBT is often configured by users to serve as a more generic issue tracking system and project management tool."

I think that change is especially needed if we would like to keep last sentence valid.

dnewman

dnewman

2017-02-09 05:11

reporter   ~0055610

This is something that my department would also like to see reinstated. I agree with @aavagyan that for use as a project management tool having all attachments collated within one area is immensely useful.

When uploading items such as: functional or business requirements, this could prove quite costly if they were missed. This is more likely to occur if they are 'hidden' away within the notes/activities section.

A configuration option would be ideal.

dnewman

dnewman

2017-02-09 05:13

reporter   ~0055611

@cas I will test out those options on a test build of Mantis. Thank you for the effort.

aavagyan

aavagyan

2017-02-10 10:51

reporter   ~0055643

Discovered small glitch with this fix. Opening inline (+ sign) shows image in the top-block and not showing it in 'activity' block...

udaymantis

udaymantis

2017-02-17 10:35

reporter   ~0055718

The fix provided above works great, except that the details are coming on multiple lines as shown in the attachment here. Is there a way to make the details come on one line?

AttachedFiles.JPG (88,216 bytes)   
AttachedFiles.JPG (88,216 bytes)   
cas

cas

2017-02-22 12:46

reporter   ~0055748

Just change this line:
echo '<td class="bug-attachments" colspan="5">';
into:
echo '<td class="bug-attachments" colspan="7">';

Should do the trick!

dregad

dregad

2017-02-22 13:11

developer   ~0055749

in 0022323:0055518

echo '<tr ', helper_alternate_class(), '>';

Please note that helper_alternate_class() function is deprecated and will be removed in a future version of MantisBT

cas

cas

2017-02-23 11:07

reporter   ~0055767

Last edited: 2017-02-23 12:22

In order to be future compliant, I think that the line:
echo '<tr ', helper_alternate_class(), '>';
should read:
echo '<tr class="bug-attachments">';
So, the correct adjustment would be:

# Attachments
if ( ON == config_get('show_attachments') ) {
   echo '&lt;tr class=&quot;bug-attachments&quot;>';
    echo '&lt;td class=&quot;category&quot;>&lt;a name=&quot;attachments&quot; id=&quot;attachments&quot;>', lang_get( 'attached_files' ), '&lt;/td>';
    echo '&lt;td class=&quot;bug-attachments&quot; colspan=&quot;7&quot;>';
    print_bug_attachments_list( $t_bug_id, null);
    echo '&lt;/td>&lt;/tr>';
}
aavagyan

aavagyan

2017-02-24 09:34

reporter   ~0055777

@cas I think it is colspan=5

helfy022

helfy022

2017-09-07 10:14

reporter   ~0057637

Hello,

Is there an official means of making available the "Attached Files" section without modifying the core configuration suite?

Thanks,
Ryan.

dzaggiel

dzaggiel

2017-09-08 09:44

reporter   ~0057646

@cas thanx for tip but how to delete comments with attachments since they are already in the attached file box?

cas

cas

2017-09-10 05:15

reporter   ~0057648

@dzaggiel, the attachements will show up on both places. Not much to do avbout that.

dzaggiel

dzaggiel

2017-09-11 05:25

reporter   ~0057673

@cas ahh :( It is possible to add a date and time to attachements?

helfy022

helfy022

2017-09-11 21:29

reporter   ~0057685

Hello,

In addition to the previous question, please also comment when possible on the question posed in this comment:

https://www.mantisbt.org/bugs/view.php?id=22323#c57637

Thanks very much,
Ryan.

cas

cas

2017-09-12 02:51

reporter   ~0057689

@ Ryan,
the direction of Mantis is set by the development team, see also https://www.mantisbt.org/bugs/view.php?id=22323#c55523 .
Hopefully they follow the suggestion made by myself but there is no guarantee for that.

@dzaggiel,
adding date/time requires adjustment of core functions which I wouldlike to avoid.
First and formost, I hope that this section is re-enabled again.

ycap

ycap

2017-09-13 04:13

reporter   ~0057709

Hello,
I have the same need.
The attached file section was very usefull in Mantis v1.2.15, it's almost indispensable for my use.
Do you know if it is planned to be added in a future version ?
Thanks
Yannick

cas

cas

2017-09-14 15:56

reporter   ~0057715

really no clue. for now this is an easy fix!

123

123

2018-11-29 22:44

reporter   ~0061027

I also speak in favor of the possibility of choosing how to display attachments.

j2gl

j2gl

2019-07-23 23:45

reporter   ~0062421

I just upgraded mantis and I'm having a lot of complaints from the users on how the attachments are organized. Please would you add the feature to choose how to display the attachments.
Thanks

cas

cas

2019-07-24 15:21

reporter   ~0062426

Since it is not being added to core yet, i suggest you follow my instructions on how to actieve the “old” way�

andresrom

andresrom

2019-08-26 10:52

reporter   ~0062662

Last edited: 2019-08-26 10:53

Hi guys, i'm getting an error.
Please, can you guide me on how to solve it?
@cas
Thanks

image.png (177,084 bytes)   
image.png (177,084 bytes)   
cas

cas

2019-08-27 02:32

reporter   ~0062669

@andresrom,What exactly is the error message?

andresrom

andresrom

2019-08-27 09:50

reporter   ~0062671

Hi @cas
In the section where the attachments are displayed, html tags <td> and <tr> are shown.

wuqixin

wuqixin

2019-08-30 05:58

reporter   ~0062693

Last edited: 2019-09-02 02:41

@andresrom

if ( ON == config_get('show_attachments') ) {
echo '<tr>';
echo '<th class="bug-attach-tags category">', lang_get( 'attached_files' ), '</th>';
echo '<td class="bug-attach-tags" colspan="5">';
print_bug_attachments_list( $t_bug_id, null);
echo '</td></tr>';
}

image-2.png (39,586 bytes)   
image-2.png (39,586 bytes)   
andresrom

andresrom

2019-09-18 09:05

reporter   ~0062861

@wuqixin
Thank you! Works great.

ciwu

ciwu

2020-01-28 03:53

reporter   ~0063524

If "print_bug_attachments_list" is used, clicking the "chevron" on attachment in the note expands the attachment in the list (duplicate id?).

polzin

polzin

2020-02-04 11:13

reporter   ~0063574

Last edited: 2020-02-04 11:14

Be aware that with 2.23 the suggested patch ignores that privacy of attachments, because of security issue https://mantisbt.org/bugs/view.php?id=26631

pdx

pdx

2020-04-21 08:35

reporter   ~0063879

This patch worked great until we upgraded from 2.17 to 2.24. Now the Attached files section is there but no attachments listed. Can someone tell me if it works in 2.24 and if there is anything that I need to configure to make it work?

cas

cas

2020-04-21 09:44

reporter   ~0063881

Last edited: 2020-04-21 11:39

For version 2.24 please use the following code at line 612 in bug_view_inc.php:

if ( ON == config_get('show_attachments') ) {
    echo '&lt;tr>';
    echo '&lt;th class=&quot;bug-attach-tags category&quot;>', lang_get( 'attached_files' ), '&lt;/th>';
    echo '&lt;td class=&quot;bug-attach-tags&quot; colspan=&quot;5&quot;>';
    print_bug_attachments_list( $f_issue_id, null);
    echo '&lt;/td>&lt;/tr>';
}

This is after the custom fields section just before the closing 'body' statement.

Do not forget to set the variable in core/config_inc.php:
$g_show_attachments = ON;

pdx

pdx

2020-04-21 10:18

reporter   ~0063882

That fixed it. Thank you!

cas

cas

2020-12-02 14:10

reporter   ~0064733

Adjusted the code to give a better fit. Done this for 2.24.2.
So insert the attached code into bug_view_inc.php after the lines
echo '</tbody></table>';
echo '</div></div></div></div></div>';
You find them around line 613.
It is right before the following code:

User list sponsoring the bug

Do not forget to set the variable in core/config_inc.php:
$g_show_attachments = ON;

reinstate_attachment_list.txt (1,198 bytes)   
// CN start reinstate Attachment section
if ( ON == config_get('show_attachments') ) {
	echo '<div class="col-md-12 col-xs-12">';
	echo '<a id="attachments"></a>';
	echo '<div class="space-10"></div>';
	$t_collapse_block = is_collapsed( 'attachments' );
	$t_block_css = $t_collapse_block ? 'collapsed' : '';
	$t_block_icon = $t_collapse_block ? 'fa-chevron-down' : 'fa-chevron-up'; 
	?>
	<div id="attachments" class="widget-box widget-color-blue2 <?php echo $t_block_css ?>">
	<div class="widget-header widget-header-small">
	<h4 class="widget-title lighter">
	<i class="ace-icon fa fa-users"></i>
	<?php echo lang_get( 'attached_files'  ) ?>
	</h4>
	<div class="widget-toolbar">
	<a data-action="collapse" href="#">
	<i class="1 ace-icon fa <?php echo $t_block_icon ?> bigger-125"></i>
	</a>
	</div>
	</div>
	<div class="widget-body">
	<div class="widget-main no-padding">
	<div class="table-responsive">
	<table class="table table-bordered table-condensed table-striped">
	<tr><td>
	<?php
    print_bug_attachments_list( $f_issue_id, null);
	?>
 	</td>
	</tr>
	</table>
	</div>
	</div>
	</div>
	</div>
	</div>
<?php	
}
// CN end reinstate Attachment section
reinstate_attachment_list.txt (1,198 bytes)   
martin.fernau

martin.fernau

2021-04-20 04:54

reporter   ~0065405

Thanks for the updates in this topic. I was able to re-enable this feature for 2.25

vboctor

vboctor

2021-08-07 23:38

manager   ~0065740

Here is a PR that shows issue attachments with issue information and notes attachments along with notes:
https://github.com/mantisbt/mantisbt/pull/1774

AlexanderY

AlexanderY

2021-11-06 09:28

reporter   ~0065988

Last edited: 2021-11-06 10:08

A big reason why we can't yet upgrade from mantis 1.x to 2.x is due to how attachments are handled. We want either attachments to be always linked with the issue and displayed in one place at the top of the issue (as it's done in 1.x), or we want to be able to choose whether to link an attachment with a specific note (and have it displayed in the note) or with the issue (and displayed at the top of the issue).

The fix posted in 0022323:0064733 partly resolves the problem (thank you for providing the fix!), but it's still not possible to attach files directly to an issue, without adding a note. Hopefully it will be resolved in 0021820.

cas

cas

2021-11-12 02:57

reporter   ~0066018

I guess it should be possible to include that section in the fix, i will have a look @ this . Fully agree here that it should be configurable.

cas

cas

2021-11-13 07:17

reporter   ~0066022

Here it is, a plugin that allows to re-instate the attachments section and allows for uploading an attachment without a note.
Can be installed without touching a core script but for better placement I suggest to make one(1) small change.
Please check out the readme!

Attachments201.zip (4,004 bytes)
cas

cas

2021-11-13 10:46

reporter   ~0066024

I have made some improvements in version 2.02:

  • improved the attachments block lay-out
  • added instructions how to avoid top-level attachments to show up in the activities block
    Check the readme for instructions
Attachments202.zip (4,713 bytes)
cas

cas

2021-11-14 07:26

reporter   ~0066025

please use version 2.03, it contains a fix for the instructions to avoid showing top-level attachments as an activity.
Further updates will be provided here:
http://www.nuy.info/mantis2/view.php?id=106

Attachments203.zip (4,265 bytes)
dregad

dregad

2021-11-14 13:37

developer   ~0066027

@cas I did not actually test your plugin so I don't know if this is the cause, but looking at your tracker the markup is bad (misaligned sections). I tried to post a note there with screenshots to illustrate but my note and the files got lost somehow...

cas

cas

2021-11-14 13:57

reporter   ~0066028

Last edited: 2021-11-14 14:21

@dregad, well spotted, I need to verify that. Actually there are 2 plugins that have the same effect, the Gauge Issue Support and the Attachments one.
The attachment plugin does show also that this functionality could easily be embedded using very simple config sections.
Found the root cause, was missing some </div>'s
I will release version2.04 soon.

cas

cas

2021-11-16 03:21

reporter   ~0066037

Final update here. Alignments adjusted, enjoy!

Attachments204.zip (4,328 bytes)
AlexanderY

AlexanderY

2021-11-19 11:38

reporter   ~0066041

About 66037: I installed the plugin on mantis 2.25 successfully. Works well, thank you! :)

treneslgr

treneslgr

2022-07-20 10:03

reporter   ~0066815

Hello, I´m using the plugin Attachments204.zip and it works very well but I am asked if it is possible to show the date the attachment was uploaded.

Regards

cas

cas

2022-07-20 11:37

reporter   ~0066816

That is possible but would require a change to one of the core scripts. So I can give info on how to do this but:

  1. Change needs to be made after every upgrade
  2. Date will also be shown within the notes in case an attachment has been added to the note. Then it shows double.

Including in the plugin is possible but it would require some additional work on it.

treneslgr

treneslgr

2022-07-20 11:47

reporter   ~0066817

Hello cas, Would you be so kind as to indicate me where I can make the change?
Regards

cas

cas

2022-07-20 11:56

reporter   ~0066818

Last edited: 2022-07-20 11:56

Open core/print_api.php
search for function print_bug_attachment_header
Just before if( $p_attachment['can_delete'] ) {

insert these 2 lines:
echo lang_get( 'word_separator' );
echo string_display_line( date(config_get( 'normal_date_format' ),$p_attachment['date_added'] ) );

treneslgr

treneslgr

2022-07-20 12:14

reporter   ~0066819

Thank you very much for your help

image-3.png (13,869 bytes)   
image-3.png (13,869 bytes)   
rexchen

rexchen

2022-11-23 22:38

reporter   ~0067160

Last edited: 2022-11-24 00:07

Hi @cas ,the code save me a lot of time, thank you!
How do I disable the preview of attachment section or configure preview collapsed by default?

cas

cas

2022-11-25 08:09

reporter   ~0067165

Add these lines in core/config_inc.php:
/**

  • Specifies the maximum size (in bytes) below which an attachment is
  • previewed in the bug view pages.
  • To disable the previewing of attachments, set max size to 0.
  • @global integer $g_preview_attachments_inline_max_size
    /
    $g_preview_attachments_inline_max_size = 256
    1024;

And of course set the value to zero

rexchen

rexchen

2022-11-27 20:56

reporter   ~0067166

Hi @cas ,
Thank you for your help.
I Just want to disable the previewing of attachments in the "Attachment section" not including the previewing of attachments in notes.

The following codes can not disable the previewing of attachments in the "Attachment section" .

// CN start reinstate Attachment section
//
$g_preview_attachments_inline_max_size = 0;
if ( ON == config_get('show_attachments') ) {
echo '<div class="col-md-12 col-xs-12">';
echo '<a id="attachments"></a>';
echo '<div class="space-10"></div>';
$t_collapse_block = is_collapsed( 'attachments' );
$t_block_css = $t_collapse_block ? 'collapsed' : '';
$t_block_icon = $t_collapse_block ? 'fa-chevron-down' : 'fa-chevron-up';
?>
<div id="attachments" class="widget-box widget-color-blue2 <?php echo $t_block_css ?>">
<div class="widget-header widget-header-small">
<h4 class="widget-title lighter">
<i class="ace-icon fa fa-users"></i>
<?php echo lang_get( 'attached_files' ) ?>
</h4>
<div class="widget-toolbar">
<a data-action="collapse" href="#">
<i class="1 ace-icon fa <?php echo $t_block_icon ?> bigger-125"></i>
</a>
</div>
</div>
<div class="widget-body">
<div class="widget-main no-padding">
<div class="table-responsive">
<table class="table table-bordered table-condensed table-striped">
<tr><td>
<?php
print_bug_attachments_list( $f_issue_id, null);
?>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<?php
}
$g_preview_attachments_inline_max_size = 3145728;
// CN end reinstate Attachment section

cas

cas

2022-11-28 06:05

reporter   ~0067167

Hi rexchen,
this is a global variable so if you want to change it, you probably first need to declare that you are changing a global one with:
global $g_preview_attachments_inline_max_size;
Next save old value, set the new value an din the end restore the new value (do not use fixed numbers, bad habit).