Skip to content

Commit

Permalink
Update to 3.3.0
Browse files Browse the repository at this point in the history
- Add a menu entry/button to create multiple translations in selectable contexts
- Include a possible scrollbar height in the context grid height
- [#204] New event when TV values have been synchronized
- Add an option to link a new created translation with all existing translations
- [#202] Fix synchronized TVs never triggered
- Don't change the parent of a new linked resource to a folder
  • Loading branch information
Jako committed Mar 27, 2024
1 parent d351700 commit 8b5826d
Show file tree
Hide file tree
Showing 59 changed files with 1,130 additions and 495 deletions.
11 changes: 6 additions & 5 deletions _build/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"lowCaseName": "babel",
"description": "The easy way for your multilingual site!",
"author": "Jakob Class, Rico Goldsky, Joshua Luckers, Thomas Jakobi",
"version": "3.2.0",
"version": "3.3.0",
"package": {
"menus": [
{
Expand Down Expand Up @@ -171,15 +171,16 @@
"readme": "docs/readme.md",
"license": "docs/license.md",
"changelog": "docs/changelog.md",
"setupOptions": {
"source": "setup.options.php"
},
"resolver": {
"after": [
"resolve.setupoptions.php",
"resolve.permissions.php",
"resolve.babelevents.php"
"resolve.babelevents.php",
"resolve.treehillstudio.php"
]
},
"setupOptions": {
"source": "setup.options.php"
}
}
}
3 changes: 2 additions & 1 deletion _build/resolvers/resolve.babelevents.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ function removeEvent(modX $modx, $name)
$babelEvents = [
'OnBabelDuplicate', // invoked on duplicating the resource in a new language context
'OnBabelLink', // invoked on link the resource with a target resource
'OnBabelUnlink' // invoked on unlink the resource from a target resource
'OnBabelUnlink', // invoked on unlink the resource from a target resource
'OnBabelTVSynced' // invoked when TVs are synchronized and changed
];

$success = true;
Expand Down
107 changes: 107 additions & 0 deletions _build/resolvers/resolve.treehillstudio.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php
/**
* Resolves install statistics
*
* @package glossary
* @subpackage build
*
* @var array $options
* @var xPDOObject $object
* @var xPDOTransport $transport
*/

$url = 'https://treehillstudio.com/extras/package/statistics';
$params = [];

/** @var xPDO $modx */
$modx =& $object->xpdo;
$c = $modx->newQuery('transport.modTransportPackage');
$c->where(
[
'workspace' => 1,
"(SELECT
`signature`
FROM {$modx->getTableName('transport.modTransportPackage')} AS `latestPackage`
WHERE `latestPackage`.`package_name` = `modTransportPackage`.`package_name`
ORDER BY
`latestPackage`.`version_major` DESC,
`latestPackage`.`version_minor` DESC,
`latestPackage`.`version_patch` DESC,
IF(`release` = '' OR `release` = 'ga' OR `release` = 'pl','z',`release`) DESC,
`latestPackage`.`release_index` DESC
LIMIT 1,1) = `modTransportPackage`.`signature`",
]
);
$c->where(
[
'modTransportPackage.signature:LIKE' => $options['namespace'] . '-%',
'modTransportPackage.installed:IS NOT' => null
]
);
$c->limit(1);

/** @var modTransportPackage $oldPackage */
$oldPackage = $modx->getObject('transport.modTransportPackage', $c);

$oldVersion = '';
if ($oldPackage) {
$oldVersion = $oldPackage->get('version_major') .
'.' . $oldPackage->get('version_minor') .
'.' . $oldPackage->get('version_patch') .
'-' . $oldPackage->get('release');
}

$version = '';
if ($transport->version) {
$version = $transport->version;
}

$modxVersionObj = $modx->getObject('modSystemSetting', ['key' => 'settings_version']);
$modxVersion = ($modxVersionObj) ? $modxVersionObj->get('value') : '';
$managerLang = $modx->getOption('manager_language');

$action = '';
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
$action = 'install';
break;
case xPDOTransport::ACTION_UPGRADE:
$action = 'upgrade';
break;
case xPDOTransport::ACTION_UNINSTALL:
$action = 'uninstall';
break;
}

$params = [
'name' => $options['namespace'],
'uuid' => $modx->uuid ?? 'unknown',
'host' => $modx->getOption('http_host', null, 'unknown'),
'php_version' => phpversion(),
'modx_version' => $modxVersion,
'manager_lang' => $managerLang,
'installation_type' => $action,
'package_version_from' => $oldVersion,
'package_version' => $version,
'date' => time()
];

/**
* Curl POST.
*/
$curl = curl_init();
if ($curl) {
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($curl, CURLOPT_TIMEOUT, 5);

$response = curl_exec($curl);
$responseInfo = curl_getinfo($curl);
$curlError = curl_error($curl);
curl_close($curl);
}

return true;
26 changes: 25 additions & 1 deletion _build/setup.options.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
$output .= '<h2>Install Babel</h2>
<p>Thanks for installing Babel. This open source extra is currently
maintained by Treehill Studio - MODX development in Münsterland.</p>
<p>During the installation, we will collect some statistical data (the
hostname, the MODX UUID, the PHP version and the MODX version of your
MODX installation). Your data will be kept confidential and under no
circumstances be used for promotional purposes or disclosed to third
parties. We only like to know the usage count of this package.</p>
<p>If you install this package, you are giving us your permission to
collect, process and use that data for statistical purposes.</p>
<p>Babel will be installed. Please review the installation options carefully.</p><br>';

$output .= '<div style="position: relative">
Expand Down Expand Up @@ -63,7 +75,19 @@
unset($setting);

$output .= '<h2>Upgrade Babel</h2>
<p>Babel will be upgraded. Please review the installation options carefully.</p><br>';
<p>Babel will be upgraded. This open source extra is currently
maintained by Treehill Studio - MODX development in Münsterland.</p>
<p>During the installation, we will collect some statistical data (the
hostname, the MODX UUID, the PHP version and the MODX version of your
MODX installation). Your data will be kept confidential and under no
circumstances be used for promotional purposes or disclosed to third
parties. We only like to know the usage count of this package.</p>
<p>If you upgrade this package, you are giving us your permission to
collect, process and use that data for statistical purposes.</p>
<p>Please review the installation options carefully.</p><br>';

$output .= '<div style="position: relative">
<label for="babel-contextKeys">Context Keys (comma-separated):</label>
Expand Down
Binary file added _packages/babel-3.3.0-pl.transport.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions assets/components/babel/css/mgr/babel.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions assets/components/babel/css/mgr/resourcebutton.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions assets/components/babel/js/mgr/babel.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions assets/components/babel/js/mgr/resourcebutton.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/components/babel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"require": {
"php": ">=7.2",
"ext-curl": "*",
"ext-json": "*",
"ext-pdo": "*"
},
Expand Down
14 changes: 11 additions & 3 deletions core/components/babel/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.3.0] - TBA
## [3.3.0] - 2024-03-27

### Added

- Add a menu entry/button to create multiple translations in selectable contexts
- Include a possible scrollbar height in the context grid height
- [#204] New event when TV values have been synchronized - thanks to Arjen <https://github.com/arjen-t>
- Add an option to link a new created translation with all existing translations

### Fixed

- [#202] Fix synchronized TVs never triggered
- [#202] Fix synchronized TVs never triggered - thanks to Arjen <https://github.com/arjen-t>
- Don't change the parent of a new linked resource to a folder

## [3.2.0] - 2024-02-07

Expand All @@ -25,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- System settings tab in custom manager page
- Change the Babel button text by the `babel.displayText` system setting (language, context or combination)
- Show all contexts in the Babel button by disabling the `babel.restrictToGroup` system setting
- New snippet property `restrictToGroup` for the BabelLinks snippet.
- New snippet property `restrictToGroup` for the BabelLinks snippet

### Fixed

Expand Down
14 changes: 10 additions & 4 deletions core/components/babel/lexicon/cs/default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
$_lang['babel.contexts'] = 'Kontexty';
$_lang['babel.contexts_desc'] = 'Správa odkazů mezi zdroji v různých kontextech/jazycích na jednom místě. K úpravě odkazů použijte následující tlačítka:';
$_lang['babel.contexts_desc_create'] = 'Vytvoření nového prostředku, který má být propojen';
$_lang['babel.contexts_desc_create_multiple'] = 'Vytvoření více nových prostředku, který má být propojen';
$_lang['babel.contexts_desc_link'] = 'Odkaz na tento zdroj a související zdroje';
$_lang['babel.contexts_desc_unlink'] = 'Přerušení spojení';
$_lang['babel.contexts_desc_update'] = 'Aktualizace tohoto propojeného zdroje';
$_lang['babel.copy_tv_values'] = 'Zkopírovat synchronizované TV do cílového dokumentu';
$_lang['babel.create_multiple_translations'] = 'Vytvořit více překladů';
$_lang['babel.create_multiple_translations_err_no_contexts'] = 'Pro překlad nejsou k dispozici žádné další kontexty.';
$_lang['babel.create_multiple_translations_finished'] = 'Vytvoření přeložených zdrojů bylo dokončeno.';
$_lang['babel.create_translation'] = 'Vytvořit překlad';
$_lang['babel.create_translation_confirm'] = 'Jste si jisti, že chcete vytvořit nový překlad tohoto zdroje na <b>"[[+context]]"</b> context?';
$_lang['babel.debug_mode'] = 'Debug Mode';
$_lang['babel.desc'] = 'Správa vícejazyčného systému';
$_lang['babel.target_id'] = 'ID cíle';
$_lang['babel.link_translation'] = 'Odkaz na existující zdroj';
$_lang['babel.open'] = 'Otevřeno';
$_lang['babel.or'] = '… nebo';
$_lang['babel.target_pagetitle'] = '... nebo vyhledat název stránky cíle';
$_lang['babel.please_wait'] = 'Počkejte prosím …';
$_lang['babel.reset'] = 'Obnovení';
$_lang['babel.resource_err_from_other_context'] = 'Dokument [[+resource]] neexistuje v kontextu <b>"[[+context]]"</b>.';
Expand All @@ -39,14 +40,19 @@
$_lang['babel.select_tree_node'] = 'Výběr uzlu ve stromu zdrojů';
$_lang['babel.settings'] = '<i class="icon icon-cog"><span class="sr-only">Nastavení</span></i>';
$_lang['babel.settings_desc'] = 'Upravte nastavení aplikace Babel. Hodnotu nastavení systému můžete upravit dvojklikem na buňku tabulky "Hodnota" nebo kliknutím pravým tlačítkem myši do buňky tabulky.';
$_lang['babel.sync_linked_tranlations'] = 'Synchronizovat všechny překlady z cílového';
$_lang['babel.sync_linked_tranlations'] = 'Synchronizovat všechny překlady';
$_lang['babel.sync_linked_tranlations_target'] = 'Synchronizovat všechny překlady z cílového';
$_lang['babel.systemsetting_key_err_nv'] = 'Nastavení lze upravovat pouze s předponou babel.';
$_lang['babel.systemsetting_usergroup_err_nv'] = 'Nastavení mohou měnit pouze uživatelé s oprávněním settings nebo settings_babel.';
$_lang['babel.target_id'] = 'ID cíle';
$_lang['babel.target_pagetitle'] = '... nebo vyhledat název stránky cíle';
$_lang['babel.translation_err_could_not_create_resource'] = 'Nastala chyba při vytváření překladu v kontextu [[+context]].';
$_lang['babel.translation_pending'] = '[čeká se na překlad]';
$_lang['babel.translation_success_create_resource'] = 'V kontextu [[+context]] byl vytvořen přeložený zdroj pro [[+id]].';
$_lang['babel.tv_caption'] = 'Překladové odkazy Babel Translation';
$_lang['babel.tv_description'] = 'Spravováno pluginem Babel. Prosím neměnit!';
$_lang['babel.unlink'] = 'Odpojení';
$_lang['babel.unlink_all'] = 'Odpojit vše';
$_lang['babel.unlink_all_translations'] = 'Zrušení propojení všech překladů';
$_lang['babel.unlink_all_translations_confirm'] = 'Opravdu chcete zrušit propojení všech překladů z tohoto zdroje?';
$_lang['babel.unlink_translation_confirm'] = 'Jste si jisti, že chcete zrušit propojení překladu z tohoto zdroje na <b>"[[+context]]"</b> kontext?';
2 changes: 1 addition & 1 deletion core/components/babel/lexicon/cs/properties.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$_lang['babel.babellinks.activeCls'] = 'CSS třída pro aktivní jazykový odkaz.';
$_lang['babel.babellinks.ignoreSiteStatus'] = 'Příznak, zda ignorovat site_status (když je web offline)';
$_lang['babel.babellinks.includeUnlinked'] = 'Příznak, zda se má zobrazit nepropojený kontext.';
$_lang['babel.babellinks.resourceId'] = 'Id dokumentu jehož překladové odkazy mají být zobrazeny.';
$_lang['babel.babellinks.resourceId'] = 'ID dokumentu jehož překladové odkazy mají být zobrazeny.';
$_lang['babel.babellinks.restrictToGroup'] = 'Omezit kontexty v tlačítku Babel na skupinu aktuálního kontextu.';
$_lang['babel.babellinks.showCurrent'] = 'Má se zobrazovat odkaz na aktuální jazykovou mutaci.';
$_lang['babel.babellinks.showUnpublished'] = 'Příznak, zda-li se má zobrazovat i nepublikovaný překlad.';
Expand Down
Loading

0 comments on commit 8b5826d

Please sign in to comment.