/** * Tests the tooltip method. * * @param string $expected @todo * @param string $selector @todo * @param array $params @todo * * @return void * * @since 3.1 * @dataProvider getTooltipData */ public function testTooltip($expected, $selector = '.hasTooltip', $params = array()) { JHtmlBehavior::tooltip($selector, $params); $this->assertEquals($expected, JHtmlBehaviorInspector::getLoaded(), 'The tooltip behavior is not loaded with all dependencies'); }
/** * Get Preview Image. * * @return string Preview image html. */ public function getPreview() { // The Preview. $preview = (string) $this->element['preview']; $showPreview = true; $showAsTooltip = false; switch ($preview) { case 'no': // Deprecated parameter value // Deprecated parameter value case 'false': case 'none': $showPreview = false; break; case 'yes': // Deprecated parameter value // Deprecated parameter value case 'true': case 'show': break; case 'tooltip': default: $this->showAsTooltip = $showAsTooltip = true; $options = array('onShow' => 'AKFinderRefreshPreviewTip(this)'); JHtmlBehavior::tooltip('.hasTipPreview', $options); break; } if ($showPreview) { if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $src = JURI::root() . $this->value; } else { $src = ''; } $width = (int) XmlHelper::get($this->element, 'preview_width', 300); $height = (int) XmlHelper::get($this->element, 'preview_height', 200); $style = ''; $style .= $width > 0 ? 'max-width:' . $width . 'px;' : ''; $style .= $height > 0 ? 'max-height:' . $height . 'px;' : ''; $style .= !$showAsTooltip ? 'margin: 10px 0;' : ''; $imgattr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style); $imgattr['class'] = $showAsTooltip ? $imgattr['class'] : $imgattr['class'] . ' img-polaroid'; $img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr); $previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>'; $previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>'; $html[] = '<div class="media-preview add-on fltlft">'; if ($showAsTooltip) { $tooltip = $previewImgEmpty . $previewImg; $options = array('title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), 'text' => '<i class="icon-eye"></i>', 'class' => 'hasTipPreview'); $options['text'] = JVERSION >= 3 ? $options['text'] : JText::_('JLIB_FORM_MEDIA_PREVIEW_TIP_TITLE'); $html[] = JHtml::tooltip($tooltip, $options); } else { $html[] = ' ' . $previewImgEmpty; $html[] = ' ' . $previewImg; $html[] = '<script type="text/javascript">AKFinderRefreshPreview("' . $this->id . '");</script>'; } $html[] = '</div>'; } return implode("\n", $html); }
<?php /** * @version $Id$ * @package Joomla.Administrator * @subpackage JoomDOC * @author ARTIO s.r.o., info@artio.net, http:://www.artio.net * @copyright Copyright (C) 2011 Artio s.r.o.. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /* @var $this JoomDOCViewDocument */ JHtmlBehavior::tooltip(); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); jimport('joomla.html.pagination'); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); /* @var $mainframe JApplication */ $config = JoomDOCConfig::getInstance(); /* @var $config JoomDOCConfig */ $js[] = 'Joomla.submitbutton = function (task) {'; $js[] = ' var form = document.getElementById(\'item-form\');'; $js[] = ' if (task == \'' . JoomDOCHelper::getTask(JOOMDOC_DOCUMENT, JOOMDOC_TASK_CANCEL) . '\' || document.formvalidator.isValid(form)) {'; $js[] = ' Joomla.submitform(task, form);'; $js[] = ' } else {'; $js[] = ' alert(\'' . JText::_('JGLOBAL_VALIDATION_FORM_FAILED', true) . '\');'; $js[] = ' }'; $js[] = '}'; $js[] = 'function tableOrdering(order, dir, task) {'; $js[] = ' document.versionForm.filter_order.value = order;';