Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Implement same filterings when listing only one or N specific nodes, …
Browse files Browse the repository at this point in the history
…instead of browsing a folder.

Make shell_exec call silent on windows.
  • Loading branch information
cdujeu committed Apr 22, 2014
1 parent 41f21d4 commit 1b49bcf
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions core/src/plugins/access.fs/class.fsAccessDriver.php
Expand Up @@ -71,7 +71,7 @@ public function initRepository()
if (!is_dir($path."/".$recycle)) {
throw new AJXP_Exception("Cannot create recycle bin folder. Please check repository configuration or that your folder is writeable!");
} elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$attributes = shell_exec('attrib +H ' . escapeshellarg($path . "/" . $recycle));
@shell_exec('attrib +H ' . escapeshellarg($path . "/" . $recycle));
}
}
$dataTemplate = $this->repository->getOption("DATA_TEMPLATE");
Expand Down Expand Up @@ -780,8 +780,11 @@ public function switchAction($action, $httpVars, $fileVars)
if ($this->wrapperClassName == "fsAccessWrapper") {
$nonPatchedPath = fsAccessWrapper::unPatchPathForBaseDir($path);
}

if(!$selection->isEmpty() && !$selection->isUnique()){
// Backward compat
if($selection->isUnique() && strpos($selection->getUniqueFile(), "/") !== 0){
$selection->setFiles(array($dir . "/" . $selection->getUniqueFile()));
}
if(!$selection->isEmpty()){
$uniqueNodes = $selection->buildNodes($this->repository->driverInstance);
$parentAjxpNode = new AJXP_Node($this->urlBase."/", array());
if (AJXP_XMLWriter::$headerSent == "tree") {
Expand All @@ -790,7 +793,23 @@ public function switchAction($action, $httpVars, $fileVars)
AJXP_XMLWriter::renderAjxpHeaderNode($parentAjxpNode);
}
foreach($uniqueNodes as $node){
$nodeName = $node->getLabel();
if (!$this->filterNodeName($node->getPath(), $nodeName, $isLeaf, $lsOptions)) {
continue;
}
if (RecycleBinManager::recycleEnabled() && $node->getPath() == RecycleBinManager::getRecyclePath()) {
continue;
}
$node->loadNodeInfo(false, false, ($lsOptions["l"]?"all":"minimal"));
if (!empty($node->metaData["nodeName"]) && $node->metaData["nodeName"] != $nodeName) {
$node->setUrl(dirname($node->getUrl())."/".$node->metaData["nodeName"]);
}
if (!empty($node->metaData["hidden"]) && $node->metaData["hidden"] === true) {
continue;
}
if (!empty($node->metaData["mimestring_id"]) && array_key_exists($node->metaData["mimestring_id"], $mess)) {
$node->mergeMetadata(array("mimestring" => $mess[$node->metaData["mimestring_id"]]));
}
if($this->repository->hasContentFilter()){
$externalPath = $this->repository->getContentFilter()->externalPath($node);
$node->setUrl($this->urlBase.$externalPath);
Expand All @@ -799,9 +818,9 @@ public function switchAction($action, $httpVars, $fileVars)
}
AJXP_XMLWriter::close();
break;
}else if (!$selection->isEmpty() && $selection->isUnique()){
}/*else if (!$selection->isEmpty() && $selection->isUnique()){
$uniqueFile = $selection->getUniqueFile();
}
}*/

if ($this->getFilteredOption("REMOTE_SORTING")) {
$orderDirection = isSet($httpVars["order_direction"])?strtolower($httpVars["order_direction"]):"asc";
Expand Down Expand Up @@ -959,6 +978,11 @@ public function switchAction($action, $httpVars, $fileVars)
// There is a special sorting, cancel the reordering of files & folders.
if(isSet($orderField) && $orderField != "ajxp_label") $nodeType = "f";

if($this->repository->hasContentFilter()){
$externalPath = $this->repository->getContentFilter()->externalPath($node);
$node->setUrl($this->urlBase.$externalPath);
}

$fullList[$nodeType][$nodeName] = $node;
$cursor ++;
if (isSet($uniqueFile) && $nodeName != $uniqueFile) {
Expand Down

0 comments on commit 1b49bcf

Please sign in to comment.