Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Apr 2, 2017
1 parent 48acb76 commit 330dcc0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
37 changes: 17 additions & 20 deletions plugins/editors/tinymce/field/uploaddirs.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

jimport('joomla.form.helper');

JFormHelper::loadFieldClass('list');
JFormHelper::loadFieldClass('folderlist');

/**
* Generates the list of directories available for drag and drop upload.
Expand All @@ -20,36 +20,33 @@
* @subpackage Editors.tinymce
* @since __DEPLOY_VERSION__
*/
class JFormFieldUploaddirs extends JFormFieldList
class JFormFieldUploaddirs extends JFormFieldFolderList
{
protected $type = 'uploaddirs';


public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);

// Get the path in which to search for file options.
$this->directory = JComponentHelper::getParams('com_media')->get('image_path');
$this->recursive = true;
$this->hideDefault = true;

return $return;
}

/**
* Method to get the directories options.
*
* @return array The skins option objects.
* @return array The dirs option objects.
*
* @since __DEPLOY_VERSION__
*/
public function getOptions()
{
$options = array();
$root = JComponentHelper::getParams('com_media')->get('image_path');


$directories = glob(JPATH_ROOT . '/' . $root . '/*', GLOB_ONLYDIR);

$options[] = JHtml::_('select.option', '', '');

for ($i = 0; $i < count($directories); ++$i)
{
$dir = basename($directories[$i]);
$options[] = JHtml::_('select.option', $i, $dir);
}

$options = array_merge(parent::getOptions(), $options);

return $options;
return parent::getOptions();
}

/**
Expand Down
10 changes: 2 additions & 8 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,15 +598,9 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons
// Get specific path
$tempPath = $levelParams->get('path', '');

if (!empty($tempPath))
if ($tempPath === '-1')
{
// List the skins
$uplloadDirs = glob(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path') . '/*', GLOB_ONLYDIR);

if ((int) $tempPath < count($uplloadDirs))
{
$tempPath = basename($uplloadDirs[(int) $tempPath - 1]);
}
$tempPath = '';
}

JText::script('PLG_TINY_ERR_UNSUPPORTEDBROWSER');
Expand Down

0 comments on commit 330dcc0

Please sign in to comment.