Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -15,6 +15,7 @@ namespace IPS\cms\modules\front\pages;
|
||||
use IPS\cms\Categories;
|
||||
use IPS\cms\Pages\Folder;
|
||||
use IPS\cms\Pages\Page;
|
||||
use IPS\cms\Records;
|
||||
use IPS\Db;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Theme;
|
||||
@@ -47,12 +48,19 @@ class ajax extends \IPS\cms\modules\admin\pages\ajax
|
||||
try
|
||||
{
|
||||
$folder = Folder::load( Request::i()->container );
|
||||
$items = iterator_to_array(
|
||||
new ActiveRecordIterator(
|
||||
$items = [];
|
||||
foreach( new ActiveRecordIterator(
|
||||
Db::i()->select( '*', 'cms_pages', [ 'page_folder_id=?', $folder->id ] ),
|
||||
Page::class
|
||||
)
|
||||
);
|
||||
) as $item )
|
||||
{
|
||||
/* @var Page $item */
|
||||
if( $item->canView() )
|
||||
{
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
Output::i()->sendOutput( Theme::i()->getTemplate( 'widgets', 'cms', 'front' )->folderNavigationItems( $items ) );
|
||||
}
|
||||
catch( OutOfRangeException ){}
|
||||
@@ -64,7 +72,18 @@ class ajax extends \IPS\cms\modules\admin\pages\ajax
|
||||
try
|
||||
{
|
||||
$container = $containerClass::load( Request::i()->container );
|
||||
Output::i()->sendOutput( Theme::i()->getTemplate( 'widgets', 'cms', 'front' )->databaseNavigationItems( $container->getContentItems( null, null ) ) );
|
||||
$items = [];
|
||||
foreach( $container->getContentItems( null, null ) as $item )
|
||||
{
|
||||
/* Only show items that we can actually see, and if they're not pending deletion */
|
||||
/* @var Records $item */
|
||||
if( $item->canView() and $item->hidden() !== -2 )
|
||||
{
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
Output::i()->sendOutput( Theme::i()->getTemplate( 'widgets', 'cms', 'front' )->databaseNavigationItems( $items ) );
|
||||
}
|
||||
catch( OutOfRangeException ){}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,13 @@ class builder extends widgets
|
||||
protected function saveOrder() : void
|
||||
{
|
||||
parent::saveOrder();
|
||||
|
||||
/* Skip for global areas */
|
||||
if( isset( Request::i()->pageArea ) AND Request::i()->pageArea == Area::AREA_GLOBAL_FOOTER )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$page = Page::load( Request::i()->pageID );
|
||||
$page->postSaveArea();
|
||||
}
|
||||
@@ -119,6 +126,12 @@ class builder extends widgets
|
||||
*/
|
||||
public function getAreasFromDatabase( ?string $area=null ) : array
|
||||
{
|
||||
/* Global areas should always use the parent */
|
||||
if( isset( Request::i()->pageArea ) AND Request::i()->pageArea == Area::AREA_GLOBAL_FOOTER )
|
||||
{
|
||||
return parent::getAreasFromDatabase( $area );
|
||||
}
|
||||
|
||||
$page = Page::load( Request::i()->pageID );
|
||||
return $page->getAreasFromDatabase( $area );
|
||||
}
|
||||
@@ -131,6 +144,13 @@ class builder extends widgets
|
||||
*/
|
||||
public function saveArea( Area $area ) : void
|
||||
{
|
||||
/* Global areas should always use the parent */
|
||||
if( $area->id == Area::AREA_GLOBAL_FOOTER )
|
||||
{
|
||||
parent::saveArea( $area );
|
||||
return;
|
||||
}
|
||||
|
||||
$page = Page::load( Request::i()->pageID );
|
||||
$page->saveArea( $area );
|
||||
|
||||
|
||||
Reference in new issue
Block a user