Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -131,6 +131,16 @@ class _databases extends \IPS\Node\Controller
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('cms_database_add') )
|
||||
),
|
||||
);
|
||||
|
||||
/*if ( \IPS\Application::appIsEnabled('forums') )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['promote'] = array(
|
||||
'title' => 'cms_database_promote',
|
||||
'icon' => 'comments',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=databases&controller=databases&do=promote' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('cms_database_promote') )
|
||||
);
|
||||
}*/
|
||||
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
@@ -243,7 +253,7 @@ class _databases extends \IPS\Node\Controller
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'admin' )->block( 'cms_database_add', $form, FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Import from upload
|
||||
*
|
||||
* @return void
|
||||
@@ -1055,7 +1065,45 @@ class _databases extends \IPS\Node\Controller
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'delete', $form, FALSE );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Promote
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function promote()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'form', 'save' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cms_promote_enabled', \IPS\Settings::i()->cms_promote_enabled, FALSE, array( 'togglesOn' => array( 'cms_promote_cat', 'cms_promote_groups' ) ) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'cms_promote_cat', \IPS\Settings::i()->cms_promote_cat ? \IPS\Settings::i()->cms_promote_cat : 0, FALSE, array(
|
||||
'class' => '\IPS\cms\Selector\Databases',
|
||||
'subnodes' => true,
|
||||
), NULL, NULL, NULL, 'cms_promote_cat' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Select(
|
||||
'cms_promote_groups',
|
||||
\IPS\Settings::i()->cms_promote_groups != '' ? ( \IPS\Settings::i()->cms_promote_groups === '*' ? '*' : explode( ",", \IPS\Settings::i()->cms_promote_groups ) ) : '*',
|
||||
FALSE,
|
||||
array( 'options' => \IPS\Member\Group::groups(), 'multiple' => TRUE, 'parse' => 'normal', 'unlimited' => '*', 'unlimitedLang' => 'all' ),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
'cms_promote_groups'
|
||||
) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=cms&module=databases&controller=databases" ), 'saved' );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core', 'admin' )->block( \IPS\Member::loggedIn()->language()->addToStack('cms_pages_settings'), $form, FALSE );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('cms_pages_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add/Edit
|
||||
*
|
||||
@@ -1078,7 +1126,7 @@ class _databases extends \IPS\Node\Controller
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', 'save', NULL, array( 'data-controller' => 'cms.admin.databases.form' ) );
|
||||
|
||||
$form->addtab( 'content_database_form_details' );
|
||||
$form->addTab( 'content_database_form_details' );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'database_name', NULL, TRUE, array( 'app' => 'cms', 'key' => ( ! empty( $current ) ? "content_db_" . $current->id : NULL ) ) ) );
|
||||
|
||||
@@ -1126,13 +1174,15 @@ class _databases extends \IPS\Node\Controller
|
||||
$templatesForm[ $template->group ] = $title;
|
||||
break;
|
||||
case 'category_articles':
|
||||
case 'category_2_column_first_featured':
|
||||
case 'category_2_column_image_feature':
|
||||
case 'category_3_column_image_feature':
|
||||
case 'category_3_column_first_featured':
|
||||
$templatesFeatured[ $template->group ] = $title;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$form->addSeparator();
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'database_cat_index_type' , $current ? $current->cat_index_type : 0, FALSE, array(
|
||||
'options' => array(
|
||||
0 => 'database_display_index_as_categories',
|
||||
@@ -1140,7 +1190,7 @@ class _databases extends \IPS\Node\Controller
|
||||
),
|
||||
'toggles' => array(
|
||||
'0' => array( 'database_template_categories' ),
|
||||
'1' => array( 'database_template_featured', 'database_featured_featured', 'database_featured_categories', 'database_featured_perpage', 'database_featured_pagination', 'database_featured_sort', 'database_featured_direction' )
|
||||
'1' => array( $form->id . '_header_cms_articles_homepage_form', 'database_template_featured', 'database_featured_featured', 'database_featured_categories', 'database_featured_perpage', 'database_featured_pagination', 'database_featured_sort', 'database_featured_direction' )
|
||||
)
|
||||
), NULL, NULL, NULL, 'database_cat_index_type' ) );
|
||||
|
||||
@@ -1167,7 +1217,8 @@ class _databases extends \IPS\Node\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database_template_categories', ! empty( $current ) ? $current->template_categories : NULL, FALSE, array( 'options' => $templatesCat ), NULL, NULL, NULL, 'database_template_categories' ) );
|
||||
$form->addHeader("cms_articles_homepage_form");
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database_template_featured', ! empty( $current ) ? $current->template_featured : NULL, FALSE, array( 'options' => $templatesFeatured ), NULL, NULL, NULL, 'database_template_featured' ) );
|
||||
|
||||
/* Featured settings */
|
||||
@@ -1194,14 +1245,13 @@ class _databases extends \IPS\Node\Controller
|
||||
)
|
||||
), NULL, NULL, NULL, 'database_featured_direction' ) );
|
||||
|
||||
$form->addSeparator();
|
||||
$form->addHeader( 'cms_database_form_display' );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database_template_categories', ! empty( $current ) ? $current->template_categories : NULL, FALSE, array( 'options' => $templatesCat ), NULL, NULL, NULL, 'database_template_categories' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database_template_listing' , ! empty( $current ) ? $current->template_listing : NULL, FALSE, array( 'options' => $templatesList ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database_template_display' , ! empty( $current ) ? $current->template_display : NULL, FALSE, array( 'options' => $templatesDisplay ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database_template_form' , ! empty( $current ) ? $current->template_form : NULL, FALSE, array( 'options' => $templatesForm ) ) );
|
||||
|
||||
$form->addHeader( 'cms_database_form_display' );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'database_key', ! empty( $current ) ? $current->key : FALSE, FALSE, array(), function( $val )
|
||||
{
|
||||
try
|
||||
@@ -1240,7 +1290,7 @@ class _databases extends \IPS\Node\Controller
|
||||
return true;
|
||||
} ) );
|
||||
|
||||
$form->addtab( 'content_database_form_lang' );
|
||||
$form->addTab( 'content_database_form_lang' );
|
||||
|
||||
$sl_Default = null;
|
||||
$pl_Default = null;
|
||||
@@ -1266,7 +1316,7 @@ class _databases extends \IPS\Node\Controller
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'database_lang_pu', $pu_Default, FALSE, array( 'app' => 'cms', 'key' => ( ! empty( $current ) ? "content_db_lang_pu_" . $current->id : NULL ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'database_lang_ia', $ia_Default, FALSE, array( 'app' => 'cms', 'key' => ( ! empty( $current ) ? "content_db_lang_ia_" . $current->id : NULL ) ) ) );
|
||||
|
||||
$form->addtab( 'content_database_form_options' );
|
||||
$form->addTab( 'content_database_form_options' );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'database_all_editable' , $current ? $current->all_editable : FALSE, FALSE, array( 'togglesOff' => array( 'cms_bitoptions_indefinite_own_edit' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cms_bitoptions_indefinite_own_edit' , $current ? $current->options['indefinite_own_edit'] : FALSE, FALSE, array(), NULL, NULL, NULL, 'cms_bitoptions_indefinite_own_edit' ) );
|
||||
@@ -1335,6 +1385,10 @@ class _databases extends \IPS\Node\Controller
|
||||
$thumbWidthHeight = $ffsettings['record_image']['thumb_dims'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$recordImagesOn = TRUE;
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'database_record_image' , $recordImagesOn, FALSE, array( 'togglesOn' => array( 'fixed_field_setting__record_image__image_dims', 'fixed_field_setting__record_image__thumb_dims' ) ), NULL, NULL, NULL, 'database_record_image' ) );
|
||||
$form->add( new \IPS\Helpers\Form\WidthHeight( 'fixed_field_setting__record_image__image_dims', ( $current AND $widthHeight !== NULL ) ? $widthHeight : array( 0, 0 ), FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), NULL, NULL, NULL, 'fixed_field_setting__record_image__image_dims' ) );
|
||||
@@ -1411,12 +1465,34 @@ class _databases extends \IPS\Node\Controller
|
||||
}
|
||||
}, NULL, NULL, 'page_name' );
|
||||
}
|
||||
|
||||
|
||||
if ( $name !== 'page_content' AND $name !== 'tab_content' )
|
||||
{
|
||||
$pageToggles[] = $name;
|
||||
$pageFormFields[ $name ] = $field;
|
||||
}
|
||||
|
||||
if ( $name === 'page_folder_id' )
|
||||
{
|
||||
$pageFormFields['page_type'] = new \IPS\Helpers\Form\Radio(
|
||||
'page_type', 'builder', 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'
|
||||
),
|
||||
'toggles' => array(
|
||||
'builder' => array( 'page_template' ),
|
||||
'html' => array( 'page_show_sidebar', 'page_wrapper_template', 'page_ipb_wrapper' )
|
||||
)
|
||||
), NULL, NULL, NULL, 'page_type'
|
||||
);
|
||||
|
||||
$pageToggles[] = 'page_type';
|
||||
}
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'database_create_page', 'existing', FALSE, array(
|
||||
@@ -1652,8 +1728,6 @@ class _databases extends \IPS\Node\Controller
|
||||
{
|
||||
if ( $values['database_create_page'] === 'new' )
|
||||
{
|
||||
$values['page_content'] = '{database="' . $current->id . '"}';
|
||||
|
||||
$pageValues = array();
|
||||
|
||||
foreach( $values as $k => $v )
|
||||
@@ -1664,7 +1738,23 @@ class _databases extends \IPS\Node\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$pageId = \IPS\cms\Pages\Page::createFromForm( $pageValues, 'html' );
|
||||
if ( $values['page_type'] === 'html' )
|
||||
{
|
||||
$pageValues['page_content'] = '{database="' . $current->id . '"}';
|
||||
$pageValues['page_template'] = '';
|
||||
}
|
||||
|
||||
$newPage = \IPS\cms\Pages\Page::createFromForm( $pageValues, 'html' );
|
||||
|
||||
if ( $values['page_type'] !== 'html' )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'cms_page_widget_areas', array(
|
||||
'area_page_id' => $newPage->id,
|
||||
'area_widgets' => json_encode( array( array( 'app' => 'cms', 'key' => 'Database', 'unique' => uniqid(), 'configuration' => array( 'database' => $current->id ) ) ) ),
|
||||
'area_area' => 'col1',
|
||||
'area_orientation' => 'horizontal'
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user