summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-10-18 23:38:44 +0000
committerwei <>2006-10-18 23:38:44 +0000
commit80c82147fc8143eb45ef2000a49fabac889a1615 (patch)
tree42cfb960ec7bc72c6b657ff532abafde417eedd9
parentaf832a5a9018c7dcc2f24111d82049902269fc53 (diff)
fixed onFailure and onSuccess in TInPlaceTextBox
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js12
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js8
-rw-r--r--framework/Web/Javascripts/prado/inlineeditor.js8
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page12
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.php5
5 files changed, 41 insertions, 4 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index 16dacb52..115be3d3 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -299,11 +299,15 @@ this.showLabel();}},onTextChanged:function(text)
{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(text);request.options.onSuccess=this.onTextChangedSuccess.bind(this);request.options.onFailure=this.onTextChangedFailure.bind(this);if(request.dispatch())
{this.isSaving=true;this.editField.disabled=true;}},onLoadingText:function()
{},onloadExternalTextSuccess:function(request,parameter)
-{this.isEditing=true;this.editField.disabled=false;this.editField.value=this.getText();Prado.Element.focus(this.editField);},onloadExternalTextFailure:function(request,parameter)
-{this.isSaving=false;this.isEditing=false;this.showLabel();},onTextChangedSuccess:function(sender,parameter)
+{this.isEditing=true;this.editField.disabled=false;this.editField.value=this.getText();Prado.Element.focus(this.editField);if(typeof(this.options.onSuccess)=="function")
+this.options.onSuccess(sender,parameter);},onloadExternalTextFailure:function(request,parameter)
+{this.isSaving=false;this.isEditing=false;this.showLabel();if(typeof(this.options.onFailure)=="function")
+this.options.onFailure(sender,parameter);},onTextChangedSuccess:function(sender,parameter)
{this.isSaving=false;this.isEditing=false;if(this.options.AutoHide)
-this.showLabel();this.element.innerHTML=parameter==null?this.editField.value:parameter;this.editField.disabled=false;},onTextChangedFailure:function(sender,parameter)
-{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;}},{textboxes:{},register:function(obj)
+this.showLabel();this.element.innerHTML=parameter==null?this.editField.value:parameter;this.editField.disabled=false;if(typeof(this.options.onSuccess)=="function")
+this.options.onSuccess(sender,parameter);},onTextChangedFailure:function(sender,parameter)
+{this.editField.disabled=false;this.isSaving=false;this.isEditing=false;if(typeof(this.options.onFailure)=="function")
+this.options.onFailure(sender,parameter);}},{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)
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index 8b75c2ad..0f2d1c1b 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -2586,6 +2586,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.editField.disabled = false;
this.editField.value = this.getText();
Prado.Element.focus(this.editField);
+ if(typeof(this.options.onSuccess)=="function")
+ this.options.onSuccess(sender,parameter);
},
onloadExternalTextFailure : function(request, parameter)
@@ -2593,6 +2595,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.isSaving = false;
this.isEditing = false;
this.showLabel();
+ if(typeof(this.options.onFailure)=="function")
+ this.options.onFailure(sender,parameter);
},
/**
@@ -2608,6 +2612,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.showLabel();
this.element.innerHTML = parameter == null ? this.editField.value : parameter;
this.editField.disabled = false;
+ if(typeof(this.options.onSuccess)=="function")
+ this.options.onSuccess(sender,parameter);
},
onTextChangedFailure : function(sender, parameter)
@@ -2615,6 +2621,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.editField.disabled = false;
this.isSaving = false;
this.isEditing = false;
+ if(typeof(this.options.onFailure)=="function")
+ this.options.onFailure(sender,parameter);
}
},
{
diff --git a/framework/Web/Javascripts/prado/inlineeditor.js b/framework/Web/Javascripts/prado/inlineeditor.js
index 719c525d..de74585f 100644
--- a/framework/Web/Javascripts/prado/inlineeditor.js
+++ b/framework/Web/Javascripts/prado/inlineeditor.js
@@ -203,6 +203,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.editField.disabled = false;
this.editField.value = this.getText();
Prado.Element.focus(this.editField);
+ if(typeof(this.options.onSuccess)=="function")
+ this.options.onSuccess(sender,parameter);
},
onloadExternalTextFailure : function(request, parameter)
@@ -210,6 +212,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.isSaving = false;
this.isEditing = false;
this.showLabel();
+ if(typeof(this.options.onFailure)=="function")
+ this.options.onFailure(sender,parameter);
},
/**
@@ -225,6 +229,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.showLabel();
this.element.innerHTML = parameter == null ? this.editField.value : parameter;
this.editField.disabled = false;
+ if(typeof(this.options.onSuccess)=="function")
+ this.options.onSuccess(sender,parameter);
},
onTextChangedFailure : function(sender, parameter)
@@ -232,6 +238,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
this.editField.disabled = false;
this.isSaving = false;
this.isEditing = false;
+ if(typeof(this.options.onFailure)=="function")
+ this.options.onFailure(sender,parameter);
}
},
{
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page b/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page
index cf43dea6..14f74013 100644
--- a/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page
+++ b/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.page
@@ -59,6 +59,18 @@
<com:TActiveLabel ID="status" Text="Status:" />
+
+ <com:TInPlaceTextBox
+ id="lblNewPackageTitle"
+ OnTextChanged="NewPackageSubject"
+ CssClass="textbox"
+ Text="عنوان باکس ...">
+ <prop:ClientSide
+ OnFailure="alert(10)"/>
+ </com:TInPlaceTextBox>
+
+ <com:TActiveButton Text="ad" OnCallback="NewPackageSubject" ClientSide.OnFailure="alert(10)"/>
+
<com:TJavascriptLogger />
</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.php b/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.php
index 5607dea8..9b5a05f7 100644
--- a/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/TInPlaceTextBoxTest.php
@@ -16,6 +16,11 @@ class TInPlaceTextBoxTest extends TPage
{
$this->label1->Text = "hahahaha";
}
+
+ function NewPackageSubject($sender, $param)
+ {
+ throw new TException('Exist');
+ }
}
?> \ No newline at end of file