Fossil

Check-in [e7857845]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:added a couple FIXME notes before bed.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | json
Files: files | file ages | folders
SHA1: e78578453878bd67602c19114ceb1e9911416c3c
User & Date: stephan 2011-09-20 22:55:59.906
Context
2011-09-21
14:42
refactored the prototype timeline code, split off completely from www version (different requirements). ... (check-in: 1ecf3374 user: stephan tags: json)
2011-09-20
22:55
added a couple FIXME notes before bed. ... (check-in: e7857845 user: stephan tags: json)
22:42
Started adding /json/timeline support, but this is gonna be a doozie. Breaking it down into separate calls for ci/wiki/ticket, e.g. /json/timeline/ci because the structures will be different for each. ... (check-in: eff3f7d9 user: stephan tags: json)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/json.c.
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422





1423
1424
1425
1426
1427
1428
1429
static cson_value * json_timeline_ci(unsigned int depth){
  cson_value * payV = NULL;
  cson_object * pay = NULL;
  cson_value * tmp = NULL;
  int limit = json_getenv_int("n",10);
  Stmt q;
  Blob sql = empty_blob;
  if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
    g.json.resultCode = FSL_JSON_E_DENIED;
    return NULL;
  }
  if( limit < 0 ) limit = 10;
  timeline_temp_table();






  blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1);
  blob_append(&sql, timeline_query_for_www(), -1);
  blob_append(&sql, "AND event.type IN('ci') ", -1);
  blob_append(&sql, "ORDER BY mtime DESC ", -1);
  if(limit){
    blob_appendf(&sql,"LIMIT %d ",limit);







|




|
>
>
>
>
>







1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
static cson_value * json_timeline_ci(unsigned int depth){
  cson_value * payV = NULL;
  cson_object * pay = NULL;
  cson_value * tmp = NULL;
  int limit = json_getenv_int("n",10);
  Stmt q;
  Blob sql = empty_blob;
  if( !g.perm.Read/* && !g.perm.RdTkt && !g.perm.RdWiki*/ ){
    g.json.resultCode = FSL_JSON_E_DENIED;
    return NULL;
  }
  if( limit < 0 ) limit = 10;
  timeline_temp_table() /* FIXME: we need a JSON-specific one or some
                           workarounds for timestamp and int-vs-bool
                           values in the HTML version. i'd prefer the
                           former, to avoid risking breaking HTML
                           mode.
                        */;

  blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1);
  blob_append(&sql, timeline_query_for_www(), -1);
  blob_append(&sql, "AND event.type IN('ci') ", -1);
  blob_append(&sql, "ORDER BY mtime DESC ", -1);
  if(limit){
    blob_appendf(&sql,"LIMIT %d ",limit);
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
  tmp = cson_value_new_string(blob_buffer(&sql),strlen(blob_buffer(&sql)));
  SET("timelineSql");
#endif

  blob_reset(&sql);
  blob_append(&sql, "SELECT rid AS rid,"
              " uuid AS uuid,"
              " timestamp AS timestamp,"
              " comment AS comment, "
              " user AS user,"
              " isleaf AS isLeaf,"
              " bgcolor AS bgColor,"
              " etype AS eventType,"
              " taglist AS tagList," /*FIXME: split this into
                                       a JSON array*/







|







1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
  tmp = cson_value_new_string(blob_buffer(&sql),strlen(blob_buffer(&sql)));
  SET("timelineSql");
#endif

  blob_reset(&sql);
  blob_append(&sql, "SELECT rid AS rid,"
              " uuid AS uuid,"
              " timestamp AS timestamp," /*FIXME: as epoch time*/
              " comment AS comment, "
              " user AS user,"
              " isleaf AS isLeaf,"
              " bgcolor AS bgColor,"
              " etype AS eventType,"
              " taglist AS tagList," /*FIXME: split this into
                                       a JSON array*/