Merge pull request #6340 from MrPetovan/bug/1495-fix-admin-theme-settings
Fix site theme settings modal form
This commit is contained in:
commit
034d0f650b
|
@ -89,12 +89,10 @@ function admin_post(App $a)
|
||||||
|
|
||||||
$theme = $a->argv[2];
|
$theme = $a->argv[2];
|
||||||
if (is_file("view/theme/$theme/config.php")) {
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
$orig_theme = Renderer::$theme;
|
$a->setCurrentTheme($theme);
|
||||||
$orig_page = $a->page;
|
|
||||||
$orig_session_theme = $_SESSION['theme'];
|
|
||||||
require_once "view/theme/$theme/theme.php";
|
require_once "view/theme/$theme/theme.php";
|
||||||
require_once "view/theme/$theme/config.php";
|
require_once "view/theme/$theme/config.php";
|
||||||
$_SESSION['theme'] = $theme;
|
|
||||||
|
|
||||||
$init = $theme . '_init';
|
$init = $theme . '_init';
|
||||||
if (function_exists($init)) {
|
if (function_exists($init)) {
|
||||||
|
@ -103,17 +101,13 @@ function admin_post(App $a)
|
||||||
if (function_exists('theme_admin_post')) {
|
if (function_exists('theme_admin_post')) {
|
||||||
theme_admin_post($a);
|
theme_admin_post($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['theme'] = $orig_session_theme;
|
|
||||||
Renderer::$theme = $orig_theme;
|
|
||||||
$a->page = $orig_page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info(L10n::t('Theme settings updated.'));
|
info(L10n::t('Theme settings updated.'));
|
||||||
if ($a->isAjax()) {
|
if ($a->isAjax()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$return_path = 'admin/themes/' . $theme;
|
$return_path = 'admin/themes/' . $theme . (!empty($_GET['mode']) ? '?mode=' . $_GET['mode'] : '');
|
||||||
break;
|
break;
|
||||||
case 'tos':
|
case 'tos':
|
||||||
admin_page_tos_post($a);
|
admin_page_tos_post($a);
|
||||||
|
@ -2312,12 +2306,10 @@ function admin_page_themes(App $a)
|
||||||
|
|
||||||
$admin_form = '';
|
$admin_form = '';
|
||||||
if (is_file("view/theme/$theme/config.php")) {
|
if (is_file("view/theme/$theme/config.php")) {
|
||||||
$orig_theme = Renderer::$theme;
|
$a->setCurrentTheme($theme);
|
||||||
$orig_page = $a->page;
|
|
||||||
$orig_session_theme = $_SESSION['theme'];
|
|
||||||
require_once "view/theme/$theme/theme.php";
|
require_once "view/theme/$theme/theme.php";
|
||||||
require_once "view/theme/$theme/config.php";
|
require_once "view/theme/$theme/config.php";
|
||||||
$_SESSION['theme'] = $theme;
|
|
||||||
|
|
||||||
$init = $theme . "_init";
|
$init = $theme . "_init";
|
||||||
if (function_exists($init)) {
|
if (function_exists($init)) {
|
||||||
|
@ -2327,10 +2319,6 @@ function admin_page_themes(App $a)
|
||||||
if (function_exists('theme_admin')) {
|
if (function_exists('theme_admin')) {
|
||||||
$admin_form = theme_admin($a);
|
$admin_form = theme_admin($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['theme'] = $orig_session_theme;
|
|
||||||
Renderer::$theme = $orig_theme;
|
|
||||||
$a->page = $orig_page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$screenshot = [Theme::getScreenshot($theme), L10n::t('Screenshot')];
|
$screenshot = [Theme::getScreenshot($theme), L10n::t('Screenshot')];
|
||||||
|
@ -2345,7 +2333,7 @@ function admin_page_themes(App $a)
|
||||||
'$toggle' => L10n::t('Toggle'),
|
'$toggle' => L10n::t('Toggle'),
|
||||||
'$settings' => L10n::t('Settings'),
|
'$settings' => L10n::t('Settings'),
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
'$addon' => $theme,
|
'$addon' => $theme . (!empty($_GET['mode']) ? '?mode=' . $_GET['mode'] : ''),
|
||||||
'$status' => $status,
|
'$status' => $status,
|
||||||
'$action' => $action,
|
'$action' => $action,
|
||||||
'$info' => Theme::getInfo($theme),
|
'$info' => Theme::getInfo($theme),
|
||||||
|
|
41
src/App.php
41
src/App.php
|
@ -1360,14 +1360,18 @@ class App
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//// @TODO Compute the current theme only once (this behavior has
|
if (!$this->currentTheme) {
|
||||||
/// already been implemented, but it didn't work well -
|
|
||||||
/// https://github.com/friendica/friendica/issues/5092)
|
|
||||||
$this->computeCurrentTheme();
|
$this->computeCurrentTheme();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->currentTheme;
|
return $this->currentTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCurrentTheme($theme)
|
||||||
|
{
|
||||||
|
$this->currentTheme = $theme;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the current theme name based on the node settings, the user settings and the device type
|
* Computes the current theme name based on the node settings, the user settings and the device type
|
||||||
*
|
*
|
||||||
|
@ -1706,16 +1710,7 @@ class App
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load current theme info
|
$content = '';
|
||||||
$theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
|
|
||||||
if (file_exists($theme_info_file)) {
|
|
||||||
require_once $theme_info_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialise content region
|
|
||||||
if ($this->getMode()->isNormal()) {
|
|
||||||
Core\Addon::callHooks('page_content_top', $this->page['content']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call module functions
|
// Call module functions
|
||||||
if ($this->module_loaded) {
|
if ($this->module_loaded) {
|
||||||
|
@ -1748,20 +1743,28 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->error) {
|
if (! $this->error) {
|
||||||
$arr = ['content' => $this->page['content']];
|
$arr = ['content' => $content];
|
||||||
Core\Addon::callHooks($this->module . '_mod_content', $arr);
|
Core\Addon::callHooks($this->module . '_mod_content', $arr);
|
||||||
$this->page['content'] = $arr['content'];
|
$content = $arr['content'];
|
||||||
$arr = ['content' => call_user_func([$this->module_class, 'content'])];
|
$arr = ['content' => call_user_func([$this->module_class, 'content'])];
|
||||||
Core\Addon::callHooks($this->module . '_mod_aftercontent', $arr);
|
Core\Addon::callHooks($this->module . '_mod_aftercontent', $arr);
|
||||||
$this->page['content'] .= $arr['content'];
|
$content .= $arr['content'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_content_loaded')) {
|
// Load current theme info after module has been executed as theme could have been set in module
|
||||||
$func = str_replace('-', '_', $this->getCurrentTheme()) . '_content_loaded';
|
$theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
|
||||||
$func($this);
|
if (file_exists($theme_info_file)) {
|
||||||
|
require_once $theme_info_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialise content region
|
||||||
|
if ($this->getMode()->isNormal()) {
|
||||||
|
Core\Addon::callHooks('page_content_top', $this->page['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->page['content'] .= $content;
|
||||||
|
|
||||||
/* Create the page head after setting the language
|
/* Create the page head after setting the language
|
||||||
* and getting any auth credentials.
|
* and getting any auth credentials.
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
{{if $admin_form}}
|
{{if $admin_form}}
|
||||||
<h3>{{$settings}}</h3>
|
<h3>{{$settings}}</h3>
|
||||||
<form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$addon}}/">
|
<form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$addon}}">
|
||||||
{{$admin_form nofilter}}
|
{{$admin_form nofilter}}
|
||||||
</form>
|
</form>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
var theme = $("#id_theme :selected").val();
|
var theme = $("#id_theme :selected").val();
|
||||||
$("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
|
$("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
|
||||||
},*/
|
},*/
|
||||||
href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val(),
|
iframe: true,
|
||||||
|
href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val() + "?mode=minimal",
|
||||||
onComplete: function(){
|
onComplete: function(){
|
||||||
$("div#fancybox-content form").submit(function(e){
|
$("div#fancybox-content form").submit(function(e){
|
||||||
var url = $(this).attr('action');
|
var url = $(this).attr('action');
|
||||||
|
|
|
@ -29,23 +29,23 @@ Don't blame me too much for ugly code and hacks. Fix it ;-)
|
||||||
|
|
||||||
#### Screenshots
|
#### Screenshots
|
||||||
**Default**
|
**Default**
|
||||||
![Default - Stream](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot.png)
|
![Default - Stream](https://git.friendi.ca/friendica/friendica/raw/branch/master/view/theme/frio/img/screenshots/screenshot.png)
|
||||||
|
|
||||||
**Modals**
|
**Modals**
|
||||||
![Modals](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-jot-modal.png)
|
![Modals](https://git.friendi.ca/friendica/friendica/raw/branch/master/view/theme/frio/img/screenshots/screenshot-jot-modal.png)
|
||||||
|
|
||||||
**Theme - Settings**
|
**Theme - Settings**
|
||||||
![Theme - Settings](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-settings.png)
|
![Theme - Settings](https://git.friendi.ca/friendica/friendica/raw/branch/master/view/theme/frio/img/screenshots/screenshot-settings.png)
|
||||||
|
|
||||||
**Red scheme**
|
**Red scheme**
|
||||||
![Red scheme](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-scheme-red.png)
|
![Red scheme](https://git.friendi.ca/friendica/friendica/raw/branch/master/view/theme/frio/img/screenshots/screenshot-scheme-red.png)
|
||||||
|
|
||||||
**Love Music scheme**
|
**Love Music scheme**
|
||||||
![Love Music scheme](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-scheme-love-music.png)
|
![Love Music scheme](https://git.friendi.ca/friendica/friendica/raw/branch/master/view/theme/frio/img/screenshots/screenshot-scheme-love-music.png)
|
||||||
|
|
||||||
**frio on mobile**
|
**frio on mobile**
|
||||||
|
|
||||||
![frio on mobile](https://github.com/rabuzarus/frio/blob/master/img/screenshots/screenshot-mobile.png)
|
![frio on mobile](https://git.friendi.ca/friendica/friendica/raw/branch/master/view/theme/frio/img/screenshots/screenshot-mobile.png)
|
||||||
|
|
||||||
#### Credits:
|
#### Credits:
|
||||||
HumHub - Social Network Kit - <https://github.com/humhub/humhub>
|
HumHub - Social Network Kit - <https://github.com/humhub/humhub>
|
||||||
|
|
|
@ -130,6 +130,15 @@ blockquote {
|
||||||
/*
|
/*
|
||||||
* standard page elements
|
* standard page elements
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
section.minimal {
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#back-to-top {
|
#back-to-top {
|
||||||
display: none;
|
display: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
var theme = $("#id_theme :selected").val();
|
var theme = $("#id_theme :selected").val();
|
||||||
$("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
|
$("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
|
||||||
},*/
|
},*/
|
||||||
href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val(),
|
iframe: true,
|
||||||
|
href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val() + "?mode=minimal",
|
||||||
onComplete: function(){
|
onComplete: function(){
|
||||||
$("div#fancybox-content form").submit(function(e){
|
$("div#fancybox-content form").submit(function(e){
|
||||||
var url = $(this).attr('action');
|
var url = $(this).attr('action');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user