<?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 = [
// Pastel colors
"EF9A9A", // red
"FFCC80", // orange
"FFF59D", // yellow
"E6EE9C", // lime
"A5D6A7", // green
"80CBC4", // teal
"81D4FA", // light blue
"90CAF9", // blue
"B39DDB", // purple
"F48FB1", // pink
// Bright colors
"F44336", // red
"FF9800", // orange
"FFEB3B", // yellow
"8BC34A", // light green
"4CAF50", // green
"009688", // teal
"03A9F4", // light blue
"2196F3", // blue
"673AB7", // purple
"E91E63", // pink
// Other colors
"FFFFFF", // white
"E0E0E0", // pastel gray
"9E9E9E", // gray
"BCAAA4", // pastel brown
"795548", // brown
"000000", // black
];
foreach ($notes as $note) {
echo "#notecard_" . $note->getID() . ", #notecard_" . $note->getID() . " .card-body a {\n"
. " background-color: #" . $note->getColor() . ";\n"
. " color: #" . $note->getTextColor() . ";\n"
. " border: 1px solid #" . $note->getColor() . ";\n"
. "}\n";
echo "#notecard_" . $note->getID() . " .card-footer a {\n"
. " color: #" . $note->getTextColor() . ";\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=newnote" class = "btn btn-success" >< i class = "fas fa-plus" ></ i > <?php $Strings -> get ( "New note" ); ?> </ a >
< a href = "app.php?page=home" class = "btn btn-light" >< i class = "fas fa-sync-alt" ></ i > <?php $Strings -> get ( "Refresh" ); ?> </ 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 pb-4 pt-1" >
< div class = "card notecard" data-color = " <?php echo $note -> getColor (); ?> " id = "notecard_ <?php echo $note -> getID (); ?> " data-note = " <?php echo $note -> getID (); ?> " >
< div class = "card-body notecard-click2open" >
< div class = "float-right" >
< a href = "./action.php?action=favoritenote¬eid= <?php echo $note -> getID (); ?> " class = "favorite-btn pr-1" data-toggle = "tooltip" title = " <?php $Strings -> get ( "Favorite" ); ?> " >
<?php
if ($note->getFavorite()) {
?>
< i class = "fas fa-star fa-fw" > < / i >
<?php
} else {
?>
< i class = "far fa-star fa-fw" > < / i >
<?php
}
?>
< / a >
< / div >
< div class = "card-text note-text" >
<?php echo $note -> getHTML (); ?>
< / div >
< / div >
< div class = "card-footer" >
< div class = "d-flex justify-content-around flex-wrap" >
< div >
< a class = "px-2 py-2" href = "./app.php?page=editnote¬e= <?php echo $note -> getID (); ?> " data-toggle = "tooltip" title = " <?php $Strings -> get ( 'Edit' ); ?> " >
< i class = "fas fa-edit" ></ i > < noscript > <?php $Strings -> get ( 'Edit' ); ?> </ noscript >
< / a >
< / div >
< div class = "d-none yesscript" >
< a class = "px-2 py-2" href = "./action.php?action=maketodolist¬eid= <?php echo $note -> getID (); ?> " data-toggle = "tooltip" title = " <?php $Strings -> get ( "Make a List" ); ?> " data-noteid = " <?php echo $note -> getID (); ?> " >
< i class = "fas fa-tasks" > < / i >
< / a >
< / div >
< div class = "d-none yesscript" >
< a class = "px-2 py-2 color-btn" href = "#" 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 >
< noscript >
< div >
< a class = "px-2 py-2" href = "./action.php?action=downloadnote¬eid= <?php echo $note -> getID (); ?> " data-toggle = "tooltip" title = " <?php $Strings -> get ( 'Download' ); ?> " >
< i class = "fas fa-download" ></ i > <?php $Strings -> get ( 'Download' ); ?>
< / a >
< / div >
< div >
< a class = "px-2 py-2" href = "./action.php?action=deletenote¬eid= <?php echo $note -> getID (); ?> " data-toggle = "tooltip" title = " <?php $Strings -> get ( 'Delete' ); ?> " >
< i class = "fas fa-trash" ></ i > <?php $Strings -> get ( 'Delete' ); ?>
< / a >
< / div >
< / noscript >
< div class = "dropdown" >
< span data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" data-offset = "0,-70" >
< a class = "p-2" href = "#" id = "moreoptionsbtn_ <?php echo $note -> getID (); ?> " data-tooltip = "tooltip" title = " <?php $Strings -> get ( 'More' ); ?> " >
< i class = "fas fa-ellipsis-v" > < / i >
< / a >
< / span >
< div class = "dropdown-menu dropdown-menu-right" aria-labelledby = "moreoptionsbtn_ <?php echo $note -> getID (); ?> " >
<!--<h4 class="dropdown-header"> <?php $Strings -> get ( "More Options" ); ?> </h4>-->
< a class = "dropdown-item" href = "./action.php?action=deletenote¬eid= <?php echo $note -> getID (); ?> " >
< i class = "fas fa-trash fa-fw" ></ i > <?php $Strings -> get ( 'Delete' ); ?>
< / a >
< div class = "dropdown-divider" > < / div >
< h4 class = "dropdown-header" >< i class = "fas fa-cloud-download-alt fa-fw" ></ i > <?php $Strings -> get ( 'Download' ); ?> </ h4 >
< div class = "dropdown-item d-flex justify-content-between" >
< a class = "p-2" href = "./action.php?action=downloadnote¬eid= <?php echo $note -> getID (); ?> &type=markdown" >
< i class = "fas fa-align-left" ></ i > <?php $Strings -> get ( 'Text' ); ?>
< / a >
< a class = "p-2" href = "./action.php?action=downloadnote¬eid= <?php echo $note -> getID (); ?> &type=html" >
< i class = "fab fa-html5" ></ i > <?php $Strings -> get ( 'HTML' ); ?>
< / a >
<?php
// Additional export formats
if (PANDOC_BIN != "") {
?>
< a class = "p-2" href = "./action.php?action=downloadnote¬eid= <?php echo $note -> getID (); ?> &type=odt" >
< i class = "fas fa-file-alt" ></ i > <?php $Strings -> get ( 'Office' ); ?>
< / a >
<?php
} else {
// Fillin' space
?>
< span class = "px-4" > < / span >
<?php
}
?>
< / div >
< / div >
< / div >
< / div >
< / 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" >< i class = "fas fa-palette" ></ i > <?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 >