Check-in [2978e43005]
Not logged in

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
Changes

Changes to src/manifest.c

194 && !wiki_name_is_wellformed((const unsigned char *)zTarget) ){ 194 && !wiki_name_is_wellformed((const unsigned char *)zTarget) ){ 195 goto manifest_syntax_error; 195 goto manifest_syntax_error; 196 } 196 } 197 if( blob_size(&a3)>0 197 if( blob_size(&a3)>0 198 && (blob_size(&a3)!=UUID_SIZE || !validate16(zSrc, UUID_SIZE)) ){ 198 && (blob_size(&a3)!=UUID_SIZE || !validate16(zSrc, UUID_SIZE)) ){ 199 goto manifest_syntax_error; 199 goto manifest_syntax_error; 200 } 200 } 201 p->zAttachName = file_tail(zName); | 201 p->zAttachName = (char*)file_tail(zName); 202 p->zAttachSrc = zSrc; 202 p->zAttachSrc = zSrc; 203 p->zAttachTarget = zTarget; 203 p->zAttachTarget = zTarget; 204 break; 204 break; 205 } 205 } 206 206 207 /* 207 /* 208 ** C <comment> 208 ** C <comment> ................................................................................................................................................................................ 1131 "UPDATE attachment SET isLatest = (mtime==" 1131 "UPDATE attachment SET isLatest = (mtime==" 1132 "(SELECT max(mtime) FROM attachment" 1132 "(SELECT max(mtime) FROM attachment" 1133 " WHERE target=%Q AND filename=%Q))" 1133 " WHERE target=%Q AND filename=%Q))" 1134 " WHERE target=%Q AND filename=%Q", 1134 " WHERE target=%Q AND filename=%Q", 1135 m.zAttachTarget, m.zAttachName, 1135 m.zAttachTarget, m.zAttachName, 1136 m.zAttachTarget, m.zAttachName 1136 m.zAttachTarget, m.zAttachName 1137 ); 1137 ); > 1138 if( strlen(m.zAttachTarget)!=UUID_SIZE > 1139 || !validate16(m.zAttachTarget, UUID_SIZE) > 1140 ){ > 1141 char *zTag = mprintf("wiki-%s", m.zAttachTarget); > 1142 char *zComment; > 1143 tag_findid(zTag, 1); > 1144 free(zTag); > 1145 if( m.zAttachSrc ){ > 1146 zComment = mprintf("Add attachment \"%h\" to wiki page [%h]", > 1147 m.zAttachName, m.zAttachTarget); > 1148 }else{ > 1149 zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]", > 1150 m.zAttachName, m.zAttachTarget); > 1151 } > 1152 db_multi_exec( > 1153 "REPLACE INTO event(type,mtime,objid,user,comment)" > 1154 "VALUES('w',%.17g,%d,%Q,%Q)", > 1155 m.rDate, rid, m.zUser, zComment > 1156 ); > 1157 free(zComment); > 1158 } 1138 } 1159 } 1139 db_end_transaction(0); 1160 db_end_transaction(0); 1140 manifest_clear(&m); 1161 manifest_clear(&m); 1141 return 1; 1162 return 1; 1142 } 1163 }

Changes to src/tkt.c

239 manifest_parse(&manifest, &content); 239 manifest_parse(&manifest, &content); 240 ticket_insert(&manifest, createFlag, rid); 240 ticket_insert(&manifest, createFlag, rid); 241 manifest_ticket_event(rid, &manifest, createFlag, tagid); 241 manifest_ticket_event(rid, &manifest, createFlag, tagid); 242 manifest_clear(&manifest); 242 manifest_clear(&manifest); 243 createFlag = 0; 243 createFlag = 0; 244 } 244 } 245 db_finalize(&q); 245 db_finalize(&q); > 246 > 247 db_prepare(&q, > 248 "SELECT attachid, mtime, src IS NULL, filename, user" > 249 " FROM attachment" > 250 " WHERE target=%Q", > 251 zTktUuid > 252 ); > 253 while( db_step(&q)==SQLITE_ROW ){ > 254 int attachid = db_column_int(&q, 0); > 255 double mtime = db_column_double(&q, 1); > 256 int isDelete = db_column_int(&q, 2); > 257 const char *zFile = db_column_text(&q, 3); > 258 const char *zUser = db_column_text(&q, 4); > 259 char *zCom; > 260 > 261 if( isDelete ){ > 262 zCom = mprintf("Delete attachment \"%h\" from ticket [%.10s] by user %h", > 263 zFile, zTktUuid, zUser); > 264 }else{ > 265 zCom = mprintf("Add attachment \"%h\" to ticket [%.10s] by user %h", > 266 zFile, zTktUuid, zUser); > 267 } > 268 db_multi_exec( > 269 "REPLACE INTO event(type,tagid,mtime,objid,user,comment,brief)" > 270 "VALUES('t',%d,%.17g,%d,%Q,%Q,%Q)", > 271 tagid, mtime, attachid, zUser, zCom, zCom > 272 ); > 273 free(zCom); > 274 } > 275 db_finalize(&q); 246 } 276 } 247 277 248 /* 278 /* 249 ** Create the subscript interpreter and load the "common" code. 279 ** Create the subscript interpreter and load the "common" code. 250 */ 280 */ 251 void ticket_init(void){ 281 void ticket_init(void){ 252 const char *zConfig; 282 const char *zConfig; ................................................................................................................................................................................ 677 "AND '%s' GLOB (target||'*')) " 707 "AND '%s' GLOB (target||'*')) " 678 "ORDER BY mtime DESC", 708 "ORDER BY mtime DESC", 679 timeline_query_for_www(), zFullUuid, zFullUuid 709 timeline_query_for_www(), zFullUuid, zFullUuid 680 ); 710 ); 681 }else{ 711 }else{ 682 zSQL = mprintf( 712 zSQL = mprintf( 683 "%s AND event.objid IN " 713 "%s AND event.objid IN " 684 " (SELECT rid FROM tagxref WHERE tagid=%d UNION" | 714 " (SELECT rid FROM tagxref WHERE tagid=%d" > 715 " UNION SELECT srcid FROM backlink" 685 " SELECT srcid FROM backlink WHERE target GLOB '%.4s*' " | 716 " WHERE target GLOB '%.4s*'" 686 "AND '%s' GLOB (target||'*')) " | 717 " AND '%s' GLOB (target||'*')" > 718 " UNION SELECT attachid FROM attachment" > 719 " WHERE target=%Q) " 687 "ORDER BY mtime DESC", 720 "ORDER BY mtime DESC", 688 timeline_query_for_www(), tagid, zFullUuid, zFullUuid | 721 timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid 689 ); 722 ); 690 } 723 } 691 db_prepare(&q, zSQL); 724 db_prepare(&q, zSQL); 692 free(zSQL); 725 free(zSQL); 693 www_print_timeline(&q, TIMELINE_ARTID, 0); 726 www_print_timeline(&q, TIMELINE_ARTID, 0); 694 db_finalize(&q); 727 db_finalize(&q); 695 style_footer(); 728 style_footer();

Changes to src/wiki.c

568 zPageName = PD("name",""); 568 zPageName = PD("name",""); 569 zTitle = mprintf("History Of %s", zPageName); 569 zTitle = mprintf("History Of %s", zPageName); 570 style_header(zTitle); 570 style_header(zTitle); 571 free(zTitle); 571 free(zTitle); 572 572 573 zSQL = mprintf("%s AND event.objid IN " 573 zSQL = mprintf("%s AND event.objid IN " 574 " (SELECT rid FROM tagxref WHERE tagid=" 574 " (SELECT rid FROM tagxref WHERE tagid=" 575 "(SELECT tagid FROM tag WHERE tagname='wiki-%q'))" | 575 "(SELECT tagid FROM tag WHERE tagname='wiki-%q')" > 576 " UNION SELECT attachid FROM attachment" > 577 " WHERE target=%Q)" 576 "ORDER BY mtime DESC", 578 "ORDER BY mtime DESC", 577 timeline_query_for_www(), zPageName); | 579 timeline_query_for_www(), zPageName, zPageName); 578 db_prepare(&q, zSQL); 580 db_prepare(&q, zSQL); 579 free(zSQL); 581 free(zSQL); 580 zWikiPageName = zPageName; 582 zWikiPageName = zPageName; 581 www_print_timeline(&q, TIMELINE_ARTID, wiki_history_extra); 583 www_print_timeline(&q, TIMELINE_ARTID, wiki_history_extra); 582 db_finalize(&q); 584 db_finalize(&q); 583 style_footer(); 585 style_footer(); 584 } 586 }