updates for #1701 - default order by file type and title

This commit is contained in:
tomash 2006-06-23 13:51:18 +00:00
parent abec16906c
commit 3276ae4108

View file

@ -310,8 +310,8 @@ class DataEngine{
$desc = (isset($criteria['desc']) ? $criteria['desc'] : NULL); $desc = (isset($criteria['desc']) ? $criteria['desc'] : NULL);
$conditions = (isset($criteria['conditions']) ? $criteria['conditions'] : array()); $conditions = (isset($criteria['conditions']) ? $criteria['conditions'] : array());
$whereArr = $this->_makeWhereArr($conditions); $whereArr = $this->_makeWhereArr($conditions);
$orderbyQn = $orderbyQn = // default is dc:title
(isset($criteria['orderby']) ? $criteria['orderby'] : NULL); (isset($criteria['orderby']) ? $criteria['orderby'] : 'dc:title' /*NULL*/);
$obSplitQn = XML_Util::splitQualifiedName($orderbyQn); $obSplitQn = XML_Util::splitQualifiedName($orderbyQn);
$obNs = $obSplitQn['namespace']; $obNs = $obSplitQn['namespace'];
$orderby = $obSplitQn['localPart']; $orderby = $obSplitQn['localPart'];
@ -339,13 +339,13 @@ class DataEngine{
if(!$browse && $orderby){ if(!$browse && $orderby){
$retype = ($orderby == 'mtime' ? '::timestamp with time zone' : '' ); $retype = ($orderby == 'mtime' ? '::timestamp with time zone' : '' );
$sql = $sql =
"SELECT to_hex(sq2.gunid)as gunid, m.object, sql2.ftype, sql2.id\n". "SELECT to_hex(sq2.gunid)as gunid, m.object, sq2.ftype, sq2.id\n".
"FROM (\n$sql\n)sq2\n". "FROM (\n$sql\n)sq2\n".
"LEFT JOIN ls_mdata m\n". "LEFT JOIN ls_mdata m\n".
" ON m.gunid = sq2.gunid AND m.predicate='$orderby'". " ON m.gunid = sq2.gunid AND m.predicate='$orderby'".
" AND m.objns='_L' AND m.predxml='T'". " AND m.objns='_L' AND m.predxml='T'".
(!is_null($obNs)? " AND m.predns='$obNs'":'')."\n". (!is_null($obNs)? " AND m.predns='$obNs'":'')."\n".
"ORDER BY m.object".$retype.($desc? ' DESC':'')."\n"; "ORDER BY sq2.ftype, m.object".$retype.($desc? ' DESC':'')."\n";
} }
// echo "\n---\n$sql\n---\n"; // echo "\n---\n$sql\n---\n";
$cnt = $this->_getNumRows($sql); $cnt = $this->_getNumRows($sql);