distroquery: added download links in package pages

This commit is contained in:
Silvan Calarco 2013-10-13 12:25:46 +02:00
parent 6a83898e66
commit 9c1d4b1547
3 changed files with 31 additions and 10 deletions

View File

@ -275,16 +275,17 @@ void printQueryData() {
/* download */ /* download */
printf("<div style='display:inline;background-color:green'>" printf("<div style='display:inline;background-color:green'>"
"<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">&nbsp;Download&nbsp;</a></div>", "&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">Download</a>&nbsp;</div>",
query_repositories[i]->download_prefix, query_repositories[i]->download_prefix,
query_repositories[i]->download_dir, query_repositories[i]->download_dir,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")), 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(statement,sqlite3_find_column_id(statement, NULL, "release")));
/* details */ /* details */
printf("&nbsp;<div style='display:inline;background-color:lightblue;font-weight:strong'>" printf("&nbsp;<div style='display:inline;background-color:lightblue;font-weight:strong'>"
"<a href='javascript:distroquery_request(" "&nbsp;<a href='javascript:distroquery_request("
"\"repository=%s&package=%s&arch=%s\")' style=\"color:black\">&nbsp;Details&nbsp;</a></div>", "\"repository=%s&package=%s&arch=%s\")' style=\"color:black\">Details</a>&nbsp;</div>",
query_repositories[i]->tag, query_repositories[i]->tag,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
query_repositories[i]->arch[a]); query_repositories[i]->arch[a]);
@ -425,7 +426,18 @@ void printPackageData() {
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>", printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX)); htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
printf("<hr><b>Developers details:</b>"); /* download */
printf("<div style='display:inline;background-color:green'>"
"&nbsp;<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" style=\"color:white\">Download</a>&nbsp;</div>",
ct->download_prefix,
ct->download_dir,
query_arch,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
query_arch);
printf("<hr><br><b>Developers details:</b>");
printf("<br>Source package:"); printf("<br>Source package:");
printf(" <a href='javascript:distroquery_request(\"repository=%s&package=%s\")'>%s</a>", printf(" <a href='javascript:distroquery_request(\"repository=%s&package=%s\")'>%s</a>",
@ -547,7 +559,16 @@ void printSourcePackageData() {
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>", printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX)); htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
printf("<hr><b>Developers details:</b>"); /* download */
printf("<div style='display:inline;background-color:green'>"
"&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">Download</a>&nbsp;</div>",
ct->download_prefix,
ct->download_dir,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")));
printf("<hr><br><b>Developers details:</b>");
printf("<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", printf("<br>Build date: %s",
simpleTimeToHuman(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")), (humanDate *) & strdate)); simpleTimeToHuman(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")), (humanDate *) & strdate));

View File

@ -518,7 +518,7 @@ char *humanSize(long long sbytes, sizeString *s) {
} }
char *htmlclean(char *source,char *dest,unsigned int max) const char *htmlclean(const char *source,char *dest,unsigned int max)
{ {
unsigned int i=0,j=0; unsigned int i=0,j=0;
char subst[10]; char subst[10];
@ -537,14 +537,14 @@ char *htmlclean(char *source,char *dest,unsigned int max)
j+=strlen(subst); j+=strlen(subst);
} else { } else {
fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n"); fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n");
return source; return source;
} }
i++; i++;
} }
return dest; return dest;
} }
char *htmlcleanNoBr(char *source,char *dest,unsigned int max) const char *htmlcleanNoBr(const char *source,char *dest,unsigned int max)
{ {
unsigned int i=0,j=0; unsigned int i=0,j=0;
char subst[10]; char subst[10];

View File

@ -33,8 +33,8 @@ simpleTimeToTemplate(long calendartime, const char* template, humanDate * strdat
humanDate *simpleTimeToHuman(long calendartime, humanDate * strdate); humanDate *simpleTimeToHuman(long calendartime, humanDate * strdate);
char *humanSize(long long sbytes, sizeString *s); char *humanSize(long long sbytes, sizeString *s);
void fprintf_depstable_filtered_var(FILE* f,char* st); void fprintf_depstable_filtered_var(FILE* f,char* st);
char *htmlclean(char *source,char *dest,unsigned int max); const char *htmlclean(const char *source,char *dest,unsigned int max);
char *htmlcleanNoBr(char *source,char *dest,unsigned int max); const char *htmlcleanNoBr(const char *source,char *dest,unsigned int max);
int scansdir(const char *dir, struct dirent ***namelist, int scansdir(const char *dir, struct dirent ***namelist,
int (*select)(const struct dirent *), int (*select)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **)); int (*compar)(const struct dirent **, const struct dirent **));