distroquery: instant search and status field addition
This commit is contained in:
parent
7289d581c2
commit
40aa848d81
@ -146,7 +146,7 @@ void printInputForm() {
|
||||
")";
|
||||
|
||||
printf("<queryform><![CDATA[");
|
||||
printf("<input id=query onkeypress=if(checkEnter(event))%s>", ajax_call);
|
||||
printf("<input id=query onkeyup=if(checkMinLength(this.value,3))%s>", ajax_call);
|
||||
printf("<button onclick=%s>Cerca</button>", ajax_call);
|
||||
/* printf(" Repository: <select id=repository>");
|
||||
while (ct) {
|
||||
@ -197,23 +197,28 @@ void printQueryData() {
|
||||
(search_arm && !strcmp(query_repositories[i]->arch[a],"arm")) ||
|
||||
(search_x86_64 && !strcmp(query_repositories[i]->arch[a],"x86_64"))) {
|
||||
snprintf(sql, PATH_MAX,
|
||||
"SELECT * FROM packages_%s WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' "
|
||||
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC",
|
||||
"SELECT * FROM packages_%s WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' OR version LIKE '%%%s%%' "
|
||||
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC, "
|
||||
"groupdescr LIKE 'Graphical Desktop/%%' DESC, groupdescr LIKE 'Applications/%%' DESC, "
|
||||
"groupdescr LIKE 'Development/%%' ASC, groupdescr LIKE 'Documentation%%' ASC, groupdescr LIKE 'System/Libraries%%' ASC, "
|
||||
"name LIKE '%%-devel' ASC, name LIKE '%%-debug' ASC "
|
||||
"LIMIT 100",
|
||||
query_repositories[i]->arch[a], query, query, query, query, query, query);
|
||||
if (query_repositories[i]->db &&
|
||||
(sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
|
||||
while (sqlite3_step(statement) == SQLITE_ROW) {
|
||||
numresults++;
|
||||
printf("<div style='position:relative'><hr><br><div style='display:inline;color:white;background-color:green'> %s </div> "
|
||||
"<div style='display:inline;color:black;background-color:yellow'> %s </div><br>"
|
||||
"<b>%s</b> %s-%s<br>%s<br>Group: %s",
|
||||
"<div style='display:inline;color:black;background-color:yellow'> %s </div> "
|
||||
"<div style='display:inline;color:black;background-color:lightblue'> %s </div><br>"
|
||||
"<b>%s</b> %s-%s<br>%s",
|
||||
query_repositories[i]->arch[a],
|
||||
query_repositories[i]->tag,
|
||||
sqlite3_column_text(statement,7),
|
||||
sqlite3_column_text(statement,1),
|
||||
sqlite3_column_text(statement,4),
|
||||
sqlite3_column_text(statement,5),
|
||||
sqlite3_column_text(statement,6),
|
||||
sqlite3_column_text(statement,7));
|
||||
sqlite3_column_text(statement,6));
|
||||
|
||||
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div>",
|
||||
sqlite3_column_text(statement,8));
|
||||
@ -253,8 +258,8 @@ void printQueryData() {
|
||||
|
||||
if (search_sources) {
|
||||
snprintf(sql, PATH_MAX,
|
||||
"SELECT * FROM sources WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' "
|
||||
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC",
|
||||
"SELECT * FROM sources WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' OR version LIKE '%%%s%%'"
|
||||
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC LIMIT 100",
|
||||
query, query, query, query, query, query);
|
||||
for (i = 0; query_repositories[i] != NULL; i++) {
|
||||
if (query_repositories[i]->db &&
|
||||
@ -262,15 +267,16 @@ void printQueryData() {
|
||||
while (sqlite3_step(statement) == SQLITE_ROW) {
|
||||
numresults++;
|
||||
printf("<hr><br><div style='display:inline;color:black;background-color:red'> Source </div> "
|
||||
"<div style='display:inline;color:black;background-color:yellow'> %s </div><br>"
|
||||
"<b>%s</b> %s-%s<br>%s<br>Group: %s<br>License: %s</br>URL: %s<br><br>"
|
||||
"<div style='display:inline;color:black;background-color:yellow'> %s </div> "
|
||||
"<div style='display:inline;color:black;background-color:lightblue'> %s </div><br>"
|
||||
"<b>%s</b> %s-%s<br>%s<br>License: %s</br>URL: %s<br><br>"
|
||||
"<div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
|
||||
query_repositories[i]->tag,
|
||||
sqlite3_column_text(statement,8),
|
||||
sqlite3_column_text(statement,1),
|
||||
sqlite3_column_text(statement,4),
|
||||
sqlite3_column_text(statement,5),
|
||||
sqlite3_column_text(statement,6),
|
||||
sqlite3_column_text(statement,8),
|
||||
sqlite3_column_text(statement,11),
|
||||
sqlite3_column_text(statement,10),
|
||||
sqlite3_column_text(statement,9));
|
||||
@ -279,9 +285,10 @@ void printQueryData() {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("<hr>");
|
||||
|
||||
printf("<hr><br>%d result(s) found.", numresults);
|
||||
printf("]]></queryreply>");
|
||||
printf("<querystatus><![CDATA[%d result(s) shown.]]></querystatus>", numresults);
|
||||
|
||||
for (i = 0; query_repositories[i] != NULL; i++) {
|
||||
sqlite3_close((sqlite3*)query_repositories[i]->db);
|
||||
|
Loading…
Reference in New Issue
Block a user