Permalink
Browse files

Merge pull request #995 from infograf768/infograf768

Custom Calendar issue when read-only -new request
  • Loading branch information...
2 parents 2d0e0e9 + 87cc8f8 commit 4ba1cd4567104a5aab2f19ac54d123742acb5130 @chdemko chdemko committed Mar 23, 2012
Showing with 11 additions and 8 deletions.
  1. +11 −8 libraries/joomla/html/html.php
@@ -802,7 +802,7 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri
$attribs = JArrayHelper::toString($attribs);
}
- if ((!$readonly) && (!$disabled))
+ if (!$readonly && !$disabled)
{
// Load the calendar behavior
self::_('behavior.calendar');
@@ -829,14 +829,17 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri
);
$done[] = $id;
}
- }
-
- return '<input type="text" title="' . (0 !== (int) $value ? self::_('date', $value) : '') . '" name="' . $name . '" id="' . $id
- . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" ' . $attribs . ' />'
- . ($readonly ? ''
- : self::_('image', 'system/calendar.png', JText::_('JLIB_HTML_CALENDAR'), array('class' => 'calendar', 'id' => $id . '_img'), true));
+ return '<input type="text" title="' . (0 !== (int) $value ? JHtml::_('date', $value) : '') . '" name="' . $name . '" id="' . $id
+ . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" ' . $attribs . ' />'
+ . JHtml::_('image', 'system/calendar.png', JText::_('JLIB_HTML_CALENDAR'), array('class' => 'calendar', 'id' => $id . '_img'), true);
+ }
+ else
+ {
+ return '<input type="text" title="' . (0 !== (int) $value ? JHtml::_('date', $value) : '')
+ . '" value="' . (0 !== (int) $value ? JHtml::_('date', $value, JFactory::getDbo()->getDateFormat()) : '') . '" ' . $attribs
+ . ' /><input type="hidden" name="' . $name . '" id="' . $id . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" />';
+ }
}
-
/**
* Add a directory where JHtml should search for helpers. You may
* either pass a string or an array of directories.

0 comments on commit 4ba1cd4

Please sign in to comment.