public ElFinderDirectory <String> ElMakeDirectory(ElFinderWorkingDirectory <String> current, string name)
        {
            var path       = current.Id.DecodePath();
            var controller = GetCurrentStoreInterface(path);

            return(controller.ElMakeDirectory(current, name));
        }
        public ElFinderDirectory <string> ElMakeDirectory(ElFinderWorkingDirectory <string> current, string name)
        {
            var path = current.Id.DecodePath();

            if (path.StartsWith(_workDirName))            //определение корневой папки в случае если их несколько в принципе можно реализовать класс, который будет реализовывать подключение нужных IElFinderStoreInterface в зависимости от папки, реализация думаю будет не сложна
            {
                path = Path.Combine(TranslatePath(_workDirName, _workDirPath, path), name);
                //! todo проверка прав и проверка существования
                return(GetEntry(_workDirName, _workDirPath, Directory.CreateDirectory(path)));
            }
            throw new ArgumentException("Неопределена корневая директория");
        }
        public IEnumerable <ElFinderContent <string> > ElGetList(string id, ElFinderListMode mode, out ElFinderWorkingDirectory <string> current)
        {
            var result = new List <ElFinderContent <string> >();

            //папка по умолчанию обязательна для указания в качестве текущей
            current = new ElFinderWorkingDirectory <string>(new ElFinderDirectory <string>(_workDirName.EncodePath())
            {
                Name     = _workDirName,
                DateTime = DateTime.Now,
                Rights   = ElFinderRights.Read
            }, _workDirName, new Uri("/files/", UriKind.Relative), new Uri("/files/tmb/", UriKind.Relative));

            if (!String.IsNullOrEmpty(id))
            {
                var relPath = id.DecodePath();
                if (relPath.StartsWith(_workDirName))                //определение корневой папки в случае если их несколько в принципе можно реализовать класс, который будет реализовывать подключение нужных IElFinderStoreInterface в зависимости от папки, реализация думаю будет не сложна
                {
                    var path = TranslatePath(_workDirName, _workDirPath, relPath);

                    //определение текущей папки для вывода
                    current = new ElFinderWorkingDirectory <string>(GetEntry(_workDirName, _workDirPath, new DirectoryInfo(path)), relPath, new Uri("/files/", UriKind.Relative), new Uri("/files/tmb/", UriKind.Relative));

                    if (mode.HasFlag(ElFinderListMode.Children))                    //вывести список папки
                    {
                        result.AddRange(Directory.GetDirectories(path).Select(d => GetEntry(_workDirName, _workDirPath, new DirectoryInfo(d))));
                        result.AddRange(Directory.GetFiles(path).Select(d => GetEntry(_workDirName, _workDirPath, new FileInfo(d))));
                    }

                    if (mode.HasFlag(ElFinderListMode.Parents))                    //вывод указанной папки и родительских для нее
                    {
                        result.Add(GetEntry(_workDirName, _workDirPath, new DirectoryInfo(path)));
                        if (!path.Equals(_workDirPath))
                        {
                            result.Add(GetEntry(_workDirName, _workDirPath, new DirectoryInfo(path).Parent));
                        }
                    }

                    if (mode.HasFlag(ElFinderListMode.ParentsToRoot))                    //вывести все родительские папки вплоть до корневой, иначе будет запрос через Parents
                    {
                    }
                }
            }
            if (mode.HasFlag(ElFinderListMode.Root))                          //вывести корневые папки
            {
                if (!result.Any(c => c.Id.Equals(_workDirName.EncodePath()))) //не выводить повторно если уже выведена
                {
                    result.Add(GetEntry(_workDirName, _workDirPath, new DirectoryInfo(_workDirPath)));
                }
            }
            return(result);
        }
Пример #4
0
 private KeyValuePair <String, Object> ElOptions(ElFinderWorkingDirectory <TI> current, IEnumerable <String> createArchives, IEnumerable <String> extractArchives)
 {
     return(new KeyValuePair <string, object>("options", new Dictionary <String, Object>
     {
         { "archives", new Dictionary <String, Object> {
               { "create", createArchives }, { "extract", extractArchives }
           } },
         { "copyOverwrite", true },
         { "disabled", new string[] {} },
         { "path", current.Path },
         { "separator", "/" },
         { "tmbUrl", current.ThumbUrl },
         { "url", current.FilesUrl }
     }));
 }
 public IEnumerable <ElFinderContent <String> > ElExtract(ElFinderFile <String> file, ElFinderWorkingDirectory <String> destination)
 {
     throw new NotImplementedException();
 }
 public ElFinderFile <String> ElArchive(ElFinderWorkingDirectory <String> destination, String type, IEnumerable <ElFinderContent <String> > targets)
 {
     throw new NotImplementedException();
 }
 public IEnumerable <ElFinderContent <String> > ElCopy(IEnumerable <ElFinderContent <String> > targets, ElFinderWorkingDirectory <String> destination, bool move)
 {
     throw new NotImplementedException();
 }
 public ElFinderFile <String> ElMakeFile(ElFinderWorkingDirectory <String> current, string name)
 {
     throw new NotImplementedException();
 }
        public IEnumerable <ElFinderContent <String> > ElGetList(String id, ElFinderListMode mode, out ElFinderWorkingDirectory <String> current)
        {
            var result = new List <ElFinderContent <string> >();
            ElFinderWorkingDirectory <String> tcurrent;

            var controller = String.IsNullOrEmpty(id) ? _controllers.Values.First() : GetCurrentStoreInterface(id.DecodePath());

            result.AddRange(controller.ElGetList(id, mode, out current));

            if (mode.HasFlag(ElFinderListMode.Root))
            {
                result.AddRange(_controllers.Values.Where(v => !v.Equals(controller)).SelectMany(c => c.ElGetList(String.Empty, ElFinderListMode.Root, out tcurrent)));
            }
            return(result);
        }