Difference between revisions of "JHTMLBehavior/uploader"
From Joomla! Documentation
< API15:JHTMLBehavior
(New page:
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{Description:JHTMLBehavior/upl...) |
m (preparing for archive only) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 87: | Line 86: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=uploader | category=uploader | ||
category=JHTMLBehavior | category=JHTMLBehavior | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Latest revision as of 19:39, 24 March 2017
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
uploader($id='file-upload', $params=array())
Parameter Name | Default Value | Description |
---|---|---|
$id | 'file-upload' | |
$params | array() |
Defined in[edit]
libraries/joomla/html/html/behavior.php
Importing[edit]
jimport( 'joomla.html.html.behavior' );
Source Body[edit]
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;
}
// Setup options object
$opt['url'] = (isset($params['targetURL'])) ? $params['targetURL'] : null ;
$opt['swf'] = (isset($params['swf'])) ? $params['swf'] : JURI::root(true).'/media/system/swf/uploader.swf';
$opt['multiple'] = (isset($params['multiple']) && !($params['multiple'])) ? '\\false' : '\\true';
$opt['queued'] = (isset($params['queued']) && !($params['queued'])) ? '\\false' : '\\true';
$opt['queueList'] = (isset($params['queueList'])) ? $params['queueList'] : 'upload-queue';
$opt['instantStart'] = (isset($params['instantStart']) && ($params['instantStart'])) ? '\\true' : '\\false';
$opt['allowDuplicates'] = (isset($params['allowDuplicates']) && !($params['allowDuplicates'])) ? '\\false' : '\\true';
$opt['limitSize'] = (isset($params['limitSize']) && ($params['limitSize'])) ? (int)$params['limitSize'] : null;
$opt['limitFiles'] = (isset($params['limitFiles']) && ($params['limitFiles'])) ? (int)$params['limitFiles'] : null;
$opt['optionFxDuration'] = (isset($params['optionFxDuration'])) ? (int)$params['optionFxDuration'] : null;
$opt['container'] = (isset($params['container'])) ? '\\$('.$params['container'].')' : '\\$(\''.$id.'\').getParent()';
$opt['types'] = (isset($params['types'])) ?'\\'.$params['types'] : '\\{\'All Files (*.*)\': \'*.*\'}';
// Optional functions
$opt['createReplacement'] = (isset($params['createReplacement'])) ? '\\'.$params['createReplacement'] : null;
$opt['onComplete'] = (isset($params['onComplete'])) ? '\\'.$params['onComplete'] : null;
$opt['onAllComplete'] = (isset($params['onAllComplete'])) ? '\\'.$params['onAllComplete'] : null;
/* types: Object with (description: extension) pairs, default: Images (*.jpg; *.jpeg; *.gif; *.png)
*/
$options = JHTMLBehavior::_getJSObject($opt);
// Attach tooltips to document
$document =& JFactory::getDocument();
$uploaderInit = 'sBrowseCaption=\''.JText::_('Browse Files', true).'\';
sRemoveToolTip=\''.JText::_('Remove from queue', true).'\';
window.addEvent(\'load\', function(){
var Uploader = new FancyUpload($(\''.$id.'\'), '.$options.');
$(\'upload-clear\').adopt(new Element(\'input\', { type: \'button\', events: { click: Uploader.clearList.bind(Uploader, [false])}, value: \''.JText::_('Clear Completed').'\' })); });';
$document->addScriptDeclaration($uploaderInit);
// Set static array
$uploaders[$id] = true;
return;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]