| |
178 |
178 |
|
| |
179 |
179 |
lappend context_bar $final |
| |
180 |
180 |
|
| |
181 |
181 |
return $context_bar |
| |
182 |
182 |
} |
| |
183 |
183 |
|
| |
184 |
184 |
# |
| |
185 |
185 |
# Make sure we don't have page crashes due to unknown MIME types |
| |
186 |
186 |
# |
| |
187 |
187 |
|
| |
188 |
188 |
ad_proc fs_maybe_create_new_mime_type { |
| |
189 |
189 |
file_name |
| |
190 |
190 |
} { |
| |
191 |
191 |
The content repository expects the MIME type to already be defined |
| |
192 |
192 |
when you upload content. We use this procedure to add a new type |
| |
193 |
193 |
when we encounter something we haven't seen before. |
| |
194 |
194 |
} { |
| |
195 |
195 |
|
| |
196 |
196 |
set file_extension [string trimleft [file extension $file_name] "."] |
| |
197 |
197 |
|
| |
198 |
|
if {[empty_string_p $file_extension]} { |
| |
199 |
|
return "*/*" |
| |
200 |
|
} |
| |
|
198 |
# This case is now handled by the code below (Ben) |
| |
|
199 |
# if {[empty_string_p $file_extension]} { |
| |
|
200 |
# return "*/*" |
| |
|
201 |
#} |
| |
201 |
202 |
|
| |
202 |
203 |
if {![db_0or1row select_mime_type "select mime_type |
| |
203 |
204 |
from cr_mime_types |
| |
204 |
205 |
where file_extension = :file_extension"]} { |
| |
205 |
206 |
|
| |
206 |
|
# A mime type for this file extension does not exist |
| |
207 |
|
# in the database. Check to see AOLServer can |
| |
208 |
|
# generate a mime type. |
| |
|
207 |
# Ben: we've fixed this so that all AOLserver mime types |
| |
|
208 |
# are now part of the cr_mime_types. So we just return now |
| |
|
209 |
# or leave it at that. |
| |
209 |
210 |
|
| |
210 |
|
set mime_type [ns_guesstype $file_name] |
| |
211 |
|
|
| |
212 |
|
# Note: If AOLServer can't determine a mime type, |
| |
213 |
|
# ns_guesstype will return */*. We still record |
| |
214 |
|
# a mime type for this file extension. At a later |
| |
215 |
|
# date, the mime type for the file extension may be |
| |
216 |
|
# updated and, as a result, the files with that |
| |
217 |
|
# file extension will be associated with the |
| |
218 |
|
# proper mime types. |
| |
219 |
|
|
| |
220 |
|
db_dml new_mime_type { |
| |
221 |
|
insert into cr_mime_types |
| |
222 |
|
(mime_type, file_extension) |
| |
223 |
|
values |
| |
224 |
|
(:mime_type, :file_extension) |
| |
|
211 |
set mime_type "*/*" |
| |
225 |
212 |
} |
| |
226 |
|
} |
| |
|
213 |
|
| |
227 |
214 |
return $mime_type |
| |
228 |
215 |
} |
| |
229 |
216 |
|
| |
230 |
217 |
|
| |
231 |
218 |
|
| |
232 |
219 |
namespace eval fs { |
| |
233 |
220 |
|
| |
234 |
221 |
ad_proc -public new_root_folder { |
| |
235 |
222 |
{-package_id ""} |
| |
236 |
223 |
{-pretty_name ""} |
| |
237 |
224 |
{-description ""} |
| |
238 |
225 |
} { |
| |
239 |
226 |
Create a root folder for a package instance. |
| |
240 |
227 |
|
| |
241 |
228 |
@param package_id Package instance associated with this root folder |
| |
242 |
229 |
|
| |
243 |
230 |
@return folder_id of the new root folder |
| |
244 |
231 |
} { |
| |
245 |
232 |
if {[empty_string_p $package_id]} { |
| |
246 |
233 |
set package_id [ad_conn package_id] |