Fossil

Diff
Login

Differences From Artifact [f9052a7595]:

To Artifact [6b4d37a073]:


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
**     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();







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








|
|
>
|
|
|
|
|
|
|







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
**     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();
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
  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);
  if( m.type!=CFTYPE_EVENT ){
    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







>















|


>
>
>
>
>
>







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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
  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);
  if( m.type!=CFTYPE_EVENT ){
    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