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/hkd 6/integration #4099

Merged
merged 168 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
20e4c74
chore: document README.md
gabrielfs7 Sep 4, 2024
48ff6bb
feat: adding base classes for translation
gabrielfs7 Sep 4, 2024
24fb952
chore: fix di injection
gabrielfs7 Sep 4, 2024
15769eb
feat: adding ACL for new endpoints and handling request
gabrielfs7 Sep 4, 2024
e752f58
chore: add unit tests and prepare code to extract data based on resou…
gabrielfs7 Sep 4, 2024
7fbbf13
chore: add list of translation types
shpran Sep 5, 2024
f9a2eca
chore: move props to tao-core
shpran Sep 5, 2024
6e1dc20
chore: change property values ID
shpran Sep 5, 2024
75ec984
chore: rename property
shpran Sep 5, 2024
01d50c2
chore: move domains to their extensions
shpran Sep 5, 2024
1276114
chore: document translation process metadata
gabrielfs7 Sep 5, 2024
086cc22
chore: document translation metadata
gabrielfs7 Sep 5, 2024
0ef1330
feat: add all translation status in response based on metadata
gabrielfs7 Sep 5, 2024
5820d20
chore: move classes to proper namespaces
gabrielfs7 Sep 6, 2024
1738870
chore: move constants to ontology
gabrielfs7 Sep 6, 2024
b7fdee0
feat: add new endpoint to get master unit and increase contract output
gabrielfs7 Sep 6, 2024
9bc1a32
chore: adding unit tests
gabrielfs7 Sep 6, 2024
05944c8
chore: adding unit tests
gabrielfs7 Sep 6, 2024
c866e86
feat: add possibility to hide button in tree by path and feature flag
gabrielfs7 Sep 9, 2024
41375eb
feat: implement form modifiers, make uniq id readonly
shpran Sep 9, 2024
bf4f835
chore: add dynamic metadata, so it can be extended later
gabrielfs7 Sep 10, 2024
3f03ed5
Merge branch 'feat/ADF-1781/translations-feature' of https://github.c…
gabrielfs7 Sep 10, 2024
58c3acc
feat: add custom metadata for resources
gabrielfs7 Sep 10, 2024
f75c3be
chore: add abstract modifier with ontology to avoid code duplications…
shpran Sep 10, 2024
b50c1de
chore: simplify entities and make them agnostic
gabrielfs7 Sep 10, 2024
8e0232a
Merge branch 'feat/ADF-1781/translations-feature' of https://github.c…
gabrielfs7 Sep 10, 2024
4a92817
chore: simplify entities and make them agnostic
gabrielfs7 Sep 10, 2024
b93da9f
chore: use unique ids and parent classes ids instead
gabrielfs7 Sep 10, 2024
1a91a2d
chore: use proxies instead of manager
shpran Sep 10, 2024
613eeab
chore: add unit tests
gabrielfs7 Sep 10, 2024
052c54e
chore: add unit tests
gabrielfs7 Sep 10, 2024
b3e2fdb
chore: remove syntax error
gabrielfs7 Sep 11, 2024
9056d64
chore: fix cs
gabrielfs7 Sep 11, 2024
0c23fb8
chore: add unit tests
gabrielfs7 Sep 11, 2024
f1a4ee5
chore: add api documentation
gabrielfs7 Sep 11, 2024
7c082f7
chore: add unit tests for modifier
shpran Sep 11, 2024
85c4fe8
chore: add setValue and setElementValue method to forms
shpran Sep 11, 2024
6bbba71
feat: introduce property aliases
shpran Sep 11, 2024
3de82d2
feat: add possibility to translate resources agnostically
gabrielfs7 Sep 11, 2024
49e0242
chore: add missing php docs
gabrielfs7 Sep 12, 2024
c4dd57d
Merge pull request #4098 from oat-sa/feat/ADF-1783/translate-resources
gabrielfs7 Sep 12, 2024
35148cf
chore: remove tmp code
gabrielfs7 Sep 12, 2024
c5c81d6
fix: avoid duplicate properties
gabrielfs7 Sep 12, 2024
debed91
feat: make endpoints only require resource id or locale to work
gabrielfs7 Sep 12, 2024
c9d15a3
chore: add missing unit tests cs fixes
gabrielfs7 Sep 12, 2024
d8d7ae6
chore: remove rules from non-translator user
gabrielfs7 Sep 12, 2024
6315e5d
chore: add PR suggestions
gabrielfs7 Sep 12, 2024
965f4ea
chore: allow update translation status
gabrielfs7 Sep 12, 2024
c5003fa
chore: fix cs
shpran Sep 13, 2024
8789fa7
fix: add extra validation and allow multiple uniqueIds search
gabrielfs7 Sep 13, 2024
5c86a48
chore: update unit tests
gabrielfs7 Sep 13, 2024
03d8a29
chore: can only translate original resource
gabrielfs7 Sep 13, 2024
804ac95
chore: add language prefix to tao ontology
shpran Sep 13, 2024
2623693
fix: validate the only ready for translate resources are translated
gabrielfs7 Sep 13, 2024
314ef31
Merge branch 'feat/ADF-1781/translations-feature' of https://github.c…
gabrielfs7 Sep 13, 2024
f4709bf
Merge pull request #4094 from oat-sa/feat/ADF-1781/translations-feature
gabrielfs7 Sep 13, 2024
61a0778
fix: provide related origin resource
shpran Sep 13, 2024
4496b9f
chore: extract property creation
shpran Sep 13, 2024
f889f52
chore: use standard feature flag name
gabrielfs7 Sep 16, 2024
a7bec35
chore: use standard feature flag name
gabrielfs7 Sep 16, 2024
90c6773
fix: add access to GlobalManager to translate
gabrielfs7 Sep 16, 2024
8d47352
feat: create translatable test
shpran Sep 17, 2024
83f8322
chore: use original resource URI and locale to find translations
shpran Sep 17, 2024
7886ff5
chore: add better property query and unit tests
gabrielfs7 Sep 18, 2024
ff855c0
Merge branch 'feat/HKD-6/integration' of https://github.com/oat-sa/ta…
shpran Sep 18, 2024
6840635
chore: add new metadata to link original resource
gabrielfs7 Sep 18, 2024
e9d53cf
feat: add service connectors for the translation API
jsconan Sep 18, 2024
a8b9668
chore: refactor to not use uniqueid anymore
gabrielfs7 Sep 18, 2024
616140f
chore: fix entity, command, query tests
gabrielfs7 Sep 18, 2024
d1d2a7f
chore: fix unit tests
gabrielfs7 Sep 18, 2024
3fe39bf
Merge branch 'feat/HKD-6/integration' of https://github.com/oat-sa/ta…
shpran Sep 18, 2024
9dff876
chore: extract unique ID confiuration to new form modifier, make poss…
shpran Sep 18, 2024
e97dc2c
chore: fix unit tests, fix typo in repo
shpran Sep 19, 2024
50343ad
Merge pull request #4100 from oat-sa/feature/ADF-1787/translatable-test
gabrielfs7 Sep 19, 2024
4548215
chore: add unit tests
gabrielfs7 Sep 19, 2024
f9ebe7d
chore: update tao-core-ui to branch feature/ADF-1782/styled-datatable…
jsconan Sep 19, 2024
9aa84ff
feat: add a form component for managing a list of translations for a …
jsconan Sep 19, 2024
bc84f6f
Merge branch 'feat/HKD-6/integration' into feature/ADF-1782/translati…
jsconan Sep 19, 2024
4c5c3bd
feat: style the translation form
jsconan Sep 19, 2024
40cf0b8
fix: wording for the translation form
jsconan Sep 19, 2024
7081cad
refactor: improve the state handling for the translation form
jsconan Sep 19, 2024
febefcc
fix: align the button in the translation form
jsconan Sep 19, 2024
33936f9
chore: hide translation items from the UI
gabrielfs7 Sep 19, 2024
0422e6e
fix: remove the extraneous padding around the translation form header
jsconan Sep 19, 2024
9598755
chore: allow to index readonly properties
gabrielfs7 Sep 20, 2024
fa9d566
chore: remove from form type
gabrielfs7 Sep 20, 2024
2632d42
fix: bundling issue due to the spread operator used for objects
jsconan Sep 20, 2024
9008e5d
chore: remove extraneous parenthesis
jsconan Sep 20, 2024
24fb311
feat: ignore search translations
gabrielfs7 Sep 20, 2024
727b6e5
chore: add script to populate translation properties, hide origin URI…
shpran Sep 20, 2024
784944a
test: unit test the translation form
jsconan Sep 20, 2024
7e24e4e
fix: better create/update the list of transltstion in the translation…
jsconan Sep 20, 2024
0e48a09
test: remove unused config mock
jsconan Sep 23, 2024
086b5e9
chore: update tao-core-ui to version 3.8.0
jsconan Sep 23, 2024
b486549
Merge branch 'feat/HKD-6/integration' into feature/ADF-1782/translati…
jsconan Sep 23, 2024
e0ea9d7
refactor: convert to ES6
jsconan Sep 23, 2024
e8375f6
Merge pull request #4101 from oat-sa/feature/ADF-1782/translation-lis…
jsconan Sep 24, 2024
dd1ed26
feat: accept extra parameters for the launchEditor action
jsconan Sep 24, 2024
c406e49
Merge branch 'feat/HKD-6/integration' into feature/ADF-1784/side-by-s…
jsconan Sep 24, 2024
a2f711e
chore: use recursive queries + multiple inserts with transaction
shpran Sep 24, 2024
4eae147
chore: fix docblock
shpran Sep 24, 2024
e96349a
fix: wrong value for the resourceUri in the translation services
jsconan Sep 25, 2024
51d9b40
feat: add the UI for deleting a translation
jsconan Sep 25, 2024
386188f
feat: add an option for allowing to delete a translation
jsconan Sep 25, 2024
95c41b3
chore: use language retriever to use QTI language for items if it pre…
shpran Sep 25, 2024
e9e18b8
Merge branch 'feat/HKD-6/integration' into feature/ADF-1784/side-by-s…
jsconan Sep 25, 2024
be8d554
feat: add possibility to delete translations
gabrielfs7 Oct 3, 2024
cf5b9c0
Merge pull request #4108 from oat-sa/feat/ADF-1804/add-possibility-de…
gabrielfs7 Oct 3, 2024
8b7eee2
chore: update unique id label
gabrielfs7 Oct 7, 2024
4beae21
Merge branch 'feat/HKD-6/integration' into feature/ADF-1784/side-by-s…
jsconan Oct 8, 2024
c001a21
chore: merge develop
gabrielfs7 Oct 9, 2024
b267ed0
feat: add API to update the translations and get information about pr…
jsconan Oct 10, 2024
dc78b40
fix: add the missing language parameter to the delete action
jsconan Oct 10, 2024
d415d18
feat: add a confirmation dialog before triggering the delete translat…
jsconan Oct 10, 2024
3fdd14d
feat: add a refresh action
jsconan Oct 10, 2024
ede0c4d
feat: add API for getting the language for each translation resource
jsconan Oct 10, 2024
6973e5c
Merge branch 'feat/HKD-6/integration' into feature/ADF-1784/side-by-s…
jsconan Oct 11, 2024
947ca0e
Merge pull request #4116 from oat-sa/feature/ADF-1784/side-by-side-au…
jsconan Oct 14, 2024
f2654cd
chore: bundle the assets
jsconan Oct 15, 2024
fa56845
fix: do not copy unique identifier + copy language and other metadata…
gabrielfs7 Oct 24, 2024
1eb9cc2
feat: support querying for multiple resources when listing the transl…
jsconan Oct 24, 2024
5427651
feat: add support for querying multiple resource for the translations…
jsconan Oct 24, 2024
b4f4f7a
fix: parameters order mismatch in the translation helper
jsconan Oct 24, 2024
c67d9a4
fix: translation instances cannot be copied
gabrielfs7 Oct 25, 2024
6ac6e62
fix: delete linked translations when deleting master item
gabrielfs7 Oct 25, 2024
d9eb1ab
chore: only filter item tree by tests or items
gabrielfs7 Oct 28, 2024
9aba5cb
Merge pull request #4119 from oat-sa/feature/ADF-1789/side-by-side-au…
jsconan Oct 30, 2024
f057995
chore: remove comment
gabrielfs7 Oct 30, 2024
8bad497
feat: manage the list of translations at runtime from the translation…
jsconan Oct 30, 2024
0f46ace
feat: add method to check if a locale is RTL
gabrielfs7 Oct 30, 2024
aa430b8
Merge branch 'feat/HKD-6/integration' into fix/ADF-1789/small-issues
jsconan Oct 30, 2024
895779c
fix: discard the origin resource language from the list of languages …
jsconan Oct 30, 2024
3ca5379
chore: bundle the assets
jsconan Oct 30, 2024
df4a780
Merge pull request #4120 from oat-sa/fix/ADF-1789/small-issues
jsconan Oct 31, 2024
8fd52e3
feat: add a service action for synchronizing translations
jsconan Nov 4, 2024
ad1d640
Merge pull request #4122 from oat-sa/feature/ADF-1789/sync-items-tran…
jsconan Nov 4, 2024
ef9f68d
Merge branch 'develop' into feat/HKD-6/integration
jsconan Nov 4, 2024
5e697f2
chore: bundle the assets
jsconan Nov 4, 2024
40c7c02
fix: bypass import error for literal
gabrielfs7 Nov 4, 2024
6effcae
feat: better handling for unique IDs
shpran Nov 4, 2024
c9ffd24
chore: fixes
shpran Nov 5, 2024
d96bae7
chore: use new service to clone
gabrielfs7 Nov 5, 2024
b3d0e1f
Merge pull request #4123 from oat-sa/feat/adf-1802/unique-identifier
gabrielfs7 Nov 5, 2024
9cb6e07
fix: do not allow to export translations
gabrielfs7 Nov 5, 2024
5ff8c40
fix: unique identifiers
shpran Nov 6, 2024
0d3b601
chore: fix SecureResourceService tests
gabrielfs7 Nov 6, 2024
58bf96a
chore: refactor
shpran Nov 6, 2024
f640dff
fix: require both FF to be enabled
shpran Nov 6, 2024
801481f
chore: fix variable name
shpran Nov 6, 2024
9f385e6
Merge pull request #4124 from oat-sa/fix/hkd-6/unique-identifiers
shpran Nov 6, 2024
2b07f9d
chore: fix unit tests
gabrielfs7 Nov 6, 2024
0fda5d6
chore: fix unit tests
gabrielfs7 Nov 6, 2024
bc427be
chore: fix unit tests
gabrielfs7 Nov 6, 2024
bf0cf78
chore: fix TranslationFromModifierTest
shpran Nov 6, 2024
02554a3
chore: fix unit tests
gabrielfs7 Nov 6, 2024
a35388b
Merge branch 'feat/HKD-6/integration' of https://github.com/oat-sa/ta…
gabrielfs7 Nov 6, 2024
36ccfe1
chore: add unit tests
shpran Nov 6, 2024
094800e
chore: add license blocks, add unit test for numeric ID generator
shpran Nov 6, 2024
8638c1e
chore: beautify identifier generator proxy, add unit tests
shpran Nov 6, 2024
7fd1ac8
chore: add unit tests for form modifier
shpran Nov 6, 2024
659f59d
chore: fix php cs
shpran Nov 11, 2024
c2e8ce2
chore: fix cs
shpran Nov 11, 2024
9ce2a8b
chore: use dev branch
shpran Nov 11, 2024
68542c5
chore: make data provider public
shpran Nov 11, 2024
23e9abe
chore: fix namespace
shpran Nov 11, 2024
71ea990
chore: use existing generis alias instead of new
shpran Nov 11, 2024
21cd312
test: fix broken unit tests in the translation form
jsconan Nov 11, 2024
4cb787d
chore: update composer with release
shpran Nov 11, 2024
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Here you can find the environment variables including feature flags
| DATA_STORE_STATISTIC_PUB_SUB_TOPIC | Topic name for statistic metadata Pub/Sub | - |
| REDIRECT_AFTER_LOGOUT_URL | Allows to configure the redirect after logout via environment variable. The fallback is the configured redirect on urlroute.conf.php | - |
| PORTAL_URL | The Portal url used on the back button of Portal theme | - |
| FEATURE_FLAG_TRANSLATION_ENABLED | Enable access to items/tests translations feature | - |


# Routing
Expand Down
19 changes: 17 additions & 2 deletions actions/class.Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,13 @@ private function getSections($shownExtension, $shownStructure)
$sections = [];
$user = $this->getSession()->getUser();
$structure = MenuService::getPerspective($shownExtension, $shownStructure);
$sectionVisibilityFilter = $this->getSectionVisibilityFilter();

if (!is_null($structure)) {
foreach ($structure->getChildren() as $section) {
$resolver = new ActionResolver($section->getUrl());

if (!$this->getSectionVisibilityFilter()->isVisible($section->getId())) {
if (!$sectionVisibilityFilter->isVisible($section->getId())) {
continue;
}

Expand All @@ -540,6 +542,19 @@ private function getSections($shownExtension, $shownStructure)

if (FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())) {
foreach ($section->getActions() as $action) {
$sectionPath = $sectionVisibilityFilter->createSectionPath(
[
$section->getId(),
$action->getId()
]
);

if (!$sectionVisibilityFilter->isVisible($sectionPath)) {
$section->removeAction($action);

continue;
}

$this->propagate($action);
$resolver = new ActionResolver($action->getUrl());
if (
Expand Down Expand Up @@ -580,7 +595,7 @@ protected function getUserService()
return $this->getServiceLocator()->get(tao_models_classes_UserService::SERVICE_ID);
}

private function getSectionVisibilityFilter(): SectionVisibilityFilterInterface
private function getSectionVisibilityFilter(): SectionVisibilityFilter
{
if (empty($this->sectionVisibilityFilter)) {
$this->sectionVisibilityFilter = $this->getServiceLocator()->get(SectionVisibilityFilter::SERVICE_ID);
Expand Down
168 changes: 168 additions & 0 deletions actions/class.Translation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2024 (original work) Open Assessment Technologies SA;
*/

declare(strict_types=1);

use oat\tao\model\http\HttpJsonResponseTrait;
use oat\tao\model\Translation\Command\UpdateTranslationCommand;
use oat\tao\model\Translation\Service\ResourceTranslationRetriever;
use oat\tao\model\Translation\Service\ResourceTranslatableRetriever;
use oat\tao\model\Translation\Service\TranslationCreationService;
use oat\tao\model\Translation\Service\TranslationDeletionService;
use oat\tao\model\Translation\Service\TranslationSyncService;
use oat\tao\model\Translation\Service\TranslationUpdateService;

class tao_actions_Translation extends tao_actions_CommonModule
{
use HttpJsonResponseTrait;

/**
* @requiresRight id WRITE
*/
public function update(): void
{
try {
$resource = $this->getTranslationUpdateService()->update(
new UpdateTranslationCommand(
$this->getRequestParameter('id'),
$this->getRequestParameter('progress'),
)
);

$this->setSuccessJsonResponse(
[
'resourceUri' => $resource->getUri()
]
);
} catch (Throwable $exception) {
$this->setErrorJsonResponse($exception->getMessage());
}
}

/**
* @requiresRight id WRITE
*/
public function delete(): void
{
try {
$resource = $this->getTranslationDeletionService()->deleteByRequest($this->getPsrRequest());

$this->setSuccessJsonResponse(
[
'resourceUri' => $resource->getUri()
]
);
} catch (Throwable $exception) {
$this->setErrorJsonResponse($exception->getMessage());
}
}

/**
* @requiresRight id WRITE
*/
public function translate(): void
{
try {
$newResource = $this->getTranslationCreationService()->createByRequest($this->getPsrRequest());

$this->setSuccessJsonResponse(
[
'resourceUri' => $newResource->getUri()
]
);
} catch (Throwable $exception) {
$this->setErrorJsonResponse($exception->getMessage());
}
}

/**
* @requiresRight id READ
*/
public function translations(): void
{
try {
$this->setSuccessJsonResponse(
$this->getResourceTranslationRetriever()->getByRequest($this->getPsrRequest())
);
} catch (Throwable $exception) {
$this->setErrorJsonResponse($exception->getMessage());
}
}

/**
* @requiresRight id READ
*/
public function translatable(): void
{
try {
$this->setSuccessJsonResponse(
$this->getResourceTranslatableRetriever()->getByRequest($this->getPsrRequest())
);
} catch (Throwable $exception) {
$this->setErrorJsonResponse($exception->getMessage());
}
}

/**
* @requiresRight id WRITE
*/
public function sync(): void
{
try {
$test = $this->getTranslationSyncService()->syncByRequest($this->getPsrRequest());

$this->setSuccessJsonResponse([
'resourceUri' => $test->getUri(),
]);
} catch (Throwable $exception) {
$this->setErrorJsonResponse($exception->getMessage());
}
}

private function getResourceTranslationRetriever(): ResourceTranslationRetriever
{
return $this->getPsrContainer()->get(ResourceTranslationRetriever::class);
}

private function getResourceTranslatableRetriever(): ResourceTranslatableRetriever
{
return $this->getPsrContainer()->get(ResourceTranslatableRetriever::class);
}

private function getTranslationCreationService(): TranslationCreationService
{
return $this->getPsrContainer()->get(TranslationCreationService::class);
}

private function getTranslationUpdateService(): TranslationUpdateService
{
return $this->getPsrContainer()->get(TranslationUpdateService::class);
}

private function getTranslationSyncService(): TranslationSyncService
{
return $this->getPsrContainer()->get(TranslationSyncService::class);
}

private function getTranslationDeletionService(): TranslationDeletionService
{
return $this->getPsrContainer()->get(TranslationDeletionService::class);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"oat-sa/jig": "~0.2",
"oat-sa/composer-npm-bridge": "~0.4.2||dev-master",
"oat-sa/oatbox-extension-installer": "~1.1||dev-master",
"oat-sa/generis": ">=15.36.4",
"oat-sa/generis": ">=15.39.0",
"composer/package-versions-deprecated": "^1.11",
"paragonie/random_compat": "^2.0",
"phpdocumentor/reflection-docblock": "^5.2",
Expand Down
Loading
Loading