Version 5.0.0 beta 8

This commit is contained in:
Neo committed 2025-12-19 17:30:12 -08:00
1 parent 54d5dcd0a0
commit 214f649f1d
483 files changed
+35354 -33568

No files matched your search

+19 -19
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="cms">
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/blocks" javascript_name="ips.blocks.form.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000100"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/blocks" javascript_name="ips.blocks.form.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -67,7 +67,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/blocks" javascript_name="ips.blocks.navigation.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/blocks" javascript_name="ips.blocks.navigation.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -111,7 +111,7 @@
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.download.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000150">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.download.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000150">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -156,7 +156,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000150"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -232,7 +232,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/external" javascript_name="ips.external.communication.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000150"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/external" javascript_name="ips.external.communication.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -367,7 +367,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000200"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000200"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -457,7 +457,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/media" javascript_name="ips.media.main.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000300"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/media" javascript_name="ips.media.main.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000300"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1096,7 +1096,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.embed.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000250"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.embed.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1131,7 +1131,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.form.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000250"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.form.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1253,7 +1253,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.form.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000100"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.form.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1365,7 +1365,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.revisions.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000100">/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.revisions.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000100">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1420,7 +1420,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.addForm.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.addForm.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1470,7 +1470,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.conflict.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.conflict.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1542,7 +1542,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileEditor.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileEditor.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2503,7 +2503,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileList.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileList.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2795,7 +2795,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2964,7 +2964,7 @@
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.variablesDialog.js" javascript_type="controller" javascript_version="5000034" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.variablesDialog.js" javascript_type="controller" javascript_version="5000036" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -3009,7 +3009,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="5000034" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="5000036" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
<ul class='ipsGrid ipsGrid--pages-media'>\
{{{contents}}}\
</ul>\
@@ -3026,7 +3026,7 @@ ips.templates.set( 'templates.media.noSearchResults', "\
{{#lang}}mediaNoResults{{/lang}}\
</div>\
");]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.templates.js" javascript_type="template" javascript_version="5000034" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.templates.js" javascript_type="template" javascript_version="5000036" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
/* TEMPLATECEPTION */
ips.templates.set('templates.editor.newTab', " \
<a href='#' class='ipsTabs__tab' id='ipsTabs_elTemplateEditor_tabbar_tab_{{fileid}}' role='tab' aria-controls='ipsTabs_elTemplateEditor_tabbar_tab_{{fileid}}_panel' aria-selected='false' data-fileid='{{fileid}}' data-location='{{location}}'>{{title}} <span data-action='closeTab'><i class='fa-solid fa-xmark'></i></span></a>\
+8 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="cms" version="5000034">
<app key="cms" version="5000036">
<word key="__app_cms" js="0">Pages</word>
<word key="menutab__cms" js="0">Pages</word>
<word key="menutab__cms_icon" js="0">file</word>
@@ -253,6 +253,8 @@
<word key="templates_block" js="0">Blocks</word>
<word key="templates_database" js="0">Database</word>
<word key="templates_page" js="0">Pages</word>
<word key="templates_css" js="0">CSS</word>
<word key="templates_js" js="0">Javascript</word>
<word key="cms_no_templates_selected" js="0">You must select templates to export</word>
<word key="cms_templates_import_title" js="0">Upload Templates</word>
<word key="cms_templates_import" js="0">Upload</word>
@@ -363,6 +365,11 @@
<word key="database_canonical_flag_1" js="0">All pages should be considered different</word>
<word key="database_canonical_flag_1_desc" js="0"><![CDATA[An example is a database where you post a link or video for review, and receive pages of comments and reviews.<br>In this example, the canonical tag will be set to the current page as the page of user generated content is more important.]]></word>
<word key="add_word_reason_pages" js="0">Phrases you create here can be used in custom HTML pages and theme templates to provide content in different languages.</word>
<word key="cms_import_wrappers" js="0">Page Wrappers</word>
<word key="cms_template_no_import" js="0">Do not import</word>
<word key="content_import_dev_templates_info" js="0">Select the templates you wish to import, and map it to a template type</word>
<word key="content_import_db" js="0">Database Templates</word>
<word key="content_import_wrappers" js="0">Custom Wrappers</word>
<word key="menu_content_page" js="0">Page</word>
<word key="content_page_form_tab__menu" js="0">Menu</word>
<word key="page_add_to_menu" js="0">Add to front navigation menu</word>
+1 -1
View File
@@ -1246,7 +1246,7 @@
<template template_group="widgets" template_name="folderNavigationItems" template_data="$items" template_location="front" template_app="cms"><![CDATA[{{foreach $items as $item}}
<a href='{$item->url()}'>{$item->_title}</a>
{{endforeach}}]]></template>
<template template_group="widgets" template_name="navigationLine" template_data="$container, $title=null, $currentContainer=null" template_location="front" template_app="cms"><![CDATA[<details {{if $container->_id == $currentContainer}}open="true"{{endif}} data-container="{$container->_id}">
<template template_group="widgets" template_name="navigationLine" template_data="$container, $title=null, $currentContainer=null" template_location="front" template_app="cms"><![CDATA[<details {{if $container->_id == $currentContainer}}open{{endif}} data-container="{$container->_id}">
<summary>{{if $title}}{$title}{{else}}{$container->_title}{{endif}}</summary>
{{if $container->hasChildren( 'view', null, false )}}
{{foreach $container->children( 'view', null, false ) as $child}}
+3 -1
View File
@@ -601,5 +601,7 @@
"5000031": "5.0.0 Beta 5",
"5000032": "5.0.0 Beta 6",
"5000033": "5.0.0 Beta 7",
"5000034": "5.0.0 Beta 7"
"5000034": "5.0.0 Beta 7",
"5000035": "5.0.0 Beta 7",
"5000036": "5.0.0 Beta 8"
}
@@ -14,6 +14,7 @@ namespace IPS\cms\modules\admin\pages;
/* To prevent PHP errors (extending class does not exist) revealing path */
use Diff;
use DirectoryIterator;
use DomainException;
use Exception;
use IPS\Application;
@@ -21,12 +22,12 @@ use IPS\cms\Blocks\Block;
use IPS\cms\Databases;
use IPS\cms\Templates as TemplatesClass;
use IPS\cms\Templates\Container;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
use IPS\Dispatcher;
use IPS\Dispatcher\Controller;
use IPS\Helpers\Form;
use IPS\Helpers\Form\CheckboxSet;
use IPS\Helpers\Form\Node;
use IPS\Helpers\Form\Radio;
use IPS\Helpers\Form\Select;
@@ -50,8 +51,10 @@ use function count;
use function defined;
use function in_array;
use function mb_substr;
use function str_replace;
use function strip_tags;
use function substr;
use function ucwords;
use const IPS\TEMP_DIRECTORY;
use const IPS\ROOT_PATH;
@@ -89,12 +92,104 @@ class templates extends Controller
*/
public function importInDev() : void
{
Session::i()->csrfCheck();
\IPS\cms\Theme::importFromFiles('database');
\IPS\cms\Theme::importFromFiles('page');
/* Get master keys for mapping */
$groups = [
'' => 'cms_template_no_import'
];
foreach( Databases::$templateGroups as $key => $group )
{
$groups[ $key ] = Member::loggedIn()->language()->addToStack( 'cms_new_db_template_group_' . $key );
}
Output::i()->redirect( Url::internal( 'app=cms&module=pages&controller=templates' ), 'completed' );
/* Build a list of all custom directories */
$masterTemplates = iterator_to_array(
Db::i()->select( 'template_group', 'cms_templates', [ 'template_location=? and template_master=?', 'database', 1 ] )
);
$databaseTemplates = [];
foreach( new DirectoryIterator( ROOT_PATH . "/applications/cms/dev/html/database" ) as $file )
{
if( $file->isDot() )
{
continue;
}
if( $file->isDir() and !in_array( $file->getFilename(), $masterTemplates ) )
{
$databaseTemplates[] = $file->getFilename();
}
}
$masterWrappers = iterator_to_array(
Db::i()->select( 'template_title', 'cms_templates', [ 'template_location=? and template_master=? and template_group=?', 'page', 1, 'custom_wrappers' ] )
);
$customWrappers = [];
foreach( new DirectoryIterator( ROOT_PATH . "/applications/cms/dev/html/page/custom_wrappers" ) as $file )
{
if( $file->isDir() or $file->isDot() or mb_substr( $file->getFilename(), 0, 1 ) === '.' or $file->getFilename() == 'index.html' )
{
continue;
}
$extension = strtolower( mb_substr( $file->getFilename(), mb_strrpos( $file->getFilename(), '.' ) + 1 ) );
if( $extension == 'phtml' and !in_array( mb_substr( $file->getFilename(), 0, mb_strrpos( $file->getFilename(), '.' ) ), $masterWrappers ) )
{
$customWrappers[ $file->getFilename() ] = $file->getFilename();
}
}
if( !count( $databaseTemplates ) and !count( $customWrappers ) )
{
Output::i()->error( 'err_no_dev_templates', '3T285/4' );
}
$form = new Form( 'form', 'continue' );
if( count( $databaseTemplates ) )
{
$form->addHeader( 'content_import_db' );
$form->addMessage( 'content_import_dev_templates_info', 'ipsMessage ipsMessage--info' );
foreach( $databaseTemplates as $template )
{
$key = str_replace( ' ', '_', $template );
$field = new Select( $key, null, false, [
'options' => $groups
] );
$field->label = ucwords( str_replace( '_', ' ', $template ) );
$form->add( $field );
}
}
if( count( $customWrappers ) )
{
$form->addHeader( 'content_import_wrappers' );
$form->add( new CheckboxSet( 'cms_import_wrappers', null, false, [
'options' => $customWrappers,
'noDefault' => true
] ) );
}
if( $values = $form->values() )
{
foreach( $databaseTemplates as $templateGroup )
{
$key = str_replace( ' ', '_', $templateGroup );
if( isset( $values[ $key ] ) and $values[ $key ] )
{
\IPS\cms\Theme::importDatabaseTemplate( $templateGroup, $values[ $key ] );
}
}
if( isset( $values['cms_import_wrappers'] ) )
{
foreach( $values['cms_import_wrappers'] as $wrapperName )
{
\IPS\cms\Theme::importPageWrapper( $wrapperName );
}
}
Output::i()->redirect( Url::internal( 'app=cms&module=pages&controller=templates' ), 'completed' );
}
Output::i()->output = (string) $form;
}
/**
@@ -177,7 +272,7 @@ class templates extends Controller
$conflicts = array();
/* If this is part of plugin/app installation, set relevant form data */
if( Request::i()->application OR Request::i()->plugin )
if( Request::i()->application )
{
if( Request::i()->application )
{
@@ -304,7 +399,7 @@ class templates extends Controller
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'customization/themes.css', 'core', 'admin' ) );
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'admin_templates.js', 'core', 'admin' ) );
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'admin_templates.js', 'cms', 'admin' ) );
Output::i()->output = $form->customTemplate( array( Theme::i()->getTemplate( 'templates', 'cms' ), 'templateConflict' ), $conflicts );
}
@@ -427,8 +522,8 @@ class templates extends Controller
Output::i()->sidebar['actions']['add'] = array(
'icon' => 'cog',
'title' => 'content_import_dev_templates',
'link' => Url::internal( "app=cms&module=pages&controller=templates&do=importInDev" )->csrf(),
'data' => array()
'link' => Url::internal( "app=cms&module=pages&controller=templates&do=importInDev" ),
'data' => [ 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack( 'content_import_dev_templates' ) ]
);
}
@@ -449,7 +544,7 @@ class templates extends Controller
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'templates/templates.css', 'cms', 'admin' ) );
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'admin_templates.js', 'cms' ) );
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'admin_templates.js', 'cms', 'admin' ) );
Output::i()->output = Theme::i()->getTemplate( 'templates' )->templates( $templates, $current, $request );
}
@@ -767,8 +862,8 @@ class templates extends Controller
/* Page, css, js */
if ( $type == 'js' or $type == 'css' )
{
$fileExt = ( $type == 'js' ) ? '.js' : ( $type == 'css' ? '.css' : NULL );
if ( $fileExt AND ! preg_match( '#' . preg_quote( $fileExt, '#' ) . '$#', $values['template_title'] ) )
$fileExt = ( $type == 'js' ) ? '.js' : '.css';
if ( ! preg_match( '#' . preg_quote( $fileExt, '#' ) . '$#', $values['template_title'] ) )
{
$values['template_title'] .= $fileExt;
}
@@ -1139,7 +1234,7 @@ class templates extends Controller
$displaySettings = $db->display_settings;
foreach( TemplatesClass::$databaseDefaults as $field => $template )
{
if( isset( $displaySettings[ $field ] ) and $displaySettings[ $field ]['template'] == Request::i()->group )
if( isset( $displaySettings[ $field ]['template'] ) and $displaySettings[ $field ]['template'] == Request::i()->group )
{
switch( $field )
{
@@ -0,0 +1,22 @@
{
"id": 5000035,
"name": "5.0.0 Beta 7",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeeditor": false,
"javascript": false,
"emailTemplates": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,22 @@
{
"id": 5000036,
"name": "5.0.0 Beta 8",
"steps": {
"queries": false,
"lang": true,
"theme": true,
"themeeditor": false,
"javascript": false,
"emailTemplates": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,20 @@
{
"normal": {
"added": [
"templates_css",
"templates_js",
"cms_import_wrappers",
"cms_template_no_import",
"content_import_dev_templates_info",
"content_import_db",
"content_import_wrappers"
],
"edited": [],
"removed": []
},
"js": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,19 @@
{
"html": {
"added": [],
"edited": [
"front\/widgets\/navigationLine"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
+12 -1
View File
@@ -40,11 +40,14 @@ use IPS\Patterns\ActiveRecord;
use IPS\Request;
use IPS\Theme;
use IPS\Widget;
use IPS\Widget\Polymorphic;
use LogicException;
use OutOfRangeException;
use ParseError;
use function class_implements;
use function defined;
use function func_get_args;
use function get_class;
use function in_array;
use function intval;
use function is_array;
@@ -628,9 +631,17 @@ EOF;
{
$templates = array( '_default_' => Member::loggedIn()->language()->addToStack('content_block_template_use_default') );
$keys =[ $this->widget()->key ];
if( in_array( Polymorphic::class, class_implements( $this->widget() ) ) )
{
/* @var Polymorphic $widgetClass */
$widgetClass = get_class( $this->widget() );
$keys[] = $widgetClass::getBaseKey();
}
foreach( Templates::getTemplates( Templates::RETURN_BLOCK ) as $id => $obj )
{
if ( $obj->group == $this->widget()->key )
if( in_array( $obj->group, $keys ) )
{
$templates[ $obj->key ] = $obj->title;
}
+39 -43
View File
@@ -370,7 +370,8 @@ class Records extends Item implements
return Topic::getCommentsPerPage();
}
return static::database()->field_perpage;
$databaseSetting = static::database()->comments_perpage;
return ( is_int( $databaseSetting ) and $databaseSetting > 0 ) ? $databaseSetting : static::database()->field_perpage;
}
/**
@@ -543,12 +544,13 @@ class Records extends Item implements
* Indefinite Article
*
* @param Lang|null $lang The language to use, or NULL for the language of the currently logged in member
* @param array $options
* @return string
*/
public function indefiniteArticle( ?Lang $lang = NULL ): string
public function indefiniteArticle( ?Lang $lang = NULL, array $options=array() ): string
{
$lang = $lang ?: Member::loggedIn()->language();
return $lang->addToStack( 'content_db_lang_ia_' . static::$customDatabaseId, FALSE );
return $lang->addToStack( 'content_db_lang_ia_' . static::$customDatabaseId, FALSE, $options );
}
/**
@@ -556,12 +558,13 @@ class Records extends Item implements
*
* @param array|null $containerData Container data
* @param Lang|null $lang The language to use, or NULL for the language of the currently logged in member
* @param array $options
* @return string
*/
public static function _indefiniteArticle( ?array $containerData = NULL, ?Lang $lang = NULL ): string
public static function _indefiniteArticle( ?array $containerData = NULL, ?Lang $lang = NULL, array $options=array() ): string
{
$lang = $lang ?: Member::loggedIn()->language();
return $lang->addToStack( 'content_db_lang_ia_' . static::$customDatabaseId, FALSE );
return $lang->addToStack( 'content_db_lang_ia_' . static::$customDatabaseId, FALSE, $options );
}
/**
@@ -2768,47 +2771,40 @@ class Records extends Item implements
{
if ( $this->recordCommentPageCount === NULL or $recache === TRUE )
{
/* If the database has a custom per page set, use that. */
if ( static::database()->comments_perpage )
if ( $this->useForumComments() )
{
$this->recordCommentPageCount = parent::commentPageCount( $recache );
try
{
$topic = $this->topic();
if ( $topic !== null )
{
/* Store the real count so it is not accidentally written as the actual value */
$realCount = $topic->posts;
/* If we are NOT featuring the first post in the topics, then we need to
compensate for the first post (which is actually the record) */
if ( !Member::loggedIn()->getLayoutValue( 'forum_topic_view_firstpost' ) )
{
$topic->posts = ( $topic->posts - 1 ) > 0 ? $topic->posts - 1 : 0;
}
/* Get our page count considering all of that */
$this->recordCommentPageCount = $topic->commentPageCount();
/* Reset the count back to the real count */
$topic->posts = $realCount;
}
else
{
$this->recordCommentPageCount = 1;
}
}
catch ( Exception $e ) {}
}
/* Otherwise do the normal stuff */
else
{
if ( $this->useForumComments() )
{
try
{
$topic = $this->topic();
if ( $topic !== null )
{
/* Store the real count so it is not accidentally written as the actual value */
$realCount = $topic->posts;
/* If we are NOT featuring the first post in the topics, then we need to
compensate for the first post (which is actually the record) */
if ( !Member::loggedIn()->getLayoutValue( 'forum_topic_view_firstpost' ) )
{
$topic->posts = ( $topic->posts - 1 ) > 0 ? $topic->posts - 1 : 0;
}
/* Get our page count considering all of that */
$this->recordCommentPageCount = $topic->commentPageCount();
/* Reset the count back to the real count */
$topic->posts = $realCount;
}
else
{
$this->recordCommentPageCount = 1;
}
}
catch ( Exception $e )
{
}
}
$this->recordCommentPageCount = parent::commentPageCount( $recache );
}
}
@@ -3846,7 +3842,7 @@ class Records extends Item implements
{
/* @var Fields $fieldClass */
$fieldClass = 'IPS\cms\Fields' . static::$customDatabaseId;
$photo->editable = $fieldClass::fixedFieldFormShow( 'record_image' );
$photo->editable = ( $this->canEdit() and $fieldClass::fixedFieldFormShow( 'record_image' ) );
}
return $photo;
@@ -610,7 +610,7 @@ class Templates extends ActiveRecord
*/
public static function exportForm( bool $appPluginBuild=FALSE, array $preSelected=array() ): Form
{
$form = new Form( 'form', $appPluginBuild ? 'save' : 'next' );
$form = new Form( 'form', $appPluginBuild ? 'save' : 'download' );
if( !$appPluginBuild )
{
$form->addMessage( 'cms_templates_export_description', 'ipsMessage ipsMessage_information' );
@@ -623,21 +623,17 @@ class Templates extends ActiveRecord
$templates = [];
foreach(Templates::getTemplates( Templates::RETURN_DATABASE_ONLY + Templates::RETURN_ALL ) as $template )
foreach(Templates::getTemplates( Templates::RETURN_DATABASE_AND_IN_DEV + Templates::RETURN_ALL ) as $template )
{
$title = Templates::readableGroupName( $template->group );
if ( $template->location === 'database' )
if( $template->location == 'database' )
{
$templates['database'][ $template->group ] = $title;
}
else if ( $template->location === 'block' )
else
{
$templates['block'][ $template->key ] = $title . ' &gt; ' . $template->title;
}
else if ( $template->location === 'page' )
{
$templates['page'][ $template->key ] = $title . ' &gt; ' . $template->title;
$templates[ $template->location ][ $template->key ] = $title . ' &gt; ' . $template->title;
}
}
@@ -737,7 +733,10 @@ class Templates extends ActiveRecord
if ( !in_array( substr( $k, 9 ), array( 'content', 'params' ) ) )
{
$xml->startAttribute( $k );
$xml->text( $v );
if( !empty( $v ) )
{
$xml->text( $v );
}
$xml->endAttribute();
}
}
@@ -857,7 +856,7 @@ class Templates extends ActiveRecord
$conflictKey = md5( microtime() );
$templates = Theme::i()->getAllTemplates( 'cms', NULL, NULL, \IPS\cms\Theme::RETURN_DATABASE_ONLY + Theme::RETURN_ALL );
$templates = \IPS\cms\Theme::i()->getAllTemplates( 'cms', [ 'database', 'page', 'css', 'js' ], [], \IPS\cms\Theme::RETURN_DATABASE_ONLY + Theme::RETURN_ALL );
if ( ! @$xml->read() )
{
@@ -866,7 +865,7 @@ class Templates extends ActiveRecord
$xml->read();
while ( $xml->read() )
{
if ( $xml->name === 'template' )
if ( $xml->name == 'template' )
{
$node = new SimpleXMLElement( $xml->readOuterXML() );
$attrs = array();
@@ -883,7 +882,6 @@ class Templates extends ActiveRecord
$attrs[ $k ] = ( $tryJson ) ?: (string) $v;
}
if ( isset( $attrs['template_title'] ) and isset( $attrs['template_location'] ) and isset( $attrs['template_group'] ) )
{
/* Got this template? */
+111
View File
@@ -213,6 +213,117 @@ class Theme extends SystemTheme
return $seen;
}
/**
* Import database templates from the dev directory
*
* @param string $directoryName
* @param string $templateType
* @return void
*/
public static function importDatabaseTemplate( string $directoryName, string $templateType ) : void
{
$directory = ROOT_PATH . "/applications/cms/dev/html/database/" . $directoryName;
if( !file_exists( $directory ) )
{
return;
}
/* Clear out any existing versions */
Db::i()->delete( 'cms_templates', [ 'template_master=? and template_group=? and template_location=? and template_original_group=?', 0, $directoryName, 'database', $templateType ] );
foreach( new DirectoryIterator( $directory ) as $file )
{
if( $file->isDot() or $file->isDir() or $file->getFilename() == 'index.html' )
{
continue;
}
$html = file_get_contents( $directory . '/' . $file->getFilename() );
/* Parse the header tag */
preg_match( '/^<ips:template parameters="(.+?)?"([^>]+?)>(\r\n?|\n)/', $html, $params );
/* Strip it */
$html = ( isset($params[0]) ) ? str_replace( $params[0], '', $html ) : $html;
$title = str_replace( '.phtml', '', $file->getFilename() );
/* remove compiled version */
$key = strtolower( 'template_cms_' .static::makeBuiltTemplateLookupHash( 'cms', 'database', $directoryName ) . '_' . static::cleanGroupName( $directoryName ) );
if ( isset( Store::i()->$key ) )
{
unset(Store::i()->$key);
}
Db::i()->insert( 'cms_templates', array(
'template_key' => str_replace( ' ', '_', 'database_' . $directoryName . '_' . $title ),
'template_title' => $title,
'template_desc' => '',
'template_content' => $html,
'template_location' => 'database',
'template_group' => $directoryName,
'template_original_group' => $templateType,
'template_container' => 0,
'template_params' => ( isset($params[1]) ) ? $params[1] : '',
'template_master' => 0,
'template_user_created' => 0,
'template_type' => 'template'
) );
}
}
/**
* Import a custom page wrapper
*
* @param string $wrapperName
* @return void
*/
public static function importPageWrapper( string $wrapperName ) : void
{
$file = ROOT_PATH . "/applications/cms/dev/html/page/custom_wrappers/" . $wrapperName;
if( !file_exists( $file ) )
{
return;
}
$wrapperName = str_replace( '.phtml', '', $wrapperName );
/* Delete the original */
Db::i()->delete( 'cms_templates', [ 'template_location=? and template_title=? and template_group=? and template_master=?', 'page', $wrapperName, 'custom_wrappers', 0 ] );
$html = file_get_contents( $file );
/* Parse the header tag */
preg_match( '/^<ips:template parameters="(.+?)?"([^>]+?)>(\r\n?|\n)/', $html, $params );
/* Strip it */
$html = ( isset($params[0]) ) ? str_replace( $params[0], '', $html ) : $html;
/* remove compiled version */
$key = strtolower( 'template_cms_' .static::makeBuiltTemplateLookupHash( 'cms', 'page', 'custom_wrappers' ) . '_' . static::cleanGroupName( $wrapperName ) );
if ( isset( Store::i()->$key ) )
{
unset(Store::i()->$key);
}
Db::i()->insert( 'cms_templates', array(
'template_key' => 'page_custom_wrappers_' . $wrapperName,
'template_title' => $wrapperName,
'template_desc' => '',
'template_content' => $html,
'template_location' => 'page',
'template_group' => 'custom_wrappers',
'template_original_group' => null,
'template_container' => 0,
'template_params' => ( isset($params[1]) ) ? $params[1] : '',
'template_master' => 0,
'template_user_created' => 0,
'template_type' => 'template'
) );
}
/**
* Write a template to disk
*
@@ -43,6 +43,11 @@ class DatabaseNavigation extends PermissionCache
*/
public string $app = 'cms';
/**
* @brief Prevent caching for this block
*/
public bool $neverCache = true;
/**
* Initialise this widget
*
+16
View File
@@ -368,4 +368,20 @@ implements Polymorphic
return '';
}
/**
* Return a list of all implemented keys. When the class name is dynamically generated,
* we don't have an easy way to determine if we should actually load the class or not.
*
* @return array
*/
public static function getWidgetKeys(): array
{
$return = [];
foreach( Databases::databases() as $db )
{
$return[] = 'RecordFeed' . $db->_id;
}
return $return;
}
}