Use language for querying items in native sql lists
git-svn-id: https://svn.libreccm.org/ccm/trunk@4945 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
ed8aaeae5f
commit
3cfdff88ed
|
|
@ -33,7 +33,7 @@ public class SciProjectList extends AbstractComponent {
|
|||
+ "JOIN cms_pages ON cms_items.item_id = cms_pages.item_id "
|
||||
+ "JOIN content_types ON cms_items.type_id = content_types.type_id "
|
||||
+ "JOIN ct_sci_projects ON cms_items.item_id = ct_sci_projects.project_id "
|
||||
+ "WHERE parent_id IN (SELECT object_id FROM cat_object_category_map WHERE category_id = ?) AND version = 'live' %s"
|
||||
+ "WHERE parent_id IN (SELECT object_id FROM cat_object_category_map WHERE category_id = ?) AND language = ? AND version = 'live' %s"
|
||||
+ "%s"
|
||||
+ "LIMIT ? OFFSET ?";
|
||||
|
||||
|
|
@ -144,17 +144,19 @@ public class SciProjectList extends AbstractComponent {
|
|||
whereBuffer.toString(),
|
||||
orderBy));
|
||||
projectsQueryStatement.setString(1, categoryId);
|
||||
projectsQueryStatement.setInt(2, limit);
|
||||
projectsQueryStatement.setString(2, GlobalizationHelper
|
||||
.getNegotiatedLocale().getLanguage());
|
||||
projectsQueryStatement.setInt(3, limit);
|
||||
|
||||
if (request.getParameter("page") == null) {
|
||||
page = 1;
|
||||
projectsQueryStatement.setInt(3, 0);
|
||||
projectsQueryStatement.setInt(4, 0);
|
||||
offset = 0;
|
||||
} else {
|
||||
page = Integer.parseInt(request.getParameter("page"));
|
||||
offset = (page - 1) * limit;
|
||||
|
||||
projectsQueryStatement.setInt(3, offset);
|
||||
projectsQueryStatement.setInt(4, offset);
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.arsdigita.cms.contenttypes.Proceedings;
|
|||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.contenttypes.UnPublished;
|
||||
import com.arsdigita.cms.contenttypes.WorkingPaper;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.navigation.Navigation;
|
||||
import com.arsdigita.navigation.ui.AbstractComponent;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
|
|
@ -84,7 +85,7 @@ public class PublicationList extends AbstractComponent {
|
|||
+ "LEFT JOIN ct_unpublished ON ct_publications.publication_id = ct_unpublished.unpublished_id "
|
||||
+ "LEFT JOIN ct_grey_literature ON ct_unpublished.unpublished_id = ct_grey_literature.grey_literature_id "
|
||||
+ "%s"
|
||||
+ "WHERE parent_id IN (SELECT object_id FROM cat_object_category_map WHERE category_id = ?) AND version = 'live' %s"
|
||||
+ "WHERE parent_id IN (SELECT object_id FROM cat_object_category_map WHERE category_id = ?) AND language = ? AND version = 'live' %s"
|
||||
+ "%s "
|
||||
+ "LIMIT ? OFFSET ?";
|
||||
/**
|
||||
|
|
@ -355,17 +356,19 @@ public class PublicationList extends AbstractComponent {
|
|||
orderBy));
|
||||
|
||||
publicationsQueryStatement.setString(1, categoryId);
|
||||
publicationsQueryStatement.setInt(2, limit);
|
||||
publicationsQueryStatement.setString(2, GlobalizationHelper
|
||||
.getNegotiatedLocale().getLanguage());
|
||||
publicationsQueryStatement.setInt(3, limit);
|
||||
|
||||
if (request.getParameter("page") == null) {
|
||||
page = 1;
|
||||
publicationsQueryStatement.setInt(3, 0);
|
||||
publicationsQueryStatement.setInt(4, 0);
|
||||
offset = 0;
|
||||
} else {
|
||||
page = Integer.parseInt(request.getParameter("page"));
|
||||
offset = (page - 1) * limit;
|
||||
|
||||
publicationsQueryStatement.setInt(3, offset);
|
||||
publicationsQueryStatement.setInt(4, offset);
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue