Skip to content

Commit

Permalink
Setting pages draft to other field type (NULL)
Browse files Browse the repository at this point in the history
  • Loading branch information
olafgleba committed Oct 10, 2011
1 parent 41974ba commit 1dadbb8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion welcompose/admin/content/pages_edit.php
Expand Up @@ -364,7 +364,7 @@
$sqlData['template_set'] = $FORM->exportValue('template_set');
$sqlData['index_page'] = $FORM->exportValue('index_page');
$sqlData['protect'] = $FORM->exportValue('protect');
$sqlData['draft'] = (string)intval($FORM->exportValue('draft'));
$sqlData['draft'] = $FORM->exportValue('draft');
$sqlData['exclude'] = $FORM->exportValue('exclude');
$sqlData['no_follow'] = $FORM->exportValue('no_follow');
$sqlData['sitemap_changefreq'] = $FORM->exportValue('sitemap_changefreq');
Expand Down
3 changes: 2 additions & 1 deletion welcompose/admin/content/pages_select.php
Expand Up @@ -134,7 +134,8 @@
foreach ($navigations as $_navigation) {
$select_params = array(
'navigation' => (int)$_navigation['id'],
'draft' => 1
'draft' => 1,
'exclude' => 1
);
$page_arrays[$_navigation['id']] = $PAGE->selectPages($select_params);
}
Expand Down
18 changes: 9 additions & 9 deletions welcompose/core/content_classes/page.class.php
Expand Up @@ -290,8 +290,8 @@ public function selectPage ($id)
* <li>type, int, optional: Page type id</li>
* <li>start, int, optional: row offset</li>
* <li>limit, int, optional: amount of rows to return</li>
* <li>exclude, int, optional: if set exclude page from navigation</li>
* <li>draft, int, optional: if set include pages with param draft</li>
* <li>exclude, int, optional: if set exclude page from navigation (only internal use)</li>
* <li>draft, int, optional: if set include pages with param draft (only internal use)</li>
* <li>protect, int, optional: if set exclude protected pages</li>
* </ul>
*
Expand Down Expand Up @@ -437,14 +437,14 @@ public function selectPages ($params = array())
if (!empty($protect) && is_numeric($protect)) {
$sql .= " AND `content_pages`.`protect` IS NULL ";
}
// Include only visible pages
if (!empty($exclude) && is_numeric($exclude)) {

// On default (var not set) include only visible pages
if (is_null($exclude)) {
$sql .= " AND `content_pages`.`exclude` IS NULL ";
}

// Include only result rows without drafts
if (is_null($draft) ) {
$sql .= " AND `content_pages`.`draft` = '0' ";
}
// On default (var not set) include only result rows without drafts
if (is_null($draft)) {
$sql .= " AND `content_pages`.`draft` IS NULL ";
}

// add sorting
Expand Down

0 comments on commit 1dadbb8

Please sign in to comment.