Made default messages editible (required TeaSpeak 1.2.6)
parent
66bb1350cb
commit
0309862c7f
|
@ -59,6 +59,10 @@
|
|||
resize: none;
|
||||
}
|
||||
}
|
||||
.properties_messages textarea {
|
||||
height: 70px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 6px;
|
||||
|
|
|
@ -392,7 +392,7 @@ class ConnectionCommandHandler {
|
|||
|
||||
updates.push({key: key, value: json[key]});
|
||||
}
|
||||
this.connection._client.channelTree.server.updateVariables(...updates);
|
||||
this.connection._client.channelTree.server.updateVariables(false, ...updates);
|
||||
|
||||
|
||||
chat.serverChat().name = this.connection._client.channelTree.server.properties["virtualserver_name"];
|
||||
|
@ -757,7 +757,7 @@ class ConnectionCommandHandler {
|
|||
|
||||
updates.push({key: key, value: json[key]});
|
||||
}
|
||||
this.connection._client.channelTree.server.updateVariables(...updates);
|
||||
this.connection._client.channelTree.server.updateVariables(false, ...updates);
|
||||
if(this.connection._client.selectInfo.currentSelected == this.connection._client.channelTree.server)
|
||||
this.connection._client.selectInfo.update();
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ class ConnectionCommandHandler {
|
|||
|
||||
updates.push({key: key, value: json[key]});
|
||||
}
|
||||
this.connection._client.channelTree.server.updateVariables(...updates);
|
||||
this.connection._client.channelTree.server.updateVariables(true, ...updates);
|
||||
let info = this.connection._client.selectInfo;
|
||||
if(info.currentSelected instanceof ServerEntry)
|
||||
info.update();
|
||||
|
|
|
@ -78,6 +78,7 @@ enum PermissionType {
|
|||
B_VIRTUALSERVER_MODIFY_TEMPORARY_PASSWORDS_OWN = "b_virtualserver_modify_temporary_passwords_own",
|
||||
B_VIRTUALSERVER_MODIFY_CHANNEL_TEMP_DELETE_DELAY_DEFAULT = "b_virtualserver_modify_channel_temp_delete_delay_default",
|
||||
B_VIRTUALSERVER_MODIFY_MUSIC_BOT_LIMIT = "b_virtualserver_modify_music_bot_limit",
|
||||
B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES = "b_virtualserver_modify_music_bot_limit",
|
||||
I_CHANNEL_MIN_DEPTH = "i_channel_min_depth",
|
||||
I_CHANNEL_MAX_DEPTH = "i_channel_max_depth",
|
||||
B_CHANNEL_GROUP_INHERITANCE_END = "b_channel_group_inheritance_end",
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Modals {
|
|||
|
||||
server_applyGeneralListener(properties, modal.htmlTag.find(".properties_general"), modal.htmlTag.find(".button_ok"));
|
||||
server_applyHostListener(properties, server.properties, modal.htmlTag.find(".properties_host"), modal.htmlTag.find(".button_ok"));
|
||||
server_applyMessages(properties, server, modal.htmlTag.find(".properties_messages"));
|
||||
|
||||
modal.htmlTag.find(".button_ok").click(() => {
|
||||
modal.close();
|
||||
|
@ -93,20 +94,6 @@ namespace Modals {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
virtualserver_hostmessage
|
||||
virtualserver_hostmessage_mode X
|
||||
|
||||
virtualserver_hostbanner_url
|
||||
virtualserver_hostbanner_gfx_url
|
||||
virtualserver_hostbanner_gfx_interval
|
||||
virtualserver_hostbanner_mode X
|
||||
|
||||
virtualserver_hostbutton_tooltip
|
||||
virtualserver_hostbutton_url
|
||||
virtualserver_hostbutton_gfx_url
|
||||
|
||||
*/
|
||||
function server_applyHostListener(properties: ServerProperties, original_properties: ServerProperties, tag: JQuery, button: JQuery) {
|
||||
tag.find(".virtualserver_host").change(function (this: HTMLInputElement) {
|
||||
properties.virtualserver_host = this.value;
|
||||
|
@ -158,18 +145,26 @@ virtualserver_hostbutton_gfx_url
|
|||
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_HOSTBUTTON).granted(1));
|
||||
|
||||
}
|
||||
/*
|
||||
<!--
|
||||
virtualserver_hostmessage: string = "";
|
||||
virtualserver_hostmessage_mode: string = "";
|
||||
|
||||
virtualserver_hostbanner_url: string = "";
|
||||
virtualserver_hostbanner_gfx_url: string = "";
|
||||
virtualserver_hostbanner_gfx_interval: number = 0;
|
||||
function server_applyMessages(properties: ServerProperties, server: ServerEntry, tag: JQuery) {
|
||||
server.updateProperties().then(() => {
|
||||
tag.find(".virtualserver_default_client_description").val(server.properties.virtualserver_default_client_description);
|
||||
tag.find(".virtualserver_default_channel_description").val(server.properties.virtualserver_default_channel_description);
|
||||
tag.find(".virtualserver_default_channel_topic").val(server.properties.virtualserver_default_channel_topic);
|
||||
});
|
||||
|
||||
virtualserver_hostbutton_tooltip: string = "";
|
||||
virtualserver_hostbutton_url: string = "";
|
||||
virtualserver_hostbutton_gfx_url: string = "";
|
||||
-->
|
||||
*/
|
||||
console.log(tag);
|
||||
console.log(tag.find(".virtualserver_default_client_description"));
|
||||
tag.find(".virtualserver_default_client_description").change(function (this: HTMLInputElement) {
|
||||
properties.virtualserver_default_client_description = this.value;
|
||||
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1));
|
||||
|
||||
tag.find(".virtualserver_default_channel_description").change(function (this: HTMLInputElement) {
|
||||
properties.virtualserver_default_channel_description = this.value;
|
||||
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1));
|
||||
|
||||
tag.find(".virtualserver_default_channel_topic").change(function (this: HTMLInputElement) {
|
||||
properties.virtualserver_default_channel_topic = this.value;
|
||||
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1));
|
||||
}
|
||||
}
|
|
@ -34,6 +34,11 @@ class ServerProperties {
|
|||
virtualserver_hostbutton_tooltip: string = "";
|
||||
virtualserver_hostbutton_url: string = "";
|
||||
virtualserver_hostbutton_gfx_url: string = "";
|
||||
|
||||
//Special requested properties
|
||||
virtualserver_default_client_description: string = "";
|
||||
virtualserver_default_channel_description: string = "";
|
||||
virtualserver_default_channel_topic: string = "";
|
||||
}
|
||||
|
||||
interface ServerAddress {
|
||||
|
@ -46,6 +51,10 @@ class ServerEntry {
|
|||
channelTree: ChannelTree;
|
||||
properties: ServerProperties;
|
||||
|
||||
private info_request_promise: Promise<void> = undefined;
|
||||
private info_request_promise_resolve: any = undefined;
|
||||
private info_request_promise_reject: any = undefined;
|
||||
|
||||
lastInfoRequest: number = 0;
|
||||
nextInfoRequest: number = 0;
|
||||
private _htmlTag: JQuery<HTMLElement>;
|
||||
|
@ -109,7 +118,7 @@ class ServerEntry {
|
|||
);
|
||||
}
|
||||
|
||||
updateVariables(...variables: {key: string, value: string}[]) {
|
||||
updateVariables(is_self_notify: boolean, ...variables: {key: string, value: string}[]) {
|
||||
let group = log.group(log.LogType.DEBUG, LogCategory.SERVER, "Update properties (%i)", variables.length);
|
||||
|
||||
for(let variable of variables) {
|
||||
|
@ -125,12 +134,29 @@ class ServerEntry {
|
|||
}
|
||||
|
||||
group.end();
|
||||
if(is_self_notify && this.info_request_promise_resolve) {
|
||||
this.info_request_promise_resolve();
|
||||
this.info_request_promise = undefined;
|
||||
this.info_request_promise_reject = undefined;
|
||||
this.info_request_promise_resolve = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
updateProperties() {
|
||||
this.lastInfoRequest = new Date().getTime();
|
||||
updateProperties() : Promise<void> {
|
||||
if(this.info_request_promise && Date.now() - this.lastInfoRequest < 1000) return this.info_request_promise;
|
||||
this.lastInfoRequest = Date.now();
|
||||
this.nextInfoRequest = this.lastInfoRequest + 10 * 1000;
|
||||
this.channelTree.client.serverConnection.sendCommand("servergetvariables");
|
||||
this.channelTree.client.serverConnection.sendCommand("servergetvariables").catch(error => {
|
||||
this.info_request_promise_reject(error);
|
||||
this.info_request_promise = undefined;
|
||||
this.info_request_promise_reject = undefined;
|
||||
this.info_request_promise_resolve = undefined;
|
||||
});
|
||||
|
||||
return this.info_request_promise = new Promise<void>((resolve, reject) => {
|
||||
this.info_request_promise_reject = reject;
|
||||
this.info_request_promise_resolve = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
shouldUpdateProperties() : boolean {
|
||||
|
|
|
@ -227,7 +227,29 @@
|
|||
</x-entry>
|
||||
<x-entry>
|
||||
<x-tag>Messages</x-tag>
|
||||
<x-content>TODO!</x-content>
|
||||
<x-content>
|
||||
<div> <!-- We have to move the shit one layer up -->
|
||||
<div class="container properties_messages">
|
||||
<div class="group_box">
|
||||
<div class="header">Channel</div>
|
||||
<div class="content properties">
|
||||
<div class="key">Default Topic:</div>
|
||||
<textarea class="value virtualserver_default_channel_topic">{{>virtualserver_default_channel_topic}}</textarea>
|
||||
|
||||
<div class="key">Default Description</div>
|
||||
<textarea class="value virtualserver_default_channel_description">{{>virtualserver_default_channel_description}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group_box">
|
||||
<div class="header">Client</div>
|
||||
<div class="content properties">
|
||||
<div class="key">Default Description</div>
|
||||
<textarea class="value virtualserver_default_client_description">{{>virtualserver_default_client_description}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-content>
|
||||
</x-entry>
|
||||
</x-tab>
|
||||
</script>
|
||||
|
@ -701,7 +723,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<div style="margin-top: 10px">
|
||||
<b style="margin-bottom: 2px">Description</b>
|
||||
<node key="bbcode_channel_description"></node>
|
||||
</div>
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue