Files
globelus.pl/templates/articles/password-view.php
2024-11-11 15:28:20 +01:00

43 lines
1.3 KiB
PHP

<div class="article-password" id="article-password-<?= $this -> article['id'];?>">
<div class="row">
<div class="col-12">
<?= \S::lang( 'ten-artykul-jest-chroniony-podaj-haslo-aby-odblokowac-zawartosc-artykulu' );?>
<form metho="POST" id="form-<?= $this -> article['id'];?>">
<input type="password" name="password" id="password-<?= $this -> article['id'];?>" required="required">
<input type="submit" class="btn btn-success" id="submit-<?= $this -> article['id'];?>" value="<?= \S::lang( 'odblokuj' );?>">
</form>
</div>
</div>
</div>
<script class="footer" type="text/javascript">
$( function()
{
$( 'body' ).on( click_event, '#submit-<?= $this -> article['id'];?>', function(e)
{
if ( $.trim( $( "#password-<?= $this -> article['id'];?>" ).val() ) !== '' )
{
e.preventDefault();
var password = $( '#password-<?= $this -> article['id'];?>' ).val();
$.ajax(
{
type: 'POST',
cache: false,
url: '/ajax.php',
data:
{
a: 'article_unlock',
password: password,
article_id: <?= $this -> article['id'];?>
},
success: function( data )
{
location.reload();
}
});
return false;
}
});
});
</script>