0
function mootools($debug = null)
{
static $loaded;
// Only load once
if ($loaded) {
return;
}
// If no debugging value is set, use the configuration setting
if ($debug === null) {
$config = &JFactory::getConfig();
$debug = $config->getValue('config. debug');
}
// TODO NOTE: Here we are checking for Konqueror - If they fix thier issue with compressed, we will need to update this
$konkcheck = isset($_SERVER['HTTP_USER_AGENT']) ? strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "konqueror") : null;
if ($debug || $konkcheck) {
JHTML::script('mootools-uncompressed.js', 'media/system/js/', false);
} else {
JHTML::script('mootools.js', 'media/system/js/', false);
}
$loaded = true;
return;
}
function jquery() {
JHTML::script('jquery.js','media/system/js/',false);
}
function caption() {
JHTML::script('caption.js');
}
function formvalidation() {
JHTML::script('validate.js' );
}
function switcher() {
JHTML::script('switcher.js' );
}
function combobox() {
JHTML::script('combobox.js' );
}
function tooltip($selector='.hasTip', $params = array())
{
static $tips;
if (!isset($tips)) {
$tips = array();
}
// Include mootools framework
JHTMLBehavior::mootools();
$sig = md5(serialize(array($selector, $params)));
if (isset($tips[$sig]) && ($tips[$sig])) {
return;
}
// Setup options object
$opt['maxTitleChars'] = (isset($params['maxTitleChars']) && ($params['maxTitleChars'])) ? (int)$params['maxTitleChars'] : 50 ;
// offsets needs an array in the format: array('x'=>20, 'y'=>30)
$opt['offsets'] = (isset($params['offsets']) && (is_array($params['offsets']))) ? $params['offsets'] : null;
$opt['showDelay'] = (isset($params['showDelay'])) ? (int)$params['showDelay'] : null;
$opt['hideDelay'] = (isset($params['hideDelay'])) ? (int)$params['hideDelay'] : null;
$opt['className'] = (isset($params['className'])) ? $params['className'] : null;
$opt['fixed'] = (isset($params['fixed']) && ($params['fixed'])) ? '\true' : '\false';
$opt['onShow'] = (isset($params['onShow'])) ? '\'.$params['onShow'] : null;
$opt['onHide'] = (isset($params['onHide'])) ? '\'.$params['onHide'] : null;
$options = JHTMLBehavior::_getJSObject($opt);
// Attach tooltips to document
$document =& JFactory::getDocument();
$tooltipInit = ' window. addEvent('domready', function(){ var JTooltips = new Tips($$(.$selector.), '.$options.'); });';
$document->addScriptDeclaration($tooltipInit);
// Set static array
$tips[$sig] = true;
return;
}
function modal($selector='a.modal', $params = array())
{
static $modals;
static $included;
$document =& JFactory::getDocument();
// Load the necessary files if they haven't yet been loaded
if (!isset($included)) {
// Load the javascript and css
JHTML::script('modal.js');
JHTML::stylesheet('modal.css');
$included = true;
}
if (!isset($modals)) {
$modals = array();
}
$sig = md5(serialize(array($selector, $params)));
if (isset($modals[$sig]) && ($modals[$sig])) {
return;
}
// Setup options object
$opt['ajaxOptions'] = (isset($params['ajaxOptions']) && (is_array($params['ajaxOptions']))) ? $params['ajaxOptions'] : null;
$opt['size'] = (isset($params['size']) && (is_array($params['size']))) ? $params['size'] : null;
$opt['onOpen'] = (isset($params['onOpen'])) ? $params['onOpen'] : null;
$opt['onClose'] = (isset($params['onClose'])) ? $params['onClose'] : null;
$opt['onUpdate'] = (isset($params['onUpdate'])) ? $params['onUpdate'] : null;
$opt['onResize'] = (isset($params['onResize'])) ? $params['onResize'] : null;
$opt['onMove'] = (isset($params['onMove'])) ? $params['onMove'] : null;
$opt['onShow'] = (isset($params['onShow'])) ? $params['onShow'] : null;
$opt['onHide'] = (isset($params['onHide'])) ? $params['onHide'] : null;
$options = JHTMLBehavior::_getJSObject($opt);
// Attach modal behavior to document
$document->addScriptDeclaration("
window. addEvent('domready', function() {
SqueezeBox. initialize(".$options.");
$$('".$selector."').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
SqueezeBox. fromElement(el);
});
});
});");
// Set static array
$modals[$sig] = true;
return;
}
function uploader($id='file-upload', $params = array())
{
JHTML::script('swf.js' );
JHTML::script('uploader.js' );
static $uploaders;
if (!isset($uploaders)) {
$uploaders = array();
}
if (isset($uploaders[$id]) && ($uploaders[$id])) {
return;
}
Tümünü Göster