Jeff Zaroyko : add a visual cue which shows the rating definition currently selected, it changes when a different rating is selected

Chris Morgan cmorgan at winehq.org
Tue Jun 3 18:26:09 CDT 2008


Module: appdb
Branch: master
Commit: 4bf0bb6a27e2a4be537339bfa7c0a1eee1f537d7
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=4bf0bb6a27e2a4be537339bfa7c0a1eee1f537d7

Author: Jeff Zaroyko <jeffzaroyko at gmail.com>
Date:   Tue Jun  3 17:40:04 2008 +1000

add a visual cue which shows the rating definition currently selected, it changes when a different rating is selected

---

 include/util.php |    4 ++--
 scripts.js       |   29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/include/util.php b/include/util.php
index e878ae6..57576ae 100644
--- a/include/util.php
+++ b/include/util.php
@@ -217,7 +217,7 @@ function make_bugzilla_version_list($sVarname, $sSelectedValue)
 // returns a string containing the html for the maintainer rating list
 function make_maintainer_rating_list($varname, $cvalue)
 {
-    $sTxt =  "<select name='$varname'>\n";
+    $sTxt = "<select id='ratingSelect' onchange='showHint(this)' name='$varname'>\n";
     $sTxt .= "<option value=\"\">Choose ...</option>\n";
     $aRating = array("Platinum", "Gold", "Silver", "Bronze", "Garbage");
     $iMax = count($aRating);
@@ -229,7 +229,7 @@ function make_maintainer_rating_list($varname, $cvalue)
         else
             $sTxt .= "<option class=$aRating[$i] value=$aRating[$i]>$aRating[$i]\n";
     }
-    $sTxt .= "</select>\n";
+    $sTxt .= "</select>&nbsp;<span id='hint'></span>&nbsp;\n";
 
     return $sTxt;
 }
diff --git a/scripts.js b/scripts.js
index 48f6013..078f527 100644
--- a/scripts.js
+++ b/scripts.js
@@ -67,3 +67,32 @@ function showComment(commentid)
     elem.show();
   }
 }
+/* provide a hint to the user about the selected rating */
+var ratingdesc=[
+		"",
+		" Works flawlessly out of the box - no problems ",
+		" Works flawlessly with DLL overrides, third party software or other settings ",
+		" Works excellently for normal use;works fine in singleplayer but not multi ",
+		" Works but has issues for normal use ",
+		" Does not run or cannot be installed with Wine "
+		];
+var ratingstyle =[
+		  "",
+		  "platinum",
+		  "gold",
+		  "silver",
+		  "bronze",
+		  "garbage"
+		  ];
+function showHint(o){
+    if(o)
+	{
+	    $('hint').innerHTML=ratingdesc[o.selectedIndex];
+	    $w($('hint').className).map( function(x){ $('hint').removeClassName(x); }) 
+	    $('hint').addClassName(ratingstyle[o.selectedIndex]);
+	}
+}
+/* executed when document is ready */
+document.observe("dom:loaded", function() {
+	showHint($('ratingSelect'));
+    });




More information about the wine-cvs mailing list