Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The new FileTree reload via Ajax did not work correctly (#2142)

  • Loading branch information...
commit c75034f1a46311a2ce8661e60728eb4a95106640 1 parent 88123f7
@leofeyer leofeyer authored
View
1  CHANGELOG.txt
@@ -19,6 +19,7 @@ Version 2.9.0 (2010-XX-XX)
- Fixed: "save and back" redirected back to the themes list when editing a style (#2110)
- Fixed: the style sheet files were not correctly updated in some cases (#2169)
- Fixed: the style sheet importer did not support multiple position units (#2107)
+- Fixed: the new FileTree reload via Ajax did not work correctly (#2142)
- Fixed a few minor issues
Version 2.9.RC1 (2010-06-06)
View
34 system/modules/backend/Ajax.php
@@ -255,13 +255,39 @@ public function executePostActions(DataContainer $dc)
$objWidget = new $GLOBALS['BE_FFL']['fileTree']($arrData, $dc);
- // Fallback to the files directory (reload filetrees)
- if ($this->Input->post('folder', true) == '')
+ // Load a particular node
+ if ($this->Input->post('folder', true) != '')
{
- $this->Input->setPost('folder', $GLOBALS['TL_CONFIG']['uploadPath']);
+ echo $objWidget->generateAjax($this->Input->post('folder', true), $this->Input->post('field'), intval($this->Input->post('level')));
+ exit; break;
}
- echo $objWidget->generateAjax($this->Input->post('folder', true), $this->Input->post('field'), intval($this->Input->post('level')));
+ // Reload the whole tree
+ $this->import('BackendUser', 'User');
+ $tree = '';
+
+ // Set a custom path
+ if (strlen($GLOBALS['TL_DCA'][$dc->table]['fields'][$this->Input->post('field')]['eval']['path']))
+ {
+ $tree = $objWidget->generateAjax($GLOBALS['TL_DCA'][$dc->table]['fields'][$this->Input->post('field')]['eval']['path'], $this->Input->post('field'), intval($this->Input->post('level')));
+ }
+
+ // Start from root
+ elseif ($this->User->isAdmin)
+ {
+ $tree = $objWidget->generateAjax($GLOBALS['TL_CONFIG']['uploadPath'], $this->Input->post('field'), intval($this->Input->post('level')));
+ }
+
+ // Set filemounts
+ else
+ {
+ foreach ($this->eliminateNestedPaths($this->User->filemounts) as $node)
+ {
+ $tree .= $objWidget->generateAjax($node, $this->Input->post('field'), intval($this->Input->post('level')), true);
+ }
+ }
+
+ echo $tree;
exit; break;
// Upload files via FancyUpload
View
9 system/modules/backend/FileTree.php
@@ -142,7 +142,7 @@ public function generate()
$this->varValue = array($this->varValue);
}
- // Set custom path
+ // Set a custom path
if (strlen($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['path']))
{
$tree = $this->renderFiletree(TL_ROOT . '/' . $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['path'], 0);
@@ -188,9 +188,10 @@ public function generate()
* @param string
* @param string
* @param integer
+ * @param boolean
* @return string
*/
- public function generateAjax($folder, $strField, $level)
+ public function generateAjax($folder, $strField, $level, $mount=false)
{
if (!$this->Input->post('isAjax'))
{
@@ -201,7 +202,7 @@ public function generateAjax($folder, $strField, $level)
if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'] == 'File')
{
- return $this->renderFiletree(TL_ROOT.'/'.$folder, ($level * 20));
+ return $this->renderFiletree(TL_ROOT.'/'.$folder, ($level * 20), $mount);
}
$this->import('Database');
@@ -223,7 +224,7 @@ public function generateAjax($folder, $strField, $level)
$this->varValue = array($this->varValue);
}
- return $this->renderFiletree(TL_ROOT.'/'.$folder, ($level * 20));
+ return $this->renderFiletree(TL_ROOT.'/'.$folder, ($level * 20), $mount);
}
Please sign in to comment.
Something went wrong with that request. Please try again.