",{}).bind('contextmenu', uimContextMenuOpen).addClass("contextMenu").attr("invId",user.id).attr("xname",formatRegCode(user.regCode));
$("",{class: "idx", text: i}).appendTo(row);
$(" | ",{class: "code", text: formatRegCode(user.regCode)}).appendTo(row);
$(" | ",{class: "", text: user.eMail}).appendTo(row);
$(" | ",{class: "", text: user.allowMultiUse?langPack.core.iface.yes:langPack.core.iface.no}).appendTo(row);
$(" | ",{class: "", text: UI.stamp2date(user.expireStamp,true)}).appendTo(row);
$(" | ",{class: "", text: user.joinGroupsId.length>0?langPack.core.iface.yes:langPack.core.iface.no}).appendTo(row);
$(" | ",{class: "button", style: "text-align: center", append: $("",{class: "fas fa-ellipsis-h"})})
.click(uimContextMenuOpen)
.appendTo(row);
$("",{append: row}).appendTo(tx);
});
})
}
function uimContextMenuOpen(el) {
let xName=$(el.target).closest("tr").attr("xname");
let xId=$(el.target).closest("tr").attr("invId");
UI.contextMenuOpen(el,[
{title: langPack.core.iface.delete, onClick: function() {
var buttons={};
buttons[langPack.core.iface.dialodDelButton]=function() {
$("#dialogInfo").dialog("close");
API.exec({
requestType: "DELETE",
method: "core/userInvitation/"+xId,
onSuccess: function(json) {
reloadInvites();
},
errDict: langPack.core.iface.users.errors,
});
};
buttons[langPack.core.iface.dialodCloseButton]=function() { $("#dialogInfo").dialog("close"); }
UI.showInfoDialog(langPack.core.iface.users.delInvDialogTitle+" "+xName,langPack.core.iface.users.delInvDialogTitle,buttons);
}},
],xName);
return false;
}
function formatRegCode(code) {
if ((typeof(code) != 'string') ||code.length==0) {
return langPack.core.iface.emptyInvCode;
} else {
return code.substr(0,4)+"-"+code.substr(4,4)+"-"+code.substr(8,4)+"-"+code.substr(12);
}
}
function btnInviteUser_Click(ref) {
var buttons={};
buttons[langPack.core.iface.dialodAddButton]=function() {
let fdata=UI.collectForm("addgrp", true,false, false,true);
if (fdata.validateErrCount==0) {
API.exec({
errDict: langPack.core.iface.users.errors,
requestType: "PUT",
data: {
eMail: fdata.email.val,
expireStamp: isset(fdata.expiration.val)?UI.date2stamp(fdata.expiration.val):undefined,
allowMultiUse: fdata.type.val,
},
method: "core/userInvitation",
onSuccess: function(json) {
UI.closeDialog('addgrp');
reloadInvites();
}
});
}
};
buttons[langPack.core.iface.dialodCloseButton]=function() { UI.closeDialog('addgrp'); }
UI.createDialog(
UI.addFieldGroup([
UI.addField({item: "dag_email", title: langPack.core.iface.users.email, type: "input"}),
UI.addField({item: "dag_type", title: langPack.core.iface.users.allowMultiUseTitle, type: "select",args: {"false":langPack.core.iface.no, "true": langPack.core.iface.yes}}),
UI.addField({item: "dag_expiration", title: langPack.core.iface.users.invitationExpire, type: "datetime", args: {curr: UI.stamp2isodate(UI.getUnixTime(1209600))}}),
]),
langPack.core.iface.dialodAddButton,
buttons,
325,1,'addgrp');
UI.openDialog('addgrp')
} |