distroquery: added query_compact option for webbuild
This commit is contained in:
parent
56c348f1b9
commit
f18e247d7a
@ -83,6 +83,7 @@ char *query = "";
|
|||||||
char *query_package;
|
char *query_package;
|
||||||
char *query_repository;
|
char *query_repository;
|
||||||
char *query_arch = NULL;
|
char *query_arch = NULL;
|
||||||
|
int query_compact = 0;
|
||||||
int query_limit = 10;
|
int query_limit = 10;
|
||||||
int query_offset = 0;
|
int query_offset = 0;
|
||||||
char query_next[PATH_MAX] = "";
|
char query_next[PATH_MAX] = "";
|
||||||
@ -367,6 +368,9 @@ void printQueryData() {
|
|||||||
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[ARCHS_MAX], sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[ARCHS_MAX], sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
sqlite3_step(stmt1);
|
sqlite3_step(stmt1);
|
||||||
get_favicon_from_url(sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),buffer,PATH_MAX);
|
get_favicon_from_url(sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),buffer,PATH_MAX);
|
||||||
|
if (query_compact)
|
||||||
|
printf("<div style='position:relative'>");
|
||||||
|
else
|
||||||
printf("<div style='position:relative'><hr><br>");
|
printf("<div style='position:relative'><hr><br>");
|
||||||
printTagsLine(query_repositories[i]->arch[a],
|
printTagsLine(query_repositories[i]->arch[a],
|
||||||
query_repositories[i]->tag,
|
query_repositories[i]->tag,
|
||||||
@ -375,6 +379,18 @@ void printQueryData() {
|
|||||||
printf("<br><img src=\"%s\" width\"16\" height=\"16\"> ", buffer);
|
printf("<br><img src=\"%s\" width\"16\" height=\"16\"> ", buffer);
|
||||||
sqlite3_finalize(stmt1);
|
sqlite3_finalize(stmt1);
|
||||||
}
|
}
|
||||||
|
if (query_compact) {
|
||||||
|
printf("<b><a href='http://www.openmamba.org/distribution/search.html?"
|
||||||
|
"repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
|
||||||
|
"%s</a></b> %s-%s - %s<br>",
|
||||||
|
query_repositories[i]->tag,
|
||||||
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
||||||
|
query_repositories[i]->arch[a],
|
||||||
|
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")),
|
||||||
|
htmlcleanNoBr(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX));
|
||||||
|
} else {
|
||||||
printf("<b>%s</b> %s-%s<br>%s",
|
printf("<b>%s</b> %s-%s<br>%s",
|
||||||
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")),
|
||||||
@ -411,9 +427,10 @@ void printQueryData() {
|
|||||||
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],
|
||||||
_("Details"));
|
_("Details"));
|
||||||
|
|
||||||
printf("</div><br>");
|
printf("</div><br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlite3_finalize(statement);
|
sqlite3_finalize(statement);
|
||||||
localprovidesresults = 0;
|
localprovidesresults = 0;
|
||||||
@ -435,6 +452,19 @@ void printQueryData() {
|
|||||||
_("for arch "),
|
_("for arch "),
|
||||||
query_repositories[i]->arch[a]);
|
query_repositories[i]->arch[a]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (query_compact) {
|
||||||
|
printf("<a href='http://www.openmamba.org/distribution/search.html?"
|
||||||
|
"repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
|
||||||
|
"%s</a> %s %s<br>",
|
||||||
|
query_repositories[i]->tag,
|
||||||
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")),
|
||||||
|
query_repositories[i]->arch[a],
|
||||||
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")),
|
||||||
|
_("provides"),
|
||||||
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "provided", "name")));
|
||||||
|
} else {
|
||||||
printf("<a href=#reply onclick='distroquery_request("
|
printf("<a href=#reply onclick='distroquery_request("
|
||||||
"\"repository=%s&package=%s&arch=%s\")' style=\"color:black;background-color:lightblue\">%s</a> %s %s<br>",
|
"\"repository=%s&package=%s&arch=%s\")' style=\"color:black;background-color:lightblue\">%s</a> %s %s<br>",
|
||||||
query_repositories[i]->tag,
|
query_repositories[i]->tag,
|
||||||
@ -445,6 +475,7 @@ void printQueryData() {
|
|||||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "provided", "name")));
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "provided", "name")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* files search */
|
/* files search */
|
||||||
if (search_files) {
|
if (search_files) {
|
||||||
@ -485,7 +516,7 @@ void printQueryData() {
|
|||||||
sqlite3_close(dbf);
|
sqlite3_close(dbf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (localprovidesresults > 0) printf("</div>");
|
if (localprovidesresults > 0) printf("</div><hr>");
|
||||||
|
|
||||||
sqlite3_finalize(statement);
|
sqlite3_finalize(statement);
|
||||||
}
|
}
|
||||||
@ -517,7 +548,7 @@ void printQueryData() {
|
|||||||
|
|
||||||
get_favicon_from_url(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
|
get_favicon_from_url(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
|
||||||
|
|
||||||
printf("<hr><br>");
|
if (!query_compact) printf("<hr><br>");
|
||||||
|
|
||||||
printTagsLine(NULL,
|
printTagsLine(NULL,
|
||||||
query_repositories[i]->tag,
|
query_repositories[i]->tag,
|
||||||
@ -525,6 +556,17 @@ void printQueryData() {
|
|||||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "license")));
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "license")));
|
||||||
|
|
||||||
printf("<br><img src=\"%s\" width\"16\" height=\"16\"> ", buffer);
|
printf("<br><img src=\"%s\" width\"16\" height=\"16\"> ", buffer);
|
||||||
|
if (query_compact) {
|
||||||
|
printf("<b><a href='http://www.openmamba.org/distribution/search.html?"
|
||||||
|
"repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
|
||||||
|
"%s</a></b> %s-%s - %s<br>",
|
||||||
|
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")),
|
||||||
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
||||||
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
||||||
|
htmlcleanNoBr(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX));
|
||||||
|
} else {
|
||||||
printf("<b>%s</b> %s-%s<br>%s<br><br>",
|
printf("<b>%s</b> %s-%s<br>%s<br><br>",
|
||||||
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")),
|
||||||
@ -533,12 +575,14 @@ void printQueryData() {
|
|||||||
|
|
||||||
printf("<div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div>",
|
printf("<div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div>",
|
||||||
htmlcleanNoBr(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
htmlcleanNoBr(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
||||||
|
/* source details */
|
||||||
printf("<div style='display:inline;background-color:lightblue;font-weight:strong'>"
|
printf("<div style='display:inline;background-color:lightblue;font-weight:strong'>"
|
||||||
" <a href=#reply onclick='distroquery_request("
|
" <a href=#reply onclick='distroquery_request("
|
||||||
"\"repository=%s&package=%s\")' style=\"color:black\">Details</a> </div>",
|
"\"repository=%s&package=%s\")' style=\"color:black\">Details</a> </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")));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
sqlite3_finalize(statement);
|
sqlite3_finalize(statement);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "ERROR: SQLite: %s (%s)\n", sqlite3_errmsg(query_repositories[i]->db[ARCHS_MAX]), sql);
|
fprintf(stderr, "ERROR: SQLite: %s (%s)\n", sqlite3_errmsg(query_repositories[i]->db[ARCHS_MAX]), sql);
|
||||||
@ -554,6 +598,7 @@ void printQueryData() {
|
|||||||
printf("%d %s.", numresults, _("result(s) shown"));
|
printf("%d %s.", numresults, _("result(s) shown"));
|
||||||
else
|
else
|
||||||
printf("%d %s.", numresults, _("result(s) found"));
|
printf("%d %s.", numresults, _("result(s) found"));
|
||||||
|
if (!reply_plain) {
|
||||||
if (k < 7) j=1; else j=k-5; /* j = start pages list from */
|
if (k < 7) j=1; else j=k-5; /* j = start pages list from */
|
||||||
if (!otherresults) {
|
if (!otherresults) {
|
||||||
/* current page is last available */
|
/* current page is last available */
|
||||||
@ -571,9 +616,8 @@ void printQueryData() {
|
|||||||
}
|
}
|
||||||
printf("]");
|
printf("]");
|
||||||
}
|
}
|
||||||
if (!reply_plain) printf("]]></querystatus>");
|
printf("]]></querystatus>");
|
||||||
|
|
||||||
if (!reply_plain) {
|
|
||||||
printf("<title><![CDATA[");
|
printf("<title><![CDATA[");
|
||||||
printf("%s '%s' :: %s", _("Search results for"), query, firstconfigtag->configdefaults->distribution_name);
|
printf("%s '%s' :: %s", _("Search results for"), query, firstconfigtag->configdefaults->distribution_name);
|
||||||
printf("]]></title>");
|
printf("]]></title>");
|
||||||
@ -717,12 +761,13 @@ void printPackageData() {
|
|||||||
simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildtime")), (humanDate *) & strdate));
|
simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildtime")), (humanDate *) & strdate));
|
||||||
|
|
||||||
/* obsoletes */
|
/* obsoletes */
|
||||||
printf("<br><br>%s:", _("Obsoletes"));
|
|
||||||
snprintf(sql, PATH_MAX, "SELECT * FROM obsoletes WHERE id_package=%d",
|
snprintf(sql, PATH_MAX, "SELECT * FROM obsoletes WHERE id_package=%d",
|
||||||
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
||||||
sqlite3_finalize(stmt1);
|
sqlite3_finalize(stmt1);
|
||||||
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
|
j=0;
|
||||||
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
|
if (j++ == 0) printf("<br><br>%s:", _("Obsoletes"));
|
||||||
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoletename")));
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoletename")));
|
||||||
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteversion"))) {
|
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteversion"))) {
|
||||||
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteflags")));
|
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteflags")));
|
||||||
@ -733,13 +778,14 @@ void printPackageData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* provides */
|
/* provides */
|
||||||
printf("<br><br>%s:",_("Provides"));
|
|
||||||
snprintf(sql, PATH_MAX, "SELECT * FROM provides,provided "
|
snprintf(sql, PATH_MAX, "SELECT * FROM provides,provided "
|
||||||
"WHERE provides.id_package=%d AND provided.id=provides.id_provided "
|
"WHERE provides.id_package=%d AND provided.id=provides.id_provided "
|
||||||
"ORDER BY provided.name",
|
"ORDER BY provided.name",
|
||||||
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
||||||
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
|
j=0;
|
||||||
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
|
if (j++ == 0) printf("<br><br>%s:",_("Provides"));
|
||||||
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
||||||
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideversion"))) {
|
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideversion"))) {
|
||||||
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideflags")));
|
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideflags")));
|
||||||
@ -750,13 +796,14 @@ void printPackageData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* requires */
|
/* requires */
|
||||||
printf("<br><br>%s:", _("Requires"));
|
|
||||||
snprintf(sql, PATH_MAX, "SELECT * FROM requires,provided "
|
snprintf(sql, PATH_MAX, "SELECT * FROM requires,provided "
|
||||||
"WHERE requires.id_package=%d AND provided.id=requires.id_provided "
|
"WHERE requires.id_package=%d AND provided.id=requires.id_provided "
|
||||||
"ORDER BY provided.name",
|
"ORDER BY provided.name",
|
||||||
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
||||||
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
|
j=0;
|
||||||
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
|
if (j++ == 0) printf("<br><br>%s:", _("Requires"));
|
||||||
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
||||||
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "requireversion"))) {
|
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "requireversion"))) {
|
||||||
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "requireflags")));
|
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "requireflags")));
|
||||||
@ -1019,6 +1066,8 @@ void parse_request_variables(char *data) {
|
|||||||
reply_xmltag = valuetok;
|
reply_xmltag = valuetok;
|
||||||
} else if (!strcmp(vartok, "replyplain")) {
|
} else if (!strcmp(vartok, "replyplain")) {
|
||||||
reply_plain = strstr(valuetok, "true") == valuetok;
|
reply_plain = strstr(valuetok, "true") == valuetok;
|
||||||
|
} else if (!strcmp(vartok, "query_compact")) {
|
||||||
|
query_compact = strstr(valuetok, "true") == valuetok;
|
||||||
} else {
|
} else {
|
||||||
/* fields to make reusable query string for next pages */
|
/* fields to make reusable query string for next pages */
|
||||||
if (!strcmp(vartok, "query")) {
|
if (!strcmp(vartok, "query")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user