diff options
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 19 | ||||
-rw-r--r-- | framework/Web/UI/TForm.php | 3 | ||||
-rw-r--r-- | framework/Web/UI/TPage.php | 50 | ||||
-rw-r--r-- | framework/Web/UI/TPostBackOptions.php | 34 |
4 files changed, 28 insertions, 78 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 0e3ad773..6c9d6ce8 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -36,7 +36,7 @@ class TClientScriptManager extends TComponent const SCRIPT_DIR='Web/Javascripts/js';
const POSTBACK_FUNC='Prado.PostBack.perform';
const POSTBACK_OPTIONS='Prado.PostBack.Options';
- private $_owner;
+ private $_page;
private $_hiddenFields=array();
private $_beginScripts=array();
private $_endScripts=array();
@@ -51,7 +51,7 @@ class TClientScriptManager extends TComponent public function __construct(TPage $owner)
{
- $this->_owner=$owner;
+ $this->_page=$owner;
}
public function getPostBackEventReference($control,$parameter='',$options=null,$javascriptPrefix=true)
@@ -78,7 +78,7 @@ class TClientScriptManager extends TComponent if($options->ActionUrl!=='')
{
$flag=true;
- $this->_owner->setCrossPagePostBack(true);
+ $this->_page->setCrossPagePostBack(true);
$opt.='"'.THttpUtility::quoteJavaScriptString($options->ActionUrl).'",';
}
else
@@ -104,7 +104,7 @@ class TClientScriptManager extends TComponent else
$opt='null';
$this->registerPostBackScript();
- $formID=$this->_owner->getForm()->getUniqueID();
+ $formID=$this->_page->getForm()->getUniqueID();
$postback=self::POSTBACK_FUNC.'(\''.$formID.'\',\''.$control->getUniqueID().'\',\''.THttpUtility::quoteJavaScriptString($parameter).'\','.$opt.')';
if($options && $options->AutoPostBack)
$postback='setTimeout(\''.THttpUtility::quoteJavaScriptString($postback).'\',0)';
@@ -126,7 +126,7 @@ class TClientScriptManager extends TComponent {
if(!isset($this->_publishedScriptFiles[$jsFile]))
{
- $am=$this->_owner->getService()->getAssetManager();
+ $am=$this->_page->getService()->getAssetManager();
$this->_publishedScriptFiles[$jsFile]=$am->publishFilePath(Prado::getFrameworkPath().'/'.self::SCRIPT_DIR.'/'.$jsFile);
}
return $this->_publishedScriptFiles[$jsFile];
@@ -147,12 +147,9 @@ class TClientScriptManager extends TComponent if(!$this->_scrollScriptRegistered)
{
$this->_scrollScriptRegistered=true;
- $this->registerHiddenField(TPage::FIELD_SCROLL_X,$this->_owner->getScrollPositionX());
- $this->registerHiddenField(TPage::FIELD_SCROLL_Y,$this->_owner->getScrollPositionY());
- /*
- this.ClientScript.RegisterStartupScript(typeof(Page), "PageScrollPositionScript", "\r\ntheForm.oldSubmit = theForm.submit;\r\ntheForm.submit = WebForm_SaveScrollPositionSubmit;\r\n\r\ntheForm.oldOnSubmit = theForm.onsubmit;\r\ntheForm.onsubmit = WebForm_SaveScrollPositionOnSubmit;\r\n" + (this.IsPostBack ? "\r\ntheForm.oldOnLoad = window.onload;\r\nwindow.onload = WebForm_RestoreScrollPosition;\r\n" : string.Empty), true);
- need base.js
- */
+ $this->registerHiddenField(TPage::FIELD_SCROLL_X,$x);
+ $this->registerHiddenField(TPage::FIELD_SCROLL_Y,$y);
+ // TBD, need scroll.js
}
}
diff --git a/framework/Web/UI/TForm.php b/framework/Web/UI/TForm.php index 0edb976b..4c619299 100644 --- a/framework/Web/UI/TForm.php +++ b/framework/Web/UI/TForm.php @@ -19,6 +19,7 @@ class TForm extends TControl $attributes->remove('action');
$page=$this->getPage();
+ /*
$onsubmit=$page->getClientOnSubmitEvent();
if($onsubmit!=='')
{
@@ -29,7 +30,7 @@ class TForm extends TControl }
if($page->getClientSupportsJavaScript())
$writer->addAttribute('onsubmit',$onsubmit);
- }
+ }*/
if($this->getDefaultButton()!=='')
{//todo
$control=$this->findControl($this->getDefaultButton());
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 42f495cf..46d1d8df 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -1,8 +1,13 @@ <?php
-Prado::using('System.Web.UI.*');
+//Prado::using('System.Web.UI.*');
Prado::using('System.Web.UI.WebControls.*');
+Prado::using('System.Web.UI.TControl');
+Prado::using('System.Web.UI.TTemplateControl');
+Prado::using('System.Web.UI.TForm');
+Prado::using('System.Web.UI.TClientScriptManager');
+//Prado::using('System.Web
class TPage extends TTemplateControl
{
const FIELD_POSTBACK_TARGET='PRADO_POSTBACK_TARGET';
@@ -662,7 +667,7 @@ class TPage extends TTemplateControl }
/**
- * @internal
+ * @internal This method is invoked by TForm at the beginning of its rendering
*/
public function beginFormRender($writer)
{
@@ -674,7 +679,7 @@ class TPage extends TTemplateControl }
/**
- * @internal
+ * @internal This method is invoked by TForm at the end of its rendering
*/
public function endFormRender($writer)
{
@@ -702,16 +707,26 @@ class TPage extends TTemplateControl $this->_inFormRender=false;
}
+ /**
+ * Sets input focus on a control after the page is rendered to users.
+ * @param TControl control to receive focus
+ */
public function setFocus(TControl $value)
{
$this->_focusedControl=$value;
}
+ /**
+ * @return boolean (TBD) whether to keep the page scroll position the same as users last see it
+ */
public function getMaintainScrollPosition()
{
return $this->_maintainScrollPosition;
}
+ /**
+ * @param boolean (TBD) whether to keep the page scroll position the same as users last see it
+ */
public function setMaintainScrollPosition($value)
{
$this->_maintainScrollPosition=TPropertyValue::ensureBoolean($value);
@@ -723,38 +738,9 @@ class TPage extends TTemplateControl return true;
}
-
- public function getClientOnSubmitEvent()
- {
- // todo
- if($this->getClientScript()->getHasSubmitStatements())
- return 'javascript:return WebForm_OnSubmit();';
- else
- return '';
- }
-
protected function initializeCulture()
{
}
-
- /**
- * @internal
- */
- public function loadScrollPosition()
- {
- if($this->_previousPagePath==='' && $this->_requestValueCollection)
- {
- if(isset($_REQUEST['__SCROLLPOSITIONX']))
- $this->_scrollPositionX=(integer)$_REQUEST['__SCROLLPOSITIONX'];
- if(isset($_REQUEST['__SCROLLPOSITIONY']))
- $this->_scrollPositionX=(integer)$_REQUEST['__SCROLLPOSITIONY'];
- }
- }
-
-
- final public function registerAsyncTask()
- {
- }
}
?>
\ No newline at end of file diff --git a/framework/Web/UI/TPostBackOptions.php b/framework/Web/UI/TPostBackOptions.php deleted file mode 100644 index b39d5675..00000000 --- a/framework/Web/UI/TPostBackOptions.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php
-
-class TPostBackOptions extends TComponent
-{
- public $ActionUrl;
- public $Argument;
- public $AutoPostBack;
- public $ClientSubmit;
- public $PerformValidation;
- public $TargetControl;
- public $TrackFocus;
- public $ValidationGroup;
-
- public function __construct($targetControl=null,
- $argument='',
- $actionUrl='',
- $autoPostBack=false,
- $trackFocus=false,
- $clientSubmit=true,
- $performValidation=false,
- $validationGroup='')
- {
- $this->ActionUrl=$actionUrl;
- $this->Argument=$argument;
- $this->AutoPostBack=$autoPostBack;
- $this->ClientSubmit=$clientSubmit;
- $this->PerformValidation=$performValidation;
- $this->TargetControl=$targetControl;
- $this->TrackFocus=$trackFocus;
- $this->ValidationGroup=$validationGroup;
- }
-}
-
-?>
\ No newline at end of file |