summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY7
-rw-r--r--framework/TApplicationComponent.php14
-rw-r--r--tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php24
3 files changed, 28 insertions, 17 deletions
diff --git a/HISTORY b/HISTORY
index 1fd7da5f..146bca85 100644
--- a/HISTORY
+++ b/HISTORY
@@ -9,13 +9,14 @@ BUG: Ticket#653 - TUrlMapping: ServiceId irgnored in URL-Map (Qiang)
BUG: Ticket#488 - TActiveCustomValidator Is Bypassing My Callback (Wei)
BUG: Ticket#620 - PRADO should not take over all of Prototype's Callbacks (Wei)
BUG: Ticket#635 - TDatePicker not correctly updating month (Christophe)
+BUG: Ticket#649 - Wrong error message in THttpCookieCollection::itemAt() (Knut)
+BUG: Ticket#654 - TAssetManager::copyDirectory() do not run closedir on an invalid resource (Knut)
+BUG: Ticket#655 - TAssetManager::publishTarFile() exception for 'assetmanager_tarchecksum_invalid' is not thrown on BSD systems (Knut)
+BUG: Ticket#659 - Asset is not published correctly for child classes (Qiang)
BUG: TWizard Sidebar using TDataListItemRenderer has error (Qiang)
BUG: TOutputCache crashes when a default button is set (Qiang)
BUG: Fixed several typos in TDbCache (Qiang)
BUG: Fix the bug that <include> tag was ignored in page configurations (Qiang)
-BUG: Ticket#654 - TAssetManager::copyDirectory() do not run closedir on an invalid resource (Knut)
-BUG: Ticket#655 - TAssetManager::publishTarFile() exception for 'assetmanager_tarchecksum_invalid' is not thrown on BSD systems (Knut)
-BUG: Ticket#649 - Wrong error message in THttpCookieCollection::itemAt() (Knut)
ENH: Ticket#625 - Added @ to represent authenticated users in auth rules (Qiang)
ENH: Ticket#631 - Make TQueue implement Countable as the other collection classes (Knut)
ENH: Ticket#634 - Override __toString for TXmlElement and TXmlDocument (Knut)
diff --git a/framework/TApplicationComponent.php b/framework/TApplicationComponent.php
index 1b320dc0..f5d532d2 100644
--- a/framework/TApplicationComponent.php
+++ b/framework/TApplicationComponent.php
@@ -87,12 +87,20 @@ class TApplicationComponent extends TComponent
* This method will publish a private asset (file or directory)
* and gets the URL to the asset. Note, if the asset refers to
* a directory, all contents under that directory will be published.
- * @param string path of the asset that is relative to the directory containing the control class file.
+ * Also note, it is recommended that you supply a class name as the second
+ * parameter to the method (e.g. publishAsset($assetPath,__CLASS__) ).
+ * By doing so, you avoid the issue that child classes may not work properly
+ * because the asset path will be relative to the directory containing the child class file.
+ *
+ * @param string path of the asset that is relative to the directory containing the specified class file.
+ * @param string name of the class whose containing directory will be prepend to the asset path. If null, it means get_class($this).
* @return string URL to the asset path.
*/
- public function publishAsset($assetPath)
+ public function publishAsset($assetPath,$className=null)
{
- $class=new ReflectionClass(get_class($this));
+ if($className===null)
+ $className=get_class($this);
+ $class=new ReflectionClass($className);
$fullPath=dirname($class->getFileName()).'/'.$assetPath;
return $this->publishFilePath($fullPath);
}
diff --git a/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php b/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php
index 80c16ce5..a55b7f29 100644
--- a/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php
+++ b/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php
@@ -1,39 +1,40 @@
<?php
+
/**
*
- *
+ *
* @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
* @copyright Copyright &copy; 2007, CERAM Sophia Antipolis
* @license url nameoflicense
* @version $Id$
- *
+ *
*/
class ToggleImageButton extends TImageButton {
-
+
public function getState () {
return $this->getViewState('state', ToggleImageButtonState::Down);
}
-
+
public function setState($value) {
- $this->setViewState('state', TPropertyValue::ensureEnum($value, ToggleImageButtonState));
+ $this->setViewState('state', TPropertyValue::ensureEnum($value, 'ToggleImageButtonState'));
}
-
+
public function toggleState () {
$this->setState(($this->getState()===ToggleImageButtonState::Down)?ToggleImageButtonState::Up:ToggleImageButtonState::Down);
}
-
+
public function onClick ($param) {
$this->toggleState();
parent::onClick($param);
}
-
+
public function getImageUrl () {
$img=($this->getState()===ToggleImageButtonState::Down)?'down.gif':'up.gif';
- return $this->publishAsset($img);
+ return $this->publishAsset($img,__CLASS__);
}
-
- public function setImageUrl() {
+
+ public function setImageUrl($url) {
throw new TUnsupportedOperationException('ImageUrl property is read-only');
}
}
@@ -42,4 +43,5 @@ class ToggleImageButtonState extends TEnumerable {
const Down='Down';
const Up='Up';
}
+
?> \ No newline at end of file