Notice: Undefined variable: rows in scheduler_list() (line 441 of /var/www/staging/7/html/sites/all/modules/scheduler/scheduler.module).

The attached patch will fix that, as well as update the code comment for the function for the new location of the tab.

Comments

jonathan1055’s picture

Tested and this works.

Richard, do you know if there are any extra settings when returning the $build array with 'table' to re-create the tablesort headers like we had in D6. I'm sure this functionality must be in D7 and there should be a neat way of doing it with the new return value.

jonathan1055’s picture

StatusFileSize
new554.09 KB

I've also worked out a new db_query for that sql. Change

  $sql = 'SELECT n.nid, n.uid, n.status, u.name, n.title, s.publish_on, s.unpublish_on FROM {scheduler} s LEFT JOIN {node} n ON s.nid = n.nid LEFT JOIN {users} u ON n.uid = u.uid';// . tablesort_sql($header);
  $result = db_query($sql);

to

  $query = db_select('scheduler', 's');
  $query->addJoin('LEFT ', 'node', 'n', 's.nid = n.nid');
  $query->addJoin('LEFT ', 'users', 'u', 'u.uid = n.uid');
  $query->addField('s', 'publish_on');
  $query->addField('s', 'unpublish_on');
  $query->addField('n', 'nid');
  $query->addField('n', 'uid');
  $query->addField('n', 'status');
  $query->addField('n', 'title');
  $query->addField('u', 'name');
  $query = $query
  ->extend('TableSort')
  ->orderByHeader($header);
  $result = $query->execute();

Attached is a screen grab showing that is produces the same result. Makes sense for you to add it to your patch, instead of me making another on top. It does not solve the tablesort yet, though.

[edit: I found the tablesort extender, as added it above, very nice and easy]

sillygwailo’s picture

Title: Notice on scheduled content list when nothing is scheduled » Notice on scheduled content list, table sort, use D7's abstraction layer on the content list query
StatusFileSize
new1.31 KB

Updating my patch with Jonathan's query changes.

jonathan1055’s picture

I've just found out that you can add many fields from one table in one go. Use 'fields' instead of 'addField'
For example: $query->fields('s', array('publish_on', 'unpublish_on'));

sillygwailo’s picture

sillygwailo’s picture

The following patch should add back the pager too. I tested this with 2 nodes and setting the pager to 1 (one) instead of 50 (fifty) as I have it in the patch.

sillygwailo’s picture

Title: Notice on scheduled content list, table sort, use D7's abstraction layer on the content list query » Notice on scheduled content list, table sort, use D7's abstraction layer on the content list query, add back pager
Priority: Minor » Normal
Status: Active » Needs review
eric-alexander schaefer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.