summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Exceptions/messages/messages.txt1
-rw-r--r--framework/Web/Services/TPageService.php24
-rw-r--r--framework/Web/UI/TPage.php13
4 files changed, 37 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 3fac92d6..df1f7c1d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,6 +4,7 @@ BUG: Issue#157 - Enabled does not work properly on TActiveRadioButton/CheckBoxLi
BUG: Issue#189 - Page State corrupted when EnableStateValidation=False (Christophe)
BUG: Issue#198 - "Undefined variable: tagName" after error in application configuration. (Christophe)
BUG: Typo in TBoundColumn (Robin)
+ENH: Add property ClientScriptManagerClass to TPageService and releated changes in TPage.getClientScript() (Yves)
Version 3.1.6 July 22, 2009
BUG: Issue#98 - Missing file in quickstart demo (Chrisotphe)
diff --git a/framework/Exceptions/messages/messages.txt b/framework/Exceptions/messages/messages.txt
index fc2b63f1..425979a3 100644
--- a/framework/Exceptions/messages/messages.txt
+++ b/framework/Exceptions/messages/messages.txt
@@ -200,6 +200,7 @@ page_control_outofform = {0} '{1}' must be enclosed within TForm.
page_head_duplicated = A page can contain at most one THead.
page_head_required = A THead control is needed in page template in order to render CSS and js in the HTML head section.
page_statepersister_invalid = Page state persister must implement IPageStatePersister interface.
+page_csmanagerclass_invalid = ClientScriptManager class '{0}' must be an instance of TClientScriptManager.
csmanager_pradoscript_invalid = Unknown Prado script library name '{0}'.
csmanager_invalid_packages = Unkownn packages '{1}' for javascript packages defined in '{0}'. Valid packages are '{2}'.
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index e35fb0e3..d7506912 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -100,6 +100,11 @@ class TPageService extends TService
*/
private $_basePageClass='TPage';
/**
+ * @var string clientscript manager class in namespace format
+ * @since 3.1.7
+ */
+ private $_clientScriptManagerClass='System.Web.UI.TClientScriptManager';
+ /**
* @var string default page
*/
private $_defaultPage='Home';
@@ -409,6 +414,25 @@ class TPageService extends TService
}
/**
+ * Sets the clientscript manager class (in namespace format).
+ * @param string class name
+ * @since 3.1.7
+ */
+ public function setClientScriptManagerClass($value)
+ {
+ $this->_clientScriptManagerClass=$value;
+ }
+
+ /**
+ * @return string clientscript manager class in namespace format. Defaults to 'System.Web.UI.TClientScriptManager'.
+ * @since 3.1.7
+ */
+ public function getClientScriptManagerClass()
+ {
+ return $this->_clientScriptManagerClass;
+ }
+
+ /**
* Runs the service.
* This will create the requested page, initializes it with the property values
* specified in the configuration, and executes the page.
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 4681f876..4a2ea474 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -586,8 +586,17 @@ class TPage extends TTemplateControl
*/
public function getClientScript()
{
- if(!$this->_clientScript)
- $this->_clientScript=new TClientScriptManager($this);
+ if(!$this->_clientScript) {
+ $className = $classPath = $this->getService()->getClientScriptManagerClass();
+ Prado::using($className);
+ if(($pos=strrpos($className,'.'))!==false)
+ $className=substr($className,$pos+1);
+
+ if(!class_exists($className,false) || ($className!=='TClientScriptManager' && !is_subclass_of($className,'TClientScriptManager')))
+ throw new THttpException(404,'page_csmanagerclass_invalid',$classPath);
+
+ $this->_clientScript=new $className($this);
+ }
return $this->_clientScript;
}