distroquery: apply htmlclean to description and some other improvements in packages pages

This commit is contained in:
Silvan Calarco 2013-10-13 03:31:46 +02:00
parent e41fc038c7
commit 6a83898e66

View File

@ -363,9 +363,10 @@ void printPackageData() {
int a, i, j, k;
char dbname[PATH_MAX];
sqlite3 *db, *dbs;
sqlite3_stmt *statement, *stmt1;
sqlite3 *db, *dbs, *dba;
sqlite3_stmt *statement, *stmt1, *stmt2;
char sql[PATH_MAX];
char buffer[PATH_MAX];
struct configTag* ct = findRepositoryByTag(query_repository);
sizeString strsize;
@ -395,7 +396,7 @@ void printPackageData() {
"<div style='display:inline;color:black;background-color:yellow'> %s </div>&nbsp;"
"<div style='display:inline;color:black;background-color:lightblue'>&nbsp%s&nbsp;</div>&nbsp;"
"<div style='display:inline;color:black;background-color:orange'>&nbsp%s&nbsp;</div><br><br>"
"<h1>%s - %s</h1>Version: %s-%s<br>Size: %s",
"<h1>%s - %s</h1>Version: %s-%s<br>URL: <a href=\"%s\" target=_new>%s</a><br>Size: %s",
query_arch,
ct->tag,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
@ -404,10 +405,25 @@ void printPackageData() {
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),
humanSize(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "size")), &strsize));
printf("<br>Related packages:");
snprintf(sql, PATH_MAX, "SELECT * FROM packages WHERE id_source=%d AND NOT id=%d",
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id_source")),
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt2, NULL) == SQLITE_OK)
while (sqlite3_step(stmt2) == SQLITE_ROW)
printf(" <a href='javascript:distroquery_request(\"repository=%s&package=%s&arch=%s\")'>%s(%s)</a>",
ct->tag,
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")),
query_arch,
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")),
query_arch);
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")));
htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
printf("<hr><b>Developers details:</b>");
@ -473,6 +489,7 @@ void printSourcePackageData() {
sqlite3 *db, *dba;
sqlite3_stmt *statement, *stmt1;
char sql[PATH_MAX];
char buffer[PATH_MAX];
struct configTag* ct = findRepositoryByTag(query_repository);
humanDate strdate;
sizeString strsize;
@ -528,10 +545,10 @@ void printSourcePackageData() {
}
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")));
htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
printf("<hr><b>Developers details:</b>");
printf("<br><br>Maintainer: %s", sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name")));
printf("<br>Maintainer: %s", sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name")));
printf("<br>Build date: %s",
simpleTimeToHuman(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")), (humanDate *) & strdate));