|
From: Michael K. <ko...@us...> - 2006-01-03 09:36:27
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22566 Modified Files: PortalManagerImpl.java Log Message: Support for sub classes of portalpagehtml itemclass Index: PortalManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/PortalManagerImpl.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- PortalManagerImpl.java 7 Dec 2005 14:00:50 -0000 1.68 +++ PortalManagerImpl.java 3 Jan 2006 09:36:18 -0000 1.69 @@ -466,8 +466,8 @@ // and now look for a portalpage item that has the portalfolder // category assigned - String xpath = "/item[itemclass='portalpagehtml' and " - +"name='"+pageName+"'] and " + String xpath = "/item[itemclass~'portalpagehtml'] and " + +"/item[name='"+pageName+"'] and " +"/item/folders/category/id="+Integer.toString(c.getId()); List p = itemManager.searchItems(xpath); if (p != null && p.size()>0) { @@ -520,8 +520,8 @@ throw new CobricksException("portal", "nopath", ""); // check if the page already exits - String xpath = "/item[itemclass='portalpagehtml' and " - +"name='"+pageName+"'] and " + String xpath = "/item[itemclass~'portalpagehtml'] and " + +"/item[name='"+pageName+"'] and " +"/item/folders/category/id="+Integer.toString(c.getId()); List items = itemManager.searchItems(xpath); if (items != null && items.size()>0) @@ -692,8 +692,8 @@ throws CobricksException { // search for page items in this folder - String xpath_query = "/item[itemclass='portalpagehtml' and " - + " folders/category/id="+cid + "]"; + String xpath_query = "/item[itemclass~'portalpagehtml'] and " + + "/item[folders/category/id="+cid + "]"; List pages = itemManager.searchItems(xpath_query); for (int i = 0; i < pages.size(); i++) { PortalPage p = (PortalPage) pages.get(i); @@ -1131,16 +1131,16 @@ public List getPagesWithPageCategory(int pagecategory_id) { String xpathQuery = - "/item[itemclass=\"portalpagehtml\" " - +"and pagecategories/category/id=" + pagecategory_id + "]"; + "/item[itemclass~\"portalpagehtml\"] " + +"and /item[pagecategories/category/id=" + pagecategory_id + "]"; return itemManager.searchItems(xpathQuery); } public List getPagesWithPortalCategory(int portalcategory_id) { String xpathQuery = - "/item[itemclass=\"portalpagehtml\" " - +"and portalcategory/id=" + portalcategory_id + "]"; + "/item[itemclass~\"portalpagehtml\"] " + +"and /item[portalcategory/id=" + portalcategory_id + "]"; return itemManager.searchItems(xpathQuery); } @@ -1155,13 +1155,13 @@ searchWord = searchWord.toLowerCase(); String query = ""; if (searchInTitle == true) { - query = "/item[itemclass='portalpagehtml' and (" + + query = "/item[itemclass~'portalpagehtml'] and /item[(" + "contains(translate(content, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') or " + "contains(translate(navtitle, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') or " + "contains(translate(title, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "')" + ")]"; } else { - query = "/item[itemclass='portalpagehtml' and (" + + query = "/item[itemclass~'portalpagehtml'] and /item[(" + "contains(translate(content, 'ABCDEFGHIJKLMNOPSQRTUVWXYZ', 'abcdefghijklmnopsqrtuvwxyz'),'" + searchWord + "') )]"; } |