Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: story filter by project #140

Merged
merged 4 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/Http/Controllers/StoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function index(Request $request): JsonResponse
$queryColumns = [
'RecordId' => 'RecordId',
'DcTitle' => 'dc:title',
'ProjectId' => 'ProjectId',
'DatasetId' => 'DatasetId',
'StoryId' => 'StoryId'
];
Expand Down
22 changes: 11 additions & 11 deletions src/public/adminer/adminer.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ tbody tr:hover th {
background: none;
}

table:not(.checkable) th {
min-width: 120px;
}

thead td,
thead th {
background: #34567c;
Expand Down Expand Up @@ -140,8 +136,8 @@ table.checkable tbody tr:hover th {
background: #bfb008;
}

.odd th,
.odd td {
.odds tbody tr:nth-child(2n) th,
.odds tbody tr:nth-child(2n) td {
background: #f5f5f5;
}

Expand Down Expand Up @@ -270,7 +266,7 @@ p code + a:visited:hover {

#menu #dbs {
background: #fff;
padding: 0 15px 15px;
padding: 0;
border: 1px solid #dae8fa;
border-bottom: 0;
box-sizing: border-box;
Expand All @@ -280,7 +276,6 @@ p code + a:visited:hover {
#menu #dbs select {
outline: 0;
border-color: rgba(0, 0, 0, 0.1);
width: 100%;
}

#menu p.links {
Expand Down Expand Up @@ -310,6 +305,11 @@ p code + a:visited:hover {
color: #000;
}

.tables-filter {
padding: 0;
margin-top: 32px;
}

#content p.links {
margin: -10px 0 15px;
}
Expand Down Expand Up @@ -522,7 +522,7 @@ input.default {
select {
box-sizing: border-box;
margin: 0;
padding: 6px 0;
padding: 6px;
border: 1px solid #bbbbbb;
}

Expand Down Expand Up @@ -652,11 +652,11 @@ label {
.logout {
display: none;
}

#breadcrumb {
position: static;
}

#content {
margin: 0;
}
Expand Down
2,068 changes: 1,450 additions & 618 deletions src/public/adminer/adminer.php

Large diffs are not rendered by default.

38 changes: 21 additions & 17 deletions src/public/adminer/index.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
<?php

namespace Adminer;

function adminer_object() {
// required to run any plugin
include_once "./plugins/plugin.php";
// required to run any plugin
include_once "./plugins/plugin.php";

// autoloader
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}
// autoloader
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}

// enable extra drivers just by including them
//~ include "./plugins/drivers/simpledb.php";
// enable extra drivers just by including them
//~ include "./plugins/drivers/simpledb.php";

$plugins = array(
// specify enabled plugins here
);
$plugins = array(
// specify enabled plugins here
// new AdminerJsonColumn(),
// new AdminerPrettyJsonColumn(),
);

/* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin {
}
return new AdminerCustomization($plugins);
*/
/* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin {
}
return new AdminerCustomization($plugins);
*/

return new AdminerPlugin($plugins);
return new AdminerPlugin($plugins);
}

// include original Adminer or Adminer Editor
Expand Down
59 changes: 33 additions & 26 deletions src/public/adminer/plugins/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,57 @@
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerPlugin extends Adminer {
class AdminerPlugin extends Adminer\Adminer {
/** @access protected */
var $plugins;

function _findRootClass($class) { // is_subclass_of(string, string) is available since PHP 5.0.3
do {
$return = $class;
} while ($class = get_parent_class($class));
return $return;
}


/** Register plugins
* @param array object instances or null to register all classes starting by 'Adminer'
*/
function __construct($plugins) {
if ($plugins === null) {
$plugins = array();
foreach (get_declared_classes() as $class) {
if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { //! can use interface
if (preg_match('~^Adminer\w~i', $class) && !is_subclass_of($class, 'Adminer\Adminer')) {
$plugins[$class] = new $class;
}
}
}
$this->plugins = $plugins;
//! it is possible to use ReflectionObject to find out which plugins defines which methods at once
}

function _callParent($function, $args) {
return call_user_func_array(array('parent', $function), $args);
}

function _applyPlugin($function, $args) {
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
switch (count($args)) { // call_user_func_array() doesn't work well with references
case 0: $return = $plugin->$function(); break;
case 1: $return = $plugin->$function($args[0]); break;
case 2: $return = $plugin->$function($args[0], $args[1]); break;
case 3: $return = $plugin->$function($args[0], $args[1], $args[2]); break;
case 4: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3]); break;
case 5: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4]); break;
case 6: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); break;
default: trigger_error('Too many parameters.', E_USER_WARNING);
case 0:
$return = $plugin->$function();
break;
case 1:
$return = $plugin->$function($args[0]);
break;
case 2:
$return = $plugin->$function($args[0], $args[1]);
break;
case 3:
$return = $plugin->$function($args[0], $args[1], $args[2]);
break;
case 4:
$return = $plugin->$function($args[0], $args[1], $args[2], $args[3]);
break;
case 5:
$return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4]);
break;
case 6:
$return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
break;
default:
trigger_error('Too many parameters.', E_USER_WARNING);
}
if ($return !== null) {
return $return;
Expand All @@ -57,7 +65,7 @@ function _applyPlugin($function, $args) {
}
return $this->_callParent($function, $args);
}

function _appendPlugin($function, $args) {
$return = $this->_callParent($function, $args);
foreach ($this->plugins as $plugin) {
Expand All @@ -70,14 +78,14 @@ function _appendPlugin($function, $args) {
}
return $return;
}

// appendPlugin

function dumpFormat() {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
}

function dumpOutput() {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
Expand All @@ -94,7 +102,7 @@ function editFunctions($field) {
}

// applyPlugin

function name() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
Expand Down Expand Up @@ -404,5 +412,4 @@ function tablesPrint($tables) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}

}
2 changes: 1 addition & 1 deletion src/storage/api-docs/api-docs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.1.1

info:
version: 1.57.1
version: 1.58.0
title: Transcribathon Platform API v2
description: This is the documentation of the Transcribathon API v2 used by [https:transcribathon.eu](https://transcribathon.eu/).<br />
For authorization you can use the the bearer token you are provided with.
Expand Down
5 changes: 5 additions & 0 deletions src/storage/api-docs/stories-path.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ get:
description: Show entries associated with this title in the DC section
schema:
type: string
- in: query
name: ProjectId
description: Show entries associated with this ProjectId
schema:
type: string
- in: query
name: DatasetId
description: Show entries associated with this DatasetId
Expand Down