@@ -16,6 +16,7 @@ function WorkbookError(message) {
16
16
function readJSON ( originJsonData_jsonSaid , e ) {
17
17
let isOcaPackage = false ;
18
18
let extensions = null ;
19
+ let ocaPackageSaid = "" ;
19
20
20
21
try {
21
22
const textDecoder = new TextDecoder ( "utf-8" ) ;
@@ -27,6 +28,7 @@ function readJSON(originJsonData_jsonSaid, e) {
27
28
if ( rawJson . type && rawJson . type . includes ( "oca_package" ) ) {
28
29
isOcaPackage = true ;
29
30
extensions = rawJson . extensions ;
31
+ ocaPackageSaid = rawJson ?. d || "" ;
30
32
json = rawJson . oca_bundle . bundle ;
31
33
} else if ( rawJson . oca_bundle && rawJson . oca_bundle . bundle ) {
32
34
json = rawJson . oca_bundle . bundle ;
@@ -59,7 +61,7 @@ function readJSON(originJsonData_jsonSaid, e) {
59
61
throw new WorkbookError ( ".. Error in reading the json file ..." ) ;
60
62
}
61
63
// exports oca_bundle organized, if it is an oca-package, and the extensions
62
- return [ originJsonData_jsonSaid , isOcaPackage , extensions ] ;
64
+ return [ originJsonData_jsonSaid , isOcaPackage , extensions , ocaPackageSaid ] ;
63
65
}
64
66
65
67
async function readZIP ( originJsonData_jsonSaid , e ) {
@@ -70,12 +72,14 @@ async function readZIP(originJsonData_jsonSaid, e) {
70
72
const loadData = await file . async ( "text" ) ;
71
73
const parsedData = replaceAttributeCharsInJsonString ( loadData , true ) ;
72
74
originJsonData_jsonSaid . originJsonData . push ( parsedData ) ;
75
+ if ( parsedData . type && parsedData . type . includes ( "capture_base" ) ) {
76
+ originJsonData_jsonSaid . jsonSaid = parsedData . digest || "unavailable" ;
77
+ }
73
78
}
74
79
} catch ( error ) {
75
80
throw new WorkbookError ( ".. Error in reading the zip file ..." ) ;
76
81
}
77
82
78
- originJsonData_jsonSaid . jsonSaid = "unavailable" ;
79
83
// return originJsonData_jsonSaid;
80
84
return [ originJsonData_jsonSaid , false , null ] ;
81
85
}
@@ -105,9 +109,10 @@ export async function CreateDataEntryExcel(data, selectedLang) {
105
109
}
106
110
}
107
111
108
- const { originJsonData } = inPutJsonResult [ 0 ] ;
112
+ const { jsonSaid , originJsonData } = inPutJsonResult [ 0 ] ;
109
113
110
114
const isOcaPackage = inPutJsonResult [ 1 ] ;
115
+ const ocaPackageSaid = inPutJsonResult [ 3 ] ;
111
116
let attribute_ordering_container = null ;
112
117
let entry_code_ordering = null ;
113
118
@@ -309,7 +314,6 @@ export async function CreateDataEntryExcel(data, selectedLang) {
309
314
let schemaDescription = null ;
310
315
let schemaLanguage = null ;
311
316
let schemaClassification = null ;
312
- let schemaSAID = null ;
313
317
314
318
try {
315
319
schemaTitle = metaOverlays [ 0 ] . name ;
@@ -318,44 +322,72 @@ export async function CreateDataEntryExcel(data, selectedLang) {
318
322
schemaClassification = jsonData . find (
319
323
( o ) => o . type && o . type . includes ( "/capture_base/" )
320
324
) . classification ;
321
- schemaSAID = originJsonData [ 0 ] . jsonSaid ;
322
325
} catch ( error ) {
323
326
throw new WorkbookError ( ".. Error in reading the meta overlay ..." ) ;
324
327
}
325
328
326
329
// Step 5: Schema Description Sheet Content
327
- sheet1 . getCell ( 1 , 1 ) . value =
330
+ let introSectionCurrentRow = 1 ;
331
+ sheet1 . getCell ( introSectionCurrentRow , 1 ) . value =
328
332
"This is an Excel workbook for data display and data entry." ;
329
- formatFirstPage ( sheet1 . getCell ( 1 , 1 ) ) ;
333
+ formatFirstPage ( sheet1 . getCell ( introSectionCurrentRow , 1 ) ) ;
334
+ introSectionCurrentRow ++ ;
330
335
331
- sheet1 . getCell ( 2 , 2 ) . value =
336
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
332
337
"This workbook has been prefilled with information to help users use the data. The prefilled information comes from a schema." ;
333
- sheet1 . getCell ( 3 , 2 ) . value =
338
+ introSectionCurrentRow ++ ;
339
+
340
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
334
341
"Enter or view your data in 'Data' while referencing 'Schema Description' for guidance." ;
342
+ introSectionCurrentRow += 2 ;
343
+
344
+ sheet1 . getCell ( introSectionCurrentRow , 1 ) . value = "Schema details:" ;
345
+ formatFirstPage ( sheet1 . getCell ( introSectionCurrentRow , 1 ) ) ;
346
+ introSectionCurrentRow ++ ;
347
+
348
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value = `Schema title: ${ schemaTitle } ` ;
349
+ introSectionCurrentRow ++ ;
350
+
351
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
352
+ `Schema description: ${ schemaDescription } ` ;
353
+ introSectionCurrentRow ++ ;
335
354
336
- sheet1 . getCell ( 5 , 1 ) . value = " Schema details:" ;
337
- formatFirstPage ( sheet1 . getCell ( 5 , 1 ) ) ;
355
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value = ` Schema language: ${ schemaLanguage } ` ;
356
+ introSectionCurrentRow ++ ;
338
357
339
- sheet1 . getCell ( 6 , 2 ) . value = `Schema title: ${ schemaTitle } ` ;
340
- sheet1 . getCell ( 7 , 2 ) . value = `Schema description: ${ schemaDescription } ` ;
341
- sheet1 . getCell ( 8 , 2 ) . value = `Schema language: ${ schemaLanguage } ` ;
342
- sheet1 . getCell ( 9 , 2 ) . value = `Schema SAID: ${ schemaSAID } ` ;
343
- sheet1 . getCell ( 10 , 2 ) . value = `Schema classification: ${ schemaClassification } ` ;
358
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value = `Schema SAID: ${ jsonSaid } ` ;
359
+ introSectionCurrentRow ++ ;
344
360
345
- sheet1 . getCell ( 12 , 1 ) . value = "What is a schema?" ;
346
- formatFirstPage ( sheet1 . getCell ( 12 , 1 ) ) ;
361
+ if ( ocaPackageSaid ) {
362
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value = `Package SAID: ${ ocaPackageSaid } ` ;
363
+ introSectionCurrentRow ++ ;
364
+ }
365
+
366
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
367
+ `Schema classification: ${ schemaClassification } ` ;
368
+ introSectionCurrentRow += 2 ;
369
+
370
+ sheet1 . getCell ( introSectionCurrentRow , 1 ) . value = "What is a schema?" ;
371
+ formatFirstPage ( sheet1 . getCell ( introSectionCurrentRow , 1 ) ) ;
372
+ introSectionCurrentRow ++ ;
347
373
348
- sheet1 . getCell ( 13 , 2 ) . value = "A schema describes structures and rules of a dataset." ;
349
- sheet1 . getCell ( 14 , 2 ) . value =
374
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
375
+ "A schema describes structures and rules of a dataset." ;
376
+ introSectionCurrentRow ++ ;
377
+
378
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
350
379
"Learn more and write your own schema at https://semanticengine.org" ;
380
+ introSectionCurrentRow += 2 ;
381
+
382
+ sheet1 . getCell ( introSectionCurrentRow , 1 ) . value = "Schema Description:" ;
383
+ formatFirstPage ( sheet1 . getCell ( introSectionCurrentRow , 1 ) ) ;
384
+ introSectionCurrentRow ++ ;
351
385
352
- sheet1 . getCell ( 16 , 1 ) . value = "Schema Description:" ;
353
- formatFirstPage ( sheet1 . getCell ( 16 , 1 ) ) ;
354
- sheet1 . getCell ( 17 , 2 ) . value =
355
- "Here is a table describing of each of the attributes which you will find on the Data sheet. This information has been supplied by your schema." ;
386
+ sheet1 . getCell ( introSectionCurrentRow , 2 ) . value =
387
+ "Here is a table describing each of the attributes which you will find on the Data sheet. This information has been supplied by your schema." ;
356
388
357
389
// Step 6: Start the Workbook
358
- const shift = 17 ;
390
+ const shift = introSectionCurrentRow ;
359
391
360
392
try {
361
393
sheet1 . getColumn ( 1 ) . width = 17 ;
0 commit comments