From d3379bc32379271dca1125581ef4b6a332e3e1c6 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Tue, 16 Dec 2008 10:37:03 +0000 Subject: [PATCH] Make it possible to sort_on 'translated_portal_type'. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24904 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../WebSection_zGetDocumentValueList.xml | 74 ++++++++++++++----- bt5/erp5_web/bt/revision | 2 +- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml index 7515460146..9bf78ae64c 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml @@ -94,10 +94,10 @@ </item> <item> <key> <string>arguments_src</string> </key> - <value> <string>language\r\n -all_languages\r\n -all_versions\r\n -validation_state:list\r\n + <value> <string>language\n +all_languages\n +all_versions\n +validation_state:list\n kw</string> </value> </item> <item> @@ -138,7 +138,10 @@ kw</string> </value> <key> <string>src</string> </key> <value> <string encoding="cdata"><![CDATA[ -<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), validation_state=validation_state, **kw)">\n +<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw),\n + validation_state=validation_state, **kw)"\n + is_translation_order_by="query[\'order_by_expression\'] is not None and\n + query[\'order_by_expression\'].startswith(\'related_translation_0.\')">\n \n <dtml-comment>\n Currently, there is no other choice to implement this method as an SQL catalog until SQLCatalog \n @@ -152,8 +155,12 @@ SELECT\n catalog.path AS path, catalog.uid AS uid, catalog.modification_date,\n catalog.reference, catalog.int_index, catalog.creation_date , catalog.title, \n catalog.priority\n + <dtml-if is_translation_order_by> \n + ,catalog.translated_message\n + </dtml-if>\n +\n FROM\n - (\n + (\n SELECT\n catalog.uid, catalog.path, catalog.int_index, catalog.modification_date,\n catalog.reference, my_versioning.language, my_versioning.version,\n @@ -163,11 +170,17 @@ FROM\n WHEN \'en\' THEN \'2\'\n ELSE \'1\' END,\n my_versioning.version)) AS priority\n + <dtml-if is_translation_order_by>\n + ,related_translation_intermediate.translated_message\n + </dtml-if>\n FROM\n <dtml-in prefix="table" expr="query[\'from_table_list\']">\n <dtml-var table_item> AS <dtml-var table_key>,\n </dtml-in>\n versioning AS my_versioning\n + <dtml-if is_translation_order_by>\n + ,translation AS related_translation_intermediate\n + </dtml-if>\n WHERE\n my_versioning.uid = catalog.uid\n <dtml-if "query[\'where_expression\']">\n @@ -197,14 +210,18 @@ FROM\n WHEN \'en\' THEN \'2\'\n ELSE \'1\' END,\n my_versioning.version)) = catalog.priority\n -</dtml-if>\n - ORDER BY\n -<dtml-if "query[\'order_by_expression\']">\n - <dtml-var "query[\'order_by_expression\']">\n -<dtml-else>\n - catalog.int_index, catalog.reference\n </dtml-if>\n \n + ORDER BY\n + <dtml-if "query[\'order_by_expression\']">\n + <dtml-if is_translation_order_by>\n + <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n + <dtml-else>\n + <dtml-var "query[\'order_by_expression\']">\n + </dtml-if>\n + <dtml-else>\n + catalog.int_index, catalog.reference\n + </dtml-if>\n <dtml-if "query[\'limit_expression\']">\n LIMIT <dtml-var "query[\'limit_expression\']">\n <dtml-else>\n @@ -251,7 +268,10 @@ FROM\n <key> <string>raw</string> </key> <value> <string encoding="cdata"><![CDATA[ -<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), validation_state=validation_state, **kw)">\n +<dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw),\n + validation_state=validation_state, **kw)"\n + is_translation_order_by="query[\'order_by_expression\'] is not None and\n + query[\'order_by_expression\'].startswith(\'related_translation_0.\')">\n \n <dtml-comment>\n Currently, there is no other choice to implement this method as an SQL catalog until SQLCatalog \n @@ -265,8 +285,12 @@ SELECT\n catalog.path AS path, catalog.uid AS uid, catalog.modification_date,\n catalog.reference, catalog.int_index, catalog.creation_date , catalog.title, \n catalog.priority\n + <dtml-if is_translation_order_by> \n + ,catalog.translated_message\n + </dtml-if>\n +\n FROM\n - (\n + (\n SELECT\n catalog.uid, catalog.path, catalog.int_index, catalog.modification_date,\n catalog.reference, my_versioning.language, my_versioning.version,\n @@ -276,11 +300,17 @@ FROM\n WHEN \'en\' THEN \'2\'\n ELSE \'1\' END,\n my_versioning.version)) AS priority\n + <dtml-if is_translation_order_by>\n + ,related_translation_intermediate.translated_message\n + </dtml-if>\n FROM\n <dtml-in prefix="table" expr="query[\'from_table_list\']">\n <dtml-var table_item> AS <dtml-var table_key>,\n </dtml-in>\n versioning AS my_versioning\n + <dtml-if is_translation_order_by>\n + ,translation AS related_translation_intermediate\n + </dtml-if>\n WHERE\n my_versioning.uid = catalog.uid\n <dtml-if "query[\'where_expression\']">\n @@ -310,14 +340,18 @@ FROM\n WHEN \'en\' THEN \'2\'\n ELSE \'1\' END,\n my_versioning.version)) = catalog.priority\n -</dtml-if>\n - ORDER BY\n -<dtml-if "query[\'order_by_expression\']">\n - <dtml-var "query[\'order_by_expression\']">\n -<dtml-else>\n - catalog.int_index, catalog.reference\n </dtml-if>\n \n + ORDER BY\n + <dtml-if "query[\'order_by_expression\']">\n + <dtml-if is_translation_order_by>\n + <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n + <dtml-else>\n + <dtml-var "query[\'order_by_expression\']">\n + </dtml-if>\n + <dtml-else>\n + catalog.int_index, catalog.reference\n + </dtml-if>\n <dtml-if "query[\'limit_expression\']">\n LIMIT <dtml-var "query[\'limit_expression\']">\n <dtml-else>\n diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index e34fb7d853..1d88773811 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -716 \ No newline at end of file +727 \ No newline at end of file -- 2.30.9