Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 2978e43005ad40fdb3af7bbc0e5df9a87360bad7 |
|---|---|
| Date: | 2010-03-18 01:09:51 |
| User: | drh |
| Comment: | Show attachment in timelines. |
Tags And Properties
- bgcolor=#c0ffc0 inherited from [c3d7df650b]
- branch=experimental inherited from [c3d7df650b] branch timeline
- sym-experimental inherited from [c3d7df650b]
Changes
[hide diffs]Changes to src/manifest.c
@@ -196,11 +196,11 @@
}
if( blob_size(&a3)>0
&& (blob_size(&a3)!=UUID_SIZE || !validate16(zSrc, UUID_SIZE)) ){
goto manifest_syntax_error;
}
- p->zAttachName = file_tail(zName);
+ p->zAttachName = (char*)file_tail(zName);
p->zAttachSrc = zSrc;
p->zAttachTarget = zTarget;
break;
}
@@ -1133,10 +1133,31 @@
" WHERE target=%Q AND filename=%Q))"
" WHERE target=%Q AND filename=%Q",
m.zAttachTarget, m.zAttachName,
m.zAttachTarget, m.zAttachName
);
+ if( strlen(m.zAttachTarget)!=UUID_SIZE
+ || !validate16(m.zAttachTarget, UUID_SIZE)
+ ){
+ char *zTag = mprintf("wiki-%s", m.zAttachTarget);
+ char *zComment;
+ tag_findid(zTag, 1);
+ free(zTag);
+ if( m.zAttachSrc ){
+ zComment = mprintf("Add attachment \"%h\" to wiki page [%h]",
+ m.zAttachName, m.zAttachTarget);
+ }else{
+ zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]",
+ m.zAttachName, m.zAttachTarget);
+ }
+ db_multi_exec(
+ "REPLACE INTO event(type,mtime,objid,user,comment)"
+ "VALUES('w',%.17g,%d,%Q,%Q)",
+ m.rDate, rid, m.zUser, zComment
+ );
+ free(zComment);
+ }
}
db_end_transaction(0);
manifest_clear(&m);
return 1;
}
Changes to src/tkt.c
@@ -241,10 +241,40 @@
manifest_ticket_event(rid, &manifest, createFlag, tagid);
manifest_clear(&manifest);
createFlag = 0;
}
db_finalize(&q);
+
+ db_prepare(&q,
+ "SELECT attachid, mtime, src IS NULL, filename, user"
+ " FROM attachment"
+ " WHERE target=%Q",
+ zTktUuid
+ );
+ while( db_step(&q)==SQLITE_ROW ){
+ int attachid = db_column_int(&q, 0);
+ double mtime = db_column_double(&q, 1);
+ int isDelete = db_column_int(&q, 2);
+ const char *zFile = db_column_text(&q, 3);
+ const char *zUser = db_column_text(&q, 4);
+ char *zCom;
+
+ if( isDelete ){
+ zCom = mprintf("Delete attachment \"%h\" from ticket [%.10s] by user %h",
+ zFile, zTktUuid, zUser);
+ }else{
+ zCom = mprintf("Add attachment \"%h\" to ticket [%.10s] by user %h",
+ zFile, zTktUuid, zUser);
+ }
+ db_multi_exec(
+ "REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)"
+ "VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)",
+ tagid, mtime, attachid, zUser, zCom, zCom
+ );
+ free(zCom);
+ }
+ db_finalize(&q);
}
/*
** Create the subscript interpreter and load the "common" code.
*/
@@ -679,15 +709,18 @@
timeline_query_for_www(), zFullUuid, zFullUuid
);
}else{
zSQL = mprintf(
"%s AND event.objid IN "
- " (SELECT rid FROM tagxref WHERE tagid=%d UNION"
- " SELECT srcid FROM backlink WHERE target GLOB '%.4s*' "
- "AND '%s' GLOB (target||'*')) "
+ " (SELECT rid FROM tagxref WHERE tagid=%d"
+ " UNION SELECT srcid FROM backlink"
+ " WHERE target GLOB '%.4s*'"
+ " AND '%s' GLOB (target||'*')"
+ " UNION SELECT attachid FROM attachment"
+ " WHERE target=%Q) "
"ORDER BY mtime DESC",
- timeline_query_for_www(), tagid, zFullUuid, zFullUuid
+ timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid
);
}
db_prepare(&q, zSQL);
free(zSQL);
www_print_timeline(&q, TIMELINE_ARTID, 0);
Changes to src/wiki.c
@@ -570,13 +570,15 @@
style_header(zTitle);
free(zTitle);
zSQL = mprintf("%s AND event.objid IN "
" (SELECT rid FROM tagxref WHERE tagid="
- "(SELECT tagid FROM tag WHERE tagname='wiki-%q'))"
+ "(SELECT tagid FROM tag WHERE tagname='wiki-%q')"
+ " UNION SELECT attachid FROM attachment"
+ " WHERE target=%Q)"
"ORDER BY mtime DESC",
- timeline_query_for_www(), zPageName);
+ timeline_query_for_www(), zPageName, zPageName);
db_prepare(&q, zSQL);
free(zSQL);
zWikiPageName = zPageName;
www_print_timeline(&q, TIMELINE_ARTID, wiki_history_extra);
db_finalize(&q);