Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Make the Basic/Advanced menu controls on timelines a setting that persists in the display preferences cookie. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
259074d364c11415f84027baaee5bc6b |
| User & Date: | drh 2017-12-05 22:39:49.119 |
Context
|
2017-12-06
| ||
| 01:09 | Add the --no-opt option to the ./configure script. Fix the menu.js script to avoid the use of eval(). ... (check-in: 189adb9959 user: drh tags: trunk) | |
|
2017-12-05
| ||
| 22:39 | Make the Basic/Advanced menu controls on timelines a setting that persists in the display preferences cookie. ... (check-in: 259074d364 user: drh tags: trunk) | |
| 21:36 | Remember the last Unified/Side-by-side diff in the display preferences cookie. ... (check-in: 0a1f4ed6aa user: drh tags: trunk) | |
Changes
Changes to src/style.c.
| ︙ | ︙ | |||
44 45 46 47 48 49 50 |
const char *zLabel; /* Button label */
const char *zLink; /* Jump to this link when button is pressed */
} aSubmenu[30];
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 */
| | | | | < < < | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
const char *zLabel; /* Button label */
const char *zLink; /* Jump to this link when button is pressed */
} aSubmenu[30];
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 */
unsigned char eType; /* FF_ENTRY, FF_MULTI, FF_CHECKBOX */
unsigned char eVisible; /* STYLE_NORMAL or STYLE_DISABLED */
short int iSize; /* Width for FF_ENTRY. Count for FF_MULTI */
const char *const *azChoice; /* value/display pairs for FF_MULTI */
const char *zFalse; /* FF_BINARY label when false */
const char *zJS; /* Javascript to run on toggle */
} aSubmenuCtrl[20];
static int nSubmenuCtrl = 0;
#define FF_ENTRY 1 /* Text entry box */
#define FF_MULTI 2 /* Combobox. Multiple choices. */
#define FF_BINARY 3 /* Control for binary query parameter */
#define FF_CHECKBOX 4 /* Check-box */
#if INTERFACE
#define STYLE_NORMAL 0 /* Normal display of control */
#define STYLE_DISABLED 1 /* Control is disabled */
#endif /* INTERFACE */
/*
** Remember that the header has been generated. The footer is omitted
** if an error occurs before the header.
*/
static int headerHasBeenGenerated = 0;
|
| ︙ | ︙ | |||
240 241 242 243 244 245 246 | aSubmenuCtrl[nSubmenuCtrl].zName = zName; aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel; aSubmenuCtrl[nSubmenuCtrl].eVisible = eVisible; aSubmenuCtrl[nSubmenuCtrl].zJS = zJS; aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX; nSubmenuCtrl++; } | < < < < < < < < < < < < | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
aSubmenuCtrl[nSubmenuCtrl].eVisible = eVisible;
aSubmenuCtrl[nSubmenuCtrl].zJS = zJS;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_CHECKBOX;
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 */
int eVisible /* Visible or disabled */
){
assert( nSubmenuCtrl < count(aSubmenuCtrl) );
|
| ︙ | ︙ | |||
575 576 577 578 579 580 581 |
const char *zDisabled = "";
const char *zXtraClass = "";
if( aSubmenuCtrl[i].eVisible & STYLE_DISABLED ){
zDisabled = " disabled";
}else if( zQPN ){
cgi_tag_query_parameter(zQPN);
}
| < < < < < < | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
const char *zDisabled = "";
const char *zXtraClass = "";
if( aSubmenuCtrl[i].eVisible & STYLE_DISABLED ){
zDisabled = " disabled";
}else if( zQPN ){
cgi_tag_query_parameter(zQPN);
}
switch( aSubmenuCtrl[i].eType ){
case FF_ENTRY:
@ <span class='submenuctrl%s(zXtraClass)'>\
@ %h(aSubmenuCtrl[i].zLabel)\
@ <input type='text' name='%s(zQPN)' value='%h(PD(zQPN, ""))' \
if( aSubmenuCtrl[i].iSize<0 ){
@ size='%d(-aSubmenuCtrl[i].iSize)' \
|
| ︙ | ︙ | |||
621 622 623 624 625 626 627 |
if( zXtraClass[0] ){
@ </span>
}
break;
}
case FF_BINARY: {
int isTrue = PB(zQPN);
| | > | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
if( zXtraClass[0] ){
@ </span>
}
break;
}
case FF_BINARY: {
int isTrue = PB(zQPN);
@ <select class='submenuctrl%s(zXtraClass)' size='1' \
@ name='%s(zQPN)' \
@ onchange='gebi("f01").submit();'%s(zDisabled)>
@ <option value='1'\
if( isTrue ){
@ selected\
}
@ >%h(aSubmenuCtrl[i].zLabel)</option>
@ <option value='0'\
|
| ︙ | ︙ | |||
650 651 652 653 654 655 656 |
@ onchange='%s(aSubmenuCtrl[i].zJS)'%s(zDisabled)>\
}else{
@ onchange='gebi("f01").submit();'%s(zDisabled)>\
}
@ %h(aSubmenuCtrl[i].zLabel)</label>
break;
}
| < < < < < < | 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
@ onchange='%s(aSubmenuCtrl[i].zJS)'%s(zDisabled)>\
}else{
@ onchange='gebi("f01").submit();'%s(zDisabled)>\
}
@ %h(aSubmenuCtrl[i].zLabel)</label>
break;
}
}
}
@ </div>
if( nSubmenuCtrl ){
cgi_query_parameters_to_hidden();
cgi_tag_query_parameter(0);
@ </form>
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 | ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel ** rel Show related check-ins as well as those matching t=TAG ** mionly Limit rel to show ancestors but not descendants ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP ** u=USER Only show items associated with USER ** y=TYPE 'ci', 'w', 't', 'e', or 'all'. ** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar" ** ng No Graph. ** nd Do not highlight the focus check-in ** v Show details of files changed ** f=CHECKIN Show family (immediate parents and children) of CHECKIN ** from=CHECKIN Path from... ** to=CHECKIN ... to this ** shortest ... show only the shortest path | > | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel ** rel Show related check-ins as well as those matching t=TAG ** mionly Limit rel to show ancestors but not descendants ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP ** u=USER Only show items associated with USER ** y=TYPE 'ci', 'w', 't', 'e', or 'all'. ** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar" ** advm Use the "Advanced" or "Busy" menu design. ** ng No Graph. ** nd Do not highlight the focus check-in ** v Show details of files changed ** f=CHECKIN Show family (immediate parents and children) of CHECKIN ** from=CHECKIN Path from... ** to=CHECKIN ... to this ** shortest ... show only the shortest path |
| ︙ | ︙ | |||
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 |
int pd_rid;
double rBefore, rAfter, rCirca; /* Boundary times */
const char *z;
char *zOlderButton = 0; /* URL for Older button at the bottom */
char *zNewerButton = 0; /* URL for Newer button at the top */
int selectedRid = -9999999; /* Show a highlight on this RID */
int disableY = 0; /* Disable type selector on submenu */
/* Set number of rows to display */
cookie_read_parameter("n","n");
z = P("n");
if( z==0 ) z = db_get("timeline-default-length",0);
if( z ){
if( fossil_strcmp(z,"all")==0 ){
| > | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 |
int pd_rid;
double rBefore, rAfter, rCirca; /* Boundary times */
const char *z;
char *zOlderButton = 0; /* URL for Older button at the bottom */
char *zNewerButton = 0; /* URL for Newer button at the top */
int selectedRid = -9999999; /* Show a highlight on this RID */
int disableY = 0; /* Disable type selector on submenu */
int advancedMenu = 0; /* Use the advanced menu design */
/* Set number of rows to display */
cookie_read_parameter("n","n");
z = P("n");
if( z==0 ) z = db_get("timeline-default-length",0);
if( z ){
if( fossil_strcmp(z,"all")==0 ){
|
| ︙ | ︙ | |||
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 |
}else{
z = "50";
nEntry = 50;
}
cgi_replace_query_parameter("n",z);
cookie_write_parameter("n","n",0);
tmFlags |= timeline_ss_submenu();
/* To view the timeline, must have permission to read project data.
*/
pd_rid = name_to_typed_rid(P("dp"),"ci");
if( pd_rid ){
p_rid = d_rid = pd_rid;
}
| > > | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 |
}else{
z = "50";
nEntry = 50;
}
cgi_replace_query_parameter("n",z);
cookie_write_parameter("n","n",0);
tmFlags |= timeline_ss_submenu();
cookie_link_parameter("advm","advm","0");
advancedMenu = atoi(PD("advm","0"));
/* To view the timeline, must have permission to read project data.
*/
pd_rid = name_to_typed_rid(P("dp"),"ci");
if( pd_rid ){
p_rid = d_rid = pd_rid;
}
|
| ︙ | ︙ | |||
1472 1473 1474 1475 1476 1477 1478 |
matchStyle = MS_REGEXP;
}else{
/* For exact maching, inhibit links to the selected tag. */
zThisTag = zTagName;
}
/* Display a checkbox to enable/disable display of related check-ins. */
| > | > | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 |
matchStyle = MS_REGEXP;
}else{
/* For exact maching, inhibit links to the selected tag. */
zThisTag = zTagName;
}
/* Display a checkbox to enable/disable display of related check-ins. */
if( advancedMenu ){
style_submenu_checkbox("rel", "Related", 0, 0);
}
/* Construct the tag match expression. */
zTagSql = tagMatchExpression(matchStyle, zTagName, &zMatchDesc, &zError);
}
if( zMark && zMark[0]==0 ){
if( zAfter ) zMark = zAfter;
|
| ︙ | ︙ | |||
1560 1561 1562 1563 1564 1565 1566 |
zType = "ci";
disableY = 1;
}else{
bisectOnly = 0;
}
style_header("Timeline");
| > | > | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 |
zType = "ci";
disableY = 1;
}else{
bisectOnly = 0;
}
style_header("Timeline");
if( advancedMenu ){
style_submenu_element("Help", "%R/help?cmd=/timeline");
}
login_anonymous_available();
timeline_temp_table();
blob_zero(&sql);
blob_zero(&desc);
blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1);
blob_append(&sql, timeline_query_for_www(), -1);
if( PB("fc") || PB("v") || PB("detail") ){
|
| ︙ | ︙ | |||
1605 1606 1607 1608 1609 1610 1611 |
p = p->u.pTo;
}
blob_append(&sql, ")", -1);
path_reset();
addFileGlobExclusion(zChng, &sql);
tmFlags |= TIMELINE_DISJOINT;
db_multi_exec("%s", blob_sql_text(&sql));
| > | > | 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 |
p = p->u.pTo;
}
blob_append(&sql, ")", -1);
path_reset();
addFileGlobExclusion(zChng, &sql);
tmFlags |= TIMELINE_DISJOINT;
db_multi_exec("%s", blob_sql_text(&sql));
if( advancedMenu ){
style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
}
blob_appendf(&desc, "%d check-ins going from ",
db_int(0, "SELECT count(*) FROM timeline"));
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
blob_append(&desc, " to ", -1);
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
addFileGlobDescription(zChng, &desc);
}else if( (p_rid || d_rid) && g.perm.Read ){
|
| ︙ | ︙ | |||
1655 1656 1657 1658 1659 1660 1661 |
href("%R/info/%!S", zUuid), zUuid);
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);
}
}
| > | > | > | | > | 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 |
href("%R/info/%!S", zUuid), zUuid);
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);
}
}
if( advancedMenu ){
style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
}
style_submenu_entry("n","Max:",4,0);
timeline_y_submenu(1);
}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);"
"INSERT INTO ok VALUES(%d);"
"INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
"INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
f_rid, f_rid, f_rid
);
blob_append_sql(&sql, " AND event.objid IN ok");
db_multi_exec("%s", blob_sql_text(&sql));
if( useDividers ) selectedRid = f_rid;
blob_appendf(&desc, "Parents and children of check-in ");
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid);
tmFlags |= TIMELINE_DISJOINT;
if( advancedMenu ){
style_submenu_checkbox("unhide", "Unhide", 0, 0);
style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
}
}else{
/* Otherwise, a timeline based on a span of time */
int n;
const char *zEType = "timeline item";
char *zDate;
Blob cond;
blob_zero(&cond);
|
| ︙ | ︙ | |||
1958 1959 1960 1961 1962 1963 1964 |
" WHERE blob.rid=event.objid AND mtime>=%.17g%s)",
rDate+ONE_SECOND, blob_sql_text(&cond))
){
zNewerButton = fossil_strdup(url_render(&url, "a", zDate, "b", 0));
}
free(zDate);
}
| > | | | | > > | | > > | > | > | 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 |
" WHERE blob.rid=event.objid AND mtime>=%.17g%s)",
rDate+ONE_SECOND, blob_sql_text(&cond))
){
zNewerButton = fossil_strdup(url_render(&url, "a", zDate, "b", 0));
}
free(zDate);
}
if( advancedMenu ){
if( zType[0]=='a' || zType[0]=='c' ){
style_submenu_checkbox("unhide", "Unhide", 0, 0);
}
style_submenu_checkbox("v", "Files",(zType[0]!='a' && zType[0]!='c'),0);
}
style_submenu_entry("n","Max:",4,0);
timeline_y_submenu(disableY);
if( advancedMenu ){
style_submenu_entry("t", "Tag Filter:", -8, 0);
style_submenu_multichoice("ms", count(azMatchStyles)/2,azMatchStyles,0);
}
}
blob_zero(&cond);
}
if( PB("showsql") ){
@ <pre>%h(blob_sql_text(&sql))</pre>
}
if( search_restrict(SRCH_CKIN)!=0 ){
style_submenu_element("Search", "%R/search?y=c");
}
if( advancedMenu ){
style_submenu_element("Basic", url_render(&url, "advm", "0", 0, 0));
}else{
style_submenu_element("Advanced", url_render(&url, "advm", "1", 0, 0));
}
if( PB("showid") ) tmFlags |= TIMELINE_SHOWRID;
if( useDividers && zMark && zMark[0] ){
double r = symbolic_name_to_mtime(zMark);
if( r>0.0 ) selectedRid = timeline_add_divider(r);
}
blob_zero(&sql);
db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
|
| ︙ | ︙ |