Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Pages Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Content
|
||||
* @since 15 Jan 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -55,23 +55,6 @@ class _pages extends \IPS\Node\Controller
|
||||
$nodeClass = $this->nodeClass;
|
||||
$buttons = array();
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'pages', 'page_add' ) )
|
||||
{
|
||||
$buttons['add_folder'] = array(
|
||||
'icon' => 'folder-open',
|
||||
'title' => 'content_add_folder',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&do=form' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_folder') )
|
||||
);
|
||||
|
||||
$buttons['add_page'] = array(
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'content_add_page',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&subnode=1&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_page') )
|
||||
);
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
@@ -146,6 +129,25 @@ class _pages extends \IPS\Node\Controller
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('cms_pages_settings') )
|
||||
);
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'pages', 'page_add' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['add_folder'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'folder-open',
|
||||
'title' => 'content_add_folder',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&do=form' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_folder') )
|
||||
);
|
||||
|
||||
\IPS\Output::i()->sidebar['actions']['add_page'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'content_add_page',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&subnode=1&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_page') )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -436,4 +438,36 @@ FILE;
|
||||
|
||||
return \IPS\cms\Pages\Folder::munge( $folders, $pages );
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect after save
|
||||
*
|
||||
* @param \IPS\Node\Model $old A clone of the node as it was before or NULL if this is a creation
|
||||
* @param \IPS\Node\Model $new The node now
|
||||
* @param string $lastUsedTab The tab last used in the form
|
||||
* @return void
|
||||
*/
|
||||
protected function _afterSave( \IPS\Node\Model $old = NULL, \IPS\Node\Model $new, $lastUsedTab = FALSE )
|
||||
{
|
||||
/* If this page was the default in a folder, and it was moved to a new folder that already has a default, we need to unset the
|
||||
default page flag or there will be two defaults in the destination folder */
|
||||
if( $old !== NULL AND $old->folder_id != $new->folder_id AND $old->default )
|
||||
{
|
||||
/* Is there already a default page in the new folder? */
|
||||
try
|
||||
{
|
||||
$existingDefault = \IPS\Db::i()->select( 'page_id', 'cms_pages', array( 'page_folder_id=? and page_default=?', $new->folder_id, 1 ) )->first();
|
||||
|
||||
\IPS\Db::i()->update( 'cms_pages', array( 'page_default' => 0 ), array( 'page_id=?', $new->id ) );
|
||||
|
||||
\IPS\cms\Pages\Page::buildPageUrlStore();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* No default found in destination folder, do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
parent::_afterSave( $old, $new, $lastUsedTab );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user