forked from oat-sa/extension-pcisample
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
737 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: TAO 2021.10\n" | ||
"PO-Revision-Date: 2021-11-29T18:00:52\n" | ||
"Project-Id-Version: TAO 2021.11\n" | ||
"PO-Revision-Date: 2022-02-15T09:44:49\n" | ||
"Last-Translator: TAO Translation Team <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
"Language: ja-JP\n" | ||
|
@@ -14,25 +14,25 @@ msgstr "" | |
"X-Poedit-SearchPath-0: .\n" | ||
|
||
msgid "Add page" | ||
msgstr "" | ||
msgstr "ページ追加" | ||
|
||
msgid "Allow multi pages" | ||
msgstr "" | ||
msgstr "マルチページ" | ||
|
||
msgid "Bottom" | ||
msgstr "" | ||
msgstr "下部" | ||
|
||
msgid "Button based" | ||
msgstr "" | ||
msgstr "ボタン" | ||
|
||
msgid "Button labels" | ||
msgstr "" | ||
msgstr "ボタンラベル" | ||
|
||
msgid "Button labels." | ||
msgstr "" | ||
msgstr "ボタンラベル." | ||
|
||
msgid "Columns:" | ||
msgstr "" | ||
msgstr "カラム:" | ||
|
||
msgid "Delete" | ||
msgstr "" | ||
|
@@ -41,28 +41,31 @@ msgid "Display" | |
msgstr "" | ||
|
||
msgid "If this box is checked the text reader will allow to display more than one page and to navigate between them." | ||
msgstr "" | ||
msgstr "このボックスをチェックすると、テキストリーダーで複数のページを表示したり、ページ間を移動したりすることができます。" | ||
|
||
msgid "Left" | ||
msgstr "" | ||
|
||
msgid "Navigation" | ||
msgstr "" | ||
msgstr "ナビゲーション" | ||
|
||
msgid "Navigation." | ||
msgstr "" | ||
msgstr "ナビゲーション." | ||
|
||
msgid "Next" | ||
msgstr "" | ||
|
||
msgid "Page" | ||
msgstr "" | ||
|
||
msgid "page %d column %d" | ||
msgstr "ページ %d カラム %d" | ||
|
||
msgid "Page height (px)" | ||
msgstr "" | ||
msgstr "ページ高さ (px)" | ||
|
||
msgid "Page height (px)." | ||
msgstr "" | ||
msgstr "ページ高さ (px)." | ||
|
||
msgid "Previous" | ||
msgstr "" | ||
|
@@ -74,16 +77,16 @@ msgid "Right" | |
msgstr "" | ||
|
||
msgid "Tab based" | ||
msgstr "" | ||
msgstr "タブ" | ||
|
||
msgid "Tabs + buttons" | ||
msgstr "" | ||
msgstr "タブ + ボタン" | ||
|
||
msgid "Tabs position" | ||
msgstr "" | ||
msgstr "タブ位置" | ||
|
||
msgid "Tabs position." | ||
msgstr "" | ||
msgstr "タブ位置." | ||
|
||
msgid "Tooltips" | ||
msgstr "" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\pciSamples\migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\Exception\IrreversibleMigration; | ||
use oat\qtiItemPci\model\IMSPciModel; | ||
use oat\tao\scripts\tools\migrations\AbstractMigration; | ||
use oat\pciSamples\scripts\install\RegisterPciTextReaderIMS; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version202201111538504106_pciSamples extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Fix text reader PCI destroy lifecycle'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$registry = (new IMSPciModel())->getRegistry(); | ||
if ($registry->has('textReaderInteraction')) { | ||
$registry->removeAllVersions('textReaderInteraction'); | ||
} | ||
$this->addReport( | ||
$this->propagate(new RegisterPciTextReaderIMS())(['1.1.1']) | ||
); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
throw new IrreversibleMigration( | ||
sprintf( | ||
'In order to undo this migration, please revert the client-side changes and run %s', | ||
RegisterPciTextReaderIMS::class | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\pciSamples\migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\Exception\IrreversibleMigration; | ||
use oat\pciSamples\scripts\install\RegisterPciTextReaderIMS; | ||
use oat\pciSamples\scripts\install\RegisterPciTextReaderOAT; | ||
use oat\qtiItemPci\model\IMSPciModel; | ||
use oat\qtiItemPci\model\PciModel; | ||
use oat\tao\scripts\tools\migrations\AbstractMigration; | ||
use oat\taoQtiItem\model\portableElement\action\RegisterPortableElement; | ||
use oat\taoQtiItem\model\portableElement\model\PortableElementModel; | ||
|
||
final class Version202203161157144106_pciSamples extends AbstractMigration | ||
{ | ||
private const RESTORED_PORTABLE_ELEMENT_IDENTIFIER = 'textReaderInteraction'; | ||
private const RESTORED_OAT_PORTABLE_ELEMENT_VERSION = '0.9.0'; | ||
private const RESTORED_IMS_PORTABLE_ELEMENT_VERSION = '1.1.1'; | ||
|
||
public function getDescription(): string | ||
{ | ||
return sprintf( | ||
'Restore PciModel of `%s` versions `%s`', | ||
self::RESTORED_PORTABLE_ELEMENT_IDENTIFIER, | ||
implode( | ||
', ', | ||
[self::RESTORED_OAT_PORTABLE_ELEMENT_VERSION, self::RESTORED_IMS_PORTABLE_ELEMENT_VERSION] | ||
) | ||
); | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->restoreInteraction( | ||
new PciModel(), | ||
new RegisterPciTextReaderOAT(), | ||
self::RESTORED_OAT_PORTABLE_ELEMENT_VERSION | ||
); | ||
$this->restoreInteraction( | ||
new IMSPciModel(), | ||
new RegisterPciTextReaderIMS(), | ||
self::RESTORED_IMS_PORTABLE_ELEMENT_VERSION | ||
); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
throw new IrreversibleMigration(); | ||
} | ||
|
||
private function restoreInteraction( | ||
PortableElementModel $model, | ||
RegisterPortableElement $registerPortableElement, | ||
string $version | ||
): void { | ||
$registry = $model->getRegistry(); | ||
if ($registry->has('textReaderInteraction')) { | ||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
$registry->removeAllVersions('textReaderInteraction'); | ||
} | ||
|
||
$this->addReport( | ||
$this->propagate($registerPortableElement)([$version]) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?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) 2022 (original work) Open Assessment Technologies SA; | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\pciSamples\model\LegacyPciHelper; | ||
|
||
use oat\oatbox\filesystem\Directory; | ||
use oat\taoMediaManager\model\fileManagement\FileManagement; | ||
use oat\taoMediaManager\model\MediaSource; | ||
|
||
class ImageToPropertiesHelper | ||
{ | ||
/** @var MediaSource */ | ||
private $mediaSource; | ||
|
||
/** @var FileManagement */ | ||
private $fileManagement; | ||
|
||
public function __construct(MediaSource $mediaSource, FileManagement $fileManagement) | ||
{ | ||
$this->mediaSource = $mediaSource; | ||
$this->fileManagement = $fileManagement; | ||
} | ||
|
||
public function addImagesToProperties(array $images, array $properties, Directory $itemDirectory): array | ||
{ | ||
foreach ($images as $image) { | ||
if ($this->isImageMediaManager($image['fileName'])) { | ||
$fileInfo = $this->mediaSource->getFileInfo($image['fileName']); | ||
$properties = $this->addBase64Image( | ||
$properties, | ||
$image['fileName'], | ||
$this->fileManagement->getFileStream( | ||
$fileInfo['link'] | ||
)->read(1024 * 8) | ||
); | ||
continue; | ||
} | ||
$properties = $this->addBase64Image( | ||
$properties, | ||
$image['fileName'], | ||
$itemDirectory->getFile($image['fileName'])->read() | ||
); | ||
} | ||
|
||
return $properties; | ||
} | ||
|
||
private function addBase64Image(array $properties, string $fileName, string $image): array | ||
{ | ||
$properties['content-' . $fileName] = sprintf( | ||
"data:image/png;base64,%s", | ||
base64_encode($image) | ||
); | ||
|
||
return $properties; | ||
} | ||
|
||
private function isImageMediaManager(string $fileName): bool | ||
{ | ||
return false !== strpos($fileName, 'taomedia://'); | ||
} | ||
} |
Oops, something went wrong.