Fossil

Diff
Login

Diff

Differences From Artifact [181182f225]:

To Artifact [c7415852fd]:


239
240
241
242
243
244
245






























246
247
248
249
250
251
252
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    manifest_parse(&manifest, &content);
    ticket_insert(&manifest, createFlag, rid);
    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.
*/
void ticket_init(void){
  const char *zConfig;
677
678
679
680
681
682
683
684
685
686






687
688

689
690
691
692
693
694
695
707
708
709
710
711
712
713



714
715
716
717
718
719
720

721
722
723
724
725
726
727
728







-
-
-
+
+
+
+
+
+

-
+







                                         "AND '%s' GLOB (target||'*')) "
         "ORDER BY mtime DESC",
         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);
  db_finalize(&q);
  style_footer();