-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
137 lines (104 loc) · 5.34 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>IBM ISO SWID 19770-2 online generator</title>
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script type="text/javascript">
String.prototype.format = function()
{
var content = this;
for (var i=0; i < arguments.length; i++)
{
var replacement = '{' + i + '}';
content = content.replace(replacement, arguments[i]);
}
return content;
};
window.onload=function(){
new ClipboardJS('.btn');
$("input").on("input", function() {
var name = $('#swname').val();
var version = $('#version').val();
var tagCreator = $('#tagCreator').val();
var regid = $('#regid').val();
var licensor = $('#licensor').val();
var licensor_regid = $('#licensor_regid').val();
var optionals = "";
if (licensor != "") {
optionals = " <Entity name=\"" + licensor + "\" regid=\"" + licensor_regid + "\" role=\"licensor\" /> \n";
}
var softwareCreator = $('#softwareCreator').val();
var softwareCreator_regid = $('#softwareCreator_regid').val();
var softwareCreatorStr = "";
if (softwareCreator != "") {
softwareCreatorStr = " <Entity name=\"" + softwareCreator + "\" regid=\"" + softwareCreator_regid + "\" role=\"softwareCreator\" /> \n";
}
optionals += softwareCreatorStr;
$("#output").text("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
"<SoftwareIdentity xml:lang=\"EN\" name=\"" + name + "\" version=\"" + version + "\" \n versionScheme=\"multipartnumeric\" \n tagId=\"swidgen-" + guid() + "_" + version + "\" \n xmlns=\"http://standards.iso.org/iso/19770/-2/2015/schema.xsd\"> \n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n xsi:schemaLocation=\"http://standards.iso.org/iso/19770/-2/2015-current/schema.xsd schema.xsd\" >\n" +
" <Meta generator=\"SWID Tag Online Generator v0.1\" /> \n" +
" <Entity name=\"" + tagCreator + "\" regid=\"" + regid + "\" role=\"tagCreator\" /> \n"
+ optionals +
"</SoftwareIdentity>"
);
$("#filename").text("[INSTALL_PATH]/swidtag/{0}_{1}-{2}.swidtag".format(regid, name, version));
});
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
}
}
</script>
</head>
<body>
<h2>
ISO SWID 19770-2 online generator
</h2>
<div class="bd-example">
<form>
<label for="swname"> Product name:</label>
<input class="form-control" name="swname" id="swname" placeholder="Your Software Name" required="" autofocus="" type="text">
<label for="version">Product Version:</label>
<input class="form-control" name="version" id="version" pattern="^([0-9]+)\.([0-9]+)\.?([0-9]+)?.*" placeholder="1.0" required="" type="text">
<label for="tagCreator">TagCreator:</label>
<input class="form-control" name="tagCreator" id="tagCreator" placeholder="Vendor Name, e.g. Example Corp." required="" type="text">
<label for="regid">Tag Creator domain name:</label>
<input class="form-control" name="regid" id="regid" placeholder="vendor domain, e.g. example.com" required="" type="text">
<p>
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
More entries...
</button>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body">
<label for="licensor">Licensor:</label>
<input class="form-control" name="licensor" id="licensor" placeholder="Licensor company name, e.g. Example Corp" type="text">
<label for="licensor_regid">Licensor domain name:</label>
<input class="form-control" name="licensor_regid" id="licensor_regid" placeholder="vendor domain, e.g. example.com" type="text">
<label for="softwareCreator">Software Creator:</label>
<input class="form-control" name="softwareCreator" id="softwareCreator" placeholder="Licensor company name, e.g. Example Corp." type="text">
<label for="softwareCreator_regid">Software Creator domain name:</label>
<input class="form-control" name="softwareCreator_regid" id="softwareCreator_regid" placeholder="vendor domain, e.g. example.com" type="text">
</div>
</div>
</form>
<button class="btn btn-outline-secondary" data-clipboard-target="#output">
Copy to clipboard
</button>
Once generated, put it into your software, so that it resides under <code><span id="filename">[INSTALL_PATH]/swidtag/</span></code>.
<div class="p-3 mb-2 bg-light text-dark">
<pre class=".pre-scrollable"><div id="output"></div></pre>
</div>
</div>
</body></html>