Fossil SCM

Added downloadPath property to files in timeline view, leading to /raw/FILENAME?name=uuid.

stephan 2011-10-13 17:10 UTC json-multitag-test
Commit ea5e58155d745a80f39495a8e1334559330cb4bc
1 file changed +8 -1
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -320,14 +320,16 @@
320320
while( (SQLITE_ROW == db_step(&q)) ){
321321
cson_value * rowV = cson_value_new_object();
322322
cson_object * row = cson_value_get_object(rowV);
323323
int const isNew = db_column_int(&q,0);
324324
int const isDel = db_column_int(&q,1);
325
+ char * zDownload = NULL;
325326
if(!rowsV){
326327
rowsV = cson_value_new_array();
327328
rows = cson_value_get_array(rowsV);
328329
}
330
+ cson_array_append( rows, rowV );
329331
cson_object_set(row, "name", json_new_string(db_column_text(&q,2)));
330332
cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3)));
331333
if(!isNew){
332334
cson_object_set(row, "prevUuid", json_new_string(db_column_text(&q,4)));
333335
}
@@ -335,11 +337,16 @@
335337
json_new_string(isNew
336338
? "added"
337339
: (isDel
338340
? "removed"
339341
: "modified")));
340
- cson_array_append( rows, rowV );
342
+ zDownload = mprintf("/raw/%s?name=%s",
343
+ /* reminder: g.zBaseURL is of course not set for CLI mode. */
344
+ db_column_text(&q,2),
345
+ db_column_text(&q,3));
346
+ cson_object_set(row, "downloadPath", json_new_string(zDownload));
347
+ free(zDownload);
341348
}
342349
db_finalize(&q);
343350
return rowsV;
344351
}
345352
346353
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -320,14 +320,16 @@
320 while( (SQLITE_ROW == db_step(&q)) ){
321 cson_value * rowV = cson_value_new_object();
322 cson_object * row = cson_value_get_object(rowV);
323 int const isNew = db_column_int(&q,0);
324 int const isDel = db_column_int(&q,1);
 
325 if(!rowsV){
326 rowsV = cson_value_new_array();
327 rows = cson_value_get_array(rowsV);
328 }
 
329 cson_object_set(row, "name", json_new_string(db_column_text(&q,2)));
330 cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3)));
331 if(!isNew){
332 cson_object_set(row, "prevUuid", json_new_string(db_column_text(&q,4)));
333 }
@@ -335,11 +337,16 @@
335 json_new_string(isNew
336 ? "added"
337 : (isDel
338 ? "removed"
339 : "modified")));
340 cson_array_append( rows, rowV );
 
 
 
 
 
341 }
342 db_finalize(&q);
343 return rowsV;
344 }
345
346
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -320,14 +320,16 @@
320 while( (SQLITE_ROW == db_step(&q)) ){
321 cson_value * rowV = cson_value_new_object();
322 cson_object * row = cson_value_get_object(rowV);
323 int const isNew = db_column_int(&q,0);
324 int const isDel = db_column_int(&q,1);
325 char * zDownload = NULL;
326 if(!rowsV){
327 rowsV = cson_value_new_array();
328 rows = cson_value_get_array(rowsV);
329 }
330 cson_array_append( rows, rowV );
331 cson_object_set(row, "name", json_new_string(db_column_text(&q,2)));
332 cson_object_set(row, "uuid", json_new_string(db_column_text(&q,3)));
333 if(!isNew){
334 cson_object_set(row, "prevUuid", json_new_string(db_column_text(&q,4)));
335 }
@@ -335,11 +337,16 @@
337 json_new_string(isNew
338 ? "added"
339 : (isDel
340 ? "removed"
341 : "modified")));
342 zDownload = mprintf("/raw/%s?name=%s",
343 /* reminder: g.zBaseURL is of course not set for CLI mode. */
344 db_column_text(&q,2),
345 db_column_text(&q,3));
346 cson_object_set(row, "downloadPath", json_new_string(zDownload));
347 free(zDownload);
348 }
349 db_finalize(&q);
350 return rowsV;
351 }
352
353

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button