diff options
-rwxr-xr-x | boot.php | 5 | ||||
-rw-r--r-- | doc/Home.md | 8 | ||||
-rw-r--r-- | include/bbcode.php | 4 | ||||
-rw-r--r-- | include/comanche.php | 2 | ||||
-rwxr-xr-x | include/text.php | 2 | ||||
-rwxr-xr-x | index.php | 2 | ||||
-rw-r--r-- | mod/network.php | 29 | ||||
-rw-r--r-- | mod/search_ac.php | 39 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/js/mod_network.js | 2 | ||||
-rw-r--r-- | view/js/mod_settings.js | 4 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 26 | ||||
-rw-r--r-- | view/theme/redbasic/php/config.php | 173 | ||||
-rw-r--r-- | view/theme/redbasic/php/style.php | 199 | ||||
-rwxr-xr-x | view/theme/redbasic/tpl/basic_theme_settings.tpl | 14 | ||||
-rw-r--r--[-rwxr-xr-x] | view/theme/redbasic/tpl/theme_settings.tpl | 23 |
16 files changed, 174 insertions, 360 deletions
@@ -1783,6 +1783,11 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { if($m) $channel_menu = menu_render($m); } + $menublock = get_pconfig($profile['uid'],'system','channel_menublock'); + if ($menublock) { + require_once('include/comanche.php'); + $channel_menu .= comanche_block($menublock); + } $tpl = get_markup_template('profile_vcard.tpl'); diff --git a/doc/Home.md b/doc/Home.md index 78795c478..f0e731057 100644 --- a/doc/Home.md +++ b/doc/Home.md @@ -1,5 +1,5 @@ -Red Documentation and Resources -=============================== +Red Matrix Documentation and Resources +====================================== **Contents** @@ -18,11 +18,11 @@ Red Documentation and Resources * [Install](help/Install) * [Plugins](help/Plugins) * [Developers](help/Developers) - +* [Code](doc/html) **External Resources** -* [Main Website](http://friendica.com) +* [Main Website](https://github.com/friendica/red) * [Development Channel](http://zothub.com/channel/one) **About** diff --git a/include/bbcode.php b/include/bbcode.php index 9b9c954c1..756d73aba 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -131,7 +131,7 @@ function bb_ShareAttributes($match) { // FIXME - this should really be a wall-item-ago so it will get updated on the client $reldate = (($posted) ? relative_date($posted) : ''); - $headline = '<div class="shared_header">'; + $headline = '<div class="shared_container"> <div class="shared_header">'; if ($avatar != "") $headline .= '<img src="' . $avatar . '" alt="' . $author . '" height="32" width="32" />'; @@ -146,7 +146,7 @@ function bb_ShareAttributes($match) { $headline .= '<span>' . $fmt . '</span></div>'; - $text = $headline . '<div class="reshared-content">' . trim($match[2]) . '</div>'; + $text = $headline . '<div class="reshared-content">' . trim($match[2]) . '</div></div>'; return($text); } diff --git a/include/comanche.php b/include/comanche.php index 526819572..f1dd0e521 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -87,7 +87,7 @@ function comanche_replace_region($match) { function comanche_block($name) { $o = ''; - $r = q("select * from item left join item_id on iid = item_id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1", + $r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1", intval(get_app()->profile['profile_uid']), dbesc($name) ); diff --git a/include/text.php b/include/text.php index 69c258488..8efa1e925 100755 --- a/include/text.php +++ b/include/text.php @@ -726,7 +726,7 @@ function search($s,$id='search-box',$url='/search',$save = false) { $a = get_app(); $o = '<div id="' . $id . '">'; $o .= '<form action="' . $a->get_baseurl((stristr($url,'network')) ? true : false) . $url . '" method="get" >'; - $o .= '<input type="text" name="search" id="search-text" placeholder="' . t('Search') . '" value="' . $s .'" />'; + $o .= '<input type="text" name="search" id="search-text" placeholder="' . t('Search') . '" value="' . $s .'" onclick="this.submit();" />'; $o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; if($save) $o .= '<input type="submit" name="save" id="search-save" value="' . t('Save') . '" />'; @@ -1,4 +1,4 @@ -<?php +<?php /** @file */ /** * diff --git a/mod/network.php b/mod/network.php index 72391497b..81b38a5ae 100644 --- a/mod/network.php +++ b/mod/network.php @@ -64,7 +64,6 @@ function network_init(&$a) { } } - $group_id = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); require_once('include/group.php'); require_once('include/contact_widgets.php'); @@ -74,8 +73,10 @@ function network_init(&$a) { $a->page['aside'] = ''; $search = ((x($_GET,'search')) ? $_GET['search'] : ''); + - if(x($_GET,'save')) { + + if(x($_GET,'save') && $search) { $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", intval(local_user()), intval(TERM_SAVEDSEARCH), @@ -104,6 +105,28 @@ function network_init(&$a) { $a->page['aside'] .= saved_searches($search); $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); + + if($search) { + if(strpos($search,'@') === 0) { + $r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1", + dbesc(substr($search,1)), + intval(local_user()) + ); + if($r) { + $_GET['cid'] = $r[0]['abook_id']; + $search = $_GET['search'] = ''; + } + } + elseif(strpos($search,'#') === 0) { + $search = $_GET['search'] = substr($search,1); + } + } + + $group_id = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); + + + + } function saved_searches($search) { @@ -149,7 +172,7 @@ function saved_searches($search) { $o = replace_macros($tpl, array( '$title' => t('Saved Searches'), '$add' => t('add'), - '$searchbox' => search($search,'netsearch-box',$srchurl,true), + '$searchbox' => search('','netsearch-box',$srchurl,true), '$saved' => $saved, )); diff --git a/mod/search_ac.php b/mod/search_ac.php index 21ff1c9f3..36da21376 100644 --- a/mod/search_ac.php +++ b/mod/search_ac.php @@ -27,44 +27,27 @@ function search_ac_init(&$a){ // Priority to people searches if ($search) { - $people_sql_extra = protect_sprintf(" AND `name` LIKE '%". dbesc($search) . "%' "); + $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%". dbesc($search) . "%' "); $tag_sql_extra = protect_sprintf(" AND term LIKE '%". dbesc($search) . "%' "); } - $r = q("SELECT `id`, `name`, `micro`, `url` FROM `contact` - WHERE `uid` = %d AND `pending` = 0 + + $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d $people_sql_extra - ORDER BY `name` ASC ", + ORDER BY `xchan_name` ASC ", intval(local_user()) ); - if(count($r)) { + if($r) { foreach($r as $g) { - $x['photos'][] = $g['micro']; - $x['links'][] = $g['url']; - $x['suggestions'][] = '@' . $g['name']; - $x['data'][] = intval($g['id']); + $x['photos'][] = $g['xchan_photo_s']; + $x['links'][] = $g['xchan_url']; + $x['suggestions'][] = '@' . $g['xchan_name']; + $x['data'][] = 'cid=' . intval($g['abook_id']); } } -// FIXME - extend search to non-connnections if you couldn't find any connections with that name, use poco or directory -// else { -// -// $r = q("SELECT `id`, `name`, `photo`, `url` FROM `gcontact` where 1 -// $people_sql_extra -// ORDER BY `name` ASC " -// ); - -// if(count($r)) { -// foreach($r as $g) { -// $x['photos'][] = $g['photo']; -// $x['links'][] = $g['url']; -// $x['suggestions'][] = '@' . $g['name']; -// $x['data'][] = intval($g['id']); -// } -// } -// } - - $r = q("select tid, term, url from term where type = %d $tag_sql_extra order by term asc", + + $r = q("select distinct term, tid, url from term where type = %d $tag_sql_extra group by term order by term asc", intval(TERM_HASHTAG) ); diff --git a/version.inc b/version.inc index 34d36cab2..f91c18185 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-09-30.452 +2013-10-01.453 diff --git a/view/js/mod_network.js b/view/js/mod_network.js index 7c3a9d246..ca910ae52 100644 --- a/view/js/mod_network.js +++ b/view/js/mod_network.js @@ -3,7 +3,7 @@ $(document).ready(function() { a = $("#search-text").autocomplete({ serviceUrl: baseurl + '/search_ac', minChars: 2, - width: 350, + width: 250, }); }); diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js index 1695372eb..e749cd761 100644 --- a/view/js/mod_settings.js +++ b/view/js/mod_settings.js @@ -37,6 +37,7 @@ function channel_privacy_macro(n) { $('#id_write_storage option').eq(0).attr('selected','selected'); $('#id_write_pages option').eq(0).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); + $('#id_republish option').eq(0).attr('selected','selected'); $('#id_profile_in_directory_onoff .off').removeClass('hidden'); $('#id_profile_in_directory_onoff .on').addClass('hidden'); $('#id_profile_in_directory').val(0); @@ -58,6 +59,7 @@ function channel_privacy_macro(n) { $('#id_write_storage option').eq(1).attr('selected','selected'); $('#id_write_pages option').eq(1).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); + $('#id_republish option').eq(0).attr('selected','selected'); $('#id_profile_in_directory_onoff .off').removeClass('hidden'); $('#id_profile_in_directory_onoff .on').addClass('hidden'); $('#id_profile_in_directory').val(0); @@ -79,6 +81,7 @@ function channel_privacy_macro(n) { $('#id_write_storage option').eq(0).attr('selected','selected'); $('#id_write_pages option').eq(0).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); + $('#id_republish option').eq(1).attr('selected','selected'); $('#id_profile_in_directory_onoff .on').removeClass('hidden'); $('#id_profile_in_directory_onoff .off').addClass('hidden'); $('#id_profile_in_directory').val(1); @@ -100,6 +103,7 @@ function channel_privacy_macro(n) { $('#id_write_storage option').eq(2).attr('selected','selected'); $('#id_write_pages option').eq(2).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); + $('#id_republish option').eq(4).attr('selected','selected'); $('#id_profile_in_directory_onoff .on').removeClass('hidden'); $('#id_profile_in_directory_onoff .off').addClass('hidden'); $('#id_profile_in_directory').val(1); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index e973b9c7c..bc8014978 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -10,8 +10,11 @@ body { font-family: arial,freesans,clean,sans-serif; font-size: 12px; - background-color: #FFFFFF; - color: #000000; + background-color: #$background_colour; + background-image: url('$background_image'); + background-attachment: fixed; + background-size: cover; + color: #$font_colour; margin: 0px; } .jslider { @@ -114,6 +117,21 @@ blockquote { filter:alpha(opacity=100); } +nav {background-image: linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%) !important; + background-image: -o-linear-gradient(bottom, $nav_bg_1 26%, $nav_bg_2 82%) !important; + background-image: -moz-linear-gradient(bottom,$nav_bg_1 26%, $nav_bg_2 82%) !important; + background-image: -webkit-linear-gradient(bottom, $nav_bg_1 26%, $nav_bg_2 82%) !important; + background-image: -ms-linear-gradient(bottom, $nav_bg_1 26%, $nav_bg_2 82%) !important; +} + + +nav:hover {background-image: linear-gradient(bottom, $nav_bg_3 26%, $nav_bg_4 82%); + background-image: -o-linear-gradient(bottom, $nav_bg_3 26%, $nav_bg_4 82%); + background-image: -moz-linear-gradient(bottom, $nav_bg_3 26%, $nav_bg_4 82%) !important; + background-image: -webkit-linear-gradient(bottom, $nav_bg_3 26%, $nav_bg_4 82%); + background-image: -ms-linear-gradient(bottom, $nav_bg_3 26%, $nav_bg_4 82%); +} + nav #site-location { color: #888a85; @@ -805,7 +823,8 @@ footer { margin-top: 10px; position: relative; border-radius: $radiuspx; - border: 1px solid #eec; + background-color: #$item_colour; + opacity: $item_opacity; } .thread-end-wrapper { @@ -953,6 +972,7 @@ footer { .wall-item-content { margin-left: 10px; overflow: auto; + font-size: $font_sizepx; } .wall-item-content img { diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index 4e7363362..2502bb675 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -1,164 +1,57 @@ <?php -/** - * Theme settings - */ function theme_content(&$a) { - // Doesn't yet work for anyone other than the channel owner, and stupid mode isn't finished, so return both for now. - if(!local_user()) { return; } - $font_size = get_pconfig(local_user(),'redbasic', 'font_size' ); - $line_height = get_pconfig(local_user(), 'redbasic', 'line_height' ); - $colour = get_pconfig(local_user(), 'redbasic', 'colour' ); - $shadow = get_pconfig(local_user(), 'redbasic', 'shadow' ); - $navcolour = get_pconfig(local_user(), 'redbasic', 'navcolour'); - $displaystyle = get_pconfig(local_user(), 'redbasic', 'displaystyle'); - $linkcolour = get_pconfig(local_user(), 'redbasic', 'linkcolour'); - $iconset = get_pconfig(local_user(), 'redbasic', 'iconset'); - $shiny = get_pconfig(local_user(), 'redbasic', 'shiny'); - $colour_scheme = get_pconfig(local_user(), 'redbasic', 'colour_scheme'); - $radius = get_pconfig(local_user(),'redbasic','radius'); + if(!local_user()) { return;} - return redbasic_form($a, $font_size, $line_height, $colour, $shadow, $navcolour, $opaquenav, $displaystyle, $linkcolour, $iconset, $shiny, $colour_scheme,$radius); + $nav_colour = get_pconfig(local_user(),'redbasic', 'nav_colour' ); + $background_colour = get_pconfig(local_user(),'redbasic', 'background_colour' ); + $background_image = get_pconfig(local_user(),'redbasic', 'background_image' ); + $item_colour = get_pconfig(local_user(),'redbasic', 'item_colour' ); + $item_opacity = get_pconfig(local_user(),'redbasic', 'item_opacity' ); + $font_size = get_pconfig(local_user(),'redbasic', 'font_size' ); + $font_colour = get_pconfig(local_user(),'redbasic', 'font_colour' ); + $radius = get_pconfig(local_user(),'redbasic', 'radius' ); + return redbasic_form($a, $nav_colour, $background_colour, $background_image, $item_colour, $item_opacity, + $font_size, $font_colour, $radius); } function theme_post(&$a) { - if(!local_user()) { return; } + if(!local_user()) { return;} if (isset($_POST['redbasic-settings-submit'])) { + set_pconfig(local_user(), 'redbasic', 'nav_colour', $_POST['redbasic_nav_colour']); + set_pconfig(local_user(), 'redbasic', 'background_colour', $_POST['redbasic_background_colour']); + set_pconfig(local_user(), 'redbasic', 'background_image', $_POST['redbasic_background_image']); + set_pconfig(local_user(), 'redbasic', 'item_colour', $_POST['redbasic_item_colour']); + set_pconfig(local_user(), 'redbasic', 'item_opacity', $_POST['redbasic_item_opacity']); set_pconfig(local_user(), 'redbasic', 'font_size', $_POST['redbasic_font_size']); - set_pconfig(local_user(), 'redbasic', 'line_height', $_POST['redbasic_line_height']); - set_pconfig(local_user(), 'redbasic', 'colour', $_POST['redbasic_colour']); - set_pconfig(local_user(), 'redbasic', 'shadow', $_POST['redbasic_shadow']); - set_pconfig(local_user(), 'redbasic', 'navcolour', $_POST['redbasic_navcolour']); - set_pconfig(local_user(), 'redbasic', 'displaystyle', $_POST['redbasic_displaystyle']); - set_pconfig(local_user(), 'redbasic', 'linkcolour', $_POST['redbasic_linkcolour']); - set_pconfig(local_user(), 'redbasic', 'iconset', $_POST['redbasic_iconset']); - set_pconfig(local_user(), 'redbasic', 'shiny', $_POST['redbasic_shiny']); - set_pconfig(local_user(), 'redbasic', 'colour_scheme', $_POST['redbasic_colour_scheme']); + set_pconfig(local_user(), 'redbasic', 'font_colour', $_POST['redbasic_font_colour']); set_pconfig(local_user(), 'redbasic', 'radius', $_POST['redbasic_radius']); } - } -// We probably don't want these if we're having global settings, but we'll comment out for now, just in case -//function theme_admin(&$a) { $font_size = get_config('redbasic', 'font_size' ); -// $line_height = get_config('redbasic', 'line_height' ); -// $colour = get_config('redbasic', 'colour' ); -// $shadow = get_config('redbasic', 'shadow' ); -// $navcolour = get_config('redbasic', 'navcolour' ); -// $opaquenav = get_config('redbasic', 'opaquenav' ); -// $itemstyle = get_config('redbasic', 'itemstyle' ); -// $linkcolour = get_config('redbasic', 'linkcolour' ); -// $iconset = get_config('redbasic', 'iconset' ); -// $shiny = get_config('redbasic', 'shiny' ); -// -// return redbasic_form($a, $font_size, $line_height, $colour, $shadow, $navcolour, $opaquenav, $itemstyle, $linkcolour, $iconset, $shiny); -//} - -//function theme_admin_post(&$a) { -// if (isset($_POST['redbasic-settings-submit'])) { -// set_config('redbasic', 'font_size', $_POST['redbasic_font_size']); -// set_config('redbasic', 'line_height', $_POST['redbasic_line_height']); -// set_config('redbasic', 'colour', $_POST['redbasic_colour']); -// set_config('redbasic', 'shadow', $_POST['redbasic_shadow']); -// set_config('redbasic', 'navcolour', $_POST['redbasic_navcolour']); -// set_config('redbasic', 'opaquenav', $_POST['redbasic_opaquenav']); -// set_config('redbasic', 'itemstyle', $_POST['redbasic_itemstyle']); -// set_config('redbasic', 'linkcolour', $_POST['redbasic_linkcolour']); -// set_config('redbasic', 'iconset', $_POST['redbasic_iconset']); -// set_config('redbasic', 'shiny', $_POST['redbasic_shiny']); -// } -//} - -// These aren't all used yet, but they're not bloat - we'll use drop down menus in idiot mode. -function redbasic_form(&$a, $font_size, $line_height, $colour, $shadow, $navcolour, $opaquenav, $displaystyle, $linkcolour, $iconset, $shiny, $colour_scheme,$radius) { - $line_heights = array( - "1.3" => "1.3", - "---" => "---", - "1.6" => "1.6", - "1.5" => "1.5", - "1.4" => "1.4", - "1.2" => "1.2", - "1.1" => "1.1", - ); - $font_sizes = array( - '12' => '12', - '14' => '14', - "---" => "---", - "16" => "16", - "15" => "15", - '13.5' => '13.5', - '13' => '13', - '12.5' => '12.5', - '12' => '12', - ); - $colours = array( - 'light' => 'light', - 'dark' => 'dark', - ); - - $colour_schemes = array( - 'redbasic' => 'redbasic', - 'fancyred' => 'fancyred', - 'dark' => 'dark', - ); - $shadows = array( - 'true' => 'Yes', - 'false' => 'No', - ); +function redbasic_form(&$a, $nav_colour, $background_colour, $background_image, $item_colour, $item_opacity, + $font_size, $font_colour, $radius) { - $navcolours = array ( + $nav_colours = array ( 'red' => 'red', 'black' => 'black', - ); - - $displaystyles = array ( - 'fancy' => 'fancy', - 'classic' => 'classic', - ); - - $linkcolours = array ( - 'blue' => 'blue', - 'red' => 'red', - ); - - $iconsets = array ( - 'default' => 'default', - ); - - $shinys = array ( - 'none' => 'none', - 'opaque' => 'opaque', - ); - if(feature_enabled(local_user(),'expert')) { + ); + $t = get_markup_template('theme_settings.tpl'); $o .= replace_macros($t, array( '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(), '$title' => t("Theme settings"), - '$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes), - '$line_height' => array('redbasic_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights), - '$colour' => array('redbasic_colour', t('Set colour scheme'), $colour, '', $colours), - '$shadow' => array('redbasic_shadow', t('Draw shadows'), $shadow, '', $shadows), - '$navcolour' => array('redbasic_navcolour', t('Navigation bar colour'), $navcolour, '', $navcolours), - '$displaystyle' => array('redbasic_displaystyle', t('Display style'), $displaystyle, '', $displaystyles), - '$linkcolour' => array('redbasic_linkcolour', t('Display colour of links - hex value, do not include the #'), $linkcolour, '', $linkcolours), - '$iconset' => array('redbasic_iconset', t('Icons'), $iconset, '', $iconsets), - '$shiny' => array('redbasic_shiny', t('Shiny style'), $shiny, '', $shinys), - '$radius' => array('redbasic_radius', t('Corner radius'), $radius, t('0-99 default: 5')), - ));} - - if(! feature_enabled(local_user(),'expert')) { - $t = get_markup_template('basic_theme_settings.tpl'); - $o .= replace_macros($t, array( - '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(), - '$title' => t("Theme settings"), - '$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes), - '$line_height' => array('redbasic_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights), - '$colour_scheme' => array('redbasic_colour_scheme', t('Set colour scheme'), $colour_scheme, '', $colour_schemes), - ));} - + '$nav_colour' => array('redbasic_nav_colour', t('Navigation bar colour'), $nav_colour, '', $nav_colours), + '$background_colour' => array('redbasic_background_colour', t('Set the background colour'), $background_colour), + '$background_image' => array('redbasic_background_image', t('Set the background image'), $background_image), + '$item_colour' => array('redbasic_item_colour', t('Set the background colour of items'), $item_colour), + '$item_opacity' => array('redbasic_item_opacity', t('Set the opacity of items'), $item_opacity), + '$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size), + '$font_colour' => array('redbasic_font_colour', t('Set font-colour for posts and comments'), $font_colour), + '$radius' => array('redbasic_radius', t('Set radius of corners'), $radius), + )); + return $o; } - diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php index 8643925d3..e9ee57268 100644 --- a/view/theme/redbasic/php/style.php +++ b/view/theme/redbasic/php/style.php @@ -1,159 +1,70 @@ <?php - // This needs changing now, if we're going for global settings. Admin settings have been removed in preparation, You *should* just be able to remove all - // the get_config bits, though this is untested. - // We also need to eventually. Use the page owners settings for everybody - get_pconfig(page_owner()) or whatever that would look like. - +//Set some defaults + + $nav_colour = "red"; + $nav_bg_1 = "#f88"; + $nav_bg_2 = "#b00"; + $nav_bg_3 = "#f00"; + $nav_bg_4 = "#b00"; + $background_colour = "fff"; + $background_image =''; + $item_colour = "fff"; + $item_opacity = "1"; + $font_size = "12"; + $font_colour = "000"; + $radius = "5"; + +// Get the UID of the channel owner $uid = get_theme_uid(); if($uid) load_pconfig($uid,'redbasic'); - $line_height = false; - $redbasic_font_size = false; - $resolution = false; - $colour = false; - $shadows = false; - $navcolour = false; - $nav_bg_1 = "f88"; - $nav_bg_2 = "b00"; - $nav_bg_3 = "f00"; - $nav_bg_4 = "b00"; - $displaystyle = false; - $linkcolour = false; - $shiny = false; - $radius = 5; - $site_line_height = get_config("redbasic","line_height"); - $site_redbasic_font_size = get_config("redbasic", "font_size" ); - $site_colour = get_config("redbasic", "colour" ); - $shadows = get_config("redbasic", "shadow" ); - $navcolour = get_config("redbasic", "navcolour" ); - $displaystyle = get_config("redbasic", "displaystyle" ); - $linkcolour = get_config("redbasic", "linkcolour" ); - $shiny = get_config("redbasic", "shiny" ); - - $x = get_config('redbasic','radius'); - if($x !== false) - $radius = $x; - - if ($uid) { - $line_height = get_pconfig($uid, "redbasic","line_height"); - $redbasic_font_size = get_pconfig($uid, "redbasic", "font_size"); - $colour = get_pconfig($uid, "redbasic", "colour"); - $shadows = get_pconfig($uid, "redbasic", "shadow"); - $navcolour = get_pconfig($uid, "redbasic", "navcolour"); - $displaystyle = get_pconfig($uid, "redbasic", "displaystyle"); - $linkcolour = get_pconfig($uid, "redbasic", "linkcolour"); - $shiny = get_pconfig($uid, "redbasic", "shiny"); - $x = get_pconfig($uid,'redbasic','radius'); - if($x !== false) - $radius = $x; - - if (! feature_enabled($uid,'expert')) {$colour_scheme = get_pconfig($uid, "redbasic", "colour_scheme");} - } +// Nav colours are mess. Set $nav_colour as a single word for the sake of letting folk pick one +// but it actually consists of at least two colours to form a gradient - $nav_bg_1 and $nav_bg_2 +// A further two - $nav_bg_3 and $nav_bg_4 are used to create the hover, if any particular scheme +// wants to implement that + $nav_colour = get_pconfig($uid, "redbasic", "nav_colour"); + if ($nav_colour == "red") { + $nav_bg_1 = "#f88"; + $nav_bg_2 = "#b00"; + $nav_bg_3 = "#f00"; + $nav_bg_4 = "#b00"; + } - // In non-expert mode, we just let them choose font size, line height, and a colour scheme. A colour scheme is just a pre-defined set of the above variables. - // But only apply these settings in non-expert mode to prevent confusion when turning expert mode on and off. - if(! feature_enabled($uid,'expert')) { - if ($colour_scheme === 'fancyred') {$shadows = true; $navcolour = 'black'; $displaystyle = 'fancy'; $linkcolour = 'f00'; $shiny = "opaque";} - // Dark themes are very different - we need to do some of these from scratch, so don't bother setting vars for anything else - if ($colour_scheme === 'dark') {$colour = 'dark'; $navcolour = 'black';} - if ($colour_scheme === 'redbasic'){$navcolour = 'red';} - $shadows = false; - $radius = 5; -} + if ($nav_colour == "black") { + $nav_bg_1 = $nav_bg_3 = "#000"; + $nav_bg_2 = $nav_bg_4 = "#222"; + } -// This is probably the easiest place to apply global settings. Don't bother with site line height and such. Instead, check pconfig for global user settings. -// eg, if ($redbasic_font_size === false) {$redbasic_font_size = get_pconfig($uid, "global", "font_size"); If it's not set, we'll just use the CSS with no changes. -// Then all you need to do is add a "Global Settings" tab to settings/display, and make an equivalent of theme_settings.tpl and config.php to be loaded there. Easy. + $background_colour = get_pconfig($uid, "redbasic", "background_colour"); + $background_image = get_pconfig($uid, "redbasic", "background_image"); + $item_colour = get_pconfig($uid, "redbasic", "item_colour"); + $item_opacity = get_pconfig($uid, "redbasic", "item_opacity"); + $font_size = get_pconfig($uid, "redbasic", "font_size"); + $font_colour = get_pconfig($uid, "redbasic", "font_colour"); + $radius = get_pconfig($uid, "redbasic", "radius"); - if ($line_height === false) {$line_height = $site_line_height;} - if ($line_height === false) {$line_height = "1.2";} - if ($redbasic_font_size === false) {$redbasic_font_size = $site_redbasic_font_size;} - if ($redbasic_font_size === false) {$redbasic_font_size = "12";} - if ($colour === false) {$colour = $site_colour;} - if ($colour === false) {$colour = "light";} - if ($navcolour === "black") {$nav_bg_1 = "000"; - $nav_bg_2 = "2e2f2e";} +// Apply the settings if(file_exists('view/theme/' . current_theme() . '/css/style.css')) { $x = file_get_contents('view/theme/' . current_theme() . '/css/style.css'); - if(get_config('system','pcss_compress')) { - // this shaves off about 10%, probably not enough to worry about right now. - logger('pcss compress: original size: ' . strlen($x), LOGGER_DEBUG); - $x = str_replace(array("\r","\t"," "),array("",' ',' '),$x); - $x = preg_replace('/(\n[ ]+?)/s',"\n",$x); - $x = str_replace("\n","",$x); - logger('pcss compress: final size: ' . strlen($x), LOGGER_DEBUG); - } - echo str_replace(array('$radius'),array($radius),$x); - } - echo "\r\n"; - -// use $colour_scheme for idiot mode. - if($colour === "dark") {if (file_exists('view/theme/' . current_theme() . '/css/dark.css')) { - $dark = (file_get_contents('view/theme/' . current_theme() . '/css/dark.css')); - echo "$dark";} - } - - -// Enforce sane limits for expert mode - otherwise we'll end up with "experts" who think font size is a percentage. +$options = array ( +'$nav_bg_1' => $nav_bg_1, +'$nav_bg_2' => $nav_bg_2, +'$nav_bg_3' => $nav_bg_3, +'$nav_bg_4' => $nav_bg_4, +'$background_colour' => $background_colour, +'$background_image' => $background_image, +'$item_colour' => $item_colour, +'$item_opacity' => $item_opacity, +'$font_size' => $font_size, +'$font_colour' => $font_colour, +'$radius' => $radius +); + +echo str_replace(array_keys($options), array_values($options), $x); - if(($redbasic_font_size >= 8.0) && ($redbasic_font_size <= 20.0)) { - echo ".wall-item-content { font-size: ${redbasic_font_size}px;}\r\n"; - } - - if(($line_height >= 1.0) && ($line_height <= 2.0)) { - echo ".wall-item-content { line-height: $line_height; }\r\n"; - } - - -// Minimum value shadows - they shouldn't all be the same size; just get it working, clean up later. - if($shadows === "true") { - echo "code, blockquote, .wall-item-content-wrapper, .wall-item-content-wrapper.comment, .wall-item-content img, #profile-jot-perms, #profile-jot-submit, .tab, .tab.active, .settings-widget li, .wall-item-photo, .photo, .contact-block-img, .my-comment-photo, #posted-date-selector:hover, .contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .group-selected, .nets-selected, .fileas-selected, .categories-selected { - box-shadow: 5px 5px 5px #111;}\r\n - - .tab.active, #jot-title, #jot-category, .comment-edit-text-empty, .comment-edit-text-full, iframe#profile-jot-text_ifr, #profile-jot-text { - box-shadow: 5px 5px 5px #666 inset;}\r\n"; - - } - -// Since every change would otherwise require five lines, it's simpler to just set a default and echo this without first checking if we've set it. - echo "nav {background-image: linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%); - background-image: -o-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%); - background-image: -moz-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%) !important; - background-image: -webkit-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%); - background-image: -ms-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%);}"; - - if($navcolour === false || $navcolour === 'red') { - echo "nav:hover {background-image: linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%); - background-image: -o-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%); - background-image: -moz-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%) !important; - background-image: -webkit-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%); - background-image: -ms-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%);}"; - } - -// This takes quite a lot of code, so we'll keep it in a separate file, and echo the lot. Devs still don't have to worry about - it's just overrides. -// Theme devs can play with it without facing scary PHP. - - if ($displaystyle === "fancy") - {if (file_exists('view/theme/' . current_theme() . '/css/fancy.css')) { - $fancy = (file_get_contents('view/theme/' . current_theme() . '/css/fancy.css')); - echo str_replace(array('$radius'),array($radius),$fancy); - } - } - -// Put the # here to force hex colours - if we don't, somebody is going to do something odd, using RGB and we're all going to be confused on the support forums -// until one of us works out what they've done. - - if ($linkcolour != false) { - echo "a, a:visited, a:link, .fakelink, .fakelink:visited, .fakelink:link {color: #$linkcolour;}\r\n"; - } - -// If you want a shiny that just sets a different colour, add an if $shiny != false and handle it as the linkcolour above. - - if ($shiny === 'opaque') { - echo "div.wall-item-content-wrapper.shiny {opacity: 1;}\r\n - .wall-item-content-wrapper {opacity: 0.8;}"; - }
\ No newline at end of file +} diff --git a/view/theme/redbasic/tpl/basic_theme_settings.tpl b/view/theme/redbasic/tpl/basic_theme_settings.tpl deleted file mode 100755 index 33a34b292..000000000 --- a/view/theme/redbasic/tpl/basic_theme_settings.tpl +++ /dev/null @@ -1,14 +0,0 @@ -{{* - * AUTOMATICALLY GENERATED TEMPLATE - * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN - * - *}} -{{include file="field_select.tpl" field=$font_size}} - -{{include file="field_select.tpl" field=$line_height}} - -{{include file="field_select.tpl" field=$colour_scheme}} - -<div class="settings-submit-wrapper"> - <input type="submit" value="{{$submit}}" class="settings-submit" name="redbasic-settings-submit" /> -</div> diff --git a/view/theme/redbasic/tpl/theme_settings.tpl b/view/theme/redbasic/tpl/theme_settings.tpl index cd980fbc3..596670e95 100755..100644 --- a/view/theme/redbasic/tpl/theme_settings.tpl +++ b/view/theme/redbasic/tpl/theme_settings.tpl @@ -1,21 +1,10 @@ -{{include file="field_select.tpl" field=$colour}} - +{{include file="field_select.tpl" field=$nav_colour}} +{{include file="field_input.tpl" field=$background_colour}} +{{include file="field_input.tpl" field=$background_image}} +{{include file="field_input.tpl" field=$item_colour}} +{{include file="field_input.tpl" field=$item_opacity}} {{include file="field_input.tpl" field=$font_size}} - -{{include file="field_input.tpl" field=$line_height}} - -{{include file="field_select.tpl" field=$shadow}} - -{{include file="field_select.tpl" field=$navcolour}} - -{{include file="field_select.tpl" field=$displaystyle}} - -{{include file="field_input.tpl" field=$linkcolour}} - -{{include file="field_select.tpl" field=$iconset}} - -{{include file="field_select.tpl" field=$shiny}} - +{{include file="field_input.tpl" field=$font_colour}} {{include file="field_input.tpl" field=$radius}} <div class="settings-submit-wrapper"> |