-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bootstrap popup with mootols compatibility
- Loading branch information
1 parent
3006b67
commit e9c5cb5
Showing
5 changed files
with
364 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
administrator/templates/isis/html/layouts/joomla/form/field/media.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Admin | ||
* @subpackage Layout | ||
* | ||
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Layout variables | ||
* --------------------- | ||
* | ||
* @var string $asset The asset text | ||
* @var string $authorField The label text | ||
* @var integer $authorId The author id | ||
* @var string $class The class text | ||
* @var boolean $disabled True if field is disabled | ||
* @var string $folder The folder text | ||
* @var string $id The label text | ||
* @var string $link The link text | ||
* @var string $name The name text | ||
* @var string $preview The preview image relative path | ||
* @var integer $previewHeight The image preview height | ||
* @var integer $previewWidth The image preview width | ||
* @var string $onchange The onchange text | ||
* @var boolean $readonly True if field is readonly | ||
* @var integer $size The size text | ||
* @var string $value The value text | ||
* @var string $src The path and filename of the image | ||
*/ | ||
extract($displayData); | ||
|
||
// The button. | ||
if ($disabled != true) | ||
{ | ||
JHtml::_('bootstrap.tooltip'); | ||
} | ||
|
||
$attr = ''; | ||
|
||
// Initialize some field attributes. | ||
$attr .= !empty($class) ? ' class="input-small hasTooltip field-media-input ' . $class . '"' : ' class="input-small hasTooltip field-media-input"'; | ||
$attr .= !empty($size) ? ' size="' . $size . '"' : ''; | ||
|
||
// Initialize JavaScript field attributes. | ||
$attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : ''; | ||
|
||
switch ($preview) | ||
{ | ||
case 'no': // Deprecated parameter value | ||
case 'false': | ||
case 'none': | ||
$showPreview = false; | ||
$showAsTooltip = false; | ||
break; | ||
case 'yes': // Deprecated parameter value | ||
case 'true': | ||
case 'show': | ||
break; | ||
case 'tooltip': | ||
default: | ||
$showPreview = true; | ||
$showAsTooltip = true; | ||
break; | ||
} | ||
|
||
// Pre fill the contents of the popover | ||
if ($showPreview) | ||
{ | ||
if ($value && file_exists(JPATH_ROOT . '/' . $value)) | ||
{ | ||
$src = JUri::root() . $value; | ||
} | ||
else | ||
{ | ||
$src = JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY'); | ||
} | ||
} | ||
|
||
// The url for the modal | ||
$url = ($readonly ? '' | ||
: ($link ? $link | ||
: 'index.php?option=com_media&view=images&tmpl=component&asset=' | ||
. $asset . '&author=' . $authorId) | ||
. '&fieldid={field-media-id}&ismoo=0&folder=' . $folder); | ||
?> | ||
<div class="field-media-wrapper" | ||
data-basepath="<?php echo JUri::root(); ?>" | ||
data-url="<?php echo $url; ?>" | ||
data-modal=".modal" | ||
data-modal-width="100%" | ||
data-modal-height="400px" | ||
data-input=".field-media-input" | ||
data-button-select=".button-select" | ||
data-button-clear=".button-clear" | ||
data-button-save-selected=".button-save-selected" | ||
data-preview="<?php echo $showPreview ? 'true' : 'false'; ?>" | ||
data-preview-container=".field-media-preview" | ||
data-preview-width="<?php echo $previewWidth; ?>" | ||
data-preview-height="<?php echo $previewHeight; ?>" | ||
> | ||
<?php | ||
// Render the modal | ||
echo JHtml::_('bootstrap.renderModal', | ||
'imageModal_'. $id, | ||
array( | ||
'title' => JText::_('JLIB_FORM_CHANGE_IMAGE'), | ||
'closeButton' => true, | ||
'footer' => '<button class="btn" data-dismiss="modal">' . JText::_('JCANCEL') . '</button>' | ||
) | ||
); | ||
|
||
JHtml::_('script', 'media/mediafield.min.js', false, true, false, false, true); | ||
?> | ||
<?php if ($showPreview) : ?> | ||
<div class="input-prepend input-append"> | ||
<span rel="popover" class="add-on pop-helper field-media-preview" | ||
title="<?php echo JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'); ?>" data-content="<?php echo JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY'); ?>" | ||
data-original-title="<?php echo JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'); ?>" data-trigger="hover"> | ||
<i class="icon-eye"></i> | ||
</span> | ||
<?php else: ?> | ||
<div class="input-append"> | ||
<?php endif; ?> | ||
<input type="text" name="<?php echo $name; ?>" id="<?php echo $id; ?>" value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>" readonly="readonly"<?php echo $attr; ?>/> | ||
<?php if ($disabled != true) : ?> | ||
<a class="btn add-on button-select"><?php echo JText::_("JLIB_FORM_BUTTON_SELECT"); ?></a> | ||
<a class="btn icon-remove hasTooltip add-on button-clear" title="<?php echo JText::_("JLIB_FORM_BUTTON_CLEAR"); ?>"></a> | ||
<?php endif; ?> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.