summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2006-12-01 12:28:55 +0000
committerxue <>2006-12-01 12:28:55 +0000
commit17f49a9bc71d88c9b3e2f31a161f3689c136ac16 (patch)
treefc77b9c75927cd56281417843a318e85c39ce729 /framework
parent074032e0270ae70eed481a082158dc9554aaa1db (diff)
merge from 3.0 branch till 1531.
Diffstat (limited to 'framework')
-rw-r--r--framework/I18N/core/DateTimeFormatInfo.php2
-rw-r--r--framework/I18N/core/MessageSource_XLIFF.php3
-rw-r--r--framework/Web/TAssetManager.php32
-rw-r--r--framework/Web/UI/TControl.php2
-rw-r--r--framework/Web/UI/WebControls/TDataBoundControl.php4
5 files changed, 37 insertions, 6 deletions
diff --git a/framework/I18N/core/DateTimeFormatInfo.php b/framework/I18N/core/DateTimeFormatInfo.php
index 4d8dafe8..fb6793c5 100644
--- a/framework/I18N/core/DateTimeFormatInfo.php
+++ b/framework/I18N/core/DateTimeFormatInfo.php
@@ -166,7 +166,7 @@ class DateTimeFormatInfo
* @return DateTimeFormatInfo DateTimeFormatInfo for the specified
* culture.
*/
- function getInstance($culture=null)
+ static function getInstance($culture=null)
{
if ($culture instanceof CultureInfo)
diff --git a/framework/I18N/core/MessageSource_XLIFF.php b/framework/I18N/core/MessageSource_XLIFF.php
index 7f2f27c5..79d4f38c 100644
--- a/framework/I18N/core/MessageSource_XLIFF.php
+++ b/framework/I18N/core/MessageSource_XLIFF.php
@@ -280,7 +280,8 @@ class MessageSource_XLIFF extends MessageSource
throw new TIOException("Unable to save to file {$filename}, file must be writable.");
//create a new dom, import the existing xml
- $dom = DOMDocument::load($filename);
+ $dom = new DOMDocument();
+ $dom->load($filename);
//find the body element
$xpath = new DomXPath($dom);
diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php
index 04933bfa..fa43b7d7 100644
--- a/framework/Web/TAssetManager.php
+++ b/framework/Web/TAssetManager.php
@@ -179,6 +179,38 @@ class TAssetManager extends TModule
}
/**
+ * Returns the published path of a file path.
+ * This method does not perform any publishing. It merely tells you
+ * if the file path is published, where it will go.
+ * @param string directory or file path being published
+ * @return string the published file path
+ */
+ public function getPublishedPath($path)
+ {
+ $path=realpath($path);
+ if(is_file($path))
+ return $this->_basePath.'/'.$this->hash(dirname($path)).'/'.basename($path);
+ else
+ return $this->_basePath.'/'.$this->hash($path);
+ }
+
+ /**
+ * Returns the URL of a published file path.
+ * This method does not perform any publishing. It merely tells you
+ * if the file path is published, what the URL will be to access it.
+ * @param string directory or file path being published
+ * @return string the published URL for the file path
+ */
+ public function getPublishedUrl($path)
+ {
+ $path=realpath($path);
+ if(is_file($path))
+ return $this->_baseUrl.'/'.$this->hash(dirname($path)).'/'.basename($path);
+ else
+ return $this->_baseUrl.'/'.$this->hash($path);
+ }
+
+ /**
* Generate a CRC32 hash for the directory path. Collisions are higher
* than MD5 but generates a much smaller hash string.
* @param string string to be hashed.
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 7e49e7ce..a0242d54 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -1234,8 +1234,6 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
{
if($this->_stage<self::CS_LOADED)
{
- if(($context=$this->getTemplateControl())===null)
- $context=$this;
if(isset($this->_rf[self::RF_ADAPTER]))
$this->_rf[self::RF_ADAPTER]->onLoad(null);
else
diff --git a/framework/Web/UI/WebControls/TDataBoundControl.php b/framework/Web/UI/WebControls/TDataBoundControl.php
index 599bdef2..79175288 100644
--- a/framework/Web/UI/WebControls/TDataBoundControl.php
+++ b/framework/Web/UI/WebControls/TDataBoundControl.php
@@ -218,7 +218,7 @@ abstract class TDataBoundControl extends TWebControl
public function setCurrentPageIndex($value)
{
if(($value=TPropertyValue::ensureInteger($value))<0)
- throw new TInvalidDataValueException('databoundcontrol_currentpageindex_invalid',get_class($this));
+ $value=0;
$this->setViewState('CurrentPageIndex',$value,0);
}
@@ -337,7 +337,7 @@ abstract class TDataBoundControl extends TWebControl
$ds->setDataSource($data);
$this->setViewState('PageCount',$ds->getPageCount());
if($ds->getCurrentPageIndex()>=$ds->getPageCount())
- throw new TInvalidDataValueException('databoundcontrol_currentpageindex_invalid',get_class($this));
+ $ds->setCurrentPageIndex($ds->getPageCount()-1);
$this->performDataBinding($ds);
}
else