diff --git a/include/js_strings.php b/include/js_strings.php index 14293c5ce..56ffa9536 100644 --- a/include/js_strings.php +++ b/include/js_strings.php @@ -19,6 +19,7 @@ function js_strings() { '$rating_desc' => t('Rate This Channel (this is public)'), '$rating_val' => t('Rating'), '$rating_text' => t('Describe (optional)'), + '$submit' => t('Submit'), '$t01' => ((t('timeago.prefixAgo') != 'timeago.prefixAgo') ? t('timeago.prefixAgo') : ''), '$t02' => ((t('timeago.prefixFromNow') != 'timeago.prefixFromNow') ? t('timeago.prefixFromNow') : ''), diff --git a/mod/prate.php b/mod/prate.php index 62f188891..b89d16f42 100644 --- a/mod/prate.php +++ b/mod/prate.php @@ -1,5 +1,26 @@ get_channel(); + + $target = argv(1); + if(! $target) + return; + + $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1", + dbesc($channel['channel_hash']), + dbesc($target) + ); + if($r) + json_return_and_die(array('rating' => $r[0]['xlink_rating'],'rating_text' => $r[0]['xlink_rating_text'])); + killme(); +} function prate_post(&$a) { @@ -63,7 +84,7 @@ function prate_post(&$a) { proc_run('php','include/ratenotif.php','rating',$record); } - return; + json_return_and_die(array('result' => true));; } @@ -75,3 +96,4 @@ function prate_post(&$a) { + diff --git a/view/css/mod_directory.css b/view/css/mod_directory.css index d4cf23b39..c562764ea 100644 --- a/view/css/mod_directory.css +++ b/view/css/mod_directory.css @@ -15,7 +15,7 @@ padding: 15px; } -.rating-text { +.rating-text-label { margin-top: 30px; } diff --git a/view/css/mod_events.css b/view/css/mod_events.css index 0aef13aa6..ba4ec9b61 100644 --- a/view/css/mod_events.css +++ b/view/css/mod_events.css @@ -10,8 +10,3 @@ margin-top: 15px; width: 400px; } - -.required { - color: #ff0000; - font-size: 1.2rem; -} \ No newline at end of file diff --git a/view/js/mod_directory.js b/view/js/mod_directory.js index 09b103352..87e4f92b5 100644 --- a/view/js/mod_directory.js +++ b/view/js/mod_directory.js @@ -6,15 +6,39 @@ function dirdetails(hash) { } -function doRatings(hash) { - - var html = '
'+aStr['rating_desc']+'
'+aStr['rating_text']+'
'; - - $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); +var ratingVal = 0; +var ratingText = ''; +var currentHash = ''; +function fetchRatings(hash) { + $.get('prate/'+hash, function(data) { + if(typeof(data.rating) !== 'undefined') { + ratingVal = data.rating; + ratingText = data.rating_text; + } + buildRatingForm(hash); + }); } +function doRatings(hash) { + fetchRatings(hash); +} + +function buildRatingForm(hash) { + var html = '
'+aStr['rating_desc']+'
'+aStr['rating_text']+'
'; + + $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); + currentHash = hash; +} + +function postRatings() { + $.post('prate',$('#ratings_form').serialize(),function(data) { + $.colorbox.remove(); + $('#edited-'+currentHash).show(); + },'json'); +} + $(document).ready(function() { collapseHeight(); }); \ No newline at end of file diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index cebc516da..cb58b6e11 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1185,9 +1185,12 @@ nav .acpopup { .required { - color: #FF0000; + color: #ff0000; + font-size: 1.8rem; + margin-left: 5px; } + #event-start-text, #event-finish-text { margin-top: 10px; margin-bottom: 5px; diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl index 1b84bca56..b0a1084e8 100755 --- a/view/tpl/direntry.tpl +++ b/view/tpl/direntry.tpl @@ -17,7 +17,7 @@ {{if $entry.viewrate}}
{{if $entry.total_ratings}}{{/if}} -{{if $entry.canrate}}{{/if}} +{{if $entry.canrate}}{{/if}}
{{/if}} {{if $entry.public_forum}} diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl index 9cfd84cf8..4eb9ae844 100755 --- a/view/tpl/js_strings.tpl +++ b/view/tpl/js_strings.tpl @@ -19,6 +19,7 @@ 'rating_desc' : "{{$rating_desc}}", 'rating_val' : "{{$rating_val}}", 'rating_text' : "{{$rating_text}}", + 'submit' : "{{$submit}}", 't01' : "{{$t01}}", 't02' : "{{$t02}}",