|
| 1 | +<?php |
| 2 | + |
| 3 | +require_once '../includes/ajax_header.php'; |
| 4 | + |
| 5 | +$document_id = intval($_GET['id']); |
| 6 | + |
| 7 | +$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id"); |
| 8 | + |
| 9 | +$row = mysqli_fetch_array($sql); |
| 10 | +$document_name = nullable_htmlentities($row['document_name']); |
| 11 | +$document_description = nullable_htmlentities($row['document_description']); |
| 12 | +$document_content = nullable_htmlentities($row['document_content']); |
| 13 | +$document_created_by_id = intval($row['document_created_by']); |
| 14 | +$document_created_at = nullable_htmlentities($row['document_created_at']); |
| 15 | +$document_updated_at = nullable_htmlentities($row['document_updated_at']); |
| 16 | +$document_archived_at = nullable_htmlentities($row['document_archived_at']); |
| 17 | +$document_folder_id = intval($row['document_folder_id']); |
| 18 | +$document_parent = intval($row['document_parent']); |
| 19 | +$document_client_visible = intval($row['document_client_visible']); |
| 20 | +$client_id = intval($row['document_client_id']); |
| 21 | + |
| 22 | +// Generate the HTML form content using output buffering. |
| 23 | +ob_start(); |
| 24 | +?> |
| 25 | + |
| 26 | +<div class="modal-header"> |
| 27 | + <h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Editing document: <strong><?php echo $document_name; ?></strong></h5> |
| 28 | + <button type="button" class="close text-white" data-dismiss="modal"> |
| 29 | + <span>×</span> |
| 30 | + </button> |
| 31 | +</div> |
| 32 | +<form action="post.php" method="post" autocomplete="off"> |
| 33 | + <input type="hidden" name="document_id" value="<?php if($document_parent == 0){ echo $document_id; } else { echo $document_parent; } ?>"> |
| 34 | + <input type="hidden" name="document_parent" value="<?php echo $document_parent; ?>"> |
| 35 | + <input type="hidden" name="client_id" value="<?php echo $client_id; ?>"> |
| 36 | + <input type="hidden" name="created_by" value="<?php echo $document_created_by_id; ?>"> |
| 37 | + <div class="modal-body bg-white"> |
| 38 | + |
| 39 | + <div class="form-group"> |
| 40 | + <input type="text" class="form-control" name="name" maxlength="200" value="<?php echo $document_name; ?>" placeholder="Name" required> |
| 41 | + </div> |
| 42 | + |
| 43 | + <div class="form-group"> |
| 44 | + <textarea class="form-control tinymce<?php if($config_ai_enable) { echo "AI"; } ?>" id="textInput" name="content"><?php echo $document_content; ?></textarea> |
| 45 | + </div> |
| 46 | + |
| 47 | + <div class="form-group"> |
| 48 | + <div class="input-group"> |
| 49 | + <div class="input-group-prepend"> |
| 50 | + <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> |
| 51 | + </div> |
| 52 | + <select class="form-control select2" name="folder"> |
| 53 | + <option value="0">/</option> |
| 54 | + <?php |
| 55 | + $sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC"); |
| 56 | + while ($row = mysqli_fetch_array($sql_folders_select)) { |
| 57 | + $folder_id_select = intval($row['folder_id']); |
| 58 | + $folder_name_select = nullable_htmlentities($row['folder_name']); |
| 59 | + ?> |
| 60 | + <option <?php if ($folder_id_select == $document_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option> |
| 61 | + <?php |
| 62 | + } |
| 63 | + ?> |
| 64 | + </select> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + |
| 68 | + <div class="form-group"> |
| 69 | + <input type="text" class="form-control" name="description" value="<?php echo $document_description; ?>" placeholder="Short summary of changes"> |
| 70 | + </div> |
| 71 | + |
| 72 | + </div> |
| 73 | + <div class="modal-footer bg-white"> |
| 74 | + <button type="submit" name="edit_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button> |
| 75 | + <button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button> |
| 76 | + </div> |
| 77 | +</form> |
| 78 | + |
| 79 | +<?php |
| 80 | +require_once "../includes/ajax_footer.php"; |
0 commit comments