2015-05-05 03:00:01 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2015-10-19 00:45:58 +02:00
|
|
|
echo '<script>'.PHP_EOL;
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2015-10-19 00:45:58 +02:00
|
|
|
echo 'var HTML_PATH_ROOT = "'.HTML_PATH_ROOT.'";'.PHP_EOL;
|
|
|
|
echo 'var HTML_PATH_ADMIN_ROOT = "'.HTML_PATH_ADMIN_ROOT.'";'.PHP_EOL;
|
|
|
|
echo 'var HTML_PATH_ADMIN_THEME = "'.HTML_PATH_ADMIN_THEME.'";'.PHP_EOL;
|
2015-11-04 01:28:11 +01:00
|
|
|
echo 'var HTML_PATH_UPLOADS = "'.HTML_PATH_UPLOADS.'";'.PHP_EOL;
|
2015-12-28 23:28:42 +01:00
|
|
|
echo 'var HTML_PATH_UPLOADS_THUMBNAILS = "'.HTML_PATH_UPLOADS_THUMBNAILS.'";'.PHP_EOL;
|
2017-07-13 00:44:39 +02:00
|
|
|
echo 'var PARENT = "'.PARENT.'";'.PHP_EOL;
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2016-09-26 04:57:11 +02:00
|
|
|
echo 'var tokenCSRF = "'.$Security->getTokenCSRF().'";'.PHP_EOL;
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
echo '</script>';
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
var ajaxRequest;
|
|
|
|
|
2017-07-13 22:39:04 +02:00
|
|
|
function generateSlug(text, parentKey, currentKey, writeResponse) {
|
2015-05-05 03:00:01 +02:00
|
|
|
if(ajaxRequest) {
|
|
|
|
ajaxRequest.abort();
|
|
|
|
}
|
|
|
|
|
2017-07-13 22:39:04 +02:00
|
|
|
ajaxRequest = $.ajax({
|
|
|
|
type: "POST",
|
|
|
|
data: {
|
|
|
|
tokenCSRF: tokenCSRF,
|
|
|
|
text: text,
|
|
|
|
parentKey: parentKey,
|
|
|
|
currentKey: currentKey
|
|
|
|
},
|
|
|
|
url: "<?php echo HTML_PATH_ADMIN_ROOT.'ajax/slug' ?>"
|
|
|
|
});
|
2015-05-05 03:00:01 +02:00
|
|
|
|
|
|
|
// Callback handler that will be called on success
|
|
|
|
ajaxRequest.done(function (response, textStatus, jqXHR){
|
|
|
|
writeResponse.val(response["slug"]);
|
|
|
|
console.log("DEBUG: AJAX Done function");
|
|
|
|
});
|
|
|
|
|
|
|
|
// Callback handler that will be called on failure
|
|
|
|
ajaxRequest.fail(function (jqXHR, textStatus, errorThrown){
|
|
|
|
console.log("DEBUG: AJAX error function");
|
|
|
|
});
|
|
|
|
|
|
|
|
// Callback handler that will be called regardless
|
|
|
|
// if the request failed or succeeded
|
|
|
|
ajaxRequest.always(function () {
|
|
|
|
console.log("DEBUG: AJAX always function");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-26 04:57:11 +02:00
|
|
|
</script>
|