Fossil

Check-in [6f93ca94]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Event background colors are now working.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: 6f93ca941811940e98f7caaabcc64bc95cbf1250
User & Date: drh 2010-10-02 12:37:55
Context
2010-10-02
16:35
Add hyperlinks for creating new events and the ability to browse through this history of changes for an event. Add the ability to show "details" of an event. check-in: ba06d344 user: drh tags: experimental
12:37
Event background colors are now working. check-in: 6f93ca94 user: drh tags: experimental
03:28
Add the ability to assign background colors to the timeline entries for events. check-in: a5110365 user: drh tags: experimental
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/event.c.

23
24
25
26
27
28
29
















30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46

47
48
49
50
51
52
53
..
64
65
66
67
68
69
70

71
72
73
74
75
76
77
..
79
80
81
82
83
84
85
86
87
88






89
90
91
92
93
94
95
**     Process checkpoints
**     Announcements
*/
#include <assert.h>
#include <ctype.h>
#include "config.h"
#include "event.h"

















/*
** WEBPAGE: event
** URL: /event?name=EVENTID
**
** Display an existing event identified by EVENTID
*/
void event_page(void){
  char *zTag;
  int rid = 0;

  const char *zEventId;
  char *zETime;
  Manifest m;
  Blob content;
  Blob fullbody;
  Blob title;
  Blob tail;



  /* wiki-read privilege is needed in order to read events.
  */
  login_check_credentials();
  if( !g.okRdWiki ){
    login_needed();
................................................................................
  free(zTag);
  if( rid==0 ){
    style_header("No Such Event");
    @ Unknown event: %h(zEventId)
    style_footer();
    return;
  }


  /* Extract the event content.
  */
  memset(&m, 0, sizeof(m));
  blob_zero(&m.content);
  content_get(rid, &content);
  manifest_parse(&m, &content);
................................................................................
    fossil_panic("Object #%d is not an event", rid);
  }
  zETime = db_text(0, "SELECT datetime(%.17g)", m.rEventDate);
  blob_init(&fullbody, m.zWiki, -1);
  if( wiki_find_title(&fullbody, &title, &tail) ){
    style_header(blob_str(&title));
  }else{
    style_header("Event %s", zEventId);
    tail = fullbody;
  }






  wiki_convert(&tail, 0, 0);
  style_footer();
}

/*
** WEBPAGE: eventedit
** URL: /eventedit?name=EVENTID







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|
|
>
|
|
<
|
|
|
|
>







 







>







 







|


>
>
>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
**     Process checkpoints
**     Announcements
*/
#include <assert.h>
#include <ctype.h>
#include "config.h"
#include "event.h"

/*
** Output a hyperlink to an event given its tagid.
*/
void hyperlink_to_event_tagid(int tagid){
  char *zEventId;

  zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
                     tagid);
  if( g.okHistory ){
    @ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%S(zEventId)</a>]
  }else{
    @ [%S(zEventId)]
  }
  free(zEventId);
}

/*
** WEBPAGE: event
** URL: /event?name=EVENTID
**
** Display an existing event identified by EVENTID
*/
void event_page(void){
  char *zTag;              /* The event-* tag for this event */
  int rid = 0;             /* rid of the event artifact */
  char *zUuid;             /* UUID corresponding to rid */
  const char *zEventId;    /* Event identifier */
  char *zETime;            /* Time of the event */

  Manifest m;              /* Parsed event artifact */
  Blob content;            /* Original event artifact content */
  Blob fullbody;           /* Complete content of the event body */
  Blob title;              /* Title extracted from the event body */
  Blob tail;               /* Event body that comes after the title */


  /* wiki-read privilege is needed in order to read events.
  */
  login_check_credentials();
  if( !g.okRdWiki ){
    login_needed();
................................................................................
  free(zTag);
  if( rid==0 ){
    style_header("No Such Event");
    @ Unknown event: %h(zEventId)
    style_footer();
    return;
  }
  zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);

  /* Extract the event content.
  */
  memset(&m, 0, sizeof(m));
  blob_zero(&m.content);
  content_get(rid, &content);
  manifest_parse(&m, &content);
................................................................................
    fossil_panic("Object #%d is not an event", rid);
  }
  zETime = db_text(0, "SELECT datetime(%.17g)", m.rEventDate);
  blob_init(&fullbody, m.zWiki, -1);
  if( wiki_find_title(&fullbody, &title, &tail) ){
    style_header(blob_str(&title));
  }else{
    style_header("Event %S", zEventId);
    tail = fullbody;
  }
  if( g.okWrWiki && g.okWrite ){
    style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
                          g.zTop, zEventId);
  }
  style_submenu_element("Raw", "Raw", "%s/artifact/%s", g.zTop, zUuid);

  wiki_convert(&tail, 0, 0);
  style_footer();
}

/*
** WEBPAGE: eventedit
** URL: /eventedit?name=EVENTID

Changes to src/info.c.

777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
...
798
799
800
801
802
803
804



805
806
807

808

809
810
811
812
813
814
815
    if( pDownloadName && blob_size(pDownloadName)==0 ){
      blob_appendf(pDownloadName, "%s.wiki", zPagename);
    }
  }
  db_finalize(&q);
  if( nWiki==0 ){
    db_prepare(&q,
      "SELECT datetime(mtime), user, comment, type, 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);
................................................................................
      }
      if( zType[0]=='w' ){
        @ Wiki edit
      }else if( zType[0]=='t' ){
        @ Ticket change
      }else if( zType[0]=='c' ){
        @ Manifest of check-in



      }else{
        @ Control file referencing
      }

      hyperlink_to_uuid(zUuid);

      @ - %w(zCom) by
      hyperlink_to_user(zUser,zDate," on");
      hyperlink_to_date(zDate, ".");
      if( pDownloadName && blob_size(pDownloadName)==0 ){
        blob_appendf(pDownloadName, "%.10s.txt", zUuid);
      }
      cnt++;







|







 







>
>
>



>
|
>







777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
...
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
    if( pDownloadName && blob_size(pDownloadName)==0 ){
      blob_appendf(pDownloadName, "%s.wiki", zPagename);
    }
  }
  db_finalize(&q);
  if( nWiki==0 ){
    db_prepare(&q,
      "SELECT datetime(mtime), user, comment, type, uuid, tagid"
      "  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);
................................................................................
      }
      if( zType[0]=='w' ){
        @ Wiki edit
      }else if( zType[0]=='t' ){
        @ Ticket change
      }else if( zType[0]=='c' ){
        @ Manifest of check-in
      }else if( zType[0]=='e' ){
        @ Instance of event
        hyperlink_to_event_tagid(db_column_int(&q, 5));
      }else{
        @ Control file referencing
      }
      if( zType[0]!='e' ){
        hyperlink_to_uuid(zUuid);
      }
      @ - %w(zCom) by
      hyperlink_to_user(zUser,zDate," on");
      hyperlink_to_date(zDate, ".");
      if( pDownloadName && blob_size(pDownloadName)==0 ){
        blob_appendf(pDownloadName, "%.10s.txt", zUuid);
      }
      cnt++;

Changes to src/manifest.c.

1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
      " ORDER BY mtime",
      tagid, m.rDate
    );
    if( subsequent ){
      content_deltify(rid, subsequent, 0);
    }else{
      db_multi_exec(
        "REPLACE INTO event(type,mtime,objid,tagid,user,comment,"
        "                  bgcolor,euser,ecomment)"
        "VALUES('e',%.17g,%d,%d,%Q,%Q,"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>1),"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
        m.rEventDate, rid, tagid, m.zUser, m.zComment, 
        TAG_BGCOLOR, rid,
        TAG_BGCOLOR, rid,
        TAG_USER, rid,
        TAG_COMMENT, rid
      );
    }
  }
  if( m.type==CFTYPE_TICKET ){
    char *zTag;

    assert( manifest_crosslink_busy==1 );







|
<

<
<


|
<
<
<







1192
1193
1194
1195
1196
1197
1198
1199

1200


1201
1202
1203



1204
1205
1206
1207
1208
1209
1210
      " ORDER BY mtime",
      tagid, m.rDate
    );
    if( subsequent ){
      content_deltify(rid, subsequent, 0);
    }else{
      db_multi_exec(
        "REPLACE INTO event(type,mtime,objid,tagid,user,comment,bgcolor)"

        "VALUES('e',%.17g,%d,%d,%Q,%Q,"


        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
        m.rEventDate, rid, tagid, m.zUser, m.zComment, 
        TAG_BGCOLOR, rid



      );
    }
  }
  if( m.type==CFTYPE_TICKET ){
    char *zTag;

    assert( manifest_crosslink_busy==1 );

Changes to src/timeline.c.

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
                      rid, TAG_CLOSED) ){
          @ <span class="timelineLeaf">Closed-Leaf:</span>
        }else{
          @ <span class="timelineLeaf">Leaf:</span>
        }
      }
    }else if( zType[0]=='e' && tagid ){
      char *zId = db_text(0,"SELECT tagname FROM tag WHERE tagid=%d", tagid);
      zId += 6;
      if( g.okHistory && g.okRdWiki ){
        @ [<a href="%s(g.zBaseURL)/event?name=%s(zId)">%S(zId)</a>]
      }else{
        @ [%S(zId)]
      }
    }else if( (tmFlags & TIMELINE_ARTID)!=0 ){
      hyperlink_to_uuid(zUuid);
    }
    db_column_blob(pQuery, commentColumn, &comment);
    if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){
      Blob truncated;
      blob_zero(&truncated);







|
<
<
<
<
<
<







287
288
289
290
291
292
293
294






295
296
297
298
299
300
301
                      rid, TAG_CLOSED) ){
          @ <span class="timelineLeaf">Closed-Leaf:</span>
        }else{
          @ <span class="timelineLeaf">Leaf:</span>
        }
      }
    }else if( zType[0]=='e' && tagid ){
      hyperlink_to_event_tagid(tagid);






    }else if( (tmFlags & TIMELINE_ARTID)!=0 ){
      hyperlink_to_uuid(zUuid);
    }
    db_column_blob(pQuery, commentColumn, &comment);
    if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){
      Blob truncated;
      blob_zero(&truncated);