| | @@ -52,10 +52,11 @@ |
| 52 | 52 | ** char *cookie_value(zPName, zDefault); |
| 53 | 53 | ** |
| 54 | 54 | ** Look up the value of a cookie parameter zPName. Return zDefault if |
| 55 | 55 | ** there is no display preferences cookie or if zPName does not exist. |
| 56 | 56 | */ |
| 57 | +#include "config.h" |
| 57 | 58 | #include "cookies.h" |
| 58 | 59 | #include <assert.h> |
| 59 | 60 | #include <string.h> |
| 60 | 61 | |
| 61 | 62 | #if INTERFACE |
| | @@ -208,24 +209,42 @@ |
| 208 | 209 | ** Show the current display settings contained in the |
| 209 | 210 | ** "fossil_display_settings" cookie. |
| 210 | 211 | */ |
| 211 | 212 | void cookie_page(void){ |
| 212 | 213 | int i; |
| 213 | | - if( PB("clear") ){ |
| 214 | | - cgi_set_cookie(DISPLAY_SETTINGS_COOKIE, "", 0, 1); |
| 215 | | - cgi_replace_parameter(DISPLAY_SETTINGS_COOKIE, ""); |
| 216 | | - } |
| 214 | + int nCookie = 0; |
| 215 | + const char *zName = 0; |
| 216 | + const char *zValue = 0; |
| 217 | + int isQP = 0; |
| 217 | 218 | cookie_parse(); |
| 218 | | - style_header("User Preference Cookie Values"); |
| 219 | | - if( cookies.nParam ){ |
| 220 | | - style_submenu_element("Clear", "%R/cookies?clear"); |
| 221 | | - } |
| 222 | | - @ <p>The following are user preference settings held in the |
| 223 | | - @ "fossil_display_settings" cookie. |
| 224 | | - @ <ul> |
| 225 | | - @ <li>Raw cookie value: "%h(PD("fossil_display_settings",""))" |
| 226 | | - for(i=0; i<cookies.nParam; i++){ |
| 227 | | - @ <li>%h(cookies.aParam[i].zPName): "%h(cookies.aParam[i].zPValue)" |
| 228 | | - } |
| 229 | | - @ </ul> |
| 219 | + style_header("Cookies"); |
| 220 | + @ <form method="POST"> |
| 221 | + @ <ol> |
| 222 | + for(i=0; cgi_param_info(i, &zName, &zValue, &isQP); i++){ |
| 223 | + char *zDel; |
| 224 | + if( isQP ) continue; |
| 225 | + if( fossil_isupper(zName[0]) ) continue; |
| 226 | + zDel = mprintf("del%s",zName); |
| 227 | + if( P(zDel)!=0 ){ |
| 228 | + cgi_set_cookie(zName, "", 0, -1); |
| 229 | + cgi_redirect("cookies"); |
| 230 | + } |
| 231 | + nCookie++; |
| 232 | + @ <li><p><b>%h(zName)</b>: %h(zValue) |
| 233 | + @ <input type="submit" name="%h(zDel)" value="Delete"> |
| 234 | + if( fossil_strcmp(zName, DISPLAY_SETTINGS_COOKIE)==0 && cookies.nParam>0 ){ |
| 235 | + int j; |
| 236 | + @ <ul> |
| 237 | + for(j=0; j<cookies.nParam; j++){ |
| 238 | + @ <li>%h(cookies.aParam[j].zPName): "%h(cookies.aParam[j].zPValue)" |
| 239 | + } |
| 240 | + @ </ul> |
| 241 | + } |
| 242 | + fossil_free(zDel); |
| 243 | + } |
| 244 | + @ </ol> |
| 245 | + @ </form> |
| 246 | + if( nCookie==0 ){ |
| 247 | + @ <p><i>No cookies for this website</i></p> |
| 248 | + } |
| 230 | 249 | style_finish_page(); |
| 231 | 250 | } |
| 232 | 251 | |