summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts')
-rw-r--r--framework/Web/Javascripts/packages.php27
-rw-r--r--framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js11
-rw-r--r--framework/Web/Javascripts/source/prado/controls/controls.js30
-rw-r--r--framework/Web/Javascripts/source/prado/ratings/ratings.js153
4 files changed, 95 insertions, 126 deletions
diff --git a/framework/Web/Javascripts/packages.php b/framework/Web/Javascripts/packages.php
index dd55729e..19cda98b 100644
--- a/framework/Web/Javascripts/packages.php
+++ b/framework/Web/Javascripts/packages.php
@@ -64,6 +64,18 @@ $packages = array(
'prado/controls/htmlarea4.js'
),
+ 'accordion'=>array(
+ 'prado/controls/accordion.js'
+ ),
+
+ 'inlineeditor' => array(
+ 'prado/activecontrols/inlineeditor.js'
+ ),
+
+ 'ratings' => array(
+ 'prado/ratings/ratings.js',
+ ),
+
// jquery
'jquery' => array(
JQUERY_DIR.'/jquery.js',
@@ -89,18 +101,6 @@ $packages = array(
'prado/activecontrols/dragdropextra.js',
),
- 'accordion'=>array(
- 'prado/controls/accordion.js'
- ),
-
- 'ratings' => array(
- 'prado/ratings/ratings.js',
- ),
-
- 'inlineeditor' => array(
- 'prado/activecontrols/inlineeditor.js'
- ),
-
'autocomplete' => array(
SCRIPTACULOUS_DIR.'/controls.js',
'prado/activecontrols/autocomplete.js'
@@ -127,12 +127,11 @@ $dependencies = array(
'slider' => array('jquery', 'prado', 'slider'),
'inlineeditor' => array('jquery', 'prado', 'ajax', 'inlineeditor'),
'accordion' => array('jquery', 'prado', 'accordion'),
+ 'ratings' => array('jquery', 'prado', 'ajax', 'ratings'),
'jqueryui' => array('jquery', 'jqueryui'),
-
'prototype' => array('prototype'),
'dragdrop' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop'),
'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop','dragdropextra'),
- 'ratings' => array('prototype', 'jquery', 'prado', 'ajax', 'ratings'),
'autocomplete' => array('prototype', 'jquery', 'prado', 'ajax', 'autocomplete'),
);
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
index b471a300..907d930e 100644
--- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
@@ -50,18 +50,17 @@ Prado.WebUI.TActiveCheckBox = jQuery.klass(Prado.WebUI.CallbackControl,
Prado.WebUI.TActiveRadioButton = jQuery.klass(Prado.WebUI.TActiveCheckBox);
-Prado.WebUI.TActiveCheckBoxList = jQuery.extend(
+Prado.WebUI.TActiveCheckBoxList = jQuery.klass(Prado.WebUI.Control,
{
- constructor : function(options)
+ onInit : function(options)
{
- Prado.Registry[options.ListID] = this;
for(var i = 0; i<options.ItemCount; i++)
{
- var checkBoxOptions = jQuery.extend(
+ var checkBoxOptions = jQuery.extend({}, options,
{
- ID : options.ListID+"_c"+i,
+ ID : options.ID+"_c"+i,
EventTarget : options.ListName+"$c"+i
- }, options);
+ });
new Prado.WebUI.TActiveCheckBox(checkBoxOptions);
}
}
diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js
index fa01e2e2..00a39e66 100644
--- a/framework/Web/Javascripts/source/prado/controls/controls.js
+++ b/framework/Web/Javascripts/source/prado/controls/controls.js
@@ -290,11 +290,11 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl,
* Override parent onPostBack function, tried to add hidden forms
* inputs to capture x,y clicked point.
*/
- onPostBack : function(event, options)
+ onPostBack : function(options, event)
{
- this.addXYInput(event,options);
- new Prado.PostBack(event, options);
- this.removeXYInput(event,options);
+ this.addXYInput(options, event);
+ new Prado.PostBack(options, event);
+ this.removeXYInput(options, event);
},
/**
@@ -302,7 +302,7 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl,
* @param event DOM click event.
* @param array image button options.
*/
- addXYInput : function(event,options)
+ addXYInput : function(options, event)
{
var imagePos = jQuery(this.element).offset();
var clickedPos = [event.clientX, event.clientY];
@@ -335,7 +335,7 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl,
* @param event DOM click event.
* @param array image button options.
*/
- removeXYInput : function(event,options)
+ removeXYInput : function(options, event)
{
var id = this.element.id;
jQuery('#'+id+'_x').remove();
@@ -496,16 +496,15 @@ jQuery.klass(Prado.WebUI.TTextHighlighter,
Prado.WebUI.TCheckBoxList = jQuery.klass(Prado.WebUI.Control,
{
- constructor : function(options)
+ onInit : function(options)
{
- Prado.Registry.set(options.ListID, this);
for(var i = 0; i<options.ItemCount; i++)
{
- var checkBoxOptions = jQuery.extend(
+ var checkBoxOptions = jQuery.extend({}, options,
{
- ID : options.ListID+"_c"+i,
+ ID : options.ID+"_c"+i,
EventTarget : options.ListName+"$c"+i
- }, options);
+ });
new Prado.WebUI.TCheckBox(checkBoxOptions);
}
}
@@ -513,16 +512,15 @@ Prado.WebUI.TCheckBoxList = jQuery.klass(Prado.WebUI.Control,
Prado.WebUI.TRadioButtonList = jQuery.klass(Prado.WebUI.Control,
{
- constructor : function(options)
+ onInit : function(options)
{
- Prado.Registry.set(options.ListID, this);
for(var i = 0; i<options.ItemCount; i++)
{
- var radioButtonOptions = jQuery.extend(
+ var radioButtonOptions = jQuery.extend({}, options,
{
- ID : options.ListID+"_c"+i,
+ ID : options.ID+"_c"+i,
EventTarget : options.ListName+"$c"+i
- }, options);
+ });
new Prado.WebUI.TRadioButton(radioButtonOptions);
}
}
diff --git a/framework/Web/Javascripts/source/prado/ratings/ratings.js b/framework/Web/Javascripts/source/prado/ratings/ratings.js
index 1369c740..eb541b99 100644
--- a/framework/Web/Javascripts/source/prado/ratings/ratings.js
+++ b/framework/Web/Javascripts/source/prado/ratings/ratings.js
@@ -1,78 +1,67 @@
-Prado.WebUI.TRatingList = Base.extend(
+Prado.WebUI.TRatingList = jQuery.klass(Prado.WebUI.Control,
{
selectedIndex : -1,
rating: -1,
readOnly : false,
- constructor : function(options)
+ onInit : function(options)
{
- var cap = $(options.CaptionID);
- this.options = Object.extend(
+ var cap = $('#'+options.CaptionID).get(0);
+ this.options = jQuery.extend(
{
caption : cap ? cap.innerHTML : ''
}, options || {});
- Prado.WebUI.TRatingList.register(this);
- this._init();
- Prado.Registry.set(options.ListID, this);
- this.selectedIndex = options.SelectedIndex;
- this.rating = options.Rating;
- this.readOnly = options.ReadOnly
- if(options.Rating <= 0 && options.SelectedIndex >= 0)
- this.rating = options.SelectedIndex+1;
- this.setReadOnly(this.readOnly);
- },
+ this.radios = [];
- _init: function(options)
- {
- Element.addClassName($(this.options.ListID),this.options.Style);
- this.radios = new Array();
- this._mouseOvers = new Array();
- this._mouseOuts = new Array();
- this._clicks = new Array();
- var index=0;
- for(var i = 0; i<this.options.ItemCount; i++)
+ $('#'+options.ID).addClass(options.Style);
+ for(var i = 0; i<options.ItemCount; i++)
{
- var radio = $(this.options.ListID+'_c'+i);
+ var radio = $('#'+options.ID+"_c"+i).get(0);
var td = radio.parentNode.parentNode;
+
if(radio && td.tagName.toLowerCase()=='td')
{
this.radios.push(radio);
- this._mouseOvers.push(this.hover.bindEvent(this,index));
- this._mouseOuts.push(this.recover.bindEvent(this,index));
- this._clicks.push(this.click.bindEvent(this,index));
- index++;
- Element.addClassName(td,"rating");
+ $(td).addClass("rating");
}
}
+
+ this.selectedIndex = options.SelectedIndex;
+ this.rating = options.Rating;
+ this.readOnly = options.ReadOnly
+ if(options.Rating <= 0 && options.SelectedIndex >= 0)
+ this.rating = options.SelectedIndex+1;
+ this.setReadOnly(this.readOnly);
},
- hover : function(ev,index)
+ hover : function(index, ev)
{
if(this.readOnly==true) return;
+
for(var i = 0; i<this.radios.length; i++)
{
var node = this.radios[i].parentNode.parentNode;
- var action = i <= index ? 'addClassName' : 'removeClassName'
- Element[action](node,"rating_hover");
- Element.removeClassName(node,"rating_selected");
- Element.removeClassName(node,"rating_half");
+ if(i <= index)
+ $(node).addClass('rating_hover');
+ else
+ $(node).removeClass('rating_hover');
+ $(node).removeClass("rating_selected");
+ $(node).removeClass("rating_half");
}
this.showCaption(this.getIndexCaption(index));
},
- recover : function(ev,index)
+ recover : function(index, ev)
{
if(this.readOnly==true) return;
this.showRating(this.rating);
this.showCaption(this.options.caption);
},
- click : function(ev, index)
+ click : function(index, ev)
{
if(this.readOnly==true) return;
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].checked = (i == index);
this.selectedIndex = index;
this.setRating(index+1);
@@ -83,13 +72,13 @@ Prado.WebUI.TRatingList = Base.extend(
dispatchRequest : function(ev)
{
- var requestOptions = Object.extend(
+ var requestOptions =jQuery.extend({}, this.options,
{
- ID : this.options.ListID+"_c"+this.selectedIndex,
+ ID : this.options.ID+"_c"+this.selectedIndex,
EventTarget : this.options.ListName+"$c"+this.selectedIndex
- },this.options);
- Prado.PostBack(ev, requestOptions);
- },
+ });
+ new Prado.PostBack(requestOptions, ev);
+ },
setRating : function(value)
{
@@ -119,16 +108,19 @@ Prado.WebUI.TRatingList = Base.extend(
for(var i = 0; i<this.radios.length; i++)
{
var node = this.radios[i].parentNode.parentNode;
- var action = i > index ? 'removeClassName' : 'addClassName';
- Element[action](node, "rating_selected");
+ if(i <= index)
+ $(node).addClass('rating_selected');
+ else
+ $(node).removeClass('rating_selected');
+
if(i==index+1 && hasHalf)
- Element.addClassName(node, "rating_half");
+ $(node).addClass("rating_half");
else
- Element.removeClassName(node, "rating_half");
- Element.removeClassName(node,"rating_hover");
+ $(node).removeClass("rating_half");
+ $(node).removeClass("rating_hover");
}
},
-
+
getIndexCaption : function(index)
{
return index > -1 ? this.radios[index].value : this.options.caption;
@@ -136,9 +128,8 @@ Prado.WebUI.TRatingList = Base.extend(
showCaption : function(value)
{
- var caption = $(this.options.CaptionID);
- if(caption) caption.innerHTML = value;
- $(this.options.ListID).title = value;
+ $('#'+this.options.CaptionID).html(value);
+ $('#'+this.options.ID).attr( "title", value);
},
setCaption : function(value)
@@ -152,55 +143,37 @@ Prado.WebUI.TRatingList = Base.extend(
this.readOnly = value;
for(var i = 0; i<this.radios.length; i++)
{
-
- var action = value ? 'addClassName' : 'removeClassName';
- Element[action](this.radios[i].parentNode.parentNode, "rating_disabled");
-
- var action = value ? 'stopObserving' : 'observe';
- var td = this.radios[i].parentNode.parentNode;
- Event[action](td, "mouseover", this._mouseOvers[i]);
- Event[action](td, "mouseout", this._mouseOuts[i]);
- Event[action](td, "click", this._clicks[i]);
+ var node = this.radios[i].parentNode.parentNode;
+ if(value)
+ {
+ $(node).addClass('rating_disabled');
+ $(node).off('mouseover', jQuery.proxy(this.hover, this, i));
+ $(node).off('mouseout', jQuery.proxy(this.recover, this, i));
+ $(node).off('click', jQuery.proxy(this.click, this, i));
+ } else {
+ $(node).removeClass('rating_disabled');
+ $(node).on('mouseover', jQuery.proxy(this.hover, this, i));
+ $(node).on('mouseout', jQuery.proxy(this.recover, this, i));
+ $(node).on('click', jQuery.proxy(this.click, this, i));
+ }
}
this.showRating(this.rating);
}
-},
-{
-ratings : {},
-register : function(rating)
-{
- Prado.WebUI.TRatingList.ratings[rating.options.ListID] = rating;
-},
-
-setReadOnly : function(id,value)
-{
- Prado.WebUI.TRatingList.ratings[id].setReadOnly(value);
-},
-
-setRating : function(id,value)
-{
- Prado.WebUI.TRatingList.ratings[id].setRating(value);
-},
-
-setCaption : function(id,value)
-{
- Prado.WebUI.TRatingList.ratings[id].setCaption(value);
-}
});
-Prado.WebUI.TActiveRatingList = Prado.WebUI.TRatingList.extend(
-{
+Prado.WebUI.TActiveRatingList = jQuery.klass(Prado.WebUI.TRatingList,
+{
dispatchRequest : function(ev)
{
- var requestOptions = Object.extend(
+ var requestOptions =jQuery.extend({}, this.options,
{
- ID : this.options.ListID+"_c"+this.selectedIndex,
+ ID : this.options.ID+"_c"+this.selectedIndex,
EventTarget : this.options.ListName+"$c"+this.selectedIndex
- },this.options);
+ });
var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
if(request.dispatch()==false)
- Event.stop(ev);
+ ev.preventDefault();
}
-
+
});