summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDatePicker.php
diff options
context:
space:
mode:
authorxue <>2006-05-29 03:08:07 +0000
committerxue <>2006-05-29 03:08:07 +0000
commit2ea02214b2fb6bedb58dbbd318ef171a9e146524 (patch)
tree16b12d9f68986fe204900d1cee4914a0a4035a7b /framework/Web/UI/WebControls/TDatePicker.php
parent8c1edb7f4eced999c9704ec9ff7ba11d88248bbd (diff)
Merge from 3.0 branch till 1099.
Diffstat (limited to 'framework/Web/UI/WebControls/TDatePicker.php')
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 59a71c90..a746437b 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -681,6 +681,18 @@ class TDatePicker extends TTextBox
else
throw new TConfigurationException('datepicker_calendarstyle_invalid',$style);
}
+
+ /**
+ * Publish the spacer.gif for IE iframe source.
+ * @return string the URL for the spacer.gif.
+ */
+ protected function publishIFrameSpacer()
+ {
+ $cs = $this->getPage()->getClientScript();
+ $spacer = 'System.Web.Javascripts.datepicker.spacer';
+ if(($file = Prado::getPathOfNamespace($spacer,'.gif')) != null)
+ return $this->publishFilePath($file);
+ }
/**
* Add the client id to the input textbox, and register the client scripts.
@@ -696,18 +708,24 @@ class TDatePicker extends TTextBox
/**
* Registers the javascript code to initialize the date picker.
- * Must use "Event.OnLoad" to initialize the date picker when the
- * full page is loaded, otherwise IE will throw an error.
*/
protected function registerCalendarClientScript()
{
if($this->getShowCalendar())
{
- $scripts = $this->getPage()->getClientScript();
- $scripts->registerPradoScript("datepicker");
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPradoScript("datepicker");
+
+ if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
+ {
+ $spacer = $this->publishIFrameSpacer();
+ $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
+ $cs->registerEndScript('TDatePicker.spacer', $code);
+ }
+
$options = TJavaScript::encode($this->getDatePickerOptions());
- $code = "Event.OnLoad(function(){ new Prado.WebUI.TDatePicker($options); });";
- $scripts->registerEndScript("prado:".$this->getClientID(), $code);
+ $code = "new Prado.WebUI.TDatePicker($options);";
+ $cs->registerEndScript("prado:".$this->getClientID(), $code);
}
}
}