drop tags feature
This commit is contained in:
parent
084c27653b
commit
ffc90cf9fa
1
home.php
1
home.php
|
@ -2,7 +2,6 @@
|
||||||
<div>
|
<div>
|
||||||
<input hidden type="submit" name="search" value="search" accesskey="s">
|
<input hidden type="submit" name="search" value="search" accesskey="s">
|
||||||
<input type="submit" name="open" value="open" accesskey="o">
|
<input type="submit" name="open" value="open" accesskey="o">
|
||||||
<input type="submit" name="tags" value="tags" accesskey="t">
|
|
||||||
<input type="submit" name="clip" value="clip" accesskey="c">
|
<input type="submit" name="clip" value="clip" accesskey="c">
|
||||||
<input type="submit" name="download" value="download" accesskey="d">
|
<input type="submit" name="download" value="download" accesskey="d">
|
||||||
<br>
|
<br>
|
||||||
|
|
28
index.php
28
index.php
|
@ -255,19 +255,13 @@
|
||||||
|
|
||||||
foreach($_SESSION['index'] as $path)
|
foreach($_SESSION['index'] as $path)
|
||||||
{
|
{
|
||||||
$tags = '';
|
|
||||||
$name = basename($path);
|
$name = basename($path);
|
||||||
if (!str_ends_with($name, '.del'))
|
if (!str_ends_with($name, '.del'))
|
||||||
{
|
{
|
||||||
if (($_GET['param'] && isset($_GET['search'])) || isset($_GET['tags']))
|
if (($_GET['param'] && isset($_GET['search'])))
|
||||||
{
|
{
|
||||||
$content = file_get_contents($path . '.md');
|
$content = file_get_contents($path . '.md');
|
||||||
if (
|
if (isset($_GET['search']) && !str_contains(cleanstring($content), cleanstring($param)) && !str_contains(cleanstring($name), cleanstring($param)))
|
||||||
// param does not match content or title
|
|
||||||
(isset($_GET['search']) && !str_contains(cleanstring($content), cleanstring($param)) && !str_contains(cleanstring($name), cleanstring($param))) ||
|
|
||||||
// param does not match tags
|
|
||||||
(isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content))
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -278,23 +272,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
||||||
if (isset($content) && isset($_GET['tags']))
|
if (isset($_GET['search']) && str_contains(cleanstring($content), cleanstring($param)))
|
||||||
{
|
|
||||||
$tags = array();
|
|
||||||
$hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
|
|
||||||
if ($hastags)
|
|
||||||
{
|
|
||||||
$tagslist = explode(',', $tags[0][1]);
|
|
||||||
echo '<span class="grey"> ';
|
|
||||||
foreach ($tagslist as $tag)
|
|
||||||
{
|
|
||||||
$tag = trim($tag);
|
|
||||||
echo('<a class="grey" href="index.php?tags=true¶m=' . $tag . '">' . $tag . '</a> ');
|
|
||||||
}
|
|
||||||
echo '</span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isset($_GET['search']) && str_contains(cleanstring($content), cleanstring($param)))
|
|
||||||
{
|
{
|
||||||
$pos = strpos(cleanstring($content), cleanstring($param));
|
$pos = strpos(cleanstring($content), cleanstring($param));
|
||||||
echo '<span class="grey"> ' . $param . substr($content, $pos + strlen($param), 42) . '</span>';
|
echo '<span class="grey"> ' . $param . substr($content, $pos + strlen($param), 42) . '</span>';
|
||||||
|
|
|
@ -14,7 +14,6 @@ No javascript.
|
||||||
|------------------------|----------------------------------|-------------------------------|--------|
|
|------------------------|----------------------------------|-------------------------------|--------|
|
||||||
| search (default action)| full text search | reload home | alt-s |
|
| search (default action)| full text search | reload home | alt-s |
|
||||||
| open | open if exists, or create | create with timestamp as title| alt-o |
|
| open | open if exists, or create | create with timestamp as title| alt-o |
|
||||||
| tag | filter list by tag | show all tags in list | alt-t |
|
|
||||||
| clip | insert in todo | | alt-c |
|
| clip | insert in todo | | alt-c |
|
||||||
| download | download all notes in a zip file | | alt-d |
|
| download | download all notes in a zip file | | alt-d |
|
||||||
|
|
||||||
|
@ -27,14 +26,9 @@ No javascript.
|
||||||
| stats | save and show stats | alt-i |
|
| stats | save and show stats | alt-i |
|
||||||
| delete | delete (rename as .del) | alt-d |
|
| delete | delete (rename as .del) | alt-d |
|
||||||
|
|
||||||
| On list | action |
|
|
||||||
|------------------------|--------------------------|
|
|
||||||
| clic on tag | filter list by tag (home with tags+param) |
|
|
||||||
|
|
||||||
| Url params | action |
|
| Url params | action |
|
||||||
|------------------------|--------------------------|
|
|------------------------|--------------------------|
|
||||||
| reindex | force notes reindex |
|
| reindex | force notes reindex |
|
||||||
| clip+param | same as button |
|
| clip+param | same as button |
|
||||||
| open+param | same as button |
|
| open+param | same as button |
|
||||||
| tags+param | same as button |
|
|
||||||
| search+param | same as button |
|
| search+param | same as button |
|
Loading…
Reference in New Issue