pub / rememori

Simple file-based bookmarking and notes application
git clone https://src.jayvii.de/pub/rememori.git
Home | Log | Files | Exports | Refs | README | RSS

commit c2c706ceddbd026bfd8e89b48c8776a9e05ba7f6
parent 55154c7fb0522d9c2c28b377613767fa4232492b
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Fri, 25 Oct 2024 14:56:54 +0200

feat: if link is present in first line of note, use anchor in list

Diffstat:
Mlib/list.php | 30++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/lib/list.php b/lib/list.php @@ -20,8 +20,13 @@ function list_notes( array_push( $filenames, array( - "name" => basename($filename), - "time" => filectime($filename) + "name" => preg_replace( + "/\.txt$/", + "", + basename($filename) + ), + "time" => filectime($filename), + "link" => link_in_first_line($filename) ) ); } @@ -31,7 +36,7 @@ function list_notes( ?> - <h3><?php echo $category; ?></h3> + <h4><?php echo $category; ?></h4> <table> <thead> <tr> @@ -51,8 +56,21 @@ function list_notes( ?> <tr> - <!-- 1st column: filename --> - <td><?php echo $filename["name"]; ?></td> + <!-- 1st column: filename including URL if applicable --> + <td> +<?php + /* if first line of */ + if ($filename["link"] !== false) { +?> + <a href="<?php echo $filename["link"]; ?>" target="_blank"> + <?php echo $filename["name"]; ?> + </a> +<?php + } else { + echo $filename["name"]; + } +?> + </td> <!-- 2nd column: edit time --> <td><?php echo date("Y-m-d H:i:s", $filename["time"]); ?></td> <!-- 3rd columne:form with edit-button --> @@ -74,7 +92,7 @@ function list_notes( id="filename" name="filename" type="hidden" - value="<?php echo $filename["name"]; ?>" + value="<?php echo $filename["name"] . ".txt"; ?>" > <input id="action"