You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
4.9 KiB
PHP
136 lines
4.9 KiB
PHP
<?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/. */
|
|
|
|
$noteids = $database->select('notes', 'noteid', ['ownerid' => $_SESSION['uid'], 'ORDER' => ['favorite' => "DESC"]]);
|
|
|
|
$notes = [];
|
|
|
|
foreach ($noteids as $n) {
|
|
$notes[] = Note::loadNote($n);
|
|
}
|
|
?>
|
|
|
|
<style nonce="<?php echo $SECURE_NONCE; ?>">
|
|
<?php
|
|
$colors = [
|
|
"F44336",
|
|
"F06292",
|
|
"AB47BC",
|
|
"7E57C2",
|
|
"5C6BC0",
|
|
"42A5F5",
|
|
"03A9F4",
|
|
"00BCD4",
|
|
"26A69A",
|
|
"4CAF50",
|
|
"8BC34A",
|
|
"CDDC39",
|
|
"FFF176",
|
|
"FFC107",
|
|
//"FFA726",
|
|
"FF7043",
|
|
"E64A19",
|
|
"795548",
|
|
"9E9E9E",
|
|
//"78909C",
|
|
"000000",
|
|
"FFFFFF",
|
|
];
|
|
|
|
foreach ($notes as $note) {
|
|
echo "#notecard_" . $note->getID() . ", #notecard_" . $note->getID() . " a {\n"
|
|
. " background-color: #" . $note->getColor() . ";\n"
|
|
. " color: #" . $note->getTextColor() . ";\n"
|
|
. " border: 1px solid #" . $note->getColor() . ";\n"
|
|
. "}\n";
|
|
}
|
|
|
|
foreach ($colors as $c) {
|
|
echo ".bg_$c {\n"
|
|
. " background-color: #$c !important;\n"
|
|
. " border: 1px solid #$c !important;\n"
|
|
. "}\n";
|
|
}
|
|
?>
|
|
</style>
|
|
|
|
<div class="btn-group mb-4">
|
|
<a href="app.php?page=editnote" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("New note"); ?></a>
|
|
</div>
|
|
|
|
<div class="row" id="grid">
|
|
|
|
<?php
|
|
foreach ($notes as $note) {
|
|
?>
|
|
<div class="grid__brick col-12 col-sm-6 col-md-6 col-lg-4">
|
|
<div class="card notecard mb-3" data-color="<?php echo $note->getColor(); ?>" id="notecard_<?php echo $note->getID(); ?>" data-note="<?php echo $note->getID(); ?>">
|
|
<div class="card-body">
|
|
<div class="float-right">
|
|
<a href="./action.php?action=favoritenote¬eid=<?php echo $note->getID(); ?>" class="favorite-btn mr-2 <?php echo $note->getFavorite() ? "text-warning" : ""; ?>" data-toggle="tooltip" title="<?php $Strings->get("Favorite"); ?>">
|
|
<i class="fa<?php echo $note->getFavorite() ? "s" : "r"; ?> fa-star"></i>
|
|
</a>
|
|
<a class="color-btn" data-toggle="tooltip" title="<?php $Strings->get("Set color"); ?>" data-color="<?php echo $note->getColor(); ?>" data-noteid="<?php echo $note->getID(); ?>">
|
|
<i class="fas fa-palette"></i>
|
|
</a>
|
|
</div>
|
|
<div class="card-text note-text">
|
|
<?php echo $note->getHTML(); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-footer">
|
|
<a href="./app.php?page=editnote¬e=<?php echo $note->getID(); ?>" class="mr-2">
|
|
<i class="fas fa-edit"></i> <?php $Strings->get('Edit'); ?>
|
|
</a>
|
|
<a href="./action.php?action=downloadnote¬eid=<?php echo $note->getID(); ?>" class="mr-2">
|
|
<i class="fas fa-download"></i> <?php $Strings->get('Download'); ?>
|
|
</a>
|
|
<a href="./action.php?action=deletenote¬eid=<?php echo $note->getID(); ?>">
|
|
<i class="fas fa-trash"></i> <?php $Strings->get('Delete'); ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<div class="col-1 sizer-element"></div>
|
|
|
|
</div>
|
|
|
|
<div class="modal fade" tabindex="-1" role="dialog" id="colormodal">
|
|
<div class="modal-dialog" role="document">
|
|
<form class="modal-content" action="action.php" method="POST">
|
|
<input type="hidden" name="action" value="setcolor" />
|
|
<input type="hidden" name="source" value="home" />
|
|
<input type="hidden" name="noteid" value="" />
|
|
<input type="hidden" name="color" value="FFFFFF" />
|
|
<div class="modal-header">
|
|
<h5 class="modal-title"><?php $Strings->get("Set color"); ?></h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="d-flex flex-wrap justify-content-center">
|
|
<?php
|
|
foreach ($colors as $c) {
|
|
?>
|
|
<button type="submit" name="color" value="<?php echo $c; ?>" class="btn bg_<?php echo $c; ?> m-1">
|
|
|
|
</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php $Strings->get("Cancel"); ?></button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|