@@ -1255,6 +1255,202 @@ func GetDownloadAdditions(opID string) []DownloadAddition {
1255
1255
// TabDefs creates a list definitions for embedded tab structs from the defMap parameter.
1256
1256
// overrides is updated with new override entries to allow tab definitions to generate.
1257
1257
func TabDefs (defMap map [string ]Definition , overrides map [string ]map [string ]string ) []Definition {
1258
+ // list of tab objects
1259
+ var tabObjects = []string {
1260
+ "approve" ,
1261
+ "checkbox" ,
1262
+ "company" ,
1263
+ "dateSigned" ,
1264
+ "date" ,
1265
+ "decline" ,
1266
+ "emailAddress" ,
1267
+ "email" ,
1268
+ "envelopeId" ,
1269
+ "firstName" ,
1270
+ "formulaTab" ,
1271
+ "fullName" ,
1272
+ "initialHere" ,
1273
+ "lastName" ,
1274
+ "list" ,
1275
+ "notarize" ,
1276
+ "note" ,
1277
+ "number" ,
1278
+ "radioGroup" ,
1279
+ "signerAttachment" ,
1280
+ "signHere" ,
1281
+ "ssn" ,
1282
+ "text" ,
1283
+ "tabGroup" ,
1284
+ "title" ,
1285
+ "view" ,
1286
+ "zip" ,
1287
+ }
1288
+
1289
+ // list of types of tabs
1290
+ tabDefs := map [string ]Definition {
1291
+ "Base" : {
1292
+ ID : "TabBase" ,
1293
+ Name : "TabBase" ,
1294
+ Type : "Object" ,
1295
+ Description : "contains common fields for all tabs" ,
1296
+ Summary : "contains common fields for all tabs" ,
1297
+ Category : "" ,
1298
+ },
1299
+ "Position" : {
1300
+ ID : "TabPosition" ,
1301
+ Name : "TabPosition" ,
1302
+ Type : "Object" ,
1303
+ Description : "contains common fields for all tabs that can position themselves on document" ,
1304
+ Summary : "contains common fields for all tabs that can position themselves on document" ,
1305
+ Category : "" ,
1306
+ },
1307
+ "Style" : {
1308
+ ID : "TabStyle" ,
1309
+ Name : "TabStyle" ,
1310
+ Type : "Object" ,
1311
+ Description : "contains common fields for all tabs that can set a display style" ,
1312
+ Summary : "contains common fields for all tabs that can set a display style" ,
1313
+ Category : "" ,
1314
+ },
1315
+ "Value" : {
1316
+ ID : "TabValue" ,
1317
+ Name : "TabValue" ,
1318
+ Type : "Object" ,
1319
+ Description : "add Value() func to tab" ,
1320
+ Summary : "add Value() func to tab" ,
1321
+ Category : "" ,
1322
+ },
1323
+ }
1324
+ // list of fields for each tab type
1325
+ tabFields := map [string ][]string {
1326
+ "Base" : {
1327
+ "conditionalParentLabel" ,
1328
+ "conditionalParentValue" ,
1329
+ "documentId" ,
1330
+ "recipientId" ,
1331
+ },
1332
+ "Position" : {
1333
+ "anchorCaseSensitive" ,
1334
+ "anchorHorizontalAlignment" ,
1335
+ "anchorIgnoreIfNotPresent" ,
1336
+ "anchorMatchWholeWord" ,
1337
+ "anchorString" ,
1338
+ "anchorUnits" ,
1339
+ "anchorXOffset" ,
1340
+ "anchorYOffset" ,
1341
+ "customTabId" ,
1342
+ "errorDetails" ,
1343
+ "mergeField" ,
1344
+ "pageNumber" ,
1345
+ "status" ,
1346
+ "tabId" ,
1347
+ "tabLabel" ,
1348
+ "tabOrder" ,
1349
+ "templateLocked" ,
1350
+ "templateRequired" ,
1351
+ "xPosition" ,
1352
+ "yPosition" ,
1353
+ },
1354
+ "Style" : {
1355
+ "bold" ,
1356
+ "boldMetadata" ,
1357
+ "font" ,
1358
+ "fontMetadata" ,
1359
+ "fontColor" ,
1360
+ "fontColorMetadata" ,
1361
+ "fontSize" ,
1362
+ "fontSizeMetadata" ,
1363
+ "italic" ,
1364
+ "italicMetadata" ,
1365
+ "name" ,
1366
+ "nameMetadata" ,
1367
+ "underline" ,
1368
+ "underlineMetadata" ,
1369
+ },
1370
+ "Value" : {
1371
+ "value" ,
1372
+ "valueMetadata" ,
1373
+ },
1374
+ }
1375
+ // loop thru each tab definition
1376
+ for _ , tabname := range tabObjects {
1377
+ dx := defMap ["#/definitions/" + tabname ]
1378
+ // create map of fields for easy lookup
1379
+ xmap := make (map [string ]bool )
1380
+ // NOTE: add tabLabel to notary and name to view.
1381
+ //This seems to be an error in swagger definition.
1382
+ // TODO: remove when fixed in swagger file
1383
+ if tabname == "notarize" {
1384
+ xmap ["tabLabel" ] = true
1385
+ }
1386
+ if tabname == "view" {
1387
+ xmap ["name" ] = true
1388
+ }
1389
+
1390
+ for _ , f := range dx .Fields {
1391
+ xmap [f .Name ] = true
1392
+ }
1393
+ // Get Overrides for this tab definition
1394
+ defOverrides , ok := overrides [dx .ID ]
1395
+ if ! ok {
1396
+ defOverrides = make (map [string ]string )
1397
+ overrides [dx .ID ] = defOverrides
1398
+ }
1399
+ memberOf := make ([]string , 0 ) // tab types for this tab
1400
+ // Loop thru each tab type
1401
+ for _ , nm := range []string {"Base" , "Position" , "Style" , "Value" } {
1402
+ // check for match by checking for existence of each field
1403
+ isType := true
1404
+ for _ , s := range tabFields [nm ] {
1405
+ if isType = xmap [s ]; ! isType {
1406
+ break
1407
+ }
1408
+ }
1409
+ // if match, mark override for each field
1410
+ if isType {
1411
+ for _ , f := range tabFields [nm ] {
1412
+ // Definition.StructFields() will know to skip
1413
+ // outputting this field for the type def
1414
+ defOverrides [f ] = "-"
1415
+ }
1416
+ memberOf = append (memberOf , "Tab" + nm )
1417
+ }
1418
+ }
1419
+ // create override. Definition.StructFields will know to output
1420
+ // these embedded types.
1421
+ if len (memberOf ) > 0 {
1422
+ defOverrides ["TABS" ] = strings .Join (memberOf , "," )
1423
+ }
1424
+ }
1425
+
1426
+ // Get field definitions for embedded types. Assume that
1427
+ // the Text tab meets all definitions so copy appropriate field
1428
+ // from its definition
1429
+ txtDef := defMap ["#/definitions/text" ]
1430
+ xmap := make (map [string ]Field )
1431
+ for _ , f := range txtDef .Fields {
1432
+ xmap [f .Name ] = f
1433
+
1434
+ }
1435
+ results := make ([]Definition , 0 )
1436
+ for _ , tabDefName := range []string {"Base" , "Position" , "Style" , "Value" } {
1437
+ ndef := tabDefs [tabDefName ]
1438
+ for _ , s := range tabFields [tabDefName ] {
1439
+ fx , ok := xmap [s ]
1440
+ if ok {
1441
+ ndef .Fields = append (ndef .Fields , fx )
1442
+ }
1443
+ }
1444
+ results = append (results , ndef )
1445
+
1446
+ }
1447
+ // return list of embedded tab definitions
1448
+ return results
1449
+ }
1450
+
1451
+ // V21TabDefs creates a list definitions for embedded tab structs from the defMap parameter.
1452
+ // overrides is updated with new override entries to allow tab definitions to generate.
1453
+ func V21TabDefs (defMap map [string ]Definition , overrides map [string ]map [string ]string ) []Definition {
1258
1454
// list of tab objects
1259
1455
var tabObjects = []string {
1260
1456
"approve" ,
@@ -1299,6 +1495,14 @@ func TabDefs(defMap map[string]Definition, overrides map[string]map[string]strin
1299
1495
Summary : "contains common fields for all tabs" ,
1300
1496
Category : "" ,
1301
1497
},
1498
+ "GuidedForm" : {
1499
+ ID : "TabGuidedForm" ,
1500
+ Name : "TabGuidedForm" ,
1501
+ Type : "Object" ,
1502
+ Description : "contains common fields for all text box tabs" ,
1503
+ Summary : "contains common fields for all text box tabs" ,
1504
+ Category : "" ,
1505
+ },
1302
1506
"Position" : {
1303
1507
ID : "TabPosition" ,
1304
1508
Name : "TabPosition" ,
@@ -1328,31 +1532,69 @@ func TabDefs(defMap map[string]Definition, overrides map[string]map[string]strin
1328
1532
tabFields := map [string ][]string {
1329
1533
"Base" : {
1330
1534
"conditionalParentLabel" ,
1535
+ "conditionalParentLabelMetadata" ,
1331
1536
"conditionalParentValue" ,
1537
+ "conditionalParentValueMetadata" ,
1332
1538
"documentId" ,
1539
+ "documentIdMetadata" ,
1333
1540
"recipientId" ,
1541
+ "recipientIdMetadata" ,
1542
+ "recipientIdGuid" ,
1543
+ "recipientIdGuidMetadata" ,
1544
+ "tabGroupLabels" ,
1545
+ "tabGroupLabelsMetadata" ,
1546
+ "tabType" ,
1547
+ "tabTypeMetadata" ,
1548
+ },
1549
+ "GuidedForm" : {
1550
+ "formOrder" ,
1551
+ "formOrderMetadata" ,
1552
+ "formPageLabel" ,
1553
+ "formPageLabelMetadata" ,
1554
+ "formPageNumber" ,
1555
+ "formPageNumberMetadata" ,
1334
1556
},
1335
1557
"Position" : {
1336
1558
"anchorCaseSensitive" ,
1559
+ "anchorCaseSensitiveMetadata" ,
1337
1560
"anchorHorizontalAlignment" ,
1561
+ "anchorHorizontalAlignmentMetadata" ,
1338
1562
"anchorIgnoreIfNotPresent" ,
1563
+ "anchorIgnoreIfNotPresentMetadata" ,
1339
1564
"anchorMatchWholeWord" ,
1565
+ "anchorMatchWholeWordMetadata" ,
1340
1566
"anchorString" ,
1567
+ "anchorStringMetadata" ,
1568
+ "anchorTabProcessorVersion" ,
1569
+ "anchorTabProcessorVersionMetadata" ,
1341
1570
"anchorUnits" ,
1571
+ "anchorUnitsMetadata" ,
1342
1572
"anchorXOffset" ,
1573
+ "anchorXOffsetMetadata" ,
1343
1574
"anchorYOffset" ,
1575
+ "anchorYOffsetMetadata" ,
1344
1576
"customTabId" ,
1577
+ "customTabIdMetadata" ,
1345
1578
"errorDetails" ,
1346
1579
"mergeField" ,
1347
1580
"pageNumber" ,
1581
+ "pageNumberMetadata" ,
1348
1582
"status" ,
1583
+ "statusMetadata" ,
1349
1584
"tabId" ,
1585
+ "tabIdMetadata" ,
1350
1586
"tabLabel" ,
1587
+ "tabLabelMetadata" ,
1351
1588
"tabOrder" ,
1589
+ "tabOrderMetadata" ,
1352
1590
"templateLocked" ,
1591
+ "templateLockedMetadata" ,
1353
1592
"templateRequired" ,
1593
+ "templateRequiredMetadata" ,
1354
1594
"xPosition" ,
1595
+ "xPositionMetadata" ,
1355
1596
"yPosition" ,
1597
+ "yPositionMetadata" ,
1356
1598
},
1357
1599
"Style" : {
1358
1600
"bold" ,
@@ -1381,6 +1623,10 @@ func TabDefs(defMap map[string]Definition, overrides map[string]map[string]strin
1381
1623
if tabname == "view" {
1382
1624
xmap ["name" ] = true
1383
1625
}
1626
+ if tabname == "radioGroup" {
1627
+ xmap ["tabGroupLabels" ] = true
1628
+ xmap ["tabGroupLabelsMetadata" ] = true
1629
+ }
1384
1630
1385
1631
for _ , f := range dx .Fields {
1386
1632
xmap [f .Name ] = true
@@ -1393,7 +1639,7 @@ func TabDefs(defMap map[string]Definition, overrides map[string]map[string]strin
1393
1639
}
1394
1640
memberOf := make ([]string , 0 ) // tab types for this tab
1395
1641
// Loop thru each tab type
1396
- for _ , nm := range []string {"Base" , "Position" , "Style" , "Value" } {
1642
+ for _ , nm := range []string {"Base" , "GuidedForm" , " Position" , "Style" , "Value" } {
1397
1643
// check for match by checking for existence of each field
1398
1644
isType := true
1399
1645
for _ , s := range tabFields [nm ] {
@@ -1428,7 +1674,7 @@ func TabDefs(defMap map[string]Definition, overrides map[string]map[string]strin
1428
1674
1429
1675
}
1430
1676
results := make ([]Definition , 0 )
1431
- for _ , tabDefName := range []string {"Base" , "Position" , "Style" , "Value" } {
1677
+ for _ , tabDefName := range []string {"Base" , "GuidedForm" , " Position" , "Style" , "Value" } {
1432
1678
ndef := tabDefs [tabDefName ]
1433
1679
for _ , s := range tabFields [tabDefName ] {
1434
1680
fx , ok := xmap [s ]
@@ -1479,6 +1725,9 @@ func GetTabValues(tabs Tabs) []NameValue {
1479
1725
for _, v := range tabs.TextTabs {
1480
1726
results = append(results, NameValue{Name: v.TabLabel, OriginalValue: v.OriginalValue, Value: v.Value})
1481
1727
}
1728
+ for _, v := range tabs.ZipTabs {
1729
+ results = append(results, NameValue{Name: v.TabLabel, OriginalValue: v.OriginalValue, Value: v.Value})
1730
+ }
1482
1731
return results
1483
1732
}
1484
1733
0 commit comments