Add basic create/edit/delete functionality, close #1
parent
b4ffb8f7ca
commit
407df6e228
@ -1,3 +1,6 @@
|
|||||||
[submodule "static/css/material-color"]
|
[submodule "static/css/material-color"]
|
||||||
path = static/css/material-color
|
path = static/css/material-color
|
||||||
url = https://source.netsyms.com/Netsyms/Material-Color
|
url = https://source.netsyms.com/Netsyms/Material-Color
|
||||||
|
[submodule "static/easy-markdown-editor"]
|
||||||
|
path = static/easy-markdown-editor
|
||||||
|
url = https://source.netsyms.com/Netsyms/easy-markdown-editor.git
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"New": "New",
|
"New": "New",
|
||||||
|
"New note": "New note",
|
||||||
"Note": "Note",
|
"Note": "Note",
|
||||||
"Edit": "Edit"
|
"Edit": "Edit",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"Note deleted": "Note deleted"
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$note = new Note("", "", $_SESSION['uid'], null);
|
||||||
|
|
||||||
|
if (!empty($VARS['note'])) {
|
||||||
|
try {
|
||||||
|
$note = Note::loadNote($VARS['note']);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
// It's a new note I guess
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Check for note sharing
|
||||||
|
if ($note->getOwnerID() != $_SESSION['uid']) {
|
||||||
|
header("Location: app.php?msg=no_permission");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
$note->saveNote();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form action="action.php" method="POST" id="noteform">
|
||||||
|
<textarea name="content" id="note_content"><?php echo $note->getText(); ?></textarea>
|
||||||
|
<input type="hidden" name="noteid" value="<?php echo $note->getID(); ?>" />
|
||||||
|
<input type="hidden" name="color" value="FFFFFF" />
|
||||||
|
<input type="hidden" name="action" value="savenote" />
|
||||||
|
</form>
|
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen, .CodeMirror-fullscreen {
|
||||||
|
margin-top: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview-active-side {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3551c6c003c5d382ab65d05a873f4c7d665d14a8
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var easymde = new EasyMDE({
|
||||||
|
element: $("#note_content")[0],
|
||||||
|
autoDownloadFontAwesome: false,
|
||||||
|
autofocus: true,
|
||||||
|
forceSync: true,
|
||||||
|
status: false,
|
||||||
|
toolbar: [
|
||||||
|
{
|
||||||
|
name: "save",
|
||||||
|
action: function saveNote(editor) {
|
||||||
|
$("#noteform").submit();
|
||||||
|
},
|
||||||
|
className: "fas fa-save",
|
||||||
|
title: "Save",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "exit",
|
||||||
|
action: function exit(editor) {
|
||||||
|
document.location.href = "./app.php";
|
||||||
|
},
|
||||||
|
className: "fas fa-times",
|
||||||
|
title: "Close",
|
||||||
|
},
|
||||||
|
"|",
|
||||||
|
"bold",
|
||||||
|
"italic",
|
||||||
|
"heading",
|
||||||
|
"|",
|
||||||
|
"quote",
|
||||||
|
"unordered-list",
|
||||||
|
"ordered-list",
|
||||||
|
"horizontal-rule",
|
||||||
|
"|",
|
||||||
|
"side-by-side",
|
||||||
|
"fullscreen"
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
var autosaveTimer = setInterval(function () {
|
||||||
|
$("#noteform").submit();
|
||||||
|
}, 10 * 1000);
|
Loading…
Reference in New Issue