Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+136 -10
View File
@@ -124,7 +124,7 @@ class _Records extends \IPS\Content\Item implements
/**
* @brief Icon
*/
public static $icon = 'file-text-o';
public static $icon = 'file-text';
/**
* @brief Reputation Type
@@ -177,8 +177,17 @@ class _Records extends \IPS\Content\Item implements
*/
public static function getCommentsPerPage()
{
/* Normally we check if we are using the forums at the record level, however this is a static method called so we can only try to do our best to guess */
if( static::database()->forum_record and static::database()->forum_comments and \IPS\Application::appIsEnabled('forums') )
if ( ! empty( \IPS\cms\Databases\Dispatcher::i()->recordId ) )
{
$class = 'IPS\cms\Records' . static::$customDatabaseId;
$record = $class::load( \IPS\cms\Databases\Dispatcher::i()->recordId );
if ( $record->_forum_record and $record->_forum_comments and \IPS\Application::appIsEnabled('forums') )
{
return \IPS\forums\Topic::getCommentsPerPage();
}
}
else if( static::database()->forum_record and static::database()->forum_comments and \IPS\Application::appIsEnabled('forums') )
{
return \IPS\forums\Topic::getCommentsPerPage();
}
@@ -215,9 +224,12 @@ class _Records extends \IPS\Content\Item implements
if ( isset( $qs['path'] ) )
{
$bits = explode( '/', trim( $qs['path'], '/' ) );
$path = array_pop( $bits );
try
{
return static::loadFromSlug( $qs['path'], FALSE );
return static::loadFromSlug( $path, FALSE );
}
catch ( \Exception $e ) { }
}
@@ -320,6 +332,18 @@ class _Records extends \IPS\Content\Item implements
return $lang->addToStack( 'content_db_lang_ia_' . static::$customDatabaseId, FALSE );
}
/**
* Indefinite Article
*
* @param \IPS\Lang|NULL $language The language to use, or NULL for the language of the currently logged in member
* @return string
*/
public static function _indefiniteArticle( array $containerData = NULL, \IPS\Lang $lang = NULL )
{
$lang = $lang ?: \IPS\Member::loggedIn()->language();
return $lang->addToStack( 'content_db_lang_ia_' . static::$customDatabaseId, FALSE );
}
/**
* Get elements for add/edit form
*
@@ -774,6 +798,10 @@ class _Records extends \IPS\Content\Item implements
$thumb = $values['record_image']->thumbnail( 'cms_Records', $fixedFieldSettings['record_image']['thumb_dims'][0], $fixedFieldSettings['record_image']['thumb_dims'][1] );
}
else
{
$thumb = $values['record_image'];
}
$this->record_image = (string)$values['record_image'];
$this->record_image_thumb = (string)$thumb;
@@ -1003,6 +1031,82 @@ class _Records extends \IPS\Content\Item implements
return $url;
}
/**
* Columns needed to query for search result / stream view
*
* @return array
*/
public static function basicDataColumns()
{
$return = parent::basicDataColumns();
$return[] = 'category_id';
$return[] = 'record_static_furl';
$return[] = 'record_dynamic_furl';
return $return;
}
/**
* Query to get additional data for search result / stream view
*
* @param array $items Item data (will be an array containing values from basicDataColumns())
* @return array
*/
public static function searchResultExtraData( $items )
{
$categoryIds = array();
foreach ( $items as $item )
{
if ( $item['category_id'] )
{
$categoryIds[ $item['category_id'] ] = $item['category_id'];
}
}
if ( count( $categoryIds ) )
{
$categoryPaths = iterator_to_array( \IPS\Db::i()->select( array( 'category_id', 'category_full_path' ), 'cms_database_categories', \IPS\Db::i()->in( 'category_id', $categoryIds ) )->setKeyField('category_id')->setValueField('category_full_path') );
$return = array();
foreach ( $items as $item )
{
if ( $item['category_id'] )
{
$return[ $item['primary_id_field'] ] = $categoryPaths[ $item['category_id'] ];
}
}
return $return;
}
return array();
}
/**
* Get URL from index data
*
* @param array $indexData Data from the search index
* @param array $itemData Basic data about the item. Only includes columns returned by item::basicDataColumns()
* @return \IPS\Http\Url
*/
public static function urlFromIndexData( $indexData, $itemData )
{
if ( static::$pagePath === NULL )
{
static::$pagePath = \IPS\Db::i()->select( array( 'page_full_path' ), 'cms_pages', array( 'page_id=?', static::database()->page_id ) )->first();
}
$recordSlug = !$itemData['record_static_furl'] ? $itemData['record_dynamic_furl'] . '-r' . $itemData['primary_id_field'] : $itemData['record_static_furl'];
if ( static::database()->use_categories )
{
return \IPS\Http\Url::internal( "app=cms&module=pages&controller=page&path=" . static::$pagePath . '/' . $itemData['extra'] . '/' . $recordSlug, 'front', 'content_page_path', $recordSlug );
}
else
{
return \IPS\Http\Url::internal( "app=cms&module=pages&controller=page&path=" . static::$pagePath . '/' . $recordSlug, 'front', 'content_page_path', $recordSlug );
}
}
/**
* Template helper method to fetch custom fields to display
@@ -1263,7 +1367,7 @@ class _Records extends \IPS\Content\Item implements
*/
public function editLine()
{
if ( static::database()->revisions and $this->record_edit_time and ( $this->record_edit_show or \IPS\Member::loggedIn()->modPermission('can_view_editlog') ) )
if ( $this->record_edit_time and ( $this->record_edit_show or \IPS\Member::loggedIn()->modPermission('can_view_editlog') ) and \IPS\Settings::i()->edit_log )
{
return \IPS\cms\Theme::i()->getTemplate( static::database()->template_display, 'cms', 'database' )->recordEditLine( $this );
}
@@ -1387,7 +1491,7 @@ class _Records extends \IPS\Content\Item implements
/**
* Resync the comments/unapproved comment counts
*
* @param string $commentClass
* @param string $commentClass Override comment class to use
* @return void
*/
public function resyncCommentCounts( $commentClass=NULL )
@@ -1409,6 +1513,28 @@ class _Records extends \IPS\Content\Item implements
parent::resyncCommentCounts( $commentClass );
}
}
/**
* Are comments supported by this class?
*
* @param \IPS\Member\NULL $member The member to check for or NULL fto not check permission
* @return int
*/
public static function supportsComments( \IPS\Member $member = NULL )
{
return parent::supportsComments() and static::database()->options['comments'];
}
/**
* Are reviews supported by this class?
*
* @param \IPS\Member\NULL $member The member to check for or NULL to not check permission
* @return int
*/
public static function supportsReviews( \IPS\Member $member = NULL )
{
return parent::supportsReviews() and static::database()->options['reviews'];
}
/* !IP.Board Integration */
@@ -1606,6 +1732,7 @@ class _Records extends \IPS\Content\Item implements
}
catch( \Exception $ex ) { }
}
return $record;
}
@@ -1617,7 +1744,7 @@ class _Records extends \IPS\Content\Item implements
*/
public function processAfterEdit( $values )
{
if ( \IPS\Application::appIsEnabled('forums') and $this->topic() )
if ( \IPS\Application::appIsEnabled('forums') and $this->_forum_record and $this->_forum_forum and ! $this->hidden() and ! $this->record_future_date )
{
try
{
@@ -1684,7 +1811,7 @@ class _Records extends \IPS\Content\Item implements
$topic->unhide();
}
}
else if ( $this->_forum_forum )
else if ( $this->_forum_forum and $this->_forum_comments )
{
$this->syncTopic();
}
@@ -1720,7 +1847,7 @@ class _Records extends \IPS\Content\Item implements
{
$topic->unhide();
}
elseif ( $this->_forum_forum )
elseif ( $this->_forum_forum and $this->_forum_comments )
{
$this->syncTopic();
}
@@ -2370,7 +2497,6 @@ class _Records extends \IPS\Content\Item implements
{
try
{
$url = $this->url();
return parent::searchIndexPermissions();
}
catch ( \LogicException $e )