Fossil SCM

Cleaned up some JSON output using the new %jobs format.

stephan 2020-05-15 03:35 fileedit-ajaxify
Commit d9fffa4c58686fa563e35310d0bbad10a4c6a0e3f51d165843f4af40f8008bae
2 files changed +10 -10 +2 -2
+10 -10
--- src/fileedit.c
+++ src/fileedit.c
@@ -1059,11 +1059,11 @@
10591059
Blob content = empty_blob;
10601060
va_list vargs;
10611061
va_start(vargs,zFmt);
10621062
blob_vappendf(&msg, zFmt, vargs);
10631063
va_end(vargs);
1064
- blob_appendf(&content,"{\"error\":\"%j\"}", blob_str(&msg));
1064
+ blob_appendf(&content,"{\"error\":%!j}", blob_str(&msg));
10651065
blob_reset(&msg);
10661066
cgi_set_content(&content);
10671067
cgi_set_status(httpCode, "Error");
10681068
cgi_set_content_type("application/json");
10691069
}
@@ -1526,11 +1526,11 @@
15261526
int vid = 0;
15271527
if(0==fileedit_ajax_setup_filerev(zCi, &zCiFull, &vid, 0, 0)){
15281528
/* Error already reported */
15291529
return;
15301530
}
1531
- CX("{\"checkin\":\"%j\","
1531
+ CX("{\"checkin\":%!j,"
15321532
"\"editableFiles\":[", zCiFull);
15331533
blob_append_sql(&sql, "SELECT filename FROM files_of_checkin(%Q) "
15341534
"ORDER BY filename %s",
15351535
zCiFull, filename_collation());
15361536
db_prepare_blob(&q, &sql);
@@ -1538,11 +1538,11 @@
15381538
const char * zFilename = db_column_text(&q, 0);
15391539
if(fileedit_is_editable(zFilename)){
15401540
if(i++){
15411541
CX(",");
15421542
}
1543
- CX("\"%j\"", zFilename);
1543
+ CX("%!j", zFilename);
15441544
}
15451545
}
15461546
db_finalize(&q);
15471547
CX("]}");
15481548
}else if(P("leaves")!=0){
@@ -1558,13 +1558,13 @@
15581558
while( SQLITE_ROW==db_step(&q) ){
15591559
if(i++){
15601560
CX(",");
15611561
}
15621562
CX("{");
1563
- CX("\"checkin\":\"%j\",", db_column_text(&q, 1));
1564
- CX("\"timestamp\":\"%j\",", db_column_text(&q, 2));
1565
- CX("\"branch\":\"%j\"", db_column_text(&q, 7));
1563
+ CX("\"checkin\":%!j,", db_column_text(&q, 1));
1564
+ CX("\"timestamp\":%!j,", db_column_text(&q, 2));
1565
+ CX("\"branch\":%!j", db_column_text(&q, 7));
15661566
CX("}");
15671567
}
15681568
CX("]");
15691569
db_finalize(&q);
15701570
}else{
@@ -1631,14 +1631,14 @@
16311631
}
16321632
assert(newVid>0);
16331633
zNewUuid = rid_to_uuid(newVid);
16341634
cgi_set_content_type("application/json");
16351635
CX("{");
1636
- CX("\"uuid\":\"%j\",", zNewUuid);
1636
+ CX("\"uuid\":%!j,", zNewUuid);
16371637
CX("\"dryRun\": %s,",
16381638
(CIMINI_DRY_RUN & cimi.flags) ? "true" : "false");
1639
- CX("\"manifest\": \"%j\"", blob_str(&manifest));
1639
+ CX("\"manifest\": %!j", blob_str(&manifest));
16401640
CX("}");
16411641
db_end_transaction(0/*noting that dry-run mode will have already
16421642
** set this to rollback mode. */);
16431643
end_cleanup:
16441644
fossil_free(zNewUuid);
@@ -2053,17 +2053,17 @@
20532053
blob_appendf(&endScript,
20542054
"window.addEventListener('load',");
20552055
if(zRev && zFilename){
20562056
assert(0==blob_size(&err));
20572057
blob_appendf(&endScript,
2058
- "()=>fossil.page.loadFile(\"%j\",'%j')",
2058
+ "()=>fossil.page.loadFile(%!j,%!j)",
20592059
zFilename, cimi.zParentUuid);
20602060
}else{
20612061
blob_appendf(&endScript,"function(){");
20622062
if(blob_size(&err)>0){
20632063
blob_appendf(&endScript,
2064
- "fossil.error(\"%j\");\n",
2064
+ "fossil.error(%!j);\n",
20652065
blob_str(&err));
20662066
}
20672067
blob_appendf(&endScript,
20682068
"fossil.page.tabs.switchToTab(0);\n");
20692069
blob_appendf(&endScript,"}");
20702070
--- src/fileedit.c
+++ src/fileedit.c
@@ -1059,11 +1059,11 @@
1059 Blob content = empty_blob;
1060 va_list vargs;
1061 va_start(vargs,zFmt);
1062 blob_vappendf(&msg, zFmt, vargs);
1063 va_end(vargs);
1064 blob_appendf(&content,"{\"error\":\"%j\"}", blob_str(&msg));
1065 blob_reset(&msg);
1066 cgi_set_content(&content);
1067 cgi_set_status(httpCode, "Error");
1068 cgi_set_content_type("application/json");
1069 }
@@ -1526,11 +1526,11 @@
1526 int vid = 0;
1527 if(0==fileedit_ajax_setup_filerev(zCi, &zCiFull, &vid, 0, 0)){
1528 /* Error already reported */
1529 return;
1530 }
1531 CX("{\"checkin\":\"%j\","
1532 "\"editableFiles\":[", zCiFull);
1533 blob_append_sql(&sql, "SELECT filename FROM files_of_checkin(%Q) "
1534 "ORDER BY filename %s",
1535 zCiFull, filename_collation());
1536 db_prepare_blob(&q, &sql);
@@ -1538,11 +1538,11 @@
1538 const char * zFilename = db_column_text(&q, 0);
1539 if(fileedit_is_editable(zFilename)){
1540 if(i++){
1541 CX(",");
1542 }
1543 CX("\"%j\"", zFilename);
1544 }
1545 }
1546 db_finalize(&q);
1547 CX("]}");
1548 }else if(P("leaves")!=0){
@@ -1558,13 +1558,13 @@
1558 while( SQLITE_ROW==db_step(&q) ){
1559 if(i++){
1560 CX(",");
1561 }
1562 CX("{");
1563 CX("\"checkin\":\"%j\",", db_column_text(&q, 1));
1564 CX("\"timestamp\":\"%j\",", db_column_text(&q, 2));
1565 CX("\"branch\":\"%j\"", db_column_text(&q, 7));
1566 CX("}");
1567 }
1568 CX("]");
1569 db_finalize(&q);
1570 }else{
@@ -1631,14 +1631,14 @@
1631 }
1632 assert(newVid>0);
1633 zNewUuid = rid_to_uuid(newVid);
1634 cgi_set_content_type("application/json");
1635 CX("{");
1636 CX("\"uuid\":\"%j\",", zNewUuid);
1637 CX("\"dryRun\": %s,",
1638 (CIMINI_DRY_RUN & cimi.flags) ? "true" : "false");
1639 CX("\"manifest\": \"%j\"", blob_str(&manifest));
1640 CX("}");
1641 db_end_transaction(0/*noting that dry-run mode will have already
1642 ** set this to rollback mode. */);
1643 end_cleanup:
1644 fossil_free(zNewUuid);
@@ -2053,17 +2053,17 @@
2053 blob_appendf(&endScript,
2054 "window.addEventListener('load',");
2055 if(zRev && zFilename){
2056 assert(0==blob_size(&err));
2057 blob_appendf(&endScript,
2058 "()=>fossil.page.loadFile(\"%j\",'%j')",
2059 zFilename, cimi.zParentUuid);
2060 }else{
2061 blob_appendf(&endScript,"function(){");
2062 if(blob_size(&err)>0){
2063 blob_appendf(&endScript,
2064 "fossil.error(\"%j\");\n",
2065 blob_str(&err));
2066 }
2067 blob_appendf(&endScript,
2068 "fossil.page.tabs.switchToTab(0);\n");
2069 blob_appendf(&endScript,"}");
2070
--- src/fileedit.c
+++ src/fileedit.c
@@ -1059,11 +1059,11 @@
1059 Blob content = empty_blob;
1060 va_list vargs;
1061 va_start(vargs,zFmt);
1062 blob_vappendf(&msg, zFmt, vargs);
1063 va_end(vargs);
1064 blob_appendf(&content,"{\"error\":%!j}", blob_str(&msg));
1065 blob_reset(&msg);
1066 cgi_set_content(&content);
1067 cgi_set_status(httpCode, "Error");
1068 cgi_set_content_type("application/json");
1069 }
@@ -1526,11 +1526,11 @@
1526 int vid = 0;
1527 if(0==fileedit_ajax_setup_filerev(zCi, &zCiFull, &vid, 0, 0)){
1528 /* Error already reported */
1529 return;
1530 }
1531 CX("{\"checkin\":%!j,"
1532 "\"editableFiles\":[", zCiFull);
1533 blob_append_sql(&sql, "SELECT filename FROM files_of_checkin(%Q) "
1534 "ORDER BY filename %s",
1535 zCiFull, filename_collation());
1536 db_prepare_blob(&q, &sql);
@@ -1538,11 +1538,11 @@
1538 const char * zFilename = db_column_text(&q, 0);
1539 if(fileedit_is_editable(zFilename)){
1540 if(i++){
1541 CX(",");
1542 }
1543 CX("%!j", zFilename);
1544 }
1545 }
1546 db_finalize(&q);
1547 CX("]}");
1548 }else if(P("leaves")!=0){
@@ -1558,13 +1558,13 @@
1558 while( SQLITE_ROW==db_step(&q) ){
1559 if(i++){
1560 CX(",");
1561 }
1562 CX("{");
1563 CX("\"checkin\":%!j,", db_column_text(&q, 1));
1564 CX("\"timestamp\":%!j,", db_column_text(&q, 2));
1565 CX("\"branch\":%!j", db_column_text(&q, 7));
1566 CX("}");
1567 }
1568 CX("]");
1569 db_finalize(&q);
1570 }else{
@@ -1631,14 +1631,14 @@
1631 }
1632 assert(newVid>0);
1633 zNewUuid = rid_to_uuid(newVid);
1634 cgi_set_content_type("application/json");
1635 CX("{");
1636 CX("\"uuid\":%!j,", zNewUuid);
1637 CX("\"dryRun\": %s,",
1638 (CIMINI_DRY_RUN & cimi.flags) ? "true" : "false");
1639 CX("\"manifest\": %!j", blob_str(&manifest));
1640 CX("}");
1641 db_end_transaction(0/*noting that dry-run mode will have already
1642 ** set this to rollback mode. */);
1643 end_cleanup:
1644 fossil_free(zNewUuid);
@@ -2053,17 +2053,17 @@
2053 blob_appendf(&endScript,
2054 "window.addEventListener('load',");
2055 if(zRev && zFilename){
2056 assert(0==blob_size(&err));
2057 blob_appendf(&endScript,
2058 "()=>fossil.page.loadFile(%!j,%!j)",
2059 zFilename, cimi.zParentUuid);
2060 }else{
2061 blob_appendf(&endScript,"function(){");
2062 if(blob_size(&err)>0){
2063 blob_appendf(&endScript,
2064 "fossil.error(%!j);\n",
2065 blob_str(&err));
2066 }
2067 blob_appendf(&endScript,
2068 "fossil.page.tabs.switchToTab(0);\n");
2069 blob_appendf(&endScript,"}");
2070
+2 -2
--- src/style.c
+++ src/style.c
@@ -1529,14 +1529,14 @@
15291529
/* Set up the generic/app-agnostic parts of window.fossil
15301530
** which require C-level state... */
15311531
style_emit_script_tag(0,0);
15321532
CX("(function(){\n"
15331533
"if(!window.fossil) window.fossil={};\n"
1534
- "window.fossil.version = \"%j\";\n"
1534
+ "window.fossil.version = %!j;\n"
15351535
/* fossil.rootPath is the top-most CGI/server path,
15361536
** including a trailing slash. */
1537
- "window.fossil.rootPath = \"%j\"+'/';\n",
1537
+ "window.fossil.rootPath = %!j+'/';\n",
15381538
get_version(), g.zTop);
15391539
/* fossil.config = {...various config-level options...} */
15401540
CX("window.fossil.config = {"
15411541
"hashDigits: %d, hashDigitsUrl: %d"
15421542
"};\n", hash_digits(0), hash_digits(1));
15431543
--- src/style.c
+++ src/style.c
@@ -1529,14 +1529,14 @@
1529 /* Set up the generic/app-agnostic parts of window.fossil
1530 ** which require C-level state... */
1531 style_emit_script_tag(0,0);
1532 CX("(function(){\n"
1533 "if(!window.fossil) window.fossil={};\n"
1534 "window.fossil.version = \"%j\";\n"
1535 /* fossil.rootPath is the top-most CGI/server path,
1536 ** including a trailing slash. */
1537 "window.fossil.rootPath = \"%j\"+'/';\n",
1538 get_version(), g.zTop);
1539 /* fossil.config = {...various config-level options...} */
1540 CX("window.fossil.config = {"
1541 "hashDigits: %d, hashDigitsUrl: %d"
1542 "};\n", hash_digits(0), hash_digits(1));
1543
--- src/style.c
+++ src/style.c
@@ -1529,14 +1529,14 @@
1529 /* Set up the generic/app-agnostic parts of window.fossil
1530 ** which require C-level state... */
1531 style_emit_script_tag(0,0);
1532 CX("(function(){\n"
1533 "if(!window.fossil) window.fossil={};\n"
1534 "window.fossil.version = %!j;\n"
1535 /* fossil.rootPath is the top-most CGI/server path,
1536 ** including a trailing slash. */
1537 "window.fossil.rootPath = %!j+'/';\n",
1538 get_version(), g.zTop);
1539 /* fossil.config = {...various config-level options...} */
1540 CX("window.fossil.config = {"
1541 "hashDigits: %d, hashDigitsUrl: %d"
1542 "};\n", hash_digits(0), hash_digits(1));
1543

Keyboard Shortcuts

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