aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/webapp
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-07-14 13:27:56 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-07-14 13:27:56 +0200
commit030ad8ea8455922ad59c095d3a9ecbfc462ff69f (patch)
tree3fb0ab24b8432dae25efab6ef3e3b77bd623b1d5 /pdf-as-web/src/main/webapp
parent38a852e11c1edd313ab0882ac7bda00a82546fbb (diff)
downloadpdf-as-4-030ad8ea8455922ad59c095d3a9ecbfc462ff69f.tar.gz
pdf-as-4-030ad8ea8455922ad59c095d3a9ecbfc462ff69f.tar.bz2
pdf-as-4-030ad8ea8455922ad59c095d3a9ecbfc462ff69f.zip
many fixes for html5 js viewer integration
Diffstat (limited to 'pdf-as-web/src/main/webapp')
-rw-r--r--pdf-as-web/src/main/webapp/WEB-INF/web.xml20
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/dragNdrop.js8
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js70
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon.pngbin0 -> 417 bytes
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon@2x.pngbin0 -> 417 bytes
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css5
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html7
-rw-r--r--pdf-as-web/src/main/webapp/index.jsp2
8 files changed, 95 insertions, 17 deletions
diff --git a/pdf-as-web/src/main/webapp/WEB-INF/web.xml b/pdf-as-web/src/main/webapp/WEB-INF/web.xml
index 4dd96f5f..3c80e11a 100644
--- a/pdf-as-web/src/main/webapp/WEB-INF/web.xml
+++ b/pdf-as-web/src/main/webapp/WEB-INF/web.xml
@@ -106,12 +106,24 @@
<servlet-class>at.gv.egiz.pdfas.web.servlets.PDFData</servlet-class>
</servlet>
<servlet>
+ <servlet-name>PDFPosData</servlet-name>
+ <display-name>PDFPosData</display-name>
+ <description></description>
+ <servlet-class>at.gv.egiz.pdfas.web.servlets.PDFPositioningDataServlet</servlet-class>
+ </servlet>
+ <servlet>
<servlet-name>ErrorPage</servlet-name>
<display-name>ErrorPage</display-name>
<description></description>
<servlet-class>at.gv.egiz.pdfas.web.servlets.ErrorPage</servlet-class>
</servlet>
<servlet>
+ <servlet-name>SIGNNOW</servlet-name>
+ <display-name>SIGNNOW</display-name>
+ <description></description>
+ <servlet-class>at.gv.egiz.pdfas.web.servlets.SignNowServlet</servlet-class>
+ </servlet>
+ <servlet>
<servlet-name>PDFVerifyData</servlet-name>
<display-name>PDFVerifyData</display-name>
<description></description>
@@ -182,6 +194,10 @@
<url-pattern>/PDFData</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>PDFPosData</servlet-name>
+ <url-pattern>/PDFPosData</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>ErrorPage</servlet-name>
<url-pattern>/ErrorPage</url-pattern>
</servlet-mapping>
@@ -190,6 +206,10 @@
<url-pattern>/signData</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>SIGNNOW</servlet-name>
+ <url-pattern>/signNow</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>PDFVerifyCert</servlet-name>
<url-pattern>/signCert</url-pattern>
</servlet-mapping>
diff --git a/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js b/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js
index 940804bd..fd05f81b 100644
--- a/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js
+++ b/pdf-as-web/src/main/webapp/assets/js/dragNdrop.js
@@ -111,7 +111,13 @@ function sign(file, connector, locale) {
processData: false,
contentType: false,
type: "POST",
+ xhrFields: {
+ withCredentials: true
+ },
success: function(response) {
+ $("html").empty();
+ $("html").html(response);
+ /*
$("#fade").remove();
$("#popup").remove();
var fade_div = "<div id='fade' class='black_overlay'></div>";
@@ -122,7 +128,7 @@ function sign(file, connector, locale) {
$("#closelink").bind("click", function(evt) {
$("#fade").remove();
$("#popup").remove();
- });
+ });*/
}
});
}
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js
index 6e16c306..da71e83d 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js
@@ -12,7 +12,17 @@ function statusObject() {
this.connector = null;
this.file_path = null;
this.file = null;
- this.signature = null,
+ this.signature = null;
+ this.running = false;
+ this.applicationContext = '../../../../';
+
+ this.setRunning = function(r) {
+ this.running = (r === 'true');
+ }
+
+ this.getRunning = function() {
+ return this.running;
+ }
this.setFile = function(f) {
this.file = f;
@@ -180,7 +190,7 @@ function isSignaturePlaced() {
function placeSignature(evt, page_to_place, s) {
var current_scale = PDFViewerApplication.pdfViewer.currentScale;
var sig_size = Math.floor(96 * current_scale);
- var defaultSignature = "<img src='/pdf-as-web/visblock?r=" + sig_size.toString() + "' alt='Signature' id='img_signature' class='cl_signature' draggable='true' style='position: absolute; z-index:4; cursor:move'>";
+ var defaultSignature = "<img src='" + global_status.applicationContext + "/visblock?r=" + sig_size.toString() + "' alt='Signature' id='img_signature' class='cl_signature' draggable='true' style='position: absolute; z-index:4; cursor:move'>";
if (typeof page_to_place === 'undefined') { page_to_place = PDFView.page;}
if (typeof s === 'undefined') { s = defaultSignature}
@@ -251,13 +261,15 @@ $(document).ready(function() {
if(!results) {
return null;
} else {
- return results[1] || 0;
+ return decodeURIComponent(results[1]) || decodeURI(0);
}
}
global_status.setConnector($.urlParam("connector"));
global_status.setPdfUlr($.urlParam("pdfurl"));
global_status.setFilePath($.urlParam("file"));
+ console.log("Status:", global_status);
+ global_status.setRunning($.urlParam("running"));
if(global_status.getFilePath()) { //if a filepath is given via the file HTML get parameter, try to fetch the file and display it
fetchFile(global_status.getFilePath()).then(function(result) {
@@ -370,11 +382,16 @@ function quickSign(connector, pdfurl) {
fd.append("connector", connector);
fd.append("pdf-url", pdfurl);
+ var signUrl = global_status.applicationContext + "/Sign";
+
$.ajax({
- url: "/pdf-as-web/Sign",
+ url: signUrl,
data: fd,
processData: false,
contentType: false,
+ xhrFields: {
+ withCredentials: true
+ },
type: "POST",
success: function(response) {
$("html").empty();
@@ -397,22 +414,44 @@ function sign(statusObj) {
}
var fd = new FormData();
fd.append("source", "internal");
- fd.append("connector", global_status.getConnector());
- fd.append("pdf-file", global_status.getFile());
-
- if(isSignaturePlaced()) {
- fd.append("sig-pos-x", global_status.getSignature().posx);
- fd.append("sig-pos-y", global_status.getSignature().posy);
- fd.append("sig-pos-p", global_status.getSignature().page);
- }
+ var method = "POST";
+ var signUrl = global_status.applicationContext + "/Sign";
+
+ if(global_status.getRunning()) {
+ signUrl = global_status.applicationContext + "/signNow";
+ method = "GET";
+ fd = null;
+
+ if(isSignaturePlaced()) {
+ signUrl = signUrl + "?sigPosX=" + encodeURIComponent(global_status.getSignature().posx);
+ signUrl = signUrl + "&sigPosY=" + encodeURIComponent(global_status.getSignature().posy);
+ signUrl = signUrl + "&sigPosP=" + encodeURIComponent(global_status.getSignature().page);
+ }
+ } else {
+ fd.append("connector", global_status.getConnector());
+ fd.append("pdf-file", global_status.getFile());
+ if(isSignaturePlaced()) {
+ fd.append("sig-pos-x", global_status.getSignature().posx);
+ fd.append("sig-pos-y", global_status.getSignature().posy);
+ fd.append("sig-pos-p", global_status.getSignature().page);
+ }
+ }
+
+ console.log("Data:", fd);
$.ajax({
- url: "/pdf-as-web/Sign",
+ url: signUrl,
data: fd,
processData: false,
contentType: false,
- type: "POST",
+ type: method,
+ xhrFields: {
+ withCredentials: true
+ },
success: function(response) {
+ $("html").empty();
+ $("html").html(response);
+ /*
$("#fade").remove();
$("#popup").remove();
var fade_div = "<div id='fade' class='black_overlay'></div>";
@@ -424,6 +463,9 @@ function sign(statusObj) {
$("#fade").remove();
$("#popup").remove();
});
+ if(typeof onAnmeldeSubmit == 'function') {
+ onAnmeldeSubmit();
+ }*/
}
});
}
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon.png b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon.png
new file mode 100644
index 00000000..d47bc8a0
--- /dev/null
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon.png
Binary files differ
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon@2x.png b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon@2x.png
new file mode 100644
index 00000000..d47bc8a0
--- /dev/null
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/images/signature-icon@2x.png
Binary files differ
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css
index adba9ec6..de21f494 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.css
@@ -1052,6 +1052,11 @@ html[dir='rtl'] .toolbarButton.pageDown::before {
content: url(images/toolbarButton-openFile.png);
}
+.toolbarButton.createSignature::before,
+.secondaryToolbarButton.createSignature::before {
+ content: url(images/document_signature.png);
+}
+
.toolbarButton.placeSignature::before,
.secondaryToolbarButton.placeSignature::before {
content: url(images/document_signature.png);
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html
index 6d49482d..c6cf575f 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.html
@@ -31,7 +31,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="locale/locale.properties"/>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="l10n.js"></script>
@@ -137,6 +137,11 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</button>
<!-- ADDED -->
+ <button id="secondaryCreateSignature" class="secondaryToolbarButton createSignature visibleLargeView" title="Create Signature" tabindex="51" data-l10n-id="create_signature">
+ <span data-l10n-id="create_signature_label">Create Signature</span>
+ </button>
+
+ <!-- ADDED -->
<button id="secondaryPlaceSignature" class="secondaryToolbarButton placeSignature visibleLargeView" title="Place Signature" tabindex="51" data-l10n-id="place_signature">
<span data-l10n-id="place_signature_label">Place Signature</span>
</button>
diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp
index 5dbd7d2e..ac8a5f20 100644
--- a/pdf-as-web/src/main/webapp/index.jsp
+++ b/pdf-as-web/src/main/webapp/index.jsp
@@ -6,7 +6,7 @@
<meta charset="utf-8">
<title>PDF-Signatur</title>
<link rel="stylesheet" href="assets/css/style.css">
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="assets/js/pdf.js/build/pdf.js"></script>
<script src="assets/js/dragNdrop.js"></script>