Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
c3af73ef
Commit
c3af73ef
authored
Jun 06, 2009
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#302268
by Berdir, Dave Reid, tizzo, Ryan Palmer: TableSort and PagerQueries broken.
parent
d532753c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
30 deletions
+18
-30
modules/comment/comment.admin.inc
modules/comment/comment.admin.inc
+4
-5
modules/dblog/dblog.admin.inc
modules/dblog/dblog.admin.inc
+10
-19
modules/poll/poll.pages.inc
modules/poll/poll.pages.inc
+4
-6
No files found.
modules/comment/comment.admin.inc
View file @
c3af73ef
...
...
@@ -66,19 +66,18 @@ function comment_admin_overview($type = 'new', $arg) {
'operations'
=>
array
(
'data'
=>
t
(
'Operations'
)),
);
$query
=
db_select
(
'comment'
,
'c'
);
$query
=
db_select
(
'comment'
,
'c'
)
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
;
$query
->
join
(
'users'
,
'u'
,
'u.uid = c.uid'
);
$query
->
join
(
'node'
,
'n'
,
'n.nid = c.nid'
);
$query
->
addField
(
'u'
,
'name'
,
'registered_name'
);
$query
->
addField
(
'n'
,
'title'
,
'node_title'
);
$query
$result
=
$query
->
fields
(
'c'
,
array
(
'subject'
,
'nid'
,
'cid'
,
'comment'
,
'timestamp'
,
'status'
,
'name'
,
'homepage'
))
->
fields
(
'u'
,
array
(
'uid'
))
->
condition
(
'c.status'
,
$status
)
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
->
limit
(
50
)
->
orderByHeader
(
$header
)
;
$result
=
$query
->
execute
();
->
orderByHeader
(
$header
)
->
execute
();
// Build a table listing the appropriate comments.
...
...
modules/dblog/dblog.admin.inc
View file @
c3af73ef
...
...
@@ -51,7 +51,7 @@ function dblog_overview() {
$build
[
'dblog_clear_log_form'
]
=
drupal_get_form
(
'dblog_clear_log_form'
);
$header
=
array
(
'
'
,
''
,
// Icon column.
array
(
'data'
=>
t
(
'Type'
),
'field'
=>
'w.type'
),
array
(
'data'
=>
t
(
'Date'
),
'field'
=>
'w.wid'
,
'sort'
=>
'desc'
),
t
(
'Message'
),
...
...
@@ -59,26 +59,18 @@ function dblog_overview() {
array
(
'data'
=>
t
(
'Operations'
)),
);
$query
=
db_select
(
'watchdog'
,
'w'
);
$query
=
db_select
(
'watchdog'
,
'w'
)
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
;
$query
->
join
(
'users'
,
'u'
,
'w.uid = u.uid'
);
$query
->
fields
(
'w'
,
array
(
'wid'
,
'uid'
,
'severity'
,
'type'
,
'timestamp'
,
'message'
,
'variables'
,
'link'
))
->
addField
(
'u'
,
'name'
);
if
(
!
empty
(
$filter
[
'where'
]))
{
$query
->
where
(
$filter
[
'where'
],
$filter
[
'args'
])
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
->
limit
(
50
,
0
)
->
orderByHeader
(
$header
);
$result
=
$query
->
execute
();
}
else
{
$query
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
->
limit
(
50
)
->
orderByHeader
(
$header
);
$result
=
$query
->
execute
();
$query
->
where
(
$filter
[
'where'
],
$filter
[
'args'
]);
}
$result
=
$query
->
limit
(
50
)
->
orderByHeader
(
$header
)
->
execute
();
foreach
(
$result
as
$dblog
)
{
$rows
[]
=
array
(
'data'
=>
...
...
@@ -120,16 +112,15 @@ function dblog_top($type) {
$count_query
->
addExpression
(
'COUNT(DISTINCT(message))'
);
$count_query
->
condition
(
'type'
,
$type
);
$query
=
db_select
(
'watchdog'
,
'w'
);
$query
=
db_select
(
'watchdog'
,
'w'
)
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
;
$query
->
addExpression
(
'COUNT(wid)'
,
'count'
);
$query
=
$query
->
fields
(
'w'
,
array
(
'message'
,
'variables'
))
->
condition
(
'w.type'
,
$type
)
->
groupBy
(
'message'
)
->
groupBy
(
'variables'
)
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
->
limit
(
30
);
$query
=
$query
->
orderByHeader
(
$header
);
->
limit
(
30
)
->
orderByHeader
(
$header
);
$query
->
setCountQuery
(
$count_query
);
$result
=
$query
->
execute
();
...
...
modules/poll/poll.pages.inc
View file @
c3af73ef
...
...
@@ -58,19 +58,17 @@ function poll_votes($node) {
$header
[]
=
array
(
'data'
=>
t
(
'Vote'
),
'field'
=>
'pc.chtext'
);
$header
[]
=
array
(
'data'
=>
t
(
'Timestamp'
),
'field'
=>
'pv.timestamp'
,
'sort'
=>
'desc'
);
$select
=
db_select
(
'poll_vote'
,
'pv'
);
$select
=
db_select
(
'poll_vote'
,
'pv'
)
->
extend
(
'PagerDefault'
)
->
extend
(
'TableSort'
)
;
$select
->
join
(
'poll_choice'
,
'pc'
,
'pv.chid = pc.chid'
);
$select
->
join
(
'users'
,
'u'
,
'pv.uid = u.uid'
);
$queried_votes
=
$select
->
fields
(
'pv'
,
array
(
'chid'
,
'uid'
,
'hostname'
,
'timestamp'
,
'nid'
))
$queried_votes
=
$select
->
fields
(
'pv'
,
array
(
'chid'
,
'uid'
,
'hostname'
,
'timestamp'
,
'nid'
))
->
fields
(
'pc'
,
array
(
'chtext'
))
->
fields
(
'u'
,
array
(
'name'
))
->
condition
(
'pv.nid'
,
$node
->
nid
)
->
extend
(
'PagerDefault'
)
->
limit
(
$votes_per_page
)
->
extend
(
'TableSort'
)
->
orderByHeader
(
$header
)
->
execute
()
->
fetchAllAssoc
(
'hostname'
);
->
execute
();
$rows
=
array
();
foreach
(
$queried_votes
as
$vote
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment