Commit 4f58da8a authored by Luc Didry's avatar Luc Didry

1er commit, fonctionnel

parents
cache.json
*.swp
This diff is collapsed.
[![](https://framagit.org/assets/favicon-075eba76312e8421991a0c1f89a89ee81678bcde72319dd3e8047e2a47cd3a42.ico)](https://framagit.org)
![English:](https://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Flag_of_the_United_Kingdom.svg/20px-Flag_of_the_United_Kingdom.svg.png) **Framasoft uses GitLab** for the development of its free softwares. Our Github repositories are only mirrors.
If you want to work with us, **fork us on [framagit.org](https://framagit.org)**. (no registration needed, you can sign in with your Github account)
![Français :](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Flag_of_France.svg/20px-Flag_of_France.svg.png) **Framasoft utilise GitLab** pour le développement de ses logiciels libres. Nos dépôts Github ne sont que des miroirs.
Si vous souhaitez travailler avec nous, **forkez-nous sur [framagit.org](https://framagit.org)**. (l'inscription n'est pas nécessaire, vous pouvez vous connecter avec votre compte Github)
* * *
# WP-Dolomon
Plugin Wordpress pour interagir avec un serveur [Dolomon](https://framagit.org/luc/dolomon).
## Fonctionnalités
- création de catégories, étiquettes et dolos depuis Wordpress
- shortcodes permettant d'afficher un ou plusieurs dolos dans un article ou une page, avec un formattage fin
- widget affichant les dolos d'une catégorie, d'une étiquette ou plusieurs dolos choisis
## Licence
Ce plugin est soumis à la licence GNU GPLv3. Voir le [fichier de licence](LICENSE) pour plus de détails
## Bugs et demandes de fonctionnalité
Merci de soumettre vos bugs et demandes de fonctionnalité sur http://framagit.org/framasoft/wp-dolomon/issues.
## Divers
Ce plugin a été réalisé par l'association Framasoft.
#dolomon-meta-box input,
#dolomon-meta-box select {
width: 100%;
}
.copyLink {
text-align: center;
}
.copyLink a {
text-decoration: none;
}
.dolosTB {
width: 98% !important;
margin-left: 1% !important;
left: 0 !important;
overflow: auto;
}
.tabs-menu {
height: 30px;
float: left;
clear: both;
border-bottom: 1px solid #ccc;
}
.tabs-menu li {
height: 30px;
line-height: 30px;
float: left;
margin-right: 10px;
background-color: #ccc;
border-top: 1px solid #d4d4d1;
border-right: 1px solid #d4d4d1;
border-left: 1px solid #d4d4d1;
}
.tabs-menu li:last-of-type {
margin-right: 0px;
}
.tabs-menu li.current {
position: relative;
background-color: #fff;
border-bottom: 1px solid #fff;
z-index: 5;
}
.tabs-menu li a {
padding: 10px;
text-transform: uppercase;
color: #fff;
text-decoration: none;
}
.tabs-menu .current a {
color: #2e7da3;
}
.tab {
background-color: #fff;
margin-bottom: 20px;
width: auto;
}
.tab-content {
display: none;
padding: 0px 20px 20px 20px;
}
.sc-builder {
padding: 60px 20px 20px 20px;
display: block !important;
}
.tab-content pre {
display: inline;
}
.tab-content ul {
list-style: initial;
padding-left: 40px;
}
#tab-1 {
display: block;
}
.hidden {
display: none;
}
#doloSearch {
width: 97%;
}
.doloCat {
border: 1px solid #ddd;
border-radius: 5px;
margin: 10px 5px 5px 0;
display: inline-block;
vertical-align: top;
}
.doloCat h3 {
border-bottom: 1px solid #ddd;
margin: 10px;
padding-bottom: 5px;
}
@media screen and (max-width: 760px) {
.doloCat {
width: 96%;
}
}
@media screen and (min-width: 761px) {
.doloCat {
width: 48%;
}
.doloCat.featured {
width: calc(96% + 5px);
}
}
.dolo-button:hover {
text-decoration: none;
}
.dolo-button {
color: #fff !important;
border-color: #036881;
background: #04bcea;
vertical-align: middle;
display: inline-block;
text-decoration: none;
margin: 5px;
padding: 5px 10px 5px 10px;
cursor: pointer;
-webkit-appearance: none;
-webkit-border-radius: 8px;
border-radius: 8px;
white-space: nowrap;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
// Stolen from https://github.com/mozilla-services/push-dev-dashboard/blob/3ad4de737380d0842f40c82301d1f748c1b20f2b/push/static/js/validation.js
function createNode(text) {
var node = document.createElement('pre');
node.style.width = '1px';
node.style.height = '1px';
node.style.position = 'fixed';
node.style.top = '5px';
node.textContent = text;
return node;
}
function copyNode(node) {
var selection = getSelection();
selection.removeAllRanges();
var range = document.createRange();
range.selectNodeContents(node);
selection.addRange(range);
var success = document.execCommand('copy');
selection.removeAllRanges();
return success;
}
function copyText(text) {
var node = createNode(text);
document.body.appendChild(node);
var success = copyNode(node);
document.body.removeChild(node);
if (!success) {
prompt(dolomon_hit_enter, text);
}
}
function copyInput(node) {
node.select();
var success = document.execCommand('copy');
getSelection().removeAllRanges();
return success;
}
jQuery(document).ready(function($){
window.$ = $;
var url = dolomonPostUrl;
$('#dolo-sc-name').val('');
$('#dolo-sc-count, #dolo-sc-extra, #dolo-sc-link, #dolo-sc-button, #dolo-sc-self, #dolo-sc-page').prop('checked', false);
$('#dolo-sc-cat option, dolo-sc-tag option').prop('selected', false);
$('#dolomon-submit').click(function(e) {
e.preventDefault();
$.ajax({
url: ajaxurl+'?action=add_dolo',
method: 'POST',
data: {
url: $('#dolomon-url').val(),
name: $('#dolomon-name').val(),
extra: $('#dolomon-extra').val(),
short: $('#dolomon-short').val(),
cat_id: $('#dolomon-cat').val(),
tags: $('#dolomon-tag').val(),
dolomon_meta_box_nonce: $('#dolomon_meta_box_nonce').val(),
_wp_http_referer: $('input[name="_wp_http_referer"]').val(),
},
dataType: 'json',
success: function(data, textStatus, jqXHR) {
if (data.success) {
var tags = new Array();
data.object.tags.forEach(function(t) {
tags.push(t.name);
});
$('#tab-1 tbody').prepend([
'<tr>',
' <td class="dolo-filter-category">', data.object.category_name, '</td>',
' <td class="dolo-filter-url">', data.object.url, '</td>',
' <td><a href="#" class="dolo-filter-durl" onclick="copyText(\'', url, data.object.short, '\')">', url, data.object.short, '</a></td>',
' <td class="dolo-filter-name">', data.object.name, '</td>',
' <td class="dolo-filter-extra">', data.object.extra, '</td>',
' <td><a href="#" class="dolo-filter-shortcode" onclick="copyText(\'[dolo id=', data.object.id, '\')">[dolo id=', data.object.id, ']</a></td>',
' <td class="dolo-filter-tags">', tags.join(', '), '</td>',
'</tr>'
].join(''));
addAlert(dolomon_add_dolo_success);
} else {
alert(data.msg);
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
});
$('#dolomon-cat-submit').click(function(e) {
e.preventDefault();
$.ajax({
url: ajaxurl+'?action=add_dolo_cat',
method: 'POST',
data: {
name: $('#dolomon-cat-name').val(),
dolomon_meta_box_nonce: $('#dolomon_meta_box_nonce').val(),
_wp_http_referer: $('input[name="_wp_http_referer"]').val(),
},
dataType: 'json',
success: function(data, textStatus, jqXHR) {
if (data.success) {
$('#dolomon-cat option').prop('selected', false);
$('#dolomon-cat').prepend([
'<option value="', data.object.id, '" selected>',
data.object.name,
'</option>'
].join(''));
$('#tab-2 tbody').prepend([
'<tr>',
' <td class="dolo-filter-name">', data.object.name, '</td>',
' <td class="dolo-filter-number">', data.object.dolos.length, '</td>',
' <td><a href="#" class="dolo-filter-shortcode" data-id="', data.object.id, '" onclick="copyText(\'[dolos cat=', data.object.id, '\')">[dolos cat=', data.object.id, '</a></td>',
'</tr>'
].join(''));
$('#TB_closeWindowButton').click();
addAlert(dolomon_add_cat_success);
} else {
alert(data.msg);
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
});
$('#dolomon-tag-submit').click(function(e) {
e.preventDefault();
$.ajax({
url: ajaxurl+'?action=add_dolo_tag',
method: 'POST',
data: {
name: $('#dolomon-tag-name').val(),
dolomon_meta_box_nonce: $('#dolomon_meta_box_nonce').val(),
_wp_http_referer: $('input[name="_wp_http_referer"]').val(),
},
dataType: 'json',
success: function(data, textStatus, jqXHR) {
if (data.success) {
$('#dolomon-tag').prepend([
'<option value="', data.object.id, '" selected>',
data.object.name,
'</option>'
].join(''));
$('#tab-3 tbody').prepend([
'<tr>',
' <td class="dolo-filter-name">', data.object.name, '</td>',
' <td class="dolo-filter-number">', data.object.dolos.length, '</td>',
' <td><a href="#" class="dolo-filter-shortcode" data-id="', data.object.id, '" onclick="copyText(\'[dolos tag=', data.object.id, '\')">[dolos tag=', data.object.id, '</a></td>',
'</tr>'
].join(''));
$('#TB_closeWindowButton').click();
addAlert(dolomon_add_tag_success);
} else {
alert(data.msg);
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
});
$('#showadddolocat').click(function(e) {
e.preventDefault();
tb_show('', '#TB_inline?width=800&height=600&inlineId=addDoloCat');
});
$('#showadddolotag').click(function(e) {
e.preventDefault();
tb_show('', '#TB_inline?width=800&height=600&inlineId=addDoloTag');
});
$('#showdolotb').click(function(e) {
e.preventDefault();
tb_show('', '#TB_inline?width=800&height=600&inlineId=myDolos');
var tb = document.getElementById('TB_ajaxContent');
tb.setAttribute('style', '');
$('#TB_window').addClass('dolosTB');
$('#TB_window .dolo-filter').val('');
$('#TB_window .dolo-filter').unbind('keyup');
$('#TB_window .dolo-filter').on('keyup', doloFilter);
});
$(".tabs-menu a").click(function(event) {
event.preventDefault();
$(this).parent().addClass("current");
$(this).parent().siblings().removeClass("current");
var tab = $(this).attr("href");
$(".tab-content").not(tab).css("display", "none").removeClass("current");
$(tab).addClass("current");
updateShortcodes();
$(tab).fadeIn();
});
function doloFilter(event) {
var thi = this;
var input = $(thi);
$('#TB_window .dolo-filter').each(function (index, element) {
if (element != thi) {
$(element).val('');
}
});
var val = input.val();
var sel = input.data('filter');
input.parents('table').find(sel).each(function (index, element) {
var e = $(element);
if (val === undefined || val === '') {
e.parents('tr').removeClass('hidden');
} else {
if (!e.text().match(new RegExp(val))) {
e.parents('tr').addClass('hidden');
} else {
e.parents('tr').removeClass('hidden');
}
}
});
}
$('#dolo-sc-name').on('keyup', function() {
updateShortcodes();
});
$('#dolo-sc-count, #dolo-sc-extra, #dolo-sc-button, #dolo-sc-self, #dolo-sc-link, #dolo-sc-page, #dolo-sc-tag, #dolo-sc-cat').on('change', function() {
updateShortcodes();
});
function updateShortcodes() {
$('.tab-content.current').find('.dolo-filter-shortcode').each(function(i) {
var e = $(this);
var a = new Array()
switch ($('.tab-content.current').data('selected')) {
case 'dolo':
$('#dolo-sc-tag').parent().addClass('hidden');
$('#dolo-sc-cat').parent().addClass('hidden');
$('#dolo-sc-page').parent().addClass('hidden');
a.push('[dolo');
a.push('id='+e.data('id'));
break;
case 'cat':
a.push('[dolos');
if ($('#dolo-sc-page').is(':checked')) {
$('#dolo-sc-tag').parent().addClass('hidden');
a = new Array('[dolos page=true');
} else {
$('#dolo-sc-cat').parent().addClass('hidden');
$('#dolo-sc-tag').parent().removeClass('hidden');
$('#dolo-sc-page').parent().removeClass('hidden');
a.push('cat='+e.data('id'));
var t = new Array();
$('#dolo-sc-tag option:selected').each(function(i) {
var e = $(this);
t.push(e.val());
});
if (t.length > 0) {
a.push('tags='+t.join(','));
}
}
break;
case 'tag':
a.push('[dolos');
if ($('#dolo-sc-page').is(':checked')) {
$('#dolo-sc-cat').parent().addClass('hidden');
a = new Array('[dolos page=true');
} else {
$('#dolo-sc-tag').parent().addClass('hidden');
$('#dolo-sc-cat').parent().removeClass('hidden');
$('#dolo-sc-page').parent().removeClass('hidden');
a.push('tag='+e.data('id'));
var c = new Array();
$('#dolo-sc-cat option:selected').each(function(i) {
var e = $(this);
c.push(e.val());
});
if (c.length > 0) {
a.push('cats='+c.join(','));
}
}
break;
}
if ($('#dolo-sc-name').val()) {
a.push('name="'+$('#dolo-sc-name').val()+'"');
}
if ($('#dolo-sc-count').is(':checked')) {
a.push('count=true');
}
if ($('#dolo-sc-extra').is(':checked')) {
a.push('extra=true');
}
if ($('#dolo-sc-link').is(':checked')) {
a.push('link=true');
$('#dolo-sc-button, #dolo-sc-self').parent().removeClass('hidden');
if ($('#dolo-sc-button').is(':checked')) {
a.push('button=true');
}
if ($('#dolo-sc-self').is(':checked')) {
a.push('self=true');
}
} else {
$('#dolo-sc-button, #dolo-sc-self').parent().addClass('hidden');
}
var s = a.join(' ');
s += ']';
e.text(s);
e.unbind('click');
e.click(function () {
copyText(s);
});
});
}
function addAlert(text) {
$('#wpbody-content').prepend([
'<div class="updated settings-error notice is-dismissible">',
' <p>',
' <strong>',
' <span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">',
text,
' </span>',
' </strong>',
' </p>',
' <button type="button" class="notice-dismiss" onclick="var el = this.parentNode; el.parentNode.removeChild(el);">',
' <span class="screen-reader-text">', dolomon_dismiss_notice, '</span>',
' </button>',
'</div>'
].join(''));
}
});
jQuery(document).ready(function($){
$("#doloSearch").val('');
$("#doloSearch").on("keyup", function(e) {
var thi = this;
var input = $(thi);
var val = input.val();
$(".doloCat li").each(function (index, element) {
var e = $(element);
if (val === undefined || val === "") {
e.removeClass("hidden");
} else {
if (!e.data("search").match(new RegExp(val))) {
e.addClass("hidden");
} else {
e.removeClass("hidden");
}
}
});
});
});
jQuery(document).ready(function($){
$('.dolo-widget-type').unbind('change');
$('.dolo-widget-type').change(function() {
var e = $(this);
var par = e.parent().parent();
par.find('.dolo-choose-cat').addClass('hidden');
par.find('.dolo-choose-tag').addClass('hidden');
par.find('.dolo-choose-dolo').addClass('hidden');
par.find('.'+e.val()).removeClass('hidden');
});
});
This diff is collapsed.
<?php // Silence is golden
# Copyright (C) 2016 Dolomon
# This file is distributed under the same license as the Dolomon package.
msgid ""
msgstr ""
"Project-Id-Version: Dolomon 0.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/dolomon\n"
"POT-Creation-Date: 2016-07-06 11:12:53+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
#: dolomon.php:66
msgid "Unable to open cache file %s!"
msgstr "Impossible d’ouvrir le fichier de cache %s !"
#: dolomon.php:119 settings.php:8
msgid "Dolomon settings"
msgstr "Paramètres de Dolomon"
#. #-#-#-#-# dolomon-slug.pot (Dolomon 0.1) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: dolomon.php:119
msgid "Dolomon"
msgstr "Dolomon"
#: dolomon.php:142
msgid "You do not have sufficient permissions to access this page."
msgstr "Vous n’avez pas les permissions suffisantes pour accéder à cette page."
#: dolomon.php:156
msgid "Unable to register your settings"
msgstr "Impossible d’enregistrer vos paramètres"
#: dolomon.php:170
msgid "Your settings has been successfully registered :-)"
msgstr "Vos paramètres ont été enregistrés avec succès :-)"
#: dolomon.php:172
msgid "Your dolomon settings are invalid. Please check and retry."
msgstr "Vos paramètres pour Dolomon sont invalides. Veuillez vérifier et réessayer."
#: dolomon.php:242 dolomon.php:284 dolomon.php:329
msgid ""
"It seems that the Dolomon server URL is not set. Check your Dolomon settings."
msgstr "Il semblerait que l’URL du server Dolomon ne soit pas paramétrée. Vérifiez la configuration du plugin Dolomon"
#: dolomon.php:248 dolomon.php:290 dolomon.php:335
msgid "You don't have the right permissions."
msgstr "Vous n’avez pas les bonnes permissions."
#: dolomon.php:302
msgid "There was a problem while checking the referer."
msgstr ""
#: metabox.php:6 metabox.php:131
msgid "URL"
msgstr "URL"
#: metabox.php:7 metabox.php:221
msgid "mandatory"
msgstr "obligatoire"
#: metabox.php:10 metabox.php:52 metabox.php:62 metabox.php:133
#: metabox.php:169 metabox.php:194
msgid "Name"
msgstr "Nom"
#: metabox.php:11 metabox.php:15 metabox.php:19 metabox.php:226
#: metabox.php:251 metabox.php:256 metabox.php:261
msgid "optional"
msgstr "facultatif"
#: metabox.php:14 metabox.php:134
msgid "Extra"
msgstr "Extra"
#: metabox.php:18
msgid "Short"
msgstr "Lien dolomon"
#: metabox.php:22 metabox.php:130 widget.php:112
msgid "Category"
msgstr "Catégorie"
#: metabox.php:24 metabox.php:50
msgid "Add a category"
msgstr "Ajouter une catégorie"
#: metabox.php:33
msgid "Tag"
msgstr "Étiquette"