appification of the pdl editor and move advanced_theming to theme settings where it belongs

This commit is contained in:
Mario Vavti 2018-09-26 15:02:20 +02:00
parent 9948bb3f2a
commit 9bc76b4259
6 changed files with 27 additions and 23 deletions

View File

@ -1,15 +1,20 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Pdledit extends \Zotlabs\Web\Controller {
class Pdledit extends Controller {
function post() {
if(! local_channel())
return;
if(! $_REQUEST['module'])
if(! Apps::system_app_installed(local_channel(), 'PDL Editor'))
return;
if(! feature_enabled(local_channel(),'advanced_theming'))
if(! $_REQUEST['module'])
return;
if(! trim($_REQUEST['content'])) {
@ -30,9 +35,13 @@ class Pdledit extends \Zotlabs\Web\Controller {
return;
}
if(! feature_enabled(local_channel(),'advanced_theming')) {
notice( t('Feature disabled.') . EOL);
return;
if(! Apps::system_app_installed(local_channel(), 'PDL Editor')) {
//Do not display any associated widgets at this point
App::$pdl = '';
$o = '<b>PDL Editor App (Not Installed):</b><br>';
$o .= t('Provides the ability to edit system page layouts');
return $o;
}
if(argc() > 2 && argv(2) === 'reset') {

View File

@ -31,7 +31,6 @@ class Display {
$network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0);
$manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0);
$start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0);
$advanced_theming = ((x($_POST,'advanced_theming')) ? intval($_POST['advanced_theming']) : 0);
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
if($channel_divmore_height < 50)
@ -63,7 +62,6 @@ class Display {
set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update);
set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
set_pconfig(local_channel(),'system','start_menu', $start_menu);
set_pconfig(local_channel(),'system','advanced_theming', $advanced_theming);
$newschema = '';
if($theme){
@ -181,8 +179,6 @@ class Display {
$title_tosource = get_pconfig(local_channel(),'system','title_tosource');
$title_tosource = (($title_tosource===false)? '0': $title_tosource); // default if not set: 0
$advanced_theming = get_pconfig(local_channel(),'system','advanced_theming', 0);
$theme_config = "";
if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){
require_once($themeconfigfile);
@ -218,16 +214,12 @@ class Display {
'$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ],
'$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no),
'$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no),
'$layout_editor' => t('System Page Layout Editor - (advanced)'),
'$theme_config' => $theme_config,
'$expert' => $advanced_theming,
'$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(),'system','channel_list_mode'), t('(comments displayed separately)'), $yes_no),
'$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no),
'$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
'$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')),
'$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no],
'$advanced_theming' => ['advanced_theming', t('Advanced Theme and Layout Settings'), $advanced_theming, t('Allows fine tuning of themes and page layouts'), $yes_no]
'$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no]
));
call_hooks('display_settings',$o);

6
app/pdledit.apd Normal file
View File

@ -0,0 +1,6 @@
version: 1
url: $baseurl/pdledit
requires: local_channel
name: PDL Editor
photo: icon:object-group
categories: Appearance

View File

@ -54,6 +54,7 @@ class RedbasicConfig {
$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');
return $this->form($arr);
}
@ -80,15 +81,15 @@ class RedbasicConfig {
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']);
}
}
function form($arr) {
if(get_pconfig(local_channel(), 'system', 'advanced_theming'))
if(get_pconfig(local_channel(), 'redbasic', 'advanced_theming'))
$expert = 1;
$o .= replace_macros(get_markup_template('theme_settings.tpl'), array(
'$submit' => t('Submit'),
'$baseurl' => z_root(),
@ -112,6 +113,7 @@ class RedbasicConfig {
'$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 more custom theme settings'), $arr['advanced_theming'], '', [t('No'), t('Yes')]]
));
return $o;

View File

@ -1,6 +1,7 @@
{{include file="field_checkbox.tpl" field=$narrow_navbar}}
{{include file="field_input.tpl" field=$converse_width}}
{{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}}

View File

@ -69,12 +69,6 @@
{{include file="field_checkbox.tpl" field=$preload_images}}
{{include file="field_checkbox.tpl" field=$manual_update}}
{{include file="field_checkbox.tpl" field=$start_menu}}
{{include file="field_checkbox.tpl" field=$advanced_theming}}
{{if $expert}}
<div class="form-group">
<a class="btn btn-outline-secondary "href="pdledit">{{$layout_editor}}</a>
</div>
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>