/** * Returns true if the input "record" contains a folder which can be linked. * * @param array Array with information about the folder element. Contains keys like title, uid, path, _title * @return boolean True is returned if the path is found in the web-part of the the server and is NOT a recycler or temp folder */ function ext_isLinkable($v) { $webpath = t3lib_BEfunc::getPathType_web_nonweb($v['path']); if ($GLOBALS['SOBE']->act == 'magic') { return 1; } //$webpath='web'; // The web/non-web path does not matter if the mode is 'magic' if (strstr($v['path'], '_recycler_') || strstr($v['path'], '_temp_') || $webpath != 'web') { return 0; } return 1; }
function getFolderTree($files_path, $depth = 999, $depthData = "") { // This generates the directory tree $dirs = t3lib_div::get_dirs($files_path); // debug($dirs); $c = 0; if (is_array($dirs)) { $depth = intval($depth); $HTML = ""; $a = 0; $c = count($dirs); sort($dirs); while (list($key, $val) = each($dirs)) { $a++; $this->tree[] = array(); // Reserve space. end($this->tree); $treeKey = key($this->tree); // Get the key for this space $LN = $a == $c ? "blank" : "line"; $val = ereg_replace("^\\./", "", $val); $title = $val; $path = $files_path . $val . "/"; $webpath = t3lib_BEfunc::getPathType_web_nonweb($path); $md5_uid = md5($path); $specUID = hexdec(substr($md5_uid, 0, 6)); $this->specUIDmap[$specUID] = $path; $row = array(); $row["path"] = $path; $row["uid"] = $specUID; $row["title"] = $title; if ($depth > 1 && $this->expandNext($specUID)) { $nextCount = $this->getFolderTree($path, $depth - 1, $this->makeHTML ? $depthData . '<IMG src="' . $this->backPath . 't3lib/gfx/ol/' . $LN . '.gif">' : ''); $exp = 1; } else { $nextCount = $this->getFolderCount($path); $exp = 0; } // Set HTML-icons, if any: if ($this->makeHTML) { $HTML = $depthData . $this->PMicon($row, $a, $c, $nextCount, $exp); $icon = 'gfx/i/_icon_' . $webpath . 'folders.gif'; if ($val == "_temp_") { $icon = 'gfx/i/sysf.gif'; $row["title"] = "<b>TEMP</b>"; } if ($val == "_recycler_") { $icon = 'gfx/i/recycler.gif'; $row["title"] = "<b>RECYCLER</b>"; } $HTML .= $this->wrapIcon('<IMG src="' . $this->backPath . $icon . '">', $row); } $this->tree[$treeKey] = array("row" => $row, "HTML" => $HTML); } } return $c; }
/** * Fetches the data for the tree * * @param string Abs file path * @param integer Max depth (recursivity limit) * @return integer The count of items on the level * @see getBrowsableTree() */ function getFolderTree($files_path, $depth = 999, $type = '') { // This generates the directory tree $dirs = t3lib_div::get_dirs($files_path); if (!is_array($dirs)) { return 0; } sort($dirs); $c = count($dirs); $depth = intval($depth); $HTML = ''; $a = 0; foreach ($dirs as $key => $val) { $a++; $this->tree[] = array(); // Reserve space. end($this->tree); $treeKey = key($this->tree); // Get the key for this space $val = preg_replace('/^\\.\\//', '', $val); $title = $val; $path = $files_path . $val . '/'; $specUID = t3lib_div::md5int($path); $this->specUIDmap[$specUID] = $path; $row = array(); $row['path'] = $path; $row['uid'] = $specUID; $row['title'] = $title; // Make a recursive call to the next level if ($depth > 1 && $this->expandNext($specUID)) { $nextCount = $this->getFolderTree($path, $depth - 1, $this->makeHTML ? '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . ($a == $c ? 'blank' : 'line') . '.gif', 'width="18" height="16"') . ' alt="" />' : '', $type); $exp = 1; // Set "did expand" flag } else { $nextCount = $this->getCount($path); $exp = 0; // Clear "did expand" flag } // Set HTML-icons, if any: if ($this->makeHTML) { $HTML = $this->PMicon($row, $a, $c, $nextCount, $exp); $webpath = t3lib_BEfunc::getPathType_web_nonweb($path); if (is_writable($path)) { $type = ''; $overlays = array(); } else { $type = 'readonly'; $overlays = array('status-overlay-locked' => array()); } if ($webpath == 'web') { $icon = 'apps-filetree-folder-default'; } else { $icon = 'apps-filetree-folder-default'; } if ($val == '_temp_') { $icon = 'apps-filetree-folder-temp'; $row['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true); $row['_title'] = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true) . '</strong>'; } if ($val == '_recycler_') { $icon = 'apps-filetree-folder-recycler'; $row['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:recycler', true); $row['_title'] = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:recycler', true) . '</strong>'; } $HTML .= $this->wrapIcon(t3lib_iconWorks::getSpriteIcon($icon, array('title' => $row['title']), $overlays), $row); } // Finally, add the row/HTML content to the ->tree array in the reserved key. $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'hasSub' => $nextCount && $this->expandNext($specUID), 'isFirst' => $a == 1, 'isLast' => false, 'invertedDepth' => $depth, 'bank' => $this->bank); } if ($a) { $this->tree[$treeKey]['isLast'] = true; } return $c; }
/** * Returns true if the input "record" contains a folder which can be linked. * * @param array Array with information about the folder element. Contains keys like title, uid, path, _title * @return boolean True is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder */ function ext_isLinkable($v) { $webpath = t3lib_BEfunc::getPathType_web_nonweb($v['path']); // Checking, if the input path is a web-path. if (strstr($v['path'], '_recycler_') || strstr($v['path'], '_temp_') || $webpath != 'web') { return 0; } return 1; }
/** * Fetches the data for the tree * * @param string Abs file path * @param integer Max depth (recursivity limit) * @param string HTML-code prefix for recursive calls. * @return integer The count of items on the level * @see getBrowsableTree() */ function getFolderTree($files_path, $depth = 999, $depthData = '', $type = '') { // This generates the directory tree $dirs = t3lib_div::get_dirs($files_path); $c = 0; if (is_array($dirs)) { $depth = intval($depth); $HTML = ''; $a = 0; $c = count($dirs); sort($dirs); foreach ($dirs as $key => $val) { $a++; $this->tree[] = array(); // Reserve space. end($this->tree); $treeKey = key($this->tree); // Get the key for this space $LN = $a == $c ? 'blank' : 'line'; $val = preg_replace('/^\\.\\//', '', $val); $title = $val; $path = $files_path . $val . '/'; $webpath = t3lib_BEfunc::getPathType_web_nonweb($path); $md5_uid = md5($path); $specUID = hexdec(substr($md5_uid, 0, 6)); $this->specUIDmap[$specUID] = $path; $row = array(); $row['path'] = $path; $row['uid'] = $specUID; $row['title'] = $title; if ($depth > 1 && $this->expandNext($specUID)) { $nextCount = $this->getFolderTree($path, $depth - 1, $this->makeHTML ? $depthData . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' alt="" />' : '', $type); $exp = 1; // Set "did expand" flag } else { $nextCount = $this->getCount($path); $exp = 0; // Clear "did expand" flag } // Set HTML-icons, if any: if ($this->makeHTML) { $HTML = $depthData . $this->PMicon($row, $a, $c, $nextCount, $exp); $icon = 'gfx/i/_icon_' . $webpath . 'folders' . ($type == 'readonly' ? '_ro' : '') . '.gif'; if ($val == '_temp_') { $icon = 'gfx/i/sysf.gif'; $row['title'] = $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true); $row['_title'] = '<strong>' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true) . '</strong>'; } if ($val == '_recycler_') { $icon = 'gfx/i/recycler.gif'; $row['title'] = $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_file_list.xml:recycler', true); $row['_title'] = '<strong>' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_file_list.xml:recycler', true) . '</strong>'; } $HTML .= $this->wrapIcon('<img' . t3lib_iconWorks::skinImg($this->backPath, $icon, 'width="18" height="16"') . ' alt="" />', $row); } // Finally, add the row/HTML content to the ->tree array in the reserved key. $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'bank' => $this->bank); } } return $c; }