Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -980,7 +980,7 @@ class _databases extends \IPS\Node\Controller
|
||||
$textFields = array( 'category_name', 'category_description', 'category_meta_keywords', 'category_meta_description', 'category_page_title' );
|
||||
$removeFields = array( 'category_database_id', 'category_last_record_id', 'category_last_record_date', 'category_last_record_member', 'category_last_record_name', 'category_last_record_seo_name', 'category_records', 'category_record_comments',
|
||||
'category_record_comments_queued', 'category_rss_cache', 'category_rss_cached', 'category_rss_exclude', 'category_forum_override', 'category_forum_record', 'category_forum_comments', 'category_forum_delete', 'category_forum_suffix', 'category_forum_prefix',
|
||||
'category_forum_forum', 'category_full_path', 'category_last_title', 'category_last_seo_title');
|
||||
'category_forum_forum', 'category_full_path', 'category_last_title', 'category_last_seo_title', 'category_club_id', 'category_club_view_permission', 'category_club_category_meta_index' );
|
||||
$categorySchema = $schema['cms_database_categories'];
|
||||
foreach ( \IPS\Db::i()->select( 'c.*, w.word_custom as category_name, w2.word_custom as category_description, p.*', array('cms_database_categories', 'c'), array( 'category_database_id=?', $database->id ) )
|
||||
->join( array( 'core_sys_lang_words', 'w' ), "w.word_key=CONCAT( 'content_cat_name_', c.category_id ) and w.lang_id=" . \IPS\Lang::defaultLanguage() )
|
||||
@@ -1377,6 +1377,7 @@ class _databases extends \IPS\Node\Controller
|
||||
\IPS\Lang::saveCustom( 'cms', "module__cms_records" . $current->id, $values['database_name'] );
|
||||
|
||||
$current->use_categories = $values['database_use_categories'];
|
||||
$current->allow_club_categories = $values['database_allow_club_categories'] ?? $current->allow_club_categories;
|
||||
$current->template_categories = $values['database_template_categories'];
|
||||
$current->template_listing = $values['database_template_listing'];
|
||||
$current->template_display = $values['database_template_display'];
|
||||
@@ -1426,9 +1427,10 @@ class _databases extends \IPS\Node\Controller
|
||||
'categories' => $categories
|
||||
);
|
||||
|
||||
$current->field_sort = $values['database_field_sort'];
|
||||
$current->field_direction = $values['database_field_direction'];
|
||||
$current->field_perpage = $values['database_field_perpage'];
|
||||
$current->field_sort = $values['database_field_sort'];
|
||||
$current->field_direction = $values['database_field_direction'];
|
||||
$current->field_perpage = $values['database_field_perpage'];
|
||||
$current->comments_perpage = $values['database_comments_perpage'];
|
||||
|
||||
if ( \IPS\Application::appIsEnabled( 'forums' ) )
|
||||
{
|
||||
@@ -1585,7 +1587,7 @@ class _databases extends \IPS\Node\Controller
|
||||
) ) );
|
||||
|
||||
$disabled = FALSE;
|
||||
if ( $current and $current->use_categories and $current->numberOfCategories() > 1 )
|
||||
if ( $current and ( ( $current->use_categories and $current->numberOfCategories() > 1 ) or ( $current->allow_club_categories and $current->numberOfClubCategories() ) ) )
|
||||
{
|
||||
$disabled = TRUE;
|
||||
}
|
||||
@@ -1596,7 +1598,7 @@ class _databases extends \IPS\Node\Controller
|
||||
0 => 'database_use_categories_no'
|
||||
),
|
||||
'toggles' => array(
|
||||
1 => array( 'database_template_categories' ),
|
||||
1 => array( 'database_template_categories', 'database_allow_club_categories' ),
|
||||
0 => array( 'category_allow_rating', 'category_can_view_others' )
|
||||
),
|
||||
'disabled' => $disabled
|
||||
@@ -1607,6 +1609,17 @@ class _databases extends \IPS\Node\Controller
|
||||
$form->hiddenValues['database_use_categories_impossible'] = TRUE;
|
||||
\IPS\Member::loggedIn()->language()->words['database_use_categories_warning'] = \IPS\Member::loggedIn()->language()->addToStack( 'database_use_categories_impossible', FALSE, array( 'sprintf' => array( $current->numberOfCategories() ) ) );
|
||||
}
|
||||
|
||||
if( \IPS\Settings::i()->clubs )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'database_allow_club_categories', $current?->allow_club_categories ? 1 : 0, false, array(
|
||||
'options' => array (
|
||||
0 => 'database_allow_club_categories_no',
|
||||
1 => 'database_allow_club_categories_yes',
|
||||
),
|
||||
'disabled' => (bool) ($current?->allow_club_categories and $current->numberOfClubCategories()),
|
||||
), null, null, null, 'database_allow_club_categories' ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'database_use_as_page_title' , $current ? $current->use_as_page_title : 1, FALSE, array(
|
||||
'options' => array(
|
||||
@@ -1831,6 +1844,7 @@ class _databases extends \IPS\Node\Controller
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'database_field_perpage', $current ? $current->field_perpage : 25, FALSE, array( 'min' => 1 ), NULL, NULL, NULL, 'database_field_perpage' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'database_comments_perpage', $current ? $current->comments_perpage : 0, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'database_comments_perpage_inherit' ) ) );
|
||||
|
||||
$form->addHeader( 'content_database_form_options_field_record_image_settings' );
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ FILE;
|
||||
{
|
||||
$badge = array( 0 => 'style7', 1 => \IPS\Member::loggedIn()->language()->addToStack( 'page_database_display', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack('content_db_' . static::$pageToDatabaseMap[ $page->id ] ) ) ) ) );
|
||||
}
|
||||
return \IPS\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 ), "", 'file-text-o', NULL, FALSE, NULL, NULL, $badge, FALSE, FALSE, FALSE );
|
||||
return \IPS\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 ), \IPS\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 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,7 +321,7 @@ FILE;
|
||||
*/
|
||||
public static function getFolderRow( $folder, $url )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'trees', 'core' )->row( $url, $folder->id, $folder->name, true, $folder->getButtons( \IPS\Http\url::internal('app=cms&module=pages&controller=pages') ), "", 'folder-o', NULL );
|
||||
return \IPS\Theme::i()->getTemplate( 'trees', 'core' )->row( $url, $folder->id, $folder->name, true, $folder->getButtons( \IPS\Http\Url::internal('app=cms&module=pages&controller=pages') ), "", 'folder-o', NULL );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,11 +145,6 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
$form->hiddenValues['plugin'] = \IPS\Request::i()->plugin;
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->marketplace )
|
||||
{
|
||||
$form->hiddenValues['marketplace'] = (int) \IPS\Request::i()->marketplace;
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->lang )
|
||||
{
|
||||
$form->hiddenValues['lang'] = \IPS\Request::i()->lang;
|
||||
@@ -256,11 +251,7 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
$lang = $values['lang'] == 'updated' ? 'application_now_updated' : 'application_now_installed';
|
||||
}
|
||||
|
||||
if( !empty( $values['marketplace'] ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . $values['marketplace'] ), $lang );
|
||||
}
|
||||
elseif( !empty( $values['application'] ) )
|
||||
if( !empty( $values['application'] ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), $lang );
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
{
|
||||
$breadcrumbs = \IPS\Output::i()->breadcrumb;
|
||||
}
|
||||
|
||||
|
||||
$RecordsClass = $category::$contentItemClass;
|
||||
|
||||
/* AdvancedSearch can wipe out the checked box as it is looking for _checkbox. Note to self in 4.5, rewrite the filter widget to avoid using advancedSearch :/ */
|
||||
@@ -683,19 +683,12 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
\IPS\Output::i()->linkTags['canonical'] = (string) $category->url();
|
||||
|
||||
/* Set breadcrumb */
|
||||
if ( \IPS\IPS::classUsesTrait( $category, 'IPS\Content\ClubContainer' ) and $club = $category->club() )
|
||||
foreach ( $category->parents() as $parent )
|
||||
{
|
||||
$club->setBreadcrumbs( $category );
|
||||
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ( $category->parents() as $parent )
|
||||
{
|
||||
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, $category->_title );
|
||||
}
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, $category->_title );
|
||||
}
|
||||
|
||||
/* Node handler does not support keywords, so we need to do it manually */
|
||||
@@ -704,6 +697,9 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
\IPS\Output::i()->metaTags['keywords'] = $category->meta_keywords;
|
||||
}
|
||||
|
||||
/* Show club header, if applicable */
|
||||
$this->showClubHeader( $category );
|
||||
|
||||
/* Update location */
|
||||
$permissions = $category->permissions();
|
||||
\IPS\Session::i()->setLocation( $category->url(), explode( ",", $permissions['perm_view'] ), 'loc_cms_viewing_db_cat', array( 'content_db_' . $database->id => TRUE, 'content_cat_name_' . $category->id => TRUE ) );
|
||||
@@ -740,6 +736,39 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
\IPS\Output::i()->title = $titleSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Club Header
|
||||
*
|
||||
* @param \IPS\cms\Categories $category
|
||||
* @return void
|
||||
*/
|
||||
protected function showClubHeader( \IPS\cms\Categories $category )
|
||||
{
|
||||
if ( $club = $category->_club )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['contextual'] = '';
|
||||
|
||||
/* Club info in sidebar */
|
||||
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['enabled'] = true;
|
||||
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core', 'front' )->header( $club, $category, 'sidebar' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\Theme::i()->getTemplate( 'clubs', 'core', 'front' )->header( $club, $category, 'full' );
|
||||
}
|
||||
|
||||
if( ( \IPS\GeoLocation::enabled() and \IPS\Settings::i()->clubs_locations AND $location = $club->location() ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['enabled'] = true;
|
||||
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core', 'front' )->clubLocationBox( $club, $location );
|
||||
}
|
||||
|
||||
$club->setBreadcrumbs( $category );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Form
|
||||
@@ -774,13 +803,6 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
{
|
||||
$hasModOptions = TRUE;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\cms\Pages\Page::$currentPage->getWidgets();
|
||||
\IPS\cms\Databases\Dispatcher::i()->output = \IPS\Output::i()->output = $form->customTemplate( array( \IPS\cms\Theme::i()->getTemplate( $database->template_form, 'cms', 'database' ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( $title );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -794,8 +816,17 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
|
||||
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, $title );
|
||||
|
||||
$this->showClubHeader( $category );
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\cms\Pages\Page::$currentPage->getWidgets();
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\cms\Theme::i()->getTemplate( $database->template_form, 'cms', 'database' ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\Output::i()->output;
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( $title );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,7 +148,16 @@ class _index extends \IPS\cms\Databases\Controller
|
||||
|
||||
/* Load into memory */
|
||||
$class::loadIntoMemory();
|
||||
$categories = $class::roots();
|
||||
|
||||
/* Get only the categories we can view. Otherwise, there is a risk the output will show a list of categories with no actual content or error message (the template that checks view permission is separate from the one that verifies the count in our oob templates) */
|
||||
$categories = [];
|
||||
foreach ( $class::roots() as $category )
|
||||
{
|
||||
if ( $category->can('view') )
|
||||
{
|
||||
$categories[] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/index.css', 'cms', 'front' ) );
|
||||
\IPS\Output::i()->title = $database->pageTitle();
|
||||
|
||||
@@ -124,6 +124,16 @@ class _record extends \IPS\Content\Controller
|
||||
|
||||
if ( \count( $customValues ) )
|
||||
{
|
||||
/* Store a revision before we change any values */
|
||||
if ( $record::database()->revisions )
|
||||
{
|
||||
$revision = new \IPS\cms\Records\Revisions;
|
||||
$revision->database_id = $record::$customDatabaseId;
|
||||
$revision->record_id = $record->_id;
|
||||
$revision->data = $record->fieldValues( TRUE );
|
||||
$revision->save();
|
||||
}
|
||||
|
||||
if ( isset( $values['record_display_field_change'] ) AND $values['record_display_field_change'] )
|
||||
{
|
||||
$record->addCommentWhenFiltersChanged( $values );
|
||||
@@ -326,6 +336,7 @@ class _record extends \IPS\Content\Controller
|
||||
);
|
||||
}
|
||||
|
||||
$this->showClubHeader();
|
||||
/* Set default search to this record */
|
||||
if ( ! $record::database()->search )
|
||||
{
|
||||
@@ -729,7 +740,6 @@ class _record extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\cms\Pages\Page::$currentPage->getWidgets();
|
||||
\IPS\cms\Databases\Dispatcher::i()->output = $form->customTemplate( array( \IPS\cms\Theme::i()->getTemplate( $database->template_form, 'cms', 'database' ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( $title );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
|
||||
@@ -747,6 +757,9 @@ class _record extends \IPS\Content\Controller
|
||||
catch( \Exception $e ) {}
|
||||
|
||||
\IPS\Output::i()->breadcrumb[] = array( $record->url(), $record->mapped('title') );
|
||||
|
||||
$this->showClubHeader();
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= $form->customTemplate( array( \IPS\cms\Theme::i()->getTemplate( $database->template_form, 'cms', 'database' ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -949,4 +962,37 @@ class _record extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->error( 'node_error', '2T252/F', 403, '' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the club header to \IPS\Output
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function showClubHeader()
|
||||
{
|
||||
$record = $this->_getRecord();
|
||||
if ( $record and $club = $record->club )
|
||||
{
|
||||
$category = $record->container();
|
||||
|
||||
\IPS\Output::i()->sidebar['contextual'] = '';
|
||||
|
||||
/* Club info in sidebar */
|
||||
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['enabled'] = true;
|
||||
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core', 'front' )->header( $club, $category, 'sidebar' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\Theme::i()->getTemplate( 'clubs', 'core', 'front' )->header( $club, $record->container(), 'full' );
|
||||
}
|
||||
|
||||
if( ( \IPS\GeoLocation::enabled() and \IPS\Settings::i()->clubs_locations AND $location = $club->location() ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['enabled'] = true;
|
||||
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core', 'front' )->clubLocationBox( $club, $location );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,6 +161,14 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
|
||||
$blocks[ $k ]['configuration'] = $values;
|
||||
\IPS\Db::i()->insert( 'cms_page_widget_areas', array( 'area_page_id' => \IPS\Request::i()->pageID, 'area_area' => \IPS\Request::i()->pageArea, 'area_widgets' => json_encode( $blocks ) ), TRUE );
|
||||
|
||||
/* Reindex the page any time the blocks are updated */
|
||||
try
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->index( \IPS\cms\Pages\PageItem::load( \IPS\Request::i()->pageID ) );
|
||||
}
|
||||
catch( \OutOfRangeException ){}
|
||||
|
||||
\IPS\Output::i()->json( 'OK' );
|
||||
}
|
||||
\IPS\Output::i()->output = $widget->configuration()->customTemplate( array( \IPS\Theme::i()->getTemplate( 'widgets', 'core' ), 'formTemplate' ), $widget );
|
||||
@@ -267,6 +275,13 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
/* Save to database */
|
||||
$orientation = ( isset( \IPS\Request::i()->orientation ) and \IPS\Request::i()->orientation === 'vertical' ) ? 'vertical' : 'horizontal';
|
||||
\IPS\Db::i()->replace( 'cms_page_widget_areas', array( 'area_orientation' => $orientation, 'area_page_id' => \IPS\Request::i()->pageID, 'area_widgets' => json_encode( $newOrder ), 'area_area' => \IPS\Request::i()->area ) );
|
||||
|
||||
/* Reindex the page any time the blocks are updated */
|
||||
try
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->index( \IPS\cms\Pages\PageItem::load( \IPS\Request::i()->pageID ) );
|
||||
}
|
||||
catch( \OutOfRangeException ){}
|
||||
|
||||
\IPS\cms\Pages\Page::load( \IPS\Request::i()->pageID )->postWidgetOrderSave();
|
||||
}
|
||||
|
||||
@@ -23,15 +23,6 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _page extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine which method to load
|
||||
@@ -195,6 +186,11 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->error( 'content_err_page_403', '2T187/3', 403, '' );
|
||||
}
|
||||
|
||||
if ( \IPS\IPS::classUsesTrait( $page->item(), 'IPS\Content\ViewUpdates' ) )
|
||||
{
|
||||
$page->item()->updateViews();
|
||||
}
|
||||
|
||||
/* Set the current page, so other blocks, DBs, etc don't have to figure out where they are */
|
||||
\IPS\cms\Pages\Page::$currentPage = $page;
|
||||
|
||||
|
||||
Reference in new issue
Block a user