Plugin Directory

Changeset 828725


Ignore:
Timestamp:
12/26/2013 05:36:43 PM (12 years ago)
Author:
zhykos
Message:

Version 2.2

  • New features : filters
Location:
comment-contest/trunk
Files:
4 added
17 edited

Legend:

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

    r828636 r828725  
    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.1.3
     7  Version: 2.2
    88  Author URI: http://www.zhyweb.org/
    99 */
     
    6969     */
    7070    public function orgZhyweb_wpCommentContest_loadJsCSS() {
    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'));
     71        // Comment Contest Javascript file (needs jQuery, jQueryUI, jQueryUI Dialog and jQueryUI DatePicker)
     72        wp_register_script('OrgZhywebWPCommentContest.js', plugins_url('/js/OrgZhyweb_WPCommentContest_jQuery.min.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-datepicker'));
    7373        wp_enqueue_script('OrgZhywebWPCommentContest.js');
    7474               
     
    7777        wp_enqueue_script('TipTip.js');
    7878       
    79         // jQueryUI Dialog style
    80         wp_enqueue_style('wp-jquery-ui-dialog');
     79        // jQuery UI style
     80        wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css');
    8181       
    8282        // Plugin CSS
  • comment-contest/trunk/css/comment-contest.css

    r754147 r828725  
    5050.subsubsub {
    5151    clear: both;
     52}
     53
     54#filters {
     55    border-left: 1px dotted black;
     56    padding-left: 10px;
     57    margin-bottom: 20px;
    5258}
    5359
  • comment-contest/trunk/css/comment-contest.min.css

    r754147 r828725  
    1 .removedComment{background-color:#ffe5eb}.cheatComment{background-color:#ddffc9}.restoreLink{color:#006905;display:none}.cheatLink{color:#006905}.stopCheatLink{color:#bc0b0b;display:none}.help{height:15px;vertical-align:middle;margin-left:10px}#mainHelp{margin-top:15px}.subsubsub{clear:both}#tiptip_holder{display:none;position:absolute;top:0;left:0;z-index:99999}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_left{padding-right:5px}#tiptip_content{font-size:11px;color:#fff;text-shadow:0 0 2px #000;padding:4px 8px;border:1px solid rgba(255,255,255,.25);background-color:#191919;background-color:rgba(25,25,25,.92);background-image:-webkit-gradient(linear,0 0,0 100%,from(transparent),to(#000));border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;box-shadow:0 0 3px #555;-webkit-box-shadow:0 0 3px #555;-moz-box-shadow:0 0 3px #555}#tiptip_content code{background:#1d94cf;color:#fff;text-shadow:none;padding:2px;font-size:12px}#tiptip_content a{color:#0cf}#tiptip_content a:hover{color:#f93}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border:6px solid transparent;height:0;width:0}#tiptip_holder.tip_top #tiptip_arrow{border-top-color:#fff;border-top-color:rgba(255,255,255,.35)}#tiptip_holder.tip_bottom #tiptip_arrow{border-bottom-color:#fff;border-bottom-color:rgba(255,255,255,.35)}#tiptip_holder.tip_right #tiptip_arrow{border-right-color:#fff;border-right-color:rgba(255,255,255,.35)}#tiptip_holder.tip_left #tiptip_arrow{border-left-color:#fff;border-left-color:rgba(255,255,255,.35)}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#191919;border-top-color:rgba(25,25,25,.92)}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#191919;border-bottom-color:rgba(25,25,25,.92)}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#191919;border-right-color:rgba(25,25,25,.92)}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#191919;border-left-color:rgba(25,25,25,.92)}
     1.removedComment{background-color:#ffe5eb}.cheatComment{background-color:#ddffc9}.restoreLink{color:#006905;display:none}.cheatLink{color:#006905}.stopCheatLink{color:#bc0b0b;display:none}.help{height:15px;vertical-align:middle;margin-left:10px}#mainHelp{margin-top:15px}.subsubsub{clear:both}#filters{border-left:1px dotted black;padding-left:10px;margin-bottom:20px}#tiptip_holder{display:none;position:absolute;top:0;left:0;z-index:99999}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_left{padding-right:5px}#tiptip_content{font-size:11px;color:#fff;text-shadow:0 0 2px #000;padding:4px 8px;border:1px solid rgba(255,255,255,0.25);background-color:#191919;background-color:rgba(25,25,25,0.92);background-image:-webkit-gradient(linear,0 0,0 100%,from(transparent),to(#000));border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;box-shadow:0 0 3px #555;-webkit-box-shadow:0 0 3px #555;-moz-box-shadow:0 0 3px #555}#tiptip_content code{background:#1d94cf;color:#fff;text-shadow:none;padding:2px;font-size:12px}#tiptip_content a{color:#0CF}#tiptip_content a:hover{color:#F93}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border:6px solid transparent;height:0;width:0}#tiptip_holder.tip_top #tiptip_arrow{border-top-color:#fff;border-top-color:rgba(255,255,255,0.35)}#tiptip_holder.tip_bottom #tiptip_arrow{border-bottom-color:#fff;border-bottom-color:rgba(255,255,255,0.35)}#tiptip_holder.tip_right #tiptip_arrow{border-right-color:#fff;border-right-color:rgba(255,255,255,0.35)}#tiptip_holder.tip_left #tiptip_arrow{border-left-color:#fff;border-left-color:rgba(255,255,255,0.35)}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#191919;border-top-color:rgba(25,25,25,0.92)}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#191919;border-bottom-color:rgba(25,25,25,0.92)}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#191919;border-right-color:rgba(25,25,25,0.92)}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#191919;border-left-color:rgba(25,25,25,0.92)}
  • comment-contest/trunk/js/OrgZhyweb_WPCommentContest_jQuery.js

    r754147 r828725  
    7777        var line = jQuery(this);
    7878       
    79         // Search for span tag with class zhyweb_comment_contest_role" which is equal to "roleID"
     79        // Search for span tag with class "zhyweb_comment_contest_role" which is equal to "roleID"
    8080        // A user can have several roles, separated by a pipe (|)
    8181        var rolesStr = line.find('.zhyweb_comment_contest_role').text();
     
    110110}
    111111
     112/**
     113 * Open / Hide filters DIV component
     114 * @since 2.2
     115 */
     116function toggleFilters(pluginURL) {
     117    var filtersDIV = jQuery('#filters');
     118   
     119    filtersDIV.fadeToggle("slow", "linear", function() {
     120        if (filtersDIV.is(':visible')) {
     121            jQuery('#filtersImg').attr('src', pluginURL + '/img/minus.png');
     122        } else {
     123            jQuery('#filtersImg').attr('src', pluginURL + '/img/plus.png');
     124        }
     125    });
     126}
     127
     128/**
     129 * Select duplicated lines in the table.
     130 * Lines are duplicated when a certain line parameter is the same in two lines.
     131 * @param cssClassParameter [string] CSS class name for the searched parameter
     132 * @since 2.2
     133 */
     134function selectDuplicates(cssClassParameter) {
     135    var line1nb = 0;
     136    jQuery('#contestForm tr').each(function() {
     137        // Browse all table lines
     138        var line1 = jQuery(this);
     139       
     140        var line2nb = 0;
     141        jQuery('#contestForm tr').each(function() {
     142            // Browse all table lines
     143            var line2 = jQuery(this);
     144            if (line1nb != line2nb) { // Compare two different lines
     145                var data1 = line1.find('.' + cssClassParameter).text();
     146                var data2 = line2.find('.' + cssClassParameter).text();
     147                if (data1 == data2 && data1 != "") {
     148                    // If data are equal => check both lines
     149                    line1.find('input[id^="cb-select"]').each(function() {
     150                        jQuery(this).attr("checked", true);
     151                    });
     152                    line2.find('input[id^="cb-select"]').each(function() {
     153                        jQuery(this).attr("checked", true);
     154                    });
     155                }
     156            }
     157           
     158            line2nb++;
     159        });
     160       
     161        line1nb++;
     162    });
     163}
     164
    112165// -----------------------------------------------------------------------------
    113166// jQuery ready document
    114167
    115168jQuery(document).ready(function() {
     169   
     170    // ------------------------ IP address filter ------------------------------
     171   
     172    jQuery('#ipAddressFilter').click(function() {
     173        selectDuplicates("zhyweb_comment_contest_ip");
     174    });
     175   
     176    // ------------------------ end IP address filter --------------------------
     177   
     178    // ------------------------ Email filter -----------------------------------
     179   
     180    jQuery('#emailAddressFilter').click(function() {
     181        selectDuplicates("zhyweb_comment_contest_email");
     182    });
     183   
     184    // ------------------------ end Email filter -------------------------------
     185   
     186    // ------------------------ Date filter ------------------------------------
     187   
     188    jQuery('#datepicker').datepicker();
     189   
     190    jQuery('#dateSubmit').click(function() {
     191        // Clear error messages
     192        jQuery('#zwpcc_dateFilter_error_message').hide();
     193        jQuery('#datepicker').css("border", "1px solid rgb(223,223,223)");
     194        jQuery('#dateHours').css("border", "1px solid rgb(223,223,223)");
     195        jQuery('#dateMinutes').css("border", "1px solid rgb(223,223,223)");
     196       
     197        // Check date format
     198        var dateFormatOk = false;
     199        var dateRegex = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
     200        var dateValue = jQuery('#datepicker').val();
     201        var month = "";
     202        var day = "";
     203        var year = "";
     204        if (dateRegex.test(dateValue)) {
     205            var match = dateRegex.exec(dateValue);
     206            month = match[1];
     207            day = match[2];
     208            year = match[3];
     209            if (month > 0 && month < 13 && day > 0 && day <32 && year > 0) {
     210                dateFormatOk = true;
     211            }
     212        }
     213       
     214        if (dateFormatOk) {
     215            // Check hours format
     216            var dateHours = jQuery('#dateHours').val();
     217            var dateMinutes = jQuery('#dateMinutes').val();
     218            if (dateHours != "" && dateHours >= 0 && dateHours < 24 && dateMinutes != "" && dateMinutes >= 0 && dateMinutes < 60) {
     219                // Date OK => Launch selection
     220                jQuery('#contestForm tr').each(function() {
     221                    // Browse all table lines
     222                    var line = jQuery(this);
     223
     224                    // Search for span tag with class "zhyweb_comment_contest_timestamp"
     225                    var timestampComment = line.find('.zhyweb_comment_contest_timestamp').text();
     226                    if (timestampComment != "") {
     227                        var wantedTimestamp = year + month + day + dateHours + dateMinutes;
     228                        if (timestampComment > wantedTimestamp) {
     229                            // If comment time > deadline => Check the box in lines
     230                            line.find('input[id^="cb-select"]').each(function() {
     231                                jQuery(this).attr("checked", true);
     232                            });
     233                        }
     234                    }
     235                });
     236            } else {
     237                jQuery('#zwpcc_dateFilter_error_message').show();
     238                jQuery('#dateHours').css("border", "2px solid red");
     239                jQuery('#dateMinutes').css("border", "2px solid red");
     240            }
     241        } else {
     242            jQuery('#zwpcc_dateFilter_error_message').show();
     243            jQuery('#datepicker').css("border", "2px solid red");
     244        }
     245    });
     246   
     247    // ------------------------ END Date filter --------------------------------
    116248   
    117249    // ------------------------ Tooltips (Help) --------------------------------
     
    209341                var line = jQuery(this);
    210342               
    211                 // Get only normal et cheating lines
     343                // Get only normal and cheating lines
    212344                if (!line.hasClass("removedComment")) {
    213345                    var commentID = line.find('.zhyweb_comment_contest_id').html();
     
    232364            fisherYates(commentsCheat);
    233365            if (commentsCheat.length < nbWinners) {
    234                 // Optimisation
     366                // Optimisation : randomize array only if necessary
    235367                fisherYates(commentsNormal);
    236368            }
     
    253385       
    254386        // Clean all inputs
     387        jQuery("#zwpcc_nbWinners_error_message").hide();
    255388        jQuery(this).find('input').each(function() {
    256389            jQuery(this).css('border', '1px solid rgb(223,223,223)');
     
    259392        // Check all values
    260393        // "Number of winners" must be numeric
    261         if (!jQuery.isNumeric(jQuery("#zwpcc_nb_winners").val())) {
     394        var nbWinners = jQuery("#zwpcc_nb_winners").val();
     395        if (!jQuery.isNumeric(nbWinners) || nbWinners <= 0) {
    262396            launch = false;
    263397            jQuery("#zwpcc_nb_winners").css('border', '2px solid red');
     398            jQuery("#zwpcc_nbWinners_error_message").show();
    264399        }
    265400       
  • comment-contest/trunk/js/OrgZhyweb_WPCommentContest_jQuery.min.js

    r754147 r828725  
    1 function commentContestDelete(commentID){jQuery("#comment-contest-"+commentID).removeClass("cheatComment");jQuery("#comment-contest-"+commentID).addClass("removedComment");jQuery("#restoreLink-"+commentID).show();jQuery("#deleteLink-"+commentID).hide();jQuery("#stopCheatLink-"+commentID).hide();jQuery("#cheatLink-"+commentID).show()}function commentContestRestore(commentID){jQuery("#comment-contest-"+commentID).removeClass("removedComment");jQuery("#deleteLink-"+commentID).show();jQuery("#restoreLink-"+commentID).hide()}function commentContestCheat(commentID){jQuery("#comment-contest-"+commentID).removeClass("removedComment");jQuery("#comment-contest-"+commentID).addClass("cheatComment");jQuery("#stopCheatLink-"+commentID).show();jQuery("#cheatLink-"+commentID).hide();jQuery("#deleteLink-"+commentID).show();jQuery("#restoreLink-"+commentID).hide()}function commentContestStopCheat(commentID){jQuery("#comment-contest-"+commentID).removeClass("cheatComment");jQuery("#stopCheatLink-"+commentID).hide();jQuery("#cheatLink-"+commentID).show()}function selectRole(roleID){jQuery('#contestForm tr').each(function(){var line=jQuery(this);var rolesStr=line.find('.zhyweb_comment_contest_role').text();var roles=rolesStr.split('|');if(jQuery.inArray(roleID,roles)>=0&&rolesStr.length>0){line.find('input[id^="cb-select"]').each(function(){jQuery(this).attr("checked",true)})}})}function fisherYates(myArray){var i=myArray.length;if(i>0){while(--i){var j=Math.floor(Math.random()*(i+1));var tempi=myArray[i];var tempj=myArray[j];myArray[i]=tempj;myArray[j]=tempi}}}jQuery(document).ready(function(){jQuery('.help').tipTip({'attribute':'title','fadeIn':50,'fadeOut':50,'keepAlive':true,'activation':'hover','maxWidth':400});jQuery(".help").tipTip();function deleteSelectedComments(){jQuery('#contestForm input[id^="cb-select"]:checked').each(function(index,domElem){if(domElem.id.indexOf("-all-")==-1){commentContestDelete(jQuery(this).val())}else{jQuery(this).attr("checked",false)}})}jQuery("#contestForm #doaction").click(function(){if(jQuery('#contestForm select[name="action"]').val()=='delete'){deleteSelectedComments()}});jQuery("#contestForm #doaction2").click(function(){if(jQuery('#contestForm select[name="action2"]').val()=='delete'){deleteSelectedComments()}});function restoreSelectedComments(){jQuery('#contestForm input[id^="cb-select"]:checked').each(function(index,domElem){if(domElem.id.indexOf("-all-")==-1){commentContestRestore(jQuery(this).val())}else{jQuery(this).attr("checked",false)}})}jQuery("#contestForm #doaction").click(function(){if(jQuery('#contestForm select[name="action"]').val()=='restore'){restoreSelectedComments()}});jQuery("#contestForm #doaction2").click(function(){if(jQuery('#contestForm select[name="action2"]').val()=='restore'){restoreSelectedComments()}});jQuery("#dialog-modal-winners").dialog({height:500,width:800,modal:true,autoOpen:false,dialogClass:'wp-dialog',open:function(){var nbWinners=jQuery('#zwpcc_nb_winners').val();var commentsNormal=new Array();var commentsCheat=new Array();jQuery('#contestForm tr').each(function(){var line=jQuery(this);if(!line.hasClass("removedComment")){var commentID=line.find('.zhyweb_comment_contest_id').html();if(commentID!=null&&commentID!=""){if(line.hasClass("cheatComment")){commentsCheat.push(commentID)}else{commentsNormal.push(commentID)}}}});jQuery('#dialog-modal-winners tr[id^="result-comment-contest"]').each(function(){jQuery(this).hide()});fisherYates(commentsCheat);if(commentsCheat.length<nbWinners){fisherYates(commentsNormal)}var comments=jQuery.merge(commentsCheat,commentsNormal);for(var i=0;i<nbWinners&&i<comments.length;i++){jQuery("#result-comment-contest-"+comments[i]).show();if(i>=1){jQuery("#result-comment-contest-"+comments[i-1]).after(jQuery("#result-comment-contest-"+comments[i]))}}}});jQuery("#zwpcc_form").submit(function(){launch=true;jQuery(this).find('input').each(function(){jQuery(this).css('border','1px solid rgb(223,223,223)')});if(!jQuery.isNumeric(jQuery("#zwpcc_nb_winners").val())){launch=false;jQuery("#zwpcc_nb_winners").css('border','2px solid red')}if(launch){jQuery("#dialog-modal-winners").dialog("open")}return false})});
     1function commentContestDelete(a){jQuery("#comment-contest-"+a).removeClass("cheatComment");jQuery("#comment-contest-"+a).addClass("removedComment");jQuery("#restoreLink-"+a).show();jQuery("#deleteLink-"+a).hide();jQuery("#stopCheatLink-"+a).hide();jQuery("#cheatLink-"+a).show()}function commentContestRestore(a){jQuery("#comment-contest-"+a).removeClass("removedComment");jQuery("#deleteLink-"+a).show();jQuery("#restoreLink-"+a).hide()}function commentContestCheat(a){jQuery("#comment-contest-"+a).removeClass("removedComment");jQuery("#comment-contest-"+a).addClass("cheatComment");jQuery("#stopCheatLink-"+a).show();jQuery("#cheatLink-"+a).hide();jQuery("#deleteLink-"+a).show();jQuery("#restoreLink-"+a).hide()}function commentContestStopCheat(a){jQuery("#comment-contest-"+a).removeClass("cheatComment");jQuery("#stopCheatLink-"+a).hide();jQuery("#cheatLink-"+a).show()}function selectRole(a){jQuery("#contestForm tr").each(function(){var c=jQuery(this);var b=c.find(".zhyweb_comment_contest_role").text();var d=b.split("|");if(jQuery.inArray(a,d)>=0&&b.length>0){c.find('input[id^="cb-select"]').each(function(){jQuery(this).attr("checked",true)})}})}function fisherYates(c){var b=c.length;if(b>0){while(--b){var a=Math.floor(Math.random()*(b+1));var e=c[b];var d=c[a];c[b]=d;c[a]=e}}}function toggleFilters(a){var b=jQuery("#filters");b.fadeToggle("slow","linear",function(){if(b.is(":visible")){jQuery("#filtersImg").attr("src",a+"/img/minus.png")}else{jQuery("#filtersImg").attr("src",a+"/img/plus.png")}})}function selectDuplicates(b){var a=0;jQuery("#contestForm tr").each(function(){var c=jQuery(this);var d=0;jQuery("#contestForm tr").each(function(){var f=jQuery(this);if(a!=d){var e=c.find("."+b).text();var g=f.find("."+b).text();if(e==g&&e!=""){c.find('input[id^="cb-select"]').each(function(){jQuery(this).attr("checked",true)});f.find('input[id^="cb-select"]').each(function(){jQuery(this).attr("checked",true)})}}d++});a++})}jQuery(document).ready(function(){jQuery("#ipAddressFilter").click(function(){selectDuplicates("zhyweb_comment_contest_ip")});jQuery("#emailAddressFilter").click(function(){selectDuplicates("zhyweb_comment_contest_email")});jQuery("#datepicker").datepicker();jQuery("#dateSubmit").click(function(){jQuery("#zwpcc_dateFilter_error_message").hide();jQuery("#datepicker").css("border","1px solid rgb(223,223,223)");jQuery("#dateHours").css("border","1px solid rgb(223,223,223)");jQuery("#dateMinutes").css("border","1px solid rgb(223,223,223)");var f=false;var d=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;var e=jQuery("#datepicker").val();var h="";var j="";var i="";if(d.test(e)){var g=d.exec(e);h=g[1];j=g[2];i=g[3];if(h>0&&h<13&&j>0&&j<32&&i>0){f=true}}if(f){var c=jQuery("#dateHours").val();var k=jQuery("#dateMinutes").val();if(c!=""&&c>=0&&c<24&&k!=""&&k>=0&&k<60){jQuery("#contestForm tr").each(function(){var m=jQuery(this);var n=m.find(".zhyweb_comment_contest_timestamp").text();if(n!=""){var l=i+h+j+c+k;if(n>l){m.find('input[id^="cb-select"]').each(function(){jQuery(this).attr("checked",true)})}}})}else{jQuery("#zwpcc_dateFilter_error_message").show();jQuery("#dateHours").css("border","2px solid red");jQuery("#dateMinutes").css("border","2px solid red")}}else{jQuery("#zwpcc_dateFilter_error_message").show();jQuery("#datepicker").css("border","2px solid red")}});jQuery(".help").tipTip({attribute:"title",fadeIn:50,fadeOut:50,keepAlive:true,activation:"hover",maxWidth:400});jQuery(".help").tipTip();function b(){jQuery('#contestForm input[id^="cb-select"]:checked').each(function(c,d){if(d.id.indexOf("-all-")==-1){commentContestDelete(jQuery(this).val())}else{jQuery(this).attr("checked",false)}})}jQuery("#contestForm #doaction").click(function(){if(jQuery('#contestForm select[name="action"]').val()=="delete"){b()}});jQuery("#contestForm #doaction2").click(function(){if(jQuery('#contestForm select[name="action2"]').val()=="delete"){b()}});function a(){jQuery('#contestForm input[id^="cb-select"]:checked').each(function(c,d){if(d.id.indexOf("-all-")==-1){commentContestRestore(jQuery(this).val())}else{jQuery(this).attr("checked",false)}})}jQuery("#contestForm #doaction").click(function(){if(jQuery('#contestForm select[name="action"]').val()=="restore"){a()}});jQuery("#contestForm #doaction2").click(function(){if(jQuery('#contestForm select[name="action2"]').val()=="restore"){a()}});jQuery("#dialog-modal-winners").dialog({height:500,width:800,modal:true,autoOpen:false,dialogClass:"wp-dialog",open:function(){var e=jQuery("#zwpcc_nb_winners").val();var d=new Array();var c=new Array();jQuery("#contestForm tr").each(function(){var h=jQuery(this);if(!h.hasClass("removedComment")){var i=h.find(".zhyweb_comment_contest_id").html();if(i!=null&&i!=""){if(h.hasClass("cheatComment")){c.push(i)}else{d.push(i)}}}});jQuery('#dialog-modal-winners tr[id^="result-comment-contest"]').each(function(){jQuery(this).hide()});fisherYates(c);if(c.length<e){fisherYates(d)}var g=jQuery.merge(c,d);for(var f=0;f<e&&f<g.length;f++){jQuery("#result-comment-contest-"+g[f]).show();if(f>=1){jQuery("#result-comment-contest-"+g[f-1]).after(jQuery("#result-comment-contest-"+g[f]))}}}});jQuery("#zwpcc_form").submit(function(){launch=true;jQuery("#zwpcc_nbWinners_error_message").hide();jQuery(this).find("input").each(function(){jQuery(this).css("border","1px solid rgb(223,223,223)")});var c=jQuery("#zwpcc_nb_winners").val();if(!jQuery.isNumeric(c)||c<=0){launch=false;jQuery("#zwpcc_nb_winners").css("border","2px solid red");jQuery("#zwpcc_nbWinners_error_message").show()}if(launch){jQuery("#dialog-modal-winners").dialog("open")}return false})});
  • comment-contest/trunk/lang/comment-contest-fr_FR.po

    r754147 r828725  
    11msgid ""
    22msgstr ""
    3 "Project-Id-Version: Comment Contest v2.0\n"
     3"Project-Id-Version: Comment Contest v2.2\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2013-08-09 18:37+0100\n"
    6 "PO-Revision-Date: 2013-08-09 18:38+0100\n"
     5"POT-Creation-Date: 2013-12-26 18:23+0100\n"
     6"PO-Revision-Date: 2013-12-26 18:26+0100\n"
    77"Last-Translator: Thomas \"Zhykos\" Cicognani <tcicognani@zhyweb.org>\n"
    88"Language-Team: \n"
     
    1616"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
    1717"_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"
    18 "X-Poedit-Basepath: \n"
     18"X-Poedit-Basepath: D:\\www\\zhyweb\\wordpress\\wp-content\\plugins\\comment-"
     19"contest\n"
    1920"X-Textdomain-Support: yes\n"
    2021"X-Poedit-SearchPath-0: .\n"
     
    2223# @ comment-contest
    2324#: comment-contest.php:92 php/OrgZhyweb_WPCommentContest_MainUI.php:64
    24 #: php/OrgZhyweb_WPCommentContest_MainUI.php:65
    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
    2825msgid "Comment Contest"
    2926msgstr "Comment Contest"
     
    3128# @ comment-contest
    3229#: comment-contest.php:103
    33 #: D:\www\zhyweb\wp-content\plugins\comment-contest/comment-contest.php:103
    3430msgid "Contest"
    3531msgstr "Concours"
    3632
    3733# @ 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
     34#: comment-contest.php:121 php/OrgZhyweb_WPCommentContest_MainUI.php:73
    4135msgid "Launch contest"
    4236msgstr "Lancer le concours"
     
    4438# @ comment-contest
    4539#: comment-contest.php:123
    46 #: D:\www\zhyweb\wp-content\plugins\comment-contest/comment-contest.php:123
    4740msgid "No comment"
    4841msgstr "Aucun commentaire"
     
    5144#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:65
    5245#: php/OrgZhyweb_WPCommentContest_TableResults.php:33
    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
    5546msgid "Author"
    5647msgstr "Auteur"
     
    5950#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:66
    6051#: php/OrgZhyweb_WPCommentContest_TableResults.php:34
    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
    6352msgid "Comment"
    6453msgstr "Commentaire"
     
    6655# @ comment-contest
    6756#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:102
    68 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:102
    6957#, php-format
    7058msgid "Select: %s"
     
    7361# @ comment-contest
    7462#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:135
    75 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:135
    7663msgid "Select comment"
    7764msgstr "Sélectionner le commentaire"
    7865
    7966# @ comment-contest
    80 #: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:221
    81 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:221
     67#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:230
    8268#, php-format
    8369msgid "Submitted on <a href=\"%1$s\">%2$s at %3$s</a>"
     
    8571
    8672# @ comment-contest
    87 #: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:222
    88 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:222
     73#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:231
    8974msgid "Y/m/d"
    9075msgstr "d / m / Y"
    9176
    9277# @ comment-contest
    93 #: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:229
    94 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:229
     78#: php/OrgZhyweb_WPCommentContest_AbstractTableUI.php:238
    9579#, php-format
    9680msgid "In reply to <a href=\"%1$s\">%2$s</a>."
     
    9983# @ comment-contest
    10084#: php/OrgZhyweb_WPCommentContest_MainUI.php:47
    101 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:47
    10285msgid "URL must have 'post' parameter as integer"
    10386msgstr "Le paramètre 'post' dans l'URL doit être un nombre entier"
     
    10588# @ comment-contest
    10689#: php/OrgZhyweb_WPCommentContest_MainUI.php:50
    107 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:50
    10890msgid "You have to be administrator to access this page"
    10991msgstr ""
     
    11193
    11294# @ comment-contest
    113 #: php/OrgZhyweb_WPCommentContest_MainUI.php:68
    114 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:68
     95#: php/OrgZhyweb_WPCommentContest_MainUI.php:67
    11596#, php-format
    11697msgid "Contest on post \"%s\""
     
    11899
    119100# @ comment-contest
    120 #: php/OrgZhyweb_WPCommentContest_MainUI.php:72
    121 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:72
     101#: php/OrgZhyweb_WPCommentContest_MainUI.php:70
     102msgid "Number of winners error"
     103msgstr "Erreur pour le nombre de gagnants"
     104
     105# @ comment-contest
     106#: php/OrgZhyweb_WPCommentContest_MainUI.php:71
    122107msgid "Number of winners:"
    123108msgstr "Nombre de gagnants :"
    124109
    125 #: php/OrgZhyweb_WPCommentContest_MainUI.php:73
    126 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:73
     110#: php/OrgZhyweb_WPCommentContest_MainUI.php:72
    127111msgid "Number of comments used to determine winners"
    128112msgstr "Nombre de commentaires utilisés pour déterminer les gagnants"
    129113
    130114# @ comment-contest
    131 #: php/OrgZhyweb_WPCommentContest_MainUI.php:79
    132 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:79
     115#: php/OrgZhyweb_WPCommentContest_MainUI.php:78
    133116msgid "Winners"
    134117msgstr "Gagnants"
    135118
    136119# @ comment-contest
    137 #: php/OrgZhyweb_WPCommentContest_MainUI.php:108
    138 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:108
     120#: php/OrgZhyweb_WPCommentContest_MainUI.php:107
    139121msgid "Comments used for the contest:"
    140122msgstr "Commentaires utilisés pour le concours :"
    141123
    142 #: php/OrgZhyweb_WPCommentContest_MainUI.php:109
    143 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:109
     124#: php/OrgZhyweb_WPCommentContest_MainUI.php:110
    144125msgid ""
    145126"The table below shows all available comments. You have to choose which ones "
     
    166147"utilisés que s'il n'a pas assez de commentaire de triche."
    167148
    168 # @ comment-contest
     149#: php/OrgZhyweb_WPCommentContest_MainUI.php:120
     150msgid "Filters"
     151msgstr "Filtres"
     152
     153# @ comment-contest
     154#: php/OrgZhyweb_WPCommentContest_MainUI.php:123
     155msgid "Contest deadline"
     156msgstr "Date limite du concours"
     157
     158#: php/OrgZhyweb_WPCommentContest_MainUI.php:124
     159msgid "Wrong date format!"
     160msgstr "Mauvais format de date !"
     161
     162#: php/OrgZhyweb_WPCommentContest_MainUI.php:125
     163msgid "Date:"
     164msgstr "Date :"
     165
    169166#: php/OrgZhyweb_WPCommentContest_MainUI.php:126
    170 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:126
     167msgid "Hour (24h format):"
     168msgstr "Heure (format 24h) :"
     169
     170#: php/OrgZhyweb_WPCommentContest_MainUI.php:126
     171msgid "h"
     172msgstr "h"
     173
     174#: php/OrgZhyweb_WPCommentContest_MainUI.php:126
     175msgid "min"
     176msgstr "min"
     177
     178#: php/OrgZhyweb_WPCommentContest_MainUI.php:127
     179msgid "Select comments after this deadline"
     180msgstr "Sélectionner tous les commentaires postés après cette date"
     181
     182#: php/OrgZhyweb_WPCommentContest_MainUI.php:130
     183msgid "IP address"
     184msgstr "Adresse IP"
     185
     186#: php/OrgZhyweb_WPCommentContest_MainUI.php:131
     187msgid "Select all comments with the same IP address"
     188msgstr ""
     189"Sélectionner tous les commentaires ayant été postés avec la même adresse IP"
     190
     191#: php/OrgZhyweb_WPCommentContest_MainUI.php:134
     192msgid "Email address"
     193msgstr "Adresses email"
     194
     195#: php/OrgZhyweb_WPCommentContest_MainUI.php:135
     196msgid "Select all comments with the same email"
     197msgstr "Sélectionner tous les commentaires ayant été postés avec le même email"
     198
     199# @ comment-contest
     200#: php/OrgZhyweb_WPCommentContest_MainUI.php:151
    171201msgid "URL 'post' parameter has to be valid"
    172202msgstr "Le paramètre 'post' dans l'URL n'est pas valide"
    173203
    174204# @ comment-contest
    175 #: php/OrgZhyweb_WPCommentContest_MainUI.php:138
    176 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:138
     205#: php/OrgZhyweb_WPCommentContest_MainUI.php:163
    177206#, php-format
    178207msgid ""
     
    184213
    185214# @ comment-contest
    186 #: php/OrgZhyweb_WPCommentContest_MainUI.php:140
    187 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:140
     215#: php/OrgZhyweb_WPCommentContest_MainUI.php:165
    188216msgid "Support:"
    189217msgstr "Support :"
    190218
    191219# @ comment-contest
    192 #: php/OrgZhyweb_WPCommentContest_MainUI.php:141
    193 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:141
     220#: php/OrgZhyweb_WPCommentContest_MainUI.php:166
     221#: php/OrgZhyweb_WPCommentContest_MainUI.php:167
    194222msgid "Official page:"
    195223msgstr "Page officielle :"
    196224
    197225# @ comment-contest
    198 #: php/OrgZhyweb_WPCommentContest_MainUI.php:145
    199 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_MainUI.php:145
     226#: php/OrgZhyweb_WPCommentContest_MainUI.php:171
    200227msgid "Debug:"
    201228msgstr "Debug :"
     
    204231#: php/OrgZhyweb_WPCommentContest_TableUI.php:41
    205232#: 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
    208233msgid "Delete"
    209234msgstr "Supprimer"
     
    212237#: php/OrgZhyweb_WPCommentContest_TableUI.php:42
    213238#: 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
    216239msgid "Restore"
    217240msgstr "Restaurer"
    218241
    219242#: php/OrgZhyweb_WPCommentContest_TableUI.php:43
    220 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:43
    221243msgid "Cheat"
    222244msgstr "Tricher"
    223245
    224246#: php/OrgZhyweb_WPCommentContest_TableUI.php:44
    225 #: D:\www\zhyweb\wp-content\plugins\comment-contest/php/OrgZhyweb_WPCommentContest_TableUI.php:44
    226247msgid "Stop cheating"
    227248msgstr "Ne plus tricher"
  • comment-contest/trunk/php/OrgZhyweb_WPCommentContest_AbstractTableUI.php

    r754147 r828725  
    208208        // Add comment ID (used to get winners)
    209209        echo '<span style="display:none" class="zhyweb_comment_contest_id">' . $comment->comment_ID . '</span>';
     210       
     211        // Add comment timestamp post
     212        echo '<span style="display:none" class="zhyweb_comment_contest_timestamp">' . get_comment_date('YmdHi', $comment->comment_ID) . '</span>';
     213       
     214        // Add comment IP address
     215        echo '<span style="display:none" class="zhyweb_comment_contest_ip">' . get_comment_author_IP($comment->comment_ID) . '</span>';
     216       
     217        // Add comment email
     218        echo '<span style="display:none" class="zhyweb_comment_contest_email">' . $comment->comment_author_email . '</span>';
    210219    }
    211220   
  • comment-contest/trunk/php/OrgZhyweb_WPCommentContest_MainUI.php

    r822566 r828725  
    6868
    6969            // Contest parameters
    70             echo "<div id=\"zwpcc_error_message\" style=\"color: red\"></div>"
     70            echo "<div id=\"zwpcc_nbWinners_error_message\" style=\"color: red; display: none;\">" . __('Number of winners error', "comment-contest") . "</div>"
    7171               . __('Number of winners:', "comment-contest") . " <input type=\"text\" id=\"zwpcc_nb_winners\" value=\"1\"/>"
    7272               . "<img src=\"$this->pluginDir/img/help.png\" alt=\"Help\" class=\"help\" title=\"". __('Number of comments used to determine winners', "comment-contest") . "\" /><br /><br />"
     
    105105            $this->displayHeaderPage($postID);
    106106           
    107             echo "<br /><br /><hr /><h3 style=\"float: left;\">" . __('Comments used for the contest:', "comment-contest") . "</h3>
    108                 <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 />"
     107            echo "<br /><br /><hr /><h3 style=\"float: left;\">" . __('Comments used for the contest:', "comment-contest") . "</h3>";
     108           
     109            // Help image
     110            echo "<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 />"
    109111                . " - You can select users who have the same Wordpress role (see User page).<br />"
    110112                . " - You can remove comments from contest (don't be used to determine winners). Removed comments still are visible with red background color.<br />"
    111113                . " - 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 />"
    112                 . " - The other comments (white/grey background) are only used if there isn't enough cheating comments.", "comment-contest") . "\" />
    113                 <div id='contestForm'>";
    114                        
     114                . " - The other comments (white/grey background) are only used if there isn't enough cheating comments.", "comment-contest") . "\" />";
     115               
     116            // Filters
     117            echo "<div style='clear:both;'>
     118                    <span>
     119                        <a href='javascript:;' onclick='toggleFilters(\"$this->pluginDir\")'><img src='$this->pluginDir/img/plus.png' alt='expand/collapse' id='filtersImg' style='vertical-align: middle;' /></a>
     120                        <a href='javascript:;' onclick='toggleFilters(\"$this->pluginDir\")'>" . __('Filters', "comment-contest") . "</a>
     121                    </span>
     122                    <div id='filters' style='display: none;'>
     123                        <h4>" . __('Contest deadline', "comment-contest") . "</h4>
     124                        <div id='zwpcc_dateFilter_error_message' style='color: red; display: none;'>" . __('Wrong date format!', "comment-contest") . "</div>
     125                        " . __('Date:', "comment-contest") . " <input type='text' id='datepicker' /><br />
     126                        " . __('Hour (24h format):', "comment-contest") . " <input type='text' id='dateHours' maxlength='2' size='3' />" . __('h', "comment-contest") . " <input type='text' id='dateMinutes' maxlength='2' size='3' />" . __('min', "comment-contest") . "<br />
     127                        <br /><input type='button' class='button action' id='dateSubmit' value='" . __('Select comments after this deadline', "comment-contest") . "' />
     128                       
     129                        <br /><br />
     130                        <h4>" . __('IP address', "comment-contest") . "</h4>
     131                        <input type='button' class='button action' id='ipAddressFilter' value='" . __('Select all comments with the same IP address', "comment-contest") . "' />
     132                           
     133                        <br /><br />
     134                        <h4>" . __('Email address', "comment-contest") . "</h4>
     135                        <input type='button' class='button action' id='emailAddressFilter' value='" . __('Select all comments with the same email', "comment-contest") . "' />
     136                    </div>
     137                </div>";
     138           
     139            // Table
     140            echo "<div id='contestForm'>";
    115141            $list = new OrgZhyweb_WPCommentContest_TableUI($postID);
    116142            $list->prepare_items();
    117143            $list->views();
    118144            $list->display();
    119            
    120145            echo "</div>";
    121146           
     147            // Footer
    122148            $this->displayFooterPage();
    123149        } else {
  • comment-contest/trunk/readme.txt

    r828636 r828725  
    3232= What are the available languages? =
    3333
    34 * English by Thomas "Zhykos" Cicognani ;
    35 * French by Thomas "Zhykos" Cicognani ;
    36 * Spanish by Andrew Kurtis ;
    37 * Belorussian by P.C. (partial since 2.0) ;
    38 * Dutch by Rene (partial since 2.0)
     34* English by Thomas "Zhykos" Cicognani (since 1.1) ;
     35* French by Thomas "Zhykos" Cicognani (since 1.0) ;
     36* Spanish by Andrew Kurtis (since 2.1.3 / partial since 2.2) ;
     37* Belorussian by P.C. (since 1.40.1 / partial since 2.0) ;
     38* Dutch by Rene (since 1.41.1 / partial since 2.0)
    3939
    4040== Screenshots ==
     
    46465. You can restore deleted comments (deleted comments are red)
    47476. Cheat: this comment will win! (cheating comments are green)
    48 7. Result table with winner(s)
     487. Filters
     498. Help
     509. Result table
    4951
    5052== Changelog ==
     53
     54= 2.2 =
     55* New: Add filters to select comments posted after a date, to select comments with same IP address or email
     56* Misc: New screenshots
    5157
    5258= 2.1.3 =
     
    149155* Compatibility with Wordpress 3.6
    150156
     157= 2.2 =
     158* New features to filter comments
     159
    151160== Credits ==
    152161
    153162= Images =
    154163* Help icon by http://www.visualpharm.com/
     164* Plus and Minus icons by http://www.yanlu.de
Note: See TracChangeset for help on using the changeset viewer.