Skip to content

Commit

Permalink
Add source preview in list mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaraki committed Dec 3, 2022
1 parent 7774c2a commit 15efd8f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ composer install

### Setup database

Execute `db.sql` to setup database structure.
Execute `db/db.sql` to setup database structure.

If you want to install table into database called `iwtt` by `root` user, type below command.
```shell
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion debug.rundb.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$docker_pwd = pwd.exe
docker run --rm -it -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=iwtt -v "$docker_pwd/_debugtmp/db:/var/lib/mysql" -v "$docker_pwd/db.sql:/docker-entrypoint-initdb.d/init.sql:ro" -p 3306:3306 mariadb:latest
docker run --rm -it -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=iwtt -v "$docker_pwd/_debugtmp/db:/var/lib/mysql" -v "$docker_pwd/db/db.sql:/docker-entrypoint-initdb.d/init.sql:ro" -p 3306:3306 mariadb:latest
11 changes: 10 additions & 1 deletion inspect/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@
<?php foreach ($list as $i) : ?>
<tr>
<td><?= $i['src'] ?></td>
<td><?= htmlentities($i['srcName']) ?></td>
<td>
<?= htmlentities($i['srcName']) ?>
<br />
<?php
if (isset($_GET['preview'])) {
$srvSrcPath = '/dataset/' . $tid . '/src/' . urlencode($i['srcName']);
require __DIR__ . '/../req/view_src.php';
}
?>
</td>
<td>
<pre><?= htmlentities($i['value']) ?></pre>
</td>
Expand Down
5 changes: 5 additions & 0 deletions req/view_src.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php switch ($teachInfo['type']):
case 'audio': ?>
<audio src="<?= $srvSrcPath ?>" controls></audio>
<?php break; ?>
<?php endswitch; ?>
6 changes: 1 addition & 5 deletions teach.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@
<p class="lead">Teach</p>
</div>
<div class="mb-3">
<?php switch ($teachInfo['type']):
case 'audio': ?>
<audio src="<?= $srvSrcPath ?>" controls></audio>
<?php break; ?>
<?php endswitch; ?>
<?php require __DIR__ . '/req/view_src.php'; ?>
</div>
<div>
<form action="learn.php" method="POST">
Expand Down

0 comments on commit 15efd8f

Please sign in to comment.