Merge pull request #7876 from MrPetovan/task/7308-backport-compose-acl
Generalize the Compose ACL to the whole site
This commit is contained in:
commit
2f2480d88d
34 changed files with 782 additions and 1197 deletions
376
view/js/acl.js
376
view/js/acl.js
|
@ -1,376 +0,0 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
|
||||
function ACL(backend_url, preset, automention, is_mobile){
|
||||
|
||||
this.url = backend_url;
|
||||
this.automention = automention;
|
||||
this.is_mobile = is_mobile;
|
||||
|
||||
|
||||
this.kp_timer = null;
|
||||
|
||||
if (preset == undefined) {
|
||||
preset = [];
|
||||
}
|
||||
this.allow_cid = (preset[0] || []);
|
||||
this.allow_gid = (preset[1] || []);
|
||||
this.deny_cid = (preset[2] || []);
|
||||
this.deny_gid = (preset[3] || []);
|
||||
this.group_uids = [];
|
||||
this.forumCache = null;
|
||||
|
||||
if (this.is_mobile) {
|
||||
this.nw = 1;
|
||||
} else {
|
||||
this.nw = 4;
|
||||
}
|
||||
|
||||
|
||||
this.list_content = $("#acl-list-content");
|
||||
this.item_tpl = unescape($(".acl-list-item[rel=acl-template]").html());
|
||||
this.showall = $("#acl-showall");
|
||||
|
||||
if (preset.length==0) {
|
||||
this.showall.addClass("selected");
|
||||
}
|
||||
|
||||
/*events*/
|
||||
this.showall.click(this.on_showall.bind(this));
|
||||
$(document).on("click", ".acl-button-show", this.on_button_show.bind(this));
|
||||
$(document).on("click", ".acl-button-hide", this.on_button_hide.bind(this));
|
||||
$("#acl-search").keypress(this.on_search.bind(this));
|
||||
$("#acl-wrapper").parents("form").submit(this.on_submit.bind(this));
|
||||
|
||||
/* add/remove mentions */
|
||||
this.element = $("#profile-jot-text");
|
||||
this.htmlelm = this.element.get()[0];
|
||||
}
|
||||
|
||||
ACL.prototype.remove_mention = function(id) {
|
||||
if (!this.automention) {
|
||||
return;
|
||||
}
|
||||
var nick = this.data[id].nick;
|
||||
var addr = this.data[id].addr;
|
||||
|
||||
if (addr != "") {
|
||||
var searchText = "!" + addr + " ";
|
||||
} else {
|
||||
var searchText = "!" + nick + "+" + id + " ";
|
||||
}
|
||||
|
||||
var start = this.element.val().indexOf(searchText);
|
||||
if (start < 0) {
|
||||
return;
|
||||
}
|
||||
var end = start + searchText.length;
|
||||
this.element.setSelection(start, end).replaceSelectedText('').collapseSelection(false);
|
||||
};
|
||||
|
||||
ACL.prototype.add_mention = function(id) {
|
||||
if (!this.automention) {
|
||||
return;
|
||||
}
|
||||
var nick = this.data[id].nick;
|
||||
var addr = this.data[id].addr;
|
||||
|
||||
if (addr != "") {
|
||||
var searchText = "!" + addr + " ";
|
||||
} else {
|
||||
var searchText = "!" + nick + "+" + id + " ";
|
||||
}
|
||||
|
||||
if (this.element.val().indexOf( searchText) >= 0 ) {
|
||||
return;
|
||||
}
|
||||
this.element.val(searchText + this.element.val()).trigger('change');
|
||||
}
|
||||
|
||||
ACL.prototype.on_submit = function(){
|
||||
var aclfields = $("#acl-fields").html("");
|
||||
$(this.allow_gid).each(function(i,v){
|
||||
aclfields.append("<input type='hidden' name='group_allow[]' value='"+v+"'>");
|
||||
});
|
||||
$(this.allow_cid).each(function(i,v){
|
||||
aclfields.append("<input type='hidden' name='contact_allow[]' value='"+v+"'>");
|
||||
});
|
||||
$(this.deny_gid).each(function(i,v){
|
||||
aclfields.append("<input type='hidden' name='group_deny[]' value='"+v+"'>");
|
||||
});
|
||||
$(this.deny_cid).each(function(i,v){
|
||||
aclfields.append("<input type='hidden' name='contact_deny[]' value='"+v+"'>");
|
||||
});
|
||||
};
|
||||
|
||||
ACL.prototype.search = function(){
|
||||
var srcstr = $("#acl-search").val();
|
||||
this.list_content.html("");
|
||||
this.get(0,100, srcstr);
|
||||
};
|
||||
|
||||
ACL.prototype.on_search = function(event){
|
||||
if (this.kp_timer) clearTimeout(this.kp_timer);
|
||||
|
||||
// Triggers an immediate search while preventing form submission
|
||||
if (event.key === 'Enter') {
|
||||
this.search();
|
||||
event.preventDefault();
|
||||
} else {
|
||||
this.kp_timer = setTimeout( this.search.bind(this), 500);
|
||||
}
|
||||
};
|
||||
|
||||
ACL.prototype.on_showall = function(event){
|
||||
event.preventDefault()
|
||||
event.stopPropagation();
|
||||
|
||||
if (this.showall.hasClass("selected")){
|
||||
return false;
|
||||
}
|
||||
this.showall.addClass("selected");
|
||||
|
||||
this.allow_cid = [];
|
||||
this.allow_gid = [];
|
||||
this.deny_cid = [];
|
||||
this.deny_gid = [];
|
||||
|
||||
this.update_view();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
ACL.prototype.on_button_show = function(event){
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
event.stopPropagation();
|
||||
|
||||
this.set_allow($(event.target).parent().attr('id'));
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
ACL.prototype.on_button_hide = function(event){
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
event.stopPropagation();
|
||||
|
||||
this.set_deny($(event.target).parent().attr('id'));
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
ACL.prototype.set_allow = function(itemid) {
|
||||
type = itemid[0];
|
||||
id = parseInt(itemid.substr(1));
|
||||
|
||||
switch (type){
|
||||
case "g":
|
||||
if (this.allow_gid.indexOf(id) < 0) {
|
||||
this.allow_gid.push(id);
|
||||
}else {
|
||||
this.allow_gid.remove(id);
|
||||
}
|
||||
if (this.deny_gid.indexOf(id) >= 0) {
|
||||
this.deny_gid.remove(id);
|
||||
}
|
||||
break;
|
||||
case "c":
|
||||
if (this.allow_cid.indexOf(id) < 0){
|
||||
this.allow_cid.push(id);
|
||||
if (this.data[id].forum == "1") {
|
||||
// If we have select already a forum,
|
||||
// we need to remove the old one (because friendica does
|
||||
// allow only one forum as receiver).
|
||||
if (this.forumCache !== null && this.forumCache !== id) {
|
||||
this.deselectCid(this.forumCache);
|
||||
}
|
||||
// Update the forum cache.
|
||||
this.forumCache = id;
|
||||
this.add_mention(id);
|
||||
}
|
||||
} else {
|
||||
this.allow_cid.remove(id);
|
||||
if (this.data[id].forum == "1") {
|
||||
this.remove_mention(id);
|
||||
}
|
||||
}
|
||||
if (this.deny_cid.indexOf(id) >=0 ) {
|
||||
this.deny_cid.remove(id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.update_view();
|
||||
};
|
||||
|
||||
ACL.prototype.set_deny = function(itemid){
|
||||
type = itemid[0];
|
||||
id = parseInt(itemid.substr(1));
|
||||
|
||||
switch(type){
|
||||
case "g":
|
||||
if (this.deny_gid.indexOf(id)<0){
|
||||
this.deny_gid.push(id)
|
||||
} else {
|
||||
this.deny_gid.remove(id);
|
||||
}
|
||||
if (this.allow_gid.indexOf(id)>=0) this.allow_gid.remove(id);
|
||||
break;
|
||||
case "c":
|
||||
if (this.data[id].forum=="1") this.remove_mention(id);
|
||||
if (this.deny_cid.indexOf(id)<0){
|
||||
this.deny_cid.push(id)
|
||||
} else {
|
||||
this.deny_cid.remove(id);
|
||||
}
|
||||
if (this.allow_cid.indexOf(id)>=0) this.allow_cid.remove(id);
|
||||
break;
|
||||
}
|
||||
this.update_view();
|
||||
};
|
||||
|
||||
ACL.prototype.is_show_all = function() {
|
||||
return (this.allow_gid.length==0 && this.allow_cid.length==0 &&
|
||||
this.deny_gid.length==0 && this.deny_cid.length==0);
|
||||
};
|
||||
|
||||
ACL.prototype.update_view = function () {
|
||||
if (this.is_show_all()) {
|
||||
this.showall.addClass("selected");
|
||||
/* jot acl */
|
||||
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
|
||||
$('#jot-public').show();
|
||||
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||
// Restores checkbox state if it had been saved
|
||||
if ($(this).attr('data-checked') !== undefined) {
|
||||
$(this).prop('checked', $(this).attr('data-checked') === 'true');
|
||||
}
|
||||
});
|
||||
|
||||
$('.profile-jot-net input').attr('disabled', false);
|
||||
if (typeof editor != 'undefined' && editor != false) {
|
||||
$('#profile-jot-desc').html(ispublic);
|
||||
}
|
||||
} else {
|
||||
this.showall.removeClass("selected");
|
||||
/* jot acl */
|
||||
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
|
||||
$('#jot-public').hide();
|
||||
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||
// Saves current checkbox state
|
||||
$(this)
|
||||
.attr('data-checked', $(this).prop('checked'))
|
||||
.prop('checked', false);
|
||||
});
|
||||
$('.profile-jot-net input').attr('disabled', 'disabled');
|
||||
$('#profile-jot-desc').html(' ');
|
||||
}
|
||||
|
||||
$("#acl-list-content .acl-list-item").each(function (index, element) {
|
||||
$(this).removeClass("groupshow grouphide");
|
||||
|
||||
itemid = $(element).attr('id');
|
||||
type = itemid[0];
|
||||
id = parseInt(itemid.substr(1));
|
||||
|
||||
btshow = $(element).children(".acl-button-show").removeClass("selected");
|
||||
bthide = $(element).children(".acl-button-hide").removeClass("selected");
|
||||
|
||||
switch (type) {
|
||||
case "g":
|
||||
var uclass = "";
|
||||
if (this.allow_gid.indexOf(id) >= 0) {
|
||||
btshow.addClass("selected");
|
||||
bthide.removeClass("selected");
|
||||
uclass = "groupshow";
|
||||
}
|
||||
if (this.deny_gid.indexOf(id) >= 0) {
|
||||
btshow.removeClass("selected");
|
||||
bthide.addClass("selected");
|
||||
uclass = "grouphide";
|
||||
}
|
||||
|
||||
$(this.group_uids[id]).each(function (i, v) {
|
||||
if (uclass == "grouphide")
|
||||
$("#c" + v).removeClass("groupshow");
|
||||
if (uclass != "") {
|
||||
var cls = $("#c" + v).attr('class');
|
||||
if (cls == undefined)
|
||||
return true;
|
||||
var hiding = cls.indexOf('grouphide');
|
||||
if (hiding == -1)
|
||||
$("#c" + v).addClass(uclass);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case "c":
|
||||
if (this.allow_cid.indexOf(id) >= 0) {
|
||||
btshow.addClass("selected");
|
||||
bthide.removeClass("selected");
|
||||
}
|
||||
if (this.deny_cid.indexOf(id) >= 0) {
|
||||
btshow.removeClass("selected");
|
||||
bthide.addClass("selected");
|
||||
}
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
|
||||
};
|
||||
|
||||
ACL.prototype.get = function(start,count, search){
|
||||
var postdata = {
|
||||
start:start,
|
||||
count:count,
|
||||
search:search,
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url: this.url,
|
||||
data: postdata,
|
||||
dataType: 'json',
|
||||
success:this.populate.bind(this)
|
||||
});
|
||||
};
|
||||
|
||||
ACL.prototype.populate = function(data){
|
||||
var height = Math.ceil(data.tot / this.nw) * 42;
|
||||
this.list_content.height(height);
|
||||
this.data = {};
|
||||
$(data.items).each(function(index, item) {
|
||||
if (item.separator != undefined) {
|
||||
html = "<hr class='clear'>";
|
||||
} else {
|
||||
html = "<div class='acl-list-item {4} {5} type{2}' title='{6}' id='{2}{3}'>"+this.item_tpl+"</div>";
|
||||
html = html.format(item.photo, item.name, item.type, item.id, (item.forum=='1'?'forum':''), item.network, item.link);
|
||||
if (item.uids != undefined) {
|
||||
this.group_uids[item.id] = item.uids;
|
||||
}
|
||||
}
|
||||
this.list_content.append(html);
|
||||
this.data[item.id] = item;
|
||||
}.bind(this));
|
||||
$(".acl-list-item img[data-src]", this.list_content).each(function(i, el){
|
||||
// Add src attribute for images with a data-src attribute
|
||||
$(el).attr('src', $(el).data("src"));
|
||||
});
|
||||
|
||||
this.update_view();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Deselect previous selected contact.
|
||||
*
|
||||
* @param {int} id The contact ID.
|
||||
* @returns {void}
|
||||
*/
|
||||
ACL.prototype.deselectCid = function(id) {
|
||||
if (this.allow_cid.indexOf(id) >= 0) {
|
||||
this.allow_cid.remove(id);
|
||||
}
|
||||
if (this.deny_cid.indexOf(id) >=0 ) {
|
||||
this.deny_cid.remove(id);
|
||||
}
|
||||
this.remove_mention(id);
|
||||
};
|
||||
// @license-end
|
155
view/js/friendica-tagsinput/friendica-tagsinput.css
Normal file
155
view/js/friendica-tagsinput/friendica-tagsinput.css
Normal file
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* friendica-tagsinput v0.8.0
|
||||
*
|
||||
* Non-Bootstrap edition
|
||||
*/
|
||||
|
||||
.label {
|
||||
display: inline;
|
||||
padding: .2em .6em .3em;
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: .25em;
|
||||
}
|
||||
|
||||
.label-default {
|
||||
background-color: #777777;
|
||||
}
|
||||
.label-default[href]:hover,
|
||||
.label-default[href]:focus {
|
||||
background-color: #5e5e5e;
|
||||
}
|
||||
.label-primary {
|
||||
background-color: #337ab7;
|
||||
}
|
||||
.label-primary[href]:hover,
|
||||
.label-primary[href]:focus {
|
||||
background-color: #286090;
|
||||
}
|
||||
.label-success {
|
||||
background-color: #5cb85c;
|
||||
}
|
||||
.label-success[href]:hover,
|
||||
.label-success[href]:focus {
|
||||
background-color: #449d44;
|
||||
}
|
||||
.label-info {
|
||||
background-color: #5bc0de;
|
||||
}
|
||||
.label-info[href]:hover,
|
||||
.label-info[href]:focus {
|
||||
background-color: #31b0d5;
|
||||
}
|
||||
.label-warning {
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
.label-warning[href]:hover,
|
||||
.label-warning[href]:focus {
|
||||
background-color: #ec971f;
|
||||
}
|
||||
.label-danger {
|
||||
background-color: #d9534f;
|
||||
}
|
||||
.label-danger[href]:hover,
|
||||
.label-danger[href]:focus {
|
||||
background-color: #c9302c;
|
||||
}
|
||||
|
||||
.form-control[disabled],
|
||||
.form-control[readonly],
|
||||
fieldset[disabled] .form-control {
|
||||
background-color: #eeeeee;
|
||||
opacity: 1;
|
||||
}
|
||||
.form-control[disabled],
|
||||
fieldset[disabled] .form-control {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.friendica-tagsinput {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
display: inline-block;
|
||||
padding: 4px 6px;
|
||||
color: #555;
|
||||
vertical-align: middle;
|
||||
border-radius: 4px;
|
||||
max-width: 100%;
|
||||
line-height: 22px;
|
||||
cursor: text;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.friendica-tagsinput.input-lg {
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.friendica-tagsinput input {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
max-width: inherit;
|
||||
}
|
||||
|
||||
.friendica-tagsinput.form-control input::-moz-placeholder {
|
||||
color: #777;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.friendica-tagsinput.form-control input:-ms-input-placeholder {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.friendica-tagsinput.form-control input::-webkit-input-placeholder {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.friendica-tagsinput input:focus {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.friendica-tagsinput .tag {
|
||||
margin: 0 2px 2px 0;
|
||||
color: white;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.friendica-tagsinput .tag img {
|
||||
width: auto;
|
||||
height: 1.5em;
|
||||
vertical-align: text-top;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.friendica-tagsinput .tag [data-role="remove"] {
|
||||
margin-left: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.friendica-tagsinput .tag [data-role="remove"]:after {
|
||||
content: "x";
|
||||
padding: 0px 2px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.friendica-tagsinput .tag [data-role="remove"]:hover {
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.friendica-tagsinput .tag [data-role="remove"]:hover:active {
|
||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
|
||||
}
|
|
@ -14,40 +14,39 @@
|
|||
$.fn.linkPreview = function (options) {
|
||||
var opts = jQuery.extend({}, $.fn.linkPreview.defaults, options);
|
||||
|
||||
var selector = $(this).selector;
|
||||
selector = selector.substr(1);
|
||||
var id = $(this).attr('id');
|
||||
|
||||
var previewTpl = '\
|
||||
<div id="preview_' + selector + '" class="preview {0}">\
|
||||
<div id="preview_' + id + '" class="preview {0}">\
|
||||
{1}\
|
||||
<input type="hidden" name="has_attachment" id="hasAttachment_' + selector + '" value="{2}" />\
|
||||
<input type="hidden" name="attachment_url" id="attachmentUrl_' + selector + '" value="{3}" />\
|
||||
<input type="hidden" name="attachment_type" id="attachmentType_' + selector + '" value="{4}" />\
|
||||
<input type="hidden" name="has_attachment" id="hasAttachment_' + id + '" value="{2}" />\
|
||||
<input type="hidden" name="attachment_url" id="attachmentUrl_' + id + '" value="{3}" />\
|
||||
<input type="hidden" name="attachment_type" id="attachmentType_' + id + '" value="{4}" />\
|
||||
</div>';
|
||||
|
||||
var attachmentTpl = '\
|
||||
<hr class="previewseparator">\
|
||||
<div id="closePreview_' + selector + '" title="Remove" class="closePreview" >\
|
||||
<div id="closePreview_' + id + '" title="Remove" class="closePreview" >\
|
||||
<button type="button" class="previewActionBtn">×</button>\
|
||||
</div>\
|
||||
<div id="previewImages_' + selector + '" class="previewImages">\
|
||||
<div id="previewImgBtn_' + selector + '" class="previewImgBtn">\
|
||||
<button type="button" id="previewChangeImg_' + selector + '" class="buttonChangeDeactive previewActionBtn" style="display: none">\
|
||||
<div id="previewImages_' + id + '" class="previewImages">\
|
||||
<div id="previewImgBtn_' + id + '" class="previewImgBtn">\
|
||||
<button type="button" id="previewChangeImg_' + id + '" class="buttonChangeDeactive previewActionBtn" style="display: none">\
|
||||
<i class="fa fa-exchange" aria-hidden="true"></i>\
|
||||
</button>\
|
||||
</div>\
|
||||
<div id="previewImage_' + selector + '" class="previewImage">\
|
||||
<div id="previewImage_' + id + '" class="previewImage">\
|
||||
</div>\
|
||||
<input type="hidden" id="photoNumber_' + selector + '" class="photoNumber" value="0" />\
|
||||
<input type="hidden" name="attachment_img_src" id="attachmentImageSrc_' + selector + '" value="" />\
|
||||
<input type="hidden" name="attachment_img_width" id="attachmentImageWidth_' + selector + '" value="0" />\
|
||||
<input type="hidden" name="attachment_img_height" id="attachmentImageHeight_' + selector + '" value="0" />\
|
||||
<input type="hidden" id="photoNumber_' + id + '" class="photoNumber" value="0" />\
|
||||
<input type="hidden" name="attachment_img_src" id="attachmentImageSrc_' + id + '" value="" />\
|
||||
<input type="hidden" name="attachment_img_width" id="attachmentImageWidth_' + id + '" value="0" />\
|
||||
<input type="hidden" name="attachment_img_height" id="attachmentImageHeight_' + id + '" value="0" />\
|
||||
</div>\
|
||||
<div id="previewContent_' + selector + '" class="previewContent">\
|
||||
<h4 id="previewTitle_' + selector + '" class="previewTitle"></h4>\
|
||||
<blockquote id="previewDescription_' + selector + '" class="previewDescription"></blockquote>\
|
||||
<div id="hiddenDescription_' + selector + '" class="hiddenDescription"></div>\
|
||||
<sup id="previewUrl_' + selector + '" class="previewUrl"></sup>\
|
||||
<div id="previewContent_' + id + '" class="previewContent">\
|
||||
<h4 id="previewTitle_' + id + '" class="previewTitle"></h4>\
|
||||
<blockquote id="previewDescription_' + id + '" class="previewDescription"></blockquote>\
|
||||
<div id="hiddenDescription_' + id + '" class="hiddenDescription"></div>\
|
||||
<sup id="previewUrl_' + id + '" class="previewUrl"></sup>\
|
||||
</div>\
|
||||
<div class="clear"></div>\
|
||||
<hr class="previewseparator">';
|
||||
|
@ -72,7 +71,7 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
var init = function() {
|
||||
$('#' + selector).bind({
|
||||
$('#' + id).bind({
|
||||
paste: function () {
|
||||
setTimeout(function () {
|
||||
crawlText();
|
||||
|
@ -88,7 +87,7 @@
|
|||
|
||||
// Check if we have already attachment bbcode in the textarea
|
||||
// and add it to the attachment preview.
|
||||
var content = $('#' + selector).val();
|
||||
var content = $('#' + id).val();
|
||||
addBBCodeToPreview(content);
|
||||
};
|
||||
|
||||
|
@ -98,7 +97,7 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
var resetPreview = function() {
|
||||
$('#hasAttachment_' + selector).val(0);
|
||||
$('#hasAttachment_' + id).val(0);
|
||||
photoNumber = 0;
|
||||
images = "";
|
||||
};
|
||||
|
@ -121,7 +120,7 @@
|
|||
// If no text is passed to crawlText() we
|
||||
// take the previous word before the cursor.
|
||||
if (typeof text === 'undefined') {
|
||||
text = getPrevWord(selector);
|
||||
text = getPrevWord(id);
|
||||
} else {
|
||||
isExtern = true;
|
||||
}
|
||||
|
@ -254,7 +253,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
$('#photoNumber_' + selector).val(0);
|
||||
$('#photoNumber_' + id).val(0);
|
||||
resetPreview();
|
||||
|
||||
processAttachmentTpl(data, 'type-' + data.type);
|
||||
|
@ -275,7 +274,7 @@
|
|||
*/
|
||||
var processAttachmentTpl = function(data) {
|
||||
// Load and add the template if it isn't allready loaded.
|
||||
if ($('#preview_' + selector).length === 0) {
|
||||
if ($('#preview_' + id).length === 0) {
|
||||
var tpl = previewTpl.format(
|
||||
'type-' + data.type,
|
||||
attachmentTpl,
|
||||
|
@ -283,7 +282,7 @@
|
|||
bin2hex(data.url),
|
||||
data.type
|
||||
);
|
||||
$('#' + selector).after(tpl);
|
||||
$('#' + id).after(tpl);
|
||||
}
|
||||
|
||||
isActive = true;
|
||||
|
@ -303,14 +302,14 @@
|
|||
description = defaultDescription;
|
||||
}
|
||||
|
||||
$('#previewTitle_' + selector).html("\
|
||||
<span id='previewSpanTitle_" + selector + "' class='previewSpanTitle' >" + escapeHTML(data.title) + "</span>\
|
||||
<input type='text' name='attachment_title' value='" + escapeHTML(data.title) + "' id='previewInputTitle_" + selector + "' class='previewInputTitle inputPreview' style='display: none;'/>"
|
||||
$('#previewTitle_' + id).html("\
|
||||
<span id='previewSpanTitle_" + id + "' class='previewSpanTitle' >" + escapeHTML(data.title) + "</span>\
|
||||
<input type='text' name='attachment_title' value='" + escapeHTML(data.title) + "' id='previewInputTitle_" + id + "' class='previewInputTitle inputPreview' style='display: none;'/>"
|
||||
);
|
||||
|
||||
$('#previewDescription_' + selector).html("\
|
||||
<span id='previewSpanDescription_" + selector + "' class='previewSpanDescription' >" + escapeHTML(description) + "</span>\n\
|
||||
<textarea id='previewInputDescription_" + selector + "' name='attachment_text' class='previewInputDescription' style='display: none;' class='inputPreview' >" + escapeHTML(data.text) + "</textarea>"
|
||||
$('#previewDescription_' + id).html("\
|
||||
<span id='previewSpanDescription_" + id + "' class='previewSpanDescription' >" + escapeHTML(description) + "</span>\n\
|
||||
<textarea id='previewInputDescription_" + id + "' name='attachment_text' class='previewInputDescription' style='display: none;' class='inputPreview' >" + escapeHTML(data.text) + "</textarea>"
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -325,7 +324,7 @@
|
|||
var regexpr = "(https?://)([^:^/]*)(:\\d*)?(.*)?";
|
||||
var regResult = url.match(regexpr);
|
||||
var urlHost = regResult[1] + regResult[2];
|
||||
$('#previewUrl_' + selector).html("<a href='" + url + "'>" + urlHost + "</a>");
|
||||
$('#previewUrl_' + id).html("<a href='" + url + "'>" + urlHost + "</a>");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -340,12 +339,12 @@
|
|||
var imageClass = 'attachment-preview';
|
||||
|
||||
if (Array.isArray(images)) {
|
||||
$('#previewImages_' + selector).show();
|
||||
$('#attachmentImageSrc_' + selector).val(bin2hex(images[photoNumber].src));
|
||||
$('#attachmentImageWidth_' + selector).val(images[photoNumber].width);
|
||||
$('#attachmentImageHeight_' + selector).val(images[photoNumber].height);
|
||||
$('#previewImages_' + id).show();
|
||||
$('#attachmentImageSrc_' + id).val(bin2hex(images[photoNumber].src));
|
||||
$('#attachmentImageWidth_' + id).val(images[photoNumber].width);
|
||||
$('#attachmentImageHeight_' + id).val(images[photoNumber].height);
|
||||
} else {
|
||||
$('#previewImages_' + selector).hide();
|
||||
$('#previewImages_' + id).hide();
|
||||
}
|
||||
|
||||
images.length = parseInt(images.length);
|
||||
|
@ -359,26 +358,26 @@
|
|||
}
|
||||
|
||||
if (i === 0) {
|
||||
appendImage += "<img id='imagePreview_" + selector + "_" + i + "' src='" + images[i].src + "' class='" + imageClass + "' ></img>";
|
||||
appendImage += "<img id='imagePreview_" + id + "_" + i + "' src='" + images[i].src + "' class='" + imageClass + "' ></img>";
|
||||
} else {
|
||||
appendImage += "<img id='imagePreview_" + selector + "_" + i + "' src='" + images[i].src + "' class='" + imageClass + "' style='display: none;'></img>";
|
||||
appendImage += "<img id='imagePreview_" + id + "_" + i + "' src='" + images[i].src + "' class='" + imageClass + "' style='display: none;'></img>";
|
||||
}
|
||||
}
|
||||
|
||||
$('#previewImage_' + selector).html(appendImage + "<div id='whiteImage' style='color: transparent; display:none;'>...</div>");
|
||||
$('#previewImage_' + id).html(appendImage + "<div id='whiteImage' style='color: transparent; display:none;'>...</div>");
|
||||
|
||||
// More than just one image.
|
||||
if (images.length > 1) {
|
||||
// Enable the the button to change the preview pictures.
|
||||
$('#previewChangeImg_' + selector).show();
|
||||
$('#previewChangeImg_' + id).show();
|
||||
|
||||
if (firstPosted === false) {
|
||||
firstPosted = true;
|
||||
|
||||
$('#previewChangeImg_' + selector).unbind('click').click(function (e) {
|
||||
$('#previewChangeImg_' + id).unbind('click').click(function (e) {
|
||||
e.stopPropagation();
|
||||
if (images.length > 1) {
|
||||
$('#imagePreview_' + selector + '_' + photoNumber).css({
|
||||
$('#imagePreview_' + id + '_' + photoNumber).css({
|
||||
'display': 'none'
|
||||
});
|
||||
photoNumber += 1;
|
||||
|
@ -388,13 +387,13 @@
|
|||
photoNumber = 0;
|
||||
}
|
||||
|
||||
$('#imagePreview_' + selector + '_' + photoNumber).css({
|
||||
$('#imagePreview_' + id + '_' + photoNumber).css({
|
||||
'display': 'block'
|
||||
});
|
||||
$('#photoNumber_' + selector).val(photoNumber);
|
||||
$('#attachmentImageSrc_' + selector).val(bin2hex(images[photoNumber].src));
|
||||
$('#attachmentImageWidth_' + selector).val(images[photoNumber].width);
|
||||
$('#attachmentImageHeight_' + selector).val(images[photoNumber].height);
|
||||
$('#photoNumber_' + id).val(photoNumber);
|
||||
$('#attachmentImageSrc_' + id).val(bin2hex(images[photoNumber].src));
|
||||
$('#attachmentImageWidth_' + id).val(images[photoNumber].width);
|
||||
$('#attachmentImageHeight_' + id).val(images[photoNumber].height);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -407,94 +406,94 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
var processEventListener = function() {
|
||||
$('#previewSpanTitle_' + selector).unbind('click').click(function (e) {
|
||||
$('#previewSpanTitle_' + id).unbind('click').click(function (e) {
|
||||
e.stopPropagation();
|
||||
if (blockTitle === false) {
|
||||
blockTitle = true;
|
||||
$('#previewSpanTitle_' + selector).hide();
|
||||
$('#previewInputTitle_' + selector).show();
|
||||
$('#previewInputTitle_' + selector).val($('#previewInputTitle_' + selector).val());
|
||||
$('#previewInputTitle_' + selector).focus().select();
|
||||
$('#previewSpanTitle_' + id).hide();
|
||||
$('#previewInputTitle_' + id).show();
|
||||
$('#previewInputTitle_' + id).val($('#previewInputTitle_' + id).val());
|
||||
$('#previewInputTitle_' + id).focus().select();
|
||||
}
|
||||
});
|
||||
|
||||
$('#previewInputTitle_' + selector).blur(function () {
|
||||
$('#previewInputTitle_' + id).blur(function () {
|
||||
blockTitle = false;
|
||||
$('#previewSpanTitle_' + selector).html($('#previewInputTitle_' + selector).val());
|
||||
$('#previewSpanTitle_' + selector).show();
|
||||
$('#previewInputTitle_' + selector).hide();
|
||||
$('#previewSpanTitle_' + id).html($('#previewInputTitle_' + id).val());
|
||||
$('#previewSpanTitle_' + id).show();
|
||||
$('#previewInputTitle_' + id).hide();
|
||||
});
|
||||
|
||||
$('#previewInputTitle_' + selector).keypress(function (e) {
|
||||
$('#previewInputTitle_' + id).keypress(function (e) {
|
||||
if (e.which === 13) {
|
||||
blockTitle = false;
|
||||
$('#previewSpanTitle_' + selector).html($('#previewInputTitle_' + selector).val());
|
||||
$('#previewSpanTitle_' + selector).show();
|
||||
$('#previewInputTitle_' + selector).hide();
|
||||
$('#previewSpanTitle_' + id).html($('#previewInputTitle_' + id).val());
|
||||
$('#previewSpanTitle_' + id).show();
|
||||
$('#previewInputTitle_' + id).hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#previewSpanDescription_' + selector).unbind('click').click(function (e) {
|
||||
$('#previewSpanDescription_' + id).unbind('click').click(function (e) {
|
||||
e.stopPropagation();
|
||||
if (blockDescription === false) {
|
||||
blockDescription = true;
|
||||
$('#previewSpanDescription_' + selector).hide();
|
||||
$('#previewInputDescription_' + selector).show();
|
||||
$('#previewInputDescription_' + selector).val($('#previewInputDescription_' + selector).val());
|
||||
$('#previewInputDescription_' + selector).focus().select();
|
||||
$('#previewSpanDescription_' + id).hide();
|
||||
$('#previewInputDescription_' + id).show();
|
||||
$('#previewInputDescription_' + id).val($('#previewInputDescription_' + id).val());
|
||||
$('#previewInputDescription_' + id).focus().select();
|
||||
}
|
||||
});
|
||||
|
||||
$('#previewInputDescription_' + selector).blur(function () {
|
||||
$('#previewInputDescription_' + id).blur(function () {
|
||||
blockDescription = false;
|
||||
$('#previewSpanDescription_' + selector).html($('#previewInputDescription_' + selector).val());
|
||||
$('#previewSpanDescription_' + selector).show();
|
||||
$('#previewInputDescription_' + selector).hide();
|
||||
$('#previewSpanDescription_' + id).html($('#previewInputDescription_' + id).val());
|
||||
$('#previewSpanDescription_' + id).show();
|
||||
$('#previewInputDescription_' + id).hide();
|
||||
});
|
||||
|
||||
$('#previewInputDescription_' + selector).keypress(function (e) {
|
||||
$('#previewInputDescription_' + id).keypress(function (e) {
|
||||
if (e.which === 13) {
|
||||
blockDescription = false;
|
||||
$('#previewSpanDescription_' + selector).html($('#previewInputDescription_' + selector).val());
|
||||
$('#previewSpanDescription_' + selector).show();
|
||||
$('#previewInputDescription_' + selector).hide();
|
||||
$('#previewSpanDescription_' + id).html($('#previewInputDescription_' + id).val());
|
||||
$('#previewSpanDescription_' + id).show();
|
||||
$('#previewInputDescription_' + id).hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#previewSpanTitle_' + selector).mouseover(function () {
|
||||
$('#previewSpanTitle_' + selector).css({
|
||||
$('#previewSpanTitle_' + id).mouseover(function () {
|
||||
$('#previewSpanTitle_' + id).css({
|
||||
"background-color": "#ff9"
|
||||
});
|
||||
});
|
||||
|
||||
$('#previewSpanTitle_' + selector).mouseout(function () {
|
||||
$('#previewSpanTitle_' + selector).css({
|
||||
$('#previewSpanTitle_' + id).mouseout(function () {
|
||||
$('#previewSpanTitle_' + id).css({
|
||||
"background-color": "transparent"
|
||||
});
|
||||
});
|
||||
|
||||
$('#previewSpanDescription_' + selector).mouseover(function () {
|
||||
$('#previewSpanDescription_' + selector).css({
|
||||
$('#previewSpanDescription_' + id).mouseover(function () {
|
||||
$('#previewSpanDescription_' + id).css({
|
||||
"background-color": "#ff9"
|
||||
});
|
||||
});
|
||||
|
||||
$('#previewSpanDescription_' + selector).mouseout(function () {
|
||||
$('#previewSpanDescription_' + selector).css({
|
||||
$('#previewSpanDescription_' + id).mouseout(function () {
|
||||
$('#previewSpanDescription_' + id).css({
|
||||
"background-color": "transparent"
|
||||
});
|
||||
});
|
||||
|
||||
$('#closePreview_' + selector).unbind('click').click(function (e) {
|
||||
$('#closePreview_' + id).unbind('click').click(function (e) {
|
||||
e.stopPropagation();
|
||||
block = false;
|
||||
images = '';
|
||||
isActive = false;
|
||||
firstPosted = false;
|
||||
$('#preview_' + selector).fadeOut("fast", function () {
|
||||
$('#preview_' + selector).remove();
|
||||
$('#preview_' + id).fadeOut("fast", function () {
|
||||
$('#preview_' + id).remove();
|
||||
$('#profile-rotator').hide();
|
||||
$('#' + selector).focus();
|
||||
$('#' + id).focus();
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -628,8 +627,8 @@
|
|||
reAddAttachment(attachmentData);
|
||||
// Remove the attachment bbcode from the textarea.
|
||||
var content = content.replace(/\[attachment[\s\S]*\[\/attachment]/im, '');
|
||||
$('#' + selector).val(content);
|
||||
$('#' + selector).focus();
|
||||
$('#' + id).val(content);
|
||||
$('#' + id).focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -676,16 +675,16 @@
|
|||
}
|
||||
|
||||
if (image !== '') {
|
||||
var appendImage = "<img id='imagePreview_" + selector + "' src='" + image + "' class='" + imageClass + "' ></img>"
|
||||
$('#previewImage_' + selector).html(appendImage);
|
||||
$('#attachmentImageSrc_' + selector).val(bin2hex(image));
|
||||
var appendImage = "<img id='imagePreview_" + id + "' src='" + image + "' class='" + imageClass + "' ></img>"
|
||||
$('#previewImage_' + id).html(appendImage);
|
||||
$('#attachmentImageSrc_' + id).val(bin2hex(image));
|
||||
|
||||
// We need to add the image widht and height when it is
|
||||
// loaded.
|
||||
$('<img/>' ,{
|
||||
load : function(){
|
||||
$('#attachmentImageWidth_' + selector).val(this.width);
|
||||
$('#attachmentImageHeight_' + selector).val(this.height);
|
||||
$('#attachmentImageWidth_' + id).val(this.width);
|
||||
$('#attachmentImageHeight_' + id).val(this.height);
|
||||
},
|
||||
src : image
|
||||
});
|
||||
|
@ -751,8 +750,8 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
var destroy = function() {
|
||||
$('#' + selector).unbind();
|
||||
$('#preview_' + selector).remove();
|
||||
$('#' + id).unbind();
|
||||
$('#preview_' + id).remove();
|
||||
binurl;
|
||||
block = false;
|
||||
blockTitle = false;
|
||||
|
@ -764,7 +763,7 @@
|
|||
firstPosted = false;
|
||||
isActive = false;
|
||||
isCrawling = false;
|
||||
selector = "";
|
||||
id = "";
|
||||
};
|
||||
|
||||
var trim = function(str) {
|
||||
|
|
|
@ -764,11 +764,10 @@ function showHideComments(id) {
|
|||
}
|
||||
|
||||
function preview_post() {
|
||||
$("#jot-preview").val("1");
|
||||
$("#jot-preview-content").show();
|
||||
$.post(
|
||||
"item",
|
||||
$("#profile-jot-form").serialize(),
|
||||
$("#profile-jot-form").serialize() + '&preview=1',
|
||||
function(data) {
|
||||
if (data.preview) {
|
||||
$("#jot-preview-content").html(data.preview);
|
||||
|
@ -778,7 +777,6 @@ function preview_post() {
|
|||
},
|
||||
"json"
|
||||
);
|
||||
$("#jot-preview").val("0");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,58 +1,263 @@
|
|||
|
||||
<div id="acl-wrapper">
|
||||
<input id="acl-search" autocomplete="off">
|
||||
<a id="acl-showall">{{$showall}}</a>
|
||||
<div id="acl-list">
|
||||
<div id="acl-list-content">
|
||||
<div class="panel-group" id="visibility-accordion" role="tablist" aria-multiselectable="true">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading{{if $visibility != 'public'}} collapsed{{/if}}" id="visibility-public-heading" aria-expanded="{{if $visibility == 'public'}}true{{else}}false{{/if}}">
|
||||
<label>
|
||||
<input type="radio" name="visibility" id="visibility-public" value="public" tabindex="14" {{if $visibility == 'public'}}checked{{/if}}>
|
||||
<i class="fa fa-globe"></i> {{$public_title}}
|
||||
</label>
|
||||
</div>
|
||||
<fieldset id="visibility-public-panel" class="panel-collapse collapse{{if $visibility == 'public'}} in{{/if}}" role="tabpanel" aria-labelledby="visibility-public-heading" {{if $visibility != 'public'}}disabled{{/if}}>
|
||||
<div class="panel-body">
|
||||
<p>{{$public_desc}}</p>
|
||||
{{if $for_federation}}
|
||||
{{if $user_hidewall}}
|
||||
<h4>{{$jotnets_summary}}</h4>
|
||||
{{$jotnets_disabled_label}}
|
||||
{{elseif $jotnets_fields}}
|
||||
{{if $jotnets_fields|count < 3}}
|
||||
<div class="profile-jot-net">
|
||||
{{else}}
|
||||
<details class="profile-jot-net">
|
||||
<summary>{{$jotnets_summary}}</summary>
|
||||
{{/if}}
|
||||
|
||||
{{foreach $jotnets_fields as $jotnets_field}}
|
||||
{{if $jotnets_field.type == 'checkbox'}}
|
||||
{{include file="field_checkbox.tpl" field=$jotnets_field.field}}
|
||||
{{elseif $jotnets_field.type == 'select'}}
|
||||
{{include file="field_select.tpl" field=$jotnets_field.field}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $jotnets_fields|count >= 3}}
|
||||
</details>
|
||||
{{else}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading{{if $visibility != 'custom'}} collapsed{{/if}}" id="visibility-custom-heading" aria-expanded="{{if $visibility == 'custom'}}true{{else}}false{{/if}}">
|
||||
<label>
|
||||
<input type="radio" name="visibility" id="visibility-custom" value="custom" tabindex="15" {{if $visibility == 'custom'}}checked{{/if}}>
|
||||
<i class="fa fa-lock"></i> {{$custom_title}}
|
||||
</label>
|
||||
</div>
|
||||
<fieldset id="visibility-custom-panel" class="panel-collapse collapse{{if $visibility == 'custom'}} in{{/if}}" role="tabpanel" aria-labelledby="visibility-custom-heading" {{if $visibility != 'custom'}}disabled{{/if}}>
|
||||
<input type="hidden" name="group_allow" value="{{$group_allow}}"/>
|
||||
<input type="hidden" name="contact_allow" value="{{$contact_allow}}"/>
|
||||
<input type="hidden" name="group_deny" value="{{$group_deny}}"/>
|
||||
<input type="hidden" name="contact_deny" value="{{$contact_deny}}"/>
|
||||
<div class="panel-body">
|
||||
<p>{{$custom_desc}}</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="acl_allow">{{$allow_label}}</label>
|
||||
<input type="text" class="form-control input-lg" id="acl_allow">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="acl_deny">{{$deny_label}}</label>
|
||||
<input type="text" class="form-control input-lg" id="acl_deny">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<span id="acl-fields"></span>
|
||||
</div>
|
||||
|
||||
<div class="acl-list-item" rel="acl-template" style="display:none">
|
||||
<img data-src="{0}"><p>{1}</p>
|
||||
<a class='acl-button-show'>{{$show}}</a>
|
||||
<a class='acl-button-hide'>{{$hide}}</a>
|
||||
</div>
|
||||
|
||||
{{if $networks}}
|
||||
<hr style="clear:both"/>
|
||||
<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle}}" />
|
||||
<div id="profile-jot-email-end"></div>
|
||||
|
||||
{{if $jotnets_fields}}
|
||||
{{if $jotnets_fields|count < 3}}
|
||||
<div class="profile-jot-net">
|
||||
{{else}}
|
||||
<details class="profile-jot-net">
|
||||
<summary>{{$jotnets_summary}}</summary>
|
||||
{{/if}}
|
||||
|
||||
{{foreach $jotnets_fields as $jotnets_field}}
|
||||
{{if $jotnets_field.type == 'checkbox'}}
|
||||
{{include file="field_checkbox.tpl" field=$jotnets_field.field}}
|
||||
{{elseif $jotnets_field.type == 'select'}}
|
||||
{{include file="field_select.tpl" field=$jotnets_field.field}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $jotnets_fields|count >= 3}}
|
||||
</details>
|
||||
{{else}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $for_federation}}
|
||||
<div class="form-group">
|
||||
<label for="profile-jot-email" id="profile-jot-email-label">{{$emailcc}}</label>
|
||||
<input type="text" name="emailcc" id="profile-jot-email" class="form-control" title="{{$emtitle}}" />
|
||||
</div>
|
||||
<div id="profile-jot-email-end"></div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
let $acl_allow_input = $('#acl_allow');
|
||||
let $contact_allow_input = $('[name=contact_allow]');
|
||||
let $group_allow_input = $('[name=group_allow]');
|
||||
let $acl_deny_input = $('#acl_deny');
|
||||
let $contact_deny_input = $('[name=contact_deny]');
|
||||
let $group_deny_input = $('[name=group_deny]');
|
||||
let $visibility_public_panel = $('#visibility-public-panel');
|
||||
let $visibility_custom_panel = $('#visibility-custom-panel');
|
||||
let $visibility_public_radio = $('#visibility-public');
|
||||
let $visibility_custom_radio = $('#visibility-custom');
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
if(typeof acl=="undefined"){
|
||||
acl = new ACL(
|
||||
baseurl + '/search/acl',
|
||||
[ {{$allowcid nofilter}},{{$allowgid nofilter}},{{$denycid nofilter}},{{$denygid nofilter}} ],
|
||||
{{$features.aclautomention}},
|
||||
{{if $APP->is_mobile}}true{{else}}false{{/if}}
|
||||
);
|
||||
}
|
||||
});
|
||||
// Frio specific
|
||||
if ($.fn.collapse) {
|
||||
$visibility_public_panel.collapse({parent: '#visibility-accordion', toggle: false});
|
||||
$visibility_custom_panel.collapse({parent: '#visibility-accordion', toggle: false});
|
||||
}
|
||||
|
||||
$visibility_public_radio.on('change', function (e) {
|
||||
if ($.fn.collapse) {
|
||||
$visibility_public_panel.collapse('show');
|
||||
}
|
||||
|
||||
$visibility_public_panel.prop('disabled', false);
|
||||
$visibility_custom_panel.prop('disabled', true);
|
||||
|
||||
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||
// Restores checkbox state if it had been saved
|
||||
if ($(this).attr('data-checked') !== undefined) {
|
||||
$(this).prop('checked', $(this).attr('data-checked') === 'true');
|
||||
}
|
||||
});
|
||||
$('.profile-jot-net input').attr('disabled', false);
|
||||
});
|
||||
|
||||
$visibility_custom_radio.on('change', function(e) {
|
||||
if ($.fn.collapse) {
|
||||
$visibility_custom_panel.collapse('show');
|
||||
}
|
||||
|
||||
$visibility_public_panel.prop('disabled', true);
|
||||
$visibility_custom_panel.prop('disabled', false);
|
||||
|
||||
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||
// Saves current checkbox state
|
||||
$(this)
|
||||
.attr('data-checked', $(this).prop('checked'))
|
||||
.prop('checked', false);
|
||||
});
|
||||
$('.profile-jot-net input').attr('disabled', 'disabled');
|
||||
});
|
||||
|
||||
// Custom visibility tags inputs
|
||||
let acl_groups = new Bloodhound({
|
||||
local: {{$acl_groups|@json_encode nofilter}},
|
||||
identify: function(obj) { return obj.id; },
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name']),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
});
|
||||
let acl_contacts = new Bloodhound({
|
||||
local: {{$acl_contacts|@json_encode nofilter}},
|
||||
identify: function(obj) { return obj.id; },
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
});
|
||||
let acl = new Bloodhound({
|
||||
local: {{$acl_list|@json_encode nofilter}},
|
||||
identify: function(obj) { return obj.id; },
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
});
|
||||
acl.initialize();
|
||||
|
||||
let suggestionTemplate = function (item) {
|
||||
return '<div><img src="' + item.micro + '" alt="" style="float: left; width: auto; height: 2.8em; margin-right: 0.5em;"> <strong>' + item.name + '</strong><br /><em>' + item.addr + '</em></div>';
|
||||
};
|
||||
|
||||
$acl_allow_input.tagsinput({
|
||||
confirmKeys: [13, 44],
|
||||
freeInput: false,
|
||||
tagClass: function(item) {
|
||||
switch (item.type) {
|
||||
case 'group' : return 'label label-primary';
|
||||
case 'contact' :
|
||||
default:
|
||||
return 'label label-info';
|
||||
}
|
||||
},
|
||||
itemValue: 'id',
|
||||
itemText: 'name',
|
||||
itemThumb: 'micro',
|
||||
itemTitle: function(item) {
|
||||
return item.addr;
|
||||
},
|
||||
typeaheadjs: {
|
||||
name: 'contacts',
|
||||
displayKey: 'name',
|
||||
templates: {
|
||||
suggestion: suggestionTemplate
|
||||
},
|
||||
source: acl.ttAdapter()
|
||||
}
|
||||
});
|
||||
|
||||
$acl_deny_input
|
||||
.tagsinput({
|
||||
confirmKeys: [13, 44],
|
||||
freeInput: false,
|
||||
tagClass: function(item) {
|
||||
switch (item.type) {
|
||||
case 'group' : return 'label label-primary';
|
||||
case 'contact' :
|
||||
default:
|
||||
return 'label label-info';
|
||||
}
|
||||
},
|
||||
itemValue: 'id',
|
||||
itemText: 'name',
|
||||
itemThumb: 'micro',
|
||||
itemTitle: function(item) {
|
||||
return item.addr;
|
||||
},
|
||||
typeaheadjs: {
|
||||
name: 'contacts',
|
||||
displayKey: 'name',
|
||||
templates: {
|
||||
suggestion: suggestionTemplate
|
||||
},
|
||||
source: acl.ttAdapter()
|
||||
}
|
||||
});
|
||||
|
||||
// Import existing ACL into the tags input fields.
|
||||
|
||||
$group_allow_input.val().split(',').forEach(function (val) {
|
||||
$acl_allow_input.tagsinput('add', acl_groups.get(val)[0]);
|
||||
});
|
||||
$contact_allow_input.val().split(',').forEach(function (val) {
|
||||
$acl_allow_input.tagsinput('add', acl_contacts.get(val)[0]);
|
||||
});
|
||||
$group_deny_input.val().split(',').forEach(function (val) {
|
||||
$acl_deny_input.tagsinput('add', acl_groups.get(val)[0]);
|
||||
});
|
||||
$contact_deny_input.val().split(',').forEach(function (val) {
|
||||
$acl_deny_input.tagsinput('add', acl_contacts.get(val)[0]);
|
||||
});
|
||||
|
||||
// Anti-duplicate callback + acl fields value generation
|
||||
|
||||
$acl_allow_input.on('itemAdded', function (event) {
|
||||
// Removes duplicate in the opposite acl box
|
||||
$acl_deny_input.tagsinput('remove', event.item);
|
||||
|
||||
// Update the real acl field
|
||||
$group_allow_input.val('');
|
||||
$contact_allow_input.val('');
|
||||
[].forEach.call($acl_allow_input.tagsinput('items'), function (item) {
|
||||
if (item.type === 'group') {
|
||||
$group_allow_input.val($group_allow_input.val() + ',' + item.id);
|
||||
} else {
|
||||
$contact_allow_input.val($contact_allow_input.val() + ',' + item.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$acl_deny_input.on('itemAdded', function (event) {
|
||||
// Removes duplicate in the opposite acl box
|
||||
$acl_allow_input.tagsinput('remove', event.item);
|
||||
|
||||
// Update the real acl field
|
||||
$group_deny_input.val('');
|
||||
$contact_deny_input.val('');
|
||||
[].forEach.call($acl_deny_input.tagsinput('items'), function (item) {
|
||||
if (item.type === 'group') {
|
||||
$group_deny_input.val($group_allow_input.val() + ',' + item.id);
|
||||
} else {
|
||||
$contact_deny_input.val($contact_allow_input.val() + ',' + item.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
<script type="text/javascript" src="view/asset/jquery-datetimepicker/build/jquery.datetimepicker.full.min.js"></script>
|
||||
<script type="text/javascript" src="view/asset/perfect-scrollbar/js/perfect-scrollbar.jquery.min.js" ></script>
|
||||
<script type="text/javascript" src="view/asset/imagesloaded/imagesloaded.pkgd.min.js"></script>
|
||||
<script type="text/javascript" src="view/js/acl.js" ></script>
|
||||
<script type="text/javascript" src="view/asset/base64/base64.min.js" ></script>
|
||||
<script type="text/javascript" src="view/asset/dompurify/dist/purify.min.js"></script>
|
||||
<script type="text/javascript" src="view/js/main.js" ></script>
|
||||
|
|
|
@ -1,250 +0,0 @@
|
|||
<script type="text/javascript">
|
||||
function updateLocationButtonDisplay(location_button, location_input)
|
||||
{
|
||||
location_button.classList.remove('btn-primary');
|
||||
if (location_input.value) {
|
||||
location_button.disabled = false;
|
||||
location_button.classList.add('btn-primary');
|
||||
location_button.title = location_button.dataset.titleClear;
|
||||
} else if (!"geolocation" in navigator) {
|
||||
location_button.disabled = true;
|
||||
location_button.title = location_button.dataset.titleUnavailable;
|
||||
} else if (location_button.disabled) {
|
||||
location_button.title = location_button.dataset.titleDisabled;
|
||||
} else {
|
||||
location_button.title = location_button.dataset.titleSet;
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// Jot attachment live preview.
|
||||
let $textarea = $('#comment-edit-text-0');
|
||||
$textarea.linkPreview();
|
||||
$textarea.keyup(function(){
|
||||
var textlen = $(this).val().length;
|
||||
$('#character-counter').text(textlen);
|
||||
});
|
||||
$textarea.editor_autocomplete(baseurl + '/search/acl');
|
||||
$textarea.bbco_autocomplete('bbcode');
|
||||
|
||||
let $acl_allow_input = $('#acl_allow');
|
||||
let $group_allow_input = $('[name=group_allow]');
|
||||
let $contact_allow_input = $('[name=contact_allow]');
|
||||
let $acl_deny_input = $('#acl_deny');
|
||||
let $group_deny_input = $('[name=group_deny]');
|
||||
let $contact_deny_input = $('[name=contact_deny]');
|
||||
|
||||
// Visibility accordion
|
||||
|
||||
// Prevents open panel to collapse
|
||||
// @see https://stackoverflow.com/a/43593116
|
||||
$('[data-toggle="collapse"]').click(function(e) {
|
||||
target = $(this).attr('href');
|
||||
if ($(target).hasClass('in')) {
|
||||
e.preventDefault(); // to stop the page jump to the anchor target.
|
||||
e.stopPropagation()
|
||||
}
|
||||
});
|
||||
// Accessibility: enable space and enter to open a panel when focused
|
||||
$('body').on('keyup', '[data-toggle="collapse"]:focus', function (e) {
|
||||
if (e.key === ' ' || e.key === 'Enter') {
|
||||
$(this).click();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
$('#visibility-public-panel').on('show.bs.collapse', function() {
|
||||
$('#visibility-public').prop('checked', true);
|
||||
$group_allow_input.prop('disabled', true);
|
||||
$contact_allow_input.prop('disabled', true);
|
||||
$group_deny_input.prop('disabled', true);
|
||||
$contact_deny_input.prop('disabled', true);
|
||||
|
||||
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||
// Restores checkbox state if it had been saved
|
||||
if ($(this).attr('data-checked') !== undefined) {
|
||||
$(this).prop('checked', $(this).attr('data-checked') === 'true');
|
||||
}
|
||||
});
|
||||
$('.profile-jot-net input').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#visibility-custom-panel').on('show.bs.collapse', function() {
|
||||
$('#visibility-custom').prop('checked', true);
|
||||
$group_allow_input.prop('disabled', false);
|
||||
$contact_allow_input.prop('disabled', false);
|
||||
$group_deny_input.prop('disabled', false);
|
||||
$contact_deny_input.prop('disabled', false);
|
||||
|
||||
$('.profile-jot-net input[type=checkbox]').each(function() {
|
||||
// Saves current checkbox state
|
||||
$(this)
|
||||
.attr('data-checked', $(this).prop('checked'))
|
||||
.prop('checked', false);
|
||||
});
|
||||
$('.profile-jot-net input').attr('disabled', 'disabled');
|
||||
});
|
||||
|
||||
if (document.querySelector('input[name="visibility"]:checked').value === 'custom') {
|
||||
$('#visibility-custom-panel').collapse({parent: '#visibility-accordion'});
|
||||
}
|
||||
|
||||
// Custom visibility tags inputs
|
||||
|
||||
let acl_groups = new Bloodhound({
|
||||
local: {{$acl_groups|@json_encode nofilter}},
|
||||
identify: function(obj) { return obj.id; },
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name']),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
});
|
||||
let acl_contacts = new Bloodhound({
|
||||
local: {{$acl_contacts|@json_encode nofilter}},
|
||||
identify: function(obj) { return obj.id; },
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
});
|
||||
let acl = new Bloodhound({
|
||||
local: {{$acl|@json_encode nofilter}},
|
||||
identify: function(obj) { return obj.id; },
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
});
|
||||
acl.initialize();
|
||||
|
||||
let suggestionTemplate = function (item) {
|
||||
return '<div><img src="' + item.micro + '" alt="" style="float: left; width: auto; height: 2.8em; margin-right: 0.5em;"> <strong>' + item.name + '</strong><br /><em>' + item.addr + '</em></div>';
|
||||
};
|
||||
|
||||
$acl_allow_input.tagsinput({
|
||||
confirmKeys: [13, 44],
|
||||
freeInput: false,
|
||||
tagClass: function(item) {
|
||||
switch (item.type) {
|
||||
case 'group' : return 'label label-primary';
|
||||
case 'contact' :
|
||||
default:
|
||||
return 'label label-info';
|
||||
}
|
||||
},
|
||||
itemValue: 'id',
|
||||
itemText: 'name',
|
||||
itemThumb: 'micro',
|
||||
itemTitle: function(item) {
|
||||
return item.addr;
|
||||
},
|
||||
typeaheadjs: {
|
||||
name: 'contacts',
|
||||
displayKey: 'name',
|
||||
templates: {
|
||||
suggestion: suggestionTemplate
|
||||
},
|
||||
source: acl.ttAdapter()
|
||||
}
|
||||
});
|
||||
|
||||
$acl_deny_input
|
||||
.tagsinput({
|
||||
confirmKeys: [13, 44],
|
||||
freeInput: false,
|
||||
tagClass: function(item) {
|
||||
switch (item.type) {
|
||||
case 'group' : return 'label label-primary';
|
||||
case 'contact' :
|
||||
default:
|
||||
return 'label label-info';
|
||||
}
|
||||
},
|
||||
itemValue: 'id',
|
||||
itemText: 'name',
|
||||
itemThumb: 'micro',
|
||||
itemTitle: function(item) {
|
||||
return item.addr;
|
||||
},
|
||||
typeaheadjs: {
|
||||
name: 'contacts',
|
||||
displayKey: 'name',
|
||||
templates: {
|
||||
suggestion: suggestionTemplate
|
||||
},
|
||||
source: acl.ttAdapter()
|
||||
}
|
||||
});
|
||||
|
||||
// Import existing ACL into the tags input fields.
|
||||
|
||||
$group_allow_input.val().split(',').forEach(function (val) {
|
||||
$acl_allow_input.tagsinput('add', acl_groups.get(val)[0]);
|
||||
});
|
||||
$contact_allow_input.val().split(',').forEach(function (val) {
|
||||
$acl_allow_input.tagsinput('add', acl_contacts.get(val)[0]);
|
||||
});
|
||||
$group_deny_input.val().split(',').forEach(function (val) {
|
||||
$acl_deny_input.tagsinput('add', acl_groups.get(val)[0]);
|
||||
});
|
||||
$contact_deny_input.val().split(',').forEach(function (val) {
|
||||
$acl_deny_input.tagsinput('add', acl_contacts.get(val)[0]);
|
||||
});
|
||||
|
||||
// Anti-duplicate callback + acl fields value generation
|
||||
|
||||
$acl_allow_input.on('itemAdded', function (event) {
|
||||
// Removes duplicate in the opposite acl box
|
||||
$acl_deny_input.tagsinput('remove', event.item);
|
||||
|
||||
// Update the real acl field
|
||||
$group_allow_input.val('');
|
||||
$contact_allow_input.val('');
|
||||
[].forEach.call($acl_allow_input.tagsinput('items'), function (item) {
|
||||
if (item.type === 'group') {
|
||||
$group_allow_input.val($group_allow_input.val() + '<' + item.id + '>');
|
||||
} else {
|
||||
$contact_allow_input.val($contact_allow_input.val() + '<' + item.id + '>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$acl_deny_input.on('itemAdded', function (event) {
|
||||
// Removes duplicate in the opposite acl box
|
||||
$acl_allow_input.tagsinput('remove', event.item);
|
||||
|
||||
// Update the real acl field
|
||||
$group_deny_input.val('');
|
||||
$contact_deny_input.val('');
|
||||
[].forEach.call($acl_deny_input.tagsinput('items'), function (item) {
|
||||
if (item.type === 'group') {
|
||||
$group_deny_input.val($group_allow_input.val() + '<' + item.id + '>');
|
||||
} else {
|
||||
$contact_deny_input.val($contact_allow_input.val() + '<' + item.id + '>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let location_button = document.getElementById('profile-location');
|
||||
let location_input = document.getElementById('jot-location');
|
||||
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
|
||||
location_input.addEventListener('change', function () {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
location_input.addEventListener('keyup', function () {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
|
||||
location_button.addEventListener('click', function() {
|
||||
if (location_input.value) {
|
||||
location_input.value = '';
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
} else if ("geolocation" in navigator) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
location_input.value = position.coords.latitude + ', ' + position.coords.longitude;
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
}, function (error) {
|
||||
location_button.disabled = true;
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
|
@ -74,82 +74,18 @@
|
|||
|
||||
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
|
||||
|
||||
<input type="hidden" name="group_allow" value="{{$group_allow}}" {{if $visibility == 'public'}}disabled{{/if}}/>
|
||||
<input type="hidden" name="contact_allow" value="{{$contact_allow}}" {{if $visibility == 'public'}}disabled{{/if}}/>
|
||||
<input type="hidden" name="group_deny" value="{{$group_deny}}" {{if $visibility == 'public'}}disabled{{/if}}/>
|
||||
<input type="hidden" name="contact_deny" value="{{$contact_deny}}" {{if $visibility == 'public'}}disabled{{/if}}/>
|
||||
{{if $type == 'post'}}
|
||||
<h3>Visibility</h3>
|
||||
<div class="panel-group" id="visibility-accordion" role="tablist" aria-multiselectable="true">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading" id="visibility-public-heading" role="button" data-toggle="collapse" data-parent="#visibility-accordion" href="#visibility-public-panel" aria-expanded="true" aria-controls="visibility-public-panel" tabindex="14">
|
||||
<label>
|
||||
<input type="radio" name="visibility" id="visibility-public" value="public" {{if $visibility == 'public'}}checked{{/if}} style="display:none">
|
||||
<i class="fa fa-globe"></i> {{$public_title}}
|
||||
</label>
|
||||
</div>
|
||||
<div id="visibility-public-panel" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="visibility-public-heading">
|
||||
<div class="panel-body">
|
||||
<p>{{$public_desc}}</p>
|
||||
{{if $doesFederate && $jotnets_fields}}
|
||||
{{if $jotnets_fields|count < 3}}
|
||||
<div class="profile-jot-net">
|
||||
{{else}}
|
||||
<details class="profile-jot-net">
|
||||
<summary>{{$jotnets_summary}}</summary>
|
||||
{{/if}}
|
||||
<h3>{{$visibility_title}}</h3>
|
||||
{{$acl_selector nofilter}}
|
||||
|
||||
{{foreach $jotnets_fields as $jotnets_field}}
|
||||
{{if $jotnets_field.type == 'checkbox'}}
|
||||
{{include file="field_checkbox.tpl" field=$jotnets_field.field}}
|
||||
{{elseif $jotnets_field.type == 'select'}}
|
||||
{{include file="field_select.tpl" field=$jotnets_field.field}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $jotnets_fields|count >= 3}}
|
||||
</details>
|
||||
{{else}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading collapsed" id="visibility-custom-heading" role="button" data-toggle="collapse" data-parent="#visibility-accordion" href="#visibility-custom-panel" aria-expanded="true" aria-controls="visibility-custom-panel" tabindex="15">
|
||||
<label>
|
||||
<input type="radio" name="visibility" id="visibility-custom" value="custom" {{if $visibility == 'custom'}}checked{{/if}} style="display:none">
|
||||
<i class="fa fa-lock"></i> {{$custom_title}}
|
||||
</label>
|
||||
</div>
|
||||
<div id="visibility-custom-panel" class="panel-collapse collapse" role="tabpanel" aria-labelledby="visibility-custom-heading">
|
||||
<div class="panel-body">
|
||||
<p>{{$custom_desc}}</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="acl_allow">Deliver to:</label>
|
||||
<input type="text" class="form-control input-lg" id="acl_allow">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="acl_deny">Except to:</label>
|
||||
<input type="text" class="form-control input-lg" id="acl_deny">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{if $doesFederate}}
|
||||
<div class="form-group">
|
||||
<label for="profile-jot-email" id="profile-jot-email-label">{{$emailcc}}</label>
|
||||
<input type="text" name="emailcc" id="profile-jot-email" class="form-control" title="{{$emtitle}}" />
|
||||
</div>
|
||||
<div id="profile-jot-email-end"></div>
|
||||
{{/if}}
|
||||
<div class="jotplugins">
|
||||
{{$jotplugins nofilter}}
|
||||
</div>
|
||||
{{else}}
|
||||
<input type="hidden" name="group_allow" value="{{$group_allow}}"/>
|
||||
<input type="hidden" name="contact_allow" value="{{$contact_allow}}"/>
|
||||
<input type="hidden" name="group_deny" value="{{$group_deny}}"/>
|
||||
<input type="hidden" name="contact_deny" value="{{$contact_deny}}"/>
|
||||
{{/if}}
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* friendica-tagsinput v0.8.0
|
||||
*
|
||||
*/
|
||||
|
||||
.friendica-tagsinput {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
display: inline-block;
|
||||
padding: 4px 6px;
|
||||
color: #555;
|
||||
vertical-align: middle;
|
||||
border-radius: 4px;
|
||||
max-width: 100%;
|
||||
line-height: 22px;
|
||||
cursor: text;
|
||||
height: auto;
|
||||
}
|
||||
.friendica-tagsinput.input-lg {
|
||||
line-height: 27px;
|
||||
}
|
||||
.friendica-tagsinput input {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
max-width: inherit;
|
||||
}
|
||||
.friendica-tagsinput.form-control input::-moz-placeholder {
|
||||
color: #777;
|
||||
opacity: 1;
|
||||
}
|
||||
.friendica-tagsinput.form-control input:-ms-input-placeholder {
|
||||
color: #777;
|
||||
}
|
||||
.friendica-tagsinput.form-control input::-webkit-input-placeholder {
|
||||
color: #777;
|
||||
}
|
||||
.friendica-tagsinput input:focus {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.friendica-tagsinput .tag {
|
||||
margin: 0 2px 2px 0;
|
||||
color: white;
|
||||
font-weight: normal;
|
||||
}
|
||||
.friendica-tagsinput .tag img {
|
||||
width: auto;
|
||||
height: 1.5em;
|
||||
vertical-align: text-top;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.friendica-tagsinput .tag [data-role="remove"] {
|
||||
margin-left: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.friendica-tagsinput .tag [data-role="remove"]:after {
|
||||
content: "x";
|
||||
padding: 0px 2px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.friendica-tagsinput .tag [data-role="remove"]:hover {
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.friendica-tagsinput .tag [data-role="remove"]:hover:active {
|
||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
|
||||
}
|
57
view/theme/frio/js/compose.js
Normal file
57
view/theme/frio/js/compose.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
$(function() {
|
||||
// Jot attachment live preview.
|
||||
let $textarea = $('textarea[name=body]');
|
||||
$textarea.linkPreview();
|
||||
$textarea.keyup(function(){
|
||||
var textlen = $(this).val().length;
|
||||
$('#character-counter').text(textlen);
|
||||
});
|
||||
$textarea.editor_autocomplete(baseurl + '/search/acl');
|
||||
$textarea.bbco_autocomplete('bbcode');
|
||||
|
||||
let location_button = document.getElementById('profile-location');
|
||||
let location_input = document.getElementById('jot-location');
|
||||
|
||||
if (location_button && location_input) {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
|
||||
location_input.addEventListener('change', function () {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
location_input.addEventListener('keyup', function () {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
|
||||
location_button.addEventListener('click', function() {
|
||||
if (location_input.value) {
|
||||
location_input.value = '';
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
} else if ("geolocation" in navigator) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
location_input.value = position.coords.latitude + ', ' + position.coords.longitude;
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
}, function (error) {
|
||||
location_button.disabled = true;
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function updateLocationButtonDisplay(location_button, location_input)
|
||||
{
|
||||
location_button.classList.remove('btn-primary');
|
||||
if (location_input.value) {
|
||||
location_button.disabled = false;
|
||||
location_button.classList.add('btn-primary');
|
||||
location_button.title = location_button.dataset.titleClear;
|
||||
} else if (!"geolocation" in navigator) {
|
||||
location_button.disabled = true;
|
||||
location_button.title = location_button.dataset.titleUnavailable;
|
||||
} else if (location_button.disabled) {
|
||||
location_button.title = location_button.dataset.titleDisabled;
|
||||
} else {
|
||||
location_button.title = location_button.dataset.titleSet;
|
||||
}
|
||||
}
|
|
@ -49,24 +49,6 @@ $(document).ready(function() {
|
|||
$("#event-preview").empty();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Construct a new ACL. We need this everytime the 'event-edit-form' is loaded
|
||||
// without page reloading (e.g. closing an old modal and open a new modal).
|
||||
// Otherwise we wouldn't get the ACL data.
|
||||
/// @todo: Try to implement some kind of ACL reloading in acl.js.
|
||||
|
||||
var eventPerms = document.getElementById('event-edit-form');
|
||||
|
||||
acl = new ACL(
|
||||
baseurl + '/search/acl',
|
||||
[
|
||||
JSON.parse(eventPerms.dataset.allow_cid),
|
||||
JSON.parse(eventPerms.dataset.allow_gid),
|
||||
JSON.parse(eventPerms.dataset.deny_cid),
|
||||
JSON.parse(eventPerms.dataset.deny_gid)
|
||||
]
|
||||
);
|
||||
acl.get(0, 100);
|
||||
});
|
||||
|
||||
// Load the html of the actual event and incect the output to the
|
||||
|
|
|
@ -344,11 +344,11 @@ function toggleJotNav (elm) {
|
|||
|
||||
// Minimize all tab content wrapper and activate only the selected
|
||||
// tab panel.
|
||||
$('#jot-modal [role=tabpanel]').addClass("minimize").attr("aria-hidden" ,"true");
|
||||
$('#jot-modal #' + tabpanel).removeClass("minimize").attr("aria-hidden" ,"false");
|
||||
$('#profile-jot-form > [role=tabpanel]').addClass("minimize").attr("aria-hidden" ,"true");
|
||||
$('#' + tabpanel).removeClass("minimize").attr("aria-hidden" ,"false");
|
||||
|
||||
// Set the aria-selected states
|
||||
$("#jot-modal .nav-tabs .jot-nav-lnk").attr("aria-selected", "false");
|
||||
$("#jot-modal .modal-header .nav-tabs .jot-nav-lnk").attr("aria-selected", "false");
|
||||
elm.setAttribute("aria-selected", "true");
|
||||
|
||||
// For some some tab panels we need to execute other js functions.
|
||||
|
|
|
@ -98,7 +98,6 @@ $("nav").bind('nav-update', function(e,data)
|
|||
});
|
||||
</script>
|
||||
<script src="<?=$frio?>/js/theme.js"></script>
|
||||
<script src="<?=$frio?>/js/acl.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/jasny/js/jasny-bootstrap.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/bootstrap-select/js/bootstrap-select.min.js"></script>
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
<div id="acl-wrapper">
|
||||
<div class="form-group form-group-search">
|
||||
<button id="acl-showall" class="btn btn-block btn-default"><i class="fa fa-globe"></i> {{$showall}}</button>
|
||||
</div>
|
||||
<div class="form-group form-group-search">
|
||||
<input type="text" id="acl-search" class="form-control form-search" autocomplete="off">
|
||||
</div>
|
||||
<div id="acl-list">
|
||||
<div id="acl-list-content"></div>
|
||||
</div>
|
||||
<span id="acl-fields"></span>
|
||||
</div>
|
||||
|
||||
<div class="acl-list-item" rel="acl-template" style="display:none">
|
||||
<img data-src="{0}" alt="{1}"><p>{1}</p>
|
||||
<button class='acl-button-hide btn btn-sm btn-default'>{{$hide}}</button>
|
||||
<button class='acl-button-show btn btn-sm btn-default'>{{$show}}</button>
|
||||
</div>
|
||||
|
||||
{{if $networks}}
|
||||
<hr style="clear:both"/>
|
||||
<div class="form-group">
|
||||
<label for="profile-jot-email" id="profile-jot-email-label">{{$emailcc}}</label>
|
||||
<input type="text" name="emailcc" id="profile-jot-email" class="form-control" title="{{$emtitle}}" />
|
||||
</div>
|
||||
<div id="profile-jot-email-end"></div>
|
||||
|
||||
{{if $jotnets_fields}}
|
||||
{{if $jotnets_fields|count < 3}}
|
||||
<div class="profile-jot-net">
|
||||
{{else}}
|
||||
<details class="profile-jot-net">
|
||||
<summary>{{$jotnets_summary}}</summary>
|
||||
{{/if}}
|
||||
|
||||
{{foreach $jotnets_fields as $jotnets_field}}
|
||||
{{if $jotnets_field.type == 'checkbox'}}
|
||||
{{include file="field_checkbox.tpl" field=$jotnets_field.field}}
|
||||
{{elseif $jotnets_field.type == 'select'}}
|
||||
{{include file="field_select.tpl" field=$jotnets_field.field}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $jotnets_fields|count >= 3}}
|
||||
</details>
|
||||
{{else}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
if(typeof acl=="undefined"){
|
||||
acl = new ACL(
|
||||
baseurl + '/search/acl',
|
||||
[ {{$allowcid nofilter}},{{$allowgid nofilter}},{{$denycid nofilter}},{{$denygid nofilter}} ],
|
||||
{{$features.aclautomention}},
|
||||
{{if $APP->is_mobile}}true{{else}}false{{/if}}
|
||||
);
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -30,7 +30,7 @@
|
|||
</ul>
|
||||
|
||||
<div id="event-edit-form-wrapper">
|
||||
<form id="event-edit-form" action="{{$post}}" method="post" data-allow_cid="{{$allow_cid}}" data-allow_gid="{{$allow_gid}}" data-deny_cid="{{$deny_cid}}" data-deny_gid="{{$deny_gid}}">
|
||||
<form id="event-edit-form" action="{{$post}}" method="post">
|
||||
|
||||
<input type="hidden" name="event_id" value="{{$eid}}" />
|
||||
<input type="hidden" name="cid" value="{{$cid}}" />
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
<script type="text/javascript" src="view/asset/jquery-datetimepicker/build/jquery.datetimepicker.full.min.js"></script>
|
||||
<script type="text/javascript" src="view/asset/perfect-scrollbar/js/perfect-scrollbar.jquery.min.js"></script>
|
||||
<script type="text/javascript" src="view/asset/imagesloaded/imagesloaded.pkgd.min.js"></script>
|
||||
<script type="text/javascript" src="view/js/acl.js"></script>
|
||||
<script type="text/javascript" src="view/asset/base64/base64.min.js"></script>
|
||||
<script type="text/javascript" src="view/asset/dompurify/dist/purify.min.js"></script>
|
||||
<script type="text/javascript" src="view/js/main.js"></script>
|
||||
|
|
|
@ -70,9 +70,6 @@
|
|||
<div style="display: none;">
|
||||
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
|
||||
{{$acl nofilter}}
|
||||
<hr style="clear:both"/>
|
||||
<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle}}" />
|
||||
<div id="profile-jot-email-end"></div>
|
||||
{{$jotnets nofilter}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue