Skip to content

Commit

Permalink
Fixes to admin tickets. Added some data folders to gitignore. Investi…
Browse files Browse the repository at this point in the history
…gate and logs arent necessary in the repo.
  • Loading branch information
DavidEdwards committed Oct 12, 2014
1 parent 8196081 commit f5795e2
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
*.lk
*.int
/data/mode.txt
/data/logs
/data/investigate
2 changes: 1 addition & 1 deletion code/modules/admin/tickets/admin_ticket.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// var/msg = "<span class='boldnotice'><font color=red>New ticket created: </font>[key_name(owner, 1)] (<a href='?_src_=holder;adminmoreinfo=\ref[owner.mob]'>?</a>) (<a href='?_src_=holder;adminplayeropts=\ref[owner.mob]'>PP</a>) (<a href='?_src_=vars;Vars=\ref[owner.mob]'>VV</a>) (<a href='?_src_=holder;subtlemessage=\ref[owner.mob]'>SM</a>) (<a href='?_src_=holder;adminplayerobservejump=\ref[owner.mob]'>JMP</a>) (<a href='?_src_=holder;secretsadmin=check_antagonist'>CA</a>) [ai_found ? " (<a href='?_src_=holder;adminchecklaws=\ref[owner.mob]'>CL</a>)" : ""]:</b> [title] <a href='?src=\ref[owner];action=view_admin_ticket;ticket=\ref[src]'>View</a> <a href='?src=\ref[owner];action=monitor_admin_ticket;ticket=\ref[src]'>(Un)Monitor</a> <a href='?src=\ref[owner];action=resolve_admin_ticket;ticket=\ref[src]'>(Un)Resolve</a></span>"
var/msg = "<span class='boldnotice'><font color=red>New ticket created: </font>[key_name(owner, 1)]: [title] <b><a href='?src=\ref[owner];action=view_admin_ticket;ticket=\ref[src]'>View</a></b></span>"

log_file << msg
log_file << "<p>[msg]</p>"

//send this msg to all admins
var/admin_number_total = 0 //Total number of admins
Expand Down
43 changes: 28 additions & 15 deletions code/modules/admin/tickets/admin_ticket_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@
var/message = "[time] - <b>[calling_user]</b> - [log_message]"
log += "[message]"

world << output(message, "ViewTicketLog[ticket_id].browser:add_message")

log_file << "<p>[message]</p>"

var/found = 0

for(var/M in monitors)
M << "\"[log_message]\" added to <a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>ticket</a> by [calling_user]"
if(owner == M || calling_user == handling_admin)
break

M << "<span class='boldnotice'>\"[log_message]\" added to <a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>ticket</a> by [calling_user]</span>"
if(M == calling_user)
found = 1

if(handling_admin)
handling_admin << "\"[log_message]\" added to <a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>ticket</a> by [calling_user]"
if(handling_admin != calling_user)
handling_admin << "<span class='boldnotice'>\"[log_message]\" added to <a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>ticket</a> by [calling_user]</span>"

if(owner && calling_user != owner)
calling_user << "\"[log_message]\" added to <a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>your ticket</a> by [calling_user]"
else if(!found)
calling_user << "<a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>Your reply</a> has been noted "
owner << "<span class='boldnotice'>\"[log_message]\" added to <a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>your ticket</a> by [calling_user]</span>"

if(!found && calling_user != owner)
calling_user << "<span class='boldnotice'><a href='?src=\ref[calling_user];action=view_admin_ticket;ticket=\ref[src]'>Your reply</a> has been noted.</span>"

/datum/admin_ticket/proc/toggle_monitor(calling_user as mob)
var/found = 0
Expand All @@ -36,16 +41,16 @@
if(!found)
log_file << "<p>[calling_user] is now monitoring this ticket.</p>"
monitors += calling_user
calling_user << "You are now monitoring this ticket"
calling_user << "<span class='boldnotice'>You are now monitoring this ticket</span>"
if(owner)
owner << "[calling_user] is now monitoring your ticket"
owner << "<span class='boldnotice'>[calling_user] is now monitoring your ticket</span>"
return 1
else
log_file << "<p>[calling_user] is no longer monitoring this ticket.</p>"
monitors -= calling_user
calling_user << "You are no longer monitoring this ticket"
calling_user << "<span class='boldnotice'>You are no longer monitoring this ticket</span>"
if(owner)
owner << "[calling_user] is no longer monitoring your ticket"
owner << "<span class='boldnotice'>[calling_user] is no longer monitoring your ticket</span>"
return 0

/datum/admin_ticket/proc/view_log(mob/calling_user as mob)
Expand All @@ -54,11 +59,12 @@

var/content = ""
content += "<p class='control-bar'>[reply_link] [refresh_link]</p>"
content += "<p class='info-bar'>Primary Admin: <span id='primary-admin'>[handling_admin != null ? key_name(handling_admin, 1) : "Unassigned"]</span></p>"
content += "<p class='title-bar'>[title]</p>"
content += "<p class='info-bar'>Primary Admin: <span id='primary-admin'>[handling_admin != null ? (usr.client.holder ? key_name(handling_admin, 1) : "[handling_admin]") : "Unassigned"]</span></p>"

content += "<p id='monitors' class='[monitors.len > 0 ? "shown" : "hidden"]'>Monitors:"
for(var/M in monitors)
content += " [M]"
content += " <span class='monitor'>[M]</span>"
content += "</p>"

content += "<p class='resolved-bar [resolved ? "resolved" : "unresolved"]' id='resolved'>[resolved ? "Is resolved" : "Is not resolved"]</p>"
Expand Down Expand Up @@ -100,8 +106,15 @@
content += "<p class='user-info-bar'>Location: [location]</p>"

content += "<div id='messages'>"
for(var/line in log)
content += "<p class='message-bar'>[line]</p>"


var/i = 0
for(i = log.len; i > 0; i--)
content += "<p class='message-bar'>[log[i]]</p>"

/*for(var/line in log)
content += "<p class='message-bar'>[line]</p>"*/

content += "</div>"
content += "<p class='control-bar'>[reply_link] [refresh_link]</p>"
content += "<br /></div></body></html>"
Expand Down
29 changes: 23 additions & 6 deletions code/modules/admin/tickets/admin_ticket_templates.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
font-size: 12px;
}

.monitor {
background-color: #202020;
border: solid 1px #404040;
margin: 2px;
padding: 2px
}

.notice {
background: url(uiNoticeBackground.jpg) 0 0 repeat;
color: #15345A;
Expand All @@ -88,7 +95,7 @@

.info-bar {
margin: 4px;
padding: 4px
padding: 4px;
}

.emboldened {
Expand All @@ -102,32 +109,42 @@
padding: 2px 2px 2px 4px;
}

.title-bar {
background-color: #202020;
border: solid 1px #404040;
margin: 4px;
padding: 4px;
text-align: center;
font-size: 15px;
font-weight: bold;
}

.control-bar {
background-color: #202020;
border: solid 1px #404040;
margin: 4px;
padding: 4px
padding: 4px;
}

.resolved-bar {
background-color: #202020;
border: solid 1px #404040;
margin: 4px;
padding: 4px
padding: 4px;
}

.user-bar {
background-color: #202020;
border: solid 1px #404040;
margin: 4px;
padding: 4px
padding: 4px;
}

.ticket-bar {
background-color: #202020;
border: solid 1px #404040;
margin: 4px;
padding: 4px
padding: 4px;
}

.large-font {
Expand Down Expand Up @@ -177,7 +194,7 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type='text/javascript'>
function add_message(message) {
$('#messages').append('<p class=\"message-bar\" style=\"display: none;\">'+message+'</p>');
$('#messages').prepend('<p class=\"message-bar\" style=\"display: none;\">'+message+'</p>');

$('.message-bar').fadeIn();
}
Expand Down
52 changes: 22 additions & 30 deletions code/modules/admin/tickets/admin_ticket_topic.dm
Original file line number Diff line number Diff line change
@@ -1,81 +1,73 @@

/client/Topic(href, href_list[])
..()
var/mob/M = locate(href_list["src"])
//var/mob/M = locate(href_list["src"])
var/client/C = usr.client

if(href_list["action"] == "view_admin_ticket")
var/datum/admin_ticket/T = locate(href_list["ticket"])
// Close ticket list when opening ticket
//src << browse(null, "window=ViewTickets;size=700x500")
T.view_log(M)
T.view_log(C)
else if(href_list["action"] == "reply_to_ticket")
var/time = time2text(world.timeofday, "hh:mm")
//var/time = time2text(world.timeofday, "hh:mm")
var/datum/admin_ticket/T = locate(href_list["ticket"])

if(T.resolved && !holder)
usr << "This ticket is marked as resolved. You may not add any more information to it."
usr << "<span class='boldnotice'>This ticket is marked as resolved. You may not add any more information to it.</span>"
return

if(T.handling_admin && src != T.handling_admin && src != T.owner)
usr << "You are not the owner or primary admin of this ticket. You may not reply to it."
usr << "<span class='boldnotice'>You are not the owner or primary admin of this ticket. You may not reply to it.</span>"
return

var/logtext = input("Please enter your reply:")

if(holder && !T.handling_admin)
if(src != T.owner)
if(usr != T.owner)
T.handling_admin = src
T.add_log("[T.handling_admin] has been assigned to this ticket as primary admin.");
usr << output("[key_name(T.handling_admin, 1)]", "ViewTicketLog[T.ticket_id].browser:handling_user")
T.owner << output("[key_name(T.handling_admin, 1)]", "ViewTicketLog[T.ticket_id].browser:handling_user")

usr << output("[time] - <b>[M]</b> - [logtext]", "ViewTicketLog[T.ticket_id].browser:add_message")
if(src != T.owner)
T.owner << output("[time] - <b>[M]</b> - [logtext]", "ViewTicketLog[T.ticket_id].browser:add_message")
world << output("[T.handling_admin]", "ViewTicketLog[T.ticket_id].browser:handling_user")

if(logtext)
T.add_log(M, logtext)
T.add_log(C, logtext)
else if(href_list["action"] == "monitor_admin_ticket")
if(!holder)
return

var/datum/admin_ticket/T = locate(href_list["ticket"])
T.toggle_monitor(M)
T.toggle_monitor(C)

var/monitors_text = ""
if(T.monitors.len > 0)
monitors_text += "Monitors:"
for(var/MO in T.monitors)
monitors_text += " [MO]"
monitors_text += " <span class='monitor'>[MO]</span>"

usr << output("[monitors_text] ", "ViewTicketLog[T.ticket_id].browser:set_monitors")
if(src != T.owner)
T.owner << output("[monitors_text] ", "ViewTicketLog[T.ticket_id].browser:set_monitors")
world << output("[monitors_text] ", "ViewTicketLog[T.ticket_id].browser:set_monitors")
else if(href_list["action"] == "administer_admin_ticket")
var/datum/admin_ticket/T = locate(href_list["ticket"])
T.handling_admin = M
T.handling_admin = C
T.log_file << "<p>[T.handling_admin] has been assigned to this ticket as primary admin.</p>"
T.add_log("[T.handling_admin] has been assigned to this ticket as primary admin.");
usr << output("[key_name(src, 1)]", "ViewTicketLog[T.ticket_id].browser:handling_user")
if(src != T.owner)
T.owner << output("[key_name(src, 1)]", "ViewTicketLog[T.ticket_id].browser:handling_user")
world << output("[src != null ? "[src]" : "Unassigned"]", "ViewTicketLog[T.ticket_id].browser:handling_user")
else if(href_list["action"] == "resolve_admin_ticket")
var/datum/admin_ticket/T = locate(href_list["ticket"])
T.resolved = !T.resolved
if(T.resolved)
T.log_file << "<p>Ticket marked as resolved by [src].</p>"
T.owner << "Your ticket has been marked as resolved."
T.owner << "<span class='boldnotice'>Your ticket has been marked as resolved.</span>"
for(var/O in T.monitors)
O << "\"[T.title]\" was marked as resolved."
O << "<span class='boldnotice'>\"[T.title]\" was marked as resolved.</span>"
else
T.log_file << "<p>Ticket marked as unresolved by [src].</p>"
T.owner << "Your ticket has been marked as unresolved."
T.owner << "<span class='boldnotice'>Your ticket has been marked as unresolved.</span>"
for(var/O in T.monitors)
O << "\"[T.title]\" was marked as unresolved."
usr << output("[T.resolved]", "ViewTicketLog[T.ticket_id].browser:set_resolved")
if(src != T.owner)
T.owner << output("[T.resolved]", "ViewTicketLog[T.ticket_id].browser:set_resolved")
O << "<span class='boldnotice'>\"[T.title]\" was marked as unresolved.</span>"
world << output("[T.resolved]", "ViewTicketLog[T.ticket_id].browser:set_resolved")
else if(href_list["action"] == "refresh_admin_ticket")
var/datum/admin_ticket/T = locate(href_list["ticket"])
T.view_log(M)
T.view_log(C)
else if(href_list["action"] == "get_admin_ticket_json")
var/datum/admin_ticket/T = locate(href_list["ticket"])
world << "get_admin_ticket_json [T.title]"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/tickets/admin_ticket_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
tickets_list.Add(T)
else
var/time = time2text(world.timeofday, "hh:mm")
usr << output("[time] - <b>[found_ticket.owner]</b> - [ticket_title]", "ViewTicketLog[found_ticket.ticket_id].browser:add_message")
//usr << output("[time] - <b>[found_ticket.owner]</b> - [ticket_title]", "ViewTicketLog[found_ticket.ticket_id].browser:add_message")
if(src != found_ticket.owner)
found_ticket.owner << output("[time] - <b>[found_ticket.owner]</b> - [ticket_title]", "ViewTicketLog[found_ticket.ticket_id].browser:add_message")
found_ticket.add_log(src, ticket_title)
Expand Down
2 changes: 0 additions & 2 deletions data/investigate/gravity.html

This file was deleted.

9 changes: 0 additions & 9 deletions data/investigate/singulo.html

This file was deleted.

0 comments on commit f5795e2

Please sign in to comment.