Fossil SCM

Incremental web interface enhancments.

drh 2007-09-22 18:13 trunk
Commit 72b3b1ad47f479df8f0046b6a69fbd4d51d4882b
+13 -8
--- src/info.c
+++ src/info.c
@@ -212,13 +212,12 @@
212212
int cnt = 0;
213213
db_prepare(&q,
214214
"SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
215215
" coalesce(event.euser, event.user),"
216216
" coalesce(event.ecomment,event.comment)"
217
- " FROM leaves, plink, blob, event"
218
- " WHERE plink.cid=leaves.rid"
219
- " AND blob.rid=leaves.rid"
217
+ " FROM leaves, blob, event"
218
+ " WHERE blob.rid=leaves.rid"
220219
" AND event.objid=leaves.rid"
221220
" ORDER BY event.mtime DESC"
222221
);
223222
while( db_step(&q)==SQLITE_ROW ){
224223
const char *zUuid = db_column_text(&q, 0);
@@ -253,11 +252,10 @@
253252
" LEFT JOIN blob ON blob.rid=tagxref.srcid"
254253
" WHERE tagxref.rid=%d"
255254
" ORDER BY tagname", rid
256255
);
257256
while( db_step(&q)==SQLITE_ROW ){
258
- int tagid = db_column_int(&q, 0);
259257
const char *zTagname = db_column_text(&q, 1);
260258
int srcid = db_column_int(&q, 2);
261259
const char *zUuid = db_column_text(&q, 3);
262260
const char *zValue = db_column_text(&q, 4);
263261
const char *zDate = db_column_text(&q, 5);
@@ -545,18 +543,19 @@
545543
while( db_step(&q)==SQLITE_ROW ){
546544
const char *zDate = db_column_text(&q, 0);
547545
const char *zUuid = db_column_text(&q, 3);
548546
const char *zCom = db_column_text(&q, 2);
549547
const char *zUser = db_column_text(&q, 1);
550
- @ Version
548
+ @ Manifest of version
551549
hyperlink_to_uuid(zUuid);
552550
@ %s(zCom) by %s(zUser) on %s(zDate).
553551
cnt++;
554552
}
555553
db_finalize(&q);
556554
if( cnt==0 ){
557
- @ Empty file
555
+ char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
556
+ @ Control file %s(zUuid).
558557
}else if( linkToView ){
559558
@ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a>
560559
}
561560
}
562561
@@ -565,12 +564,12 @@
565564
**
566565
** Two arguments, v1 and v2, are integers. Show the difference between
567566
** the two records.
568567
*/
569568
void diff_page(void){
570
- int v1 = atoi(PD("v1","0"));
571
- int v2 = atoi(PD("v2","0"));
569
+ int v1 = name_to_rid(PD("v1","0"));
570
+ int v2 = name_to_rid(PD("v2","0"));
572571
Blob c1, c2, diff;
573572
574573
login_check_credentials();
575574
if( !g.okHistory ){ login_needed(); return; }
576575
style_header("Diff");
@@ -595,10 +594,11 @@
595594
blob_reset(&diff);
596595
style_footer();
597596
}
598597
599598
/*
599
+** WEBPAGE: info
600600
** WEBPAGE: fview
601601
** URL: /fview/UUID
602602
**
603603
** Show the complete content of a file identified by UUID
604604
** as preformatted text.
@@ -608,10 +608,15 @@
608608
Blob content;
609609
610610
rid = name_to_rid(g.zExtra);
611611
login_check_credentials();
612612
if( !g.okHistory ){ login_needed(); return; }
613
+ if( g.zPath[0]=='i' &&
614
+ db_exists("SELECT 1 FROM plink WHERE cid=%d", rid) ){
615
+ vinfo_page();
616
+ return;
617
+ }
613618
style_header("File Content");
614619
@ <h2>Content Of:</h2>
615620
@ <blockquote>
616621
object_description(rid, 0);
617622
@ </blockquote>
618623
--- src/info.c
+++ src/info.c
@@ -212,13 +212,12 @@
212 int cnt = 0;
213 db_prepare(&q,
214 "SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
215 " coalesce(event.euser, event.user),"
216 " coalesce(event.ecomment,event.comment)"
217 " FROM leaves, plink, blob, event"
218 " WHERE plink.cid=leaves.rid"
219 " AND blob.rid=leaves.rid"
220 " AND event.objid=leaves.rid"
221 " ORDER BY event.mtime DESC"
222 );
223 while( db_step(&q)==SQLITE_ROW ){
224 const char *zUuid = db_column_text(&q, 0);
@@ -253,11 +252,10 @@
253 " LEFT JOIN blob ON blob.rid=tagxref.srcid"
254 " WHERE tagxref.rid=%d"
255 " ORDER BY tagname", rid
256 );
257 while( db_step(&q)==SQLITE_ROW ){
258 int tagid = db_column_int(&q, 0);
259 const char *zTagname = db_column_text(&q, 1);
260 int srcid = db_column_int(&q, 2);
261 const char *zUuid = db_column_text(&q, 3);
262 const char *zValue = db_column_text(&q, 4);
263 const char *zDate = db_column_text(&q, 5);
@@ -545,18 +543,19 @@
545 while( db_step(&q)==SQLITE_ROW ){
546 const char *zDate = db_column_text(&q, 0);
547 const char *zUuid = db_column_text(&q, 3);
548 const char *zCom = db_column_text(&q, 2);
549 const char *zUser = db_column_text(&q, 1);
550 @ Version
551 hyperlink_to_uuid(zUuid);
552 @ %s(zCom) by %s(zUser) on %s(zDate).
553 cnt++;
554 }
555 db_finalize(&q);
556 if( cnt==0 ){
557 @ Empty file
 
558 }else if( linkToView ){
559 @ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a>
560 }
561 }
562
@@ -565,12 +564,12 @@
565 **
566 ** Two arguments, v1 and v2, are integers. Show the difference between
567 ** the two records.
568 */
569 void diff_page(void){
570 int v1 = atoi(PD("v1","0"));
571 int v2 = atoi(PD("v2","0"));
572 Blob c1, c2, diff;
573
574 login_check_credentials();
575 if( !g.okHistory ){ login_needed(); return; }
576 style_header("Diff");
@@ -595,10 +594,11 @@
595 blob_reset(&diff);
596 style_footer();
597 }
598
599 /*
 
600 ** WEBPAGE: fview
601 ** URL: /fview/UUID
602 **
603 ** Show the complete content of a file identified by UUID
604 ** as preformatted text.
@@ -608,10 +608,15 @@
608 Blob content;
609
610 rid = name_to_rid(g.zExtra);
611 login_check_credentials();
612 if( !g.okHistory ){ login_needed(); return; }
 
 
 
 
 
613 style_header("File Content");
614 @ <h2>Content Of:</h2>
615 @ <blockquote>
616 object_description(rid, 0);
617 @ </blockquote>
618
--- src/info.c
+++ src/info.c
@@ -212,13 +212,12 @@
212 int cnt = 0;
213 db_prepare(&q,
214 "SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
215 " coalesce(event.euser, event.user),"
216 " coalesce(event.ecomment,event.comment)"
217 " FROM leaves, blob, event"
218 " WHERE blob.rid=leaves.rid"
 
219 " AND event.objid=leaves.rid"
220 " ORDER BY event.mtime DESC"
221 );
222 while( db_step(&q)==SQLITE_ROW ){
223 const char *zUuid = db_column_text(&q, 0);
@@ -253,11 +252,10 @@
252 " LEFT JOIN blob ON blob.rid=tagxref.srcid"
253 " WHERE tagxref.rid=%d"
254 " ORDER BY tagname", rid
255 );
256 while( db_step(&q)==SQLITE_ROW ){
 
257 const char *zTagname = db_column_text(&q, 1);
258 int srcid = db_column_int(&q, 2);
259 const char *zUuid = db_column_text(&q, 3);
260 const char *zValue = db_column_text(&q, 4);
261 const char *zDate = db_column_text(&q, 5);
@@ -545,18 +543,19 @@
543 while( db_step(&q)==SQLITE_ROW ){
544 const char *zDate = db_column_text(&q, 0);
545 const char *zUuid = db_column_text(&q, 3);
546 const char *zCom = db_column_text(&q, 2);
547 const char *zUser = db_column_text(&q, 1);
548 @ Manifest of version
549 hyperlink_to_uuid(zUuid);
550 @ %s(zCom) by %s(zUser) on %s(zDate).
551 cnt++;
552 }
553 db_finalize(&q);
554 if( cnt==0 ){
555 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
556 @ Control file %s(zUuid).
557 }else if( linkToView ){
558 @ <a href="%s(g.zBaseURL)/fview/%d(rid)">[view]</a>
559 }
560 }
561
@@ -565,12 +564,12 @@
564 **
565 ** Two arguments, v1 and v2, are integers. Show the difference between
566 ** the two records.
567 */
568 void diff_page(void){
569 int v1 = name_to_rid(PD("v1","0"));
570 int v2 = name_to_rid(PD("v2","0"));
571 Blob c1, c2, diff;
572
573 login_check_credentials();
574 if( !g.okHistory ){ login_needed(); return; }
575 style_header("Diff");
@@ -595,10 +594,11 @@
594 blob_reset(&diff);
595 style_footer();
596 }
597
598 /*
599 ** WEBPAGE: info
600 ** WEBPAGE: fview
601 ** URL: /fview/UUID
602 **
603 ** Show the complete content of a file identified by UUID
604 ** as preformatted text.
@@ -608,10 +608,15 @@
608 Blob content;
609
610 rid = name_to_rid(g.zExtra);
611 login_check_credentials();
612 if( !g.okHistory ){ login_needed(); return; }
613 if( g.zPath[0]=='i' &&
614 db_exists("SELECT 1 FROM plink WHERE cid=%d", rid) ){
615 vinfo_page();
616 return;
617 }
618 style_header("File Content");
619 @ <h2>Content Of:</h2>
620 @ <blockquote>
621 object_description(rid, 0);
622 @ </blockquote>
623
--- src/schema.c
+++ src/schema.c
@@ -127,10 +127,13 @@
127127
@ );
128128
@
129129
@ -- Linkages between manifests, files created by that manifest, and
130130
@ -- the names of those files.
131131
@ --
132
+@ -- pid==0 if the file is added by check-in mid.
133
+@ -- fid==0 if the file is removed by check-in mid.
134
+@ --
132135
@ CREATE TABLE mlink(
133136
@ mid INTEGER REFERENCES blob, -- Manifest ID where change occurs
134137
@ pid INTEGER REFERENCES blob, -- File ID in parent manifest
135138
@ fid INTEGER REFERENCES blob, -- Changed file ID in this manifest
136139
@ fnid INTEGER REFERENCES filename -- Name of the file
137140
--- src/schema.c
+++ src/schema.c
@@ -127,10 +127,13 @@
127 @ );
128 @
129 @ -- Linkages between manifests, files created by that manifest, and
130 @ -- the names of those files.
131 @ --
 
 
 
132 @ CREATE TABLE mlink(
133 @ mid INTEGER REFERENCES blob, -- Manifest ID where change occurs
134 @ pid INTEGER REFERENCES blob, -- File ID in parent manifest
135 @ fid INTEGER REFERENCES blob, -- Changed file ID in this manifest
136 @ fnid INTEGER REFERENCES filename -- Name of the file
137
--- src/schema.c
+++ src/schema.c
@@ -127,10 +127,13 @@
127 @ );
128 @
129 @ -- Linkages between manifests, files created by that manifest, and
130 @ -- the names of those files.
131 @ --
132 @ -- pid==0 if the file is added by check-in mid.
133 @ -- fid==0 if the file is removed by check-in mid.
134 @ --
135 @ CREATE TABLE mlink(
136 @ mid INTEGER REFERENCES blob, -- Manifest ID where change occurs
137 @ pid INTEGER REFERENCES blob, -- File ID in parent manifest
138 @ fid INTEGER REFERENCES blob, -- Changed file ID in this manifest
139 @ fnid INTEGER REFERENCES filename -- Name of the file
140
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -33,11 +33,11 @@
3333
*/
3434
void hyperlink_to_uuid(const char *zUuid){
3535
char zShortUuid[UUID_SIZE+1];
3636
sprintf(zShortUuid, "%.10s", zUuid);
3737
if( g.okHistory ){
38
- @ <a href="%s(g.zBaseURL)/vinfo/%s(zUuid)">[%s(zShortUuid)]</a>
38
+ @ <a href="%s(g.zBaseURL)/info/%s(zUuid)">[%s(zShortUuid)]</a>
3939
}else{
4040
@ <b>[%s(zShortUuid)]</b>
4141
}
4242
}
4343
4444
--- src/timeline.c
+++ src/timeline.c
@@ -33,11 +33,11 @@
33 */
34 void hyperlink_to_uuid(const char *zUuid){
35 char zShortUuid[UUID_SIZE+1];
36 sprintf(zShortUuid, "%.10s", zUuid);
37 if( g.okHistory ){
38 @ <a href="%s(g.zBaseURL)/vinfo/%s(zUuid)">[%s(zShortUuid)]</a>
39 }else{
40 @ <b>[%s(zShortUuid)]</b>
41 }
42 }
43
44
--- src/timeline.c
+++ src/timeline.c
@@ -33,11 +33,11 @@
33 */
34 void hyperlink_to_uuid(const char *zUuid){
35 char zShortUuid[UUID_SIZE+1];
36 sprintf(zShortUuid, "%.10s", zUuid);
37 if( g.okHistory ){
38 @ <a href="%s(g.zBaseURL)/info/%s(zUuid)">[%s(zShortUuid)]</a>
39 }else{
40 @ <b>[%s(zShortUuid)]</b>
41 }
42 }
43
44

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button