Browse Source

Fixed missing advanced theming option

Made advanced theming option independent from red basic
master
antil0pa 1 year ago
parent
commit
8f4ded40ee
9 changed files with 194 additions and 198 deletions
  1. +60
    -58
      beetroot/php/config.php
  2. +25
    -25
      beetroot/php/style.php
  3. +0
    -0
      beetroot/schema/default.css
  4. +1
    -0
      beetroot/schema/default.php
  5. +0
    -0
      beetroot/tpl/navbar_default.tpl.bak
  6. +22
    -22
      beetroot/tpl/theme_settings.tpl
  7. +59
    -65
      cyberpunk/php/config.php
  8. +22
    -22
      cyberpunk/php/style.php
  9. +5
    -6
      cyberpunk/tpl/theme_settings.tpl

+ 60
- 58
beetroot/php/config.php View File

@@ -13,7 +13,7 @@ class BeetrootConfig {

if(in_array('view/theme/beetroot/schema/default.php', $files)) {
$scheme_choices['---'] = t('Default');
$scheme_choices['focus'] = t('Focus (Hubzilla default)');
//$scheme_choices['focus'] = t('Focus (Hubzilla default)');
}
else {
$scheme_choices['---'] = t('Focus (Hubzilla default)');
@@ -37,24 +37,25 @@ class BeetrootConfig {
}

$arr = array();
$arr['narrow_navbar'] = get_pconfig(local_channel(),'redbasic', 'narrow_navbar' );
$arr['nav_bg'] = get_pconfig(local_channel(),'redbasic', 'nav_bg' );
$arr['nav_icon_colour'] = get_pconfig(local_channel(),'redbasic', 'nav_icon_colour' );
$arr['nav_active_icon_colour'] = get_pconfig(local_channel(),'redbasic', 'nav_active_icon_colour' );
$arr['link_colour'] = get_pconfig(local_channel(),'redbasic', 'link_colour' );
$arr['link_bgcolour'] = get_pconfig(local_channel(),'redbasic', 'link_bgcolour' );
$arr['banner_colour'] = get_pconfig(local_channel(),'redbasic', 'banner_colour' );
$arr['bgcolour'] = get_pconfig(local_channel(),'redbasic', 'background_colour' );
$arr['background_image'] = get_pconfig(local_channel(),'redbasic', 'background_image' );
$arr['item_colour'] = get_pconfig(local_channel(),'redbasic', 'item_colour' );
$arr['comment_item_colour'] = get_pconfig(local_channel(),'redbasic', 'comment_item_colour' );
$arr['font_size'] = get_pconfig(local_channel(),'redbasic', 'font_size' );
$arr['font_colour'] = get_pconfig(local_channel(),'redbasic', 'font_colour' );
$arr['radius'] = get_pconfig(local_channel(),'redbasic', 'radius' );
$arr['shadow'] = get_pconfig(local_channel(),'redbasic', 'photo_shadow' );
$arr['converse_width']=get_pconfig(local_channel(),"redbasic","converse_width");
$arr['top_photo']=get_pconfig(local_channel(),"redbasic","top_photo");
$arr['reply_photo']=get_pconfig(local_channel(),"redbasic","reply_photo");
$arr['narrow_navbar'] = get_pconfig(local_channel(),'beetroot', 'narrow_navbar' );
$arr['nav_bg'] = get_pconfig(local_channel(),'beetroot', 'nav_bg' );
$arr['nav_icon_colour'] = get_pconfig(local_channel(),'beetroot', 'nav_icon_colour' );
$arr['nav_active_icon_colour'] = get_pconfig(local_channel(),'beetroot', 'nav_active_icon_colour' );
$arr['link_colour'] = get_pconfig(local_channel(),'beetroot', 'link_colour' );
$arr['link_bgcolour'] = get_pconfig(local_channel(),'beetroot', 'link_bgcolour' );
$arr['banner_colour'] = get_pconfig(local_channel(),'beetroot', 'banner_colour' );
$arr['bgcolour'] = get_pconfig(local_channel(),'beetroot', 'background_colour' );
$arr['background_image'] = get_pconfig(local_channel(),'beetroot', 'background_image' );
$arr['item_colour'] = get_pconfig(local_channel(),'beetroot', 'item_colour' );
$arr['comment_item_colour'] = get_pconfig(local_channel(),'beetroot', 'comment_item_colour' );
$arr['font_size'] = get_pconfig(local_channel(),'beetroot', 'font_size' );
$arr['font_colour'] = get_pconfig(local_channel(),'beetroot', 'font_colour' );
$arr['radius'] = get_pconfig(local_channel(),'beetroot', 'radius' );
$arr['shadow'] = get_pconfig(local_channel(),'beetroot', 'photo_shadow' );
$arr['converse_width']=get_pconfig(local_channel(),"beetroot","converse_width");
$arr['top_photo']=get_pconfig(local_channel(),"beetroot","top_photo");
$arr['reply_photo']=get_pconfig(local_channel(),"beetroot","reply_photo");
$arr['advanced_theming'] = get_pconfig(local_channel(), 'beetroot', 'advanced_theming');
return $this->form($arr);
}

@@ -63,31 +64,32 @@ class BeetrootConfig {
return;
}

if (isset($_POST['redbasic-settings-submit'])) {
set_pconfig(local_channel(), 'redbasic', 'narrow_navbar', $_POST['redbasic_narrow_navbar']);
set_pconfig(local_channel(), 'redbasic', 'nav_bg', $_POST['redbasic_nav_bg']);
set_pconfig(local_channel(), 'redbasic', 'nav_icon_colour', $_POST['redbasic_nav_icon_colour']);
set_pconfig(local_channel(), 'redbasic', 'nav_active_icon_colour', $_POST['redbasic_nav_active_icon_colour']);
set_pconfig(local_channel(), 'redbasic', 'link_colour', $_POST['redbasic_link_colour']);
set_pconfig(local_channel(), 'redbasic', 'link_bgcolour', $_POST['redbasic_link_bgcolour']);
set_pconfig(local_channel(), 'redbasic', 'background_colour', $_POST['redbasic_background_colour']);
set_pconfig(local_channel(), 'redbasic', 'banner_colour', $_POST['redbasic_banner_colour']);
set_pconfig(local_channel(), 'redbasic', 'background_image', $_POST['redbasic_background_image']);
set_pconfig(local_channel(), 'redbasic', 'item_colour', $_POST['redbasic_item_colour']);
set_pconfig(local_channel(), 'redbasic', 'comment_item_colour', $_POST['redbasic_comment_item_colour']);
set_pconfig(local_channel(), 'redbasic', 'font_size', $_POST['redbasic_font_size']);
set_pconfig(local_channel(), 'redbasic', 'font_colour', $_POST['redbasic_font_colour']);
set_pconfig(local_channel(), 'redbasic', 'radius', $_POST['redbasic_radius']);
set_pconfig(local_channel(), 'redbasic', 'photo_shadow', $_POST['redbasic_shadow']);
set_pconfig(local_channel(), 'redbasic', 'converse_width', $_POST['redbasic_converse_width']);
set_pconfig(local_channel(), 'redbasic', 'top_photo', $_POST['redbasic_top_photo']);
set_pconfig(local_channel(), 'redbasic', 'reply_photo', $_POST['redbasic_reply_photo']);
if (isset($_POST['beetroot-settings-submit'])) {
set_pconfig(local_channel(), 'beetroot', 'narrow_navbar', $_POST['beetroot_narrow_navbar']);
set_pconfig(local_channel(), 'beetroot', 'nav_bg', $_POST['beetroot_nav_bg']);
set_pconfig(local_channel(), 'beetroot', 'nav_icon_colour', $_POST['beetroot_nav_icon_colour']);
set_pconfig(local_channel(), 'beetroot', 'nav_active_icon_colour', $_POST['beetroot_nav_active_icon_colour']);
set_pconfig(local_channel(), 'beetroot', 'link_colour', $_POST['beetroot_link_colour']);
set_pconfig(local_channel(), 'beetroot', 'link_bgcolour', $_POST['beetroot_link_bgcolour']);
set_pconfig(local_channel(), 'beetroot', 'background_colour', $_POST['beetroot_background_colour']);
set_pconfig(local_channel(), 'beetroot', 'banner_colour', $_POST['beetroot_banner_colour']);
set_pconfig(local_channel(), 'beetroot', 'background_image', $_POST['beetroot_background_image']);
set_pconfig(local_channel(), 'beetroot', 'item_colour', $_POST['beetroot_item_colour']);
set_pconfig(local_channel(), 'beetroot', 'comment_item_colour', $_POST['beetroot_comment_item_colour']);
set_pconfig(local_channel(), 'beetroot', 'font_size', $_POST['beetroot_font_size']);
set_pconfig(local_channel(), 'beetroot', 'font_colour', $_POST['beetroot_font_colour']);
set_pconfig(local_channel(), 'beetroot', 'radius', $_POST['beetroot_radius']);
set_pconfig(local_channel(), 'beetroot', 'photo_shadow', $_POST['beetroot_shadow']);
set_pconfig(local_channel(), 'beetroot', 'converse_width', $_POST['beetroot_converse_width']);
set_pconfig(local_channel(), 'beetroot', 'top_photo', $_POST['beetroot_top_photo']);
set_pconfig(local_channel(), 'beetroot', 'reply_photo', $_POST['beetroot_reply_photo']);
set_pconfig(local_channel(), 'beetroot', 'advanced_theming', $_POST['beetroot_advanced_theming']);
}
}

function form($arr) {

if(get_pconfig(local_channel(), 'redbasic','advanced_theming'))
if(get_pconfig(local_channel(), 'beetroot','advanced_theming'))
$expert = 1;


@@ -97,25 +99,25 @@ class BeetrootConfig {
'$theme' => \App::$channel['channel_theme'],
'$expert' => $expert,
'$title' => t("Theme settings"),
'$narrow_navbar' => array('redbasic_narrow_navbar',t('Narrow navbar'),$arr['narrow_navbar'], '', array(t('No'),t('Yes'))),
'$nav_bg' => array('redbasic_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
'$nav_icon_colour' => array('redbasic_nav_icon_colour', t('Navigation bar icon color '), $arr['nav_icon_colour']),
'$nav_active_icon_colour' => array('redbasic_nav_active_icon_colour', t('Navigation bar active icon color '), $arr['nav_active_icon_colour']),
'$link_colour' => array('redbasic_link_colour', t('Link color'), $arr['link_colour'], '', $link_colours),
'$link_bgcolour' => array('redbasic_link_bgcolour', t('Link bgcolor'), $arr['link_bgcolour']),
'$banner_colour' => array('redbasic_banner_colour', t('Set font-color for banner'), $arr['banner_colour']),
'$bgcolour' => array('redbasic_background_colour', t('Set the background color'), $arr['bgcolour']),
'$background_image' => array('redbasic_background_image', t('Set the background image'), $arr['background_image']),
'$item_colour' => array('redbasic_item_colour', t('Set the background color of items'), $arr['item_colour']),
'$comment_item_colour' => array('redbasic_comment_item_colour', t('Set the background color of comments'), $arr['comment_item_colour']),
'$font_size' => array('redbasic_font_size', t('Set font-size for the entire application'), $arr['font_size'], t('Examples: 1rem, 100%, 16px')),
'$font_colour' => array('redbasic_font_colour', t('Set font-color for posts and comments'), $arr['font_colour']),
'$radius' => array('redbasic_radius', t('Set radius of corners'), $arr['radius'], t('Example: 4px')),
'$shadow' => array('redbasic_shadow', t('Set shadow depth of photos'), $arr['shadow']),
'$converse_width' => array('redbasic_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')),
'$top_photo' => array('redbasic_top_photo', t('Set size of conversation author photo'), $arr['top_photo']),
'$reply_photo' => array('redbasic_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']),
'$advanced_theming' => ['redbasic_advanced_theming', t('Show advanced settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]]
'$narrow_navbar' => array('beetroot_narrow_navbar',t('Narrow navbar'),$arr['narrow_navbar'], '', array(t('No'),t('Yes'))),
'$nav_bg' => array('beetroot_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
'$nav_icon_colour' => array('beetroot_nav_icon_colour', t('Navigation bar icon color '), $arr['nav_icon_colour']),
'$nav_active_icon_colour' => array('beetroot_nav_active_icon_colour', t('Navigation bar active icon color '), $arr['nav_active_icon_colour']),
'$link_colour' => array('beetroot_link_colour', t('Link color'), $arr['link_colour'], '', $link_colours),
'$link_bgcolour' => array('beetroot_link_bgcolour', t('Link bgcolor'), $arr['link_bgcolour']),
'$banner_colour' => array('beetroot_banner_colour', t('Set font-color for banner'), $arr['banner_colour']),
'$bgcolour' => array('beetroot_background_colour', t('Set the background color'), $arr['bgcolour']),
'$background_image' => array('beetroot_background_image', t('Set the background image'), $arr['background_image']),
'$item_colour' => array('beetroot_item_colour', t('Set the background color of items'), $arr['item_colour']),
'$comment_item_colour' => array('beetroot_comment_item_colour', t('Set the background color of comments'), $arr['comment_item_colour']),
'$font_size' => array('beetroot_font_size', t('Set font-size for the entire application'), $arr['font_size'], t('Examples: 1rem, 100%, 16px')),
'$font_colour' => array('beetroot_font_colour', t('Set font-color for posts and comments'), $arr['font_colour']),
'$radius' => array('beetroot_radius', t('Set radius of corners'), $arr['radius'], t('Example: 4px')),
'$shadow' => array('beetroot_shadow', t('Set shadow depth of photos'), $arr['shadow']),
'$converse_width' => array('beetroot_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')),
'$top_photo' => array('beetroot_top_photo', t('Set size of conversation author photo'), $arr['top_photo']),
'$reply_photo' => array('beetroot_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']),
'$advanced_theming' => ['beetroot_advanced_theming', t('Show advanced settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]]
));

return $o;


+ 25
- 25
beetroot/php/style.php View File

@@ -6,29 +6,29 @@ if(! App::$install) {
$uid = get_theme_uid();

if($uid) {
load_pconfig($uid,'redbasic');
load_pconfig($uid,'beetroot');
}

// Load the owners pconfig
$nav_bg = get_pconfig($uid, 'redbasic', 'nav_bg');
$nav_icon_colour = get_pconfig($uid, 'redbasic', 'nav_icon_colour');
$nav_active_icon_colour = get_pconfig($uid, 'redbasic', 'nav_active_icon_colour');
$banner_colour = get_pconfig($uid,'redbasic','banner_colour');
$narrow_navbar = get_pconfig($uid,'redbasic','narrow_navbar');
$link_colour = get_pconfig($uid, 'redbasic', 'link_colour');
$link_bgcolour = get_pconfig($uid, 'redbasic', 'link_bgcolour');
$schema = get_pconfig($uid,'redbasic','schema');
$bgcolour = get_pconfig($uid, 'redbasic', 'background_colour');
$background_image = get_pconfig($uid, 'redbasic', 'background_image');
$item_colour = get_pconfig($uid, 'redbasic', 'item_colour');
$comment_item_colour = get_pconfig($uid, 'redbasic', 'comment_item_colour');
$font_size = get_pconfig($uid, 'redbasic', 'font_size');
$font_colour = get_pconfig($uid, 'redbasic', 'font_colour');
$radius = get_pconfig($uid, 'redbasic', 'radius');
$shadow = get_pconfig($uid,'redbasic','photo_shadow');
$converse_width=get_pconfig($uid,'redbasic','converse_width');
$top_photo=get_pconfig($uid,'redbasic','top_photo');
$reply_photo=get_pconfig($uid,'redbasic','reply_photo');
$nav_bg = get_pconfig($uid, 'beetroot', 'nav_bg');
$nav_icon_colour = get_pconfig($uid, 'beetroot', 'nav_icon_colour');
$nav_active_icon_colour = get_pconfig($uid, 'beetroot', 'nav_active_icon_colour');
$banner_colour = get_pconfig($uid,'beetroot','banner_colour');
$narrow_navbar = get_pconfig($uid,'beetroot','narrow_navbar');
$link_colour = get_pconfig($uid, 'beetroot', 'link_colour');
$link_bgcolour = get_pconfig($uid, 'beetroot', 'link_bgcolour');
$schema = get_pconfig($uid,'beetroot','schema');
$bgcolour = get_pconfig($uid, 'beetroot', 'background_colour');
$background_image = get_pconfig($uid, 'beetroot', 'background_image');
$item_colour = get_pconfig($uid, 'beetroot', 'item_colour');
$comment_item_colour = get_pconfig($uid, 'beetroot', 'comment_item_colour');
$font_size = get_pconfig($uid, 'beetroot', 'font_size');
$font_colour = get_pconfig($uid, 'beetroot', 'font_colour');
$radius = get_pconfig($uid, 'beetroot', 'radius');
$shadow = get_pconfig($uid,'beetroot','photo_shadow');
$converse_width=get_pconfig($uid,'beetroot','converse_width');
$top_photo=get_pconfig($uid,'beetroot','top_photo');
$reply_photo=get_pconfig($uid,'beetroot','reply_photo');
}

// Now load the scheme. If a value is changed above, we'll keep the settings
@@ -114,8 +114,8 @@ if(! $reply_photo)
if(file_exists('view/theme/redbasic/css/style.css')) {

$x = file_get_contents('view/theme/redbasic/css/style.css');
$x .= file_get_contents('view/theme/beetroot/css/style.css');
$x .= file_get_contents('view/theme/beetroot/css/style.css');

if($narrow_navbar && file_exists('view/theme/redbasic/css/narrow_navbar.css')) {
$x .= file_get_contents('view/theme/redbasic/css/narrow_navbar.css');
@@ -165,7 +165,7 @@ if(file_exists('view/theme/redbasic/css/style.css')) {

// Set the schema to the default schema in derived themes. See the documentation for creating derived themes how to override this.

if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'redbasic')
set_pconfig(local_channel(), 'redbasic', 'schema', '---');
if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'beetroot')
set_pconfig(local_channel(), 'beetroot', 'schema', '---');

echo @file_get_contents('view/theme/beetroot/css/style.css');
//echo @file_get_contents('view/theme/beetroot/css/style.css');

+ 0
- 0
beetroot/schema/default.css View File


+ 1
- 0
beetroot/schema/default.php View File

@@ -0,0 +1 @@
<?php

beetroot/tpl/navbar_default.tpl → beetroot/tpl/navbar_default.tpl.bak View File


+ 22
- 22
beetroot/tpl/theme_settings.tpl View File

@@ -3,33 +3,33 @@
{{include file="field_input.tpl" field=$font_size}}
{{include file="field_checkbox.tpl" field=$advanced_theming}}
{{if $expert}}
{{include file="field_colorinput.tpl" field=$nav_bg}}
{{include file="field_colorinput.tpl" field=$nav_icon_colour}}
{{include file="field_colorinput.tpl" field=$nav_active_icon_colour}}
{{include file="field_colorinput.tpl" field=$banner_colour}}
{{include file="field_colorinput.tpl" field=$bgcolour}}
{{include file="field_colorinput.tpl" field=$background_image}}
{{include file="field_colorinput.tpl" field=$item_colour}}
{{include file="field_colorinput.tpl" field=$comment_item_colour}}
{{*include file="field_colorinput.tpl" field=$comment_border_colour*}}
{{*include file="field_input.tpl" field=$comment_indent*}}
{{include file="field_colorinput.tpl" field=$font_colour}}
{{include file="field_colorinput.tpl" field=$link_colour}}
{{include file="field_colorinput.tpl" field=$link_bgcolour}}
{{include file="field_input.tpl" field=$radius}}
{{include file="field_input.tpl" field=$shadow}}
{{include file="field_input.tpl" field=$top_photo}}
{{include file="field_input.tpl" field=$reply_photo}}
{{include file="field_colorinput.tpl" field=$nav_bg}}
{{include file="field_colorinput.tpl" field=$nav_icon_colour}}
{{include file="field_colorinput.tpl" field=$nav_active_icon_colour}}
{{include file="field_colorinput.tpl" field=$banner_colour}}
{{include file="field_colorinput.tpl" field=$bgcolour}}
{{include file="field_colorinput.tpl" field=$background_image}}
{{include file="field_colorinput.tpl" field=$item_colour}}
{{include file="field_colorinput.tpl" field=$comment_item_colour}}
{{*include file="field_colorinput.tpl" field=$comment_border_colour*}}
{{*include file="field_input.tpl" field=$comment_indent*}}
{{include file="field_colorinput.tpl" field=$font_colour}}
{{include file="field_colorinput.tpl" field=$link_colour}}
{{include file="field_colorinput.tpl" field=$link_bgcolour}}
{{include file="field_input.tpl" field=$radius}}
{{include file="field_input.tpl" field=$shadow}}
{{include file="field_input.tpl" field=$top_photo}}
{{include file="field_input.tpl" field=$reply_photo}}

<script>
$(function(){
$('#id_redbasic_nav_bg, #id_redbasic_nav_icon_colour, #id_redbasic_nav_active_icon_colour, #id_redbasic_banner_colour').colorpicker({format: 'rgba'});
$('#id_redbasic_link_colour,#id_redbasic_link_bgcolour,#id_redbasic_background_colour').colorpicker();
$('#id_redbasic_toolicon_colour,#id_redbasic_toolicon_activecolour,#id_redbasic_font_colour').colorpicker();
$('#id_redbasic_item_colour,#id_redbasic_comment_item_colour,#id_redbasic_comment_border_colour').colorpicker({format: 'rgba'});
$('#id_beetroot_nav_bg, #id_beetroot_nav_icon_colour, #id_beetroot_nav_active_icon_colour, #id_beetroot_banner_colour').colorpicker({format: 'rgba'});
$('#id_beetroot_link_colour,#id_beetroot_link_bgcolour,#id_beetroot_background_colour').colorpicker();
$('#id_beetroot_toolicon_colour,#id_beetroot_toolicon_activecolour,#id_beetroot_font_colour').colorpicker();
$('#id_beetroot_item_colour,#id_beetroot_comment_item_colour,#id_beetroot_comment_border_colour').colorpicker({format: 'rgba'});
});
</script>
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="redbasic-settings-submit" class="btn btn-primary">{{$submit}}</button>
<button type="submit" name="beetroot-settings-submit" class="btn btn-primary">{{$submit}}</button>
</div>

+ 59
- 65
cyberpunk/php/config.php View File

@@ -32,97 +32,91 @@ class CyberpunkConfig {
}

function get() {
if(! local_channel()) {
if(! local_channel()) {
return;
}

$arr = array();
$arr['narrow_navbar'] = get_pconfig(local_channel(),'redbasic', 'narrow_navbar' );
$arr['nav_bg'] = get_pconfig(local_channel(),'redbasic', 'nav_bg' );
$arr['nav_icon_colour'] = get_pconfig(local_channel(),'redbasic', 'nav_icon_colour' );
$arr['nav_active_icon_colour'] = get_pconfig(local_channel(),'redbasic', 'nav_active_icon_colour' );
$arr['link_colour'] = get_pconfig(local_channel(),'redbasic', 'link_colour' );
$arr['banner_colour'] = get_pconfig(local_channel(),'redbasic', 'banner_colour' );
$arr['bgcolour'] = get_pconfig(local_channel(),'redbasic', 'background_colour' );
$arr['background_image'] = get_pconfig(local_channel(),'redbasic', 'background_image' );
$arr['item_colour'] = get_pconfig(local_channel(),'redbasic', 'item_colour' );
$arr['comment_item_colour'] = get_pconfig(local_channel(),'redbasic', 'comment_item_colour' );
$arr['font_size'] = get_pconfig(local_channel(),'redbasic', 'font_size' );
$arr['font_colour'] = get_pconfig(local_channel(),'redbasic', 'font_colour' );
$arr['radius'] = get_pconfig(local_channel(),'redbasic', 'radius' );
$arr['shadow'] = get_pconfig(local_channel(),'redbasic', 'photo_shadow' );
$arr['converse_width']=get_pconfig(local_channel(),"redbasic","converse_width");
$arr['top_photo']=get_pconfig(local_channel(),"redbasic","top_photo");
$arr['reply_photo']=get_pconfig(local_channel(),"redbasic","reply_photo");
$arr['advanced_theming'] = get_pconfig(local_channel(), 'redbasic', 'advanced_theming');
$arr['narrow_navbar'] = get_pconfig(local_channel(),'cyberpunk', 'narrow_navbar' );
$arr['nav_bg'] = get_pconfig(local_channel(),'cyberpunk', 'nav_bg' );
$arr['nav_icon_colour'] = get_pconfig(local_channel(),'cyberpunk', 'nav_icon_colour' );
$arr['nav_active_icon_colour'] = get_pconfig(local_channel(),'cyberpunk', 'nav_active_icon_colour' );
$arr['link_colour'] = get_pconfig(local_channel(),'cyberpunk', 'link_colour' );
$arr['banner_colour'] = get_pconfig(local_channel(),'cyberpunk', 'banner_colour' );
$arr['bgcolour'] = get_pconfig(local_channel(),'cyberpunk', 'background_colour' );
$arr['background_image'] = get_pconfig(local_channel(),'cyberpunk', 'background_image' );
$arr['item_colour'] = get_pconfig(local_channel(),'cyberpunk', 'item_colour' );
$arr['comment_item_colour'] = get_pconfig(local_channel(),'cyberpunk', 'comment_item_colour' );
$arr['font_size'] = get_pconfig(local_channel(),'cyberpunk', 'font_size' );
$arr['font_colour'] = get_pconfig(local_channel(),'cyberpunk', 'font_colour' );
$arr['radius'] = get_pconfig(local_channel(),'cyberpunk', 'radius' );
$arr['shadow'] = get_pconfig(local_channel(),'cyberpunk', 'photo_shadow' );
$arr['converse_width']=get_pconfig(local_channel(),"cyberpunk","converse_width");
$arr['top_photo']=get_pconfig(local_channel(),"cyberpunk","top_photo");
$arr['reply_photo']=get_pconfig(local_channel(),"cyberpunk","reply_photo");
$arr['advanced_theming'] = get_pconfig(local_channel(), 'cyberpunk', 'advanced_theming');
return $this->form($arr);
}

function post() {
if(!local_channel()) {
if(!local_channel()) {
return;
}

if (isset($_POST['redbasic-settings-submit'])) {
set_pconfig(local_channel(), 'redbasic', 'narrow_navbar', $_POST['redbasic_narrow_navbar']);
set_pconfig(local_channel(), 'redbasic', 'nav_bg', $_POST['redbasic_nav_bg']);
set_pconfig(local_channel(), 'redbasic', 'nav_icon_colour', $_POST['redbasic_nav_icon_colour']);
set_pconfig(local_channel(), 'redbasic', 'nav_active_icon_colour', $_POST['redbasic_nav_active_icon_colour']);
set_pconfig(local_channel(), 'redbasic', 'link_colour', $_POST['redbasic_link_colour']);
set_pconfig(local_channel(), 'redbasic', 'background_colour', $_POST['redbasic_background_colour']);
set_pconfig(local_channel(), 'redbasic', 'banner_colour', $_POST['redbasic_banner_colour']);
set_pconfig(local_channel(), 'redbasic', 'background_image', $_POST['redbasic_background_image']);
set_pconfig(local_channel(), 'redbasic', 'item_colour', $_POST['redbasic_item_colour']);
set_pconfig(local_channel(), 'redbasic', 'comment_item_colour', $_POST['redbasic_comment_item_colour']);
set_pconfig(local_channel(), 'redbasic', 'font_size', $_POST['redbasic_font_size']);
set_pconfig(local_channel(), 'redbasic', 'font_colour', $_POST['redbasic_font_colour']);
set_pconfig(local_channel(), 'redbasic', 'radius', $_POST['redbasic_radius']);
set_pconfig(local_channel(), 'redbasic', 'photo_shadow', $_POST['redbasic_shadow']);
set_pconfig(local_channel(), 'redbasic', 'converse_width', $_POST['redbasic_converse_width']);
set_pconfig(local_channel(), 'redbasic', 'top_photo', $_POST['redbasic_top_photo']);
set_pconfig(local_channel(), 'redbasic', 'reply_photo', $_POST['redbasic_reply_photo']);
set_pconfig(local_channel(), 'redbasic', 'advanced_theming', $_POST['redbasic_advanced_theming']);
if (isset($_POST['cyberpunk-settings-submit'])) {
set_pconfig(local_channel(), 'cyberpunk', 'narrow_navbar', $_POST['cyberpunk_narrow_navbar']);
set_pconfig(local_channel(), 'cyberpunk', 'nav_bg', $_POST['cyberpunk_nav_bg']);
set_pconfig(local_channel(), 'cyberpunk', 'nav_icon_colour', $_POST['cyberpunk_nav_icon_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'nav_active_icon_colour', $_POST['cyberpunk_nav_active_icon_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'link_colour', $_POST['cyberpunk_link_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'background_colour', $_POST['cyberpunk_background_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'banner_colour', $_POST['cyberpunk_banner_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'background_image', $_POST['cyberpunk_background_image']);
set_pconfig(local_channel(), 'cyberpunk', 'item_colour', $_POST['cyberpunk_item_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'comment_item_colour', $_POST['cyberpunk_comment_item_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'font_size', $_POST['cyberpunk_font_size']);
set_pconfig(local_channel(), 'cyberpunk', 'font_colour', $_POST['cyberpunk_font_colour']);
set_pconfig(local_channel(), 'cyberpunk', 'radius', $_POST['cyberpunk_radius']);
set_pconfig(local_channel(), 'cyberpunk', 'photo_shadow', $_POST['cyberpunk_shadow']);
set_pconfig(local_channel(), 'cyberpunk', 'converse_width', $_POST['cyberpunk_converse_width']);
set_pconfig(local_channel(), 'cyberpunk', 'top_photo', $_POST['cyberpunk_top_photo']);
set_pconfig(local_channel(), 'cyberpunk', 'reply_photo', $_POST['cyberpunk_reply_photo']);
set_pconfig(local_channel(), 'cyberpunk', 'advanced_theming', $_POST['cyberpunk_advanced_theming']);
}
}

function form($arr) {

if(get_pconfig(local_channel(), 'redbasic', 'advanced_theming'))
if(get_pconfig(local_channel(), 'cyberpunk', 'advanced_theming'))
$expert = 1;
$o .= replace_macros(get_markup_template('theme_settings.tpl'), array(
'$submit' => t('Submit'),
'$baseurl' => z_root(),
'$theme' => \App::$channel['channel_theme'],
'$expert' => $expert,
'$title' => t("Theme settings"),
'$narrow_navbar' => array('redbasic_narrow_navbar',t('Narrow navbar'),$arr['narrow_navbar'], '', array(t('No'),t('Yes'))),
'$nav_bg' => array('redbasic_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
'$nav_icon_colour' => array('redbasic_nav_icon_colour', t('Navigation bar icon color '), $arr['nav_icon_colour']),
'$nav_active_icon_colour' => array('redbasic_nav_active_icon_colour', t('Navigation bar active icon color '), $arr['nav_active_icon_colour']),
'$link_colour' => array('redbasic_link_colour', t('Link color'), $arr['link_colour'], '', $link_colours),
'$banner_colour' => array('redbasic_banner_colour', t('Set font-color for banner'), $arr['banner_colour']),
'$bgcolour' => array('redbasic_background_colour', t('Set the background color'), $arr['bgcolour']),
'$background_image' => array('redbasic_background_image', t('Set the background image'), $arr['background_image']),
'$item_colour' => array('redbasic_item_colour', t('Set the background color of items'), $arr['item_colour']),
'$comment_item_colour' => array('redbasic_comment_item_colour', t('Set the background color of comments'), $arr['comment_item_colour']),
'$font_size' => array('redbasic_font_size', t('Set font-size for the entire application'), $arr['font_size'], t('Examples: 1rem, 100%, 16px')),
'$font_colour' => array('redbasic_font_colour', t('Set font-color for posts and comments'), $arr['font_colour']),
'$radius' => array('redbasic_radius', t('Set radius of corners'), $arr['radius'], t('Example: 4px')),
'$shadow' => array('redbasic_shadow', t('Set shadow depth of photos'), $arr['shadow']),
'$converse_width' => array('redbasic_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')),
'$top_photo' => array('redbasic_top_photo', t('Set size of conversation author photo'), $arr['top_photo']),
'$reply_photo' => array('redbasic_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']),
'$advanced_theming' => ['redbasic_advanced_theming', t('Show advanced settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]]
'$narrow_navbar' => array('cyberpunk_narrow_navbar',t('Narrow navbar'),$arr['narrow_navbar'], '', array(t('No'),t('Yes'))),
'$nav_bg' => array('cyberpunk_nav_bg', t('Navigation bar background color'), $arr['nav_bg']),
'$nav_icon_colour' => array('cyberpunk_nav_icon_colour', t('Navigation bar icon color '), $arr['nav_icon_colour']),
'$nav_active_icon_colour' => array('cyberpunk_nav_active_icon_colour', t('Navigation bar active icon color '), $arr['nav_active_icon_colour']),
'$link_colour' => array('cyberpunk_link_colour', t('Link color'), $arr['link_colour'], '', $link_colours),
'$banner_colour' => array('cyberpunk_banner_colour', t('Set font-color for banner'), $arr['banner_colour']),
'$bgcolour' => array('cyberpunk_background_colour', t('Set the background color'), $arr['bgcolour']),
'$background_image' => array('cyberpunk_background_image', t('Set the background image'), $arr['background_image']),
'$item_colour' => array('cyberpunk_item_colour', t('Set the background color of items'), $arr['item_colour']),
'$comment_item_colour' => array('cyberpunk_comment_item_colour', t('Set the background color of comments'), $arr['comment_item_colour']),
'$font_size' => array('cyberpunk_font_size', t('Set font-size for the entire application'), $arr['font_size'], t('Examples: 1rem, 100%, 16px')),
'$font_colour' => array('cyberpunk_font_colour', t('Set font-color for posts and comments'), $arr['font_colour']),
'$radius' => array('cyberpunk_radius', t('Set radius of corners'), $arr['radius'], t('Example: 4px')),
'$shadow' => array('cyberpunk_shadow', t('Set shadow depth of photos'), $arr['shadow']),
'$converse_width' => array('cyberpunk_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')),
'$top_photo' => array('cyberpunk_top_photo', t('Set size of conversation author photo'), $arr['top_photo']),
'$reply_photo' => array('cyberpunk_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']),
'$advanced_theming' => ['cyberpunk_advanced_theming', t('Show advanced settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]]
));

return $o;
}

}







+ 22
- 22
cyberpunk/php/style.php View File

@@ -6,28 +6,28 @@ if(! App::$install) {
$uid = get_theme_uid();

if($uid) {
load_pconfig($uid,'redbasic');
load_pconfig($uid,'cyberpunk');
}

// Load the owners pconfig
$nav_bg = get_pconfig($uid, 'redbasic', 'nav_bg');
$nav_icon_colour = get_pconfig($uid, 'redbasic', 'nav_icon_colour');
$nav_active_icon_colour = get_pconfig($uid, 'redbasic', 'nav_active_icon_colour');
$banner_colour = get_pconfig($uid,'redbasic','banner_colour');
$narrow_navbar = get_pconfig($uid,'redbasic','narrow_navbar');
$link_colour = get_pconfig($uid, 'redbasic', 'link_colour');
$schema = get_pconfig($uid,'redbasic','schema');
$bgcolour = get_pconfig($uid, 'redbasic', 'background_colour');
$background_image = get_pconfig($uid, 'redbasic', 'background_image');
$item_colour = get_pconfig($uid, 'redbasic', 'item_colour');
$comment_item_colour = get_pconfig($uid, 'redbasic', 'comment_item_colour');
$font_size = get_pconfig($uid, 'redbasic', 'font_size');
$font_colour = get_pconfig($uid, 'redbasic', 'font_colour');
$radius = get_pconfig($uid, 'redbasic', 'radius');
$shadow = get_pconfig($uid,'redbasic','photo_shadow');
$converse_width=get_pconfig($uid,'redbasic','converse_width');
$top_photo=get_pconfig($uid,'redbasic','top_photo');
$reply_photo=get_pconfig($uid,'redbasic','reply_photo');
$nav_bg = get_pconfig($uid, 'cyberpunk', 'nav_bg');
$nav_icon_colour = get_pconfig($uid, 'cyberpunk', 'nav_icon_colour');
$nav_active_icon_colour = get_pconfig($uid, 'cyberpunk', 'nav_active_icon_colour');
$banner_colour = get_pconfig($uid,'cyberpunk','banner_colour');
$narrow_navbar = get_pconfig($uid,'cyberpunk','narrow_navbar');
$link_colour = get_pconfig($uid, 'cyberpunk', 'link_colour');
$schema = get_pconfig($uid,'cyberpunk','schema');
$bgcolour = get_pconfig($uid, 'cyberpunk', 'background_colour');
$background_image = get_pconfig($uid, 'cyberpunk', 'background_image');
$item_colour = get_pconfig($uid, 'cyberpunk', 'item_colour');
$comment_item_colour = get_pconfig($uid, 'cyberpunk', 'comment_item_colour');
$font_size = get_pconfig($uid, 'cyberpunk', 'font_size');
$font_colour = get_pconfig($uid, 'cyberpunk', 'font_colour');
$radius = get_pconfig($uid, 'cyberpunk', 'radius');
$shadow = get_pconfig($uid,'cyberpunk','photo_shadow');
$converse_width=get_pconfig($uid,'cyberpunk','converse_width');
$top_photo=get_pconfig($uid,'cyberpunk','top_photo');
$reply_photo=get_pconfig($uid,'cyberpunk','reply_photo');
}

// Now load the scheme. If a value is changed above, we'll keep the settings
@@ -162,7 +162,7 @@ if(file_exists('view/theme/redbasic/css/style.css')) {

// Set the schema to the default schema in derived themes. See the documentation for creating derived themes how to override this.

if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'redbasic')
set_pconfig(local_channel(), 'redbasic', 'schema', '---');
if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'cyberpunk')
set_pconfig(local_channel(), 'cyberpunk', 'schema', '---');

echo @file_get_contents('view/theme/cyberpunk/css/style.css');
//echo @file_get_contents('view/theme/cyberpunk/css/style.css');

+ 5
- 6
cyberpunk/tpl/theme_settings.tpl View File

@@ -22,14 +22,13 @@

<script>
$(function(){
$('#id_redbasic_nav_bg, #id_redbasic_nav_icon_colour, #id_redbasic_nav_active_icon_colour, #id_redbasic_banner_colour').colorpicker({format: 'rgba'});
$('#id_redbasic_link_colour,#id_redbasic_background_colour').colorpicker();
$('#id_redbasic_toolicon_colour,#id_redbasic_toolicon_activecolour,#id_redbasic_font_colour').colorpicker();
$('#id_redbasic_item_colour,#id_redbasic_comment_item_colour,#id_redbasic_comment_border_colour').colorpicker({format: 'rgba'});
$('#id_cyberpunk_nav_bg, #id_cyberpunk_nav_icon_colour, #id_cyberpunk_nav_active_icon_colour, #id_cyberpunk_banner_colour').colorpicker({format: 'rgba'});
$('#id_cyberpunk_link_colour,#id_cyberpunk_background_colour').colorpicker();
$('#id_cyberpunk_toolicon_colour,#id_cyberpunk_toolicon_activecolour,#id_cyberpunk_font_colour').colorpicker();
$('#id_cyberpunk_item_colour,#id_cyberpunk_comment_item_colour,#id_cyberpunk_comment_border_colour').colorpicker({format: 'rgba'});
});
</script>
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="redbasic-settings-submit" class="btn btn-primary">{{$submit}}</button>
<button type="submit" name="cyberpunk-settings-submit" class="btn btn-primary">{{$submit}}</button>
</div>


Loading…
Cancel
Save