summaryrefslogtreecommitdiffstats
path: root/vmail-listmessages-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2010-09-09 14:34:52 +0000
committerTed Trask <ttrask01@yahoo.com>2010-09-09 14:34:52 +0000
commitba26ef8ecef31ae3bd145b276994f76e5f633ebd (patch)
tree237b0b89d7548109d73d7c213859514dd890f852 /vmail-listmessages-html.lsp
downloadacf-freeswitch-vmail-0.0.1.tar.bz2
acf-freeswitch-vmail-0.0.1.tar.xz
Initial cut - but pretty close to complete.v0.0.1
Diffstat (limited to 'vmail-listmessages-html.lsp')
-rw-r--r--vmail-listmessages-html.lsp129
1 files changed, 129 insertions, 0 deletions
diff --git a/vmail-listmessages-html.lsp b/vmail-listmessages-html.lsp
new file mode 100644
index 0000000..853d05c
--- /dev/null
+++ b/vmail-listmessages-html.lsp
@@ -0,0 +1,129 @@
+<% local view, viewlibrary, page_info, session = ...
+require("viewfunctions")
+%>
+
+<% -- Pregenerate the list of users
+if viewlibrary.check_permission("listusers") and (viewlibrary.check_permission("forwardmessage") or viewlibrary.check_permission("forwardmymessage")) then
+ local users = viewlibrary.dispatch_component("listusers", nil, true)
+ options = {}
+ for i,u in ipairs(users.value) do
+ if u.username ~= session.userinfo.userid then
+ options[#options+1] = '<option value="'..html.html_escape(u.username)..'">'..html.html_escape(u.fullname)..' ('..html.html_escape(u.username)..')</option>'
+ end
+ end
+ options = table.concat(options)
+end
+%>
+
+<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
+<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script>
+<script type="text/javascript">
+ function PlayMessage() {
+ $(".temporaryplayer").remove();
+ $(this).parent().parent().after("<tr class='temporaryplayer'><td colspan='8'><embed width='100%' height='25px' marginheight='0' marginwidth='0' frameborder='0' scrolling='no' autostart='false' autoplay='false' loop='false' src='" + $(this).attr("href") + "'></embed></TD></TR>");
+ return false;
+ }
+ function HandleMulti() {
+ var messages = [];
+ $(".multicheck:checked").each(function(){
+ messages[messages.length] = this.value;
+ });
+ $(this).parent().find("[name='message']").attr("value", messages.join(","));
+ }
+ $(document).ready(function() {
+ $("#list").tablesorter({headers: {0:{sorter: false}, 1:{sorter: false}}});
+ $("#list").bind("sortStart",function() {
+ $(".temporaryplayer").remove();
+ });
+ $(".playmessage").click(PlayMessage);
+<% if viewlibrary.check_permission("deletemessage") or viewlibrary.check_permission("deletemymessage") then %>
+ $("#multidelete").click(HandleMulti);
+<% end %>
+<% if viewlibrary.check_permission("forwardmessage") or viewlibrary.check_permission("forwardmymessage") then %>
+ $("#multiforward").click(HandleMulti);
+<% end %>
+<% if viewlibrary.check_permission("emailmessage") or viewlibrary.check_permission("emailmymessage") then %>
+ $("#multiemail").click(HandleMulti);
+<% end %>
+ });
+</script>
+
+<% displaycommandresults({"deletemessage", "deletemymessage", "forwardmessage", "forwardmymessage", "emailmessage", "emailmymessage"}, session) %>
+
+<h1>Messages</h1>
+<DL>
+<TABLE><TR><TD>
+<% if viewlibrary.check_permission("deletemessage") or viewlibrary.check_permission("deletemymessage") then %>
+ <form id="multidelete" action="<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller) %>/
+ <% if viewlibrary.check_permission("deletemessage") then io.write("deletemessage") else io.write("deletemymessage") end %>
+ " method="POST">
+ <input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
+ <input class="hidden" type="hidden" name="message" value="" >
+ <input class="submit" type="submit" value="Delete">
+ </form>
+<% end %>
+<% if viewlibrary.check_permission("forwardmessage") or viewlibrary.check_permission("forwardmymessage") then %>
+ <form id="multiforward" action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) %>/
+ <% if viewlibrary.check_permission("forwardmessage") then io.write("forwardmessage") else io.write("forwardmymessage") end %>
+ " method="POST">
+ <input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
+ <input class="hidden" type="hidden" name="message" value="" >
+ <select name="newuser"><%= (options or "") %></select>
+ <input class="submit" type="submit" value="Forward">
+ </form>
+<% end %>
+<% if viewlibrary.check_permission("emailmessage") or viewlibrary.check_permission("emailmymessage") then %>
+ <form id="multiemail" action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) %>/
+ <% if viewlibrary.check_permission("emailmessage") then io.write("emailmessage") else io.write("emailmymessage") end %>
+ " method="POST">
+ <input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
+ <input class="hidden" type="hidden" name="message" value="" >
+ <input class="text" type="text" name="address" value="" >
+ <input class="submit" type="submit" value="E-mail">
+ </form>
+<% end %>
+</TD></TR></TABLE>
+
+<TABLE id="list" class="tablesorter"><THEAD>
+ <TR style="background:#eee;font-weight:bold;">
+ <TH></TH>
+ <TH>Action</TH>
+ <TH>Date</TH>
+ <TH>Time</TH>
+ <TH>Caller ID</TH>
+ <TH>Priority</TH>
+ <TH>Orig Mailbox</Th>
+ <TH>Duration</TH>
+ </TR>
+</THEAD><TBODY>
+<% for k,v in ipairs( view.value ) do %>
+ <TR>
+ <TD><input type=checkbox class="multicheck" value="<%= html.html_escape(v.uuid) %>"></TD>
+ <TD>
+ <% if viewlibrary.check_permission("downloadmessage") then %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/downloadmessage?message="..v.uuid, label="Download "} %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/downloadmessage?message="..v.uuid, class="playmessage", label="Play "} %>
+ <% elseif viewlibrary.check_permission("downloadmymessage") then %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/downloadmymessage?message="..v.uuid, label="Download "} %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/downloadmymessage?message="..v.uuid, class="playmessage", label="Play "} %>
+ <% end %>
+ </TD>
+ <TD><%= html.html_escape(os.date("%x", v.created_epoch)) %></TD>
+ <TD><%= html.html_escape(os.date("%X", v.created_epoch)) %></TD>
+ <TD><%= html.html_escape(v.cid_number) %></TD>
+ <TD><%= html.html_escape(v.read_flags) %></TD>
+ <TD><%= html.html_escape(v.username) %></TD>
+ <TD><%= html.html_escape(v.message_len) %></TD>
+ </TR>
+<% end %>
+</TBODY>
+</TABLE>
+
+<% if view.errtxt then %>
+<p class="error"><%= html.html_escape(view.errtxt) %></p>
+<% end %>
+<% if #view.value == 0 then %>
+<p>No messages found</p>
+<% end %>
+
+</DL>