master
Jean-Christian Paul Denis 2021-11-04 11:17:26 +01:00
parent 540872a178
commit 403f09a4f5
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 64 additions and 23 deletions

View File

@ -10,7 +10,6 @@
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
@ -30,11 +29,21 @@ if (!$core->blog->settings->tweakStores->active) {
if ($core->blog->settings->tweakStores->packman) {
$core->addBehavior('packmanBeforeCreatePackage', ['tweakStoresBehaviors', 'packmanBeforeCreatePackage']);
}
$core->addBehavior('pluginsToolsHeaders', ['tweakStoresBehaviors', 'modulesToolsHeaders']);
$core->addBehavior('themesToolsHeaders', ['tweakStoresBehaviors', 'modulesToolsHeaders']);
$core->addBehavior('pluginsToolsTabs', ['tweakStoresBehaviors', 'pluginsToolsTabs']);
$core->addBehavior('themesToolsTabs', ['tweakStoresBehaviors', 'themesToolsTabs']);
class tweakStoresBehaviors
{
# addd some js
public static function modulesToolsHeaders(dcCore $core, $plugin)
{
return
dcPage::jsVars(['dotclear.ts_copied' => __('Copied to clipboard')]) .
dcPage::jsLoad(dcPage::getPF('tweakStores/js/admin.js'));
}
# create dcstore.xml file on the fly when pack a module
public static function packmanBeforeCreatePackage(dcCore $core, $module)
{
@ -137,13 +146,17 @@ class tweakStoresBehaviors
) {
echo
'<p class="field"><label for="your_pwd2" class="classic required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Your password:') . '</label> ' .
form::password(['your_pwd', 'your_pwd2'], 20, 255,
form::password(
['your_pwd', 'your_pwd2'],
20,
255,
[
'extra_html' => 'required placeholder="' . __('Password') . '"',
'autocomplete' => 'current-password'
]
) . '</p>' .
'<p><input type="submit" name="write_xml" value="' . __('Save to module directory') . '" /> ' .
'<a class="hidden-if-no-js button" href="#tweakStores" id="ts_copy_button">' . __('Copy to clipboard') . '</a>' .
form::hidden('buildxml_id', $_POST['buildxml_id']) .
$core->formNonce() . '</p>';
}
@ -170,6 +183,7 @@ class tweakStoresBehaviors
}
$combo[$module['name'] . ' ' . $module['version']] = $id;
}
return $combo;
}
}

21
js/admin.js 100644
View File

@ -0,0 +1,21 @@
/*global $, dotclear */
'use strict';
$(function(){
$("#ts_copy_button").click(function() {
tsCopy("#gen_xml");
return false;
});
function tsCopy(element_id) {
$(element_id).attr("contenteditable", true)
.select()
.on("focus", function() {
document.execCommand('selectAll', false, null)
})
.focus()
document.execCommand("Copy");
$(element_id).removeAttr("contenteditable");
alert(dotclear.ts_copied);
}
});

View File

@ -1,15 +1,18 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: tweakStores 0.1.0\n"
"Project-Id-Version: tweakStores 0.2.0\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-09-27T22:20:49+00:00\n"
"PO-Revision-Date: 2021-11-04T10:06:45+00:00\n"
"Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Copied to clipboard"
msgstr "Copié dans le presse-papier"
msgid "Tweak third-party repositories"
msgstr "Gestion de dépôts tiers"
@ -19,6 +22,9 @@ msgstr "Fichier enregistré avec succès"
msgid "There is no module to tweak"
msgstr "Il n'y a pas de module à gérer"
msgid "You must configure zip file pattern to complete xml code automatically."
msgstr "Vous devez configurer le modèle de fichier zip pour compléter le code XML automatiquement."
msgid "Generate xml code"
msgstr "Générer le code XML"
@ -46,8 +52,8 @@ msgstr "Le code est complet"
msgid "Save to module directory"
msgstr "Enregistrer dans le répertoire du module"
msgid "You must configure zip file pattern to complete xml code automatically."
msgstr "Vous devez configurer le modèle de fichier zip pour compléter le code XML automatiquement."
msgid "Copy to clipboard"
msgstr "Copier dans le presse-papier"
msgid "You can edit zip file pattern from configuration page."
msgstr "Vous pouvez modifier le modèle de fichier zip sur la page de configuration."