Fix rendering of js_calendar on add_attr, when no previous DateAttributes existed

This commit is contained in:
Deon George 2009-09-20 11:21:59 +10:00
parent 9196bb9e41
commit a6dc80616b
2 changed files with 10 additions and 17 deletions

View File

@ -160,6 +160,7 @@ if (get_request('meth','REQUEST') != 'ajax') {
echo '<table class="entry" cellspacing="0" align="center" border=0>'; echo '<table class="entry" cellspacing="0" align="center" border=0>';
$request['page']->draw('Template',$attribute); $request['page']->draw('Template',$attribute);
$request['page']->draw('Javascript',$attribute);
echo '</table>'; echo '</table>';
} else { } else {

View File

@ -1598,10 +1598,7 @@ function validateForm(silence) {
$this->drawTemplateJavascript(); $this->drawTemplateJavascript();
# If we have a DateAttribute, we need to set some defaults for the js_calendar. # For DateAttributes, 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 '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n"; echo '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
echo '<script type="text/javascript" language="javascript">'."\n"; echo '<script type="text/javascript" language="javascript">'."\n";
echo 'var defaults = new Array();'."\n"; echo 'var defaults = new Array();'."\n";
@ -1611,11 +1608,6 @@ function validateForm(silence) {
echo '<!-- END: GLOBAL SETTINGS FOR THE js_calendar -->'."\n"; echo '<!-- END: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
echo "\n"; echo "\n";
break;
}
}
}
foreach ($this->template->getAttributesShown() as $attribute) foreach ($this->template->getAttributesShown() as $attribute)
$this->draw('Javascript',$attribute); $this->draw('Javascript',$attribute);