Changed how directories are processed when the parent directory is selected and

the branch was never opened on the client.  This should fix some of the issues
with the server_add as I was able to select the staging directory and then add
over 400 images in a multi-tier structure.

Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
This commit is contained in:
Tim Almdal
2009-06-10 07:23:30 +08:00
parent 3c3a65b5a7
commit b11ec14f24
@@ -87,17 +87,20 @@ class Server_Add_Controller extends Controller {
foreach (array_keys($paths) as $valid_path) {
$path_length = strlen($valid_path);
foreach ($input_files as $key => $path) {
if (!empty($path) && $valid_path != $path && strpos($path, $valid_path) === 0) {
$relative_path = substr(dirname($path), $path_length);
$name = basename($path);
$files[$valid_path][] = array("path" => $relative_path,
"parent_id" => $id, "name" => basename($path),
if (!empty($path)) {
if ($valid_path != $path && strpos($path, $valid_path) === 0) {
$relative_path = substr(dirname($path), $path_length);
$name = basename($path);
$files[$valid_path][] = array("path" => $relative_path,
"parent_id" => $id, "name" => basename($path),
"type" => is_dir($path) ? "album" : "file");
$total_count++;
$total_count++;
}
if ($collapsed[$key] === "true") {
$total_count += $this->_select_children($id, $valid_path, $path, $files[$valid_path]);
}
unset($input_files[$key]);
unset($collapsed[$key]);
}
}
}