summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes12
-rw-r--r--framework/DataAccess/SQLMap/Statements/TSqlMapSelect.php11
-rw-r--r--framework/Web/Javascripts/js/prado.js7
-rw-r--r--framework/Web/Javascripts/prado/element.js72
-rw-r--r--framework/Web/UI/ActiveControls/TActivePanel.php20
-rw-r--r--framework/Web/UI/ActiveControls/TBaseActiveControl.php66
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientScript.php132
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php2
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php11
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl6
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page16
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php27
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php4
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page22
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php31
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page21
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php11
-rw-r--r--tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php22
-rw-r--r--tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php48
-rw-r--r--tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php24
-rwxr-xr-xtests/FunctionalTests/active.php4
21 files changed, 433 insertions, 136 deletions
diff --git a/.gitattributes b/.gitattributes
index 61552a8d..a95e0881 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1311,6 +1311,7 @@ framework/DataAccess/SQLMap/Statements/TPreparedStatement.php -text
framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php -text
framework/DataAccess/SQLMap/Statements/TSelectMappedStatement.php -text
framework/DataAccess/SQLMap/Statements/TSimpleDynamicSql.php -text
+framework/DataAccess/SQLMap/Statements/TSqlMapSelect.php -text
framework/DataAccess/SQLMap/Statements/TStaticSql.php -text
framework/DataAccess/SQLMap/Statements/TUpdateMappedStatement.php -text
framework/DataAccess/SQLMap/TMapper.php -text
@@ -1855,6 +1856,17 @@ requirements/messages.txt -text
requirements/template-bg.html -text
requirements/template-zh.html -text
requirements/template.html -text
+tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php -text
+tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl -text
+tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page -text
+tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php -text
+tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page -text
+tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php -text
+tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page -text
+tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php -text
+tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php -text
+tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php -text
+tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php -text
tests/FunctionalTests/features.php -text
tests/FunctionalTests/features/index.php -text
tests/FunctionalTests/features/protected/application.xml -text
diff --git a/framework/DataAccess/SQLMap/Statements/TSqlMapSelect.php b/framework/DataAccess/SQLMap/Statements/TSqlMapSelect.php
new file mode 100644
index 00000000..b33bc27e
--- /dev/null
+++ b/framework/DataAccess/SQLMap/Statements/TSqlMapSelect.php
@@ -0,0 +1,11 @@
+<?php
+
+class TSqlMapSelect extends TSqlMapStatement
+{
+ private $_generate;
+
+ public function getGenerate(){ return $this->_generate; }
+ public function setGenerate($value){ $this->_generate = $value; }
+}
+
+?> \ No newline at end of file
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js
index 955790ea..25a26d70 100644
--- a/framework/Web/Javascripts/js/prado.js
+++ b/framework/Web/Javascripts/js/prado.js
@@ -329,7 +329,12 @@ elements[i].checked=true;}},checkIndices:function(elements,indices)
{elements.each(function(el)
{el.checked=true;})},checkInvert:function(elements)
{elements.each(function(el)
-{el.checked!=el.checked;})}};Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={_elementOnClick:null,initialize:function(options)
+{el.checked!=el.checked;})}};Prado.Element.Insert={append:function(element,content)
+{new Insertion.Bottom(element,content);},prepend:function(element,content)
+{new Insertion.Top(element,content);},after:function(element,content)
+{new Insertion.After(element,content);},before:function(element,content)
+{new Insertion.Before(element,content);}}
+Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={_elementOnClick:null,initialize:function(options)
{this.element=$(options.ID);if(this.onInit)
this.onInit(options);},onInit:function(options)
{if(typeof(this.element.onclick)=="function")
diff --git a/framework/Web/Javascripts/prado/element.js b/framework/Web/Javascripts/prado/element.js
index 82f281fb..9b7bd120 100644
--- a/framework/Web/Javascripts/prado/element.js
+++ b/framework/Web/Javascripts/prado/element.js
@@ -1,4 +1,4 @@
-Prado.Element =
+Prado.Element =
{
/**
* Set the value of a particular element.
@@ -16,7 +16,7 @@ Prado.Element =
{
var el = $(element);
var selection = Prado.Element.Selection;
- if(typeof(selection[method]) == "function")
+ if(typeof(selection[method]) == "function")
{
control = selection.isSelectable(el) ? [el] : selection.getListElements(element,total);
selection[method](control, value);
@@ -26,10 +26,10 @@ Prado.Element =
click : function(element)
{
var el = $(element);
- if(el)
+ if(el)
Event.fireEvent(el,'click');
},
-
+
setAttribute : function(element, attribute, value)
{
var el = $(element);
@@ -63,7 +63,7 @@ Prado.Element =
setTimeout(function(){ obj.focus(); }, 100);
return false;
},
-
+
replace : function(element, method, content, boundary, transport)
{
if(boundary)
@@ -82,7 +82,7 @@ Prado.Element =
method.toFunction().apply(this,[content]);
}
},
-
+
extractContent : function(text, boundary)
{
f = RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)(<!--//'+boundary+'-->)',"m");
@@ -92,20 +92,20 @@ Prado.Element =
else
return null;
},
-
+
evaluateScript : function(content)
{
content.evalScripts();
}
}
-Prado.Element.Selection =
+Prado.Element.Selection =
{
isSelectable : function(el)
{
if(el && el.type)
{
- switch(el.type.toLowerCase())
+ switch(el.type.toLowerCase())
{
case 'checkbox':
case 'radio':
@@ -116,12 +116,12 @@ Prado.Element.Selection =
}
return false;
},
-
+
inputValue : function(el, value)
{
- switch(el.type.toLowerCase())
+ switch(el.type.toLowerCase())
{
- case 'checkbox':
+ case 'checkbox':
case 'radio':
return el.checked = value;
}
@@ -137,10 +137,10 @@ Prado.Element.Selection =
options.selected = value;
else if(option.value == value)
option.selected = true;
- });
+ });
})
},
-
+
selectValues : function(elements, values)
{
selection = this;
@@ -166,7 +166,7 @@ Prado.Element.Selection =
}
})
},
-
+
selectAll : function(elements)
{
elements.each(function(el)
@@ -177,7 +177,7 @@ Prado.Element.Selection =
{
option.selected = true;
})
- }
+ }
})
},
@@ -191,10 +191,10 @@ Prado.Element.Selection =
{
option.selected = !options.selected;
})
- }
+ }
})
},
-
+
selectIndices : function(elements, indices)
{
selection = this;
@@ -208,7 +208,7 @@ Prado.Element.Selection =
{
elements.each(function(el)
{
- el.selectedIndex = -1;
+ el.selectedIndex = -1;
})
},
@@ -220,10 +220,10 @@ Prado.Element.Selection =
el = $(element+"_c"+i);
if(el)
elements.push(el);
- }
+ }
return elements;
},
-
+
checkValue : function(elements, value)
{
elements.each(function(el)
@@ -269,7 +269,7 @@ Prado.Element.Selection =
el.checked = false;
});
},
-
+
checkAll : function(elements)
{
elements.each(function(el)
@@ -277,7 +277,7 @@ Prado.Element.Selection =
el.checked = true;
})
},
-
+
checkInvert : function(elements)
{
elements.each(function(el)
@@ -285,4 +285,28 @@ Prado.Element.Selection =
el.checked != el.checked;
})
}
-}; \ No newline at end of file
+};
+
+
+Prado.Element.Insert =
+{
+ append: function(element, content)
+ {
+ new Insertion.Bottom(element, content);
+ },
+
+ prepend: function(element, content)
+ {
+ new Insertion.Top(element, content);
+ },
+
+ after: function(element, content)
+ {
+ new Insertion.After(element, content);
+ },
+
+ before: function(element, content)
+ {
+ new Insertion.Before(element, content);
+ }
+} \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TActivePanel.php b/framework/Web/UI/ActiveControls/TActivePanel.php
index b7773e1c..467209ef 100644
--- a/framework/Web/UI/ActiveControls/TActivePanel.php
+++ b/framework/Web/UI/ActiveControls/TActivePanel.php
@@ -6,7 +6,7 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2006 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version : :
+ * @version : :
* @package System.Web.UI.ActiveControls
*/
@@ -17,10 +17,10 @@ Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
/**
* TActivePanel is the TPanel active control counterpart.
- *
- * TActivePanel allows the client-side panel contents to be updated during a
+ *
+ * TActivePanel allows the client-side panel contents to be updated during a
* callback response using the {@link flush} method.
- *
+ *
* Example: Assume $param is an instance of TCallbackEventParameter attached to
* the OnCallback event a TCallback with ID "callback1", and
* "panel1" is the ID of a TActivePanel.
@@ -48,7 +48,7 @@ class TActivePanel extends TPanel implements IActiveControl
parent::__construct();
$this->setAdapter(new TActiveControlAdapter($this));
}
-
+
/**
* @return TBaseActiveControl standard active control options.
*/
@@ -56,19 +56,17 @@ class TActivePanel extends TPanel implements IActiveControl
{
return $this->getAdapter()->getBaseActiveControl();
}
-
+
/**
* Renders and replaces the panel's content on the client-side.
* @param THtmlWriter html writer
*/
- public function flush($writer)
+ public function render($writer)
{
+ parent::render($writer);
if($this->getActiveControl()->canUpdateClientSide())
- {
- $this->render($writer);
$this->getPage()->getCallbackClient()->replaceContent($this,$writer);
- }
}
-}
+}
?> \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php
index dfb7efeb..0c95a6a5 100644
--- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php
+++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php
@@ -17,11 +17,11 @@ Prado::using('System.Web.UI.ActiveControls.TCallbackClientSideOptions');
* active control. An instance of TBaseActiveControl or its decendent
* TBaseActiveCallbackControl is created by {@link TActiveControlAdapter::getBaseActiveControl()}
* method.
- *
+ *
* The {@link setEnableUpdate EnableUpdate} property determines wether the active
* control is allowed to update the contents of the client-side when the callback
- * response returns.
- *
+ * response returns.
+ *
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.ActiveControls
@@ -48,7 +48,7 @@ class TBaseActiveControl extends TComponent
$this->_options = new TMap;
}
- /**
+ /**
* Sets a named options with a value. Options are used to store and retrive
* named values for the base active controls.
* @param string option name.
@@ -63,7 +63,7 @@ class TBaseActiveControl extends TComponent
$this->_options->add($name,$value);
}
- /**
+ /**
* Gets an option named value. Options are used to store and retrive
* named values for the base active controls.
* @param string option name.
@@ -77,6 +77,14 @@ class TBaseActiveControl extends TComponent
}
/**
+ * @return TMap active control options
+ */
+ protected function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
* @return TPage the page containing the attached control.
*/
protected function getPage()
@@ -100,7 +108,7 @@ class TBaseActiveControl extends TComponent
$this->setOption('EnableUpdate', TPropertyValue::ensureBoolean($value), true);
}
- /**
+ /**
* @return boolean true to allow fine grain callback updates.
*/
public function getEnableUpdate()
@@ -108,12 +116,12 @@ class TBaseActiveControl extends TComponent
return $this->getOption('EnableUpdate', true);
}
- /**
+ /**
* Returns true if callback response is allowed to update the browser contents.
- * Is is true if the control is initilized, and is a callback request and
+ * Is is true if the control is initilized, and is a callback request and
* the {@link setEnableUpdate EnabledUpdate} property is true.
- * @return boolean true if the callback response is allowed update
- * client-side contents.
+ * @return boolean true if the callback response is allowed update
+ * client-side contents.
*/
public function canUpdateClientSide()
{
@@ -125,19 +133,19 @@ class TBaseActiveControl extends TComponent
/**
* TBaseActiveCallbackControl is a common set of options and functionality for
- * active controls that can perform callback requests.
- *
+ * active controls that can perform callback requests.
+ *
* The properties of TBaseActiveCallbackControl can be accessed and changed from
- * each individual active controls' {@link getActiveControl ActiveControl}
+ * each individual active controls' {@link getActiveControl ActiveControl}
* property.
- *
+ *
* The following example to set the validation group property of a TCallback component.
* <code>
* <com:TCallback ActiveControl.ValidationGroup="group1" ... />
* </code>
- *
- * Additional client-side options and events can be set using the
- * {@link getClientSide ClientSide} property. The following example to show
+ *
+ * Additional client-side options and events can be set using the
+ * {@link getClientSide ClientSide} property. The following example to show
* an alert box when a TCallback component response returns successfully.
* <code>
* <com:TCallback Active.Control.ClientSide.OnSuccess="alert('ok!')" ... />
@@ -165,7 +173,7 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
}
return $client;
}
-
+
/**
* Sets the client side options. Can only be set when client side is null.
* @param TCallbackClientSideOptions client side options.
@@ -188,7 +196,7 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
}
/**
- * Sets default callback options. Takes the ID of a TCallbackOptions
+ * Sets default callback options. Takes the ID of a TCallbackOptions
* component to duplicate the client-side
* options for this control. The {@link getClientSide ClientSide}
* subproperties has precendent over the CallbackOptions property.
@@ -209,11 +217,11 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
return $this->getOption('CallbackOptions', '');
}
- /**
+ /**
* Returns an array of default callback client-side options. The default options
* are obtained from the client-side options of a TCallbackOptions control with
- * ID specified by {@link setCallbackOptionsID CallbackOptionsID}.
- * @return array list of default callback client-side options.
+ * ID specified by {@link setCallbackOptionsID CallbackOptionsID}.
+ * @return array list of default callback client-side options.
*/
protected function getDefaultClientSideOptions()
{
@@ -226,17 +234,17 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
if ($control!==null)
$control=$control->findControl($newid);
}
- else
+ else
{
$control=$this->getControl()->findControl($id);
}
-
+
if($control instanceof TCallbackOptions)
return $control->getClientSide()->getOptions()->toArray();
else
- throw new TConfigurationException('callback_invalid_callback_options_ID', $id);
+ throw new TConfigurationException('callback_invalid_callback_options_ID', $id);
}
-
+
return array();
}
@@ -273,7 +281,7 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
*/
public function setValidationGroup($value)
{
- $this->getOption('ValidationGroup',$value,'');
+ $this->setOption('ValidationGroup',$value,'');
}
/**
@@ -308,7 +316,7 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
* Registers the callback control javascript code. Client-side options are
* merged and passed to the javascript code. This method should be called by
* Active component developers wanting to register the javascript to initialize
- * the active component with additional options offered by the
+ * the active component with additional options offered by the
* {@link getClientSide ClientSide} property.
* @param string client side javascript class name.
* @param array additional callback options.
@@ -321,7 +329,7 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
else
$options = $this->getClientSideOptions();
//remove true as default to save bytes
- $options['CausesValidation']= $options['CausesValidation'] ? '' : false;
+ $options['CausesValidation']= $options['CausesValidation'] ? '' : false;
$cs->registerCallbackControl($class, $options);
}
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
index 0e1dff5c..6a025802 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
@@ -9,36 +9,36 @@
* @version $Revision: $ $Date: $
* @package System.Web.UI.ActiveControls
*/
-
+
/**
* TCallbackClientScript class.
- *
+ *
* The TCallbackClientScript class provides corresponding methods that can be
* executed on the client-side (i.e. the browser client that is viewing
* the page) during a callback response.
- *
+ *
* The avaiable methods includes setting/clicking input elements, changing Css
* styles, hiding/showing elements, and adding visual effects to elements on the
* page. The client-side methods can be access through the CallbackClient
* property available in TPage.
- *
+ *
* For example, to hide "$myTextBox" element during callback response, do
- * <code>
+ * <code>
* $this->getPage()->getCallbackClient()->hide($myTextBox);
* </code>
- *
+ *
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @version $Revision: $ $Date: $
* @package System.Web.UI.ActiveControls
* @since 3.0
- */
+ */
class TCallbackClientScript extends TApplicationComponent
{
/**
* @var TList list of client functions to execute.
*/
private $_actions;
-
+
/**
* Constructor.
*/
@@ -55,7 +55,7 @@ class TCallbackClientScript extends TApplicationComponent
{
return $this->_actions->toArray();
}
-
+
/**
* Executes a client-side statement.
* @param string javascript function name
@@ -63,9 +63,9 @@ class TCallbackClientScript extends TApplicationComponent
*/
public function callClientFunction($function, $params=null)
{
- if(!is_array($params))
+ if(!is_array($params))
$params = array($params);
-
+
if(count($params) > 0)
{
if($params[0] instanceof TControl)
@@ -85,7 +85,7 @@ class TCallbackClientScript extends TApplicationComponent
}
/**
- * Client script to select/clear/check a drop down list, check box list,
+ * Client script to select/clear/check a drop down list, check box list,
* or radio button list.
* The second parameter determines the selection method. Valid methods are
* - <b>Value</b>, select or check by value
@@ -102,14 +102,14 @@ class TCallbackClientScript extends TApplicationComponent
*/
public function select($control, $method='Value', $value=null, $type=null)
{
- $method = TPropertyValue::ensureEnum($method,
+ $method = TPropertyValue::ensureEnum($method,
'Value', 'Index', 'Clear', 'Indices', 'Values', 'All', 'Invert');
$type = is_null($type) ? $this->getSelectionControlType($control) : $type;
$total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1;
- $this->callClientFunction('Prado.Element.select',
+ $this->callClientFunction('Prado.Element.select',
array($control, $type.$method, $value, $total));
- }
-
+ }
+
private function getSelectionControlType($control)
{
if(is_string($control)) return 'check';
@@ -119,7 +119,7 @@ class TCallbackClientScript extends TApplicationComponent
return 'check';
return 'select';
}
-
+
private function getSelectionControlIsListType($control)
{
return $control instanceof TListControl;
@@ -146,7 +146,7 @@ class TCallbackClientScript extends TApplicationComponent
}
/**
- * Sets the attribute of a particular control.
+ * Sets the attribute of a particular control.
* @param TControl|string control element or element id
* @param string attribute name
* @param string attribute value
@@ -168,10 +168,10 @@ class TCallbackClientScript extends TApplicationComponent
$options[] = array($item->getText(),$item->getValue());
$this->callClientFunction('Prado.Element.setOptions', array($control, $options));
}
-
+
/**
* Shows an element by changing its CSS display style as empty.
- * @param TControl|string control element or element id
+ * @param TControl|string control element or element id
*/
public function show($element)
{
@@ -180,7 +180,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Hides an element by changing its CSS display style to "none".
- * @param TControl|string control element or element id
+ * @param TControl|string control element or element id
*/
public function hide($element)
{
@@ -189,7 +189,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Toggles the visibility of the element.
- * @param TControl|string control element or element id
+ * @param TControl|string control element or element id
*/
public function toggle($element)
{
@@ -277,49 +277,49 @@ class TCallbackClientScript extends TApplicationComponent
}
/**
- * Insert a HTML fragement after the element.
+ * Append a HTML fragement to the element.
* @param TControl|string control element or element id
* @param TControl|string HTML fragement, otherwise if TControl, its render
* method will be called.
*/
- public function insertAfter($element, $content)
+ public function appendContent($element, $content)
{
- $this->replace($element, $content, 'Element.Insert.After');
+ $this->replace($element, $content, 'Prado.Element.Insert.append');
}
/**
- * Insert a HTML fragement before the element.
+ * Prepend a HTML fragement to the element.
* @param TControl|string control element or element id
* @param TControl|string HTML fragement, otherwise if TControl, its render
* method will be called.
- */
- public function insertBefore($element, $content)
+ */
+ public function prependContent($element, $content)
{
- $this->replace($element, $content, 'Element.Insert.Before');
+ $this->replace($element, $content, 'Prado.Element.Insert.prepend');
}
/**
- * Insert a HTML fragement below the element.
+ * Insert a HTML fragement after the element.
* @param TControl|string control element or element id
* @param TControl|string HTML fragement, otherwise if TControl, its render
* method will be called.
*/
- public function insertBelow($element, $content)
+ public function insertContentAfter($element, $content)
{
- $this->replace($element, $content, 'Element.Insert.Below');
+ $this->replace($element, $content, 'Prado.Element.Insert.after');
}
/**
- * Insert a HTML fragement above the element.
+ * Insert a HTML fragement in before the element.
* @param TControl|string control element or element id
* @param TControl|string HTML fragement, otherwise if TControl, its render
* method will be called.
*/
- public function insertAbove($element, $content)
+ public function insertContentBefore($element, $content)
{
- $this->replace($element, $content, 'Element.Insert.Above');
+ $this->replace($element, $content, 'Prado.Element.Insert.before');
}
-
+
/**
* Replace the content of an element with new content. The new content can
* be a string or a TControl component. If the <tt>content</tt> parameter is
@@ -348,11 +348,11 @@ class TCallbackClientScript extends TApplicationComponent
$boundary = $this->getResponseContentBoundary($content);
$content = null;
}
-
- $this->callClientFunction('Prado.Element.replace',
- array($element, $method, $content, $boundary));
+
+ $this->callClientFunction('Prado.Element.replace',
+ array($element, $method, $content, $boundary));
}
-
+
/**
* Replace the content of an element with new content contained in writer.
* @param TControl|string control element or HTML element id.
@@ -362,7 +362,7 @@ class TCallbackClientScript extends TApplicationComponent
{
$this->replace($element, $writer);
}
-
+
/**
* Evaluate a block of javascript enclosed in a boundary.
* @param THtmlWriter writer for the content.
@@ -371,7 +371,7 @@ class TCallbackClientScript extends TApplicationComponent
{
$this->replace(null, $writer, 'Prado.Element.evaluateScript');
}
-
+
/**
* Renders the control and return the content boundary from
* TCallbackResponseWriter. This method should only be used by framework
@@ -385,7 +385,7 @@ class TCallbackClientScript extends TApplicationComponent
$control->render($writer);
return $writer->getWriter()->getBoundary();
}
-
+
/**
* @param THtmlWriter the writer responsible for rendering html content.
* @return string content boundary.
@@ -396,7 +396,7 @@ class TCallbackClientScript extends TApplicationComponent
{
if($html->getWriter() instanceof TCallbackResponseWriter)
return $html->getWriter()->getBoundary();
- }
+ }
return null;
}
@@ -414,7 +414,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Gradually make the element appear.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function appear($element, $options=null)
{
@@ -424,7 +424,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Blind down.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function blindDown($element, $options=null)
{
@@ -434,38 +434,38 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Blind up.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function blindUp($element, $options=null)
{
$this->visualEffect('Effect.BlindUp', $element, $options);
-
+
}
/**
* Visual Effect: Drop out.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function dropOut($element, $options=null)
{
$this->visualEffect('Effect.DropOut', $element, $options);
}
-
+
/**
* Visual Effect: Gradually fade the element.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function fade($element, $options=null)
{
$this->visualEffect('Effect.Fade', $element, $options);
}
-
+
/**
* Visual Effect: Fold.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function fold($element, $options = null)
{
@@ -475,7 +475,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Gradually make an element grow to a predetermined size.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function grow($element, $options=null)
{
@@ -485,7 +485,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Gradually grow and fade the element.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function puff($element, $options=null)
{
@@ -495,8 +495,8 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Pulsate.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
- */
+ * @param array visual effect key-value pair options.
+ */
public function pulsate($element, $options=null)
{
$this->visualEffect('Effect.Pulsate', $element, $options);
@@ -505,7 +505,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Shake the element.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function shake($element, $options=null)
{
@@ -515,7 +515,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Shrink the element.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function shrink($element, $options=null)
{
@@ -525,7 +525,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Slide down.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function slideDown($element, $options=null)
{
@@ -535,27 +535,27 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: Side up.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function slideUp($element, $options=null)
{
$this->visualEffect('Effect.SlideUp', $element, $options);
}
-
+
/**
* Visual Effect: Squish the element.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function squish($element, $options=null)
{
$this->visualEffect('Effect.Squish', $element, $options);
}
-
+
/**
* Visual Effect: Switch Off effect.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function switchOff($element, $options=null)
{
@@ -565,7 +565,7 @@ class TCallbackClientScript extends TApplicationComponent
/**
* Visual Effect: High light the element for about 2 seconds.
* @param TControl|string control element or element id
- * @param array visual effect key-value pair options.
+ * @param array visual effect key-value pair options.
*/
public function highlight($element, $options=null)
{
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
index 79e3d46c..8a0a4316 100644
--- a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
@@ -5,7 +5,7 @@ class ActivePanelTest extends TPage
function callback1_requested($sender, $param)
{
$this->content1->visible = true;
- $this->panel1->flush($param->output);
+ $this->panel1->render($param->output);
}
}
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php
new file mode 100644
index 00000000..7da2834e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php
@@ -0,0 +1,11 @@
+<?php
+
+class CustomTemplateComponent extends TTemplateControl
+{
+ public function suboncallback ($sender, $param)
+ {
+ $sender->setText("Foo");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl
new file mode 100644
index 00000000..04a0476a
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl
@@ -0,0 +1,6 @@
+<com:TPanel ID="ThePanel" GroupingText="Foolio">
+ Getting textbox from the template!!!<br />
+ Client ID: <%# $this->ThePanel->getClientID() %>
+ <div><com:TTextBox ID="foo" /></div>
+ <com:TButton ID="lalalala" Text="Llalalaal" OnClick="suboncallback" />
+</com:TPanel> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page
new file mode 100644
index 00000000..3bed7d5b
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page
@@ -0,0 +1,16 @@
+<com:TForm ID="form1">
+
+ <h1>Add Dynamic Custom TTemplateControl Test</h1>
+ <com:TActivePanel ID="Foo">
+ <com:TTextBox ID="foo" />
+ </com:TActivePanel>
+ <com:TActiveButton ID="button2" Text="Button 1"
+ OnClick="button2_onclick" OnCallback="button2_callback"/>
+
+ <com:TActivePanel ID="placeholder" />
+
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+
+
+ <com:TJavascriptLogger />
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php
new file mode 100644
index 00000000..753de25c
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php
@@ -0,0 +1,27 @@
+<?php
+
+class CustomTemplateControlTest extends TPage
+{
+ function button2_onclick($sender, $param)
+ {
+
+ $this->label1->Text = "Button 1 was clicked ";
+ $this->label1->Text .= $this->foo->Text;
+
+ $x=Prado::createComponent('Application.pages.CustomTemplateComponent');
+
+ $this->placeholder->getControls()->add($x);
+ $this->placeholder->dataBind();
+ }
+
+ function button2_callback($sender, $param)
+ {
+ $this->placeholder->render($param->output);
+
+ $this->label1->Text .= " using callback!";
+ $this->label1->Text .= "... and this is the textbox text: ". $this->foo->Text;
+ }
+
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
index a4a22cbf..4c6190ee 100644
--- a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
@@ -5,9 +5,9 @@ class NestedActiveControls extends TPage
function callback1_requested($sender, $param)
{
$this->content1->visible = true;
- $this->panel1->flush($param->output);
+ $this->panel1->render($param->output);
}
-
+
function button1_clicked($sender, $param)
{
$this->label1->Text = "Label 1: Button 1 Clicked";
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page
new file mode 100644
index 00000000..b0c22587
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page
@@ -0,0 +1,22 @@
+<com:TForm>
+
+<h1>Callback Replace Content Test</h1>
+
+<com:TPanel ID="panel1" style="border:1px solid red; background-color: #ffc; padding:2em;">
+Main Panel
+ <com:TPanel ID="subpanel" style="border:1px solid blue; background-color: #fff; padding: 2em;">
+ Sub Panel
+ </com:TPanel>
+</com:TPanel>
+
+<com:TTextBox ID="content" />
+<com:TActiveButton id="btn_append" Text="Append to Sub Panel" OnCallback="appendContent"/>
+<com:TActiveButton id="btn_prepend" Text="Prepend to Sub Panel" OnCallback="prependContent" />
+<com:TActiveButton id="btn_before" Text="Insert Before Sub Panel" OnCallback="insertContentBefore"/>
+<com:TActiveButton id="btn_after" Text="Insert After Sub Panel" OnCallback="insertContentAfter"/>
+
+<com:TActiveButton id="btn_replace" Text="Replace" OnCallback="replaceContent"/>
+
+<com:TJavascriptLogger />
+
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php
new file mode 100644
index 00000000..0e09a012
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php
@@ -0,0 +1,31 @@
+<?php
+
+class ReplaceContentTest extends TPage
+{
+ function appendContent($sender, $param)
+ {
+ $this->CallbackClient->appendContent($this->subpanel, $this->content->Text);
+ }
+
+ function prependContent($sender, $param)
+ {
+ $this->CallbackClient->prependContent($this->subpanel, $this->content->Text);
+ }
+
+ function insertContentBefore($sender, $param)
+ {
+ $this->CallbackClient->insertContentBefore($this->subpanel, $this->content->Text);
+ }
+
+ function insertContentAfter($sender, $param)
+ {
+ $this->CallbackClient->insertContentAfter($this->subpanel, $this->content->Text);
+ }
+
+ function replaceContent($sender, $param)
+ {
+ $this->CallbackClient->replaceContent($this->subpanel, $this->content->Text);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page
new file mode 100644
index 00000000..79fc17e0
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page
@@ -0,0 +1,21 @@
+<com:TForm>
+<h1>TextBox AutoPostBack With Group Validation</h1>
+<com:TTextBox ID="Address" Columns="60" Maxlength="128" />
+<com:TRequiredFieldValidator
+ ID="validator1"
+ ControlToValidate="Address"
+ ValidationGroup="post"
+ ErrorMessage="*" />
+
+<com:TActiveTextBox
+ AutoPostBack="true"
+ ID="ZipCode"
+ Columns="4"
+ Maxlength="12"
+ ValidationGroup="post"
+ OnCallback="lookupZipCode"/>
+<com:TJavascriptLogger />
+
+<com:TActiveTextBox ID="City" Columns="60" Maxlength="128" />
+
+</com:TForm>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php
new file mode 100644
index 00000000..cf43bccd
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php
@@ -0,0 +1,11 @@
+<?php
+
+class TextBoxValidationCallback extends TPage
+{
+
+ function lookupZipCode()
+ {
+ $this->City->Text = "City: ".$this->Address->Text . ' Zip: '.$this->ZipCode->Text;
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php b/tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php
new file mode 100644
index 00000000..b927b3e9
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php
@@ -0,0 +1,22 @@
+<?php
+
+class CustomTemplateTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('active-controls/index.php?page=CustomTemplateControlTest');
+ $this->assertTextPresent('Add Dynamic Custom TTemplateControl Test');
+ $this->assertText('label1', 'Label 1');
+
+ $this->type('foo', 'Foo Bar!');
+ $this->click('button2');
+ $this->pause(500);
+
+ $this->assertVisible('ctl1_ThePanel');
+ $this->assertTextPresent('Client ID: ctl1_ThePanel');
+
+ $this->assertText('label1', 'Button 1 was clicked Foo Bar! using callback!... and this is the textbox text: Foo Bar!');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php
new file mode 100644
index 00000000..de4cbc71
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php
@@ -0,0 +1,48 @@
+<?php
+
+class ReplaceContentTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('active-controls/index.php?page=ReplaceContentTest');
+ $this->assertTextPresent('Callback Replace Content Test');
+
+ $this->assertText('subpanel', 'Sub Panel');
+ $this->assertText('panel1', 'Main Panel Sub Panel');
+
+ $this->type('content', 'something');
+
+ $this->click('btn_append');
+ $this->pause(500);
+
+ $this->assertText('subpanel', 'Sub Panel something');
+ $this->assertText('panel1', 'Main Panel Sub Panel something');
+
+ $this->type('content', 'more');
+ $this->click('btn_prepend');
+ $this->pause(500);
+
+ $this->assertText('subpanel', 'more Sub Panel something');
+ $this->assertText('panel1', 'Main Panel more Sub Panel something');
+
+
+ $this->type('content', 'prado');
+ $this->click('btn_before');
+ $this->pause(500);
+
+ $this->assertText('subpanel', 'more Sub Panel something');
+ $this->assertText('panel1', 'Main Panel pradomore Sub Panel something');
+
+ $this->type('content', ' php ');
+ $this->click('btn_after');
+ $this->pause(500);
+
+ $this->type('content', 'mauahahaha');
+ $this->click('btn_replace');
+ $this->pause(1000);
+
+ $this->assertText('panel1', 'Main Panel pradomauahahahaphp');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php b/tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php
new file mode 100644
index 00000000..b0950cbc
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php
@@ -0,0 +1,24 @@
+<?php
+
+class TextBoxGroupValidationTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=TextBoxValidationCallback");
+ $this->assertTextPresent('TextBox AutoPostBack With Group Validation');
+ $this->assertNotVisible('validator1');
+
+ $this->type('ZipCode', 'test');
+ $this->assertVisible('validator1');
+
+ $this->type('Address', 'Sydney');
+ $this->type('ZipCode', '2000');
+
+ $this->assertNotVisible('validator1');
+
+ $this->pause(500);
+ $this->assertValue('City', 'City: Sydney Zip: 2000');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active.php b/tests/FunctionalTests/active.php
index ca6ab635..f8776c2e 100755
--- a/tests/FunctionalTests/active.php
+++ b/tests/FunctionalTests/active.php
@@ -1,8 +1,8 @@
<?php
-require(dirname(__FILE__).'/PradoTester.php');
+require('../test_tools/functional_tests.php');
-$tester=new PradoTester(dirname(__FILE__).'/active-controls/tests');
+$tester=new PradoFunctionalTester(dirname(__FILE__).'/active-controls/tests');
$tester->run(new SimpleReporter());
?> \ No newline at end of file