Add download button to notes
This commit is contained in:
parent
bc86fd0aa6
commit
91636b15d2
11
action.php
11
action.php
@ -57,4 +57,15 @@ switch ($VARS['action']) {
|
|||||||
}
|
}
|
||||||
$note->deleteNote();
|
$note->deleteNote();
|
||||||
returnToSender("note_deleted");
|
returnToSender("note_deleted");
|
||||||
|
case "downloadnote":
|
||||||
|
if (empty($VARS['noteid'])) {
|
||||||
|
die($Strings->get("invalid parameters", false));
|
||||||
|
}
|
||||||
|
$note = Note::loadNote($VARS['noteid']);
|
||||||
|
if (!$note->hasReadAccess(new User($_SESSION['uid']))) {
|
||||||
|
die($Strings->get("invalid parameters", false));
|
||||||
|
}
|
||||||
|
header("Content-Type: text/markdown; charset=UTF-8");
|
||||||
|
header("Content-disposition: attachment; filename=\"" . $note->getCleanTitle() . "_" . $note->getModified() . ".md\"");
|
||||||
|
echo $note->getText();
|
||||||
}
|
}
|
@ -4,5 +4,6 @@
|
|||||||
"Note": "Note",
|
"Note": "Note",
|
||||||
"Edit": "Edit",
|
"Edit": "Edit",
|
||||||
"Delete": "Delete",
|
"Delete": "Delete",
|
||||||
|
"Download": "Download",
|
||||||
"Note deleted": "Note deleted"
|
"Note deleted": "Note deleted"
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,9 @@ foreach ($notes as $note) {
|
|||||||
<a href="./app.php?page=editnote¬e=<?php echo $note->getID(); ?>" class="text-body mr-2">
|
<a href="./app.php?page=editnote¬e=<?php echo $note->getID(); ?>" class="text-body mr-2">
|
||||||
<i class="fas fa-edit"></i> <?php $Strings->get('Edit'); ?>
|
<i class="fas fa-edit"></i> <?php $Strings->get('Edit'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="./action.php?action=downloadnote¬eid=<?php echo $note->getID(); ?>" class="text-body mr-2">
|
||||||
|
<i class="fas fa-download"></i> <?php $Strings->get('Download'); ?>
|
||||||
|
</a>
|
||||||
<a href="./action.php?action=deletenote¬eid=<?php echo $note->getID(); ?>" class="text-body text-danger">
|
<a href="./action.php?action=deletenote¬eid=<?php echo $note->getID(); ?>" class="text-body text-danger">
|
||||||
<i class="fas fa-trash"></i> <?php $Strings->get('Delete'); ?>
|
<i class="fas fa-trash"></i> <?php $Strings->get('Delete'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user