pa_is_type_in_package (private)
pa_is_type_in_package item_id content_type [ package_id ]
Defined in packages/photo-album/tcl/photo-album-procs.tcl
returns "t" if item_id is of the specified content_type and is a child of the root folder of the package, else returns "f"
- Parameters:
- item_id
content_type
package_id (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set root_folder [pa_get_root_folder $package_id] # I check for the case that item is the root_folder first because # this happens on the index page. Since index page accessed # often, and the root_folder is within the package this avoids an # unnecessary trip to the database on a commonly accessed page. if {$content_type eq "content_folder" && $item_id eq $root_folder} { return "t" } else { return [db_string check_is_type_in_package "select decode((select 1 from dual where exists (select 1 from cr_items where item_id = :root_folder connect by prior parent_id = item_id start with item_id = :item_id) and content_item.get_content_type(:item_id) = :content_type ), 1, 't', 'f') from dual" ] }Generic XQL file: packages/photo-album/tcl/photo-album-procs.xql
PostgreSQL XQL file: <fullquery name="pa_is_type_in_package.check_is_type_in_package"> <querytext> select exists (select 1 from cr_items i, cr_items i2 where i.item_id = :item_id and i.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) and i2.item_id = :root_folder ) and content_item__get_content_type(:item_id) = :content_type </querytext> </fullquery>packages/photo-album/tcl/photo-album-procs-postgresql.xql
Oracle XQL file: <fullquery name="pa_is_type_in_package.check_is_type_in_package"> <querytext> select case when (select 1 from dual where exists (select 1 from cr_items where item_id = :root_folder connect by prior parent_id = item_id start with item_id = :item_id) and content_item.get_content_type(:item_id) = :content_type ) = 1 then 't' else 'f' end from dual </querytext> </fullquery>packages/photo-album/tcl/photo-album-procs-oracle.xql