summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Exceptions/messages.txt1
-rw-r--r--framework/Web/UI/TClientScriptManager.php10
-rw-r--r--framework/Web/UI/TPage.php3
4 files changed, 15 insertions, 0 deletions
diff --git a/HISTORY b/HISTORY
index cdeff6a7..55e2469f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,7 @@
Version 3.1.1 To be released
============================
BUG: Ticket#670 - TDatePicker: Year Issue (Christophe)
+ENH: Added THead requirement check (Qiang)
Version 3.1.0 July 2, 2007
==========================
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index baddb754..c9607f00 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -193,6 +193,7 @@ page_isvalid_unknown = TPage.IsValid has not been evaluated yet.
page_postbackcontrol_invalid = Unable to determine postback control '{0}'.
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.
csmanager_pradoscript_invalid = Unknown Prado script library name '{0}'.
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index efb8ec17..5f924397 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -87,6 +87,16 @@ class TClientScriptManager extends TApplicationComponent
}
/**
+ * @return boolean whether THead is required in order to render CSS and js within head
+ * @since 3.1.1
+ */
+ public function getRequiresHead()
+ {
+ return count($this->_styleSheetFiles) || count($this->_styleSheets)
+ || count($this->_headScriptFiles) || count($this->_headScripts);
+ }
+
+ /**
* Registers Prado javascript by library name. See "Web/Javascripts/source/packages.php"
* for library names.
* @param string script library name.
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 1a9f45c6..f368bc60 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -659,6 +659,9 @@ class TPage extends TTemplateControl
foreach($this->_styleSheet->getJavaScriptFiles() as $url)
$cs->registerHeadScriptFile($url,$url);
}
+
+ if($cs->getRequiresHead() && $this->getHead()===null)
+ throw new TConfigurationException('page_head_required');
}
/**