From a6dc80616b8a6c496eff251471c11613c9ec1e0a Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 20 Sep 2009 11:21:59 +1000 Subject: [PATCH] Fix rendering of js_calendar on add_attr, when no previous DateAttributes existed --- htdocs/add_value_form.php | 1 + lib/TemplateRender.php | 26 +++++++++----------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/htdocs/add_value_form.php b/htdocs/add_value_form.php index 2815c51..33e39bd 100644 --- a/htdocs/add_value_form.php +++ b/htdocs/add_value_form.php @@ -160,6 +160,7 @@ if (get_request('meth','REQUEST') != 'ajax') { echo ''; $request['page']->draw('Template',$attribute); + $request['page']->draw('Javascript',$attribute); echo '
'; } else { diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index db20ba4..1f1a276 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -1598,23 +1598,15 @@ function validateForm(silence) { $this->drawTemplateJavascript(); - # If we have a DateAttribute, we need to set some defaults for the js_calendar. - if (isset($_SESSION[APPCONFIG])) { - foreach ($this->template->getAttributesShown() as $attribute) { - if (array_key_exists($attribute->getName(),array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs')))) { - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo "\n"; - - break; - } - } - } + # For DateAttributes, we need to set some defaults for the js_calendar. + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo "\n"; foreach ($this->template->getAttributesShown() as $attribute) $this->draw('Javascript',$attribute);