Plugin Directory

Changeset 754147


Ignore:
Timestamp:
08/09/2013 04:45:18 PM (13 years ago)
Author:
zhykos
Message:

Version 2.1

  • One table
  • Cheating mode
  • Fix sorted result table
  • Add help
  • Minimize JS and CSS
Location:
comment-contest/trunk
Files:
7 added
1 deleted
12 edited
3 copied

Legend:

Unmodified
Added
Removed
  • comment-contest/trunk/comment-contest.php

    r688171 r754147  
    55  Description: If you create a contest on your website, you can draw all comments in a specific post
    66  Author: Thomas "Zhykos" Cicognani
    7   Version: 2.0
     7  Version: 2.1
    88  Author URI: http://www.zhyweb.org/
    99 */
     
    6969     */
    7070    public function orgZhyweb_wpCommentContest_loadJsCSS() {
    71         // Comment Contest Javascript file (needs jQuery)
    72         wp_register_script('OrgZhywebWPCommentContest.js', plugins_url('/js/OrgZhyweb_WPCommentContest_jQuery.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'));
     71        // Comment Contest Javascript file (needs jQuery, jQueryUI and jQueryUI Dialog)
     72        wp_register_script('OrgZhywebWPCommentContest.js', plugins_url('/js/OrgZhyweb_WPCommentContest_jQuery.min.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'));
    7373        wp_enqueue_script('OrgZhywebWPCommentContest.js');
     74               
     75        // Tooltips by TipTip (needs jQuery)
     76        wp_register_script('TipTip.js', plugins_url('/js/jquery.tipTip.minified.js', __FILE__), array('jquery'));
     77        wp_enqueue_script('TipTip.js');
    7478       
    7579        // jQueryUI Dialog style
    7680        wp_enqueue_style('wp-jquery-ui-dialog');
     81       
     82        // Plugin CSS
     83        wp_enqueue_style('comment-contest.css', plugins_url('/css/comment-contest.min.css', __FILE__));
    7784    }
    7885   
     
    99106   
    100107    /**
    101      * Modify the posts table.
    102108     * Display the content of the contest column. It's a link to contest page.
    103109     * If no comment posted, cannot launch contest.
  • comment-contest/trunk/js/OrgZhyweb_WPCommentContest_jQuery.js

    r688171 r754147  
    1717
    1818/*
    19  * Display/Hide empty messages in table (messages shown because there isn't any comment in the table)
    20  */
    21 function updateEmptyTableMessages() {
    22     // Display/Hide "no comment found" message in Contest table
    23     if (jQuery('#the-list-contest tr:visible').size() <= 0) {
    24         jQuery("#comment-contest-not-found-tr").show();
    25     } else {
    26         jQuery("#comment-contest-not-found-tr").hide();
    27     }
    28    
    29     // Display/Hide "no comment found" message in Removed Comments table
    30     if (jQuery('#the-list-no-contest tr:visible').size() <= 0) {
    31         jQuery("#comment-no-contest-not-found-tr").show();
    32     } else {
    33         jQuery("#comment-no-contest-not-found-tr").hide();
    34     }
    35 }
    36 
    37 /*
    38  * Move comment into Removed Comments (table with comment which wont be used for contest)
     19 * Selected comment won't be used for contest
     20 * @param commentID Comment ID
     21 * @since 2.0
    3922 */
    4023function commentContestDelete(commentID) {
    41     jQuery("#comment-contest-" + commentID).hide();
    42     jQuery("#comment-no-contest-" + commentID).show();
    43    
    44     updateEmptyTableMessages();
    45 }
    46 
    47 /*
    48  * Move comment into Removed Comments (table with comment which wont be used for contest)
     24    jQuery("#comment-contest-" + commentID).removeClass("cheatComment");
     25    jQuery("#comment-contest-" + commentID).addClass("removedComment");
     26    jQuery("#restoreLink-" + commentID).show();
     27    jQuery("#deleteLink-" + commentID).hide();
     28   
     29    jQuery("#stopCheatLink-" + commentID).hide();
     30    jQuery("#cheatLink-" + commentID).show();
     31}
     32
     33/*
     34 * Selected comment must be used for contest
     35 * @param commentID Comment ID
     36 * @since 2.0
    4937 */
    5038function commentContestRestore(commentID) {
    51     jQuery("#comment-contest-" + commentID).show();
    52     jQuery("#comment-no-contest-" + commentID).hide();
    53    
    54     updateEmptyTableMessages();
     39    jQuery("#comment-contest-" + commentID).removeClass("removedComment");
     40    jQuery("#deleteLink-" + commentID).show();
     41    jQuery("#restoreLink-" + commentID).hide();
     42}
     43
     44/**
     45 * Selected comment will win (if winners number greater than cheating comments number)
     46 * @param commentID Comment ID
     47 * @since 2.1
     48 */
     49function commentContestCheat(commentID) {
     50    jQuery("#comment-contest-" + commentID).removeClass("removedComment");
     51    jQuery("#comment-contest-" + commentID).addClass("cheatComment");
     52    jQuery("#stopCheatLink-" + commentID).show();
     53    jQuery("#cheatLink-" + commentID).hide();
     54
     55    jQuery("#deleteLink-" + commentID).show();
     56    jQuery("#restoreLink-" + commentID).hide();
     57}
     58
     59/**
     60 * Selected comment won't win anymore (except if it will be randomly choosen during the contest last step)
     61 * @param commentID Comment ID
     62 * @since 2.1
     63 */
     64function commentContestStopCheat(commentID) {
     65    jQuery("#comment-contest-" + commentID).removeClass("cheatComment");
     66    jQuery("#stopCheatLink-" + commentID).hide();
     67    jQuery("#cheatLink-" + commentID).show();
    5568}
    5669
    5770/*
    5871 * Select all comments in the table which have the role "roleID"
    59  */
    60 function selectRoleInTable(roleID, tableID) {
     72 * @since 2.1
     73 */
     74function selectRole(roleID) {
    6175    // Browse all table lines
    62     jQuery('#' + tableID + ' tr').each(function() {
     76    jQuery('#contestForm tr').each(function() {
    6377        var line = jQuery(this);
    6478       
     
    7892
    7993/*
    80  * Select all comments (in the contest table) which have the role "roleID"
    81  */
    82 function selectRoleInContest(roleID) {
    83     selectRoleInTable(roleID, "inContestForm");
    84 }
    85 
    86 /*
    87  * Select all comments (in the deleted comments table) which have the role "roleID"
    88  */
    89 function selectRoleInNoContest(roleID) {
    90     selectRoleInTable(roleID, "outContestForm");
    91 }
    92 
    93 /*
    9494 * Shuffle an array
    9595 * @param myArray Array to shuffle
    9696 * @see http://sedition.com/perl/javascript-fy.html
     97 * @since 2.0
    9798 */
    9899function fisherYates(myArray) {
     
    113114
    114115jQuery(document).ready(function() {
    115     // ------------------------ DELETE COMMENTS FROM CONTEST -------------------------------
     116   
     117    // ------------------------ Tooltips (Help) --------------------------------
     118
     119    // Code from BackWPup - WordPress Backup Plugin
     120    // http://marketpress.com/product/backwpup-pro/
     121   
     122    jQuery('.help').tipTip({
     123            'attribute': 'title',
     124            'fadeIn': 50,
     125            'fadeOut': 50,
     126            'keepAlive': true,
     127            'activation': 'hover',
     128            'maxWidth': 400
     129    });
     130
     131    jQuery(".help").tipTip();
     132   
     133    // ------------------------ END Tooltips (Help) ----------------------------
     134
     135
     136    // ------------------------ DELETE COMMENTS FROM CONTEST -------------------
     137    /**
     138     * Remove all checked comments
     139     * @since 2.0
     140     */
    116141    function deleteSelectedComments() {
    117         jQuery('#inContestForm input[id^="cb-select"]:checked').each(function(index, domElem) {
     142        jQuery('#contestForm input[id^="cb-select"]:checked').each(function(index, domElem) {
    118143            if (domElem.id.indexOf("-all-") == -1) {
    119144                commentContestDelete(jQuery(this).val());
     
    124149    }
    125150   
    126     jQuery("#inContestForm #doaction").click(function() {
    127         if (jQuery('#inContestForm select[name="action"]').val() == 'delete') {
     151    jQuery("#contestForm #doaction").click(function() {
     152        if (jQuery('#contestForm select[name="action"]').val() == 'delete') {
    128153            deleteSelectedComments();
    129154        }
    130155    });
    131156   
    132     jQuery("#inContestForm #doaction2").click(function() {
    133         if (jQuery('#inContestForm select[name="action2"]').val() == 'delete') {
     157    jQuery("#contestForm #doaction2").click(function() {
     158        if (jQuery('#contestForm select[name="action2"]').val() == 'delete') {
    134159            deleteSelectedComments();
    135160        }
    136161    });
    137     // ------------------------ end DELETE COMMENTS FROM CONTEST ---------------------------
    138    
    139    
    140     // ------------------------ RESTORE COMMENTS FOR CONTEST -------------------------------
     162    // ------------------------ end DELETE COMMENTS FROM CONTEST ---------------
     163   
     164   
     165    // ------------------------ RESTORE COMMENTS FOR CONTEST -------------------
     166    /**
     167     * Restore all checked comments
     168     * @since 2.0
     169     */
    141170    function restoreSelectedComments() {
    142         jQuery('#outContestForm input[id^="cb-select"]:checked').each(function(index, domElem) {
     171        jQuery('#contestForm input[id^="cb-select"]:checked').each(function(index, domElem) {
    143172            if (domElem.id.indexOf("-all-") == -1) {
    144173                commentContestRestore(jQuery(this).val());
     
    149178    }
    150179   
    151     jQuery("#outContestForm #doaction").click(function() {
    152         if (jQuery('#outContestForm select[name="action"]').val() == 'restore') {
     180    jQuery("#contestForm #doaction").click(function() {
     181        if (jQuery('#contestForm select[name="action"]').val() == 'restore') {
    153182            restoreSelectedComments();
    154183        }
    155184    });
    156185   
    157     jQuery("#outContestForm #doaction2").click(function() {
    158         if (jQuery('#outContestForm select[name="action2"]').val() == 'restore') {
     186    jQuery("#contestForm #doaction2").click(function() {
     187        if (jQuery('#contestForm select[name="action2"]').val() == 'restore') {
    159188            restoreSelectedComments();
    160189        }
    161190    });
    162     // ------------------------ end RESTORE COMMENTS FOR CONTEST ---------------------------
    163    
    164    
    165     // ------------------------ CHECK FORM VALUES -------------------------------
     191    // ------------------------ end RESTORE COMMENTS FOR CONTEST ---------------
     192   
     193   
     194    // ------------------------ RESULT TABLE -----------------------------------
    166195    jQuery("#dialog-modal-winners").dialog({
    167196        height: 500,
     
    171200        dialogClass: 'wp-dialog',
    172201        open: function() {
     202            // While opening the result dialog...
     203            var nbWinners = jQuery('#zwpcc_nb_winners').val();
     204            var commentsNormal = new Array();
     205            var commentsCheat = new Array();
     206           
    173207            // Get all comments ID which are used for the contest
    174             var comments = new Array();
    175             jQuery('#inContestForm tr').each(function() {
     208            jQuery('#contestForm tr').each(function() {
    176209                var line = jQuery(this);
    177                 if (line.css("display") != "none") {
    178                     // Get only displayed lines
     210               
     211                // Get only normal et cheating lines
     212                if (!line.hasClass("removedComment")) {
    179213                    var commentID = line.find('.zhyweb_comment_contest_id').html();
    180                     if (commentID != null && commentID != "") {
    181                         // Don't get table header and footer
    182                         comments.push(commentID);
     214
     215                    // Don't get table header and footer
     216                    if (commentID != null && commentID != "") {                       
     217                        if (line.hasClass("cheatComment")) {
     218                            commentsCheat.push(commentID);
     219                        } else {
     220                            commentsNormal.push(commentID);
     221                        }
    183222                    }
    184223                }
     
    190229            });
    191230           
    192             // Randomize array
    193             fisherYates(comments);
    194            
    195             // Display winners
    196             var nbWinners = jQuery('#zwpcc_nb_winners').val();
    197             for (var i = 0; i < nbWinners; i++) {
     231            // Randomize arrays
     232            fisherYates(commentsCheat);
     233            if (commentsCheat.length < nbWinners) {
     234                // Optimisation
     235                fisherYates(commentsNormal);
     236            }
     237           
     238            // Show winners
     239            var comments = jQuery.merge(commentsCheat, commentsNormal);
     240            for (var i = 0; i < nbWinners && i < comments.length; i++) {
    198241                jQuery("#result-comment-contest-" + comments[i]).show();
    199             }
    200         }
    201     });
    202    
     242                if (i >= 1) {
     243                    // Sort table
     244                    jQuery("#result-comment-contest-" + comments[i - 1]).after(jQuery("#result-comment-contest-" + comments[i]));
     245                }
     246            }
     247        }
     248    });
     249   
     250    // Launch contest Button
    203251    jQuery("#zwpcc_form").submit(function() {
    204252        launch = true;
     
    223271        return false;
    224272    });
    225     // ------------------------ end CHECK FORM VALUES -------------------------------
     273    // ------------------------ end RESULT TABLE -------------------------------
    226274   
    227275});
  • comment-contest/trunk/lang/comment-contest-fr_FR.po

    r688171 r754147  
    33"Project-Id-Version: Comment Contest v2.0\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: \n"
    6 "PO-Revision-Date: 2013-03-24 15:48:08+0000\n"
    7 "Last-Translator: Thomas 'zhykos' Cicognani <tcicognani@zhyweb.org>\n"
     5"POT-Creation-Date: 2013-08-09 18:37+0100\n"
     6"PO-Revision-Date: 2013-08-09 18:38+0100\n"
     7"Last-Translator: Thomas \"Zhykos\" Cicognani <tcicognani@zhyweb.org>\n"
    88"Language-Team: \n"
     9"Language: fr_FR\n"
    910"MIME-Version: 1.0\n"
    1011"Content-Type: text/plain; charset=UTF-8\n"
    1112"Content-Transfer-Encoding: 8bit\n"
    1213"Plural-Forms: nplurals=2; plural=n>1;\n"
    13 "X-Generator: CSL v1.x\n"
    14 "X-Poedit-Language: French\n"
    15 "X-Poedit-Country: FRANCE\n"
    16 "X-Poedit-SourceCharset: utf-8\n"
    17 "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
     14"X-Generator: Poedit 1.5.5\n"
     15"X-Poedit-SourceCharset: UTF-8\n"
     16"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
     17"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
    1818"X-Poedit-Basepath: \n"
    19 "X-Poedit-Bookmarks: \n"
     19"X-Textdomain-Support: yes\n"
    2020"X-Poedit-SearchPath-0: .\n"
    21 "X-Textdomain-Support: yes"
    22 
    23 #: comment-contest.php:85
     21
     22# @ comment-contest
     23#: comment-contest.php:92 php/OrgZhyweb_WPCommentContest_MainUI.php:64
    2424#: php/OrgZhyweb_WPCommentContest_MainUI.php:65
    25 #: php/OrgZhyweb_WPCommentContest_MainUI.php:66
    26 #@ comment-contest
     25#: D:\www\zhyweb\wp-content\plugins\comment-contest/comment-contest.php:92
     26#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:64
     27#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:65
    2728msgid "Comment Contest"
    2829msgstr "Comment Contest"
    2930
    30 #: comment-contest.php:96
    31 #@ comment-contest
     31# @ comment-contest
     32#: comment-contest.php:103
     33#: D:\www\zhyweb\wp-content\plugins\comment-contest/comment-contest.php:103
    3234msgid "Contest"
    3335msgstr "Concours"
    3436
    35 #: comment-contest.php:115
    36 #: php/OrgZhyweb_WPCommentContest_MainUI.php:74
    37 #@ comment-contest
     37# @ comment-contest
     38#: comment-contest.php:121 php/OrgZhyweb_WPCommentContest_MainUI.php:74
     39#: D:\www\zhyweb\wp-content\plugins\comment-contest/comment-contest.php:121
     40#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:74
    3841msgid "Launch contest"
    3942msgstr "Lancer le concours"
    4043
    41 #: comment-contest.php:117
    42 #@ comment-contest
     44# @ comment-contest
     45#: comment-contest.php:123
     46#: D:\www\zhyweb\wp-content\plugins\comment-contest/comment-contest.php:123
    4347msgid "No comment"
    4448msgstr "Aucun commentaire"
    4549
     50# @ comment-contest
    4651#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:65
    4752#: php/OrgZhyweb_WPCommentContest_TableResults.php:33
    48 #@ comment-contest
     53#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:65
     54#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableResults.php:33
    4955msgid "Author"
    5056msgstr "Auteur"
    5157
     58# @ comment-contest
    5259#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:66
    5360#: php/OrgZhyweb_WPCommentContest_TableResults.php:34
    54 #@ comment-contest
     61#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:66
     62#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableResults.php:34
    5563msgid "Comment"
    5664msgstr "Commentaire"
    5765
     66# @ comment-contest
    5867#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:102
    59 #, php-format
    60 #@ comment-contest
     68#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:102
     69#, php-format
    6170msgid "Select: %s"
    6271msgstr "Sélectionner : %s"
    6372
     73# @ comment-contest
    6474#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:135
    65 #@ comment-contest
     75#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:135
    6676msgid "Select comment"
    6777msgstr "Sélectionner le commentaire"
    6878
    69 #. translators: 2: comment date, 3: comment time
     79# @ comment-contest
    7080#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:221
    71 #, php-format
    72 #@ comment-contest
     81#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:221
     82#, php-format
    7383msgid "Submitted on <a href=\"%1$s\">%2$s at %3$s</a>"
    7484msgstr "Soumis le <a href=\"%1$s\">%2$s à %3$s</a>"
    7585
    76 #. translators: comment date format. See http://php.net/date
     86# @ comment-contest
    7787#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:222
    78 #@ comment-contest
     88#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:222
    7989msgid "Y/m/d"
    8090msgstr "d / m / Y"
    8191
    82 #. translators: comment time format. See http://php.net/date
     92# @ comment-contest
    8393#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:229
    84 #, php-format
    85 #@ comment-contest
     94#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:229
     95#, php-format
    8696msgid "In reply to <a href=\"%1$s\">%2$s</a>."
    8797msgstr "En réponse à <a href=\"%1$s\">%2$s</a>."
    8898
    89 #: php/OrgZhyweb_WPCommentContest_MainUI.php:48
    90 #@ comment-contest
     99# @ comment-contest
     100#: php/OrgZhyweb_WPCommentContest_MainUI.php:47
     101#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:47
    91102msgid "URL must have 'post' parameter as integer"
    92103msgstr "Le paramètre 'post' dans l'URL doit être un nombre entier"
    93104
    94 #: php/OrgZhyweb_WPCommentContest_MainUI.php:51
    95 #@ comment-contest
     105# @ comment-contest
     106#: php/OrgZhyweb_WPCommentContest_MainUI.php:50
     107#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:50
    96108msgid "You have to be administrator to access this page"
    97 msgstr "Vous devez disposer de droits d'administrateur pour accéder à cette page"
    98 
    99 #: php/OrgZhyweb_WPCommentContest_MainUI.php:69
    100 #, php-format
    101 #@ comment-contest
     109msgstr ""
     110"Vous devez disposer de droits d'administrateur pour accéder à cette page"
     111
     112# @ comment-contest
     113#: php/OrgZhyweb_WPCommentContest_MainUI.php:68
     114#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:68
     115#, php-format
    102116msgid "Contest on post \"%s\""
    103117msgstr "Concours pour l'article \"%s\""
    104118
    105 #: php/OrgZhyweb_WPCommentContest_MainUI.php:73
    106 #@ comment-contest
     119# @ comment-contest
     120#: php/OrgZhyweb_WPCommentContest_MainUI.php:72
     121#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:72
    107122msgid "Number of winners:"
    108123msgstr "Nombre de gagnants :"
    109124
     125#: php/OrgZhyweb_WPCommentContest_MainUI.php:73
     126#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:73
     127msgid "Number of comments used to determine winners"
     128msgstr "Nombre de commentaires utilisés pour déterminer les gagnants"
     129
     130# @ comment-contest
    110131#: php/OrgZhyweb_WPCommentContest_MainUI.php:79
    111 #@ comment-contest
     132#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:79
    112133msgid "Winners"
    113134msgstr "Gagnants"
    114135
     136# @ comment-contest
    115137#: php/OrgZhyweb_WPCommentContest_MainUI.php:108
    116 #@ comment-contest
     138#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:108
    117139msgid "Comments used for the contest:"
    118140msgstr "Commentaires utilisés pour le concours :"
    119141
    120 #: php/OrgZhyweb_WPCommentContest_MainUI.php:117
    121 #@ comment-contest
    122 msgid "Not used comments:"
    123 msgstr "Commentaires non utilisés :"
    124 
    125 #: php/OrgZhyweb_WPCommentContest_MainUI.php:130
    126 #@ comment-contest
     142#: php/OrgZhyweb_WPCommentContest_MainUI.php:109
     143#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:109
     144msgid ""
     145"The table below shows all available comments. You have to choose which ones "
     146"you want for the contest.<br /> - You can select users who have the same "
     147"Wordpress role (see User page).<br /> - You can remove comments from contest "
     148"(don't be used to determine winners). Removed comments still are visible "
     149"with red background color.<br /> - You can also cheat by adding comments "
     150"into a cheating list. All cheating comments will always win! (only if the "
     151"cheating list length is less than the winners number). Cheating comments "
     152"still are visible with green background color.<br /> - The other comments "
     153"(white/grey background) are only used if there isn't enough cheating "
     154"comments."
     155msgstr ""
     156"Le tableau ci-dessous affiche tous les commentaires disponibles. Vous devez "
     157"choisir ceux à utiliser pour le concours.<br /> - Vous pouvez choisir des "
     158"utilisateurs ayant le même rôle Wordpress (voir la page des Utilisateurs)."
     159"<br /> - Vous pouvez supprimer un commentaire du concours (ne sera donc pas "
     160"utilisé pour déterminer les gagnants). Les commentaires supprimés seront "
     161"toujours visibles mais affichés avec un fond rouge.<br /> - Vous pouvez "
     162"aussi tricher en ajoutant des commentaires dans la liste de triche. Tous les "
     163"commentaires de triche gagnent ! (seulement si la liste de triche est plus "
     164"petite que le nombre de gagnants). Les commentaires de triche sont affichés "
     165"avec un fond vert.<br /> - Les autres comentaires (fond blanc/gris) ne sont "
     166"utilisés que s'il n'a pas assez de commentaire de triche."
     167
     168# @ comment-contest
     169#: php/OrgZhyweb_WPCommentContest_MainUI.php:126
     170#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:126
    127171msgid "URL 'post' parameter has to be valid"
    128172msgstr "Le paramètre 'post' dans l'URL n'est pas valide"
    129173
    130 #: php/OrgZhyweb_WPCommentContest_MainUI.php:142
    131 #, php-format
    132 #@ comment-contest
    133 msgid "To use the plug-in, go to <a href=\"%s\">articles page</a> then you'll find a link to launch contests"
    134 msgstr "Pour utiliser le plug-in, aller à la <a href=\"%s\">page des articles</a> puis cliquez sur le lien dédié au lancement de concours"
    135 
    136 #: php/OrgZhyweb_WPCommentContest_MainUI.php:144
    137 #@ comment-contest
     174# @ comment-contest
     175#: php/OrgZhyweb_WPCommentContest_MainUI.php:138
     176#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:138
     177#, php-format
     178msgid ""
     179"To use the plug-in, go to <a href=\"%s\">articles page</a> then you'll find "
     180"a link to launch contests"
     181msgstr ""
     182"Pour utiliser le plug-in, aller à la <a href=\"%s\">page des articles</a> "
     183"puis cliquez sur le lien dédié au lancement de concours"
     184
     185# @ comment-contest
     186#: php/OrgZhyweb_WPCommentContest_MainUI.php:140
     187#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:140
    138188msgid "Support:"
    139189msgstr "Support :"
    140190
    141 #: php/OrgZhyweb_WPCommentContest_MainUI.php:145
    142 #@ comment-contest
     191# @ comment-contest
     192#: php/OrgZhyweb_WPCommentContest_MainUI.php:141
     193#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:141
    143194msgid "Official page:"
    144195msgstr "Page officielle :"
    145196
    146 #: php/OrgZhyweb_WPCommentContest_MainUI.php:149
    147 #@ comment-contest
     197# @ comment-contest
     198#: php/OrgZhyweb_WPCommentContest_MainUI.php:145
     199#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:145
    148200msgid "Debug:"
    149201msgstr "Debug :"
    150202
    151 #: php/OrgZhyweb_WPCommentContest_TableRemoveUI.php:41
    152 #: php/OrgZhyweb_WPCommentContest_TableRemoveUI.php:46
    153 #@ comment-contest
     203# @ comment-contest
     204#: php/OrgZhyweb_WPCommentContest_TableUI.php:41
     205#: php/OrgZhyweb_WPCommentContest_TableUI.php:50
     206#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:41
     207#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:50
     208msgid "Delete"
     209msgstr "Supprimer"
     210
     211# @ comment-contest
     212#: php/OrgZhyweb_WPCommentContest_TableUI.php:42
     213#: php/OrgZhyweb_WPCommentContest_TableUI.php:51
     214#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:42
     215#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:51
    154216msgid "Restore"
    155217msgstr "Restaurer"
    156218
    157 #: php/OrgZhyweb_WPCommentContest_TableUI.php:41
    158 #: php/OrgZhyweb_WPCommentContest_TableUI.php:46
    159 #@ comment-contest
    160 msgid "Delete"
    161 msgstr "Supprimer"
    162 
     219#: php/OrgZhyweb_WPCommentContest_TableUI.php:43
     220#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:43
     221msgid "Cheat"
     222msgstr "Tricher"
     223
     224#: php/OrgZhyweb_WPCommentContest_TableUI.php:44
     225#: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:44
     226msgid "Stop cheating"
     227msgstr "Ne plus tricher"
  • comment-contest/trunk/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php

    r688171 r754147  
    248248        foreach ($actions as $action => $link) {
    249249            ++$i;
    250             if ($i == 1) {
    251                 $sep = '';
    252             } else {
     250            $sep = '';
     251            if ($i == 3) {
    253252                $sep = ' | ';
    254253            }
  • comment-contest/trunk/php/OrgZhyweb_WPCommentContest_MainUI.php

    r688171 r754147  
    1818
    1919require_once 'OrgZhyweb_WPCommentContest_TableUI.php';
    20 require_once 'OrgZhyweb_WPCommentContest_TableRemoveUI.php';
    2120require_once 'OrgZhyweb_WPCommentContest_TableResults.php';
    2221
     
    7170            // Contest parameters
    7271            echo "<div id=\"zwpcc_error_message\" style=\"color: red\"></div>"
    73                . __('Number of winners:', "comment-contest") . " <input type=\"text\" id=\"zwpcc_nb_winners\" value=\"1\"/><br /><br />"
     72               . __('Number of winners:', "comment-contest") . " <input type=\"text\" id=\"zwpcc_nb_winners\" value=\"1\"/>"
     73               . "<img src=\"$this->pluginDir/img/help.png\" alt=\"Help\" class=\"help\" title=\"". __('Number of comments used to determine winners', "comment-contest") . "\" /><br /><br />"
    7474               . "<input type=\"submit\" class=\"button action\" value=\"" . __('Launch contest', "comment-contest") . "\" />";
    7575
     
    106106            $this->displayHeaderPage($postID);
    107107           
    108             echo "<br /><br /><hr /><h3>" . __('Comments used for the contest:', "comment-contest") . "</h3>
    109                 <div id='inContestForm'>";
     108            echo "<br /><br /><hr /><h3 style=\"float: left;\">" . __('Comments used for the contest:', "comment-contest") . "</h3>
     109                <img src=\"$this->pluginDir/img/help.png\" alt=\"Help\" class=\"help\" id=\"mainHelp\" title=\"". __("The table below shows all available comments. You have to choose which ones you want for the contest.<br />"
     110                . " - You can select users who have the same Wordpress role (see User page).<br />"
     111                . " - You can remove comments from contest (don't be used to determine winners). Removed comments still are visible with red background color.<br />"
     112                . " - You can also cheat by adding comments into a cheating list. All cheating comments will always win! (only if the cheating list length is less than the winners number). Cheating comments still are visible with green background color.<br />"
     113                . " - The other comments (white/grey background) are only used if there isn't enough cheating comments.", "comment-contest") . "\" />
     114                <div id='contestForm'>";
    110115                       
    111116            $list = new OrgZhyweb_WPCommentContest_TableUI($postID);
     
    113118            $list->views();
    114119            $list->display();
    115            
    116             echo "</div><br /><hr />
    117                 <h3>" . __('Not used comments:', "comment-contest") . "</h3>
    118                     <div id='outContestForm'>";
    119            
    120             $list2 = new OrgZhyweb_WPCommentContest_TableRemoveUI($postID);
    121             $list2->prepare_items();
    122             $list2->views();
    123             $list2->display();
    124120           
    125121            echo "</div>";
  • comment-contest/trunk/php/OrgZhyweb_WPCommentContest_TableUI.php

    r688171 r754147  
    3939    protected function getActions($commentID) {
    4040         $actions = array(
    41             'delete' => "<a href='javascript:;' onclick='commentContestDelete($commentID)' class='delete'>" . __('Delete', "comment-contest") . '</a>');
     41            'delete' => "<a href='javascript:;' onclick='commentContestDelete($commentID)' id='deleteLink-$commentID' class='delete'>" . __('Delete', "comment-contest") . '</a>',
     42            'restore' => "<a href='javascript:;' onclick='commentContestRestore($commentID)' id='restoreLink-$commentID' class='restoreLink'>" . __('Restore', "comment-contest") . '</a>',
     43            'cheat' => "<a href='javascript:;' onclick='commentContestCheat($commentID)' id='cheatLink-$commentID' class='cheatLink'>" . __('Cheat', "comment-contest") . '</a>',
     44            'stopcheat' => "<a href='javascript:;' onclick='commentContestStopCheat($commentID)' id='stopCheatLink-$commentID' class='stopCheatLink'>" . __('Stop cheating', "comment-contest") . '</a>');
    4245         return $actions;
    4346    }
    4447   
    4548    public function get_bulk_actions() {
    46     $actions = array('delete' => __('Delete', "comment-contest"));
     49    $actions = array(
     50            'delete' => __('Delete', "comment-contest"),
     51            'restore' => __('Restore', "comment-contest"));
    4752        return $actions;
    4853    }
    4954
    5055    protected function getViewFunction($roleID) {
    51         return "selectRoleInContest(\"$roleID\")";
     56        return "selectRole(\"$roleID\")";
    5257    }
    5358}
  • comment-contest/trunk/readme.txt

    r688171 r754147  
    44Tags: comments, contest, concours, commentaire, zhykos, zhyweb
    55Requires at least: 3.3
    6 Tested up to: 3.5.1
     6Tested up to: 3.6
    77Stable tag: trunk
    88License: GPLv2 or later
     
    43433. Manage the comments
    44444. Choose to delete a comment from the contest
    45 5. You can restore deleted comments
    46 6. Result table with winner(s)
     455. You can restore deleted comments (deleted comments are red)
     466. Cheat: this comment will win! (cheating comments are green)
     477. Result table with winner(s)
    4748
    4849== Changelog ==
     50
     51= 2.1 =
     52* Fix: Result array wasn't sorted (most recent comment was always on the top)
     53* New: Add cheat. Selected comments always win
     54* New: Add help
     55* Update: Only use one table to choose comments
     56* Misc: Check compatibility with Wordpress 3.6
     57* Misc: Minimize Javascript and CSS
    4958
    5059= 2.0 =
     
    122131* Compatibility with Wordpress 3.5.1
    123132
     133= 2.1 =
     134* New table
     135* Cheat and help added
     136* Compatibility with Wordpress 3.6
     137
    124138== Credits ==
    125139
    126140= Images =
    127141* Comment contest icon is based on http://www.iconfinder.com/icondetails/49848/128/media_random_shuffle_icon and http://www.iconfinder.com/icondetails/33565/64/chat_comment_talk_icon
     142* Help icon by http://www.visualpharm.com/
Note: See TracChangeset for help on using the changeset viewer.