From 53ac68d8d0f3191ff2fb6be0dbfcee45e2ffb9df Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 24 Nov 2014 12:46:34 +0100 Subject: [PATCH] distroquery: milestone3 (still hardcoded) support and searchbox fix for package query --- src/distroquery.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/distroquery.c b/src/distroquery.c index 45a486b..d0405fd 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -81,7 +81,7 @@ const char* ARCHS[ARCHS_MAX] = { "i586", "x86_64", "arm", "", "" }; static struct configTag *firstconfigtag = NULL; char *query = ""; char *query_package; -char *query_repository = "milestone2"; +char *query_repository = "devel"; char *query_arch = NULL; int query_compact = 0; int query_limit = 10; @@ -95,7 +95,7 @@ char *query_path = NULL; 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_files = 0; @@ -318,6 +318,7 @@ void printInputForm() { // "'repository='+getElementById('repository').value" "'query='+getElementById('query').value+" "'&search_devel='+getElementById('search_devel').checked+" + "'&search_milestone3='+getElementById('search_milestone3').checked+" "'&search_milestone2='+getElementById('search_milestone2').checked+" "'&search_milestone1='+getElementById('search_milestone1').checked+" "'&search_i586='+getElementById('search_i586').checked+" @@ -341,6 +342,10 @@ void printInputForm() { if (search_devel) printf("checked=checked "); printf("onclick=%s>devel ", ajax_call); + printf("milestone3 ", ajax_call); + printf("milestone2 ", ajax_call); @@ -1517,6 +1522,8 @@ void parse_request_variables(char *data) { /* fields to make reusable query string for next pages */ if (!strcmp(vartok, "query")) { query = url_decode(valuetok); + } else if (!strcmp(vartok, "search_milestone3")) { + search_milestone3 = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_milestone2")) { search_milestone2 = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_milestone1")) { @@ -1548,19 +1555,24 @@ void parse_request_variables(char *data) { if (query_package) { if (strstr(query_repository, "devel") == query_repository) { 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_milestone1 = 0; - searchbox = 1; } else if (strstr(query_repository, "milestone2") == query_repository) { search_devel = 0; + search_milestone3 = 0; search_milestone2 = 1; search_milestone1 = 0; - searchbox = 1; } else if (strstr(query_repository, "milestone1") == query_repository) { search_devel = 0; + search_milestone3 = 0; search_milestone2 = 0; search_milestone1 = 1; - searchbox = 1; } } while (ct) { @@ -1568,6 +1580,11 @@ void parse_request_variables(char *data) { ct = ct->next; } ct = firstconfigtag; + while (ct) { + if ((strstr(ct->tag, "milestone3") == ct->tag) && search_milestone3) query_repositories[i++] = ct; + ct = ct->next; + } + ct = firstconfigtag; while (ct) { if ((strstr(ct->tag, "milestone2") == ct->tag) && search_milestone2) query_repositories[i++] = ct; ct = ct->next;