Fossil

Check-in [27a4518e]
Login

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

Overview
Comment:Make it easier to use Events as quick notes: Display the title just above the text on Event pages. If there's no title in the wiki text, use the comment as a title.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | ben-minorchanges
Files: files | file ages | folders
SHA1:27a4518e13c41e6016757469dcae30d7baa54225
User & Date: ben 2011-09-07 08:12:27
Context
2011-09-07
08:12
Make it easier to use Events as quick notes: Display the title just above the text on Event pages. If there's no title in the wiki text, use the comment as a title. Leaf check-in: 27a4518e user: ben tags: ben-minorchanges
2011-09-06
13:23
Close A and LI tags when displaying new and deleted files in timeline. check-in: 8d703ff9 user: dmitry tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/event.c.

62
63
64
65
66
67
68

69
70

71
72
73
74
75
76
77
...
114
115
116
117
118
119
120

121
122

123
124
125
126
127
128
129
...
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
...
177
178
179
180
181
182
183
184

185
186

187
188
189
190




191
192
193
194
195
196
197
  char *zUuid;             /* UUID corresponding to rid */
  const char *zEventId;    /* Event identifier */
  char *zETime;            /* Time of the event */
  char *zATime;            /* Time the artifact was created */
  int specRid;             /* rid specified by aid= parameter */
  int prevRid, nextRid;    /* Previous or next edits of this event */
  Manifest *pEvent;        /* Parsed event artifact */

  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 */
  Stmt q1;                 /* Query to search for the event */
  int showDetail;          /* True to show details */


  /* wiki-read privilege is needed in order to read events.
  */
................................................................................

  /* Extract the event content.
  */
  pEvent = manifest_get(rid, CFTYPE_EVENT);
  if( pEvent==0 ){
    fossil_panic("Object #%d is not an event", rid);
  }

  blob_init(&fullbody, pEvent->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 && nextRid==0 ){
    style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
................................................................................
                            g.zTop, zEventId, zUuid);
    }
  }

  if( showDetail && g.okHistory ){
    int i;
    const char *zClr = 0;
    Blob comment;

    zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
    @ <p>Event [<a href="%s(g.zTop)/artifact/%s(zUuid)">%S(zUuid)</a>] at
    @ [<a href="%s(g.zTop)/timeline?c=%T(zETime)">%s(zETime)</a>]
    @ entered by user <b>%h(pEvent->zUser)</b> on
    @ [<a href="%s(g.zTop)/timeline?c=%T(zATime)">%s(zATime)</a>]:</p>
    @ <blockquote>
................................................................................
    }
    if( zClr && zClr[0]==0 ) zClr = 0;
    if( zClr ){
      @ <div style="background-color: %h(zClr);">
    }else{
      @ <div>
    }
    blob_init(&comment, pEvent->zComment, -1);

    wiki_convert(&comment, 0, WIKI_INLINE);
    blob_reset(&comment);

    @ </div>
    @ </blockquote><hr />
  }  





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

/*
** WEBPAGE: eventedit







>


>







 







>

|
>







 







<







 







|
>
|
<
>




>
>
>
>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
162
163
164
165
166
167
168

169
170
171
172
173
174
175
...
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
  char *zUuid;             /* UUID corresponding to rid */
  const char *zEventId;    /* Event identifier */
  char *zETime;            /* Time of the event */
  char *zATime;            /* Time the artifact was created */
  int specRid;             /* rid specified by aid= parameter */
  int prevRid, nextRid;    /* Previous or next edits of this event */
  Manifest *pEvent;        /* Parsed event artifact */
  Blob comment;            /* Comment shown in timeline */
  Blob fullbody;           /* Complete content of the event body */
  Blob title;              /* Title extracted from the event body */
  int haveTitle;           /* Whether a title was extracted */
  Blob tail;               /* Event body that comes after the title */
  Stmt q1;                 /* Query to search for the event */
  int showDetail;          /* True to show details */


  /* wiki-read privilege is needed in order to read events.
  */
................................................................................

  /* Extract the event content.
  */
  pEvent = manifest_get(rid, CFTYPE_EVENT);
  if( pEvent==0 ){
    fossil_panic("Object #%d is not an event", rid);
  }
  blob_init(&comment, pEvent->zComment, -1);
  blob_init(&fullbody, pEvent->zWiki, -1);
  haveTitle = wiki_find_title(&fullbody, &title, &tail);
  if( haveTitle ){
    style_header(blob_str(&title));
  }else{
    style_header("Event %S", zEventId);
    tail = fullbody;
  }
  if( g.okWrWiki && g.okWrite && nextRid==0 ){
    style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
................................................................................
                            g.zTop, zEventId, zUuid);
    }
  }

  if( showDetail && g.okHistory ){
    int i;
    const char *zClr = 0;


    zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
    @ <p>Event [<a href="%s(g.zTop)/artifact/%s(zUuid)">%S(zUuid)</a>] at
    @ [<a href="%s(g.zTop)/timeline?c=%T(zETime)">%s(zETime)</a>]
    @ entered by user <b>%h(pEvent->zUser)</b> on
    @ [<a href="%s(g.zTop)/timeline?c=%T(zATime)">%s(zATime)</a>]:</p>
    @ <blockquote>
................................................................................
    }
    if( zClr && zClr[0]==0 ) zClr = 0;
    if( zClr ){
      @ <div style="background-color: %h(zClr);">
    }else{
      @ <div>
    }
    if( haveTitle ){
      /* Don't display comment if it's used as the inline title below */
      wiki_convert(&comment, 0, WIKI_INLINE);

    }
    @ </div>
    @ </blockquote><hr />
  }  

  @ <h2>
  wiki_convert(haveTitle ? &title : &comment, 0, WIKI_INLINE);
  @ </h2>

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

/*
** WEBPAGE: eventedit