change gui use combobox to select action
This commit is contained in:
parent
ccd63ea392
commit
74d2c4f86d
49
index.php
49
index.php
|
@ -46,23 +46,30 @@
|
||||||
|
|
||||||
echo '<div><a accesskey="h" href="' . $root . '">home</a></div><br>';
|
echo '<div><a accesskey="h" href="' . $root . '">home</a></div><br>';
|
||||||
|
|
||||||
if (isset($_POST['savebutton']))
|
$action = '';
|
||||||
|
if (isset($_POST['action'])) $action = $_POST['action'];
|
||||||
|
else if (isset($_GET['action'])) $action = $_GET['action'];
|
||||||
|
|
||||||
|
$param = '';
|
||||||
|
if (isset($_GET['param'])) $param = $_GET['param'];
|
||||||
|
|
||||||
|
if ($action == 'save')
|
||||||
{
|
{
|
||||||
$title = $_POST['title'];
|
$title = $_POST['title'];
|
||||||
$content = $_POST['content'];
|
$content = $_POST['content'];
|
||||||
file_put_contents($dir . '/' . $title, $content);
|
file_put_contents($dir . '/' . $title, $content);
|
||||||
$_GET['openaction'] = true;
|
$action = 'open';
|
||||||
$_GET['userdata'] = $title;
|
$param = $title;
|
||||||
}
|
}
|
||||||
else if (isset($_POST['deletebutton']))
|
else if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$title = $_POST['title'];
|
$title = $_POST['title'];
|
||||||
rename($dir . '/' . $title, $dir . '/' . $title . '.del');
|
rename($dir . '/' . $title, $dir . '/' . $title . '.del');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['openaction']))
|
if ($action == 'open')
|
||||||
{
|
{
|
||||||
$title = $_GET['userdata'];
|
$title = $param;
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
if (!file_exists($dir . '/' . $title))
|
if (!file_exists($dir . '/' . $title))
|
||||||
|
@ -78,8 +85,11 @@
|
||||||
|
|
||||||
echo '<form action="index.php" method="POST">
|
echo '<form action="index.php" method="POST">
|
||||||
<div>
|
<div>
|
||||||
<input type="submit" name="savebutton" value="save" accesskey="s">
|
<select name="action">
|
||||||
<input accesskey="d" type="submit" name="deletebutton" value="delete">
|
<option value="save">save</option>
|
||||||
|
<option value="delete">delete</option>
|
||||||
|
</select>
|
||||||
|
<input type="submit" name="go" value="go" accesskey="g">
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div><input class="title" name="title" value="' . $title . '"></div><br>
|
<div><input class="title" name="title" value="' . $title . '"></div><br>
|
||||||
|
@ -91,15 +101,18 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$defaulttitle = date("Y-m-d H.i.s", time());
|
$defaulttitle = date("Y-m-d H.i.s", time());
|
||||||
if (isset($_GET['userdata']))
|
if ($param)
|
||||||
{
|
{
|
||||||
$defaulttitle = $_GET['userdata'];
|
$defaulttitle = $param;
|
||||||
}
|
}
|
||||||
echo '<form action="index.php" method="GET">
|
echo '<form action="index.php" method="GET">
|
||||||
<input list="notes" name="userdata" value="' . $defaulttitle . '">
|
<input name="param" value="' . $defaulttitle . '">
|
||||||
<input accesskey="n" type="submit" name="openaction" value="open">
|
<select name="action">
|
||||||
<input accesskey="f" type="submit" name="filteraction" value="filter">
|
<option value="open">open</option>
|
||||||
<input accesskey="g" type="submit" name="searchaction" value="search">
|
<option value="filter">filter</option>
|
||||||
|
<option value="search">search</option>
|
||||||
|
</select>
|
||||||
|
<input accesskey="g" type="submit" value="go">
|
||||||
</form>';
|
</form>';
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
|
|
||||||
|
@ -113,17 +126,17 @@
|
||||||
{
|
{
|
||||||
$name = basename($path);
|
$name = basename($path);
|
||||||
if (!str_ends_with($name, '.del')
|
if (!str_ends_with($name, '.del')
|
||||||
&& (!isset($_GET['filteraction']) || str_contains($name, $_GET['userdata'])))
|
&& ($action != 'filter' || str_contains($name, $param)))
|
||||||
{
|
{
|
||||||
if (isset($_GET['searchaction']))
|
if ($action == 'search')
|
||||||
{
|
{
|
||||||
$content = file_get_contents($path);
|
$content = file_get_contents($path);
|
||||||
if (!str_contains($content, $_GET['userdata']))
|
if (!str_contains($content, $param))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<div><a href=index.php?openaction&userdata=' . urlencode($name) . '>' . $name .'</a></div>';
|
echo '<div><a href=index.php?action=open¶m=' . urlencode($name) . '>' . $name .'</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
|
|
Loading…
Reference in New Issue