Changeset 739201
- Timestamp:
- 07/11/2013 01:55:36 PM (12 years ago)
- Location:
- nextgen-gallery-voting
- Files:
-
- 41 added
- 5 edited
-
assets (added)
-
assets/screenshot-1.jpg (added)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.jpg (added)
-
assets/screenshot-5.jpg (added)
-
assets/screenshot-6.png (added)
-
tags/2.6 (added)
-
tags/2.6/css (added)
-
tags/2.6/css/jquery-ui (added)
-
tags/2.6/css/jquery-ui/images (added)
-
tags/2.6/css/jquery-ui/images/animated-overlay.gif (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png (added)
-
tags/2.6/css/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png (added)
-
tags/2.6/css/jquery-ui/images/ui-icons_222222_256x240.png (added)
-
tags/2.6/css/jquery-ui/images/ui-icons_2e83ff_256x240.png (added)
-
tags/2.6/css/jquery-ui/images/ui-icons_454545_256x240.png (added)
-
tags/2.6/css/jquery-ui/images/ui-icons_888888_256x240.png (added)
-
tags/2.6/css/jquery-ui/images/ui-icons_cd0a0a_256x240.png (added)
-
tags/2.6/css/jquery-ui/jquery-ui-1.10.3.custom.css (added)
-
tags/2.6/css/jquery-ui/jquery-ui-1.10.3.custom.min.css (added)
-
tags/2.6/css/star_rating.css (added)
-
tags/2.6/images (added)
-
tags/2.6/images/loading.gif (added)
-
tags/2.6/images/star.gif (added)
-
tags/2.6/images/thumbs_down.png (added)
-
tags/2.6/images/thumbs_up.png (added)
-
tags/2.6/js (added)
-
tags/2.6/js/admin_gallery.js (added)
-
tags/2.6/js/ajaxify-likes.js (added)
-
tags/2.6/js/ajaxify-stars.js (added)
-
tags/2.6/js/top-voted.js (added)
-
tags/2.6/ngg-voting.php (added)
-
tags/2.6/readme.txt (added)
-
tags/2.6/voting-types.php (added)
-
trunk/js/ajaxify-likes.js (modified) (1 diff)
-
trunk/js/ajaxify-stars.js (modified) (1 diff)
-
trunk/js/top-voted.js (modified) (1 diff)
-
trunk/ngg-voting.php (modified) (15 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nextgen-gallery-voting/trunk/js/ajaxify-likes.js
r618913 r739201 1 jQuery(document).ready(function() { 2 jQuery('a.nggv-link-like, a.nggv-link-dislike').click(function(e) { 3 var container = jQuery(this).parents('.nggv_container'); 4 5 container.find('img.nggv-star-loader').show(); 6 7 var url = jQuery(this).attr('href'); 8 url += '&ajaxify=1'; 9 10 jQuery.ajax({ 11 url: url, 12 data: '', 13 success: function(data, textStatus, XMLHttpRequest) { 14 var start = data.indexOf("<!-- NGGV START AJAX RESPONSE -->") + 41; //find the start of the outputting by the ajax url (stupid wordpress and poor buffering options blah blah) 15 var end = data.indexOf("<script><!-- NGGV END AJAX RESPONSE -->"); 16 17 var js = data.substr(start, (end-start)); 18 js = js.replace(/(\r\n|\n|\r)/gm,''); 19 20 eval(js); //the array of voters gets echoed out at the ajax url 21 22 if(typeof(nggv_js) == 'object') { 23 var msg = ''; 24 if(nggv_js.saved) { 25 jQuery(document).focus(); 26 container.find('.nggv-vote-form').html(nggv_js.voting_form); 27 }else{ 28 if(nggv_js.msg) { 29 msg = nggv_js.msg 30 }else{ //there should always be a msg, but just in case lets default one 31 msg = jQuery('#ngg-genric-err-msg').val(); 32 } 33 34 //if we got markup back, replace the voting form with it 35 if(nggv_js.voting_form) { 36 jQuery(document).focus(); 37 container.find('.nggv-vote-form').html(nggv_js.voting_form); 38 } 39 } 40 }else{ 1 function nggv_dis_like_click(e) { 2 var container = jQuery(this).parents('.nggv_container'); 3 4 container.find('img.nggv-star-loader').show(); 5 6 var url = jQuery(this).attr('href'); 7 url += '&ajaxify=1'; 8 9 jQuery.ajax({ 10 url: url, 11 data: '', 12 success: function(data, textStatus, XMLHttpRequest) { 13 var start = data.indexOf("<!-- NGGV START AJAX RESPONSE -->") + 41; //find the start of the outputting by the ajax url (stupid wordpress and poor buffering options blah blah) 14 var end = data.indexOf("<script><!-- NGGV END AJAX RESPONSE -->"); 15 16 var js = data.substr(start, (end-start)); 17 js = js.replace(/(\r\n|\n|\r)/gm,''); 18 19 eval(js); //the array of voters gets echoed out at the ajax url 20 21 if(typeof(nggv_js) == 'object') { 22 var msg = ''; 23 if(nggv_js.saved) { 24 jQuery(document).focus(); 25 container.find('.nggv-vote-form').html(nggv_js.voting_form); 26 }else{ 27 if(nggv_js.msg) { 28 msg = nggv_js.msg 29 }else{ //there should always be a msg, but just in case lets default one 41 30 msg = jQuery('#ngg-genric-err-msg').val(); 42 31 } 43 32 44 if(msg) {45 //the 'continer' div and 'nggv-error' div are on the same dom level, making them siblings46 container.find('div.nggv-error').show();47 container.find(' div.nggv-error').html(msg);33 //if we got markup back, replace the voting form with it 34 if(nggv_js.voting_form) { 35 jQuery(document).focus(); 36 container.find('.nggv-vote-form').html(nggv_js.voting_form); 48 37 } 49 },50 error: function(XMLHttpRequest, textStatus, errorThrown) {51 container.find('div.nggv-error').show();52 container.find('div.nggv-error').html(jQuery('#ngg-genric-err-msg').val());53 },54 complete: function() {55 container.find('img.nggv-star-loader').hide();56 38 } 57 }); 58 59 e.preventDefault(); 60 return false; 39 }else{ 40 msg = jQuery('#ngg-genric-err-msg').val(); 41 } 42 43 if(msg) { 44 //the 'continer' div and 'nggv-error' div are on the same dom level, making them siblings 45 container.find('div.nggv-error').show(); 46 container.find('div.nggv-error').html(msg); 47 } 48 }, 49 error: function(XMLHttpRequest, textStatus, errorThrown) { 50 container.find('div.nggv-error').show(); 51 container.find('div.nggv-error').html(jQuery('#ngg-genric-err-msg').val()); 52 }, 53 complete: function() { 54 container.find('img.nggv-star-loader').hide(); 55 } 61 56 }); 57 58 e.preventDefault(); 59 return false; 60 } 61 62 jQuery(document).ready(function() { 63 jQuery('a.nggv-link-like, a.nggv-link-dislike').click(nggv_dis_like_click); 62 64 }); -
nextgen-gallery-voting/trunk/js/ajaxify-stars.js
r618913 r739201 1 function nggv_stars_click(e) { 2 var container = jQuery(this).parents('.nggv_container'); 3 4 container.find('img.nggv-star-loader').show(); 5 6 var url = jQuery(this).attr('href'); 7 url += '&ajaxify=1'; 8 9 jQuery.ajax({ 10 url: url, 11 data: '', 12 success: function(data, textStatus, XMLHttpRequest) { 13 var start = data.indexOf("<!-- NGGV START AJAX RESPONSE -->") + 41; //find the start of the outputting by the ajax url (stupid wordpress and poor buffering options blah blah) 14 var end = data.indexOf("<script><!-- NGGV END AJAX RESPONSE -->"); 15 16 var js = data.substr(start, (end-start)); 17 js = js.replace(/(\r\n|\n|\r)/gm,''); 18 19 eval(js); //the array of voters gets echoed out at the ajax url 20 21 if(typeof(nggv_js) == 'object') { 22 var msg = ''; 23 if(nggv_js.saved) { 24 jQuery(document).focus(); 25 container.find('.nggv-vote-form').html(nggv_js.voting_form); 26 }else{ 27 if(nggv_js.msg) { 28 msg = nggv_js.msg 29 }else{ //there should always be a msg, but just in case lets default one 30 msg = jQuery('#ngg-genric-err-msg').val(); 31 } 32 33 //if we got markup back, replace the voting form with it 34 if(nggv_js.voting_form) { 35 jQuery(document).focus(); 36 container.find('.nggv-vote-form').html(nggv_js.voting_form); 37 } 38 } 39 }else{ 40 msg = jQuery('#ngg-genric-err-msg').val(); 41 } 42 43 if(msg) { 44 //the 'continer' div and 'nggv-error' div are on the same dom level, making them siblings 45 container.find('div.nggv-error').show(); 46 container.find('div.nggv-error').html(msg); 47 } 48 }, 49 error: function(XMLHttpRequest, textStatus, errorThrown) { 50 container.find('div.nggv-error').show(); 51 container.find('div.nggv-error').html(jQuery('#ngg-genric-err-msg').val()); 52 }, 53 complete: function() { 54 container.find('img.nggv-star-loader').hide(); 55 } 56 }); 57 58 e.preventDefault(); 59 return false; 60 } 61 1 62 jQuery(document).ready(function() { 2 jQuery('ul.star-rating li a').click(function(e) { 3 var container = jQuery(this).parents('.nggv_container'); 4 5 container.find('img.nggv-star-loader').show(); 6 7 var url = jQuery(this).attr('href'); 8 url += '&ajaxify=1'; 9 10 jQuery.ajax({ 11 url: url, 12 data: '', 13 success: function(data, textStatus, XMLHttpRequest) { 14 var start = data.indexOf("<!-- NGGV START AJAX RESPONSE -->") + 41; //find the start of the outputting by the ajax url (stupid wordpress and poor buffering options blah blah) 15 var end = data.indexOf("<script><!-- NGGV END AJAX RESPONSE -->"); 16 17 var js = data.substr(start, (end-start)); 18 js = js.replace(/(\r\n|\n|\r)/gm,''); 19 20 eval(js); //the array of voters gets echoed out at the ajax url 21 22 if(typeof(nggv_js) == 'object') { 23 var msg = ''; 24 if(nggv_js.saved) { 25 jQuery(document).focus(); 26 container.find('.nggv-vote-form').html(nggv_js.voting_form); 27 }else{ 28 if(nggv_js.msg) { 29 msg = nggv_js.msg 30 }else{ //there should always be a msg, but just in case lets default one 31 msg = jQuery('#ngg-genric-err-msg').val(); 32 } 33 34 //if we got markup back, replace the voting form with it 35 if(nggv_js.voting_form) { 36 jQuery(document).focus(); 37 container.find('.nggv-vote-form').html(nggv_js.voting_form); 38 } 39 } 40 }else{ 41 msg = jQuery('#ngg-genric-err-msg').val(); 42 } 43 44 if(msg) { 45 //the 'continer' div and 'nggv-error' div are on the same dom level, making them siblings 46 container.find('div.nggv-error').show(); 47 container.find('div.nggv-error').html(msg); 48 } 49 }, 50 error: function(XMLHttpRequest, textStatus, errorThrown) { 51 container.find('div.nggv-error').show(); 52 container.find('div.nggv-error').html(jQuery('#ngg-genric-err-msg').val()); 53 }, 54 complete: function() { 55 container.find('img.nggv-star-loader').hide(); 56 } 57 }); 58 59 e.preventDefault(); 60 return false; 61 }); 63 jQuery('ul.star-rating li a').click(nggv_stars_click); 62 64 }); -
nextgen-gallery-voting/trunk/js/top-voted.js
r723381 r739201 8 8 e.preventDefault(); 9 9 }); 10 11 /* 12 jQuery('a.nggv-delete-vote').click(function(e) { 13 if(!confirm('Are you sure you want to delete this vote? This cannot be undone!')) { 14 e.preventDefault(); 15 } 16 }); 17 */ 10 18 }); 11 19 -
nextgen-gallery-voting/trunk/ngg-voting.php
r724636 r739201 4 4 Plugin URI: http://shauno.co.za/wordpress/nextgen-gallery-voting/ 5 5 Description: This plugin allows you to add user voting and rating to NextGEN Galleries and Images 6 Version: 2. 5.26 Version: 2.6 7 7 Author: Shaun Alberts 8 8 Author URI: http://shauno.co.za … … 35 35 36 36 class nggVoting { 37 private $dbVersion = 2. 5;38 p rivate$slug;37 private $dbVersion = 2.6; 38 public $slug; 39 39 public $types = array( 40 40 '2'=>array('name'=>'Star Rating', 'gallery'=>true, 'image'=>true, … … 91 91 $this->slug = basename(dirname(__FILE__)); 92 92 93 $dir = array_pop(explode('/', str_replace('\\', '/', dirname(__FILE__)))); 93 $tmp = explode('/', str_replace('\\', '/', dirname(__FILE__))); 94 $dir = array_pop($tmp); 94 95 $this->pluginUrl = trailingslashit(WP_PLUGIN_URL.'/'.$dir); 95 96 $this->pluginPath = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); … … 142 143 voting_type INT NOT NULL DEFAULT 1, 143 144 criteria_id BIGINT NOT NULL DEFAULT 0, 145 show_in_popup TINYINT NOT NULL DEFAULT 0, 144 146 UNIQUE KEY id (id) 145 147 );'; … … 906 908 echo '<td><strong>User Name</strong><br ><em>(if logged in)</em></td>'; 907 909 echo '<td><strong>IP</strong></td>'; 910 echo '<td></td>'; 908 911 echo '</tr>'; 909 912 echo '</thead>'; … … 927 930 echo '<td>'.(isset($user_info->data->display_name) && $user_info->data->display_name ? $user_info->data->display_name : $val->user_id).'</td>'; 928 931 echo '<td>'.$val->ip.'</td>'; 932 echo '<td>'; 933 echo apply_filters('nggv_top_voted_row_actions', '', $this, $val); 934 echo '</td>'; 929 935 echo '</tr>'; 930 936 … … 932 938 } 933 939 940 echo do_action('nggv_popup_votes_list_bottom', $this, $options); 941 934 942 echo '</tbody>'; 935 943 echo '</table>'; 944 936 945 exit; 937 946 /* … … 1026 1035 <p> 1027 1036 Here you can set the default voting options for Galleries and Images. 1028 Changing these options will not affect any existing Galleries or Images. 1037 Changing these options will not affect any existing Galleries or Images. You can change the settings per image or gallery from the 'Manage Gallery' screen in NextGEN Gallery. 1029 1038 </p> 1030 1039 … … 1054 1063 1055 1064 <tr valign="top"> 1056 <th>Limit user to 1 vote:<br ><em> (IP or userid is used to stop multiple)</em></th>1065 <th>Limit user to 1 vote:<br ><em><small>IP or userid is used to stop multiple</small></em></th> 1057 1066 <td style="text-align:center;"><input type="checkbox" name="nggv[gallery][force_once]" <?php echo (get_option('nggv_gallery_force_once') ? 'checked="checked"' : ''); ?> /></td> 1058 1067 <td style="text-align:center;"> … … 1194 1203 <tr> 1195 1204 <th>From Date</th> 1196 <td><input type="text" id="nggv_date_from" name="nggv[date_from]" value="<?php echo $_GET['nggv']['date_from']?>" /></td>1205 <td><input type="text" id="nggv_date_from" name="nggv[date_from]" value="<?php echo (isset($_GET['nggv']['date_from']) ? $_GET['nggv']['date_from'] : '') ?>" /></td> 1197 1206 <th>To Date</th> 1198 <td><input type="text" id="nggv_date_to" name="nggv[date_to]" value="<?php echo $_GET['nggv']['date_to']?>" /></td>1207 <td><input type="text" id="nggv_date_to" name="nggv[date_to]" value="<?php echo (isset($_GET['nggv']['date_to']) ? $_GET['nggv']['date_to'] : '') ?>" /></td> 1199 1208 </tr> 1200 1209 … … 1265 1274 if($val->criteria_id) { 1266 1275 if(class_exists('nggVotingPremium')) { 1267 $c = nggVotingPremium::getCriteria(array('id'=>$val->criteria_id)); 1268 echo $c->name; 1276 if($c = nggVotingPremium::getCriteria(array('id'=>$val->criteria_id))) { 1277 echo $c->name; 1278 }else{ 1279 echo 'Critera has been deleted'; 1280 } 1269 1281 } 1270 1282 }else{ … … 1502 1514 //TODO 2.0 Consider APIing these queries, using new wpdb insert/update methods 1503 1515 if($this->getImageVotingOptions($pid, $criteriaId)) { 1504 $wpdb->query('UPDATE '.$wpdb->prefix.'nggv_settings SET criteria_id = "'.$criteriaId.'", force_login = "'.$login.'", force_once = "'.$once.'", user_results = "'.$user_results.'", enable = "'.$enable.'", voting_type = "'.$voting_type.'" WHERE pid = "'.$wpdb->escape($pid).'" ');1516 $wpdb->query('UPDATE '.$wpdb->prefix.'nggv_settings SET criteria_id = "'.$criteriaId.'", force_login = "'.$login.'", force_once = "'.$once.'", user_results = "'.$user_results.'", enable = "'.$enable.'", voting_type = "'.$voting_type.'" WHERE pid = "'.$wpdb->escape($pid).'" AND criteria_id = "'.$wpdb->escape($criteriaId).'"'); 1505 1517 }else{ 1506 1518 $wpdb->query('INSERT INTO '.$wpdb->prefix.'nggv_settings (id, pid, criteria_id, enable, force_login, force_once, user_results, voting_type) VALUES (null, "'.$wpdb->escape($pid).'", "'.$criteriaId.'", "'.$enable.'", "'.$login.'", "'.$once.'", "'.$user_results.'", "'.$voting_type.'")'); … … 1708 1720 } 1709 1721 } 1722 1723 do_action('nggv_wp_init_bottom', $this); 1710 1724 } 1711 1725 … … 1822 1836 $out .= '<div class="nggv_container">'; 1823 1837 $out .= (isset($form['scripts']) ? $form['scripts'] : ''); 1824 $out .= '<input type="hidden" id="ngg-genric-err-msg" value="'.esc_attr(nggVoting::msg('There was a problem saving your vote, please try again in a few moments.')).'" />'; 1838 1839 //make sure the generic err is only every output once. hackity, but needs to be in for backwards compat with premium releases blah blah etc 1840 global $_nggv_generic_err; 1841 if(!$_nggv_generic_err) { 1842 $out .= '<input type="hidden" id="ngg-genric-err-msg" value="'.esc_attr(nggVoting::msg('There was a problem saving your vote, please try again in a few moments.')).'" />'; 1843 $_nggv_generic_err = true; 1844 } 1845 1846 $votedOrErr = isset($this->initCatchVote[$pid][$criteriaId]['result']) ? $this->initCatchVote[$pid][$criteriaId]['result'] : ''; 1825 1847 1826 1848 $out .= '<div class="nggv-error" style="'.(!$votedOrErr || $votedOrErr === true ? 'display:none;' : '').' border: 1px solid red;">'; … … 1832 1854 $out .= '</div>'; 1833 1855 $out .= '</div>'; 1856 1857 do_action('nggv_image_vote_bottom', $options); 1834 1858 /* 1835 1859 } -
nextgen-gallery-voting/trunk/readme.txt
r724636 r739201 4 4 Tags: nextgen-gallery, nextgen, gallery, voting, rating, ratings, nextgen-gallery-voting 5 5 Requires at least: 2.9.1 6 Tested up to: 3.5.1 7 Stable tag: 2.5.2 8 9 Adds the ability for users to vote and rate your NextGEN Galleries and Images. Simple to understand options give you the ability to 10 limit who can vote on what. 6 Tested up to: 3.5.2 7 Stable tag: 2.6 8 9 Adds the ability for users to vote and rate your NextGEN Galleries and Images. Simple to understand options give you the ability to limit who can vote on what. 11 10 12 11 == Description == … … 35 34 Do not put inside the `<a>` tag that wraps the image in some of the templates, or the link will conflict with the voting process. 36 35 37 = Ew, that looks hideous=38 This plugin intentionally adds very little styling to the voting forms. It does provdedplenty of ids and classes allowing you to style it to fit in with your site.36 = Can I style it? = 37 Absolutely. This plugin intentionally adds very little styling to the voting forms, but it does provide plenty of ids and classes allowing you to style it to fit in with your site. 39 38 40 39 = Where are the results = 41 Under the Gallery or Image options, the current average vote show along with how many votes have been cast. Click on the number of votes cast to show more info on those votes. 40 Under the Gallery or Image options, the current average vote show along with how many votes have been cast. Click on the number of votes cast to view more info on those votes. 41 You can also see more information on the voting results under the 'Top Voted' menu option. 42 42 43 43 == Installation == … … 46 46 1. Activate the plugin through the 'Plugins' menu in WordPress 47 47 1. Go to 'Manage Gallery' in NextGEN, and select a gallery to see the new options 48 1. Remember to add the tag to the gallery template for image voting to work! 48 1. Remember to add the tag to the gallery template for image voting to work (see the FAQ)! 49 50 == Screenshots == 51 52 1. Main settings screen to control settings for any new Images or Galleries created 53 2. The image settings for an actual image in the NextGEN Gallery 'Manage Gallery' screen 54 3. Voting types available (more available in the Premium add-on!) 55 4. Voting results for an image 56 5. Top Voted screen showing you images and their votes 57 6. Images with voting enabled 49 58 50 59 == Changelog == 60 61 = 2.6 = 62 * Added hooks and filters for the premium add-on to use. 51 63 52 64 = 2.5.2 = … … 176 188 == Upgrade Notice == 177 189 190 = 2.6 = 191 Minor update adding hooks and filters for next Premium add-on version to use. 192 178 193 = 2.5.2 = 179 194 This update fixes an issue stopping the vote form showing for certain setups.
Note: See TracChangeset
for help on using the changeset viewer.