Enhanced detail log to pass as XHTML.

Thanks to Markus Elfring for the small patch.

svn path=/trunk/; revision=931
This commit is contained in:
Curtis Gedak 2008-10-14 21:57:56 +00:00
parent a849cfe897
commit c3cdcb4dc5
2 changed files with 32 additions and 28 deletions

View File

@ -1,3 +1,11 @@
2008-10-14 Curtis Gedak <gedakc@gmail.com>
* src/Dialog_Progress.cc: Enhanced detail log to pass as XHTML
- gparted_details.htm now passes as XHTML 1.0 Transitional
in the validator found at http://validator.w3.org/
- Thanks to Markus Elfring for the small patch.
- Closes GParted bug #525347
2008-10-08 Curtis Gedak <gedakc@gmail.com> 2008-10-08 Curtis Gedak <gedakc@gmail.com>
* autogen.sh, * autogen.sh,

View File

@ -345,27 +345,25 @@ void Dialog_Progress::on_save()
if ( out ) if ( out )
{ {
//Write out proper HTML start //Write out proper HTML start
out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" ; out << "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" << std::endl
out << "<HTML>" ; << "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>" << std::endl
out << "<HEAD>" ; << "<head>" << std::endl
out << " <META http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">" ; << "<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />" << std::endl
out << " <TITLE>GParted Details</TITLE>" ; << "<title>GParted Details</title>" << std::endl
out << "</HEAD>" ; << "</head>" << std::endl
out << "<BODY>" ; << "<body>" << std::endl
<< "<p>GParted " << VERSION << "</p>" << std::endl
<< "<p>Libparted " << signal_get_libparted_version .emit() << "</p>" << std::endl ;
out << "<P>" ; //Write out each operation
out << "GParted " << VERSION << "<BR><BR>" << std::endl ;
out << "Libparted " << signal_get_libparted_version .emit() ;
out << "</P>" << std::endl ;
for ( unsigned int t = 0 ; t < operations .size() ; t++ ) for ( unsigned int t = 0 ; t < operations .size() ; t++ )
{ {
echo_operation_details( operations[ t ] ->operation_detail, out ) ; echo_operation_details( operations[ t ] ->operation_detail, out ) ;
out << "<P>========================================</P>" << std::endl ; out << "<p>========================================</p>" << std::endl ;
} }
//Write out proper HTML finish //Write out proper HTML finish
out << "</BODY>" ; out << "</body>" << std::endl << "</html>" ;
out << "</HTML>" ;
out .close() ; out .close() ;
} }
} }
@ -376,13 +374,13 @@ void Dialog_Progress::echo_operation_details( const OperationDetail & operationd
//replace '\n' with '<br>' //replace '\n' with '<br>'
Glib::ustring temp = operationdetail .get_description() ; Glib::ustring temp = operationdetail .get_description() ;
for ( unsigned int index = temp .find( "\n" ) ; index < temp .length() ; index = temp .find( "\n" ) ) for ( unsigned int index = temp .find( "\n" ) ; index < temp .length() ; index = temp .find( "\n" ) )
temp .replace( index, 1, "<BR>" ) ; temp .replace( index, 1, "<br />" ) ;
//and export everything to some kind of html... //and export everything to some kind of html...
out << "<TABLE border=0>" << std::endl ; out << "<table border='0'>" << std::endl
out << "<TR>" << std::endl ; << "<tr>" << std::endl
out << "<TD colspan=2>" << std::endl ; << "<td colspan='2'>" << std::endl
out << temp ; << temp ;
if ( ! operationdetail .get_elapsed_time() .empty() ) if ( ! operationdetail .get_elapsed_time() .empty() )
out << "&nbsp;&nbsp;" << operationdetail .get_elapsed_time() ; out << "&nbsp;&nbsp;" << operationdetail .get_elapsed_time() ;
@ -413,23 +411,21 @@ void Dialog_Progress::echo_operation_details( const OperationDetail & operationd
} }
} }
out << std::endl ; out << std::endl << "</td>" << std::endl << "</tr>" << std::endl ;
out << "</TD>" << std::endl ;
out << "</TR>" << std::endl ;
if ( operationdetail .get_childs(). size() ) if ( operationdetail .get_childs(). size() )
{ {
out << "<TR>" << std::endl ; out << "<tr>" << std::endl
out << "<TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD>" << std::endl ; << "<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>" << std::endl
out << "<TD>" << std::endl ; << "<td>" << std::endl ;
for ( unsigned int t = 0 ; t < operationdetail .get_childs() .size() ; t++ ) for ( unsigned int t = 0 ; t < operationdetail .get_childs() .size() ; t++ )
echo_operation_details( operationdetail .get_childs()[ t ], out ) ; echo_operation_details( operationdetail .get_childs()[ t ], out ) ;
out << "</TD>" << std::endl ; out << "</td>" << std::endl << "</tr>" << std::endl ;
out << "</TR>" << std::endl ;
} }
out << "</TABLE>" << std::endl ; out << "</table>" << std::endl ;
} }
void Dialog_Progress::on_response( int response_id ) void Dialog_Progress::on_response( int response_id )