Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
pdf-customizer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
a5cdde8f
authored
2016-09-08 15:19:49 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
changes to preview
1 parent
11ddae0a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
127 deletions
app/Http/Controllers/ApiController.php
public/files/js/interfaceGdrive.js
app/Http/Controllers/ApiController.php
View file @
a5cdde8
...
...
@@ -154,10 +154,11 @@ class ApiController extends Controller
$pdf
=
$pdf
->
pdf
(
$pdfId
);
$response
=
$pdfId
;
$statusCode
=
200
;
return
Response
::
json
(
$response
,
$statusCode
);
$UploaqdPdf
=
new
GoogledriveuploadpdfController
();
$UploaqdPdf
->
google_drive_upload
(
$folder
,
'new_'
.
$pdfLocation
,
$pdfId
,
$cust_id
);
return
Response
::
json
(
$response
,
$statusCode
);
}
public
function
getList
(
$json
)
...
...
public/files/js/interfaceGdrive.js
View file @
a5cdde8
var
pluginUrl
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
'/commonwell'
;
var
pdf_customizer
=
"http://localhost:8888/pdf-customizer/public"
;
//
var pluginUrl = window.location.protocol + '//' + window.location.host + '/commonwell';
//
var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
//var pluginUrl = "http://contact.gotenzing.com"
;
//
var pdf_customizer = "http://pdf-customizer.synapsus.co";
var
pluginUrl
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
;
var
pdf_customizer
=
"http://pdf-customizer.synapsus.co"
;
var
imageHeight
=
""
;
...
...
@@ -67,19 +67,19 @@ CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
return
this
;
}
function
ShowBox
(
pheight
,
pwidth
,
up
,
right
,
height
,
width
,
count
,
example
)
{
function
ShowBox
(
pheight
,
pwidth
,
b
up
,
right
,
height
,
width
,
count
,
example
)
{
jQuery
(
document
).
ready
(
function
(
$
)
{
$
(
'span'
).
hide
();
$
(
'#span'
+
count
).
show
();
// $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
// $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
var
Qc
=
document
.
getElementById
(
"Canvas"
);
var
Qctx
=
Qc
.
getContext
(
"2d"
);
Qctx
.
clearRect
(
0
,
0
,
Qc
.
width
,
Qc
.
height
);
Qctx
.
restore
();
var
fix
=
3
;
var
up
=
bup
-
fix
;
var
down
=
pheight
-
(
up
+
height
);
var
scaleH
=
$
(
"Canvas"
).
height
()
/
pheight
;
var
scaleW
=
$
(
"Canvas"
).
width
()
/
pwidth
;
...
...
@@ -94,22 +94,21 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
ctx
.
lineWidth
=
2
;
ctx
.
strokeStyle
=
$
(
'.callout'
).
css
(
"background-color"
)
ctx
.
roundRect
(
scaleRight
,
scaleDown
,
scalewidth
,
scaleheight
,
5
).
stroke
();
console
.
log
(
PageChangeOn
,
setpage
);
if
(
PageChangeOn
!=
setpage
)
{
document
.
getElementById
(
"preview"
).
checked
=
true
;
console
.
log
(
PageChangeOn
,
setpage
);
if
(
PageChangeOn
!=
setpage
)
{
document
.
getElementById
(
"preview"
).
checked
=
true
;
$
(
'#changes'
).
trigger
(
'submit'
);
}
});
setpage
=
PageChangeOn
;
}
function
HideBox
(
kind
,
page
)
{
function
HideBox
(
kind
,
page
)
{
jQuery
(
document
).
ready
(
function
(
$
)
{
$
(
'span'
).
hide
();
...
...
@@ -118,7 +117,7 @@ function HideBox(kind,page) {
var
Qctx
=
Qc
.
getContext
(
"2d"
);
Qctx
.
clearRect
(
0
,
0
,
Qc
.
width
,
Qc
.
height
);
Qctx
.
restore
();
if
(
kind
!=
'file'
)
{
document
.
getElementById
(
"preview"
).
checked
=
true
;
$
(
'#changes'
).
trigger
(
'submit'
);
...
...
@@ -128,13 +127,13 @@ function HideBox(kind,page) {
}
function
HideBoxwithdate
(
kind
,
page
)
{
function
HideBoxwithdate
(
kind
,
page
)
{
jQuery
(
document
).
ready
(
function
(
$
)
{
var
Qc
=
document
.
getElementById
(
"Canvas"
);
var
Qctx
=
Qc
.
getContext
(
"2d"
);
Qctx
.
clearRect
(
0
,
0
,
Qc
.
width
,
Qc
.
height
);
Qctx
.
restore
();
});
...
...
@@ -142,15 +141,33 @@ function HideBoxwithdate(kind,page) {
}
function
setSubmit
(
off
){
jQuery
(
document
).
ready
(
function
(
$
)
{
if
(
off
!=
'on'
){
$
(
'input:submit'
).
attr
(
"disabled"
,
true
);
}
else
{
$
(
'input:submit'
).
attr
(
"disabled"
,
false
);
}
});
}
function
setPage
(
page
)
{
setpage
=
page
;
setpage
=
page
;
}
function
setPreview
(
off
)
{
document
.
getElementById
(
"preview"
).
checked
=
false
;
}
function
setPageChangeOn
(
page
)
{
PageChangeOn
=
page
;
PageChangeOn
=
page
;
}
...
...
@@ -225,7 +242,7 @@ function pickPdfFromList(json) {
function
setTinyMce
()
{
jQuery
(
document
).
ready
(
function
(
$
)
{
var
tinymces
=
tinymce
.
init
({
var
tinymces
=
tinymce
.
init
({
selector
:
'.textarea'
,
entity_encoding
:
"raw"
,
menubar
:
false
,
...
...
@@ -268,30 +285,30 @@ function setTinyMce() {
function
setDatePicker
()
{
jQuery
(
document
).
ready
(
function
(
$
)
{
$
(
"#changescontentdate"
).
datepicker
({
plugins
:
"tabfocus"
,
changeMonth
:
true
,
changeYear
:
true
,
yearRange
:
'2015:2025'
,
dateFormat
:
'DD MM dd yy'
,
minDate
:
0
,
defaultDate
:
null
}).
on
(
'change'
,
function
()
{
$
(
this
).
valid
();
// triggers the validation test
document
.
getElementById
(
"preview"
).
checked
=
true
;
$
(
'#changes'
).
trigger
(
'submit'
);
$
(
"#changescontentdate"
).
datepicker
({
plugins
:
"tabfocus"
,
changeMonth
:
true
,
changeYear
:
true
,
yearRange
:
'2015:2025'
,
dateFormat
:
'DD MM dd yy'
,
minDate
:
0
,
defaultDate
:
null
}).
on
(
'change'
,
function
()
{
$
(
this
).
valid
();
// triggers the validation test
document
.
getElementById
(
"preview"
).
checked
=
true
;
$
(
'#changes'
).
trigger
(
'submit'
);
});
});
});
}
function
getPdfSize
(
json
)
{
jQuery
(
document
).
ready
(
function
(
$
)
{
json
=
JSON
.
parse
(
json
);
//console.log(json);
json
=
JSON
.
parse
(
json
);
//console.log(json);
var
windowWidth
=
0.90
*
$
(
".layout-grid"
).
width
();
var
windowHeight
=
0.90
*
$
(
".layout-grid"
).
height
();
...
...
@@ -302,7 +319,7 @@ function getPdfSize(json) {
pheight
=
parseInt
(
json
[
0
].
pheight
);
if
(
pwidth
>
pheight
)
{
var
scaleImage
=
windowWidth
/
pwidth
;
var
scaleImage
=
windowWidth
/
pwidth
;
vimageHeight
=
pheight
*
scaleImage
;
vimageWidth
=
windowWidth
;
vimgLeft
=
0
;
...
...
@@ -314,20 +331,20 @@ function getPdfSize(json) {
vimgLeft
=
30
;
vimgTop
=
2
;
}
console
.
log
(
pwidth
,
pheight
,
vimgLeft
,
vimgTop
,
vwindowHBG
,
vimageHeight
,
vimageWidth
);
setPdfSize
(
vimgLeft
,
vimgTop
,
vwindowHBG
,
vimageHeight
,
vimageWidth
);
setPdfSize
(
vimgLeft
,
vimgTop
,
vwindowHBG
,
vimageHeight
,
vimageWidth
);
});
}
function
setPdfSize
(
vimgLeft
,
vimgTop
,
vwindowHBG
,
vimageHeight
,
vimageWidth
)
{
console
.
log
(
vimgLeft
,
vimgTop
,
vwindowHBG
,
vimageHeight
,
vimageWidth
);
imgLeft
=
vimgLeft
;
imgTop
=
vimgTop
;
windowHBG
=
vwindowHBG
;
imageHeight
=
vimageHeight
;
imageWidth
=
vimageWidth
;
//
console.log(vimgLeft, vimgTop, vwindowHBG, vimageHeight, vimageWidth);
imgLeft
=
vimgLeft
;
imgTop
=
vimgTop
;
windowHBG
=
vwindowHBG
;
imageHeight
=
vimageHeight
;
imageWidth
=
vimageWidth
;
}
...
...
@@ -339,11 +356,11 @@ function changePdfOptions(json, edit) {
$
(
'#contentAreaOver'
).
hide
();
}
json
=
JSON
.
parse
(
json
);
$
(
document
).
ready
(
function
()
{
setDatePicker
();
...
...
@@ -365,7 +382,7 @@ function changePdfOptions(json, edit) {
var
pdflist
=
""
;
var
pdfChange
=
""
;
var
f
=
0
;
// console.log('windowWidth'+windowWidth ,'windowHeight'+windowHeight,'pheight'+json[0].pheight,'pwidth'+json[0].pwidth,'imageWidth'+imageWidth, 'imageHeight'+imageHeight);
...
...
@@ -375,34 +392,34 @@ function changePdfOptions(json, edit) {
pdflist
+=
'<canvas id="Canvas" width="'
+
imageWidth
+
'" height="'
+
imageHeight
+
'" style=" background-image: url('
+
pdf_customizer
+
'/fileentry/getImage/'
+
json
[
0
].
folder
+
'/'
+
json
[
0
].
example
+
'); background-size:'
+
imageWidth
+
'px '
+
imageHeight
+
'px; position: relative; z-index: 10; margin-top:'
+
imgTop
+
'%; display: block; margin-left: auto; margin-right: auto; border-style: solid; border-width:1px; background-size:'
+
imageWidth
+
'px '
+
imageHeight
+
'px"></canvas><div id="pdfPreviewInner" style=" position: relative; top: -'
+
imageHeight
+
'px;"></div></div>'
;
pdfChange
+=
'<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>'
+
json
[
0
].
name
+
'</h4>'
;
pdfChange
+=
'<input type="hidden" id="id" name="id" value="'
+
json
[
0
].
idPDF
+
'">'
;
setPage
(
json
[
0
].
pages
);
setPage
(
json
[
0
].
pages
);
for
(
i
=
0
;
i
<
json
.
length
;
++
i
)
{
var
example
=
json
[
0
].
folder
+
'/'
+
json
[
i
].
example
;
if
(
json
[
i
].
change_type
==
"textflow"
)
{
pdfChange
+=
json
[
i
].
names
+
': <textarea onfocusout="HideBox(\'textflow\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontent'
+
[
f
]
+
'" class="textarea required" value="'
+
json
[
i
].
content
+
'" name="content['
+
i
+
']">'
+
json
[
i
].
content
+
'</textarea>'
;
pdfChange
+=
json
[
i
].
names
+
': <textarea onfocusout="HideBox(\'textflow\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontent'
+
[
f
]
+
'" class="textarea required" value="'
+
json
[
i
].
content
+
'" name="content['
+
i
+
']">'
+
json
[
i
].
content
+
'</textarea>'
;
++
f
;
pdfChange
+=
'<span id="span'
+
i
+
'">'
+
json
[
i
].
tips
+
'</span><br/>'
;
}
if
(
json
[
i
].
change_type
==
"text"
)
{
pdfChange
+=
json
[
i
].
names
+
': <input onfocusout="HideBox(\'text\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontent['
+
i
+
']" type="text" class="required" name="content['
+
i
+
']" value="'
+
json
[
i
].
content
+
'"">'
;
pdfChange
+=
json
[
i
].
names
+
': <input onfocusout="HideBox(\'text\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontent['
+
i
+
']" type="text" class="required" name="content['
+
i
+
']" value="'
+
json
[
i
].
content
+
'"">'
;
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'">'
+
json
[
i
].
tips
+
'</span><br/>'
;
}
if
(
json
[
i
].
change_type
==
"img"
)
{
if
(
edit
==
true
)
{
pdfChange
+=
'<input value="'
+
json
[
i
].
content
+
'" tabindex="-1" class="required" id="hiddenchangescontent['
+
i
+
']" type="hidden" name="content['
+
i
+
']" >'
;
pdfChange
+=
json
[
i
].
names
+
':<label onfocusout="HideBox(\'file\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="focusButton'
+
i
+
'" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload" id="changescontent['
+
i
+
']" type="file" name="content['
+
i
+
']" ><span class="file-button"><span class="file-name file-button">'
+
json
[
i
].
content
+
'</span><strong>Browse</strong></span></label>'
;
pdfChange
+=
json
[
i
].
names
+
':<label onfocusout="HideBox(\'file\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="focusButton'
+
i
+
'" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload" id="changescontent['
+
i
+
']" type="file" name="content['
+
i
+
']" ><span class="file-button"><span class="file-name file-button">'
+
json
[
i
].
content
+
'</span><strong>Browse</strong></span></label>'
;
}
else
{
pdfChange
+=
json
[
i
].
names
+
':<label onfocusout="HideBox(\'file\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'), ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="focusButton'
+
i
+
'" class="custom-file-input" tabindex="0"><input value="'
+
json
[
i
].
content
+
'" tabindex="-1" class="fileupload upload required" id="changescontent['
+
i
+
']" type="file" name="content['
+
i
+
']" ><span class="file-button"><span class="file-name file-button">'
+
json
[
i
].
content
+
'</span><strong>Browse</strong></span></label>'
;
pdfChange
+=
json
[
i
].
names
+
':<label onfocusout="HideBox(\'file\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'), ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="focusButton'
+
i
+
'" class="custom-file-input" tabindex="0"><input value="'
+
json
[
i
].
content
+
'" tabindex="-1" class="fileupload upload required" id="changescontent['
+
i
+
']" type="file" name="content['
+
i
+
']" ><span class="file-button"><span class="file-name file-button">'
+
json
[
i
].
content
+
'</span><strong>Browse</strong></span></label>'
;
}
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'">'
+
json
[
i
].
tips
+
'</span><br/>'
;
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'">'
+
json
[
i
].
tips
+
'</span><br/>'
;
}
if
(
json
[
i
].
change_type
==
"date"
)
{
pdfChange
+=
json
[
i
].
names
+
': <input onfocusout="HideBoxwithdate(\'date\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontentdate" type="text" class="required date" name="content['
+
i
+
']" value="'
+
json
[
i
].
content
+
'"">'
;
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'"> </span><br/>'
;
pdfChange
+=
json
[
i
].
names
+
': <input onfocusout="HideBoxwithdate(\'date\')" onfocus="setPageChangeOn(\''
+
json
[
i
].
pages
+
'\'),ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontentdate" type="text" class="required date" name="content['
+
i
+
']" value="'
+
json
[
i
].
content
+
'"">'
;
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'"> </span><br/>'
;
}
if
(
json
[
i
].
change_type
==
"user"
)
{
...
...
@@ -414,15 +431,15 @@ function changePdfOptions(json, edit) {
}
else
{
var
content_string
=
json
[
i
].
content
;
}
pdfChange
+=
json
[
i
].
names
+
': <input onfocusout="HideBox()" onfocus="ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontent['
+
i
+
']" type="text" class="required" name="content['
+
i
+
']" value="'
+
content_string
+
'"">'
;
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'">'
+
json
[
i
].
tips
+
'</span><br/>'
;
pdfChange
+=
json
[
i
].
names
+
': <input onfocusout="HideBox()" onfocus="ShowBox('
+
json
[
0
].
pheight
+
','
+
json
[
0
].
pwidth
+
','
+
json
[
i
].
locationUp
+
','
+
json
[
i
].
locationRight
+
','
+
json
[
i
].
height
+
','
+
json
[
i
].
width
+
','
+
i
+
',\''
+
example
+
'\')" id="changescontent['
+
i
+
']" type="text" class="required" name="content['
+
i
+
']" value="'
+
content_string
+
'"">'
;
pdfChange
+=
'<span class="tip" id="span'
+
i
+
'">'
+
json
[
i
].
tips
+
'</span><br/>'
;
}
}
pdfChange
+=
'<input type="checkbox" id="preview" name="preview" style="display: none;">'
;
pdfChange
+=
'<input
type="submit
" value="Save and Continue">'
;
pdfChange
+=
'<input
id="saveButton" type="submit" onclick="setPreview(\'off\')
" value="Save and Continue">'
;
pdfChange
+=
'</form>'
;
...
...
@@ -441,8 +458,8 @@ function changePdfOptions(json, edit) {
//document.getElementById('google_drive').innerHTML = " ";
}
setTinyMce
();
setTinyMce
();
$
(
'.closeEditer'
).
click
(
function
()
{
$
(
"#contentAreaOver"
).
slideToggle
(
function
()
{
...
...
@@ -501,7 +518,7 @@ function changePdfOptions(json, edit) {
if
(
el
.
id
)
document
.
getElementById
(
el
.
id
).
value
=
el
.
getContent
();
//$('#changes').hide();
});
...
...
@@ -518,6 +535,8 @@ function changePdfOptions(json, edit) {
if
(
$
(
"#changes"
).
valid
())
{
setSubmit
(
'off'
);
$
(
tinymce
.
get
()).
each
(
function
(
i
,
el
)
{
if
(
el
.
id
)
...
...
@@ -543,7 +562,7 @@ function changePdfOptions(json, edit) {
});
}
var
form
=
$
(
"#changes"
);
//console.log(form);
returnfileOptions
(
imagefiles
,
form
,
preview
=
false
);
...
...
@@ -605,16 +624,16 @@ function returnOptions(form, preview) {
$
.
getJSON
(
pdf_customizer
+
"/api/v1/get-pdf/"
+
id
.
value
,
function
(
dataReturnd
)
{
var
content
=
[];
var
content
=
[];
for
(
e
=
0
;
e
<
form
[
0
].
length
;
++
e
)
{
if
(
form
[
0
][
e
].
type
!=
'button'
)
{
content
.
push
(
JSON
.
stringify
(
form
[
0
][
e
].
value
));
}
if
(
form
[
0
][
e
].
type
!=
'button'
)
{
content
.
push
(
JSON
.
stringify
(
form
[
0
][
e
].
value
));
}
}
// Get the element with id summary and set the inner text to the result.
...
...
@@ -623,14 +642,14 @@ function returnOptions(form, preview) {
var
jsonReturn
=
'{"pdf":[{"name":"'
+
json
[
0
].
name
+
'", "folder":"'
+
json
[
0
].
folder
+
'", "pdfLocation":"'
+
json
[
0
].
file
+
'","pageWidth":"'
+
json
[
0
].
pwidth
+
'","pageHeight":"'
+
json
[
0
].
pheight
+
'", "custId":"'
+
user_id
+
'"}],"changes":['
var
o
=
1
;
var
e
=
1
;
for
(
i
=
0
;
i
<
json
.
length
;
++
i
)
{
var
style
=
JSON
.
stringify
(
json
[
i
].
style
);
if
(
content
[
e
]
!=
'""'
)
{
if
(
o
!==
1
)
{
jsonReturn
+=
','
;
...
...
@@ -642,14 +661,17 @@ function returnOptions(form, preview) {
++
o
};
++
e
++
e
}
jsonReturn
+=
' ]}'
;
if
(
preview
==
false
)
{
url
=
'update'
;
}
else
{
url
=
'preview'
;}
if
(
preview
==
false
)
{
url
=
'update'
;
}
else
{
url
=
'preview'
;
}
...
...
@@ -663,7 +685,7 @@ function returnOptions(form, preview) {
success
:
function
(
data
)
{
finalPdf
(
data
,
json
)
finalPdf
(
data
,
json
)
;
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
//Add these parameters to display the required response
...
...
@@ -682,66 +704,69 @@ function returnOptions(form, preview) {
function
finalPdf
(
data
,
json
)
{
jQuery
(
function
(
$
)
{
jQuery
(
function
(
$
)
{
// console.log(jsonReturn);
if
(
preview
==
false
)
{
$
(
"#Canvas"
).
css
(
'z-index'
,
'0'
);
$
(
'#changes'
).
hide
();
$
(
'#controls'
).
show
();
url
=
'update'
;
}
else
{
$
(
"#changes"
).
validate
().
cancelSubmit
=
false
;
document
.
getElementById
(
"preview"
).
checked
=
false
;
url
=
'preview'
;
}
$
(
'#controls'
).
hide
();
$
(
'#pdfPreviewInner'
).
show
();
// console.log(jsonReturn);
var
strVar2
=
""
strVar2
+=
'<div id="seepdf" style=" width:'
+
imageWidth
+
'px; height: '
+
imageHeight
+
'px; overflow: hidden;" ><embed src="'
+
pdf_customizer
+
'/fileentry/getPDF/'
+
json
[
0
].
folder
+
'/new_'
+
json
[
0
].
file
+
'#page='
+
setpage
+
'&toolbar=0&navpanes=0&scrollbar=0statusbar=0" width="'
+
imageWidth
+
'" height="'
+
imageHeight
+
'" type="application/pdf" id="pdfloaded"></div>'
;
document
.
getElementById
(
'pdfPreviewInner'
).
innerHTML
=
strVar2
;
if
(
preview
==
false
)
{
$
(
"#Canvas"
).
css
(
'z-index'
,
'0'
);
$
(
'#changes'
).
hide
();
$
(
'#controls'
).
show
();
}
else
{
$
(
"#changes"
).
validate
().
cancelSubmit
=
false
;
document
.
getElementById
(
"preview"
).
checked
=
false
;
}
$
(
'#controls'
).
hide
();
$
(
'#pdfPreviewInner'
).
show
()
var
strVar3
=
'<div id="button"><input id="editMe" type="submit" value="Edit"><a href="'
+
pdf_customizer
+
'/fileentry/getPDF/'
+
json
[
0
].
folder
+
'/new_'
+
json
[
0
].
file
+
'" download="'
+
json
[
0
].
file
+
'" ><input id="downloadMe" type="submit" value="Download"></a> </div>'
;
document
.
getElementById
(
'controls'
).
innerHTML
=
strVar3
;
var
strVar2
=
""
strVar2
+=
'<div id="seepdf" style=" width:'
+
imageWidth
+
'px; height: '
+
imageHeight
+
'px; overflow: hidden;" ><embed src="'
+
pdf_customizer
+
'/fileentry/getPDF/'
+
json
[
0
].
folder
+
'/new_'
+
json
[
0
].
file
+
'#page='
+
setpage
+
'&toolbar=0&navpanes=0&zoom=scale,left,top&;scrollbar=0&statusbar=0" width="'
+
imageWidth
+
'" height="'
+
imageHeight
+
'" type="application/pdf" id="pdfloaded"></embed></div>'
;
document
.
getElementById
(
'pdfPreviewInner'
).
innerHTML
=
strVar2
;
$
.
LoadingOverlaySetup
({
color
:
"rgba(0, 0, 0, 0.9)"
});
$
(
'#Canvas'
).
LoadingOverlay
(
"show"
);
$
(
'#Canvas'
).
delay
(
500
).
queue
(
function
()
{
$
(
this
).
css
(
"background-image"
,
""
);
});
var
strVar3
=
'<div id="button"><input id="editMe" type="submit" value="Edit"><a href="'
+
pdf_customizer
+
'/fileentry/getPDF/'
+
json
[
0
].
folder
+
'/new_'
+
json
[
0
].
file
+
'" download="'
+
json
[
0
].
file
+
'" ><input id="downloadMe" type="submit" value="Download"></a> </div>'
;
document
.
getElementById
(
'controls'
).
innerHTML
=
strVar3
;
setTimeout
(
function
()
{
$
(
'#Canvas'
).
LoadingOverlay
(
"hide"
,
true
);
},
500
);
$
.
LoadingOverlaySetup
({
color
:
"rgba(0, 0, 0, 0.9)"
,
image
:
pluginUrl
+
"/wp-content/plugins/pdf-customizer-plugin/public/js/loading.gif"
,
});
$
(
'#Canvas'
).
LoadingOverlay
(
"show"
);
$
(
'#Canvas'
).
delay
(
600
).
queue
(
function
()
{
$
(
this
).
css
(
"background-image"
,
""
);
});
if
(
preview
==
false
)
{
$
(
'#controls'
).
show
(
);
}
setTimeout
(
function
(
)
{
$
(
'#Canvas'
).
LoadingOverlay
(
"hide"
,
true
);
},
600
);
if
(
preview
==
false
)
{
$
(
'#controls'
).
show
();
setSubmit
(
'on'
);
}
$
(
'#editMe'
).
click
(
function
()
{
$
(
"#google_drive"
).
hide
();
$
(
'#controls'
).
hide
();
$
(
'#changes'
).
show
();
$
(
"#Canvas"
).
show
();
$
(
"#Canvas"
).
css
(
'z-index'
,
'10'
);
});
$
(
'#editMe'
).
click
(
function
()
{
$
(
"#google_drive"
).
hide
();
$
(
'#controls'
).
hide
();
$
(
'#changes'
).
show
();
$
(
"#Canvas"
).
show
();
$
(
"#Canvas"
).
css
(
'z-index'
,
'10'
);
setTinyMce
();
$
(
'#downloadMe'
).
click
(
function
()
{
$
(
".closeEditer"
).
click
();
});
});
$
(
'#downloadMe'
).
click
(
function
()
{
$
(
".closeEditer"
).
click
();
});
});
}
});
}
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment