| |
330 |
330 |
} |
| |
331 |
331 |
set local_name $path |
| |
332 |
332 |
} |
| |
333 |
333 |
} |
| |
334 |
334 |
|
| |
335 |
335 |
Package instproc resolve_request {-path} { |
| |
336 |
336 |
my instvar folder_id |
| |
337 |
337 |
#my log "--u [self args]" |
| |
338 |
338 |
[self class] instvar queryparm |
| |
339 |
339 |
set item_id 0 |
| |
340 |
340 |
|
| |
341 |
341 |
if {$path ne ""} { |
| |
342 |
342 |
|
| |
343 |
343 |
set item_id [::Generic::CrItem lookup -name $path -parent_id $folder_id] |
| |
344 |
344 |
my log "--try $path -> $item_id" |
| |
345 |
345 |
|
| |
346 |
346 |
if {$item_id == 0} { |
| |
347 |
347 |
my get_name_and_lang_from_path $path lang local_name |
| |
348 |
348 |
set name ${lang}:$local_name |
| |
349 |
349 |
set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id] |
| |
350 |
|
my log "--try $name -> $item_id" |
| |
|
350 |
my log "--try $name -> $item_id // ::Generic::CrItem lookup -name $name -parent_id $folder_id" |
| |
351 |
351 |
if {$item_id == 0 && $lang eq "file"} { |
| |
352 |
352 |
set item_id [::Generic::CrItem lookup -name image:$local_name -parent_id $folder_id] |
| |
353 |
353 |
my log "--try image:$local_name -> $item_id" |
| |
354 |
354 |
} |
| |
355 |
355 |
if {$item_id == 0} { |
| |
356 |
356 |
set nname [my normalize_name $name] |
| |
357 |
357 |
set item_id [::Generic::CrItem lookup -name $nname -parent_id $folder_id] |
| |
358 |
358 |
my log "--try $nname -> $item_id" |
| |
359 |
359 |
} |
| |
360 |
360 |
} |
| |
361 |
361 |
} |
| |
362 |
362 |
if {$item_id != 0} { |
| |
363 |
363 |
set revision_id [my query_parameter revision_id 0] |
| |
364 |
364 |
set [expr {$revision_id ? "item_id" : "revision_id"}] 0 |
| |
365 |
365 |
#my log "--instantiate item_id $item_id revision_id $revision_id" |
| |
366 |
366 |
set r [::Generic::CrItem instantiate -item_id $item_id -revision_id $revision_id] |
| |
367 |
367 |
$r destroy_on_cleanup |
| |
368 |
368 |
#my log "--instantiate done CONTENT\n[$r serialize]" |
| |
369 |
369 |
$r set package_id [namespace tail [self]] |
| |
370 |
370 |
return $r |