aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-08-19 10:40:24 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-08-19 10:40:24 +0200
commit734b2e1f111286d332ef0799b7d2c99d5b7a6bd6 (patch)
treea0d5fdcf1588f0bea63e475637c6e756c7b4169b
parent82ac22ffefde9efe00255b008a5cbf892fb09063 (diff)
downloadeinfach-signieren-734b2e1f111286d332ef0799b7d2c99d5b7a6bd6.tar.gz
einfach-signieren-734b2e1f111286d332ef0799b7d2c99d5b7a6bd6.tar.bz2
einfach-signieren-734b2e1f111286d332ef0799b7d2c99d5b7a6bd6.zip
show Version in example
-rw-r--r--simpleSigning/src/main/resources/js/pdfas.js35
-rw-r--r--simpleSigning/src/main/webapp/index.jsp17
2 files changed, 51 insertions, 1 deletions
diff --git a/simpleSigning/src/main/resources/js/pdfas.js b/simpleSigning/src/main/resources/js/pdfas.js
index 6ddb7d7..a08d0f4 100644
--- a/simpleSigning/src/main/resources/js/pdfas.js
+++ b/simpleSigning/src/main/resources/js/pdfas.js
@@ -26,6 +26,9 @@ var pdfAsOrigin = "##REPLACE##DOMAIN##";
var pdfAsUrl = "##REPLACE##DOMAIN####REPLACE##CONTEXT##/Start";
+var pdfAsVersionUrl = "##REPLACE##DOMAIN####REPLACE##CONTEXT##/version";
+
+
var pdfAs = {};
/**
@@ -41,6 +44,37 @@ pdfAs.signPdf = function(content, error, success) {
this.createAsyncSignature(content.content, content.connector, content.uiId, pdfAsUrl, "PDF", success, error);
};
+pdfAs.getVersion = function(cb, err) {
+ var xmlhttp;
+
+ if (window.XMLHttpRequest) {
+ // code for IE7+, Firefox, Chrome, Opera, Safari
+ xmlhttp = new XMLHttpRequest();
+ } else {
+ // code for IE6, IE5
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 ) {
+ if(xmlhttp.status == 200){
+ var obj = JSON.parse(xmlhttp.responseText);
+ cb(obj);
+ }
+ else if(xmlhttp.status == 400) {
+ err('There was an error 400')
+ }
+ else {
+ err('something else other than 200 was returned')
+ }
+ }
+ }
+
+ xmlhttp.open("GET", pdfAsVersionUrl, true);
+ xmlhttp.send();
+}
+
+
var postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage');
var guid = (function() {
@@ -195,6 +229,7 @@ pdfAs.createAsyncSignature = function(pdfUrl, connector, divID, pdfAsURL, type,
form.submit();
};
+
pdfAs.addCallback = function(eventId, custDiv, error, success) {
pdfAs.cbMap.eventId = {suc: success, err: error, div: custDiv};
};
diff --git a/simpleSigning/src/main/webapp/index.jsp b/simpleSigning/src/main/webapp/index.jsp
index 9917165..ad21be7 100644
--- a/simpleSigning/src/main/webapp/index.jsp
+++ b/simpleSigning/src/main/webapp/index.jsp
@@ -65,6 +65,16 @@
// so we don't follow the form ...
return false;
}
+
+ function showVersion() {
+ pdfAs.getVersion(function show(version) {
+ alert("Version: " + version.version + " SCM: " + version.scm);
+ }, function error(error) {
+ alert("Failed to get Version: " + error);
+ });
+ // so we don't follow the form ...
+ return false;
+ }
</script>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
@@ -125,7 +135,12 @@
<label for="txtContent">Signaturdaten (Text oder Link zu
einem PDF Dokument, optional): </label> <input type="text" id="txtContent">
</div>
- <button id="btnSign" onclick="return signWidthContent();">Unterschreiben</button>
+ <div class="form-group">
+ <button id="btnSign" onclick="return signWidthContent();">Unterschreiben</button>
+ </div>
+ <div class="form-group">
+ <button id="btnVersion" onclick="return showVersion();">zeige Version</button>
+ </div>
</form>
</div>