diff --git a/extensions/libraries/redcore/form/fields/rmedia.php b/extensions/libraries/redcore/form/fields/rmedia.php index 40a3a3e33..424462be7 100644 --- a/extensions/libraries/redcore/form/fields/rmedia.php +++ b/extensions/libraries/redcore/form/fields/rmedia.php @@ -42,6 +42,7 @@ class JFormFieldRmedia extends JFormField */ protected function getInput() { + $bootstrapVersion = RHtmlMedia::getFramework(); $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; $authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by'; $asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id']; @@ -134,8 +135,10 @@ function closeModal(fieldId) // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; + $inputClass = $bootstrapVersion == 'bootstrap2' ? 'input-prepend input-append' : 'input-group'; + // The text field. - $html[] = '
'; + $html[] = '
'; // The Preview. $preview = (string) $this->element['preview']; @@ -196,11 +199,22 @@ function closeModal(fieldId) { $html[] = '
'; $tooltip = $previewImgEmpty . $previewImg; + $options = array( 'title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), - 'text' => '', - 'class' => 'hasTipPreview' ); + + if ($bootstrapVersion == 'bootstrap2') + { + $options['text'] = ''; + $options['class'] = 'hasTipPreview'; + } + else + { + $options['text'] = ''; + $options['data-toggle'] = 'tooltip'; + } + $html[] = RHtml::tooltip($tooltip, $options); $html[] = '
'; } @@ -213,7 +227,9 @@ function closeModal(fieldId) } } - $html[] = ' '; $directory = (string) $this->element['directory']; @@ -239,13 +255,16 @@ function closeModal(fieldId) . $this->id . '&folder=' . $folder . '&redcore=true'; + $hideModal = $bootstrapVersion == 'bootstrap2' ? 'modal hide' : 'modal'; + $style = $bootstrapVersion == 'bootstrap2' ? 'width: 820px; height: 500px; margin-left: -410px; top: 50%; margin-top: -250px;' : ''; + // Create the modal object $modal = RModal::getInstance( array( 'attribs' => array( 'id' => $modalId, - 'class' => 'modal hide', - 'style' => 'width: 820px; height: 500px; margin-left: -410px; top: 50%; margin-top: -250px;' + 'class' => $hideModal, + 'style' => $style ), 'params' => array( 'showHeader' => true, diff --git a/extensions/libraries/redcore/layouts/modal.bs3.php b/extensions/libraries/redcore/layouts/modal.bs3.php new file mode 100644 index 000000000..b7e229e0e --- /dev/null +++ b/extensions/libraries/redcore/layouts/modal.bs3.php @@ -0,0 +1,69 @@ +getAttribute('id'); + +if ($link = $modal->params->get('link', null)) +{ + // @ToDo Remove re adding css style if more modal buttons are used + $styleSheet = " + iframe { border: 0 none; } + .modal { + position: absolute; + left: 40%; + } + .modal-body { + padding: 5px; + } + "; + $doc->addStyleDeclaration($styleSheet); + + $jsEvents = $modal->params->get('events', array()); + $jsEventsString = ''; + + foreach ($jsEvents as $event => $function) + { + $jsEventsString .= $event . '="' . $function . '(this)" '; + } + + $script = array(); + + $script[] = ' (function($) {'; + $script[] = ' $(document).ready(function() {'; + $script[] = ' $(\'#' . $cssId . '\').on(\'show\', function () {'; + $script[] = ' $(\'#' . $cssId . ' .modal-body\').html(\'\');'; + $script[] = ' });'; + $script[] = ' });'; + $script[] = ' })( jQuery );'; + + $doc->addScriptDeclaration(implode("\n", $script)); +} + +?> + +
renderAttributes(); ?>> + +