... | ... |
@@ -31,11 +31,11 @@ |
31 | 31 |
$(function() { |
32 | 32 |
var $sigdiv = $("#signature_<?= $this->id ?>") |
33 | 33 |
$sigdiv.jSignature({ |
34 |
- 'color': "#<?= $this->color ?>", |
|
34 |
+ 'color': "<?= $this->color ?>", |
|
35 | 35 |
'lineWidth': <?= $this->pen ?>, |
36 | 36 |
'width': '<?= $this->width ?>', |
37 | 37 |
'height': '<?= $this->height ?>', |
38 |
- 'background-color': "transparent", |
|
38 |
+ 'background-color': '<?= $this->bgcolor ?>', |
|
39 | 39 |
'UndoButton': true |
40 | 40 |
}) |
41 | 41 |
$sigdiv.bind('change', function(e) { |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
<?php |
2 | 2 |
$GLOBALS['TL_CSS'][] = 'bundles/softleistersignatureformfield/styles.css|static'; |
3 | 3 |
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/softleistersignatureformfield/jSignature.min.noconflict.js|static'; |
4 |
- $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/softleistersignatureformfield/jSignature.UndoButton.js|static'; |
|
5 | 4 |
?> |
6 | 5 |
|
7 | 6 |
<?php $this->extend('form_row'); ?> |
... | ... |
@@ -26,20 +25,24 @@ |
26 | 25 |
<input id="hidden_<?= $this->id ?>" type="hidden" name="<?= $this->name ?>" value=""> |
27 | 26 |
<div id="signature_<?= $this->id ?>" class="canvas" style="width:<?= $this->width ?>px;height:<?= $this->height ?>px;background-color:#<?= $this->bgcolor ?>;"></div> |
28 | 27 |
<script> |
29 |
- $(document).ready(function() { |
|
30 |
- var $sigdiv = $("#signature_<?= $this->id ?>") |
|
31 |
- $sigdiv.jSignature({ |
|
32 |
- 'color': "#<?= $this->color ?>", |
|
33 |
- 'lineWidth': <?= $this->pen ?>, |
|
34 |
- 'width': '<?= $this->width ?>', |
|
35 |
- 'height': '<?= $this->height ?>', |
|
36 |
- 'background-color': "transparent", |
|
37 |
- 'UndoButton': true |
|
38 |
- }) |
|
39 |
- $sigdiv.bind('change', function(e) { |
|
40 |
- document.getElementById("hidden_<?= $this->id ?>").value = $sigdiv.jSignature("getData","default") |
|
28 |
+ |
|
29 |
+ jQuery.noConflict(); |
|
30 |
+ (function($) { |
|
31 |
+ $(function() { |
|
32 |
+ var $sigdiv = $("#signature_<?= $this->id ?>") |
|
33 |
+ $sigdiv.jSignature({ |
|
34 |
+ 'color': "#<?= $this->color ?>", |
|
35 |
+ 'lineWidth': <?= $this->pen ?>, |
|
36 |
+ 'width': '<?= $this->width ?>', |
|
37 |
+ 'height': '<?= $this->height ?>', |
|
38 |
+ 'background-color': "transparent", |
|
39 |
+ 'UndoButton': true |
|
40 |
+ }) |
|
41 |
+ $sigdiv.bind('change', function(e) { |
|
42 |
+ document.getElementById("hidden_<?= $this->id ?>").value = $sigdiv.jSignature("getData","default") |
|
41 | 43 |
}) |
42 |
- }) |
|
44 |
+ }); |
|
45 |
+ })(jQuery); |
|
43 | 46 |
</script> |
44 | 47 |
|
45 | 48 |
<?php $this->endblock(); ?> |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,45 @@ |
1 |
+<?php |
|
2 |
+ $GLOBALS['TL_CSS'][] = 'bundles/softleistersignatureformfield/styles.css|static'; |
|
3 |
+ $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/softleistersignatureformfield/jSignature.min.noconflict.js|static'; |
|
4 |
+ $GLOBALS['TL_JAVASCRIPT'][] = 'bundles/softleistersignatureformfield/jSignature.UndoButton.js|static'; |
|
5 |
+?> |
|
6 |
+ |
|
7 |
+<?php $this->extend('form_row'); ?> |
|
8 |
+ |
|
9 |
+<?php $this->block('label'); ?> |
|
10 |
+ <?php if ($this->label): ?> |
|
11 |
+ <label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>> |
|
12 |
+ <?php if ($this->mandatory): ?> |
|
13 |
+ <span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span> |
|
14 |
+ <?php else: ?> |
|
15 |
+ <?= $this->label ?> |
|
16 |
+ <?php endif; ?> |
|
17 |
+ </label> |
|
18 |
+ <?php endif; ?> |
|
19 |
+<?php $this->endblock(); ?> |
|
20 |
+ |
|
21 |
+<?php $this->block('field'); ?> |
|
22 |
+ <?php if ($this->hasErrors()): ?> |
|
23 |
+ <p class="error"><?= $this->getErrorAsString() ?></p> |
|
24 |
+ <?php endif; ?> |
|
25 |
+ |
|
26 |
+ <input id="hidden_<?= $this->id ?>" type="hidden" name="<?= $this->name ?>" value=""> |
|
27 |
+ <div id="signature_<?= $this->id ?>" class="canvas" style="width:<?= $this->width ?>px;height:<?= $this->height ?>px;background-color:#<?= $this->bgcolor ?>;"></div> |
|
28 |
+ <script> |
|
29 |
+ $(document).ready(function() { |
|
30 |
+ var $sigdiv = $("#signature_<?= $this->id ?>") |
|
31 |
+ $sigdiv.jSignature({ |
|
32 |
+ 'color': "#<?= $this->color ?>", |
|
33 |
+ 'lineWidth': <?= $this->pen ?>, |
|
34 |
+ 'width': '<?= $this->width ?>', |
|
35 |
+ 'height': '<?= $this->height ?>', |
|
36 |
+ 'background-color': "transparent", |
|
37 |
+ 'UndoButton': true |
|
38 |
+ }) |
|
39 |
+ $sigdiv.bind('change', function(e) { |
|
40 |
+ document.getElementById("hidden_<?= $this->id ?>").value = $sigdiv.jSignature("getData","default") |
|
41 |
+ }) |
|
42 |
+ }) |
|
43 |
+ </script> |
|
44 |
+ |
|
45 |
+<?php $this->endblock(); ?> |