• [MOD] Ajax Star Rating. Rate images without page reload, like on youtube etc. 4 0 5 1
Currently:  

Author Topic: [MOD] Ajax Star Rating. Rate images without page reload, like on youtube etc.  (Read 129571 times)

0 Members and 1 Guest are viewing this topic.

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Bild 1 wurde vor dem Mod irgendwann früher mit 10 bewertet

Bild 3 ist Bild 1 nur nochmal bewertet, aber über die 5 Sterne aus dem neuen Mod hinaus, das meine ich!

Bild 2 wurde noch nie bewertet und es stehen auch nur 5 Sterne zur Auswahl und nicht 10 vom alten Mod.

Was ich fragen will, ist, ob man bei den Bildern, die man immer noch über 5 bewerten kann, es zu unterbinden geh...!


Rembrandt

  • Guest
wie auch immer, die alte bewertung bis 10 steht in der DB, entweder du löscht diese oder du bewertest auch die neuen bis 10.

mfg Andi

Offline Markus/TSC

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
1. Open details.php

Insert before:
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START------------------------------------------------
$site_template->register_vars(array(
[
b]
	
"ajax_rating_labels_0" => $lang['ajax_rating_labels'][0],
	
"ajax_rating_labels_1" => $lang['ajax_rating_labels'][1],
	
"ajax_rating_labels_2" => $lang['ajax_rating_labels'][2],
	
"ajax_rating_labels_3" => $lang['ajax_rating_labels'][3],
	
"ajax_rating_labels_4" => $lang['ajax_rating_labels'][4],
	
"ajax_rating_labels_5" => $lang['ajax_rating_labels'][5],[/b]
	
"ajax_rating_messages_0" => $lang['ajax_rating_messages'][0],
	
"ajax_rating_messages_1" => $lang['ajax_rating_messages'][1],
	
"ajax_rating_messages_2" => $lang['ajax_rating_messages'][2],
	
"ajax_rating_messages_3" => $lang['ajax_rating_messages'][3],
	
"ajax_rating_points" => $lang['ajax_rating_points']
));
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//--------------------------------------------------END


2. Open includes/constants.php
Locate:
define('MAX_RATING'5);

Replace with:
define('MAX_RATING'6);



4. Open lang/(your_lang)/main.php
[php]//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START------------------------------------------------
$lang['ajax_rating_labels'] = array (
   0 => "Noch nicht bewertet",
   1 => "Öde",
   2 => "Nichts besonderes",
   3 => "Sehenswert",
   4 => "Echt cool",
   5 => "Genial!"

);
$lang['ajax_rating_messages'] = array (
   0 => "Bewertung ungültig", //voting_error
   1 => "Vielen Dank für Deine Bewertung!", // voting_success
   2 => "Du hast das Bild bereits bewertet.", //already_voted
   3 => "Weitere Bewertungen sind für dieses Bild deaktiviert."
);
$lang['ajax_rating_points'] = "Punkte";

Open templates/(your_template)/rate_form.html
Replace the whole file with the following code:
Code: [Select]
<!-- ----------------------------------------------- -->
<!-- [MOD] Ajax Star Rating -------------- by Bash-T -->
<!-- START ----------------------------------------- -->
....
<form method="post" action="{self}">
  <table border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td class="head1">
        <table border="0" cellspacing="0" cellpadding="3" class="row1">
          <tr>
            <td valign="bottom">
              <select name="rating" class="select">
               <option value="">--</option>
                <option value="5">5</option>
                <option value="4">4</option>
                <option value="3">3</option>
                <option value="2">2</option>
                <option value="1">1</option>
              </select>
            </td>
            <td>
              <input type="hidden" name="action" value="rateimage" />
              <input type="hidden" name="id" value="{image_id}" />
              <input type="submit" value="{rate}" class="button" name="submit" />
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>-->
<!-- ----------------------------------------------- -->
<!-- [MOD] Ajax Star Rating -------------- by Bash-T -->
<!-- END ----------------------------------------- -->

Danke für die Info! Wenn ich es auf 10 Bewertungspunkte ändern will, muss ich demzufolge die Ergänzungen in oben zitierten, von mir fett markierten Bereich entsprechend ergänzen, richtig?

Gruß

Offline pwa

  • Pre-Newbie
  • Posts: 8
    • View Profile
Hi all!

I am preparing own site based on 4images...
Ajax star rating is very nice mod - work properly... but...  :-(
there is some conflict with mod for image text overlaying (http://www.4homepages.de/forum/index.php?topic=29572.0

Ajax Star rating works well but overlay text dont apear over image...
if I remove from detail.html
Code: [Select]
<script type="text/javascript" src="scripts/ajaxrating.js"></script>overlaing works (but ajax stars of course not)

same suggestion? can you help?

edit:
error message from FF console:
 $("div.description") is null @ ....../details.php?image_id=5:63

Code: [Select]
<script type="text/javascript">
$(window).load(function(){
//for each description div...
$('div.description').each(function(){
//...set the opacity to 0...
$(this).css('opacity', 0);
//..set width same as the image...
$(this).css('width', $(this).siblings('img').width());
//...get the parent (the wrapper) and set it's width same as the image width... '
$(this).parent().css('width', $(this).siblings('img').width());
//...set the display to block
$(this).css('display', 'block');
});

$('div.wrapper').hover(function(){
//when mouse hover over the wrapper div
//get it's children elements with class descriptio
//and show it using fadeTo
$(this).children('.description').stop().fadeTo(500, 0.7);
},function(){
//when mouse out of the wrapper div
//use fadeTo to hide the div
$(this).children('.description').stop().fadeTo(500, 0);
});

});
</script>
« Last Edit: November 06, 2011, 09:32:58 PM by pwa »

Offline sathishIPL

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
I think Jquery selectors is conflicting with other Javacscript framework  i.e yahoo libraries

I am not 100% sure will this code work or not .But just give a try

I didnt test the CODE

please replace the below jquery code in Imageoverlay text[mod].

<script type="text/javascript">
$.
noConflict();
jQuery(window).load(function(){
	
//for each description div...
	
jQuery('div.description').each(function(){
	
	
//...set the opacity to 0...
	
	
jQuery(this).css('opacity'0);
	
	
//..set width same as the image...
	
	
jQuery(this).css('width'jQuery(this).siblings('img').width());
	
	
//...get the parent (the wrapper) and set it's width same as the image width... '
	
	
jQuery(this).parent().css('width'jQuery(this).siblings('img').width());
	
	
//...set the display to block
	
	
jQuery(this).css('display''block');
	
});
	

	
jQuery('div.wrapper').hover(function(){
	
	
//when mouse hover over the wrapper div
	
	
//get it's children elements with class descriptio
	
	
//and show it using fadeTo
	
	
jQuery(this).children('.description').stop().fadeTo(5000.7);
	
},function(){
	
	
//when mouse out of the wrapper div
	
	
//use fadeTo to hide the div
	
	
jQuery(this).children('.description').stop().fadeTo(5000);
	
});
	

});
</
script>
« Last Edit: November 22, 2011, 06:07:42 AM by sathishIPL »

Offline chrissim

  • Pre-Newbie
  • Posts: 4
    • View Profile
hi,

Im trying to align the word "Vote" next to the rating stars but it seem it can't be done here.

For example : Vote : star star star star star

Any guru here can show me or guide on these issue?

Thanks

Offline Murat

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Lavinya
Hello thanks for mod.
I've installed the first version of it. did not work.
After I updated the above version 1.1. still does not work.
This mode does not work in any browsers   :(

As with the mouse on the stars seem to work.
However, do not understand where you click and vote not fixed stars .. voting does not seem to have any symptoms that had been given. However, re-install as the page (f5) is understood given votes.

My system: 4images 1.7.10, Httpd 2.2.21.x, Php 5.3.10.x, mysql 5.5.23.x on centos 5.8

Please update mod. thanks.
<?php echo 'Hello, World!'; ?>

Offline wallward

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
 :( ajax not work, please see this page , after vote need refresh to update voite result
http://wallward.net/details.php?image_id=1&sessionid=d1e6ec902be2079749e2bac515b95c4d

ver 1.7.10

Offline CodeMan

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • ArabGlobe.com
Hi,

I installed this MOD and it seems to work fine.
I was wondering if it's possible to show the result image (which is shown after vote is placed) on other pages.
Now the result image (stars) shows only on the detail.html, but how can I show the image (stars) on other page like Home or in the thumbnail_bit.
Which code should I use?

Thanks!

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
CodeMan, at which pages do you want to show results? What result? Only voted image? Or all votes, maybe must voted??

Offline CodeMan

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • ArabGlobe.com
MrAndrew,

when someone votes, an image of stars is shown.
This image of stars is the result/score of the voting.

Now, this is image is only shown in the detail.html (where the rating code is located).

But how can I show this image of stars on the index.php?
I want to show just the image (result/score), not the whole rating system on other pages.


In the other MOD (Star rating) it is possible to show the mentioned image by using the code <img src="{template_url}/images/{rating_pic}" width="90" height="21" />.



Thanks.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
CodeMan, I`ll try to help you...

Firstly, install this MOD: http://www.4homepages.de/forum/index.php?topic=6123.0

Important! Install variant "A" of the MOD. (A - will uses new table in the database)

When OK and checked, we will go next

Offline CodeMan

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • ArabGlobe.com
MrAndrew,

thanks for offering your help.
Unfortunately, now I have another problem.
After I posted my questions above, I decided to remove this MOD AJAX star rating and so I replaced it with the other MOD Star rating.
Then, when I read your last post I installed the AJAX star rating MOD again.
But now it doesn’t work anymore.
The rating system is visible on my site and the mouse-over-effect is working.

But when clicking on the image to vote, then nothing happens.
No votes are placed, even not when an image was never voted before.
I tried more than once to install it by deleting old files and using fresh files, but no result.
I’m still asking for help, but now first I must get the AJAX rating system work again.

Thanks!

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
CodeMan, now STEP by STEP, to do next:

Before do steps below, make a backup, all files!! I strongly recommend you to do this!

1. Remove AJAX MOD, step by step from instructions from step 8 to 1
2. Check last installed rating mod, and do the same steps (Remove step by step)
3. Check, that default rating system work`s correctly reengaged and work
4. Step by step install AJAX rating again!

Be very careful with code!

Offline CodeMan

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • ArabGlobe.com
Oke MrAndrew,

The AJAX Star Rating is working again.

I also installed the intsructions from the link you gave earlier: http://www.4homepages.de/forum/index.php?topic=6123.0.
And I installed the "voted_a_install.php" after upload to my the root, which is mentioned in the instructions.
Everyting seems to work oke!

Looking forward to reading your further instructions!