Files
HotLunches/page_content.php
T
2026-10-19 15:22:52 -07:00

112 lines
3.6 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
//
// Process all actions to list and edit records
//
$CurrentTable = "formatted_content";
$FormFile = "page_content.dialog.php";
$DialogWidth = 980;
$DialogHeight = 600;
$TitleText = getLanguageText('TEXT-PAGE-CONTENT-ADMINISTRATION');
$SequenceFlag = 'N';
$InsertNewRecord = 'N';
$tableAction = "page-content";
$SummerNoteFields = array('content');
$CustomDialogFields = array(
array('field_name' => 'content_id_display', 'default' => '', 'ftype' => 'form-data'),
);
// Start the template and output buffering
startTemplate();
$templatePageTitle = getLanguageText('TEXT-PAGE-CONTENT-ADMINISTRATION');
$headerArgs = "";
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Communications Administrator');
if (checkPermission($AllowedUserTypes) != 1) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
$action = '';
$naction = '';
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
exit();
}
include "form.js.php";
?>
<link href="summernote/summernote-lite.min.css" rel="stylesheet">
<script language="JavaScript" type="text/javascript" src="summernote/summernote-lite.min.js"></script>
<script src="summernote/summernote-image-attributes.js"></script>
<script src="summernote/lang/en-us.js"></script>
<?php
// form.js.php renders the dialog textarea as #dialog_<field> (page_content.dialog.php
// emits id='dialog_content'), and only ever calls .summernote('code', ...) on it --
// it never runs .summernote({...}), so the editor comes up with default options:
// no Gallery button and no upload callback. summernote.images.php supplies both and
// is already parameterised by $fieldName, so point it at the dialog's textarea.
$fieldName = 'dialog_content';
$windowHeight = 450;
include "summernote.images.php";
?>
<script>
$(document).ready(function() {
<?php // include "include/ajax.Setup.php" ?>
$.ajaxSetup({ cache: false });
$(document).on('click touch', '.reset-content', function(e) {
e.preventDefault();
var rnum = $(this).attr('rnum');
var cid = $("#content_id_"+rnum).val();
if (confirm("<?php displayLanguageText('TEXT-CONFIRM-PAGE-RESET'); ?>\n - "+cid)) {
// Reset entry
var data = "record_num="+rnum;
$.getJSON("ajax.ResetPageContent.php", data,
function(results) {
if (results.ajax_return_code == 0) alert("<?php displayLanguageText('TEXT-PAGE-HAS-BEEN-RESET'); ?>");
else alert("<?php displayLanguageText('ERRORMSG-UNABLE-TO-COMPLETE-ACTION'); ?>");
}
);
}
});
// $('#dialog_content').summernote({
// height: 550,
// toolbar: [
// ['style', ['style']],
// ['font', ['bold', 'underline', 'clear']],
// ['fontname', ['fontname']],
// ['fontSize', ['fontsize']],
// ['color', ['color']],
// ['para', ['ul', 'ol', 'paragraph']],
// ['table', ['table']],
// ['insert', ['link', 'picture', 'video']],
// ['view', ['fullscreen', 'codeview', 'help']],
// ]
// });
});
</script>
</script>
<?php
endTemplate();
?>