Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -43,6 +43,15 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
/* There may be no database ID if the admin only has permission to view records and not the database list itself */
|
||||
if ( !\IPS\Request::i()->database_id )
|
||||
{
|
||||
foreach ( \IPS\cms\Databases::databases() as $database )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=cms&module=databases&controller=records&do=manage&database_id=' . $database->_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
$database = \IPS\cms\Databases::load( \IPS\Request::i()->database_id );
|
||||
$title = \IPS\Member::loggedIn()->language()->addToStack('content_record_db_title', TRUE, array( 'sprintf' => array( $database->_title ) ) );
|
||||
|
||||
@@ -328,7 +337,7 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
|
||||
$form = new \IPS\Helpers\Form();
|
||||
|
||||
$form->addtab( 'content_database_record_tab_content' );
|
||||
$form->addTab( 'content_database_record_tab_content' );
|
||||
|
||||
$formElements = $class::formElements( $current, $container );
|
||||
|
||||
@@ -353,7 +362,7 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
$form->add( $obj );
|
||||
}
|
||||
|
||||
$form->addtab( 'content_database_record_tab_publish' );
|
||||
$form->addTab( 'content_database_record_tab_publish' );
|
||||
|
||||
if ( isset( $formElements['record_publish_date'] ) )
|
||||
{
|
||||
@@ -364,18 +373,26 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$form->add( $formElements['record_expiry_date'] );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'record_author_choice', $current ? ( $current->member_id === \IPS\Member::loggedIn()->member_id ? 'me' : 'notme' ) : 'me', FALSE, array(
|
||||
'options' => array(
|
||||
'me' => 'record_author_choice_me',
|
||||
'notme' => 'record_author_choice_notme'
|
||||
),
|
||||
|
||||
$currentMember = ( $current ? \IPS\Member::load( $current->member_id ) : NULL );
|
||||
$options = array(
|
||||
'me' => 'record_author_choice_me',
|
||||
'notme' => 'record_author_choice_notme'
|
||||
);
|
||||
|
||||
if ( $currentMember and ! $current->member_id )
|
||||
{
|
||||
$options['guest'] = 'record_author_choice_guest';
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'record_author_choice', $currentMember ? ( $currentMember->member_id === \IPS\Member::loggedIn()->member_id ? 'me' : ( $currentMember->member_id ? 'notme' : 'guest' ) ) : 'me', FALSE, array(
|
||||
'options' => $options,
|
||||
'toggles' => array(
|
||||
'notme' => array( 'record_member_id' )
|
||||
)
|
||||
), NULL, NULL, NULL, 'record_author_choice' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'record_member_id', ( $current ? \IPS\Member::load( $current->member_id ) : NULL ), FALSE, array(), NULL, NULL, NULL, 'record_member_id' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'record_member_id', ( $currentMember and $currentMember->member_id ) ? $currentMember : NULL, FALSE, array(), NULL, NULL, NULL, 'record_member_id' ) );
|
||||
|
||||
if ( isset( $formElements['record_allow_comments'] ) )
|
||||
{
|
||||
@@ -391,7 +408,7 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( \IPS\Member::loggedIn()->modPermission('can_content_edit_meta_tags') )
|
||||
{
|
||||
$form->addtab( 'content_database_record_tab_meta' );
|
||||
$form->addTab( 'content_database_record_tab_meta' );
|
||||
$form->add( $formElements['record_meta_keywords'] );
|
||||
$form->add( $formElements['record_meta_description'] );
|
||||
}
|
||||
@@ -435,13 +452,36 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
/* Other data */
|
||||
$current->record_meta_keywords = $values['record_meta_keywords'];
|
||||
$current->record_meta_description = $values['record_meta_description'];
|
||||
|
||||
$changeAuthor = FALSE;
|
||||
if ( ! empty( \IPS\Request::i()->id ) and $values['record_author_choice'] === 'notme' and ! empty( $values['record_member_id'] ) )
|
||||
{
|
||||
$changeAuthor = TRUE;
|
||||
}
|
||||
|
||||
$changeAuthor = FALSE;
|
||||
if ( ! empty( \IPS\Request::i()->id ) )
|
||||
{
|
||||
if ( $values['record_author_choice'] === 'guest' )
|
||||
{
|
||||
if ( $current->member_id )
|
||||
{
|
||||
$values['record_member_id'] = new \IPS\Member;
|
||||
$changeAuthor = TRUE;
|
||||
}
|
||||
}
|
||||
else if ( ! $current->member_id and $values['record_author_choice'] !== 'guest' )
|
||||
{
|
||||
$values['record_member_id'] = \IPS\Member::loggedIn();
|
||||
$changeAuthor = TRUE;
|
||||
}
|
||||
else if ( $values['record_author_choice'] === 'notme' and ! empty( $values['record_member_id'] ) )
|
||||
{
|
||||
$changeAuthor = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $values['record_author_choice'] === 'notme' and ! empty( $values['record_member_id'] ) )
|
||||
{
|
||||
$changeAuthor = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Just editing, thanks */
|
||||
if ( ! $new )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user