Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Hyperlinks to directory browser pages on the pathname in the title of the file history viewer, finfo. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a20dcb5c26addae8473d1eb93f44f00c |
| User & Date: | drh 2008-02-04 19:08:55.000 |
Context
|
2008-02-04
| ||
| 23:14 | Added style info to db_generic_query_view(), so it can be styled via css ... (check-in: 0095e24ba9 user: stephan tags: trunk) | |
| 19:08 | Hyperlinks to directory browser pages on the pathname in the title of the file history viewer, finfo. ... (check-in: a20dcb5c26 user: drh tags: trunk) | |
| 19:07 | On the printf extension converters (ex: %T, %w) the "alternate form flag" (ex: %#T, %#w) means first read an integer from the argument list and then only process that number of characters from the string or blob that is read next from the argument list. ... (check-in: 8c3ec00311 user: drh tags: trunk) | |
Changes
Changes to src/browse.c.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
sqlite3_result_text(context, (char*)&z[n], len-n, SQLITE_TRANSIENT);
}else{
zOut = sqlite3_mprintf("/%.*s", i-n, &z[n]);
sqlite3_result_text(context, zOut, i-n+1, sqlite3_free);
}
}
/*
** WEBPAGE: dir
**
** Query parameters:
**
** name=PATH Directory to display. Required.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
sqlite3_result_text(context, (char*)&z[n], len-n, SQLITE_TRANSIENT);
}else{
zOut = sqlite3_mprintf("/%.*s", i-n, &z[n]);
sqlite3_result_text(context, zOut, i-n+1, sqlite3_free);
}
}
/*
** Given a pathname which is a relative path from the root of
** the repository to a file or directory, compute a string which
** is an HTML rendering of that path with hyperlinks on each
** directory component of the path where the hyperlink redirects
** to the "dir" page for the directory.
**
** There is no hyperlink on the file element of the path.
**
** The computed string is appended to the pOut blob. pOut should
** have already been initialized.
*/
void hyperlinked_path(const char *zPath, Blob *pOut){
int i, j;
char *zSep = "";
for(i=0; zPath[i]; i=j){
for(j=i; zPath[j] && zPath[j]!='/'; j++){}
if( zPath[j] ){
blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
zSep, g.zBaseURL, j, zPath, j-i, &zPath[i]);
}else{
blob_appendf(pOut, "%s%h", zSep, &zPath[i]);
}
zSep = "/";
while( zPath[j]=='/' ){ j++; }
}
}
/*
** WEBPAGE: dir
**
** Query parameters:
**
** name=PATH Directory to display. Required.
|
| ︙ | ︙ | |||
90 91 92 93 94 95 96 |
pathelementFunc, 0, 0);
/* If the name= parameter is an empty string, make it a NULL pointer */
if( zD && strlen(zD)==0 ){ zD = 0; }
/* Compute the title of the page */
if( zD ){
| < < < | < < < < < < < < < < < | < < < | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
pathelementFunc, 0, 0);
/* If the name= parameter is an empty string, make it a NULL pointer */
if( zD && strlen(zD)==0 ){ zD = 0; }
/* Compute the title of the page */
if( zD ){
Blob title;
blob_zero(&title);
blob_appendf(&title, "Files in directory ");
hyperlinked_path(zD, &title);
@ <h2>%s(blob_str(&title))</h2>
blob_reset(&title);
zPrefix = mprintf("%h/", zD);
}else{
@ <h2>Files in the top-level directory</h2>
zPrefix = "";
}
/* Compute the temporary table "localfiles" containing the names
** of all files and subdirectories in the zD[] directory.
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
**
** Show the complete change history for a single file.
*/
void finfo_page(void){
Stmt q;
const char *zFilename;
char zPrevDate[20];
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("File History");
zPrevDate[0] = 0;
zFilename = PD("name","");
db_prepare(&q,
"SELECT a.uuid, substr(b.uuid,1,10), datetime(event.mtime,'localtime'),"
" coalesce(event.ecomment, event.comment),"
" coalesce(event.euser, event.user),"
" mlink.pid, mlink.fid, mlink.mid, mlink.fnid"
" FROM mlink, blob a, blob b, event"
" WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
" AND a.rid=mlink.mid"
" AND b.rid=mlink.fid"
" AND event.objid=mlink.mid"
" ORDER BY event.mtime DESC",
zFilename
);
| > > > | > > > | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
**
** Show the complete change history for a single file.
*/
void finfo_page(void){
Stmt q;
const char *zFilename;
char zPrevDate[20];
Blob title;
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("File History");
zPrevDate[0] = 0;
zFilename = PD("name","");
db_prepare(&q,
"SELECT a.uuid, substr(b.uuid,1,10), datetime(event.mtime,'localtime'),"
" coalesce(event.ecomment, event.comment),"
" coalesce(event.euser, event.user),"
" mlink.pid, mlink.fid, mlink.mid, mlink.fnid"
" FROM mlink, blob a, blob b, event"
" WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
" AND a.rid=mlink.mid"
" AND b.rid=mlink.fid"
" AND event.objid=mlink.mid"
" ORDER BY event.mtime DESC",
zFilename
);
blob_zero(&title);
blob_appendf(&title, "History of ");
hyperlinked_path(zFilename, &title);
@ <h2>%b(&title)</h2>
blob_reset(&title);
@ <table cellspacing=0 border=0 cellpadding=0>
while( db_step(&q)==SQLITE_ROW ){
const char *zVers = db_column_text(&q, 0);
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
|
| ︙ | ︙ |