Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Change the "Log" submenu element of the annotation page so that it shows or hides the log using javascript, avoiding a server roundtrip and a recomputation of the annotation. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
037e06b37015873b0f45b08ebe2d8ddb |
| User & Date: | drh 2017-09-25 15:36:19.425 |
Context
|
2017-09-25
| ||
| 17:24 | Improved limit handling for annotation. The limit can now be expressed in compute-time seconds rather than versions analyzed, and defaults to "1.0s", which is enough to compute a complete annotation on most reasonable files. ... (check-in: 517b9a5652 user: drh tags: trunk) | |
| 15:36 | Change the "Log" submenu element of the annotation page so that it shows or hides the log using javascript, avoiding a server roundtrip and a recomputation of the annotation. ... (check-in: 037e06b370 user: drh tags: trunk) | |
| 15:28 | Merge search-technote ... (check-in: a551d503c2 user: andygoth tags: trunk) | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
386 387 388 389 390 391 392 |
Stmt q;
double rNow;
int show_colors = PB("colors");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Branches");
style_adunit_config(ADUNIT_RIGHT_OK);
| | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
Stmt q;
double rNow;
int show_colors = PB("colors");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_header("Branches");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
login_anonymous_available();
db_prepare(&q, brlistQuery/*works-like:""*/);
rNow = db_double(0.0, "SELECT julianday('now')");
@ <div class="brlist"><table id="branchlisttable">
@ <thead><tr>
@ <th>Branch Name</th>
|
| ︙ | ︙ |
Changes to src/browse.c.
| ︙ | ︙ | |||
751 752 753 754 755 756 757 |
if( p->pChild!=0 && p->nFullName>nD ) nFile++;
}
zObjType = "Folders";
}else{
zObjType = "Files";
}
| | | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
if( p->pChild!=0 && p->nFullName>nD ) nFile++;
}
zObjType = "Folders";
}else{
zObjType = "Files";
}
style_submenu_checkbox("nofiles", "Folders Only", 0, 0);
if( zCI ){
@ <h2>%s(zObjType) from
if( sqlite3_strnicmp(zCI, zUuid, (int)strlen(zCI))!=0 ){
@ "%h(zCI)"
}
@ [%z(href("vinfo?name=%!S",zUuid))%S(zUuid)</a>] %s(blob_str(&dirname))
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | u64 annFlags = DIFF_STRIP_EOLCR; int showLog; /* True to display the log */ int fileVers; /* Show file version instead of check-in versions */ int ignoreWs; /* Ignore whitespace */ const char *zFilename; /* Name of file to annotate */ const char *zRevision; /* Name of check-in from which to start annotation */ const char *zCI; /* The check-in containing zFilename */ Annotator ann; HQuery url; struct AnnVers *p; unsigned clr1, clr2, clr; int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */ /* Gather query parameters */ | > | 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 | u64 annFlags = DIFF_STRIP_EOLCR; int showLog; /* True to display the log */ int fileVers; /* Show file version instead of check-in versions */ int ignoreWs; /* Ignore whitespace */ const char *zFilename; /* Name of file to annotate */ const char *zRevision; /* Name of check-in from which to start annotation */ const char *zCI; /* The check-in containing zFilename */ char *zLink; Annotator ann; HQuery url; struct AnnVers *p; unsigned clr1, clr2, clr; int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */ /* Gather query parameters */ |
| ︙ | ︙ | |||
2351 2352 2353 2354 2355 2356 2357 |
url_add_parameter(&url, "filename", zFilename);
if( iLimit!=20 ){
url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
}
url_add_parameter(&url, "w", ignoreWs ? "1" : "0");
url_add_parameter(&url, "log", showLog ? "1" : "0");
url_add_parameter(&url, "filevers", fileVers ? "1" : "0");
| | | | | 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 |
url_add_parameter(&url, "filename", zFilename);
if( iLimit!=20 ){
url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
}
url_add_parameter(&url, "w", ignoreWs ? "1" : "0");
url_add_parameter(&url, "log", showLog ? "1" : "0");
url_add_parameter(&url, "filevers", fileVers ? "1" : "0");
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
style_submenu_checkbox("log", "Log", 0, "toggle_annotation_log()");
style_submenu_checkbox("filevers", "Link to Files", 0, 0);
if( ann.bLimit ){
char *z1, *z2;
style_submenu_element("All Ancestors", "%s",
url_render(&url, "limit", "-1", 0, 0));
z1 = sqlite3_mprintf("%d Ancestors", iLimit+20);
z2 = sqlite3_mprintf("%d", iLimit+20);
style_submenu_element(z1, "%s", url_render(&url, "limit", z2, 0, 0));
|
| ︙ | ︙ | |||
2378 2379 2380 2381 2382 2383 2384 |
clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
}
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
}
| | | | | | | | | | < < < < < < < < < < < | < < < | | > > > > > > > > | | 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 |
clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
}
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
}
@ <div id="annotation_log" style='display:%s(showLog?"block":"none")'>
zLink = href("%R/finfo?name=%t&ci=%!S",zFilename,zCI);
@ <h2>Versions of %z(zLink)%h(zFilename)</a> analyzed:</h2>
@ <ol>
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
@ <li><span style='background-color:%s(p->zBgColor);'>%s(p->zDate)
@ check-in %z(href("%R/info/%!S",p->zMUuid))%S(p->zMUuid)</a>
@ artifact %z(href("%R/artifact/%!S",p->zFUuid))%S(p->zFUuid)</a>
@ </span>
}
@ </ol>
@ <hr />
@ </div>
@ <script>
@ function toggle_annotation_log(){
@ var w = gebi("annotation_log");
@ var x = document.forms["f01"].elements["log"].checked
@ w.style.display = x ? "block" : "none";
@ }
@ </script>
if( !ann.bLimit ){
@ <h2>Origin for each line in
@ %z(href("%R/finfo?name=%h&ci=%!S", zFilename, zCI))%h(zFilename)</a>
@ from check-in %z(href("%R/info/%!S",zCI))%S(zCI)</a>:</h2>
iLimit = ann.nVers+10;
}else{
@ <h2>Lines added by the %d(iLimit) most recent ancestors of
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
1152 1153 1154 1155 1156 1157 1158 |
style_submenu_element("Clear glob",
"%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo,
sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
}else{
style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
}
if( sideBySide || verboseFlag ){
| | | 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 |
style_submenu_element("Clear glob",
"%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo,
sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
}else{
style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
}
if( sideBySide || verboseFlag ){
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
}
style_header("Check-in Differences");
if( P("nohdr")==0 ){
@ <h2>Difference From:</h2><blockquote>
checkin_description(ridFrom);
@ </blockquote><h2>To:</h2><blockquote>
checkin_description(ridTo);
|
| ︙ | ︙ | |||
1584 1585 1586 1587 1588 1589 1590 |
}
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
style_header("Diff");
| | | | | 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 |
}
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
style_header("Diff");
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
style_submenu_checkbox("sbs", "Side-by-Side Diff", 0, 0);
style_submenu_checkbox("verbose", "Verbose", 0, 0);
style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch",
g.zTop, P("v1"), P("v2"));
if( P("smhdr")!=0 ){
@ <h2>Differences From Artifact
@ %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a> To
@ %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>.</h2>
|
| ︙ | ︙ | |||
2082 2083 2084 2085 2086 2087 2088 |
if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){
style_submenu_element("Parsed", "%R/info/%s", zUuid);
}
if( descOnly ){
style_submenu_element("Content", "%R/artifact/%s", zUuid);
}else{
if( zLn==0 || atoi(zLn)==0 ){
| | | 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 |
if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){
style_submenu_element("Parsed", "%R/info/%s", zUuid);
}
if( descOnly ){
style_submenu_element("Content", "%R/artifact/%s", zUuid);
}else{
if( zLn==0 || atoi(zLn)==0 ){
style_submenu_checkbox("ln", "Line Numbers", 0, 0);
}
@ <hr />
content_get(rid, &content);
if( renderAsWiki ){
wiki_render_by_mimetype(&content, zMime);
}else if( renderAsHtml ){
@ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 |
*/
static struct Submenu {
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 {
| | | | | | | | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
*/
static struct Submenu {
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_BINARY */
unsigned char isDisabled; /* True if this control is grayed out */
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
#define FF_MULTI 2
#define FF_BINARY 3
#define FF_CHECKBOX 4
|
| ︙ | ︙ | |||
258 259 260 261 262 263 264 | aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled; aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY; nSubmenuCtrl++; } void style_submenu_checkbox( const char *zName, /* Query parameter name */ const char *zLabel, /* Label to display after the checkbox */ | | > > | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
nSubmenuCtrl++;
}
void style_submenu_checkbox(
const char *zName, /* Query parameter name */
const char *zLabel, /* Label to display after the checkbox */
int isDisabled, /* True if disabled */
const char *zJS /* Optional javascript to run on toggle */
){
assert( nSubmenuCtrl < count(aSubmenuCtrl) );
aSubmenuCtrl[nSubmenuCtrl].zName = zName;
aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
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 */
|
| ︙ | ︙ | |||
591 592 593 594 595 596 597 |
if( !isTrue ){
@ selected\
}
@ >%h(aSubmenuCtrl[i].zFalse)</option>
@ </select>
break;
}
| | > > > | > > | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
if( !isTrue ){
@ selected\
}
@ >%h(aSubmenuCtrl[i].zFalse)</option>
@ </select>
break;
}
case FF_CHECKBOX: {
@ <label class='submenuctrl submenuckbox'>\
@ <input type='checkbox' name='%s(zQPN)' \
if( PB(zQPN) ){
@ checked \
}
if( aSubmenuCtrl[i].zJS ){
@ 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>
|
| ︙ | ︙ | |||
1591 1592 1593 1594 1595 1596 1597 |
if( !g.perm.Admin && !g.perm.Setup && !db_get_boolean("test_env_enable",0) ){
login_needed(0);
return;
}
for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
style_header("Environment Test");
showAll = PB("showall");
| | | 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 |
if( !g.perm.Admin && !g.perm.Setup && !db_get_boolean("test_env_enable",0) ){
login_needed(0);
return;
}
for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]);
style_header("Environment Test");
showAll = PB("showall");
style_submenu_checkbox("showall", "Cookies", 0, 0);
style_submenu_element("Stats", "%R/stat");
#if !defined(_WIN32)
@ uid=%d(getuid()), gid=%d(getgid())<br />
#endif
@ g.zBaseURL = %h(g.zBaseURL)<br />
@ g.zHttpsURL = %h(g.zHttpsURL)<br />
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
1614 1615 1616 1617 1618 1619 1620 |
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. */
| | | 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 |
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. */
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;
|
| ︙ | ︙ | |||
1746 1747 1748 1749 1750 1751 1752 |
p = p->u.pTo;
}
blob_append(&sql, ")", -1);
path_reset();
addFileGlobExclusion(zChng, &sql);
tmFlags |= TIMELINE_DISJOINT;
db_multi_exec("%s", blob_sql_text(&sql));
| | | 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 |
p = p->u.pTo;
}
blob_append(&sql, ")", -1);
path_reset();
addFileGlobExclusion(zChng, &sql);
tmFlags |= TIMELINE_DISJOINT;
db_multi_exec("%s", blob_sql_text(&sql));
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 ){
|
| ︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 |
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);
}
}
| | | | | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 |
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);
}
}
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;
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);
|
| ︙ | ︙ | |||
2101 2102 2103 2104 2105 2106 2107 |
rDate+ONE_SECOND, blob_sql_text(&cond))
){
timeline_submenu(&url, "Newer", "a", zDate, "b");
}
free(zDate);
}
if( zType[0]=='a' || zType[0]=='c' ){
| | | | 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 |
rDate+ONE_SECOND, blob_sql_text(&cond))
){
timeline_submenu(&url, "Newer", "a", zDate, "b");
}
free(zDate);
}
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);
style_submenu_entry("t", "Tag Filter:", -8, 0);
style_submenu_multichoice("ms", count(azMatchStyles)/2, azMatchStyles, 0);
}
blob_zero(&cond);
}
|
| ︙ | ︙ |