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>';
$request['page']->draw('Template',$attribute);
$request['page']->draw('Javascript',$attribute);
echo '</table>';
} else {

View File

@ -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 '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
echo '<script type="text/javascript" language="javascript">'."\n";
echo 'var defaults = new Array();'."\n";
printf('var default_date_format = "%s";',$_SESSION[APPCONFIG]->getValue('appearance','date'));
echo "\n";
echo '</script>'."\n";
echo '<!-- END: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
echo "\n";
break;
}
}
}
# For DateAttributes, we need to set some defaults for the js_calendar.
echo '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
echo '<script type="text/javascript" language="javascript">'."\n";
echo 'var defaults = new Array();'."\n";
printf('var default_date_format = "%s";',$_SESSION[APPCONFIG]->getValue('appearance','date'));
echo "\n";
echo '</script>'."\n";
echo '<!-- END: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
echo "\n";
foreach ($this->template->getAttributesShown() as $attribute)
$this->draw('Javascript',$attribute);