0
@@ -78,103 +78,49 @@ class midcom_core_helpers_webdav extends HTTP_WebDAV_Server
0
function PROPFIND(&$options, &$files)
0
$_MIDCOM->authorization->require_user();
0
- $info = $this->get_path_info();
0
+ $controller = $this->controller;
0
+ $action_method = $this->action_method;
0
+ $controller->$action_method($this->route_id, $data, $this->action_arguments);
0
- if (
is_null($info['object']))
0
+ if (
!isset($data['children']))
0
- $this->logger->log("404 Not Found");
0
- throw new midcom_exception_notfound("Not found");
0
+ // Controller did not return children
0
+ $data['children'] = array();
0
- /*if (substr($_MIDCOM->dispatcher->argv[0], 0, 1) == '.')
0
- $this->logger->log("Skipping dotfile, object is {$info['object']->guid}");
0
- throw new midcom_exception_notfound("No dotfiles please");
0
- $this->get_files_page($info['object'], &$files);
0
- private function get_files_page($page, &$files)
0
- // Add the downloadable page itself
0
- $conf = $this->get_files_stub();
0
- $conf['props'][] = $this->mkprop('displayname', $page->title);
0
- $conf['props'][] = $this->mkprop('resourcetype', '');
0
- $conf['props'][] = $this->mkprop('getcontenttype', 'text/html');
0
- $conf['props'][] = $this->mkprop('getcontentlength', strlen($page->content));
0
- $conf['props'][] = $this->mkprop('getlastmodified', strtotime($page->metadata->revised));
0
- $conf['path'] = "{$_MIDCOM->context->prefix}__content.html";
0
- $files['files'][] = $conf;
0
- $conf = $this->get_files_stub();
0
- $conf['props'][] = $this->mkprop('displayname', $page->title);
0
- $conf['props'][] = $this->mkprop('resourcetype', '');
0
- $conf['props'][] = $this->mkprop('getcontenttype', 'text/xml');
0
- //$conf['props'][] = $this->mkprop('getcontentlength', strlen($page->serialize()));
0
- $conf['props'][] = $this->mkprop('getlastmodified', strtotime($page->metadata->revised));
0
- $conf['path'] = "{$_MIDCOM->context->prefix}__midgard_page.xml";
0
- $files['files'][] = $conf;
0
- $mc = midgard_page::new_collector('up', $page->id);
0
- $mc->set_key_property('name');
0
- $mc->add_value_property('title');
0
+ // Get children from component instance
0
+ $page = new midgard_page($_MIDCOM->context->page['guid']);
0
+ $data['children'] = array_merge
0
+ $_MIDCOM->context->component_instance->get_node_children($page)
0
- $guids = $mc->list_keys();
0
- foreach ($guids as $name => $array)
0
- $subpage = $this->get_files_stub();
0
- $subpage['props'][] = $this->mkprop('displayname', $mc->get_subkey($name, 'title'));
0
- $subpage['props'][] = $this->mkprop('resourcetype', 'collection');
0
- $subpage['props'][] = $this->mkprop('getcontenttype', 'httpd/unix-directory');
0
- $subpage['path'] = "{$_MIDCOM->context->prefix}{$name}/";
0
- $files['files'][] = $subpage;
0
+ // Convert children to PROPFIND elements
0
+ $this->children_to_files($data['children'], &$files);
0
- private function get_files_snippetdir($snippetdir_id, &$files)
0
+ private function children_to_files($children, &$files)
0
- $this->logger->log("Snippetdir {$snippetdir_id}");
0
- $mc = midgard_snippetdir::new_collector('up', $snippetdir_id);
0
- $mc->set_key_property('name');
0
- $guids = $mc->list_keys();
0
- foreach ($guids as $name => $array)
0
+ foreach ($children as $child)
0
- $page = $this->get_files_stub();
0
- $page['props'][] = $this->mkprop('displayname', $name);
0
- $page['props'][] = $this->mkprop('resourcetype', 'collection');
0
- $page['props'][] = $this->mkprop('getcontenttype', 'httpd/unix-directory');
0
- $page['path'] = "{$_MIDCOM->context->prefix}__snippets/{$name}/";
0
- $files['files'][] = $page;
0
+ 'path' => $child['uri'],
0
+ $child_props['props'][] = $this->mkprop('displayname', $child['title']);
0
+ $child_props['props'][] = $this->mkprop('resourcetype', $child['resource']);
0
+ $child_props['props'][] = $this->mkprop('getcontenttype', $child['mimetype']);
0
+ $files['files'][] = $child_props;
0
- private function get_files_stub()
Comments
No one has commented yet.