Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | File differences and file viewer added to the www interface. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
1a9c6dbfb7a85fd148c4def82a34c351 |
| User & Date: | drh 2007-08-01 16:13:49.000 |
Context
|
2007-08-01
| ||
| 16:42 | Update the todo list. ... (check-in: 36df57aa39 user: drh tags: trunk) | |
| 16:13 | File differences and file viewer added to the www interface. ... (check-in: 1a9c6dbfb7 user: drh tags: trunk) | |
| 15:13 | Fix the test-verify command so that it ignores phantoms. ... (check-in: 1245b42ba3 user: drh tags: trunk) | |
Changes
Changes to src/info.c.
| ︙ | ︙ | |||
276 277 278 279 280 281 282 |
char zPrevDate[20];
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("File History");
zPrevDate[0] = 0;
db_prepare(&q,
| | | | | > > > | > > > > | > > > > | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
char zPrevDate[20];
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("File History");
zPrevDate[0] = 0;
db_prepare(&q,
"SELECT a.uuid, substr(b.uuid,1,10), datetime(event.mtime,'localtime'),"
" event.comment, event.user, mlink.pid, mlink.fid"
" 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",
g.zExtra
);
@ <h2>History of %h(g.zExtra)</h2>
@ <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);
int fpid = db_column_int(&q, 5);
int frid = db_column_int(&q, 6);
if( memcmp(zDate, zPrevDate, 10) ){
sprintf(zPrevDate, "%.10s", zDate);
@ <tr><td colspan=3>
@ <table cellpadding=2 border=0>
@ <tr><td bgcolor="#a0b5f4" class="border1">
@ <table cellpadding=2 cellspacing=0 border=0><tr>
@ <td bgcolor="#d0d9f4" class="bkgnd1">%s(zPrevDate)</td>
@ </tr></table>
@ </td></tr></table>
@ </td></tr>
}
@ <tr><td valign="top">%s(&zDate[11])</td>
@ <td width="20"></td>
@ <td valign="top" align="left">
hyperlink_to_uuid(zVers);
@ %h(zCom) (By: %h(zUser))
@ Id: %s(zUuid)/%d(frid)
@ <a href="%s(g.zBaseURL)/fview/%d(frid)">[view]</a>
@ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&v2=%d(frid)">[diff]</a>
@ </td>
}
db_finalize(&q);
@ </table>
style_footer();
}
|
| ︙ | ︙ | |||
333 334 335 336 337 338 339 |
/*
** WEBPAGE: vdiff
**
** Show all differences for a particular check-in specified by g.zExtra
*/
void vdiff_page(void){
| | < < | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
/*
** WEBPAGE: vdiff
**
** Show all differences for a particular check-in specified by g.zExtra
*/
void vdiff_page(void){
int rid;
Stmt q;
char *zUuid;
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("Version Diff");
rid = name_to_rid(g.zExtra);
|
| ︙ | ︙ | |||
373 374 375 376 377 378 379 |
@ </pre></blockquote>
}
db_finalize(&q);
style_footer();
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > | | | < | | < | | < > | < < < < | | | < < < < | < | | | > > | < > | < > | | < | < < < | | | < | < < | > > > > > > > > > > > > > > > > > > > > > > > > > | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 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 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
@ </pre></blockquote>
}
db_finalize(&q);
style_footer();
}
/*
** Write a description of an object to the www reply.
**
** If the object is a file then mention:
**
** * It's uuid
** * All its filenames
** * The versions it was checked-in on, with times and users
**
** If the object is a manifest, then mention:
**
** * It's uuid
** * date of check-in
** * Comment & user
*/
static void object_description(int rid, int linkToView){
Stmt q;
int cnt = 0;
db_prepare(&q,
"SELECT filename.name, datetime(event.mtime), substr(a.uuid,1,10),"
" event.comment, event.user, b.uuid"
" FROM mlink, filename, event, blob a, blob b"
" WHERE filename.fnid=mlink.fnid"
" AND event.objid=mlink.mid"
" AND a.rid=mlink.fid"
" AND b.rid=mlink.mid"
" AND mlink.fid=%d",
rid
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
const char *zDate = db_column_text(&q, 1);
const char *zFuuid = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
const char *zVers = db_column_text(&q, 5);
@ File <a href="%s(g.zBaseURL)/finfo/%T(zName)">%h(zName)</a>
@ uuid %s(zFuuid) part of check-in
hyperlink_to_uuid(zVers);
@ %s(zCom) by %s(zUser) on %s(zDate).
cnt++;
}
db_finalize(&q);
db_prepare(&q,
"SELECT datetime(mtime), user, comment, uuid"
" FROM event, blob"
" WHERE event.objid=%d"
" AND blob.rid=%d",
rid, rid
);
while( db_step(&q)==SQLITE_ROW ){
const char *zDate = db_column_text(&q, 0);
const char *zUuid = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 1);
@ Version
hyperlink_to_uuid(zUuid);
@ %s(zCom) by %s(zUser) on %s(zDate).
cnt++;
}
db_finalize(&q);
if( cnt==0 ){
@ Empty file
}else if( linkToView ){
@ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a>
}
}
/*
** WEBPAGE: fdiff
**
** Two arguments, v1 and v2, are integers. Show the difference between
** the two records.
*/
void diff_page(void){
int v1 = atoi(PD("v1","0"));
int v2 = atoi(PD("v2","0"));
Blob c1, c2, diff;
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("Diff");
@ <h2>Differences From:</h2>
@ <blockquote>
object_description(v1, 1);
@ </blockquote>
@ <h2>To:</h2>
@ <blockquote>
object_description(v2, 1);
@ </blockquote>
@ <hr>
@ <blockquote><pre>
content_get(v1, &c1);
content_get(v2, &c2);
blob_zero(&diff);
unified_diff(&c1, &c2, 4, &diff);
blob_reset(&c1);
blob_reset(&c2);
@ %h(blob_str(&diff))
@ </pre></blockquote>
blob_reset(&diff);
style_footer();
}
/*
** WEBPAGE: fview
**
** Show the complete content of a file identified by g.zExtra
*/
void fview_page(void){
int rid;
Blob content;
rid = name_to_rid(g.zExtra);
login_check_credentials();
if( !g.okHistory ){ login_needed(); return; }
style_header("File Content");
@ <h2>Content Of:</h2>
@ <blockquote>
object_description(rid, 0);
@ </blockquote>
@ <hr>
@ <blockquote><pre>
content_get(rid, &content);
@ %h(blob_str(&content))
@ </pre></blockquote>
blob_reset(&content);
style_footer();
}
|