78 lines
2.5 KiB
Plaintext
Executable File
78 lines
2.5 KiB
Plaintext
Executable File
//
|
|
// Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
|
//
|
|
// This library is free software; you can redistribute it and/or
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
// as published by the Free Software Foundation; either version 2.1 of
|
|
// the License, or (at your option) any later version.
|
|
//
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
//
|
|
// $Id: Search.pdl 1428 2007-01-24 12:39:56Z sskracic $
|
|
// $DateTime: 2004/08/17 23:15:09 $
|
|
model com.arsdigita.cms;
|
|
|
|
|
|
|
|
query searchCategoryObjects {
|
|
BigDecimal id;
|
|
|
|
do {
|
|
select m.object_id
|
|
from cat_object_category_map m,
|
|
cat_cat_subcat_trans_index cc
|
|
where cc.category_id in :ids
|
|
and cc.subcategory_id = m.category_id
|
|
and cc.n_paths <= :pathLimit
|
|
union
|
|
select i.item_id
|
|
from cat_object_category_map cm,
|
|
cat_cat_subcat_trans_index cc2,
|
|
cms_items i
|
|
where cc2.category_id in :ids
|
|
and cc2.subcategory_id = cm.category_id
|
|
and cm.object_id = i.parent_id
|
|
and cc2.n_paths <= :pathLimit
|
|
} map {
|
|
id = m.object_id;
|
|
}
|
|
}
|
|
|
|
// This might seem as a hack to get all content items and assets within
|
|
// a content section. Unfortunately, for assets the section_id is always
|
|
// empty, and we can't introduce dependencies on various ca_ tables here,
|
|
// to get all content assets within a content section. The workaround is
|
|
// to use security context information, which must point to the enclosing
|
|
// content page. It's safe to use this info, since the permission system
|
|
// is using it as well.
|
|
//
|
|
query getContentSectionItems {
|
|
BigDecimal itemID;
|
|
|
|
do {
|
|
select i.item_id
|
|
from content_sections s,
|
|
cms_items i
|
|
where s.pretty_name in :sectionName
|
|
and i.section_id = s.section_id
|
|
union
|
|
select o.object_id
|
|
from content_sections s2,
|
|
object_context o,
|
|
cms_items i2
|
|
where s2.pretty_name in :sectionName
|
|
and i2.section_id = s2.section_id
|
|
and o.context_id = i2.item_id
|
|
} map {
|
|
itemID = item_id;
|
|
}
|
|
}
|
|
|