139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/milkode/cdweb/lib/database.rb', line 139
def fileList(base)
base_parts = base.split("/")
base_depth = base_parts.length
if (base_depth == 0)
return yaml_load.contents.sort_by{|v| v.name}.map{|v| [v.name, false] }
end
records = @documents.find_shortpath_below(base)
paths = records.map {|record|
DocumentRecord.new(record).shortpath.split("/")
}.find_all {|parts|
parts.length > base_depth && parts[0, base_depth] == base_parts
}.map {|parts|
[parts[0, base_depth + 1].join("/"), parts.length == base_depth + 1]
}.sort_by {|parts|
[parts[1] ? 1 : 0, parts[0].downcase] }.uniq
paths
end
|