From 548bf884a4b34a4881f3188e54c592597f755dc9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 1 Mar 2016 21:06:27 -0800 Subject: [PATCH 01/14] profile field admin page (functional only: still needs a lot of HTML/CSS cleanup) --- include/identity.php | 4 +- mod/admin.php | 121 +++++++++++++++++++++++++++++++----- view/tpl/admin_aside.tpl | 1 + view/tpl/admin_profiles.tpl | 31 +++++++++ 4 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 view/tpl/admin_profiles.tpl diff --git a/include/identity.php b/include/identity.php index 382b096fe..0a461dbe4 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1652,7 +1652,7 @@ function get_profile_fields_basic($filter = 0) { $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null); if(! $profile_fields_basic) - $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); + $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','with','howlong','sexual','homepage','hometown','keywords','about','contact'); $x = array(); if($profile_fields_basic) @@ -1667,7 +1667,7 @@ function get_profile_fields_advanced($filter = 0) { $basic = get_profile_fields_basic($filter); $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null); if(! $profile_fields_advanced) - $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); + $profile_fields_advanced = array('politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); $x = array(); if($basic) diff --git a/mod/admin.php b/mod/admin.php index 292a4e66a..2e2536af3 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1620,26 +1620,47 @@ readable."); function admin_page_profs_post(&$a) { - if($_REQUEST['id']) { - $r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d", - dbesc($_REQUEST['field_name']), - dbesc($_REQUEST['field_type']), - dbesc($_REQUEST['field_desc']), - dbesc($_REQUEST['field_help']), - dbesc($_REQUEST['field_inputs']), - intval($_REQUEST['id']) - ); + if(array_key_exists('basic',$_REQUEST)) { + $arr = explode(',',$_REQUEST['basic']); + for($x = 0; $x < count($arr); $x ++) + if(trim($arr[$x])) + $arr[$x] = trim($arr[$x]); + set_config('system','profile_fields_basic',$arr); + + if(array_key_exists('advanced',$_REQUEST)) { + $arr = explode(',',$_REQUEST['advanced']); + for($x = 0; $x < count($arr); $x ++) + if(trim($arr[$x])) + $arr[$x] = trim($arr[$x]); + set_config('system','profile_fields_advanced',$arr); + } + goaway(z_root() . '/admin/profs'); } - else { - $r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )", - dbesc($_REQUEST['field_name']), - dbesc($_REQUEST['field_type']), - dbesc($_REQUEST['field_desc']), - dbesc($_REQUEST['field_help']), - dbesc($_REQUEST['field_inputs']) - ); + + + if(array_key_exists('field_name',$_REQUEST)) { + if($_REQUEST['id']) { + $r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d", + dbesc($_REQUEST['field_name']), + dbesc($_REQUEST['field_type']), + dbesc($_REQUEST['field_desc']), + dbesc($_REQUEST['field_help']), + dbesc($_REQUEST['field_inputs']), + intval($_REQUEST['id']) + ); + } + else { + $r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )", + dbesc($_REQUEST['field_name']), + dbesc($_REQUEST['field_type']), + dbesc($_REQUEST['field_desc']), + dbesc($_REQUEST['field_help']), + dbesc($_REQUEST['field_inputs']) + ); + } } + // add to chosen array basic or advanced goaway(z_root() . '/admin/profs'); @@ -1686,4 +1707,70 @@ function admin_page_profs(&$a) { '$submit' => t('Save') )); } + + $basic = ''; + $barr = array(); + $fields = get_profile_fields_basic(); + if(! $fields) + $fields = get_profile_fields_basic(1); + if($fields) { + foreach($fields as $k => $v) { + if($basic) + $basic .= ', '; + $basic .= trim($k); + $barr[] = trim($k); + } + } + + $advanced = ''; + $fields = get_profile_fields_advanced(); + if(! $fields) + $fields = get_profile_fields_advanced(1); + if($fields) { + foreach($fields as $k => $v) { + if(in_array(trim($k),$barr)) + continue; + if($advanced) + $advanced .= ', '; + $advanced .= trim($k); + } + } + + $all = ''; + $fields = get_profile_fields_advanced(1); + if($fields) { + foreach($fields as $k => $v) { + if($all) + $all .= ', '; + $all .= trim($k); + } + } + + $r = q("select * from profdef where true"); + if($r) { + foreach($r as $rr) { + if($all) + $all .= ', '; + $all .= $rr['field_name']; + } + } + + + $o = replace_macros(get_markup_template('admin_profiles.tpl'),array( + '$title' => t('Profile Management'), + '$basic' => array('basic',t('Basic Profile Fields'),$basic,''), + '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('In addition to basic fields')), + '$all' => $all, + '$all_desc' => t('All available fields'), + '$cust_field_desc' => t('Custom Fields'), + '$cust_fields' => $r, + '$edit' => t('Edit'), + '$drop' => t('Delete'), + '$new' => t('Create'), + '$submit' => t('Submit') + )); + + return $o; + + } diff --git a/view/tpl/admin_aside.tpl b/view/tpl/admin_aside.tpl index ab190fc95..da762a094 100755 --- a/view/tpl/admin_aside.tpl +++ b/view/tpl/admin_aside.tpl @@ -21,6 +21,7 @@
  • {{$admin.plugins.1}}
  • {{$admin.themes.1}}
  • {{$admin.features.1}}
  • +
  • {{$admin.profs.1}}
  • {{$admin.dbsync.1}}
  • diff --git a/view/tpl/admin_profiles.tpl b/view/tpl/admin_profiles.tpl new file mode 100644 index 000000000..70fcc303b --- /dev/null +++ b/view/tpl/admin_profiles.tpl @@ -0,0 +1,31 @@ +
    +

    {{$title}}

    + +
    + +{{include file="field_textarea.tpl" field=$basic}} +{{include file="field_textarea.tpl" field=$advanced}} + + + +
    + +
    {{$all_desc}}
    + +
    {{$all}}
    + +

    +
    {{$cust_field_desc}}
    + + + +{{if $cust_fields}} + +{{foreach $cust_fields as $field}} + +{{/foreach}} +
    {{$field.field_desc}}{{$field.field_name}}{{$edit}} {{$drop}}
    +{{/if}} + + +
    From 428b4dbad63d429c3b0d47b49ff5918dbda3c596 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 1 Mar 2016 22:47:07 -0800 Subject: [PATCH 02/14] sort out the with and howlong dependencies --- include/identity.php | 4 ++-- view/tpl/profile_advanced.tpl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/identity.php b/include/identity.php index 0a461dbe4..382b096fe 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1652,7 +1652,7 @@ function get_profile_fields_basic($filter = 0) { $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null); if(! $profile_fields_basic) - $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','with','howlong','sexual','homepage','hometown','keywords','about','contact'); + $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); $x = array(); if($profile_fields_basic) @@ -1667,7 +1667,7 @@ function get_profile_fields_advanced($filter = 0) { $basic = get_profile_fields_basic($filter); $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null); if(! $profile_fields_advanced) - $profile_fields_advanced = array('politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); + $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); $x = array(); if($basic) diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl index 034a6d43d..a724c41bb 100755 --- a/view/tpl/profile_advanced.tpl +++ b/view/tpl/profile_advanced.tpl @@ -72,7 +72,7 @@ {{if $profile.marital}}
    {{$profile.marital.0}}
    -
    {{$profile.marital.1}}{{if $profile.marital.with}} ({{$profile.marital.with}}){{/if}}{{if $profile.howlong}} {{$profile.howlong}}{{/if}}
    +
    {{$profile.marital.1}}{{if in_array('with',$fields)}}{{if $profile.marital.with}} ({{$profile.marital.with}}){{/if}}{{/if}}{{if in_array('howlong',$fields)}}{{if $profile.howlong}} {{$profile.howlong}}{{/if}}{{/if}}
    {{/if}} {{/if}} From c97cc1487cbcac2c4fbc4d9e931a82df109af2e6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 2 Mar 2016 12:31:25 +0100 Subject: [PATCH 03/14] a simple cover-photo implementation for redbasic default template --- include/widgets.php | 4 ++-- view/css/default.css | 17 +++-------------- view/pdl/mod_channel.pdl | 3 +++ view/php/default.php | 1 + view/theme/redbasic/css/style.css | 1 + view/theme/redbasic/js/redbasic.js | 23 +++++++++++++++++++++-- 6 files changed, 31 insertions(+), 18 deletions(-) diff --git a/include/widgets.php b/include/widgets.php index a995fdf1c..05b9eca1a 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -993,7 +993,7 @@ function widget_cover_photo($arr) { if(array_key_exists('style', $arr) && isset($arr['style'])) $style = $arr['style']; else - $style = 'width:100%; padding-right: 10px; height: auto;'; + $style = 'width:100%; height: auto;'; // ensure they can't sneak in an eval(js) function @@ -1003,7 +1003,7 @@ function widget_cover_photo($arr) { $c = get_cover_photo($channel_id,'html'); if($c) { - $o = '
    ' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '
    '; + $o = '
    ' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '
    '; } return $o; } diff --git a/view/css/default.css b/view/css/default.css index bffecbb81..f6857ec83 100644 --- a/view/css/default.css +++ b/view/css/default.css @@ -12,29 +12,18 @@ main { position: relative; width: 100%; height: 100%; + padding-top: 71px; } aside { display: table-cell; vertical-align: top; - padding: 80px 7px 0px 7px; + padding: 0px 7px 0px 7px; } section { width: 100%; display: table-cell; vertical-align: top; - padding: 80px 7px 200px 7px; -} - -@media screen and (max-width: 767px) { - - section { - padding: 65px 7px 200px 7px; - } - - aside#region_1 { - padding: 65px 7px 0px 7px; - } - + padding: 0px 7px 200px 7px; } diff --git a/view/pdl/mod_channel.pdl b/view/pdl/mod_channel.pdl index 6cbc0c0e4..98dc71915 100644 --- a/view/pdl/mod_channel.pdl +++ b/view/pdl/mod_channel.pdl @@ -1,3 +1,6 @@ +[region=banner] +[widget=cover_photo][/widget] +[/region] [region=aside] [widget=fullprofile][/widget] [widget=archive][var=wall]1[/var][/widget] diff --git a/view/php/default.php b/view/php/default.php index 6a9cc5517..cf6b25d90 100644 --- a/view/php/default.php +++ b/view/php/default.php @@ -6,6 +6,7 @@ +
    diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 2cf311baa..f365bec1a 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -174,6 +174,7 @@ header #banner { z-index: 1040; margin-top: 14px; text-align: center; + text-shadow: 1px 1px 2px rgba(0,0,0,.5); font-size: 14px; font-family: tahoma, "Lucida Sans", sans; color: $banner_colour; diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 38dc4d209..7c5df0834 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -2,6 +2,17 @@ * redbasic theme specific JavaScript */ $(document).ready(function() { + + //Simple cover-photo implementation + if($('#cover-photo').length && $(window).width() > 767) { + $('.navbar-fixed-top').css('position', 'relative'); + $('main').css('padding-top', 0 + 'px'); + } + else { + $('#cover-photo').remove(); + + } + // CSS3 calc() fallback (for unsupported browsers) $('body').append(''); if( $('#css3-calc').width() == 10) { @@ -38,9 +49,7 @@ $(document).ready(function() { $("input[data-role=cat-tagsinput]").tagsinput({ tagClass: 'label label-primary' }); -}); -$(document).ready(function(){ var doctitle = document.title; function checkNotify() { var notifyUpdateElem = document.getElementById('notify-update'); @@ -53,3 +62,13 @@ $(document).ready(function(){ } setInterval(function () {checkNotify();}, 10 * 1000); }); + +//Simple cover-photo implementation +$(window).scroll(function () { + if($('#cover-photo').length && $(window).width() > 767 && $(window).scrollTop() >= $('#cover-photo').height()) { + $('main').css('padding-top', 71 + 'px'); + $(window).scrollTop($(window).scrollTop() - $('#cover-photo').height()) + $('.navbar-fixed-top').css('position', 'fixed'); + $('#cover-photo').remove(); + } +}); From c5d08fd5fdcd504dac010d62c434d16a92879852 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 2 Mar 2016 13:33:18 +0100 Subject: [PATCH 04/14] add a fade in effect to main while scrolling up cover photo --- view/theme/redbasic/js/redbasic.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 7c5df0834..809776220 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -7,6 +7,7 @@ $(document).ready(function() { if($('#cover-photo').length && $(window).width() > 767) { $('.navbar-fixed-top').css('position', 'relative'); $('main').css('padding-top', 0 + 'px'); + $('main').css('opacity', 0); } else { $('#cover-photo').remove(); @@ -71,4 +72,8 @@ $(window).scroll(function () { $('.navbar-fixed-top').css('position', 'fixed'); $('#cover-photo').remove(); } + + if($('#cover-photo').length) { + $('main').css('opacity', ($(window).scrollTop()/$('#cover-photo').height()).toFixed(1)); + } }); From d3f2d2a2dbba70403d197221500aeae80d541557 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 2 Mar 2016 14:30:33 +0100 Subject: [PATCH 05/14] small fix to simple cover-photo --- view/css/default.css | 5 ++--- view/theme/redbasic/js/redbasic.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/view/css/default.css b/view/css/default.css index f6857ec83..db0628cb3 100644 --- a/view/css/default.css +++ b/view/css/default.css @@ -12,18 +12,17 @@ main { position: relative; width: 100%; height: 100%; - padding-top: 71px; } aside { display: table-cell; vertical-align: top; - padding: 0px 7px 0px 7px; + padding: 71px 7px 0px 7px; } section { width: 100%; display: table-cell; vertical-align: top; - padding: 0px 7px 200px 7px; + padding: 71px 7px 200px 7px; } diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 809776220..d3f9c5f70 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -6,12 +6,11 @@ $(document).ready(function() { //Simple cover-photo implementation if($('#cover-photo').length && $(window).width() > 767) { $('.navbar-fixed-top').css('position', 'relative'); - $('main').css('padding-top', 0 + 'px'); + $('aside, section').css('padding-top', 0 + 'px'); $('main').css('opacity', 0); } else { $('#cover-photo').remove(); - } // CSS3 calc() fallback (for unsupported browsers) @@ -67,7 +66,7 @@ $(document).ready(function() { //Simple cover-photo implementation $(window).scroll(function () { if($('#cover-photo').length && $(window).width() > 767 && $(window).scrollTop() >= $('#cover-photo').height()) { - $('main').css('padding-top', 71 + 'px'); + $('aside, section').css('padding-top', 71 + 'px'); $(window).scrollTop($(window).scrollTop() - $('#cover-photo').height()) $('.navbar-fixed-top').css('position', 'fixed'); $('#cover-photo').remove(); From aa62bad07b7505cecb4347c7c4425bbd7bbcfcc5 Mon Sep 17 00:00:00 2001 From: Jeroen van Riet Paap Date: Wed, 2 Mar 2016 15:33:18 +0100 Subject: [PATCH 06/14] little nl string fix --- view/nl/register_open_eml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/nl/register_open_eml.tpl b/view/nl/register_open_eml.tpl index 4ee6756ef..6c15de192 100644 --- a/view/nl/register_open_eml.tpl +++ b/view/nl/register_open_eml.tpl @@ -1,4 +1,4 @@ -s met dit e-mailadres een account aangemaakt op {{$sitename}}. +Er is met dit e-mailadres een account aangemaakt op {{$sitename}}. De inloggegevens zijn als volgt: Hub: {{$siteurl}} From 5c22f59c4f758e474f4ff553fc5ada36a14fd474 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Mar 2016 11:32:32 -0800 Subject: [PATCH 07/14] issue #305 --- include/notifier.php | 1 - include/ratenotif.php | 1 - version.inc | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index 93cc77a1c..628847d54 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -68,7 +68,6 @@ require_once('include/html2plain.php'); require_once('include/cli_startup.php'); require_once('include/zot.php'); require_once('include/queue_fn.php'); -require_once('include/session.php'); require_once('include/datetime.php'); require_once('include/items.php'); require_once('include/bbcode.php'); diff --git a/include/ratenotif.php b/include/ratenotif.php index e94f30247..2c636c710 100644 --- a/include/ratenotif.php +++ b/include/ratenotif.php @@ -11,7 +11,6 @@ function ratenotif_run($argv, $argc){ $a = get_app(); - require_once("session.php"); require_once("datetime.php"); require_once('include/items.php'); require_once('include/Contact.php'); diff --git a/version.inc b/version.inc index 9881b9f45..9863e681b 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2016-03-01.1323H +2016-03-02.1324H From 6f4c45a48912c9dfaaf7631c58849476878b4fe1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Mar 2016 15:36:14 -0800 Subject: [PATCH 08/14] UI cleanup for admin profile field management page --- mod/admin.php | 4 ++-- view/tpl/admin_profiles.tpl | 27 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 2e2536af3..6ec722691 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1759,14 +1759,14 @@ function admin_page_profs(&$a) { $o = replace_macros(get_markup_template('admin_profiles.tpl'),array( '$title' => t('Profile Management'), '$basic' => array('basic',t('Basic Profile Fields'),$basic,''), - '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('In addition to basic fields')), + '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('(In addition to basic fields)')), '$all' => $all, '$all_desc' => t('All available fields'), '$cust_field_desc' => t('Custom Fields'), '$cust_fields' => $r, '$edit' => t('Edit'), '$drop' => t('Delete'), - '$new' => t('Create'), + '$new' => t('Create Custom Field'), '$submit' => t('Submit') )); diff --git a/view/tpl/admin_profiles.tpl b/view/tpl/admin_profiles.tpl index 70fcc303b..8962c21b3 100644 --- a/view/tpl/admin_profiles.tpl +++ b/view/tpl/admin_profiles.tpl @@ -1,5 +1,14 @@
    -

    {{$title}}

    +
     {{$new}}

    {{$title}}

    +
    +
    + +
    + +
    @@ -10,22 +19,20 @@
    -
    {{$all_desc}}
    -
    {{$all}}
    - -

    -
    {{$cust_field_desc}}
    - - {{if $cust_fields}} - +

    +
    {{$cust_field_desc}}
    +
    + +
    {{foreach $cust_fields as $field}} - + {{/foreach}}
    {{$field.field_desc}}{{$field.field_name}}{{$edit}} {{$drop}}
    {{$field.field_name}}{{$field.field_desc}} {{$drop}}
    {{/if}} +
    From 436e91a1e13bc488003262dfffb0a7d273a3106a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Mar 2016 16:39:34 -0800 Subject: [PATCH 09/14] rename the menu entry and page to 'Profile Fields' to maintain consistency --- include/widgets.php | 2 +- mod/admin.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/widgets.php b/include/widgets.php index 3b8a5a7a3..0fc10dfc0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -1297,7 +1297,7 @@ function widget_admin($arr) { 'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'), 'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'), 'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'), - 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'), + 'profs' => array(z_root() . '/admin/profs', t('Profile Fields'), 'profs'), 'dbsync' => array(z_root() . '/admin/dbsync/', t('DB updates'), 'dbsync') ); diff --git a/mod/admin.php b/mod/admin.php index 6ec722691..6300ac027 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1757,7 +1757,7 @@ function admin_page_profs(&$a) { $o = replace_macros(get_markup_template('admin_profiles.tpl'),array( - '$title' => t('Profile Management'), + '$title' => t('Profile Fields'), '$basic' => array('basic',t('Basic Profile Fields'),$basic,''), '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('(In addition to basic fields)')), '$all' => $all, From 59e04aed1b7ea68b51b8672768dffd21f5a4bd4d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 3 Mar 2016 12:07:58 +0100 Subject: [PATCH 10/14] move cover-photo to template, add the ability to define a title and subtitle (defaults to channel name and addres), move js from redbasic.js to template. --- include/widgets.php | 24 +++++++++++++-- view/css/widgets.css | 27 ++++++++++++++++ view/theme/redbasic/js/redbasic.js | 24 --------------- view/tpl/cover_photo_widget.tpl | 49 ++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 26 deletions(-) create mode 100755 view/tpl/cover_photo_widget.tpl diff --git a/include/widgets.php b/include/widgets.php index 3b8a5a7a3..96d7b5cd0 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -982,14 +982,18 @@ function widget_cover_photo($arr) { require_once('include/identity.php'); $o = ''; + $a = get_app(); + $channel_id = 0; if(array_key_exists('channel_id', $arr) && intval($arr['channel_id'])) $channel_id = intval($arr['channel_id']); if(! $channel_id) - $channel_id = get_app()->profile_uid; + $channel_id = $a->profile_uid; if(! $channel_id) return ''; + $channel = channelx_by_n($channel_id); + if(array_key_exists('style', $arr) && isset($arr['style'])) $style = $arr['style']; else @@ -1000,10 +1004,26 @@ function widget_cover_photo($arr) { if(strpbrk($style,'(\'"<>') !== false) $style = ''; + if(array_key_exists('title', $arr) && isset($arr['title'])) + $title = $arr['title']; + else + $title = $channel['channel_name']; + + if(array_key_exists('subtitle', $arr) && isset($arr['subtitle'])) + $subtitle = $arr['subtitle']; + else + $subtitle = $channel['xchan_addr']; + $c = get_cover_photo($channel_id,'html'); if($c) { - $o = '
    ' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '
    '; + $photo_html = (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c); + + $o = replace_macros(get_markup_template('cover_photo_widget.tpl'),array( + '$photo_html' => $photo_html, + '$title' => $title, + '$subtitle' => $subtitle, + )); } return $o; } diff --git a/view/css/widgets.css b/view/css/widgets.css index a1801ac77..db90afad9 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -122,3 +122,30 @@ li:hover .group-edit-icon { #event-upload-choose { width: 100%; } + +/* cover photo */ + +#cover-photo { + position: relative; + width: 100%; + height: auto; +} + +#cover-photo-caption { + position: absolute; + bottom: 0px; + left: 0px; + width: 100%; + padding: 15px; + color: #fff; + font-weight: bold; + text-shadow: 1px 1px 3px rgba(0,0,0,.7); +} + +.cover-photo-title { + font-size: 30px; +} + +.cover-photo-subtitle { + font-size: 20px; +} diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index d3f9c5f70..a4e13b8eb 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -3,16 +3,6 @@ */ $(document).ready(function() { - //Simple cover-photo implementation - if($('#cover-photo').length && $(window).width() > 767) { - $('.navbar-fixed-top').css('position', 'relative'); - $('aside, section').css('padding-top', 0 + 'px'); - $('main').css('opacity', 0); - } - else { - $('#cover-photo').remove(); - } - // CSS3 calc() fallback (for unsupported browsers) $('body').append(''); if( $('#css3-calc').width() == 10) { @@ -62,17 +52,3 @@ $(document).ready(function() { } setInterval(function () {checkNotify();}, 10 * 1000); }); - -//Simple cover-photo implementation -$(window).scroll(function () { - if($('#cover-photo').length && $(window).width() > 767 && $(window).scrollTop() >= $('#cover-photo').height()) { - $('aside, section').css('padding-top', 71 + 'px'); - $(window).scrollTop($(window).scrollTop() - $('#cover-photo').height()) - $('.navbar-fixed-top').css('position', 'fixed'); - $('#cover-photo').remove(); - } - - if($('#cover-photo').length) { - $('main').css('opacity', ($(window).scrollTop()/$('#cover-photo').height()).toFixed(1)); - } -}); diff --git a/view/tpl/cover_photo_widget.tpl b/view/tpl/cover_photo_widget.tpl new file mode 100755 index 000000000..68571d257 --- /dev/null +++ b/view/tpl/cover_photo_widget.tpl @@ -0,0 +1,49 @@ + + +
    + {{$photo_html}} +
    +
    + {{$title}} +
    +
    + {{$subtitle}} +
    +
    +
    From 8ca877bdd3fbfd6f3b5ef1764c38ce39b2244c95 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 3 Mar 2016 12:31:49 +0100 Subject: [PATCH 11/14] slide up cover on click --- view/tpl/cover_photo_widget.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/view/tpl/cover_photo_widget.tpl b/view/tpl/cover_photo_widget.tpl index 68571d257..d6d2517e7 100755 --- a/view/tpl/cover_photo_widget.tpl +++ b/view/tpl/cover_photo_widget.tpl @@ -34,9 +34,13 @@ } }); + + function slideUpCover() { + $('html, body').animate({scrollTop: $('#cover-photo').height() + 'px'}); + } -
    +
    {{$photo_html}}
    From d3491c9165855ac7c2f1e0243a6c796ab36f9109 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 3 Mar 2016 13:46:08 +0100 Subject: [PATCH 12/14] fix jot form --- view/tpl/jot.tpl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 631f55d83..dea75efa9 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -1,12 +1,12 @@ -{{$mimeselect}} -{{$layoutselect}} -{{if $id_select}} -
    - {{$id_seltext}} {{$id_select}} -
    -{{/if}} -
    -
    + + {{$mimeselect}} + {{$layoutselect}} + {{if $id_select}} +
    + {{$id_seltext}} {{$id_select}} +
    + {{/if}} +
    {{if $parent}} {{/if}} @@ -160,8 +160,8 @@
    -
    -
    +
    + From 2cf54c465d25918d582efcf2bce0e3086d270e72 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Mar 2016 14:47:39 -0800 Subject: [PATCH 13/14] remove the markdown feature. Do not re-enable unless you are willing to support it. --- doc/to_do_code.bb | 2 -- include/features.php | 2 +- mod/item.php | 29 +++++++++++++++++++++-------- version.inc | 2 +- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/doc/to_do_code.bb b/doc/to_do_code.bb index a7c3c94b4..d0860cf3a 100644 --- a/doc/to_do_code.bb +++ b/doc/to_do_code.bb @@ -32,8 +32,6 @@ We need much more than this, but here are areas where developers can help. Pleas [li]API extensions, for Twitter API - search, friending, threading. For Red API, lots of stuff[/li] [li]Import channel from Diaspora/Friendica (Diaspora partially done)[/li] [li]MediaGoblin photo "crosspost" connector[/li] -[li]Create management page/UI for extensible profile fields[/li] -[li]Create interface to include/exclude and re-order standard profile fields[/li] [li]App taxonomy[/li] [li]Customisable App collection pages[/li] [li]replace the tinymce visual editor and/or make the visual editor pluggable and responsive to different output formats. We probably want library/bbedit for bbcode. This needs a fair bit of work to catch up with our "enhanced bbcode", but start with images, links, bold and highlight and work from there.[/li] diff --git a/include/features.php b/include/features.php index 1ef070b00..ff6b71d4c 100644 --- a/include/features.php +++ b/include/features.php @@ -66,7 +66,7 @@ function get_features($filtered = true) { 'composition' => array( t('Post Composition Features'), // array('richtext', t('Richtext Editor'), t('Enable richtext editor'),falseget_config('feature_lock','richtext')), - array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false,get_config('feature_lock','markdown')), +// array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false,get_config('feature_lock','markdown')), array('large_photos', t('Large Photos'), t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'),false,get_config('feature_lock','large_photos')), array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false,get_config('feature_lock','channel_sources')), array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false,get_config('feature_lock','content_encrypt')), diff --git a/mod/item.php b/mod/item.php index f23bff3ac..038a967b2 100644 --- a/mod/item.php +++ b/mod/item.php @@ -477,15 +477,28 @@ function item_post(&$a) { if($mimetype === 'text/bbcode') { require_once('include/text.php'); - if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { - require_once('include/bb2diaspora.php'); - $body = escape_tags(trim($body)); - $body = str_replace("\n",'
    ', $body); - $body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body); - $body = diaspora2bb($body,true); - $body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body); - } + // Markdown doesn't work correctly. Do not re-enable unless you're willing to fix it and support it. + + // Sample that will probably give you grief - you must preserve the linebreaks + // and provide the correct markdown interpretation and you cannot allow unfiltered HTML + + // Markdown + // ======== + // + // **bold** abcde + // fghijkl + // *italic* + // + +// if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { +// require_once('include/bb2diaspora.php'); +// $body = escape_tags(trim($body)); +// $body = str_replace("\n",'
    ', $body); +// $body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body); +// $body = diaspora2bb($body,true); +// $body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body); +// } // BBCODE alert: the following functions assume bbcode input // and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.) diff --git a/version.inc b/version.inc index 9863e681b..bac770446 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2016-03-02.1324H +2016-03-03.1325H From a59d1b22f6ab1bf5b3cf5df555d71b893c05540a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Mar 2016 18:55:10 -0800 Subject: [PATCH 14/14] Update the CHANGELOG for V1.3 --- CHANGELOG | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 819347552..9e9156fbc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,46 @@ +Hubzilla 1.3 + Admin Security configuration page created which consolidates several previously hidden settings: + Communication white/black lists + Channel white/black lists + OEmbed white/black lists + Admin Profile Fields page created which manages the availability and order of standard profile fields and allows new fields to be created/managed + "Poke" module reworked - page UI updated and "poke basic" setting introduced which limits the available poke "verbs". + "Mood" module UI reworked + "profile_photo" module UI reworked + "cover_photo" module UI reworked + "new_channel" module UI reworked + "register" module UI reworked + "pubsites" module UI reworked + item-meta ("iconfig") created which implements arbitrary storage for item metadata for plugins + abook-meta ("abconfig") created which implements arbitrary storage for connection metadata for plugins + "Strict transport security header" made optional as it conflicts with some existing Apache/nginx configurations + "Hubzilla UNO" (Hubzilla with radically simplified and locked site settings) implemented as an install configuration. + .well-known directory conflict worked out to support LetsEncrypt cert ownership checks without disrupting webfinger and other internal uses of .well-known + Lots of work on 'zcards' which are self-contained HTML representations of a channel including cover photos, profile photos, and some text information + Long standing bug uncovered which failed to properly restrict the lower time limit for public feed requests + A number of fixes to "readmore" to fix page jumping + Bugfix: persons other than the channel owner who have permission to upload photos to a channel could not do so if the js_upload plugin/addon was enabled + Siteinfo incorrectly identifying secondary directory servers + Allow admin to set and lock features when UNO is configured + Atom feeds: alter how events are formatted to be compatible with GNU-social + Allow guest/visitor access to view personal calendar + Moved several more classes to "composer format" and provided an autoloader. + Bugfix: require existing password to change password + Bugfix: allow relative_date() to be translated to Polish which has more than two plural forms. + Plugin API: add "requires" keyword to module header to indicate dependent addons + ActivityStreams improvements and cleanup: photo and file activities + UI cleanup for editing profile when multiple profiles enabled + Removed the "markdown" feature as there are numerous issues and no maintainer. + Provide "footer" bbcode to ease theming of post footer content + Bugfix: install issues caused by composer code refactor and typo in postgres load file + Plugins: + keepout - "block public on steroids" + pubsubhubbub - provides PuSH support to Atom feeds, required for GNU-social federation + GNUsocial protocol - under development + Diaspora protocol - some work to ease migration to the new signing format + Diaspost - disabled; numerous issues and no maintainer + smileybutton - theme work and fixed compatibility with other jot-tools plugins + Hubzilla 1.2 Provide extra HTTP security headers (several of them).