- md5
- b1ddd6c5f5431dc65e57482219ac57e7
- sha1
- 1157438b7b461fdb5ed1339c7464bb31e5866e00
- sha256
- 087a5592a0e59c40477289edf053178a34b01ebf98af951375c3e6f85a4638a8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
<?php
/**
* @version $Id: contacts.php 20196 2011-01-09 02:40:25Z ian $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
/**
* Supports a modal contact picker.
*
* @package Joomla.Administrator
* @subpackage com_contact
* @since 1.6
*/
class JFormFieldModal_Contacts extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Modal_Contacts';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Load the javascript and css
JHtml::_('behavior.framework');
JHTML::_('script','system/modal.js', false, true);
JHTML::_('stylesheet','system/modal.css', array(), true);
// Build the script.
$script = array();
$script[] = ' function jSelectChart_'.$this->id.'(id, name, object) {';
$script[] = ' document.id("'.$this->id.'_id").value = id;';
$script[] = ' document.id("'.$this->id.'_name").value = name;';
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Build the script.
$script = array();
$script[] = ' window.addEvent("domready", function() {';
$script[] = ' var div = new Element("div").setStyle("display", "none").injectBefore(document.id("menu-types"));';
$script[] = ' document.id("menu-types").injectInside(div);';
$script[] = ' SqueezeBox.initialize();';
$script[] = ' SqueezeBox.assign($$("input.modal"), {parse:"rel"});';
$script[] = ' });';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Get the title of the linked chart
$db = JFactory::getDBO();
$db->setQuery(
'SELECT name' .
' FROM #__contact_details' .
' WHERE id = '.(int) $this->value
);
$title = $db->loadResult();
if ($error = $db->getErrorMsg()) {
JError::raiseWarning(500, $error);
}
if (empty($title)) {
$title = JText::_('COM_CONTACT_SELECT_A_CONTACT');
}
$link = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&function=jSelectChart_'.$this->id;
JHTML::_('behavior.modal', 'a.modal');
$html = "\n".'<div class="fltlft"><input type="text" id="'.$this->id.'_name" value="'.htmlspecialchars($title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" /></div>';
$html .= '<div class="button2-left"><div class="blank"><a class="modal" title="'.JText::_('COM_CONTACT_CHANGE_CONTACT_BUTTON').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('COM_CONTACT_CHANGE_CONTACT_BUTTON').'</a></div></div>'."\n";
// The active contact id field.
if (0 == (int)$this->value) {
$value = '';
} else {
$value = (int)$this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html .= '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" />';
return $html;
}
}
No other release has this exact content. See every version of this file.