summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2005-12-10 02:02:10 +0000
committerxue <>2005-12-10 02:02:10 +0000
commit1f1f96b7e143973e7da69fc01ebd6721f62e291c (patch)
tree342915f87c904d8a79a853101ad9d176051a588b /framework
parent662547dc4c6c493c1c89f888e3ef73667ea783c4 (diff)
Diffstat (limited to 'framework')
-rw-r--r--framework/TODO.txt4
-rw-r--r--framework/Web/UI/TControl.php22
-rw-r--r--framework/Web/UI/WebControls/TContent.php2
-rw-r--r--framework/Web/UI/WebControls/TContentPlaceHolder.php5
4 files changed, 28 insertions, 5 deletions
diff --git a/framework/TODO.txt b/framework/TODO.txt
index ff3c2598..658bbc12 100644
--- a/framework/TODO.txt
+++ b/framework/TODO.txt
@@ -1,15 +1,13 @@
+how to properly encode a URL (e.g. used in javascript or css includes)
how to display context information for template parsing and instantiation? File name? line number?
how to do this for Theme (skin files)?
-how to correctly highlight source code displayed for exception context?
-checkbox if checked, posted, unchecked and then post, it will be checked.
think more about encoding/decoding
<%@ MasterClass="Pages.MasterPage" %>
Features to be implemented later:
- SmartNavigation: TForm, TPage
-- DefaultButton: TForm, TClientScriptManager
Main Problems:
1. How to solve viewstate ID mapping problems? What if a control has changed its ID before saving viewstate?
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index ce343925..7a123ed2 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -790,7 +790,7 @@ class TControl extends TComponent
* The current naming container is either the control itself
* if it implements {@link INamingContainer} or the control's naming container.
* The ID path is an ID sequence separated by {@link TControl::ID_SEPARATOR}.
- * For example, 'Repeater1:Item1:Button1' looks for a control with ID 'Button1'
+ * For example, 'Repeater1.Item1.Button1' looks for a control with ID 'Button1'
* whose naming container is 'Item1' whose naming container is 'Repeater1'.
* @param string ID of the control to be looked up
* @return TControl|null the control found, null if not found
@@ -798,6 +798,7 @@ class TControl extends TComponent
*/
public function findControl($id)
{
+ $id=strtr($id,'.',self::ID_SEPARATOR);
$container=($this instanceof INamingContainer)?$this:$this->getNamingContainer();
if(!$container || !$container->getHasControls())
return null;
@@ -843,6 +844,25 @@ class TControl extends TComponent
}
/**
+ * Unregisters an object by name.
+ * @param string name of the object
+ * @see registerObject
+ */
+ public function unregisterObject($name)
+ {
+ unset($this->_rf[self::RF_NAMED_OBJECTS][$name]);
+ }
+
+ /**
+ * @return boolean whether an object has been registered with the name
+ * @see registerObject
+ */
+ public function isObjectRegistered($name)
+ {
+ return isset($this->_rf[self::RF_NAMED_OBJECTS][$name]);
+ }
+
+ /**
* This method is invoked after the control is instantiated by a template.
* When this method is invoked, the control should have a valid TemplateControl
* and has its properties initialized according to template configurations.
diff --git a/framework/Web/UI/WebControls/TContent.php b/framework/Web/UI/WebControls/TContent.php
index 20cd1dc5..d02d3b4d 100644
--- a/framework/Web/UI/WebControls/TContent.php
+++ b/framework/Web/UI/WebControls/TContent.php
@@ -39,6 +39,8 @@ class TContent extends TControl implements INamingContainer
*/
public function createdOnTemplate($parent)
{
+ if(($id=$this->getID())==='')
+ throw new TConfigurationException('content_id_required');
$this->getTemplateControl()->registerContent($this);
parent::createdOnTemplate($parent);
}
diff --git a/framework/Web/UI/WebControls/TContentPlaceHolder.php b/framework/Web/UI/WebControls/TContentPlaceHolder.php
index 32106e82..a13e85bc 100644
--- a/framework/Web/UI/WebControls/TContentPlaceHolder.php
+++ b/framework/Web/UI/WebControls/TContentPlaceHolder.php
@@ -39,8 +39,11 @@ class TContentPlaceHolder extends TControl
*/
public function createdOnTemplate($parent)
{
+ if(($id=$this->getID())==='')
+ throw new TConfigurationException('contentplaceholder_id_required');
$loc=$parent->getHasControls()?$parent->getControls()->getCount():0;
- $this->getTemplateControl()->registerContentPlaceHolder($this->getID(),$parent,$loc);
+ $this->getTemplateControl()->registerContentPlaceHolder($id,$parent,$loc);
+ $parent->unregisterObject($id);
}
}