summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorxue <>2006-03-13 02:38:47 +0000
committerxue <>2006-03-13 02:38:47 +0000
commit7770c298450237e092d6d801fd547609ba2db230 (patch)
treeddc92889b2f10256f59a4024f5bed5cc01d73bdf /framework/Web/UI
parent6ae6538555d45b3e947f5ce0d948d9b88d95364a (diff)
TDataFieldAccessor can access public member variables now. Added implementation to cope with low PHP versions.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TTemplateManager.php43
-rw-r--r--framework/Web/UI/WebControls/TMultiView.php2
-rw-r--r--framework/Web/UI/WebControls/TWizard.php82
3 files changed, 79 insertions, 48 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 7c32e6a1..33c2edc5 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -704,13 +704,13 @@ class TTemplate extends TApplicationComponent implements ITemplate
{
// a subproperty, so the first segment must be readable
$subname=substr($name,0,$pos);
- if(!$class->containsMethod('get'.$subname))
+ if(!$class->hasMethod('get'.$subname))
throw new TConfigurationException('template_property_unknown',$type,$subname);
}
else if(strncasecmp($name,'on',2)===0)
{
// an event
- if(!$class->containsMethod($name))
+ if(!$class->hasMethod($name))
throw new TConfigurationException('template_event_unknown',$type,$name);
else if(!is_string($att))
throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
@@ -718,9 +718,9 @@ class TTemplate extends TApplicationComponent implements ITemplate
else
{
// a simple property
- if(!$class->containsMethod('set'.$name))
+ if(!$class->hasMethod('set'.$name))
{
- if($class->containsMethod('get'.$name))
+ if($class->hasMethod('get'.$name))
throw new TConfigurationException('template_property_readonly',$type,$name);
else
throw new TConfigurationException('template_property_unknown',$type,$name);
@@ -745,7 +745,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
{
// a subproperty, so the first segment must be readable
$subname=substr($name,0,$pos);
- if(!$class->containsMethod('get'.$subname))
+ if(!$class->hasMethod('get'.$subname))
throw new TConfigurationException('template_property_unknown',$type,$subname);
}
else if(strncasecmp($name,'on',2)===0)
@@ -753,9 +753,9 @@ class TTemplate extends TApplicationComponent implements ITemplate
else
{
// id is still alowed for TComponent, even if id property doesn't exist
- if(strcasecmp($name,'id')!==0 && !$class->containsMethod('set'.$name))
+ if(strcasecmp($name,'id')!==0 && !$class->hasMethod('set'.$name))
{
- if($class->containsMethod('get'.$name))
+ if($class->hasMethod('get'.$name))
throw new TConfigurationException('template_property_readonly',$type,$name);
else
throw new TConfigurationException('template_property_unknown',$type,$name);
@@ -768,33 +768,4 @@ class TTemplate extends TApplicationComponent implements ITemplate
}
}
-/**
- * TReflectionClass class.
- * This class is written to cope with the incompatibility between 5.1+ and earlier versions.
- * It mainly provides a way to detect if a method exists for a given class name.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System.Web.UI
- * @since 3.0
- */
-class TReflectionClass extends ReflectionClass
-{
- /**
- * @param string method name
- * @return boolean whether the method exists
- */
- public function containsMethod($method)
- {
- try
- {
- return $this->getMethod($method)!==null;
- }
- catch(Exception $e)
- {
- return false;
- }
- }
-}
-
?> \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php
index d44668f4..a88fbda7 100644
--- a/framework/Web/UI/WebControls/TMultiView.php
+++ b/framework/Web/UI/WebControls/TMultiView.php
@@ -139,7 +139,7 @@ class TMultiView extends TControl
{
if($view->getActive())
return;
- $triggerEvent=$this->getControlStage()>=TControl::CS_STATE_LOADED || !$this->getPage()->getIsPostBack();
+ $triggerEvent=$this->getControlStage()>=TControl::CS_STATE_LOADED || !$this->getPage() || !$this->getPage()->getIsPostBack();
foreach($this->getViews() as $v)
{
if($v===$view)
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 0e2e6c41..52a11164 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -16,6 +16,10 @@ Prado::using('System.Web.UI.WebControls.TMultiView');
class TWizard extends TWebControl implements INamingContainer
{
/**
+ * @var TMultiView multiview that contains the wizard steps
+ */
+ private $_multiView=null;
+ /**
* @var mixed navigation template for the start step.
*/
private $_startNavigationTemplate=null;
@@ -35,26 +39,27 @@ class TWizard extends TWebControl implements INamingContainer
* @var mixed template for the side bar.
*/
private $_sideBarTemplate=null;
+ /**
+ * @var TWizardStepCollection
+ */
+ private $_wizardSteps=null;
/**
* @return string tag name for the wizard
*/
protected function getTagName()
{
- return 'table';
+ return 'div';
}
- // SideBarDataList, MultiView, History
- /**
- * Creates a style object for the wizard.
- * This method creates a {@link TTableStyle} to be used by the wizard.
- * @return TTableStyle control style to be used
- */
- protected function createStyle()
+ public function addParsedObject($object)
{
- return new TTableStyle;
+ if(is_object($object))
+ $this->getWizardSteps()->add($object);
}
+ // SideBarDataList, History
+
/**
* @return integer the cellspacing for the table used by wizard. Defaults to -1, meaning not set.
*/
@@ -117,6 +122,9 @@ class TWizard extends TWebControl implements INamingContainer
public function getWizardSteps()
{
+ if($this->_wizardSteps===null)
+ $this->_wizardSteps=new TWizardStepCollection($this);
+ return $this->_wizardSteps;
}
public function getTemplatedSteps()
@@ -477,6 +485,18 @@ class TWizard extends TWebControl implements INamingContainer
$this->raiseEvent('OnSideBarButtonClick',$this,$param);
}
+ protected function getMultiView()
+ {
+ if($this->_multiView===null)
+ {
+ $this->_multiView=new TMultiView;
+ $this->_multiView->setID('WizardMultiView');
+ // add handler to OnActiveViewChanged
+ // ignore bubble events
+ }
+ return $this->_multiView;
+ }
+
public function addedWizardStep($step)
{
if(($owner=$step->getOwner())!==null)
@@ -489,7 +509,7 @@ class TWizard extends TWebControl implements INamingContainer
//$this->getTemplateWizardSteps()->add($step);
// register it ???
}
- $this->onWizardStepsChanged();
+ //$this->wizardStepsChanged();
}
public function removedWizardStep($step)
@@ -501,7 +521,42 @@ class TWizard extends TWebControl implements INamingContainer
// $this->_templatedSteps....
//$this->getTemplateWizardSteps()->remove($step);
}
- $this->onWizardStepsChanged();
+ $this->wizardStepsChanged();
+ }
+
+ protected function createChildControls()
+ {
+ // side bar
+ if($this->getDisplaySideBar())
+ {
+ // render side bar here
+ }
+
+ // header
+ $header=new TPanel;
+ $header->setID('Header');
+ if(($template=$this->getHeaderTemplate())!==null)
+ $template->instantiateIn($header);
+ else
+ $header->getControls()->add($this->getHeaderText());
+
+ // steps
+ $content=new TPanel;
+ $content->setID('Content');
+ $content->getControls()->add($this->getMultiView());
+ $this->getMultiView()->setActiveViewIndex(0);
+ $this->getControls()->add($content);
+ // navigation
+ /*
+ $navigation=new TPanel;
+ $navigation->setID('Navigation');
+ $startNavigation=$this->createStartNavigation();
+ $stepNavigation=$this->createStepNavigation();
+ $finishNavigation=$this->createFinishNavigation();
+ $navigation->getControls()->add($startNavigation);
+ $navigation->getControls()->add($stepNavigation);
+ $navigation->getControls()->add($finishNavigation);
+ */
}
}
@@ -745,6 +800,11 @@ class TCompleteWizardStep extends TTemplateWizardStep
class TWizardStepCollection extends TList
{
/**
+ * @var TWizard
+ */
+ private $_wizard;
+
+ /**
* Constructor.
* @param TWizard wizard that owns this collection
*/