summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/compressed/ajax.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/js/compressed/ajax.js')
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index b6387293..d8536c50 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -231,7 +231,7 @@ this.onInit(options);},doCallback:function(event,options)
{var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();Event.fireEvent(this.element,"change");},getUpdatedChoices:function()
{var options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},selectEntry:function()
{if(this.hasResults)
-{this.active=false;this.updateElement(this.getCurrentEntry());}},onComplete:function(request,boundary)
+{this.active=false;this.updateElement(this.getCurrentEntry());var options=[this.index,"__TAutoComplete_onSuggestionSelected__"];Prado.Callback(this.options.EventTarget,options,null,this.options);}},onComplete:function(request,boundary)
{var result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string")
{if(result.length>0)
{this.hasResults=true;this.updateChoices(result);}
@@ -268,8 +268,8 @@ this.count=this.count+this.options.Decay;if(this.observing)
this.time=setTimeout(this.checkChanges.bind(this),parseInt(this.options.Interval*1000*this.count));}},doCallback:function(oldValue,newValue)
{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);var param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer)
{Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID]=timer;},stop:function(id)
-{Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options)
-{this.options=Object.extend({LoadTextFromSource:false,TextMode:'SingleLine'},options||{});this.element=$(this.options.ID);Prado.WebUI.TInPlaceTextBox.register(this);this.createEditorInput();this.initializeListeners();},initializeListeners:function()
+{Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({constructor:function(options)
+{this.isSaving=false;this.isEditing=false;this.editField=null;this.options=Object.extend({LoadTextFromSource:false,TextMode:'SingleLine'},options||{});this.element=$(this.options.ID);Prado.WebUI.TInPlaceTextBox.register(this);this.createEditorInput();this.initializeListeners();},initializeListeners:function()
{this.onclickListener=this.enterEditMode.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);if(this.options.ExternalControl)
Event.observe($(this.options.ExternalControl),'click',this.onclickListener);},enterEditMode:function(evt)
{if(this.isSaving||this.isEditing)return;this.isEditing=true;this.onEnterEditMode();this.createEditorInput();this.showTextBox();this.editField.disabled=false;if(this.options.LoadTextOnEdit)
@@ -295,14 +295,21 @@ if(this.options.TextMode=='SingleLine')
{if(Event.keyCode(e)==Event.KEY_RETURN)
{var target=Event.element(e);if(target)
{Event.fireEvent(target,"blur");Event.stop(e);}}});}
-Event.observe(this.editField,"blur",this.onTextBoxBlur.bind(this));},getText:function()
+Event.observe(this.editField,"blur",this.onTextBoxBlur.bind(this));Event.observe(this.editField,"keypress",this.onKeyPressed.bind(this));},getText:function()
{return this.element.innerHTML;},onEnterEditMode:function()
{if(typeof(this.options.onEnterEditMode)=="function")
this.options.onEnterEditMode(this,null);},onTextBoxBlur:function(e)
{text=this.element.innerHTML;if(this.options.AutoPostBack&&text!=this.editField.value)
-this.onTextChanged(text);else
+{if(this.isEditing)
+this.onTextChanged(text);}
+else
{this.element.innerHTML=this.editField.value;this.isEditing=false;if(this.options.AutoHide)
-this.showLabel();}},onTextChanged:function(text)
+this.showLabel();}},onKeyPressed:function(e)
+{if(Event.keyCode(e)==Event.KEY_ESC)
+{this.editField.value=this.getText();this.isEditing=false;if(this.options.AutoHide)
+this.showLabel();}
+else if(Event.keyCode(e)==Event.KEY_RETURN)
+Event.stop(e);},onTextChanged:function(text)
{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(text);request.ActiveControl.onSuccess=this.onTextChangedSuccess.bind(this);request.ActiveControl.onFailure=this.onTextChangedFailure.bind(this);if(request.dispatch())
{this.isSaving=true;this.editField.disabled=true;}},onLoadingText:function()
{},onloadExternalTextSuccess:function(request,parameter)