Index: mantisbt/admin/schema.php =================================================================== --- mantisbt/admin/schema.php (revision 5358) +++ mantisbt/admin/schema.php (working copy) @@ -409,3 +409,5 @@ $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), " filter_by L NOTNULL DEFAULT \" '1' \"" ) ); + +$upgrade[] = Array( 'AddColumnSQL', Array(db_get_table('mantis_project_file_table'), "visible_in_child L NOTNULL DEFAULT '1' AFTER description") ); \ No newline at end of file Index: mantisbt/core/file_api.php =================================================================== --- mantisbt/core/file_api.php (revision 5358) +++ mantisbt/core/file_api.php (working copy) @@ -526,7 +526,7 @@ } # -------------------- - function file_add( $p_bug_id, $p_tmp_file, $p_file_name, $p_file_type='', $p_table = 'bug', $p_file_error = 0, $p_title = '', $p_desc = '' ) { + function file_add( $p_bug_id, $p_tmp_file, $p_file_name, $p_file_type='', $p_table = 'bug', $p_file_error = 0, $p_title = '', $p_desc = '', $p_visible_in_child = false ) { switch ( (int) $p_file_error ) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: @@ -558,6 +558,7 @@ if ( 'bug' == $p_table ) { $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); $t_bug_id = bug_format_id( $p_bug_id ); + $p_visible_in_child = false; } else { $t_project_id = helper_get_current_project(); $t_bug_id = 0; @@ -569,6 +570,7 @@ $c_file_type = db_prepare_string( $p_file_type ); $c_title = db_prepare_string( $p_title ); $c_desc = db_prepare_string( $p_desc ); + $c_visible_in_child = db_prepare_bool( $p_visible_in_child ); if( $t_project_id == ALL_PROJECTS ) { $t_file_path = config_get( 'absolute_path_default_upload_folder' ); @@ -631,10 +633,17 @@ $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); $c_id = ( 'bug' == $p_table ) ? $c_bug_id : $c_project_id; + if( 'bug' == $p_table ) { $query = "INSERT INTO $t_file_table (" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content) VALUES ($c_id, '$c_title', '$c_desc', '$c_disk_file_name', '$c_new_file_name', '$c_file_path', $c_file_size, '$c_file_type', '" . db_now() ."', $c_content)"; + } else { + $query = "INSERT INTO $t_file_table + (" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, visible_in_child) + VALUES + ($c_id, '$c_title', '$c_desc', '$c_disk_file_name', '$c_new_file_name', '$c_file_path', $c_file_size, '$c_file_type', '" . db_now() ."', $c_content, $c_visible_in_child)"; + } db_query( $query ); if ( 'bug' == $p_table ) { Index: mantisbt/lang/strings_english.txt =================================================================== --- mantisbt/lang/strings_english.txt (revision 5358) +++ mantisbt/lang/strings_english.txt (working copy) @@ -1025,6 +1025,8 @@ # proj_doc_add_page.php $s_upload_file_title = 'Upload File'; $s_title = 'Title'; +$s_visible_in_child_project = 'Visible in child projects'; +$s_visibility = 'Visibility'; # proj_doc_delete.php $s_project_file_deleted_msg = 'Project file deleted'; Index: mantisbt/proj_doc_add.php =================================================================== --- mantisbt/proj_doc_add.php (revision 5358) +++ mantisbt/proj_doc_add.php (working copy) @@ -39,6 +39,7 @@ $f_title = gpc_get_string( 'title' ); $f_description = gpc_get_string( 'description' ); $f_file = gpc_get_file( 'file' ); + $f_visible_in_child = gpc_get_bool( 'visible_in_child', false ); if ( is_blank( $f_title ) ) { error_parameters( lang_get( 'title' ) ); @@ -46,7 +47,7 @@ } $f_file_error = ( isset( $f_file['error'] ) ) ? $f_file['error'] : 0; - file_add( 0, $f_file['tmp_name'], $f_file['name'], $f_file['type'], 'project', $f_file_error, $f_title, $f_description ); + file_add( 0, $f_file['tmp_name'], $f_file['name'], $f_file['type'], 'project', $f_file_error, $f_title, $f_description, $f_visible_in_child ); $t_redirect_url = 'proj_doc_page.php'; Index: mantisbt/proj_doc_add_page.php =================================================================== --- mantisbt/proj_doc_add_page.php (revision 5358) +++ mantisbt/proj_doc_add_page.php (working copy) @@ -71,6 +71,14 @@