From 9e2820e98640f4ca262db7279a514826341df3e0 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 8 Oct 2006 05:11:23 +0000 Subject: Fixed #414, #411, #415 --- framework/Web/Javascripts/js/debug/ajax.js | 121 ++++++++++++++++++++++++----- 1 file changed, 102 insertions(+), 19 deletions(-) (limited to 'framework/Web/Javascripts/js/debug') diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js index ba777546..8b75c2ad 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2396,7 +2396,7 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( }, options || {}); this.element = $(this.options.ID); - + Prado.WebUI.TInPlaceTextBox.register(this); this.initializeListeners(); }, @@ -2417,8 +2417,7 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( */ enterEditMode : function(evt) { - if (this.isSaving) return; - if (this.isEditing) return; + if (this.isSaving || this.isEditing) return; this.isEditing = true; this.onEnterEditMode(); this.createEditorInput(); @@ -2432,6 +2431,15 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( return false; }, + exitEditMode : function(evt) + { + this.isEditing = false; + this.isSaving = false; + this.editField.disabled = false; + this.element.innerHTML = this.editField.value; + this.showLabel(); + }, + showTextBox : function() { Element.hide(this.element); @@ -2608,11 +2616,34 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( this.isSaving = false; this.isEditing = false; } +}, +{ + textboxes : {}, + + register : function(obj) + { + Prado.WebUI.TInPlaceTextBox.textboxes[obj.options.TextBoxID] = obj; + }, + + setDisplayTextBox : function(id,value) + { + var textbox = Prado.WebUI.TInPlaceTextBox.textboxes[id]; + if(textbox) + { + if(value) + textbox.enterEditMode(null); + else + { + textbox.exitEditMode(null); + } + } + } }); Prado.WebUI.TRatingList = Base.extend( { selectedIndex : -1, + rating: -1, enabled : true, readOnly : false, @@ -2627,7 +2658,10 @@ Prado.WebUI.TRatingList = Base.extend( Prado.WebUI.TRatingList.register(this); this._init(); this.selectedIndex = options.SelectedIndex; - this.setRating(this.selectedIndex); + this.rating = options.Rating; + if(options.Rating <= 0 && options.SelectedIndex >= 0) + this.rating = options.SelectedIndex+1; + this.showRating(this.rating); }, _init: function(options) @@ -2656,18 +2690,20 @@ Prado.WebUI.TRatingList = Base.extend( if(this.enabled==false) return; for(var i = 0; i halfMax ? base+1 : base; + for(var i = 0; i halfMax ? base+1 : base; + var hasHalf = remainder >= halfMin && remainder <= halfMax; for(var i = 0; i index ? 'removeClassName' : 'addClassName' - Element[action](this.radios[i].parentNode, "rating_selected"); + var action = i > index ? 'removeClassName' : 'addClassName'; + Element[action](node, "rating_selected"); + if(i==index+1 && hasHalf) + Element.addClassName(node, "rating_half"); + else + Element.removeClassName(node, "rating_half"); + Element.removeClassName(node,"rating_hover"); } - this.setCaption(index); }, - setCaption : function(index) + getIndexCaption : function(index) + { + return index > -1 ? this.radios[index].value : this.options.caption; + }, + + showCaption : function(value) { - var value = index > -1 ? this.radios[index].value : this.options.caption; var caption = $(this.options.CaptionID); if(caption) caption.innerHTML = value; $(this.options.ListID).title = value; }, + setCaption : function(value) + { + this.options.caption = value; + this.showCaption(value); + }, + setEnabled : function(value) { this.enabled = value; @@ -2732,7 +2811,11 @@ setEnabled : function(id,value) setRating : function(id,value) { Prado.WebUI.TRatingList.ratings[id].setRating(value); - Prado.WebUI.TRatingList.ratings[id].selectedIndex = value; +}, + +setCaption : function(id,value) +{ + Prado.WebUI.TRatingList.ratings[id].setCaption(value); } }); -- cgit v1.2.3