1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

Modal share informations on the first open

This commit is contained in:
Vincent LAURENT 2022-03-31 16:35:26 +02:00
parent 814793f847
commit 6537d1ae1c
3 changed files with 36 additions and 3 deletions

View File

@ -57,6 +57,8 @@ $f3->route('GET /signature',
$f3->route('GET /signature/@hash',
function($f3, $param) {
$f3->set('hash', $param['hash']);
$port = $f3->get('PORT');
$f3->set('shareLink', $f3->set('urlbase', $f3->get('SCHEME').'://'.$_SERVER['SERVER_NAME'].(!in_array($port,[80,443])?(':'.$port):'').$f3->get('BASE')).$f3->get('URI'));
$f3->set('maxSize', min(array(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize')))));
$f3->set('maxPage', ini_get('max_file_uploads') - 1);
@ -185,7 +187,7 @@ $f3->route('POST /share',
if(!count($files)) {
$f3->error(403);
}
$f3->reroute('/signature/'.$hash);
$f3->reroute('/signature/'.$hash."#informations");
}
);

View File

@ -938,6 +938,12 @@ var pageUpload = async function() {
}
var pageSignature = async function(url) {
if(window.location.hash == '#informations') {
let modalInformations = new bootstrap.Modal(document.getElementById('modal-share-informations'));
modalInformations.show();
}
let filename = url.replace('/pdf/', '');
document.title = filename + ' - ' + document.title;
document.getElementById('page-upload').classList.add('d-none');
@ -986,6 +992,7 @@ var pageSignature = async function(url) {
return;
}
if(window.location.hash && window.location.hash.match(/^\#http/)) {
let hashUrl = window.location.hash.replace(/^\#/, '');
pageUpload();

View File

@ -35,6 +35,7 @@
<div class="offcanvas offcanvas-end show d-none d-md-block shadow-sm" data-bs-backdrop="false" data-bs-scroll="true" data-bs-keyboard="false" tabindex="-1" id="sidebarTools" aria-labelledby="sidebarToolsLabel">
<div class="offcanvas-header mb-0 pb-0">
<h5 id="sidebarToolsLabel">Signature du PDF</h5>
<p class="text-muted"><i class="bi bi-laptop"></i> document.pdf</p>
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
@ -75,7 +76,7 @@
<form id="form_sharing" action="/share" method="post" enctype="multipart/form-data">
<input id="input_pdf_share" name="pdf" type="file" class="d-none" />
<div class="d-grid gap-2 mt-2">
<button class="btn btn-outline-secondary" type="submit" id="save"><i class="bi bi-share"></i> Partager ce PDF</button>
<button class="btn btn-outline-secondary" type="submit" id="save"><i class="bi bi-share"></i> Partager pour signature</button>
</div>
</form>
<form id="form_pdf" action="/sign" method="post" enctype="multipart/form-data">
@ -148,7 +149,30 @@
</div>
</div>
</div>
</div>
</div>
<?php if(isset($shareLink)): ?>
<div id="modal-share-informations" class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Partager la signature du PDF</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Pour permettre à une ou plusieurs personnes de signer ce PDF il suffit de partager ce lien :</p>
<div class="input-group mb-3">
<input type="text" readonly="readonly" class="form-control" value="<?php echo $shareLink ?>">
<button class="btn btn-primary" type="button" id="btn-copy-share-link"><i class="bi bi-clipboard"></i></button>
</div>
</div>
<div class="modal-footer text-start">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Fermer</button>
</div>
</div>
</div>
</div>
<?php endif; ?>
<span id="is_mobile" class="d-md-none"></span>
<script src="/vendor/bootstrap.min.js?5.1.3"></script>