summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/ratings
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/ratings')
-rw-r--r--framework/Web/Javascripts/ratings/10star_white.gifbin25048 -> 0 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks.css29
-rw-r--r--framework/Web/Javascripts/ratings/blocks.pngbin0 -> 29885 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_blank.gifbin0 -> 72 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_half.gifbin0 -> 94 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_hover.gifbin0 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/ratings/blocks_selected.gifbin0 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default.css32
-rw-r--r--framework/Web/Javascripts/ratings/default_blank.gifbin0 -> 271 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_half.gifbin0 -> 619 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_hover.gifbin0 -> 618 bytes
-rw-r--r--framework/Web/Javascripts/ratings/default_selected.gifbin0 -> 614 bytes
-rw-r--r--framework/Web/Javascripts/ratings/ratings.js70
-rw-r--r--framework/Web/Javascripts/ratings/stars1.pngbin0 -> 53016 bytes
14 files changed, 79 insertions, 52 deletions
diff --git a/framework/Web/Javascripts/ratings/10star_white.gif b/framework/Web/Javascripts/ratings/10star_white.gif
deleted file mode 100644
index 0acdf5c9..00000000
--- a/framework/Web/Javascripts/ratings/10star_white.gif
+++ /dev/null
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks.css b/framework/Web/Javascripts/ratings/blocks.css
new file mode 100644
index 00000000..2bf2e904
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks.css
@@ -0,0 +1,29 @@
+.TRatingList_blocks
+{
+ border-collapse: collapse;
+}
+.TRatingList_blocks input, .TRatingList_blocks label
+{
+ display: none;
+}
+.TRatingList_blocks td
+{
+ width: 17px;
+ height: 18px;
+ background-image: url(blocks_blank.gif);
+ background-repeat: no-repeat;
+ cursor: pointer;
+}
+.TRatingList_blocks td.rating_selected
+{
+ background-image: url(blocks_selected.gif);
+}
+
+.TRatingList_blocks td.rating_hover
+{
+ background-image: url(blocks_hover.gif);
+}
+.TRatingList_blocks td.rating_half
+{
+ background-image: url(blocks_half.gif);
+}
diff --git a/framework/Web/Javascripts/ratings/blocks.png b/framework/Web/Javascripts/ratings/blocks.png
new file mode 100644
index 00000000..16a2b249
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks.png
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_blank.gif b/framework/Web/Javascripts/ratings/blocks_blank.gif
new file mode 100644
index 00000000..a68d0e94
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_half.gif b/framework/Web/Javascripts/ratings/blocks_half.gif
new file mode 100644
index 00000000..4cff0148
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_hover.gif b/framework/Web/Javascripts/ratings/blocks_hover.gif
new file mode 100644
index 00000000..58ad7495
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_hover.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_selected.gif b/framework/Web/Javascripts/ratings/blocks_selected.gif
new file mode 100644
index 00000000..f91873e2
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/blocks_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default.css b/framework/Web/Javascripts/ratings/default.css
index 1609ee05..c15a36bd 100644
--- a/framework/Web/Javascripts/ratings/default.css
+++ b/framework/Web/Javascripts/ratings/default.css
@@ -1,21 +1,29 @@
-.TRatingList_default tr
+.TRatingList_default
+{
+ border-collapse: collapse;
+}
+.TRatingList_default input, .TRatingList_default label
{
display: none;
}
-
-.TRatingList_default
+.TRatingList_default td
{
- width: 120px;
- height: 20px;
- background-image: url(10star_white.gif);
- background-position: -0px -4px;
+ width: 17px;
+ height: 18px;
+ background-image: url(default_blank.gif);
background-repeat: no-repeat;
- margin: 4px;
cursor: pointer;
}
+.TRatingList_default td.rating_selected
+{
+ background-image: url(default_selected.gif);
+}
-.TRatingList_default caption
+.TRatingList_default td.rating_hover
{
- padding-left: 4px;
- text-align: left;
-} \ No newline at end of file
+ background-image: url(default_hover.gif);
+}
+.TRatingList_default td.rating_half
+{
+ background-image: url(default_half.gif);
+}
diff --git a/framework/Web/Javascripts/ratings/default_blank.gif b/framework/Web/Javascripts/ratings/default_blank.gif
new file mode 100644
index 00000000..4e6fda3c
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_half.gif b/framework/Web/Javascripts/ratings/default_half.gif
new file mode 100644
index 00000000..7cecf0ec
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_hover.gif b/framework/Web/Javascripts/ratings/default_hover.gif
new file mode 100644
index 00000000..ad0cd28a
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_hover.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_selected.gif b/framework/Web/Javascripts/ratings/default_selected.gif
new file mode 100644
index 00000000..a19ab39f
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/default_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/ratings.js b/framework/Web/Javascripts/ratings/ratings.js
index c5efc372..e6fd97ba 100644
--- a/framework/Web/Javascripts/ratings/ratings.js
+++ b/framework/Web/Javascripts/ratings/ratings.js
@@ -8,63 +8,53 @@ Prado.WebUI.TRatingList.prototype =
this.options = options;
this.element = $(options['ID']);
Element.addClassName(this.element,options.cssClass);
- var width = options.total * options.dx;
- this.element.style.width = width+"px";
- Event.observe(this.element, 'mouseover', this.hover.bindEvent(this));
- Event.observe(this.element, 'mouseout', this.recover.bindEvent(this));
- Event.observe(this.element, 'click', this.click.bindEvent(this));
- this._onMouseMoveEvent = this.mousemoved.bindEvent(this);
- this.selectedIndex = options.pos;
this.radios = document.getElementsByName(options.field);
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ Event.observe(this.radios[i].parentNode, "mouseover", this.hover.bindEvent(this,i));
+ Event.observe(this.radios[i].parentNode, "mouseout", this.recover.bindEvent(this,i));
+ Event.observe(this.radios[i].parentNode, "click", this.click.bindEvent(this, i));
+ }
this.caption = CAPTION();
this.element.appendChild(this.caption);
- this.showPosition(this.selectedIndex,false);
+ this.selectedIndex = options.selectedIndex;
+ this.setRating(this.selectedIndex);
},
- hover : function()
+ hover : function(ev,index)
{
- Event.observe(this.element, "mousemove", this._onMouseMoveEvent);
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
+ this.setCaption(index);
},
- recover : function()
+ recover : function(ev,index)
{
- Event.stopObserving(this.element, "mousemove", this._onMouseMoveEvent);
- this.showPosition(this.selectedIndex,false);
+ for(var i = 0; i<=index; i++)
+ Element.removeClassName(this.radios[i].parentNode, "rating_hover");
+ this.setRating(this.selectedIndex);
},
- mousemoved : function(e)
+ click : function(ev, index)
{
- this.updatePosition(e,true);
- },
-
- updatePosition : function(e, hovering)
- {
- var obj = Event.element(e);
- var elementPos = Position.cumulativeOffset(obj);
- var clientX = Event.pointerX(e) - elementPos[0];
- var pos = parseInt(clientX / this.options.dx);
- if(!hovering || this.options.pos != pos)
- this.showPosition(pos, hovering)
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].checked = (i == index);
+ this.selectedIndex = index;
+ this.setRating(index);
+ if(isFunction(this.options.onChange))
+ this.options.onChange(this,index);
},
- click : function(ev)
+ setRating: function(index)
{
- this.updatePosition(ev,false);
- this.selectedIndex = this.options.pos;
- for(var i = 0; i < this.radios.length; i++)
- this.radios[i].checked = (i == this.selectedIndex);
- if(isFunction(this.options.onChange))
- this.options.onChange(this, this.selectedIndex);
+ for(var i = 0; i<=index; i++)
+ this.radios[i].parentNode.className = "rating_selected";
+ this.setCaption(index);
},
- showPosition : function(pos, hovering)
+ setCaption : function(index)
{
- if(pos >= this.options.total) return;
- var dy = this.options.dy * (pos+1) + this.options.iy;
- var dx = hovering ? this.options.hx + this.options.ix : this.options.ix;
- this.element.style.backgroundPosition = "-"+dx+"px -"+dy+"px";
- this.options.pos = pos;
- this.caption.innerHTML = pos >= 0 ?
- this.radios[this.options.pos].value : this.options.caption;
+ this.caption.innerHTML = index > -1 ?
+ this.radios[index].value : this.options.caption;
}
} \ No newline at end of file
diff --git a/framework/Web/Javascripts/ratings/stars1.png b/framework/Web/Javascripts/ratings/stars1.png
new file mode 100644
index 00000000..e4dd3c25
--- /dev/null
+++ b/framework/Web/Javascripts/ratings/stars1.png
Binary files differ