Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -1559,7 +1559,6 @@ class databases extends Controller
|
||||
}
|
||||
$pageValues['page_folder_id'] = $pageValues['page_folder_id'] ?: 0;
|
||||
$pageValues['page_name'] = $pageValues['page_name'] ?: $values['database_name'];
|
||||
$pageValues['page_ipb_wrapper'] = true;
|
||||
|
||||
if( $currentPage = $current->page )
|
||||
{
|
||||
@@ -1740,7 +1739,7 @@ class databases extends Controller
|
||||
|
||||
foreach( Page::formElements( $current?->page ) as $name => $field )
|
||||
{
|
||||
if( !in_array( $name, [ 'tab_details', 'tab_content', 'page_content', 'page_ipb_wrapper', 'page_wrapper_template', 'page_theme', 'page_template' ] ) )
|
||||
if( !in_array( $name, [ 'tab_details', 'page_theme', 'page_template', 'tab_content', 'page_content', 'page_ipb_wrapper', 'page_wrapper_template' ] ) )
|
||||
{
|
||||
if ( is_array( $field ) )
|
||||
{
|
||||
|
||||
@@ -19,12 +19,10 @@ use IPS\cms\Pages\Page;
|
||||
use IPS\Data\Store;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Helpers\Badge;
|
||||
use IPS\Helpers\Badge\Icon;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Radio;
|
||||
use IPS\Helpers\Tree\Tree;
|
||||
use IPS\Http\url;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Controller;
|
||||
use IPS\Node\Model;
|
||||
@@ -166,7 +164,8 @@ class pages extends Controller
|
||||
'primary' => true,
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'content_add_page',
|
||||
'link' => Url::internal( 'app=cms&module=pages&controller=pages&subnode=1&do=form&subnode=1' )
|
||||
'link' => Url::internal( 'app=cms&module=pages&controller=pages&subnode=1&do=add&subnode=1' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('content_add_page') )
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -218,6 +217,41 @@ FILE;
|
||||
Output::i()->sendOutput( $htaccess, 200, 'application/x-htaccess', array( 'Content-Disposition' => 'attachment; filename=.htaccess' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Page content form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function add() : void
|
||||
{
|
||||
Dispatcher::i()->checkAcpPermission( 'page_add' );
|
||||
|
||||
$form = new Form( 'form', 'next' );
|
||||
$form->hiddenValues['parent'] = ( isset( Request::i()->parent ) ) ? Request::i()->parent : 0;
|
||||
|
||||
$form->add( new Radio(
|
||||
'page_type',
|
||||
NULL,
|
||||
FALSE,
|
||||
array( 'options' => array( 'builder' => 'page_type_builder', 'html' => 'page_type_manual' ),
|
||||
'descriptions' => array( 'builder' => 'page_type_builder_desc', 'html' => 'page_type_manual_custom_desc' ) ),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
'page_type'
|
||||
) );
|
||||
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
Output::i()->redirect( Url::internal( 'app=cms&module=pages&controller=pages&do=form&subnode=1&page_type=' . $values['page_type'] . '&parent=' . Request::i()->parent ) );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'global', 'core', 'admin' )->block( Member::loggedIn()->language()->addToStack('content_add_page'), $form, FALSE );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('content_add_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add/Edit Form
|
||||
*
|
||||
@@ -346,7 +380,7 @@ FILE;
|
||||
'sprintf' => array( Url::internal( "app=cms&module=databases&controller=databases&do=form&id=" . static::$pageToDatabaseMap[ $page->id ] ) )
|
||||
) );
|
||||
}
|
||||
return Theme::i()->getTemplate( 'trees', 'core' )->row( $url, $page->id, $page->seo_name, false, $page->getButtons( \IPS\Http\Url::internal('app=cms&module=pages&controller=pages'), true ), Member::loggedIn()->language()->addToStack( 'num_views_with_number', NULL, array( 'pluralize' => array( $page->views ) ) ), 'file-text-o', NULL, FALSE, NULL, NULL, $badge, FALSE, FALSE, FALSE );
|
||||
return Theme::i()->getTemplate( 'trees', 'core' )->row( $url, $page->id, $page->seo_name, false, $page->getButtons( Url::internal('app=cms&module=pages&controller=pages'), true ), Member::loggedIn()->language()->addToStack( 'num_views_with_number', NULL, array( 'pluralize' => array( $page->views ) ) ), 'file-text-o', NULL, FALSE, NULL, NULL, $badge, FALSE, FALSE, FALSE );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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