aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'view/tpl')
-rw-r--r--view/tpl/cdav_calendar.tpl46
-rw-r--r--view/tpl/chat.tpl12
-rw-r--r--view/tpl/conv_item.tpl4
-rw-r--r--view/tpl/conv_list.tpl8
-rw-r--r--view/tpl/head.tpl1
-rw-r--r--view/tpl/hq.tpl4
-rw-r--r--view/tpl/hq_controls.tpl13
-rw-r--r--view/tpl/jot-header.tpl4
-rw-r--r--view/tpl/messages_widget.tpl134
-rw-r--r--view/tpl/notes.tpl12
-rw-r--r--view/tpl/notifications_widget.tpl514
-rw-r--r--view/tpl/photo_view.tpl6
-rw-r--r--view/tpl/photos_upload.tpl13
-rw-r--r--view/tpl/search_item.tpl6
-rw-r--r--view/tpl/settings.tpl7
15 files changed, 655 insertions, 129 deletions
diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl
index b2df9d892..2d6853513 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -24,16 +24,16 @@ $(document).ready(function() {
calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
eventSources: [ {{$sources}} ],
-
+
timeZone: '{{$timezone}}',
locale: '{{$lang}}',
eventTextColor: 'white',
header: false,
-
+
height: 'auto',
-
+
firstDay: {{$first_day}},
defaultView: default_view,
@@ -59,7 +59,7 @@ $(document).ready(function() {
allDayText: aStr['allday'],
snapDuration: '00:05:00',
-
+
dateClick: function(info) {
if(new_event.id) {
var event_poi = calendar.getEventById(new_event.id);
@@ -151,7 +151,7 @@ $(document).ready(function() {
event_poi.remove();
new_event = {};
}
-
+
var calendar_id = ((event.extendedProps.calendar_id.constructor === Array) ? event.extendedProps.calendar_id[0] + ':' + event.extendedProps.calendar_id[1] : event.extendedProps.calendar_id);
if(!event.extendedProps.recurrent) {
@@ -209,7 +209,7 @@ $(document).ready(function() {
$('#calendar_select').val(calendar_id).attr('disabled', true).trigger('change');
}
},
-
+
eventResize: function(info) {
var event = info.event._def;
@@ -258,13 +258,13 @@ $(document).ready(function() {
});
}
},
-
+
eventDrop: function(info) {
var event = info.event._def;
var dtstart = new Date(info.event._instance.range.start);
var dtend = new Date(info.event._instance.range.end);
-
+
$('#id_title').val(event.title);
$('#id_dtstart').val(dtstart.toUTCString().slice(0, -4));
$('#id_dtend').val(dtend.toUTCString().slice(0, -4));
@@ -316,24 +316,24 @@ $(document).ready(function() {
$('#today-btn > i').show();
}
}
-
+
});
-
+
calendar.render();
$('#title').text(calendar.view.title);
$('#view_selector').html(views[calendar.view.type]);
-
+
$('#today-btn').on('click', function() {
calendar.today();
$('#title').text(calendar.view.title);
});
-
+
$('#prev-btn').on('click', function() {
calendar.prev();
$('#title').text(calendar.view.title);
});
-
+
$('#next-btn').on('click', function() {
calendar.next();
$('#title').text(calendar.view.title);
@@ -345,7 +345,7 @@ $(document).ready(function() {
else
$('#dbtn-acl, #id_categories_wrapper').addClass('d-none');
});
-
+
$('.color-edit').colorpicker({ input: '.color-edit-input' });
$(document).on('click','#fullscreen-btn', updateSize);
@@ -481,9 +481,13 @@ function on_submit() {
})
.done(function() {
var eventSource = calendar.getEventSourceById('channel_calendar');
- eventSource.refetch();
+ if (eventSource) {
+ eventSource.refetch();
+ }
+ else {
+ $.jGrowl('{{$disabled_warning}}', { sticky: false, theme: 'notice', life: 10000 });
+ }
reset_form();
-
});
}
@@ -503,9 +507,13 @@ function on_submit() {
.done(function() {
var parts = $('#calendar_select').val().split(':');
var eventSource = calendar.getEventSourceById(parts[0]);
- eventSource.refetch();
+ if (eventSource) {
+ eventSource.refetch();
+ }
+ else {
+ $.jGrowl('{{$disabled_warning}}', { sticky: false, theme: 'notice', life: 10000 });
+ }
reset_form();
-
});
}
}
@@ -549,7 +557,7 @@ function reset_form() {
event_poi.remove();
new_event = {};
}
-
+
if($('#more_block').hasClass('open'))
on_more();
}
diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl
index 7e09b2071..944fbebb5 100644
--- a/view/tpl/chat.tpl
+++ b/view/tpl/chat.tpl
@@ -110,7 +110,9 @@ $(document).ready(function() {
$('#chatroom_bookmarks, #vcard').hide();
$('#chatroom_list, #chatroom_members').show();
adjustInlineTopBarHeight();
- chatNotificationInit();
+ $('#toggle-notifications').one('click', function() {
+ chatNotificationInit();
+ });
});
$(window).resize(function () {
@@ -141,7 +143,7 @@ function load_chats() {
$('#chat-top-spinner').hide();
}
});
-
+
chat_timer = setTimeout(load_chats,10000);
}
@@ -218,7 +220,7 @@ var chat_notify_audio = {};
// Request notification access from the user
// TODO: Check Hubzilla member config setting before requesting permission
function chatNotificationInit() {
-
+
if (!("Notification" in window)) {
window.console.log("This browser does not support system notifications");
}
@@ -258,8 +260,8 @@ var chat_issue_notification = function (theBody,theTitle) {
}
var n = new Notification(theTitle,options);
n.onclick = function (event) {
- setTimeout(n.close.bind(n), 300);
- }
+ setTimeout(n.close.bind(n), 300);
+ }
if(chat_notify_audio_enabled) {
chat_notify_audio.play();
}
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 1987c9aca..fc4b2e4dc 100644
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -189,11 +189,11 @@
{{/foreach}}
{{/if}}
{{if $item.drop.dropping}}
- <a class="dropdown-item" href="#" onclick="dropItem('item/drop/{{$item.id}}', '#thread-wrapper-{{$item.id}}'); return false;" title="{{$item.drop.delete}}" ><i class="generic-icons-nav fa fa-fw fa-trash-o"></i>{{$item.drop.delete}}</a>
+ <a class="dropdown-item" href="#" onclick="dropItem('item/drop/{{$item.id}}', '#thread-wrapper-{{$item.id}}', '{{$item.mid}}'); return false;" title="{{$item.drop.delete}}" ><i class="generic-icons-nav fa fa-fw fa-trash-o"></i>{{$item.drop.delete}}</a>
{{/if}}
{{if $item.dropdown_extras}}
<div class="dropdown-divider"></div>
- {{$item.dropdown_extras}}
+ {{$item.dropdown_extras}}
{{/if}}
{{if $item.edpost && $item.dreport}}
<div class="dropdown-divider"></div>
diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl
index 9fb15e7d9..d163c5842 100644
--- a/view/tpl/conv_list.tpl
+++ b/view/tpl/conv_list.tpl
@@ -169,12 +169,16 @@
{{/foreach}}
{{/if}}
{{if $item.drop.dropping}}
- <a class="dropdown-item" href="#" onclick="dropItem('item/drop/{{$item.id}}', '#thread-wrapper-{{$item.id}}'); return false;" title="{{$item.drop.delete}}" ><i class="generic-icons-nav fa fa-fw fa-trash-o"></i>{{$item.drop.delete}}</a>
+ <a class="dropdown-item" href="#" onclick="dropItem('item/drop/{{$item.id}}', '#thread-wrapper-{{$item.id}}', '{{$item.mid}}'); return false;" title="{{$item.drop.delete}}" ><i class="generic-icons-nav fa fa-fw fa-trash-o"></i>{{$item.drop.delete}}</a>
{{/if}}
- <div class="dropdown-divider"></div>
{{if $item.edpost && $item.dreport}}
+ <div class="dropdown-divider"></div>
<a class="dropdown-item" href="dreport/{{$item.mid}}">{{$item.dreport}}</a>
{{/if}}
+ {{if $item.settings}}
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item conversation-settings-link" href="" data-toggle="modal" data-target="#conversation_settings">{{$item.settings}}</a>
+ {{/if}}
</div>
</div>
</div>
diff --git a/view/tpl/head.tpl b/view/tpl/head.tpl
index ecb30afd3..bf61a7ee4 100644
--- a/view/tpl/head.tpl
+++ b/view/tpl/head.tpl
@@ -17,6 +17,7 @@
var channelId = {{if $channel_id}}{{$channel_id}}{{else}}false{{/if}};{{* Used in e.g. autocomplete *}}
var preloadImages = {{$preload_images}};
var auto_save_draft = {{$auto_save_draft}};
+ {{if $module}}var module = '{{$module}}';{{/if}}
</script>
diff --git a/view/tpl/hq.tpl b/view/tpl/hq.tpl
deleted file mode 100644
index 099d892bb..000000000
--- a/view/tpl/hq.tpl
+++ /dev/null
@@ -1,4 +0,0 @@
-<div id="jot-popup">
-{{$editor}}
-</div>
-
diff --git a/view/tpl/hq_controls.tpl b/view/tpl/hq_controls.tpl
index d7f6d436f..3adbfa7c0 100644
--- a/view/tpl/hq_controls.tpl
+++ b/view/tpl/hq_controls.tpl
@@ -1,8 +1,7 @@
-<div class="widget">
- <h3>{{$title}}</h3>
- <ul class="nav nav-pills flex-column">
- {{foreach $menu as $m}}
- <li class="nav-item"><a href="{{$m.href}}" id="{{$m.id}}" class="nav-link{{if $m.class}} {{$m.class}}{{/if}}">{{$m.label}}</a></li>
- {{/foreach}}
- </ul>
+<div class="mb-3{{if $wrapper_class}} {{$wrapper_class}}{{/if}}">
+ {{foreach $entries as $e}}
+ <button class="{{$e.class}} rounded-circle{{if $entry_class}} {{$entry_class}}{{/if}}" type="{{$e.type}}" title="{{$e.label}}"{{if $e.extra}} {{$e.extra}}{{/if}}>
+ {{if $e.icon}}<i class="fa fa-{{$e.icon}} mt-1 mb-1"></i>{{/if}}
+ </button>
+ {{/foreach}}
</div>
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 93f1ea28a..2ee78cd28 100644
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -320,7 +320,9 @@ var activeCommentText = '';
postSaveChanges('clean');
- {{if $reset}}
+ {{if $popup}}
+ $("#profile-jot-text").focus();
+ {{else if $reset}}
$(".jothidden").hide();
$("#profile-jot-text").removeClass('jot-expanded');
$("#profile-jot-tools").addClass('d-none');
diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl
new file mode 100644
index 000000000..2d7ab99df
--- /dev/null
+++ b/view/tpl/messages_widget.tpl
@@ -0,0 +1,134 @@
+<ul class="nav nav-tabs nav-fill clearfix">
+ <li class="nav-item">
+ <a class="nav-link active messages-type" href="#" title="{{$strings.messages_title}}" data-messages_type="">
+ <i class="fa fa-fw fa-comment-o"></i>
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link messages-type" href="#" title="{{$strings.direct_messages_title}}" data-messages_type="direct">
+ <i class="fa fa-fw fa-envelope-o"></i>
+ </a>
+ </li>
+ {{if $feature_star}}
+ <li class="nav-item">
+ <a class="nav-link messages-type" href="#" title="{{$strings.starred_messages_title}}" data-messages_type="starred">
+ <i class="fa fa-fw fa-star"></i>
+ </a>
+ </li>
+ {{/if}}
+</ul>
+<div id="messages-widget" class="border border-top-0 overflow-auto mb-3 clearfix" style="height: 70vh;">
+ <div id="messages-template" rel="template" class="d-none">
+ <a href="{6}" class="list-group-item list-group-item-action message" data-b64mid="{0}">
+ <div class="d-flex w-100 justify-content-between">
+ <div class="mb-1 text-truncate" title="{5}">
+ {7}
+ <strong>{4}</strong>
+ </div>
+ <small class="messages-timeago text-nowrap" title="{1}"></small>
+ </div>
+ <div class="mb-1">
+ <div class="text-break">{2}</div>
+ </div>
+ <small>{3}</small>
+ </a>
+ </div>
+ <div id="dm-container" class="list-group list-group-flush" data-offset="10">
+ {{foreach $entries as $e}}
+ <a href="{{$e.href}}" class="list-group-item list-group-item-action message" data-b64mid="{{$e.b64mid}}">
+ <div class="d-flex w-100 justify-content-between">
+ <div class="mb-1 text-truncate" title="{{$e.author_addr}}">
+ {{$e.icon}}
+ <strong>{{$e.author_name}}</strong>
+ </div>
+ <small class="messages-timeago text-nowrap" title="{{$e.created}}"></small>
+ </div>
+ <div class="mb-1">
+ <div class="text-break">{{$e.summary}}</div>
+ </div>
+ <small>{{$e.info}}</small>
+ </a>
+ {{/foreach}}
+ <div id="messages-empty" class="list-group-item border-0"{{if $entries}} style="display: none;"{{/if}}>
+ {{$strings.empty}}...
+ </div>
+ <div id="messages-loading" class="list-group-item" style="display: none;">
+ {{$strings.loading}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
+ </div>
+ </div>
+</div>
+<script>
+ var messages_offset = {{$offset}};
+ var get_messages_page_active = false;
+ var messages_type;
+
+ $(document).ready(function () {
+ $('.messages-timeago').timeago();
+ $('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active');
+ });
+
+ $('#messages-widget').on('scroll', function() {
+ if(this.scrollTop > this.scrollHeight - this.clientHeight - (this.scrollHeight/7)) {
+ get_messages_page();
+ }
+ });
+
+ $(document).on('click', '.messages-type', function(e) {
+ e.preventDefault();
+ $('.messages-type').removeClass('active');
+ $(this).addClass('active');
+ messages_offset = 0;
+ messages_type = $(this).data('messages_type');
+ $('#dm-container .message').remove();
+ get_messages_page();
+ });
+
+ function get_messages_page() {
+
+ if (get_messages_page_active)
+ return;
+
+ if (messages_offset === -1)
+ return;
+
+ get_messages_page_active = true;
+ $('#messages-loading').show();
+ $('#messages-empty').hide();
+
+ $.ajax({
+ type: 'post',
+ url: 'hq',
+ data: {
+ offset: messages_offset,
+ type: messages_type
+ }
+ }).done(function(obj) {
+ get_messages_page_active = false;
+ messages_offset = obj.offset;
+ let html;
+ let tpl = $('#messages-template[rel=template]').html();
+ if (obj.entries.length) {
+ obj.entries.forEach(function(e) {
+ html = tpl.format(
+ e.b64mid,
+ e.created,
+ e.summary,
+ e.info,
+ e.author_name,
+ e.author_addr,
+ e.href,
+ e.icon
+ );
+ $('#messages-loading').before(html);
+ });
+ }
+ else {
+ $('#messages-empty').show();
+ }
+ $('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active');
+ $('#messages-loading').hide();
+ $('.messages-timeago').timeago();
+
+ });
+ }
+</script>
diff --git a/view/tpl/notes.tpl b/view/tpl/notes.tpl
index 4bee02aa0..0ae0604ef 100644
--- a/view/tpl/notes.tpl
+++ b/view/tpl/notes.tpl
@@ -1,24 +1,18 @@
{{if $app}}
-<div class="generic-content-wrapper">
+<div id="personal-notes" class="generic-content-wrapper{{if $hidden}} d-none{{/if}}">
<div class="section-title-wrapper">
<h2>{{$banner}}</h2>
</div>
<div class="section-content-wrapper">
{{else}}
-<div class="widget">
+<div id="personal-notes" class="widget{{if $hidden}} d-none{{/if}}">
<h3>{{$banner}}</h3>
{{/if}}
- <textarea name="note_text" id="note-text">{{$text}}</textarea>
+ <textarea name="note_text" id="note-text" class="{{if $app}}form-control border-0{{/if}}">{{$text}}</textarea>
<script>
var noteSaveTimer = null;
var noteText = $('#note-text');
- $(document).ready(function(e){
- noteText.on('change keyup keydown paste cut', function () {
- noteText.height(0).height(noteText[0].scrollHeight);
- }).change();
- });
-
$(document).on('focusout',"#note-text",function(e){
if(noteSaveTimer)
clearTimeout(noteSaveTimer);
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 4fb9fcea5..19452dad7 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -1,20 +1,23 @@
-{{if $notifications}}
<script>
- var notifications_parent;
+ var sse_bs_active = false;
+ var sse_offset = 0;
+ var sse_type;
+ var sse_partial_result = false;
+ var sse_rmids = [];
+ var sse_fallback_interval;
$(document).ready(function() {
- notifications_parent = $('#notifications_wrapper')[0].parentElement.id;
+ let notifications_parent;
+ if ($('#notifications_wrapper').length) {
+ notifications_parent = $('#notifications_wrapper')[0].parentElement.id;
+ }
+
$('.notifications-btn').click(function() {
if($('#notifications_wrapper').hasClass('fs')) {
$('#notifications_wrapper').prependTo('#' + notifications_parent);
- //undo scrollbar remove
- $('section').css('height', '');
}
else {
$('#notifications_wrapper').prependTo('section');
- //remove superfluous scrollbar
- //setting overflow to hidden here has issues with some browsers
- $('section').css('height', '100vh');
}
$('#notifications_wrapper').toggleClass('fs');
@@ -23,60 +26,130 @@
}
});
- window.onpopstate = function(e) {
- if(e.state !== null && e.state.b64mid !== bParam_mid)
- getData(e.state.b64mid, '');
- };
- });
+ $(document).on('click', '.notification', function() {
+ if($('#notifications_wrapper').hasClass('fs')) {
+ $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
+ }
+ });
- {{if $module == 'display' || $module == 'hq' || $startpage == '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);
- var stateObj = { b64mid: b64mid };
+ if(sse_enabled) {
+ if(typeof(window.SharedWorker) === 'undefined') {
+ // notifications with multiple tabs open will not work very well in this scenario
+ var evtSource = new EventSource('/sse');
- if(! b64mid && ! notify_id)
- return;
+ evtSource.addEventListener('notifications', function(e) {
+ var obj = JSON.parse(e.data);
+ sse_handleNotifications(obj, false, false);
+ }, false);
- {{if $module != 'hq' && $startpage == 'hq'}}
- e.preventDefault();
- if(notify_id != null) {
- $.post(
- "hq",
- {
- "notify_id" : notify_id
+ document.addEventListener('visibilitychange', function() {
+ if (!document.hidden) {
+ sse_offset = 0;
+ sse_bs_init();
}
- );
+ }, false);
+
}
- window.location.href = 'hq/' + b64mid;
- return;
- {{else}}
- {{if $module == 'display'}}
- history.pushState(stateObj, '', 'display/' + b64mid);
- {{/if}}
-
- {{if $module == 'hq'}}
- history.pushState(stateObj, '', 'hq/' + b64mid);
- {{/if}}
-
- {{if $module == 'hq'}}
- if(b64mid) {
- {{else}}
- if(path === 'display' && b64mid) {
- {{/if}}
- e.preventDefault();
-
- if(! page_load) {
- getData(b64mid, notify_id);
+ else {
+ var myWorker = new SharedWorker('/view/js/sse_worker.js', localUser);
+
+ myWorker.port.onmessage = function(e) {
+ obj = e.data;
+ console.log(obj);
+ sse_handleNotifications(obj, false, false);
}
- if($('#notifications_wrapper').hasClass('fs'))
- $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
+ myWorker.onerror = function(e) {
+ myWorker.port.close();
+ }
+
+ myWorker.port.start();
+ }
+ }
+ else {
+ if (!document.hidden)
+ sse_fallback_interval = setInterval(sse_fallback, updateInterval);
+
+ document.addEventListener('visibilitychange', function() {
+ if (document.hidden) {
+ clearInterval(sse_fallback_interval);
+ }
+ else {
+ sse_offset = 0;
+ sse_bs_init();
+ sse_fallback_interval = setInterval(sse_fallback, updateInterval);
+ }
+
+ }, false);
+ }
+
+ $('.notification-link').on('click', { replace: true, followup: false }, sse_bs_notifications);
+
+ $('.notification-filter').on('keypress', function(e) {
+ if(e.which == 13) { // enter
+ this.blur();
+ sse_offset = 0;
+ $("#nav-" + sse_type + "-menu").html('');
+ $("#nav-" + sse_type + "-loading").show();
+
+ var cn_val = $('#cn-' + sse_type + '-input').length ? $('#cn-' + sse_type + '-input').val().toString().toLowerCase() : '';
+
+ $.get('/sse_bs/' + sse_type + '/' + sse_offset + '?nquery=' + encodeURIComponent(cn_val), function(obj) {
+ console.log('sse: bootstraping ' + sse_type);
+ console.log(obj);
+
+ sse_bs_active = false;
+ sse_partial_result = true;
+ sse_offset = obj[sse_type].offset;
+ if(sse_offset < 0)
+ $("#nav-" + sse_type + "-loading").hide();
+
+ sse_handleNotifications(obj, true, false);
+
+ });
}
- {{/if}}
+ });
+
+ $('.notifications-textinput-clear').on('click', function(e) {
+ if(! sse_partial_result)
+ return;
+
+ $("#nav-" + sse_type + "-menu").html('');
+ $("#nav-" + sse_type + "-loading").show();
+ $.get('/sse_bs/' + sse_type, function(obj) {
+ console.log('sse: bootstraping ' + sse_type);
+ console.log(obj);
+
+ sse_bs_active = false;
+ sse_partial_result = false;
+ sse_offset = obj[sse_type].offset;
+ if(sse_offset < 0)
+ $("#nav-" + sse_type + "-loading").hide();
+
+ sse_handleNotifications(obj, true, false);
+
+ });
+ });
+
+ $('.notification-content').on('scroll', function() {
+ if(this.scrollTop > this.scrollHeight - this.clientHeight - (this.scrollHeight/7)) {
+ sse_bs_notifications(sse_type, false, true);
+ }
+ });
+
+ });
+
+ $(document).on('hz:sse_setNotificationsStatus', function(e, data) {
+ sse_setNotificationsStatus(data);
+ });
+
+ $(document).on('hz:sse_bs_init', function() {
+ sse_bs_init();
+ });
+
+ $(document).on('hz:sse_bs_counts', function() {
+ sse_bs_counts();
});
- {{/if}}
{{foreach $notifications as $notification}}
{{if $notification.filter}}
@@ -88,15 +161,21 @@
else {
$('#nav-{{$notification.type}}-menu .notification[data-thread_top=false]').addClass('tt-filter-active');
$(this).addClass('active sticky-top');
+ // load more notifications if visible notifications count is low
+ if(sse_type && sse_offset != -1 && $('#nav-' + sse_type + '-menu').children(':visible').length < 15) {
+ sse_bs_notifications(sse_type, false, true);
+ }
}
});
+
$(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('cn-filter-active');
$('#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) {
@@ -122,18 +201,320 @@
{{/if}}
{{/foreach}}
- function getData(b64mid, notify_id) {
- $(document).scrollTop(0);
- $('.thread-wrapper').remove();
- bParam_mid = b64mid;
- mode = 'replace';
- page_load = true;
- {{if $module == 'hq'}}
- liveUpdate(notify_id);
- {{/if}}
- {{if $module == 'display'}}
- liveUpdate();
- {{/if}}
+ function sse_bs_init() {
+ if(sessionStorage.getItem('notification_open') !== null || typeof sse_type !== 'undefined' ) {
+ if(typeof sse_type === 'undefined')
+ sse_type = sessionStorage.getItem('notification_open');
+
+ $("#nav-" + sse_type + "-sub").addClass('show');
+ sse_bs_notifications(sse_type, true, false);
+ }
+ else {
+ sse_bs_counts();
+ }
+ }
+
+ function sse_bs_counts() {
+ if(sse_bs_active)
+ return;
+
+ sse_bs_active = true;
+
+ $.ajax({
+ type: 'post',
+ url: '/sse_bs',
+ data: { sse_rmids }
+ }).done( function(obj) {
+ console.log(obj);
+ sse_bs_active = false;
+ sse_rmids = [];
+ sse_handleNotifications(obj, true, false);
+ });
+ }
+
+ function sse_bs_notifications(e, replace, followup) {
+
+ if(sse_bs_active)
+ return;
+
+ var manual = false;
+
+ if(typeof replace === 'undefined')
+ replace = e.data.replace;
+
+ if(typeof followup === 'undefined')
+ followup = e.data.followup;
+
+ if(typeof e === 'string') {
+ sse_type = e;
+ }
+ else {
+ manual = true;
+ sse_offset = 0;
+ sse_type = e.target.dataset.sse_type;
+ }
+
+ if(typeof sse_type === 'undefined')
+ return;
+
+ if(followup || !manual || !($('#nav-' + sse_type + '-sub').hasClass('collapse') && $('#nav-' + sse_type + '-sub').hasClass('show'))) {
+
+ if(sse_offset >= 0) {
+ $("#nav-" + sse_type + "-loading").show();
+ }
+
+ sessionStorage.setItem('notification_open', sse_type);
+ if(sse_offset !== -1 || replace) {
+
+ var cn_val = (($('#cn-' + sse_type + '-input').length && sse_partial_result) ? $('#cn-' + sse_type + '-input').val().toString().toLowerCase() : '');
+
+ $("#nav-" + sse_type + "-loading").show();
+
+ sse_bs_active = true;
+
+ $.ajax({
+ type: 'post',
+ url: '/sse_bs/' + sse_type + '/' + sse_offset,
+ nquery: encodeURIComponent(cn_val),
+ data: { sse_rmids }
+ }).done(function(obj) {
+ console.log('sse: bootstraping ' + sse_type);
+ console.log(obj);
+ sse_bs_active = false;
+ sse_rmids = [];
+ $("#nav-" + sse_type + "-loading").hide();
+ sse_offset = obj[sse_type].offset;
+ sse_handleNotifications(obj, replace, followup);
+ });
+ }
+ else
+ $("#nav-" + sse_type + "-loading").hide();
+
+ }
+ else {
+ sessionStorage.removeItem('notification_open');
+ }
+ }
+
+ function sse_handleNotifications(obj, replace, followup) {
+
+ var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
+ var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
+ var all_notifications = primary_notifications.concat(secondary_notifications);
+
+ all_notifications.forEach(function(type, index) {
+ if(typeof obj[type] === typeof undefined)
+ return true;
+
+ if(obj[type].count) {
+ $('.' + type + '-button').fadeIn();
+ if(replace || followup)
+ $('.' + type + '-update').html(Number(obj[type].count));
+ else
+ $('.' + type + '-update').html(Number(obj[type].count) + Number($('.' + type + '-update').html()));
+ }
+ else {
+ $('.' + type + '-update').html('0');
+ $('.' + type + '-button').fadeOut(function() {
+ sse_setNotificationsStatus();
+ });
+ }
+ if(obj[type].notifications.length)
+ sse_handleNotificationsItems(type, obj[type].notifications, replace, followup);
+ });
+
+ sse_setNotificationsStatus();
+
+ // notice and info
+ $.jGrowl.defaults.closerTemplate = '<div>[ ' + aStr.closeAll + ']</div>';
+
+ if(obj.notice) {
+ $(obj.notice.notifications).each(function() {
+ $.jGrowl(this, { sticky: true, theme: 'notice' });
+ });
+ }
+
+ if(obj.info) {
+ $(obj.info.notifications).each(function(){
+ $.jGrowl(this, { sticky: false, theme: 'info', life: 10000 });
+ });
+ }
+
+ // load more notifications if visible notifications count becomes low
+ if(sse_type && sse_offset != -1 && $('#nav-' + sse_type + '-menu').children(':not(.tt-filter-active)').length < 15) {
+ sse_bs_notifications(sse_type, false, true);
+ }
+
+
+ }
+
+ function sse_handleNotificationsItems(notifyType, data, replace, followup) {
+
+ var notifications_tpl = ((notifyType == 'forums') ? decodeURIComponent($("#nav-notifications-forums-template[rel=template]").html().replace('data-src', 'src')) : decodeURIComponent($("#nav-notifications-template[rel=template]").html().replace('data-src', 'src')));
+ var notify_menu = $("#nav-" + notifyType + "-menu");
+ var notify_loading = $("#nav-" + notifyType + "-loading");
+ var notify_count = $("." + notifyType + "-update");
+
+ if(replace && !followup) {
+ notify_menu.html('');
+ notify_loading.hide();
+ }
+
+ $(data).each(function() {
+
+ // do not add a notification if it is already present
+ if($('#nav-' + notifyType + '-menu .notification[data-b64mid=\'' + this.b64mid + '\']').length)
+ return true;
+
+ if(!replace && !followup && (this.thread_top && notifyType === 'network')) {
+ $(document).trigger('hz:handleNetworkNotificationsItems', this);
+ }
+
+ html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids), this.body);
+ notify_menu.append(html);
+ });
+
+ if(!replace && !followup) {
+ $("#nav-" + notifyType + "-menu .notification").sort(function(a,b) {
+ a = new Date(a.dataset.when);
+ b = new Date(b.dataset.when);
+ return a > b ? -1 : a < b ? 1 : 0;
+ }).appendTo('#nav-' + notifyType + '-menu');
+ }
+
+ $("#nav-" + notifyType + "-menu .notifications-autotime").timeago();
+
+ if($('#tt-' + notifyType + '-only').hasClass('active'))
+ $('#nav-' + notifyType + '-menu [data-thread_top=false]').addClass('tt-filter-active');
+
+ if($('#cn-' + notifyType + '-input').length) {
+ var filter = $('#cn-' + notifyType + '-input').val().toString().toLowerCase();
+ if(filter) {
+ filter = filter.indexOf('%') == 0 ? filter.substring(1) : filter;
+
+ $('#nav-' + notifyType + '-menu .notification').each(function(i, el) {
+ var cn = $(el).data('contact_name').toString().toLowerCase();
+ var ca = $(el).data('contact_addr').toString().toLowerCase();
+ if(cn.indexOf(filter) === -1 && ca.indexOf(filter) === -1)
+ $(el).addClass('cn-filter-active');
+ else
+ $(el).removeClass('cn-filter-active');
+ });
+ }
+ }
+ }
+
+ function sse_updateNotifications(type, mid) {
+
+ if(type === 'pubs')
+ return true;
+
+ if(type === 'notify' && (mid !== bParam_mid || sse_type !== 'notify'))
+ return true;
+ /*
+ var count = Number($('.' + type + '-update').html());
+
+ count--;
+
+ if(count < 1) {
+ $('.' + type + '-update').html(count);
+ $('.' + type + '-button').fadeOut(function() {
+ sse_setNotificationsStatus();
+ });
+ }
+ else {
+ $('.' + type + '-update').html(count);
+ }
+ */
+
+ $('#nav-' + type + '-menu .notification[data-b64mid=\'' + mid + '\']').fadeOut(function() {
+ this.remove();
+ });
+
+ }
+
+ function sse_setNotificationsStatus(data) {
+ var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
+ var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
+ var all_notifications = primary_notifications.concat(secondary_notifications);
+
+ var primary_available = false;
+ var any_available = false;
+
+ all_notifications.forEach(function(type, index) {
+ if($('.' + type + '-button').css('display') == 'block') {
+ any_available = true;
+ if(primary_notifications.indexOf(type) > -1)
+ primary_available = true;
+ }
+ });
+
+ if(primary_available) {
+ $('.notifications-btn-icon').removeClass('fa-exclamation-circle');
+ $('.notifications-btn-icon').addClass('fa-exclamation-triangle');
+ }
+ else {
+ $('.notifications-btn-icon').removeClass('fa-exclamation-triangle');
+ $('.notifications-btn-icon').addClass('fa-exclamation-circle');
+ }
+
+ if(any_available) {
+ $('.notifications-btn').css('opacity', 1);
+ $('#no_notifications').hide();
+ $('#notifications').show();
+ }
+ else {
+ $('.notifications-btn').css('opacity', 0.5);
+ $('#navbar-collapse-1').removeClass('show');
+ $('#no_notifications').show();
+ $('#notifications').hide();
+ }
+
+ if (typeof data !== typeof undefined) {
+ data.forEach(function(nmid, index) {
+
+ sse_rmids.push(nmid);
+
+ if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
+ $('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
+ var n = this.parentElement.id.split('-');
+ return sse_updateNotifications(n[1], nmid);
+ });
+ }
+
+ // special handling for forum notifications
+ $('.notification-forum').filter(function() {
+ var fmids = decodeURIComponent($(this).data('b64mids'));
+ var n = this.parentElement.id.split('-');
+ if(fmids.indexOf(nmid) > -1) {
+ var fcount = Number($('.' + n[1] + '-update').html());
+ fcount--;
+ $('.' + n[1] + '-update').html(fcount);
+ if(fcount < 1)
+ $('.' + n[1] + '-button').fadeOut();
+
+ var count = Number($(this).find('.badge-secondary').html());
+ count--;
+ $(this).find('.badge-secondary').html(count);
+ if(count < 1)
+ $(this).remove();
+ }
+ });
+ });
+ }
+
+ }
+
+ function sse_fallback() {
+ $.get('/sse', function(obj) {
+ if(! obj)
+ return;
+
+ console.log('sse fallback');
+ console.log(obj);
+
+ sse_handleNotifications(obj, false, false);
+ });
}
</script>
@@ -142,7 +523,7 @@
{{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
<div id="nav-notifications-template" rel="template">
- <a class="list-group-item text-decoration-none text-darkclearfix notification {6}" href="{0}" title="{13}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-when="{5}">
+ <a class="list-group-item text-decoration-none text-dark clearfix notification {6}" href="{0}" title="{13}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-when="{5}">
<img class="menu-img-3" data-src="{1}" loading="lazy">
<div class="contactname"><span class="text-dark font-weight-bold">{2}</span> <span class="text-muted">{3}</span></div>
<span class="text-muted">{4}</span><br>
@@ -260,4 +641,3 @@
{{/foreach}}
</div>
</div>
-{{/if}}
diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl
index d375cf0eb..85d794f11 100644
--- a/view/tpl/photo_view.tpl
+++ b/view/tpl/photo_view.tpl
@@ -66,11 +66,13 @@
<label id="photo-edit-caption-label" for="photo-edit-caption">{{$edit.capt_label}}</label>
<input id="photo-edit-caption" class="form-control" type="text" name="desc" value="{{$edit.caption}}" />
</div>
- <div class="mb-3">
+ {{*
+ <div class="form-group">
<label id="photo-edit-tags-label" for="photo-edit-newtag">{{$edit.tag_label}}</label>
<input name="newtag" id="photo-edit-newtag" class="form-control" title="{{$edit.help_tags}}" type="text" />
</div>
- <div class="mb-3">
+ *}}
+ <div class="form-group">
{{include file="field_select.tpl" field=$edit.album_select}}
</div>
<div class="mb-3">
diff --git a/view/tpl/photos_upload.tpl b/view/tpl/photos_upload.tpl
index 4649c6e5a..95cf4e295 100644
--- a/view/tpl/photos_upload.tpl
+++ b/view/tpl/photos_upload.tpl
@@ -20,11 +20,9 @@
<input id="photos-upload-choose" type="file" name="userfile" />
</div -->
{{include file="field_input.tpl" field=$caption}}
- {{include file="field_checkbox.tpl" field=$visible}}
- <div id="body-textarea">
{{include file="field_textarea.tpl" field=$body}}
- </div>
- <div class="float-end btn-group">
+ {{include file="field_checkbox.tpl" field=$visible}}
+ <div class="pull-right btn-group">
<div class="btn-group">
{{if $lockstate}}
<button id="dbtn-acl" class="btn btn-outline-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#aclModal" onclick="return false;">
@@ -40,11 +38,10 @@
{{if $uploader}}
{{include file="field_input.tpl" field=$caption}}
- {{include file="field_checkbox.tpl" field=$visible}}
- <div id="body-textarea">
{{include file="field_textarea.tpl" field=$body}}
- </div>
- <div id="photos-upload-perms" class="btn-group float-end">
+ {{include file="field_checkbox.tpl" field=$visible}}
+
+ <div id="photos-upload-perms" class="btn-group pull-right">
{{if $lockstate}}
<button class="btn btn-outline-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#aclModal" onclick="return false;">
<i id="jot-perms-icon" class="fa fa-{{$lockstate}}"></i>
diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl
index d3dc72fe4..9797b11d8 100644
--- a/view/tpl/search_item.tpl
+++ b/view/tpl/search_item.tpl
@@ -71,6 +71,7 @@
<div class="spinner s"></div>
</div>
</div>
+ {{if $item.star || $item.thread_action_menu || $item.drop.dropping}}
<div class="btn-group">
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown">
<i class="fa fa-cog"></i>
@@ -81,14 +82,15 @@
{{/if}}
{{if $item.thread_action_menu}}
{{foreach $item.thread_action_menu as $mitem}}
- <a class="dropdown-item" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} ><i class="fa fa-fw fa-{{$mitem.icon}} generic-icons-nav"></i>{{$mitem.title}}</a></li>
+ <a class="dropdown-item" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} ><i class="fa fa-fw fa-{{$mitem.icon}} generic-icons-nav"></i>{{$mitem.title}}</a>
{{/foreach}}
{{/if}}
{{if $item.drop.dropping}}
- <a class="dropdown-item" href="item/drop/{{$item.id}}" onclick="return confirmDelete();" title="{{$item.drop.delete}}" ><i class="fa fa-fw fa-trash-o generic-icons-nav"></i>{{$item.drop.delete}}</a></li>
+ <a class="dropdown-item" href="#" onclick="dropItem('item/drop/{{$item.id}}', '#thread-wrapper-{{$item.id}}', '{{$item.mid}}'); return false;" title="{{$item.drop.delete}}" ><i class="generic-icons-nav fa fa-fw fa-trash-o"></i>{{$item.drop.delete}}</a>
{{/if}}
</div>
</div>
+ {{/if}}
</div>
{{if $item.star && $item.star.isstarred}}
<div class="btn-group" id="star-button-{{$item.id}}">
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index df3788abd..a3e68f60a 100644
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -106,7 +106,12 @@
<div class="section-content-tools-wrapper">
<div id="settings-notifications">
- {{include file="field_input.tpl" field=$mailhost}}
+ <div id="desktop-notifications-info" class="section-content-warning-wrapper" style="display: none;">
+ {{$desktop_notifications_info}}<br>
+ <a id="desktop-notifications-request" href="#">{{$desktop_notifications_request}}</a>
+ </div>
+
+ {{include file="field_input.tpl" field=$mailhost}}
<h3>{{$activity_options}}</h3>
<div class="group">