Merge pull request #10 from redmatrix/dev

Dev
This commit is contained in:
mrjive 2018-01-22 09:34:08 +01:00 committed by GitHub
commit 131baa9f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 276 additions and 302 deletions

View File

@ -641,7 +641,7 @@ function configure_cron_daily {
# every 10 min for poller.php
if [ -z "`grep 'poller.php' /etc/crontab`" ]
then
echo "*/10 * * * * www-data cd /var/www/html; php include/poller.php >> /dev/null 2>&1" >> /etc/crontab
echo "*/10 * * * * www-data cd /var/www/html; php Zotlabs/Daemon/Master.php Cron >> /dev/null 2>&1" >> /etc/crontab
fi
# Run external script daily at 05:30
# - stop apache and mysql-server

View File

@ -90,8 +90,6 @@ class Notifier {
$item_id = $argv[2];
$extra = (($argc > 3) ? $argv[3] : null);
if(! $item_id)
return;
@ -315,7 +313,7 @@ class Notifier {
}
if($target_item['id'] == $target_item['parent']) {
if($target_item['mid'] === $target_item['parent_mid']) {
$parent_item = $target_item;
$top_level_post = true;
}

View File

@ -730,9 +730,6 @@ class ThreadItem {
$observer = $conv->get_observer();
$qc = ((local_channel()) ? get_pconfig(local_channel(),'system','qcomment') : null);
$qcomment = (($qc) ? explode("\n",$qc) : null);
$arr = array('comment_buttons' => '','id' => $this->get_id());
call_hooks('comment_buttons',$arr);
$comment_buttons = $arr['comment_buttons'];
@ -744,7 +741,6 @@ class ThreadItem {
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(),
'$parent' => $this->get_id(),
'$qcomment' => $qcomment,
'$comment_buttons' => $comment_buttons,
'$profile_uid' => $conv->get_profile_owner(),
'$mylink' => $observer['xchan_url'],

View File

@ -43,6 +43,7 @@ class Site {
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
$site_firehose = ((x($_POST,'site_firehose')) ? True : False);
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
@ -66,7 +67,7 @@ class Site {
$techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0);
$imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : '');
$thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0);
$force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 300);
$force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000);
$techlevel = null;
if(array_key_exists('techlevel', $_POST))
@ -135,6 +136,7 @@ class Site {
set_config('system','allowed_sites', $allowed_sites);
set_config('system','publish_all', $force_publish);
set_config('system','disable_discover_tab', $disable_discover_tab);
set_config('system','site_firehose', $site_firehose);
set_config('system','force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
@ -314,6 +316,8 @@ class Site {
'$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")),
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
'$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')),
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
@ -328,7 +332,7 @@ class Site {
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
'$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',300), t("Always defer immediate delivery if queue contains more than this number of entries.")),
'$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
'$thumbnail_security' => array('thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.")),

View File

@ -97,6 +97,9 @@ class Dirsearch extends \Zotlabs\Web\Controller {
else
$sync = false;
if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
$hub = \App::get_hostname();
}
if($hub)
$hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";

View File

@ -17,9 +17,16 @@ class Pubstream extends \Zotlabs\Web\Controller {
return login();
}
$disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
if($disable_discover_tab)
return;
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
$net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
if(! ($site_firehose || $net_firehose)) {
return '';
}
if($net_firehose) {
$site_firehose = false;
}
$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
@ -142,7 +149,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
require_once('include/channel.php');
require_once('include/security.php');
if(get_config('system','site_firehose')) {
if($site_firehose) {
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
}
else {

View File

@ -38,10 +38,9 @@ class Router {
/**
* @brief Router constructor.
*
* @param[in,out] App &$a
* @throws Exception module not found
*/
function __construct(&$a) {
function __construct() {
$module = \App::$module;
$modname = "Zotlabs\\Module\\" . ucfirst($module);
@ -179,9 +178,8 @@ class Router {
/**
* @brief
*
* @param[in,out] App &$a
*/
function Dispatch(&$a) {
function Dispatch() {
/**
* Call module functions

View File

@ -58,11 +58,10 @@ class WebServer {
if((x($_GET,'zid')) && (! \App::$install)) {
\App::$query_string = strip_zids(\App::$query_string);
if(! local_channel()) {
if ($_SESSION['my_address']!=$_GET['zid'])
{
$_SESSION['my_address'] = $_GET['zid'];
$_SESSION['authenticated'] = 0;
}
if ($_SESSION['my_address']!=$_GET['zid']) {
$_SESSION['my_address'] = $_GET['zid'];
$_SESSION['authenticated'] = 0;
}
zid_init();
}
}
@ -107,9 +106,43 @@ class WebServer {
check_config();
}
//nav_set_selected('nothing');
$this->create_channel_links();
$Router = new Router($a);
$Router = new Router();
$this->initialise_content();
$Router->Dispatch();
$this->set_homebase();
// now that we've been through the module content, see if the page reported
// a permission problem and if so, a 403 response would seem to be in order.
if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
}
call_hooks('page_end', \App::$page['content']);
construct_page();
killme();
}
private function initialise_content() {
/* initialise content region */
if(! x(\App::$page, 'content'))
\App::$page['content'] = '';
call_hooks('page_content_top', \App::$page['content']);
}
private function create_channel_links() {
/* Initialise the Link: response header if this is a channel page.
* This cannot be done inside the channel module because some protocol
@ -135,26 +168,17 @@ class WebServer {
\App::$channel_links = $x['channel_links'];
header('Link: ' . \App::get_channel_links());
}
}
/* initialise content region */
if(! x(\App::$page, 'content'))
\App::$page['content'] = '';
call_hooks('page_content_top', \App::$page['content']);
$Router->Dispatch($a);
private function set_homebase() {
// If you're just visiting, let javascript take you home
if(x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
} elseif(local_channel()) {
}
elseif(local_channel()) {
$homebase = z_root() . '/channel/' . \App::$channel['channel_address'];
}
@ -162,17 +186,8 @@ class WebServer {
\App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
// now that we've been through the module content, see if the page reported
// a permission problem and if so, a 403 response would seem to be in order.
if(is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
}
call_hooks('page_end', \App::$page['content']);
construct_page();
killme();
}
}

View File

@ -71,6 +71,8 @@ class Forums {
if($r)
$r1[$x]['unseen'] = $r[0]['unseen'];
}
/**
* @FIXME
* This SQL makes the counts correct when you get forum posts arriving from different routes/sources
@ -79,21 +81,19 @@ class Forums {
* It may make more sense in that query to look for the mention in the body rather than another join,
* but that makes it very inefficient.
*
$r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
intval(TERM_OBJ_POST),
dbesc($r1[$x]['xchan_hash']),
intval(local_channel()),
dbesc($r1[$x]['xchan_url']),
intval(TERM_MENTION)
);
if($r)
$r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
* $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ",
* intval(TERM_OBJ_POST),
* dbesc($r1[$x]['xchan_hash']),
* intval(local_channel()),
* dbesc($r1[$x]['xchan_url']),
* intval(TERM_MENTION)
* );
* if($r)
* $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']);
*
* end @FIXME
*/
}
if($r1) {
$o .= '<div class="widget">';
$o .= '<h3>' . t('Forums') . '</h3><ul class="nav nav-pills flex-column">';

View File

@ -51,7 +51,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.1.1' );
define ( 'STD_VERSION', '3.1.2' );
define ( 'ZOT_REVISION', '1.3' );
define ( 'DB_UPDATE_VERSION', 1198 );

View File

@ -846,6 +846,23 @@ Your files are visible on the web at the location [observer=1][baseurl]/cloud/[o
WebDAV provides a way to copy files directly to or from your computer's operating system, where your cloud files appear as a virtual disk drive. This should be used to upload large files such as video and audio; as it is not limited to available memory. See [zrl=help/member/member_guide#Cloud_Desktop_Clients]Cloud Desktop Clients[/zrl] below.
[h4]CalDAV and CardDAV access on Android[/h4]
You can sync you calendar and contacts on Android with your Hub.
The following steps where tested for [url=https://f-droid.org/en/packages/at.bitfire.davdroid/]DAVdroid[/url]
[list]
[*] install DAVdroid
[*] add account
[*] use "URL" and "user name" to login
[list]
[*] base url is [baseurl]/cdav
[*] user name is [observer=1][observer.webname][/observer][observer=0]username[/observer]
[/list]
[/list]
To share your calendar visit [observer.baseurl]/cdav/calendar
[h4]Permissions[/h4]

View File

@ -6,6 +6,8 @@
api_register_func('api/export/basic','api_export_basic', true);
api_register_func('api/red/channel/export/basic','api_export_basic', true);
api_register_func('api/z/1.0/channel/export/basic','api_export_basic', true);
api_register_func('api/red/channel/list','api_channel_list', true);
api_register_func('api/z/1.0/channel/list','api_channel_list', true);
api_register_func('api/red/channel/stream','api_channel_stream', true);
api_register_func('api/z/1.0/channel/stream','api_channel_stream', true);
api_register_func('api/red/files','api_attach_list', true);
@ -111,9 +113,31 @@
}
}
function api_channel_list($type) {
if(api_user() === false) {
logger('api_channel_stream: no user');
return false;
}
$channel = channelx_by_n(api_user());
if(! $channel)
return false;
$ret = [];
$r = q("select channel_address from channel where channel_account_id = %d",
intval($channel['channel_account_id'])
);
if($r) {
foreach($r as $rv) {
$ret[] = $rv['channel_address'];
}
}
json_return_and_die($ret);
}
function api_channel_stream($type) {

View File

@ -15,7 +15,7 @@ class dba_pdo extends dba_driver {
$dsn = $server;
}
else {
$dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? '' : ';port=' . $port);
$dsn = $this->driver_dbtype . ':host=' . $server . (intval($port) ? ';port=' . $port : '');
}
$dsn .= ';dbname=' . $db;

View File

@ -190,6 +190,16 @@ function get_features($filtered = true) {
feature_level('event_tz_select',2),
],
[
'premium_channel',
t('Premium Channel'),
t('Allows you to set restrictions and terms on those that connect with your channel'),
false,
get_config('feature_lock','premium_channel'),
feature_level('premium_channel',4),
],
[
'advanced_dirsearch',
t('Advanced Directory Search'),
@ -438,16 +448,10 @@ function get_features($filtered = true) {
],
];
$x = [ 'features' => $arr, ];
call_hooks('get_features',$x);
$arr['general'][] = [
'premium_channel',
t('Premium Channel'),
t('Allows you to set restrictions and terms on those that connect with your channel'),
false,
get_config('feature_lock','premium_channel'),
feature_level('premium_channel',4),
];
$arr = $x['features'];
$techlevel = get_account_techlevel();
@ -482,7 +486,5 @@ function get_features($filtered = true) {
$narr = $arr;
}
$x = [ 'features' => $narr, 'filtered' => $filtered, 'techlevel' => $techlevel ];
call_hooks('get_features',$x);
return $x['features'];
return $narr;
}

View File

@ -82,7 +82,8 @@ function import_channel($channel, $account_id, $seize) {
'channel_r_storage', 'channel_r_pages', 'channel_w_stream', 'channel_w_wall',
'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall',
'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish',
'channel_a_delegate', 'perm_limits', 'channel_password', 'channel_salt'
'channel_a_delegate', 'perm_limits', 'channel_password', 'channel_salt',
'channel_moved'
];
$clean = array();

View File

@ -100,38 +100,6 @@ EOT;
if(local_channel()) {
$nav['network'] = array('network', t('Activity'), "", t('Network Activity'),'network_nav_btn');
$nav['network']['all'] = [ 'network', t('View your network activity'), '','' ];
$nav['network']['mark'] = array('', t('Mark all activity notifications seen'), '','');
$nav['home'] = array('channel/' . $channel['channel_address'], t('Channel Home'), "", t('Channel home'),'home_nav_btn');
$nav['home']['all'] = [ 'channel/' . $channel['channel_address'], t('View your channel home'), '' , '' ];
$nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '','');
$nav['intros'] = array('connections/ifpending', t('Connections'), "", t('Connections'),'connections_nav_btn');
if(is_site_admin())
$nav['registrations'] = array('admin/accounts', t('Registrations'), "", t('Registrations'),'registrations_nav_btn');
$nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications'),'notifications_nav_btn');
$nav['notifications']['all']=array('notifications/system', t('View all notifications'), "", "");
$nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '','');
$nav['messages'] = array('mail/combined', t('Mail'), "", t('Private mail'),'mail_nav_btn');
$nav['messages']['all']=array('mail/combined', t('View your private messages'), "", "");
$nav['messages']['mark'] = array('', t('Mark all private messages seen'), '','');
$nav['messages']['inbox'] = array('mail/inbox', t('Inbox'), "", t('Inbox'));
$nav['messages']['outbox']= array('mail/outbox', t('Outbox'), "", t('Outbox'));
$nav['messages']['new'] = array('mail/new', t('New Message'), "", t('New Message'));
$nav['all_events'] = array('events', t('Events'), "", t('Event Calendar'),'events_nav_btn');
$nav['all_events']['all']=array('events', t('View events'), "", "");
$nav['all_events']['mark'] = array('', t('Mark all events seen'), '','');
if(! $_SESSION['delegate']) {
$nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage Your Channels'),'manage_nav_btn');
}

View File

@ -313,39 +313,25 @@ function dir_tagadelic($count = 0, $hub = '') {
$count = intval($count);
$dirmode = get_config('system','directory_mode');
if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
$hub = \App::get_hostname();
}
if($hub)
$hub_query = " and xtag_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
else
$hub_query = '';
if($hub_query) {
// Fetch tags
if($hub) {
$r = q("select xtag_term as term, count(xtag_term) as total from xtag
left join hubloc on xtag_hash = hubloc_hash
where xtag_flags = 0 $hub_query
where xtag_flags = 0 and xtag_hash in (select hubloc_hash from hubloc where hubloc_host = '%s' )
group by xtag_term order by total desc %s",
dbesc($hub),
((intval($count)) ? "limit $count" : '')
);
}
else {
// Fetch tags
$r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0
group by xtag_term order by total desc %s",
((intval($count)) ? "limit $count" : '')
);
}
if(! $r)
return array();
return [];
return Zotlabs\Text\Tagadelic::calc($r);
}

View File

@ -127,8 +127,11 @@ function clean_query_string($s = '') {
* @return string
*/
function zidify_callback($match) {
$is_zid = ((feature_enabled(local_channel(), 'sendzid')) || (strpos($match[1], 'zrl')) ? true : false);
$replace = '<a' . $match[1] . ' href="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
$arr = [ 'zid' => ((strpos($match[1],'zrl')) ? true : false), 'url' => $match[2] ];
call_hooks('zidify', $arr);
$replace = '<a' . $match[1] . ' href="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"';
$x = str_replace($match[0], $replace, $match[0]);
@ -136,8 +139,11 @@ function zidify_callback($match) {
}
function zidify_img_callback($match) {
$is_zid = ((feature_enabled(local_channel(), 'sendzid')) || (strpos($match[1], 'zrl')) ? true : false);
$replace = '<img' . $match[1] . ' src="' . (($is_zid) ? zid($match[2]) : $match[2]) . '"';
$arr = [ 'zid' => ((strpos($match[1],'zrl')) ? true : false), 'url' => $match[2] ];
call_hooks('zidify', $arr);
$replace = '<img' . $match[1] . ' src="' . (intval($arr['zid']) ? zid($arr['url']) : $arr['url']) . '"';
$x = str_replace($match[0], $replace, $match[0]);

View File

@ -1,3 +0,0 @@
#notifications {
display: none;
}

View File

@ -179,6 +179,23 @@ a.wikilist {
overflow: auto;
}
.notifications-textinput input {
font-family: FontAwesome, sans-serif;
}
.notifications-textinput {
padding: .75rem 0.85rem;
}
.notifications-textinput-clear {
padding: .5rem;
line-height: 1;
position: absolute;
top: .75rem;
right: 1rem;
cursor: pointer;
}
.notification-content.collapsing {
overflow: hidden;
}

View File

@ -282,22 +282,6 @@ function viewsrc(id) {
$.colorbox({href: 'viewsrc/' + id, maxWidth: '80%', maxHeight: '80%' });
}
function qCommentInsert(obj, id) {
var tmpStr = $("#comment-edit-text-" + id).val();
if(tmpStr == aStr.comment) {
tmpStr = '';
$("#comment-edit-text-" + id).addClass("expanded");
openMenu("comment-edit-submit-wrapper-" + id);
}
var ins = $(obj).val();
ins = ins.replace('&lt;','<');
ins = ins.replace('&gt;','>');
ins = ins.replace('&amp;','&');
ins = ins.replace('&quot;','"');
$("#comment-edit-text-" + id).val(tmpStr + ins);
$(obj).val('');
}
function showHideComments(id) {
if( $('#collapsed-comments-' + id).is(':visible')) {
$('#collapsed-comments-' + id + ' .autotime').timeago('dispose');
@ -878,33 +862,26 @@ function justifyPhotosAjax(id) {
function notify_popup_loader(notifyType) {
/* notifications template - different for navbar and notifications widget */
var navbar_notifications_tpl= unescape($("#navbar-notifications-template[rel=template]").html());
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
var notifications_all = unescape($('<div>').append( $("#nav-" + notifyType + "-see-all").clone() ).html()); //outerHtml hack
var notifications_mark = unescape($('<div>').append( $("#nav-" + notifyType + "-mark-all").clone() ).html()); //outerHtml hack
var notifications_tt_only = unescape($('<div>').append( $("#tt-" + notifyType + "-only").clone() ).html()); //outerHtml hack
var notifications_empty = unescape($("#nav-" + notifyType + "-menu").html());
var notify_menu = $("#nav-" + notifyType + "-menu");
var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : '');
$.get(pingExCmd, function(data) {
if(data.invalid == 1) {
window.location.href=window.location.href;
}
$("#navbar-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only);
$("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only);
//$("#navbar-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only + notifications_cn_only);
//$("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark + notifications_tt_only + notifications_cn_only);
$("." + notifyType + "-update").html(data.notify.length);
notify_menu.html('');
$(data.notify).each(function() {
html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top);
$("#navbar-" + notifyType + "-menu").append(html);
html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top);
$("#nav-" + notifyType + "-menu").append(html);
notify_menu.append(html);
});
$(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){
@ -915,11 +892,22 @@ function notify_popup_loader(notifyType) {
if($('#tt-' + notifyType + '-only').hasClass('active'))
$('#nav-' + notifyType + '-menu [data-thread_top=false]').hide();
var filter = $('#cn-' + notifyType + '-input').val().toString().toLowerCase();
if(filter) {
$('#nav-' + notifyType + '-menu .notification').each(function(i, el){
var cn = $(el).data('contact_name').toString().toLowerCase();
if(cn.indexOf(filter) === -1)
$(el).addClass('d-none');
else
$(el).removeClass('d-none');
});
}
});
setTimeout(function() {
if(notify_menu.hasClass('show')) {
if($('#nav-' + notifyType + '-sub').hasClass('show')) {
console.log('updating ' + notifyType + ' notifications...');
setTimeout(notify_popup_loader, updateInterval, notifyType);
}

View File

@ -82,6 +82,7 @@
{{include file="field_checkbox.tpl" field=$feed_contacts}}
{{include file="field_checkbox.tpl" field=$force_publish}}
{{include file="field_checkbox.tpl" field=$disable_discover_tab}}
{{include file="field_checkbox.tpl" field=$site_firehose}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

View File

@ -19,14 +19,6 @@
</div>
{{/if}}
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text" placeholder="{{$comment}}" name="body" ondragenter="linkdropper(event);" ondragleave="linkdropexit(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" ></textarea>
{{if $qcomment}}
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
<option value=""></option>
{{foreach $qcomment as $qc}}
<option value="{{$qc}}">{{$qc}}</option>
{{/foreach}}
</select>
{{/if}}
<div id="comment-tools-{{$id}}" class="pt-2 comment-tools">
<div id="comment-edit-bb-{{$id}}" class="btn-toolbar pull-left">
<div class="btn-group mr-2">

View File

@ -1,3 +0,0 @@
<div id="navbar-notifications-template" rel="template" style="display:none;">
<a class="dropdown-item clearfix dropdown-notification {5}" href="{0}" title="{2} {3}"><img class="menu-img-3" data-src="{1}"><span class="contactname">{2}</span><span class="dropdown-sub-text">{3}<br>{4}</span></a>
</div>

View File

@ -16,12 +16,9 @@
{{/if}}
</div>
{{/if}}
{{if $userinfo}}
<div class="dropdown usermenu">
<div class="fakelink" data-toggle="dropdown">
<div class="dropdown">
<div class="fakelink usermenu" data-toggle="dropdown">
<img id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}">
<i class="fa fa-caret-down"></i>
</div>
@ -31,7 +28,7 @@
<a class="dropdown-item{{if $usermenu.2}} active{{/if}}" href="{{$usermenu.0}}" title="{{$usermenu.3}}" role="menuitem" id="{{$usermenu.4}}">{{$usermenu.1}}</a>
{{/foreach}}
{{if $nav.manage}}
<a class="dropdown-item{{if $sel.active == Manage}} active{{/if}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}" role="menuitem" id="{{$nav.manage.4}}">{{$nav.manage.1}}</a>
<a class="dropdown-item{{if $sel.name == Manage}} active{{/if}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}" role="menuitem" id="{{$nav.manage.4}}">{{$nav.manage.1}}</a>
{{/if}}
{{if $nav.channels}}
{{foreach $nav.channels as $chan}}
@ -43,7 +40,11 @@
{{/if}}
{{if $nav.settings}}
<div class="dropdown-divider"></div>
<a class="dropdown-item{{if $sel.active == Settings}} active{{/if}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}" role="menuitem" id="{{$nav.settings.4}}">{{$nav.settings.1}}</a>
<a class="dropdown-item{{if $sel.name == Settings}} active{{/if}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}" role="menuitem" id="{{$nav.settings.4}}">{{$nav.settings.1}}</a>
{{/if}}
{{if $nav.admin}}
<div class="dropdown-divider"></div>
<a class="dropdown-item{{if $sel.name == Admin}} active{{/if}}" href="{{$nav.admin.0}}" title="{{$nav.admin.3}}" role="menuitem" id="{{$nav.admin.4}}">{{$nav.admin.1}}</a>
{{/if}}
{{if $nav.logout}}
<div class="dropdown-divider"></div>
@ -51,7 +52,6 @@
{{/if}}
</div>
{{/if}}
{{if ! $is_owner}}
<div class="dropdown-menu" role="menu" aria-labelledby="avatar">
<a class="dropdown-item" href="{{$nav.rusermenu.0}}" role="menuitem">{{$nav.rusermenu.1}}</a>
@ -59,129 +59,37 @@
</div>
{{/if}}
</div>
{{if $sel.name}}
<div id="nav-app-link-wrapper" class="navbar-nav mr-auto">
<a id="nav-app-link" href="{{$url}}" class="nav-link text-truncate">
{{$sel.name}}
{{if $sitelocation}}
<br><small>{{$sitelocation}}</small>
{{/if}}
</a>
</div>
{{/if}}
{{if $navbar_apps}}
<ul class="navbar-nav mr-auto d-none d-xl-flex">
{{foreach $navbar_apps as $navbar_app}}
<li>
{{$navbar_app}}
</li>
{{/foreach}}
</ul>
{{/if}}
<div class="navbar-toggler-right">
{{if $nav.help.6}}
<button id="context-help-btn" class="navbar-toggler border-0" type="button" onclick="contextualHelp(); return false;">
<i class="fa fa-question-circle"></i>
</button>
{{/if}}
<button id="expand-aside" type="button" class="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-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 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">
<i class="fa fa-bars"></i>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="navbar-nav mr-auto">
{{if $nav.network}}
<li class="nav-item dropdown network-button" style="display: none;">
<a class="nav-link" href="#" title="{{$nav.network.3}}" id="{{$nav.network.4}}" data-toggle="dropdown" rel="#navbar-network-menu">
<i class="fa fa-fw fa-th"></i>
<span class="badge badge-pill badge-secondary network-update"></span>
</a>
<div id="navbar-network-menu" class="dropdown-menu" rel="network">
<a class="dropdown-item" id="nav-network-see-all" href="{{$nav.network.all.0}}">{{$nav.network.all.1}}</a>
<a class="dropdown-item" id="nav-network-mark-all" href="#" onclick="markRead('network'); return false;">{{$nav.network.mark.1}}</a>
{{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</li>
{{/if}}
{{if $nav.home}}
<li class="nav-item dropdown home-button" style="display: none;">
<a class="nav-link" href="#" title="{{$nav.home.3}}" id="{{$nav.home.4}}" data-toggle="dropdown" rel="#navbar-home-menu">
<i class="fa fa-fw fa-home"></i>
<span class="badge badge-pill badge-danger home-update"></span>
</a>
<div id="navbar-home-menu" class="dropdown-menu" rel="home">
<a class="dropdown-item" id="nav-home-see-all" href="{{$nav.home.all.0}}">{{$nav.home.all.1}}</a>
<a class="dropdown-item" id="nav-home-mark-all" href="#" onclick="markRead('home'); return false;">{{$nav.home.mark.1}}</a>
{{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</li>
{{/if}}
{{if $nav.messages}}
<li class="nav-item dropdown mail-button" style="display: none;">
<a class="nav-link" href="#" title="{{$nav.messages.3}}" id="{{$nav.messages.4}}" data-toggle="dropdown" rel="#navbar-mail-menu">
<i class="fa fa-fw fa-envelope"></i>
<span class="badge badge-pill badge-danger mail-update"></span>
</a>
<div id="navbar-mail-menu" class="dropdown-menu" rel="messages">
<a class="dropdown-item" id="nav-messages-see-all" href="{{$nav.messages.all.0}}">{{$nav.messages.all.1}}</a>
<a class="dropdown-item" id="nav-messages-mark-all" href="#" onclick="markRead('messages'); return false;">{{$nav.messages.mark.1}}</a>
{{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</li>
{{/if}}
{{if $nav.all_events}}
<li class="nav-item dropdown all_events-button" style="display: none;">
<a class="nav-link" href="#" title="{{$nav.all_events.3}}" id="{{$nav.all_events.4}}" data-toggle="dropdown" rel="#navbar-all_events-menu">
<i class="fa fa-fw fa-calendar"></i>
<span class="badge badge-pill badge-secondary all_events-update"></span>
</a>
<div id="navbar-all_events-menu" class="dropdown-menu" rel="all_events">
<a class="dropdown-item" id="nav-all_events-see-all" href="{{$nav.all_events.all.0}}">{{$nav.all_events.all.1}}</a>
<a class="dropdown-item" id="nav-all_events-mark-all" href="#" onclick="markRead('all_events'); return false;">{{$nav.all_events.mark.1}}</a>
{{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</li>
{{/if}}
{{if $nav.intros}}
<li class="nav-item dropdown intros-button" style="display: none;">
<a class="nav-link" href="#" title="{{$nav.intros.3}}" id="{{$nav.intros.4}}" data-toggle="dropdown" rel="#navbar-intros-menu">
<i class="fa fa-fw fa-users"></i>
<span class="badge badge-pill badge-danger intros-update"></span>
</a>
<div id="navbar-intros-menu" class="dropdown-menu" rel="intros">
<a class="dropdown-item" id="nav-intros-see-all" href="{{$nav.intros.all.0}}">{{$nav.intros.all.1}}</a>
{{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</li>
{{/if}}
{{if $nav.notifications}}
<li class="nav-item dropdown notify-button" style="display: none;">
<a class="nav-link" href="#" title="{{$nav.notifications.1}}" id="{{$nav.notifications.4}}" data-toggle="dropdown" rel="#navbar-notify-menu">
<i class="fa fa-fw fa-exclamation"></i>
<span class="badge badge-pill badge-danger notify-update"></span>
</a>
<div id="navbar-notify-menu" class="dropdown-menu" rel="notify">
<a class="dropdown-item" id="nav-notify-see-all" href="{{$nav.notifications.all.0}}">{{$nav.notifications.all.1}}</a>
<a class="dropdown-item" id="nav-notify-mark-all" href="#" onclick="markRead('notify'); return false;">{{$nav.notifications.mark.1}}</a>
{{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</li>
{{/if}}
{{if $nav.login && !$userinfo}}
<li class="nav-item d-none d-xl-flex">
{{if $nav.loginmenu.1.4}}
@ -205,16 +113,11 @@
<a class="nav-link" href="{{$nav.alogout.0}}" title="{{$nav.alogout.3}}" id="{{$nav.alogout.4}}">{{$nav.alogout.1}}</a>
</li>
{{/if}}
</ul>
<div id="banner" class="navbar-text">{{$banner}}</div>
<div id="banner" class="navbar-text d-none d-xl-flex">{{$banner}}</div>
<ul id="nav-right" class="navbar-nav ml-auto d-none d-xl-flex">
<ul id="nav-right" class="navbar-nav ml-auto">
<li class="nav-item collapse clearfix" id="nav-search">
<form class="form-inline" method="get" action="search" role="search">
<input class="form-control form-control-sm mt-1 mr-2" id="nav-search-text" type="text" value="" placeholder="&#xf002; {{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur="closeMenu('nav-search'); openMenu('nav-search-btn');"/>
@ -236,7 +139,7 @@
<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}}
{{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>
<div id="dropdown-menu" class="dropdown-menu dropdown-menu-right">
@ -246,12 +149,32 @@
</div>
</li>
{{/if}}
{{if $navbar_apps}}
{{foreach $navbar_apps as $navbar_app}}
<li>
{{$navbar_app}}
</li>
{{/foreach}}
{{/if}}
<li class="nav-item dropdown" id="app-menu">
<a class="nav-link" href="#" data-toggle="dropdown"><i class="fa fa-fw fa-bars"></i></a>
<div id="dropdown-menu" class="dropdown-menu dropdown-menu-right">
{{if $channel_apps.0 && ! $channel_menu}}
{{foreach $channel_apps as $channel_app}}
{{$channel_app}}
{{/foreach}}
<div class="dropdown-divider"></div>
<div class="dropdown-header sys-apps-toggle" onclick="$('#dropdown-menu').click(function(e) { e.stopPropagation(); }); openClose('sys_apps');">
{{$sysapps_toggle}}
</div>
<div id="sys_apps" style="display:none;">
{{/if}}
{{foreach $nav_apps as $nav_app}}
{{$nav_app}}
{{/foreach}}
{{if $channel_apps.0 && ! $channel_menu}}
</div>
{{/if}}
{{if $is_owner}}
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/apps"><i class="generic-icons-nav fa fa-fw fa-plus-circle"></i>{{$addapps}}</a>
@ -261,8 +184,6 @@
</li>
</ul>
</div>
<div class="collapse d-lg-none" id="navbar-collapse-2">
<div class="navbar-nav mr-auto">
{{if $channel_apps.0}}
@ -274,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}}

View File

@ -65,6 +65,33 @@
$('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggle();
$(this).toggleClass('active sticky-top');
});
$(document).on('click ', '#cn-{{$notification.type}}-input-clear', function(e) {
$('#cn-{{$notification.type}}-input').val('');
$('#cn-{{$notification.type}}-only').removeClass('active sticky-top');
$("#nav-{{$notification.type}}-menu .notification").removeClass('d-none');
$('#cn-{{$notification.type}}-input-clear').addClass('d-none');
});
$(document).on('input', '#cn-{{$notification.type}}-input', function(e) {
var val = $('#cn-{{$notification.type}}-input').val().toString().toLowerCase();
if(val) {
$('#cn-{{$notification.type}}-only').addClass('active sticky-top');
$('#cn-{{$notification.type}}-input-clear').removeClass('d-none');
}
else {
$('#cn-{{$notification.type}}-only').removeClass('active sticky-top');
$('#cn-{{$notification.type}}-input-clear').addClass('d-none');
}
$("#nav-{{$notification.type}}-menu .notification").each(function(i, el){
var cn = $(el).data('contact_name').toString().toLowerCase();
if(cn.indexOf(val) === -1)
$(this).addClass('d-none');
else
$(this).removeClass('d-none');
});
});
{{/if}}
{{/foreach}}
@ -90,7 +117,7 @@
</div>
<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}" data-notify_id="{7}" data-thread_top="{8}">
<a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}" data-thread_top="{8}" data-contact_name="{2}">
<img class="menu-img-3" data-src="{1}">
<span class="contactname">{2}</span>
<span class="dropdown-sub-text">{3}<br>{4}</span>
@ -98,11 +125,11 @@
</div>
{{foreach $notifications as $notification}}
<div class="collapse {{$notification.type}}-button">
<a class="list-group-item" href="#nav-{{$notification.type}}-menu" title="{{$notification.title}}" data-toggle="collapse" data-parent="#notifications" rel="#nav-{{$notification.type}}-menu">
<a class="list-group-item" href="#nav-{{$notification.type}}-sub" title="{{$notification.title}}" data-toggle="collapse" data-parent="#notifications" rel="#nav-{{$notification.type}}-menu">
<i class="fa fa-fw fa-{{$notification.icon}}"></i> {{$notification.label}}
<span class="float-right badge badge-{{$notification.severity}} {{$notification.type}}-update"></span>
</a>
<div id="nav-{{$notification.type}}-menu" class="collapse notification-content" rel="{{$notification.type}}">
<div id="nav-{{$notification.type}}-sub" class="collapse notification-content">
{{if $notification.viewall}}
<a class="list-group-item text-dark" id="nav-{{$notification.type}}-see-all" href="{{$notification.viewall.url}}">
<i class="fa fa-fw fa-external-link"></i> {{$notification.viewall.label}}
@ -117,8 +144,14 @@
<div class="list-group-item cursor-pointer" id="tt-{{$notification.type}}-only">
<i class="fa fa-fw fa-filter"></i> {{$notification.filter.label}}
</div>
<div class="list-group-item clearfix notifications-textinput" id="cn-{{$notification.type}}-only">
<input id="cn-{{$notification.type}}-input" type="text" class="form-control form-control-sm" placeholder="&#xf0b0; Filter by name">
<div id="cn-{{$notification.type}}-input-clear" class="text-muted notifications-textinput-clear d-none"><i class="fa fa-times"></i></div>
</div>
{{/if}}
{{$loading}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
<div id="nav-{{$notification.type}}-menu" class="" rel="{{$notification.type}}">
{{$loading}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
</div>
</div>
{{/foreach}}