distroquery: milestone3 (still hardcoded) support and searchbox fix for package query

This commit is contained in:
Silvan Calarco 2014-11-24 12:46:34 +01:00
parent 714aba96fd
commit 53ac68d8d0

View File

@ -81,7 +81,7 @@ const char* ARCHS[ARCHS_MAX] = { "i586", "x86_64", "arm", "", "" };
static struct configTag *firstconfigtag = NULL; static struct configTag *firstconfigtag = NULL;
char *query = ""; char *query = "";
char *query_package; char *query_package;
char *query_repository = "milestone2"; char *query_repository = "devel";
char *query_arch = NULL; char *query_arch = NULL;
int query_compact = 0; int query_compact = 0;
int query_limit = 10; int query_limit = 10;
@ -95,7 +95,7 @@ char *query_path = NULL;
struct configTag *query_repositories[100]; struct configTag *query_repositories[100];
int search_milestone1 = 0, search_milestone2 = 1, search_devel = 1; int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 1, search_devel = 1;
int search_sources = 0, searchbox = 0; int search_sources = 0, searchbox = 0;
int search_files = 0; int search_files = 0;
@ -318,6 +318,7 @@ void printInputForm() {
// "'repository='+getElementById('repository').value" // "'repository='+getElementById('repository').value"
"'query='+getElementById('query').value+" "'query='+getElementById('query').value+"
"'&search_devel='+getElementById('search_devel').checked+" "'&search_devel='+getElementById('search_devel').checked+"
"'&search_milestone3='+getElementById('search_milestone3').checked+"
"'&search_milestone2='+getElementById('search_milestone2').checked+" "'&search_milestone2='+getElementById('search_milestone2').checked+"
"'&search_milestone1='+getElementById('search_milestone1').checked+" "'&search_milestone1='+getElementById('search_milestone1').checked+"
"'&search_i586='+getElementById('search_i586').checked+" "'&search_i586='+getElementById('search_i586').checked+"
@ -341,6 +342,10 @@ void printInputForm() {
if (search_devel) printf("checked=checked "); if (search_devel) printf("checked=checked ");
printf("onclick=%s>devel ", ajax_call); printf("onclick=%s>devel ", ajax_call);
printf("<input type=checkbox id=\"search_milestone3\" ");
if (search_milestone3) printf("checked=checked ");
printf("onclick=%s>milestone3&nbsp;", ajax_call);
printf("<input type=checkbox id=\"search_milestone2\" "); printf("<input type=checkbox id=\"search_milestone2\" ");
if (search_milestone2) printf("checked=checked "); if (search_milestone2) printf("checked=checked ");
printf("onclick=%s>milestone2&nbsp;", ajax_call); printf("onclick=%s>milestone2&nbsp;", ajax_call);
@ -1517,6 +1522,8 @@ void parse_request_variables(char *data) {
/* 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")) {
query = url_decode(valuetok); query = url_decode(valuetok);
} else if (!strcmp(vartok, "search_milestone3")) {
search_milestone3 = strstr(valuetok, "false") != valuetok;
} else if (!strcmp(vartok, "search_milestone2")) { } else if (!strcmp(vartok, "search_milestone2")) {
search_milestone2 = strstr(valuetok, "false") != valuetok; search_milestone2 = strstr(valuetok, "false") != valuetok;
} else if (!strcmp(vartok, "search_milestone1")) { } else if (!strcmp(vartok, "search_milestone1")) {
@ -1548,19 +1555,24 @@ void parse_request_variables(char *data) {
if (query_package) { if (query_package) {
if (strstr(query_repository, "devel") == query_repository) { if (strstr(query_repository, "devel") == query_repository) {
search_devel = 1; search_devel = 1;
search_milestone3 = 0;
search_milestone2 = 0;
search_milestone1 = 0;
} else if (strstr(query_repository, "milestone3") == query_repository) {
search_devel = 0;
search_milestone3 = 1;
search_milestone2 = 0; search_milestone2 = 0;
search_milestone1 = 0; search_milestone1 = 0;
searchbox = 1;
} else if (strstr(query_repository, "milestone2") == query_repository) { } else if (strstr(query_repository, "milestone2") == query_repository) {
search_devel = 0; search_devel = 0;
search_milestone3 = 0;
search_milestone2 = 1; search_milestone2 = 1;
search_milestone1 = 0; search_milestone1 = 0;
searchbox = 1;
} else if (strstr(query_repository, "milestone1") == query_repository) { } else if (strstr(query_repository, "milestone1") == query_repository) {
search_devel = 0; search_devel = 0;
search_milestone3 = 0;
search_milestone2 = 0; search_milestone2 = 0;
search_milestone1 = 1; search_milestone1 = 1;
searchbox = 1;
} }
} }
while (ct) { while (ct) {
@ -1568,6 +1580,11 @@ void parse_request_variables(char *data) {
ct = ct->next; ct = ct->next;
} }
ct = firstconfigtag; ct = firstconfigtag;
while (ct) {
if ((strstr(ct->tag, "milestone3") == ct->tag) && search_milestone3) query_repositories[i++] = ct;
ct = ct->next;
}
ct = firstconfigtag;
while (ct) { while (ct) {
if ((strstr(ct->tag, "milestone2") == ct->tag) && search_milestone2) query_repositories[i++] = ct; if ((strstr(ct->tag, "milestone2") == ct->tag) && search_milestone2) query_repositories[i++] = ct;
ct = ct->next; ct = ct->next;