From 464a235c8c7dc070fb10ac47f2186f24a077ae0d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 20 Jan 2015 22:43:27 +0100 Subject: One class per file: framework/Web/UI/JuiControls --- framework/Web/UI/JuiControls/IJuiOptions.php | 27 ++ framework/Web/UI/JuiControls/TJuiAutoComplete.php | 72 +---- .../JuiControls/TJuiAutoCompleteEventParameter.php | 51 ++++ .../UI/JuiControls/TJuiAutoCompleteTemplate.php | 39 +++ .../Web/UI/JuiControls/TJuiControlAdapter.php | 292 --------------------- .../Web/UI/JuiControls/TJuiControlOptions.php | 137 ++++++++++ .../Web/UI/JuiControls/TJuiEventParameter.php | 77 ++++++ framework/Web/UI/JuiControls/TJuiSelectable.php | 31 +-- .../Web/UI/JuiControls/TJuiSelectableTemplate.php | 39 +++ framework/Web/UI/JuiControls/TJuiSortable.php | 32 +-- .../Web/UI/JuiControls/TJuiSortableTemplate.php | 40 +++ 11 files changed, 413 insertions(+), 424 deletions(-) create mode 100644 framework/Web/UI/JuiControls/IJuiOptions.php create mode 100644 framework/Web/UI/JuiControls/TJuiAutoCompleteEventParameter.php create mode 100644 framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php delete mode 100644 framework/Web/UI/JuiControls/TJuiControlAdapter.php create mode 100644 framework/Web/UI/JuiControls/TJuiControlOptions.php create mode 100644 framework/Web/UI/JuiControls/TJuiEventParameter.php create mode 100644 framework/Web/UI/JuiControls/TJuiSelectableTemplate.php create mode 100644 framework/Web/UI/JuiControls/TJuiSortableTemplate.php (limited to 'framework/Web/UI/JuiControls') diff --git a/framework/Web/UI/JuiControls/IJuiOptions.php b/framework/Web/UI/JuiControls/IJuiOptions.php new file mode 100644 index 00000000..b021c421 --- /dev/null +++ b/framework/Web/UI/JuiControls/IJuiOptions.php @@ -0,0 +1,27 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2013-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.JuiControls + */ + +/** + * IJuiOptions interface + * + * IJuiOptions is the interface that must be implemented by controls using + * {@link TJuiControlOptions}. + * + * @author Fabio Bas + * @package System.Web.UI.JuiControls + * @since 3.3 + */ +interface IJuiOptions +{ + public function getOptions(); + public function getValidOptions(); + public function getValidEvents(); +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiAutoComplete.php b/framework/Web/UI/JuiControls/TJuiAutoComplete.php index f6663057..1ef05ba2 100644 --- a/framework/Web/UI/JuiControls/TJuiAutoComplete.php +++ b/framework/Web/UI/JuiControls/TJuiAutoComplete.php @@ -404,74 +404,4 @@ class TJuiAutoComplete extends TActiveTextBox implements INamingContainer, IJuiO { return 'Prado.WebUI.TJuiAutoComplete'; } -} - -/** - * TAutCompleteEventParameter contains the {@link getToken Token} requested by - * the user for a partial match of the suggestions. - * - * The {@link getSelectedIndex SelectedIndex} is a zero-based index of the - * suggestion selected by the user, -1 if not suggestion is selected. - * - * @author Wei Zhuo - * @package System.Web.UI.ActiveControls - * @since 3.1 - */ -class TJuiAutoCompleteEventParameter extends TCallbackEventParameter -{ - private $_selectedIndex=-1; - - /** - * Creates a new TCallbackEventParameter. - */ - public function __construct($response, $parameter, $index=-1) - { - parent::__construct($response, $parameter); - $this->_selectedIndex=$index; - } - - /** - * @return int selected suggestion zero-based index, -1 if not selected. - */ - public function getSelectedIndex() - { - return $this->_selectedIndex; - } - - /** - * @return string token for matching a list of suggestions. - */ - public function getToken() - { - return $this->getCallbackParameter(); - } -} - -/** - * TJuiAutoCompleteTemplate class. - * - * TJuiAutoCompleteTemplate is the default template for TJuiAutoCompleteTemplate - * item template. - * - * @author Wei Zhuo - * @package System.Web.UI.ActiveControls - * @since 3.1 - */ -class TJuiAutoCompleteTemplate extends TComponent implements ITemplate -{ - private $_template; - - public function __construct($template) - { - $this->_template = $template; - } - /** - * Instantiates the template. - * It creates a {@link TDataList} control. - * @param TControl parent to hold the content within the template - */ - public function instantiateIn($parent) - { - $parent->getControls()->add($this->_template); - } -} +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiAutoCompleteEventParameter.php b/framework/Web/UI/JuiControls/TJuiAutoCompleteEventParameter.php new file mode 100644 index 00000000..d722632e --- /dev/null +++ b/framework/Web/UI/JuiControls/TJuiAutoCompleteEventParameter.php @@ -0,0 +1,51 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.ActiveControls + */ + +/** + * TJuiAutoCompleteEventParameter contains the {@link getToken Token} requested by + * the user for a partial match of the suggestions. + * + * The {@link getSelectedIndex SelectedIndex} is a zero-based index of the + * suggestion selected by the user, -1 if not suggestion is selected. + * + * @author Wei Zhuo + * @package System.Web.UI.ActiveControls + * @since 3.1 + */ +class TJuiAutoCompleteEventParameter extends TCallbackEventParameter +{ + private $_selectedIndex=-1; + + /** + * Creates a new TCallbackEventParameter. + */ + public function __construct($response, $parameter, $index=-1) + { + parent::__construct($response, $parameter); + $this->_selectedIndex=$index; + } + + /** + * @return int selected suggestion zero-based index, -1 if not selected. + */ + public function getSelectedIndex() + { + return $this->_selectedIndex; + } + + /** + * @return string token for matching a list of suggestions. + */ + public function getToken() + { + return $this->getCallbackParameter(); + } +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php b/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php new file mode 100644 index 00000000..cc4eb449 --- /dev/null +++ b/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php @@ -0,0 +1,39 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.ActiveControls + */ + +/** + * TJuiAutoCompleteTemplate class. + * + * TJuiAutoCompleteTemplate is the default template for TJuiAutoCompleteTemplate + * item template. + * + * @author Wei Zhuo + * @package System.Web.UI.ActiveControls + * @since 3.1 + */ +class TJuiAutoCompleteTemplate extends TComponent implements ITemplate +{ + private $_template; + + public function __construct($template) + { + $this->_template = $template; + } + /** + * Instantiates the template. + * It creates a {@link TDataList} control. + * @param TControl parent to hold the content within the template + */ + public function instantiateIn($parent) + { + $parent->getControls()->add($this->_template); + } +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiControlAdapter.php b/framework/Web/UI/JuiControls/TJuiControlAdapter.php deleted file mode 100644 index 3668a8b4..00000000 --- a/framework/Web/UI/JuiControls/TJuiControlAdapter.php +++ /dev/null @@ -1,292 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2013-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package System.Web.UI.JuiControls - */ - -Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter'); - -/** - * TJuiControlAdapter class - * - * TJuiControlAdapter is the base adapter class for controls that are - * derived from a jQuery-ui widget. It exposes convenience methods to - * publish jQuery-UI javascript and css assets. - * - * @author Fabio Bas - * @package System.Web.UI.JuiControls - * @since 3.3 - */ -class TJuiControlAdapter extends TActiveControlAdapter -{ - const SCRIPT_PATH = 'jquery'; - const CSS_PATH = 'css'; - const BASE_CSS_FILENAME ='jquery-ui.css'; - - /** - * @param string set the jquery-ui style - */ - public function setJuiBaseStyle($value) - { - $this->getControl()->setViewState('JuiBaseStyle', $value, 'base'); - } - - /** - * @return string current jquery-ui style - */ - public function getJuiBaseStyle() - { - return $this->getControl()->getViewState('JuiBaseStyle', 'base'); - } - - /** - * Inject jquery script and styles before render - */ - public function onPreRender($param) - { - parent::onPreRender($param); - $this->getPage()->getClientScript()->registerPradoScript('jqueryui'); - $this->publishJuiStyle(self::BASE_CSS_FILENAME); - } - - /** - * @param string jQuery asset file in the self::SCRIPT_PATH directory. - * @return string jQuery asset url. - */ - protected function getAssetUrl($file='') - { - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); - return $base.'/'.self::SCRIPT_PATH.'/'.$file; - } - - /** - * Publish the jQuery-ui style Css asset file. - * @param file name - * @return string Css file url. - */ - public function publishJuiStyle($file) - { - $url = $this->getAssetUrl(self::CSS_PATH.'/'.$this->getJuiBaseStyle().'/'.$file); - $cs = $this->getPage()->getClientScript(); - if(!$cs->isStyleSheetFileRegistered($url)) - $cs->registerStyleSheetFile($url, $url); - return $url; - } - -} - -/** - * IJuiOptions interface - * - * IJuiOptions is the interface that must be implemented by controls using - * {@link TJuiControlOptions}. - * - * @author Fabio Bas - * @package System.Web.UI.JuiControls - * @since 3.3 - */ -interface IJuiOptions -{ - public function getOptions(); - public function getValidOptions(); - public function getValidEvents(); -} - -/** - * TJuiControlOptions interface - * - * TJuiControlOptions is an helper class that can collect a list of options - * for a control. The control must implement {@link IJuiOptions}. - * The options are validated againg an array of valid options provided by the control itself. - * Since component properties are case insensitive, the array of valid options is used - * to ensure the option name has the correct case. - * The options array can then get retrieved using {@link toArray} and applied to the jQuery-ui widget. - * In addition to the options, this class will render the needed javascript to raise a callback - * for any event for which an handler is defined in the control. - * - * @author Fabio Bas - * @package System.Web.UI.JuiControls - * @since 3.3 - */ -class TJuiControlOptions -{ - /** - * @var TMap map of javascript options. - */ - private $_options; - /** - * @var TControl parent control. - */ - private $_control; - - public function __construct($control) - { - if(!$control instanceof IJuiOptions) - throw new THttpException(500,'juioptions_control_invalid',$control->ID); - $this->_control=$control; - } - /** - * Sets a named options with a value. Options are used to store and retrive - * named values for the javascript control. - * @param string option name. - * @param mixed option value. - * @throws THttpException - */ - public function __set($name,$value) - { - if($this->_options===null) - $this->_options=array(); - - foreach($this->_control->getValidOptions() as $option) - { - if(0 == strcasecmp($name, $option)) - { - $low = strtolower($value); - if($low === 'null') - { - $this->_options[$option] = null; - } elseif($low === 'true') { - $this->_options[$option] = true; - } elseif($low === 'false') { - $this->_options[$option] = false; - } elseif(is_numeric($value)) { - // trick to get float or integer automatically when needed - $this->_options[$option] = $value + 0; - } else { - $this->_options[$option] = $value; - } - return; - } - } - - throw new THttpException(500,'juioptions_option_invalid',$this->_control->ID, $name); - } - - /** - * Gets an option named value. Options are used to store and retrive - * named values for the base active controls. - * @param string option name. - * @return mixed options value or null if not set. - */ - public function __get($name) - { - if($this->_options===null) - $this->_options=array(); - - foreach($this->_control->getValidOptions() as $option) - { - if(0 == strcasecmp($name, $option) && isset($this->_options[$option])) - { - return $this->_options[$option]; - } - } - - return null; - } - - /** - * @return Array of active control options - */ - public function toArray() - { - $ret= ($this->_options===null) ? array() : $this->_options; - - foreach($this->_control->getValidEvents() as $event) - if($this->_control->hasEventHandler('on'.$event)) - $ret[$event]=new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(".TJavascript::encode($this->_control->getUniqueID()).", ".TJavascript::encode($event).", event, ui, this); }"); - - return $ret; - } - - /** - * Raise the specific callback event handler of the target control. - * @param mixed callback parameters - */ - public function raiseCallbackEvent($param) - { - $callbackParam=$param->CallbackParameter; - if(isset($callbackParam->event)) - { - $eventName = 'On'.ucfirst($callbackParam->event); - if($this->_control->hasEventHandler($eventName)) - { - $this->_control->$eventName( new TJuiEventParameter( - $this->_control->getResponse(), - isset($callbackParam->ui) ? $callbackParam->ui : null) - ); - } - } - } -} - -/** - * TJuiEventParameter class - * - * TJuiEventParameter encapsulate the parameters for callback - * events of TJui* components. - * Any parameter representing a control is identified by its - * clientside ID. - * TJuiEventParameter contains a {@link getControl} helper method - * that retrieves an existing PRADO control on che current page from its - * clientside ID as returned by the callback. - * For example, if the parameter contains a "draggable" item (as returned in - * {@link TJuiDroppable}::OnDrop event), the relative PRADO control can be - * retrieved using: - * - * $draggable = $param->getControl($param->getCallbackParameter()->draggable); - * - * - * A shortcut __get() method is implemented, too: - * - * $draggable = $param->DraggableControl; - * - * - * @author Fabio Bas - * @license http://www.pradosoft.com/license - * @package System.Web.UI.JuiControls - */ -class TJuiEventParameter extends TCallbackEventParameter -{ - /** - * getControl - * - * Compatibility method to get a control from its clientside id - * @return TControl control, or null if not found - */ - public function getControl($id) - { - $control=null; - $service=prado::getApplication()->getService(); - if ($service instanceof TPageService) - { - // Find the control - // Warning, this will not work if you have a '_' in your control Id ! - $controlId=str_replace(TControl::CLIENT_ID_SEPARATOR,TControl::ID_SEPARATOR,$id); - $control=$service->getRequestedPage()->findControl($controlId); - } - return $control; - } - - /** - * Gets a control instance named after a returned control id. - * Example: if a $param->draggable control id is returned from clientside, - * calling $param->DraggableControl will return the control instance - * @return mixed control or null if not set. - */ - public function __get($name) - { - $pos=strpos($name, 'Control',1); - $name=strtolower(substr($name, 0, $pos)); - - $cp=$this->getCallbackParameter(); - if(!isset($cp->$name) || $cp->$name=='') - return null; - - return $this->getControl($cp->$name); - } -} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiControlOptions.php b/framework/Web/UI/JuiControls/TJuiControlOptions.php new file mode 100644 index 00000000..038da26e --- /dev/null +++ b/framework/Web/UI/JuiControls/TJuiControlOptions.php @@ -0,0 +1,137 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2013-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.JuiControls + */ + +/** + * TJuiControlOptions interface + * + * TJuiControlOptions is an helper class that can collect a list of options + * for a control. The control must implement {@link IJuiOptions}. + * The options are validated againg an array of valid options provided by the control itself. + * Since component properties are case insensitive, the array of valid options is used + * to ensure the option name has the correct case. + * The options array can then get retrieved using {@link toArray} and applied to the jQuery-ui widget. + * In addition to the options, this class will render the needed javascript to raise a callback + * for any event for which an handler is defined in the control. + * + * @author Fabio Bas + * @package System.Web.UI.JuiControls + * @since 3.3 + */ +class TJuiControlOptions +{ + /** + * @var TMap map of javascript options. + */ + private $_options; + /** + * @var TControl parent control. + */ + private $_control; + + public function __construct($control) + { + if(!$control instanceof IJuiOptions) + throw new THttpException(500,'juioptions_control_invalid',$control->ID); + $this->_control=$control; + } + /** + * Sets a named options with a value. Options are used to store and retrive + * named values for the javascript control. + * @param string option name. + * @param mixed option value. + * @throws THttpException + */ + public function __set($name,$value) + { + if($this->_options===null) + $this->_options=array(); + + foreach($this->_control->getValidOptions() as $option) + { + if(0 == strcasecmp($name, $option)) + { + $low = strtolower($value); + if($low === 'null') + { + $this->_options[$option] = null; + } elseif($low === 'true') { + $this->_options[$option] = true; + } elseif($low === 'false') { + $this->_options[$option] = false; + } elseif(is_numeric($value)) { + // trick to get float or integer automatically when needed + $this->_options[$option] = $value + 0; + } else { + $this->_options[$option] = $value; + } + return; + } + } + + throw new THttpException(500,'juioptions_option_invalid',$this->_control->ID, $name); + } + + /** + * Gets an option named value. Options are used to store and retrive + * named values for the base active controls. + * @param string option name. + * @return mixed options value or null if not set. + */ + public function __get($name) + { + if($this->_options===null) + $this->_options=array(); + + foreach($this->_control->getValidOptions() as $option) + { + if(0 == strcasecmp($name, $option) && isset($this->_options[$option])) + { + return $this->_options[$option]; + } + } + + return null; + } + + /** + * @return Array of active control options + */ + public function toArray() + { + $ret= ($this->_options===null) ? array() : $this->_options; + + foreach($this->_control->getValidEvents() as $event) + if($this->_control->hasEventHandler('on'.$event)) + $ret[$event]=new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(".TJavascript::encode($this->_control->getUniqueID()).", ".TJavascript::encode($event).", event, ui, this); }"); + + return $ret; + } + + /** + * Raise the specific callback event handler of the target control. + * @param mixed callback parameters + */ + public function raiseCallbackEvent($param) + { + $callbackParam=$param->CallbackParameter; + if(isset($callbackParam->event)) + { + $eventName = 'On'.ucfirst($callbackParam->event); + if($this->_control->hasEventHandler($eventName)) + { + $this->_control->$eventName( new TJuiEventParameter( + $this->_control->getResponse(), + isset($callbackParam->ui) ? $callbackParam->ui : null) + ); + } + } + } +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiEventParameter.php b/framework/Web/UI/JuiControls/TJuiEventParameter.php new file mode 100644 index 00000000..ac9c378d --- /dev/null +++ b/framework/Web/UI/JuiControls/TJuiEventParameter.php @@ -0,0 +1,77 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2013-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.JuiControls + */ + +/** + * TJuiEventParameter class + * + * TJuiEventParameter encapsulate the parameters for callback + * events of TJui* components. + * Any parameter representing a control is identified by its + * clientside ID. + * TJuiEventParameter contains a {@link getControl} helper method + * that retrieves an existing PRADO control on che current page from its + * clientside ID as returned by the callback. + * For example, if the parameter contains a "draggable" item (as returned in + * {@link TJuiDroppable}::OnDrop event), the relative PRADO control can be + * retrieved using: + * + * $draggable = $param->getControl($param->getCallbackParameter()->draggable); + * + * + * A shortcut __get() method is implemented, too: + * + * $draggable = $param->DraggableControl; + * + * + * @author Fabio Bas + * @license http://www.pradosoft.com/license + * @package System.Web.UI.JuiControls + */ +class TJuiEventParameter extends TCallbackEventParameter +{ + /** + * getControl + * + * Compatibility method to get a control from its clientside id + * @return TControl control, or null if not found + */ + public function getControl($id) + { + $control=null; + $service=prado::getApplication()->getService(); + if ($service instanceof TPageService) + { + // Find the control + // Warning, this will not work if you have a '_' in your control Id ! + $controlId=str_replace(TControl::CLIENT_ID_SEPARATOR,TControl::ID_SEPARATOR,$id); + $control=$service->getRequestedPage()->findControl($controlId); + } + return $control; + } + + /** + * Gets a control instance named after a returned control id. + * Example: if a $param->draggable control id is returned from clientside, + * calling $param->DraggableControl will return the control instance + * @return mixed control or null if not set. + */ + public function __get($name) + { + $pos=strpos($name, 'Control',1); + $name=strtolower(substr($name, 0, $pos)); + + $cp=$this->getCallbackParameter(); + if(!isset($cp->$name) || $cp->$name=='') + return null; + + return $this->getControl($cp->$name); + } +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiSelectable.php b/framework/Web/UI/JuiControls/TJuiSelectable.php index b370d14a..c4eec235 100644 --- a/framework/Web/UI/JuiControls/TJuiSelectable.php +++ b/framework/Web/UI/JuiControls/TJuiSelectable.php @@ -229,33 +229,4 @@ class TJuiSelectable extends TActivePanel implements IJuiOptions, ICallbackEvent $this->getControls()->add($repeater); return $repeater; } -} - -/** - * TJuiSelectableTemplate class. - * - * TJuiSelectableTemplate is the default template for TJuiSelectableTemplate - * item template. - * - * @author Wei Zhuo - * @package System.Web.UI.ActiveControls - * @since 3.1 - */ -class TJuiSelectableTemplate extends TComponent implements ITemplate -{ - private $_template; - - public function __construct($template) - { - $this->_template = $template; - } - /** - * Instantiates the template. - * It creates a {@link TDataList} control. - * @param TControl parent to hold the content within the template - */ - public function instantiateIn($parent) - { - $parent->getControls()->add($this->_template); - } -} +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php b/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php new file mode 100644 index 00000000..846cfcef --- /dev/null +++ b/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php @@ -0,0 +1,39 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2013-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.JuiControls + */ + +/** + * TJuiSelectableTemplate class. + * + * TJuiSelectableTemplate is the default template for TJuiSelectableTemplate + * item template. + * + * @author Wei Zhuo + * @package System.Web.UI.ActiveControls + * @since 3.1 + */ +class TJuiSelectableTemplate extends TComponent implements ITemplate +{ + private $_template; + + public function __construct($template) + { + $this->_template = $template; + } + /** + * Instantiates the template. + * It creates a {@link TDataList} control. + * @param TControl parent to hold the content within the template + */ + public function instantiateIn($parent) + { + $parent->getControls()->add($this->_template); + } +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiSortable.php b/framework/Web/UI/JuiControls/TJuiSortable.php index 2fdf80dc..05d635d4 100644 --- a/framework/Web/UI/JuiControls/TJuiSortable.php +++ b/framework/Web/UI/JuiControls/TJuiSortable.php @@ -281,34 +281,4 @@ class TJuiSortable extends TActivePanel implements IJuiOptions, ICallbackEventHa $this->getControls()->add($repeater); return $repeater; } -} - - -/** - * TJuiSortableTemplate class. - * - * TJuiSortableTemplate is the default template for TJuiSortableTemplate - * item template. - * - * @author Wei Zhuo - * @package System.Web.UI.ActiveControls - * @since 3.1 - */ -class TJuiSortableTemplate extends TComponent implements ITemplate -{ - private $_template; - - public function __construct($template) - { - $this->_template = $template; - } - /** - * Instantiates the template. - * It creates a {@link TDataList} control. - * @param TControl parent to hold the content within the template - */ - public function instantiateIn($parent) - { - $parent->getControls()->add($this->_template); - } -} +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiSortableTemplate.php b/framework/Web/UI/JuiControls/TJuiSortableTemplate.php new file mode 100644 index 00000000..5903ea6c --- /dev/null +++ b/framework/Web/UI/JuiControls/TJuiSortableTemplate.php @@ -0,0 +1,40 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2013-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.JuiControls + */ + + +/** + * TJuiSortableTemplate class. + * + * TJuiSortableTemplate is the default template for TJuiSortableTemplate + * item template. + * + * @author Wei Zhuo + * @package System.Web.UI.ActiveControls + * @since 3.1 + */ +class TJuiSortableTemplate extends TComponent implements ITemplate +{ + private $_template; + + public function __construct($template) + { + $this->_template = $template; + } + /** + * Instantiates the template. + * It creates a {@link TDataList} control. + * @param TControl parent to hold the content within the template + */ + public function instantiateIn($parent) + { + $parent->getControls()->add($this->_template); + } +} \ No newline at end of file -- cgit v1.2.3