From 02ac983fba9a371727925612fc548340429009aa Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Fri, 23 May 2014 22:40:35 -0700 Subject: [PATCH] Start working on channel detail view --- lib/acp.js | 2 +- lib/server.js | 14 +++++++-- templates/acp.jade | 2 +- www/js/acp.js | 76 ++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 87 insertions(+), 7 deletions(-) diff --git a/lib/acp.js b/lib/acp.js index f7f23d0f..08933d39 100644 --- a/lib/acp.js +++ b/lib/acp.js @@ -261,7 +261,7 @@ function handleDeleteChannel(user, data) { } function handleListActiveChannels(user) { - user.socket.emit("acp-list-activechannels", Server.getServer().packChannelList(false)); + user.socket.emit("acp-list-activechannels", Server.getServer().packChannelList(false, true)); } function handleForceUnload(user, data) { diff --git a/lib/server.js b/lib/server.js index 81535558..074a1de1 100644 --- a/lib/server.js +++ b/lib/server.js @@ -194,7 +194,7 @@ Server.prototype.unloadChannel = function (chan) { chan.dead = true; }; -Server.prototype.packChannelList = function (publicOnly) { +Server.prototype.packChannelList = function (publicOnly, showMeta) { var channels = this.channels.filter(function (c) { if (!publicOnly) { return true; @@ -203,10 +203,13 @@ Server.prototype.packChannelList = function (publicOnly) { return c.modules.options && c.modules.options.get("show_public"); }); - return channels.map(this.packChannel.bind(this)); + var self = this; + return channels.map(function (c) { + return self.packChannel(c, showMeta); + }); }; -Server.prototype.packChannel = function (c) { +Server.prototype.packChannel = function (c, showMeta) { var opts = c.modules.options; var pl = c.modules.playlist; var chat = c.modules.chat; @@ -238,6 +241,11 @@ Server.prototype.packChannel = function (c) { } } + /* Add in some extra data- intended to be site admin only */ + if (showMeta) { + data.activeLockCount = c.activeLock.count; + } + return data; }; diff --git a/templates/acp.jade b/templates/acp.jade index bb042d78..a2103e35 100644 --- a/templates/acp.jade +++ b/templates/acp.jade @@ -109,7 +109,7 @@ html(lang="en") th Now Playing th Registered th Public - th Force Unload + th Control #acp-eventlog.acp-panel.col-md-12(style="display: none") h3 Event Log strong Filter event types diff --git a/www/js/acp.js b/www/js/acp.js index f2ef37c8..d5d909bd 100644 --- a/www/js/acp.js +++ b/www/js/acp.js @@ -355,6 +355,72 @@ socket.on("acp-delete-channel", function (data) { }); /* Active channels */ + +function showChannelDetailModal(c) { + var wrap = $("
").addClass("modal fade").appendTo($("body")); + var dialog = $("
").addClass("modal-dialog").appendTo(wrap); + var content = $("
").addClass("modal-content").appendTo(dialog); + var head = $("
").addClass("modal-header").appendTo(content); + $("