Permalink
Browse files

Merge remote-tracking branch 'joomla/master'

  • Loading branch information...
2 parents 011253a + 27eaaba commit e433121c7f4eacdf226846f4223cd8fa0b01eea6 @gamort gamort committed Jun 20, 2012
Showing with 15 additions and 18 deletions.
  1. +5 −16 libraries/joomla/session/storage/database.php
  2. +10 −2 libraries/legacy/form/field/media.php
@@ -80,22 +80,11 @@ public function write($id, $data)
{
return false;
}
-
- if ($db->getAffectedRows())
- {
- return true;
- }
- else
- {
- $query->clear();
- $query->insert($db->quoteName('#__session'))
- ->columns($db->quoteName('session_id') . ', ' . $db->quoteName('data') . ', ' . $db->quoteName('time'))
- ->values($db->quote($id) . ', ' . $db->quote($data) . ', ' . $db->quote((int) time()));
-
- // If the session does not exist, we need to insert the session.
- $db->setQuery($query);
- return (boolean) $db->execute();
- }
+ /* Since $db->execute did not throw an exception, so the query was successful.
+ Either the data changed, or the data was identical.
+ In either case we are done.
+ */
+ return true;
}
catch (Exception $e)
{
@@ -92,11 +92,12 @@ protected function getInput()
$script[] = ' function jMediaRefreshPreviewTip(tip)';
$script[] = ' {';
- $script[] = ' tip.setStyle("display", "block");';
$script[] = ' var img = tip.getElement("img.media-preview");';
+ $script[] = ' tip.getElement("div.tip").setStyle("max-width", "none");';
$script[] = ' var id = img.getProperty("id");';
$script[] = ' id = id.substring(0, id.length - "_preview".length);';
$script[] = ' jMediaRefreshPreview(id);';
+ $script[] = ' tip.setStyle("display", "block");';
$script[] = ' }';
// Add the script to the document head.
@@ -138,6 +139,7 @@ protected function getInput()
{
$folder = '';
}
+
// The button.
if ($this->element['disabled'] != true)
{
@@ -202,10 +204,16 @@ protected function getInput()
$src = '';
}
+ $width = isset($this->element['preview_width']) ? (int) $this->element['preview_width'] : 300;
+ $height = isset($this->element['preview_height']) ? (int) $this->element['preview_height'] : 200;
+ $style = '';
+ $style .= ($width > 0) ? 'max-width:' . $width . 'px;' : '';
+ $style .= ($height > 0) ? 'max-height:' . $height . 'px;' : '';
+
$attr = array(
'id' => $this->id . '_preview',
'class' => 'media-preview',
- 'style' => 'max-width:160px; max-height:100px;'
+ 'style' => $style,
);
$img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $attr);
$previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>';

0 comments on commit e433121

Please sign in to comment.