Merge branch 'main' of http://git.pb.bib.de/PBBFA23CIV/EIANotesApp
This commit is contained in:
@@ -2,6 +2,16 @@
|
||||
use ppa\Model\NotesModel;
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
|
||||
//// Test write permissions
|
||||
//// This is the directory we will upload files to.
|
||||
//$uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/';
|
||||
//if (!file_exists($uploadDir)) {
|
||||
// mkdir($uploadDir, 0777, true);
|
||||
//}
|
||||
//$testFile = $uploadDir . 'test_write.txt';
|
||||
//$testContent = 'Test write operation at ' . date('Y-m-d H:i:s');
|
||||
//$writeResult = file_put_contents($testFile, $testContent);
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
$parsedown->setSafeMode(true);
|
||||
|
||||
@@ -26,12 +36,16 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
|
||||
|
||||
<div class="page-header">
|
||||
<h2>Create New Note</h2>
|
||||
<a href="?controller=Notes&page=showNotes&do=showNotes" class="button secondary">Cancel</a>
|
||||
<a href="?controller=Notes&page=showNotes&do=showNotes" class="button secondary">Cancel</a>
|
||||
</div>
|
||||
|
||||
<label class="error-message"><?php if (isset($errmsg)):?>
|
||||
<?php echo $errmsg;?>
|
||||
<?php endif; ?></label>
|
||||
|
||||
<div id="drop-zone">Drag & drop a .txt or .md file here, or fill manually.</div>
|
||||
|
||||
<form id="note-form" method="POST">
|
||||
<form id="note-form" method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="action" value="create_note">
|
||||
<div class="form-group">
|
||||
<label for="title">Title:</label>
|
||||
@@ -55,6 +69,12 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
|
||||
<option value="3">HIGH</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="attachments">Attach Files:</label>
|
||||
<input type="file" id="attachments" name="attachments[]" multiple>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="button">Create Note</button>
|
||||
</div>
|
||||
@@ -62,4 +82,4 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
|
||||
<input type="hidden" name="do" value="createNote">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
@@ -15,6 +15,8 @@ if (!$note) {
|
||||
echo "<a href='?controller=Notes&page=showNotes&do=showNotes' class='button secondary'>Back to Dashboard</a>";
|
||||
}
|
||||
|
||||
$files = $this->notesModel->getUploadedFiles($noteId);
|
||||
|
||||
function isLoggedIn() {
|
||||
return isset($_SESSION['user_id']);
|
||||
}
|
||||
@@ -37,7 +39,7 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
|
||||
|
||||
<div id="drop-zone">Drag & drop a .txt or .md file here, or fill manually.</div>
|
||||
|
||||
<form id="note-form" method="POST">
|
||||
<form id="note-form" method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="action" value="update_note">
|
||||
<input type="hidden" name="note_id" value="<?php echo sanitize($note['id']); ?>">
|
||||
<div class="form-group">
|
||||
@@ -62,11 +64,26 @@ function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {
|
||||
<option value="3">HIGH</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="attachments">Attach additional Files:</label>
|
||||
<input type="file" id="attachments" name="attachments[]" multiple>
|
||||
</div>
|
||||
<?php if($files && count($files) > 0): ?>
|
||||
<div class="form-group">
|
||||
<label>Files currently attached:</label>
|
||||
<ul>
|
||||
<?php foreach($files as $file): ?>
|
||||
<li>
|
||||
<a href="/EIANotesApp/Uploads/<?php echo $file['stored_filename']; ?>" download target="_blank"><?php echo htmlspecialchars($file['original_filename']); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="button">Update Note</button>
|
||||
</div>
|
||||
<input type="hidden" name="controller" value="Notes">
|
||||
<input type="hidden" name="do" value="editNote">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
@@ -3,6 +3,9 @@
|
||||
<?php
|
||||
$parsedown = new Parsedown();
|
||||
$parsedown->setSafeMode(true);
|
||||
|
||||
$this->notesModel = new \ppa\Model\NotesModel();
|
||||
$files = $this->notesModel->getUploadedFiles($note['id']);
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
@@ -24,6 +27,19 @@ $parsedown->setSafeMode(true);
|
||||
<?php echo $parsedown->text($note['content'] ?? ''); ?>
|
||||
</div>
|
||||
|
||||
<div class="note-files">
|
||||
<?php if (isset($files) && count($files) > 0): ?>
|
||||
<h3>Attached Files:</h3>
|
||||
<ul>
|
||||
<?php foreach ($files as $file): ?>
|
||||
<li>
|
||||
<a href="/EIANotesApp/Uploads/<?php echo $file['stored_filename']; ?>" download target="_blank"><?php echo htmlspecialchars($file['original_filename']); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="note-actions">
|
||||
<a href="?controller=Notes&page=showNotes&do=showNotes" class="button">Back to Notes</a>
|
||||
<?php if (isset($note['id'])): ?>
|
||||
|
@@ -25,6 +25,10 @@
|
||||
<a href="?controller=Notes&do=createNote" class="button">Create New Note</a>
|
||||
</div>
|
||||
|
||||
<?php if (isset($errmsg)): ?>
|
||||
<label class="error-message"><?php echo $errmsg; ?></label>
|
||||
<?php endif; ?>
|
||||
|
||||
<table class="notes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user