From c4972a4a8ea507434175d88eabf5185181c34619 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Thu, 2 Sep 2021 14:30:05 +0200 Subject: [PATCH] Move form from post sidebar to sidebar items (and some fixes) --- CHANGELOG.md | 12 ++-- _admin.php | 27 ++++---- _define.php | 2 +- js/admin.js | 7 +++ locales/fr/main.lang.php | 128 +++++++++++++++++++------------------ locales/fr/main.po | 133 +++++++++++++++++++-------------------- 6 files changed, 158 insertions(+), 151 deletions(-) create mode 100644 js/admin.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 684e33f..6cd993f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ -todo -- Added public page of the list of know urls and in/visible status -- Added passworded links -- fix deprecated external service -- update pager (see posts list) +xxx.xx.xx +- [ ] Add public page of the list of know urls and in/visible status +- [ ] Add passworded links +- [ ] fix deprecated external service +- [ ] update php header to phpdoc style +- [x] fix post page options display 2021.08.28 - pre release - add dashboard icon @@ -11,6 +12,7 @@ todo - fix compatibility with Dotclear 2.19 - create readme file - merge index file sub parts +- update admin pager for links list - remove custom js - fix widgets rendering - fix public template now based on dotty diff --git a/_admin.php b/_admin.php index d06bbb5..8c7e801 100644 --- a/_admin.php +++ b/_admin.php @@ -15,6 +15,8 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } +$core->blog->settings->addNamespace('kUtRL'); + require_once dirname(__FILE__) . '/_widgets.php'; # Plugin menu @@ -29,7 +31,7 @@ $_menu['Plugins']->addItem( if ($core->blog->settings->kUtRL->kutrl_active) { $core->addBehavior('adminDashboardFavorites', ['adminKutrl', 'antispamDashboardFavorites']); $core->addBehavior('adminPostHeaders', ['adminKutrl', 'adminPostHeaders']); - $core->addBehavior('adminPostFormSidebar', ['adminKutrl', 'adminPostFormSidebar']); + $core->addBehavior('adminPostFormItems', ['adminKutrl', 'adminPostFormItems']); $core->addBehavior('adminAfterPostUpdate', ['adminKutrl', 'adminAfterPostUpdate']); // update existing short url $core->addBehavior('adminAfterPostUpdate', ['adminKutrl', 'adminAfterPostCreate']); // create new short url $core->addBehavior('adminAfterPostCreate', ['adminKutrl', 'adminAfterPostCreate']); @@ -66,7 +68,7 @@ class adminKutrl return dcPage::jsLoad('index.php?pf=kUtRL/js/admin.js'); } - public static function adminPostFormSidebar($post) + public static function adminPostFormItems($main_items, $sidebar_items, $post) { global $core; $s = $core->blog->settings->kUtRL; @@ -86,9 +88,8 @@ class adminKutrl $rs = false; } - echo - '

' . __('Short link') . '

' . - '
' . + $ret = + '
' . __('Short link') . '
' . form::hidden(['kutrl_old_post_url'], $post_url); if (!$rs) { @@ -97,13 +98,13 @@ class adminKutrl } else { $chk = !empty($_POST['kutrl_create']); } - echo + $ret .= '

'; if ($kut->allow_custom_hash) { - echo + $ret .= '

' . '

' . + __('Delete short link') . '

' . '

' . $href . '

'; } - echo '
'; + $ret .= '
'; + + $sidebar_items['options-box']['items']['kUtRL'] = $ret; } public static function adminAfterPostUpdate($cur, $post_id) @@ -239,8 +242,8 @@ class adminKutrl return null; } - $args[0][__('kUtRL')][__('create short link')] = 'kutrl_create'; - $args[0][__('kUtRL')][__('delete short link')] = 'kutrl_delete'; + $args[0][__('kUtRL')][__('Create short link')] = 'kutrl_create'; + $args[0][__('kUtRL')][__('Delete short link')] = 'kutrl_delete'; } public static function adminPostsActions(dcCore $core, $posts, $action, $redir) diff --git a/_define.php b/_define.php index 7639716..e4e1a48 100644 --- a/_define.php +++ b/_define.php @@ -21,9 +21,9 @@ $this->registerModule( 'Jean-Christian Denis and contributors', '2021.08.28', [ + 'requires' => [['core', '2.19']], 'permissions' => 'admin', 'type' => 'plugin', - 'dc_min' => '2.19', 'support' => 'https://github.com/JcDenis/kUtRL', 'details' => 'http://plugins.dotaddict.org/dc2/details/kUtRL', 'repository' => 'https://raw.githubusercontent.com/JcDenis/kUtRL/master/dcstore.xml' diff --git a/js/admin.js b/js/admin.js new file mode 100644 index 0000000..d39c02b --- /dev/null +++ b/js/admin.js @@ -0,0 +1,7 @@ +$(function(){ + /* toogle admin form sidebar */ + $('#kUtRL h5').toggleWithLegend( + $('#kUtRL').children().not('h5'), + {cookie:'dcx_kUtRL_admin_form_sidebar',legend_click:true} + ); +}); \ No newline at end of file diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php index 551b7ab..c7c9558 100644 --- a/locales/fr/main.lang.php +++ b/locales/fr/main.lang.php @@ -1,52 +1,50 @@ 1);\n" -#: _admin.php:22 -#: _admin.php:55 +#: _admin.php:24 +#: _admin.php:57 #: _widgets.php:28 #: default-templates/kutrl.html:3 #: default-templates/kutrl.html:18 #: default-templates/kutrl404.html:9 #: default-templates/kutrl_old.html:48 -#: index.php:284 -#: index.php:308 -#: index.php:405 -#: index.php:454 -#: index.php:499 +#: index.php:276 +#: index.php:300 +#: index.php:397 +#: index.php:446 +#: index.php:491 msgid "Links shortener" msgstr "Réducteur de liens" -#: _admin.php:90 +#: _admin.php:92 #: index.php:196 msgid "Short link" msgstr "Lien court" -#: _admin.php:103 +#: _admin.php:104 +#: _admin.php:245 msgid "Create short link" msgstr "Créer un lien court" -#: _admin.php:108 -#: index.php:475 +#: _admin.php:109 +#: index.php:467 msgid "Custom short link:" msgstr "Lien court personnalisé :" -#: _admin.php:115 +#: _admin.php:116 #: _widgets.php:212 msgid "never followed" msgstr "jamais suivi" -#: _admin.php:117 +#: _admin.php:118 #: _widgets.php:214 msgid "followed one time" msgstr "suivi une fois" -#: _admin.php:119 +#: _admin.php:120 #: _widgets.php:216 msgid "followed %s times" msgstr "suivi %s fois" -#: _admin.php:126 -#: _admin.php:243 -msgid "delete short link" -msgstr "effacer un lien court" - -#: _admin.php:242 -msgid "create short link" -msgstr "créer un lien court" +#: _admin.php:127 +#: _admin.php:246 +msgid "Delete short link" +msgstr "Effacer un lien court" #: _public.php:133 msgid "Failed to verify protected field." @@ -174,7 +171,7 @@ msgid "Rank" msgstr "Rang" #: _widgets.php:84 -#: inc/lib.kutrl.lst.php:18 +#: inc/lib.kutrl.lst.php:55 msgid "Hash" msgstr "Hash" @@ -189,7 +186,7 @@ msgstr "Cacher les liens non suivis" #: _widgets.php:138 #: default-templates/kutrl.html:33 #: default-templates/kutrl_old.html:55 -#: index.php:470 +#: index.php:462 msgid "Long link:" msgstr "Lien long :" @@ -230,11 +227,11 @@ msgstr "Création de lien court" msgid "New short link of type \"%s\" and hash \"%s\" was created." msgstr "Un nouveau lien court de type \"%s\" et de hash \"%s\" a été créé." -#: inc/lib.kutrl.lst.php:8 +#: inc/lib.kutrl.lst.php:37 msgid "No short link" msgstr "Pas de lien court" -#: inc/lib.kutrl.lst.php:21 +#: inc/lib.kutrl.lst.php:58 msgid "Service" msgstr "Service" @@ -533,148 +530,148 @@ msgstr "Impossible de créé un lien court. Ceci peut être causé par un probl msgid "Long link" msgstr "Lien long" -#: index.php:272 +#: index.php:264 msgid "Links successfully deleted" msgstr "Liens supprimés avec succès" -#: index.php:310 -#: index.php:407 -#: index.php:413 -#: index.php:565 +#: index.php:302 +#: index.php:399 +#: index.php:405 +#: index.php:561 msgid "Services configuration" msgstr "Configuration des services" -#: index.php:317 -#: index.php:414 +#: index.php:309 +#: index.php:406 msgid "Back to links list" msgstr "Retour à la liste des liens" -#: index.php:322 +#: index.php:314 msgid "Plugin activation" msgstr "Activation" -#: index.php:325 +#: index.php:317 msgid "Enable plugin" msgstr "Activer le plugin" -#: index.php:329 +#: index.php:321 msgid "Behaviors" msgstr "Comportements" -#: index.php:332 +#: index.php:324 msgid "Allow short link for external URL" msgstr "Autoriser les liens court sur des URLs externes" -#: index.php:333 +#: index.php:325 msgid "Not only link started with this blog URL could be shortened." msgstr "Ne pas limiter la création de liens courts aux liens commençant par l'URL du blog." -#: index.php:336 +#: index.php:328 msgid "Passive mode" msgstr "Mode passif" -#: index.php:337 +#: index.php:329 msgid "If this extension is disabled and the passive mode is enabled, \"kutrl\" tags (like EntryKurl) will display long urls instead of nothing on templates." msgstr "Si cette extension est désactivée et que le mode passif est activé, les balises \"kutrl\" (comme EntryKutrl) afficheront les liens longs au lieu de rien." -#: index.php:340 +#: index.php:332 msgid "Active mode" msgstr "Mode actif" -#: index.php:341 +#: index.php:333 msgid "If the active mode is enabled, all know default template tags (like EntryURL) will display short urls instead of long ones on templates." msgstr "Si le mode actif est acitvé, les balises de thème (comme EntryURL) afficheront les liens court au lieu des longs." -#: index.php:342 +#: index.php:334 msgid "You can disable URL shortening for a specific template tag by adding attribute disable_kutrl=\"1\" to it ." msgstr "Vous pouvez désactiver le raccourcissement pour un tag de template spécifique en lui ajoutant l'attribue disable_kutrl=\"1\"" -#: index.php:345 +#: index.php:337 msgid "Create short link for new entries" msgstr "Créer un lien court pour les nouveaux billets" -#: index.php:346 +#: index.php:338 msgid "This can be changed on page of creation/edition of an entry." msgstr "Ceci peut être changé sur la page d'édition / création d'un billet." -#: index.php:350 +#: index.php:342 msgid "Default services" msgstr "Services par défaut" -#: index.php:357 +#: index.php:349 msgid "Administration:" msgstr "Administration :" -#: index.php:360 +#: index.php:352 msgid "Service to use in this admin page and on edit page of an entry." msgstr "Service à utiliser sur cette page d'administration ou sur la page d'édition d'un billet." -#: index.php:367 +#: index.php:359 msgid "Extensions:" msgstr "Extensions :" -#: index.php:370 +#: index.php:362 msgid "Service to use on third part plugins." msgstr "Service à utiliser par les plugins tiers" -#: index.php:377 +#: index.php:369 msgid "Templates:" msgstr "Templates :" -#: index.php:380 +#: index.php:372 msgid "Shorten links automatically when using template value like \"EntryKutrl\"." msgstr "Réduit automatiquement les liens des templates utilisant les balises telles que \"EntryKutrl\"." -#: index.php:387 +#: index.php:379 msgid "Contents:" msgstr "Contenus :" -#: index.php:390 +#: index.php:382 msgid "Shorten links automatically found in contents using wiki synthax." msgstr "Réduit automatiquement les liens des contenus utilisant la syntax wiki." -#: index.php:425 +#: index.php:417 msgid "%s API is well configured and runing." msgstr "L'API %s est correctement configurée et est fonctionnelle." -#: index.php:426 +#: index.php:418 msgid "Failed to test %s API." msgstr "Impossible de tester l'API %s." -#: index.php:433 +#: index.php:425 msgid "homepage" msgstr "page d'accueil" -#: index.php:433 +#: index.php:425 msgid "Learn more about %s." msgstr "En savoir plus à propos de %s." -#: index.php:456 -#: index.php:501 +#: index.php:448 +#: index.php:493 msgid "New link" msgstr "Nouveau lien" -#: index.php:463 +#: index.php:455 msgid "You must set an admin service." msgstr "Vous devez définir un service admin." -#: index.php:467 +#: index.php:459 msgid "Shorten link using service \"%s\"" msgstr "Raccourcir un lien en utilisant le service \"%s\"" -#: index.php:477 +#: index.php:469 msgid "Only if you want a custom short link." msgstr "Uniquement si vous souhaitez un lien court personnalisé." -#: index.php:481 +#: index.php:473 msgid "You can use \"bob!!\" if you want a semi-custom link, it starts with \"bob\" and \"!!\" will be replaced by an increment value." msgstr "Vous pouvez utiliser \"bob!!\" si vous souhaitez un lien semi-personnalisé, il commencera par \"bob\" et \"!!\" sera remplacé par une valeur incrémentale." -#: index.php:513 +#: index.php:505 msgid "Service:" msgstr "Service :" -#: index.php:545 +#: index.php:539 msgid "Delete selected short links" msgstr "Effacer les liens sélectionnés"