/* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code to implement the timeline web page ** */ #include "config.h" #include "timeline.h" /* ** Generate a hyperlink to a version. */ void hyperlink_to_uuid(const char *zUuid){ char zShortUuid[UUID_SIZE+1]; sprintf(zShortUuid, "%.10s", zUuid); if( g.okHistory ){ @ [%s(zShortUuid)] }else{ @ [%s(zShortUuid)] } } /* ** Generate a hyperlink to a diff between two versions. */ void hyperlink_to_diff(const char *zV1, const char *zV2){ if( g.okHistory ){ if( zV2==0 ){ @ [diff] }else{ @ [diff] } } } /* ** Output a timeline in the web format given a query. The query ** should return 4 columns: ** ** 0. UUID ** 1. Date/Time ** 2. Comment string ** 3. User */ void www_print_timeline(Stmt *pQuery, char *zLastDate){ char zPrevDate[20]; zPrevDate[0] = 0; @
@
| ||||
%s(&zDate[11]) | @@ | hyperlink_to_uuid(db_column_text(pQuery,0)); @ %h(db_column_text(pQuery,2)) (by %h(db_column_text(pQuery,3))) | if( zLastDate ){ strcpy(zLastDate, zDate); } } @
Note: You will be able to see much more timeline @ information if login.
} zSQL = mprintf( "SELECT uuid, datetime(event.mtime,'localtime'), comment, user" " FROM event, blob" " WHERE event.type='ci' AND blob.rid=event.objid" ); if( zStart ){ while( isspace(zStart[0]) ){ zStart++; } if( zStart[0] ){ zSQL = mprintf("%z AND event.mtime<=julianday(%Q, 'localtime')", zSQL, zStart); } } zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry); db_prepare(&q, zSQL); free(zSQL); zDate[0] = 0; www_print_timeline(&q, zDate); db_finalize(&q); if( zStart==0 ){ zStart = zDate; } @