diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-19 17:39:42 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-19 17:39:42 -0800 |
commit | 6a49e3124e193edf57005873e825bf8328649183 (patch) | |
tree | 138c2387b7d107575f89a3de9ad3c35ae2ce60c6 | |
parent | 16f584608f8147a58bfe295ff3295aae0f85b38a (diff) | |
parent | 88d0bf94d89ac739469528bdab7905d0c00cf8a9 (diff) | |
download | volse-hubzilla-6a49e3124e193edf57005873e825bf8328649183.tar.gz volse-hubzilla-6a49e3124e193edf57005873e825bf8328649183.tar.bz2 volse-hubzilla-6a49e3124e193edf57005873e825bf8328649183.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
-rw-r--r-- | Zotlabs/Lib/Apps.php | 45 | ||||
-rw-r--r-- | Zotlabs/Module/Appman.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Apporder.php | 16 | ||||
-rw-r--r-- | Zotlabs/Module/Hq.php | 260 | ||||
-rw-r--r-- | Zotlabs/Module/Notify.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Ping.php | 14 | ||||
-rw-r--r-- | Zotlabs/Widget/Appcategories.php | 1 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/nav.php | 14 | ||||
-rw-r--r-- | view/css/bootstrap-red.css | 4 | ||||
-rw-r--r-- | view/css/mod_hq.css | 3 | ||||
-rw-r--r-- | view/js/main.js | 16 | ||||
-rw-r--r-- | view/js/mod_hq.js | 145 | ||||
-rw-r--r-- | view/pdl/mod_hq.pdl | 3 | ||||
-rw-r--r-- | view/php/default.php | 2 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 7 | ||||
-rw-r--r-- | view/theme/redbasic/js/redbasic.js | 10 | ||||
-rw-r--r-- | view/tpl/app.tpl | 11 | ||||
-rw-r--r-- | view/tpl/app_nav.tpl | 2 | ||||
-rw-r--r-- | view/tpl/apporder.tpl | 16 | ||||
-rw-r--r-- | view/tpl/help.tpl | 1 | ||||
-rwxr-xr-x | view/tpl/navbar_default.tpl | 18 | ||||
-rwxr-xr-x | view/tpl/navbar_tucson.tpl | 13 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 22 |
24 files changed, 566 insertions, 67 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index f13fbe362..9271cee85 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -401,11 +401,15 @@ class Apps { '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], '$feature' => (($papp['embed']) ? false : true), + '$pin' => (($papp['embed']) ? false : true), '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), + '$pinned' => ((strpos($papp['categories'], 'nav_pinned_app') === false) ? false : true), '$navapps' => (($mode == 'nav') ? true : false), '$order' => (($mode == 'nav-order') ? true : false), '$add' => t('Add to app-tray'), - '$remove' => t('Remove from app-tray') + '$remove' => t('Remove from app-tray'), + '$add_nav' => t('Pin to navbar'), + '$remove_nav' => t('Unpin from navbar') )); } @@ -498,25 +502,27 @@ class Apps { } } - static public function app_feature($uid,$app) { + static public function app_feature($uid,$app,$term) { $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc($app['guid']), intval($uid) ); - $x = q("select * from term where otype = %d and oid = %d and term = 'nav_featured_app' limit 1", + $x = q("select * from term where otype = %d and oid = %d and term = '%s' limit 1", intval(TERM_OBJ_APP), - intval($r[0]['id']) + intval($r[0]['id']), + dbesc($term) ); if($x) { - q("delete from term where otype = %d and oid = %d and term = 'nav_featured_app'", + q("delete from term where otype = %d and oid = %d and term = '%s'", intval(TERM_OBJ_APP), - intval($x[0]['oid']) + intval($x[0]['oid']), + dbesc($term) ); } else { - store_item_tag($uid,$r[0]['id'],TERM_OBJ_APP,TERM_CATEGORY,'nav_featured_app',escape_tags(z_root() . '/apps/?f=&cat=nav_featured_app')); + store_item_tag($uid, $r[0]['id'], TERM_OBJ_APP, TERM_CATEGORY, $term, escape_tags(z_root() . '/apps/?f=&cat=' . $term)); } } @@ -531,16 +537,27 @@ class Apps { } - static public function app_list($uid, $deleted = false, $cat = '') { + static public function app_list($uid, $deleted = false, $cats = []) { if($deleted) $sql_extra = ""; else $sql_extra = " and app_deleted = 0 "; - if($cat) { - $r = q("select oid from term where otype = %d and term = '%s'", - intval(TERM_OBJ_APP), - dbesc($cat) + if($cats) { + + $cat_sql_extra = " and ( "; + + foreach($cats as $cat) { + if(strpos($cat_sql_extra, 'term')) + $cat_sql_extra .= "or "; + + $cat_sql_extra .= "term = '" . dbesc($cat) . "' "; + } + + $cat_sql_extra .= ") "; + + $r = q("select oid from term where otype = %d $cat_sql_extra", + intval(TERM_OBJ_APP) ); if(! $r) return $r; @@ -616,7 +633,7 @@ class Apps { static function moveup($uid,$guid) { $syslist = array(); - $list = self::app_list($uid, false, 'nav_featured_app'); + $list = self::app_list($uid, false, ['nav_featured_app', 'nav_pinned_app']); if($list) { foreach($list as $li) { $syslist[] = self::app_encode($li); @@ -657,7 +674,7 @@ class Apps { static function movedown($uid,$guid) { $syslist = array(); - $list = self::app_list($uid, false, 'nav_featured_app'); + $list = self::app_list($uid, false, ['nav_featured_app', 'nav_pinned_app']); if($list) { foreach($list as $li) { $syslist[] = self::app_encode($li); diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php index 5c0667357..64d4628ae 100644 --- a/Zotlabs/Module/Appman.php +++ b/Zotlabs/Module/Appman.php @@ -64,7 +64,11 @@ class Appman extends \Zotlabs\Web\Controller { } if($_POST['feature']) { - Zlib\Apps::app_feature(local_channel(),$papp); + Zlib\Apps::app_feature(local_channel(), $papp, $_POST['feature']); + } + + if($_POST['pin']) { + Zlib\Apps::app_feature(local_channel(), $papp, $_POST['pin']); } if($_SESSION['return_url']) diff --git a/Zotlabs/Module/Apporder.php b/Zotlabs/Module/Apporder.php index 956548d1f..a9f66ba69 100644 --- a/Zotlabs/Module/Apporder.php +++ b/Zotlabs/Module/Apporder.php @@ -18,7 +18,7 @@ class Apporder extends \Zotlabs\Web\Controller { nav_set_selected('Order Apps'); $syslist = array(); - $list = Zlib\Apps::app_list(local_channel(), false, 'nav_featured_app'); + $list = Zlib\Apps::app_list(local_channel(), false, ['nav_featured_app', 'nav_pinned_app']); if($list) { foreach($list as $li) { $syslist[] = Zlib\Apps::app_encode($li); @@ -31,14 +31,20 @@ class Apporder extends \Zotlabs\Web\Controller { $syslist = Zlib\Apps::app_order(local_channel(),$syslist); foreach($syslist as $app) { - $nav_apps[] = Zlib\Apps::app_render($app,'nav-order'); + if(strpos($app['categories'],'nav_pinned_app') !== false) { + $navbar_apps[] = Zlib\Apps::app_render($app,'nav-order'); + } + else { + $nav_apps[] = Zlib\Apps::app_render($app,'nav-order'); + } } return replace_macros(get_markup_template('apporder.tpl'), [ - '$header' => t('Change Order of Navigation Apps'), - '$desc' => t('Use arrows to move the corresponding app up or down in the display list'), - '$nav_apps' => $nav_apps + '$header' => [t('Change Order of Pinned Navbar Apps'), t('Change Order of App Tray Apps')], + '$desc' => [t('Use arrows to move the corresponding app left (top) or right (bottom) in the navbar'), t('Use arrows to move the corresponding app up or down in the app tray')], + '$nav_apps' => $nav_apps, + '$navbar_apps' => $navbar_apps ] ); } diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php new file mode 100644 index 000000000..41e9d40ca --- /dev/null +++ b/Zotlabs/Module/Hq.php @@ -0,0 +1,260 @@ +<?php +namespace Zotlabs\Module; + +require_once("include/bbcode.php"); +require_once('include/security.php'); +require_once('include/conversation.php'); +require_once('include/acl_selectors.php'); +require_once('include/items.php'); + + +class Hq extends \Zotlabs\Web\Controller { + + function post() { + + if(!local_channel()) + return; + + if($_REQUEST['notify_id']) { + q("update notify set seen = 1 where id = %d and uid = %d", + intval($_REQUEST['notify_id']), + intval(local_channel()) + ); + } + + } + + function get($update = 0, $load = false) { + + if(!local_channel()) + return; + + if($load) + $_SESSION['loadtime'] = datetime_convert(); + + if(argc() > 1 && argv(1) !== 'load') { + $item_hash = argv(1); + } + + if($_REQUEST['mid']) + $item_hash = $_REQUEST['mid']; + + $item_normal = item_normal(); + $item_normal_update = item_normal_update(); + + if(! $item_hash) { + + $r = q("SELECT mid FROM item + WHERE uid = %d + AND mid = parent_mid + $item_normal + ORDER BY id DESC + limit 1", + local_channel() + ); + $item_hash = 'b64.' . base64url_encode($r[0]['mid']); + + if(!$item_hash) { + \App::$error = 404; + notice( t('Item not found.') . EOL); + return; + } + } + + $updateable = false; + + if(! $update) { + + $channel = \App::get_channel(); + + $channel_acl = [ + 'allow_cid' => $channel['channel_allow_cid'], + 'allow_gid' => $channel['channel_allow_gid'], + 'deny_cid' => $channel['channel_deny_cid'], + 'deny_gid' => $channel['channel_deny_gid'] + ]; + + $x = [ + 'is_owner' => true, + 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), + 'default_location' => $channel['channel_location'], + 'nickname' => $channel['channel_address'], + 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + + 'acl' => populate_acl($channel_acl), + 'permissions' => $channel_acl, + 'bang' => '', + 'visitor' => true, + 'profile_uid' => local_channel(), + 'return_path' => 'channel/' . $channel['channel_address'], + 'expanded' => true, + 'editor_autocomplete' => true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true, + 'jotnets' => true + ]; + + $o = '<div id="jot-popup">'; + $o .= status_editor($a,$x); + $o .= '</div>'; + } + + $target_item = null; + + if(strpos($item_hash,'b64.') === 0) + $decoded = @base64url_decode(substr($item_hash,4)); + if($decoded) + $item_hash = $decoded; + + $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid like '%s' limit 1", + dbesc($item_hash . '%') + ); + + if($r) { + $target_item = $r[0]; + } + + //if the item is to be moderated redirect to /moderate + if($target_item['item_blocked'] == ITEM_MODERATED) { + goaway(z_root() . '/moderate/' . $target_item['id']); + } + + $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); + + $simple_update = (($update) ? " AND item_unseen = 1 " : ''); + + if($update && $_SESSION['loadtime']) + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; + if($load) + $simple_update = ''; + + if($static && $simple_update) + $simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' "; + + if(! $update && ! $load) { + + $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); + + // if the target item is not a post (eg a like) we want to address its thread parent + + $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']); + + // if we got a decoded hash we must encode it again before handing to javascript + if($decoded) + $mid = 'b64.' . base64url_encode($mid); + + $o .= '<div id="live-display"></div>' . "\r\n"; + $o .= "<script> var profile_uid = " . local_channel() + . "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . "; </script>\r\n"; + + \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),[ + '$baseurl' => z_root(), + '$pgtype' => 'display', + '$uid' => '0', + '$gid' => '0', + '$cid' => '0', + '$cmin' => '0', + '$cmax' => '99', + '$star' => '0', + '$liked' => '0', + '$conv' => '0', + '$spam' => '0', + '$fh' => '0', + '$nouveau' => '0', + '$wall' => '0', + '$static' => $static, + '$page' => 1, + '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), + '$search' => '', + '$xchan' => '', + '$order' => '', + '$file' => '', + '$cats' => '', + '$tags' => '', + '$dend' => '', + '$dbegin' => '', + '$verb' => '', + '$net' => '', + '$mid' => $mid + ]); + + } + + if($load) { + $r = null; + + $r = q("SELECT item.id as item_id from item + WHERE uid = %d + and mid = '%s' + $item_normal + limit 1", + intval(local_channel()), + dbesc($target_item['parent_mid']) + ); + if($r) { + $updateable = true; + } + + } + + elseif($update) { + $r = null; + + $r = q("SELECT item.parent AS item_id from item + WHERE uid = %d + and parent_mid = '%s' + $item_normal_update + $simple_update + limit 1", + intval(local_channel()), + dbesc($target_item['parent_mid']) + ); + if($r) { + $updateable = true; + } + + $_SESSION['loadtime'] = datetime_convert(); + } + + else { + $r = []; + } + + if($r) { + $parents_str = ids_to_querystr($r,'item_id'); + if($parents_str) { + $items = q("SELECT item.*, item.id AS item_id + FROM item + WHERE parent in ( %s ) $item_normal ", + dbesc($parents_str) + ); + + xchan_query($items); + $items = fetch_post_tags($items,true); + $items = conv_sort($items,'created'); + } + } + else { + $items = []; + } + + $o .= conversation($items, 'display', $update, 'client'); + + if($updateable) { + $x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ", + intval(local_channel()), + intval($r[0]['item_id']) + ); + } + + $o .= '<div id="content-complete"></div>'; + + if(($update && $load) && (! $items)) { + notice( t('Something went wrong.') . EOL ); + } + + return $o; + + } + +} diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php index 3d6e1c2e7..cffcc8099 100644 --- a/Zotlabs/Module/Notify.php +++ b/Zotlabs/Module/Notify.php @@ -34,7 +34,7 @@ class Notify extends \Zotlabs\Web\Controller { } - function get() { + function get() { if(! local_channel()) return login(); diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 3c6dda1e9..8644b8326 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -262,6 +262,16 @@ class Ping extends \Zotlabs\Web\Controller { if($t) { foreach($t as $tt) { + $message = trim(strip_tags(bbcode($tt['msg']))); + + if(strpos($message, $tt['xname']) === 0) + $message = substr($message, strlen($tt['xname']) + 1); + + + $mid = basename($tt['link']); + + $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid)); + $notifs[] = array( 'notify_link' => z_root() . '/notify/view/' . $tt['id'], 'name' => $tt['xname'], @@ -269,7 +279,9 @@ class Ping extends \Zotlabs\Web\Controller { 'photo' => $tt['photo'], 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), - 'message' => strip_tags(bbcode($tt['msg'])) + 'b64mid' => $b64mid, + 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''), + 'message' => $message ); } } diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php index 490ec1abc..8ff14230f 100644 --- a/Zotlabs/Widget/Appcategories.php +++ b/Zotlabs/Widget/Appcategories.php @@ -26,6 +26,7 @@ class Appcategories { and term.uid = app_channel and term.otype = %d and term.term != 'nav_featured_app' + and term.term != 'nav_pinned_app' order by term.term asc", intval(local_channel()), intval(TERM_OBJ_APP) @@ -50,7 +50,7 @@ require_once('include/hubloc.php'); require_once('include/attach.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '2.9' ); +define ( 'STD_VERSION', '2.9.1' ); define ( 'ZOT_REVISION', '1.3' ); define ( 'DB_UPDATE_VERSION', 1198 ); diff --git a/include/nav.php b/include/nav.php index 9df50c9fe..2dcf68bc8 100644 --- a/include/nav.php +++ b/include/nav.php @@ -253,7 +253,7 @@ EOT; } $syslist = array(); - $list = Zlib\Apps::app_list(local_channel(), false, 'nav_featured_app'); + $list = Zlib\Apps::app_list(local_channel(), false, ['nav_featured_app', 'nav_pinned_app']); if($list) { foreach($list as $li) { $syslist[] = Zlib\Apps::app_encode($li); @@ -274,16 +274,20 @@ EOT; $app['active'] = true; if($is_owner) { - $nav_apps[] = Zlib\Apps::app_render($app,'nav'); - if(strpos($app['categories'],'navbar_' . $template)) { + if(strpos($app['categories'],'nav_pinned_app') !== false) { $navbar_apps[] = Zlib\Apps::app_render($app,'navbar'); } + else { + $nav_apps[] = Zlib\Apps::app_render($app,'nav'); + } } elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) { - $nav_apps[] = Zlib\Apps::app_render($app,'nav'); - if(strpos($app['categories'],'navbar_' . $template)) { + if(strpos($app['categories'],'nav_pinned_app') !== false) { $navbar_apps[] = Zlib\Apps::app_render($app,'navbar'); } + else { + $nav_apps[] = Zlib\Apps::app_render($app,'nav'); + } } } diff --git a/view/css/bootstrap-red.css b/view/css/bootstrap-red.css index 18efd69e4..a0b7c5bba 100644 --- a/view/css/bootstrap-red.css +++ b/view/css/bootstrap-red.css @@ -11,7 +11,7 @@ nav .dropdown-menu { min-width: 16rem; } -@media screen and (min-width: 767px) { +@media screen and (min-width: 992px) { nav .badge { top: 0px; left: 0px; @@ -19,7 +19,7 @@ nav .dropdown-menu { } } -@media screen and (max-width: 767px) { +@media screen and (max-width: 992px) { .navbar { padding: .5rem 7px; } diff --git a/view/css/mod_hq.css b/view/css/mod_hq.css new file mode 100644 index 000000000..dde242d4e --- /dev/null +++ b/view/css/mod_hq.css @@ -0,0 +1,3 @@ +#jot-popup { + display: none; +} diff --git a/view/js/main.js b/view/js/main.js index e231dac60..ddd876689 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -451,20 +451,20 @@ function NavUpdate() { updateCountsOnly = false; if(data.network || data.home || data.intros || data.register || data.mail || data.all_events || data.notify || data.files || data.pubs) { - $('#notifications-btn').css('opacity', 1); + $('.notifications-btn').css('opacity', 1); } else { - $('#notifications-btn').css('opacity', 0.5); + $('.notifications-btn').css('opacity', 0.5); $('#navbar-collapse-1').removeClass('show'); } if(data.home || data.intros || data.register || data.mail || data.notify || data.files) { - $('#notifications-btn-icon').removeClass('fa-exclamation-circle'); - $('#notifications-btn-icon').addClass('fa-exclamation-triangle'); + $('.notifications-btn-icon').removeClass('fa-exclamation-circle'); + $('.notifications-btn-icon').addClass('fa-exclamation-triangle'); } if(!data.home && !data.intros && !data.register && !data.mail && !data.notify && !data.files) { - $('#notifications-btn-icon').removeClass('fa-exclamation-triangle'); - $('#notifications-btn-icon').addClass('fa-exclamation-circle'); + $('.notifications-btn-icon').removeClass('fa-exclamation-triangle'); + $('.notifications-btn-icon').addClass('fa-exclamation-circle'); } $.each(data, function(index, item) { @@ -959,9 +959,9 @@ function notify_popup_loader(notifyType) { $("." + notifyType + "-update").html(data.notify.length); $(data.notify).each(function() { - html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid); + html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id); $("#navbar-" + notifyType + "-menu").append(html); - html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid); + html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id); $("#nav-" + notifyType + "-menu").append(html); }); diff --git a/view/js/mod_hq.js b/view/js/mod_hq.js new file mode 100644 index 000000000..cf7ec941c --- /dev/null +++ b/view/js/mod_hq.js @@ -0,0 +1,145 @@ +function hqLiveUpdate(notify_id, b64mid) { + + if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */ + if((src === null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; } + if(($('.comment-edit-text.expanded').length) || (in_progress)) { + if(livetime) { + clearTimeout(livetime); + } + livetime = setTimeout(liveUpdate, 10000); + return; + } + if(livetime !== null) + livetime = null; + + prev = 'live-' + src; + + in_progress = true; + + var update_url; + var update_mode; + + if(scroll_next) { + bParam_page = next_page; + page_load = true; + } + else { + bParam_page = 1; + } + + update_url = buildCmd(); + + if(page_load) { + $("#page-spinner").show(); + if(bParam_page == 1) + update_mode = 'replace'; + else + update_mode = 'append'; + } + else { + update_mode = 'update'; + var orgHeight = $("#region_2").height(); + } + + var dstart = new Date(); + console.log('LOADING data...'); + $.get(update_url, function(data) { + + // on shared hosts occasionally the live update process will be killed + // leaving an incomplete HTML structure, which leads to conversations getting + // truncated and the page messed up if all the divs aren't closed. We will try + // again and give up if we can't get a valid HTML response after 10 tries. + + if((data.indexOf("<html>") != (-1)) && (data.indexOf("</html>") == (-1))) { + console.log('Incomplete data. Reloading'); + in_progress = false; + liveRecurse ++; + if(liveRecurse < 10) { + liveUpdate(); + } + else { + console.log('Incomplete data. Too many attempts. Giving up.'); + } + } + + // else data was valid - reset the recursion counter + liveRecurse = 0; + + if(notify_id !== 'undefined') { + $.post( + "hq", + { + "notify_id" : notify_id + }, + function(data) { + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,10); + } + ); + } + + var dready = new Date(); + console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.'); + + if(update_mode === 'update' || preloadImages) { + console.log('LOADING images...'); + + $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() { + var iready = new Date(); + console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.'); + + page_load = false; + scroll_next = false; + updateConvItems(update_mode,data); + $("#page-spinner").hide(); + $("#profile-jot-text-loading").hide(); + + // adjust scroll position if new content was added above viewport + if(update_mode === 'update') { + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + } + + in_progress = false; + + // FIXME - the following lines were added so that almost + // immediately after we update the posts on the page, we + // re-check and update the notification counts. + // As it turns out this causes a bit of an inefficiency + // as we're pinging twice for every update, once before + // and once after. A btter way to do this is to rewrite + // NavUpdate and perhaps LiveUpdate so that we check for + // post updates first and only call the notification ping + // once. + + updateCountsOnly = true; + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,10); + + }); + } + else { + page_load = false; + scroll_next = false; + updateConvItems(update_mode,data); + $("#page-spinner").hide(); + $("#profile-jot-text-loading").hide(); + + in_progress = false; + + // FIXME - the following lines were added so that almost + // immediately after we update the posts on the page, we + // re-check and update the notification counts. + // As it turns out this causes a bit of an inefficiency + // as we're pinging twice for every update, once before + // and once after. A btter way to do this is to rewrite + // NavUpdate and perhaps LiveUpdate so that we check for + // post updates first and only call the notification ping + // once. + + updateCountsOnly = true; + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,10); + + } + }); +} diff --git a/view/pdl/mod_hq.pdl b/view/pdl/mod_hq.pdl new file mode 100644 index 000000000..e657fa88b --- /dev/null +++ b/view/pdl/mod_hq.pdl @@ -0,0 +1,3 @@ +[region=right_aside] +[widget=notifications][/widget] +[/region] diff --git a/view/php/default.php b/view/php/default.php index b180a6eb8..06cecc56f 100644 --- a/view/php/default.php +++ b/view/php/default.php @@ -8,7 +8,7 @@ <body <?php if($page['direction']) echo 'dir="rtl"' ?> > <?php if(x($page,'banner')) echo $page['banner']; ?> <header><?php if(x($page,'header')) echo $page['header']; ?></header> - <nav class="navbar fixed-top navbar-expand-xl navbar-dark bg-dark"><?php if(x($page,'nav')) echo $page['nav']; ?></nav> + <nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark"><?php if(x($page,'nav')) echo $page['nav']; ?></nav> <main> <aside id="region_1"><div id="left_aside_spacer"><div id="left_aside_wrapper"><?php if(x($page,'aside')) echo $page['aside']; ?></div></div></aside> <section id="region_2"><?php if(x($page,'content')) echo $page['content']; ?> diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 6df5a060b..5f31004ff 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1484,7 +1484,7 @@ blockquote { color: $nav_active_icon_colour; } -@media screen and (max-width: 767px) { +@media screen and (max-width: 992px) { aside#region_1 { border-right: 1px solid $nav_bd; @@ -1504,6 +1504,11 @@ blockquote { flex-basis: 25%; } + #navbar-collapse-2 .navbar-app i { + font-size: 1rem; + margin-right: 0.5rem; + } + } .shareable_element_text { diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index ed9ef02aa..41f5eb7ce 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -8,7 +8,7 @@ $(document).ready(function() { $('body').append('<div id="css3-calc" style="width: 10px; width: calc(10px + 10px); display: none;"></div>'); if( $('#css3-calc').width() == 10) { $(window).resize(function() { - if($(window).width() < 767) { + if($(window).width() < 992) { $('main').css('width', $(window).width() + $('aside').outerWidth() ); } else { $('main').css('width', '100%' ); @@ -17,7 +17,7 @@ $(document).ready(function() { } $('#css3-calc').remove(); // Remove the test element - if($(window).width() >= 767) { + if($(window).width() >= 992) { $('#left_aside_wrapper').stick_in_parent({ offset_top: parseInt($('aside').css('padding-top')), parent: 'main', @@ -25,7 +25,7 @@ $(document).ready(function() { }); } - if($(window).width() >= 1200) { + if($(window).width() >= 992) { $('#right_aside_wrapper').stick_in_parent({ offset_top: parseInt($('aside').css('padding-top')), parent: 'main', @@ -77,7 +77,9 @@ $(document).ready(function() { } }); - $('#notifications-btn').click(function() { + $('.notifications-btn').click(function(e) { + e.preventDefault(); + e.stopPropagation(); if($('#navbar-collapse-2').hasClass('show')){ $('#navbar-collapse-2').removeClass('show'); } diff --git a/view/tpl/app.tpl b/view/tpl/app.tpl index ac5c18deb..7d2e46c59 100644 --- a/view/tpl/app.tpl +++ b/view/tpl/app.tpl @@ -12,13 +12,14 @@ </div> {{/if}} {{if $install || $update || $delete || $feature}} - <div class="app-tools"> + <div class="text-center app-tools"> <form action="{{$hosturl}}appman" method="post"> <input type="hidden" name="papp" value="{{$app.papp}}" /> - {{if $install}}<button type="submit" name="install" value="{{$install}}" class="btn btn-outline-secondary btn-sm" title="{{$install}}" ><i class="fa fa-arrow-circle-o-down" ></i></button>{{/if}} - {{if $edit}}<input type="hidden" name="appid" value="{{$app.guid}}" /><button type="submit" name="edit" value="{{$edit}}" class="btn btn-outline-secondary btn-sm" title="{{$edit}}" ><i class="fa fa-pencil" ></i></button>{{/if}} - {{if $delete}}<button type="submit" name="delete" value="{{if $deleted}}{{$undelete}}{{else}}{{$delete}}{{/if}}" class="btn btn-outline-secondary btn-sm" title="{{if $deleted}}{{$undelete}}{{else}}{{$delete}}{{/if}}" ><i class="fa fa-trash-o drop-icons"></i></button>{{/if}} - {{if $feature}}<button type="submit" name="feature" value="feature" class="btn btn-outline-secondary btn-sm" title="{{if $featured}}{{$remove}}{{else}}{{$add}}{{/if}}"><i class="fa fa-star"{{if $featured}} style="color: gold"{{/if}}></i></button>{{/if}} + {{if $install}}<button type="submit" name="install" value="{{$install}}" class="btn btn-outline-secondary btn-sm" title="{{$install}}" ><i class="fa fa-fw fa-arrow-circle-o-down" ></i></button>{{/if}} + {{if $edit}}<input type="hidden" name="appid" value="{{$app.guid}}" /><button type="submit" name="edit" value="{{$edit}}" class="btn btn-outline-secondary btn-sm" title="{{$edit}}" ><i class="fa fa-fw fa-pencil" ></i></button>{{/if}} + {{if $delete}}<button type="submit" name="delete" value="{{if $deleted}}{{$undelete}}{{else}}{{$delete}}{{/if}}" class="btn btn-outline-secondary btn-sm" title="{{if $deleted}}{{$undelete}}{{else}}{{$delete}}{{/if}}" ><i class="fa fa-fw fa-trash-o drop-icons"></i></button>{{/if}} + {{if $feature}}<button type="submit" name="feature" value="nav_featured_app" class="btn btn-outline-secondary btn-sm" title="{{if $featured}}{{$remove}}{{else}}{{$add}}{{/if}}"><i class="fa fa-fw fa-star{{if $featured}} text-warning{{/if}}"></i></button>{{/if}} + {{if $pin}}<button type="submit" name="pin" value="nav_pinned_app" class="btn btn-outline-secondary btn-sm" title="{{if $pinned}}{{$remove_nav}}{{else}}{{$add_nav}}{{/if}}"><i class="fa fa-fw fa-thumb-tack{{if $pinned}} text-success{{/if}}"></i></button>{{/if}} </form> </div> {{/if}} diff --git a/view/tpl/app_nav.tpl b/view/tpl/app_nav.tpl index 046cd7237..817c74763 100644 --- a/view/tpl/app_nav.tpl +++ b/view/tpl/app_nav.tpl @@ -1 +1 @@ -<a class="navbar-app nav-link{{if $app.active}} active{{/if}}" href="{{$app.url}}" title="{{$app.name}}" >{{if $icon}}<i class="fa fa-fw fa-{{$icon}}"></i>{{else}}<img src="{{$app.photo}}" width="16" height="16" />{{/if}}</a> +<a class="navbar-app nav-link{{if $app.active}} active{{/if}}" href="{{$app.url}}" title="{{$app.name}}" >{{if $icon}}<i class="fa fa-fw fa-{{$icon}}"></i>{{else}}<img src="{{$app.photo}}" width="16" height="16" />{{/if}}<span class="d-lg-none">{{$app.name}}</span></a> diff --git a/view/tpl/apporder.tpl b/view/tpl/apporder.tpl index fdb726131..8a247f11d 100644 --- a/view/tpl/apporder.tpl +++ b/view/tpl/apporder.tpl @@ -1,7 +1,15 @@ -<h2>{{$header}}</h2> - -<div class="descriptive-text">{{$desc}}</div> -<br><br><br> +{{if $navbar_apps}} +<h2>{{$header.0}}</h2> +<div class="descriptive-text">{{$desc.0}}</div> +<br><br> +{{foreach $navbar_apps as $navbar_app}} +{{$navbar_app}} +{{/foreach}} +<br><br> +{{/if}} +<h2>{{$header.1}}</h2> +<div class="descriptive-text">{{$desc.1}}</div> +<br><br> {{foreach $nav_apps as $nav_app}} {{$nav_app}} {{/foreach}} diff --git a/view/tpl/help.tpl b/view/tpl/help.tpl index d36494123..c523c4115 100644 --- a/view/tpl/help.tpl +++ b/view/tpl/help.tpl @@ -9,6 +9,7 @@ <a class="dropdown-item lang-choice" href="/help">de</a> <a class="dropdown-item lang-choice" href="/help">en</a> <a class="dropdown-item lang-choice" href="/help">es</a> + <a class="dropdown-item lang-choice" href="/help">fr</a> </div> </div> </div> diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl index 426d32047..c4f5af1dc 100755 --- a/view/tpl/navbar_default.tpl +++ b/view/tpl/navbar_default.tpl @@ -1,5 +1,5 @@ {{if $nav.login && !$userinfo}} -<div class="d-xl-none pt-1 pb-1"> +<div class="d-lg-none pt-1 pb-1"> {{if $nav.loginmenu.1.4}} <a class="btn btn-primary btn-sm text-white" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}_collapse" data-toggle="modal" data-target="#nav-login"> {{$nav.loginmenu.1.1}} @@ -76,12 +76,12 @@ <i class="fa fa-question-circle"></i> </button> {{/if}} - <button id="expand-aside" type="button" class="d-md-none navbar-toggler border-0" data-toggle="offcanvas" data-target="#region_1"> + <button id="expand-aside" type="button" class="d-lg-none navbar-toggler border-0" data-toggle="offcanvas" data-target="#region_1"> <i class="fa fa-arrow-circle-right" id="expand-aside-icon"></i> </button> {{if $localuser || $nav.pubs}} - <button id="notifications-btn" type="button" class="navbar-toggler border-0 text-white"> - <i id="notifications-btn-icon" class="fa fa-exclamation-circle"></i> + <button id="notifications-btn-1" type="button" class="navbar-toggler border-0 text-white notifications-btn"> + <i id="notifications-btn-icon-1" class="fa fa-exclamation-circle notifications-btn-icon"></i> </button> {{/if}} <button id="menu-btn" class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbar-collapse-2"> @@ -134,6 +134,11 @@ <a class="nav-link {{$nav.help.2}}" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" id="{{$nav.help.4}}" onclick="contextualHelp(); return false;"><i class="fa fa-fw fa-question-circle"></i></a> </li> {{/if}} + {{if $localuser || $nav.pubs}} + <li id="notifications-btn" class="nav-item d-xl-none"> + <a class="nav-link text-white notifications-btn" href="#"><i id="notifications-btn-icon" class="fa fa-exclamation-circle notifications-btn-icon"></i></a> + </li> + {{/if}} {{if $channel_menu && $channel_apps.0}} <li class="nav-item dropdown" id="channel-menu"> <a class="nav-link" href="#" data-toggle="dropdown"><img src="{{$channel_thumb}}" style="height:14px; width:14px;position:relative; top:-2px;" /></a> @@ -179,7 +184,7 @@ </li> </ul> </div> -<div class="collapse d-xl-none" id="navbar-collapse-2"> +<div class="collapse d-lg-none" id="navbar-collapse-2"> <div class="navbar-nav mr-auto"> {{if $channel_apps.0}} {{foreach $channel_apps as $channel_app}} @@ -190,6 +195,9 @@ </div> <div id="sys-apps-collapsed" style="display:none;"> {{/if}} + {{foreach $navbar_apps as $navbar_app}} + {{$navbar_app}} + {{/foreach}} {{foreach $nav_apps as $nav_app}} {{$nav_app|replace:'dropdown-item':'nav-link'}} {{/foreach}} diff --git a/view/tpl/navbar_tucson.tpl b/view/tpl/navbar_tucson.tpl index faf8b5b4a..4e045571f 100755 --- a/view/tpl/navbar_tucson.tpl +++ b/view/tpl/navbar_tucson.tpl @@ -1,5 +1,5 @@ {{if $nav.login && !$userinfo}} -<div class="d-xl-none pt-1 pb-1"> +<div class="d-lg-none pt-1 pb-1"> {{if $nav.loginmenu.1.4}} <a class="btn btn-primary btn-sm text-white" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}_collapse" data-toggle="modal" data-target="#nav-login"> {{$nav.loginmenu.1.1}} @@ -87,8 +87,8 @@ </button> {{if $localuser || $nav.pubs}} - <button id="notifications-btn" type="button" class="navbar-toggler border-0 text-white" data-toggle="collapse" data-target="#navbar-collapse-1"> - <i id="notifications-btn-icon" class="fa fa-exclamation"></i> + <button id="notifications-btn-1" type="button" class="navbar-toggler border-0 text-white notifications-btn" data-toggle="collapse" data-target="#navbar-collapse-1"> + <i id="notifications-btn-icon-1" class="fa fa-exclamation notifications-btn-icon"></i> </button> {{/if}} @@ -231,6 +231,11 @@ <a class="nav-link {{$nav.help.2}}" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" id="{{$nav.help.4}}" onclick="contextualHelp(); return false;"><i class="fa fa-fw fa-question-circle"></i></a> </li> {{/if}} + {{if $localuser || $nav.pubs}} + <li id="notifications-btn" class="nav-item d-xl-none"> + <a class="nav-link text-white notifications-btn" href="#"><i id="notifications-btn-icon" class="fa fa-exclamation-circle notifications-btn-icon"></i></a> + </li> + {{/if}} {{if $channel_apps.0}} <li class="nav-item dropdown" id="channel-menu"> <a class="nav-link" href="#" data-toggle="dropdown"><img src="{{$channel_thumb}}" style="height:14px; width:14px;position:relative; top:-2px;" /></a> @@ -258,7 +263,7 @@ </div> -<div class="collapse d-xl-none" id="navbar-collapse-2"> +<div class="collapse d-lg-none" id="navbar-collapse-2"> <div class="navbar-nav mr-auto"> {{if $channel_apps.0}} {{foreach $channel_apps as $channel_app}} diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 3ef7bff7d..8168866ad 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -2,7 +2,7 @@ var notifications_parent; $(document).ready(function() { notifications_parent = $('#notifications_wrapper')[0].parentElement.id; - $('#notifications-btn').click(function() { + $('.notifications-btn').click(function() { if($('#notifications_wrapper').hasClass('fs')) $('#notifications_wrapper').prependTo('#' + notifications_parent); else @@ -15,21 +15,35 @@ }); }); - {{if $module == 'display'}} + {{if $module == 'display' || $module == 'hq'}} $(document).on('click', '.notification', function(e) { var b64mid = $(this).data('b64mid'); + var notify_id = $(this).data('notify_id'); var path = $(this)[0].pathname.substr(1,7); + console.log(path); + + {{if $module == 'hq'}} + if(b64mid !== 'undefined' && path !== 'pubstre') { + {{else}} if(path === 'display' && b64mid) { + {{/if}} e.preventDefault(); e.stopPropagation(); $('.thread-wrapper').remove(); - $(this).fadeOut(); + + if(! page_load) + $(this).fadeOut(); + bParam_mid = b64mid; mode = 'replace'; page_load = true; + {{if $module == 'hq'}} + hqLiveUpdate(notify_id); + {{else}} liveUpdate(); + {{/if}} if($('#notifications_wrapper').hasClass('fs')) $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs'); @@ -43,7 +57,7 @@ <div id="notifications_wrapper"> <div id="notifications" class="navbar-nav" data-children=".nav-item"> <div id="nav-notifications-template" rel="template"> - <a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}"> + <a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}"> <img class="menu-img-3" data-src="{1}"> <span class="contactname">{2}</span> <span class="dropdown-sub-text">{3}<br>{4}</span> |