| | @@ -51,34 +51,25 @@ |
| 51 | 51 | @ <a href="%s(g.zBaseURL)/diff?v1=%s(zV1)&v2=%s(zV2)">[diff]</a> |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | | - |
| 57 | 56 | /* |
| 58 | | -** WEBPAGE: timeline |
| 59 | | -*/ |
| 60 | | -void page_timeline(void){ |
| 61 | | - Stmt q; |
| 62 | | - char zPrevDate[20]; |
| 63 | | - |
| 64 | | - /* To view the timeline, must have permission to read project data. |
| 65 | | - */ |
| 66 | | - login_check_credentials(); |
| 67 | | - if( !g.okRead ){ login_needed(); return; } |
| 68 | | - |
| 69 | | - style_header("Timeline"); |
| 57 | +** Output a timeline in the web format given a query. The query |
| 58 | +** should return 4 columns: |
| 59 | +** |
| 60 | +** 0. UUID |
| 61 | +** 1. Date/Time |
| 62 | +** 2. Comment string |
| 63 | +** 3. User |
| 64 | +*/ |
| 65 | +void www_print_timeline(Stmt *pQuery){ |
| 66 | + char zPrevDate[20]; |
| 70 | 67 | zPrevDate[0] = 0; |
| 71 | | - db_prepare(&q, |
| 72 | | - "SELECT uuid, datetime(event.mtime,'localtime'), comment, user" |
| 73 | | - " FROM event, blob" |
| 74 | | - " WHERE event.type='ci' AND blob.rid=event.objid" |
| 75 | | - " ORDER BY event.mtime DESC" |
| 76 | | - ); |
| 77 | 68 | @ <table cellspacing=0 border=0 cellpadding=0> |
| 78 | | - while( db_step(&q)==SQLITE_ROW ){ |
| 79 | | - const char *zDate = db_column_text(&q, 1); |
| 69 | + while( db_step(pQuery)==SQLITE_ROW ){ |
| 70 | + const char *zDate = db_column_text(pQuery, 1); |
| 80 | 71 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 81 | 72 | sprintf(zPrevDate, "%.10s", zDate); |
| 82 | 73 | @ <tr><td colspan=3> |
| 83 | 74 | @ <table cellpadding=2 border=0> |
| 84 | 75 | @ <tr><td bgcolor="#a0b5f4" class="border1"> |
| | @@ -89,15 +80,38 @@ |
| 89 | 80 | @ </td></tr> |
| 90 | 81 | } |
| 91 | 82 | @ <tr><td valign="top">%s(&zDate[11])</td> |
| 92 | 83 | @ <td width="20"></td> |
| 93 | 84 | @ <td valign="top" align="left"> |
| 94 | | - hyperlink_to_uuid(db_column_text(&q,0)); |
| 95 | | - @ %h(db_column_text(&q,2)) (by %h(db_column_text(&q,3)))</td> |
| 85 | + hyperlink_to_uuid(db_column_text(pQuery,0)); |
| 86 | + @ %h(db_column_text(pQuery,2)) (by %h(db_column_text(pQuery,3)))</td> |
| 96 | 87 | } |
| 97 | | - db_finalize(&q); |
| 98 | 88 | @ </table> |
| 89 | +} |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +/* |
| 94 | +** WEBPAGE: timeline |
| 95 | +*/ |
| 96 | +void page_timeline(void){ |
| 97 | + Stmt q; |
| 98 | + |
| 99 | + /* To view the timeline, must have permission to read project data. |
| 100 | + */ |
| 101 | + login_check_credentials(); |
| 102 | + if( !g.okRead ){ login_needed(); return; } |
| 103 | + |
| 104 | + style_header("Timeline"); |
| 105 | + db_prepare(&q, |
| 106 | + "SELECT uuid, datetime(event.mtime,'localtime'), comment, user" |
| 107 | + " FROM event, blob" |
| 108 | + " WHERE event.type='ci' AND blob.rid=event.objid" |
| 109 | + " ORDER BY event.mtime DESC" |
| 110 | + ); |
| 111 | + www_print_timeline(&q); |
| 112 | + db_finalize(&q); |
| 99 | 113 | style_footer(); |
| 100 | 114 | } |
| 101 | 115 | /* |
| 102 | 116 | ** The input query q selects various records. Print a human-readable |
| 103 | 117 | ** summary of those records. |
| 104 | 118 | |