Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Use a two-entry selection-box instead of a checkbox for boolean properties. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | form-submenu |
| Files: | files | file ages | folders |
| SHA1: |
1d50f47f6c2b65c2d49a96d8913d5f04 |
| User & Date: | drh 2015-02-04 23:56:46.155 |
Context
|
2015-02-05
| ||
| 02:01 | Merge trunk fixes into form-submenu. ... (check-in: d867a83545 user: drh tags: form-submenu) | |
|
2015-02-04
| ||
| 23:56 | Use a two-entry selection-box instead of a checkbox for boolean properties. ... (check-in: 1d50f47f6c user: drh tags: form-submenu) | |
| 19:14 | Add the ability to include FORM elements on the submenu. ... (check-in: b17970e13b user: drh tags: form-submenu) | |
Changes
Changes to src/style.c.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 |
static int nSubmenu = 0; /* Number of buttons */
static struct SubmenuCtrl {
const char *zName; /* Form query parameter */
const char *zLabel; /* Label. Might be NULL for FF_MULTI */
int eType; /* FF_ENTRY, FF_CKBOX, FF_MULTI */
int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
const char **azChoice; /* value/display pairs for FF_MULTI */
} aSubmenuCtrl[20];
static int nSubmenuCtrl = 0;
| > | | | > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
static int nSubmenu = 0; /* Number of buttons */
static struct SubmenuCtrl {
const char *zName; /* Form query parameter */
const char *zLabel; /* Label. Might be NULL for FF_MULTI */
int eType; /* FF_ENTRY, FF_CKBOX, FF_MULTI */
int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
const char **azChoice; /* value/display pairs for FF_MULTI */
const char *zFalse; /* FF_BINARY label when false */
} aSubmenuCtrl[20];
static int nSubmenuCtrl = 0;
#define FF_ENTRY 1
#define FF_CKBOX 2
#define FF_MULTI 3
#define FF_BINARY 4
/*
** Remember that the header has been generated. The footer is omitted
** if an error occurs before the header.
*/
static int headerHasBeenGenerated = 0;
|
| ︙ | ︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
const char *zLabel /* Label before the checkbox */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_CKBOX;
nSubmenuCtrl++;
}
void style_submenu_multichoice(
const char *zName, /* Query parameter name */
int nChoice, /* Number of options */
const char **azChoice /* value/display pairs. 2*nChoice entries */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
| > > > > > > > > > > > > | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
const char *zLabel /* Label before the checkbox */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_CKBOX;
nSubmenuCtrl++;
}
void style_submenu_binary(
const char *zName, /* Query parameter name */
const char *zTrue, /* Label to show when parameter is true */
const char *zFalse /* Label to show when the parameter is false */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
nSubmenuCtrl++;
}
void style_submenu_multichoice(
const char *zName, /* Query parameter name */
int nChoice, /* Number of options */
const char **azChoice /* value/display pairs. 2*nChoice entries */
){
assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
|
| ︙ | ︙ | |||
525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
cgi_printf(
"<option value='%h'%s>%h</option>\n",
zQPV,
fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
aSubmenuCtrl[i].azChoice[j+1]
);
}
@ </select>
break;
}
}
}
}
@ </div>
| > > > > > > > > > > > > > > > > > > | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
cgi_printf(
"<option value='%h'%s>%h</option>\n",
zQPV,
fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
aSubmenuCtrl[i].azChoice[j+1]
);
}
@ </select>
break;
}
case FF_BINARY: {
int isTrue = PB(zQPN);
cgi_printf(
"<select class='submenuctrl' size='1' name='%s' "
"onchange='gebi(\"f01\").submit();'>\n",
zQPN
);
cgi_printf(
"<option value='1'%s>%h</option>\n",
isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
);
cgi_printf(
"<option value='0'%s>%h</option>\n",
(!isTrue) ? " selected":"", aSubmenuCtrl[i].zFalse
);
@ </select>
break;
}
}
}
}
@ </div>
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
1296 1297 1298 1299 1300 1301 1302 |
if( d_rid ){
if( p_rid ){
/* If both p= and d= are set, we don't have the uuid of d yet. */
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
}
url_add_parameter(&url, "d", zUuid);
}
| | | 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 |
if( d_rid ){
if( p_rid ){
/* If both p= and d= are set, we don't have the uuid of d yet. */
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
}
url_add_parameter(&url, "d", zUuid);
}
style_submenu_binary("v","With Files","Without Files");
style_submenu_entry("n","Lines",1);
timeline_y_submenu();
}else if( f_rid && g.perm.Read ){
/* If f= is present, ignore all other parameters other than n= */
char *zUuid;
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
|
| ︙ | ︙ | |||
1540 1541 1542 1543 1544 1545 1546 |
}else if( rCirca>0.0 ){
blob_appendf(&desc, " occurring around %h.<br />", zCirca);
}
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.perm.Hyperlink ){
| | | 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 |
}else if( rCirca>0.0 ){
blob_appendf(&desc, " occurring around %h.<br />", zCirca);
}
if( zSearch ){
blob_appendf(&desc, " matching \"%h\"", zSearch);
}
if( g.perm.Hyperlink ){
style_submenu_binary("v","With Files","Without Files");
if( zAfter || n==nEntry ){
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
timeline_submenu(&url, "Older", "b", zDate, "a");
free(zDate);
}
if( zBefore || (zAfter && n==nEntry) ){
zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
|
| ︙ | ︙ |