change default new note name

added autocomplete
This commit is contained in:
quenousimporte 2024-02-14 18:04:29 +01:00
parent d007101e08
commit 4fd592ceb3
1 changed files with 9 additions and 6 deletions

View File

@ -88,8 +88,8 @@
else
{
echo '<form action="index.php" method="GET">
<input name="open" value="' . time() . '">
<input accesskey="n" type="submit" value="create new">
<input list="notes" name="open" value="' . date("Y-m-d H.i.s", time()) . '">
<input accesskey="n" type="submit" value="open">
</form>';
echo '<br>';
@ -99,15 +99,18 @@
return filemtime($b) - filemtime($a);
});
$autocomplete = '<datalist id="notes">';
foreach($files as $path)
{
if (!str_ends_with($path, '.del'))
$name = basename($path);
if (!str_ends_with($name, '.del'))
{
$name = basename($path);
$mod = date("F d Y H:i:s", filemtime($path));
echo '<div>' . $mod . '&nbsp;<a href=index.php?open=' . urlencode($name) . '>' . $name .'</a></div>';
$autocomplete .= '<option value="' . $name . '">';
echo '<div><a href=index.php?open=' . urlencode($name) . '>' . $name .'</a></div>';
}
}
$autocomplete .= '</datalist>';
echo $autocomplete;
echo '<br>';
}
?>